function getSearchEnginesAndKeywords()
 {
     $view = new Piwik_View('Referers/templates/searchEngines_Keywords.tpl');
     $view->searchEngines = $this->getSearchEngines(true);
     $view->keywords = $this->getKeywords(true);
     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();
 }
 /**
  * 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();
 }
 function index()
 {
     $view = new Piwik_View('VisitorInterest/templates/index.tpl');
     $view->dataTableNumberOfVisitsPerVisitDuration = $this->getNumberOfVisitsPerVisitDuration(true);
     $view->dataTableNumberOfVisitsPerPage = $this->getNumberOfVisitsPerPage(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();
 }
Exemple #6
0
 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();
 }
 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();
 }
 /**
  * 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);
 }
 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();
 }
Exemple #11
0
 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();
 }
Exemple #13
0
 /**
  * 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();
 }
 /** 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();
 }
Exemple #16
0
 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();
 }
Exemple #17
0
 public function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = Piwik_View::factory('index');
     $this->setGeneralVariablesView($view);
     $view->currentUserEmail = Piwik::getCurrentUserEmail();
     $availableReports = Piwik_API_API::getInstance()->getReportMetadata($this->idSite);
     $reportsByCategory = array();
     foreach ($availableReports as $report) {
         $reportsByCategory[$report['category']][] = $report;
     }
     unset($reportsByCategory['API']);
     $reports = Piwik_PDFReports_API::getInstance()->getReports($this->idSite, $period = false, $idReport = false, $ifSuperUserReturnOnlySuperUserReports = true);
     $reportsById = array();
     foreach ($reports as &$report) {
         $report['additional_emails'] = str_replace(',', "\n", $report['additional_emails']);
         $report['reports'] = explode(',', str_replace('.', '_', $report['reports']));
         $reportsById[$report['idreport']] = $report;
     }
     $view->downloadOutputType = Piwik_PDFReports_API::OUTPUT_DOWNLOAD;
     $columnsCount = 2;
     $view->newColumnAfter = ceil(count($reportsByCategory) / $columnsCount);
     $view->reportsByCategory = $reportsByCategory;
     $view->reportsJSON = Piwik_Common::json_encode($reportsById);
     $view->periods = array_merge(array('never' => Piwik_Translate('General_Never')), Piwik_PDFReports_API::getPeriodToFrequency());
     $view->defaultFormat = Piwik_PDFReports::DEFAULT_FORMAT;
     $view->formats = Piwik_ReportRenderer::$availableReportRenderers;
     $view->aggregateReportsFormats = Piwik_PDFReports_API::getAggregateReportsFormats();
     $view->reports = $reports;
     $view->language = Piwik_LanguagesManager::getLanguageCodeForCurrentUser();
     echo $view->render();
 }
Exemple #18
0
 function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = Piwik_View::factory('Settings');
     $view->isSuperUser = Piwik::isUserIsSuperUser();
     $mobileMessagingAPI = Piwik_MobileMessaging_API::getInstance();
     $view->delegatedManagement = $mobileMessagingAPI->getDelegatedManagement();
     $view->credentialSupplied = $mobileMessagingAPI->areSMSAPICredentialProvided();
     $view->accountManagedByCurrentUser = $view->isSuperUser || $view->delegatedManagement;
     $view->strHelpAddPhone = Piwik_Translate('MobileMessaging_Settings_PhoneNumbers_HelpAdd', array(Piwik_Translate('UserSettings_SubmenuSettings'), Piwik_Translate('MobileMessaging_SettingsMenu')));
     if ($view->credentialSupplied && $view->accountManagedByCurrentUser) {
         $view->provider = $mobileMessagingAPI->getSMSProvider();
         $view->creditLeft = $mobileMessagingAPI->getCreditLeft();
     }
     $view->smsProviders = Piwik_MobileMessaging_SMSProvider::$availableSMSProviders;
     // construct the list of countries from the lang files
     $countries = array();
     foreach (Piwik_Common::getCountriesList() as $countryCode => $continentCode) {
         if (isset(Piwik_MobileMessaging_CountryCallingCodes::$countryCallingCodes[$countryCode])) {
             $countries[$countryCode] = array('countryName' => Piwik_CountryTranslate($countryCode), 'countryCallingCode' => Piwik_MobileMessaging_CountryCallingCodes::$countryCallingCodes[$countryCode]);
         }
     }
     $view->countries = $countries;
     $view->defaultCountry = Piwik_Common::getCountry(Piwik_LanguagesManager::getLanguageCodeForCurrentUser(), true, Piwik_IP::getIpFromHeader());
     $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers();
     $this->setBasicVariablesView($view);
     $view->menu = Piwik_GetAdminMenu();
     echo $view->render();
 }
Exemple #19
0
 function worldMap()
 {
     if (!Piwik_PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
         return '';
     }
     $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
     Piwik::checkUserHasViewAccess($idSite);
     $period = Piwik_Common::getRequestVar('period');
     $date = Piwik_Common::getRequestVar('date');
     $token_auth = Piwik::getCurrentUserTokenAuth();
     $view = Piwik_View::factory('worldmap');
     $view->dataUrl = "?module=API" . "&method=API.getProcessedReport&format=XML" . "&apiModule=UserCountry&apiAction=getCountry" . "&idSite=" . $idSite . "&period=" . $period . "&date=" . $date . "&token_auth=" . $token_auth . "&segment=" . Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('segment', '')) . "&filter_limit=-1";
     // definition of the color scale
     $view->hueMin = 218;
     $view->hueMax = 216;
     $view->satMin = "0.285";
     $view->satMax = "0.9";
     $view->lgtMin = ".97";
     $view->lgtMax = ".44";
     $request = new Piwik_API_Request('method=API.getMetadata&format=PHP' . '&apiModule=UserCountry&apiAction=getCountry' . '&idSite=' . $idSite . '&period=' . $period . '&date=' . $date . '&token_auth=' . $token_auth . '&filter_limit=-1');
     $metaData = $request->process();
     $metrics = array();
     foreach ($metaData[0]['metrics'] as $id => $val) {
         if (Piwik_Common::getRequestVar('period') == 'day' || $id != 'nb_uniq_visitors') {
             $metrics[] = array($id, $val);
         }
     }
     foreach ($metaData[0]['processedMetrics'] as $id => $val) {
         $metrics[] = array($id, $val);
     }
     $view->metrics = $metrics;
     $view->defaultMetric = 'nb_visits';
     echo $view->render();
 }
Exemple #20
0
	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();
	}
	public function index()
	{
		$view = Piwik_View::factory('index');
		$view->dataTableVisitInformationPerLocalTime = $this->getVisitInformationPerLocalTime(true);
		$view->dataTableVisitInformationPerServerTime = $this->getVisitInformationPerServerTime(true);
		echo $view->render();
	}
Exemple #22
0
 /**
  * send email to Piwik team and display nice thanks
  */
 function sendFeedback()
 {
     $email = Piwik_Common::getRequestVar('email', '', 'string');
     $body = Piwik_Common::getRequestVar('body', '', 'string');
     $category = Piwik_Common::getRequestVar('category', '', 'string');
     $nonce = Piwik_Common::getRequestVar('nonce', '', 'string');
     $view = Piwik_View::factory('sent');
     $view->feedbackEmailAddress = Zend_Registry::get('config')->General->feedback_email_address;
     try {
         $minimumBodyLength = 35;
         if (strlen($body) < $minimumBodyLength) {
             throw new Exception(Piwik_TranslateException('Feedback_ExceptionBodyLength', array($minimumBodyLength)));
         }
         if (!Piwik::isValidEmailString($email)) {
             throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidEmail'));
         }
         if (preg_match('/https?:/i', $body)) {
             throw new Exception(Piwik_TranslateException('Feedback_ExceptionNoUrls'));
         }
         if (!Piwik_Nonce::verifyNonce('Piwik_Feedback.sendFeedback', $nonce)) {
             throw new Exception(Piwik_TranslateException('General_ExceptionNonceMismatch'));
         }
         Piwik_Nonce::discardNonce('Piwik_Feedback.sendFeedback');
         $mail = new Piwik_Mail();
         $mail->setFrom(Piwik_Common::unsanitizeInputValue($email));
         $mail->addTo($view->feedbackEmailAddress, 'Piwik Team');
         $mail->setSubject('[ Feedback form - Piwik ] ' . $category);
         $mail->setBodyText(Piwik_Common::unsanitizeInputValue($body) . "\n" . 'Piwik ' . Piwik_Version::VERSION . "\n" . 'IP: ' . Piwik_Common::getIpString() . "\n" . 'URL: ' . Piwik_Url::getReferer() . "\n");
         @$mail->send();
     } catch (Exception $e) {
         $view->ErrorString = $e->getMessage();
         $view->message = $body;
     }
     echo $view->render();
 }
Exemple #23
0
 function index()
 {
     Piwik::checkUserIsSuperUser();
     $plugins = array();
     $listPlugins = array_merge(Piwik_PluginsManager::getInstance()->readPluginsDirectory(), Piwik_Config::getInstance()->Plugins['Plugins']);
     $listPlugins = array_unique($listPlugins);
     foreach ($listPlugins as $pluginName) {
         $oPlugin = Piwik_PluginsManager::getInstance()->loadPlugin($pluginName);
         $plugins[$pluginName] = array('activated' => Piwik_PluginsManager::getInstance()->isPluginActivated($pluginName), 'alwaysActivated' => Piwik_PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName));
     }
     Piwik_PluginsManager::getInstance()->loadPluginTranslations();
     $loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
     foreach ($loadedPlugins as $oPlugin) {
         $pluginName = $oPlugin->getPluginName();
         $plugins[$pluginName]['info'] = $oPlugin->getInformation();
     }
     foreach ($plugins as $pluginName => &$plugin) {
         if (!isset($plugin['info'])) {
             $plugin['info'] = array('description' => '<strong><em>' . Piwik_Translate('CorePluginsAdmin_PluginCannotBeFound') . '</strong></em>', 'version' => Piwik_Translate('General_Unknown'));
         }
     }
     $view = Piwik_View::factory('manage');
     $view->pluginsName = $plugins;
     $this->setBasicVariablesView($view);
     $view->menu = Piwik_GetAdminMenu();
     if (!Piwik_Config::getInstance()->isFileWritable()) {
         $view->configFileNotWritable = true;
     }
     echo $view->render();
 }
Exemple #24
0
 public function __construct($templateFile, $smConf = array())
 {
     require_once "Smarty.php";
     $this->template = $templateFile;
     $this->smarty = new Piwik_Smarty();
     if (count($smConf) == 0) {
         $smConf = Zend_Registry::get('config')->smarty;
     }
     foreach ($smConf as $key => $value) {
         $this->smarty->{$key} = $value;
     }
     $this->smarty->template_dir = $smConf->template_dir->toArray();
     array_walk($this->smarty->template_dir, array("Piwik_View", "addPiwikPath"));
     $this->smarty->plugins_dir = $smConf->plugins_dir->toArray();
     array_walk($this->smarty->plugins_dir, array("Piwik_View", "addPiwikPath"));
     $this->smarty->compile_dir = $smConf->compile_dir;
     Piwik_View::addPiwikPath($this->smarty->compile_dir, null);
     $this->smarty->cache_dir = $smConf->cache_dir;
     Piwik_View::addPiwikPath($this->smarty->cache_dir, null);
     $this->smarty->error_reporting = $smConf->debugging;
     $this->smarty->error_reporting = $smConf->error_reporting;
     $this->smarty->assign('tag', 'piwik=' . Piwik_Version::VERSION);
     $this->smarty->load_filter('output', 'cachebuster');
     $this->smarty->load_filter('output', 'trimwhitespace');
     // global value accessible to all templates: the piwik base URL for the current request
     $this->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName();
 }
Exemple #25
0
 public function __construct($templateFile, $smConf = array(), $filter = true)
 {
     $this->template = $templateFile;
     $this->smarty = new Piwik_Smarty();
     if (count($smConf) == 0) {
         $smConf = Zend_Registry::get('config')->smarty;
     }
     foreach ($smConf as $key => $value) {
         $this->smarty->{$key} = $value;
     }
     $this->smarty->template_dir = $smConf->template_dir->toArray();
     array_walk($this->smarty->template_dir, array("Piwik_View", "addPiwikPath"), PIWIK_INCLUDE_PATH);
     $this->smarty->plugins_dir = $smConf->plugins_dir->toArray();
     array_walk($this->smarty->plugins_dir, array("Piwik_View", "addPiwikPath"), PIWIK_INCLUDE_PATH);
     $this->smarty->compile_dir = $smConf->compile_dir;
     Piwik_View::addPiwikPath($this->smarty->compile_dir, null, PIWIK_USER_PATH);
     $this->smarty->cache_dir = $smConf->cache_dir;
     Piwik_View::addPiwikPath($this->smarty->cache_dir, null, PIWIK_USER_PATH);
     $error_reporting = $smConf->error_reporting;
     if ($error_reporting != (string) (int) $error_reporting) {
         $error_reporting = self::bitwise_eval($error_reporting);
     }
     $this->smarty->error_reporting = $error_reporting;
     $this->smarty->assign('tag', 'piwik=' . Piwik_Version::VERSION);
     if ($filter) {
         $this->smarty->load_filter('output', 'cachebuster');
         $this->smarty->load_filter('output', 'ajaxcdn');
         $this->smarty->load_filter('output', 'trimwhitespace');
     }
     // global value accessible to all templates: the piwik base URL for the current request
     $this->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName();
 }
Exemple #26
0
 function index()
 {
     $view = Piwik_View::factory('index');
     $view->dataTableNumberOfVisitsPerVisitDuration = $this->getNumberOfVisitsPerVisitDuration(true);
     $view->dataTableNumberOfVisitsPerPage = $this->getNumberOfVisitsPerPage(true);
     echo $view->render();
 }
Exemple #27
0
 function getSearchEnginesAndKeywords()
 {
     $view = Piwik_View::factory('searchEngines_Keywords');
     $view->searchEngines = $this->getSearchEngines(true);
     $view->keywords = $this->getKeywords(true);
     echo $view->render();
 }
Exemple #28
0
 public function getSparklines()
 {
     $view = Piwik_View::factory('sparklines');
     $this->setPeriodVariablesView($view);
     $this->setSparklinesAndNumbers($view);
     echo $view->render();
 }
Exemple #29
0
 /**
  * Display the "Export Image" window.
  *
  * @deprecated 1.5.1
  *
  * @param string $imageData Base-64 encoded image data (via $_POST)
  */
 public static function exportImageWindow()
 {
     Piwik::checkUserHasSomeViewAccess();
     $view = Piwik_View::factory('exportImage');
     $view->imageData = 'data:image/png;base64,' . Piwik_Common::getRequestVar('imageData', self::TRANSPARENT_PNG_PIXEL, 'string', $_POST);
     echo $view->render();
 }
	function index()
	{
		Piwik::checkUserIsSuperUser();

		$plugins = array();

		$listPlugins = Piwik_PluginsManager::getInstance()->readPluginsDirectory();
		foreach($listPlugins as $pluginName)
		{
			$oPlugin = Piwik_PluginsManager::getInstance()->loadPlugin($pluginName);
			$plugins[$pluginName] = array(
			 	'activated' => Piwik_PluginsManager::getInstance()->isPluginActivated($pluginName),
				'alwaysActivated' => Piwik_PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName),
			);
		}
		Piwik_PluginsManager::getInstance()->loadPluginTranslations();

		$loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
		foreach($loadedPlugins as $oPlugin)
		{
			$pluginName = $oPlugin->getPluginName();
			$plugins[$pluginName]['info'] = $oPlugin->getInformation();
		}

		$view = Piwik_View::factory('manage');
		$view->pluginsName = $plugins;
		$this->setBasicVariablesView($view);
		$view->menu = Piwik_GetAdminMenu();
		if(!Zend_Registry::get('config')->isFileWritable())
		{
			$view->configFileNotWritable = true;
		}
		echo $view->render();
	}