diff --git a/api/inc/class.egw_exception_db.inc.php b/api/inc/class.egw_exception_db.inc.php new file mode 100644 index 0000000000..30893263b7 --- /dev/null +++ b/api/inc/class.egw_exception_db.inc.php @@ -0,0 +1,24 @@ + + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package api + * @subpackage accounts + * @access public + * @version $Id$ + */ + +use EGroupware\Api; + +/** + * Exception thrown by the egw_db class for everything not covered by extended classed below + * + * New Db\Exception has to extend deprecated egw_exception_db to allow legacy code + * to catch exceptions thrown by Api\Db class! + * + * @deprecated use Api\Db\Exception + */ +class egw_exception_db extends Api\Exception {} diff --git a/api/inc/class.egw_exception_db_invalid_sql.inc.php b/api/inc/class.egw_exception_db_invalid_sql.inc.php new file mode 100644 index 0000000000..13aa751154 --- /dev/null +++ b/api/inc/class.egw_exception_db_invalid_sql.inc.php @@ -0,0 +1,24 @@ + + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package api + * @subpackage accounts + * @access public + * @version $Id$ + */ + +use EGroupware\Api; + +/** + * Classic invalid SQL error + * + * New InvalidSql exception has to extend deprecated egw_exception_db_invalid_sql + * to allow legacy code to catch exceptions thrown by Api\Db! + * + * @deprecated use Api\Db\Exception\InvalidSql + */ +class egw_exception_db_invalid_sql extends Api\Db\Exception {} diff --git a/api/inc/class.egw_exception_no_permission.inc.php b/api/inc/class.egw_exception_no_permission.inc.php new file mode 100644 index 0000000000..4baa311d1a --- /dev/null +++ b/api/inc/class.egw_exception_no_permission.inc.php @@ -0,0 +1,24 @@ + + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package api + * @subpackage accounts + * @access public + * @version $Id$ + */ + +use EGroupware\Api; + +/** + * Base class for all exceptions about missing permissions + * + * New NoPermisison excpetion has to extend deprecated egw_exception_no_permission + * to allow legacy code to catch them! + * + * @deprecated use Api\Exception\NoPermission + */ +class egw_exception_no_permission extends Api\Exception {} diff --git a/api/src/Accounts/Sql.php b/api/src/Accounts/Sql.php index 83d94b60b3..dac6634bda 100644 --- a/api/src/Accounts/Sql.php +++ b/api/src/Accounts/Sql.php @@ -148,7 +148,7 @@ class Sql $this->table.'.account_id='.abs($account_id), __LINE__, __FILE__, false, '', false, 0, $join); } - catch (egw_exception_db $e) { + catch (Api\Db\Exception $e) { unset($e); } @@ -261,7 +261,7 @@ class Sql } } // ignore not (yet) existing mailaccounts table (does NOT work in PostgreSQL, because of transaction!) - catch (egw_exception_db $e) { + catch (Api\Db\Exception $e) { unset($e); } } diff --git a/api/src/Etemplate/Widget/ItemPicker.php b/api/src/Etemplate/Widget/ItemPicker.php index 3e61b570b8..61865fbe57 100755 --- a/api/src/Etemplate/Widget/ItemPicker.php +++ b/api/src/Etemplate/Widget/ItemPicker.php @@ -27,7 +27,7 @@ class ItemPicker extends Etemplate\Widget * Constructor * * @param string|XMLReader $xml string with xml or XMLReader positioned on the element to construct - * @throws egw_exception_wrong_parameter + * @throws Api\Exception\WrongParameter */ public function __construct($xml = '') { diff --git a/api/src/Etemplate/Widget/Select.php b/api/src/Etemplate/Widget/Select.php index ae9bc91ec5..3aab04f62c 100644 --- a/api/src/Etemplate/Widget/Select.php +++ b/api/src/Etemplate/Widget/Select.php @@ -77,7 +77,7 @@ class Select extends Etemplate\Widget * Constructor * * @param string|XMLReader $xml string with xml or XMLReader positioned on the element to construct - * @throws egw_exception_wrong_parameter + * @throws Api\Exception\WrongParameter */ public function __construct($xml = '') { diff --git a/api/src/Etemplate/Widget/Taglist.php b/api/src/Etemplate/Widget/Taglist.php index 98d4d2fe88..38ce19b902 100644 --- a/api/src/Etemplate/Widget/Taglist.php +++ b/api/src/Etemplate/Widget/Taglist.php @@ -30,7 +30,7 @@ class Taglist extends Etemplate\Widget * Overrides parent to check for $xml first, prevents errors when instanciated without (via AJAX) * * @param string|XMLReader $xml string with xml or XMLReader positioned on the element to construct - * @throws egw_exception_wrong_parameter + * @throws Api\Exception\WrongParameter */ public function __construct($xml = '') { diff --git a/api/src/Etemplate/Widget/Textbox.php b/api/src/Etemplate/Widget/Textbox.php index 78b0896b07..bf5c135071 100644 --- a/api/src/Etemplate/Widget/Textbox.php +++ b/api/src/Etemplate/Widget/Textbox.php @@ -32,7 +32,7 @@ class Textbox extends Etemplate\Widget * Constructor * * @param string|XMLReader $xml string with xml or XMLReader positioned on the element to construct - * @throws egw_exception_wrong_parameter + * @throws Api\Exception\WrongParameter */ public function __construct($xml) { diff --git a/api/src/Mail.php b/api/src/Mail.php index 3f41574bd9..dab23aa00f 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -6403,11 +6403,11 @@ class Mail } elseif (is_uploaded_file($_formData['file'])) { - move_uploaded_file($_formData['file'], $GLOBALS['egw_info']['server']['temp_dir'].SEP.$tmpFileName); // requirement for safe_mode! + move_uploaded_file($_formData['file'], $GLOBALS['egw_info']['server']['temp_dir'].'/'.$tmpFileName); // requirement for safe_mode! } else { - rename($_formData['file'], $GLOBALS['egw_info']['server']['temp_dir'].SEP.$tmpFileName); + rename($_formData['file'], $GLOBALS['egw_info']['server']['temp_dir'].'/'.$tmpFileName); } } else { //error_log("Import of message ".$_formData['file']." failes to meet basic restrictions"); @@ -6808,7 +6808,7 @@ class Mail $message = Link::get_data(parse_url($tmpFileName, PHP_URL_HOST), true); break; default: - $tmpFileName = $GLOBALS['egw_info']['server']['temp_dir'].SEP.basename($tmpFileName); + $tmpFileName = $GLOBALS['egw_info']['server']['temp_dir'].'/'.basename($tmpFileName); break; } if (!isset($message)) $message = fopen($tmpFileName, 'r'); diff --git a/api/src/MimeMagic.php b/api/src/MimeMagic.php index 8ecc4bc967..0c80a598f1 100644 --- a/api/src/MimeMagic.php +++ b/api/src/MimeMagic.php @@ -195,7 +195,7 @@ class MimeMagic } mt_srand(time()); - $filename = $GLOBALS['egw_info']['server']['temp_dir'] . SEP + $filename = $GLOBALS['egw_info']['server']['temp_dir'] . '/' . md5( time() + mt_rand() ) . '.tmp'; $fp = @fopen($filename, 'ab'); diff --git a/api/src/Vfs/Sharing.php b/api/src/Vfs/Sharing.php index 069037b52f..9585b733b7 100644 --- a/api/src/Vfs/Sharing.php +++ b/api/src/Vfs/Sharing.php @@ -385,8 +385,8 @@ class Sharing * @param string $name filename to use for $mode==self::LINK, default basename of $path * @param string|array $recipients one or more recipient email addresses * @param array $extra =array() extra data to store - * @throw egw_exception_not_found if $path not found - * @throw egw_excpetion_assertion_failed if user temp. directory does not exist and can not be created + * @throw Api\Exception\NotFound if $path not found + * @throw Api\Exception\AssertionFailed if user temp. directory does not exist and can not be created * @return array with share data, eg. value for key 'share_token' */ public static function create($path, $mode, $name, $recipients, $extra=array()) diff --git a/api/src/autoload.php b/api/src/autoload.php index 3b84fa237b..a7e131c17f 100755 --- a/api/src/autoload.php +++ b/api/src/autoload.php @@ -69,6 +69,8 @@ spl_autoload_register(function($class) $app = array_shift($components); // classes using the new naming schema app_class_name, eg. admin_cmd if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$class.'.inc.php') || + // compatibility class in new eGW api dir, eg. exceptions + file_exists($file = EGW_INCLUDE_ROOT.'/api/inc/class.'.$class.'.inc.php') || // classes using the new naming schema app_class_name, eg. admin_cmd isset($components[0]) && file_exists($file = EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$app.'_'.$components[0].'.inc.php') || // classes with an underscore in their name diff --git a/api/src/loader/exception.php b/api/src/loader/exception.php index ebe594d5de..34f5a4bd15 100755 --- a/api/src/loader/exception.php +++ b/api/src/loader/exception.php @@ -90,7 +90,7 @@ function _egw_log_exception($e,&$headline=null) function egw_exception_handler($e) { // handle redirects without logging - if (is_a($e, 'egw_exception_redirect')) + if ($e instanceof Api\Exception\Redirect) { egw::redirect($e->url, $e->app); } diff --git a/phpgwapi/inc/class.egw_exception.inc.php b/phpgwapi/inc/class.egw_exception.inc.php index b43b172800..6d1d1ded9f 100644 --- a/phpgwapi/inc/class.egw_exception.inc.php +++ b/phpgwapi/inc/class.egw_exception.inc.php @@ -26,16 +26,6 @@ use EGroupware\Api; */ class egw_exception extends Api\Exception {} -/** - * Base class for all exceptions about missing permissions - * - * New NoPermisison excpetion has to extend deprecated egw_exception_no_permission - * to allow legacy code to catch them! - * - * @deprecated use Api\Exception\NoPermission - */ -class egw_exception_no_permission extends Api\Exception {} - /** * A record or application entry was not found for the given id * @@ -68,26 +58,6 @@ class egw_exception_wrong_parameter extends Api\Exception\WrongParameter {} */ class egw_exception_wrong_userinput extends Api\Exception\WrongUserInput {} -/** - * Exception thrown by the egw_db class for everything not covered by extended classed below - * - * New Db\Exception has to extend deprecated egw_exception_db to allow legacy code - * to catch exceptions thrown by Api\Db class! - * - * @deprecated use Api\Db\Exception - */ -class egw_exception_db extends Api\Exception {} - -/** - * Classic invalid SQL error - * - * New InvalidSql exception has to extend deprecated egw_exception_db_invalid_sql - * to allow legacy code to catch exceptions thrown by Api\Db! - * - * @deprecated use Api\Db\Exception\InvalidSql - */ -class egw_exception_db_invalid_sql extends Api\Db\Exception {} - /** * Allow callbacks to request a redirect *