public function indexAction() { USVN_Update::updateUSVNAvailableVersionNumber(); $this->_helper->viewRenderer->setNoRender(true); $this->view->layout()->disableLayout(); header('Cache-Control: max-age=3600, must-revalidate'); header("Content-type: {$this->_mimetype}"); echo file_get_contents(USVN_PUB_DIR . "/medias/" . 'usvn' . "/images/empty.png"); }
public function indexAction() { $this->view->config = Zend_Registry::get('config'); $this->view->available_version = USVN_Update::getUSVNAvailableVersion(); }
public function test_updateUSVNAvailableVersionNumber() { USVN_Update::updateUSVNAvailableVersionNumber(); $this->assertEquals("1.0.1", USVN_Update::getUSVNAvailableVersion()); $config = Zend_Registry::get('config'); $this->assertNotEquals(0, $config->update->lastcheckforupdate); }
/** * Update file with USVN version number */ public static function updateUSVNAvailableVersionNumber() { if (USVN_Update::itsCheckForUpdateTime()) { $config = Zend_Registry::get('config'); $url = 'http://www.usvn.info'; $http_conf = USVN_Update::setProxyForUpdate(array('maxredirects' => 0, 'timeout' => 30)); // if (defined("PHPUnit_MAIN_METHOD")) // $url = 'http://iceage.usvn.info'; $client = new Zend_Http_Client($url . '/update/' . urlencode($config->version), $http_conf); $client->setParameterPost('sysinfo', USVN_Update::getInformationsAboutSystem()); try { $response = $client->request('POST'); } catch (Exception $e) { // Ugly but we don't want to display error if usvn.info is not available return; } if ($response->getStatus() == 200) { $config->update->availableversion = $response->getBody(); $config->save(); } $config->update->lastcheckforupdate = time(); $config->save(); } }
$autoloader->registerNamespace("USVN_"); $autoloader->registerNamespace("menus_"); require_once 'functions.php'; /* Config Loading or Installation */ try { $config = new USVN_Config_Ini(USVN_CONFIG_FILE, USVN_CONFIG_SECTION); if (empty($config) && file_exists(USVN_CONFIG_FILE)) { echo 'Config file unreadeable'; exit(0); } if (!isset($config->version)) { header('Location: install.php'); exit(0); } if ($config->version != USVN_CONFIG_VERSION) { USVN_Update::runUpdate(); } } catch (Exception $e) { header('Location: install.php'); // echo '<pre>' . "\n"; // echo $e; // echo '</pre>' . "\n"; // exit(0); } /* USVN Configuration */ date_default_timezone_set($config->timezone); USVN_ConsoleUtils::setLocale($config->system->locale); USVN_Translation::initTranslation($config->translation->locale, USVN_LOCALE_DIR); USVN_Template::initTemplate($config->template->name, USVN_MEDIAS_DIR); /* Zend Configuration */ Zend_Registry::set('config', $config);