/** * append some more infos to better track down the error * @return string * 2011-12-21 ms */ public static function traceDetails() { App::uses('CommonComponent', 'Tools.Controller/Component'); $currentUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : 'n/a'; $refererUrl = CommonComponent::getReferer(); //Router::getRequest()->url().' App::uses('CakeSession', 'Model/Datasource'); $uid = CakeSession::read('Auth.User.id'); if (empty($uid)) { $uid = !empty($_SESSION) && !empty($_SESSION['Auth']['User']['id']) ? $_SESSION['Auth']['User']['id'] : null; } $data = array(@CakeRequest::clientIp(), $currentUrl . (!empty($refererUrl) ? ' (' . $refererUrl . ')' : ''), $uid, env('HTTP_USER_AGENT')); return implode(' - ', $data); }
/** * logs attempts * @param bool errorsOnly (only if error occured, otherwise always) * @returns null if not logged, true otherwise * 2009-12-18 ms */ protected function _logAttempt($errorsOnly = true) { if ($errorsOnly === true && empty($this->error) && empty($this->internalError)) { return null; } if (!$this->settings[$this->Model->alias]['log']) { return null; } //App::import('Component', 'RequestHandler'); $msg = 'IP \'' . CakeRequest::clientIP() . '\', Agent \'' . env('HTTP_USER_AGENT') . '\', Referer \'' . env('HTTP_REFERER') . '\', Host-Referer \'' . CommonComponent::getReferer() . '\''; if (!empty($this->error)) { $msg .= ', ' . $this->error; } if (!empty($this->internalError)) { $msg .= ' (' . $this->internalError . ')'; } $this->log($msg, 'captcha'); return true; }