From f95340b3619b2cf30c0af43486299d26e5d9df58 Mon Sep 17 00:00:00 2001 From: AD7six Date: Sat, 19 Mar 2011 18:07:05 +0100 Subject: [PATCH] use the domain cake_error for error message intended for the developer --- .../Controller/Component/AclComponent.php | 16 +++++++-------- .../Component/Auth/BaseAuthorize.php | 2 +- .../Component/Auth/ControllerAuthorize.php | 2 +- .../Component/Auth/CrudAuthorize.php | 2 +- .../Controller/Component/AuthComponent.php | 20 +++++++++---------- .../Controller/Component/EmailComponent.php | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/Cake/Controller/Component/AclComponent.php b/lib/Cake/Controller/Component/AclComponent.php index d0b9dd188..962e721ae 100644 --- a/lib/Cake/Controller/Component/AclComponent.php +++ b/lib/Cake/Controller/Component/AclComponent.php @@ -68,7 +68,7 @@ class AclComponent extends Component { list($plugin, $name) = pluginSplit($name); $name .= 'Component'; } else { - throw new CakeException(__d('cake', 'Could not find %s.', $name)); + throw new CakeException(__d('cake_error', 'Could not find %s.', $name)); } } $this->adapter($name); @@ -92,7 +92,7 @@ class AclComponent extends Component { $adapter = new $adapter(); } if (!$adapter instanceof AclInterface) { - throw new CakeException(__d('cake', 'AclComponent adapters must implement AclInterface')); + throw new CakeException(__d('cake_error', 'AclComponent adapters must implement AclInterface')); } $this->_Instance = $adapter; $this->_Instance->initialize($this); @@ -163,7 +163,7 @@ class AclComponent extends Component { * @deprecated */ public function grant($aro, $aco, $action = "*") { - trigger_error(__d('cake', 'AclComponent::grant() is deprecated, use allow() instead'), E_USER_WARNING); + trigger_error(__d('cake_error', 'AclComponent::grant() is deprecated, use allow() instead'), E_USER_WARNING); return $this->_Instance->allow($aro, $aco, $action); } @@ -177,7 +177,7 @@ class AclComponent extends Component { * @deprecated */ public function revoke($aro, $aco, $action = "*") { - trigger_error(__d('cake', 'AclComponent::revoke() is deprecated, use deny() instead'), E_USER_WARNING); + trigger_error(__d('cake_error', 'AclComponent::revoke() is deprecated, use deny() instead'), E_USER_WARNING); return $this->_Instance->deny($aro, $aco, $action); } } @@ -299,12 +299,12 @@ class DbAcl extends Object implements AclInterface { $acoPath = $this->Aco->node($aco); if (empty($aroPath) || empty($acoPath)) { - trigger_error(__d('cake', "DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: ") . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING); + trigger_error(__d('cake_error', "DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: ") . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING); return false; } if ($acoPath == null || $acoPath == array()) { - trigger_error(__d('cake', "DbAcl::check() - Failed ACO node lookup in permissions check. Node references:\nAro: ") . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING); + trigger_error(__d('cake_error', "DbAcl::check() - Failed ACO node lookup in permissions check. Node references:\nAro: ") . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING); return false; } @@ -312,7 +312,7 @@ class DbAcl extends Object implements AclInterface { $acoNode = $acoPath[0]; if ($action != '*' && !in_array('_' . $action, $permKeys)) { - trigger_error(__d('cake', "ACO permissions key %s does not exist in DbAcl::check()", $action), E_USER_NOTICE); + trigger_error(__d('cake_error', "ACO permissions key %s does not exist in DbAcl::check()", $action), E_USER_NOTICE); return false; } @@ -386,7 +386,7 @@ class DbAcl extends Object implements AclInterface { $save = array(); if ($perms == false) { - trigger_error(__d('cake', 'DbAcl::allow() - Invalid node'), E_USER_WARNING); + trigger_error(__d('cake_error', 'DbAcl::allow() - Invalid node'), E_USER_WARNING); return false; } if (isset($perms[0])) { diff --git a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php index 7a5245174..f11dbe174 100644 --- a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php @@ -87,7 +87,7 @@ abstract class BaseAuthorize { public function controller($controller = null) { if ($controller) { if (!$controller instanceof Controller) { - throw new CakeException(__d('cake', '$controller needs to be an instance of Controller')); + throw new CakeException(__d('cake_error', '$controller needs to be an instance of Controller')); } $this->_Controller = $controller; return true; diff --git a/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php b/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php index 816cb836d..500d41b42 100644 --- a/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php @@ -46,7 +46,7 @@ class ControllerAuthorize extends BaseAuthorize { public function controller($controller = null) { if ($controller) { if (!method_exists($controller, 'isAuthorized')) { - throw new CakeException(__d('cake', '$controller does not implement an isAuthorized() method.')); + throw new CakeException(__d('cake_error', '$controller does not implement an isAuthorized() method.')); } } return parent::controller($controller); diff --git a/lib/Cake/Controller/Component/Auth/CrudAuthorize.php b/lib/Cake/Controller/Component/Auth/CrudAuthorize.php index 1adda536e..a9c93a6ff 100644 --- a/lib/Cake/Controller/Component/Auth/CrudAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/CrudAuthorize.php @@ -81,7 +81,7 @@ class CrudAuthorize extends BaseAuthorize { */ public function authorize($user, CakeRequest $request) { if (!isset($this->settings['actionMap'][$request->params['action']])) { - trigger_error(__d('cake', + trigger_error(__d('cake_error', 'CrudAuthorize::authorize() - Attempted access of un-mapped action "%1$s" in controller "%2$s"', $request->action, $request->controller diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index 34df18bcc..0ad35357d 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -363,7 +363,7 @@ class AuthComponent extends Component { /** * Uses the configured Authorization adapters to check whether or not a user is authorized. - * Each adapter will be checked in sequence, if any of them return true, then the user will + * Each adapter will be checked in sequence, if any of them return true, then the user will * be authorized for the request. * * @param mixed $user The user to check the authorization of. If empty the user in the session will be used. @@ -411,10 +411,10 @@ class AuthComponent extends Component { $className = $class . 'Authorize'; App::uses($className, $plugin . 'Controller/Component/Auth'); if (!class_exists($className)) { - throw new CakeException(__d('cake', 'Authorization adapter "%s" was not found.', $class)); + throw new CakeException(__d('cake_error', 'Authorization adapter "%s" was not found.', $class)); } if (!method_exists($className, 'authorize')) { - throw new CakeException(__d('cake', 'Authorization objects must implement an authorize method.')); + throw new CakeException(__d('cake_error', 'Authorization objects must implement an authorize method.')); } $settings = array_merge($global, (array)$settings); $this->_authorizeObjects[] = new $className($this->_Collection, $settings); @@ -428,7 +428,7 @@ class AuthComponent extends Component { * * You can use allow with either an array, or var args. * - * `$this->Auth->allow(array('edit', 'add'));` or + * `$this->Auth->allow(array('edit', 'add'));` or * `$this->Auth->allow('edit', 'add');` * * allow() also supports '*' as a wildcard to mean all actions. @@ -458,7 +458,7 @@ class AuthComponent extends Component { * * You can use deny with either an array, or var args. * - * `$this->Auth->deny(array('edit', 'add'));` or + * `$this->Auth->deny(array('edit', 'add'));` or * `$this->Auth->deny('edit', 'add');` * * @param mixed $action Controller action name or array of actions @@ -586,8 +586,8 @@ class AuthComponent extends Component { } /** - * If no parameter is passed, gets the authentication redirect URL. Pass a url in to - * set the destination a user should be redirected to upon logging in. Will fallback to + * If no parameter is passed, gets the authentication redirect URL. Pass a url in to + * set the destination a user should be redirected to upon logging in. Will fallback to * AuthComponent::$loginRedirect if there is no stored redirect value. * * @param mixed $url Optional URL to write as the login redirect URL. @@ -651,10 +651,10 @@ class AuthComponent extends Component { $className = $class . 'Authenticate'; App::uses($className, $plugin . 'Controller/Component/Auth'); if (!class_exists($className)) { - throw new CakeException(__d('cake', 'Authentication adapter "%s" was not found.', $class)); + throw new CakeException(__d('cake_error', 'Authentication adapter "%s" was not found.', $class)); } if (!method_exists($className, 'authenticate')) { - throw new CakeException(__d('cake', 'Authentication objects must implement an authenticate method.')); + throw new CakeException(__d('cake_error', 'Authentication objects must implement an authenticate method.')); } $settings = array_merge($global, (array)$settings); $this->_authenticateObjects[] = new $className($this->_Collection, $settings); @@ -707,4 +707,4 @@ class AuthComponent extends Component { public function flash($message) { $this->Session->setFlash($message, $this->flash['element'], $this->flash['params'], $this->flash['key']); } -} +} \ No newline at end of file diff --git a/lib/Cake/Controller/Component/EmailComponent.php b/lib/Cake/Controller/Component/EmailComponent.php index b260c1561..2eb887a1b 100644 --- a/lib/Cake/Controller/Component/EmailComponent.php +++ b/lib/Cake/Controller/Component/EmailComponent.php @@ -725,7 +725,7 @@ class EmailComponent extends Component { $formatted = array(); if ($this->_lineLength !== null) { - trigger_error(__d('cake', '_lineLength cannot be accessed please use lineLength'), E_USER_WARNING); + trigger_error(__d('cake_error', '_lineLength cannot be accessed please use lineLength'), E_USER_WARNING); $this->lineLength = $this->_lineLength; }