Example #1
0
 static function init()
 {
     self::$maxlifetime && ini_set('session.gc_maxlifetime', self::$maxlifetime);
     !isset($_SESSION) && session_start();
     if (self::$maxpause && isset($_SESSION['qgLastAccessTime']) && $_SESSION['qgLastAccessTime'] && $_SESSION['qgLastAccessTime'] + self::$maxpause < time()) {
         $_SESSION = array();
     }
     $_SESSION['qgLastAccessTime'] = time();
     liveClient::init();
     qgAuth::listen();
     if (!isset($_SESSION['liveSess']['id'])) {
         $_SESSION['liveSess']['id'] = D()->sess->insert(array('ip' => $_SERVER['REMOTE_ADDR'], 'usr_id' => Usr(), 'client_id' => liveClient::$id, 'time' => time()));
     }
     self::$id = $_SESSION['liveSess']['id'];
 }
Example #2
0
<?php

namespace qg;

qg::on('action', function () {
    // use 'render' ? would be .5 miliseconds slower :(
    liveSess::$maxpause = G()->SET['qg']['session']['maxpause']->v;
    liveSess::init();
    G()->win = isset(G()->ASK['rTicket']) ? G()->ASK['rTicket'] : (isset($_GET['rTicket']) ? $_GET['rTicket'] : null);
    if (G()->win && !rTicket::check(G()->win)) {
        Answer(array('info' => 'rTicket nicht gültig'));
    }
    if (!G()->win) {
        G()->win = rTicket::get();
    }
    L::init();
    liveLog::init();
    // todo: country from ip?
    $l_country = 'ch';
    if (Usr()->is()) {
        $values = Usr()->getVs();
        if (isset($values['country']) && $values['country']) {
            $l_country = $values['country'];
        }
    }
    $winCountryTranslate = array('ch' => 's', 'at' => 'a', 'de' => 'u', 'it' => 'a', 'fr' => 'a', 'pl' => 'k');
    setLocale(LC_ALL, L() . '_' . strtoupper($l_country) . '.utf8', L() . $winCountryTranslate[strtolower($l_country)], L());
    if (strpos(appRequestUri, 'dbFile/') === 0) {
        $request = substr(appRequestUri, 7);
        dbFile::output($request);
    }