Changeset 6061 for sandbox/webservice/api/rest/core/Expresso.php
- Timestamp:
- 04/27/12 15:18:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/webservice/api/rest/core/Expresso.php
r6022 r6061 59 59 } 60 60 61 public function setError($errorID, $arg1 = false) { 62 if($errorID) 63 $this-> error = Errors::get($errorID, $arg1); 64 else 65 $this-> error = null; 61 public function setError($error) { 62 $this-> error = $error; 66 63 } 67 64 … … 96 93 $response->addHeader('content-type', 'application/json'); 97 94 95 if($this->getId()) 96 $body['id'] = $this->getId(); 97 if($this->getResult()) 98 $body['result'] = $this->getResult(); 99 else 100 throw new ResponseException("",Errors::E_UNKNOWN_ERROR); 98 101 99 if($this->getResult()) {100 $body['result'] = $this->getResult();101 }102 elseif($this->getError()){103 $body['error'] = $this->getError();104 }105 else{106 $this->setError(Errors::E_INTERNAL_ERROR);107 $body['error'] = $this->getError();108 }109 110 if($this->getId()) {111 $body['id'] = $this->getId();112 }113 114 102 $response->body = json_encode($body); 115 103 … … 143 131 list($sessionid, $kp3) = explode(":", $this->getParam('auth')); 144 132 if($GLOBALS['phpgw']->session->verify($sessionid, $kp3)){ 145 return true;133 return $sessionid; 146 134 } 147 135 else{ 148 $this-> setError(Errors::LOGIN_AUTH_INVALID); 149 return false; 136 throw new ResponseException("",Errors::LOGIN_AUTH_INVALID); 150 137 } 151 138 } 152 139 else{ 153 $this-> setError(Errors::LOGIN_NOT_LOGGED_IN); 154 return false; 140 throw new ResponseException("",Errors::LOGIN_NOT_LOGGED_IN); 155 141 } 156 142 }
Note: See TracChangeset
for help on using the changeset viewer.