Changeset 6165 for sandbox/webservice/api/rest
- Timestamp:
- 05/11/12 10:38:02 (12 years ago)
- Location:
- sandbox/webservice/api/rest
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/webservice/api/rest/catalog/ContactsResource.php
r6148 r6165 24 24 return $this->getGlobalContacts($search, $this->getParam('contactID')); 25 25 else{ 26 $error = Errors::get(Errors::CATALOG_MIN_ARGUMENT_SEARCH, $this-> getMinArgumentSearch()); 27 throw new ResponseException($error['message'], $error['code']); 26 Errors::runException("CATALOG_MIN_ARGUMENT_SEARCH", $this-> getMinArgumentSearch()); 28 27 } 29 28 } -
sandbox/webservice/api/rest/core/LoginResource.php
r6149 r6165 35 35 else 36 36 { 37 throw new ResponseException("",$GLOBALS['phpgw']->session->cd_reason);37 Errors::runException($GLOBALS['phpgw']->session->cd_reason); 38 38 } 39 39 return $this->getResponse(); -
sandbox/webservice/api/rest/dispatch.php
r6155 r6165 2 2 3 3 // load libraries 4 require_once __DIR__.'/../library/tonic/lib/tonic.php';5 require_once(__DIR__. "/../Errors.php");4 require_once(__DIR__.'/../library/tonic/lib/tonic.php'); 5 require_once(__DIR__.'/../library/utils/Errors.php'); 6 6 7 7 // load adapters … … 54 54 break; 55 55 default: 56 $response = Errors::getResponse($request, $e); 56 57 $response = new Response($request); 58 $response->code = Response::OK; 59 $response->addHeader('content-type', 'application/json'); 60 if($request->id) 61 $body['id'] = $request->id; 62 63 $body['error'] = array("code" => "".$e->getCode(), "message" => $e->getMessage()); 64 $response->body = json_encode($body); 57 65 } 58 66 } -
sandbox/webservice/api/rest/mail/AddFolderResource.php
r6155 r6165 13 13 14 14 if(empty($new_name) || preg_match('/[\/\\\!\@\#\$\%\&\*\(\)]/', $new_name)) 15 throw new ResponseException("",Errors::MAIL_INVALID_NEW_FOLDER_NAME);15 Errors::runException("MAIL_INVALID_NEW_FOLDER_NAME"); 16 16 17 17 $new_id = $parent_id . $this->getImap()->imap_delimiter . $new_name; … … 21 21 $result = $this->getImap()->create_mailbox($params); 22 22 if($result != 'Ok') 23 throw new ResponseException("",Errors::MAIL_FOLDER_NOT_ADDED);23 Errors::runException("MAIL_FOLDER_NOT_ADDED"); 24 24 } 25 25 -
sandbox/webservice/api/rest/mail/CleanTrashResource.php
r6148 r6165 10 10 $params['clean_folder'] = 'imapDefaultTrashFolder'; 11 11 if(!$this -> getImap() -> empty_folder($params)) 12 throw new ResponseException("",Errors::MAIL_TRASH_NOT_CLEANED);12 Errors::runException("MAIL_TRASH_NOT_CLEANED"); 13 13 } 14 14 -
sandbox/webservice/api/rest/mail/DelFolderResource.php
r6155 r6165 11 11 12 12 if(!$this->getImap()->folder_exists($folder_id)) 13 throw new ResponseException("",Errors::MAIL_INVALID_FOLDER);13 Errors::runException("MAIL_INVALID_FOLDER"); 14 14 15 15 $default_folders = array_keys($this->defaultFolders); 16 16 if(in_array($folder_id, $default_folders)) 17 throw new ResponseException("",Errors::MAIL_CANNOT_DEL_DEFAULT_FOLDER);17 Errors::runException("MAIL_CANNOT_DEL_DEFAULT_FOLDER"); 18 18 19 19 $personal_folders = $this->getImap()->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'personal')); … … 23 23 foreach($personal_folders AS $personal_folder){ 24 24 if($personal_folder['folder_id'] == $folder_id && $personal_folder['folder_hasChildren']) 25 throw new ResponseException("",Errors::MAIL_FOLDER_NOT_EMPTY);25 Errors::runException("MAIL_FOLDER_NOT_EMPTY"); 26 26 } 27 27 28 28 if($this->getImap()->get_num_msgs(array('folder' => $folder_id)) > 0) 29 throw new ResponseException("",Errors::MAIL_FOLDER_NOT_EMPTY);29 Errors::runException("MAIL_FOLDER_NOT_EMPTY"); 30 30 31 31 $result = $this->getImap()->delete_mailbox($params); 32 32 if($result != 'Ok') 33 throw new ResponseException("",Errors::MAIL_FOLDER_NOT_DELETED);33 Errors::runException("MAIL_FOLDER_NOT_DELETED"); 34 34 } 35 35 -
sandbox/webservice/api/rest/mail/RenameFolderResource.php
r6155 r6165 12 12 13 13 if(!$this->getImap()->folder_exists($old_id)) 14 throw new ResponseException("",Errors::MAIL_INVALID_OLD_FOLDER);14 Errors::runException("MAIL_INVALID_OLD_FOLDER"); 15 15 16 16 $default_folders = array_keys($this->defaultFolders); 17 17 if(in_array($old_id, $default_folders)) 18 throw new ResponseException("",Errors::MAIL_INVALID_OLD_FOLDER);18 Errors::runException("MAIL_INVALID_OLD_FOLDER"); 19 19 20 20 if(empty($new_name) || preg_match('/[\/\\\!\@\#\$\%\&\*\(\)]/', $new_name)) 21 throw new ResponseException("",Errors::MAIL_INVALID_NEW_FOLDER_NAME);21 Errors::runException("MAIL_INVALID_NEW_FOLDER_NAME"); 22 22 23 23 $old_id_arr = explode($this->getImap()->imap_delimiter, $old_id); … … 30 30 $result = $this->getImap()->ren_mailbox($params); 31 31 if($result != 'Ok') 32 throw new ResponseException("",Errors::MAIL_FOLDER_NOT_RENAMED);32 Errors::runException("MAIL_FOLDER_NOT_RENAMED"); 33 33 } 34 34 -
sandbox/webservice/api/rest/mail/SendSupportFeedbackResource.php
r6148 r6165 29 29 30 30 if (!$returncode || !(is_array($returncode) && $returncode['success'] == true)) 31 throw new ResponseException("",Errors::MAIL_NOT_SENT);31 Errors::runException("MAIL_NOT_SENT"); 32 32 } 33 33
Note: See TracChangeset
for help on using the changeset viewer.