From 7f6e422952454dbe02924ffecd20cb1d1c1ff06a Mon Sep 17 00:00:00 2001 From: "J.M" Date: Tue, 19 Jun 2012 19:17:14 +0200 Subject: [PATCH 01/21] Fix possibly undefined $return_to_sql_query in insert_edit.lib.php --- libraries/insert_edit.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index bc2dd90351..5a62f79399 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -1750,6 +1750,7 @@ function PMA_buildSqlQuery($is_insertignore, $query_fields, $value_sets) */ function PMA_executeSqlQuery($url_params, $query) { + $return_to_sql_query = ''; if (! empty($GLOBALS['sql_query'])) { $url_params['sql_query'] = $GLOBALS['sql_query']; $return_to_sql_query = $GLOBALS['sql_query']; From d578bda1009af54a8d32f11ba75f78aeddedb68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 19 Apr 2012 14:02:48 +0200 Subject: [PATCH 02/21] Clarify code for ForceSSL Conflicts: libraries/common.inc.php --- libraries/common.inc.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 82cdd22bdc..2309405d3b 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -75,7 +75,7 @@ if (version_compare(phpversion(), '5.3', 'lt')) { if (version_compare(phpversion(), '5.4', 'lt')) { /** * Avoid problems with magic_quotes_runtime - */ + */ @ini_set('magic_quotes_runtime', false); } @@ -335,11 +335,14 @@ if (isset($_COOKIE) * check HTTPS connection */ if ($GLOBALS['PMA_Config']->get('ForceSSL') - && !$GLOBALS['PMA_Config']->get('is_https')) { - PMA_sendHeaderLocation( - preg_replace('/^http/', 'https', - $GLOBALS['PMA_Config']->get('PmaAbsoluteUri')) - . PMA_generate_common_url($_GET, 'text')); + && ! $GLOBALS['PMA_Config']->get('is_https') +) { + // grab current URL + $url = $GLOBALS['PMA_Config']->get('PmaAbsoluteUri'); + // Replace http protocol + $url = preg_replace('@^http:@', 'https:', $url); + // Actually redirect + PMA_sendHeaderLocation($url . PMA_generate_common_url($_GET, 'text')); // delete the current session, otherwise we get problems (see bug #2397877) $GLOBALS['PMA_Config']->removeCookie($GLOBALS['session_name']); exit; @@ -813,7 +816,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { $GLOBALS['PMA_Config']->setCookie('pma_lang', $GLOBALS['lang']); if (isset($GLOBALS['collation_connection'])) { $GLOBALS['PMA_Config']->setCookie( - 'pma_collation_connection', + 'pma_collation_connection', $GLOBALS['collation_connection']); } From 6fe86fc54919ac756bc5f0ee1229671259e1f490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 19 Apr 2012 14:06:47 +0200 Subject: [PATCH 03/21] More clever URL rewriting with ForceSSL (bug #3510196) --- libraries/common.inc.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 2309405d3b..72368b7e5d 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -339,8 +339,20 @@ if ($GLOBALS['PMA_Config']->get('ForceSSL') ) { // grab current URL $url = $GLOBALS['PMA_Config']->get('PmaAbsoluteUri'); - // Replace http protocol - $url = preg_replace('@^http:@', 'https:', $url); + // Parse current URL + $parsed = parse_url($url); + // In case parsing has failed do stupid string replacement + if ($parsed === false) { + // Replace http protocol + $url = preg_replace('@^http:@', 'https:', $url); + } else { + if($GLOBALS['PMA_Config']->get('SSLPort')) { + $port_number = $GLOBALS['PMA_Config']->get('SSLPort'); + } else { + $port_number = 443; + } + $url = 'https://' . $parsed['host'] . ':' . $port_number . '/' . $parsed['path']; + } // Actually redirect PMA_sendHeaderLocation($url . PMA_generate_common_url($_GET, 'text')); // delete the current session, otherwise we get problems (see bug #2397877) From 2e354b7b7551ac0c310bb05666b624936e103a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 20 Jun 2012 10:29:54 +0200 Subject: [PATCH 04/21] Document backport --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 06335dc854..cc62eb36ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ phpMyAdmin - ChangeLog - bug #3531586 [unterface] Add user form prints JSON when user presses enter - bug #3534121 [config] duplicate line in config.sample.inc.php - bug #3534311 [interface] Grid editing incorrectly parses ENUM/SET values +- bug #3510196 [core] More clever URL rewriting with ForceSSL 3.5.1.0 (2012-05-03) - bug #3510784 [edit] Limit clause ignored when sort order is remembered From d80cc280879928279cb633457b5054e3b27972fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 20 Jun 2012 10:42:48 +0200 Subject: [PATCH 05/21] Forgot to correctly merge changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index c249cd17e7..256001a8cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -56,6 +56,7 @@ VerboseMultiSubmit, ReplaceHelpImg - bug #3531586 [unterface] Add user form prints JSON when user presses enter - bug #3534121 [config] duplicate line in config.sample.inc.php - bug #3534311 [interface] Grid editing incorrectly parses ENUM/SET values +- bug #3510196 [core] More clever URL rewriting with ForceSSL 3.5.1.0 (2012-05-03) - bug #3510784 [edit] Limit clause ignored when sort order is remembered From 90770909d0524763b7084e9b8db26dcd71beb957 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 20 Jun 2012 06:08:25 -0400 Subject: [PATCH 06/21] - Use strict comparison, in case the user put 0 for the ProtectBinary directive - Add a space after the ! operator --- libraries/insert_edit.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 5a62f79399..92b6b9529b 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -457,9 +457,9 @@ function PMA_getFunctionColumn($column, $is_upload, $column_name_appendix, $tabindex, $idindex, $insert_mode ) { $html_output = ''; - if (($GLOBALS['cfg']['ProtectBinary'] && $column['is_blob'] && !$is_upload) - || ($GLOBALS['cfg']['ProtectBinary'] == 'all' && $column['is_binary']) - || ($GLOBALS['cfg']['ProtectBinary'] == 'noblob' && !$column['is_blob']) + if (($GLOBALS['cfg']['ProtectBinary'] && $column['is_blob'] && ! $is_upload) + || ($GLOBALS['cfg']['ProtectBinary'] === 'all' && $column['is_binary']) + || ($GLOBALS['cfg']['ProtectBinary'] === 'noblob' && ! $column['is_blob']) ) { $html_output .= '' . __('Binary') . '' . "\n"; } elseif (strstr($column['True_Type'], 'enum') From 092b24227e1a52f776263cdcd76434d1aa492d72 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 20 Jun 2012 18:39:04 +0200 Subject: [PATCH 07/21] Translated using Weblate. --- po/fr.po | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/po/fr.po b/po/fr.po index 8ef36efb20..9da70440e3 100644 --- a/po/fr.po +++ b/po/fr.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin-docs 3.5.1-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-04 13:42+0200\n" -"PO-Revision-Date: 2012-04-03 15:36+0200\n" +"PO-Revision-Date: 2012-06-20 18:39+0200\n" "Last-Translator: Marc Delisle \n" "Language-Team: none\n" "Language: fr\n" @@ -12,7 +12,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -"X-Generator: Weblate 0.8\n" +"X-Generator: Weblate 1.0\n" #: browse_foreigners.php:35 browse_foreigners.php:53 js/messages.php:353 #: libraries/display_tbl.lib.php:359 server_privileges.php:1677 @@ -1545,10 +1545,9 @@ msgid "From general log" msgstr "Depuis le journal général" #: js/messages.php:176 -#, fuzzy #| msgid "Loading logs" msgid "Analysing logs" -msgstr "Chargement des journaux en cours" +msgstr "Analyse des journaux en cours" #: js/messages.php:177 msgid "Analysing & loading logs. This may take a while." @@ -1589,7 +1588,6 @@ msgid "Jump to Log table" msgstr "Aller à la table du journal" #: js/messages.php:184 -#, fuzzy #| msgid "No data" msgid "No data found" msgstr "Aucune donnée" @@ -1629,16 +1627,14 @@ msgid "Chart" msgstr "Tableau" #: js/messages.php:195 -#, fuzzy #| msgid "Add chart" msgid "Edit chart" -msgstr "Ajouter un graphique" +msgstr "Modifier le graphique" #: js/messages.php:196 -#, fuzzy #| msgid "Series:" msgid "Series" -msgstr "Séries : " +msgstr "Séries" #. l10n: A collection of available filters #: js/messages.php:199 @@ -1713,16 +1709,14 @@ msgid "Import" msgstr "Importer" #: js/messages.php:217 -#, fuzzy #| msgid "Could not import configuration" msgid "Import monitor configuration" -msgstr "Erreur d'importation de la configuration" +msgstr "Importer la configuration de surveillance" #: js/messages.php:218 -#, fuzzy #| msgid "Please select the primary key or a unique key" msgid "Please select the file you want to import" -msgstr "Veuillez choisir la clé primaire ou un index unique" +msgstr "Veuillez choisir le fichier à importer" #: js/messages.php:220 msgid "Analyse Query" @@ -1919,7 +1913,7 @@ msgstr "Survoler un point montrera sa description." #: js/messages.php:304 msgid "To zoom in, select a section of the plot with the mouse." -msgstr "" +msgstr "Pour zoomer, sélectionnez une section avec la souris." #: js/messages.php:306 msgid "Click reset zoom link to come back to original state." @@ -12023,10 +12017,9 @@ msgid "How to use" msgstr "Consignes d'utilisation" #: tbl_zoom_select.php:431 -#, fuzzy #| msgid "Reset" msgid "Reset zoom" -msgstr "Réinitialiser" +msgstr "Réinitialiser le zoom" #: themes.php:28 msgid "Get more themes!" From b0350245007e34fd42a6f57ba500b1e82429f836 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 20 Jun 2012 18:40:32 +0200 Subject: [PATCH 08/21] Translated using Weblate. --- po/fr.po | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/po/fr.po b/po/fr.po index e6841dda11..df8e92641a 100644 --- a/po/fr.po +++ b/po/fr.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin-docs 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-18 10:54+0200\n" -"PO-Revision-Date: 2012-05-25 18:45+0200\n" +"PO-Revision-Date: 2012-06-20 18:40+0200\n" "Last-Translator: Marc Delisle \n" "Language-Team: none\n" "Language: fr\n" @@ -1582,7 +1582,7 @@ msgstr "Tableau" #: js/messages.php:191 msgid "Edit chart" -msgstr "Éditer le graphique" +msgstr "Modifier le graphique" #: js/messages.php:192 msgid "Series" @@ -1897,10 +1897,9 @@ msgstr "Survoler un point montrera sa description." #: js/messages.php:304 msgid "To zoom in, select a section of the plot with the mouse." -msgstr "Pour faire un zoom avant, sélectionnez une section avec la souris." +msgstr "Pour zoomer, sélectionnez une section avec la souris." #: js/messages.php:306 -#, fuzzy #| msgid "Click reset zoom link to come back to original state." msgid "Click reset zoom button to come back to original state." msgstr "Cliquez le lien «Réinitialiser zoom» pour revenir à l'état original." @@ -2467,10 +2466,10 @@ msgid "vertical" msgstr "vertical" #: libraries/DisplayResults.class.php:702 -#, fuzzy, php-format +#, php-format #| msgid "Headers every" msgid "Headers every %s rows" -msgstr "En-têtes à chaque" +msgstr "En-têtes à chaque %s ligne" #: libraries/DisplayResults.class.php:1180 msgid "Sort by key" @@ -3462,7 +3461,7 @@ msgstr "Impossible d'utiliser Blowfish depuis mcrypt !" #: libraries/auth/cookie.auth.lib.php:139 msgid "Your session has expired. Please login again." -msgstr "" +msgstr "Votre session a expiré. Veuillez vous connecter à nouveau." #: libraries/auth/cookie.auth.lib.php:227 msgid "Log in" From 2f47c31a66a96532b9447810486495c9b39ec14f Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 21 Jun 2012 09:06:23 +0200 Subject: [PATCH 09/21] Translated using Weblate. --- po/fr.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/fr.po b/po/fr.po index 9da70440e3..2ab3b10b12 100644 --- a/po/fr.po +++ b/po/fr.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin-docs 3.5.1-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-06-04 13:42+0200\n" -"PO-Revision-Date: 2012-06-20 18:39+0200\n" +"PO-Revision-Date: 2012-06-20 18:40+0200\n" "Last-Translator: Marc Delisle \n" "Language-Team: none\n" "Language: fr\n" @@ -5961,7 +5961,7 @@ msgstr "vertical" #: libraries/display_tbl.lib.php:445 #, php-format msgid "Headers every %s rows" -msgstr "En-têtes à intervalle de %s lignes" +msgstr "En-têtes à chaque %s ligne" #: libraries/display_tbl.lib.php:548 msgid "Sort by key" From 7c645a10c6d08823550df66e4eb7a3ec37f00150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Jun 2012 09:48:53 +0200 Subject: [PATCH 10/21] Various fixes for docblocks --- libraries/insert_edit.lib.php | 134 ++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 56 deletions(-) diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 92b6b9529b..7d9f115e74 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -73,6 +73,9 @@ function PMA_getValuesForEditMode($where_clause, $table, $db) } /** + * Creates array of where clauses + * + * @param array $where_clause where clause * * @return whereClauseArray array of where clauses */ @@ -90,10 +93,10 @@ function PMA_getWhereClauseArray($where_clause) /** * Analysing where cluases array * - * @param array $where_clause_array array of where clauses - * @param string $table name of the table - * @param string $db name of the database - * @param boolean $found_unique_key boolean variable for unique key + * @param array $where_clause_array array of where clauses + * @param string $table name of the table + * @param string $db name of the database + * @param boolean $found_unique_key boolean variable for unique key * * @return array $where_clauses, $result, $rows */ @@ -122,12 +125,12 @@ function PMA_analyzeWhereClauses( /** * Show message for empty reult or set the unique_condition * - * @param array $rows - * @param string $key_id - * @param array $where_clause_array - * @param string $local_query - * @param array $result - * @param boolean $found_unique_key + * @param array $rows MySQL returned rows + * @param string $key_id ID in current key + * @param array $where_clause_array array of where clauses + * @param string $local_query query performed + * @param array $result MySQL result handle + * @param boolean $found_unique_key boolean variable for unique key * * @return boolean $found_unique_key */ @@ -158,8 +161,8 @@ function PMA_showEmptyResultMessageOrSetUniqueCondition($rows, $key_id, /** * No primary key given, just load first row * - * @param string $table name of the table - * @param string $db name of the database + * @param string $table name of the table + * @param string $db name of the database * * @return array containing $result and $rows arrays */ @@ -177,10 +180,9 @@ function PMA_loadFirstRowInEditMode($table, $db) /** * Add some url parameters * - * @param array $url_params containing $db and $table as url parameters + * @param array $url_params containing $db and $table as url parameters * - * @return array Add some url parameters to $url_params array - * and return it + * @return array Add some url parameters to $url_params array and return it */ function PMA_urlParamsInEditMode($url_params) { @@ -196,9 +198,10 @@ function PMA_urlParamsInEditMode($url_params) /** * Show function fields in data edit view in pma * - * @param array $url_params containing url parameters + * @param array $url_params containing url parameters + * @param boolean $showFuncFields whether to show function field * - * @return string an html snippet + * @return string an html snippet */ function PMA_showFunctionFieldsInEditMode($url_params, $showFuncFields) { @@ -228,11 +231,12 @@ function PMA_showFunctionFieldsInEditMode($url_params, $showFuncFields) /** * Show field types in data edit view in pma * - * @param array $url_params containing url parameters + * @param array $url_params containing url parameters + * @param boolean $showColumnType whether to show column type * - * @return stirng an html snippet + * @return string an html snippet */ -function PMA_showColumnTypesInDataEditView($url_params, $showColumnType ) +function PMA_showColumnTypesInDataEditView($url_params, $showColumnType) { $params = array(); if (! $showColumnType) { @@ -257,7 +261,9 @@ function PMA_showColumnTypesInDataEditView($url_params, $showColumnType ) /** * Retrieve the default for datetime data type * - * @param array $column containing column type, Default and null + * @param array $column containing column type, Default and null + * + * @return nothing */ function PMA_getDefaultForDatetime($column) { @@ -290,9 +296,9 @@ function PMA_getDefaultForDatetime($column) /** * Analyze the table column array * - * @param array $column description of column in given table - * @param array $comments_map comments for every column that has a comment - * @param integer $timestamp_seen 0 interger + * @param array $column description of column in given table + * @param array $comments_map comments for every column that has a comment + * @param integer $timestamp_seen 0 interger * * @return array description of column in given table */ @@ -317,8 +323,8 @@ function PMA_analyzeTableColumnsArray($column, $comments_map, $timestamp_seen) /** * Retrieve the column title * - * @param array $column description of column in given table - * @param array $comments_map comments for every column that has a comment + * @param array $column description of column in given table + * @param array $comments_map comments for every column that has a comment * * @return string column title */ @@ -402,7 +408,7 @@ function PMA_isColumnChar($column) * @param array $column description of column in given table * @param integer $timestamp_seen 0 interger * - * return array $column['pma_type'], $column['wrap'], $column['first_timestamp'] + * @return array $column['pma_type'], $column['wrap'], $column['first_timestamp'] */ function PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen) { @@ -574,20 +580,26 @@ function PMA_getNullifyCodeForNullColumn($column, $foreigners, $foreignData) * @param array $data description of the column field * @param array $special_chars special characters * @param array $foreignData data about the foreign keys + * @param boolean $odd_row whether row is odd * @param array $paramTableDbArray array containing $db and $table * @param array $rownumber_param &rownumber=row_id * @param array $titles An HTML IMG tag for a particular icon from * a theme, which may be an actual file or * an icon from a sprite - * @param array $text_dir + * @param array $text_dir text direction * @param string $special_chars_encoded replaced char if the string starts * with a \r\n pair (0x0d0a) add an extra \n + * @param string $vkey [multi_edit]['row_id'] + * @param boolean $is_upload is upload or not * @param integer $biggest_max_file_size 0 intger * @param string $default_char_editing default char editing mode which is stroe * in the config.inc.php script * @param array $no_support_types list of datatypes that are not (yet) * handled by PMA * @param array $gis_data_types list of GIS data types + * @param array $extracted_columnspec associative array containing type, + * spec_in_brackets and possibly + * enum_set_values (another array) * * @return string an html snippet */ @@ -683,7 +695,7 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix, * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param array $data + * @param array $data data to edit * @param array $paramTableDbArray array containing $db and $table * @param array $rownumber_param &rownumber=row_id * @param array $titles An HTML IMG tag for a particular icon from @@ -722,7 +734,7 @@ function PMA_getForeignLink($column, $backup_field, $column_name_appendix, * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param array $data + * @param array $data data to edit * @param array $foreignData data about the foreign keys * * @return string an html snippet @@ -748,13 +760,14 @@ function PMA_dispRowForeignData($backup_field, $column_name_appendix, /** * Get HTML textarea for insert form * + * @param array $column column information * @param string $backup_field hidden input field * @param string $column_name_appendix the name atttibute * @param string $unnullify_trigger validation string * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param array $text_dir + * @param array $text_dir text direction * @param array $special_chars_encoded replaced char if the string starts * with a \r\n pair (0x0d0a) add an extra \n * @@ -859,7 +872,7 @@ function PMA_getColumnEnumValues($column, $extracted_columnspec) * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param array $data + * @param array $data data to edit * @param array $column_enum_values $column['values'] * * @return string an html snippet @@ -901,7 +914,7 @@ function PMA_getDropDownDependingOnLength( * @param array $column description of column in given table * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param array $data + * @param array $data data to edit * @param array $column_enum_values $column['values'] * * @return string an html snippet @@ -938,12 +951,12 @@ function PMA_getRadioButtonDependingOnLength( /** * Get the HTML for 'set' pma type * - * @param array $column description of column in given table - * @param array $extracted_columnspec associative array containing type, spec_in_brackets + * @param array $column description of column in given table + * @param array $extracted_columnspec associative array containing type, spec_in_brackets * and possibly enum_set_values (another array) - * @param string $backup_field hidden input field - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string + * @param string $backup_field hidden input field + * @param string $column_name_appendix the name atttibute + * @param string $unnullify_trigger validation string * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index @@ -1008,7 +1021,7 @@ function PMA_getColumnSetValueAndSelectSize($column, $extracted_columnspec) * Get HTML for binary and blob column * * @param array $column description of column in given table - * @param array $data + * @param array $data data to edit * @param array $special_chars special characters * @param integer $biggest_max_file_size biggest max file size for uploading * @param string $backup_field hidden input field @@ -1017,11 +1030,11 @@ function PMA_getColumnSetValueAndSelectSize($column, $extracted_columnspec) * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param string $text_dir + * @param string $text_dir text direction * @param string $special_chars_encoded replaced char if the string starts * with a \r\n pair (0x0d0a) add an extra \n - * @param string $vkey [multi_edit]['row_id'] - * @param boolean $is_upload is upload or not + * @param string $vkey [multi_edit]['row_id'] + * @param boolean $is_upload is upload or not * * @return string an html snippet */ @@ -1136,8 +1149,8 @@ function PMA_getSelectOptionForUpload($vkey, $column) /** * Retrieve the maximum upload file size * - * @param array $column description of column in given table - * @param integer $biggest_max_file_size biggest max file size for uploading + * @param array $column description of column in given table + * @param integer $biggest_max_file_size biggest max file size for uploading * * @return array an html snippet and $biggest_max_file_size */ @@ -1181,9 +1194,13 @@ function PMA_getMaxUploadSize($column, $biggest_max_file_size) * @param array $special_chars apecial characters * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index - * @param string $text_dir + * @param string $text_dir text direction * @param array $special_chars_encoded replaced char if the string starts * with a \r\n pair (0x0d0a) add an extra \n + * @param strign $data data to edit + * @param array $extracted_columnspec associative array containing type, + * spec_in_brackets and possibly + * enum_set_values (another array) * * @return string an html snippet */ @@ -1241,7 +1258,9 @@ function PMA_getNoSupportTypes($column, $default_char_editing, $backup_field, /** * Get the field size * - * @param array $column description of column in given table + * @param array $column description of column in given table + * @param array $extracted_columnspec associative array containing type, spec_in_brackets + * and possibly enum_set_values (another array) * * @return integer field size */ @@ -1270,8 +1289,8 @@ function PMA_getColumnSize($column, $extracted_columnspec) /** * Get HTML for gis data types * - * @param string $current_row row description - * @param array $column description of column in given table + * @param string $current_row row description + * @param array $column description of column in given table * * @return string an html snippet */ @@ -1335,6 +1354,8 @@ function PMA_getContinueInsertionForm($table, $db, $where_clause_array, $err_url /** * Get action panel * + * @param array $where_clause where clause + * @param string $after_insert insert mode, e.g. new_insert, same_insert * @param integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param boolean $found_unique_key boolean variable for unique key @@ -1394,7 +1415,6 @@ function PMA_getSubmitTypeDropDown($where_clause, $tabindex, $tabindex_for_value * * @param array $where_clause where clause * @param string $after_insert insert mode, e.g. new_insert, same_insert - * @param string $after_insert a request parameter it can be 'edit_text', 'back' * @param boolean $found_unique_key boolean variable for unique key * * @return string an html snippet @@ -1436,10 +1456,10 @@ function PMA_getAfterInsertDropDown($where_clause, $after_insert, $found_unique_ /** * get Submit button and Reset button for action panel * - * @param integer $tabindex tab index - * @param integer $tabindex_for_value offset for the values tabindex + * @param integer $tabindex tab index + * @param integer $tabindex_for_value offset for the values tabindex * - * @return string an html snippet + * @return string an html snippet */ function PMA_getSumbitAndResetButtonForActionsPanel($tabindex, $tabindex_for_value) { @@ -1497,6 +1517,8 @@ function PMA_getHeadAndFootOfInsertRowTable($url_params) * @param array $extracted_columnspec associative array containing type, spec_in_brackets * and possibly enum_set_values (another array) * @param boolean $real_null_value whether column value null or not null + * @param array $gis_data_types list of GIS data types + * @param string $column_name_appendix string to append to column name in input * * @return array $real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded */ @@ -1720,11 +1742,11 @@ function PMA_getErrorUrl($url_params) /** * Builds the sql query * - * @param boolean $is_insertignore $_REQUEST['submit_type'] == 'insertignore' - * @param array $query_fields column names array - * @param array $value_sets array of query values + * @param boolean $is_insertignore $_REQUEST['submit_type'] == 'insertignore' + * @param array $query_fields column names array + * @param array $value_sets array of query values * - * @return string a query + * @return string a query */ function PMA_buildSqlQuery($is_insertignore, $query_fields, $value_sets) { From aa3a1bbb0d0715f3349e71768b0644e0c52a8aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Jun 2012 10:00:52 +0200 Subject: [PATCH 11/21] Various spacing and indentation improvements --- libraries/insert_edit.lib.php | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 7d9f115e74..9d66f80945 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -314,8 +314,8 @@ function PMA_analyzeTableColumnsArray($column, $comments_map, $timestamp_seen) $column['is_binary'] = PMA_isColumnBinary($column); $column['is_blob'] = PMA_isColumnBlob($column); $column['is_char'] = PMA_isColumnChar($column); - list($column['pma_type'], $column['wrap'], $column['first_timestamp']) = - PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen); + list($column['pma_type'], $column['wrap'], $column['first_timestamp']) + = PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen); return $column; } @@ -617,7 +617,7 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix, $column, $backup_field, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, $paramTableDbArray, $rownumber_param, $titles - ); + ); } elseif (is_array($foreignData['disp_row'])) { $html_output .= PMA_dispRowForeignData( @@ -632,7 +632,7 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix, $html_output .= '' . ''; $html_output .= PMA_getTextarea( - $column,$backup_field, $column_name_appendix, $unnullify_trigger, + $column, $backup_field, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded ); @@ -651,28 +651,28 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix, } elseif ($column['pma_type'] == 'enum') { $html_output .= PMA_getPmaTypeEnum( - $paramsArrayForColumns, $column,$extracted_columnspec + $paramsArrayForColumns, $column, $extracted_columnspec ); } elseif ($column['pma_type'] == 'set') { $html_output .= PMA_getPmaTypeSet( - $column,$extracted_columnspec, $backup_field, + $column, $extracted_columnspec, $backup_field, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex ); } elseif ($column['is_binary'] || $column['is_blob']) { $html_output .= PMA_getBinaryAndBlobColumn( - $column, $data, $special_chars,$biggest_max_file_size, - $backup_field,$column_name_appendix, $unnullify_trigger, $tabindex, + $column, $data, $special_chars, $biggest_max_file_size, + $backup_field, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, $vkey, $is_upload ); } elseif (! in_array($column['pma_type'], $no_support_types)) { $html_output .= PMA_getNoSupportTypes( - $column, $default_char_editing,$backup_field, - $column_name_appendix, $unnullify_trigger,$tabindex,$special_chars, + $column, $default_char_editing, $backup_field, + $column_name_appendix, $unnullify_trigger, $tabindex, $special_chars, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, $data, $extracted_columnspec ); @@ -750,8 +750,10 @@ function PMA_dispRowForeignData($backup_field, $column_name_appendix, . $unnullify_trigger . 'class="textfield"' . ($tabindex + $tabindex_for_value). '"' . 'id="field_' . $idindex . '_3"' - . PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], - $foreignData['foreign_display'], $data, $GLOBALS['cfg']['ForeignKeyMaxLimit']) + . PMA_foreignDropdown( + $foreignData['disp_row'], $foreignData['foreign_field'], + $foreignData['foreign_display'], $data, $GLOBALS['cfg']['ForeignKeyMaxLimit'] + ) . ''; return $html_output; @@ -828,11 +830,13 @@ function PMA_getPmaTypeEnum( $html_output .= ''; $html_output .= "\n" . ' ' . $backup_field . "\n"; if (strlen($column['Type']) > 20) { - $html_output .= PMA_getDropDownDependingOnLength($column, $column_name_appendix, $unnullify_trigger, + $html_output .= PMA_getDropDownDependingOnLength( + $column, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data, $column_enum_values ); } else { - $html_output .= PMA_getRadioButtonDependingOnLength($column_name_appendix, $unnullify_trigger, + $html_output .= PMA_getRadioButtonDependingOnLength( + $column_name_appendix, $unnullify_trigger, $tabindex, $column, $tabindex_for_value, $idindex, $data, $column_enum_values ); } @@ -1039,7 +1043,7 @@ function PMA_getColumnSetValueAndSelectSize($column, $extracted_columnspec) * @return string an html snippet */ function PMA_getBinaryAndBlobColumn( - $column, $data, $special_chars,$biggest_max_file_size, + $column, $data, $special_chars, $biggest_max_file_size, $backup_field, $column_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, $vkey, $is_upload From 50c01dbd19d6dc784faec8d9b3fe254a81d46661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Jun 2012 10:07:57 +0200 Subject: [PATCH 12/21] Wrap some long lines --- libraries/insert_edit.lib.php | 161 ++++++++++++++++++++++------------ 1 file changed, 106 insertions(+), 55 deletions(-) diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 9d66f80945..2c24fdef7c 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -169,7 +169,8 @@ function PMA_showEmptyResultMessageOrSetUniqueCondition($rows, $key_id, function PMA_loadFirstRowInEditMode($table, $db) { $result = PMA_DBI_query( - 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT 1;', + 'SELECT * FROM ' + . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE ); @@ -509,21 +510,25 @@ function PMA_getNullColumn($column, $column_name_appendix, $real_null_value, } $html_output = ''; $html_output .= '' . "\n"; - $html_output .= ''; // nullify_code is needed by the js nullify() function - $nullify_code = PMA_getNullifyCodeForNullColumn($column, $foreigners, $foreignData); + $nullify_code = PMA_getNullifyCodeForNullColumn( + $column, $foreigners, $foreignData + ); // to be able to generate calls to nullify() in jQuery $html_output .= ''; @@ -745,14 +750,16 @@ function PMA_dispRowForeignData($backup_field, $column_name_appendix, ) { $html_output = ''; $html_output .= $backup_field . "\n"; - $html_output .= '' + $html_output .= '' . ''; - $html_output .= ''; + $html_output .= ''; + $html_output .= ''; $html_output .= "\n" . ' ' . $backup_field . "\n"; if (strlen($column['Type']) > 20) { $html_output .= PMA_getDropDownDependingOnLength( @@ -837,7 +848,8 @@ function PMA_getPmaTypeEnum( } else { $html_output .= PMA_getRadioButtonDependingOnLength( $column_name_appendix, $unnullify_trigger, - $tabindex, $column, $tabindex_for_value, $idindex, $data, $column_enum_values + $tabindex, $column, $tabindex_for_value, + $idindex, $data, $column_enum_values ); } return $html_output; @@ -956,8 +968,9 @@ function PMA_getRadioButtonDependingOnLength( * Get the HTML for 'set' pma type * * @param array $column description of column in given table - * @param array $extracted_columnspec associative array containing type, spec_in_brackets - * and possibly enum_set_values (another array) + * @param array $extracted_columnspec associative array containing type, + * spec_in_brackets and possibly + * enum_set_values (another array) * @param string $backup_field hidden input field * @param string $column_name_appendix the name atttibute * @param string $unnullify_trigger validation string @@ -977,7 +990,8 @@ function PMA_getPmaTypeSet( ); $vset = array_flip(explode(',', $data)); $html_output = $backup_field . "\n"; - $html_output .= ''; + $html_output .= ''; $html_output .= ''; + $html_output .= '' + . ''; } elseif ($column['is_blob']) { $html_output .= "\n" . PMA_getTextarea( $column, $backup_field, $column_name_appendix, $unnullify_trigger, @@ -1079,8 +1095,10 @@ function PMA_getBinaryAndBlobColumn( if ($is_upload && $column['is_blob']) { $html_output .= '
' - . ' '; + . ' '; list($html_out, $biggest_max_file_size) = PMA_getMaxUploadSize( $column, $biggest_max_file_size ); @@ -1138,15 +1156,17 @@ function PMA_getSelectOptionForUpload($vkey, $column) { $files = PMA_getFileSelectOptions(PMA_userDir($GLOBALS['cfg']['UploadDir'])); if ($files === false) { - return ' ' . __('Error') . '
' . "\n" - . ' ' . __('The directory you set for upload work cannot be reached') . "\n"; + return '' . __('Error') . '
' . "\n" + . __('The directory you set for upload work cannot be reached') . "\n"; } elseif (!empty($files)) { return "
\n" - . ' ' . __('Or') . '' . ' ' . __('web server upload directory') . ':
' . "\n" - . ' ' . "\n" + . '' . "\n" . $files - . ' ' . "\n"; + . '' . "\n"; } } @@ -1223,7 +1243,8 @@ function PMA_getNoSupportTypes($column, $default_char_editing, $backup_field, $GLOBALS['cfg']['CharEditing'] = $default_char_editing; $html_output .= PMA_getTextarea( $column, $backup_field, $column_name_appendix, $unnullify_trigger, - $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded + $tabindex, $tabindex_for_value, $idindex, $text_dir, + $special_chars_encoded ); } else { $html_output .= PMA_getHTMLinput( @@ -1232,20 +1253,20 @@ function PMA_getNoSupportTypes($column, $default_char_editing, $backup_field, ); if ($column['Extra'] == 'auto_increment') { - $html_output .= ''; - + $html_output .= ''; } if (substr($column['pma_type'], 0, 9) == 'timestamp') { - $html_output .= ''; - + $html_output .= ''; } if (substr($column['pma_type'], 0, 8) == 'datetime') { - $html_output .= ''; - + $html_output .= ''; } if ($column['True_Type'] == 'bit') { - $html_output .= ''; - + $html_output .= ''; } if ($column['pma_type'] == 'date' || $column['pma_type'] == 'datetime' @@ -1263,8 +1284,9 @@ function PMA_getNoSupportTypes($column, $default_char_editing, $backup_field, * Get the field size * * @param array $column description of column in given table - * @param array $extracted_columnspec associative array containing type, spec_in_brackets - * and possibly enum_set_values (another array) + * @param array $extracted_columnspec associative array containing type, + * spec_in_brackets and possibly enum_set_values + * (another array) * * @return integer field size */ @@ -1287,7 +1309,10 @@ function PMA_getColumnSize($column, $extracted_columnspec) */ $fieldsize = $column['len']; } - return min(max($fieldsize, $GLOBALS['cfg']['MinSizeForInputField']), $GLOBALS['cfg']['MaxSizeForInputField']); + return min( + max($fieldsize, $GLOBALS['cfg']['MinSizeForInputField']), + $GLOBALS['cfg']['MaxSizeForInputField'] + ); } /** @@ -1300,13 +1325,15 @@ function PMA_getColumnSize($column, $extracted_columnspec) */ function PMA_getHTMLforGisDataTypes($current_row, $column) { - $data_val = isset($current_row[$column['Field']]) ? $current_row[$column['Field']] : ''; + $data_val = isset($current_row[$column['Field']]) + ? $current_row[$column['Field']] : ''; $_url_params = array( 'field' => $column['Field_title'], 'value' => $data_val, ); if ($column['pma_type'] != 'geometry') { - $_url_params = $_url_params + array('gis_data[gis_type]' => strtoupper($column['pma_type'])); + $_url_params = $_url_params + + array('gis_data[gis_type]' => strtoupper($column['pma_type'])); } $edit_str = PMA_getIcon('b_edit.png', __('Edit/Insert')); return '' @@ -1334,7 +1361,9 @@ function PMA_getContinueInsertionForm($table, $db, $where_clause_array, $err_url if (isset($_REQUEST['where_clause'])) { foreach ($where_clause_array as $key_id => $where_clause) { - $html_output .= ''. "\n"; + $html_output .= ''. "\n"; } } $tmp = ''; return $html_output; } @@ -1441,7 +1479,10 @@ function PMA_getAfterInsertDropDown($where_clause, $after_insert, $found_unique_ // in 2.9.0, we are looking for `table_name`.`field_name` = numeric_value $is_numeric = false; for ($i = 0; $i < count($where_clause); $i++) { - $is_numeric = preg_match('@^[\s]*`[^`]*`[\.]`[^`]*` = [0-9]+@', $where_clause[$i]); + $is_numeric = preg_match( + '@^[\s]*`[^`]*`[\.]`[^`]*` = [0-9]+@', + $where_clause[$i] + ); if ($is_numeric == true) { break; } @@ -1518,15 +1559,18 @@ function PMA_getHeadAndFootOfInsertRowTable($url_params) * * @param array $current_row a row of the table * @param array $column description of column in given table - * @param array $extracted_columnspec associative array containing type, spec_in_brackets - * and possibly enum_set_values (another array) + * @param array $extracted_columnspec associative array containing type, + * spec_in_brackets and possibly + * enum_set_values (another array) * @param boolean $real_null_value whether column value null or not null * @param array $gis_data_types list of GIS data types * @param string $column_name_appendix string to append to column name in input * - * @return array $real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded + * @return array $real_null_value, $data, $special_chars, $backup_field, + * $special_chars_encoded */ -function PMA_getSpecialCharsAndBackupFieldForExistingRow($current_row, $column, $extracted_columnspec, +function PMA_getSpecialCharsAndBackupFieldForExistingRow( + $current_row, $column, $extracted_columnspec, $real_null_value, $gis_data_types, $column_name_appendix ) { $special_chars_encoded = ''; @@ -1588,8 +1632,9 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow($current_row, $column, * * @return array $real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded */ -function PMA_getSpecialCharsAndBackupFieldForInsertingMode($column, $real_null_value) -{ +function PMA_getSpecialCharsAndBackupFieldForInsertingMode( + $column, $real_null_value +) { if (! isset($column['Default'])) { $column['Default'] = ''; $real_null_value = true; @@ -1613,7 +1658,10 @@ function PMA_getSpecialCharsAndBackupFieldForInsertingMode($column, $real_null_v ) { $column['display_binary_as_hex'] = true; } - return array($real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded); + return array( + $real_null_value, $data, $special_chars, + $backup_field, $special_chars_encoded + ); } /** @@ -1645,7 +1693,8 @@ function PMA_getParamsForUpdateOrInsert() } /** - * check wether insert row mode and if so include tbl_changen script and set global variables. + * Check wether insert row mode and if so include tbl_changen script and set + * global variables. * * @return void */ @@ -1674,7 +1723,8 @@ function PMA_isInsertRow() */ function PMA_setSessionForEditNext($one_where_clause) { - $local_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($GLOBALS['table']) + $local_query = 'SELECT * FROM ' + . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($GLOBALS['table']) . ' WHERE ' . str_replace('` =', '` >', $one_where_clause) . ' LIMIT 1;'; $res = PMA_DBI_query($local_query); @@ -1695,7 +1745,8 @@ function PMA_setSessionForEditNext($one_where_clause) * if $GLOBALS['goto'] empty, if $goto_include previously not defined * and new_insert, same_insert, same_insert * - * @param string $goto_include store some script for include, otherwise it is boolean false + * @param string $goto_include store some script for include, otherwise it is + * boolean false * * @return string $goto_include */ From 1924460dbab726c31420675774ba6bd330ac3337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Jun 2012 10:43:24 +0200 Subject: [PATCH 13/21] Some minor coding style fixes --- pmd_general.php | 102 +++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 53 deletions(-) diff --git a/pmd_general.php b/pmd_general.php index 8f2c48d0dc..04b44771e9 100644 --- a/pmd_general.php +++ b/pmd_general.php @@ -262,9 +262,9 @@ if (! isset($tab_pos[$t_n]) || ! empty($tab_pos[$t_n]["V"])) { ?> '; + echo ''; }?> @@ -272,8 +272,8 @@ echo 'onmouseout="Table_onover(\''.htmlspecialchars($t_n_url).'\',1,1)">'; > - '; $display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]); for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++) { ?> @@ -311,56 +311,52 @@ for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++ id="">
- * - - + * + + .png" alt="*" /> + .png" alt="*" /> - \n\n"; + if (isset($_REQUEST['query'])) { + //$temp = $GLOBALS['PMD_OUT']["OWNER"][$i].'.'.$GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]; + echo ''; + echo ' '; + } + echo "\n"; } - echo htmlspecialchars( - $tab_column[$t_n]["COLUMN_NAME"][$j] . " : " . $tab_column[$t_n]["TYPE"][$j], - ENT_QUOTES - ); - ?> -
- - '; - echo ' '; - } - ?> - - - - - \n\n"; } ?> From cad77715a487cc88a77caf43d83f97fc098775cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Jun 2012 10:54:11 +0200 Subject: [PATCH 14/21] Indenation fix --- pmd_general.php | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/pmd_general.php b/pmd_general.php index 04b44771e9..d620da82ec 100644 --- a/pmd_general.php +++ b/pmd_general.php @@ -228,23 +228,24 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { '; - echo ''; -}?> + if (isset($_REQUEST['query'])) { + echo ''; + echo ''; + } + ?> '; -}?> + if (isset($_REQUEST['query'])) { + echo ''; + } + ?> '; -$display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]); -for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++) { + if (isset($tab_pos[$t_n]) && empty($tab_pos[$t_n]["V"])) { + echo 'style="display: none;"'; + } + echo '>'; + $display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]); + for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++) { ?> Date: Thu, 21 Jun 2012 11:29:50 +0200 Subject: [PATCH 15/21] Fix docblocks --- libraries/rte/rte_routines.lib.php | 58 +++++++++++++++++------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index c5654635d6..b5f5c2d4b4 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -11,6 +11,8 @@ if (! defined('PHPMYADMIN')) { /** * Sets required globals + * + * @return nothing */ function PMA_RTN_setGlobals() { @@ -30,6 +32,8 @@ function PMA_RTN_setGlobals() /** * Main function for the routines functionality + * + * @return nothing */ function PMA_RTN_main() { @@ -78,7 +82,7 @@ function PMA_RTN_main() * as returned by PMA_RTN_parseAllParameters() and returns an array containing * the information about this parameter. * - * @param string $value A string containing one parameter of a routine + * @param string $value A string containing one parameter of a routine * * @return array Parsed information about the input parameter */ @@ -137,8 +141,8 @@ function PMA_RTN_parseOneParameter($value) * SHOW CREATE [PROCEDURE | FUNCTION] query and extracts * information about the routine's parameters. * - * @param array $parsed_query Parsed query, returned by by PMA_SQP_parse() - * @param string $routine_type Routine type: 'PROCEDURE' or 'FUNCTION' + * @param array $parsed_query Parsed query, returned by by PMA_SQP_parse() + * @param string $routine_type Routine type: 'PROCEDURE' or 'FUNCTION' * * @return array Information about the parameteres of a routine. */ @@ -203,7 +207,7 @@ function PMA_RTN_parseAllParameters($parsed_query, $routine_type) * SHOW CREATE [PROCEDURE | FUNCTION] query and extracts * information about the routine's definer. * - * @param array $parsed_query Parsed query, returned by PMA_SQP_parse() + * @param array $parsed_query Parsed query, returned by PMA_SQP_parse() * * @return string The definer of a routine. */ @@ -227,6 +231,8 @@ function PMA_RTN_parseRoutineDefiner($parsed_query) /** * Handles editor requests for adding or editing an item + * + * @return Does not return */ function PMA_RTN_handleEditor() { @@ -505,10 +511,10 @@ function PMA_RTN_getDataFromRequest() * This function will generate the values that are required to complete * the "Edit routine" form given the name of a routine. * - * @param string $name The name of the routine. - * @param string $type Type of routine (ROUTINE|PROCEDURE) - * @param bool $all Whether to return all data or just - * the info about parameters. + * @param string $name The name of the routine. + * @param string $type Type of routine (ROUTINE|PROCEDURE) + * @param bool $all Whether to return all data or just + * the info about parameters. * * @return array Data necessary to create the routine editor. */ @@ -627,13 +633,13 @@ function PMA_RTN_getDataFromName($name, $type, $all = true) /** * Creates one row for the parameter table used in the routine editor. * - * @param array $routine Data for the routine returned by - * PMA_RTN_getDataFromRequest() or - * PMA_RTN_getDataFromName() - * @param mixed $index Either a numeric index of the row being processed - * or NULL to create a template row for AJAX request - * @param string $class Class used to hide the direction column, if the - * row is for a stored function. + * @param array $routine Data for the routine returned by + * PMA_RTN_getDataFromRequest() or + * PMA_RTN_getDataFromName() + * @param mixed $index Either a numeric index of the row being processed + * or NULL to create a template row for AJAX request + * @param string $class Class used to hide the direction column, if the + * row is for a stored function. * * @return string HTML code of one row of parameter table for the editor. */ @@ -732,14 +738,14 @@ function PMA_RTN_getParameterRow($routine = array(), $index = null, $class = '') /** * Displays a form used to add/edit a routine * - * @param string $mode If the editor will be used edit a routine - * or add a new one: 'edit' or 'add'. - * @param string $operation If the editor was previously invoked with - * JS turned off, this will hold the name of - * the current operation - * @param array $routine Data for the routine returned by - * PMA_RTN_getDataFromRequest() or - * PMA_RTN_getDataFromName() + * @param string $mode If the editor will be used edit a routine + * or add a new one: 'edit' or 'add'. + * @param string $operation If the editor was previously invoked with + * JS turned off, this will hold the name of + * the current operation + * @param array $routine Data for the routine returned by + * PMA_RTN_getDataFromRequest() or + * PMA_RTN_getDataFromName() * * @return string HTML code for the editor. */ @@ -1133,6 +1139,8 @@ function PMA_RTN_getQueryFromRequest() /** * Handles requests for executing a routine + * + * @return Does not return */ function PMA_RTN_handleExecute() { @@ -1344,8 +1352,8 @@ function PMA_RTN_handleExecute() /** * Creates the HTML code that shows the routine execution dialog. * - * @param array $routine Data for the routine returned by - * PMA_RTN_getDataFromName() + * @param array $routine Data for the routine returned by + * PMA_RTN_getDataFromName() * * @return string HTML code for the routine execution dialog. */ From 9102d0f1c1b2cad9cf198b7fa22b29f536205ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Jun 2012 11:34:11 +0200 Subject: [PATCH 16/21] Wrap some long lines --- libraries/rte/rte_routines.lib.php | 80 ++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index b5f5c2d4b4..e66ed304ca 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -115,17 +115,27 @@ function PMA_RTN_parseOneParameter($value) || $parsed_param[$i]['type'] == 'alpha_functionName') && $depth == 0 // "CHAR" seems to be mistaken for a function by the parser ) { $retval[2] = strtoupper($parsed_param[$i]['data']); - } else if ($parsed_param[$i]['type'] == 'punct_bracket_open_round' && $depth == 0) { + } else if ($parsed_param[$i]['type'] == 'punct_bracket_open_round' + && $depth == 0 + ) { $depth = 1; - } else if ($parsed_param[$i]['type'] == 'punct_bracket_close_round' && $depth == 1) { + } else if ($parsed_param[$i]['type'] == 'punct_bracket_close_round' + && $depth == 1 + ) { $depth = 0; } else if ($depth == 1) { $param_length .= $parsed_param[$i]['data']; - } else if ($parsed_param[$i]['type'] == 'alpha_reservedWord' && strtoupper($parsed_param[$i]['data']) == 'CHARSET' && $depth == 0) { - if ($parsed_param[$i+1]['type'] == 'alpha_charset' || $parsed_param[$i+1]['type'] == 'alpha_identifier') { + } else if ($parsed_param[$i]['type'] == 'alpha_reservedWord' + && strtoupper($parsed_param[$i]['data']) == 'CHARSET' && $depth == 0 + ) { + if ($parsed_param[$i+1]['type'] == 'alpha_charset' + || $parsed_param[$i+1]['type'] == 'alpha_identifier' + ) { $param_opts[] = strtolower($parsed_param[$i+1]['data']); } - } else if ($parsed_param[$i]['type'] == 'alpha_columnAttrib' && $depth == 0) { + } else if ($parsed_param[$i]['type'] == 'alpha_columnAttrib' + && $depth == 0 + ) { $param_opts[] = strtoupper($parsed_param[$i]['data']); } } @@ -157,14 +167,20 @@ function PMA_RTN_parseAllParameters($parsed_query, $routine_type) $fetching = false; $depth = 0; for ($i=0; $i<$parsed_query['len']; $i++) { - if ($parsed_query[$i]['type'] == 'alpha_reservedWord' && $parsed_query[$i]['data'] == $routine_type) { + if ($parsed_query[$i]['type'] == 'alpha_reservedWord' + && $parsed_query[$i]['data'] == $routine_type + ) { $fetching = true; - } else if ($fetching == true && $parsed_query[$i]['type'] == 'punct_bracket_open_round') { + } else if ($fetching == true + && $parsed_query[$i]['type'] == 'punct_bracket_open_round' + ) { $depth++; if ($depth > 1) { $buffer .= $parsed_query[$i]['data'] . ' '; } - } else if ($fetching == true && $parsed_query[$i]['type'] == 'punct_bracket_close_round') { + } else if ($fetching == true + && $parsed_query[$i]['type'] == 'punct_bracket_close_round' + ) { $depth--; if ($depth > 0) { $buffer .= $parsed_query[$i]['data'] . ' '; @@ -216,11 +232,18 @@ function PMA_RTN_parseRoutineDefiner($parsed_query) $retval = ''; $fetching = false; for ($i=0; $i<$parsed_query['len']; $i++) { - if ($parsed_query[$i]['type'] == 'alpha_reservedWord' && $parsed_query[$i]['data'] == 'DEFINER') { + if ($parsed_query[$i]['type'] == 'alpha_reservedWord' + && $parsed_query[$i]['data'] == 'DEFINER' + ) { $fetching = true; - } else if ($fetching == true && ($parsed_query[$i]['type'] != 'quote_backtick' && substr($parsed_query[$i]['type'], 0, 5) != 'punct')) { + } else if ($fetching == true + && $parsed_query[$i]['type'] != 'quote_backtick' + && substr($parsed_query[$i]['type'], 0, 5) != 'punct' + ) { break; - } else if ($fetching == true && $parsed_query[$i]['type'] == 'quote_backtick') { + } else if ($fetching == true + && $parsed_query[$i]['type'] == 'quote_backtick' + ) { $retval .= PMA_unQuote($parsed_query[$i]['data']); } else if ($fetching == true && $parsed_query[$i]['type'] == 'punct_user') { $retval .= $parsed_query[$i]['data']; @@ -286,10 +309,15 @@ function PMA_RTN_handleEditor() // 'Add a new routine' mode $result = PMA_DBI_try_query($routine_query); if (! $result) { - $errors[] = sprintf(__('The following query has failed: "%s"'), $routine_query) . '

' - . __('MySQL said: ') . PMA_DBI_getError(null); + $errors[] = sprintf( + __('The following query has failed: "%s"'), + $routine_query + ) . '

' + . __('MySQL said: ') . PMA_DBI_getError(null); } else { - $message = PMA_Message::success(__('Routine %1$s has been created.')); + $message = PMA_Message::success( + __('Routine %1$s has been created.') + ); $message->addParam(PMA_backquote($_REQUEST['item_name'])); $sql_query = $routine_query; } @@ -297,7 +325,9 @@ function PMA_RTN_handleEditor() } if (count($errors)) { - $message = PMA_Message::error(__('One or more errors have occured while processing your request:')); + $message = PMA_Message::error( + __('One or more errors have occured while processing your request:') + ); $message->addString('
    '); foreach ($errors as $string) { $message->addString('
  • ' . $string . '
  • '); @@ -583,7 +613,9 @@ function PMA_RTN_getDataFromName($name, $type, $all = true) && strtoupper($parsed_query[$i]['data']) == 'RETURNS' ) { $fetching = true; - } else if ($fetching == true && $parsed_query[$i]['type'] == 'alpha_reservedWord') { + } else if ($fetching == true + && $parsed_query[$i]['type'] == 'alpha_reservedWord' + ) { // We will not be looking for options such as UNSIGNED // or ZEROFILL because there is no way that a numeric // field's DTD_IDENTIFIER can be longer than 64 @@ -610,8 +642,8 @@ function PMA_RTN_getDataFromName($name, $type, $all = true) $retval['item_returnopts_num'] = $returnparam[4]; $retval['item_returnopts_text'] = $returnparam[4]; } - $retval['item_definer'] = PMA_RTN_parseRoutineDefiner($parsed_query); - $retval['item_definition'] = $routine['ROUTINE_DEFINITION']; + $retval['item_definer'] = PMA_RTN_parseRoutineDefiner($parsed_query); + $retval['item_definition'] = $routine['ROUTINE_DEFINITION']; $retval['item_isdeterministic'] = ''; if ($routine['IS_DETERMINISTIC'] == 'YES') { $retval['item_isdeterministic'] = " checked='checked'"; @@ -785,7 +817,9 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine) $routine['item_type'] = 'PROCEDURE'; $routine['item_type_toggle'] = 'FUNCTION'; } - } else if ($operation == 'add' || ($routine['item_num_params'] == 0 && $mode == 'add' && ! $errors)) { + } else if ($operation == 'add' + || ($routine['item_num_params'] == 0 && $mode == 'add' && ! $errors) + ) { $routine['item_param_dir'][] = ''; $routine['item_param_name'][] = ''; $routine['item_param_type'][] = ''; @@ -995,7 +1029,8 @@ function PMA_RTN_getQueryFromRequest() { global $_REQUEST, $errors, $param_sqldataaccess, $param_directions; - $_REQUEST['item_type'] = isset($_REQUEST['item_type']) ? $_REQUEST['item_type'] : ''; + $_REQUEST['item_type'] = isset($_REQUEST['item_type']) + ? $_REQUEST['item_type'] : ''; $query = 'CREATE '; if (! empty($_REQUEST['item_definer'])) { @@ -1012,7 +1047,10 @@ function PMA_RTN_getQueryFromRequest() ) { $query .= $_REQUEST['item_type'] . ' '; } else { - $errors[] = sprintf(__('Invalid routine type: "%s"'), htmlspecialchars($_REQUEST['item_type'])); + $errors[] = sprintf( + __('Invalid routine type: "%s"'), + htmlspecialchars($_REQUEST['item_type']) + ); } if (! empty($_REQUEST['item_name'])) { $query .= PMA_backquote($_REQUEST['item_name']); From ba0a51e9f92dbb414c542b8a016b642120273c9f Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 21 Jun 2012 06:17:22 -0400 Subject: [PATCH 17/21] This should be a boolean param --- libraries/insert_edit.lib.php | 8 ++++---- tbl_change.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 2c24fdef7c..8dbdfada69 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -299,7 +299,7 @@ function PMA_getDefaultForDatetime($column) * * @param array $column description of column in given table * @param array $comments_map comments for every column that has a comment - * @param integer $timestamp_seen 0 interger + * @param boolean $timestamp_seen whether a timestamp has been seen * * @return array description of column in given table */ @@ -407,7 +407,7 @@ function PMA_isColumnChar($column) * Retieve set, enum, timestamp table columns * * @param array $column description of column in given table - * @param integer $timestamp_seen 0 interger + * @param boolean $timestamp_seen whether a timestamp has been seen * * @return array $column['pma_type'], $column['wrap'], $column['first_timestamp'] */ @@ -424,8 +424,8 @@ function PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen) $column['wrap'] = ''; break; case 'timestamp': - if (!$timestamp_seen) { // can only occur once per table - $timestamp_seen = 1; + if (! $timestamp_seen) { // can only occur once per table + $timestamp_seen = true; $column['first_timestamp'] = true; } $column['pma_type'] = $column['Type']; diff --git a/tbl_change.php b/tbl_change.php index 8613410c4f..b847330cb4 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -186,7 +186,7 @@ $html_output .= ' . 'document.onkeydown = onKeyDownArrowsHandler;' . ''; // Set if we passed the first timestamp field -$timestamp_seen = 0; +$timestamp_seen = false; $columns_cnt = count($table_fields); $tabindex = 0; From 747d49f2bee1ef67607b539fe0ba03c0fcf557bf Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 21 Jun 2012 06:18:01 -0400 Subject: [PATCH 18/21] Typo --- libraries/insert_edit.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 8dbdfada69..25531f825c 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -404,7 +404,7 @@ function PMA_isColumnChar($column) } } /** - * Retieve set, enum, timestamp table columns + * Retrieve set, enum, timestamp table columns * * @param array $column description of column in given table * @param boolean $timestamp_seen whether a timestamp has been seen From 10c9132fdf510d6f8f1ebca9cc9677abfed1d364 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 21 Jun 2012 06:26:59 -0400 Subject: [PATCH 19/21] Typos --- libraries/DisplayResults.class.php | 16 ++++++++-------- libraries/gis_visualization.lib.php | 2 +- libraries/insert_edit.lib.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 0061047fb2..4e86431c1b 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -4576,7 +4576,7 @@ class PMA_DisplayResults * @param string $default_function default function * @param string $nowrap 'nowrap' if the content should not be * wrapped - * @param string $where_comparison data for the where cluase + * @param string $where_comparison data for the where clause * @param array $transform_options array of options for transformation * @param bool $is_field_truncated whether the field is truncated * @@ -4747,8 +4747,8 @@ class PMA_DisplayResults * @param array $is_display array with explicit indexes for all * the display elements * @param string $row_no the row number - * @param string $where_clause_html url encoded where cluase - * @param array $condition_array array of conditions in the where cluase + * @param string $where_clause_html url encoded where clause + * @param array $condition_array array of conditions in the where clause * @param string $del_query delete query * @param string $id_suffix suffix for the id * @param string $class css classes for the td element @@ -4799,8 +4799,8 @@ class PMA_DisplayResults * @param string $edit_url edit url * @param string $class css classes for td element * @param string $edit_str text for the edit link - * @param string $where_clause where cluase - * @param string $where_clause_html url encoded where cluase + * @param string $where_clause where clause + * @param string $where_clause_html url encoded where clause * * @return string the generated HTML * @@ -4839,7 +4839,7 @@ class PMA_DisplayResults * @param string $copy_url copy url * @param string $copy_str text for the copy link * @param string $where_clause where clause - * @param string $where_clause_html url encoded where cluase + * @param string $where_clause_html url encoded where clause * @param string $class css classes for the td element * * @return string the generated HTML @@ -4924,8 +4924,8 @@ class PMA_DisplayResults * display elements * @param string $row_no row number * @param string $where_clause where clause - * @param string $where_clause_html url encoded where cluase - * @param array $condition_array array of conditions in the where cluase + * @param string $where_clause_html url encoded where clause + * @param array $condition_array array of conditions in the where clause * @param string $del_query delete query * @param string $id_suffix suffix for the id * @param string $edit_url edit url diff --git a/libraries/gis_visualization.lib.php b/libraries/gis_visualization.lib.php index 9ec6cf19c1..63ad18814d 100644 --- a/libraries/gis_visualization.lib.php +++ b/libraries/gis_visualization.lib.php @@ -73,7 +73,7 @@ function PMA_GIS_modifyQuery($sql_query, $visualizationSettings) } } } - // If select cluase is * + // If select clause is * } else { // If label column is chosen add it to the query if (isset($visualizationSettings['labelColumn']) diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 25531f825c..256afd485f 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -91,7 +91,7 @@ function PMA_getWhereClauseArray($where_clause) } /** - * Analysing where cluases array + * Analysing where clauses array * * @param array $where_clause_array array of where clauses * @param string $table name of the table From 82fc0ff49f256a137c41af8c79a628a940ef1cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Jun 2012 13:04:43 +0200 Subject: [PATCH 20/21] Some indenation fixes --- server_status.php | 127 +++++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 58 deletions(-) diff --git a/server_status.php b/server_status.php index 301ea93c27..87e176d3c7 100644 --- a/server_status.php +++ b/server_status.php @@ -854,15 +854,14 @@ echo __('Runtime Information');
    @@ -872,25 +871,25 @@ echo __('Runtime Information');
    @@ -910,17 +909,17 @@ echo __('Runtime Information');
    @@ -1024,11 +1023,11 @@ function printQueryStatistics()
    0) { - $chart_json[__('Other')] = $other_sum; - } + if ($other_sum > 0) { + $chart_json[__('Other')] = $other_sum; + } - echo json_encode($chart_json); + echo json_encode($chart_json); ?>
    @@ -1266,7 +1265,9 @@ function printServerTraffic() <?php echo $show_full_sql ? __('Truncate Shown Queries') : __('Show Full Queries'); ?> - + @@ -1581,12 +1582,16 @@ function printMonitor() - + - + @@ -1664,7 +1669,9 @@ function printMonitor() ?>

    - +