Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Piwik\Plugin; use Exception; use Piwik\Access; use Piwik\API\Proxy; use P..

Decoded Output download

<?php
 namespace Piwik\Plugin; use Exception; use Piwik\Access; use Piwik\API\Proxy; use Piwik\API\Request; use Piwik\Changes\Model as ChangesModel; use Piwik\Changes\UserChanges; use Piwik\Common; use Piwik\Config as PiwikConfig; use Piwik\Config\GeneralConfig; use Piwik\Container\StaticContainer; use Piwik\Date; use Piwik\Exception\NoPrivilegesException; use Piwik\Exception\NoWebsiteFoundException; use Piwik\FrontController; use Piwik\Menu\MenuAdmin; use Piwik\Menu\MenuTop; use Piwik\NoAccessException; use Piwik\Notification\Manager as NotificationManager; use Piwik\Period\Month; use Piwik\Period; use Piwik\Period\PeriodValidator; use Piwik\Period\Range; use Piwik\Piwik; use Piwik\Plugins\CoreAdminHome\CustomLogo; use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Evolution; use Piwik\Plugins\LanguagesManager\LanguagesManager; use Piwik\Plugins\UsersManager\Model as UsersModel; use Piwik\SettingsPiwik; use Piwik\Site; use Piwik\Url; use Piwik\Plugin; use Piwik\View; use Piwik\View\ViewInterface; use Piwik\ViewDataTable\Factory as ViewDataTableFactory; abstract class Controller { protected $pluginName; protected $strDate; protected $date; protected $idSite; protected $site = null; protected $securityPolicy = null; public function __construct() { $this->init(); } protected function init() { $aPluginName = explode("\", get_class($this)); $this->pluginName = $aPluginName[2]; $this->securityPolicy = StaticContainer::get(View\SecurityPolicy::class); $date = Common::getRequestVar("date", "yesterday", "string"); try { $this->idSite = Common::getRequestVar("idSite", false, "int"); $this->site = new Site($this->idSite); $date = $this->getDateParameterInTimezone($date, $this->site->getTimezone()); $this->setDate($date); } catch (Exception $e) { $this->date = null; } } protected function getDateParameterInTimezone($date, $timezone) { $timezoneToUse = null; if (in_array($date, array("today", "yesterday"))) { if ($date === "today") { $date = "now"; } elseif ($date === "yesterday") { $date = "yesterdaySameTime"; } $timezoneToUse = $timezone; } return Date::factory($date, $timezoneToUse); } protected function setDate(Date $date) { $this->date = $date; $this->strDate = $date->toString(); } protected static function getEnabledPeriodsInUI() { $periodValidator = new PeriodValidator(); return $periodValidator->getPeriodsAllowedForUI(); } private static function getEnabledPeriodsNames() { $availablePeriods = self::getEnabledPeriodsInUI(); $periodNames = array("day" => array("singular" => Piwik::translate("Intl_PeriodDay"), "plural" => Piwik::translate("Intl_PeriodDays")), "week" => array("singular" => Piwik::translate("Intl_PeriodWeek"), "plural" => Piwik::translate("Intl_PeriodWeeks")), "month" => array("singular" => Piwik::translate("Intl_PeriodMonth"), "plural" => Piwik::translate("Intl_PeriodMonths")), "year" => array("singular" => Piwik::translate("Intl_PeriodYear"), "plural" => Piwik::translate("Intl_PeriodYears")), "range" => array("singular" => Piwik::translate("General_DateRangeInPeriodList"), "plural" => Piwik::translate("General_DateRangeInPeriodList"))); $periodNames = array_intersect_key($periodNames, array_fill_keys($availablePeriods, true)); return $periodNames; } public function getDefaultAction() { return "index"; } protected function renderView(ViewInterface $view) { return $view->render(); } protected function renderTemplate($template, array $variables = array()) { return $this->renderTemplateAs($template, $variables); } protected function renderTemplateAs($template, array $variables = array(), $viewType = null) { if (false === strpos($template, "@") || false === strpos($template, "/")) { $template = "@" . $this->pluginName . "/" . $template; } $view = new View($template); $this->checkViewType($viewType); if (empty($viewType)) { $viewType = $this instanceof ControllerAdmin ? "admin" : "basic"; } if (isset($variables["hideWhatIsNew"])) { $view->hideWhatIsNew = $variables["hideWhatIsNew"]; } if ($this instanceof ControllerAdmin && $viewType === "admin") { $this->setBasicVariablesViewAs($view, $viewType); } elseif (empty($this->site) || empty($this->idSite)) { $this->setBasicVariablesViewAs($view, $viewType); } else { $this->setGeneralVariablesViewAs($view, $viewType); } foreach ($variables as $key => $value) { $view->{$key} = $value; } if (isset($view->siteName)) { $view->siteNameDecoded = Common::unsanitizeInputValue($view->siteName); } return $view->render(); } protected function renderReport($apiAction, $controllerAction = false) { if (empty($controllerAction) && is_string($apiAction)) { $report = ReportsProvider::factory($this->pluginName, $apiAction); if (!empty($report)) { $apiAction = $report; } } if ($apiAction instanceof Report) { $this->checkSitePermission(); $apiAction->checkIsEnabled(); return $apiAction->render(); } $pluginName = $this->pluginName; $apiProxy = Proxy::getInstance(); if (!$apiProxy->isExistingApiAction($pluginName, $apiAction)) { throw new \Exception("Invalid action name '{$apiAction}' for '{$pluginName}' plugin."); } $apiAction = $apiProxy->buildApiActionName($pluginName, $apiAction); if ($controllerAction !== false) { $controllerAction = $pluginName . "." . $controllerAction; } $view = ViewDataTableFactory::build(null, $apiAction, $controllerAction); $rendered = $view->render(); return $rendered; } protected function getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod) { $view = ViewDataTableFactory::build(Evolution::ID, $apiMethod, $currentModuleName . "." . $currentControllerAction, $forceDefault = true); $view->config->show_goals = false; return $view; } protected function getLastUnitGraphAcrossPlugins($currentModuleName, $currentControllerAction, $columnsToDisplay = false, $selectableColumns = array(), $reportDocumentation = false, $apiMethod = "API.get") { $idSite = Common::getRequestVar("idSite"); $period = Piwik::getPeriod(); $date = Piwik::getDate(); $meta = \Piwik\Plugins\API\API::getInstance()->getReportMetadata($idSite, $period, $date); $columns = array_merge($columnsToDisplay ? $columnsToDisplay : array(), $selectableColumns); $translations = array_combine($columns, $columns); foreach ($meta as $reportMeta) { if ($reportMeta["action"] === "get" && !isset($reportMeta["parameters"])) { foreach ($columns as $column) { if (isset($reportMeta["metrics"][$column])) { $translations[$column] = $reportMeta["metrics"][$column]; } } } } $view = $this->getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod); if ($columnsToDisplay !== false) { $view->config->columns_to_display = $columnsToDisplay; } if (property_exists($view->config, "selectable_columns")) { $view->config->selectable_columns = array_merge($view->config->selectable_columns ?: array(), $selectableColumns); } $view->config->translations += $translations; if ($reportDocumentation) { $view->config->documentation = $reportDocumentation; } return $view; } protected function getGraphParamsModified($paramsToSet = array()) { $period = $paramsToSet["period"] ?? Piwik::getPeriod(); if ($period === "range") { return $paramsToSet; } $range = isset($paramsToSet["range"]) ? $paramsToSet["range"] : "last30"; $endDate = isset($paramsToSet["date"]) ? $paramsToSet["date"] : $this->strDate; if (is_null($this->site)) { throw new NoAccessException("Website not initialized, check that you are logged in and/or using the correct token_auth."); } $paramDate = Range::getRelativeToEndDate($period, $range, $endDate, $this->site); $params = array_merge($paramsToSet, array("date" => $paramDate)); return $params; } protected function getNumericValue($methodToCall, $date = false) { $params = $date === false ? array() : array("date" => $date); $return = Request::processRequest($methodToCall, $params); $columns = $return->getFirstRow()->getColumns(); return reset($columns); } protected function getUrlSparkline($action, $customParameters = array()) { $params = $this->getGraphParamsModified(array("viewDataTable" => "sparkline", "action" => $action, "module" => $this->pluginName) + $customParameters); foreach ($params as &$value) { if (is_array($value)) { $value = rawurlencode(implode(",", $value)); } } $url = Url::getCurrentQueryStringWithParametersModified($params); return $url; } protected function setMinDateView(Date $minDate, $view) { $view->minDateYear = $minDate->toString("Y"); $view->minDateMonth = $minDate->toString("m"); $view->minDateDay = $minDate->toString("d"); } protected function setMaxDateView(Date $maxDate, $view) { $view->maxDateYear = $maxDate->toString("Y"); $view->maxDateMonth = $maxDate->toString("m"); $view->maxDateDay = $maxDate->toString("d"); } protected function setGeneralVariablesView($view) { $this->setGeneralVariablesViewAs($view, $viewType = null); } protected function setGeneralVariablesViewAs($view, $viewType) { $this->checkViewType($viewType); if ($viewType === null) { $viewType = $this instanceof ControllerAdmin ? "admin" : "basic"; } $view->idSite = $this->idSite; $this->checkSitePermission(); $this->setPeriodVariablesView($view); $view->siteName = $this->site->getName(); $view->siteMainUrl = $this->site->getMainUrl(); $siteTimezone = $this->site->getTimezone(); $datetimeMinDate = $this->site->getCreationDate()->getDatetime(); $minDate = Date::factory($datetimeMinDate, $siteTimezone); $this->setMinDateView($minDate, $view); $maxDate = Date::factory("now", $siteTimezone); $this->setMaxDateView($maxDate, $view); $rawDate = Piwik::getDate(GeneralConfig::getConfigValue("default_day")); Period::checkDateFormat($rawDate); $periodStr = Piwik::getPeriod(GeneralConfig::getConfigValue("default_period")); if ($periodStr !== "range") { $date = Date::factory($this->strDate); $validDate = $this->getValidDate($date, $minDate, $maxDate); $period = Period\Factory::build($periodStr, $validDate); if ($date->toString() !== $validDate->toString()) { $this->setDate($validDate); } } else { $period = new Range($periodStr, $rawDate, $siteTimezone); } $dateStart = $period->getDateStart(); $dateStart = $this->getValidDate($dateStart, $minDate, $maxDate); $dateEnd = $period->getDateEnd(); $dateEnd = $this->getValidDate($dateEnd, $minDate, $maxDate); if ($periodStr === "range") { $newRawDate = $dateStart->toString() . "," . $dateEnd->toString(); $period = new Range($periodStr, $newRawDate, $siteTimezone); } $view->date = $this->strDate; $view->prettyDate = self::getCalendarPrettyDate($period); $view->prettyDateLong = $period->getLocalizedLongString(); $view->rawDate = $rawDate; $view->startDate = $dateStart; $view->endDate = $dateEnd; $timezoneOffsetInSeconds = Date::getUtcOffset($siteTimezone); $view->timezoneOffset = $timezoneOffsetInSeconds; $language = LanguagesManager::getLanguageForSession(); $view->language = !empty($language) ? $language : LanguagesManager::getLanguageCodeForCurrentUser(); $this->setBasicVariablesViewAs($view, $viewType); $view->topMenu = MenuTop::getInstance()->getMenu(); $view->adminMenu = MenuAdmin::getInstance()->getMenu(); $notifications = $view->notifications; if (empty($notifications)) { $view->notifications = NotificationManager::getAllNotificationsToDisplay(); NotificationManager::cancelAllNonPersistent(); } } private function getValidDate(Date $date, Date $minDate, Date $maxDate) { if ($date->isEarlier($minDate)) { $date = $minDate; } if ($date->isLater($maxDate)) { $date = $maxDate; } return $date; } protected function setBasicVariablesNoneAdminView($view) { $view->clientSideConfig = PiwikConfig::getInstance()->getClientSideOptions(); $view->isSuperUser = Access::getInstance()->hasSuperUserAccess(); $view->hasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess(); $view->hasSomeViewAccess = Piwik::isUserHasSomeViewAccess(); $view->isUserIsAnonymous = Piwik::isUserIsAnonymous(); $view->hasSuperUserAccess = Piwik::hasUserSuperUserAccess(); $view->disableTrackingMatomoAppLinks = PiwikConfig::getInstance()->General["disable_tracking_matomo_app_links"]; if (!Piwik::isUserIsAnonymous()) { $this->showWhatIsNew($view); $view->contactEmail = implode(",", Piwik::getContactEmailAddresses()); $view->emailSuperUser = implode(",", Piwik::getAllSuperUserAccessEmailAddresses()); } $capabilities = array(); if ($this->idSite && $this->site) { $capabilityProvider = StaticContainer::get(Access\CapabilitiesProvider::class); foreach ($capabilityProvider->getAllCapabilities() as $capability) { if (Piwik::isUserHasCapability($this->idSite, $capability->getId())) { $capabilities[] = $capability->getId(); } } } $view->userCapabilities = $capabilities; $this->addCustomLogoInfo($view); $customLogo = new CustomLogo(); $view->logoHeader = $customLogo->getHeaderLogoUrl(); $view->logoLarge = $customLogo->getLogoUrl(); $view->logoSVG = $customLogo->getSVGLogoUrl(); $view->hasSVGLogo = $customLogo->hasSVGLogo(); $view->contactEmail = implode(",", Piwik::getContactEmailAddresses()); $view->themeStyles = ThemeStyles::get(); $general = PiwikConfig::getInstance()->General; $view->enableFrames = $general["enable_framed_pages"] || isset($general["enable_framed_logins"]) && $general["enable_framed_logins"]; $embeddedAsIframe = Common::getRequestVar("module", '', "string") === "Widgetize"; if (!$view->enableFrames && !$embeddedAsIframe) { $view->setXFrameOptions("sameorigin"); } $pluginManager = Plugin\Manager::getInstance(); $view->relativePluginWebDirs = (object) $pluginManager->getWebRootDirectoriesForCustomPluginDirs(); $view->pluginsToLoadOnDemand = $pluginManager->getPluginUmdsToLoadOnDemand(); $view->isMultiSitesEnabled = $pluginManager->isPluginActivated("MultiSites"); $view->isSingleSite = Access::doAsSuperUser(function () { $allSites = Request::processRequest("SitesManager.getAllSitesId", array(), array()); return count($allSites) === 1; }); if (isset($this->site) && is_object($this->site) && $this->site instanceof Site) { $view->siteName = $this->site->getName(); } self::setHostValidationVariablesView($view); } protected function setBasicVariablesView($view) { $this->setBasicVariablesViewAs($view); } protected function setBasicVariablesViewAs($view, $viewType = null) { $this->checkViewType($viewType); $this->setBasicVariablesNoneAdminView($view); } protected function addCustomLogoInfo($view) { $customLogo = new CustomLogo(); $view->isCustomLogo = $customLogo->isEnabled(); $view->customFavicon = $customLogo->getPathUserFavicon(); } protected function showWhatIsNew(View $view) : void { $view->whatisnewShow = false; if (isset($view->hideWhatIsNew) && $view->hideWhatIsNew) { return; } $model = new UsersModel(); $user = $model->getUser(Piwik::getCurrentUserLogin()); if (!$user) { return; } $userChanges = new UserChanges($user); $newChangesStatus = $userChanges->getNewChangesStatus(); $shownRecently = $userChanges->shownRecently(); if ($newChangesStatus == ChangesModel::NEW_CHANGES_EXIST && !$shownRecently) { $view->whatisnewShow = true; } } public static function setHostValidationVariablesView($view) { $view->isValidHost = Url::isValidHost(); if (!$view->isValidHost) { $validHosts = Url::getTrustedHostsFromConfig(); $validHost = $validHosts[0]; $invalidHost = Common::sanitizeInputValue(Url::getHost(false)); $emailSubject = rawurlencode(Piwik::translate("CoreHome_InjectedHostEmailSubject", $invalidHost)); $emailBody = rawurlencode(Piwik::translate("CoreHome_InjectedHostEmailBody")); $superUserEmail = rawurlencode(implode(",", Piwik::getContactEmailAddresses())); $mailToUrl = "mailto:{$superUserEmail}?subject={$emailSubject}&body={$emailBody}"; $mailLinkStart = "<a href="{$mailToUrl}">"; $invalidUrl = Url::getCurrentUrlWithoutQueryString($checkIfTrusted = false); $validUrl = Url::getCurrentScheme() . "://" . $validHost . Url::getCurrentScriptName(); $invalidUrl = Common::sanitizeInputValue($invalidUrl); $validUrl = Common::sanitizeInputValue($validUrl); $changeTrustedHostsUrl = "index.php" . Url::getCurrentQueryStringWithParametersModified(array("module" => "CoreAdminHome", "action" => "generalSettings")) . "#trustedHostsSection"; $warningStart = Piwik::translate("CoreHome_InjectedHostWarningIntro", array("<strong>" . $invalidUrl . "</strong>", "<strong>" . $validUrl . "</strong>")) . " <br/>"; if (Piwik::hasUserSuperUserAccess()) { $view->invalidHostMessage = $warningStart . " " . Piwik::translate("CoreHome_InjectedHostSuperUserWarning", array("<a href="{$changeTrustedHostsUrl}">", $invalidHost, "</a>", "<br/><a href="{$validUrl}">", Common::sanitizeInputValue($validHost), "</a>")); } elseif (Piwik::isUserIsAnonymous()) { $view->invalidHostMessage = $warningStart . " " . Piwik::translate("CoreHome_InjectedHostNonSuperUserWarning", array("<br/><a href="{$validUrl}">", "</a>", "<span style="display:none">", "</span>")); } else { $view->invalidHostMessage = $warningStart . " " . Piwik::translate("CoreHome_InjectedHostNonSuperUserWarning", array("<br/><a href="{$validUrl}">", "</a>", $mailLinkStart, "</a>")); } $view->invalidHostMessageHowToFix = "<p><b>How do I fix this problem and how do I login again?</b><br/> The Matomo Super User can manually edit the file /path/to/matomo/config/config.ini.php
		\x9\x9	\x9and add the following lines: <pre>[General]" . "\xa" . "trusted_hosts[] = "" . $invalidHost . ""</pre>After making the change, you will be able to login again.</p>
	\x9	\x9	\x9<p>You may also <i>disable this security feature (not recommended)</i>. To do so edit config/config.ini.php and add:\xa\x9\x9\x9\x9		<pre>[General]" . "
" . "enable_trusted_host_check=0</pre>"; $view->invalidHost = $invalidHost; $view->invalidHostMailLinkStart = $mailLinkStart; } } public static function setPeriodVariablesView($view) { if (isset($view->period)) { return; } $periodValidator = new PeriodValidator(); $currentPeriod = Piwik::getPeriod(GeneralConfig::getConfigValue("default_period")); $availablePeriods = $periodValidator->getPeriodsAllowedForUI(); if (!$periodValidator->isPeriodAllowedForUI($currentPeriod)) { throw new Exception("Period must be one of: " . implode(", ", $availablePeriods)); } $view->displayUniqueVisitors = SettingsPiwik::isUniqueVisitorsEnabled($currentPeriod); $found = array_search($currentPeriod, $availablePeriods); unset($availablePeriods[$found]); $view->period = $currentPeriod; $view->otherPeriods = $availablePeriods; $view->enabledPeriods = self::getEnabledPeriodsInUI(); $view->periodsNames = self::getEnabledPeriodsNames(); } public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array()) { try { $this->doRedirectToUrl($moduleToRedirect, $actionToRedirect, $websiteId, $defaultPeriod, $defaultDate, $parameters); } catch (Exception $e) { } if (Piwik::hasUserSuperUserAccess()) { $siteTableName = Common::prefixTable("site"); $message = "Error: no website was found in this Matomo installation.\xa\x9\x9\x9<br />Check the table '{$siteTableName}' in your database, it should contain your Matomo websites."; $ex = new NoWebsiteFoundException($message); $ex->setIsHtmlMessage(); throw $ex; } if (!Piwik::isUserIsAnonymous()) { $currentLogin = Piwik::getCurrentUserLogin(); $emails = rawurlencode(implode(",", Piwik::getContactEmailAddresses())); $errorMessage = sprintf(Piwik::translate("CoreHome_NoPrivilegesAskPiwikAdmin"), $currentLogin, "<br/><a href='mailto:" . $emails . "?subject=Access to Matomo for user {$currentLogin}'>", "</a>"); $errorMessage .= "<br /><br />&nbsp;&nbsp;&nbsp;<b><a href='index.php?module=" . Piwik::getLoginPluginName() . "&amp;action=logout'>&rsaquo; " . Piwik::translate("General_Logout") . "</a></b><br />"; $ex = new NoPrivilegesException($errorMessage); $ex->setIsHtmlMessage(); throw $ex; } echo FrontController::getInstance()->dispatch(Piwik::getLoginPluginName(), false); die; } protected function checkTokenInUrl() { $tokenRequest = Common::getRequestVar("token_auth", false); $tokenUser = Piwik::getCurrentUserTokenAuth(); if (empty($tokenRequest) && empty($tokenUser)) { return; } if ($tokenRequest !== $tokenUser) { throw new NoAccessException(Piwik::translate("General_ExceptionSecurityCheckFailed")); } } public static function getCalendarPrettyDate($period) { if ($period instanceof Month) { return $period->getLocalizedLongString(); } else { return $period->getPrettyString(); } } public static function getPrettyDate($date, $period) { return self::getCalendarPrettyDate(Period\Factory::build($period, Date::factory($date))); } protected function checkSitePermission() { if (!empty($this->idSite)) { Access::getInstance()->checkUserHasViewAccess($this->idSite); new Site($this->idSite); } elseif (empty($this->site) || empty($this->idSite)) { throw new Exception("The requested website idSite is not found in the request, or is invalid.
\x9\x9		Please check that you are logged in Matomo and have permission to access the specified website."); } } private function doRedirectToUrl($moduleToRedirect, $actionToRedirect, $websiteId, $defaultPeriod, $defaultDate, $parameters) { $menu = new Menu(); $parameters = array_merge($menu->urlForDefaultUserParams($websiteId, $defaultPeriod, $defaultDate), $parameters); $queryParams = !empty($parameters) ? "&" . Url::getQueryStringFromParameters($parameters) : ''; $url = "index.php?module=%s&action=%s"; $url = sprintf($url, $moduleToRedirect, $actionToRedirect); $url = $url . $queryParams; Url::redirectToUrl($url); } private function checkViewType($viewType) { if ($viewType === "admin" && !$this instanceof ControllerAdmin) { throw new Exception("'admin' view type is only allowed with ControllerAdmin class."); } } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace Piwik\Plugin; use Exception; use Piwik\Access; use Piwik\API\Proxy; use Piwik\API\Request; use Piwik\Changes\Model as ChangesModel; use Piwik\Changes\UserChanges; use Piwik\Common; use Piwik\Config as PiwikConfig; use Piwik\Config\GeneralConfig; use Piwik\Container\StaticContainer; use Piwik\Date; use Piwik\Exception\NoPrivilegesException; use Piwik\Exception\NoWebsiteFoundException; use Piwik\FrontController; use Piwik\Menu\MenuAdmin; use Piwik\Menu\MenuTop; use Piwik\NoAccessException; use Piwik\Notification\Manager as NotificationManager; use Piwik\Period\Month; use Piwik\Period; use Piwik\Period\PeriodValidator; use Piwik\Period\Range; use Piwik\Piwik; use Piwik\Plugins\CoreAdminHome\CustomLogo; use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Evolution; use Piwik\Plugins\LanguagesManager\LanguagesManager; use Piwik\Plugins\UsersManager\Model as UsersModel; use Piwik\SettingsPiwik; use Piwik\Site; use Piwik\Url; use Piwik\Plugin; use Piwik\View; use Piwik\View\ViewInterface; use Piwik\ViewDataTable\Factory as ViewDataTableFactory; abstract class Controller { protected $pluginName; protected $strDate; protected $date; protected $idSite; protected $site = null; protected $securityPolicy = null; public function __construct() { $this->init(); } protected function init() { $aPluginName = explode("\x5c", get_class($this)); $this->pluginName = $aPluginName[2]; $this->securityPolicy = StaticContainer::get(View\SecurityPolicy::class); $date = Common::getRequestVar("\x64\x61\x74\x65", "\171\x65\x73\x74\145\162\x64\141\x79", "\163\x74\x72\151\156\147"); try { $this->idSite = Common::getRequestVar("\151\x64\123\x69\164\x65", false, "\151\x6e\164"); $this->site = new Site($this->idSite); $date = $this->getDateParameterInTimezone($date, $this->site->getTimezone()); $this->setDate($date); } catch (Exception $e) { $this->date = null; } } protected function getDateParameterInTimezone($date, $timezone) { $timezoneToUse = null; if (in_array($date, array("\x74\157\x64\x61\x79", "\x79\145\x73\164\145\x72\x64\141\171"))) { if ($date === "\x74\x6f\x64\x61\x79") { $date = "\x6e\157\x77"; } elseif ($date === "\171\145\163\164\x65\162\x64\x61\x79") { $date = "\171\145\163\x74\x65\x72\144\x61\x79\x53\x61\155\x65\124\151\x6d\x65"; } $timezoneToUse = $timezone; } return Date::factory($date, $timezoneToUse); } protected function setDate(Date $date) { $this->date = $date; $this->strDate = $date->toString(); } protected static function getEnabledPeriodsInUI() { $periodValidator = new PeriodValidator(); return $periodValidator->getPeriodsAllowedForUI(); } private static function getEnabledPeriodsNames() { $availablePeriods = self::getEnabledPeriodsInUI(); $periodNames = array("\x64\x61\x79" => array("\x73\x69\156\x67\x75\154\x61\x72" => Piwik::translate("\111\156\x74\x6c\137\120\145\162\x69\157\144\x44\x61\171"), "\160\x6c\x75\x72\x61\154" => Piwik::translate("\111\156\x74\154\137\120\x65\x72\151\x6f\144\x44\141\171\x73")), "\167\x65\145\153" => array("\163\x69\x6e\147\165\x6c\141\162" => Piwik::translate("\111\x6e\x74\154\137\x50\x65\162\x69\x6f\x64\127\145\x65\153"), "\160\x6c\x75\162\141\x6c" => Piwik::translate("\x49\156\x74\x6c\x5f\120\x65\162\151\157\144\127\x65\x65\x6b\163")), "\155\x6f\x6e\164\x68" => array("\163\151\156\x67\165\x6c\141\x72" => Piwik::translate("\111\156\x74\x6c\137\x50\145\x72\151\157\144\115\157\x6e\164\x68"), "\x70\154\x75\x72\141\154" => Piwik::translate("\111\156\x74\154\x5f\120\145\162\x69\x6f\x64\115\x6f\x6e\x74\x68\163")), "\171\145\x61\162" => array("\x73\151\x6e\147\x75\x6c\141\x72" => Piwik::translate("\111\x6e\164\154\137\120\x65\x72\151\157\144\131\x65\141\162"), "\x70\154\165\x72\x61\154" => Piwik::translate("\x49\x6e\164\154\137\120\x65\162\151\x6f\x64\x59\145\141\x72\163")), "\162\x61\x6e\147\145" => array("\163\151\156\147\165\154\141\162" => Piwik::translate("\x47\145\x6e\145\x72\141\154\x5f\x44\141\164\x65\122\141\156\x67\145\x49\x6e\x50\145\162\151\157\144\114\x69\163\x74"), "\x70\154\x75\162\x61\x6c" => Piwik::translate("\107\x65\x6e\145\x72\141\154\x5f\104\141\164\145\x52\141\x6e\x67\145\x49\x6e\120\145\162\151\157\144\x4c\151\163\164"))); $periodNames = array_intersect_key($periodNames, array_fill_keys($availablePeriods, true)); return $periodNames; } public function getDefaultAction() { return "\151\x6e\x64\145\x78"; } protected function renderView(ViewInterface $view) { return $view->render(); } protected function renderTemplate($template, array $variables = array()) { return $this->renderTemplateAs($template, $variables); } protected function renderTemplateAs($template, array $variables = array(), $viewType = null) { if (false === strpos($template, "\100") || false === strpos($template, "\57")) { $template = "\x40" . $this->pluginName . "\x2f" . $template; } $view = new View($template); $this->checkViewType($viewType); if (empty($viewType)) { $viewType = $this instanceof ControllerAdmin ? "\x61\x64\155\x69\156" : "\x62\x61\x73\151\x63"; } if (isset($variables["\150\x69\144\x65\x57\150\x61\164\111\163\x4e\x65\x77"])) { $view->hideWhatIsNew = $variables["\x68\x69\144\145\127\x68\x61\x74\111\x73\x4e\x65\x77"]; } if ($this instanceof ControllerAdmin && $viewType === "\x61\144\x6d\151\x6e") { $this->setBasicVariablesViewAs($view, $viewType); } elseif (empty($this->site) || empty($this->idSite)) { $this->setBasicVariablesViewAs($view, $viewType); } else { $this->setGeneralVariablesViewAs($view, $viewType); } foreach ($variables as $key => $value) { $view->{$key} = $value; } if (isset($view->siteName)) { $view->siteNameDecoded = Common::unsanitizeInputValue($view->siteName); } return $view->render(); } protected function renderReport($apiAction, $controllerAction = false) { if (empty($controllerAction) && is_string($apiAction)) { $report = ReportsProvider::factory($this->pluginName, $apiAction); if (!empty($report)) { $apiAction = $report; } } if ($apiAction instanceof Report) { $this->checkSitePermission(); $apiAction->checkIsEnabled(); return $apiAction->render(); } $pluginName = $this->pluginName; $apiProxy = Proxy::getInstance(); if (!$apiProxy->isExistingApiAction($pluginName, $apiAction)) { throw new \Exception("\111\x6e\166\141\154\151\144\x20\x61\143\164\151\x6f\156\x20\x6e\x61\x6d\x65\40\47{$apiAction}\x27\x20\146\157\x72\x20\x27{$pluginName}\x27\40\x70\154\x75\x67\x69\x6e\x2e"); } $apiAction = $apiProxy->buildApiActionName($pluginName, $apiAction); if ($controllerAction !== false) { $controllerAction = $pluginName . "\x2e" . $controllerAction; } $view = ViewDataTableFactory::build(null, $apiAction, $controllerAction); $rendered = $view->render(); return $rendered; } protected function getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod) { $view = ViewDataTableFactory::build(Evolution::ID, $apiMethod, $currentModuleName . "\x2e" . $currentControllerAction, $forceDefault = true); $view->config->show_goals = false; return $view; } protected function getLastUnitGraphAcrossPlugins($currentModuleName, $currentControllerAction, $columnsToDisplay = false, $selectableColumns = array(), $reportDocumentation = false, $apiMethod = "\101\x50\111\56\147\x65\x74") { $idSite = Common::getRequestVar("\x69\144\123\151\164\x65"); $period = Piwik::getPeriod(); $date = Piwik::getDate(); $meta = \Piwik\Plugins\API\API::getInstance()->getReportMetadata($idSite, $period, $date); $columns = array_merge($columnsToDisplay ? $columnsToDisplay : array(), $selectableColumns); $translations = array_combine($columns, $columns); foreach ($meta as $reportMeta) { if ($reportMeta["\x61\x63\164\x69\x6f\156"] === "\x67\145\164" && !isset($reportMeta["\x70\141\162\141\x6d\145\164\145\x72\163"])) { foreach ($columns as $column) { if (isset($reportMeta["\155\x65\164\162\151\x63\x73"][$column])) { $translations[$column] = $reportMeta["\155\145\164\162\151\143\163"][$column]; } } } } $view = $this->getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod); if ($columnsToDisplay !== false) { $view->config->columns_to_display = $columnsToDisplay; } if (property_exists($view->config, "\x73\x65\154\x65\x63\x74\x61\x62\x6c\145\x5f\x63\157\154\165\x6d\x6e\x73")) { $view->config->selectable_columns = array_merge($view->config->selectable_columns ?: array(), $selectableColumns); } $view->config->translations += $translations; if ($reportDocumentation) { $view->config->documentation = $reportDocumentation; } return $view; } protected function getGraphParamsModified($paramsToSet = array()) { $period = $paramsToSet["\160\145\x72\x69\x6f\144"] ?? Piwik::getPeriod(); if ($period === "\162\x61\156\147\145") { return $paramsToSet; } $range = isset($paramsToSet["\162\141\x6e\x67\145"]) ? $paramsToSet["\x72\x61\156\147\x65"] : "\x6c\141\163\164\x33\x30"; $endDate = isset($paramsToSet["\x64\x61\164\x65"]) ? $paramsToSet["\x64\141\x74\145"] : $this->strDate; if (is_null($this->site)) { throw new NoAccessException("\x57\145\142\x73\151\164\x65\x20\156\x6f\x74\40\151\x6e\x69\x74\x69\141\x6c\x69\172\145\144\x2c\x20\143\150\145\143\153\x20\164\150\141\164\x20\171\157\165\x20\141\162\145\40\x6c\x6f\x67\x67\x65\x64\x20\x69\x6e\x20\x61\156\144\x2f\157\x72\40\165\x73\x69\x6e\147\40\164\150\145\x20\x63\157\162\162\x65\x63\164\40\x74\157\x6b\145\156\137\x61\x75\164\x68\x2e"); } $paramDate = Range::getRelativeToEndDate($period, $range, $endDate, $this->site); $params = array_merge($paramsToSet, array("\x64\x61\x74\145" => $paramDate)); return $params; } protected function getNumericValue($methodToCall, $date = false) { $params = $date === false ? array() : array("\144\x61\164\145" => $date); $return = Request::processRequest($methodToCall, $params); $columns = $return->getFirstRow()->getColumns(); return reset($columns); } protected function getUrlSparkline($action, $customParameters = array()) { $params = $this->getGraphParamsModified(array("\x76\x69\145\x77\104\141\164\x61\124\141\142\154\x65" => "\163\160\141\162\153\154\151\156\x65", "\x61\x63\x74\x69\157\156" => $action, "\x6d\157\144\165\154\145" => $this->pluginName) + $customParameters); foreach ($params as &$value) { if (is_array($value)) { $value = rawurlencode(implode("\x2c", $value)); } } $url = Url::getCurrentQueryStringWithParametersModified($params); return $url; } protected function setMinDateView(Date $minDate, $view) { $view->minDateYear = $minDate->toString("\x59"); $view->minDateMonth = $minDate->toString("\x6d"); $view->minDateDay = $minDate->toString("\x64"); } protected function setMaxDateView(Date $maxDate, $view) { $view->maxDateYear = $maxDate->toString("\x59"); $view->maxDateMonth = $maxDate->toString("\155"); $view->maxDateDay = $maxDate->toString("\x64"); } protected function setGeneralVariablesView($view) { $this->setGeneralVariablesViewAs($view, $viewType = null); } protected function setGeneralVariablesViewAs($view, $viewType) { $this->checkViewType($viewType); if ($viewType === null) { $viewType = $this instanceof ControllerAdmin ? "\x61\x64\155\151\156" : "\x62\x61\x73\151\x63"; } $view->idSite = $this->idSite; $this->checkSitePermission(); $this->setPeriodVariablesView($view); $view->siteName = $this->site->getName(); $view->siteMainUrl = $this->site->getMainUrl(); $siteTimezone = $this->site->getTimezone(); $datetimeMinDate = $this->site->getCreationDate()->getDatetime(); $minDate = Date::factory($datetimeMinDate, $siteTimezone); $this->setMinDateView($minDate, $view); $maxDate = Date::factory("\x6e\157\167", $siteTimezone); $this->setMaxDateView($maxDate, $view); $rawDate = Piwik::getDate(GeneralConfig::getConfigValue("\x64\x65\146\141\x75\154\x74\x5f\x64\141\171")); Period::checkDateFormat($rawDate); $periodStr = Piwik::getPeriod(GeneralConfig::getConfigValue("\x64\145\146\141\x75\x6c\164\137\160\145\162\151\x6f\144")); if ($periodStr !== "\162\x61\x6e\147\145") { $date = Date::factory($this->strDate); $validDate = $this->getValidDate($date, $minDate, $maxDate); $period = Period\Factory::build($periodStr, $validDate); if ($date->toString() !== $validDate->toString()) { $this->setDate($validDate); } } else { $period = new Range($periodStr, $rawDate, $siteTimezone); } $dateStart = $period->getDateStart(); $dateStart = $this->getValidDate($dateStart, $minDate, $maxDate); $dateEnd = $period->getDateEnd(); $dateEnd = $this->getValidDate($dateEnd, $minDate, $maxDate); if ($periodStr === "\162\x61\x6e\147\x65") { $newRawDate = $dateStart->toString() . "\x2c" . $dateEnd->toString(); $period = new Range($periodStr, $newRawDate, $siteTimezone); } $view->date = $this->strDate; $view->prettyDate = self::getCalendarPrettyDate($period); $view->prettyDateLong = $period->getLocalizedLongString(); $view->rawDate = $rawDate; $view->startDate = $dateStart; $view->endDate = $dateEnd; $timezoneOffsetInSeconds = Date::getUtcOffset($siteTimezone); $view->timezoneOffset = $timezoneOffsetInSeconds; $language = LanguagesManager::getLanguageForSession(); $view->language = !empty($language) ? $language : LanguagesManager::getLanguageCodeForCurrentUser(); $this->setBasicVariablesViewAs($view, $viewType); $view->topMenu = MenuTop::getInstance()->getMenu(); $view->adminMenu = MenuAdmin::getInstance()->getMenu(); $notifications = $view->notifications; if (empty($notifications)) { $view->notifications = NotificationManager::getAllNotificationsToDisplay(); NotificationManager::cancelAllNonPersistent(); } } private function getValidDate(Date $date, Date $minDate, Date $maxDate) { if ($date->isEarlier($minDate)) { $date = $minDate; } if ($date->isLater($maxDate)) { $date = $maxDate; } return $date; } protected function setBasicVariablesNoneAdminView($view) { $view->clientSideConfig = PiwikConfig::getInstance()->getClientSideOptions(); $view->isSuperUser = Access::getInstance()->hasSuperUserAccess(); $view->hasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess(); $view->hasSomeViewAccess = Piwik::isUserHasSomeViewAccess(); $view->isUserIsAnonymous = Piwik::isUserIsAnonymous(); $view->hasSuperUserAccess = Piwik::hasUserSuperUserAccess(); $view->disableTrackingMatomoAppLinks = PiwikConfig::getInstance()->General["\144\151\163\141\x62\x6c\x65\x5f\x74\162\141\x63\153\151\156\x67\x5f\x6d\x61\164\x6f\155\x6f\x5f\x61\160\x70\x5f\154\151\156\153\x73"]; if (!Piwik::isUserIsAnonymous()) { $this->showWhatIsNew($view); $view->contactEmail = implode("\x2c", Piwik::getContactEmailAddresses()); $view->emailSuperUser = implode("\x2c", Piwik::getAllSuperUserAccessEmailAddresses()); } $capabilities = array(); if ($this->idSite && $this->site) { $capabilityProvider = StaticContainer::get(Access\CapabilitiesProvider::class); foreach ($capabilityProvider->getAllCapabilities() as $capability) { if (Piwik::isUserHasCapability($this->idSite, $capability->getId())) { $capabilities[] = $capability->getId(); } } } $view->userCapabilities = $capabilities; $this->addCustomLogoInfo($view); $customLogo = new CustomLogo(); $view->logoHeader = $customLogo->getHeaderLogoUrl(); $view->logoLarge = $customLogo->getLogoUrl(); $view->logoSVG = $customLogo->getSVGLogoUrl(); $view->hasSVGLogo = $customLogo->hasSVGLogo(); $view->contactEmail = implode("\54", Piwik::getContactEmailAddresses()); $view->themeStyles = ThemeStyles::get(); $general = PiwikConfig::getInstance()->General; $view->enableFrames = $general["\145\156\x61\x62\x6c\x65\137\146\x72\141\x6d\145\144\137\160\141\147\145\163"] || isset($general["\145\x6e\141\x62\154\x65\x5f\146\x72\x61\155\x65\144\x5f\x6c\157\x67\151\x6e\x73"]) && $general["\145\x6e\141\x62\154\145\x5f\x66\162\x61\155\x65\144\137\154\157\x67\x69\x6e\x73"]; $embeddedAsIframe = Common::getRequestVar("\x6d\x6f\x64\x75\154\x65", '', "\163\164\x72\x69\156\147") === "\127\151\x64\x67\x65\x74\x69\172\x65"; if (!$view->enableFrames && !$embeddedAsIframe) { $view->setXFrameOptions("\x73\x61\x6d\145\x6f\162\x69\x67\151\x6e"); } $pluginManager = Plugin\Manager::getInstance(); $view->relativePluginWebDirs = (object) $pluginManager->getWebRootDirectoriesForCustomPluginDirs(); $view->pluginsToLoadOnDemand = $pluginManager->getPluginUmdsToLoadOnDemand(); $view->isMultiSitesEnabled = $pluginManager->isPluginActivated("\115\x75\x6c\x74\x69\x53\151\164\145\163"); $view->isSingleSite = Access::doAsSuperUser(function () { $allSites = Request::processRequest("\x53\x69\x74\x65\163\x4d\x61\156\141\147\145\x72\56\147\145\x74\101\x6c\154\123\x69\x74\x65\163\x49\x64", array(), array()); return count($allSites) === 1; }); if (isset($this->site) && is_object($this->site) && $this->site instanceof Site) { $view->siteName = $this->site->getName(); } self::setHostValidationVariablesView($view); } protected function setBasicVariablesView($view) { $this->setBasicVariablesViewAs($view); } protected function setBasicVariablesViewAs($view, $viewType = null) { $this->checkViewType($viewType); $this->setBasicVariablesNoneAdminView($view); } protected function addCustomLogoInfo($view) { $customLogo = new CustomLogo(); $view->isCustomLogo = $customLogo->isEnabled(); $view->customFavicon = $customLogo->getPathUserFavicon(); } protected function showWhatIsNew(View $view) : void { $view->whatisnewShow = false; if (isset($view->hideWhatIsNew) && $view->hideWhatIsNew) { return; } $model = new UsersModel(); $user = $model->getUser(Piwik::getCurrentUserLogin()); if (!$user) { return; } $userChanges = new UserChanges($user); $newChangesStatus = $userChanges->getNewChangesStatus(); $shownRecently = $userChanges->shownRecently(); if ($newChangesStatus == ChangesModel::NEW_CHANGES_EXIST && !$shownRecently) { $view->whatisnewShow = true; } } public static function setHostValidationVariablesView($view) { $view->isValidHost = Url::isValidHost(); if (!$view->isValidHost) { $validHosts = Url::getTrustedHostsFromConfig(); $validHost = $validHosts[0]; $invalidHost = Common::sanitizeInputValue(Url::getHost(false)); $emailSubject = rawurlencode(Piwik::translate("\103\x6f\162\x65\110\x6f\x6d\x65\137\x49\x6e\152\x65\x63\x74\145\144\110\x6f\x73\164\x45\155\141\x69\154\x53\x75\x62\152\x65\143\164", $invalidHost)); $emailBody = rawurlencode(Piwik::translate("\x43\157\162\x65\x48\x6f\x6d\145\137\111\x6e\152\145\x63\x74\145\x64\x48\x6f\x73\x74\x45\x6d\x61\151\154\x42\x6f\144\171")); $superUserEmail = rawurlencode(implode("\54", Piwik::getContactEmailAddresses())); $mailToUrl = "\155\141\x69\x6c\x74\157\x3a{$superUserEmail}\x3f\x73\x75\142\x6a\145\x63\x74\x3d{$emailSubject}\x26\142\x6f\x64\171\75{$emailBody}"; $mailLinkStart = "\x3c\x61\40\x68\162\x65\146\75\42{$mailToUrl}\x22\x3e"; $invalidUrl = Url::getCurrentUrlWithoutQueryString($checkIfTrusted = false); $validUrl = Url::getCurrentScheme() . "\72\x2f\x2f" . $validHost . Url::getCurrentScriptName(); $invalidUrl = Common::sanitizeInputValue($invalidUrl); $validUrl = Common::sanitizeInputValue($validUrl); $changeTrustedHostsUrl = "\x69\156\144\x65\x78\56\160\x68\160" . Url::getCurrentQueryStringWithParametersModified(array("\155\x6f\x64\x75\154\x65" => "\103\157\x72\145\x41\x64\x6d\x69\156\x48\x6f\155\145", "\x61\143\x74\151\x6f\156" => "\147\145\x6e\145\x72\141\154\123\145\x74\x74\151\x6e\147\x73")) . "\43\x74\x72\x75\x73\x74\145\x64\110\x6f\163\x74\x73\123\145\143\x74\x69\x6f\156"; $warningStart = Piwik::translate("\x43\157\x72\x65\x48\x6f\155\x65\137\111\156\152\145\143\x74\145\x64\110\157\x73\164\127\x61\x72\156\x69\156\147\x49\x6e\164\162\x6f", array("\x3c\x73\164\162\x6f\156\x67\x3e" . $invalidUrl . "\x3c\57\x73\x74\x72\x6f\x6e\x67\76", "\x3c\163\x74\162\x6f\156\x67\x3e" . $validUrl . "\74\x2f\163\164\162\157\x6e\x67\76")) . "\x20\x3c\x62\162\x2f\x3e"; if (Piwik::hasUserSuperUserAccess()) { $view->invalidHostMessage = $warningStart . "\40" . Piwik::translate("\103\x6f\162\x65\x48\157\x6d\x65\137\111\156\x6a\145\143\164\x65\144\x48\x6f\x73\x74\123\165\160\x65\x72\x55\163\x65\162\127\141\x72\x6e\151\156\x67", array("\x3c\141\40\x68\162\x65\146\x3d\42{$changeTrustedHostsUrl}\42\x3e", $invalidHost, "\x3c\x2f\141\76", "\x3c\142\x72\x2f\x3e\74\x61\40\x68\162\145\146\x3d\42{$validUrl}\42\76", Common::sanitizeInputValue($validHost), "\x3c\x2f\141\x3e")); } elseif (Piwik::isUserIsAnonymous()) { $view->invalidHostMessage = $warningStart . "\40" . Piwik::translate("\x43\x6f\x72\145\x48\x6f\155\x65\x5f\111\x6e\152\145\143\x74\145\144\110\x6f\x73\x74\116\x6f\x6e\x53\x75\x70\x65\162\x55\x73\x65\x72\x57\x61\x72\x6e\x69\156\x67", array("\x3c\142\162\x2f\76\74\x61\x20\x68\x72\x65\146\75\42{$validUrl}\x22\76", "\x3c\x2f\x61\76", "\74\x73\x70\x61\156\40\163\164\x79\154\x65\x3d\42\144\151\163\160\154\x61\x79\x3a\156\157\156\x65\42\76", "\x3c\x2f\163\x70\x61\156\76")); } else { $view->invalidHostMessage = $warningStart . "\40" . Piwik::translate("\103\x6f\162\x65\x48\x6f\x6d\145\x5f\111\156\152\x65\143\x74\x65\x64\110\157\x73\164\116\157\x6e\x53\165\160\x65\162\x55\163\x65\x72\127\x61\x72\156\151\x6e\x67", array("\74\x62\162\57\76\x3c\141\x20\x68\162\x65\146\75\42{$validUrl}\x22\76", "\74\x2f\141\76", $mailLinkStart, "\x3c\x2f\x61\x3e")); } $view->invalidHostMessageHowToFix = "\x3c\160\x3e\74\142\x3e\110\x6f\167\x20\144\x6f\40\x49\x20\x66\151\x78\40\x74\x68\x69\163\x20\160\x72\x6f\x62\154\x65\155\x20\x61\x6e\x64\x20\x68\x6f\x77\40\144\x6f\x20\x49\x20\154\157\x67\x69\x6e\40\141\x67\141\x69\156\x3f\x3c\x2f\x62\76\x3c\142\162\x2f\x3e\40\124\150\145\x20\x4d\141\x74\157\155\x6f\40\123\165\x70\145\x72\40\125\163\x65\162\40\143\141\x6e\40\x6d\x61\x6e\165\141\x6c\154\x79\x20\x65\144\151\x74\x20\x74\x68\x65\x20\x66\x69\154\145\x20\x2f\x70\x61\x74\x68\x2f\164\x6f\x2f\x6d\141\164\x6f\155\x6f\57\143\x6f\x6e\146\151\147\x2f\x63\157\x6e\146\151\147\x2e\151\156\x69\x2e\160\x68\x70\12\11\11\x9\x9\11\x9\141\156\x64\40\141\144\144\x20\164\150\x65\x20\x66\x6f\x6c\154\x6f\167\151\x6e\147\x20\x6c\x69\x6e\x65\x73\x3a\x20\x3c\160\x72\145\76\x5b\x47\145\x6e\145\x72\x61\154\135" . "\xa" . "\x74\162\165\163\164\x65\x64\x5f\150\157\x73\x74\x73\133\x5d\40\75\x20\42" . $invalidHost . "\42\x3c\57\160\x72\x65\76\x41\x66\164\x65\x72\x20\155\141\153\151\156\147\40\164\150\x65\x20\x63\x68\x61\x6e\147\145\x2c\x20\x79\157\x75\x20\167\x69\154\154\40\142\x65\40\x61\x62\154\x65\x20\164\157\x20\154\x6f\x67\151\x6e\x20\141\x67\x61\x69\156\56\x3c\x2f\160\76\12\11\x9\11\x9\11\x9\74\x70\76\x59\157\x75\x20\x6d\141\171\40\x61\154\x73\x6f\40\x3c\151\x3e\144\x69\163\141\142\x6c\145\x20\164\150\x69\163\40\x73\145\143\x75\162\x69\164\x79\x20\146\145\x61\164\165\162\145\x20\x28\x6e\157\x74\40\162\145\x63\157\x6d\155\145\156\144\x65\144\x29\x3c\x2f\151\x3e\56\40\x54\157\40\144\157\40\x73\x6f\x20\x65\x64\151\164\40\x63\x6f\156\146\151\x67\x2f\x63\157\156\x66\x69\x67\56\151\x6e\151\56\x70\x68\x70\x20\x61\156\x64\x20\141\144\144\72\xa\x9\x9\x9\x9\11\11\x3c\x70\162\145\76\x5b\x47\145\x6e\x65\x72\141\154\135" . "\12" . "\145\156\x61\142\154\x65\x5f\164\162\x75\163\x74\x65\x64\x5f\150\x6f\x73\164\x5f\x63\x68\145\143\153\x3d\60\74\57\160\x72\145\76"; $view->invalidHost = $invalidHost; $view->invalidHostMailLinkStart = $mailLinkStart; } } public static function setPeriodVariablesView($view) { if (isset($view->period)) { return; } $periodValidator = new PeriodValidator(); $currentPeriod = Piwik::getPeriod(GeneralConfig::getConfigValue("\x64\145\x66\x61\165\x6c\x74\x5f\x70\145\x72\x69\157\144")); $availablePeriods = $periodValidator->getPeriodsAllowedForUI(); if (!$periodValidator->isPeriodAllowedForUI($currentPeriod)) { throw new Exception("\x50\145\162\151\x6f\144\40\x6d\165\163\x74\x20\x62\145\x20\x6f\156\145\x20\x6f\x66\x3a\x20" . implode("\x2c\x20", $availablePeriods)); } $view->displayUniqueVisitors = SettingsPiwik::isUniqueVisitorsEnabled($currentPeriod); $found = array_search($currentPeriod, $availablePeriods); unset($availablePeriods[$found]); $view->period = $currentPeriod; $view->otherPeriods = $availablePeriods; $view->enabledPeriods = self::getEnabledPeriodsInUI(); $view->periodsNames = self::getEnabledPeriodsNames(); } public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array()) { try { $this->doRedirectToUrl($moduleToRedirect, $actionToRedirect, $websiteId, $defaultPeriod, $defaultDate, $parameters); } catch (Exception $e) { } if (Piwik::hasUserSuperUserAccess()) { $siteTableName = Common::prefixTable("\163\151\x74\145"); $message = "\105\162\162\x6f\162\72\40\x6e\157\40\x77\x65\142\x73\x69\164\x65\40\167\141\x73\x20\x66\x6f\x75\156\x64\40\151\156\x20\x74\150\x69\163\40\115\x61\x74\x6f\155\157\40\151\156\x73\x74\x61\x6c\x6c\141\x74\151\x6f\156\56\xa\x9\x9\x9\x3c\142\162\x20\57\x3e\103\x68\145\143\x6b\x20\x74\x68\x65\40\164\141\x62\154\145\x20\47{$siteTableName}\47\x20\x69\156\x20\171\157\165\162\40\144\x61\x74\141\x62\141\x73\x65\54\x20\x69\164\40\x73\150\157\x75\154\144\x20\x63\x6f\x6e\x74\141\x69\x6e\x20\171\157\x75\162\40\115\141\x74\157\155\157\x20\167\x65\142\x73\151\x74\145\163\56"; $ex = new NoWebsiteFoundException($message); $ex->setIsHtmlMessage(); throw $ex; } if (!Piwik::isUserIsAnonymous()) { $currentLogin = Piwik::getCurrentUserLogin(); $emails = rawurlencode(implode("\54", Piwik::getContactEmailAddresses())); $errorMessage = sprintf(Piwik::translate("\103\157\x72\x65\x48\x6f\x6d\145\137\x4e\157\120\x72\x69\x76\151\x6c\145\x67\x65\163\101\163\153\x50\x69\x77\x69\x6b\x41\x64\155\x69\x6e"), $currentLogin, "\74\x62\x72\x2f\76\x3c\x61\40\x68\x72\145\146\75\x27\x6d\141\x69\x6c\164\157\x3a" . $emails . "\77\x73\165\142\152\x65\143\x74\x3d\101\x63\x63\x65\x73\x73\x20\x74\x6f\40\115\141\x74\157\155\157\x20\146\157\162\x20\165\163\145\x72\40{$currentLogin}\47\76", "\x3c\x2f\x61\x3e"); $errorMessage .= "\x3c\142\162\40\57\x3e\x3c\x62\x72\40\57\76\x26\x6e\142\163\160\x3b\x26\x6e\142\163\x70\73\x26\x6e\x62\163\x70\x3b\x3c\x62\76\x3c\141\x20\x68\x72\x65\x66\x3d\47\151\156\x64\x65\170\56\160\150\x70\77\x6d\157\x64\165\x6c\145\x3d" . Piwik::getLoginPluginName() . "\46\141\155\x70\73\x61\143\x74\x69\x6f\x6e\75\154\x6f\x67\157\165\x74\47\76\46\x72\x73\x61\x71\x75\157\x3b\x20" . Piwik::translate("\107\x65\x6e\x65\x72\141\154\x5f\114\x6f\147\x6f\x75\164") . "\x3c\x2f\x61\x3e\74\57\142\76\74\x62\x72\x20\57\x3e"; $ex = new NoPrivilegesException($errorMessage); $ex->setIsHtmlMessage(); throw $ex; } echo FrontController::getInstance()->dispatch(Piwik::getLoginPluginName(), false); die; } protected function checkTokenInUrl() { $tokenRequest = Common::getRequestVar("\x74\157\x6b\145\x6e\x5f\141\x75\x74\x68", false); $tokenUser = Piwik::getCurrentUserTokenAuth(); if (empty($tokenRequest) && empty($tokenUser)) { return; } if ($tokenRequest !== $tokenUser) { throw new NoAccessException(Piwik::translate("\x47\145\x6e\145\162\x61\x6c\x5f\x45\170\143\x65\x70\x74\x69\157\x6e\x53\145\143\165\162\x69\164\171\x43\150\x65\x63\x6b\106\x61\x69\x6c\145\144")); } } public static function getCalendarPrettyDate($period) { if ($period instanceof Month) { return $period->getLocalizedLongString(); } else { return $period->getPrettyString(); } } public static function getPrettyDate($date, $period) { return self::getCalendarPrettyDate(Period\Factory::build($period, Date::factory($date))); } protected function checkSitePermission() { if (!empty($this->idSite)) { Access::getInstance()->checkUserHasViewAccess($this->idSite); new Site($this->idSite); } elseif (empty($this->site) || empty($this->idSite)) { throw new Exception("\x54\x68\x65\x20\x72\145\x71\x75\x65\163\x74\x65\x64\40\x77\x65\142\163\151\164\x65\x20\x69\144\123\151\164\x65\40\151\x73\40\156\x6f\164\x20\146\x6f\x75\156\144\40\151\x6e\x20\x74\150\x65\40\x72\x65\x71\x75\145\x73\164\54\40\157\x72\40\151\x73\40\x69\x6e\x76\141\154\151\144\x2e\12\x9\x9\11\11\120\154\145\141\x73\x65\x20\x63\150\x65\x63\153\40\x74\150\x61\164\40\171\157\x75\40\x61\162\145\x20\x6c\157\x67\x67\x65\144\40\151\x6e\x20\115\x61\164\157\x6d\x6f\x20\x61\x6e\144\x20\x68\141\166\x65\x20\160\145\x72\155\151\163\x73\x69\x6f\156\x20\x74\x6f\40\x61\143\x63\x65\163\x73\40\x74\150\x65\40\x73\x70\145\x63\x69\x66\151\x65\144\x20\x77\x65\142\x73\151\x74\x65\x2e"); } } private function doRedirectToUrl($moduleToRedirect, $actionToRedirect, $websiteId, $defaultPeriod, $defaultDate, $parameters) { $menu = new Menu(); $parameters = array_merge($menu->urlForDefaultUserParams($websiteId, $defaultPeriod, $defaultDate), $parameters); $queryParams = !empty($parameters) ? "\x26" . Url::getQueryStringFromParameters($parameters) : ''; $url = "\x69\x6e\144\145\x78\56\x70\150\160\x3f\x6d\x6f\144\x75\x6c\145\75\x25\x73\x26\141\143\164\x69\x6f\x6e\75\x25\163"; $url = sprintf($url, $moduleToRedirect, $actionToRedirect); $url = $url . $queryParams; Url::redirectToUrl($url); } private function checkViewType($viewType) { if ($viewType === "\141\x64\x6d\151\156" && !$this instanceof ControllerAdmin) { throw new Exception("\x27\141\144\155\x69\x6e\47\x20\x76\151\145\x77\40\x74\171\160\145\x20\151\x73\40\157\156\x6c\171\40\x61\154\x6c\x6f\x77\x65\x64\x20\x77\151\x74\150\x20\x43\x6f\156\x74\x72\157\154\154\145\x72\101\144\155\151\156\40\x63\x6c\x61\x73\x73\56"); } } }

Function Calls

None

Variables

None

Stats

MD5 80e75089543b610308a74a545c5554ab
Eval Count 0
Decode Time 136 ms