diff --git a/tbl_row_action.php b/tbl_row_action.php index 708009a83f..f4414a1a85 100644 --- a/tbl_row_action.php +++ b/tbl_row_action.php @@ -26,7 +26,7 @@ if (! PMA_isValid($_REQUEST['rows_to_delete'], 'array') if (isset($_REQUEST['submit_mult'])) { $submit_mult = $_REQUEST['submit_mult']; -// workaround for IE problem: + // workaround for IE problem: } elseif (isset($_REQUEST['submit_mult_delete_x'])) { $submit_mult = 'row_delete'; } elseif (isset($_REQUEST['submit_mult_change_x'])) { @@ -42,104 +42,107 @@ if (isset($_REQUEST['mult_btn'])) { } switch($submit_mult) { - case 'row_delete': - case 'row_edit': - case 'row_export': - // leave as is - break; +case 'row_delete': +case 'row_edit': +case 'row_export': + // leave as is + break; - case 'export': - $submit_mult = 'row_export'; - break; +case 'export': + $submit_mult = 'row_export'; + break; - case 'delete': - $submit_mult = 'row_delete'; - break; +case 'delete': + $submit_mult = 'row_delete'; + break; - default: - case 'edit': - $submit_mult = 'row_edit'; - break; +default: +case 'edit': + $submit_mult = 'row_edit'; + break; } if (!empty($submit_mult)) { switch($submit_mult) { - case 'row_edit': - // As we got the rows to be edited from the - // 'rows_to_delete' checkbox, we use the index of it as the - // indicating WHERE clause. Then we build the array which is used - // for the tbl_change.php script. - $where_clause = array(); - foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) { - $where_clause[] = urldecode($i_where_clause); + case 'row_edit': + // As we got the rows to be edited from the + // 'rows_to_delete' checkbox, we use the index of it as the + // indicating WHERE clause. Then we build the array which is used + // for the tbl_change.php script. + $where_clause = array(); + foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) { + $where_clause[] = urldecode($i_where_clause); + } + + $active_page = 'tbl_change.php'; + include 'tbl_change.php'; + break; + + case 'row_export': + // Needed to allow SQL export + $single_table = true; + + // As we got the rows to be exported from the + // 'rows_to_delete' checkbox, we use the index of it as the + // indicating WHERE clause. Then we build the array which is used + // for the tbl_change.php script. + $where_clause = array(); + foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) { + $where_clause[] = urldecode($i_where_clause); + } + + $active_page = 'tbl_export.php'; + include 'tbl_export.php'; + break; + + case 'row_delete': + default: + $action = 'tbl_row_action.php'; + $err_url = 'tbl_row_action.php' + . PMA_generate_common_url($GLOBALS['url_params']); + if (! isset($_REQUEST['mult_btn'])) { + $original_sql_query = $sql_query; + if (! empty($url_query)) { + $original_url_query = $url_query; } - - $active_page = 'tbl_change.php'; - include 'tbl_change.php'; - break; - - case 'row_export': - // Needed to allow SQL export - $single_table = true; - - // As we got the rows to be exported from the - // 'rows_to_delete' checkbox, we use the index of it as the - // indicating WHERE clause. Then we build the array which is used - // for the tbl_change.php script. - $where_clause = array(); - foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) { - $where_clause[] = urldecode($i_where_clause); - } - - $active_page = 'tbl_export.php'; - include 'tbl_export.php'; - break; - - case 'row_delete': - default: - $action = 'tbl_row_action.php'; - $err_url = 'tbl_row_action.php' . PMA_generate_common_url($GLOBALS['url_params']); - if (! isset($_REQUEST['mult_btn'])) { - $original_sql_query = $sql_query; - if (! empty($url_query)) { - $original_url_query = $url_query; - } - } - include 'libraries/mult_submits.inc.php'; - $_url_params = $GLOBALS['url_params']; - $_url_params['goto'] = 'tbl_sql.php'; - $url_query = PMA_generate_common_url($_url_params); + } + include 'libraries/mult_submits.inc.php'; + $_url_params = $GLOBALS['url_params']; + $_url_params['goto'] = 'tbl_sql.php'; + $url_query = PMA_generate_common_url($_url_params); - /** - * Show result of multi submit operation - */ - // sql_query is not set when user does not confirm multi-delete - if ((!empty($submit_mult) || isset($_REQUEST['mult_btn'])) && ! empty($sql_query)) { - $disp_message = __('Your SQL query has been executed successfully'); - $disp_query = $sql_query; - } + /** + * Show result of multi submit operation + */ + // sql_query is not set when user does not confirm multi-delete + if ((! empty($submit_mult) || isset($_REQUEST['mult_btn'])) + && ! empty($sql_query) + ) { + $disp_message = __('Your SQL query has been executed successfully'); + $disp_query = $sql_query; + } - if (isset($original_sql_query)) { - $sql_query = $original_sql_query; - } + if (isset($original_sql_query)) { + $sql_query = $original_sql_query; + } - if (isset($original_url_query)) { - $url_query = $original_url_query; - } + if (isset($original_url_query)) { + $url_query = $original_url_query; + } - // this is because sql.php could call tbl_structure - // which would think it needs to call mult_submits.inc.php: - unset($submit_mult, $_REQUEST['mult_btn']); + // this is because sql.php could call tbl_structure + // which would think it needs to call mult_submits.inc.php: + unset($submit_mult, $_REQUEST['mult_btn']); - $active_page = 'sql.php'; - include 'sql.php'; + $active_page = 'sql.php'; + include 'sql.php'; - /** - * Displays the footer - */ - include 'libraries/footer.inc.php'; - break; + /** + * Displays the footer + */ + include 'libraries/footer.inc.php'; + break; } } ?> diff --git a/tbl_select.php b/tbl_select.php index e395c83933..4120c23590 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -78,7 +78,8 @@ if (! isset($param) || $param[0] == '') { $err_url = $goto . '?' . PMA_generate_common_url($db, $table); // Gets the list and number of fields - list($fields_list, $fields_type, $fields_collation, $fields_null, $geom_column_present) = PMA_tbl_getFields($db, $table); + list($fields_list, $fields_type, $fields_collation, $fields_null, $geom_column_present) + = PMA_tbl_getFields($db, $table); $fields_cnt = count($fields_list); // retrieve keys into foreign fields, if any @@ -155,7 +156,10 @@ echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params, '', 'topmenu2'); $foreignData = PMA_getForeignData($foreigners, $field, false, '', ''); - echo PMA_getForeignFields_Values($foreigners, $foreignData, $field, $fields_type, $i, $db, $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], '', true); + echo PMA_getForeignFields_Values( + $foreigners, $foreignData, $field, $fields_type, $i, $db, $table, + $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], '', true + ); ?> isUnaryOperator($func_type); $tmp_geom_func = isset($geom_func[$i]) ? $geom_func[$i] : null; - $whereClause = PMA_tbl_search_getWhereClause($fields[$i], $names[$i], $types[$i], $collations[$i], $func_type, $unaryFlag, $tmp_geom_func); + $whereClause = PMA_tbl_search_getWhereClause( + $fields[$i], $names[$i], $types[$i], $collations[$i], + $func_type, $unaryFlag, $tmp_geom_func + ); if ($whereClause) { $w[] = $whereClause; diff --git a/tbl_sql.php b/tbl_sql.php index bc0123f1b4..6342ffb9ea 100644 --- a/tbl_sql.php +++ b/tbl_sql.php @@ -41,7 +41,10 @@ require_once 'libraries/tbl_links.inc.php'; /** * Query box, bookmark, insert data from textfile */ -PMA_sqlQueryForm(true, false, isset($_REQUEST['delimiter']) ? htmlspecialchars($_REQUEST['delimiter']) : ';'); +PMA_sqlQueryForm( + true, false, + isset($_REQUEST['delimiter']) ? htmlspecialchars($_REQUEST['delimiter']) : ';' +); /** * Displays the footer diff --git a/tbl_structure.php b/tbl_structure.php index a0836317fe..97f0ee84d4 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -260,7 +260,9 @@ foreach ($fields as $row) { $type = $row['Type']; $extracted_columnspec = PMA_extractColumnSpec($row['Type']); - if ('set' == $extracted_columnspec['type'] || 'enum' == $extracted_columnspec['type']) { + if ('set' == $extracted_columnspec['type'] + || 'enum' == $extracted_columnspec['type'] + ) { $type_nowrap = ''; } else { $type_nowrap = ' class="nowrap"'; @@ -271,13 +273,20 @@ foreach ($fields as $row) { } $field_charset = ''; - if ($extracted_columnspec['can_contain_collation'] && ! empty($row['Collation'])) { + if ($extracted_columnspec['can_contain_collation'] + && ! empty($row['Collation']) + ) { $field_charset = $row['Collation']; } // Display basic mimetype [MIME] - if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME'] && isset($mime_map[$row['Field']]['mimetype'])) { - $type_mime = '
MIME: ' . str_replace('_', '/', $mime_map[$row['Field']]['mimetype']); + if ($cfgRelation['commwork'] + && $cfgRelation['mimework'] + && $cfg['BrowseMIME'] + && isset($mime_map[$row['Field']]['mimetype']) + ) { + $type_mime = '
MIME: ' + . str_replace('_', '/', $mime_map[$row['Field']]['mimetype']); } else { $type_mime = ''; } @@ -293,7 +302,10 @@ foreach ($fields as $row) { // here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having the // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe // the latter. - if (!empty($analyzed_sql[0]['create_table_fields'][$row['Field']]['type']) && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP' && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null']) { + if (! empty($analyzed_sql[0]['create_table_fields'][$row['Field']]['type']) + && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP' + && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] + ) { $row['Null'] = ''; } @@ -313,7 +325,9 @@ foreach ($fields as $row) { // underline commented fields and display a hover-title (CSS only) if (isset($comments_map[$row['Field']])) { - $displayed_field_name = '' . $field_name . ''; + $displayed_field_name = '' + . $field_name . ''; } if ($primary && $primary->hasColumn($field_name)) { @@ -559,22 +573,50 @@ $checkall_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table); @@ -697,7 +739,10 @@ if (count($fields) > 20) { * Displays indexes */ -if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_storage_engine) { +if (! $tbl_is_view + && ! $db_is_information_schema + && 'ARCHIVE' != $tbl_storage_engine +) { PMA_generate_slider_effect('indexes', __('Indexes')); /** * Display indexes @@ -730,12 +775,16 @@ if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_storage_ if ($cfg['ShowStats']) { echo '
'; if (empty($showtable)) { - $showtable = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], null, true); + $showtable = PMA_Table::sGetStatusInfo( + $GLOBALS['db'], $GLOBALS['table'], null, true + ); } $nonisam = false; $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB'); - if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) { + if (isset($showtable['Type']) + && ! preg_match('@ISAM|HEAP@i', $showtable['Type']) + ) { $nonisam = true; } @@ -746,20 +795,40 @@ if ($cfg['ShowStats']) { // this is to display for example 261.2 MiB instead of 268k KiB $max_digits = 3; $decimals = 1; - list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length'], $max_digits, $decimals); + list($data_size, $data_unit) = PMA_formatByteDown( + $showtable['Data_length'], $max_digits, $decimals + ); if ($mergetable == false) { - list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length'], $max_digits, $decimals); + list($index_size, $index_unit) = PMA_formatByteDown( + $showtable['Index_length'], $max_digits, $decimals + ); } // InnoDB returns a huge value in Data_free, do not use it - if (! $is_innodb && isset($showtable['Data_free']) && $showtable['Data_free'] > 0) { - list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free'], $max_digits, $decimals); - list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], $max_digits, $decimals); + if (! $is_innodb + && isset($showtable['Data_free']) + && $showtable['Data_free'] > 0 + ) { + list($free_size, $free_unit) = PMA_formatByteDown( + $showtable['Data_free'], $max_digits, $decimals + ); + list($effect_size, $effect_unit) = PMA_formatByteDown( + $showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], + $max_digits, $decimals + ); } else { - list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals); + list($effect_size, $effect_unit) = PMA_formatByteDown( + $showtable['Data_length'] + $showtable['Index_length'], + $max_digits, $decimals + ); } - list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals); + list($tot_size, $tot_unit) = PMA_formatByteDown( + $showtable['Data_length'] + $showtable['Index_length'], + $max_digits, $decimals + ); if ($table_info_num_rows > 0) { - list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1); + list($avg_size, $avg_unit) = PMA_formatByteDown( + ($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1 + ); } // Displays them diff --git a/tbl_tracking.php b/tbl_tracking.php index e4533da2b2..711065b3de 100644 --- a/tbl_tracking.php +++ b/tbl_tracking.php @@ -16,7 +16,9 @@ $url_params['back'] = 'tbl_tracking.php'; // Init vars for tracking report if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) { - $data = PMA_Tracker::getTrackedData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']); + $data = PMA_Tracker::getTrackedData( + $_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'] + ); $selection_schema = false; $selection_data = false; @@ -49,17 +51,16 @@ if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) { // Prepare export if (isset($_REQUEST['report_export'])) { -/** - * Filters tracking entries - * - * @param array the entries to filter - * @param string "from" date - * @param string "to" date - * @param string users - * - * @return array filtered entries - * - */ + /** + * Filters tracking entries + * + * @param array the entries to filter + * @param string "from" date + * @param string "to" date + * @param string users + * + * @return array filtered entries + */ function PMA_filter_tracking($data, $filter_ts_from, $filter_ts_to, $filter_users) { $tmp_entries = array(); @@ -84,13 +85,27 @@ if (isset($_REQUEST['report_export'])) { $entries = array(); // Filtering data definition statements - if ($_REQUEST['logtype'] == 'schema' || $_REQUEST['logtype'] == 'schema_and_data') { - $entries = array_merge($entries, PMA_filter_tracking($data['ddlog'], $filter_ts_from, $filter_ts_to, $filter_users)); + if ($_REQUEST['logtype'] == 'schema' + || $_REQUEST['logtype'] == 'schema_and_data' + ) { + $entries = array_merge( + $entries, + PMA_filter_tracking( + $data['ddlog'], $filter_ts_from, $filter_ts_to, $filter_users + ) + ); } // Filtering data manipulation statements - if ($_REQUEST['logtype'] == 'data' || $_REQUEST['logtype'] == 'schema_and_data') { - $entries = array_merge($entries, PMA_filter_tracking($data['dmlog'], $filter_ts_from, $filter_ts_to, $filter_users)); + if ($_REQUEST['logtype'] == 'data' + || $_REQUEST['logtype'] == 'schema_and_data' + ) { + $entries = array_merge( + $entries, + PMA_filter_tracking( + $data['dmlog'], $filter_ts_from, $filter_ts_to, $filter_users + ) + ); } // Sort it @@ -101,7 +116,10 @@ if (isset($_REQUEST['report_export'])) { $statements[$key] = $row['statement']; } - array_multisort($timestamps, SORT_ASC, $ids, SORT_ASC, $usernames, SORT_ASC, $statements, SORT_ASC, $entries); + array_multisort( + $timestamps, SORT_ASC, $ids, SORT_ASC, $usernames, + SORT_ASC, $statements, SORT_ASC, $entries + ); } @@ -109,8 +127,10 @@ if (isset($_REQUEST['report_export'])) { if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldumpfile') { @ini_set('url_rewriter.tags', ''); - $dump = "# " . sprintf(__('Tracking report for table `%s`'), htmlspecialchars($_REQUEST['table'])) . "\n" . - "# " . date('Y-m-d H:i:s') . "\n"; + $dump = "# " . sprintf( + __('Tracking report for table `%s`'), htmlspecialchars($_REQUEST['table']) + ) + . "\n" . "# " . date('Y-m-d H:i:s') . "\n"; foreach ($entries as $entry) { $dump .= $entry['statement']; } @@ -172,7 +192,10 @@ if (isset($_REQUEST['submit_create_version'])) { } $tracking_set = rtrim($tracking_set, ','); - if (PMA_Tracker::createVersion($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'], $tracking_set)) { + $versionCreated = PMA_Tracker::createVersion( + $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'], $tracking_set + ); + if ($versionCreated) { $msg = PMA_Message::success( sprintf( __('Version %1$s was created, tracking for %2$s is active.'), @@ -186,7 +209,10 @@ if (isset($_REQUEST['submit_create_version'])) { // Deactivate tracking if (isset($_REQUEST['submit_deactivate_now'])) { - if (PMA_Tracker::deactivateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) { + $deactivated = PMA_Tracker::deactivateTracking( + $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'] + ); + if ($deactivated) { $msg = PMA_Message::success( sprintf( __('Tracking for %1$s was deactivated at version %2$s.'), @@ -200,7 +226,10 @@ if (isset($_REQUEST['submit_deactivate_now'])) { // Activate tracking if (isset($_REQUEST['submit_activate_now'])) { - if (PMA_Tracker::activateTracking($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'])) { + $activated = PMA_Tracker::activateTracking( + $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version'] + ); + if ($activated) { $msg = PMA_Message::success( sprintf( __('Tracking for %1$s was activated at version %2$s.'), @@ -394,7 +423,9 @@ if (isset($_REQUEST['snapshot'])) { /* * Tracking report */ -if (isset($_REQUEST['report']) && (isset($_REQUEST['delete_ddlog']) || isset($_REQUEST['delete_dmlog']))) { +if (isset($_REQUEST['report']) + && (isset($_REQUEST['delete_ddlog']) || isset($_REQUEST['delete_dmlog'])) +) { if (isset($_REQUEST['delete_ddlog'])) { @@ -405,7 +436,11 @@ if (isset($_REQUEST['report']) && (isset($_REQUEST['delete_ddlog']) || isset($_R if ($delete_id == (int)$delete_id) { unset($data['ddlog'][$delete_id]); - if (PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], 'DDL', $data['ddlog'])) { + $successfullyDeleted = PMA_Tracker::changeTrackingData( + $_REQUEST['db'], $_REQUEST['table'], + $_REQUEST['version'], 'DDL', $data['ddlog'] + ); + if ($successfullyDeleted) { $msg = PMA_Message::success(__('Tracking data definition successfully deleted')); } else { $msg = PMA_Message::rawError(__('Query error')); @@ -423,7 +458,11 @@ if (isset($_REQUEST['report']) && (isset($_REQUEST['delete_ddlog']) || isset($_R if ($delete_id == (int)$delete_id) { unset($data['dmlog'][$delete_id]); - if (PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], 'DML', $data['dmlog'])) { + $successfullyDeleted = PMA_Tracker::changeTrackingData( + $_REQUEST['db'], $_REQUEST['table'], + $_REQUEST['version'], 'DML', $data['dmlog'] + ); + if ($successfullyDeleted) { $msg = PMA_Message::success(__('Tracking data manipulation successfully deleted')); } else { $msg = PMA_Message::rawError(__('Query error')); diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php index 7d11c8057a..3eacd335d4 100644 --- a/tbl_zoom_select.php +++ b/tbl_zoom_select.php @@ -75,8 +75,8 @@ if (isset($_REQUEST['get_data_row']) && $_REQUEST['get_data_row'] == true) { } /** - * Handle AJAX request for changing field information(value,collation,operators,field values) - * in input form + * Handle AJAX request for changing field information + * (value,collation,operators,field values) in input form * @var post_params Object containing parameters for the POST request */ @@ -92,7 +92,8 @@ if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true) // Gets the list and number of fields - list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($_REQUEST['db'], $_REQUEST['table']); + list($fields_list, $fields_type, $fields_collation, $fields_null) + = PMA_tbl_getFields($_REQUEST['db'], $_REQUEST['table']); $foreigners = PMA_getForeigners($db, $table); $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values')); @@ -158,7 +159,8 @@ $err_url = $goto . '?' . PMA_generate_common_url($db, $table); // Gets the list and number of fields -list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($db, $table); +list($fields_list, $fields_type, $fields_collation, $fields_null) + = PMA_tbl_getFields($db, $table); $fields_cnt = count($fields_list); // retrieve keys into foreign fields, if any @@ -315,7 +317,11 @@ echo '" />'; * Handle the input criteria and generate the query result * Form for displaying query results */ -if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' && $inputs[0] != $inputs[1]) { +if (isset($zoom_submit) + && $inputs[0] != 'pma_null' + && $inputs[1] != 'pma_null' + && $inputs[0] != $inputs[1] +) { /* * Query generation part @@ -355,13 +361,16 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' $result = PMA_DBI_query($sql_query . ";", null, PMA_DBI_QUERY_STORE); $fields_meta = PMA_DBI_get_fields_meta($result); while ($row = PMA_DBI_fetch_assoc($result)) { - //Need a row with indexes as 0,1,2 for the PMA_getUniqueCondition hence using a temporary array + //Need a row with indexes as 0,1,2 for the PMA_getUniqueCondition + // hence using a temporary array $tmpRow = array(); foreach ($row as $val) { $tmpRow[] = $val; } //Get unique conditon on each row (will be needed for row update) - $uniqueCondition = PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $tmpRow, true); + $uniqueCondition = PMA_getUniqueCondition( + $result, $fields_cnt, $fields_meta, $tmpRow, true + ); //Append it to row array as where_clause $row['where_clause'] = $uniqueCondition[0]; diff --git a/transformation_wrapper.php b/transformation_wrapper.php index 138235f135..1d873ace6f 100644 --- a/transformation_wrapper.php +++ b/transformation_wrapper.php @@ -48,11 +48,19 @@ foreach ($request_params as $one_request_param) { */ PMA_DBI_select_db($db); if (isset($where_clause)) { - $result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';', null, PMA_DBI_QUERY_STORE); - $row = PMA_DBI_fetch_assoc($result); + $result = PMA_DBI_query( + 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';', + null, + PMA_DBI_QUERY_STORE + ); + $row = PMA_DBI_fetch_assoc($result); } else { - $result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE); - $row = PMA_DBI_fetch_assoc($result); + $result = PMA_DBI_query( + 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', + null, + PMA_DBI_QUERY_STORE + ); + $row = PMA_DBI_fetch_assoc($result); } // No row returned @@ -64,7 +72,10 @@ $default_ct = 'application/octet-stream'; if ($cfgRelation['commwork'] && $cfgRelation['mimework']) { $mime_map = PMA_getMime($db, $table); - $mime_options = PMA_transformation_getOptions((isset($mime_map[$transform_key]['transformation_options']) ? $mime_map[$transform_key]['transformation_options'] : '')); + $mime_options = PMA_transformation_getOptions( + isset($mime_map[$transform_key]['transformation_options']) + ? $mime_map[$transform_key]['transformation_options'] : '' + ); foreach ($mime_options AS $key => $option) { if (substr($option, 0, 10) == '; charset=') { @@ -82,7 +93,10 @@ require_once './libraries/header_http.inc.php'; if (isset($ct) && !empty($ct)) { $mime_type = $ct; } else { - $mime_type = (isset($mime_map[$transform_key]['mimetype']) ? str_replace('_', '/', $mime_map[$transform_key]['mimetype']) : $default_ct) . (isset($mime_options['charset']) ? $mime_options['charset'] : ''); + $mime_type = (isset($mime_map[$transform_key]['mimetype']) + ? str_replace('_', '/', $mime_map[$transform_key]['mimetype']) + : $default_ct) + . (isset($mime_options['charset']) ? $mime_options['charset'] : ''); } PMA_download_header($cn, $mime_type); @@ -116,9 +130,13 @@ if (! isset($resize)) { $destImage = ImageCreateTrueColor($destWidth, $destHeight); } -// ImageCopyResized($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight); -// better quality but slower: - ImageCopyResampled($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight); + // ImageCopyResized($destImage, $srcImage, 0, 0, 0, 0, + // $destWidth, $destHeight, $srcWidth, $srcHeight); + // better quality but slower: + ImageCopyResampled( + $destImage, $srcImage, 0, 0, 0, 0, $destWidth, + $destHeight, $srcWidth, $srcHeight + ); if ($resize == 'jpeg') { ImageJPEG($destImage, '', 75); diff --git a/url.php b/url.php index 23f3ac5b76..56cce845ce 100644 --- a/url.php +++ b/url.php @@ -9,7 +9,9 @@ */ require_once './libraries/common.inc.php'; -if (! PMA_isValid($_GET['url']) || ! preg_match('/^https?:\/\/[^\n\r]*$/', $_GET['url'])) { +if (! PMA_isValid($_GET['url']) + || ! preg_match('/^https?:\/\/[^\n\r]*$/', $_GET['url']) +) { header('Location: ' . $cfg['PmaAbsoluteUri']); } else { header('Location: ' . $_GET['url']);