private static function getErrorResponse(Exception $ex) { $debugTrace = $ex->getTraceAsString(); $message = $ex->getMessage(); if (!method_exists($ex, 'isHtmlMessage') || !$ex->isHtmlMessage()) { $message = Common::sanitizeInputValue($message); } $logo = new CustomLogo(); $logoHeaderUrl = false; $logoFaviconUrl = false; try { $logoHeaderUrl = $logo->getHeaderLogoUrl(); $logoFaviconUrl = $logo->getPathUserFavicon(); } catch (Exception $ex) { Log::debug($ex); } $result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true, $logoHeaderUrl, $logoFaviconUrl); /** * Triggered before a Piwik error page is displayed to the user. * * This event can be used to modify the content of the error page that is displayed when * an exception is caught. * * @param string &$result The HTML of the error page. * @param Exception $ex The Exception displayed in the error page. */ Piwik::postEvent('FrontController.modifyErrorPage', array(&$result, $ex)); return $result; }
public function setDefaultFromPiwik() { $customLogo = new CustomLogo(); $fromEmailName = $customLogo->isEnabled() ? Piwik::translate('CoreHome_WebAnalyticsReports') : Piwik::translate('ScheduledReports_PiwikReports'); $fromEmailAddress = Config::getInstance()->General['noreply_email_address']; $this->setFrom($fromEmailAddress, $fromEmailName); }
public function setDefaultFromPiwik() { $customLogo = new CustomLogo(); /** @var Translator $translator */ $translator = StaticContainer::get('Piwik\\Translation\\Translator'); if ($customLogo->isEnabled()) { $fromEmailName = $translator->translate('CoreHome_WebAnalyticsReports'); } else { $fromEmailName = $translator->translate('ScheduledReports_PiwikReports'); } $fromEmailAddress = Config::getInstance()->General['noreply_email_address']; $this->setFrom($fromEmailAddress, $fromEmailName); }
private static function getErrorResponse(Exception $ex) { $debugTrace = $ex->getTraceAsString(); $message = $ex->getMessage(); $isHtmlMessage = method_exists($ex, 'isHtmlMessage') && $ex->isHtmlMessage(); if (!$isHtmlMessage && Request::isApiRequest($_GET)) { $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $_GET + $_POST)); $response = new ResponseBuilder($outputFormat); return $response->getResponseException($ex); } elseif (!$isHtmlMessage) { $message = Common::sanitizeInputValue($message); } $logo = new CustomLogo(); $logoHeaderUrl = false; $logoFaviconUrl = false; try { $logoHeaderUrl = $logo->getHeaderLogoUrl(); $logoFaviconUrl = $logo->getPathUserFavicon(); } catch (Exception $ex) { try { Log::debug($ex); } catch (\Exception $otherEx) { // DI container may not be setup at this point } } $result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true, $logoHeaderUrl, $logoFaviconUrl); try { /** * Triggered before a Piwik error page is displayed to the user. * * This event can be used to modify the content of the error page that is displayed when * an exception is caught. * * @param string &$result The HTML of the error page. * @param Exception $ex The Exception displayed in the error page. */ Piwik::postEvent('FrontController.modifyErrorPage', array(&$result, $ex)); } catch (ContainerDoesNotExistException $ex) { // this can happen when an error occurs before the Piwik environment is created } return $result; }
public function hasSVGLogo() { if (!$this->isEnabled()) { /* We always have our application logo */ return true; } if ($this->isEnabled() && file_exists(Filesystem::getPathToPiwikRoot() . '/' . CustomLogo::getPathUserSvgLogo())) { return true; } return false; }
public function hasSVGLogo() { if (Config::getInstance()->branding['use_custom_logo'] == 0) { /* We always have our application logo */ return true; } if (Config::getInstance()->branding['use_custom_logo'] == 1 && file_exists(Filesystem::getPathToPiwikRoot() . '/' . CustomLogo::getPathUserSvgLogo())) { return true; } return false; }
public function uploadCustomLogo() { Piwik::checkUserHasSuperUserAccess(); $logo = new CustomLogo(); $successLogo = $logo->copyUploadedLogoToFilesystem(); $successFavicon = $logo->copyUploadedFaviconToFilesystem(); if ($successLogo || $successFavicon) { return '1'; } return '0'; }
protected function addCustomLogoInfo($view) { $customLogo = new CustomLogo(); $view->isCustomLogo = $customLogo->isEnabled(); $view->customFavicon = $customLogo->getPathUserFavicon(); }
protected function handleMaintenanceMode() { if (Config::getInstance()->General['maintenance_mode'] != 1 || Common::isPhpCliMode()) { return; } Common::sendResponseCode(503); $logoUrl = null; $faviconUrl = null; try { $logo = new CustomLogo(); $logoUrl = $logo->getHeaderLogoUrl(); $faviconUrl = $logo->getPathUserFavicon(); } catch (Exception $ex) { } $logoUrl = $logoUrl ?: 'plugins/Morpheus/images/logo-header.png'; $faviconUrl = $faviconUrl ?: 'plugins/CoreHome/images/favicon.ico'; $page = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/maintenance.tpl'); $page = str_replace('%logoUrl%', $logoUrl, $page); $page = str_replace('%faviconUrl%', $faviconUrl, $page); $page = str_replace('%piwikTitle%', Piwik::getRandomTitle(), $page); echo $page; exit; }
private static function migrateBrandingConfig(Config $config) { $useCustomLogo = self::getValueAndDelete($config, 'branding', 'use_custom_logo'); $customLogo = new CustomLogo(); $useCustomLogo ? $customLogo->enable() : $customLogo->disable(); }
/** * Returns whether there is an SVG Logo available. * @ignore * @return bool */ public function hasSVGLogo() { $logo = new CustomLogo(); return $logo->hasSVGLogo(); }
/** * @internal */ public function setBrandingSettings($useCustomLogo) { Piwik::checkUserHasSuperUserAccess(); $customLogo = new CustomLogo(); if ($useCustomLogo) { $customLogo->enable(); } else { $customLogo->disable(); } return true; }
public function uploadCustomLogo() { Piwik::checkUserIsSuperUser(); $logo = new CustomLogo(); $success = $logo->copyUploadedLogoToFilesystem(); if ($success) { return '1'; } return '0'; }