Back to index

d-push  2.0
class.mapiexception.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  * Copyright 2005 - 2012  Zarafa B.V.
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU Affero General Public License, version 3,
00007  * as published by the Free Software Foundation with the following additional
00008  * term according to sec. 7:
00009  *
00010  * According to sec. 7 of the GNU Affero General Public License, version
00011  * 3, the terms of the AGPL are supplemented with the following terms:
00012  *
00013  * "Zarafa" is a registered trademark of Zarafa B.V. The licensing of
00014  * the Program under the AGPL does not imply a trademark license.
00015  * Therefore any rights, title and interest in our trademarks remain
00016  * entirely with us.
00017  *
00018  * However, if you propagate an unmodified version of the Program you are
00019  * allowed to use the term "Zarafa" to indicate that you distribute the
00020  * Program. Furthermore you may use our trademarks where it is necessary
00021  * to indicate the intended purpose of a product or service provided you
00022  * use it in accordance with honest practices in industrial or commercial
00023  * matters.  If you want to propagate modified versions of the Program
00024  * under the name "Zarafa" or "Zarafa Server", you may only do so if you
00025  * have a written permission by Zarafa B.V. (to acquire a permission
00026  * please contact Zarafa at trademark@zarafa.com).
00027  *
00028  * The interactive user interface of the software displays an attribution
00029  * notice containing the term "Zarafa" and/or the logo of Zarafa.
00030  * Interactive user interfaces of unmodified and modified versions must
00031  * display Appropriate Legal Notices according to sec. 5 of the GNU
00032  * Affero General Public License, version 3, when you propagate
00033  * unmodified or modified versions of the Program. In accordance with
00034  * sec. 7 b) of the GNU Affero General Public License, version 3, these
00035  * Appropriate Legal Notices must retain the logo of Zarafa or display
00036  * the words "Initial Development by Zarafa" if the display of the logo
00037  * is not reasonably feasible for technical reasons. The use of the logo
00038  * of Zarafa in Legal Notices is allowed for unmodified and modified
00039  * versions of the software.
00040  *
00041  * This program is distributed in the hope that it will be useful,
00042  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00043  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00044  * GNU Affero General Public License for more details.
00045  *
00046  * You should have received a copy of the GNU Affero General Public License
00047  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00048  *
00049  */
00050 
00051 
00058     // FatalException will trigger a HTTP return code 500 to the mobile
00059     class MAPIException extends FatalException
00060     {
00067         public function getDisplayMessage()
00068         {
00069             if(!empty($this->displayMessage))
00070                 return $this->displayMessage;
00071 
00072             switch($this->getCode())
00073             {
00074                 case MAPI_E_NO_ACCESS:
00075                     return _("You have insufficient privileges to open this object.");
00076                 case MAPI_E_LOGON_FAILED:
00077                 case MAPI_E_UNCONFIGURED:
00078                     return _("Logon Failed. Please check your username/password.");
00079                 case MAPI_E_NETWORK_ERROR:
00080                     return _("Can not connect to Zarafa server.");
00081                 case MAPI_E_UNKNOWN_ENTRYID:
00082                     return _("Can not open object with provided id.");
00083                 case MAPI_E_NO_RECIPIENTS:
00084                     return _("There are no recipients in the message.");
00085                 case MAPI_E_NOT_FOUND:
00086                     return _("Can not find object.");
00087                 case MAPI_E_INTERFACE_NOT_SUPPORTED:
00088                 case MAPI_E_INVALID_PARAMETER:
00089                 case MAPI_E_INVALID_ENTRYID:
00090                 case MAPI_E_INVALID_OBJECT:
00091                 case MAPI_E_TOO_COMPLEX:
00092                 case MAPI_E_CORRUPT_DATA:
00093                 case MAPI_E_END_OF_SESSION:
00094                 case MAPI_E_AMBIGUOUS_RECIP:
00095                 case MAPI_E_COLLISION:
00096                 case MAPI_E_UNCONFIGURED:
00097                 default :
00098                     return sprintf(_("Unknown MAPI Error: %s"), get_mapi_error_name($this->getCode()));
00099             }
00100         }
00101     }
00102 
00103     // Tell the PHP extension which exception class to instantiate
00104     if (function_exists('mapi_enable_exceptions')) {
00105        //mapi_enable_exceptions("mapiexception");
00106     }
00107 ?>