Changeset 5954 for sandbox/webservice/api
- Timestamp:
- 04/16/12 17:34:31 (12 years ago)
- Location:
- sandbox/webservice/api
- Files:
-
- 2 added
- 3 edited
- 1 moved
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 } -
sandbox/webservice/api/library/HttpRequest.php
r5595 r5954 3 3 * Access the HTTP Request 4 4 */ 5 class http_request {5 class HttpRequest { 6 6 7 7 /** additional HTTP headers not prefixed with HTTP_ in $_SERVER superglobal */ … … 13 13 * @param Array Additional Headers to retrieve 14 14 */ 15 function http_request($add_headers = false) {15 function HttpRequest($add_headers = false) { 16 16 17 17 $this->retrieve_headers($add_headers); -
sandbox/webservice/api/webservice.php
r5687 r5954 1 1 <?php 2 include_once("http_request.class.php");3 2 4 3 $public_functions = array( … … 22 21 23 22 include_once('../header.inc.php'); 23 include_once("./library/HttpRequest.php"); 24 include_once("./library/Errors.php"); 24 25 25 26 // NO COOKIES!!!! … … 38 39 if(empty($request)) { 39 40 $request = array(); 40 $http_request = new http_request();41 $http_request = new HttpRequest(); 41 42 $content_type = $http_request->header('Content-Type'); 42 43 $accept = $http_request->header('Accept');
Note: See TracChangeset
for help on using the changeset viewer.