protected function init() { parent::init(); $this->divPath = $this->_module . '/' . Config::divisions($this->_division); $this->divPrefix = $this->_division === '' ? '' : $this->_division . '_'; $this->divPostfix = $this->_division === '' ? '' : '.' . $this->_division; }
public function __construct() { $config = Config::get('application'); Session::start(); if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = stripslashes_deep($_POST); $_GET = stripslashes_deep($_GET); $_COOKIE = stripslashes_deep($_COOKIE); $_REQUEST = stripslashes_deep($_REQUEST); } if (isset($config['response']['defaultHeaders'])) { foreach ($config['response']['defaultHeaders'] as $header) { header($header); } } AbstractDb::$useMemcacheForMetadata = $config['useCache']; Object::$debug = MySQL::$monitorQueries = $config['debug']; Db::setConfig(Config::get('database')); $this->initialize(); }
public static function getModuleViewCached($division, $module, $method) { $params = func_get_args(); if (Config::application('useCache') && !DEBUG) { $key = self::getCacheKeyForCall($params); $retValue = Memcache::remember($key, function () use($params) { return call_user_func_array(array('self', 'getModuleView'), $params); }); } else { // [TODO]: cache 2 file //call_user_func_array(array(self,'getModuleView'),$params); $retValue = call_user_func_array(array('self', 'getModuleView'), $params); } return $retValue; }
/** * @deprecated * * @param string $rpcQuery with xmlrpc * @exception 123x */ private function parseRpcQuery($rpcQuery) { $rpcRequest = new XmlRpcRequest($rpcQuery); if ($rpcRequest->errno) { $this->__raiseError(1231, $rpcRequest->errno, $rpcRequest->error); } $appConfig = Config::get('application'); $parts = explode('.', $rpcRequest->methodName); $partsCnt = count($parts); if ($partsCnt > 0 && in_array($parts[0], Config::get('divisions'))) { $this->_division = $parts[0]; $parts = array_slice($parts, 1); } else { $this->_division = ''; } if (empty($parts[0])) { $this->_module = $appConfig['module']['default']; } else { $this->_module = $parts[0]; } if ($partsCnt < 2 || empty($parts[1])) { $this->_method = $appConfig['module']['defaultMethodsControllerAction']; } else { $this->_method = $parts[1]; } $this->_params = $rpcRequest->params; }
if (Config::application('debug')) { echo '<tt>' . nl2br(htmlspecialchars("\n" . 'DEBUG Info: ' . $screenMsg)) . '</tt><br/>'; } else { header('HTTP/1.1 500 Internal Server Error'); include HTTPERRORS . '500.php'; } } Log::add($message, 'core.module'); } catch (\Exception $exc) { $message = "\n" . 'error [' . $exc->getCode() . ']: ' . $exc->getMessage() . "\n\n" . $exc->getTraceAsString(); $screenMsg = $message . "\n\n" . '$_GET: ' . print_r($_GET, true) . "\n" . '$_POST: ' . print_r($_POST, true); if ($mEngine !== null && $mEngine->responseType == ResponseType::rpc) { header('Content-type: text/xml; charset=' . Config::application('encoding')); echo XmlRpcResponse::fault($exc->getCode(), DEBUG ? $screenMsg : 'Internal Server Error.'); } else { if (Config::application('debug')) { $error = htmlspecialchars($screenMsg); } if ($exc->getCode() == 1242 || $exc->getCode() == 1222) { header('HTTP/1.1 404 Not Found'); include HTTPERRORS . '404.php'; } else { header('HTTP/1.1 500 Internal Server Error'); include HTTPERRORS . '500.php'; } } if ($exc->getCode() == 1242) { Log::warning(' Request: ' . $_SERVER['REQUEST_URI'] . ' Referer: ' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 'core.notFound'); } else { Log::add($message, 'core.module'); }
private static function getConfig() { $config = Config::getOrEmpty('cache'); return Arr::overwrite(static::$defaultConfig, isset($config['memcache']) ? $config['memcache'] : []); }
private static function loadFromConfig() { static::$config = Arr::overwrite(static::$defaultConfig, Config::getOrEmpty('log')); static::$config['folder'] = rtrim(static::$config['folder'], '/\\ '); return static::$config; }