Skip to content
Extraits de code Groupes Projets
Valider 52c4961a rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Use custom logo & favicon in error page.

parent 5dd1bff3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -17,6 +17,7 @@ use Piwik\Http\Router; ...@@ -17,6 +17,7 @@ use Piwik\Http\Router;
use Piwik\Plugin\Controller; use Piwik\Plugin\Controller;
use Piwik\Plugin\Report; use Piwik\Plugin\Report;
use Piwik\Plugin\Widgets; use Piwik\Plugin\Widgets;
use Piwik\Plugins\CoreAdminHome\CustomLogo;
use Piwik\Session; use Piwik\Session;
use Piwik\Plugins\CoreHome\Controller as CoreHomeController; use Piwik\Plugins\CoreHome\Controller as CoreHomeController;
...@@ -618,7 +619,8 @@ class FrontController extends Singleton ...@@ -618,7 +619,8 @@ class FrontController extends Singleton
$message = Common::sanitizeInputValue($ex->getMessage()); $message = Common::sanitizeInputValue($ex->getMessage());
} }
$result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true); $logo = new CustomLogo();
$result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true, $logo->getHeaderLogoUrl(), $logo->getPathUserFavicon());
/** /**
* Triggered before a Piwik error page is displayed to the user. * Triggered before a Piwik error page is displayed to the user.
......
...@@ -88,9 +88,12 @@ if (!function_exists('Piwik_GetErrorMessagePage')) { ...@@ -88,9 +88,12 @@ if (!function_exists('Piwik_GetErrorMessagePage')) {
* @param bool|string $optionalTrace Backtrace; will be displayed in lighter color * @param bool|string $optionalTrace Backtrace; will be displayed in lighter color
* @param bool $optionalLinks If true, will show links to the Piwik website for help * @param bool $optionalLinks If true, will show links to the Piwik website for help
* @param bool $optionalLinkBack If true, displays a link to go back * @param bool $optionalLinkBack If true, displays a link to go back
* @param bool|string $logoUrl The URL to the logo to use.
* @param bool|string $faviconUrl The URL to the favicon to use.
* @return string * @return string
*/ */
function Piwik_GetErrorMessagePage($message, $optionalTrace = false, $optionalLinks = false, $optionalLinkBack = false) function Piwik_GetErrorMessagePage($message, $optionalTrace = false, $optionalLinks = false, $optionalLinkBack = false,
$logoUrl = false, $faviconUrl = false)
{ {
if (!headers_sent()) { if (!headers_sent()) {
header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
...@@ -101,6 +104,14 @@ if (!function_exists('Piwik_GetErrorMessagePage')) { ...@@ -101,6 +104,14 @@ if (!function_exists('Piwik_GetErrorMessagePage')) {
} }
} }
if (empty($logoUrl)) {
$logoUrl = "plugins/Morpheus/images/logo-header.png";
}
if (empty($faviconUrl)) {
$faviconUrl = "plugins/CoreHome/images/favicon.ico";
}
if ($optionalTrace) { if ($optionalTrace) {
$optionalTrace = '<span class="exception-backtrace">Backtrace:<br /><pre>' . $optionalTrace . '</pre></span>'; $optionalTrace = '<span class="exception-backtrace">Backtrace:<br /><pre>' . $optionalTrace . '</pre></span>';
} }
...@@ -117,7 +128,11 @@ if (!function_exists('Piwik_GetErrorMessagePage')) { ...@@ -117,7 +128,11 @@ if (!function_exists('Piwik_GetErrorMessagePage')) {
if ($optionalLinkBack) { if ($optionalLinkBack) {
$optionalLinkBack = '<a href="javascript:window.history.back();">Go Back</a><br/>'; $optionalLinkBack = '<a href="javascript:window.history.back();">Go Back</a><br/>';
} }
$headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl'); $headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl');
$headerPage = str_replace('%logoUrl%', $logoUrl, $headerPage);
$headerPage = str_replace('%faviconUrl%', $faviconUrl, $headerPage);
$footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl'); $footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl');
$headerPage = str_replace('{$HTML_TITLE}', PAGE_TITLE_WHEN_ERROR, $headerPage); $headerPage = str_replace('{$HTML_TITLE}', PAGE_TITLE_WHEN_ERROR, $headerPage);
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>{$HTML_TITLE}</title> <title>{$HTML_TITLE}</title>
<link rel="shortcut icon" href="plugins/CoreHome/images/favicon.ico" /> <link rel="shortcut icon" href="%faviconUrl%" />
<link rel="stylesheet" type="text/css" href="plugins/Morpheus/stylesheets/simple_structure.css" /> <link rel="stylesheet" type="text/css" href="plugins/Morpheus/stylesheets/simple_structure.css" />
</head> </head>
<body id="simple"> <body id="simple">
<div id="contentsimple"> <div id="contentsimple">
<div id="title"><img title="Piwik" alt="Piwik" src="plugins/Morpheus/images/logo-header.png" style="margin-left:10px;" /><span id="subh1"> # <a href='http://piwik.org/'>Web Analytics</a></span></div> <div id="title"><img title="Piwik" alt="Piwik" src="%logoUrl%" style="margin-left:10px;" /><span id="subh1"> # <a href='http://piwik.org/'>Web Analytics</a></span></div>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter