Beispiel #1
0
 public static function employ()
 {
     if (func_num_args() === 1) {
         self::$employ = func_get_arg(0);
     }
     return self::$employ;
 }
 public function __construct($params = null)
 {
     if (!empty($params)) {
         $key = array_shift($params);
     }
     if (empty($key) && empty($_COOKIE[EpiSession::COOKIE])) {
         setcookie(EpiSession::COOKIE, md5(uniqid(rand(), true)), time() + 1209600, '/');
     }
     $this->memcached = EpiCache::getInstance(EpiCache::MEMCACHED);
     $this->key = empty($key) ? $_COOKIE[EpiSession::COOKIE] : $key;
     $this->store = $this->getAll();
 }
Beispiel #3
0
$epiPath = "{$basePath}/libraries/external/epi";
require "{$epiPath}/Epi.php";
require "{$basePath}/libraries/compatability.php";
require "{$basePath}/libraries/models/UserConfig.php";
Epi::setSetting('exceptions', true);
Epi::setPath('base', $epiPath);
Epi::setPath('config', "{$basePath}/configs");
Epi::setPath('view', '');
Epi::init('api', 'cache', 'config', 'curl', 'form', 'logger', 'route', 'session', 'template', 'database');
$routeObj = getRoute();
$apiObj = getApi();
// loads configs and dependencies
$userConfigObj = new UserConfig();
$hasConfig = $userConfigObj->load();
$configObj = getConfig();
EpiCache::employ($configObj->get('epi')->cache);
$sessionParams = array($configObj->get('epi')->session);
if ($configObj->get('epiSessionParams')) {
    $sessionParams = array_merge($sessionParams, (array) $configObj->get('epiSessionParams'));
    // for TLDs we need to override the cookie domain if specified
    if (isset($sessionParams['domain']) && stristr($_SERVER['HTTP_HOST'], $sessionParams['domain']) === false) {
        $sessionParams['domain'] = $_SERVER['HTTP_HOST'];
    }
    $sessionParams = array_values($sessionParams);
    // reset keys
}
EpiSession::employ($sessionParams);
getSession();
// load theme after everything is initialized
// this initializes user which extends BaseModel and gets session, config and cache objects
$userConfigObj->loadTheme();