Options::set("MEMCACHE_ENABLED", false); Options::set("CACHE_ENABLED", !DEBUG); Options::set("JSON_HEADER", !DEBUG || isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && $_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest"); Options::set("SESSION_NAME", "CF"); Options::set("SESSION_TIMEOUT", ini_get("session.gc_maxlifetime")); Options::set("SESSION_REGENERATE", SESSION_TIMEOUT); Options::set("API_TOKEN_HEADER", "cf-token"); Options::set("ERROR_TEMPLATE", "error.php"); Options::set("CACHE_DIR", DATA_DIR . DIRECTORY_SEPARATOR . "cache"); Options::set("WWW_CACHE_DIR", WWW_DIR . DIRECTORY_SEPARATOR . "cache"); Options::set("LANG_DEFAULT", "en_US"); Options::set("LANG_AUTOLOAD", true); Options::set("LANG_AUTODETECT", true); Options::set("CF_URL", "https://github.com/DavBfr/cf"); Options::set("CF_AUTHOR", "David PHAM-VAN"); Options::set("CF_EMAIL", "*****@*****.**"); class CorePlugin extends Plugins { const config = "config"; public static function loadConfig() { $conf = Config::getInstance(); $memcache = new MemCache(); if (array_key_exists("JCONFIG_FILE", $memcache)) { $conf->setData($memcache["JCONFIG_FILE"]); Logger::debug("Config loaded from cache"); foreach ($conf->get("plugins", array()) as $plugin) { Plugins::add($plugin); } } else { $cache = Cache::Priv(self::config, ".php");
function configure($key, $value) { Options::set($key, $value); }
* Based on Portable PHP password hashing framework. * * Version 0.3 / genuine. * * Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in * the public domain. Revised in subsequent years, still public domain. * * There's absolutely no warranty. * * The homepage URL for this framework is: * * http://www.openwall.com/phpass/ **/ use Exception; Options::set("PASSWORD_ITERATION_COUNT", 8); Options::set("PASSWORD_PORTABLE", false); class Password { private $itoa64; private $iteration_count_log2; private $portable_hashes; private $random_state; public function __construct() { $iteration_count_log2 = PASSWORD_ITERATION_COUNT; $portable_hashes = PASSWORD_PORTABLE; $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) { $iteration_count_log2 = 8; } $this->iteration_count_log2 = $iteration_count_log2;