diff --git a/libraries/navigation/NavigationHeader.class.php b/libraries/navigation/NavigationHeader.class.php
index 9d9ec76ab3..a5023e4a27 100644
--- a/libraries/navigation/NavigationHeader.class.php
+++ b/libraries/navigation/NavigationHeader.class.php
@@ -9,6 +9,9 @@ if (! defined('PHPMYADMIN')) {
exit;
}
+require_once 'libraries/Template.class.php';
+use PMA\Template;
+
/**
* This class renders the logo, links, server selection,
* which are then displayed at the top of the navigation panel
@@ -73,11 +76,10 @@ class PMA_NavigationHeader
*/
private function _logo()
{
- $retval = '';
// display Logo, depending on $GLOBALS['cfg']['NavigationDisplayLogo']
if (!$GLOBALS['cfg']['NavigationDisplayLogo']) {
- $retval .= '';
- return $retval;
+ return Template::get('logo')
+ ->render(array('displayLogo' => false));
}
$logo = 'phpMyAdmin';
@@ -88,44 +90,57 @@ class PMA_NavigationHeader
$logo = '
';
}
- $retval .= '
';
- if ($GLOBALS['cfg']['NavigationLogoLink']) {
- $logo_link = trim(
- htmlspecialchars($GLOBALS['cfg']['NavigationLogoLink'])
- );
- // prevent XSS, see PMASA-2013-9
- // if link has protocol, allow only http and https
- if (preg_match('/^[a-z]+:/i', $logo_link)
- && ! preg_match('/^https?:/i', $logo_link)
- ) {
- $logo_link = 'index.php';
- }
- $retval .= '
render(
+ array(
+ 'displayLogo' => true,
+ 'useLogoLink' => false,
+ 'logo' => $logo,
+ )
+ );
+ }
+
+ $useLogoLink = true;
+ $logoLink = null;
+ $linkAttriks = null;
+ $logoLink = trim(
+ htmlspecialchars($GLOBALS['cfg']['NavigationLogoLink'])
+ );
+ // prevent XSS, see PMASA-2013-9
+ // if link has protocol, allow only http and https
+ if (preg_match('/^[a-z]+:/i', $logoLink)
+ && ! preg_match('/^https?:/i', $logoLink)
+ ) {
+ $logoLink = 'index.php';
+ }
+ switch ($GLOBALS['cfg']['NavigationLogoLinkWindow']) {
+ case 'new':
+ $linkAttriks = 'target="_blank"';
+ break;
+ case 'main':
+ // do not add our parameters for an external link
+ $navLogoLinkLower = /*overload*/mb_strtolower(
+ $GLOBALS['cfg']['NavigationLogoLink']
+ );
+ if (/*overload*/mb_substr($navLogoLinkLower, 0, 4) !== '://') {
+ $logoLink .= $GLOBALS['url_query'];
+ } else {
+ $linkAttriks = 'target="_blank"';
+ }
+ }
+
+ return Template::get('logo')
+ ->render(
+ array(
+ 'displayLogo' => true,
+ 'useLogoLink' => $useLogoLink,
+ 'logoLink' => $logoLink,
+ 'linkAttribs' => $linkAttriks,
+ 'logo' => $logo,
+ )
+ );
}
/**
diff --git a/templates/logo.phtml b/templates/logo.phtml
new file mode 100644
index 0000000000..60b60e88d7
--- /dev/null
+++ b/templates/logo.phtml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
\ No newline at end of file