예제 #1
0
    /**
     * Constructor
     * Calls the parent constructor to register the methods
     *
     * @return object
     */
    public function __construct()
    {
        parent::__construct($this);
        if (!($this->aliases = $this->_cache->get('aliases'))) {
            $query = 'SELECT id, alias, url, redirect
						  FROM {PREFIX}mod_aliases ORDER BY alias ASC';
            foreach ($this->_sql->query($query, PDO::FETCH_ASSOC) as $row) {
                $this->aliases[trim($row['alias'], '/')] = array('id' => $row['id'], 'alias' => $row['alias'], 'url' => trim($row['url'], '/'), 'redirect' => (bool) $row['redirect']);
            }
            $this->_cache->add('aliases', $this->aliases);
        }
        if (!is_array($this->aliases)) {
            $this->aliases = array();
        }
    }
예제 #2
0
 /**
  * Constructor
  * Calls the parent constructor to register the methods
  *
  * Also gathers the version file to get latest versions
  *
  * @return object
  */
 public function __construct()
 {
     parent::__construct($this);
     $verFile = $this->_zula->getDir('tmp') . '/sysinfo/versions';
     if (file_exists($verFile) && is_readable($verFile) && filemtime($verFile) + 60 * 60 * 8 > time()) {
         $this->versions = @unserialize(file_get_contents($verFile));
     } else {
         // Attempt to re-read the versions
         if (ini_get('allow_url_fopen')) {
             $stream = stream_context_create(array('http' => array('method' => 'GET', 'header' => 'X-TangoCMS-Version: ' . _PROJECT_VERSION . "\r\n" . 'X-TangoCMS-USI: ' . zula_hash($_SERVER['HTTP_HOST']) . "\r\n", 'timeout' => 6)));
             foreach (array('stable', 'unstable') as $type) {
                 $tmpVer = @file_get_contents('http://releases.tangocms.org/latest/' . $type, false, $stream);
                 if (isset($http_response_header[0]) && strpos($http_response_header[0], '200') !== false) {
                     $this->versions[$type] = trim($tmpVer);
                 }
             }
             if (zula_make_dir($this->_zula->getDir('tmp') . '/sysinfo')) {
                 file_put_contents($verFile, serialize($this->versions));
             }
         } else {
             $this->_log->message('Sysinfo unable to get latest TangoCMS versions, allow_url_fopen disabled', Log::L_NOTICE);
         }
     }
 }
예제 #3
0
 /**
  * Constructor
  * Calls the parent constructor to register the methods
  *
  * @return object
  */
 public function __construct()
 {
     parent::__construct($this);
 }