示例#1
0
文件: session.php 项目: uinerd/Code
 /**
  * Destroy current session
  */
 public static function delCurrent()
 {
     // Delete the global object
     if ($session = LigminchaGlobalSession::getCurrent()) {
         lgDebug('Session destroyed', $session);
         LigminchaGlobalDistributed::del(array('id' => $session->id));
     }
     // Delete the SSO cookie
     LigminchaGlobalSSO::delCookie();
 }
示例#2
0
文件: sso.php 项目: uinerd/Code
 function __construct()
 {
     // If the cookie is a not standard name, set it now
     $config = JFactory::getConfig();
     if ($cookie = $config->get('lgCookie', false)) {
         self::$cookie = $cookie;
     }
     $domain = $config->get('lgCookieDomain', '');
     lgDebug("Using cookie \"" . self::$cookie . "\" with domain \"{$domain}\"");
     // Make singleton available if we need it
     self::$instance = $this;
     // If this is an SSO token request and this is the master site, return the key
     if (LigminchaGlobalServer::getCurrent()->isMaster && array_key_exists(self::$cmd, $_REQUEST)) {
         self::setCookie($_REQUEST[self::$cmd]);
         exit;
     }
 }
示例#3
0
 function __construct()
 {
     $sa = LG_STANDALONE ? ' (standalone)' : '';
     $ip = $_SERVER['REMOTE_ADDR'];
     lgDebug("Request started for {$ip}{$sa}: " . join(',', array_keys($_REQUEST)));
     // Make singleton available if we need it
     self::$instance = $this;
     // Check that the local distributed database table exists and has a matching structure
     $this->checkTable();
     // Delete any objects that have reached their expiry time
     $this->expire();
     // Instantiate the main global objects
     LigminchaGlobalServer::getMaster();
     $server = LigminchaGlobalServer::getCurrent();
     LigminchaGlobalUser::checkAll();
     LigminchaGlobalSSO::makeSessionFromCookie();
     // If this is a changes request,
     if (array_key_exists(self::$cmd, $_REQUEST)) {
         // Commit the data (and re-route if master)
         $data = $_REQUEST[self::$cmd];
         if ($data) {
             print self::recvQueue($data);
         } elseif ($server->isMaster) {
             print self::encodeData($this->initialTableData());
         }
         // If we're the master, always send queue incase any re-routing
         if ($server->isMaster) {
             self::sendQueue();
         }
         exit;
     } elseif ($server->isMaster && array_key_exists('fakeinfo', $_REQUEST)) {
         $actions = array('edited', 'created', 'booked', 'posted');
         $titles = array('Alguma Coisa', 'Outra Coisa', 'Muitas Coisas', 'Mais ou Menos');
         $users = LigminchaGlobalUser::select();
         $user = $users[rand(0, count($users) - 1)]->data['realname'];
         $action = $actions[rand(0, count($actions) - 1)];
         $title = $titles[rand(0, count($titles) - 1)];
         new LigminchaGlobalLog("{$user} {$action} {$title}", 'Info', time() + 1000);
         self::sendToWebSocket(array(0, $server->id, 0, LigminchaGlobalSync::select()[0]), 0);
         self::sendQueue();
         exit;
     }
 }
示例#4
0
 /**
  * Called after the page has rendered but before it's been sent to the client
  */
 public function onAfterRender()
 {
     LigminchaGlobalSSO::appendTokenRequest();
     LigminchaGlobalSSO::toolbar();
     LigminchaGlobalDistributed::sendQueue();
 }