public function execute($target = '', $data = array(), $age = '')
 {
     $mod = cms_utils::get_module('ModuleManager');
     if (!$age) {
         $age = get_site_preference('browser_cache_expiry', 60);
     }
     if ($age) {
         $age = max(1, (int) $age);
     }
     // build a signature
     $this->_signature = md5(serialize(array($target, $data)));
     $fn = $this->_getCacheFile();
     if (!$fn) {
         return;
     }
     // check for the cached file
     $atime = time() - $age * 60;
     $status = '';
     $resutl = '';
     if ($mod->GetPreference('disable_caching', 0) || !file_exists($fn) || filemtime($fn) <= $atime) {
         // execute the request
         $req = new cms_http_request();
         if ($this->_timeout) {
             $req->setTimeout($this->_timeout);
         }
         $req->execute($target, '', 'POST', $data);
         $this->_status = $req->getStatus();
         $this->_result = $req->getResult();
         @unlink($fn);
         if ($this->_status == 200) {
             // create a cache file
             $fh = fopen($fn, 'w');
             fwrite($fh, serialize(array($this->_status, $this->_result)));
             fclose($fh);
         }
     } else {
         // get data from the cache.
         $data = unserialize(file_get_contents($fn));
         $this->_status = $data[0];
         $this->_result = $data[1];
     }
 }
예제 #2
0
     $themeObject->AddNotification(1, 'Core', lang('installdirwarning'));
 }
 // Display a warning if safe mode is enabled
 if (ini_get_boolean('safe_mode') && get_site_preference('disablesafemodewarning', 0) == 0) {
     $themeObject->AddNotification(1, 'Core', lang('warning_safe_mode'));
 }
 // Display a warning sitedownwarning
 $sitedown_message = lang('sitedownwarning', TMP_CACHE_LOCATION . '/SITEDOWN');
 $sitedown_file = TMP_CACHE_LOCATION . '/SITEDOWN';
 if (file_exists($sitedown_file)) {
     $themeObject->AddNotification(1, 'Core', $sitedown_message);
 }
 $timelastchecked = get_site_preference('lastcmsversioncheck', 0);
 if (get_site_preference('checkversion', 1) && time() - $timelastchecked > 24 * 60 * 60 || isset($_GET['forceversioncheck'])) {
     $req = new cms_http_request();
     $req->setTimeout(10);
     $req->execute(CMS_DEFAULT_VERSIONCHECK_URL);
     if ($req->getStatus() == 200) {
         $remote_ver = trim($req->getResult());
         if (strpos($remote_ver, ':') !== FALSE) {
             list($tmp, $remote_ver) = explode(':', $remote_ver, 2);
             $remote_ver = trim($remote_ver);
         }
         if (version_compare(CMS_VERSION, $remote_ver) < 0) {
             set_site_preference('cms_is_uptodate', 0);
             $themeObject->AddNotification(1, 'Core', lang('new_version_available'));
             audit('', 'Core', 'CMSMS version ' . $remote_ver . ' is available');
         } else {
             set_site_preference('cms_is_uptodate', 1);
             audit('', 'Core', 'Tested for newer CMSMS Version. None Available.');
         }