Skip to content

Commit

Permalink
use the domain cake_error for error message intended for the developer
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed Mar 19, 2011
1 parent 9b092f4 commit f95340b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions lib/Cake/Controller/Component/AclComponent.php
Expand Up @@ -68,7 +68,7 @@ public function __construct(ComponentCollection $collection, $settings = array()
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);
Expand All @@ -92,7 +92,7 @@ public function adapter($adapter = null) {
$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);
Expand Down Expand Up @@ -163,7 +163,7 @@ public function inherit($aro, $aco, $action = "*") {
* @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);
}

Expand All @@ -177,7 +177,7 @@ public function grant($aro, $aco, $action = "*") {
* @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);
}
}
Expand Down Expand Up @@ -299,20 +299,20 @@ public function check($aro, $aco, $action = "*") {
$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;
}

$aroNode = $aroPath[0];
$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;
}

Expand Down Expand Up @@ -386,7 +386,7 @@ public function allow($aro, $aco, $actions = "*", $value = 1) {
$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])) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/Auth/BaseAuthorize.php
Expand Up @@ -87,7 +87,7 @@ abstract public function authorize($user, CakeRequest $request);
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;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/Auth/ControllerAuthorize.php
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/Auth/CrudAuthorize.php
Expand Up @@ -81,7 +81,7 @@ protected function _setPrefixMappings() {
*/
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
Expand Down
20 changes: 10 additions & 10 deletions lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -363,7 +363,7 @@ function __setDefaults() {

/**
* 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.
Expand Down Expand Up @@ -411,10 +411,10 @@ public function constructAuthorize() {
$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);
Expand All @@ -428,7 +428,7 @@ public function constructAuthorize() {
*
* 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.
Expand Down Expand Up @@ -458,7 +458,7 @@ public function allow() {
*
* 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
Expand Down Expand Up @@ -586,8 +586,8 @@ protected function _getUser() {
}

/**
* 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.
Expand Down Expand Up @@ -651,10 +651,10 @@ public function constructAuthenticate() {
$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);
Expand Down Expand Up @@ -707,4 +707,4 @@ public function loggedIn($logged = null) {
public function flash($message) {
$this->Session->setFlash($message, $this->flash['element'], $this->flash['params'], $this->flash['key']);
}
}
}
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/EmailComponent.php
Expand Up @@ -725,7 +725,7 @@ function _wrap($message, $lineLength = null) {
$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;
}

Expand Down

0 comments on commit f95340b

Please sign in to comment.