From 306901394e3e8960d3f212234ee99589a5311fed Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Tue, 4 Oct 2011 19:51:02 +0100 Subject: [PATCH 1/2] Fixed usage of undefined function PMA_getImage() in setup script --- libraries/config/FormDisplay.tpl.php | 52 ++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/libraries/config/FormDisplay.tpl.php b/libraries/config/FormDisplay.tpl.php index a9e509a21a..58d6d3e789 100644 --- a/libraries/config/FormDisplay.tpl.php +++ b/libraries/config/FormDisplay.tpl.php @@ -124,14 +124,46 @@ function display_fieldset_top($title = '', $description = '', $errors = null, $a function display_input($path, $name, $description = '', $type, $value, $value_is_default = true, $opts = null) { global $_FormDisplayGroup; - static $base_dir, $img_path; + static $base_dir; // Relative path to the root phpMyAdmin folder + static $icons; // An array of IMG tags used further below in the function $is_setup_script = defined('PMA_SETUP'); - if ($base_dir === null) { + if ($base_dir === null) { // if the static variables have not been initialised $base_dir = $is_setup_script ? '../' : ''; - $img_path = $is_setup_script - ? '../' . ltrim($GLOBALS['cfg']['ThemePath'], './') . '/original/img/' - : $_SESSION['PMA_Theme']->img_path; + $icons = array(); + // Icon definitions: + // The same indexes will be used in the $icons array. + // The first element contains the filename and the second + // element is used for the "alt" and "title" attributes. + $icon_init = array( + 'edit' => array('b_edit.png', ''), + 'help' => array('b_help.png', __('Documentation')), + 'info' => array('b_info.png', __('Wiki')), + 'reload' => array('s_reload.png', ''), + 'tblops' => array('b_tblops.png', '') + ); + if ($is_setup_script) { + // When called from the setup script, we don't have access to the + // sprite-aware PMA_getImage() function because the PMA_theme class + // has not been loaded, so we generate the img tags manually. + foreach ($icon_init as $k => $v) { + $title = ''; + if (! empty($v[1])) { + $title = ' title="' . $v[1] . '"'; + } + $icons[$k] = sprintf( + '%s', + $v[1], + ".{$GLOBALS['cfg']['ThemePath']}/original/img/{$v[0]}", + $title + ); + } + } else { + // In this case we just use PMA_getImage() because it's available + foreach ($icon_init as $k => $v) { + $icons[$k] = PMA_getImage($v[0], $v[1]); + } + } } $has_errors = isset($opts['errors']) && !empty($opts['errors']); $option_is_disabled = !$is_setup_script && isset($opts['userprefs_allow']) && !$opts['userprefs_allow']; @@ -159,8 +191,8 @@ function display_input($path, $name, $description = '', $type, $value, $value_is - - + + @@ -234,17 +266,17 @@ function display_input($path, $name, $description = '', $type, $value, $value_is } if ($is_setup_script && isset($opts['userprefs_comment']) && $opts['userprefs_comment']) { ?> - + - " title="" style="display:none"> + " title="" style="display:none"> - + Date: Wed, 5 Oct 2011 00:34:56 +0530 Subject: [PATCH 2/2] bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false --- ChangeLog | 1 + libraries/navigation_header.inc.php | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a285f45de1..edf76a79d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog ====================== 3.4.7.0 (not yet released) +- bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false 3.4.6.0 (not yet released) - patch #3404173 InnoDB comment display with tooltips/aliases diff --git a/libraries/navigation_header.inc.php b/libraries/navigation_header.inc.php index b549a02fd8..a892c4f012 100644 --- a/libraries/navigation_header.inc.php +++ b/libraries/navigation_header.inc.php @@ -97,15 +97,27 @@ if ($GLOBALS['cfg']['LeftDisplayLogo']) { if ($GLOBALS['cfg']['MainPageIconic']) { echo '' . __('phpMyAdmin documentation') . ''; + } else { + echo '
' . __('phpMyAdmin documentation'); } echo ''; - echo ' ' . PMA_showMySQLDocu('', '', TRUE) . "\n"; + + $documentation_link = PMA_showMySQLDocu('', '', true); + if ($GLOBALS['cfg']['MainPageIconic']) { + echo $documentation_link . "\n"; + } else { + preg_match('/]*>/', $documentation_link, $matches); + $link = $matches[0]; + echo substr($link, 0, strlen($link) - 1) . ' title="' . __('Documentation') . '" >' + . '
' . __('Documentation') . ''; + } $params = array('uniqid' => uniqid()); if (!empty($GLOBALS['db'])) { $params['db'] = $GLOBALS['db']; } - echo ''; + echo ''; if ($GLOBALS['cfg']['MainPageIconic']) { echo '