Merge branch 'master' of github.com:phpmyadmin/phpmyadmin

This commit is contained in:
Madhura Jayaratne 2015-06-16 11:08:28 +05:30
commit f4f183aacd
7 changed files with 98 additions and 46 deletions

View File

@ -1111,8 +1111,8 @@ Generic settings
:type: boolean
:default: true
Enables check for latest versions using javascript on main phpMyAdmin
page.
Enables check for latest versions using JavaScript on the main phpMyAdmin
page or by directly accessing :file:`version_check.php`.
.. note::
@ -1693,6 +1693,15 @@ Main panel
Defines whether to display informations about the current Git revision (if
applicable) on the main panel.
.. config:option:: $cfg['MysqlMinVersion']
:type: array
Defines the minimum supported MySQL version. The default is chosen
by the phpMyAdmin team; however this directive was asked by a developer
of the Plesk control panel to ease integration with older MySQL servers
(where most of the phpMyAdmin features work).
Database structure
------------------

View File

@ -4491,6 +4491,10 @@ class PMA_Util
*/
public static function getLatestVersion()
{
if (!$GLOBALS['cfg']['VersionCheck']) {
return new stdClass();
}
// wait 3s at most for server response, it's enough to get information
// from a working server
$connection_timeout = 3;

View File

@ -1027,10 +1027,10 @@ if (! defined('PMA_MINIMUM_COMMON')) {
/* Log success */
PMA_logUser($cfg['Server']['user']);
if (PMA_MYSQL_INT_VERSION < 50500) {
if (PMA_MYSQL_INT_VERSION < $cfg['MysqlMinVersion']['internal']) {
PMA_fatalError(
__('You should upgrade to %s %s or later.'),
array('MySQL', '5.5.0')
array('MySQL', $cfg['MysqlMinVersion']['human'])
);
}

View File

@ -3065,4 +3065,15 @@ $cfg['maxRowPlotLimit'] = 500;
*/
$cfg['ShowGitRevision'] = true;
/**
* MySQL minimal version required
*
* @global array $cfg['MysqlMinVersion']
*/
$cfg['MysqlMinVersion'] = array(
'internal' => 50500,
'human' => '5.5.0'
);
?>

View File

@ -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 = '<!-- LOGO START -->';
// display Logo, depending on $GLOBALS['cfg']['NavigationDisplayLogo']
if (!$GLOBALS['cfg']['NavigationDisplayLogo']) {
$retval .= '<!-- LOGO END -->';
return $retval;
return Template::get('logo')
->render(array('displayLogo' => false));
}
$logo = 'phpMyAdmin';
@ -88,44 +90,57 @@ class PMA_NavigationHeader
$logo = '<img src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo2.png" '
. 'alt="' . $logo . '" id="imgpmalogo" />';
}
$retval .= '<div id="pmalogo">';
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 .= ' <a href="' . $logo_link;
switch ($GLOBALS['cfg']['NavigationLogoLinkWindow']) {
case 'new':
$retval .= '" 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) !== '://') {
$retval .= $GLOBALS['url_query'] . '"';
} else {
$retval .= '" target="_blank"';
}
}
$retval .= '>';
$retval .= $logo;
$retval .= '</a>';
} else {
$retval .= $logo;
}
$retval .= '</div>';
$retval .= '<!-- LOGO END -->';
return $retval;
if (!$GLOBALS['cfg']['NavigationLogoLink']) {
return Template::get('logo')
->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,
)
);
}
/**

View File

@ -473,7 +473,6 @@ $PMA_SQPdata_reserved_word = array (
'FUNCTION',
'GEMINI',
'GEMINI_SPIN_RETRIES',
'GENERAL',
'GLOBAL',
'GRANT',
'GRANTS',
@ -766,7 +765,6 @@ $PMA_SQPdata_forbidden_word = array (
'FOREIGN',
'FROM',
'FULLTEXT',
'GENERAL',
'GET',
'GRANT',
'GROUP',

15
templates/logo.phtml Normal file
View File

@ -0,0 +1,15 @@
<!-- LOGO START -->
<?php if (false === $displayLogo) : ?>
<!-- LOGO END -->
<?php return; ?>
<?php endif; ?>
<div id="pmalogo">
<?php if (true === $useLogoLink) : ?>
<a href="<?php echo $logoLink; ?>" <?php echo $linkAttribs; ?>>
<?php endif; ?>
<?php echo $logo; ?>
<?php if (true === $useLogoLink) : ?>
</a>
<?php endif; ?>
</div>
<!-- LOGO END -->