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 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 bc2dd90351..256afd485f 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 */ @@ -88,12 +91,12 @@ 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 - * @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,15 +161,16 @@ 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 */ 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 ); @@ -177,10 +181,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 +199,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 +232,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 +262,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 +297,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 boolean $timestamp_seen whether a timestamp has been seen * * @return array description of column in given table */ @@ -308,8 +315,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; } @@ -317,8 +324,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 */ @@ -397,12 +404,12 @@ 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 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'] + * @return array $column['pma_type'], $column['wrap'], $column['first_timestamp'] */ function PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen) { @@ -417,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']; @@ -457,9 +464,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') @@ -503,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 .= ''; @@ -574,20 +585,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 */ @@ -605,7 +622,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( @@ -620,7 +637,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 ); @@ -639,28 +656,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 ); @@ -683,7 +700,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 +739,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 @@ -733,13 +750,17 @@ 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($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, - $tabindex, $column, $tabindex_for_value, $idindex, $data, $column_enum_values + $html_output .= PMA_getRadioButtonDependingOnLength( + $column_name_appendix, $unnullify_trigger, + $tabindex, $column, $tabindex_for_value, + $idindex, $data, $column_enum_values ); } return $html_output; @@ -859,7 +888,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 +930,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 +967,13 @@ 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 string $backup_field hidden input field - * @param string $column_name_appendix the name atttibute - * @param string $unnullify_trigger validation string + * @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 integer $tabindex tab index * @param integer $tabindex_for_value offset for the values tabindex * @param integer $idindex id index @@ -960,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, @@ -1062,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 ); @@ -1121,23 +1156,25 @@ 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"; } } /** * 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 +1218,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 */ @@ -1202,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( @@ -1211,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' @@ -1241,7 +1283,10 @@ 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 */ @@ -1264,26 +1309,31 @@ 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'] + ); } /** * 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 */ 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 '' @@ -1311,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; } @@ -1394,7 +1457,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 @@ -1417,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; } @@ -1436,10 +1501,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) { @@ -1494,13 +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 = ''; @@ -1562,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; @@ -1587,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 + ); } /** @@ -1619,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 */ @@ -1648,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); @@ -1669,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 */ @@ -1720,11 +1797,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) { @@ -1750,6 +1827,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']; diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index c5654635d6..e66ed304ca 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 */ @@ -111,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']); } } @@ -137,8 +151,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. */ @@ -153,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'] . ' '; @@ -203,7 +223,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. */ @@ -212,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']; @@ -227,6 +254,8 @@ function PMA_RTN_parseRoutineDefiner($parsed_query) /** * Handles editor requests for adding or editing an item + * + * @return Does not return */ function PMA_RTN_handleEditor() { @@ -280,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; } @@ -291,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('