public static function handler($exception) { if ($exception instanceof Exception) { $debugging = defined('IS_DEBUGGING') ? IS_DEBUGGING : false; $production = defined('IS_PRODUCTION') ? IS_PRODUCTION : false; if (true == $debugging) { if (true == $production) { LJL_Log::write(API_String::clean($exception), LJL_Log::TYPE_EXCEPTION); } else { echo LJL_Request::resolveType() == LJL_Request::CLI ? API_String::clean($exception) : $exception; } } else { header('location: ' . SYSTEM_HOMEPAGE); } } }
public static function handler($level, $errorMsg, $file, $line, $context = null) { if ('.tpl.php' == substr($file, -8)) { return; } $str = new LJL_Exception($errorMsg, $level, $file, $line); $debugging = IS_DEBUGGING; $production = IS_PRODUCTION; if ($debugging) { $content = "<br />\n<h2>Error Info:</h2>\n" . '<b>MESSAGE:</b> ' . $errorMsg . "<br />\n" . '<b>TYPE:</b> ' . (isset(self::$levels[$level]) ? self::$levels[$level] : $level) . "<br />\n" . '<b>FILE:</b> ' . $file . "<br />\n" . '<b>LINE:</b> ' . $line . "<br />\n" . $str; if ($production) { LJL_Log::write(API_String::clean($content), LJL_Log::TYPE_ERROR); } else { echo LJL_Request::resolveType() == LJL_Request::CLI ? API_String::clean($content) : $content; } } }
public function getByMethod($key = '', $method = 'get', $allowTags = false) { $ret = ''; if (empty($key)) { if (false === $allowTags) { $ret = API_String::clean($this->_a[$method]); } else { $ret = $this->_a[$method]; } } elseif (isset($this->_a[$method][$key])) { // don't operate on reference to avoid segfault :-( $ret = $this->_a[$method][$key]; // if html not allowed, run an enhanced strip_tags() if (false === $allowTags) { $ret = API_String::clean($ret); } } if (!empty($ret)) { if (self::AJAX == $this->getType() && strcasecmp(SYSTEM_CHARSET, 'utf-8')) { if (in_array(strtolower($method), array('get', 'post')) && !empty($ret)) { $ret = API_String::convertEncodingDeep($ret, SYSTEM_CHARSET, 'utf-8'); } } } return $ret; }