Exemplo n.º 1
0
 private function __construct()
 {
     try {
         $this->id = session_id();
         $this->database = Database::singleton();
         // AMPERSAND SESSION
         Concept::getConcept('SESSION');
         // Remove expired Ampersand sessions from __SessionTimeout__ and all concept tables and relations where it appears.
         $expiredSessionsAtoms = array_column($this->database->Exe("SELECT SESSION FROM `__SessionTimeout__` WHERE `lastAccess` < " . (time() - Config::get('sessionExpirationTime'))), 'SESSION');
         foreach ($expiredSessionsAtoms as $expiredSessionAtom) {
             $this->destroyAmpersandSession($expiredSessionAtom);
         }
         // Create a new Ampersand session if session_id() is not in SESSION table (browser started a new session or Ampersand session was expired
         $sessionAtom = new Atom($this->id, 'SESSION');
         if (!$sessionAtom->atomExists()) {
             $this->database->addAtomToConcept($this->id, 'SESSION');
             $this->database->commitTransaction();
             //TODO: ook door Database->closeTransaction() laten doen, maar die verwijst terug naar Session class voor de checkrules. Oneindige loop
         }
         $this->database->Exe("INSERT INTO `__SessionTimeout__` (`SESSION`,`lastAccess`) VALUES ('" . $this->id . "', '" . time() . "') ON DUPLICATE KEY UPDATE `lastAccess` = '" . time() . "'");
     } catch (Exception $e) {
         throw $e;
     }
 }
Exemplo n.º 2
0
 public static function getAffectedInvConjuncts($concept)
 {
     $conceptInfo = Concept::getConcept($concept);
     return (array) $conceptInfo['affectedInvConjunctIds'];
 }