Exemplo n.º 1
0
 /**
  * @implements <SessionBase::Restore>
  */
 function &Restore($id)
 {
     global $CONFIG;
     if (isset($GLOBALS['object_storage'][strtolower($id)])) {
         return $GLOBALS['object_storage'][strtolower($id)];
     }
     $rs = $this->ds->ExecuteSql("SELECT content FROM " . $CONFIG['session']['table'] . "\n\t\t\tWHERE id=?0 AND storage_id=?1 LIMIT 1", array(session_id(), $id));
     if ($rs->Count() == 0) {
         log_trace("Trying to restore unknown object '{$id}'");
         $null = null;
         return $null;
     }
     $data = $rs['content'];
     $serializer = new Serializer();
     $res = $serializer->Unserialize($data);
     $GLOBALS['object_storage'][strtolower($id)] = $res;
     return $GLOBALS['object_storage'][strtolower($id)];
 }
Exemplo n.º 2
0
/**
 * @shortcut <Serializer::Unserialize>
 */
function session_unserialize($value)
{
    $s = new Serializer();
    $res = $s->Unserialize($value);
    return $res;
}
Exemplo n.º 3
0
 /**
  * @implements <SessionBase::Restore>
  */
 function &Restore($id)
 {
     global $CONFIG;
     $id = strtolower($id);
     if (isset($GLOBALS['object_storage'][$id])) {
         return $GLOBALS['object_storage'][$id];
     }
     if (!isset($_SESSION[$CONFIG['session']['prefix'] . "session"][$id])) {
         $null = null;
         return $null;
     }
     $data = $_SESSION[$CONFIG['session']['prefix'] . "session"][$id];
     $serializer = new Serializer();
     $res = $serializer->Unserialize($data);
     $GLOBALS['object_storage'][$id] = $res;
     return $GLOBALS['object_storage'][$id];
 }