The branch, master has been updated
via 306901394e3e8960d3f212234ee99589a5311fed (commit)
from 8adddca21f5fc04e8bfe37f513b87608abd7a0a7 (commit)
- Log -----------------------------------------------------------------
commit 306901394e3e8960d3f212234ee99589a5311fed
Author: Rouslan Placella <rouslan(a)placella.com>
Date: Tue Oct 4 19:51:02 2011 +0100
Fixed usage of undefined function PMA_getImage() in setup script
-----------------------------------------------------------------------
Summary of changes:
libraries/config/FormDisplay.tpl.php | 52 +++++++++++++++++++++++++++------
1 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/libraries/config/FormDisplay.tpl.php b/libraries/config/FormDisplay.tpl.php
index a9e509a..58d6d3e 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(
+ '<img alt="%s" src="%s"%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
<label for="<?php echo htmlspecialchars($path) ?>"><?php echo $name ?></label>
<?php if (!empty($opts['doc']) || !empty($opts['wiki'])) { ?>
<span class="doc">
- <?php if (!empty($opts['doc'])) { ?><a href="<?php echo $base_dir . $opts['doc'] ?>" target="documentation"><?php echo PMA_getImage('b_help.png', __('Documentation')); ?></a><?php } ?>
- <?php if (!empty($opts['wiki'])){ ?><a href="<?php echo $opts['wiki'] ?>" target="wiki"><?php echo PMA_getImage('b_info.png', __('Wiki')) ?></a><?php } ?>
+ <?php if (!empty($opts['doc'])) { ?><a href="<?php echo $base_dir . $opts['doc'] ?>" target="documentation"><?php echo $icons['help']; ?></a><?php } ?>
+ <?php if (!empty($opts['wiki'])){ ?><a href="<?php echo $opts['wiki'] ?>" target="wiki"><?php echo $icons['info']; ?></a><?php } ?>
</span>
<?php } ?>
<?php if ($option_is_disabled) { ?>
@@ -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']) {
?>
- <a class="userprefs-comment" title="<?php echo htmlspecialchars($opts['userprefs_comment']) ?>"><?php echo PMA_getImage('b_tblops.png', __('Comment')); ?></a>
+ <a class="userprefs-comment" title="<?php echo htmlspecialchars($opts['userprefs_comment']) ?>"><?php echo $icons['tblops']; ?></a>
<?php
}
if (isset($opts['setvalue']) && $opts['setvalue']) {
?>
- <a class="set-value" href="#<?php echo htmlspecialchars("$path={$opts['setvalue']}") ?>" title="<?php echo sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue'])) ?>" style="display:none"><?php echo PMA_getImage('b_edit.png'); ?></a>
+ <a class="set-value" href="#<?php echo htmlspecialchars("$path={$opts['setvalue']}") ?>" title="<?php echo sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue'])) ?>" style="display:none"><?php echo $icons['edit']; ?></a>
<?php
}
if (isset($opts['show_restore_default']) && $opts['show_restore_default']) {
?>
- <a class="restore-default" href="#<?php echo $path ?>" title="<?php echo __('Restore default value') ?>" style="display:none"><?php echo PMA_getImage('s_reload.png'); ?></a>
+ <a class="restore-default" href="#<?php echo $path ?>" title="<?php echo __('Restore default value') ?>" style="display:none"><?php echo $icons['reload']; ?></a>
<?php
}
// this must match with displayErrors() in scripts/config.js
hooks/post-receive
--
phpMyAdmin