| 
					
				 | 
			
			
				@@ -12,7 +12,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @package QBF 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// $Id: qbf.module,v 1.9.2.4 2008-10-04 17:01:32 marand Exp $ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// $Id: qbf.module,v 1.9.2.5 2008-10-05 18:27:13 marand Exp $ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Saved error reporting level. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -337,7 +337,7 @@ function qbf_after_build($form, $form_values) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return $form; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // If #post is not emtpy, we are indeed querying 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // If #post is not empty, we are indeed querying 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $arQuery = _qbf_extract_query($form, $form_values); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /* This function is called at the end of the form building process, which 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -556,28 +556,24 @@ function _qbf_save($form_id, $form_values) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    $arRemoved = array 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      'form_id', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      'form_token', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      'form_build_id', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      'op', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $form = drupal_retrieve_form($form_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    drupal_prepare_form($form_id, $form); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $name = $form_values['save-name']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $form_values = _qbf_extract_query($form, $form_values); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $arValues = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     foreach ($form_values as $key => $value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    	if (empty($value) || in_array($key, $arRemoved)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	if (empty($value)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	  continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	$arValues[$key] = $value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-dsm($arValues); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $sq = 'INSERT INTO {%s} (qid, uid, name, query) ' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          ."VALUES           (%d,  %d,  '%s', '%s' ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $ret = db_next_id('qbf_qid'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    $q = db_query($sq, QBF_TABLE_NAME, $ret, $user->uid, $form_values['save-name'], serialize($arValues)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $q = db_query($sq, QBF_TABLE_NAME, $ret, $user->uid, $name, serialize($arValues)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return $ret; 
			 |