function getSearchEnginesAndKeywords() { $view = new Piwik_View('Referers/templates/searchEngines_Keywords.tpl'); $view->searchEngines = $this->getSearchEngines(true); $view->keywords = $this->getKeywords(true); echo $view->render(); }
function index() { $view = new Piwik_View('DBStats/templates/DBStats.tpl'); $view->tablesStatus = Piwik_DBStats_API::getAllTablesStatus(); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); }
function render() { // prepare the all steps templates $this->currentStepId = array_search($this->currentStepName, $this->steps); $this->totalNumberOfSteps = count($this->steps); $this->percentDone = round(($this->currentStepId) * 100 / ($this->totalNumberOfSteps-1)); $this->percentToDo = 100 - $this->percentDone; $this->nextModuleName = ''; if(isset($this->steps[$this->currentStepId + 1])) { $this->nextModuleName = $this->steps[$this->currentStepId + 1]; } $this->previousModuleName = ''; if(isset($this->steps[$this->currentStepId - 1])) { $this->previousModuleName = $this->steps[$this->currentStepId - 1]; } $this->previousPreviousModuleName = ''; if(isset($this->steps[$this->currentStepId - 2])) { $this->previousPreviousModuleName = $this->steps[$this->currentStepId - 2]; } return parent::render(); }
function index() { $view = new Piwik_View('VisitorInterest/templates/index.tpl'); $view->dataTableNumberOfVisitsPerVisitDuration = $this->getNumberOfVisitsPerVisitDuration(true); $view->dataTableNumberOfVisitsPerPage = $this->getNumberOfVisitsPerPage(true); echo $view->render(); }
/** * send email to Piwik team and display nice thanks */ function sendFeedback() { $body = Piwik_Common::getRequestVar('body', '', 'string'); $email = Piwik_Common::getRequestVar('email', '', 'string'); $view = new Piwik_View('Feedback/templates/sent.tpl'); try { $minimumBodyLength = 35; if (strlen($body) < $minimumBodyLength) { throw new Exception(sprintf("Message must be at least %s characters long.", $minimumBodyLength)); } if (!Piwik::isValidEmailString($email)) { throw new Exception(Piwik_Translate('UsersManager_ExceptionInvalidEmail')); } if (strpos($body, 'http://') !== false) { throw new Exception("The message cannot contain a URL, to avoid spams messages."); } $mail = new Piwik_Mail(); $mail->setFrom($email); $mail->addTo('*****@*****.**', 'Piwik Team'); $mail->setSubject('[ Feedback form - Piwik ]'); $mail->setBodyText($body); @$mail->send(); } catch (Exception $e) { $view->ErrorString = $e->getMessage(); $view->message = $body; } echo $view->render(); }
/** Latest searches method */ public function searches() { $view = new Piwik_View('LatestReferrers/templates/searches.tpl'); $view->latestSearches = $this->latestSearches(true); $view->latestNewSearches = $this->latestNewSearches(true); echo $view->render(); }
function index() { $view = new Piwik_View('VisitTime/templates/index.tpl'); $view->dataTableVisitInformationPerLocalTime = $this->getVisitInformationPerLocalTime(true); $view->dataTableVisitInformationPerServerTime = $this->getVisitInformationPerServerTime(true); echo $view->render(); }
function showLanguagesSelector() { $view = new Piwik_View("LanguagesManager/templates/languages.tpl"); $view->languages = Piwik_LanguagesManager_API::getAvailableLanguageNames(); $view->currentLanguageCode = self::getLanguageCodeForCurrentUser(); $view->currentLanguageName = self::getLanguageNameForCurrentUser(); echo $view->render(); }
/** * Show styled language selection drop-down list * * @param string $url The form action. Default is to save language. */ function showLanguagesSelector() { // don't use Piwik_View::factory() here $view = new Piwik_View("LanguagesManager/templates/languages.tpl"); $view->languages = Piwik_LanguagesManager_API::getInstance()->getAvailableLanguageNames(); $view->currentLanguageCode = self::getLanguageCodeForCurrentUser(); $view->currentLanguageName = self::getLanguageNameForCurrentUser(); Piwik_AddTopMenu('LanguageSelector', $view->render(), true, $order = 30, true); }
public function index() { $view = new Piwik_View('Actions/index.tpl'); /* Actions, Downloads, Outlinks */ $view->dataTableActions = $this->getActions(true); $view->dataTableDownloads = $this->getDownloads(true); $view->dataTableOutlinks = $this->getOutlinks(true); echo $view->render(); }
function index() { $view = new Piwik_View('UserCountry/templates/index.tpl'); $view->urlSparklineCountries = $this->getUrlSparkline('getLastDistinctCountriesGraph'); $view->numberDistinctCountries = $this->getNumberOfDistinctCountries(true); $view->dataTableCountry = $this->getCountry(true); $view->dataTableContinent = $this->getContinent(true); echo $view->render(); }
function iframe() { $controllerName = Piwik_Common::getRequestVar('moduleToWidgetize'); $actionName = Piwik_Common::getRequestVar('actionToWidgetize'); $parameters = array($fetch = true); $outputDataTable = Piwik_FrontController::getInstance()->fetchDispatch($controllerName, $actionName, $parameters); $view = new Piwik_View('Widgetize/templates/iframe.tpl'); $view->content = $outputDataTable; echo $view->render(); }
function displayJavascriptCode() { $idSite = Piwik_Common::getRequestVar('idsite', 1); Piwik::checkUserHasViewAccess($idSite); $jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName()); $view = new Piwik_View('SitesManager/templates/DisplayJavascriptCode.tpl'); $view->menu = Piwik_GetAdminMenu(); $view->jsTag = $jsTag; echo $view->render(); }
/** The plugin index */ public function index() { $view = new Piwik_View('SiteSearch/templates/index.tpl'); $view->evolution = $this->evolution(true); $view->keywords = $this->keywords(true); $view->noResults = $this->noResults(true); $view->searchPercentage = $this->searchPercentage(true); if (isset($this->date)) { $view->period = $this->range->getLocalizedLongString(); } echo $view->render(); }
/** * Simple feedburner statistics output * */ function feedburner() { $view = new Piwik_View('ExampleFeedburner/templates/feedburner.tpl'); $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int'); $feedburnerFeedName = Piwik_FetchOne('SELECT feedburnerName FROM ' . Piwik::prefixTable('site') . ' WHERE idsite = ?', $idSite); if (empty($feedburnerFeedName)) { $feedburnerFeedName = 'Piwik'; } $view->feedburnerFeedName = $feedburnerFeedName; $view->idSite = $idSite; echo $view->render(); }
function index() { $view = new Piwik_View('UserSettings/templates/index.tpl'); $view->dataTablePlugin = $this->getPlugin(true); $view->dataTableResolution = $this->getResolution(true); $view->dataTableConfiguration = $this->getConfiguration(true); $view->dataTableOS = $this->getOS(true); $view->dataTableBrowser = $this->getBrowser(true); $view->dataTableBrowserType = $this->getBrowserType(true); $view->dataTableWideScreen = $this->getWideScreen(true); echo $view->render(); }
function index() { Piwik::checkUserIsSuperUser(); $listPlugins = Piwik_PluginsManager::getInstance()->readPluginsDirectory(); $loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins(); $plugins = array(); foreach ($listPlugins as $pluginName) { $oPlugin = Piwik_PluginsManager::getInstance()->loadPlugin($pluginName); $plugins[$pluginName] = array('activated' => Piwik_PluginsManager::getInstance()->isPluginEnabled($pluginName), 'alwaysActivated' => Piwik_PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName), 'info' => $oPlugin->getInformation()); } $view = new Piwik_View('PluginsAdmin/templates/manage.tpl'); $view->pluginsName = $plugins; echo $view->render(); }
function getLastVisits($fetch = false) { $idSite = Piwik_Common::getRequestVar('idSite', null, 'int'); $minIdVisit = Piwik_Common::getRequestVar('minIdVisit', 0, 'int'); $limit = 10; $api = new Piwik_API_Request("method=Live.getLastVisits&idSite={$idSite}&limit={$limit}&minIdVisit={$minIdVisit}&format=php&serialize=0&disable_generic_filters=1"); $view = new Piwik_View('Live/templates/lastVisits.tpl'); $visitors = $api->process(); if ($minIdVisit == 0) { $visitors = array_slice($visitors, 3); } $view->visitors = $visitors; $rendered = $view->render($fetch); if ($fetch) { return $rendered; } echo $rendered; }
public function oneClickUpdate() { Piwik::checkUserIsSuperUser(); $this->checkNewVersionIsAvailableOrDie(); $steps = array(array('oneClick_Download', Piwik_Translate('CoreUpdate_DownloadingUpdateFromX', self::LATEST_PIWIK_URL)), array('oneClick_Unpack', Piwik_Translate('CoreUpdate_UnpackingTheUpdate')), array('oneClick_Verify', Piwik_Translate('CoreUpdater_VerifyingUnpackedFiles')), array('oneClick_CreateConfigFileBackup', Piwik_Translate('CoreUpdater_CreatingBackupOfConfigurationFile', self::CONFIG_FILE_BACKUP)), array('oneClick_Copy', Piwik_Translate('CoreUpdater_InstallingTheLatestVersion')), array('oneClick_Finished', Piwik_Translate('CoreUpdater_PiwikUpdatedSuccessfully'))); $errorMessage = false; $messages = array(); foreach ($steps as $step) { try { $method = $step[0]; $message = $step[1]; $this->{$method}(); $messages[] = $message; } catch (Exception $e) { $errorMessage = $e->getMessage(); break; } } $view = new Piwik_View('CoreUpdater/templates/update_one_click_done.tpl'); $view->coreError = $errorMessage; $view->feedbackMessages = $messages; echo $view->render(); }
function index() { $view = new Piwik_View('UsersManager/templates/UsersManager.tpl'); $IdSitesAdmin = Piwik_SitesManager_API::getSitesIdWithAdminAccess(); $idSiteSelected = 1; if (count($IdSitesAdmin) > 0) { $defaultWebsiteId = $IdSitesAdmin[0]; $idSiteSelected = Piwik_Common::getRequestVar('idsite', $defaultWebsiteId); } if ($idSiteSelected === 'all') { $usersAccessByWebsite = array(); } else { $usersAccessByWebsite = Piwik_UsersManager_API::getUsersAccessFromSite($idSiteSelected); } // requires super user access $usersLogin = Piwik_UsersManager_API::getUsersLogin(); // we dont want to display the user currently logged so that the user can't change his settings from admin to view... $currentlyLogged = Piwik::getCurrentUserLogin(); foreach ($usersLogin as $login) { if ($login != $currentlyLogged && !isset($usersAccessByWebsite[$login])) { $usersAccessByWebsite[$login] = 'noaccess'; } } ksort($usersAccessByWebsite); $users = array(); if (Zend_Registry::get('access')->isSuperUser()) { $users = Piwik_UsersManager_API::getUsers(); } $view->idSiteSelected = $idSiteSelected; $view->users = $users; $view->usersAccessByWebsite = $usersAccessByWebsite; $view->formUrl = Piwik_Url::getCurrentUrl(); $view->websites = Piwik_SitesManager_API::getSitesWithAdminAccess(); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); }
/** * Installation Step 8: Display JavaScript tracking code */ public function displayJavascriptCode() { $this->checkPreviousStepIsValid( __FUNCTION__ ); $view = new Piwik_Installation_View( $this->pathView . 'displayJavascriptCode.tpl', $this->getInstallationSteps(), __FUNCTION__ ); $this->skipThisStep( __FUNCTION__ ); if( !isset($this->session->firstWebsiteSetupSuccessMessage)) { $view->displayfirstWebsiteSetupSuccess = true; $this->session->firstWebsiteSetupSuccessMessage = true; } $siteName = $this->session->site_name; $idSite = $this->session->site_idSite; // Load the Tracking code and help text from the SitesManager $viewTrackingHelp = new Piwik_View('SitesManager/templates/DisplayJavascriptCode.tpl'); $viewTrackingHelp->displaySiteName = $siteName; $viewTrackingHelp->jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName()); $viewTrackingHelp->idSite = $idSite; // Assign the html output to a smarty variable $view->trackingHelp = $viewTrackingHelp->render(); $view->displaySiteName = urldecode($siteName); $view->showNextStep = true; $this->session->currentStepDone = __FUNCTION__; echo $view->render(); }
/** The plugin index */ public function logins() { $view = new Piwik_View('SiteUsers/templates/logins.tpl'); $view->logins = $this->getLoginsTable(true); echo $view->render(); }
/** * Render the single report template * * @param string $title Report title * @param string $reportHtml Report body * @param bool $fetch If true, return report contents as a string; else echo to screen * @return string Report contents if $fetch == true */ public static function singleReport($title, $reportHtml, $fetch = false) { $view = new Piwik_View('CoreHome/templates/single_report.tpl'); $view->title = $title; $view->report = $reportHtml; if ($fetch) { return $view->render(); } echo $view->render(); }
function addNewGoal() { $view = new Piwik_View('Goals/templates/add_new_goal.tpl'); $view->userCanEditGoals = Piwik::isUserHasAdminAccess($this->idSite); $view->currency = Piwik::getCurrency(); $view->onlyShowAddNewGoal = true; echo $view->render(); }
private function doExecuteUpdates($updater, $componentsWithUpdateFile) { $this->loadAndExecuteUpdateFiles($updater, $componentsWithUpdateFile); $view = new Piwik_View('CoreUpdater/templates/update_database_done.tpl'); $view->coreError = $this->coreError; $view->warningMessages = $this->warningMessages; $view->errorMessages = $this->errorMessages; $view->deactivatedPlugins = $this->deactivatedPlugins; $view->clearCompiledTemplates(); echo $view->render(); }
protected function lostPasswordFormValidated($loginMail, $urlToRedirect) { Piwik::setUserIsSuperUser(); $user = null; $isSuperUser = false; if ($loginMail == Zend_Registry::get('config')->superuser->email || $loginMail == Zend_Registry::get('config')->superuser->login) { $isSuperUser = true; $user = array('login' => Zend_Registry::get('config')->superuser->login, 'email' => Zend_Registry::get('config')->superuser->email); } else { if (Piwik_UsersManager_API::userExists($loginMail)) { $user = Piwik_UsersManager_API::getUser($loginMail); } else { if (Piwik_UsersManager_API::userEmailExists($loginMail)) { $user = Piwik_UsersManager_API::getUserByEmail($loginMail); } } } if ($user === null) { $messageNoAccess = Piwik_Translate('Login_InvalidUsernameEmail'); } else { $view = new Piwik_View('Login/templates/passwordsent.tpl'); $login = $user['login']; $email = $user['email']; $randomPassword = Piwik_Common::getRandomString(8); if ($isSuperUser) { $user['password'] = md5($randomPassword); Zend_Registry::get('config')->superuser = $user; } else { Piwik_UsersManager_API::updateUser($login, $randomPassword); } // send email with new password try { $mail = new Piwik_Mail(); $mail->addTo($email, $login); $mail->setSubject(Piwik_Translate('Login_MailTopicPasswordRecovery')); $mail->setBodyText(str_replace('\\n', "\n", sprintf(Piwik_Translate('Login_MailPasswordRecoveryBody'), $login, $randomPassword, Piwik_Url::getCurrentUrlWithoutQueryString()))); $piwikHost = $_SERVER['HTTP_HOST']; if (strlen($piwikHost) == 0) { $piwikHost = 'piwik.org'; } $fromEmailName = Zend_Registry::get('config')->General->login_password_recovery_email_name; $fromEmailAddress = Zend_Registry::get('config')->General->login_password_recovery_email_address; $fromEmailAddress = str_replace('{DOMAIN}', $piwikHost, $fromEmailAddress); $mail->setFrom($fromEmailAddress, $fromEmailName); @$mail->send(); } catch (Exception $e) { $view->ErrorString = $e->getMessage(); } $view->linkTitle = Piwik::getRandomTitle(); $view->urlToRedirect = $urlToRedirect; echo $view->render(); } }