Changeset 5954 for sandbox/webservice/api/json-rpc
- Timestamp:
- 04/16/12 17:34:31 (12 years ago)
- Location:
- sandbox/webservice/api/json-rpc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/webservice/api/json-rpc/Catalog.php
r5889 r5954 4 4 5 5 class Catalog extends Expresso { 6 var $ userPrefs;6 var $searchCharactersNumber; 7 7 var $userId; 8 8 9 9 public function __construct(){ 10 $this->userPrefs = $this->getUserPreferences(); 10 $prefs = $GLOBALS['phpgw']->preferences->read(); 11 $this-> searchCharactersNumber = $prefs['expressoMail']['search_characters_number']; 11 12 } 12 13 13 14 private function getUserId(){ 14 15 $userProfile = $this->getUserProfile(); 15 return $userProfile[' account_id'];16 return $userProfile['contactID']; 16 17 } 17 18 … … 29 30 } 30 31 elseif($params['contactType'] == 2){ 31 if($this-> userPrefs['search_characters_number']<= strlen($search))32 if($this-> searchCharactersNumber <= strlen($search)) 32 33 return $this->getGlobalContacts($search, $params['contactID']); 33 34 else{ 34 $this-> error = str_replace("%1",$this->userPrefs['search_characters_number'],"Your search argument must be longer than %1 characters."); 35 $this-> error = Errors::get(Errors::CATALOG_MIN_ARGUMENT_SEARCH); 36 $this-> error = str_replace("%1",$this-> searchCharactersNumber,$this->error); 35 37 return $this->getResponse(); 36 38 } -
sandbox/webservice/api/json-rpc/Expresso.php
r5896 r5954 49 49 50 50 protected function isLoggedIn($params){ 51 list($sessionid, $kp3) = explode(":", $params['auth']); 52 if($GLOBALS['phpgw']->session->verify($sessionid, $kp3)){ 53 return true; 51 if($params['auth'] != null) { 52 list($sessionid, $kp3) = explode(":", $params['auth']); 53 if($GLOBALS['phpgw']->session->verify($sessionid, $kp3)){ 54 return true; 55 } 56 else{ 57 $this-> error = Errors::get(Errors::LOGIN_AUTH_INVALID); 58 return false; 59 } 54 60 } 55 61 else{ 56 $this-> error = "You are not logged in";62 $this-> error = Errors::get(Errors::LOGIN_NOT_LOGGED_IN); 57 63 return false; 58 64 } … … 67 73 if(!$this-> isLoggedIn($params)) 68 74 { 69 if($params['auth'] != "") 70 { 71 $this->error = "Your auth is invalid"; 72 73 } 74 elseif($sessionid = $GLOBALS['phpgw']->session->create($params['user'], $params['password'])) 75 if($sessionid = $GLOBALS['phpgw']->session->create($params['user'], $params['password'])) 75 76 { 76 77 $this->error = null; … … 82 83 else 83 84 { 84 $this-> error = $GLOBALS['phpgw']->session->reason;85 $this-> error = Errors::get($GLOBALS['phpgw']->session->cd_reason); 85 86 } 86 87 }
Note: See TracChangeset
for help on using the changeset viewer.