Ejemplo n.º 1
0
 /**
  * Get Cache
  *
  * @param string $flag
  * @return null|mixed
  */
 public function get($flag)
 {
     if ($this->cacheActive) {
         $cache = read_file(MAIN_PATH . 'storage/cache/' . sha1($flag . ($this->cacheEncrypt ? '_encrypt' : '')));
         if ($cache != null) {
             if ($this->cacheEncrypt) {
                 $cache = (array) @unserialize(trim(Encryption::decode($cache)));
             } else {
                 $cache = (array) @unserialize($cache);
             }
             if ($cache['date_created'] + $cache['max_age'] > time()) {
                 return $cache['data'];
             }
         }
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * Self Get Session Data
  *
  * @return array|null
  */
 private function getSessionData()
 {
     $sessionId = $this->getSessionId();
     $string = read_file(MAIN_PATH . $this->sessionPath . $sessionId, $this->sessionMaxSize);
     if ($string != null) {
         if ($this->sessionEncrypt) {
             $this->sessionData = (array) @unserialize(trim(Encryption::decode($string, $this->sessionKey)));
         } else {
             $this->sessionData = (array) @unserialize($string);
         }
         if ($this->sessionData != null) {
             $sess_user_agent = isset($this->sessionData['SESS_USER_AGENT']) ? $this->sessionData['SESS_USER_AGENT'] : '';
             $sess_ip_addr = isset($this->sessionData['SESS_IP_ADDR']) ? $this->sessionData['SESS_IP_ADDR'] : '';
             $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
             $ip_addr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
             if ($user_agent == $sess_user_agent) {
                 if (!$this->sessionMatchIP) {
                     return $this->sessionData;
                 } elseif ($ip_addr == $sess_ip_addr) {
                     return $this->sessionData;
                 }
             }
         }
     }
     return $this->sessionData;
 }
Ejemplo n.º 3
0
 public function encryption()
 {
     echo $cipher = Encryption::encode('Are you authorized to profile this page? Probe not found or invalid signature. This is the most common issue when installing the Blackfire stack. If this issue occurs, please follow these steps:');
     echo nl2br(PHP_EOL) . nl2br(PHP_EOL);
     echo Encryption::decode($cipher);
 }