diff --git a/.gsoc/todo.txt b/.gsoc/todo.txt index b9a860860..959835c0c 100644 --- a/.gsoc/todo.txt +++ b/.gsoc/todo.txt @@ -1,9 +1,9 @@ restore cache'ing in phpmyadmin.css.php remove debug from user preferences header -marker for extension dependent options (SOAP for sql validation) info about setup script in prefs manage, it seems many people still don't know it exists (and maybe some description in docs on making it work with live configuration?) -info for constrained values (eg. MaxDbList)? + +show blacklist (and debug?) on prefs manage page diff --git a/libraries/config/Form.class.php b/libraries/config/Form.class.php index dcdba3190..ddf6a0f83 100644 --- a/libraries/config/Form.class.php +++ b/libraries/config/Form.class.php @@ -109,6 +109,7 @@ class Form $value = array_combine($keys, $value); } } + // $value has keys and value names, return it return $value; } diff --git a/libraries/config/FormDisplay.class.php b/libraries/config/FormDisplay.class.php index b1caa788e..eba4d0d77 100644 --- a/libraries/config/FormDisplay.class.php +++ b/libraries/config/FormDisplay.class.php @@ -374,6 +374,7 @@ class FormDisplay } } } + $this->_setComments($system_path, $opts); // send default value to form's JS $js_line = '\'' . $translated_path . '\': '; @@ -705,5 +706,67 @@ class FormDisplay $this->userprefs_disallow = array_flip($userprefs_disallow); } } + + /** + * Sets field comments and warnings based on current environment + * + * @param string $system_path + * @param array $opts + */ + private function _setComments($system_path, array &$opts) + { + // RecodingEngine - mark unavailable types + if ($system_path == 'RecodingEngine') { + $comment = ''; + if (!function_exists('iconv')) { + $opts['values']['iconv'] .= ' (' . __('unavailable') . ')'; + $comment = sprintf(__('"%s" requires %s extension'), 'iconv', 'iconv'); + } + if (!function_exists('recode_string')) { + $opts['values']['recode'] .= ' (' . __('unavailable') . ')'; + $comment .= ($comment ? ", " : '') . sprintf(__('"%s" requires %s extension'), + 'recode', 'recode'); + } + $opts['comment'] = $comment; + $opts['comment_warning'] = true; + } + // ZipDump, GZipDump, BZipDump - check function availability + if ($system_path == 'ZipDump' || $system_path == 'GZipDump' || $system_path == 'BZipDump') { + $comment = ''; + $funcs = array( + 'ZipDump' => array('zip_open', 'gzcompress'), + 'GZipDump' => array('gzopen', 'gzencode'), + 'BZipDump' => array('bzopen', 'bzcompress')); + if (!function_exists($funcs[$system_path][0])) { + $comment = sprintf(__('import will not work, missing function (%s)'), + $funcs[$system_path][0]); + } + if (!function_exists($funcs[$system_path][1])) { + $comment .= ($comment ? '; ' : '') . sprintf(__('export will not work, missing function (%s)'), + $funcs[$system_path][1]); + } + $opts['comment'] = $comment; + $opts['comment_warning'] = true; + } + if ($system_path == 'SQLQuery/Validate' && !$GLOBALS['cfg']['SQLValidator']['use']) { + $opts['comment'] = __('SQL Validator is disabled'); + $opts['comment_warning'] = true; + } + if ($system_path == 'SQLValidator/use') { + if (!class_exists('SOAPClient')) { + @include_once 'SOAP/Client.php'; + if (!class_exists('SOAP_Client')) { + $opts['comment'] = __('SOAP extension not found'); + $opts['comment_warning'] = true; + } + } + } + if (!defined('PMA_SETUP') || !PMA_SETUP) { + if (($system_path == 'MaxDbList' || $system_path == 'MaxTableList' + || $system_path == 'QueryHistoryMax')) { + $opts['comment'] = sprintf(__('maximum %s'), $GLOBALS['cfg'][$system_path]); + } + } + } } ?> \ No newline at end of file diff --git a/libraries/config/FormDisplay.tpl.php b/libraries/config/FormDisplay.tpl.php index e4a39d4af..f60d6244e 100644 --- a/libraries/config/FormDisplay.tpl.php +++ b/libraries/config/FormDisplay.tpl.php @@ -111,6 +111,8 @@ function display_fieldset_top($title = '', $description = '', $errors = null, $a * o values - key - value paris for