Index: /sandbox/webservice/api/rest/dispatch.php
===================================================================
--- /sandbox/webservice/api/rest/dispatch.php	(revision 7855)
+++ /sandbox/webservice/api/rest/dispatch.php	(revision 7859)
@@ -1,5 +1,5 @@
 <?php
 
-define('API_DIRECTORY','/var/www/expresso/api/rest', True);
+define('API_DIRECTORY','/var/www/expresso_22/api/rest', True);
 
 // load libraries
Index: /sandbox/webservice/api/rest/admin/DeleteUserResource.php
===================================================================
--- /sandbox/webservice/api/rest/admin/DeleteUserResource.php	(revision 7814)
+++ /sandbox/webservice/api/rest/admin/DeleteUserResource.php	(revision 7859)
@@ -42,5 +42,5 @@
 				}
 
-				$this->setResult( array( "result" => true ) );
+				$this->setResult( array( "deleteUser" => true ) );
 			}
 			else
Index: /sandbox/webservice/api/rest/admin/CreateUserResource.php
===================================================================
--- /sandbox/webservice/api/rest/admin/CreateUserResource.php	(revision 7813)
+++ /sandbox/webservice/api/rest/admin/CreateUserResource.php	(revision 7859)
@@ -132,5 +132,5 @@
 				}
 
-				$this->setResult( array( "result" => true ) );
+				$this->setResult( array( "createUser" => true ) );
 			}
 			else
Index: /sandbox/webservice/api/rest/admin/EditUserResource.php
===================================================================
--- /sandbox/webservice/api/rest/admin/EditUserResource.php	(revision 7814)
+++ /sandbox/webservice/api/rest/admin/EditUserResource.php	(revision 7859)
@@ -43,5 +43,5 @@
 					$return['accountDescription']	= $fields['corporative_information_description'];
 					
-					$this->setResult( array( "result" => $return ));
+					$this->setResult( array( "editUser" => $return ));
 				}
 				else
Index: /sandbox/webservice/api/rest/admin/SearchUserResource.php
===================================================================
--- /sandbox/webservice/api/rest/admin/SearchUserResource.php	(revision 7813)
+++ /sandbox/webservice/api/rest/admin/SearchUserResource.php	(revision 7859)
@@ -28,7 +28,17 @@
 				$list = $this->listUsers( $searchUser );
 
+				$user = array();
+
+				foreach( $list as $_u )
+				{
+					$user['accountId'] 		= $_u['account_id'];
+					$user['accountLid']		= $_u['account_lid'];
+					$user['accountCn']		= $_u['account_cn'];
+					$user['accountMail']	= $_u['account_mail'];
+				}
+
 				if( count($list) > 0 )
 				{
-					$this->setResult( array( "result" => $list ) );
+					$this->setResult( array( "searchUser" => $user ) );
 				}
 				else
Index: /sandbox/webservice/api/rest/admin/RenameUserResource.php
===================================================================
--- /sandbox/webservice/api/rest/admin/RenameUserResource.php	(revision 7813)
+++ /sandbox/webservice/api/rest/admin/RenameUserResource.php	(revision 7859)
@@ -66,5 +66,5 @@
 
 
-				$this->setResult( array( "result" => true ) );
+				$this->setResult( array( "renameUser" => true ) );
 			}
 			else
Index: /sandbox/webservice/api/rest/catalog/ContactsResource.php
===================================================================
--- /sandbox/webservice/api/rest/catalog/ContactsResource.php	(revision 7489)
+++ /sandbox/webservice/api/rest/catalog/ContactsResource.php	(revision 7859)
@@ -12,16 +12,25 @@
 				$search = trim($this->getParam('search'));
 				$search = ($search ? mb_convert_encoding($search,"ISO_8859-1", "UTF8") : "");
-				
+				$contactID = $this->getParam('contactID');
+
+				$search_string = "%$search%";
+
+				$arr_params = array();
+
 				if($this->getParam('contactType') == 1) {
-					if($search != "") {
-						$query_contact = "(A.alias ilike '%$search%' or A.names_ordered ilike '%$search%' or C.connection_value ilike '%$search%') and";
+					if($search != "") {	
+						$arr_params[] = $search_string;
+						$arr_params[] = $search_string;
+						$arr_params[] = $search_string;
+						$query_contact = "(A.alias ilike ? or A.names_ordered ilike ? or C.connection_value ilike ?) and";
 					}
 					elseif($this->getParam('contactID') > 0){
-						$query_contact = 'A.id_contact='.$this->getParam('contactID').' and';
+						$arr_params[] = $contactID;
+						$query_contact = "A.id_contact = ? and ";
 					}
 				}
 				elseif($this->getParam('contactType') == 2){
 					if($this-> getMinArgumentSearch() <= strlen($search))
-						return $this->getGlobalContacts($search, $this->getParam('contactID'));
+						return $this->getGlobalContacts($search, $contactID );
 					else{
 						Errors::runException("CATALOG_MIN_ARGUMENT_SEARCH", $this-> getMinArgumentSearch());
@@ -29,19 +38,50 @@
 				}
 			}
+
+			//ADICIONA O ID_OWNER 
+			$arr_params[] = $this->getUserId();
 		
-			$query = 'select B.id_typeof_contact_connection, A.photo, A.id_contact, A.alias, A.given_names, A.family_names, A.names_ordered, A.birthdate, A.notes, C.connection_value from phpgw_cc_contact A, '.
-					'phpgw_cc_contact_conns B, phpgw_cc_connections C where A.id_contact = B.id_contact and B.id_connection = C.id_connection '.
-					' and '.$query_contact.' A.id_owner='.$this -> getUserId().' group by '.
-					' B.id_typeof_contact_connection, A.photo, A.id_contact, A.alias, A.given_names, A.family_names,A.names_ordered,A.birthdate, A.notes,C.connection_value	order by lower(A.names_ordered)';
-		
-			if (!$this->getDb()->query($query))
-				return false;
-		
+			$query = 'select 
+						  B.id_typeof_contact_connection, 
+						  A.photo, 
+						  A.id_contact, 
+						  A.alias, 
+						  A.given_names, 
+						  A.family_names, 
+						  A.names_ordered, 
+						  A.birthdate, 
+						  A.notes, 
+						  C.connection_value 
+						from 
+							phpgw_cc_contact A, 
+							phpgw_cc_contact_conns B, 
+							phpgw_cc_connections C 
+						where 
+							A.id_contact = B.id_contact and 
+							B.id_connection = C.id_connection and 
+							'.$query_contact.' 
+							A.id_owner = ?
+					group by 
+						B.id_typeof_contact_connection, 
+						A.photo, 
+						A.id_contact, 
+						A.alias, 
+						A.given_names,
+						A.family_names,
+						A.names_ordered,
+						A.birthdate,
+						A.notes,
+						C.connection_value	
+					order by 
+						lower(A.names_ordered)';
+
+			$resQuery = $this->getDb()->Link_ID->query($query,$arr_params);
+
 			$contacts = array();
-			while($this->getDb()->next_record()) {
-				$row = $this->getDb()->row();
+			while($row = $resQuery->fetchRow()) {
+
 				$id = $row['id_contact'];
 				$contactType = ($row['id_typeof_contact_connection'] == 2 ? 'contactPhones' : 'contactMails');
-		
+
 				if($contacts[$id] != null){
 					$contacts[$id][$contactType][] = $row['connection_value'];
@@ -61,5 +101,6 @@
 				}
 			}
-			$result = array ('contacts' => array_values($contacts));
+
+			$result = array ( 'contacts' => array_values($contacts));
 			$this->setResult($result);
 		}
