/** * The top part of the caching system */ public static function startBuffer() { //naming issues here, pls fix file naming issues self::$script = new DFile(str_replace(array('?', '/', ','), '_', self::$config['cacheFolder'] . self::$config['cachePrefix'] . DRequest::SERVER('REQUEST_URI') . '.cache')); if (self::$script->exists()) { if (self::$script->lastModifiedTime() > time() - self::$config['cacheThreshold']) { include_once self::$script->handle; exit; } } ob_start('ob_gzhandler'); }
/** * * @param DRequest $request * @return DResponse */ protected function handleRequest($request) { list($route, $params) = $request->resolve(); $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->response; if ($result !== null) { $response->data = $result; } return $response; }
public static function init() { self::$GET =& $_GET; //note the reference pass self::$POST =& $_POST; self::$SERVER =& $_SERVER; if (get_magic_quotes_gpc()) { @set_magic_quotes_runtime(0); } if (!empty(self::$GET)) { self::doSqlInjectionCleanup(self::$GET); self::$isPost = false; } if (!empty(self::$POST)) { self::doSqlInjectionCleanup(self::$POST); } self::doSqlInjectionCleanup(self::$SERVER); unset($GLOBALS['db_character_set']); unset($GLOBALS['cachedir']); }
/** * The unique hash is used to prevent csrf attacks, form re-submission, remote form submission, and unique links per user * @return string */ public static function uniqueHash() { return hash(settings::$ecryptionScheme['core'], DRequest::getUniqueId()); //todo you should revise the uniqueness of this hash }