private function checkNewVersionIsAvailableOrDie() { $newVersion = Piwik_UpdateCheck::isNewestVersionAvailable(); if (!$newVersion) { throw new Exception("Your Piwik version " . Piwik_Version::VERSION . " is up to date."); } return $newVersion; }
private function checkNewVersionIsAvailableOrDie() { $newVersion = Piwik_UpdateCheck::isNewestVersionAvailable(); if (!$newVersion) { throw new Exception(Piwik_TranslateException('CoreUpdater_ExceptionAlreadyLatestVersion', Piwik_Version::VERSION)); } return $newVersion; }
/** * Renders the current view. * * @return string Generated template */ public function render() { try { $this->currentModule = Piwik::getModule(); $this->currentAction = Piwik::getAction(); $userLogin = Piwik::getCurrentUserLogin(); $this->userLogin = $userLogin; // workaround for #1331 $count = method_exists('Piwik', 'getWebsitesCountToDisplay') ? Piwik::getWebsitesCountToDisplay() : 1; $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count); usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);')); $this->sites = $sites; $this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl()); $this->token_auth = Piwik::getCurrentUserTokenAuth(); $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess(); $this->userIsSuperUser = Piwik::isUserIsSuperUser(); $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable(); $this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int'); $this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int'); if (Zend_Registry::get('config')->General->autocomplete_min_sites <= count($sites)) { $this->show_autocompleter = true; } else { $this->show_autocompleter = false; } // workaround for #1331 $this->loginModule = method_exists('Piwik', 'getLoginPluginName') ? Piwik::getLoginPluginName() : 'Login'; $user = Piwik_UsersManager_API::getInstance()->getUser($userLogin); $this->userAlias = $user['alias']; } catch (Exception $e) { // can fail, for example at installation (no plugin loaded yet) } $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime(); try { $this->totalNumberOfQueries = Piwik::getQueryCount(); } catch (Exception $e) { $this->totalNumberOfQueries = 0; } // workaround for #1331 if (method_exists('Piwik', 'overrideCacheControlHeaders')) { Piwik::overrideCacheControlHeaders('no-store'); } @header('Content-Type: ' . $this->contentType); if ($this->xFrameOptions) { @header('X-Frame-Options: ' . $this->xFrameOptions); } return $this->smarty->fetch($this->template); }
/** * Renders the current view. * * @return string Generated template */ public function render() { try { $this->currentModule = Piwik::getModule(); $this->currentAction = Piwik::getAction(); $userLogin = Piwik::getCurrentUserLogin(); $this->userLogin = $userLogin; $count = Piwik::getWebsitesCountToDisplay(); $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count); usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);')); $this->sites = $sites; $this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl()); $this->token_auth = Piwik::getCurrentUserTokenAuth(); $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess(); $this->userIsSuperUser = Piwik::isUserIsSuperUser(); $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable(); $this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int'); $this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int'); if (Piwik_Config::getInstance()->General['autocomplete_min_sites'] <= count($sites)) { $this->show_autocompleter = true; } else { $this->show_autocompleter = false; } $this->loginModule = Piwik::getLoginPluginName(); $user = Piwik_UsersManager_API::getInstance()->getUser($userLogin); $this->userAlias = $user['alias']; } catch (Exception $e) { // can fail, for example at installation (no plugin loaded yet) } $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime(); try { $this->totalNumberOfQueries = Piwik::getQueryCount(); } catch (Exception $e) { $this->totalNumberOfQueries = 0; } Piwik::overrideCacheControlHeaders('no-store'); @header('Content-Type: ' . $this->contentType); // always sending this header, sometimes empty, to ensure that Dashboard embed loads (which could call this header() multiple times, the last one will prevail) @header('X-Frame-Options: ' . (string) $this->xFrameOptions); return $this->smarty->fetch($this->template); }
function updateCheck() { Piwik_UpdateCheck::check(); }
public function render() { try { $this->currentModule = Piwik::getModule(); $this->currentPluginName = Piwik::getCurrentPlugin()->getName(); $this->userLogin = Piwik::getCurrentUserLogin(); $showWebsiteSelectorInUserInterface = Zend_Registry::get('config')->General->show_website_selector_in_user_interface; if ($showWebsiteSelectorInUserInterface) { $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess(); usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);')); $this->sites = $sites; } $this->showWebsiteSelectorInUserInterface = $showWebsiteSelectorInUserInterface; $this->url = Piwik_Url::getCurrentUrl(); $this->token_auth = Piwik::getCurrentUserTokenAuth(); $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess(); $this->userIsSuperUser = Piwik::isUserIsSuperUser(); $this->piwik_version = Piwik_Version::VERSION; $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable(); $this->loginModule = Zend_Registry::get('auth')->getName(); } catch (Exception $e) { // can fail, for example at installation (no plugin loaded yet) } $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime(); try { $this->totalNumberOfQueries = Piwik::getQueryCount(); } catch (Exception $e) { $this->totalNumberOfQueries = 0; } @header('Content-Type: text/html; charset=utf-8'); @header("Pragma: "); @header("Cache-Control: no-store, must-revalidate"); return $this->smarty->fetch($this->template); }
/** * Must be called before dispatch() * - checks that directories are writable, * - loads the configuration file, * - loads the plugin, * - inits the DB connection, * - etc. * * @return void */ function init() { try { Zend_Registry::set('timer', new Piwik_Timer()); $directoriesToCheck = array('/tmp', '/tmp/templates_c', '/tmp/cache'); Piwik::checkDirectoriesWritableOrDie($directoriesToCheck); self::assignCliParametersToRequest(); $exceptionToThrow = false; try { Piwik::createConfigObject(); } catch (Exception $e) { Piwik_PostEvent('FrontController.NoConfigurationFile', $e); $exceptionToThrow = $e; } Piwik_Translate::getInstance()->loadEnglishTranslation(); $pluginsManager = Piwik_PluginsManager::getInstance(); $pluginsManager->setPluginsToLoad(Zend_Registry::get('config')->Plugins->Plugins->toArray()); if ($exceptionToThrow) { throw $exceptionToThrow; } Piwik::createDatabaseObject(); Piwik::createLogObject(); // creating the access object, so that core/Updates/* can enforce Super User and use some APIs Piwik::createAccessObject(); Piwik::displayScreenForCoreAndPluginsUpdatesIfNecessary(); Piwik_PluginsManager::getInstance()->installLoadedPlugins(); Piwik::install(); Piwik_PostEvent('FrontController.initAuthenticationObject'); try { $authAdapter = Zend_Registry::get('auth'); } catch (Exception $e) { throw new Exception("Authentication object cannot be found in the Registry. Maybe the Login plugin is not activated?\n\t\t\t\t\t\t\t\t\t<br>You can activate the plugin by adding:<br>\n\t\t\t\t\t\t\t\t\t<code>Plugins[] = Login</code><br>\n\t\t\t\t\t\t\t\t\tunder the <code>[Plugins]</code> section in your config/config.inc.php"); } Zend_Registry::get('access')->reloadAccess($authAdapter); Piwik::raiseMemoryLimitIfNecessary(); Piwik_Translate::getInstance()->loadUserTranslation(); $pluginsManager->setLanguageToLoad(Piwik_Translate::getInstance()->getLanguageToLoad()); $pluginsManager->postLoadPlugins(); Piwik_UpdateCheck::check(); } catch (Exception $e) { Piwik_ExitWithMessage($e->getMessage(), $e->getTraceAsString(), true); } }