From 2595b5f390690892fd140416a2acdd54e3b52217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 24 Apr 2012 14:52:30 +0200 Subject: [PATCH 1/4] Wrap some long lines --- libraries/common.lib.php | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index cc3ea5564a..a78ae53a5f 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -3161,7 +3161,8 @@ function PMA_getTitleForTarget($target) } /** - * Formats user string, expanding @VARIABLES@, accepting strftime format string. + * Formats user string, expanding @VARIABLES@, accepting strftime format + * string. * * @param string $string Text where to do expansion. * @param function $escape Function to call for escaping variable values. @@ -3246,8 +3247,8 @@ function PMA_expandUserString($string, $escape = null, $updates = array()) * html of the message * @param bool $success success whether the ajax request * was successfull - * @param array $extra_data extra data optional - - * any other data as part of the json request + * @param array $extra_data extra data optional - any other data + * as part of the json request * * @return void */ @@ -3292,7 +3293,8 @@ function PMA_ajaxResponse($message, $success = true, $extra_data = array()) } /** - * Display the form used to browse anywhere on the local server for a file to import + * Display the form used to browse anywhere on the local server for a file to + * import * * @param string $max_upload_size maximum upload size * @@ -3316,7 +3318,8 @@ function PMA_browseUploadFile($max_upload_size) } /** - * Display the form used to select a file to import from the server upload directory + * Display the form used to select a file to import from the server upload + * directory * * @param array $import_list array of import types * @param string $uploaddir upload directory @@ -3325,7 +3328,11 @@ function PMA_browseUploadFile($max_upload_size) */ function PMA_selectUploadFile($import_list, $uploaddir) { - echo ''; + echo ''; $extensions = ''; foreach ($import_list as $key => $val) { if (! empty($extensions)) { @@ -3391,7 +3398,8 @@ function PMA_buildActionTitles() /** * This function processes the datatypes supported by the DB, as specified in * $cfg['ColumnTypes'] and either returns an array (useful for quickly checking - * if a datatype is supported) or an HTML snippet that creates a drop-down list. + * if a datatype is supported) or an HTML snippet that creates a drop-down + * list. * * @param bool $html Whether to generate an html snippet or an array * @param string $selected The value to mark as selected in HTML mode @@ -3669,7 +3677,8 @@ function PMA_getFunctionsForField($field, $insert_mode) ) { $default_function = $cfg['DefaultFunctions']['first_timestamp']; } - // For primary keys of type char(36) or varchar(36) UUID if the default function + // For primary keys of type char(36) or varchar(36) UUID if the default + // function // Only applies to insert mode, as it would silently trash data on updates. if ($insert_mode && $field['Key'] == 'PRI' @@ -3684,7 +3693,8 @@ function PMA_getFunctionsForField($field, $insert_mode) // Create the output $retval = ' ' . "\n"; - // loop on the dropdown array and print all available options for that field. + // loop on the dropdown array and print all available options for that + // field. foreach ($dropdown as $each_dropdown) { $retval .= ' '; $retval .= ''; - echo ''; + echo ''; echo '

'; } ?> From 11fbda23048d92a7d70250745e0a56b7f76fb017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 24 Apr 2012 14:54:14 +0200 Subject: [PATCH 2/4] PMA_getenv already returns empty string if not found --- libraries/common.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index a78ae53a5f..163470f520 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -3174,7 +3174,7 @@ function PMA_getTitleForTarget($target) function PMA_expandUserString($string, $escape = null, $updates = array()) { /* Content */ - $vars['http_host'] = PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : ''; + $vars['http_host'] = PMA_getenv('HTTP_HOST'); $vars['server_name'] = $GLOBALS['cfg']['Server']['host']; $vars['server_verbose'] = $GLOBALS['cfg']['Server']['verbose']; $vars['server_verbose_or_name'] = ! empty($GLOBALS['cfg']['Server']['verbose']) From e7639a9152f256bc8ed5441ec61574321309e06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 24 Apr 2012 14:54:25 +0200 Subject: [PATCH 3/4] Better coding style --- libraries/common.lib.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 163470f520..c21f7df92f 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -3177,9 +3177,11 @@ function PMA_expandUserString($string, $escape = null, $updates = array()) $vars['http_host'] = PMA_getenv('HTTP_HOST'); $vars['server_name'] = $GLOBALS['cfg']['Server']['host']; $vars['server_verbose'] = $GLOBALS['cfg']['Server']['verbose']; - $vars['server_verbose_or_name'] = ! empty($GLOBALS['cfg']['Server']['verbose']) - ? $GLOBALS['cfg']['Server']['verbose'] - : $GLOBALS['cfg']['Server']['host']; + if (empty($GLOBALS['cfg']['Server']['verbose'])) { + $vars['server_verbose_or_name'] = $GLOBALS['cfg']['Server']['verbose']; + } else { + $vars['server_verbose_or_name'] = $GLOBALS['cfg']['Server']['host']; + } $vars['database'] = $GLOBALS['db']; $vars['table'] = $GLOBALS['table']; $vars['phpmyadmin_version'] = 'phpMyAdmin ' . PMA_VERSION; From f1e2bfc103fd507a9203627079d50173400de7f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 24 Apr 2012 14:55:40 +0200 Subject: [PATCH 4/4] Wrap comments --- libraries/common.lib.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index c21f7df92f..238fb249e6 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2395,8 +2395,8 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1, This helps me a lot when navigating through giant tables. - Test case: table with 2.28 million sets, 76190 pages. Page of interest is - between 72376 and 76190. + Test case: table with 2.28 million sets, 76190 pages. Page of interest + is between 72376 and 76190. Selecting page 72376. Now, old version enumerated only +/- 10 pages around 72376 and the percentage increment produced steps of about 3000. @@ -2425,8 +2425,8 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1, } } - // Since because of ellipsing of the current page some numbers may be double, - // we unify our array: + // Since because of ellipsing of the current page some numbers may be + // double, we unify our array: sort($pages); $pages = array_unique($pages); } @@ -2671,8 +2671,9 @@ function PMA_display_html_radio($html_field_name, $choices, $checked_choice = '' * @param string $select_name name for the select element * @param array $choices choices values * @param string $active_choice the choice to select by default - * @param string $id id of the select element; can be different in case - * the dropdown is present more than once on the page + * @param string $id id of the select element; can be different in + * case the dropdown is present more than once + * on the page * * @return string * @@ -2709,11 +2710,12 @@ function PMA_generate_slider_effect($id, $message) return; } /** - * Bad hack on the next line. document.write() conflicts with jQuery, hence, - * opening the
with PHP itself instead of JavaScript. + * Bad hack on the next line. document.write() conflicts with jQuery, + * hence, opening the
with PHP itself instead of JavaScript. * - * @todo find a better solution that uses $.append(), the recommended method - * maybe by using an additional param, the id of the div to append to + * @todo find a better solution that uses $.append(), the recommended + * method maybe by using an additional param, the id of the div to + * append to */ ?>