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(); }
public function index() { $view = Piwik_View::factory('index'); $view->dataTableVisitInformationPerLocalTime = $this->getVisitInformationPerLocalTime(true); $view->dataTableVisitInformationPerServerTime = $this->getVisitInformationPerServerTime(true); echo $view->render(); }
function getSearchEnginesAndKeywords() { $view = Piwik_View::factory('searchEngines_Keywords'); $view->searchEngines = $this->getSearchEngines(true); $view->keywords = $this->getKeywords(true); 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(); }
function index() { $view = Piwik_View::factory('index'); $view->dataTableNumberOfVisitsPerVisitDuration = $this->getNumberOfVisitsPerVisitDuration(true); $view->dataTableNumberOfVisitsPerPage = $this->getNumberOfVisitsPerPage(true); echo $view->render(); }
function index() { $view = Piwik_View::factory('structure'); $this->setGeneralVariablesView($view); $view->visitors = $this->getLastVisits($fetch = true); echo $view->render(); }
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(); }
public function getSparklines() { $view = Piwik_View::factory('sparklines'); $this->setPeriodVariablesView($view); $this->setSparklinesAndNumbers($view); echo $view->render(); }
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(); }
/** * 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(); }
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(); }
/** * 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(); }
/** * Show styled language selection drop-down list * * @param string $url The form action. Default is to save language. */ function showLanguagesSelector() { $view = Piwik_View::factory("languages"); $view->languages = Piwik_LanguagesManager_API::getAvailableLanguageNames(); $view->currentLanguageCode = self::getLanguageCodeForCurrentUser(); $view->currentLanguageName = self::getLanguageNameForCurrentUser(); echo $view->render(); }
function index() { $view = Piwik_View::factory('DBStats'); $view->tablesStatus = Piwik_DBStats_API::getAllTablesStatus(); $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); }
protected function getDefaultIndexView() { $view = Piwik_View::factory('index'); $this->setGeneralVariablesView($view); $view->menu = Piwik_GetMenu(); $view->content = ''; return $view; }
public function index() { $view = Piwik_View::factory('index'); /* Actions, Downloads, Outlinks */ $view->dataTableActions = $this->getActions(true); $view->dataTableDownloads = $this->getDownloads(true); $view->dataTableOutlinks = $this->getOutlinks(true); echo $view->render(); }
function index() { Piwik::checkUserIsSuperUser(); $view = Piwik_View::factory('DBStats'); $view->tablesStatus = Piwik_DBStats_API::getInstance()->getAllTablesStatus(); $this->setBasicVariablesView($view); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); }
function index() { $view = Piwik_View::factory('index'); $view->urlSparklineCountries = $this->getUrlSparkline('getLastDistinctCountriesGraph'); $view->numberDistinctCountries = $this->getNumberOfDistinctCountries(true); $view->dataTableCountry = $this->getCountry(true); $view->dataTableContinent = $this->getContinent(true); echo $view->render(); }
public function listAllAPI() { $view = Piwik_View::factory("listAllAPI"); $this->setGeneralVariablesView($view); $ApiDocumentation = new Piwik_API_DocumentationGenerator(); $view->countLoadedAPI = Piwik_API_Proxy::getInstance()->getCountRegisteredClasses(); $view->list_api_methods_with_links = $ApiDocumentation->getAllInterfaceString(); echo $view->render(); }
function displayJavascriptCode() { $idSite = Piwik_Common::getRequestVar('idsite', 1); Piwik::checkUserHasViewAccess($idSite); $jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName()); $view = Piwik_View::factory('DisplayJavascriptCode'); $view->menu = Piwik_GetAdminMenu(); $view->jsTag = $jsTag; 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 = Piwik_View::factory('iframe'); $view->content = $outputDataTable; echo $view->render(); }
protected function getDashboardView($template) { $view = Piwik_View::factory($template); $this->setGeneralVariablesView($view); $view->availableWidgets = Piwik_Common::json_encode(Piwik_GetWidgetsList()); $view->availableLayouts = $this->getAvailableLayouts(); $view->dashboardId = Piwik_Common::getRequestVar('idDashboard', 1, 'int'); $view->dashboardLayout = $this->getLayout($view->dashboardId); return $view; }
function funnelReport() { $idFunnel = Piwik_Common::getRequestVar('idFunnel', null, 'int'); if (!isset($this->funnels[$idFunnel])) { Piwik::redirectToModule('Funnels', 'index', array('idFunnel' => null)); } // Set up the view $view = Piwik_View::factory('single_funnel'); $this->setGeneralVariablesView($view); // Get the funnel and related goal data $funnelDefinition = $this->funnels[$idFunnel]; $idGoal = $funnelDefinition['idgoal']; $goal_request = new Piwik_API_Request("method=Goals.get&format=original&idGoal={$idGoal}"); $datatable = $goal_request->process(); $dataRow = $datatable->getFirstRow(); $view->goal_conversions = $dataRow->getColumn('nb_conversions'); $view->name = $funnelDefinition['goal_name']; // Get the data on each funnel step $funnel_data = $this->getMetricsForFunnel($idFunnel); foreach ($funnelDefinition['steps'] as &$step) { $recordName = Piwik_Funnels::getRecordName('nb_actions', $idFunnel, $step['idstep']); $step['nb_actions'] = $funnel_data->getColumn($recordName); $recordName = Piwik_Funnels::getRecordName('nb_next_step_actions', $idFunnel, $step['idstep']); $step['nb_next_step_actions'] = $funnel_data->getColumn($recordName); $recordName = Piwik_Funnels::getRecordName('percent_next_step_actions', $idFunnel, $step['idstep']); $step['percent_next_step_actions'] = round($funnel_data->getColumn($recordName), self::ROUNDING_PRECISION); $recordName = Piwik_Funnels::getRecordName('nb_entry', $idFunnel, $step['idstep']); $step['nb_entry'] = $funnel_data->getColumn($recordName); $step['referring_actions'] = array(); $refUrls = $this->getRefUrls($idFunnel, $step['idstep']); $refUrls->filter('Sort', array('value', 'desc')); $refUrls->filter('Limit', array(0, self::NUM_URLS_TO_DISPLAY)); foreach ($refUrls->getRows() as $row) { $label = $this->labelOrDefault($row->getColumn('label'), '(entrance)'); $step['referring_actions'][] = array('label' => $label, 'value' => $row->getColumn('value')); } $recordName = Piwik_Funnels::getRecordName('nb_exit', $idFunnel, $step['idstep']); $step['nb_exit'] = $funnel_data->getColumn($recordName); $step['next_actions'] = array(); $nextUrls = $this->getNextUrls($idFunnel, $step['idstep']); $nextUrls->filter('Sort', array('value', 'desc')); $nextUrls->filter('Limit', array(0, self::NUM_URLS_TO_DISPLAY)); foreach ($nextUrls->getRows() as $row) { $label = $this->labelOrDefault($row->getColumn('label'), '(exit)'); $step['next_actions'][] = array('label' => $label, 'value' => $row->getColumn('value')); } } // What percent of people who visited the first funnel step converted at the end of the funnel? $recordName = Piwik_Funnels::getRecordName('conversion_rate', $idFunnel, false); $view->conversion_rate = round($funnel_data->getColumn($recordName), self::ROUNDING_PRECISION); // Let the view access the funnel steps $view->steps = $funnelDefinition['steps']; echo $view->render(); }
protected function getDashboardView($template) { $view = Piwik_View::factory($template); $this->setGeneralVariablesView($view); $view->availableWidgets = json_encode(Piwik_GetWidgetsList()); $layout = $this->getLayout(); if (empty($layout)) { $layout = $this->getDefaultLayout(); } $view->layout = $layout; return $view; }
function index() { $view = Piwik_View::factory('UsersManager'); $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(!isset($usersAccessByWebsite[$login])) { $usersAccessByWebsite[$login] = 'noaccess'; } } unset($usersAccessByWebsite[$currentlyLogged]); 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(); $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); }
/** * Simple feedburner statistics output * */ function feedburner() { $view = Piwik_View::factory('feedburner'); $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 = Piwik_View::factory('index'); $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(); }
public function getLastVisitsStart($fetch = false) { // hack, ensure we load today's visits by default $_GET['date'] = 'today'; $_GET['period'] = 'day'; $view = Piwik_View::factory('lastVisits'); $view->idSite = $this->idSite; $api = new Piwik_API_Request("method=Live.getLastVisitsDetails&idSite={$this->idSite}&filter_limit=10&format=php&serialize=0&disable_generic_filters=1"); $visitors = $api->process(); $view->visitors = $visitors; return $this->render($view, $fetch); }
public function adminMenu() { Piwik::checkUserIsSuperUser(); $view = Piwik_View::factory('settings'); if (!Piwik_MobileAnalytics::settingsExist()) { Piwik_MobileAnalytics::createSettings(); } $view->config = Piwik_Config::getInstance()->MobileAnalytics; $this->setBasicVariablesView($view); $view->topMenu = Piwik_GetTopMenu(); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); }
function iframe() { Piwik_API_Request::reloadAuthUsingTokenAuth(); $this->init(); $controllerName = Piwik_Common::getRequestVar('moduleToWidgetize'); $actionName = Piwik_Common::getRequestVar('actionToWidgetize'); $parameters = array ( $fetch = true ); $outputDataTable = Piwik_FrontController::getInstance()->fetchDispatch( $controllerName, $actionName, $parameters); $view = Piwik_View::factory('iframe'); $this->setGeneralVariablesView($view); $view->content = $outputDataTable; echo $view->render(); }