diff options
89 files changed, 1453 insertions, 1453 deletions
diff --git a/db_operations.php b/db_operations.php index c2223b4ee8..338d38574f 100644 --- a/db_operations.php +++ b/db_operations.php @@ -122,7 +122,7 @@ if (strlen($db) PMA_relationsCleanupDatabase($db); // if someday the RENAME DATABASE reappears, do not DROP - $local_query = 'DROP DATABASE ' . $common_functions->backquote($db) . ';'; + $local_query = 'DROP DATABASE ' . PMA_Util::backquote($db) . ';'; $sql_query .= "\n" . $local_query; PMA_DBI_query($local_query); @@ -166,7 +166,7 @@ if (strlen($db) $response->addJSON('newname', $_REQUEST['newname']); $response->addJSON( 'sql_query', - $common_functions->getMessage(null, $sql_query) + PMA_Util::getMessage(null, $sql_query) ); exit; } @@ -200,7 +200,7 @@ if (empty($is_info)) { echo "\n"; if (isset($message)) { - echo $common_functions->getMessage($message, $sql_query); + echo PMA_Util::getMessage($message, $sql_query); unset($message); } } @@ -279,9 +279,9 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { // We only show this if we find something in the new pdf_pages table $test_query = ' SELECT * - FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) - . '.' . $common_functions->backquote($cfgRelation['pdf_pages']) . ' - WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''; + FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) + . '.' . PMA_Util::backquote($cfgRelation['pdf_pages']) . ' + WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''; $test_rs = PMA_queryAsControlUser($test_query, null, PMA_DBI_QUERY_STORE); /* diff --git a/db_printview.php b/db_printview.php index ded495c1a1..ce7a7d0375 100644 --- a/db_printview.php +++ b/db_printview.php @@ -14,7 +14,7 @@ $response = PMA_Response::getInstance(); $header = $response->getHeader(); $header->enablePrintView(); -$common_functions->checkParameters(array('db')); +PMA_Util::checkParameters(array('db')); /** * Defines the url to return to in case of error in a sql statement @@ -132,9 +132,9 @@ if ($num_tables == 0) { <td class="right"> <?php if ($merged_size) { - echo '<i>' . $common_functions->formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n"; + echo '<i>' . PMA_Util::formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n"; } else { - echo $common_functions->formatNumber($sts_data['TABLE_ROWS'], 0) . "\n"; + echo PMA_Util::formatNumber($sts_data['TABLE_ROWS'], 0) . "\n"; } ?> </td> @@ -146,7 +146,7 @@ if ($num_tables == 0) { $tblsize = $sts_data['Data_length'] + $sts_data['Index_length']; $sum_size += $tblsize; list($formated_size, $unit) - = $common_functions->formatByteDown($tblsize, 3, 1); + = PMA_Util::formatByteDown($tblsize, 3, 1); ?> <td class="right nowrap"> <?php echo $formated_size . ' ' . $unit; ?> @@ -183,7 +183,7 @@ if ($num_tables == 0) { ?> <tr> <td class="right"><?php echo __('Creation') . ': '; ?></td> - <td class="right"><?php echo $common_functions->localisedDate(strtotime($sts_data['Create_time'])); ?></td> + <td class="right"><?php echo PMA_Util::localisedDate(strtotime($sts_data['Create_time'])); ?></td> </tr> <?php } @@ -192,7 +192,7 @@ if ($num_tables == 0) { ?> <tr> <td class="right"><?php echo __('Last update') . ': '; ?></td> - <td class="right"><?php echo $common_functions->localisedDate(strtotime($sts_data['Update_time'])); ?></td> + <td class="right"><?php echo PMA_Util::localisedDate(strtotime($sts_data['Update_time'])); ?></td> </tr> <?php } @@ -201,7 +201,7 @@ if ($num_tables == 0) { ?> <tr> <td class="right"><?php echo __('Last check') . ': '; ?></td> - <td class="right"><?php echo $common_functions->localisedDate(strtotime($sts_data['Check_time'])); ?></td> + <td class="right"><?php echo PMA_Util::localisedDate(strtotime($sts_data['Check_time'])); ?></td> </tr> <?php } @@ -217,10 +217,10 @@ if ($num_tables == 0) { ?> <tr> <th class="center"> - <?php echo sprintf(_ngettext('%s table', '%s tables', $num_tables), $common_functions->formatNumber($num_tables, 0)); ?> + <?php echo sprintf(_ngettext('%s table', '%s tables', $num_tables), PMA_Util::formatNumber($num_tables, 0)); ?> </th> <th class="right nowrap"> - <?php echo $common_functions->formatNumber($sum_entries, 0); ?> + <?php echo PMA_Util::formatNumber($sum_entries, 0); ?> </th> <th class="center"> -- @@ -228,7 +228,7 @@ if ($num_tables == 0) { <?php if ($cfg['ShowStats']) { list($sum_formated, $unit) - = $common_functions->formatByteDown($sum_size, 3, 1); + = PMA_Util::formatByteDown($sum_size, 3, 1); ?> <th class="right nowrap"> <?php echo $sum_formated . ' ' . $unit; ?> @@ -246,7 +246,7 @@ if ($num_tables == 0) { /** * Displays the footer */ -echo $common_functions->getButton(); +echo PMA_Util::getButton(); echo "<div id='PMA_disable_floating_menubar'></div>\n"; ?> diff --git a/db_structure.php b/db_structure.php index 3cfaabaafe..3c9ca8a09b 100644 --- a/db_structure.php +++ b/db_structure.php @@ -77,7 +77,7 @@ require_once 'libraries/bookmark.lib.php'; require_once 'libraries/mysql_charsets.lib.php'; $db_collation = PMA_getDbCollation($db); -$titles = $common_functions->buildActionTitles(); +$titles = PMA_Util::buildActionTitles(); // 1. No tables @@ -117,7 +117,7 @@ if (isset($_REQUEST['sort_order'])) { } $response->addHTML( - $common_functions->getListNavigator( + PMA_Util::getListNavigator( $total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList'] ) @@ -307,7 +307,7 @@ $response->addHTML('</form>'); //end of form // display again the table list navigator $response->addHTML( - $common_functions->getListNavigator( + PMA_Util::getListNavigator( $total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList'] ) diff --git a/db_tables_search.php b/db_tables_search.php index d61442791c..0631415131 100644 --- a/db_tables_search.php +++ b/db_tables_search.php @@ -12,7 +12,7 @@ require_once 'libraries/Util.class.php'; $db = $_GET['db']; $table_term = $_GET['table']; $common_url_query = PMA_generate_common_url($GLOBALS['db']); -$tables_full = $common_functions->getTableList($db); +$tables_full = PMA_Util::getTableList($db); $tables_response = array(); foreach ($tables_full as $key => $table) { @@ -21,7 +21,7 @@ foreach ($tables_full as $key => $table) { . htmlspecialchars($link_title) . ': ' . htmlspecialchars($table['Comment']) . ' (' - . $common_functions->formatNumber($table['Rows'], 0) + . PMA_Util::formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"' . ' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"' . ' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?' @@ -33,11 +33,11 @@ foreach ($tables_full as $key => $table) { 'id' => 'icon_' . htmlspecialchars($table_db . '.' . $table['Name']) ); if (PMA_Table::isView($table_db, $table['Name'])) { - $link .= $common_functions->getImage( + $link .= PMA_Util::getImage( 's_views.png', htmlspecialchars($link_title), $attr ); } else { - $link .= $common_functions->getImage( + $link .= PMA_Util::getImage( 'b_browse.png', htmlspecialchars($link_title), $attr ); } @@ -48,12 +48,12 @@ foreach ($tables_full as $key => $table) { . urlencode($table['Name']) . '&pos=0'; $link .= '<a href="' . $href . '" title="' . htmlspecialchars( - $common_functions->getTitleForTarget( + PMA_Util::getTitleForTarget( $GLOBALS['cfg']['DefaultTabTable'] ) . ': ' . $table['Comment'] . ' (' . - $common_functions->formatNumber($table['Rows'], 0) + PMA_Util::formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')' ) . '" id="' . htmlspecialchars($table_db . '.' . $table['Name']) diff --git a/db_tracking.php b/db_tracking.php index bab140f115..03dd1407db 100644 --- a/db_tracking.php +++ b/db_tracking.php @@ -60,9 +60,9 @@ if ($num_tables == 0 && count($data['ddlog']) == 0) { // Prepare statement to get HEAD version $all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' . - $common_functions->backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . - $common_functions->backquote($GLOBALS['cfg']['Server']['tracking']) . - ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($_REQUEST['db']) . '\' ' . + PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . + PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']) . + ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($_REQUEST['db']) . '\' ' . ' GROUP BY table_name' . ' ORDER BY table_name ASC'; @@ -94,7 +94,7 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) { $drop_image_or_text = ''; if (true == $GLOBALS['cfg']['PropertiesIconic']) { - $drop_image_or_text .= $common_functions->getImage( + $drop_image_or_text .= PMA_Util::getImage( 'b_drop.png', __('Delete tracking data for this table') ); @@ -109,10 +109,10 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) { while ($one_result = PMA_DBI_fetch_array($all_tables_result)) { list($table_name, $version_number) = $one_result; $table_query = ' SELECT * FROM ' . - $common_functions->backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . - $common_functions->backquote($GLOBALS['cfg']['Server']['tracking']) . - ' WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($_REQUEST['db']) - . '\' AND `table_name` = \'' . $common_functions->sqlAddSlashes($table_name) + PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . + PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']) . + ' WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($_REQUEST['db']) + . '\' AND `table_name` = \'' . PMA_Util::sqlAddSlashes($table_name) . '\' AND `version` = \'' . $version_number . '\''; $table_result = PMA_queryAsControlUser($table_query); @@ -159,7 +159,7 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) { $sep = $GLOBALS['cfg']['LeftFrameTableSeparator']; // Get list of tables -$table_list = $common_functions->getTableList($GLOBALS['db']); +$table_list = PMA_Util::getTableList($GLOBALS['db']); // For each table try to get the tracking version foreach ($table_list as $key => $value) { @@ -211,7 +211,7 @@ if (isset($my_tables)) { if (PMA_Tracker::getVersion($GLOBALS['db'], $tablename) == -1) { $my_link = '<a href="tbl_tracking.php?' . $url_query . '&table=' . htmlspecialchars($tablename) .'">'; - $my_link .= $common_functions->getIcon('eye.png', __('Track table')); + $my_link .= PMA_Util::getIcon('eye.png', __('Track table')); $my_link .= '</a>'; ?> <tr class="noclick <?php echo $style;?>"> @@ -239,7 +239,7 @@ if (count($data['ddlog']) > 0) { $log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n" . $entry['statement'] . "\n"; } - echo $common_functions->getMessage(__('Database Log'), $log); + echo PMA_Util::getMessage(__('Database Log'), $log); } ?> diff --git a/export.php b/export.php index 4d23427c4c..05dd75672c 100644 --- a/export.php +++ b/export.php @@ -21,7 +21,7 @@ foreach ($_POST as $one_post_param => $one_post_value) { $GLOBALS[$one_post_param] = $one_post_value; } -$common_functions->checkParameters(array('what', 'export_type')); +PMA_Util::checkParameters(array('what', 'export_type')); // export class instance, not array of properties, as before $export_plugin = PMA_getPlugin( @@ -248,7 +248,7 @@ function PMA_exportOutputHandler($line) if ($what == 'sql') { $crlf = "\n"; } else { - $crlf = $common_functions->whichCrlf(); + $crlf = PMA_Util::whichCrlf(); } $output_kanji_conversion = function_exists('PMA_kanji_str_conv') && $type != 'xls'; @@ -318,7 +318,7 @@ if ($asfile) { ); } } - $filename = $common_functions->expandUserString($filename_template); + $filename = PMA_Util::expandUserString($filename_template); $filename = PMA_sanitizeFilename($filename); // Grab basic dump extension and mime type @@ -350,7 +350,7 @@ if ($asfile) { // Open file on server if needed if ($save_on_server) { - $save_filename = $common_functions->userDir($cfg['SaveDir']) + $save_filename = PMA_Util::userDir($cfg['SaveDir']) . preg_replace('@[/\\\\]@', '_', $filename); unset($message); if (file_exists($save_filename) @@ -535,8 +535,8 @@ do { || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data') && ! ($is_view || PMA_Table::isMerge($current_db, $table)) ) { - $local_query = 'SELECT * FROM ' . $common_functions->backquote($current_db) - . '.' . $common_functions->backquote($table); + $local_query = 'SELECT * FROM ' . PMA_Util::backquote($current_db) + . '.' . PMA_Util::backquote($table); if (! $export_plugin->exportData($current_db, $table, $crlf, $err_url, $local_query)) { break 3; } @@ -614,8 +614,8 @@ do { || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data') && ! ($is_view || PMA_Table::isMerge($db, $table)) ) { - $local_query = 'SELECT * FROM ' . $common_functions->backquote($db) - . '.' . $common_functions->backquote($table); + $local_query = 'SELECT * FROM ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($table); if (! $export_plugin->exportData($db, $table, $crlf, $err_url, $local_query)) { break 2; } @@ -694,8 +694,8 @@ do { $local_query = $sql_query . $add_query; PMA_DBI_select_db($db); } else { - $local_query = 'SELECT * FROM ' . $common_functions->backquote($db) - . '.' . $common_functions->backquote($table) . $add_query; + $local_query = 'SELECT * FROM ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($table) . $add_query; } if (! $export_plugin->exportData($db, $table, $crlf, $err_url, $local_query)) { break; diff --git a/import.php b/import.php index c426801c83..f84268b68c 100644 --- a/import.php +++ b/import.php @@ -121,7 +121,7 @@ foreach (array_keys($_POST) as $post_key) { } // Check needed parameters -$common_functions->checkParameters(array('import_type', 'format')); +PMA_Util::checkParameters(array('import_type', 'format')); // We don't want anything special in format $format = PMA_securePath($format); @@ -215,7 +215,7 @@ if (! empty($id_bookmark)) { if (isset($bookmark_variable) && ! empty($bookmark_variable)) { $import_text = preg_replace( '|/\*(.*)\[VARIABLE\](.*)\*/|imsU', - '${1}' . $common_functions->sqlAddSlashes($bookmark_variable) . '${2}', + '${1}' . PMA_Util::sqlAddSlashes($bookmark_variable) . '${2}', $import_text ); } @@ -299,7 +299,7 @@ if (! empty($local_import_file) && ! empty($cfg['UploadDir'])) { // sanitize $local_import_file as it comes from a POST $local_import_file = PMA_securePath($local_import_file); - $import_file = $common_functions->userDir($cfg['UploadDir']) + $import_file = PMA_Util::userDir($cfg['UploadDir']) . $local_import_file; } elseif (empty($import_file) || ! is_uploaded_file($import_file)) { @@ -550,7 +550,7 @@ if (strlen($sql_query) <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) { // There was an error? if (isset($my_die)) { foreach ($my_die AS $key => $die) { - $common_functions->mysqlDie( + PMA_Util::mysqlDie( $die['error'], $die['sql'], '', $err_url, $error ); } diff --git a/libraries/Index.class.php b/libraries/Index.class.php index 19361d8b7b..ef6c3f6b14 100644 --- a/libraries/Index.class.php +++ b/libraries/Index.class.php @@ -535,7 +535,7 @@ class PMA_Index if (! $print_mode) { $r = '<fieldset>'; $r .= '<legend id="index_header">' . __('Indexes'); - $r .= $common_functions->showMySQLDocu( + $r .= PMA_Util::showMySQLDocu( 'optimization', 'optimizing-database-structure' ); @@ -587,13 +587,13 @@ class PMA_Index } $r .= '" ' . $row_span . '>' . ' <a href="tbl_indexes.php' . PMA_generate_common_url($this_params) . '">' - . $common_functions->getIcon('b_edit.png', __('Edit')) . '</a>' + . PMA_Util::getIcon('b_edit.png', __('Edit')) . '</a>' . '</td>' . "\n"; $this_params = $GLOBALS['url_params']; if ($index->getName() == 'PRIMARY') { $this_params['sql_query'] = 'ALTER TABLE ' - . $common_functions->backquote($table) + . PMA_Util::backquote($table) . ' DROP PRIMARY KEY;'; $this_params['message_to_show'] = __('The primary key has been dropped'); @@ -602,8 +602,8 @@ class PMA_Index ); } else { $this_params['sql_query'] = 'ALTER TABLE ' - . $common_functions->backquote($table) . ' DROP INDEX ' - . $common_functions->backquote($index->getName()) . ';'; + . PMA_Util::backquote($table) . ' DROP INDEX ' + . PMA_Util::backquote($index->getName()) . ';'; $this_params['message_to_show'] = sprintf( __('Index %s has been dropped'), $index->getName() ); @@ -624,7 +624,7 @@ class PMA_Index } $r .= ' href="sql.php' . PMA_generate_common_url($this_params) . '" >' - . $common_functions->getIcon('b_drop.png', __('Drop')) . '</a>' + . PMA_Util::getIcon('b_drop.png', __('Drop')) . '</a>' . '</td>' . "\n"; } diff --git a/libraries/List_Database.class.php b/libraries/List_Database.class.php index a6fc7dbfc4..cb8c8289a3 100644 --- a/libraries/List_Database.class.php +++ b/libraries/List_Database.class.php @@ -451,7 +451,7 @@ class PMA_List_Database extends PMA_List SELECT DISTINCT `Db` FROM `mysql`.`db` WHERE `Select_priv` = 'Y' AND `User` - IN ('" . $common_functions->sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "', '')"; + IN ('" . PMA_Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "', '')"; $tmp_mydbs = PMA_DBI_fetch_result( $local_query, null, null, $GLOBALS['controllink'] ); @@ -511,7 +511,7 @@ class PMA_List_Database extends PMA_List $local_query = 'SELECT DISTINCT `Db` FROM `mysql`.`tables_priv`'; $local_query .= ' WHERE `Table_priv` LIKE \'%Select%\''; $local_query .= ' AND `User` = \''; - $local_query .= $common_functions->sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . '\''; + $local_query .= PMA_Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . '\''; $rs = PMA_DBI_try_query($local_query, $GLOBALS['controllink']); if ($rs && @PMA_DBI_num_rows($rs)) { while ($row = PMA_DBI_fetch_assoc($rs)) { diff --git a/libraries/Table.class.php b/libraries/Table.class.php index cd699db751..59d7db116c 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -218,8 +218,8 @@ class PMA_Table $result = PMA_DBI_fetch_result( "SELECT TABLE_NAME FROM information_schema.VIEWS - WHERE TABLE_SCHEMA = '" . $common_functions->sqlAddSlashes($db) . "' - AND TABLE_NAME = '" . $common_functions->sqlAddSlashes($table) . "'" + WHERE TABLE_SCHEMA = '" . PMA_Util::sqlAddSlashes($db) . "' + AND TABLE_NAME = '" . PMA_Util::sqlAddSlashes($table) . "'" ); return $result ? true : false; } @@ -383,7 +383,7 @@ class PMA_Table $is_timestamp = strpos(strtoupper($type), 'TIMESTAMP') !== false; - $query = $common_functions->backquote($name) . ' ' . $type; + $query = PMA_Util::backquote($name) . ' ' . $type; if ($length != '' && ! preg_match( @@ -433,10 +433,10 @@ class PMA_Table } else { // Invalid BOOLEAN value $query .= ' DEFAULT \'' - . $common_functions->sqlAddSlashes($default_value) . '\''; + . PMA_Util::sqlAddSlashes($default_value) . '\''; } } else { - $query .= ' DEFAULT \'' . $common_functions->sqlAddSlashes($default_value) . '\''; + $query .= ' DEFAULT \'' . PMA_Util::sqlAddSlashes($default_value) . '\''; } break; case 'NULL' : @@ -486,14 +486,14 @@ class PMA_Table } // end if (auto_increment) } if (!empty($comment)) { - $query .= " COMMENT '" . $common_functions->sqlAddSlashes($comment) . "'"; + $query .= " COMMENT '" . PMA_Util::sqlAddSlashes($comment) . "'"; } // move column if ($move_to == '-first') { // dash can't appear as part of column name $query .= ' FIRST'; } elseif ($move_to != '') { - $query .= ' AFTER ' . $common_functions->backquote($move_to); + $query .= ' AFTER ' . PMA_Util::backquote($move_to); } return $query; } // end function @@ -565,8 +565,8 @@ class PMA_Table // Use try_query because it can fail (when a VIEW is // based on a table that no longer exists) $result = PMA_DBI_try_query( - 'SELECT 1 FROM ' . $common_functions->backquote($db) . '.' - . $common_functions->backquote($table) . ' LIMIT ' + 'SELECT 1 FROM ' . PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($table) . ' LIMIT ' . $GLOBALS['cfg']['MaxExactCountViews'], null, PMA_DBI_QUERY_STORE @@ -650,27 +650,27 @@ class PMA_Table $select_parts = array(); $row_fields = array(); foreach ($get_fields as $get_field) { - $select_parts[] = $common_functions->backquote($get_field); + $select_parts[] = PMA_Util::backquote($get_field); $row_fields[$get_field] = 'cc'; } $where_parts = array(); foreach ($where_fields as $_where => $_value) { - $where_parts[] = $common_functions->backquote($_where) . ' = \'' - . $common_functions->sqlAddSlashes($_value) . '\''; + $where_parts[] = PMA_Util::backquote($_where) . ' = \'' + . PMA_Util::sqlAddSlashes($_value) . '\''; } $new_parts = array(); $new_value_parts = array(); foreach ($new_fields as $_where => $_value) { - $new_parts[] = $common_functions->backquote($_where); - $new_value_parts[] = $common_functions->sqlAddSlashes($_value); + $new_parts[] = PMA_Util::backquote($_where); + $new_value_parts[] = PMA_Util::sqlAddSlashes($_value); } $table_copy_query = ' SELECT ' . implode(', ', $select_parts) . ' - FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($GLOBALS['cfgRelation'][$pma_table]) . ' + FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($GLOBALS['cfgRelation'][$pma_table]) . ' WHERE ' . implode(' AND ', $where_parts); // must use PMA_DBI_QUERY_STORE here, since we execute another @@ -683,13 +683,13 @@ class PMA_Table $value_parts = array(); foreach ($table_copy_row as $_key => $_val) { if (isset($row_fields[$_key]) && $row_fields[$_key] == 'cc') { - $value_parts[] = $common_functions->sqlAddSlashes($_val); + $value_parts[] = PMA_Util::sqlAddSlashes($_val); } } $new_table_query = 'INSERT IGNORE INTO ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) - . '.' . $common_functions->backquote($GLOBALS['cfgRelation'][$pma_table]) . ' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) + . '.' . PMA_Util::backquote($GLOBALS['cfgRelation'][$pma_table]) . ' (' . implode(', ', $select_parts) . ', ' . implode(', ', $new_parts) . ') VALUES @@ -761,7 +761,7 @@ class PMA_Table return false; } - $source = $common_functions->backquote($source_db) . '.' . $common_functions->backquote($source_table); + $source = PMA_Util::backquote($source_db) . '.' . PMA_Util::backquote($source_table); if (! isset($target_db) || ! strlen($target_db)) { $target_db = $source_db; } @@ -770,7 +770,7 @@ class PMA_Table // when moving table from replicated one to not replicated one PMA_DBI_select_db($target_db); - $target = $common_functions->backquote($target_db) . '.' . $common_functions->backquote($target_table); + $target = PMA_Util::backquote($target_db) . '.' . PMA_Util::backquote($target_table); // do not create the table if dataonly if ($what != 'dataonly') { @@ -798,7 +798,7 @@ class PMA_Table $i = 0; if (empty($analyzed_sql[0]['create_table_fields'])) { // this is not a CREATE TABLE, so find the first VIEW - $target_for_view = $common_functions->backquote($target_db); + $target_for_view = PMA_Util::backquote($target_db); while (true) { if ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'VIEW' @@ -842,7 +842,7 @@ class PMA_Table // and change them to the target db, ensuring we stay into // the $parsed_sql limits $last = $parsed_sql['len'] - 1; - $backquoted_source_db = $common_functions->backquote($source_db); + $backquoted_source_db = PMA_Util::backquote($source_db); for (++$i; $i <= $last; $i++) { if ($parsed_sql[$i]['type'] == $table_delimiter && $parsed_sql[$i]['data'] == $backquoted_source_db @@ -869,8 +869,8 @@ class PMA_Table $drop_query = 'DROP TABLE'; } $drop_query .= ' IF EXISTS ' - . $common_functions->backquote($target_db) . '.' - . $common_functions->backquote($target_table); + . PMA_Util::backquote($target_db) . '.' + . PMA_Util::backquote($target_table); PMA_DBI_query($drop_query); $GLOBALS['sql_query'] .= "\n" . $drop_query . ';'; @@ -982,24 +982,24 @@ class PMA_Table // Get all comments and MIME-Types for current table $comments_copy_query = 'SELECT column_name, comment' . ($GLOBALS['cfgRelation']['mimework'] ? ', mimetype, transformation, transformation_options' : '') . ' - FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['column_info']) . ' + FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['column_info']) . ' WHERE - db_name = \'' . $common_functions->sqlAddSlashes($source_db) . '\' AND - table_name = \'' . $common_functions->sqlAddSlashes($source_table) . '\''; + db_name = \'' . PMA_Util::sqlAddSlashes($source_db) . '\' AND + table_name = \'' . PMA_Util::sqlAddSlashes($source_table) . '\''; $comments_copy_rs = PMA_queryAsControlUser($comments_copy_query); // Write every comment as new copied entry. [MIME] while ($comments_copy_row = PMA_DBI_fetch_assoc($comments_copy_rs)) { - $new_comment_query = 'REPLACE INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['column_info']) + $new_comment_query = 'REPLACE INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['column_info']) . ' (db_name, table_name, column_name, comment' . ($GLOBALS['cfgRelation']['mimework'] ? ', mimetype, transformation, transformation_options' : '') . ') ' . ' VALUES(' - . '\'' . $common_functions->sqlAddSlashes($target_db) . '\',' - . '\'' . $common_functions->sqlAddSlashes($target_table) . '\',' - . '\'' . $common_functions->sqlAddSlashes($comments_copy_row['column_name']) . '\'' - . ($GLOBALS['cfgRelation']['mimework'] ? ',\'' . $common_functions->sqlAddSlashes($comments_copy_row['comment']) . '\',' - . '\'' . $common_functions->sqlAddSlashes($comments_copy_row['mimetype']) . '\',' - . '\'' . $common_functions->sqlAddSlashes($comments_copy_row['transformation']) . '\',' - . '\'' . $common_functions->sqlAddSlashes($comments_copy_row['transformation_options']) . '\'' : '') + . '\'' . PMA_Util::sqlAddSlashes($target_db) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($target_table) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($comments_copy_row['column_name']) . '\'' + . ($GLOBALS['cfgRelation']['mimework'] ? ',\'' . PMA_Util::sqlAddSlashes($comments_copy_row['comment']) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($comments_copy_row['mimetype']) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($comments_copy_row['transformation']) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($comments_copy_row['transformation_options']) . '\'' : '') . ')'; PMA_queryAsControlUser($new_comment_query); } // end while diff --git a/libraries/TableSearch.class.php b/libraries/TableSearch.class.php index 8f36f53500..048ec5e147 100644 --- a/libraries/TableSearch.class.php +++ b/libraries/TableSearch.class.php @@ -465,10 +465,10 @@ EOT; $parens_close = ''; } $enum_where = '\'' - . $common_functions->sqlAddSlashes($criteriaValues[0]) . '\''; + . PMA_Util::sqlAddSlashes($criteriaValues[0]) . '\''; for ($e = 1; $e < $enum_selected_count; $e++) { $enum_where .= ', \'' - . $common_functions->sqlAddSlashes($criteriaValues[$e]) . '\''; + . PMA_Util::sqlAddSlashes($criteriaValues[$e]) . '\''; } return ' ' . $func_type . ' ' . $parens_open @@ -595,7 +595,7 @@ EOT; // quote values one by one $values = explode(',', $criteriaValues); foreach ($values as &$value) { - $value = $quot . $common_functions->sqlAddSlashes(trim($value)) + $value = $quot . PMA_Util::sqlAddSlashes(trim($value)) . $quot; } @@ -609,7 +609,7 @@ EOT; } } else { $where = $backquoted_name . ' ' . $func_type . ' ' . $quot - . $common_functions->sqlAddSlashes($criteriaValues) . $quot; + . PMA_Util::sqlAddSlashes($criteriaValues) . $quot; } } // end if diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php index fd4c19cd34..204cf61387 100644 --- a/libraries/Tracker.class.php +++ b/libraries/Tracker.class.php @@ -94,8 +94,8 @@ class PMA_Tracker static protected function init() { - self::$pma_table = $common_functions->backquote($GLOBALS['cfg']['Server']['pmadb']) .".". - $common_functions->backquote($GLOBALS['cfg']['Server']['tracking']); + self::$pma_table = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) .".". + PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']); self::$add_drop_table = $GLOBALS['cfg']['Server']['tracking_add_drop_table']; @@ -212,8 +212,8 @@ class PMA_Tracker } $sql_query = " SELECT tracking_active FROM " . self::$pma_table . - " WHERE db_name = '" . $common_functions->sqlAddSlashes($dbname) . "' " . - " AND table_name = '" . $common_functions->sqlAddSlashes($tablename) . "' " . + " WHERE db_name = '" . PMA_Util::sqlAddSlashes($dbname) . "' " . + " AND table_name = '" . PMA_Util::sqlAddSlashes($tablename) . "' " . " ORDER BY version DESC"; $row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query)); @@ -298,13 +298,13 @@ class PMA_Tracker if (self::$add_drop_table == true && $is_view == false) { $create_sql .= self::getLogComment() - . 'DROP TABLE IF EXISTS ' . $common_functions->backquote($tablename) . ";\n"; + . 'DROP TABLE IF EXISTS ' . PMA_Util::backquote($tablename) . ";\n"; } if (self::$add_drop_view == true && $is_view == true) { $create_sql .= self::getLogComment() - . 'DROP VIEW IF EXISTS ' . $common_functions->backquote($tablename) . ";\n"; + . 'DROP VIEW IF EXISTS ' . PMA_Util::backquote($tablename) . ";\n"; } $create_sql .= self::getLogComment() . @@ -325,15 +325,15 @@ class PMA_Tracker "tracking " . ") " . "values ( - '" . $common_functions->sqlAddSlashes($dbname) . "', - '" . $common_functions->sqlAddSlashes($tablename) . "', - '" . $common_functions->sqlAddSlashes($version) . "', - '" . $common_functions->sqlAddSlashes($date) . "', - '" . $common_functions->sqlAddSlashes($date) . "', - '" . $common_functions->sqlAddSlashes($snapshot) . "', - '" . $common_functions->sqlAddSlashes($create_sql) . "', - '" . $common_functions->sqlAddSlashes("\n") . "', - '" . $common_functions->sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )"; + '" . PMA_Util::sqlAddSlashes($dbname) . "', + '" . PMA_Util::sqlAddSlashes($tablename) . "', + '" . PMA_Util::sqlAddSlashes($version) . "', + '" . PMA_Util::sqlAddSlashes($date) . "', + '" . PMA_Util::sqlAddSlashes($date) . "', + '" . PMA_Util::sqlAddSlashes($snapshot) . "', + '" . PMA_Util::sqlAddSlashes($create_sql) . "', + '" . PMA_Util::sqlAddSlashes("\n") . "', + '" . PMA_Util::sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )"; $result = PMA_queryAsControlUser($sql_query); @@ -362,9 +362,9 @@ class PMA_Tracker $sql_query = "/*NOTRACK*/\n" . "DELETE FROM " . self::$pma_table . " WHERE `db_name` = '" - . $common_functions->sqlAddSlashes($dbname) . "'" + . PMA_Util::sqlAddSlashes($dbname) . "'" . " AND `table_name` = '" - . $common_functions->sqlAddSlashes($tablename) . "'"; + . PMA_Util::sqlAddSlashes($tablename) . "'"; $result = PMA_queryAsControlUser($sql_query); return $result; @@ -399,7 +399,7 @@ class PMA_Tracker if (self::$add_drop_database == true) { $create_sql .= self::getLogComment() - . 'DROP DATABASE IF EXISTS ' . $common_functions->backquote($dbname) . ";\n"; + . 'DROP DATABASE IF EXISTS ' . PMA_Util::backquote($dbname) . ";\n"; } $create_sql .= self::getLogComment() . $query; @@ -418,15 +418,15 @@ class PMA_Tracker "tracking " . ") " . "values ( - '" . $common_functions->sqlAddSlashes($dbname) . "', - '" . $common_functions->sqlAddSlashes('') . "', - '" . $common_functions->sqlAddSlashes($version) . "', - '" . $common_functions->sqlAddSlashes($date) . "', - '" . $common_functions->sqlAddSlashes($date) . "', - '" . $common_functions->sqlAddSlashes('') . "', - '" . $common_functions->sqlAddSlashes($create_sql) . "', - '" . $common_functions->sqlAddSlashes("\n") . "', - '" . $common_functions->sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )"; + '" . PMA_Util::sqlAddSlashes($dbname) . "', + '" . PMA_Util::sqlAddSlashes('') . "', + '" . PMA_Util::sqlAddSlashes($version) . "', + '" . PMA_Util::sqlAddSlashes($date) . "', + '" . PMA_Util::sqlAddSlashes($date) . "', + '" . PMA_Util::sqlAddSlashes('') . "', + '" . PMA_Util::sqlAddSlashes($create_sql) . "', + '" . PMA_Util::sqlAddSlashes("\n") . "', + '" . PMA_Util::sqlAddSlashes(self::_transformTrackingSet($tracking_set)) . "' )"; $result = PMA_queryAsControlUser($sql_query); @@ -453,9 +453,9 @@ class PMA_Tracker $common_functions= PMA_CommonFunctions::getInstance(); $sql_query = " UPDATE " . self::$pma_table . " SET `tracking_active` = '" . $new_state . "' " . - " WHERE `db_name` = '" . $common_functions->sqlAddSlashes($dbname) . "' " . - " AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "' " . - " AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' "; + " WHERE `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' " . + " AND `table_name` = '" . PMA_Util::sqlAddSlashes($tablename) . "' " . + " AND `version` = '" . PMA_Util::sqlAddSlashes($version) . "' "; $result = PMA_queryAsControlUser($sql_query); @@ -492,7 +492,7 @@ class PMA_Tracker if (is_array($new_data)) { foreach ($new_data as $data) { $new_data_processed .= '# log ' . $date . ' ' . $data['username'] - . $common_functions->sqlAddSlashes($data['statement']) . "\n"; + . PMA_Util::sqlAddSlashes($data['statement']) . "\n"; } } else { $new_data_processed = $new_data; @@ -500,9 +500,9 @@ class PMA_Tracker $sql_query = " UPDATE " . self::$pma_table . " SET `" . $save_to . "` = '" . $new_data_processed . "' " . - " WHERE `db_name` = '" . $common_functions->sqlAddSlashes($dbname) . "' " . - " AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "' " . - " AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' "; + " WHERE `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' " . + " AND `table_name` = '" . PMA_Util::sqlAddSlashes($tablename) . "' " . + " AND `version` = '" . PMA_Util::sqlAddSlashes($version) . "' "; $result = PMA_queryAsControlUser($sql_query); @@ -559,8 +559,8 @@ class PMA_Tracker { $sql_query = " SELECT MAX(version) FROM " . self::$pma_table . - " WHERE `db_name` = '" . $common_functions->sqlAddSlashes($dbname) . "' " . - " AND `table_name` = '" . $common_functions->sqlAddSlashes($tablename) . "' "; + " WHERE `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' " . + " AND `table_name` = '" . PMA_Util::sqlAddSlashes($tablename) . "' "; if ($statement != "") { $sql_query .= PMA_DRIZZLE @@ -592,12 +592,12 @@ class PMA_Tracker self::init(); } $sql_query = " SELECT * FROM " . self::$pma_table . - " WHERE `db_name` = '" . $common_functions->sqlAddSlashes($dbname) . "' "; + " WHERE `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' "; if (! empty($tablename)) { $sql_query .= " AND `table_name` = '" - . $common_functions->sqlAddSlashes($tablename) ."' "; + . PMA_Util::sqlAddSlashes($tablename) ."' "; } - $sql_query .= " AND `version` = '" . $common_functions->sqlAddSlashes($version) ."' ". + $sql_query .= " AND `version` = '" . PMA_Util::sqlAddSlashes($version) ."' ". " ORDER BY `version` DESC LIMIT 1"; $mixed = PMA_DBI_fetch_assoc(PMA_queryAsControlUser($sql_query)); @@ -999,16 +999,16 @@ class PMA_Tracker // Mark it as untouchable $sql_query = " /*NOTRACK*/\n" . " UPDATE " . self::$pma_table - . " SET " . $common_functions->backquote($save_to) - . " = CONCAT( " . $common_functions->backquote($save_to) . ",'\n" - . $common_functions->sqlAddSlashes($query) . "') ," + . " SET " . PMA_Util::backquote($save_to) + . " = CONCAT( " . PMA_Util::backquote($save_to) . ",'\n" + . PMA_Util::sqlAddSlashes($query) . "') ," . " `date_updated` = '" . $date . "' "; // If table was renamed we have to change // the tablename attribute in pma_tracking too if ($result['identifier'] == 'RENAME TABLE') { $sql_query .= ', `table_name` = \'' - . $common_functions->sqlAddSlashes($result['tablename_after_rename']) + . PMA_Util::sqlAddSlashes($result['tablename_after_rename']) . '\' '; } @@ -1019,9 +1019,9 @@ class PMA_Tracker // we want to track $sql_query .= " WHERE FIND_IN_SET('" . $result['identifier'] . "',tracking) > 0" . - " AND `db_name` = '" . $common_functions->sqlAddSlashes($dbname) . "' " . - " AND `table_name` = '" . $common_functions->sqlAddSlashes($result['tablename']) . "' " . - " AND `version` = '" . $common_functions->sqlAddSlashes($version) . "' "; + " AND `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' " . + " AND `table_name` = '" . PMA_Util::sqlAddSlashes($result['tablename']) . "' " . + " AND `version` = '" . PMA_Util::sqlAddSlashes($version) . "' "; $result = PMA_queryAsControlUser($sql_query); } diff --git a/libraries/bookmark.lib.php b/libraries/bookmark.lib.php index 9d69d3a256..9f3d52f4f0 100644 --- a/libraries/bookmark.lib.php +++ b/libraries/bookmark.lib.php @@ -60,18 +60,18 @@ function PMA_Bookmark_getList($db) return array(); } - $query = 'SELECT label, id FROM '. $common_functions->backquote($cfgBookmark['db']) - . '.' . $common_functions->backquote($cfgBookmark['table']) - . ' WHERE dbase = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND user = \'' . $common_functions->sqlAddSlashes($cfgBookmark['user']) . '\'' + $query = 'SELECT label, id FROM '. PMA_Util::backquote($cfgBookmark['db']) + . '.' . PMA_Util::backquote($cfgBookmark['table']) + . ' WHERE dbase = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND user = \'' . PMA_Util::sqlAddSlashes($cfgBookmark['user']) . '\'' . ' ORDER BY label'; $per_user = PMA_DBI_fetch_result( $query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE ); - $query = 'SELECT label, id FROM '. $common_functions->backquote($cfgBookmark['db']) - . '.' . $common_functions->backquote($cfgBookmark['table']) - . ' WHERE dbase = \'' . $common_functions->sqlAddSlashes($db) . '\'' + $query = 'SELECT label, id FROM '. PMA_Util::backquote($cfgBookmark['db']) + . '.' . PMA_Util::backquote($cfgBookmark['table']) + . ' WHERE dbase = \'' . PMA_Util::sqlAddSlashes($db) . '\'' . ' AND user = \'\'' . ' ORDER BY label'; $global = PMA_DBI_fetch_result( @@ -118,19 +118,19 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal return ''; } - $query = 'SELECT query FROM ' . $common_functions->backquote($cfgBookmark['db']) - . '.' . $common_functions->backquote($cfgBookmark['table']) - . ' WHERE dbase = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $query = 'SELECT query FROM ' . PMA_Util::backquote($cfgBookmark['db']) + . '.' . PMA_Util::backquote($cfgBookmark['table']) + . ' WHERE dbase = \'' . PMA_Util::sqlAddSlashes($db) . '\''; if (!$action_bookmark_all) { - $query .= ' AND (user = \'' . $common_functions->sqlAddSlashes($cfgBookmark['user']) . '\''; + $query .= ' AND (user = \'' . PMA_Util::sqlAddSlashes($cfgBookmark['user']) . '\''; if (!$exact_user_match) { $query .= ' OR user = \'\''; } $query .= ')'; } - $query .= ' AND ' . $common_functions->backquote($id_field) . ' = ' . $id; + $query .= ' AND ' . PMA_Util::backquote($id_field) . ' = ' . $id; return PMA_DBI_fetch_value($query, 0, 0, $controllink); } // end of the 'PMA_Bookmark_get()' function @@ -158,13 +158,13 @@ function PMA_Bookmark_save($fields, $all_users = false) return false; } - $query = 'INSERT INTO ' . $common_functions->backquote($cfgBookmark['db']) - . '.' . $common_functions->backquote($cfgBookmark['table']) + $query = 'INSERT INTO ' . PMA_Util::backquote($cfgBookmark['db']) + . '.' . PMA_Util::backquote($cfgBookmark['table']) . ' (id, dbase, user, query, label)' - . ' VALUES (NULL, \'' . $common_functions->sqlAddSlashes($fields['dbase']) . '\', ' - . '\'' . ($all_users ? '' : $common_functions->sqlAddSlashes($fields['user'])) . '\', ' - . '\'' . $common_functions->sqlAddSlashes(urldecode($fields['query'])) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($fields['label']) . '\')'; + . ' VALUES (NULL, \'' . PMA_Util::sqlAddSlashes($fields['dbase']) . '\', ' + . '\'' . ($all_users ? '' : PMA_Util::sqlAddSlashes($fields['user'])) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes(urldecode($fields['query'])) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($fields['label']) . '\')'; return PMA_DBI_query($query, $controllink); } // end of the 'PMA_Bookmark_save()' function @@ -191,9 +191,9 @@ function PMA_Bookmark_delete($db, $id) return false; } - $query = 'DELETE FROM ' . $common_functions->backquote($cfgBookmark['db']) - . '.' . $common_functions->backquote($cfgBookmark['table']) - . ' WHERE (user = \'' . $common_functions->sqlAddSlashes($cfgBookmark['user']) . '\'' + $query = 'DELETE FROM ' . PMA_Util::backquote($cfgBookmark['db']) + . '.' . PMA_Util::backquote($cfgBookmark['table']) + . ' WHERE (user = \'' . PMA_Util::sqlAddSlashes($cfgBookmark['user']) . '\'' . ' OR user = \'\')' . ' AND id = ' . $id; return PMA_DBI_try_query($query, $controllink); diff --git a/libraries/build_html_for_db.lib.php b/libraries/build_html_for_db.lib.php index df685b0936..12b27d2517 100644 --- a/libraries/build_html_for_db.lib.php +++ b/libraries/build_html_for_db.lib.php @@ -111,11 +111,11 @@ function PMA_buildHtmlForDb( $column_order[$stat_name]['footer'] += $current[$stat_name]; } if ($stat['format'] === 'byte') { - list($value, $unit) = $common_functions->formatByteDown( + list($value, $unit) = PMA_Util::formatByteDown( $current[$stat_name], 3, 1 ); } elseif ($stat['format'] === 'number') { - $value = $common_functions->formatNumber( + $value = PMA_Util::formatNumber( $current[$stat_name], 0 ); } else { @@ -145,7 +145,7 @@ function PMA_buildHtmlForDb( $replication_info[$type]['Ignore_DB'] ); if (strlen($key) > 0) { - $out .= $common_functions->getIcon('s_cancel.png', __('Not replicated')); + $out .= PMA_Util::getIcon('s_cancel.png', __('Not replicated')); } else { $key = array_search( $current["SCHEMA_NAME"], $replication_info[$type]['Do_DB'] @@ -156,7 +156,7 @@ function PMA_buildHtmlForDb( && count($replication_info[$type]['Do_DB']) == 1) ) { // if ($key != null) did not work for index "0" - $out .= $common_functions->getIcon('s_success.png', __('Replicated')); + $out .= PMA_Util::getIcon('s_success.png', __('Replicated')); } } @@ -178,7 +178,7 @@ function PMA_buildHtmlForDb( ) . '">' . ' ' - . $common_functions->getIcon('s_rights.png', __('Check Privileges')) + . PMA_Util::getIcon('s_rights.png', __('Check Privileges')) . '</a></td>'; } return array($column_order, $out); diff --git a/libraries/check_user_privileges.lib.php b/libraries/check_user_privileges.lib.php index 74137e5a16..5cc63047ee 100644 --- a/libraries/check_user_privileges.lib.php +++ b/libraries/check_user_privileges.lib.php @@ -35,13 +35,13 @@ $GLOBALS['is_superuser'] = PMA_isSuperuser(); function PMA_analyseShowGrant() { - if ($common_functions->cacheExists('is_create_db_priv', true)) { - $GLOBALS['is_create_db_priv'] = $common_functions->cacheGet('is_create_db_priv', true); - $GLOBALS['is_process_priv'] = $common_functions->cacheGet('is_process_priv', true); - $GLOBALS['is_reload_priv'] = $common_functions->cacheGet('is_reload_priv', true); - $GLOBALS['db_to_create'] = $common_functions->cacheGet('db_to_create', true); + if (PMA_Util::cacheExists('is_create_db_priv', true)) { + $GLOBALS['is_create_db_priv'] = PMA_Util::cacheGet('is_create_db_priv', true); + $GLOBALS['is_process_priv'] = PMA_Util::cacheGet('is_process_priv', true); + $GLOBALS['is_reload_priv'] = PMA_Util::cacheGet('is_reload_priv', true); + $GLOBALS['db_to_create'] = PMA_Util::cacheGet('db_to_create', true); $GLOBALS['dbs_where_create_table_allowed'] - = $common_functions->cacheGet('dbs_where_create_table_allowed', true); + = PMA_Util::cacheGet('dbs_where_create_table_allowed', true); return; } @@ -69,7 +69,7 @@ function PMA_analyseShowGrant() strpos($row[0], '.', $db_name_offset) - $db_name_offset ); $show_grants_dbname - = $common_functions->unQuote($show_grants_dbname, '`'); + = PMA_Util::unQuote($show_grants_dbname, '`'); $show_grants_str = substr($row[0], 6, (strpos($row[0], ' ON ') - 6)); if ($show_grants_str == 'RELOAD') { @@ -98,7 +98,7 @@ function PMA_analyseShowGrant() // this array may contain wildcards $GLOBALS['dbs_where_create_table_allowed'][] = $show_grants_dbname; - $dbname_to_test = $common_functions->backquote($show_grants_dbname); + $dbname_to_test = PMA_Util::backquote($show_grants_dbname); if ($GLOBALS['is_create_db_priv']) { // no need for any more tests if we already know this @@ -140,11 +140,11 @@ function PMA_analyseShowGrant() // must also cacheUnset() them in // libraries/plugins/auth/AuthenticationCookie.class.php - $common_functions->cacheSet('is_create_db_priv', $GLOBALS['is_create_db_priv'], true); - $common_functions->cacheSet('is_process_priv', $GLOBALS['is_process_priv'], true); - $common_functions->cacheSet('is_reload_priv', $GLOBALS['is_reload_priv'], true); - $common_functions->cacheSet('db_to_create', $GLOBALS['db_to_create'], true); - $common_functions->cacheSet( + PMA_Util::cacheSet('is_create_db_priv', $GLOBALS['is_create_db_priv'], true); + PMA_Util::cacheSet('is_process_priv', $GLOBALS['is_process_priv'], true); + PMA_Util::cacheSet('is_reload_priv', $GLOBALS['is_reload_priv'], true); + PMA_Util::cacheSet('db_to_create', $GLOBALS['db_to_create'], true); + PMA_Util::cacheSet( 'dbs_where_create_table_allowed', $GLOBALS['dbs_where_create_table_allowed'], true diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 2a745709c3..ff7b792fe2 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -404,13 +404,13 @@ function PMA_DBI_get_tables_full($database, $table = false, if ($table) { if (true === $tbl_is_group) { $sql_where_table = 'AND t.`TABLE_NAME` LIKE \'' - . $common_functions->escapeMysqlWildcards($common_functions->sqlAddSlashes($table)) . '%\''; + . PMA_Util::escapeMysqlWildcards(PMA_Util::sqlAddSlashes($table)) . '%\''; } elseif ('comment' === $tbl_is_group) { $sql_where_table = 'AND t.`TABLE_COMMENT` LIKE \'' - . $common_functions->escapeMysqlWildcards($common_functions->sqlAddSlashes($table)) . '%\''; + . PMA_Util::escapeMysqlWildcards(PMA_Util::sqlAddSlashes($table)) . '%\''; } else { $sql_where_table = 'AND t.`TABLE_NAME` = \'' - . $common_functions->sqlAddSlashes($table) . '\''; + . PMA_Util::sqlAddSlashes($table) . '\''; } } else { $sql_where_table = ''; @@ -426,7 +426,7 @@ function PMA_DBI_get_tables_full($database, $table = false, $this_databases = array_map('sqlAddSlashes', $databases); if (PMA_DRIZZLE) { - $engine_info = $common_functions->cacheGet('drizzle_engines', true); + $engine_info = PMA_Util::cacheGet('drizzle_engines', true); $stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false"; if (isset($engine_info['InnoDB']) && $engine_info['InnoDB']['module_library'] == 'innobase' @@ -549,13 +549,13 @@ function PMA_DBI_get_tables_full($database, $table = false, foreach ($databases as $each_database) { if ($table || (true === $tbl_is_group)) { $sql = 'SHOW TABLE STATUS FROM ' - . $common_functions->backquote($each_database) + . PMA_Util::backquote($each_database) .' LIKE \'' - . $common_functions->escapeMysqlWildcards($common_functions->sqlAddSlashes($table, true)) + . PMA_Util::escapeMysqlWildcards(PMA_Util::sqlAddSlashes($table, true)) . '%\''; } else { $sql = 'SHOW TABLE STATUS FROM ' - . $common_functions->backquote($each_database); + . PMA_Util::backquote($each_database); } $useStatusCache = false; @@ -817,7 +817,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, // get table information from information_schema if ($database) { $sql_where_schema = 'WHERE `SCHEMA_NAME` LIKE \'' - . $common_functions->sqlAddSlashes($database) . '\''; + . PMA_Util::sqlAddSlashes($database) . '\''; } else { $sql_where_schema = ''; } @@ -838,7 +838,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, $sql .= ' FROM data_dictionary.SCHEMAS s'; if ($force_stats) { - $engine_info = $common_functions->cacheGet('drizzle_engines', true); + $engine_info = PMA_Util::cacheGet('drizzle_engines', true); $stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false"; if (isset($engine_info['InnoDB']) && $engine_info['InnoDB']['module_library'] == 'innobase' @@ -855,7 +855,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, } $sql .= $sql_where_schema . ' GROUP BY s.SCHEMA_NAME - ORDER BY ' . $common_functions->backquote($sort_by) . ' ' . $sort_order + ORDER BY ' . PMA_Util::backquote($sort_by) . ' ' . $sort_order . $limit; } else { $sql = 'SELECT @@ -881,7 +881,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, } $sql .= $sql_where_schema . ' GROUP BY BINARY s.SCHEMA_NAME - ORDER BY BINARY ' . $common_functions->backquote($sort_by) . ' ' . $sort_order + ORDER BY BINARY ' . PMA_Util::backquote($sort_by) . ' ' . $sort_order . $limit; } @@ -889,7 +889,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, $mysql_error = PMA_DBI_getError($link); if (! count($databases) && $GLOBALS['errno']) { - $common_functions->mysqlDie($mysql_error, $sql); + PMA_Util::mysqlDie($mysql_error, $sql); } // display only databases also in official database list @@ -929,7 +929,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, $res = PMA_DBI_query( 'SHOW TABLE STATUS FROM ' - . $common_functions->backquote($database_name) . ';' + . PMA_Util::backquote($database_name) . ';' ); while ($row = PMA_DBI_fetch_assoc($res)) { @@ -1004,19 +1004,19 @@ function PMA_DBI_get_columns_full($database = null, $table = null, // get columns information from information_schema if (null !== $database) { $sql_wheres[] = '`TABLE_SCHEMA` = \'' - . $common_functions->sqlAddSlashes($database) . '\' '; + . PMA_Util::sqlAddSlashes($database) . '\' '; } else { $array_keys[] = 'TABLE_SCHEMA'; } if (null !== $table) { $sql_wheres[] = '`TABLE_NAME` = \'' - . $common_functions->sqlAddSlashes($table) . '\' '; + . PMA_Util::sqlAddSlashes($table) . '\' '; } else { $array_keys[] = 'TABLE_NAME'; } if (null !== $column) { $sql_wheres[] = '`COLUMN_NAME` = \'' - . $common_functions->sqlAddSlashes($column) . '\' '; + . PMA_Util::sqlAddSlashes($column) . '\' '; } else { $array_keys[] = 'COLUMN_NAME'; } @@ -1089,9 +1089,9 @@ function PMA_DBI_get_columns_full($database = null, $table = null, } $sql = 'SHOW FULL COLUMNS FROM ' - . $common_functions->backquote($database) . '.' . $common_functions->backquote($table); + . PMA_Util::backquote($database) . '.' . PMA_Util::backquote($table); if (null !== $column) { - $sql .= " LIKE '" . $common_functions->sqlAddSlashes($column, true) . "'"; + $sql .= " LIKE '" . PMA_Util::sqlAddSlashes($column, true) . "'"; } $columns = PMA_DBI_fetch_result($sql, 'Field', null, $link); @@ -1206,15 +1206,15 @@ function PMA_DBI_get_columns_sql($database, $table, $column = null, $full = fals NULL AS `Privileges`, column_comment AS `Comment`" : '') . " FROM data_dictionary.columns - WHERE table_schema = '" . $common_functions->sqlAddSlashes($database) . "' - AND table_name = '" . $common_functions->sqlAddSlashes($table) . "' + WHERE table_schema = '" . PMA_Util::sqlAddSlashes($database) . "' + AND table_name = '" . PMA_Util::sqlAddSlashes($table) . "' " . (($column != null) ? " - AND column_name = '" . $common_functions->sqlAddSlashes($column) . "'" : ''); + AND column_name = '" . PMA_Util::sqlAddSlashes($column) . "'" : ''); // ORDER BY ordinal_position } else { $sql = 'SHOW ' . ($full ? 'FULL' : '') . ' COLUMNS - FROM ' . $common_functions->backquote($database) . '.' . $common_functions->backquote($table) - . (($column != null) ? "LIKE '" . $common_functions->sqlAddSlashes($column, true) . "'" : ''); + FROM ' . PMA_Util::backquote($database) . '.' . PMA_Util::backquote($table) + . (($column != null) ? "LIKE '" . PMA_Util::sqlAddSlashes($column, true) . "'" : ''); } return $sql; } @@ -1262,8 +1262,8 @@ function PMA_DBI_get_columns($database, $table, $column = null, $full = false, FROM data_dictionary.indexes i JOIN data_dictionary.index_parts p USING (table_schema, table_name) - WHERE i.table_schema = '" . $common_functions->sqlAddSlashes($database) . "' - AND i.table_name = '" . $common_functions->sqlAddSlashes($table) . "' + WHERE i.table_schema = '" . PMA_Util::sqlAddSlashes($database) . "' + AND i.table_name = '" . PMA_Util::sqlAddSlashes($table) . "' AND i.is_unique AND NOT i.is_nullable"; $fs = PMA_DBI_fetch_result($sql, 'index_name', null, $link); @@ -1330,12 +1330,12 @@ function PMA_DBI_get_table_indexes_sql($database, $table, $where = null) FROM data_dictionary.index_parts ip LEFT JOIN data_dictionary.indexes i USING (table_schema, table_name, index_name) - WHERE table_schema = '" . $common_functions->sqlAddSlashes($database) . "' - AND table_name = '" . $common_functions->sqlAddSlashes($table) . "' + WHERE table_schema = '" . PMA_Util::sqlAddSlashes($database) . "' + AND table_name = '" . PMA_Util::sqlAddSlashes($table) . "' "; } else { - $sql = 'SHOW INDEXES FROM ' . $common_functions->backquote($database) . '.' - . $common_functions->backquote($table); + $sql = 'SHOW INDEXES FROM ' . PMA_Util::backquote($database) . '.' + . PMA_Util::backquote($table); } if ($where) { $sql .= (PMA_DRIZZLE ? ' AND (' : ' WHERE (') . $where . ')'; @@ -1411,22 +1411,22 @@ function PMA_DBI_postConnect($link, $is_controluser = false) { if (! defined('PMA_MYSQL_INT_VERSION')) { - if ($common_functions->cacheExists('PMA_MYSQL_INT_VERSION', true)) { + if (PMA_Util::cacheExists('PMA_MYSQL_INT_VERSION', true)) { define( 'PMA_MYSQL_INT_VERSION', - $common_functions->cacheGet('PMA_MYSQL_INT_VERSION', true) + PMA_Util::cacheGet('PMA_MYSQL_INT_VERSION', true) ); define( 'PMA_MYSQL_MAJOR_VERSION', - $common_functions->cacheGet('PMA_MYSQL_MAJOR_VERSION', true) + PMA_Util::cacheGet('PMA_MYSQL_MAJOR_VERSION', true) ); define( 'PMA_MYSQL_STR_VERSION', - $common_functions->cacheGet('PMA_MYSQL_STR_VERSION', true) + PMA_Util::cacheGet('PMA_MYSQL_STR_VERSION', true) ); define( 'PMA_MYSQL_VERSION_COMMENT', - $common_functions->cacheGet('PMA_MYSQL_VERSION_COMMENT', true) + PMA_Util::cacheGet('PMA_MYSQL_VERSION_COMMENT', true) ); } else { $version = PMA_DBI_fetch_single_row( @@ -1452,22 +1452,22 @@ function PMA_DBI_postConnect($link, $is_controluser = false) define('PMA_MYSQL_STR_VERSION', '5.00.15'); define('PMA_MYSQL_VERSION_COMMENT', ''); } - $common_functions->cacheSet( + PMA_Util::cacheSet( 'PMA_MYSQL_INT_VERSION', PMA_MYSQL_INT_VERSION, true ); - $common_functions->cacheSet( + PMA_Util::cacheSet( 'PMA_MYSQL_MAJOR_VERSION', PMA_MYSQL_MAJOR_VERSION, true ); - $common_functions->cacheSet( + PMA_Util::cacheSet( 'PMA_MYSQL_STR_VERSION', PMA_MYSQL_STR_VERSION, true ); - $common_functions->cacheSet( + PMA_Util::cacheSet( 'PMA_MYSQL_VERSION_COMMENT', PMA_MYSQL_VERSION_COMMENT, true @@ -1483,7 +1483,7 @@ function PMA_DBI_postConnect($link, $is_controluser = false) if (! empty($GLOBALS['collation_connection'])) { PMA_DBI_query("SET CHARACTER SET 'utf8';", $link, PMA_DBI_QUERY_STORE); $set_collation_con_query = "SET collation_connection = '" - . $common_functions->sqlAddSlashes($GLOBALS['collation_connection']) . "';"; + . PMA_Util::sqlAddSlashes($GLOBALS['collation_connection']) . "';"; PMA_DBI_query( $set_collation_con_query, $link, @@ -1499,7 +1499,7 @@ function PMA_DBI_postConnect($link, $is_controluser = false) } // Cache plugin list for Drizzle - if (PMA_DRIZZLE && !$common_functions->cacheExists('drizzle_engines', true)) { + if (PMA_DRIZZLE && !PMA_Util::cacheExists('drizzle_engines', true)) { $sql = "SELECT p.plugin_name, m.module_library FROM data_dictionary.plugins p JOIN data_dictionary.modules m USING (module_name) @@ -1507,7 +1507,7 @@ function PMA_DBI_postConnect($link, $is_controluser = false) AND p.plugin_name NOT IN ('FunctionEngine', 'schema') AND p.is_active = 'YES'"; $engines = PMA_DBI_fetch_result($sql, 'plugin_name', null, $link); - $common_functions->cacheSet('drizzle_engines', $engines, true); + PMA_Util::cacheSet('drizzle_engines', $engines, true); } } @@ -1811,8 +1811,8 @@ function PMA_DBI_get_warnings($link = null) function PMA_isSuperuser() { - if ($common_functions->cacheExists('is_superuser', true)) { - return $common_functions->cacheGet('is_superuser', true); + if (PMA_Util::cacheExists('is_superuser', true)) { + return PMA_Util::cacheGet('is_superuser', true); } // when connection failed we don't have a $userlink @@ -1832,12 +1832,12 @@ function PMA_isSuperuser() PMA_DBI_QUERY_STORE ); } - $common_functions->cacheSet('is_superuser', $r, true); + PMA_Util::cacheSet('is_superuser', $r, true); } else { - $common_functions->cacheSet('is_superuser', false, true); + PMA_Util::cacheSet('is_superuser', false, true); } - return $common_functions->cacheGet('is_superuser', true); + return PMA_Util::cacheGet('is_superuser', true); } /** @@ -1884,8 +1884,8 @@ function PMA_DBI_get_definition($db, $which, $name, $link = null) 'VIEW' => 'Create View' ); $query = 'SHOW CREATE ' . $which . ' ' - . $common_functions->backquote($db) . '.' - . $common_functions->backquote($name); + . PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($name); return(PMA_DBI_fetch_value($query, 0, $returned_field[$which])); } @@ -1915,16 +1915,16 @@ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//') . ', EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT' . ', EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER' . ' FROM information_schema.TRIGGERS' - . ' WHERE TRIGGER_SCHEMA= \'' . $common_functions->sqlAddSlashes($db) . '\''; + . ' WHERE TRIGGER_SCHEMA= \'' . PMA_Util::sqlAddSlashes($db) . '\''; if (! empty($table)) { $query .= " AND EVENT_OBJECT_TABLE = '" - . $common_functions->sqlAddSlashes($table) . "';"; + . PMA_Util::sqlAddSlashes($table) . "';"; } } else { - $query = "SHOW TRIGGERS FROM " . $common_functions->backquote($db); + $query = "SHOW TRIGGERS FROM " . PMA_Util::backquote($db); if (! empty($table)) { - $query .= " LIKE '" . $common_functions->sqlAddSlashes($table, true) . "';"; + $query .= " LIKE '" . PMA_Util::sqlAddSlashes($table, true) . "';"; } } @@ -1948,7 +1948,7 @@ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//') // do not prepend the schema name; this way, importing the // definition into another schema will work - $one_result['full_trigger_name'] = $common_functions->backquote( + $one_result['full_trigger_name'] = PMA_Util::backquote( $trigger['TRIGGER_NAME'] ); $one_result['drop'] = 'DROP TRIGGER IF EXISTS ' @@ -1957,7 +1957,7 @@ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//') . $one_result['full_trigger_name'] . ' ' . $trigger['ACTION_TIMING']. ' ' . $trigger['EVENT_MANIPULATION'] - . ' ON ' . $common_functions->backquote($trigger['EVENT_OBJECT_TABLE']) + . ' ON ' . PMA_Util::backquote($trigger['EVENT_OBJECT_TABLE']) . "\n" . ' FOR EACH ROW ' . $trigger['ACTION_STATEMENT'] . "\n" . $delimiter . "\n"; diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index 2474078213..2b7709f125 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -76,23 +76,23 @@ function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table) if (isset($table['Create_time']) && !empty($table['Create_time'])) { $tooltip_aliasname[$table['Name']] .= ', ' . __('Creation') . ': ' - . $common_functions->localisedDate(strtotime($table['Create_time'])); + . PMA_Util::localisedDate(strtotime($table['Create_time'])); } if (! empty($table['Update_time'])) { $tooltip_aliasname[$table['Name']] .= ', ' . __('Last update') . ': ' - . $common_functions->localisedDate(strtotime($table['Update_time'])); + . PMA_Util::localisedDate(strtotime($table['Update_time'])); } if (! empty($table['Check_time'])) { $tooltip_aliasname[$table['Name']] .= ', ' . __('Last check') . ': ' - . $common_functions->localisedDate(strtotime($table['Check_time'])); + . PMA_Util::localisedDate(strtotime($table['Check_time'])); } } -$common_functions->checkParameters(array('db')); +PMA_Util::checkParameters(array('db')); /** * @global bool whether to display extended stats @@ -118,7 +118,7 @@ $tables = array(); // only show tables matching the given groupname if (PMA_isValid($tbl_group) && !$cfg['ShowTooltipAliasTB']) { $tbl_group_sql = ' LIKE "' - . $common_functions->escapeMysqlWildcards($tbl_group) + . PMA_Util::escapeMysqlWildcards($tbl_group) . '%"'; } else { $tbl_group_sql = ''; @@ -132,7 +132,7 @@ if ($cfg['ShowTooltip']) { // Special speedup for newer MySQL Versions (in 4.0 format changed) if (true === $cfg['SkipLockedTables']) { $db_info_result = PMA_DBI_query( - 'SHOW OPEN TABLES FROM ' . $common_functions->backquote($db) . ';' + 'SHOW OPEN TABLES FROM ' . PMA_Util::backquote($db) . ';' ); // Blending out tables in use @@ -147,15 +147,15 @@ if (true === $cfg['SkipLockedTables']) { if (isset($sot_cache)) { $db_info_result = PMA_DBI_query( - 'SHOW TABLES FROM ' . $common_functions->backquote($db) . $tbl_group_sql . ';', + 'SHOW TABLES FROM ' . PMA_Util::backquote($db) . $tbl_group_sql . ';', null, PMA_DBI_QUERY_STORE ); if ($db_info_result && PMA_DBI_num_rows($db_info_result) > 0) { while ($tmp = PMA_DBI_fetch_row($db_info_result)) { if (! isset($sot_cache[$tmp[0]])) { $sts_result = PMA_DBI_query( - 'SHOW TABLE STATUS FROM ' . $common_functions->backquote($db) - . ' LIKE \'' . $common_functions->sqlAddSlashes($tmp[0], true) . '\';' + 'SHOW TABLE STATUS FROM ' . PMA_Util::backquote($db) + . ' LIKE \'' . PMA_Util::sqlAddSlashes($tmp[0], true) . '\';' ); $sts_tmp = PMA_DBI_fetch_assoc($sts_result); PMA_DBI_free_result($sts_result); diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php index cf41a8d985..bdb0681f6e 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -91,7 +91,7 @@ if (isset($_GET['sql_query'])) { echo '<div class="exportoptions" id="header">'; echo '<h2>'; -echo $common_functions->getImage('b_export.png', __('Export')); +echo PMA_Util::getImage('b_export.png', __('Export')); if ($export_type == 'server') { echo __('Exporting databases from the current server'); } elseif ($export_type == 'database') { @@ -209,7 +209,7 @@ if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { echo '<label for="checkbox_quick_dump_onserver">'; printf( __('Save on server in the directory <b>%s</b>'), - htmlspecialchars($common_functions->userDir($cfg['SaveDir'])) + htmlspecialchars(PMA_Util::userDir($cfg['SaveDir'])) ); echo '</label>'; echo '</li>'; @@ -246,7 +246,7 @@ if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { echo '<label for="checkbox_dump_onserver">'; printf( __('Save on server in the directory <b>%s</b>'), - htmlspecialchars($common_functions->userDir($cfg['SaveDir'])) + htmlspecialchars(PMA_Util::userDir($cfg['SaveDir'])) ); echo '</label>'; echo '</li>'; @@ -288,7 +288,7 @@ $msg->addParam( ); $msg->addParam('</a>', false); -echo $common_functions->showHint($msg); +echo PMA_Util::showHint($msg); echo '</label>'; echo '<input type="text" name="filename_template" id="filename_template" '; echo ' value="'; @@ -432,7 +432,7 @@ if (function_exists('PMA_set_enc_form')) { echo '<div class="exportoptions" id="submit">'; -echo $common_functions->getExternalBug( +echo PMA_Util::getExternalBug( __('SQL compatibility mode'), 'mysql', '50027', '14515' ); diff --git a/libraries/display_git_revision.lib.php b/libraries/display_git_revision.lib.php index a0e50b1b0c..cb32d81edf 100644 --- a/libraries/display_git_revision.lib.php +++ b/libraries/display_git_revision.lib.php @@ -66,7 +66,7 @@ function PMA_printGitRevision() . $branch . ',<br /> ' . sprintf( __('committed on %1$s by %2$s'), - $common_functions->localisedDate(strtotime($committer['date'])), + PMA_Util::localisedDate(strtotime($committer['date'])), '<a href="' . PMA_linkURL('mailto:' . $committer['email']) . '">' . htmlspecialchars($committer['name']) . '</a>' ) @@ -74,7 +74,7 @@ function PMA_printGitRevision() ? ', <br />' . sprintf( __('authored on %1$s by %2$s'), - $common_functions->localisedDate(strtotime($author['date'])), + PMA_Util::localisedDate(strtotime($author['date'])), '<a href="' . PMA_linkURL('mailto:' . $author['email']) . '">' . htmlspecialchars($author['name']) . '</a>' ) diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index 5e8a43c352..e62beecd92 100644 --- a/libraries/display_import.lib.php +++ b/libraries/display_import.lib.php @@ -138,7 +138,7 @@ if ($_SESSION[$SESSION_KEY]["handler"] != "UploadNoplugin") { <?php // reload the left sidebar when the import is finished $GLOBALS['reload'] = true; - echo $common_functions->getReloadNavigationScript(true); + echo PMA_Util::getReloadNavigationScript(true); ?> } // if finished @@ -152,7 +152,7 @@ if ($_SESSION[$SESSION_KEY]["handler"] != "UploadNoplugin") { <?php } else { // no plugin available ?> - $('#upload_form_status_info').html('<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" width="16" height="16" alt="ajax clock" /> <?php echo PMA_jsFormat(__('Please be patient, the file is being uploaded. Details about the upload are not available.'), false) . $common_functions->showDocu('faq2_9'); ?>'); + $('#upload_form_status_info').html('<img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" width="16" height="16" alt="ajax clock" /> <?php echo PMA_jsFormat(__('Please be patient, the file is being uploaded. Details about the upload are not available.'), false) . PMA_Util::showDocu('faq2_9'); ?>'); $('#upload_form_status').css("display", "none"); <?php } // else @@ -182,7 +182,7 @@ echo ' <input type="hidden" name="import_type" value="' . $import_type . '" / <div class="exportoptions" id="header"> <h2> - <?php echo $common_functions->getImage('b_import.png', __('Import')); ?> + <?php echo PMA_Util::getImage('b_import.png', __('Import')); ?> <?php if ($import_type == 'server') { echo __('Importing into the current server'); @@ -225,24 +225,24 @@ if ($GLOBALS['is_upload'] && !empty($cfg['UploadDir'])) { ?> <li> <input type="radio" name="file_location" id="radio_import_file" /> <?php - echo $common_functions->getBrowseUploadFileBlock($max_upload_size); + echo PMA_Util::getBrowseUploadFileBlock($max_upload_size); ?> </li> <li> <input type="radio" name="file_location" id="radio_local_import_file" /> <?php - echo $common_functions->getSelectUploadFileBlock($import_list, $cfg['UploadDir']); + echo PMA_Util::getSelectUploadFileBlock($import_list, $cfg['UploadDir']); ?> </li> </ul> <?php } elseif ($GLOBALS['is_upload']) { $uid = uniqid(''); - echo $common_functions->getBrowseUploadFileBlock($max_upload_size); + echo PMA_Util::getBrowseUploadFileBlock($max_upload_size); } elseif (!$GLOBALS['is_upload']) { PMA_Message::notice(__('File uploads are not allowed on this server.'))->display(); } elseif (!empty($cfg['UploadDir'])) { - echo $common_functions->getSelectUploadFileBlock($import_list, $cfg['UploadDir']); + echo PMA_Util::getSelectUploadFileBlock($import_list, $cfg['UploadDir']); } // end if (web-server upload directory) ?> </div> diff --git a/libraries/engines/innodb.lib.php b/libraries/engines/innodb.lib.php index 5b0ef20dd1..c303d61470 100644 --- a/libraries/engines/innodb.lib.php +++ b/libraries/engines/innodb.lib.php @@ -171,14 +171,14 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <th colspan="2">' . "\n" . ' ' . __('Total') . "\n" . ' : ' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_pages_total'], 0 ) . ' ' . __('pages') . ' / ' . join( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( $status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'] ) @@ -190,7 +190,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="odd">' . "\n" . ' <th>' . __('Free pages') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_pages_free'], 0 ) . '</td>' . "\n" @@ -198,7 +198,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="even">' . "\n" . ' <th>' . __('Dirty pages') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_pages_dirty'], 0 ) . '</td>' . "\n" @@ -206,7 +206,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="odd">' . "\n" . ' <th>' . __('Pages containing data') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_pages_data'], 0 ) . "\n" . '</td>' . "\n" @@ -214,7 +214,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="even">' . "\n" . ' <th>' . __('Pages to be flushed') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_pages_flushed'], 0 ) . "\n" . '</td>' . "\n" @@ -222,7 +222,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="odd">' . "\n" . ' <th>' . __('Busy pages') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_pages_misc'], 0 ) . "\n" . '</td>' . "\n" @@ -233,7 +233,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine $output .= ' <tr class="even">' . ' <th>' . __('Latched pages') . '</th>' . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_pages_latched'], 0 ) . '</td>' @@ -250,7 +250,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="odd">' . "\n" . ' <th>' . __('Read requests') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_read_requests'], 0 ) . "\n" . '</td>' . "\n" @@ -258,7 +258,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="even">' . "\n" . ' <th>' . __('Write requests') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_write_requests'], 0 ) . "\n" . '</td>' . "\n" @@ -266,7 +266,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="odd">' . "\n" . ' <th>' . __('Read misses') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_reads'], 0 ) . "\n" . '</td>' . "\n" @@ -274,7 +274,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ' <tr class="even">' . "\n" . ' <th>' . __('Write waits') . '</th>' . "\n" . ' <td class="value">' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $status['Innodb_buffer_pool_wait_free'], 0 ) . "\n" . '</td>' . "\n" @@ -285,7 +285,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars( - $common_functions->formatNumber( + PMA_Util::formatNumber( $status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 3, @@ -300,7 +300,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars( - $common_functions->formatNumber( + PMA_Util::formatNumber( $status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 3, diff --git a/libraries/engines/pbxt.lib.php b/libraries/engines/pbxt.lib.php index 4d37a43b7b..3f8af4a3a8 100644 --- a/libraries/engines/pbxt.lib.php +++ b/libraries/engines/pbxt.lib.php @@ -104,7 +104,7 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine } else { $value = $formatted_size; } - return $common_functions->formatByteDown($value); + return PMA_Util::formatByteDown($value); } //-------------------- diff --git a/libraries/gis/pma_gis_polygon.php b/libraries/gis/pma_gis_polygon.php index 0a15a6e880..57448d59da 100644 --- a/libraries/gis/pma_gis_polygon.php +++ b/libraries/gis/pma_gis_polygon.php @@ -474,8 +474,8 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry // Always keep $epsilon < 1 to go with the reduction logic down here $epsilon = 0.1; $denominator = sqrt( - $common_functions->pow(($y1 - $y0), 2) - + $common_functions->pow(($x0 - $x1), 2) + PMA_Util::pow(($y1 - $y0), 2) + + PMA_Util::pow(($x0 - $x1), 2) ); $pointA = array(); $pointB = array(); @@ -497,7 +497,7 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry } else { //If both are outside the polygon reduce the epsilon and //recalculate the points(reduce exponentially for faster convergance) - $epsilon = $common_functions->pow($epsilon, 2); + $epsilon = PMA_Util::pow($epsilon, 2); if ($epsilon == 0) { return false; } diff --git a/libraries/import.lib.php b/libraries/import.lib.php index c4d9f7b216..d7a465c712 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -942,10 +942,10 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, if ($create_db) { if (PMA_DRIZZLE) { - $sql[] = "CREATE DATABASE IF NOT EXISTS " . $common_functions->backquote($db_name) + $sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_Util::backquote($db_name) . " COLLATE " . $collation; } else { - $sql[] = "CREATE DATABASE IF NOT EXISTS " . $common_functions->backquote($db_name) + $sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_Util::backquote($db_name) . " DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation; } } @@ -1019,15 +1019,15 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, $num_tables = count($tables); for ($i = 0; $i < $num_tables; ++$i) { $num_cols = count($tables[$i][COL_NAMES]); - $tempSQLStr = "CREATE TABLE IF NOT EXISTS " . $common_functions->backquote($db_name) - . '.' . $common_functions->backquote($tables[$i][TBL_NAME]) . " ("; + $tempSQLStr = "CREATE TABLE IF NOT EXISTS " . PMA_Util::backquote($db_name) + . '.' . PMA_Util::backquote($tables[$i][TBL_NAME]) . " ("; for ($j = 0; $j < $num_cols; ++$j) { $size = $analyses[$i][SIZES][$j]; if ((int)$size == 0) { $size = 10; } - $tempSQLStr .= $common_functions->backquote($tables[$i][COL_NAMES][$j]) . " " + $tempSQLStr .= PMA_Util::backquote($tables[$i][COL_NAMES][$j]) . " " . $type_array[$analyses[$i][TYPES][$j]]; if ($analyses[$i][TYPES][$j] != GEOMETRY) { $tempSQLStr .= "(" . $size . ")"; @@ -1062,11 +1062,11 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, $num_cols = count($tables[$i][COL_NAMES]); $num_rows = count($tables[$i][ROWS]); - $tempSQLStr = "INSERT INTO " . $common_functions->backquote($db_name) . '.' - . $common_functions->backquote($tables[$i][TBL_NAME]) . " ("; + $tempSQLStr = "INSERT INTO " . PMA_Util::backquote($db_name) . '.' + . PMA_Util::backquote($tables[$i][TBL_NAME]) . " ("; for ($m = 0; $m < $num_cols; ++$m) { - $tempSQLStr .= $common_functions->backquote($tables[$i][COL_NAMES][$m]); + $tempSQLStr .= PMA_Util::backquote($tables[$i][COL_NAMES][$m]); if ($m != ($num_cols - 1)) { $tempSQLStr .= ", "; @@ -1099,7 +1099,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, } $tempSQLStr .= (($is_varchar) ? "'" : ""); - $tempSQLStr .= $common_functions->sqlAddSlashes( + $tempSQLStr .= PMA_Util::sqlAddSlashes( (string) $tables[$i][ROWS][$j][$k] ); $tempSQLStr .= (($is_varchar) ? "'" : ""); @@ -1196,10 +1196,10 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, $message .= sprintf( '<br /><li><a href="%s" title="%s">%s</a> (<a href="%s" title="%s">' . __('Options') . '</a>)</li>', $db_url, - sprintf(__('Go to database: %s'), htmlspecialchars($common_functions->backquote($db_name))), + sprintf(__('Go to database: %s'), htmlspecialchars(PMA_Util::backquote($db_name))), htmlspecialchars($db_name), $db_ops_url, - sprintf(__('Edit settings for %s'), htmlspecialchars($common_functions->backquote($db_name))) + sprintf(__('Edit settings for %s'), htmlspecialchars(PMA_Util::backquote($db_name))) ); $message .= '<ul>'; @@ -1222,18 +1222,18 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, $message .= sprintf( '<li><a href="%s" title="%s">%s</a> (<a href="%s" title="%s">' . __('Structure') . '</a>) (<a href="%s" title="%s">' . __('Options') . '</a>)</li>', $tbl_url, - sprintf(__('Go to table: %s'), htmlspecialchars($common_functions->backquote($tables[$i][TBL_NAME]))), + sprintf(__('Go to table: %s'), htmlspecialchars(PMA_Util::backquote($tables[$i][TBL_NAME]))), htmlspecialchars($tables[$i][TBL_NAME]), $tbl_struct_url, - sprintf(__('Structure of %s'), htmlspecialchars($common_functions->backquote($tables[$i][TBL_NAME]))), + sprintf(__('Structure of %s'), htmlspecialchars(PMA_Util::backquote($tables[$i][TBL_NAME]))), $tbl_ops_url, - sprintf(__('Edit settings for %s'), htmlspecialchars($common_functions->backquote($tables[$i][TBL_NAME]))) + sprintf(__('Edit settings for %s'), htmlspecialchars(PMA_Util::backquote($tables[$i][TBL_NAME]))) ); } else { $message .= sprintf( '<li><a href="%s" title="%s">%s</a></li>', $tbl_url, - sprintf(__('Go to view: %s'), htmlspecialchars($common_functions->backquote($tables[$i][TBL_NAME]))), + sprintf(__('Go to view: %s'), htmlspecialchars(PMA_Util::backquote($tables[$i][TBL_NAME]))), htmlspecialchars($tables[$i][TBL_NAME]) ); } diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 041b6379eb..d353cd370b 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -1374,9 +1374,9 @@ function PMA_getColumnSize($column, $extracted_columnspec) */ function PMA_getHTMLforGisDataTypes() { - $edit_str = $common_functions->getIcon('b_edit.png', __('Edit/Insert')); + $edit_str = PMA_Util::getIcon('b_edit.png', __('Edit/Insert')); return '<span class="open_gis_editor">' - . $common_functions->linkOrButton( + . PMA_Util::linkOrButton( '#', $edit_str, array(), false, false, '_blank' ) . '</span>'; @@ -1638,12 +1638,12 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow( $special_chars = ''; $data = $current_row[$column['Field']]; } elseif ($column['True_Type'] == 'bit') { - $special_chars = $common_functions->printableBitValue( + $special_chars = PMA_Util::printableBitValue( $current_row[$column['Field']], $extracted_columnspec['spec_in_brackets'] ); } elseif (in_array($column['True_Type'], $gis_data_types)) { // Convert gis data to Well Know Text format - $current_row[$column['Field']] = $common_functions->asWKT( + $current_row[$column['Field']] = PMA_Util::asWKT( $current_row[$column['Field']], true ); $special_chars = htmlspecialchars($current_row[$column['Field']]); @@ -1661,7 +1661,7 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow( $column['display_binary_as_hex'] = true; } else { $current_row[$column['Field']] - = $common_functions->replaceBinaryContents( + = PMA_Util::replaceBinaryContents( $current_row[$column['Field']] ); } @@ -1671,7 +1671,7 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow( //We need to duplicate the first \n or otherwise we will lose //the first newline entered in a VARCHAR or TEXT column $special_chars_encoded - = $common_functions->duplicateFirstNewline($special_chars); + = PMA_Util::duplicateFirstNewline($special_chars); $data = $current_row[$column['Field']]; } // end if... else... @@ -1808,8 +1808,8 @@ function PMA_isInsertRow() function PMA_setSessionForEditNext($one_where_clause) { - $local_query = 'SELECT * FROM ' . $common_functions->backquote($GLOBALS['db']) - . '.' . $common_functions->backquote($GLOBALS['table']) . ' WHERE ' + $local_query = 'SELECT * FROM ' . PMA_Util::backquote($GLOBALS['db']) + . '.' . PMA_Util::backquote($GLOBALS['table']) . ' WHERE ' . str_replace('` =', '` >', $one_where_clause) . ' LIMIT 1;'; $res = PMA_DBI_query($local_query); @@ -1818,7 +1818,7 @@ function PMA_setSessionForEditNext($one_where_clause) // must find a unique condition based on unique key, // not a combination of all fields list($unique_condition, $clause_is_unique) - = $common_functions->getUniqueCondition( + = PMA_Util::getUniqueCondition( $res, count($meta), $meta, $row, true ); if (! empty($unique_condition)) { @@ -2014,10 +2014,10 @@ function PMA_getDisplayValueForForeignTableColumn($where_comparison, ); // Field to display from the foreign table? if (isset($display_field) && strlen($display_field)) { - $dispsql = 'SELECT ' . $common_functions->backquote($display_field) - . ' FROM ' . $common_functions->backquote($map[$relation_field]['foreign_db']) - . '.' . $common_functions->backquote($map[$relation_field]['foreign_table']) - . ' WHERE ' . $common_functions->backquote($map[$relation_field]['foreign_field']) + $dispsql = 'SELECT ' . PMA_Util::backquote($display_field) + . ' FROM ' . PMA_Util::backquote($map[$relation_field]['foreign_db']) + . '.' . PMA_Util::backquote($map[$relation_field]['foreign_table']) + . ' WHERE ' . PMA_Util::backquote($map[$relation_field]['foreign_field']) . $where_comparison; $dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE); if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) { @@ -2059,9 +2059,9 @@ function PMA_getLinkForRelationalDisplayField($map, $relation_field, 'table' => $map[$relation_field]['foreign_table'], 'pos' => '0', 'sql_query' => 'SELECT * FROM ' - . $common_functions->backquote($map[$relation_field]['foreign_db']) - . '.' . $common_functions->backquote($map[$relation_field]['foreign_table']) - . ' WHERE ' . $common_functions->backquote($map[$relation_field]['foreign_field']) + . PMA_Util::backquote($map[$relation_field]['foreign_db']) + . '.' . PMA_Util::backquote($map[$relation_field]['foreign_table']) + . ' WHERE ' . PMA_Util::backquote($map[$relation_field]['foreign_field']) . $where_comparison ); $output = '<a href="sql.php' . PMA_generate_common_url($_url_params) . '"' . $title . '>'; @@ -2207,7 +2207,7 @@ function PMA_getQueryValuesForInsertAndUpdateInMultipleEdit($multi_edit_columns_ $query_values[] = $current_value_as_an_array; // first inserted row so prepare the list of fields if (empty($value_sets)) { - $query_fields[] = $common_functions->backquote( + $query_fields[] = PMA_Util::backquote( $multi_edit_columns_name[$key] ); } @@ -2221,11 +2221,11 @@ function PMA_getQueryValuesForInsertAndUpdateInMultipleEdit($multi_edit_columns_ // field had the null checkbox before the update // field no longer has the null checkbox $query_values[] - = $common_functions->backquote($multi_edit_columns_name[$key]) + = PMA_Util::backquote($multi_edit_columns_name[$key]) . ' = ' . $current_value_as_an_array; } elseif (empty($multi_edit_funcs[$key]) && isset($multi_edit_columns_prev[$key]) - && ("'" . $common_functions->sqlAddSlashes($multi_edit_columns_prev[$key]) . "'" == $current_value) + && ("'" . PMA_Util::sqlAddSlashes($multi_edit_columns_prev[$key]) . "'" == $current_value) ) { // No change for this column and no MySQL function is used -> next column } elseif (! empty($current_value)) { @@ -2236,7 +2236,7 @@ function PMA_getQueryValuesForInsertAndUpdateInMultipleEdit($multi_edit_columns_ || empty($multi_edit_columns_null[$key]) ) { $query_values[] - = $common_functions->backquote($multi_edit_columns_name[$key]) + = PMA_Util::backquote($multi_edit_columns_name[$key]) . ' = ' . $current_value_as_an_array; } } @@ -2274,7 +2274,7 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key, && is_array($multi_edit_columns_type) && isset($where_clause) ) { $protected_row = PMA_DBI_fetch_single_row( - 'SELECT * FROM ' . $common_functions->backquote($table) . ' WHERE ' . $where_clause . ';' + 'SELECT * FROM ' . PMA_Util::backquote($table) . ' WHERE ' . $where_clause . ';' ); } @@ -2301,7 +2301,7 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key, } elseif ($type == 'set') { if (! empty($_REQUEST['fields']['multi_edit'][$rownumber][$key])) { $current_value = implode(',', $_REQUEST['fields']['multi_edit'][$rownumber][$key]); - $current_value = "'" . $common_functions->sqlAddSlashes($current_value) . "'"; + $current_value = "'" . PMA_Util::sqlAddSlashes($current_value) . "'"; } else { $current_value = "''"; } @@ -2321,11 +2321,11 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key, } } elseif ($type == 'bit') { $current_value = preg_replace('/[^01]/', '0', $current_value); - $current_value = "b'" . $common_functions->sqlAddSlashes($current_value) . "'"; + $current_value = "b'" . PMA_Util::sqlAddSlashes($current_value) . "'"; } elseif (! ($type == 'datetime' || $type == 'timestamp') || $current_value != 'CURRENT_TIMESTAMP' ) { - $current_value = "'" . $common_functions->sqlAddSlashes($current_value) . "'"; + $current_value = "'" . PMA_Util::sqlAddSlashes($current_value) . "'"; } // Was the Null checkbox checked for this field? diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php index 971a1ac8c6..3f0e5aa6ef 100644 --- a/libraries/mult_submits.inc.php +++ b/libraries/mult_submits.inc.php @@ -85,7 +85,7 @@ if (! empty($submit_mult) case 'primary': // Gets table primary key PMA_DBI_select_db($db); - $result = PMA_DBI_query('SHOW KEYS FROM ' . $common_functions->backquote($table) . ';'); + $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_Util::backquote($table) . ';'); $primary = ''; while ($row = PMA_DBI_fetch_assoc($result)) { // Backups the list of primary keys @@ -166,13 +166,13 @@ if (!empty($submit_mult) && !empty($what)) { foreach ($selected AS $idx => $sval) { switch ($what) { case 'row_delete': - $full_query .= 'DELETE FROM ' . $common_functions->backquote($db) . '.' . $common_functions->backquote($table) + $full_query .= 'DELETE FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) . ' WHERE ' . urldecode($sval) . ' LIMIT 1' . ';<br />'; break; case 'drop_db': $full_query .= 'DROP DATABASE ' - . $common_functions->backquote(htmlspecialchars($sval)) + . PMA_Util::backquote(htmlspecialchars($sval)) . ';<br />'; $reload = 1; break; @@ -181,31 +181,31 @@ if (!empty($submit_mult) && !empty($what)) { $current = $sval; if (!empty($views) && in_array($current, $views)) { $full_query_views .= (empty($full_query_views) ? 'DROP VIEW ' : ', ') - . $common_functions->backquote(htmlspecialchars($current)); + . PMA_Util::backquote(htmlspecialchars($current)); } else { $full_query .= (empty($full_query) ? 'DROP TABLE ' : ', ') - . $common_functions->backquote(htmlspecialchars($current)); + . PMA_Util::backquote(htmlspecialchars($current)); } break; case 'empty_tbl': $full_query .= 'TRUNCATE '; - $full_query .= $common_functions->backquote(htmlspecialchars($sval)) + $full_query .= PMA_Util::backquote(htmlspecialchars($sval)) . ';<br />'; break; case 'primary_fld': if ($full_query == '') { $full_query .= 'ALTER TABLE ' - . $common_functions->backquote(htmlspecialchars($table)) + . PMA_Util::backquote(htmlspecialchars($table)) . '<br /> DROP PRIMARY KEY,' . '<br /> ADD PRIMARY KEY(' . '<br /> ' - . $common_functions->backquote(htmlspecialchars($sval)) + . PMA_Util::backquote(htmlspecialchars($sval)) . ','; } else { $full_query .= '<br /> ' - . $common_functions->backquote(htmlspecialchars($sval)) + . PMA_Util::backquote(htmlspecialchars($sval)) . ','; } if ($i == $selected_cnt-1) { @@ -216,10 +216,10 @@ if (!empty($submit_mult) && !empty($what)) { case 'drop_fld': if ($full_query == '') { $full_query .= 'ALTER TABLE ' - . $common_functions->backquote(htmlspecialchars($table)); + . PMA_Util::backquote(htmlspecialchars($table)); } $full_query .= '<br /> DROP ' - . $common_functions->backquote(htmlspecialchars($sval)) + . PMA_Util::backquote(htmlspecialchars($sval)) . ','; if ($i == $selected_cnt - 1) { $full_query = preg_replace('@,$@', ';<br />', $full_query); @@ -251,7 +251,7 @@ if (!empty($submit_mult) && !empty($what)) { } foreach ($selected as $idx => $sval) { if ($what == 'row_delete') { - $_url_params['selected'][] = 'DELETE FROM ' . $common_functions->backquote($db) . '.' . $common_functions->backquote($table) + $_url_params['selected'][] = 'DELETE FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) . ' WHERE ' . urldecode($sval) . ' LIMIT 1;'; } else { $_url_params['selected'][] = $sval; @@ -349,7 +349,7 @@ if (!empty($submit_mult) && !empty($what)) { if ($query_type == 'primary_fld') { // Gets table primary key PMA_DBI_select_db($db); - $result = PMA_DBI_query('SHOW KEYS FROM ' . $common_functions->backquote($table) . ';'); + $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_Util::backquote($table) . ';'); $primary = ''; while ($row = PMA_DBI_fetch_assoc($result)) { // Backups the list of primary keys @@ -372,7 +372,7 @@ if (!empty($submit_mult) && !empty($what)) { case 'drop_db': PMA_relationsCleanupDatabase($selected[$i]); $a_query = 'DROP DATABASE ' - . $common_functions->backquote($selected[$i]); + . PMA_Util::backquote($selected[$i]); $reload = 1; $run_parts = true; $rebuild_database_list = true; @@ -383,98 +383,98 @@ if (!empty($submit_mult) && !empty($what)) { $current = $selected[$i]; if (!empty($views) && in_array($current, $views)) { $sql_query_views .= (empty($sql_query_views) ? 'DROP VIEW ' : ', ') - . $common_functions->backquote($current); + . PMA_Util::backquote($current); } else { $sql_query .= (empty($sql_query) ? 'DROP TABLE ' : ', ') - . $common_functions->backquote($current); + . PMA_Util::backquote($current); } $reload = 1; break; case 'check_tbl': $sql_query .= (empty($sql_query) ? 'CHECK TABLE ' : ', ') - . $common_functions->backquote($selected[$i]); + . PMA_Util::backquote($selected[$i]); $use_sql = true; break; case 'optimize_tbl': $sql_query .= (empty($sql_query) ? 'OPTIMIZE TABLE ' : ', ') - . $common_functions->backquote($selected[$i]); + . PMA_Util::backquote($selected[$i]); $use_sql = true; break; case 'analyze_tbl': $sql_query .= (empty($sql_query) ? 'ANALYZE TABLE ' : ', ') - . $common_functions->backquote($selected[$i]); + . PMA_Util::backquote($selected[$i]); $use_sql = true; break; case 'repair_tbl': $sql_query .= (empty($sql_query) ? 'REPAIR TABLE ' : ', ') - . $common_functions->backquote($selected[$i]); + . PMA_Util::backquote($selected[$i]); $use_sql = true; break; case 'empty_tbl': $a_query = 'TRUNCATE '; - $a_query .= $common_functions->backquote($selected[$i]); + $a_query .= PMA_Util::backquote($selected[$i]); $run_parts = true; break; case 'drop_fld': PMA_relationsCleanupColumn($db, $table, $selected[$i]); - $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . $common_functions->backquote($table) : ',') - . ' DROP ' . $common_functions->backquote($selected[$i]) + $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) : ',') + . ' DROP ' . PMA_Util::backquote($selected[$i]) . (($i == $selected_cnt-1) ? ';' : ''); break; case 'primary_fld': - $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . $common_functions->backquote($table) . (empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ') - . $common_functions->backquote($selected[$i]) + $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . (empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ') + . PMA_Util::backquote($selected[$i]) . (($i == $selected_cnt-1) ? ');' : ''); break; case 'index_fld': - $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . $common_functions->backquote($table) . ' ADD INDEX( ' : ', ') - . $common_functions->backquote($selected[$i]) + $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD INDEX( ' : ', ') + . PMA_Util::backquote($selected[$i]) . (($i == $selected_cnt-1) ? ');' : ''); break; case 'unique_fld': - $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . $common_functions->backquote($table) . ' ADD UNIQUE( ' : ', ') - . $common_functions->backquote($selected[$i]) + $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD UNIQUE( ' : ', ') + . PMA_Util::backquote($selected[$i]) . (($i == $selected_cnt-1) ? ');' : ''); break; case 'spatial_fld': - $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . $common_functions->backquote($table) . ' ADD SPATIAL( ' : ', ') - . $common_functions->backquote($selected[$i]) + $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD SPATIAL( ' : ', ') + . PMA_Util::backquote($selected[$i]) . (($i == $selected_cnt-1) ? ');' : ''); break; case 'fulltext_fld': - $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . $common_functions->backquote($table) . ' ADD FULLTEXT( ' : ', ') - . $common_functions->backquote($selected[$i]) + $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD FULLTEXT( ' : ', ') + . PMA_Util::backquote($selected[$i]) . (($i == $selected_cnt-1) ? ');' : ''); break; case 'add_prefix_tbl': $newtablename = $_POST['add_prefix'] . $selected[$i]; - $a_query = 'ALTER TABLE ' . $common_functions->backquote($selected[$i]) . ' RENAME ' . $common_functions->backquote($newtablename); // ADD PREFIX TO TABLE NAME + $a_query = 'ALTER TABLE ' . PMA_Util::backquote($selected[$i]) . ' RENAME ' . PMA_Util::backquote($newtablename); // ADD PREFIX TO TABLE NAME $run_parts = true; break; case 'replace_prefix_tbl': $current = $selected[$i]; $newtablename = preg_replace("/^" . $_POST['from_prefix'] . "/", $_POST['to_prefix'], $current); - $a_query = 'ALTER TABLE ' . $common_functions->backquote($selected[$i]) . ' RENAME ' . $common_functions->backquote($newtablename); // CHANGE PREFIX PATTERN + $a_query = 'ALTER TABLE ' . PMA_Util::backquote($selected[$i]) . ' RENAME ' . PMA_Util::backquote($newtablename); // CHANGE PREFIX PATTERN $run_parts = true; break; case 'copy_tbl_change_prefix': $current = $selected[$i]; $newtablename = preg_replace("/^" . $_POST['from_prefix'] . "/", $_POST['to_prefix'], $current); - $a_query = 'CREATE TABLE ' . $common_functions->backquote($newtablename) . ' SELECT * FROM ' . $common_functions->backquote($selected[$i]); // COPY TABLE AND CHANGE PREFIX PATTERN + $a_query = 'CREATE TABLE ' . PMA_Util::backquote($newtablename) . ' SELECT * FROM ' . PMA_Util::backquote($selected[$i]); // COPY TABLE AND CHANGE PREFIX PATTERN $run_parts = true; break; diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index fd4d971fec..a99feb4b7d 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -8,7 +8,7 @@ if (! defined('PHPMYADMIN')) { exit; } -if (! $common_functions->cacheExists('mysql_charsets', true)) { +if (! PMA_Util::cacheExists('mysql_charsets', true)) { $sql = PMA_DRIZZLE ? 'SELECT * FROM data_dictionary.CHARACTER_SETS' : 'SELECT * FROM information_schema.CHARACTER_SETS'; @@ -66,21 +66,21 @@ if (! $common_functions->cacheExists('mysql_charsets', true)) { } unset($key, $value); - $common_functions->cacheSet('mysql_charsets', $GLOBALS['mysql_charsets'], true); - $common_functions->cacheSet('mysql_charsets_descriptions', $GLOBALS['mysql_charsets_descriptions'], true); - $common_functions->cacheSet('mysql_charsets_available', $GLOBALS['mysql_charsets_available'], true); - $common_functions->cacheSet('mysql_collations', $GLOBALS['mysql_collations'], true); - $common_functions->cacheSet('mysql_default_collations', $GLOBALS['mysql_default_collations'], true); - $common_functions->cacheSet('mysql_collations_flat', $GLOBALS['mysql_collations_flat'], true); - $common_functions->cacheSet('mysql_collations_available', $GLOBALS['mysql_collations_available'], true); + PMA_Util::cacheSet('mysql_charsets', $GLOBALS['mysql_charsets'], true); + PMA_Util::cacheSet('mysql_charsets_descriptions', $GLOBALS['mysql_charsets_descriptions'], true); + PMA_Util::cacheSet('mysql_charsets_available', $GLOBALS['mysql_charsets_available'], true); + PMA_Util::cacheSet('mysql_collations', $GLOBALS['mysql_collations'], true); + PMA_Util::cacheSet('mysql_default_collations', $GLOBALS['mysql_default_collations'], true); + PMA_Util::cacheSet('mysql_collations_flat', $GLOBALS['mysql_collations_flat'], true); + PMA_Util::cacheSet('mysql_collations_available', $GLOBALS['mysql_collations_available'], true); } else { - $GLOBALS['mysql_charsets'] = $common_functions->cacheGet('mysql_charsets', true); - $GLOBALS['mysql_charsets_descriptions'] = $common_functions->cacheGet('mysql_charsets_descriptions', true); - $GLOBALS['mysql_charsets_available'] = $common_functions->cacheGet('mysql_charsets_available', true); - $GLOBALS['mysql_collations'] = $common_functions->cacheGet('mysql_collations', true); - $GLOBALS['mysql_default_collations'] = $common_functions->cacheGet('mysql_default_collations', true); - $GLOBALS['mysql_collations_flat'] = $common_functions->cacheGet('mysql_collations_flat', true); - $GLOBALS['mysql_collations_available'] = $common_functions->cacheGet('mysql_collations_available', true); + $GLOBALS['mysql_charsets'] = PMA_Util::cacheGet('mysql_charsets', true); + $GLOBALS['mysql_charsets_descriptions'] = PMA_Util::cacheGet('mysql_charsets_descriptions', true); + $GLOBALS['mysql_charsets_available'] = PMA_Util::cacheGet('mysql_charsets_available', true); + $GLOBALS['mysql_collations'] = PMA_Util::cacheGet('mysql_collations', true); + $GLOBALS['mysql_default_collations'] = PMA_Util::cacheGet('mysql_default_collations', true); + $GLOBALS['mysql_collations_flat'] = PMA_Util::cacheGet('mysql_collations_flat', true); + $GLOBALS['mysql_collations_available'] = PMA_Util::cacheGet('mysql_collations_available', true); } define('PMA_CSDROPDOWN_COLLATION', 0); @@ -174,8 +174,8 @@ function PMA_getDbCollation($db) if (! $GLOBALS['cfg']['Server']['DisableIS']) { // this is slow with thousands of databases $sql = PMA_DRIZZLE - ? 'SELECT DEFAULT_COLLATION_NAME FROM data_dictionary.SCHEMAS WHERE SCHEMA_NAME = \'' . $common_functions->sqlAddSlashes($db) . '\' LIMIT 1' - : 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . $common_functions->sqlAddSlashes($db) . '\' LIMIT 1'; + ? 'SELECT DEFAULT_COLLATION_NAME FROM data_dictionary.SCHEMAS WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db) . '\' LIMIT 1' + : 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db) . '\' LIMIT 1'; return PMA_DBI_fetch_value($sql); } else { PMA_DBI_select_db($db); diff --git a/libraries/navigation_header.inc.php b/libraries/navigation_header.inc.php index 2aa92427a5..20e65bc544 100644 --- a/libraries/navigation_header.inc.php +++ b/libraries/navigation_header.inc.php @@ -52,7 +52,7 @@ if ($GLOBALS['cfg']['LeftDisplayLogo']) { <?php echo '<a target="frame_content" href="main.php?' . $query_url . '"' .' title="' . __('Home') . '">' - . $common_functions->getImage('b_home.png', __('Home')) + . PMA_Util::getImage('b_home.png', __('Home')) .'</a>' . "\n"; // if we have chosen server if ($server != 0) { @@ -61,7 +61,7 @@ if ($GLOBALS['cfg']['LeftDisplayLogo']) { echo '<a href="index.php?' . $query_url . '&old_usr=' .urlencode($PHP_AUTH_USER) . '" target="_parent"' .' title="' . __('Log out') . '" >' - . $common_functions->getImage('s_loggoff.png', __('Log out')) + . PMA_Util::getImage('s_loggoff.png', __('Log out')) .'</a>' . "\n"; } // end if ($GLOBALS['cfg']['Server']['auth_type'] != 'config' @@ -70,16 +70,16 @@ if ($GLOBALS['cfg']['LeftDisplayLogo']) { echo '<a href="' . $anchor . '&no_js=true"' .' title="' . __('Query window') . '"'; echo ' onclick="if (window.parent.open_querywindow()) return false;"'; - echo '>' . $common_functions->getImage('b_selboard.png', __('Query window')) . '</a>' . "\n"; + echo '>' . PMA_Util::getImage('b_selboard.png', __('Query window')) . '</a>' . "\n"; } // end if ($server != 0) echo ' <a href="Documentation.html" target="documentation"' .' title="' . __('phpMyAdmin documentation') . '" >'; - echo $common_functions->getImage('b_docs.png', __('phpMyAdmin documentation')); + echo PMA_Util::getImage('b_docs.png', __('phpMyAdmin documentation')); echo '</a>'; - echo $common_functions->showMySQLDocu('', '', true) . "\n"; + echo PMA_Util::showMySQLDocu('', '', true) . "\n"; $params = array('uniqid' => uniqid()); if (!empty($GLOBALS['db'])) { @@ -87,7 +87,7 @@ if ($GLOBALS['cfg']['LeftDisplayLogo']) { } echo '<a href="navigation.php?' . PMA_generate_common_url($params) . '" title="' . __('Reload navigation frame') . '" target="frame_navigation">'; - echo $common_functions->getImage('s_reload.png', __('Reload navigation frame')); + echo PMA_Util::getImage('s_reload.png', __('Reload navigation frame')); echo '</a>'; echo '</div>' . "\n"; diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php index 02a220891d..aeaea07289 100644 --- a/libraries/operations.lib.php +++ b/libraries/operations.lib.php @@ -97,7 +97,7 @@ function PMA_getHtmlForRenameDatabase($db) function PMA_getHtmlForDropDatabaseLink($db) { - $this_sql_query = 'DROP DATABASE ' . $common_functions->backquote($db); + $this_sql_query = 'DROP DATABASE ' . PMA_Util::backquote($db); $this_url_params = array( 'sql_query' => $this_sql_query, 'back' => 'db_operations.php', @@ -106,7 +106,7 @@ function PMA_getHtmlForDropDatabaseLink($db) 'purge' => '1', 'message_to_show' => sprintf( __('Database %s has been dropped.'), - htmlspecialchars($common_functions->backquote($db)) + htmlspecialchars(PMA_Util::backquote($db)) ), 'db' => null, ); @@ -115,7 +115,7 @@ function PMA_getHtmlForDropDatabaseLink($db) . '<fieldset class="caution">'; $html_output .= '<legend>'; if ($GLOBALS['cfg']['PropertiesIconic']) { - $html_output .= $common_functions->getImage('b_deltbl.png'); + $html_output .= PMA_Util::getImage('b_deltbl.png'); } $html_output .= __('Remove database') . '</legend>'; @@ -172,13 +172,13 @@ function PMA_getHtmlForCopyDatabase($db) . '<legend>'; if ($GLOBALS['cfg']['PropertiesIconic']) { - $html_output .= $common_functions->getImage('b_edit.png'); + $html_output .= PMA_Util::getImage('b_edit.png'); } $html_output .= __('Copy database to') . ':' . '</legend>' . '<input type="text" name="newname" size="30" ' . 'class="textfield" value="" /><br />' - . $common_functions->getRadioFields( + . PMA_Util::getRadioFields( 'what', $choices, 'data', true ); $html_output .= '<input type="checkbox" name="create_database_before_copying" ' @@ -1113,7 +1113,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria, if ($is_myisam_or_aria || $is_innodb) { $params = array( 'sql_query' => 'CHECK TABLE ' - . $common_functions->backquote($GLOBALS['table']), + . PMA_Util::backquote($GLOBALS['table']), 'table_maintenance' => 'Go', ); $html_output .= PMA_getMaintainActionlink( @@ -1126,7 +1126,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria, if ($is_innodb) { $params = array( 'sql_query' => 'ALTER TABLE ' - . $common_functions->backquote($GLOBALS['table']) + . PMA_Util::backquote($GLOBALS['table']) . ' ENGINE = InnoDB;' ); $html_output .= PMA_getMaintainActionlink( @@ -1140,7 +1140,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria, if ($is_myisam_or_aria || $is_berkeleydb) { $params = array( 'sql_query' => 'ANALYZE TABLE ' - . $common_functions->backquote($GLOBALS['table']), + . PMA_Util::backquote($GLOBALS['table']), 'table_maintenance' => 'Go', ); $html_output .= PMA_getMaintainActionlink( @@ -1153,7 +1153,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria, if ($is_myisam_or_aria && !PMA_DRIZZLE) { $params = array( 'sql_query' => 'REPAIR TABLE ' - . $common_functions->backquote($GLOBALS['table']), + . PMA_Util::backquote($GLOBALS['table']), 'table_maintenance' => 'Go', ); $html_output .= PMA_getMaintainActionlink( @@ -1168,7 +1168,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria, ) { $params = array( 'sql_query' => 'OPTIMIZE TABLE ' - . $common_functions->backquote($GLOBALS['table']), + . PMA_Util::backquote($GLOBALS['table']), 'table_maintenance' => 'Go', ); $html_output .= PMA_getMaintainActionlink( @@ -1182,7 +1182,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria, $params = array( 'sql_query' => 'FLUSH TABLE ' - . $common_functions->backquote($GLOBALS['table']), + . PMA_Util::backquote($GLOBALS['table']), 'message_to_show' => sprintf( __('Table %s has been flushed'), htmlspecialchars($GLOBALS['table']) @@ -1322,10 +1322,10 @@ function PMA_getHtmlForPartitionMaintenance($partition_names, $url_params) $html_select .= '</select>' . "\n"; $html_output .= sprintf(__('Partition %s'), $html_select); - $html_output .= $common_functions->getRadioFields( + $html_output .= PMA_Util::getRadioFields( 'partition_operation', $choices, '', false ); - $html_output .= $common_functions->showMySQLDocu( + $html_output .= PMA_Util::showMySQLDocu( 'partitioning_maintenance', 'partitioning_maintenance' ); @@ -1333,7 +1333,7 @@ function PMA_getHtmlForPartitionMaintenance($partition_names, $url_params) $url_params, array( 'sql_query' => 'ALTER TABLE ' - . $common_functions->backquote($GLOBALS['table']) + . PMA_Util::backquote($GLOBALS['table']) . ' REMOVE PARTITIONING;' ) ); @@ -1372,26 +1372,26 @@ function PMA_getHtmlForReferentialIntegrityCheck($foreign, $url_params) foreach ($foreign AS $master => $arr) { $join_query = 'SELECT ' - . $common_functions->backquote($GLOBALS['table']) . '.*' - . ' FROM ' . $common_functions->backquote($GLOBALS['table']) - . ' LEFT JOIN ' . $common_functions->backquote($arr['foreign_table']); + . PMA_Util::backquote($GLOBALS['table']) . '.*' + . ' FROM ' . PMA_Util::backquote($GLOBALS['table']) + . ' LEFT JOIN ' . PMA_Util::backquote($arr['foreign_table']); if ($arr['foreign_table'] == $GLOBALS['table']) { $foreign_table = $GLOBALS['table'] . '1'; - $join_query .= ' AS ' . $common_functions->backquote($foreign_table); + $join_query .= ' AS ' . PMA_Util::backquote($foreign_table); } else { $foreign_table = $arr['foreign_table']; } $join_query .= ' ON ' - . $common_functions->backquote($GLOBALS['table']) . '.' - . $common_functions->backquote($master) - . ' = ' . $common_functions->backquote($foreign_table) . '.' - . $common_functions->backquote($arr['foreign_field']) + . PMA_Util::backquote($GLOBALS['table']) . '.' + . PMA_Util::backquote($master) + . ' = ' . PMA_Util::backquote($foreign_table) . '.' + . PMA_Util::backquote($arr['foreign_field']) . ' WHERE ' - . $common_functions->backquote($foreign_table) . '.' - . $common_functions->backquote($arr['foreign_field']) + . PMA_Util::backquote($foreign_table) . '.' + . PMA_Util::backquote($arr['foreign_field']) . ' IS NULL AND ' - . $common_functions->backquote($GLOBALS['table']) . '.' - . $common_functions->backquote($master) + . PMA_Util::backquote($GLOBALS['table']) . '.' + . PMA_Util::backquote($master) . ' IS NOT NULL'; $this_url_params = array_merge( $url_params, @@ -1415,9 +1415,9 @@ function PMA_getQueryAndResultForReorderingTable() { $sql_query = 'ALTER TABLE ' - . $common_functions->backquote($GLOBALS['table']) + . PMA_Util::backquote($GLOBALS['table']) . ' ORDER BY ' - . $common_functions->backquote(urldecode($_REQUEST['order_field'])); + . PMA_Util::backquote(urldecode($_REQUEST['order_field'])); if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc' ) { @@ -1459,7 +1459,7 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys, && urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment'] ) { $table_alters[] = 'COMMENT = \'' - . $common_functions->sqlAddSlashes($_REQUEST['comment']) . '\''; + . PMA_Util::sqlAddSlashes($_REQUEST['comment']) . '\''; } if (! empty($_REQUEST['new_tbl_storage_engine']) && strtolower($_REQUEST['new_tbl_storage_engine']) !== strtolower($tbl_storage_engine) @@ -1517,7 +1517,7 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys, || $_REQUEST['new_auto_increment'] !== $auto_increment) ) { $table_alters[] = 'auto_increment = ' - . $common_functions->sqlAddSlashes($_REQUEST['new_auto_increment']); + . PMA_Util::sqlAddSlashes($_REQUEST['new_auto_increment']); } if (($is_myisam_or_aria || $is_innodb || $is_pbxt) @@ -1526,7 +1526,7 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys, || strtolower($_REQUEST['new_row_format']) !== strtolower($row_format)) ) { $table_alters[] = 'ROW_FORMAT = ' - . $common_functions->sqlAddSlashes($_REQUEST['new_row_format']); + . PMA_Util::sqlAddSlashes($_REQUEST['new_row_format']); } return $table_alters; @@ -1599,7 +1599,7 @@ function PMA_getWarningMessagesArray() function PMA_getQueryAndResultForPartition() { $sql_query = 'ALTER TABLE ' - . $common_functions->backquote($GLOBALS['table']) . ' ' + . PMA_Util::backquote($GLOBALS['table']) . ' ' . $_REQUEST['partition_operation'] . ' PARTITION ' . $_REQUEST['partition_name'] . ';'; diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index c9876c3915..41c90a8ab7 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -390,11 +390,11 @@ class AuthenticationCookie extends AuthenticationPlugin $last_access_time = time() - $GLOBALS['cfg']['LoginCookieValidity']; if ($_SESSION['last_access_time'] < $last_access_time ) { - $common_functions->cacheUnset('is_create_db_priv', true); - $common_functions->cacheUnset('is_process_priv', true); - $common_functions->cacheUnset('is_reload_priv', true); - $common_functions->cacheUnset('db_to_create', true); - $common_functions->cacheUnset('dbs_where_create_table_allowed', true); + PMA_Util::cacheUnset('is_create_db_priv', true); + PMA_Util::cacheUnset('is_process_priv', true); + PMA_Util::cacheUnset('is_reload_priv', true); + PMA_Util::cacheUnset('db_to_create', true); + PMA_Util::cacheUnset('dbs_where_create_table_allowed', true); $GLOBALS['no_activity'] = true; $this->authFails(); exit; diff --git a/libraries/plugins/export/ExportCodegen.class.php b/libraries/plugins/export/ExportCodegen.class.php index d4c40003a6..3494ee8157 100644 --- a/libraries/plugins/export/ExportCodegen.class.php +++ b/libraries/plugins/export/ExportCodegen.class.php @@ -245,8 +245,8 @@ class ExportCodegen extends ExportPlugin $result = PMA_DBI_query( sprintf( - 'DESC %s.%s', $common_functions->backquote($db), - $common_functions->backquote($table) + 'DESC %s.%s', PMA_Util::backquote($db), + PMA_Util::backquote($table) ) ); if ($result) { @@ -337,8 +337,8 @@ class ExportCodegen extends ExportPlugin . 'table="' . ExportCodegen::cgMakeIdentifier($table) . '">'; $result = PMA_DBI_query( sprintf( - "DESC %s.%s", $common_functions->backquote($db), - $common_functions->backquote($table) + "DESC %s.%s", PMA_Util::backquote($db), + PMA_Util::backquote($table) ) ); if ($result) { diff --git a/libraries/plugins/export/ExportLatex.class.php b/libraries/plugins/export/ExportLatex.class.php index eea28b0bad..7ea49e49c5 100644 --- a/libraries/plugins/export/ExportLatex.class.php +++ b/libraries/plugins/export/ExportLatex.class.php @@ -308,7 +308,7 @@ class ExportLatex extends ExportPlugin $buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf; if (isset($GLOBALS['latex_caption'])) { $buffer .= ' \\caption{' - . $common_functions->expandUserString( + . PMA_Util::expandUserString( $GLOBALS['latex_data_caption'], array( 'texEscape', @@ -318,7 +318,7 @@ class ExportLatex extends ExportPlugin array('table' => $table, 'database' => $db) ) . '} \\label{' - . $common_functions->expandUserString( + . PMA_Util::expandUserString( $GLOBALS['latex_data_label'], null, array('table' => $table, 'database' => $db) @@ -344,7 +344,7 @@ class ExportLatex extends ExportPlugin if (isset($GLOBALS['latex_caption'])) { if (! PMA_exportOutputHandler( '\\caption{' - . $common_functions->expandUserString( + . PMA_Util::expandUserString( $GLOBALS['latex_data_continued_caption'], array( 'texEscape', @@ -518,7 +518,7 @@ class ExportLatex extends ExportPlugin // Table caption for first page and label if (isset($GLOBALS['latex_caption'])) { $buffer .= ' \\caption{' - . $common_functions->expandUserString( + . PMA_Util::expandUserString( $GLOBALS['latex_structure_caption'], array( 'texEscape', @@ -528,7 +528,7 @@ class ExportLatex extends ExportPlugin array('table' => $table, 'database' => $db) ) . '} \\label{' - . $common_functions->expandUserString( + . PMA_Util::expandUserString( $GLOBALS['latex_structure_label'], null, array('table' => $table, 'database' => $db) @@ -540,7 +540,7 @@ class ExportLatex extends ExportPlugin // Table caption on next pages if (isset($GLOBALS['latex_caption'])) { $buffer .= ' \\caption{' - . $common_functions->expandUserString( + . PMA_Util::expandUserString( $GLOBALS['latex_structure_continued_caption'], array( 'texEscape', diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php index 299ee9890a..0958bdd2c1 100644 --- a/libraries/plugins/export/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -461,7 +461,7 @@ class ExportSql extends ExportPlugin foreach ($procedure_names as $procedure_name) { if (! empty($GLOBALS['sql_drop_table'])) { $text .= 'DROP PROCEDURE IF EXISTS ' - . $common_functions->backquote($procedure_name) + . PMA_Util::backquote($procedure_name) . $delimiter . $crlf; } $text .= PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name) @@ -478,7 +478,7 @@ class ExportSql extends ExportPlugin foreach ($function_names as $function_name) { if (! empty($GLOBALS['sql_drop_table'])) { $text .= 'DROP FUNCTION IF EXISTS ' - . $common_functions->backquote($function_name) + . PMA_Util::backquote($function_name) . $delimiter . $crlf; } $text .= PMA_DBI_get_definition($db, 'FUNCTION', $function_name) @@ -700,7 +700,7 @@ class ExportSql extends ExportPlugin if (! PMA_exportOutputHandler( 'DROP DATABASE ' . (isset($GLOBALS['sql_backquotes']) - ? $common_functions->backquoteCompat($db, $compat) : $db) + ? PMA_Util::backquoteCompat($db, $compat) : $db) . ';' . $crlf )) { return false; @@ -708,7 +708,7 @@ class ExportSql extends ExportPlugin } $create_query = 'CREATE DATABASE ' . (isset($GLOBALS['sql_backquotes']) - ? $common_functions->backquoteCompat($db, $compat) : $db); + ? PMA_Util::backquoteCompat($db, $compat) : $db); $collation = PMA_getDbCollation($db); if (PMA_DRIZZLE) { $create_query .= ' COLLATE ' . $collation; @@ -731,7 +731,7 @@ class ExportSql extends ExportPlugin || PMA_DRIZZLE) ) { $result = PMA_exportOutputHandler( - 'USE ' . $common_functions->backquoteCompat($db, $compat) + 'USE ' . PMA_Util::backquoteCompat($db, $compat) . ';' . $crlf ); } else { @@ -794,7 +794,7 @@ class ExportSql extends ExportPlugin $event_names = PMA_DBI_fetch_result( 'SELECT EVENT_NAME FROM information_schema.EVENTS WHERE' . ' EVENT_SCHEMA= \'' - . $common_functions->sqlAddSlashes($db, true) + . PMA_Util::sqlAddSlashes($db, true) . '\';' ); } else { @@ -813,7 +813,7 @@ class ExportSql extends ExportPlugin foreach ($event_names as $event_name) { if (! empty($GLOBALS['sql_drop_table'])) { $text .= 'DROP EVENT ' - . $common_functions->backquote($event_name) + . PMA_Util::backquote($event_name) . $delimiter . $crlf; } $text .= PMA_DBI_get_definition($db, 'EVENT', $event_name) @@ -845,7 +845,7 @@ class ExportSql extends ExportPlugin $create_query = ''; if (! empty($GLOBALS['sql_drop_table'])) { $create_query .= 'DROP VIEW IF EXISTS ' - . $common_functions->backquote($view) + . PMA_Util::backquote($view) . ';' . $crlf; } @@ -856,11 +856,11 @@ class ExportSql extends ExportPlugin ) { $create_query .= 'IF NOT EXISTS '; } - $create_query .= $common_functions->backquote($view) . ' (' . $crlf; + $create_query .= PMA_Util::backquote($view) . ' (' . $crlf; $tmp = array(); $columns = PMA_DBI_get_columns_full($db, $view); foreach ($columns as $column_name => $definition) { - $tmp[] = $common_functions->backquote($column_name) . ' ' . + $tmp[] = PMA_Util::backquote($column_name) . ' ' . $definition['Type'] . $crlf; } $create_query .= implode(',', $tmp) . ');'; @@ -906,8 +906,8 @@ class ExportSql extends ExportPlugin // need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli $result = PMA_DBI_query( - 'SHOW TABLE STATUS FROM ' . $common_functions->backquote($db) - . ' LIKE \'' . $common_functions->sqlAddSlashes($table, true) . '\'', + 'SHOW TABLE STATUS FROM ' . PMA_Util::backquote($db) + . ' LIKE \'' . PMA_Util::sqlAddSlashes($table, true) . '\'', null, PMA_DBI_QUERY_STORE ); @@ -922,9 +922,9 @@ class ExportSql extends ExportPlugin TABLE_UPDATE_TIME AS Update_time FROM data_dictionary.TABLES WHERE TABLE_SCHEMA = '" - . $common_functions->sqlAddSlashes($db) . "' + . PMA_Util::sqlAddSlashes($db) . "' AND TABLE_NAME = '" - . $common_functions->sqlAddSlashes($table) . "'"; + . PMA_Util::sqlAddSlashes($table) . "'"; $tmpres = array_merge(PMA_DBI_fetch_single_row($sql), $tmpres); } // Here we optionally add the AUTO_INCREMENT next value, @@ -945,7 +945,7 @@ class ExportSql extends ExportPlugin ) { $schema_create .= $this->_exportComment( __('Creation') . ': ' - . $common_functions->localisedDate( + . PMA_Util::localisedDate( strtotime($tmpres['Create_time']) ) ); @@ -958,7 +958,7 @@ class ExportSql extends ExportPlugin ) { $schema_create .= $this->_exportComment( __('Last update') . ': ' - . $common_functions->localisedDate( + . PMA_Util::localisedDate( strtotime($tmpres['Update_time']) ) ); @@ -971,7 +971,7 @@ class ExportSql extends ExportPlugin ) { $schema_create .= $this->_exportComment( __('Last check') . ': ' - . $common_functions->localisedDate( + . PMA_Util::localisedDate( strtotime($tmpres['Check_time']) ) ); @@ -986,7 +986,7 @@ class ExportSql extends ExportPlugin // no need to generate a DROP VIEW here, it was done earlier if (! empty($sql_drop_table) && ! PMA_Table::isView($db, $table)) { $schema_create .= 'DROP TABLE IF EXISTS ' - . $common_functions->backquote($table, $sql_backquotes) . ';' + . PMA_Util::backquote($table, $sql_backquotes) . ';' . $crlf; } @@ -1012,8 +1012,8 @@ class ExportSql extends ExportPlugin // produce a displayable result for the default value of a BIT // column, nor does the mysqldump command. See MySQL bug 35796 $result = PMA_DBI_try_query( - 'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.' - . $common_functions->backquote($table) + 'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($table) ); // an error can happen, for example the table is crashed $tmp_error = PMA_DBI_getError(); @@ -1044,7 +1044,7 @@ class ExportSql extends ExportPlugin */ if ($view) { $create_query = preg_replace( - '/' . $common_functions->backquote($db) . '\./', + '/' . PMA_Util::backquote($db) . '\./', '', $create_query ); @@ -1208,21 +1208,21 @@ class ExportSql extends ExportPlugin . $this->_exportComment( __('Constraints for table') . ' ' - . $common_functions->backquoteCompat($table, $compat) + . PMA_Util::backquoteCompat($table, $compat) ) . $this->_exportComment(); } // let's do the work $sql_constraints_query .= 'ALTER TABLE ' - . $common_functions->backquoteCompat($table, $compat) + . PMA_Util::backquoteCompat($table, $compat) . $crlf; $sql_constraints .= 'ALTER TABLE ' - . $common_functions->backquoteCompat($table, $compat) + . PMA_Util::backquoteCompat($table, $compat) . $crlf; $sql_drop_foreign_keys .= 'ALTER TABLE ' - . $common_functions->backquoteCompat($db, $compat) . '.' - . $common_functions->backquoteCompat($table, $compat) + . PMA_Util::backquoteCompat($db, $compat) . '.' + . PMA_Util::backquoteCompat($table, $compat) . $crlf; $first = true; @@ -1348,18 +1348,18 @@ class ExportSql extends ExportPlugin . $this->_exportComment() . $this->_exportComment( __('MIME TYPES FOR TABLE'). ' ' - . $common_functions->backquote($table, $sql_backquotes) . ':' + . PMA_Util::backquote($table, $sql_backquotes) . ':' ); @reset($mime_map); foreach ($mime_map AS $mime_field => $mime) { $schema_create .= $this->_exportComment( ' ' - . $common_functions->backquote($mime_field, $sql_backquotes) + . PMA_Util::backquote($mime_field, $sql_backquotes) ) . $this->_exportComment( ' ' - . $common_functions->backquote( + . PMA_Util::backquote( $mime['mimetype'], $sql_backquotes ) @@ -1373,23 +1373,23 @@ class ExportSql extends ExportPlugin . $this->_exportComment() . $this->_exportComment( __('RELATIONS FOR TABLE') . ' ' - . $common_functions->backquote($table, $sql_backquotes) + . PMA_Util::backquote($table, $sql_backquotes) . ':' ); foreach ($res_rel AS $rel_field => $rel) { $schema_create .= $this->_exportComment( ' ' - . $common_functions->backquote($rel_field, $sql_backquotes) + . PMA_Util::backquote($rel_field, $sql_backquotes) ) . $this->_exportComment( ' ' - . $common_functions->backquote( + . PMA_Util::backquote( $rel['foreign_table'], $sql_backquotes ) . ' -> ' - . $common_functions->backquote( + . PMA_Util::backquote( $rel['foreign_field'], $sql_backquotes ) @@ -1444,7 +1444,7 @@ class ExportSql extends ExportPlugin } $formatted_table_name = (isset($GLOBALS['sql_backquotes'])) - ? $common_functions->backquoteCompat($table, $compat) + ? PMA_Util::backquoteCompat($table, $compat) : '\'' . $table . '\''; $dump = $this->_possibleCRLF() . $this->_exportComment(str_repeat('-', 56)) @@ -1490,7 +1490,7 @@ class ExportSql extends ExportPlugin // delete the stand-in table previously created (if any) if ($export_type != 'table') { $dump .= 'DROP TABLE IF EXISTS ' - . $common_functions->backquote($table) . ';' . $crlf; + . PMA_Util::backquote($table) . ';' . $crlf; } $dump .= $this->getTableDef( $db, $table, $crlf, $error_url, $dates, true, true @@ -1535,7 +1535,7 @@ class ExportSql extends ExportPlugin } $formatted_table_name = (isset($GLOBALS['sql_backquotes'])) - ? $common_functions->backquoteCompat($table, $compat) + ? PMA_Util::backquoteCompat($table, $compat) : '\'' . $table . '\''; // Do not export data for a VIEW @@ -1582,13 +1582,13 @@ class ExportSql extends ExportPlugin for ($j = 0; $j < $fields_cnt; $j++) { if (isset($analyzed_sql[0]['select_expr'][$j]['column'])) { - $field_set[$j] = $common_functions->backquoteCompat( + $field_set[$j] = PMA_Util::backquoteCompat( $analyzed_sql[0]['select_expr'][$j]['column'], $compat, $sql_backquotes ); } else { - $field_set[$j] = $common_functions->backquoteCompat( + $field_set[$j] = PMA_Util::backquoteCompat( $fields_meta[$j]->name, $compat, $sql_backquotes @@ -1605,7 +1605,7 @@ class ExportSql extends ExportPlugin $schema_insert .= 'IGNORE '; } // avoid EOL blank - $schema_insert .= $common_functions->backquoteCompat( + $schema_insert .= PMA_Util::backquoteCompat( $table, $compat, $sql_backquotes @@ -1640,7 +1640,7 @@ class ExportSql extends ExportPlugin && $sql_command == 'INSERT' ) { $truncate = 'TRUNCATE TABLE ' - . $common_functions->backquoteCompat( + . PMA_Util::backquoteCompat( $table, $compat, $sql_backquotes @@ -1665,7 +1665,7 @@ class ExportSql extends ExportPlugin ) { $fields = implode(', ', $field_set); $schema_insert = $sql_command . $insert_delayed .' INTO ' - . $common_functions->backquoteCompat( + . PMA_Util::backquoteCompat( $table, $compat, $sql_backquotes @@ -1674,7 +1674,7 @@ class ExportSql extends ExportPlugin . ' (' . $fields . ') VALUES'; } else { $schema_insert = $sql_command . $insert_delayed .' INTO ' - . $common_functions->backquoteCompat( + . PMA_Util::backquoteCompat( $table, $compat, $sql_backquotes @@ -1720,7 +1720,7 @@ class ExportSql extends ExportPlugin ) { if (! PMA_exportOutputHandler( 'SET IDENTITY_INSERT ' - . $common_functions->backquoteCompat( + . PMA_Util::backquoteCompat( $table, $compat ) @@ -1762,8 +1762,8 @@ class ExportSql extends ExportPlugin } } elseif ($fields_meta[$j]->type == 'bit') { // detection of 'bit' works only on mysqli extension - $values[] = "b'" . $common_functions->sqlAddSlashes( - $common_functions->printableBitValue( + $values[] = "b'" . PMA_Util::sqlAddSlashes( + PMA_Util::printableBitValue( $row[$j], $fields_meta[$j]->length ) ) @@ -1773,7 +1773,7 @@ class ExportSql extends ExportPlugin $values[] = '\'' . str_replace( $search, $replace, - $common_functions->sqlAddSlashes($row[$j]) + PMA_Util::sqlAddSlashes($row[$j]) ) . '\''; } // end if @@ -1797,7 +1797,7 @@ class ExportSql extends ExportPlugin } list($tmp_unique_condition, $tmp_clause_is_unique) - = $common_functions->getUniqueCondition( + = PMA_Util::getUniqueCondition( $result, $fields_cnt, $fields_meta, @@ -1863,7 +1863,7 @@ class ExportSql extends ExportPlugin ) { $outputSucceeded = PMA_exportOutputHandler( $crlf . 'SET IDENTITY_INSERT ' - . $common_functions->backquoteCompat($table, $compat) + . PMA_Util::backquoteCompat($table, $compat) . ' OFF;' . $crlf ); if (! $outputSucceeded) { diff --git a/libraries/plugins/export/ExportXml.class.php b/libraries/plugins/export/ExportXml.class.php index bfbe6bb677..bcb2ad1bee 100644 --- a/libraries/plugins/export/ExportXml.class.php +++ b/libraries/plugins/export/ExportXml.class.php @@ -192,7 +192,7 @@ class ExportXml extends ExportPlugin } $head .= $crlf . '- ' . __('Generation Time') . ': ' - . $common_functions->localisedDate() . $crlf + . PMA_Util::localisedDate() . $crlf . '- ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf . '- ' . __('PHP Version') . ': ' . phpversion() . $crlf . '-->' . $crlf . $crlf; @@ -211,13 +211,13 @@ class ExportXml extends ExportPlugin DEFAULT_COLLATION_NAME FROM data_dictionary.SCHEMAS WHERE SCHEMA_NAME = '" - . $common_functions->sqlAddSlashes($db) . "'" + . PMA_Util::sqlAddSlashes($db) . "'" ); } else { $result = PMA_DBI_fetch_result( 'SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME`' . ' FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`' - . ' = \''.$common_functions->sqlAddSlashes($db).'\' LIMIT 1' + . ' = \''.PMA_Util::sqlAddSlashes($db).'\' LIMIT 1' ); } $db_collation = $result[0]['DEFAULT_COLLATION_NAME']; @@ -238,8 +238,8 @@ class ExportXml extends ExportPlugin foreach ($tables as $table) { // Export tables and views $result = PMA_DBI_fetch_result( - 'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.' - . $common_functions->backquote($table), + 'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($table), 0 ); $tbl = $result[$table][1]; diff --git a/libraries/plugins/import/ImportCsv.class.php b/libraries/plugins/import/ImportCsv.class.php index 16f5c7529b..216d81ab47 100644 --- a/libraries/plugins/import/ImportCsv.class.php +++ b/libraries/plugins/import/ImportCsv.class.php @@ -212,7 +212,7 @@ class ImportCsv extends ImportPlugin // If there is an error in the parameters entered, // indicate that immediately. if ($param_error) { - $common_functions->mysqlDie($message->getMessage(), '', '', $err_url); + PMA_Util::mysqlDie($message->getMessage(), '', '', $err_url); } $buffer = ''; @@ -227,7 +227,7 @@ class ImportCsv extends ImportPlugin $sql_template .= ' IGNORE'; } } - $sql_template .= ' INTO ' . $common_functions->backquote($table); + $sql_template .= ' INTO ' . PMA_Util::backquote($table); $tmp_fields = PMA_DBI_get_columns($db, $table); @@ -263,7 +263,7 @@ class ImportCsv extends ImportPlugin break; } $fields[] = $field; - $sql_template .= $common_functions->backquote($val); + $sql_template .= PMA_Util::backquote($val); } $sql_template .= ') '; } @@ -495,7 +495,7 @@ class ImportCsv extends ImportPlugin $sql .= 'NULL'; } else { $sql .= '\'' - . $common_functions->sqlAddSlashes($val) + . PMA_Util::sqlAddSlashes($val) . '\''; } diff --git a/libraries/plugins/import/ImportDocsql.class.php b/libraries/plugins/import/ImportDocsql.class.php index 6498b97bab..c4452bb27c 100644 --- a/libraries/plugins/import/ImportDocsql.class.php +++ b/libraries/plugins/import/ImportDocsql.class.php @@ -144,14 +144,14 @@ class ImportDocsql extends ImportPlugin if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) { $qry = ' INSERT INTO - ' . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['column_info']) . ' + ' . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['column_info']) . ' (db_name, table_name, column_name, comment) VALUES ( - \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\', - \'' . $common_functions->sqlAddSlashes(trim($tab)) . '\', - \'' . $common_functions->sqlAddSlashes(trim($inf[0])) . '\', - \'' . $common_functions->sqlAddSlashes(trim($inf[1])) . '\')'; + \'' . PMA_Util::sqlAddSlashes($GLOBALS['db']) . '\', + \'' . PMA_Util::sqlAddSlashes(trim($tab)) . '\', + \'' . PMA_Util::sqlAddSlashes(trim($inf[0])) . '\', + \'' . PMA_Util::sqlAddSlashes(trim($inf[1])) . '\')'; PMA_importRunQuery( $qry, $qry . '-- ' . htmlspecialchars($tab) @@ -163,17 +163,17 @@ class ImportDocsql extends ImportPlugin $for = explode('->', $inf[2]); $qry = ' INSERT INTO - ' . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['relation']) . ' + ' . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['relation']) . ' (master_db, master_table, master_field,' . ' foreign_db, foreign_table, foreign_field) VALUES ( - \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\', - \'' . $common_functions->sqlAddSlashes(trim($tab)) . '\', - \'' . $common_functions->sqlAddSlashes(trim($inf[0])) . '\', - \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\', - \'' . $common_functions->sqlAddSlashes(trim($for[0])) . '\', - \'' . $common_functions->sqlAddSlashes(trim($for[1])) . '\')'; + \'' . PMA_Util::sqlAddSlashes($GLOBALS['db']) . '\', + \'' . PMA_Util::sqlAddSlashes(trim($tab)) . '\', + \'' . PMA_Util::sqlAddSlashes(trim($inf[0])) . '\', + \'' . PMA_Util::sqlAddSlashes($GLOBALS['db']) . '\', + \'' . PMA_Util::sqlAddSlashes(trim($for[0])) . '\', + \'' . PMA_Util::sqlAddSlashes(trim($for[1])) . '\')'; PMA_importRunQuery( $qry, $qry . '-- ' . htmlspecialchars($tab) diff --git a/libraries/plugins/import/ImportLdi.class.php b/libraries/plugins/import/ImportLdi.class.php index 35e941e076..8ee18cda93 100644 --- a/libraries/plugins/import/ImportLdi.class.php +++ b/libraries/plugins/import/ImportLdi.class.php @@ -131,24 +131,24 @@ class ImportLdi extends ImportPlugin if (isset($ldi_local_option)) { $sql .= ' LOCAL'; } - $sql .= ' INFILE \'' . $common_functions->sqlAddSlashes($import_file) . '\''; + $sql .= ' INFILE \'' . PMA_Util::sqlAddSlashes($import_file) . '\''; if (isset($ldi_replace)) { $sql .= ' REPLACE'; } elseif (isset($ldi_ignore)) { $sql .= ' IGNORE'; } - $sql .= ' INTO TABLE ' . $common_functions->backquote($table); + $sql .= ' INTO TABLE ' . PMA_Util::backquote($table); if (strlen($ldi_terminated) > 0) { $sql .= ' FIELDS TERMINATED BY \'' . $ldi_terminated . '\''; } if (strlen($ldi_enclosed) > 0) { $sql .= ' ENCLOSED BY \'' - . $common_functions->sqlAddSlashes($ldi_enclosed) . '\''; + . PMA_Util::sqlAddSlashes($ldi_enclosed) . '\''; } if (strlen($ldi_escaped) > 0) { $sql .= ' ESCAPED BY \'' - . $common_functions->sqlAddSlashes($ldi_escaped) . '\''; + . PMA_Util::sqlAddSlashes($ldi_escaped) . '\''; } if (strlen($ldi_new_line) > 0) { if ($ldi_new_line == 'auto') { @@ -172,7 +172,7 @@ class ImportLdi extends ImportPlugin $sql .= ', '; } /* Trim also `, if user already included backquoted fields */ - $sql .= $common_functions->backquote( + $sql .= PMA_Util::backquote( trim($tmp[$i], " \t\r\n\0\x0B`") ); } // end for diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index 9e302895ed..3ba44e2d43 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -258,11 +258,11 @@ function PMA_getRelationsParamDiagnostic($cfgRelation) 'Create the needed tables with the ' . '<code>examples/create_tables.sql</code>.' ); - $retval .= ' ' . $common_functions->showDocu('linked-tables'); + $retval .= ' ' . PMA_Util::showDocu('linked-tables'); $retval .= '</li>'; $retval .= '<li>'; $retval .= __('Create a pma user and give access to these tables.'); - $retval .= ' ' . $common_functions->showDocu('pmausr'); + $retval .= ' ' . PMA_Util::showDocu('pmausr'); $retval .= '</li>'; $retval .= '<li>'; $retval .= __( @@ -270,7 +270,7 @@ function PMA_getRelationsParamDiagnostic($cfgRelation) . '(<code>config.inc.php</code>), for example by ' . 'starting from <code>config.sample.inc.php</code>.' ); - $retval .= ' ' . $common_functions->showDocu('quick_install'); + $retval .= ' ' . PMA_Util::showDocu('quick_install'); $retval .= '</li>'; $retval .= '<li>'; $retval .= __( @@ -506,11 +506,11 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') `foreign_db`, `foreign_table`, `foreign_field` - FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) . ' - WHERE `master_db` = \'' . $common_functions->sqlAddSlashes($db) . '\' - AND `master_table` = \'' . $common_functions->sqlAddSlashes($table) . '\' '; + FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) . ' + WHERE `master_db` = \'' . PMA_Util::sqlAddSlashes($db) . '\' + AND `master_table` = \'' . PMA_Util::sqlAddSlashes($table) . '\' '; if (strlen($column)) { - $rel_query .= ' AND `master_field` = \'' . $common_functions->sqlAddSlashes($column) . '\''; + $rel_query .= ' AND `master_field` = \'' . PMA_Util::sqlAddSlashes($column) . '\''; } $foreign = PMA_DBI_fetch_result($rel_query, 'master_field', null, $GLOBALS['controllink']); } @@ -518,7 +518,7 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') if (($source == 'both' || $source == 'foreign') && strlen($table)) { $show_create_table_query = 'SHOW CREATE TABLE ' - . $common_functions->backquote($db) . '.' . $common_functions->backquote($table); + . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table); $show_create_table = PMA_DBI_fetch_value($show_create_table_query, 0, 1); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); @@ -610,9 +610,9 @@ function PMA_getDisplayField($db, $table) if ($cfgRelation['displaywork']) { $disp_query = ' SELECT `display_field` - FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) . ' - WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($db) . '\' - AND `table_name` = \'' . $common_functions->sqlAddSlashes($table) . '\''; + FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) . ' + WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($db) . '\' + AND `table_name` = \'' . PMA_Util::sqlAddSlashes($table) . '\''; $row = PMA_DBI_fetch_single_row($disp_query, 'ASSOC', $GLOBALS['controllink']); if (isset($row['display_field'])) { @@ -689,8 +689,8 @@ function PMA_getDbComment($db) // pmadb internal db comment $com_qry = " SELECT `comment` - FROM " . $common_functions->backquote($cfgRelation['db']) . "." . $common_functions->backquote($cfgRelation['column_info']) . " - WHERE db_name = '" . $common_functions->sqlAddSlashes($db) . "' + FROM " . PMA_Util::backquote($cfgRelation['db']) . "." . PMA_Util::backquote($cfgRelation['column_info']) . " + WHERE db_name = '" . PMA_Util::sqlAddSlashes($db) . "' AND table_name = '' AND column_name = '(db_comment)'"; $com_rs = PMA_queryAsControlUser($com_qry, true, PMA_DBI_QUERY_STORE); @@ -722,7 +722,7 @@ function PMA_getDbComments() // pmadb internal db comment $com_qry = " SELECT `db_name`, `comment` - FROM " . $common_functions->backquote($cfgRelation['db']) . "." . $common_functions->backquote($cfgRelation['column_info']) . " + FROM " . PMA_Util::backquote($cfgRelation['db']) . "." . PMA_Util::backquote($cfgRelation['column_info']) . " WHERE `column_name` = '(db_comment)'"; $com_rs = PMA_queryAsControlUser($com_qry, true, PMA_DBI_QUERY_STORE); @@ -759,20 +759,20 @@ function PMA_setDbComment($db, $comment = '') if (strlen($comment)) { $upd_query = " INSERT INTO - " . $common_functions->backquote($cfgRelation['db']) . "." . $common_functions->backquote($cfgRelation['column_info']) . " + " . PMA_Util::backquote($cfgRelation['db']) . "." . PMA_Util::backquote($cfgRelation['column_info']) . " (`db_name`, `table_name`, `column_name`, `comment`) VALUES ( - '" . $common_functions->sqlAddSlashes($db) . "', + '" . PMA_Util::sqlAddSlashes($db) . "', '', '(db_comment)', - '" . $common_functions->sqlAddSlashes($comment) . "') + '" . PMA_Util::sqlAddSlashes($comment) . "') ON DUPLICATE KEY UPDATE - `comment` = '" . $common_functions->sqlAddSlashes($comment) . "'"; + `comment` = '" . PMA_Util::sqlAddSlashes($comment) . "'"; } else { $upd_query = ' DELETE FROM - ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']) . ' - WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($db) . '\' + ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']) . ' + WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($db) . '\' AND `table_name` = \'\' AND `column_name` = \'(db_comment)\''; } @@ -832,18 +832,18 @@ function PMA_setHistory($db, $table, $username, $sqlquery) PMA_queryAsControlUser( 'INSERT INTO - ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['history']) . ' + ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['history']) . ' (`username`, `db`, `table`, `timevalue`, `sqlquery`) VALUES - (\'' . $common_functions->sqlAddSlashes($username) . '\', - \'' . $common_functions->sqlAddSlashes($db) . '\', - \'' . $common_functions->sqlAddSlashes($table) . '\', + (\'' . PMA_Util::sqlAddSlashes($username) . '\', + \'' . PMA_Util::sqlAddSlashes($db) . '\', + \'' . PMA_Util::sqlAddSlashes($table) . '\', NOW(), - \'' . $common_functions->sqlAddSlashes($sqlquery) . '\')' + \'' . PMA_Util::sqlAddSlashes($sqlquery) . '\')' ); } // end of 'PMA_setHistory()' function @@ -869,8 +869,8 @@ function PMA_getHistory($username) SELECT `db`, `table`, `sqlquery` - FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['history']) . ' - WHERE `username` = \'' . $common_functions->sqlAddSlashes($username) . '\' + FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['history']) . ' + WHERE `username` = \'' . PMA_Util::sqlAddSlashes($username) . '\' ORDER BY `id` DESC'; return PMA_DBI_fetch_result($hist_query, null, null, $GLOBALS['controllink']); @@ -902,16 +902,16 @@ function PMA_purgeHistory($username) $search_query = ' SELECT `timevalue` - FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['history']) . ' - WHERE `username` = \'' . $common_functions->sqlAddSlashes($username) . '\' + FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['history']) . ' + WHERE `username` = \'' . PMA_Util::sqlAddSlashes($username) . '\' ORDER BY `timevalue` DESC LIMIT ' . $GLOBALS['cfg']['QueryHistoryMax'] . ', 1'; if ($max_time = PMA_DBI_fetch_value($search_query, 0, 0, $GLOBALS['controllink'])) { PMA_queryAsControlUser( 'DELETE FROM - ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['history']) . ' - WHERE `username` = \'' . $common_functions->sqlAddSlashes($username) . '\' + ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['history']) . ' + WHERE `username` = \'' . PMA_Util::sqlAddSlashes($username) . '\' AND `timevalue` <= \'' . $max_time . '\'' ); } @@ -1100,15 +1100,15 @@ function PMA_getForeignData($foreigners, $field, $override_total, $foreign_filte // foreign_display can be false if no display field defined: $foreign_display = PMA_getDisplayField($foreign_db, $foreign_table); - $f_query_main = 'SELECT ' . $common_functions->backquote($foreign_field) - . (($foreign_display == false) ? '' : ', ' . $common_functions->backquote($foreign_display)); - $f_query_from = ' FROM ' . $common_functions->backquote($foreign_db) . '.' . $common_functions->backquote($foreign_table); - $f_query_filter = empty($foreign_filter) ? '' : ' WHERE ' . $common_functions->backquote($foreign_field) - . ' LIKE "%' . $common_functions->sqlAddSlashes($foreign_filter, true) . '%"' - . (($foreign_display == false) ? '' : ' OR ' . $common_functions->backquote($foreign_display) - . ' LIKE "%' . $common_functions->sqlAddSlashes($foreign_filter, true) . '%"' + $f_query_main = 'SELECT ' . PMA_Util::backquote($foreign_field) + . (($foreign_display == false) ? '' : ', ' . PMA_Util::backquote($foreign_display)); + $f_query_from = ' FROM ' . PMA_Util::backquote($foreign_db) . '.' . PMA_Util::backquote($foreign_table); + $f_query_filter = empty($foreign_filter) ? '' : ' WHERE ' . PMA_Util::backquote($foreign_field) + . ' LIKE "%' . PMA_Util::sqlAddSlashes($foreign_filter, true) . '%"' + . (($foreign_display == false) ? '' : ' OR ' . PMA_Util::backquote($foreign_display) + . ' LIKE "%' . PMA_Util::sqlAddSlashes($foreign_filter, true) . '%"' ); - $f_query_order = ($foreign_display == false) ? '' :' ORDER BY ' . $common_functions->backquote($foreign_table) . '.' . $common_functions->backquote($foreign_display); + $f_query_order = ($foreign_display == false) ? '' :' ORDER BY ' . PMA_Util::backquote($foreign_table) . '.' . PMA_Util::backquote($foreign_display); $f_query_limit = isset($foreign_limit) ? $foreign_limit : ''; if (!empty($foreign_filter)) { @@ -1179,10 +1179,10 @@ function PMA_getRelatives($all_tables, $master) $in_know = '(\'' . implode('\', \'', $known_tables) . '\')'; $in_left = '(\'' . implode('\', \'', $remaining_tables) . '\')'; $rel_query = 'SELECT *' - . ' FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) - . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['relation']) - . ' WHERE ' . $from . '_db = \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\'' - . ' AND ' . $to . '_db = \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\'' + . ' FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) + . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['relation']) + . ' WHERE ' . $from . '_db = \'' . PMA_Util::sqlAddSlashes($GLOBALS['db']) . '\'' + . ' AND ' . $to . '_db = \'' . PMA_Util::sqlAddSlashes($GLOBALS['db']) . '\'' . ' AND ' . $from . '_table IN ' . $in_know . ' AND ' . $to . '_table IN ' . $in_left; $relations = @PMA_DBI_query($rel_query, $GLOBALS['controllink']); @@ -1191,11 +1191,11 @@ function PMA_getRelatives($all_tables, $master) if (isset($remaining_tables[$found_table])) { $fromclause .= "\n" . ' LEFT JOIN ' - . $common_functions->backquote($GLOBALS['db']) . '.' . $common_functions->backquote($row[$to . '_table']) . ' ON ' - . $common_functions->backquote($row[$from . '_table']) . '.' - . $common_functions->backquote($row[$from . '_field']) . ' = ' - . $common_functions->backquote($row[$to . '_table']) . '.' - . $common_functions->backquote($row[$to . '_field']) . ' '; + . PMA_Util::backquote($GLOBALS['db']) . '.' . PMA_Util::backquote($row[$to . '_table']) . ' ON ' + . PMA_Util::backquote($row[$from . '_table']) . '.' + . PMA_Util::backquote($row[$from . '_field']) . ' = ' + . PMA_Util::backquote($row[$to . '_table']) . '.' + . PMA_Util::backquote($row[$to . '_field']) . ' '; $known_tables[$found_table] = $found_table; unset($remaining_tables[$found_table]); } @@ -1203,7 +1203,7 @@ function PMA_getRelatives($all_tables, $master) $run++; if ($run > 5) { foreach ($remaining_tables as $table) { - $emerg .= ', ' . $common_functions->backquote($table); + $emerg .= ', ' . PMA_Util::backquote($table); unset($remaining_tables[$table]); } } @@ -1231,32 +1231,32 @@ function PMA_REL_renameField($db, $table, $field, $new_name) if ($cfgRelation['displaywork']) { $table_query = 'UPDATE ' - . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['table_info']) - . ' SET display_field = \'' . $common_functions->sqlAddSlashes($new_name) . '\'' - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND display_field = \'' . $common_functions->sqlAddSlashes($field) . '\''; + . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['table_info']) + . ' SET display_field = \'' . PMA_Util::sqlAddSlashes($new_name) . '\'' + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND display_field = \'' . PMA_Util::sqlAddSlashes($field) . '\''; PMA_queryAsControlUser($table_query); } if ($cfgRelation['relwork']) { $table_query = 'UPDATE ' - . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['relation']) - . ' SET master_field = \'' . $common_functions->sqlAddSlashes($new_name) . '\'' - . ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND master_table = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND master_field = \'' . $common_functions->sqlAddSlashes($field) . '\''; + . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['relation']) + . ' SET master_field = \'' . PMA_Util::sqlAddSlashes($new_name) . '\'' + . ' WHERE master_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($field) . '\''; PMA_queryAsControlUser($table_query); $table_query = 'UPDATE ' - . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['relation']) - . ' SET foreign_field = \'' . $common_functions->sqlAddSlashes($new_name) . '\'' - . ' WHERE foreign_db = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND foreign_table = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND foreign_field = \'' . $common_functions->sqlAddSlashes($field) . '\''; + . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['relation']) + . ' SET foreign_field = \'' . PMA_Util::sqlAddSlashes($new_name) . '\'' + . ' WHERE foreign_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND foreign_field = \'' . PMA_Util::sqlAddSlashes($field) . '\''; PMA_queryAsControlUser($table_query); } // end if relwork @@ -1283,14 +1283,14 @@ function PMA_REL_renameSingleTable($table, ) { $query = 'UPDATE ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($GLOBALS['cfgRelation'][$table]) - . ' SET ' . $db_field . ' = \'' . $common_functions->sqlAddSlashes($target_db) . '\', ' - . ' ' . $table_field . ' = \'' . $common_functions->sqlAddSlashes($target_table) . '\'' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($GLOBALS['cfgRelation'][$table]) + . ' SET ' . $db_field . ' = \'' . PMA_Util::sqlAddSlashes($target_db) . '\', ' + . ' ' . $table_field . ' = \'' . PMA_Util::sqlAddSlashes($target_table) . '\'' . ' WHERE ' - . $db_field . ' = \'' . $common_functions->sqlAddSlashes($source_db) . '\'' + . $db_field . ' = \'' . PMA_Util::sqlAddSlashes($source_db) . '\'' . ' AND ' - . $table_field . ' = \'' . $common_functions->sqlAddSlashes($source_table) . '\''; + . $table_field . ' = \'' . PMA_Util::sqlAddSlashes($source_table) . '\''; PMA_queryAsControlUser($query); } @@ -1389,12 +1389,12 @@ function PMA_REL_createPage($newpage, $cfgRelation, $db) $newpage = __('no description'); } $ins_query = 'INSERT INTO ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($cfgRelation['pdf_pages']) + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($cfgRelation['pdf_pages']) . ' (db_name, page_descr)' . ' VALUES (\'' - . $common_functions->sqlAddSlashes($db) . '\', \'' - . $common_functions->sqlAddSlashes($newpage) . '\')'; + . PMA_Util::sqlAddSlashes($db) . '\', \'' + . PMA_Util::sqlAddSlashes($newpage) . '\')'; PMA_queryAsControlUser($ins_query, false); return PMA_DBI_insert_id( diff --git a/libraries/relation_cleanup.lib.php b/libraries/relation_cleanup.lib.php index a2493de99d..a255082327 100644 --- a/libraries/relation_cleanup.lib.php +++ b/libraries/relation_cleanup.lib.php @@ -22,32 +22,32 @@ function PMA_relationsCleanupColumn($db, $table, $column) $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['commwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND column_name = \'' . $common_functions->sqlAddSlashes($column) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND column_name = \'' . PMA_Util::sqlAddSlashes($column) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['displaywork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND display_field = \'' . $common_functions->sqlAddSlashes($column) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND display_field = \'' . PMA_Util::sqlAddSlashes($column) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['relwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) - . ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND master_table = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND master_field = \'' . $common_functions->sqlAddSlashes($column) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) + . ' WHERE master_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($column) . '\''; PMA_queryAsControlUser($remove_query); - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) - . ' WHERE foreign_db = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND foreign_table = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND foreign_field = \'' . $common_functions->sqlAddSlashes($column) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) + . ' WHERE foreign_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND foreign_field = \'' . PMA_Util::sqlAddSlashes($column) . '\''; PMA_queryAsControlUser($remove_query); } } @@ -64,42 +64,42 @@ function PMA_relationsCleanupTable($db, $table) $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['commwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['displaywork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['pdfwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['table_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['designerwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['designer_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['designer_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['relwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) - . ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND master_table = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) + . ' WHERE master_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($table) . '\''; PMA_queryAsControlUser($remove_query); - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) - . ' WHERE foreign_db = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND foreign_table = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) + . ' WHERE foreign_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($table) . '\''; PMA_queryAsControlUser($remove_query); } } @@ -115,46 +115,46 @@ function PMA_relationsCleanupDatabase($db) $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['commwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['bookmarkwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['bookmark']) - . ' WHERE dbase = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['bookmark']) + . ' WHERE dbase = \'' . PMA_Util::sqlAddSlashes($db) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['displaywork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['pdfwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['pdf_pages']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['pdf_pages']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''; PMA_queryAsControlUser($remove_query); - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['table_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['designerwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['designer_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['designer_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''; PMA_queryAsControlUser($remove_query); } if ($cfgRelation['relwork']) { - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) - . ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) + . ' WHERE master_db = \'' . PMA_Util::sqlAddSlashes($db) . '\''; PMA_queryAsControlUser($remove_query); - $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) - . ' WHERE foreign_db = \'' . $common_functions->sqlAddSlashes($db) . '\''; + $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) + . ' WHERE foreign_db = \'' . PMA_Util::sqlAddSlashes($db) . '\''; PMA_queryAsControlUser($remove_query); } } diff --git a/libraries/rte/rte_events.lib.php b/libraries/rte/rte_events.lib.php index 0ba80296f9..ede101b5b8 100644 --- a/libraries/rte/rte_events.lib.php +++ b/libraries/rte/rte_events.lib.php @@ -96,7 +96,7 @@ function PMA_EVN_handleEditor() 'EVENT', $_REQUEST['item_original_name'] ); - $drop_item = "DROP EVENT " . $common_functions->backquote($_REQUEST['item_original_name']) . ";\n"; + $drop_item = "DROP EVENT " . PMA_Util::backquote($_REQUEST['item_original_name']) . ";\n"; $result = PMA_DBI_try_query($drop_item); if (! $result) { $errors[] = sprintf(__('The following query has failed: "%s"'), $drop_item) . '<br />' @@ -119,7 +119,7 @@ function PMA_EVN_handleEditor() } } else { $message = PMA_Message::success(__('Event %1$s has been modified.')); - $message->addParam($common_functions->backquote($_REQUEST['item_name'])); + $message->addParam(PMA_Util::backquote($_REQUEST['item_name'])); $sql_query = $drop_item . $item_query; } } @@ -131,7 +131,7 @@ function PMA_EVN_handleEditor() . __('MySQL said: ') . PMA_DBI_getError(null); } else { $message = PMA_Message::success(__('Event %1$s has been created.')); - $message->addParam($common_functions->backquote($_REQUEST['item_name'])); + $message->addParam(PMA_Util::backquote($_REQUEST['item_name'])); $sql_query = $item_query; } } @@ -146,13 +146,13 @@ function PMA_EVN_handleEditor() $message->addString('</ul>'); } - $output = $common_functions->getMessage($message, $sql_query); + $output = PMA_Util::getMessage($message, $sql_query); if ($GLOBALS['is_ajax_request']) { $response = PMA_Response::getInstance(); if ($message->isSuccess()) { $columns = "`EVENT_NAME`, `EVENT_TYPE`, `STATUS`"; - $where = "EVENT_SCHEMA='" . $common_functions->sqlAddSlashes($db) . "' " - . "AND EVENT_NAME='" . $common_functions->sqlAddSlashes($_REQUEST['item_name']) . "'"; + $where = "EVENT_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "' " + . "AND EVENT_NAME='" . PMA_Util::sqlAddSlashes($_REQUEST['item_name']) . "'"; $query = "SELECT $columns FROM `INFORMATION_SCHEMA`.`EVENTS` WHERE $where;"; $event = PMA_DBI_fetch_single_row($query); $response->addJSON('name', htmlspecialchars(strtoupper($_REQUEST['item_name']))); @@ -213,8 +213,8 @@ function PMA_EVN_handleEditor() $message = __('Error in processing request') . ' : '; $message .= sprintf( PMA_RTE_getWord('not_found'), - htmlspecialchars($common_functions->backquote($_REQUEST['item_name'])), - htmlspecialchars($common_functions->backquote($db)) + htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])), + htmlspecialchars(PMA_Util::backquote($db)) ); $message = PMA_message::error($message); if ($GLOBALS['is_ajax_request']) { @@ -277,8 +277,8 @@ function PMA_EVN_getDataFromName($name) $columns = "`EVENT_NAME`, `STATUS`, `EVENT_TYPE`, `EXECUTE_AT`, " . "`INTERVAL_VALUE`, `INTERVAL_FIELD`, `STARTS`, `ENDS`, " . "`EVENT_DEFINITION`, `ON_COMPLETION`, `DEFINER`, `EVENT_COMMENT`"; - $where = "EVENT_SCHEMA='" . $common_functions->sqlAddSlashes($db) . "' " - . "AND EVENT_NAME='" . $common_functions->sqlAddSlashes($name) . "'"; + $where = "EVENT_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "' " + . "AND EVENT_NAME='" . PMA_Util::sqlAddSlashes($name) . "'"; $query = "SELECT $columns FROM `INFORMATION_SCHEMA`.`EVENTS` WHERE $where;"; $item = PMA_DBI_fetch_single_row($query); if (! $item) { @@ -516,15 +516,15 @@ function PMA_EVN_getQueryFromRequest() if (! empty($_REQUEST['item_definer'])) { if (strpos($_REQUEST['item_definer'], '@') !== false) { $arr = explode('@', $_REQUEST['item_definer']); - $query .= 'DEFINER=' . $common_functions->backquote($arr[0]); - $query .= '@' . $common_functions->backquote($arr[1]) . ' '; + $query .= 'DEFINER=' . PMA_Util::backquote($arr[0]); + $query .= '@' . PMA_Util::backquote($arr[1]) . ' '; } else { $errors[] = __('The definer must be in the "username@hostname" format'); } } $query .= 'EVENT '; if (! empty($_REQUEST['item_name'])) { - $query .= $common_functions->backquote($_REQUEST['item_name']) . ' '; + $query .= PMA_Util::backquote($_REQUEST['item_name']) . ' '; } else { $errors[] = __('You must provide an event name'); } @@ -541,14 +541,14 @@ function PMA_EVN_getQueryFromRequest() $errors[] = __('You must provide a valid interval value for the event.'); } if (! empty($_REQUEST['item_starts'])) { - $query .= "STARTS '" . $common_functions->sqlAddSlashes($_REQUEST['item_starts']) . "' "; + $query .= "STARTS '" . PMA_Util::sqlAddSlashes($_REQUEST['item_starts']) . "' "; } if (! empty($_REQUEST['item_ends'])) { - $query .= "ENDS '" . $common_functions->sqlAddSlashes($_REQUEST['item_ends']) . "' "; + $query .= "ENDS '" . PMA_Util::sqlAddSlashes($_REQUEST['item_ends']) . "' "; } } else { if (! empty($_REQUEST['item_execute_at'])) { - $query .= "AT '" . $common_functions->sqlAddSlashes($_REQUEST['item_execute_at']) . "' "; + $query .= "AT '" . PMA_Util::sqlAddSlashes($_REQUEST['item_execute_at']) . "' "; } else { $errors[] = __('You must provide a valid execution time for the event.'); } @@ -570,7 +570,7 @@ function PMA_EVN_getQueryFromRequest() } } if (! empty($_REQUEST['item_comment'])) { - $query .= "COMMENT '" . $common_functions->sqlAddslashes( + $query .= "COMMENT '" . PMA_Util::sqlAddslashes( $_REQUEST['item_comment'] ) . "' "; } diff --git a/libraries/rte/rte_footer.lib.php b/libraries/rte/rte_footer.lib.php index af64632ad8..41f2bbc54f 100644 --- a/libraries/rte/rte_footer.lib.php +++ b/libraries/rte/rte_footer.lib.php @@ -28,17 +28,17 @@ function PMA_RTE_getFooterLinks($docu, $priv, $name) $retval .= "<fieldset class='left'>\n"; $retval .= " <legend>" . __('New'). "</legend>\n"; $retval .= " <div class='wrap'>\n"; - if ($common_functions->currentUserHasPrivilege($priv, $db)) { + if (PMA_Util::currentUserHasPrivilege($priv, $db)) { $retval .= " <a {$ajax_class['add']} "; $retval .= "href='db_" . strtolower($name) . "s.php"; $retval .= "?$url_query&add_item=1'>"; - $retval .= $common_functions->getIcon($icon); + $retval .= PMA_Util::getIcon($icon); $retval .= PMA_RTE_getWord('add') . "</a>\n"; } else { - $retval .= " " . $common_functions->getIcon($icon); + $retval .= " " . PMA_Util::getIcon($icon); $retval .= PMA_RTE_getWord('no_create') . "\n"; } - $retval .= " " . $common_functions->showMySQLDocu('SQL-Syntax', $docu) . "\n"; + $retval .= " " . PMA_Util::showMySQLDocu('SQL-Syntax', $docu) . "\n"; $retval .= " </div>\n"; $retval .= "</fieldset>\n"; $retval .= "<!-- ADD " . $name . " FORM END -->\n\n"; diff --git a/libraries/rte/rte_list.lib.php b/libraries/rte/rte_list.lib.php index 85877ab99f..51cdae5849 100644 --- a/libraries/rte/rte_list.lib.php +++ b/libraries/rte/rte_list.lib.php @@ -146,8 +146,8 @@ function PMA_RTN_getRowForList($routine, $rowclass = '') $retval .= " </td>\n"; $retval .= " <td>\n"; if ($routine['ROUTINE_DEFINITION'] !== null - && $common_functions->currentUserHasPrivilege('ALTER ROUTINE', $db) - && $common_functions->currentUserHasPrivilege('CREATE ROUTINE', $db) + && PMA_Util::currentUserHasPrivilege('ALTER ROUTINE', $db) + && PMA_Util::currentUserHasPrivilege('CREATE ROUTINE', $db) ) { $retval .= ' <a ' . $ajax_class['edit'] . ' href="db_routines.php?' @@ -162,7 +162,7 @@ function PMA_RTN_getRowForList($routine, $rowclass = '') $retval .= " </td>\n"; $retval .= " <td>\n"; if ($routine['ROUTINE_DEFINITION'] !== null - && $common_functions->currentUserHasPrivilege('EXECUTE', $db) + && PMA_Util::currentUserHasPrivilege('EXECUTE', $db) ) { // Check if he routine has any input parameters. If it does, // we will show a dialog to get values for these parameters, @@ -205,7 +205,7 @@ function PMA_RTN_getRowForList($routine, $rowclass = '') . '">' . $titles['Export'] . "</a>\n"; $retval .= " </td>\n"; $retval .= " <td>\n"; - if ($common_functions->currentUserHasPrivilege('ALTER ROUTINE', $db)) { + if (PMA_Util::currentUserHasPrivilege('ALTER ROUTINE', $db)) { $retval .= ' <a ' . $ajax_class['drop'] . ' href="sql.php?' . $url_query @@ -254,7 +254,7 @@ function PMA_TRI_getRowForList($trigger, $rowclass = '') $retval .= " </td>\n"; } $retval .= " <td>\n"; - if ($common_functions->currentUserHasPrivilege('TRIGGER', $db, $table)) { + if (PMA_Util::currentUserHasPrivilege('TRIGGER', $db, $table)) { $retval .= ' <a ' . $ajax_class['edit'] . ' href="db_triggers.php?' . $url_query @@ -274,7 +274,7 @@ function PMA_TRI_getRowForList($trigger, $rowclass = '') . '">' . $titles['Export'] . "</a>\n"; $retval .= " </td>\n"; $retval .= " <td>\n"; - if ($common_functions->currentUserHasPrivilege('TRIGGER', $db)) { + if (PMA_Util::currentUserHasPrivilege('TRIGGER', $db)) { $retval .= ' <a ' . $ajax_class['drop'] . ' href="sql.php?' . $url_query @@ -324,7 +324,7 @@ function PMA_EVN_getRowForList($event, $rowclass = '') $retval .= " {$event['STATUS']}\n"; $retval .= " </td>\n"; $retval .= " <td>\n"; - if ($common_functions->currentUserHasPrivilege('EVENT', $db)) { + if (PMA_Util::currentUserHasPrivilege('EVENT', $db)) { $retval .= ' <a ' . $ajax_class['edit'] . ' href="db_events.php?' . $url_query @@ -344,7 +344,7 @@ function PMA_EVN_getRowForList($event, $rowclass = '') . '">' . $titles['Export'] . "</a>\n"; $retval .= " </td>\n"; $retval .= " <td>\n"; - if ($common_functions->currentUserHasPrivilege('EVENT', $db)) { + if (PMA_Util::currentUserHasPrivilege('EVENT', $db)) { $retval .= ' <a ' . $ajax_class['drop'] . ' href="sql.php?' . $url_query diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index a042f80390..0018ebb392 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -281,7 +281,7 @@ function PMA_RTN_handleEditor() } else { // Backup the old routine, in case something goes wrong $create_routine = PMA_DBI_get_definition($db, $_REQUEST['item_original_type'], $_REQUEST['item_original_name']); - $drop_routine = "DROP {$_REQUEST['item_original_type']} " . $common_functions->backquote($_REQUEST['item_original_name']) . ";\n"; + $drop_routine = "DROP {$_REQUEST['item_original_type']} " . PMA_Util::backquote($_REQUEST['item_original_name']) . ";\n"; $result = PMA_DBI_try_query($drop_routine); if (! $result) { $errors[] = sprintf(__('The following query has failed: "%s"'), $drop_routine) . '<br />' @@ -304,7 +304,7 @@ function PMA_RTN_handleEditor() } } else { $message = PMA_Message::success(__('Routine %1$s has been modified.')); - $message->addParam($common_functions->backquote($_REQUEST['item_name'])); + $message->addParam(PMA_Util::backquote($_REQUEST['item_name'])); $sql_query = $drop_routine . $routine_query; } } @@ -323,7 +323,7 @@ function PMA_RTN_handleEditor() __('Routine %1$s has been created.') ); $message->addParam( - $common_functions->backquote($_REQUEST['item_name']) + PMA_Util::backquote($_REQUEST['item_name']) ); $sql_query = $routine_query; } @@ -341,14 +341,14 @@ function PMA_RTN_handleEditor() $message->addString('</ul>'); } - $output = $common_functions->getMessage($message, $sql_query); + $output = PMA_Util::getMessage($message, $sql_query); if ($GLOBALS['is_ajax_request']) { $response = PMA_Response::getInstance(); if ($message->isSuccess()) { $columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, `DTD_IDENTIFIER`, `ROUTINE_DEFINITION`"; - $where = "ROUTINE_SCHEMA='" . $common_functions->sqlAddSlashes($db) . "' " - . "AND ROUTINE_NAME='" . $common_functions->sqlAddSlashes($_REQUEST['item_name']) . "'" - . "AND ROUTINE_TYPE='" . $common_functions->sqlAddSlashes($_REQUEST['item_type']) . "'"; + $where = "ROUTINE_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "' " + . "AND ROUTINE_NAME='" . PMA_Util::sqlAddSlashes($_REQUEST['item_name']) . "'" + . "AND ROUTINE_TYPE='" . PMA_Util::sqlAddSlashes($_REQUEST['item_type']) . "'"; $routine = PMA_DBI_fetch_single_row("SELECT $columns FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE $where;"); $response->addJSON('name', htmlspecialchars(strtoupper($_REQUEST['item_name']))); $response->addJSON('new_row', PMA_RTN_getRowForList($routine)); @@ -415,8 +415,8 @@ function PMA_RTN_handleEditor() $message = __('Error in processing request') . ' : '; $message .= sprintf( PMA_RTE_getWord('not_found'), - htmlspecialchars($common_functions->backquote($_REQUEST['item_name'])), - htmlspecialchars($common_functions->backquote($db)) + htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])), + htmlspecialchars(PMA_Util::backquote($db)) ); $message = PMA_message::error($message); if ($GLOBALS['is_ajax_request']) { @@ -496,7 +496,7 @@ function PMA_RTN_getDataFromRequest() $retval['item_param_name'] = $_REQUEST['item_param_name']; $retval['item_param_type'] = $_REQUEST['item_param_type']; foreach ($retval['item_param_type'] as $key => $value) { - if (! in_array($value, $common_functions->getSupportedDatatypes(), true)) { + if (! in_array($value, PMA_Util::getSupportedDatatypes(), true)) { $retval['item_param_type'][$key] = ''; } } @@ -513,7 +513,7 @@ function PMA_RTN_getDataFromRequest() } $retval['item_returntype'] = ''; if (isset($_REQUEST['item_returntype']) - && in_array($_REQUEST['item_returntype'], $common_functions->getSupportedDatatypes()) + && in_array($_REQUEST['item_returntype'], PMA_Util::getSupportedDatatypes()) ) { $retval['item_returntype'] = $_REQUEST['item_returntype']; } @@ -564,9 +564,9 @@ function PMA_RTN_getDataFromName($name, $type, $all = true) $fields = "SPECIFIC_NAME, ROUTINE_TYPE, DTD_IDENTIFIER, " . "ROUTINE_DEFINITION, IS_DETERMINISTIC, SQL_DATA_ACCESS, " . "ROUTINE_COMMENT, SECURITY_TYPE"; - $where = "ROUTINE_SCHEMA='" . $common_functions->sqlAddSlashes($db) . "' " - . "AND SPECIFIC_NAME='" . $common_functions->sqlAddSlashes($name) . "'" - . "AND ROUTINE_TYPE='" . $common_functions->sqlAddSlashes($type) . "'"; + $where = "ROUTINE_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "' " + . "AND SPECIFIC_NAME='" . PMA_Util::sqlAddSlashes($name) . "'" + . "AND ROUTINE_TYPE='" . PMA_Util::sqlAddSlashes($type) . "'"; $query = "SELECT $fields FROM INFORMATION_SCHEMA.ROUTINES WHERE $where;"; $routine = PMA_DBI_fetch_single_row($query); @@ -727,7 +727,7 @@ function PMA_RTN_getParameterRow($routine = array(), $index = null, $class = '') $retval .= " <td><input name='item_param_name[$index]' type='text'\n"; $retval .= " value='{$routine['item_param_name'][$i]}' /></td>\n"; $retval .= " <td><select name='item_param_type[$index]'>"; - $retval .= $common_functions->getSupportedDatatypes( + $retval .= PMA_Util::getSupportedDatatypes( true, $routine['item_param_type'][$i] ) . "\n"; $retval .= " </select></td>\n"; @@ -737,7 +737,7 @@ function PMA_RTN_getParameterRow($routine = array(), $index = null, $class = '') $retval .= " value='{$routine['item_param_length'][$i]}' />\n"; $retval .= " <div class='enum_hint'>\n"; $retval .= " <a href='#' class='open_enum_editor'>\n"; - $retval .= " " . $common_functions->getImage('b_edit', '', array('title'=>__('ENUM/SET editor'))) . "\n"; + $retval .= " " . PMA_Util::getImage('b_edit', '', array('title'=>__('ENUM/SET editor'))) . "\n"; $retval .= " </a>\n"; $retval .= " </div>\n"; $retval .= " </td>\n"; @@ -1045,8 +1045,8 @@ function PMA_RTN_getQueryFromRequest() if (! empty($_REQUEST['item_definer'])) { if (strpos($_REQUEST['item_definer'], '@') !== false) { $arr = explode('@', $_REQUEST['item_definer']); - $query .= 'DEFINER=' . $common_functions->backquote($arr[0]); - $query .= '@' . $common_functions->backquote($arr[1]) . ' '; + $query .= 'DEFINER=' . PMA_Util::backquote($arr[0]); + $query .= '@' . PMA_Util::backquote($arr[1]) . ' '; } else { $errors[] = __('The definer must be in the "username@hostname" format'); } @@ -1062,7 +1062,7 @@ function PMA_RTN_getQueryFromRequest() ); } if (! empty($_REQUEST['item_name'])) { - $query .= $common_functions->backquote($_REQUEST['item_name']); + $query .= PMA_Util::backquote($_REQUEST['item_name']); } else { $errors[] = __('You must provide a routine name'); } @@ -1083,10 +1083,10 @@ function PMA_RTN_getQueryFromRequest() && ! empty($_REQUEST['item_param_dir'][$i]) && in_array($_REQUEST['item_param_dir'][$i], $param_directions) ) { - $params .= $_REQUEST['item_param_dir'][$i] . " " . $common_functions->backquote($_REQUEST['item_param_name'][$i]) . " " + $params .= $_REQUEST['item_param_dir'][$i] . " " . PMA_Util::backquote($_REQUEST['item_param_name'][$i]) . " " . $_REQUEST['item_param_type'][$i]; } else if ($_REQUEST['item_type'] == 'FUNCTION') { - $params .= $common_functions->backquote($_REQUEST['item_param_name'][$i]) . " " . $_REQUEST['item_param_type'][$i]; + $params .= PMA_Util::backquote($_REQUEST['item_param_name'][$i]) . " " . $_REQUEST['item_param_type'][$i]; } else if (! $warned_about_dir) { $warned_about_dir = true; $errors[] = sprintf( @@ -1130,7 +1130,7 @@ function PMA_RTN_getQueryFromRequest() $query .= "(" . $params . ") "; if ($_REQUEST['item_type'] == 'FUNCTION') { if (! empty($_REQUEST['item_returntype']) - && in_array($_REQUEST['item_returntype'], $common_functions->getSupportedDatatypes()) + && in_array($_REQUEST['item_returntype'], PMA_Util::getSupportedDatatypes()) ) { $query .= "RETURNS {$_REQUEST['item_returntype']}"; } else { @@ -1162,7 +1162,7 @@ function PMA_RTN_getQueryFromRequest() $query .= ' '; } if (! empty($_REQUEST['item_comment'])) { - $query .= "COMMENT '" . $common_functions->sqlAddslashes($_REQUEST['item_comment']) . "' "; + $query .= "COMMENT '" . PMA_Util::sqlAddslashes($_REQUEST['item_comment']) . "' "; } if (isset($_REQUEST['item_isdeterministic'])) { $query .= 'DETERMINISTIC '; @@ -1212,7 +1212,7 @@ function PMA_RTN_handleExecute() if (is_array($value)) { // is SET type $value = implode(',', $value); } - $value = $common_functions->sqlAddSlashes($value); + $value = PMA_Util::sqlAddSlashes($value); if (! empty($_REQUEST['funcs'][$routine['item_param_name'][$i]]) && in_array($_REQUEST['funcs'][$routine['item_param_name'][$i]], $all_functions) ) { @@ -1228,20 +1228,20 @@ function PMA_RTN_handleExecute() if ($routine['item_param_dir'][$i] == 'OUT' || $routine['item_param_dir'][$i] == 'INOUT' ) { - $end_query[] = "@p$i AS " . $common_functions->backquote($routine['item_param_name'][$i]); + $end_query[] = "@p$i AS " . PMA_Util::backquote($routine['item_param_name'][$i]); } } } if ($routine['item_type'] == 'PROCEDURE') { - $queries[] = "CALL " . $common_functions->backquote($routine['item_name']) + $queries[] = "CALL " . PMA_Util::backquote($routine['item_name']) . "(" . implode(', ', $args) . ");\n"; if (count($end_query)) { $queries[] = "SELECT " . implode(', ', $end_query) . ";\n"; } } else { - $queries[] = "SELECT " . $common_functions->backquote($routine['item_name']) + $queries[] = "SELECT " . PMA_Util::backquote($routine['item_name']) . "(" . implode(', ', $args) . ") " - . "AS " . $common_functions->backquote($routine['item_name']) . ";\n"; + . "AS " . PMA_Util::backquote($routine['item_name']) . ";\n"; } // Get all the queries as one SQL statement @@ -1267,7 +1267,7 @@ function PMA_RTN_handleExecute() $output .= "<fieldset><legend>"; $output .= sprintf( __('Execution results of routine %s'), - $common_functions->backquote(htmlspecialchars($routine['item_name'])) + PMA_Util::backquote(htmlspecialchars($routine['item_name'])) ); $output .= "</legend>"; @@ -1377,8 +1377,8 @@ function PMA_RTN_handleExecute() $message = __('Error in processing request') . ' : '; $message .= sprintf( PMA_RTE_getWord('not_found'), - htmlspecialchars($common_functions->backquote($_REQUEST['item_name'])), - htmlspecialchars($common_functions->backquote($db)) + htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])), + htmlspecialchars(PMA_Util::backquote($db)) ); $message = PMA_message::error($message); if ($GLOBALS['is_ajax_request']) { @@ -1399,7 +1399,7 @@ function PMA_RTN_handleExecute() if ($routine !== false) { $form = PMA_RTN_getExecuteForm($routine); if ($GLOBALS['is_ajax_request'] == true) { - $title = __("Execute routine") . " " . $common_functions->backquote( + $title = __("Execute routine") . " " . PMA_Util::backquote( htmlentities($_GET['item_name'], ENT_QUOTES) ); $response = PMA_Response::getInstance(); @@ -1415,8 +1415,8 @@ function PMA_RTN_handleExecute() $message = __('Error in processing request') . ' : '; $message .= sprintf( PMA_RTE_getWord('not_found'), - htmlspecialchars($common_functions->backquote($_REQUEST['item_name'])), - htmlspecialchars($common_functions->backquote($db)) + htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])), + htmlspecialchars(PMA_Util::backquote($db)) ); $message = PMA_message::error($message); @@ -1478,7 +1478,7 @@ function PMA_RTN_getExecuteForm($routine) $retval .= "<th>" . __('Value') . "</th>\n"; $retval .= "</tr>\n"; // Get a list of data types that are not yet supported. - $no_support_types = $common_functions->unsupportedDatatypes(); + $no_support_types = PMA_Util::unsupportedDatatypes(); for ($i=0; $i<$routine['item_num_params']; $i++) { // Each parameter if ($routine['item_type'] == 'PROCEDURE' && $routine['item_param_dir'][$i] == 'OUT' @@ -1506,7 +1506,7 @@ function PMA_RTN_getExecuteForm($routine) 'first_timestamp' => false ); $retval .= "<select name='funcs[{$routine['item_param_name'][$i]}]'>"; - $retval .= $common_functions->getFunctionsForField($field, false); + $retval .= PMA_Util::getFunctionsForField($field, false); $retval .= "</select>"; } $retval .= "</td>\n"; @@ -1532,7 +1532,7 @@ function PMA_RTN_getExecuteForm($routine) for ($j=0; $j<$tokens['len']; $j++) { if ($tokens[$j]['type'] != 'punct_listsep') { $tokens[$j]['data'] = htmlentities( - $common_functions->unquote($tokens[$j]['data']), + PMA_Util::unquote($tokens[$j]['data']), ENT_QUOTES ); $retval .= "<input name='params[{$routine['item_param_name'][$i]}][]' " diff --git a/libraries/rte/rte_triggers.lib.php b/libraries/rte/rte_triggers.lib.php index 077c2ef598..942bd7f2c9 100644 --- a/libraries/rte/rte_triggers.lib.php +++ b/libraries/rte/rte_triggers.lib.php @@ -406,15 +406,15 @@ function PMA_TRI_getQueryFromRequest() if (! empty($_REQUEST['item_definer'])) { if (strpos($_REQUEST['item_definer'], '@') !== false) { $arr = explode('@', $_REQUEST['item_definer']); - $query .= 'DEFINER=' . $common_functions->backquote($arr[0]); - $query .= '@' . $common_functions->backquote($arr[1]) . ' '; + $query .= 'DEFINER=' . PMA_Util::backquote($arr[0]); + $query .= '@' . PMA_Util::backquote($arr[1]) . ' '; } else { $errors[] = __('The definer must be in the "username@hostname" format'); } } $query .= 'TRIGGER '; if (! empty($_REQUEST['item_name'])) { - $query .= $common_functions->backquote($_REQUEST['item_name']) . ' '; + $query .= PMA_Util::backquote($_REQUEST['item_name']) . ' '; } else { $errors[] = __('You must provide a trigger name'); } @@ -430,7 +430,7 @@ function PMA_TRI_getQueryFromRequest() } $query .= 'ON '; if (! empty($_REQUEST['item_table']) && in_array($_REQUEST['item_table'], PMA_DBI_get_tables($db))) { - $query .= $common_functions->backquote($_REQUEST['item_table']); + $query .= PMA_Util::backquote($_REQUEST['item_table']); } else { $errors[] = __('You must provide a valid table name'); } diff --git a/libraries/schema/Dia_Relation_Schema.class.php b/libraries/schema/Dia_Relation_Schema.class.php index c95c31713e..b9f4cd5b27 100644 --- a/libraries/schema/Dia_Relation_Schema.class.php +++ b/libraries/schema/Dia_Relation_Schema.class.php @@ -228,7 +228,7 @@ class Table_Stats global $dia, $cfgRelation, $db; $this->tableName = $tableName; - $sql = 'DESCRIBE ' . $common_functions->backquote($tableName); + $sql = 'DESCRIBE ' . PMA_Util::backquote($tableName); $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE); if (!$result || !PMA_DBI_num_rows($result)) { $dia->dieSchema( @@ -257,11 +257,11 @@ class Table_Stats } $sql = 'SELECT x, y FROM ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($cfgRelation['table_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($cfgRelation['table_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' . ' AND table_name = \'' - . $common_functions->sqlAddSlashes($tableName) . '\'' + . PMA_Util::sqlAddSlashes($tableName) . '\'' . ' AND pdf_page_number = ' . $pageNumber; $result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE); if (! $result || ! PMA_DBI_num_rows($result)) { @@ -285,7 +285,7 @@ class Table_Stats * index */ $result = PMA_DBI_query( - 'SHOW INDEX FROM ' . $common_functions->backquote($tableName) . ';', + 'SHOW INDEX FROM ' . PMA_Util::backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE ); diff --git a/libraries/schema/Eps_Relation_Schema.class.php b/libraries/schema/Eps_Relation_Schema.class.php index 17682f6972..e163b8a17d 100644 --- a/libraries/schema/Eps_Relation_Schema.class.php +++ b/libraries/schema/Eps_Relation_Schema.class.php @@ -417,7 +417,7 @@ class Table_Stats global $eps, $cfgRelation, $db; $this->_tableName = $tableName; - $sql = 'DESCRIBE ' . $common_functions->backquote($tableName); + $sql = 'DESCRIBE ' . PMA_Util::backquote($tableName); $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE); if (! $result || ! PMA_DBI_num_rows($result)) { $eps->dieSchema( @@ -460,10 +460,10 @@ class Table_Stats // x and y $sql = 'SELECT x, y FROM ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($cfgRelation['table_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($tableName) . '\'' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($cfgRelation['table_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($tableName) . '\'' . ' AND pdf_page_number = ' . $pageNumber; $result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE); @@ -483,7 +483,7 @@ class Table_Stats $this->displayfield = PMA_getDisplayField($db, $tableName); // index $result = PMA_DBI_query( - 'SHOW INDEX FROM ' . $common_functions->backquote($tableName) . ';', + 'SHOW INDEX FROM ' . PMA_Util::backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE ); if (PMA_DBI_num_rows($result) > 0) { diff --git a/libraries/schema/Export_Relation_Schema.class.php b/libraries/schema/Export_Relation_Schema.class.php index b603a6cfaa..4863f5f68e 100644 --- a/libraries/schema/Export_Relation_Schema.class.php +++ b/libraries/schema/Export_Relation_Schema.class.php @@ -194,9 +194,9 @@ class PMA_Export_Relation_Schema // Get All tables $tab_sql = 'SELECT table_name FROM ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($cfgRelation['table_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($cfgRelation['table_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' . ' AND pdf_page_number = ' . $pageNumber; $tab_rs = PMA_queryAsControlUser($tab_sql, null, PMA_DBI_QUERY_STORE); @@ -204,7 +204,7 @@ class PMA_Export_Relation_Schema $this->dieSchema('', __('This page does not contain any tables!')); } while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) { - $alltables[] = $common_functions->sqlAddSlashes($curr_table['table_name']); + $alltables[] = PMA_Util::sqlAddSlashes($curr_table['table_name']); } return $alltables; } diff --git a/libraries/schema/Svg_Relation_Schema.class.php b/libraries/schema/Svg_Relation_Schema.class.php index aa7c667f17..4888e740d9 100644 --- a/libraries/schema/Svg_Relation_Schema.class.php +++ b/libraries/schema/Svg_Relation_Schema.class.php @@ -383,7 +383,7 @@ class Table_Stats global $svg, $cfgRelation, $db; $this->_tableName = $tableName; - $sql = 'DESCRIBE ' . $common_functions->backquote($tableName); + $sql = 'DESCRIBE ' . PMA_Util::backquote($tableName); $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE); if (! $result || ! PMA_DBI_num_rows($result)) { $svg->dieSchema( @@ -428,10 +428,10 @@ class Table_Stats // x and y $sql = 'SELECT x, y FROM ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($cfgRelation['table_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($tableName) . '\'' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($cfgRelation['table_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($tableName) . '\'' . ' AND pdf_page_number = ' . $pageNumber; $result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE); @@ -452,7 +452,7 @@ class Table_Stats $this->displayfield = PMA_getDisplayField($db, $tableName); // index $result = PMA_DBI_query( - 'SHOW INDEX FROM ' . $common_functions->backquote($tableName) . ';', + 'SHOW INDEX FROM ' . PMA_Util::backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE ); diff --git a/libraries/schema/Visio_Relation_Schema.class.php b/libraries/schema/Visio_Relation_Schema.class.php index 86b987a198..5acf317ba8 100644 --- a/libraries/schema/Visio_Relation_Schema.class.php +++ b/libraries/schema/Visio_Relation_Schema.class.php @@ -214,7 +214,7 @@ class Table_Stats global $visio, $cfgRelation, $db; $this->_tableName = $tableName; - $sql = 'DESCRIBE ' . $common_functions->backquote($tableName); + $sql = 'DESCRIBE ' . PMA_Util::backquote($tableName); $result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE); if (!$result || !PMA_DBI_num_rows($result)) { $visio->dieSchema( @@ -259,10 +259,10 @@ class Table_Stats // x and y $sql = 'SELECT x, y FROM ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($cfgRelation['table_coords']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($tableName) . '\'' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($cfgRelation['table_coords']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($tableName) . '\'' . ' AND pdf_page_number = ' . $pageNumber; $result = PMA_queryAsControlUser($sql, false, PMA_DBI_QUERY_STORE); diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index a010c231d1..d6d8d8d03e 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -31,12 +31,12 @@ function PMA_wildcardEscapeForGrant($dbname, $tablename) $db_and_table = '*.*'; } else { if (strlen($tablename)) { - $db_and_table = $common_functions->backquote( - $common_functions->unescapeMysqlWildcards($dbname) + $db_and_table = PMA_Util::backquote( + PMA_Util::unescapeMysqlWildcards($dbname) ) - . '.' . $common_functions->backquote($tablename); + . '.' . PMA_Util::backquote($tablename); } else { - $db_and_table = $common_functions->backquote($dbname) . '.*'; + $db_and_table = PMA_Util::backquote($dbname) . '.*'; } } return $db_and_table; @@ -56,9 +56,9 @@ function PMA_rangeOfUsers($initial = '') // might be BINARY, so LIKE would be case sensitive if (! empty($initial)) { $ret = " WHERE `User` LIKE '" - . $common_functions->sqlAddSlashes($initial, true) . "%'" + . PMA_Util::sqlAddSlashes($initial, true) . "%'" . " OR `User` LIKE '" - . $common_functions->sqlAddSlashes(strtolower($initial), true) . "%'"; + . PMA_Util::sqlAddSlashes(strtolower($initial), true) . "%'"; } else { $ret = ''; } @@ -349,21 +349,21 @@ function PMA_getSqlQueryForDisplayPrivTable($db, $table, $username, $hostname) if ($db == '*') { return "SELECT * FROM `mysql`.`user`" - ." WHERE `User` = '" . $common_functions->sqlAddSlashes($username) . "'" - ." AND `Host` = '" . $common_functions->sqlAddSlashes($hostname) . "';"; + ." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" + ." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "';"; } elseif ($table == '*') { return "SELECT * FROM `mysql`.`db`" - ." WHERE `User` = '" . $common_functions->sqlAddSlashes($username) . "'" - ." AND `Host` = '" . $common_functions->sqlAddSlashes($hostname) . "'" - ." AND '" . $common_functions->unescapeMysqlWildcards($db) . "'" + ." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" + ." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "'" + ." AND '" . PMA_Util::unescapeMysqlWildcards($db) . "'" ." LIKE `Db`;"; } return "SELECT `Table_priv`" ." FROM `mysql`.`tables_priv`" - ." WHERE `User` = '" . $common_functions->sqlAddSlashes($username) . "'" - ." AND `Host` = '" . $common_functions->sqlAddSlashes($hostname) . "'" - ." AND `Db` = '" . $common_functions->unescapeMysqlWildcards($db) . "'" - ." AND `Table_name` = '" . $common_functions->sqlAddSlashes($table) . "';"; + ." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" + ." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "'" + ." AND `Db` = '" . PMA_Util::unescapeMysqlWildcards($db) . "'" + ." AND `Table_name` = '" . PMA_Util::sqlAddSlashes($table) . "';"; } /** * Displays the privileges form table @@ -582,15 +582,15 @@ function PMA_getHtmlForTableSpecificPrivileges($username, $hostname, $db 'SELECT `Column_name`, `Column_priv`' .' FROM `mysql`.`columns_priv`' .' WHERE `User`' - .' = \'' . $common_functions->sqlAddSlashes($username) . "'" + .' = \'' . PMA_Util::sqlAddSlashes($username) . "'" .' AND `Host`' - .' = \'' . $common_functions->sqlAddSlashes($hostname) . "'" + .' = \'' . PMA_Util::sqlAddSlashes($hostname) . "'" .' AND `Db`' - .' = \'' . $common_functions->sqlAddSlashes( - $common_functions->unescapeMysqlWildcards($db) + .' = \'' . PMA_Util::sqlAddSlashes( + PMA_Util::unescapeMysqlWildcards($db) ) . "'" .' AND `Table_name`' - .' = \'' . $common_functions->sqlAddSlashes($table) . '\';' + .' = \'' . PMA_Util::sqlAddSlashes($table) . '\';' ); while ($row1 = PMA_DBI_fetch_row($res)) { @@ -608,7 +608,7 @@ function PMA_getHtmlForTableSpecificPrivileges($username, $hostname, $db . 'value="' . count($columns) . '" />' . "\n" . '<fieldset id="fieldset_user_priv">' . "\n" . '<legend>' . __('Table-specific privileges') - . $common_functions->showHint( + . PMA_Util::showHint( __('Note: MySQL privilege names are expressed in English') ) . '</legend>' . "\n"; @@ -1336,21 +1336,21 @@ function PMA_getMessageForUpdatePassword($err_url, $username, $hostname) // in $sql_query which will be displayed, hide the password $sql_query = 'SET PASSWORD FOR \'' - . $common_functions->sqlAddSlashes($username) - . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\' = ' + . PMA_Util::sqlAddSlashes($username) + . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\' = ' . (($_POST['pma_pw'] == '') ? '\'\'' : $hashing_function . '(\'' . preg_replace('@.@s', '*', $_POST['pma_pw']) . '\')'); $local_query = 'SET PASSWORD FOR \'' - . $common_functions->sqlAddSlashes($username) - . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\' = ' + . PMA_Util::sqlAddSlashes($username) + . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\' = ' . (($_POST['pma_pw'] == '') ? '\'\'' : $hashing_function - . '(\'' . $common_functions->sqlAddSlashes($_POST['pma_pw']) . '\')'); + . '(\'' . PMA_Util::sqlAddSlashes($_POST['pma_pw']) . '\')'); PMA_DBI_try_query($local_query) - or $common_functions->mysqlDie( + or PMA_Util::mysqlDie( PMA_DBI_getError(), $sql_query, false, $err_url ); $message = PMA_Message::success( @@ -1383,12 +1383,12 @@ function PMA_getMessageAndSqlQueryForPrivilegesRevoke($db_and_table, $dbname, $sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $db_and_table . ' FROM \'' - . $common_functions->sqlAddSlashes($username) . '\'@\'' - . $common_functions->sqlAddSlashes($hostname) . '\';'; + . PMA_Util::sqlAddSlashes($username) . '\'@\'' + . PMA_Util::sqlAddSlashes($hostname) . '\';'; $sql_query1 = 'REVOKE GRANT OPTION ON ' . $db_and_table - . ' FROM \'' . $common_functions->sqlAddSlashes($username) . '\'@\'' - . $common_functions->sqlAddSlashes($hostname) . '\';'; + . ' FROM \'' . PMA_Util::sqlAddSlashes($username) . '\'@\'' + . PMA_Util::sqlAddSlashes($hostname) . '\';'; PMA_DBI_query($sql_query0); if (! PMA_DBI_try_query($sql_query1)) { @@ -1451,7 +1451,7 @@ function PMA_getHtmlForAddUser($random_n, $dbname) $GLOBALS['url_query'] .= '&adduser=1'; $html_output = '<h2>' . "\n" - . $common_functions->getIcon('b_usradd.png') . __('Add user') . "\n" + . PMA_Util::getIcon('b_usradd.png') . __('Add user') . "\n" . '</h2>' . "\n" . '<form name="usersForm" id="addUsersForm_' . $random_n . '" action="server_privileges.php" method="post">' . "\n" @@ -1461,13 +1461,13 @@ function PMA_getHtmlForAddUser($random_n, $dbname) $html_output .= '<fieldset id="fieldset_add_user_database">' . "\n" . '<legend>' . __('Database for user') . '</legend>' . "\n"; - $html_output .= $common_functions->getCheckbox( + $html_output .= PMA_Util::getCheckbox( 'createdb-1', __('Create database with same name and grant all privileges'), false, false ); $html_output .= '<br />' . "\n"; - $html_output .= $common_functions->getCheckbox( + $html_output .= PMA_Util::getCheckbox( 'createdb-2', __('Grant all privileges on wildcard name (username\\_%)'), false, false @@ -1475,7 +1475,7 @@ function PMA_getHtmlForAddUser($random_n, $dbname) $html_output .= '<br />' . "\n"; if (! empty($dbname) ) { - $html_output .= $common_functions->getCheckbox( + $html_output .= PMA_Util::getCheckbox( 'createdb-3', sprintf(__('Grant all privileges on database "%s"'), htmlspecialchars($dbname)), true, @@ -1572,7 +1572,7 @@ function PMA_getHtmlForSpecificDbPrivileges($link_edit, $conditional_class) $html_output = '<form id="usersForm" action="server_privileges.php">' . '<fieldset>' . "\n"; $html_output .= '<legend>' . "\n" - . $common_functions->getIcon('b_usrcheck.png') + . PMA_Util::getIcon('b_usrcheck.png') . ' ' . sprintf( __('Users having access to "%s"'), @@ -1601,7 +1601,7 @@ function PMA_getHtmlForSpecificDbPrivileges($link_edit, $conditional_class) $sql_query = '(SELECT ' . $list_of_privileges . ', `Db`' .' FROM `mysql`.`db`' - .' WHERE \'' . $common_functions->sqlAddSlashes($_REQUEST['checkprivs']) + .' WHERE \'' . PMA_Util::sqlAddSlashes($_REQUEST['checkprivs']) . "'" .' LIKE `Db`' .' AND NOT (' . $list_of_compared_privileges. ')) ' @@ -1643,7 +1643,7 @@ function PMA_getHtmlForSpecificDbPrivileges($link_edit, $conditional_class) . '&'.$GLOBALS['url_query'] . '" class="'.$conditional_class .'" name="db_specific">' . "\n" - . $common_functions->getIcon('b_usradd.png') + . PMA_Util::getIcon('b_usradd.png') . ' ' . __('Add user') . '</a>' . "\n"; $html_output .= '</fieldset>' . "\n"; @@ -1786,7 +1786,7 @@ function PMA_getStandardLinks($conditional_class) . '&hostname=%s' . '&dbname=%s' . '&tablename=%s">' - . $common_functions->getIcon('b_usredit.png', __('Edit Privileges')) + . PMA_Util::getIcon('b_usredit.png', __('Edit Privileges')) . '</a>'; $link_revoke = '<a href=' @@ -1797,7 +1797,7 @@ function PMA_getStandardLinks($conditional_class) . '&dbname=%s' . '&tablename=%s' . '&revokeall=1">' - . $common_functions->getIcon('b_usrdrop.png', __('Revoke')) + . PMA_Util::getIcon('b_usrdrop.png', __('Revoke')) . '</a>'; $link_export = '<a class="export_user_anchor ' . $conditional_class . '"' @@ -1807,7 +1807,7 @@ function PMA_getStandardLinks($conditional_class) . '&hostname=%s' . '&initial=%s' . '&export=1">' - . $common_functions->getIcon('b_tblexport.png', __('Export')) + . PMA_Util::getIcon('b_tblexport.png', __('Export')) . '</a>'; return array($link_edit, $link_revoke, $link_export); @@ -2036,7 +2036,7 @@ function PMA_getUserSpecificRights($tables, $user_host_condition, $dbname) $user_host_condition .= ' AND `Db`' .' LIKE \'' - . $common_functions->sqlAddSlashes($dbname, true) . "'"; + . PMA_Util::sqlAddSlashes($dbname, true) . "'"; $tables_to_search_for_users = array('columns_priv',); $dbOrTableName = 'Table_name'; } @@ -2046,7 +2046,7 @@ function PMA_getUserSpecificRights($tables, $user_host_condition, $dbname) if (in_array($table_search_in, $tables)) { $db_rights_sqls[] = ' SELECT DISTINCT `' . $dbOrTableName .'` - FROM `mysql`.' . $common_functions->backquote($table_search_in) + FROM `mysql`.' . PMA_Util::backquote($table_search_in) . $user_host_condition; } } @@ -2072,7 +2072,7 @@ function PMA_getUserSpecificRights($tables, $user_host_condition, $dbname) // only Db names in the table `mysql`.`db` uses wildcards // as we are in the db specific rights display we want // all db names escaped, also from other sources - $db_rights_row['Db'] = $common_functions->escapeMysqlWildcards( + $db_rights_row['Db'] = PMA_Util::escapeMysqlWildcards( $db_rights_row['Db'] ); } @@ -2248,9 +2248,9 @@ function PMA_getTableForDisplayAllTableSpecificRights($username, $hostname . '</thead>' . "\n"; $user_host_condition = ' WHERE `User`' - . ' = \'' . $common_functions->sqlAddSlashes($username) . "'" + . ' = \'' . PMA_Util::sqlAddSlashes($username) . "'" . ' AND `Host`' - . ' = \'' . $common_functions->sqlAddSlashes($hostname) . "'"; + . ' = \'' . PMA_Util::sqlAddSlashes($hostname) . "'"; // table body // get data @@ -2298,7 +2298,7 @@ function PMA_getHTmlForDisplaySelectDbInEditPrivs($found_rows) . '<option value="" selected="selected">' . __('Use text field') . ':</option>' . "\n"; foreach ($pred_db_array as $current_db) { - $current_db = $common_functions->escapeMysqlWildcards($current_db); + $current_db = PMA_Util::escapeMysqlWildcards($current_db); // cannot use array_diff() once, outside of the loop, // because the list of databases has special characters // already escaped in $found_rows, @@ -2311,7 +2311,7 @@ function PMA_getHTmlForDisplaySelectDbInEditPrivs($found_rows) $html_output .= '</select>' . "\n"; } $html_output .= '<input type="text" id="text_dbname" name="dbname" />' . "\n" - . $common_functions->showHint( + . PMA_Util::showHint( __('Wildcards % and _ should be escaped with a \ to use them literally') ); return $html_output; @@ -2334,8 +2334,8 @@ function PMA_displayTablesInEditPrivs($dbname, $found_rows) . __('Add privileges on the following table') . ':</label>' . "\n"; $result = @PMA_DBI_try_query( - 'SHOW TABLES FROM ' . $common_functions->backquote( - $common_functions->unescapeMysqlWildcards($dbname) + 'SHOW TABLES FROM ' . PMA_Util::backquote( + PMA_Util::unescapeMysqlWildcards($dbname) ) . ';', null, PMA_DBI_QUERY_STORE @@ -2405,7 +2405,7 @@ function PMA_getUsersOverview($result, $db_rights, $link_edit, $pmaThemeImage, . '<th>' . __('Host') . '</th>' . "\n" . '<th>' . __('Password') . '</th>' . "\n" . '<th>' . __('Global privileges') . ' ' - . $common_functions->showHint( + . PMA_Util::showHint( __('Note: MySQL privilege names are expressed in English') ) . '</th>' . "\n" @@ -2430,7 +2430,7 @@ function PMA_getUsersOverview($result, $db_rights, $link_edit, $pmaThemeImage, .'<label for="checkall">' . __('Check All') . '</label> ' .'<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n"; - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_tblexport.png', 'export' ); @@ -2544,13 +2544,13 @@ function PMA_getFieldsetForAddDeleteUser($conditional_class) $html_output .= '<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1"' . 'class="' . $conditional_class . '">' . "\n" - . $common_functions->getIcon('b_usradd.png') + . PMA_Util::getIcon('b_usradd.png') . ' ' . __('Add user') . '</a>' . "\n"; $html_output .= '</fieldset>' . "\n"; $html_output .= '<fieldset id="fieldset_delete_user">' . '<legend>' . "\n" - . $common_functions->getIcon('b_usrdrop.png') + . PMA_Util::getIcon('b_usrdrop.png') . ' ' . __('Remove selected users') . '' . "\n" . '</legend>' . "\n"; @@ -2738,13 +2738,13 @@ function PMA_updatePrivileges($username, $hostname, $tablename, $dbname) $db_and_table = PMA_wildcardEscapeForGrant($dbname, $tablename); $sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $db_and_table - . ' FROM \'' . $common_functions->sqlAddSlashes($username) - . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\';'; + . ' FROM \'' . PMA_Util::sqlAddSlashes($username) + . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\';'; if (! isset($_POST['Grant_priv']) || $_POST['Grant_priv'] != 'Y') { $sql_query1 = 'REVOKE GRANT OPTION ON ' . $db_and_table - . ' FROM \'' . $common_functions->sqlAddSlashes($username) . '\'@\'' - . $common_functions->sqlAddSlashes($hostname) . '\';'; + . ' FROM \'' . PMA_Util::sqlAddSlashes($username) . '\'@\'' + . PMA_Util::sqlAddSlashes($hostname) . '\';'; } else { $sql_query1 = ''; } @@ -2754,8 +2754,8 @@ function PMA_updatePrivileges($username, $hostname, $tablename, $dbname) if (! (strlen($tablename) && 'USAGE' == implode('', PMA_extractPrivInfo()))) { $sql_query2 = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON ' . $db_and_table - . ' TO \'' . $common_functions->sqlAddSlashes($username) . '\'@\'' - . $common_functions->sqlAddSlashes($hostname) . '\''; + . ' TO \'' . PMA_Util::sqlAddSlashes($username) . '\'@\'' + . PMA_Util::sqlAddSlashes($hostname) . '\''; if ((isset($_POST['Grant_priv']) && $_POST['Grant_priv'] == 'Y') || (! strlen($dbname) @@ -3033,8 +3033,8 @@ function PMA_getHtmlForDisplayUserProperties($dbname_is_wildcard,$url_dbname, ); $sql = "SELECT '1' FROM `mysql`.`user`" - . " WHERE `User` = '" . $common_functions->sqlAddSlashes($username) . "'" - . " AND `Host` = '" . $common_functions->sqlAddSlashes($hostname) . "';"; + . " WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" + . " AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "';"; $user_does_not_exists = (bool) ! PMA_DBI_fetch_value($sql); @@ -3138,13 +3138,13 @@ function PMA_getTablePrivsQueriesForChangeOrCopyUser($user_host_condition, 'SELECT `Column_name`, `Column_priv`' .' FROM `mysql`.`columns_priv`' .' WHERE `User`' - .' = \'' . $common_functions->sqlAddSlashes($_REQUEST['old_username']) . "'" + .' = \'' . PMA_Util::sqlAddSlashes($_REQUEST['old_username']) . "'" .' AND `Host`' - .' = \'' . $common_functions->sqlAddSlashes($_REQUEST['old_username']) . '\'' + .' = \'' . PMA_Util::sqlAddSlashes($_REQUEST['old_username']) . '\'' .' AND `Db`' - .' = \'' . $common_functions->sqlAddSlashes($row['Db']) . "'" + .' = \'' . PMA_Util::sqlAddSlashes($row['Db']) . "'" .' AND `Table_name`' - .' = \'' . $common_functions->sqlAddSlashes($row['Table_name']) . "'" + .' = \'' . PMA_Util::sqlAddSlashes($row['Table_name']) . "'" .';', null, PMA_DBI_QUERY_STORE @@ -3187,10 +3187,10 @@ function PMA_getTablePrivsQueriesForChangeOrCopyUser($user_host_condition, } $queries[] = 'GRANT ' . join(', ', $tmp_privs1) - . ' ON ' . $common_functions->backquote($row['Db']) . '.' - . $common_functions->backquote($row['Table_name']) - . ' TO \'' . $common_functions->sqlAddSlashes($username) - . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\'' + . ' ON ' . PMA_Util::backquote($row['Db']) . '.' + . PMA_Util::backquote($row['Table_name']) + . ' TO \'' . PMA_Util::sqlAddSlashes($username) + . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\'' . (in_array('Grant', explode(',', $row['Table_priv'])) ? ' WITH GRANT OPTION;' : ';'); } return $queries; @@ -3210,17 +3210,17 @@ function PMA_getDbSpecificPrivsQueriesForChangeOrCopyUser( ) { $user_host_condition = ' WHERE `User`' - .' = \'' . $common_functions->sqlAddSlashes($_REQUEST['old_username']) . "'" + .' = \'' . PMA_Util::sqlAddSlashes($_REQUEST['old_username']) . "'" .' AND `Host`' - .' = \'' . $common_functions->sqlAddSlashes($_REQUEST['old_username']) . '\';'; + .' = \'' . PMA_Util::sqlAddSlashes($_REQUEST['old_username']) . '\';'; $res = PMA_DBI_query('SELECT * FROM `mysql`.`db`' . $user_host_condition); while ($row = PMA_DBI_fetch_assoc($res)) { $queries[] = 'GRANT ' . join(', ', PMA_extractPrivInfo($row)) - .' ON ' . $common_functions->backquote($row['Db']) . '.*' - .' TO \'' . $common_functions->sqlAddSlashes($username) - . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\'' + .' ON ' . PMA_Util::backquote($row['Db']) . '.*' + .' TO \'' . PMA_Util::sqlAddSlashes($username) + . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\'' . ($row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION;' : ';'); } PMA_DBI_free_result($res); @@ -3259,8 +3259,8 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query, if (isset($_REQUEST['createdb-1'])) { // Create database with same name and grant all privileges $q = 'CREATE DATABASE IF NOT EXISTS ' - . $common_functions->backquote( - $common_functions->sqlAddSlashes($username) + . PMA_Util::backquote( + PMA_Util::sqlAddSlashes($username) ) . ';'; $sql_query .= $q; if (! PMA_DBI_try_query($q)) { @@ -3274,17 +3274,17 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query, // this is needed in case tracking is on: $GLOBALS['db'] = $username; $GLOBALS['reload'] = true; - echo $common_functions->getReloadNavigationScript(); + echo PMA_Util::getReloadNavigationScript(); } $q = 'GRANT ALL PRIVILEGES ON ' - . $common_functions->backquote( - $common_functions->escapeMysqlWildcards( - $common_functions->sqlAddSlashes($username) + . PMA_Util::backquote( + PMA_Util::escapeMysqlWildcards( + PMA_Util::sqlAddSlashes($username) ) ) . '.* TO \'' - . $common_functions->sqlAddSlashes($username) - . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\';'; + . PMA_Util::sqlAddSlashes($username) + . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\';'; $sql_query .= $q; if (! PMA_DBI_try_query($q)) { $message = PMA_Message::rawError(PMA_DBI_getError()); @@ -3294,11 +3294,11 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query, if (isset($_REQUEST['createdb-2'])) { // Grant all privileges on wildcard name (username\_%) $q = 'GRANT ALL PRIVILEGES ON ' - . $common_functions->backquote( - $common_functions->sqlAddSlashes($username) . '\_%' + . PMA_Util::backquote( + PMA_Util::sqlAddSlashes($username) . '\_%' ) . '.* TO \'' - . $common_functions->sqlAddSlashes($username) - . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\';'; + . PMA_Util::sqlAddSlashes($username) + . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\';'; $sql_query .= $q; if (! PMA_DBI_try_query($q)) { $message = PMA_Message::rawError(PMA_DBI_getError()); @@ -3308,11 +3308,11 @@ function PMA_addUserAndCreateDatabase($_error, $real_sql_query, $sql_query, if (isset($_REQUEST['createdb-3'])) { // Grant all privileges on the specified database to the new user $q = 'GRANT ALL PRIVILEGES ON ' - . $common_functions->backquote( - $common_functions->sqlAddSlashes($dbname) + . PMA_Util::backquote( + PMA_Util::sqlAddSlashes($dbname) ) . '.* TO \'' - . $common_functions->sqlAddSlashes($username) - . '\'@\'' . $common_functions->sqlAddSlashes($hostname) . '\';'; + . PMA_Util::sqlAddSlashes($username) + . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\';'; $sql_query .= $q; if (! PMA_DBI_try_query($q)) { $message = PMA_Message::rawError(PMA_DBI_getError()); @@ -3335,21 +3335,21 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password) $sql_query = ''; $create_user_real = 'CREATE USER \'' - . $common_functions->sqlAddSlashes($username) . '\'@\'' - . $common_functions->sqlAddSlashes($hostname) . '\''; + . PMA_Util::sqlAddSlashes($username) . '\'@\'' + . PMA_Util::sqlAddSlashes($hostname) . '\''; $real_sql_query = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON *.* TO \'' - . $common_functions->sqlAddSlashes($username) . '\'@\'' - . $common_functions->sqlAddSlashes($hostname) . '\''; + . PMA_Util::sqlAddSlashes($username) . '\'@\'' + . PMA_Util::sqlAddSlashes($hostname) . '\''; if ($_POST['pred_password'] != 'none' && $_POST['pred_password'] != 'keep') { $sql_query = $real_sql_query . ' IDENTIFIED BY \'***\''; $real_sql_query .= ' IDENTIFIED BY \'' - . $common_functions->sqlAddSlashes($_POST['pma_pw']) . '\''; + . PMA_Util::sqlAddSlashes($_POST['pma_pw']) . '\''; if (isset($create_user_real)) { $create_user_show = $create_user_real . ' IDENTIFIED BY \'***\''; $create_user_real .= ' IDENTIFIED BY \'' - . $common_functions->sqlAddSlashes($_POST['pma_pw']) . '\''; + . PMA_Util::sqlAddSlashes($_POST['pma_pw']) . '\''; } } else { if ($_POST['pred_password'] == 'keep' && ! empty($password)) { diff --git a/libraries/server_synchronize.lib.php b/libraries/server_synchronize.lib.php index 2b0cce458a..4d7f780e13 100644 --- a/libraries/server_synchronize.lib.php +++ b/libraries/server_synchronize.lib.php @@ -160,16 +160,16 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, if (isset($source_result_set[$j]) && ($all_keys_match)) { // Query the target server to see which rows already exist - $trg_select_query = "SELECT * FROM " . $common_functions->backquote($trg_db) . "." - . $common_functions->backquote($matching_table[$matching_table_index]) + $trg_select_query = "SELECT * FROM " . PMA_Util::backquote($trg_db) . "." + . PMA_Util::backquote($matching_table[$matching_table_index]) . " WHERE "; if (count($is_key) == 1) { - $trg_select_query .= $common_functions->backquote($is_key[0]) + $trg_select_query .= PMA_Util::backquote($is_key[0]) . "='" . $source_result_set[$j] . "'"; } elseif (count($is_key) > 1) { for ($k=0; $k < count($is_key); $k++) { - $trg_select_query .= $common_functions->backquote($is_key[$k]) + $trg_select_query .= PMA_Util::backquote($is_key[$k]) . "='" . $source_result_set[$j][$is_key[$k]] . "'"; if ($k < (count($is_key)-1)) { $trg_select_query .= " AND "; @@ -187,16 +187,16 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, // Fetch the row from the source server to do a comparison $src_select_query = "SELECT * FROM " - . $common_functions->backquote($src_db) . "." - . $common_functions->backquote($matching_table[$matching_table_index]) + . PMA_Util::backquote($src_db) . "." + . PMA_Util::backquote($matching_table[$matching_table_index]) . " WHERE "; if (count($is_key) == 1) { - $src_select_query .= $common_functions->backquote($is_key[0]) + $src_select_query .= PMA_Util::backquote($is_key[0]) . "='" . $source_result_set[$j] . "'"; } elseif (count($is_key) > 1) { for ($k=0; $k< count($is_key); $k++) { - $src_select_query .= $common_functions->backquote($is_key[$k]) + $src_select_query .= PMA_Util::backquote($is_key[$k]) . "='" . $source_result_set[$j][$is_key[$k]] . "'"; if ($k < (count($is_key) - 1)) { $src_select_query .= " AND "; @@ -463,11 +463,11 @@ function PMA_updateTargetTables( if (isset($update_array[$matching_table_index][$update_row])) { $update_fields_num = count($update_array[$matching_table_index][$update_row])-count($matching_table_keys[$matching_table_index]); if ($update_fields_num > 0) { - $query = "UPDATE " . $common_functions->backquote($trg_db) . "." .$common_functions->backquote($table[$matching_table_index]) . " SET "; + $query = "UPDATE " . PMA_Util::backquote($trg_db) . "." .PMA_Util::backquote($table[$matching_table_index]) . " SET "; for ($update_field = 0; $update_field < $update_fields_num; $update_field = $update_field+2) { if (isset($update_array[$matching_table_index][$update_row][$update_field]) && isset($update_array[$matching_table_index][$update_row][$update_field+1])) { - $query .= $common_functions->backquote($update_array[$matching_table_index][$update_row][$update_field]) . "='" . $update_array[$matching_table_index][$update_row][$update_field+1] . "'"; + $query .= PMA_Util::backquote($update_array[$matching_table_index][$update_row][$update_field]) . "='" . $update_array[$matching_table_index][$update_row][$update_field+1] . "'"; } if ($update_field < ($update_fields_num - 2)) { $query .= ", "; @@ -477,7 +477,7 @@ function PMA_updateTargetTables( if (isset($matching_table_keys[$matching_table_index])) { for ($key = 0; $key < count($matching_table_keys[$matching_table_index]); $key++) { if (isset($matching_table_keys[$matching_table_index][$key])) { - $query .= $common_functions->backquote($matching_table_keys[$matching_table_index][$key]) . "='" . $update_array[$matching_table_index][$update_row][$matching_table_keys[$matching_table_index][$key]] . "'"; + $query .= PMA_Util::backquote($matching_table_keys[$matching_table_index][$key]) . "='" . $update_array[$matching_table_index][$update_row][$matching_table_keys[$matching_table_index][$key]] . "'"; } if ($key < (count($matching_table_keys[$matching_table_index]) - 1)) { $query .= " AND "; @@ -556,7 +556,7 @@ function PMA_insertIntoTargetTable($matching_table, $src_db, $trg_db, $src_link, for ($insert_row = 0; $insert_row< count($array_insert[$matching_table_index]); $insert_row++) { if (isset($array_insert[$matching_table_index][$insert_row][$matching_tables_keys[$matching_table_index][0]])) { - $select_query = "SELECT * FROM " . $common_functions->backquote($src_db) . "." . $common_functions->backquote($matching_table[$matching_table_index]) . " WHERE "; + $select_query = "SELECT * FROM " . PMA_Util::backquote($src_db) . "." . PMA_Util::backquote($matching_table[$matching_table_index]) . " WHERE "; for ($i = 0; $i < count($matching_tables_keys[$matching_table_index]); $i++) { $select_query .= $matching_tables_keys[$matching_table_index][$i] . "='"; $select_query .= $array_insert[$matching_table_index][$insert_row][$matching_tables_keys[$matching_table_index][$i]] . "'" ; @@ -567,10 +567,10 @@ function PMA_insertIntoTargetTable($matching_table, $src_db, $trg_db, $src_link, } $select_query .= "; "; $result = PMA_DBI_fetch_result($select_query, null, null, $src_link); - $insert_query = "INSERT INTO " . $common_functions->backquote($trg_db) . "." . $common_functions->backquote($matching_table[$matching_table_index]) ." ("; + $insert_query = "INSERT INTO " . PMA_Util::backquote($trg_db) . "." . PMA_Util::backquote($matching_table[$matching_table_index]) ." ("; for ($field_index = 0; $field_index < count($table_fields[$matching_table_index]); $field_index++) { - $insert_query .= $common_functions->backquote($table_fields[$matching_table_index][$field_index]); + $insert_query .= PMA_Util::backquote($table_fields[$matching_table_index][$field_index]); $is_fk_query = "SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = '" . $trg_db ."' AND TABLE_NAME = '" . $matching_table[$matching_table_index]. "'AND COLUMN_NAME = '" . @@ -675,11 +675,11 @@ function PMA_insertIntoTargetTable($matching_table, $src_db, $trg_db, $src_link, } $insert_query .= ") VALUES("; if (count($table_fields[$matching_table_index]) == 1) { - $insert_query .= "'" . $common_functions->sqlAddSlashes($result[0]) . "'"; + $insert_query .= "'" . PMA_Util::sqlAddSlashes($result[0]) . "'"; } else { for ($field_index = 0; $field_index < count($table_fields[$matching_table_index]); $field_index++) { if (isset($result[0][$table_fields[$matching_table_index][$field_index]])) { - $insert_query .= "'" . $common_functions->sqlAddSlashes($result[0][$table_fields[$matching_table_index][$field_index]]) . "'"; + $insert_query .= "'" . PMA_Util::sqlAddSlashes($result[0][$table_fields[$matching_table_index][$field_index]]) . "'"; } else { $insert_query .= "'NULL'"; } @@ -735,8 +735,8 @@ function PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, $uncommon_tables_fields[$table_index] = $fields; $Create_Query = PMA_DBI_fetch_value( - "SHOW CREATE TABLE " . $common_functions->backquote($src_db) . '.' - . $common_functions->backquote($uncommon_tables[$table_index]), + "SHOW CREATE TABLE " . PMA_Util::backquote($src_db) . '.' + . PMA_Util::backquote($uncommon_tables[$table_index]), 0, 1, $src_link @@ -744,8 +744,8 @@ function PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, // Replace the src table name with a `dbname`.`tablename` $Create_Table_Query = preg_replace( - '/' . preg_quote($common_functions->backquote($uncommon_tables[$table_index]), '/') . '/', - $common_functions->backquote($trg_db) . '.' . $common_functions->backquote($uncommon_tables[$table_index]), + '/' . preg_quote(PMA_Util::backquote($uncommon_tables[$table_index]), '/') . '/', + PMA_Util::backquote($trg_db) . '.' . PMA_Util::backquote($uncommon_tables[$table_index]), $Create_Query, $limit = 1 ); @@ -795,19 +795,19 @@ function PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link, // @todo: maybe display some of the queries if they are not too numerous $display = false; $unbuffered_result = PMA_DBI_try_query( - 'SELECT * FROM ' . $common_functions->backquote($src_db) . '.' - . $common_functions->backquote($uncommon_tables[$table_index]), + 'SELECT * FROM ' . PMA_Util::backquote($src_db) . '.' + . PMA_Util::backquote($uncommon_tables[$table_index]), $src_link, PMA_DBI_QUERY_UNBUFFERED ); if (false !== $unbuffered_result) { - $insert_query = 'INSERT INTO ' . $common_functions->backquote($trg_db) . '.' - . $common_functions->backquote($uncommon_tables[$table_index]) . ' VALUES'; + $insert_query = 'INSERT INTO ' . PMA_Util::backquote($trg_db) . '.' + . PMA_Util::backquote($uncommon_tables[$table_index]) . ' VALUES'; while ($one_row = PMA_DBI_fetch_row($unbuffered_result)) { $insert_query .= '('; $key_of_last_value = count($one_row) - 1; foreach ($one_row as $key => $value) { - $insert_query .= "'" . $common_functions->sqlAddSlashes($value) . "'"; + $insert_query .= "'" . PMA_Util::sqlAddSlashes($value) . "'"; if ($key < $key_of_last_value) { $insert_query .= ","; } @@ -842,9 +842,9 @@ function PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, for ($i = 0; $i < count($delete_array[$table_index]); $i++) { if (isset($target_tables_keys[$table_index])) { - $delete_query = 'DELETE FROM ' . $common_functions->backquote($trg_db) . '.' .$common_functions->backquote($matching_tables[$table_index]) . ' WHERE '; + $delete_query = 'DELETE FROM ' . PMA_Util::backquote($trg_db) . '.' .PMA_Util::backquote($matching_tables[$table_index]) . ' WHERE '; for ($y = 0; $y < count($target_tables_keys[$table_index]); $y++) { - $delete_query .= $common_functions->backquote($target_tables_keys[$table_index][$y]) . " = '"; + $delete_query .= PMA_Util::backquote($target_tables_keys[$table_index][$y]) . " = '"; if (count($target_tables_keys[$table_index]) == 1) { $delete_query .= $delete_array[$table_index][$i] . "'"; @@ -864,11 +864,11 @@ function PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, if ($result_size > 0) { for ($b = 0; $b < $result_size; $b++) { $drop_pk_query = "DELETE FROM " - . $common_functions->backquote($pk_query_result[$b]['TABLE_SCHEMA']) + . PMA_Util::backquote($pk_query_result[$b]['TABLE_SCHEMA']) . "." - . $common_functions->backquote($pk_query_result[$b]['TABLE_NAME']) + . PMA_Util::backquote($pk_query_result[$b]['TABLE_NAME']) . " WHERE " - . $common_functions->backquote($pk_query_result[$b]['COLUMN_NAME']) + . PMA_Util::backquote($pk_query_result[$b]['COLUMN_NAME']) . " = " . $target_tables_keys[$table_index][$y] . ";"; PMA_DBI_try_query($drop_pk_query, $trg_link, 0); } @@ -1016,8 +1016,8 @@ function PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link, for ($i = 0; $i < count($matching_tables_fields[$table_counter]); $i++) { if (isset($add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]])) { - $query = "ALTER TABLE " . $common_functions->backquote($trg_db) . '.' . $common_functions->backquote($matching_tables[$table_counter]). " ADD COLUMN " . - $common_functions->backquote($add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]]) . " " . $source_columns[$table_counter][$matching_tables_fields[$table_counter][$i]]['Type']; + $query = "ALTER TABLE " . PMA_Util::backquote($trg_db) . '.' . PMA_Util::backquote($matching_tables[$table_counter]). " ADD COLUMN " . + PMA_Util::backquote($add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]]) . " " . $source_columns[$table_counter][$matching_tables_fields[$table_counter][$i]]['Type']; if ($source_columns[$table_counter][$matching_tables_fields[$table_counter][$i]]['Null'] == 'NO') { $query .= ' Not Null '; @@ -1048,7 +1048,7 @@ function PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link, } $query .= " , ADD PRIMARY KEY ("; for ($t = 0; $t < count($matching_tables_keys[$table_counter]); $t++) { - $query .= $common_functions->backquote($matching_tables_keys[$table_counter][$t]); + $query .= PMA_Util::backquote($matching_tables_keys[$table_counter][$t]); if ($t < (count($matching_tables_keys[$table_counter]) - 1)) { $query .= " , " ; } @@ -1079,10 +1079,10 @@ function PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link, PMA_createTargetTables($src_db, $trg_db, $trg_link, $src_link, $uncommon_tables, $table_index[0], $uncommon_tables_fields, $display); unset($uncommon_tables[$table_index[0]]); } - $fk_query = "ALTER TABLE " . $common_functions->backquote($trg_db) . '.' . $common_functions->backquote($matching_tables[$table_counter]) . - "ADD CONSTRAINT FOREIGN KEY " . $common_functions->backquote($add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]]) . " - (" . $add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]] . ") REFERENCES " . $common_functions->backquote($trg_db) . - '.' . $common_functions->backquote($is_fk_result[0]['REFERENCED_TABLE_NAME']) . " (" . $is_fk_result[0]['REFERENCED_COLUMN_NAME'] . ");"; + $fk_query = "ALTER TABLE " . PMA_Util::backquote($trg_db) . '.' . PMA_Util::backquote($matching_tables[$table_counter]) . + "ADD CONSTRAINT FOREIGN KEY " . PMA_Util::backquote($add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]]) . " + (" . $add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]] . ") REFERENCES " . PMA_Util::backquote($trg_db) . + '.' . PMA_Util::backquote($is_fk_result[0]['REFERENCED_TABLE_NAME']) . " (" . $is_fk_result[0]['REFERENCED_COLUMN_NAME'] . ");"; PMA_DBI_try_query($fk_query, $trg_link, null); } @@ -1166,13 +1166,13 @@ function PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables, $pri_query = null; if (! $check) { - $pri_query = "ALTER TABLE " . $common_functions->backquote($trg_db) . '.' . $common_functions->backquote($matching_tables[$matching_table_index]); + $pri_query = "ALTER TABLE " . PMA_Util::backquote($trg_db) . '.' . PMA_Util::backquote($matching_tables[$matching_table_index]); if (count($target_tables_keys[$matching_table_index]) > 0) { $pri_query .= " DROP PRIMARY KEY ," ; } $pri_query .= " ADD PRIMARY KEY ("; for ($z = 0; $z < count($matching_tables_keys[$matching_table_index]); $z++) { - $pri_query .= $common_functions->backquote($matching_tables_keys[$matching_table_index][$z]); + $pri_query .= PMA_Util::backquote($matching_tables_keys[$matching_table_index][$z]); if ($z < (count($matching_tables_keys[$matching_table_index]) - 1)) { $pri_query .= " , " ; } @@ -1188,8 +1188,8 @@ function PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables, } for ($t = 0; $t < count($matching_tables_fields[$matching_table_index]); $t++) { if ((isset($alter_str_array[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]])) && (count($alter_str_array[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]]) > 0)) { - $sql_query = 'ALTER TABLE ' . $common_functions->backquote($trg_db) . '.' . $common_functions->backquote($matching_tables[$matching_table_index]) . ' MODIFY ' . - $common_functions->backquote($matching_tables_fields[$matching_table_index][$t]) . ' ' . $source_columns[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]]['Type']; + $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($trg_db) . '.' . PMA_Util::backquote($matching_tables[$matching_table_index]) . ' MODIFY ' . + PMA_Util::backquote($matching_tables_fields[$matching_table_index][$t]) . ' ' . $source_columns[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]]['Type']; $found = false; for ($i = 0; $i < count($criteria); $i++) { if (isset($alter_str_array[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]][$criteria[$i]]) && $criteria[$i] != 'Key') { @@ -1248,12 +1248,12 @@ function PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables, } } $check = false; - $query = "ALTER TABLE " . $common_functions->backquote($trg_db) . '.' - . $common_functions->backquote($matching_tables[$matching_table_index]); + $query = "ALTER TABLE " . PMA_Util::backquote($trg_db) . '.' + . PMA_Util::backquote($matching_tables[$matching_table_index]); for ($p = 0; $p < count($matching_tables_keys[$matching_table_index]); $p++) { if ((isset($alter_str_array[$matching_table_index][$matching_tables_keys[$matching_table_index][$p]]['Key']))) { $check = true; - $query .= ' MODIFY ' . $common_functions->backquote($matching_tables_keys[$matching_table_index][$p]) . ' ' + $query .= ' MODIFY ' . PMA_Util::backquote($matching_tables_keys[$matching_table_index][$p]) . ' ' . $source_columns[$matching_table_index][$matching_tables_fields[$matching_table_index][$p]]['Type'] . ' Not Null '; if ($p < (count($matching_tables_keys[$matching_table_index]) - 1)) { $query .= ', '; @@ -1288,8 +1288,8 @@ function PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables, ) { if (isset($uncommon_columns[$table_counter])) { - $drop_query = "ALTER TABLE " . $common_functions->backquote($trg_db) . "." - . $common_functions->backquote($matching_tables[$table_counter]); + $drop_query = "ALTER TABLE " . PMA_Util::backquote($trg_db) . "." + . PMA_Util::backquote($matching_tables[$table_counter]); for ($a = 0; $a < count($uncommon_columns[$table_counter]); $a++) { //Checks if column to be removed is a foreign key in any table $pk_query = "SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = '" . $trg_db . "' @@ -1301,8 +1301,8 @@ function PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables, if ($result_size > 0) { for ($b = 0; $b < $result_size; $b++) { - $drop_pk_query = "ALTER TABLE " . $common_functions->backquote($pk_query_result[$b]['TABLE_SCHEMA']) . "." . $common_functions->backquote($pk_query_result[$b]['TABLE_NAME']) . " - DROP FOREIGN KEY " . $common_functions->backquote($pk_query_result[$b]['CONSTRAINT_NAME']) . ", DROP COLUMN " . $common_functions->backquote($pk_query_result[$b]['COLUMN_NAME']) . ";"; + $drop_pk_query = "ALTER TABLE " . PMA_Util::backquote($pk_query_result[$b]['TABLE_SCHEMA']) . "." . PMA_Util::backquote($pk_query_result[$b]['TABLE_NAME']) . " + DROP FOREIGN KEY " . PMA_Util::backquote($pk_query_result[$b]['CONSTRAINT_NAME']) . ", DROP COLUMN " . PMA_Util::backquote($pk_query_result[$b]['COLUMN_NAME']) . ";"; PMA_DBI_try_query($drop_pk_query, $trg_link, 0); } } @@ -1313,9 +1313,9 @@ function PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables, $result = PMA_DBI_fetch_result($query, null, null, $trg_link); if (count($result) > 0) { - $drop_query .= " DROP FOREIGN KEY " . $common_functions->backquote($result[0]['CONSTRAINT_NAME']) . ","; + $drop_query .= " DROP FOREIGN KEY " . PMA_Util::backquote($result[0]['CONSTRAINT_NAME']) . ","; } - $drop_query .= " DROP COLUMN " . $common_functions->backquote($uncommon_columns[$table_counter][$a]); + $drop_query .= " DROP COLUMN " . PMA_Util::backquote($uncommon_columns[$table_counter][$a]); if ($a < (count($uncommon_columns[$table_counter]) - 1)) { $drop_query .= " , " ; } @@ -1426,7 +1426,7 @@ function PMA_applyIndexesDiff($trg_db, $trg_link, $matching_tables, $source_inde //Adds indexes on target table if (isset($add_indexes_array[$table_counter])) { - $sql = "ALTER TABLE " . $common_functions->backquote($trg_db) . "." . $common_functions->backquote($matching_tables[$table_counter]) . " ADD" ; + $sql = "ALTER TABLE " . PMA_Util::backquote($trg_db) . "." . PMA_Util::backquote($matching_tables[$table_counter]) . " ADD" ; for ($a = 0; $a < count($source_indexes[$table_counter]); $a++) { if (isset($add_indexes_array[$table_counter][$a])) { for ($b = 0; $b < count($source_indexes[$table_counter]); $b++) { @@ -1434,7 +1434,7 @@ function PMA_applyIndexesDiff($trg_db, $trg_link, $matching_tables, $source_inde if ($source_indexes[$table_counter][$b]['Non_unique'] == '0') { $sql .= " UNIQUE "; } - $sql .= " INDEX " . $common_functions->backquote($source_indexes[$table_counter][$b]['Key_name']) . " (" . $add_indexes_array[$table_counter][$a] . " );"; + $sql .= " INDEX " . PMA_Util::backquote($source_indexes[$table_counter][$b]['Key_name']) . " (" . $add_indexes_array[$table_counter][$a] . " );"; if ($display == true) { echo '<p>' . $sql . '</p>'; } @@ -1447,10 +1447,10 @@ function PMA_applyIndexesDiff($trg_db, $trg_link, $matching_tables, $source_inde //Alter indexes of target table if (isset($alter_indexes_array[$table_counter])) { - $query = "ALTER TABLE " . $common_functions->backquote($trg_db) . "." . $common_functions->backquote($matching_tables[$table_counter]); + $query = "ALTER TABLE " . PMA_Util::backquote($trg_db) . "." . PMA_Util::backquote($matching_tables[$table_counter]); for ($a = 0; $a < count($alter_indexes_array[$table_counter]); $a++) { if (isset($alter_indexes_array[$table_counter][$a])) { - $query .= ' DROP INDEX ' . $common_functions->backquote($alter_indexes_array[$table_counter][$a]) . " , ADD "; + $query .= ' DROP INDEX ' . PMA_Util::backquote($alter_indexes_array[$table_counter][$a]) . " , ADD "; $got_first_index_column = false; for ($z = 0; $z < count($source_indexes[$table_counter]); $z++) { if ($source_indexes[$table_counter][$z]['Key_name'] == $alter_indexes_array[$table_counter][$a]) { @@ -1458,11 +1458,11 @@ function PMA_applyIndexesDiff($trg_db, $trg_link, $matching_tables, $source_inde if ($source_indexes[$table_counter][$z]['Non_unique'] == '0') { $query .= " UNIQUE "; } - $query .= " INDEX " . $common_functions->backquote($source_indexes[$table_counter][$z]['Key_name']) . " (" . $common_functions->backquote($source_indexes[$table_counter][$z]['Column_name']); + $query .= " INDEX " . PMA_Util::backquote($source_indexes[$table_counter][$z]['Key_name']) . " (" . PMA_Util::backquote($source_indexes[$table_counter][$z]['Column_name']); $got_first_index_column = true; } else { // another column for this index - $query .= ', ' . $common_functions->backquote($source_indexes[$table_counter][$z]['Column_name']); + $query .= ', ' . PMA_Util::backquote($source_indexes[$table_counter][$z]['Column_name']); } } } @@ -1477,10 +1477,10 @@ function PMA_applyIndexesDiff($trg_db, $trg_link, $matching_tables, $source_inde } //Removes indexes from target table if (isset($remove_indexes_array[$table_counter])) { - $drop_index_query = "ALTER TABLE " . $common_functions->backquote($trg_db) . "." . $common_functions->backquote($matching_tables[$table_counter]); + $drop_index_query = "ALTER TABLE " . PMA_Util::backquote($trg_db) . "." . PMA_Util::backquote($matching_tables[$table_counter]); for ($a = 0; $a < count($target_indexes[$table_counter]); $a++) { if (isset($remove_indexes_array[$table_counter][$a])) { - $drop_index_query .= " DROP INDEX " . $common_functions->backquote($remove_indexes_array[$table_counter][$a]); + $drop_index_query .= " DROP INDEX " . PMA_Util::backquote($remove_indexes_array[$table_counter][$a]); } if ($a < (count($remove_indexes_array[$table_counter]) - 1)) { $drop_index_query .= " , " ; @@ -1607,12 +1607,12 @@ function PMA_getColumnValues($database, $table, $column, $link = null) $query = 'SELECT '; for ($i = 0; $i < count($column); $i++) { - $query.= $common_functions->backquote($column[$i]); + $query.= PMA_Util::backquote($column[$i]); if ($i < (count($column)-1)) { $query.= ', '; } } - $query.= ' FROM ' . $common_functions->backquote($database) . '.' . $common_functions->backquote($table); + $query.= ' FROM ' . PMA_Util::backquote($database) . '.' . PMA_Util::backquote($table); $field_values = PMA_DBI_fetch_result($query, null, null, $link); if (! is_array($field_values) || count($field_values) < 1) { diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php index 7de1d425f2..cb0129e7c7 100644 --- a/libraries/sql_query_form.lib.php +++ b/libraries/sql_query_form.lib.php @@ -218,7 +218,7 @@ function PMA_sqlQueryFormInsert( // $tmp_db_link = htmlspecialchars($db); $legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link); if (empty($query)) { - $query = $common_functions->expandUserString( + $query = PMA_Util::expandUserString( $GLOBALS['cfg']['DefaultQueryDatabase'], 'backquote' ); } @@ -242,12 +242,12 @@ function PMA_sqlQueryFormInsert( // $tmp_db_link = htmlspecialchars($db); $legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link); if (empty($query)) { - $query = $common_functions->expandUserString( + $query = PMA_Util::expandUserString( $GLOBALS['cfg']['DefaultQueryTable'], 'backquote' ); } } - $legend .= ': ' . $common_functions->showMySQLDocu('SQL-Syntax', 'SELECT'); + $legend .= ': ' . PMA_Util::showMySQLDocu('SQL-Syntax', 'SELECT'); if (count($fields_list)) { $sqlquerycontainer_id = 'sqlquerycontainer'; @@ -455,7 +455,7 @@ function PMA_sqlQueryFormUpload() if (!empty($GLOBALS['cfg']['UploadDir'])) { $files = PMA_getFileSelectOptions( - $common_functions->userDir($GLOBALS['cfg']['UploadDir']), $matcher, + PMA_Util::userDir($GLOBALS['cfg']['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '' @@ -470,9 +470,9 @@ function PMA_sqlQueryFormUpload() echo __('Browse your computer:') . '</legend>'; echo '<div class="formelement">'; echo '<input type="file" name="sql_file" class="textfield" /> '; - echo $common_functions->getFormattedMaximumUploadSize($GLOBALS['max_upload_size']); + echo PMA_Util::getFormattedMaximumUploadSize($GLOBALS['max_upload_size']); // some browsers should respect this :) - echo $common_functions->generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n"; + echo PMA_Util::generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n"; echo '</div>'; if ($files === false) { diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 1f7fc7e5ed..f25e915ed6 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -1198,7 +1198,7 @@ function PMA_SQP_analyze($arr) case 'quote_backtick': case 'quote_double': case 'quote_single': - $identifier = $common_functions->unQuote($arr[$i]['data']); + $identifier = PMA_Util::unQuote($arr[$i]['data']); break; } // end switch @@ -2007,7 +2007,7 @@ function PMA_SQP_analyze($arr) if ($arr[$i]['type'] == 'quote_backtick') { // remove backquotes - $identifier = $common_functions->unQuote($arr[$i]['data']); + $identifier = PMA_Util::unQuote($arr[$i]['data']); } else { $identifier = $arr[$i]['data']; } @@ -2354,7 +2354,7 @@ function PMA_SQP_formatHtml( if ($docu && isset($PMA_SQPdata_operators_docs[$arr[$i]['data']]) && ($arr[$i]['data'] != '*' || in_array($arr[$i]['type'], array('digit_integer','digit_float','digit_hex'))) ) { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'functions', $PMA_SQPdata_operators_docs[$arr[$i]['data']]['link'], false, @@ -2405,7 +2405,7 @@ function PMA_SQP_formatHtml( case 'bit': case 'boolean': case 'serial': - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'data-types', 'numeric-types', false, @@ -2419,7 +2419,7 @@ function PMA_SQP_formatHtml( case 'timestamp': case 'time': case 'year': - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'data-types', 'date-and-time-types', false, @@ -2442,7 +2442,7 @@ function PMA_SQP_formatHtml( case 'longblob': case 'enum': case 'set': - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'data-types', 'string-types', false, @@ -2496,7 +2496,7 @@ function PMA_SQP_formatHtml( case 'alpha_functionName': $funcname = strtoupper($arr[$i]['data']); if ($docu && isset($PMA_SQPdata_functions_docs[$funcname])) { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'functions', $PMA_SQPdata_functions_docs[$funcname]['link'], false, @@ -2581,7 +2581,7 @@ function PMA_SQP_formatHtml( case 'SERVER': case 'DATABASE': case 'VIEW': - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'SQL-Syntax', $arr[$i]['data'] . '_' . $arr[$i + 1]['data'], false, @@ -2594,7 +2594,7 @@ function PMA_SQP_formatHtml( if ($arr[$i + 1]['data'] == 'LOGFILE' && $arr[$i + 2]['data'] == 'GROUP' ) { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'SQL-Syntax', $arr[$i]['data'] . '_LOGFILE_GROUP', false, @@ -2627,7 +2627,7 @@ function PMA_SQP_formatHtml( break; case 'SET': if ($docu && ($i == 0 || $arr[$i - 1]['data'] != 'CHARACTER')) { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'SQL-Syntax', $arr[$i]['data'], false, @@ -2647,7 +2647,7 @@ function PMA_SQP_formatHtml( case 'SHOW': case 'UPDATE': if ($docu) { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'SQL-Syntax', $arr[$i]['data'], false, @@ -2664,7 +2664,7 @@ function PMA_SQP_formatHtml( case 'INSERT': case 'REPLACE': if ($docu) { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'SQL-Syntax', $arr[$i]['data'], false, @@ -2684,7 +2684,7 @@ function PMA_SQP_formatHtml( break; case 'SELECT': if ($docu) { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'SQL-Syntax', 'SELECT', false, @@ -2700,7 +2700,7 @@ function PMA_SQP_formatHtml( case 'DO': case 'HANDLER': if ($docu) { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'SQL-Syntax', $arr[$i]['data'], false, @@ -2737,7 +2737,7 @@ function PMA_SQP_formatHtml( . $arr[$i + 1]['data'] . '_' . $arr[$i + 2]['data'] ); - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'functions', $PMA_SQPdata_functions_docs[$tempname]['link'], false, @@ -2754,7 +2754,7 @@ function PMA_SQP_formatHtml( $tempname = strtoupper( $arr[$i]['data'] . '_' . $arr[$i + 1]['data'] ); - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'functions', $PMA_SQPdata_functions_docs[$tempname]['link'], false, @@ -2763,7 +2763,7 @@ function PMA_SQP_formatHtml( ); $close_docu_link = true; } else { - $before .= $common_functions->showMySQLDocu( + $before .= PMA_Util::showMySQLDocu( 'functions', $PMA_SQPdata_functions_docs[$arr[$i]['data']]['link'], false, diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index 24a3c03e60..ed5799ecd7 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -64,7 +64,7 @@ function PMA_getHtmlForActionLinks($current_table, $table_is_view, $tbl_url_quer $empty_table .= ' href="sql.php?' . $tbl_url_query . '&sql_query='; $empty_table .= urlencode( - 'TRUNCATE ' . $common_functions->backquote($current_table['TABLE_NAME']) + 'TRUNCATE ' . PMA_Util::backquote($current_table['TABLE_NAME']) ); $empty_table .= '&message_to_show=' . urlencode( @@ -91,14 +91,14 @@ function PMA_getHtmlForActionLinks($current_table, $table_is_view, $tbl_url_quer if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) { $tracking_icon = '<a href="tbl_tracking.php?' . $url_query . '&table=' . $truename . '">' - . $common_functions->getImage( + . PMA_Util::getImage( 'eye.png', __('Tracking is active.') ) . '</a>'; } elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) { $tracking_icon = '<a href="tbl_tracking.php?' . $url_query . '&table=' . $truename . '">' - . $common_functions->getImage( + . PMA_Util::getImage( 'eye_grey.png', __('Tracking is not active.') ) . '</a>'; @@ -166,11 +166,11 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, ) { if ($is_show_stats) { - list($sum_formatted, $unit) = $common_functions->formatByteDown( + list($sum_formatted, $unit) = PMA_Util::formatByteDown( $sum_size, 3, 1 ); list($overhead_formatted, $overhead_unit) - = $common_functions->formatByteDown($overhead_size, 3, 1); + = PMA_Util::formatByteDown($overhead_size, 3, 1); } $html_output = '<tbody id="tbl_summary_row">' @@ -178,7 +178,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, $html_output .= '<th class="tbl_num nowrap">'; $html_output .= sprintf( _ngettext('%s table', '%s tables', $num_tables), - $common_functions->formatNumber($num_tables, 0) + PMA_Util::formatNumber($num_tables, 0) ); $html_output .= '</th>'; @@ -189,7 +189,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, . __('Sum') . '</th>'; $html_output .= '<th class="value tbl_rows">' - . $sum_row_count_pre . $common_functions->formatNumber($sum_entries, 0) + . $sum_row_count_pre . PMA_Util::formatNumber($sum_entries, 0) . '</th>'; if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { @@ -230,7 +230,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, $html_output .= '<th class="value tbl_creation">' . "\n" . ' ' . ($create_time_all - ? $common_functions->localisedDate(strtotime($create_time_all)) + ? PMA_Util::localisedDate(strtotime($create_time_all)) : '-' ) . '</th>'; @@ -240,7 +240,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, $html_output .= '<th class="value tbl_last_update">' . "\n" . ' ' . ($update_time_all - ? $common_functions->localisedDate(strtotime($update_time_all)) + ? PMA_Util::localisedDate(strtotime($update_time_all)) : '-' ) . '</th>'; @@ -250,7 +250,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, $html_output .= '<th class="value tbl_last_check">' . "\n" . ' ' . ($check_time_all - ? $common_functions->localisedDate(strtotime($check_time_all)) + ? PMA_Util::localisedDate(strtotime($check_time_all)) : '-' ) . '</th>'; @@ -473,10 +473,10 @@ function PMA_getHtmlForStructureTableRow($curr, $odd_row, $table_is_view, $curre if ($server_slave_status) { $html_output .= '<td class="center">' . ($ignored - ? $common_functions->getImage('s_cancel.png', 'NOT REPLICATED') + ? PMA_Util::getImage('s_cancel.png', 'NOT REPLICATED') : '') . ($do - ? $common_functions->getImage('s_success.png', 'REPLICATED') + ? PMA_Util::getImage('s_success.png', 'REPLICATED') : '') . '</td>'; } @@ -603,21 +603,21 @@ function PMA_getHtmlForStructureTimes($create_time, $update_time, $check_time) if ($GLOBALS['cfg']['ShowDbStructureCreation']) { $html_output .= '<td class="value tbl_creation">' . ($create_time - ? $common_functions->localisedDate(strtotime($create_time)) + ? PMA_Util::localisedDate(strtotime($create_time)) : '-' ) . '</td>'; } // end if if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { $html_output .= '<td class="value tbl_last_update">' . ($update_time - ? $common_functions->localisedDate(strtotime($update_time)) + ? PMA_Util::localisedDate(strtotime($update_time)) : '-' ) . '</td>'; } // end if if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { $html_output .= '<td class="value tbl_last_check">' . ($check_time - ? $common_functions->localisedDate(strtotime($check_time)) + ? PMA_Util::localisedDate(strtotime($check_time)) : '-' ) . '</td>'; } @@ -657,7 +657,7 @@ function PMA_getHtmlForNotNullEngineViewTable($table_is_view, $current_table, ) { $row_count_pre = '~'; $sum_row_count_pre = '~'; - $show_superscript = $common_functions->showHint( + $show_superscript = PMA_Util::showHint( PMA_sanitize( sprintf( __('This view has at least this number of rows. Please refer to %sdocumentation%s.'), @@ -677,7 +677,7 @@ function PMA_getHtmlForNotNullEngineViewTable($table_is_view, $current_table, } $html_output .= '<td class="value tbl_rows">' - . $row_count_pre . $common_functions->formatNumber( + . $row_count_pre . PMA_Util::formatNumber( $current_table['TABLE_ROWS'], 0 ) . $show_superscript . '</td>'; @@ -865,12 +865,12 @@ function PMA_sortableTableHeader($title, $sort, $initial_sort_order = 'ASC') if ($requested_sort_order == 'ASC') { $future_sort_order = 'DESC'; // current sort order is ASC - $order_img = ' ' . $common_functions->getImage( + $order_img = ' ' . PMA_Util::getImage( 's_asc.png', __('Ascending'), array('class' => 'sort_arrow', 'title' => '') ); - $order_img .= ' ' . $common_functions->getImage( + $order_img .= ' ' . PMA_Util::getImage( 's_desc.png', __('Descending'), array('class' => 'sort_arrow hide', 'title' => '') @@ -882,12 +882,12 @@ function PMA_sortableTableHeader($title, $sort, $initial_sort_order = 'ASC') } else { $future_sort_order = 'ASC'; // current sort order is DESC - $order_img = ' ' . $common_functions->getImage( + $order_img = ' ' . PMA_Util::getImage( 's_asc.png', __('Ascending'), array('class' => 'sort_arrow hide', 'title' => '') ); - $order_img .= ' ' . $common_functions->getImage( + $order_img .= ' ' . PMA_Util::getImage( 's_desc.png', __('Descending'), array('class' => 'sort_arrow', 'title' => '') @@ -1114,12 +1114,12 @@ function PMA_getValuesForAriaTable($db_is_information_schema, $current_table, $tblsize = doubleval($current_table['Data_length']) + doubleval($current_table['Index_length']); $sum_size += $tblsize; - list($formatted_size, $unit) = $common_functions->formatByteDown( + list($formatted_size, $unit) = PMA_Util::formatByteDown( $tblsize, 3, ($tblsize > 0) ? 1 : 0 ); if (isset($current_table['Data_free']) && $current_table['Data_free'] > 0) { list($formatted_overhead, $overhead_unit) - = $common_functions->formatByteDown( + = PMA_Util::formatByteDown( $current_table['Data_free'], 3, (($current_table['Data_free'] > 0) ? 1 : 0) ); @@ -1161,7 +1161,7 @@ function PMA_getValuesForPbmsTable($current_table, $is_show_stats, $sum_size) if ($is_show_stats && $current_table['Data_length'] !== null) { $tblsize = $current_table['Data_length'] + $current_table['Index_length']; $sum_size += $tblsize; - list($formatted_size, $unit) = $common_functions->formatByteDown( + list($formatted_size, $unit) = PMA_Util::formatByteDown( $tblsize, 3, (($tblsize > 0) ? 1 : 0) ); } @@ -1284,7 +1284,7 @@ function PMA_getHtmlTableStructureRow($row, $rownum, $checked, if (isset($row['Default'])) { if ($extracted_columnspec['type'] == 'bit') { // here, $row['Default'] contains something like b'010' - $html_output .= $common_functions->convertBitDefaultValue($row['Default']); + $html_output .= PMA_Util::convertBitDefaultValue($row['Default']); } else { $html_output .= $row['Default']; } @@ -1332,8 +1332,8 @@ function PMA_getHtmlForDropColumn($tbl_is_view, $db_is_information_schema, . ($GLOBALS['cfg']['AjaxEnable'] ? ' class="drop_column_anchor"' : '') . ' href="sql.php?' . $url_query . '&sql_query=' . urlencode( - 'ALTER TABLE ' . $common_functions->backquote($table) - . ' DROP ' . $common_functions->backquote($row['Field']) . ';' + 'ALTER TABLE ' . PMA_Util::backquote($table) + . ' DROP ' . PMA_Util::backquote($row['Field']) . ';' ) . '&dropped_column=' . urlencode($row['Field']) . '&message_to_show=' . urlencode( @@ -1375,37 +1375,37 @@ function PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir, $html_output .= '<i style="margin-left: 2em">' . __('With selected:') . '</i>'; - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_browse', __('Browse'), 'b_browse.png', 'browse' ); if (! $tbl_is_view && ! $db_is_information_schema) { - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_change', __('Change'), 'b_edit.png', 'change' ); - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_drop', __('Drop'), 'b_drop.png', 'drop' ); if ('ARCHIVE' != $tbl_storage_engine) { - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_primary', __('Primary'), 'b_primary.png', 'primary' ); - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_unique', __('Unique'), 'b_unique.png', 'unique' ); - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_index', __('Index'), 'b_index.png', 'index' ); } if (! empty($tbl_storage_engine) && $tbl_storage_engine == 'MYISAM') { - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_spatial', __('Spatial'), 'b_spatial.png', 'spatial' ); @@ -1415,7 +1415,7 @@ function PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir, || $tbl_storage_engine == 'ARIA' || $tbl_storage_engine == 'MARIA') ) { - $html_output .= $common_functions->getButtonOrImage( + $html_output .= PMA_Util::getButtonOrImage( 'submit_mult', 'mult_submit', 'submit_mult_fulltext', __('Fulltext'), 'b_ftext.png', 'ftext' ); @@ -1460,7 +1460,7 @@ function PMA_getHtmlForEditView($url_params) $create_view = PMA_DBI_get_definition($GLOBALS['db'], 'VIEW', $GLOBALS['table']); $create_view = preg_replace('@^CREATE@', 'ALTER', $create_view); - $html_output = $common_functions->linkOrButton( + $html_output = PMA_Util::linkOrButton( 'tbl_sql.php' . PMA_generate_common_url( $url_params + array( @@ -1468,7 +1468,7 @@ function PMA_getHtmlForEditView($url_params) 'show_query' => '1', ) ), - $common_functions->getIcon('b_edit.png', __('Edit view'), true) + PMA_Util::getIcon('b_edit.png', __('Edit view'), true) ); return $html_output; } @@ -1490,7 +1490,7 @@ function PMA_getHtmlForOptionalActionLinks($url_query, $tbl_is_view, ) { $html_output = '<a href="tbl_printview.php?' . $url_query . '">' - . $common_functions->getIcon('b_print.png', __('Print view'), true) + . PMA_Util::getIcon('b_print.png', __('Print view'), true) . '</a>'; if (! $tbl_is_view && ! $db_is_information_schema) { @@ -1498,10 +1498,10 @@ function PMA_getHtmlForOptionalActionLinks($url_query, $tbl_is_view, // ($tbl_storage_engine comes from libraries/tbl_info.inc.php if ($cfgRelation['relwork'] - || $common_functions->isForeignKeySupported($tbl_storage_engine) + || PMA_Util::isForeignKeySupported($tbl_storage_engine) ) { $html_output .= '<a href="tbl_relation.php?' . $url_query . '">' - . $common_functions->getIcon( + . PMA_Util::getIcon( 'b_relations.png', __('Relation view'), true ) . '</a>'; @@ -1509,26 +1509,26 @@ function PMA_getHtmlForOptionalActionLinks($url_query, $tbl_is_view, if (!PMA_DRIZZLE) { $html_output .= '<a href="sql.php?' . $url_query . '&session_max_rows=all&sql_query=' . urlencode( - 'SELECT * FROM ' . $common_functions->backquote($GLOBALS['table']) + 'SELECT * FROM ' . PMA_Util::backquote($GLOBALS['table']) . ' PROCEDURE ANALYSE()' ) . '">' - . $common_functions->getIcon( + . PMA_Util::getIcon( 'b_tblanalyse.png', __('Propose table structure'), true ) . '</a>'; - $html_output .= $common_functions->showMySQLDocu( + $html_output .= PMA_Util::showMySQLDocu( 'Extending_MySQL', 'procedure_analyse' ) . "\n"; } if (PMA_Tracker::isActive()) { $html_output .= '<a href="tbl_tracking.php?' . $url_query . '">' - . $common_functions->getIcon('eye.png', __('Track table'), true) + . PMA_Util::getIcon('eye.png', __('Track table'), true) . '</a>'; } $html_output .= '<a href="#" id="move_columns_anchor">' - . $common_functions->getIcon('b_move.png', __('Move columns'), true) + . PMA_Util::getIcon('b_move.png', __('Move columns'), true) . '</a>'; } @@ -1561,7 +1561,7 @@ function PMA_getHtmlForAddColumn($columns_list) $GLOBALS['table'] ); if ($GLOBALS['cfg']['PropertiesIconic']) { - $html_output .=$common_functions->getImage( + $html_output .=PMA_Util::getImage( 'b_insrow.png', __('Add column') ); @@ -1589,7 +1589,7 @@ function PMA_getHtmlForAddColumn($columns_list) 'first' => __('At Beginning of Table'), 'after' => sprintf(__('After %s'), '') ); - $html_output .= $common_functions->getRadioFields( + $html_output .= PMA_Util::getRadioFields( 'field_where', $choices, 'last', false ); $html_output .= $column_selector; @@ -1665,10 +1665,10 @@ function PMA_getHtmlForOptimizeLink($url_query) $html_output .= '<td colspan="3" class="center">'; $html_output .= '<a href="sql.php?' . $url_query . '&pos=0&sql_query=' . urlencode( - 'OPTIMIZE TABLE ' . $common_functions->backquote($GLOBALS['table']) + 'OPTIMIZE TABLE ' . PMA_Util::backquote($GLOBALS['table']) ) . '">' - . $common_functions->getIcon('b_tbloptimize.png', __('Optimize table')) + . PMA_Util::getIcon('b_tbloptimize.png', __('Optimize table')) . '</a>'; $html_output .= '</td>'; $html_output .= '</tr>'; @@ -1754,7 +1754,7 @@ function getHtmlForRowStatsTable($showtable, $tbl_collation, $html_output .= PMA_getHtmlForRowStatsTableRow( $odd_row, __('Rows'), - $common_functions->formatNumber($showtable['Rows'], 0) + PMA_Util::formatNumber($showtable['Rows'], 0) ); $odd_row = !$odd_row; } @@ -1765,7 +1765,7 @@ function getHtmlForRowStatsTable($showtable, $tbl_collation, $html_output .= PMA_getHtmlForRowStatsTableRow( $odd_row, __('Row length'), - $common_functions->formatNumber($showtable['Avg_row_length'], 0) + PMA_Util::formatNumber($showtable['Avg_row_length'], 0) ); $odd_row = !$odd_row; } @@ -1785,7 +1785,7 @@ function getHtmlForRowStatsTable($showtable, $tbl_collation, $html_output .= PMA_getHtmlForRowStatsTableRow( $odd_row, __('Next autoindex'), - $common_functions->formatNumber($showtable['Auto_increment'], 0) + PMA_Util::formatNumber($showtable['Auto_increment'], 0) ); $odd_row = !$odd_row; } @@ -1793,14 +1793,14 @@ function getHtmlForRowStatsTable($showtable, $tbl_collation, $html_output .= PMA_getHtmlForRowStatsTableRow( $odd_row, __('Creation'), - $common_functions->localisedDate(strtotime($showtable['Create_time'])) + PMA_Util::localisedDate(strtotime($showtable['Create_time'])) ); } if (isset($showtable['Update_time'])) { $html_output .= PMA_getHtmlForRowStatsTableRow( $odd_row, __('Last update'), - $common_functions->localisedDate(strtotime($showtable['Update_time'])) + PMA_Util::localisedDate(strtotime($showtable['Update_time'])) ); $odd_row = !$odd_row; } @@ -1808,7 +1808,7 @@ function getHtmlForRowStatsTable($showtable, $tbl_collation, $html_output .= PMA_getHtmlForRowStatsTableRow( $odd_row, __('Last check'), - $common_functions->localisedDate(strtotime($showtable['Check_time'])) + PMA_Util::localisedDate(strtotime($showtable['Check_time'])) ); } $html_output .= '</tbody>' @@ -1844,10 +1844,10 @@ function PMA_getHtmlDivsForStructureActionsDropdown($class, $isActionEnabled, $html_output .= '<a href="sql.php?' . $url_query . '&sql_query=' . urlencode( - 'ALTER TABLE ' . $common_functions->backquote($GLOBALS['table']) + 'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table']) . ($isPrimary ? ($primary ? ' DROP PRIMARY KEY,' : '') : '') . ' ' . $syntax . '(' - . $common_functions->backquote($row['Field']) . ');' + . PMA_Util::backquote($row['Field']) . ');' ) . '&message_to_show=' . urlencode( sprintf( @@ -1889,7 +1889,7 @@ function PMA_getHtmlForMoreOptionInTableStructure($rownum, $primary_enabled, ) { $html_output = '<td class="more_opts" id="more_opts' . $rownum . '">'; - $html_output .= $common_functions->getImage( + $html_output .= PMA_Util::getImage( 'more.png', __('Show more actions') ) . __('More'); $html_output .= '<div class="structure_actions_dropdown" id="row_' . $rownum . '">'; @@ -1935,11 +1935,11 @@ function PMA_getHtmlForMoreOptionInTableStructure($rownum, $primary_enabled, $html_output .= '<div class="action_browse replace_in_more">'; $html_output .= '<a href="sql.php?' . $url_query . '&sql_query=' . urlencode( - 'SELECT COUNT(*) AS ' . $common_functions->backquote(__('Rows')) - . ', ' . $common_functions->backquote($row['Field']) - . ' FROM ' . $common_functions->backquote($GLOBALS['table']) - . ' GROUP BY ' . $common_functions->backquote($row['Field']) - . ' ORDER BY ' . $common_functions->backquote($row['Field']) + 'SELECT COUNT(*) AS ' . PMA_Util::backquote(__('Rows')) + . ', ' . PMA_Util::backquote($row['Field']) + . ' FROM ' . PMA_Util::backquote($GLOBALS['table']) + . ' GROUP BY ' . PMA_Util::backquote($row['Field']) + . ' ORDER BY ' . PMA_Util::backquote($row['Field']) ) . '&browse_distinct=1">' . $hidden_titles['DistinctValues'] @@ -1991,10 +1991,10 @@ function PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, . ($hasLinkClass ? 'class="add_primary_key_anchor" ' : '') . 'href="sql.php?' . $url_query . '&sql_query=' . urlencode( - 'ALTER TABLE ' . $common_functions->backquote($GLOBALS['table']) + 'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table']) . ($isPrimary ? ($primary ? ' DROP PRIMARY KEY,' : '') : '') . ' ' . $syntax . '(' - . $common_functions->backquote($row['Field']) . ');' + . PMA_Util::backquote($row['Field']) . ');' ) . '&message_to_show=' . urlencode( sprintf( @@ -2038,8 +2038,8 @@ function PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query, $html_output .= "\n"; $html_output .= '<a href="sql.php?' . $url_query . '&sql_query=' . urlencode( - 'ALTER TABLE ' . $common_functions->backquote($GLOBALS['table']) - . ' ADD FULLTEXT(' . $common_functions->backquote($row['Field']) + 'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table']) + . ' ADD FULLTEXT(' . PMA_Util::backquote($row['Field']) . ');' ) . '&message_to_show=' @@ -2078,11 +2078,11 @@ function PMA_getHtmlForDistinctValueAction($url_query, $row, $titles) $html_output = '<td class="browse replaced_by_more center">'; $html_output .= '<a href="sql.php?' . $url_query . '&sql_query=' . urlencode( - 'SELECT COUNT(*) AS ' . $common_functions->backquote(__('Rows')) - . ', ' . $common_functions->backquote($row['Field']) - . ' FROM ' . $common_functions->backquote($GLOBALS['table']) - . ' GROUP BY ' . $common_functions->backquote($row['Field']) - . ' ORDER BY ' . $common_functions->backquote($row['Field']) + 'SELECT COUNT(*) AS ' . PMA_Util::backquote(__('Rows')) + . ', ' . PMA_Util::backquote($row['Field']) + . ' FROM ' . PMA_Util::backquote($GLOBALS['table']) + . ' GROUP BY ' . PMA_Util::backquote($row['Field']) + . ' ORDER BY ' . PMA_Util::backquote($row['Field']) ) . '">' . $titles['DistinctValues'] @@ -2190,37 +2190,37 @@ function PMA_getHiddenTitlesArray() { $hidden_titles = array(); - $hidden_titles['DistinctValues'] = $common_functions->getIcon( + $hidden_titles['DistinctValues'] = PMA_Util::getIcon( 'b_browse.png', __('Distinct values'), true ); - $hidden_titles['Primary'] = $common_functions->getIcon( + $hidden_titles['Primary'] = PMA_Util::getIcon( 'b_primary.png', __('Add primary key'), true ); - $hidden_titles['NoPrimary'] = $common_functions->getIcon( + $hidden_titles['NoPrimary'] = PMA_Util::getIcon( 'bd_primary.png', __('Add primary key'), true ); - $hidden_titles['Index'] = $common_functions->getIcon( + $hidden_titles['Index'] = PMA_Util::getIcon( 'b_index.png', __('Add index'), true ); - $hidden_titles['NoIndex'] = $common_functions->getIcon( + $hidden_titles['NoIndex'] = PMA_Util::getIcon( 'bd_index.png', __('Add index'), true ); - $hidden_titles['Unique'] = $common_functions->getIcon( + $hidden_titles['Unique'] = PMA_Util::getIcon( 'b_unique.png', __('Add unique index'), true ); - $hidden_titles['NoUnique'] = $common_functions->getIcon( + $hidden_titles['NoUnique'] = PMA_Util::getIcon( 'bd_unique.png', __('Add unique index'), true ); - $hidden_titles['Spatial'] = $common_functions->getIcon( + $hidden_titles['Spatial'] = PMA_Util::getIcon( 'b_spatial.png', __('Add SPATIAL index'), true ); - $hidden_titles['NoSpatial'] = $common_functions->getIcon( + $hidden_titles['NoSpatial'] = PMA_Util::getIcon( 'bd_spatial.png', __('Add SPATIAL index'), true ); - $hidden_titles['IdxFulltext'] = $common_functions->getIcon( + $hidden_titles['IdxFulltext'] = PMA_Util::getIcon( 'b_ftext.png', __('Add FULLTEXT index'), true ); - $hidden_titles['NoIdxFulltext'] = $common_functions->getIcon( + $hidden_titles['NoIdxFulltext'] = PMA_Util::getIcon( 'bd_ftext.png', __('Add FULLTEXT index'), true ); @@ -2237,33 +2237,33 @@ function PMA_getActionTitlesArray() $titles = array(); $titles['Change'] - = $common_functions->getIcon('b_edit.png', __('Change')); + = PMA_Util::getIcon('b_edit.png', __('Change')); $titles['Drop'] - = $common_functions->getIcon('b_drop.png', __('Drop')); + = PMA_Util::getIcon('b_drop.png', __('Drop')); $titles['NoDrop'] - = $common_functions->getIcon('b_drop.png', __('Drop')); + = PMA_Util::getIcon('b_drop.png', __('Drop')); $titles['Primary'] - = $common_functions->getIcon('b_primary.png', __('Primary')); + = PMA_Util::getIcon('b_primary.png', __('Primary')); $titles['Index'] - = $common_functions->getIcon('b_index.png', __('Index')); + = PMA_Util::getIcon('b_index.png', __('Index')); $titles['Unique'] - = $common_functions->getIcon('b_unique.png', __('Unique')); + = PMA_Util::getIcon('b_unique.png', __('Unique')); $titles['Spatial'] - = $common_functions->getIcon('b_spatial.png', __('Spatial')); + = PMA_Util::getIcon('b_spatial.png', __('Spatial')); $titles['IdxFulltext'] - = $common_functions->getIcon('b_ftext.png', __('Fulltext')); + = PMA_Util::getIcon('b_ftext.png', __('Fulltext')); $titles['NoPrimary'] - = $common_functions->getIcon('bd_primary.png', __('Primary')); + = PMA_Util::getIcon('bd_primary.png', __('Primary')); $titles['NoIndex'] - = $common_functions->getIcon('bd_index.png', __('Index')); + = PMA_Util::getIcon('bd_index.png', __('Index')); $titles['NoUnique'] - = $common_functions->getIcon('bd_unique.png', __('Unique')); + = PMA_Util::getIcon('bd_unique.png', __('Unique')); $titles['NoSpatial'] - = $common_functions->getIcon('bd_spatial.png', __('Spatial')); + = PMA_Util::getIcon('bd_spatial.png', __('Spatial')); $titles['NoIdxFulltext'] - = $common_functions->getIcon('bd_ftext.png', __('Fulltext')); + = PMA_Util::getIcon('bd_ftext.png', __('Fulltext')); $titles['DistinctValues'] - = $common_functions->getIcon('b_browse.png', __('Distinct values')); + = PMA_Util::getIcon('b_browse.png', __('Distinct values')); return $titles; } @@ -2308,11 +2308,11 @@ function PMA_getHtmlForDisplayTableStats($showtable, $table_info_num_rows, // this is to display for example 261.2 MiB instead of 268k KiB $max_digits = 3; $decimals = 1; - list($data_size, $data_unit) = $common_functions->formatByteDown( + list($data_size, $data_unit) = PMA_Util::formatByteDown( $showtable['Data_length'], $max_digits, $decimals ); if ($mergetable == false) { - list($index_size, $index_unit) = $common_functions->formatByteDown( + list($index_size, $index_unit) = PMA_Util::formatByteDown( $showtable['Index_length'], $max_digits, $decimals ); } @@ -2321,25 +2321,25 @@ function PMA_getHtmlForDisplayTableStats($showtable, $table_info_num_rows, && isset($showtable['Data_free']) && $showtable['Data_free'] > 0 ) { - list($free_size, $free_unit) = $common_functions->formatByteDown( + list($free_size, $free_unit) = PMA_Util::formatByteDown( $showtable['Data_free'], $max_digits, $decimals ); - list($effect_size, $effect_unit) = $common_functions->formatByteDown( + list($effect_size, $effect_unit) = PMA_Util::formatByteDown( $showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], $max_digits, $decimals ); } else { - list($effect_size, $effect_unit) = $common_functions->formatByteDown( + list($effect_size, $effect_unit) = PMA_Util::formatByteDown( $showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals ); } - list($tot_size, $tot_unit) = $common_functions->formatByteDown( + list($tot_size, $tot_unit) = PMA_Util::formatByteDown( $showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals ); if ($table_info_num_rows > 0) { - list($avg_size, $avg_unit) = $common_functions->formatByteDown( + list($avg_size, $avg_unit) = PMA_Util::formatByteDown( ($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1 ); diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index af05a9edfb..a2d8fe1915 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -15,7 +15,7 @@ if (! defined('PHPMYADMIN')) { */ require_once './libraries/Util.class.php'; -$common_functions->checkParameters(array('db', 'table', 'action', 'num_fields')); +PMA_Util::checkParameters(array('db', 'table', 'action', 'num_fields')); // Get available character sets and storage engines @@ -86,8 +86,8 @@ $header_cells[] = __('Name'); $header_cells[] = __('Type') . PMA_CommonFunctions::getInstance()->showMySQLDocu('SQL-Syntax', 'data-types'); $header_cells[] = __('Length/Values') - . $common_functions->showHint(__('If column type is "enum" or "set", please enter the values using this format: \'a\',\'b\',\'c\'...<br />If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, precede it with a backslash (for example \'\\\\xyz\' or \'a\\\'b\').')); -$header_cells[] = __('Default') . $common_functions->showHint(__('For default values, please enter just a single value, without backslash escaping or quotes, using this format: a')); + . PMA_Util::showHint(__('If column type is "enum" or "set", please enter the values using this format: \'a\',\'b\',\'c\'...<br />If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, precede it with a backslash (for example \'\\\\xyz\' or \'a\\\'b\').')); +$header_cells[] = __('Default') . PMA_Util::showHint(__('For default values, please enter just a single value, without backslash escaping or quotes, using this format: a')); $header_cells[] = __('Collation'); $header_cells[] = __('Attributes'); $header_cells[] = __('Null'); @@ -114,7 +114,7 @@ $header_cells[] = __('Comments'); if (isset($fields_meta)) { // for moving, load all available column names - $move_columns_sql_query = 'SELECT * FROM ' . $common_functions->backquote($table); + $move_columns_sql_query = 'SELECT * FROM ' . PMA_Util::backquote($table); $move_columns_sql_result = PMA_DBI_try_query($move_columns_sql_query); $move_columns = PMA_DBI_get_fields_meta($move_columns_sql_result); unset($move_columns_sql_query, $move_columns_sql_result); @@ -142,7 +142,7 @@ if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) { $header_cells[] = __('MIME type'); $header_cells[] = __('Browser transformation'); $header_cells[] = __('Transformation options') - . $common_functions->showHint( + . PMA_Util::showHint( __( 'Please enter the values for transformation options using this' . ' format: \'a\', 100, b,\'c\'...<br />If you ever need to put' @@ -297,10 +297,10 @@ for ($i = 0; $i < $num_fields; $i++) { } if (isset($row['Type'])) { - $extracted_columnspec = $common_functions->extractColumnSpec($row['Type']); + $extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']); if ($extracted_columnspec['type'] == 'bit') { $row['Default'] - = $common_functions->convertBitDefaultValue($row['Default']); + = PMA_Util::convertBitDefaultValue($row['Default']); } } // Cell index: If certain fields get left out, the counter shouldn't change. @@ -361,7 +361,7 @@ for ($i = 0; $i < $num_fields; $i++) { $type_upper = strtoupper($type); $content_cells[$i][$ci] - .= $common_functions->getSupportedDatatypes(true, $type_upper); + .= PMA_Util::getSupportedDatatypes(true, $type_upper); $content_cells[$i][$ci] .= ' </select>'; $ci++; @@ -416,7 +416,7 @@ for ($i = 0; $i < $num_fields; $i++) { if ($type_upper == 'BIT') { $row['DefaultValue'] - = $common_functions->convertBitDefaultValue($row['DefaultValue']); + = PMA_Util::convertBitDefaultValue($row['DefaultValue']); } $content_cells[$i][$ci] = '<select name="field_default_type[' . $i @@ -614,7 +614,7 @@ for ($i = 0; $i < $num_fields; $i++) { .'>' . sprintf( __('after %s'), - $common_functions->backquote($move_columns[$mi]->name) + PMA_Util::backquote($move_columns[$mi]->name) ) . '</option>'; } @@ -757,7 +757,7 @@ if (is_array($content_cells) && is_array($header_cells)) { echo '<table id="table_columns" class="noclick">'; echo '<caption class="tblHeaders">' . __('Structure') - . $common_functions->showMySQLDocu('SQL-Syntax', 'CREATE_TABLE') . '</caption>'; + . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_TABLE') . '</caption>'; ?> <tr> @@ -831,7 +831,7 @@ if ($action == 'tbl_create.php') { <th><?php echo __('Table comments'); ?>: </th> <td width="25"> </td> <th><?php echo __('Storage Engine'); ?>: - <?php echo $common_functions->showMySQLDocu('Storage_engines', 'Storage_engines'); ?> + <?php echo PMA_Util::showMySQLDocu('Storage_engines', 'Storage_engines'); ?> </th> <td width="25"> </td> <th><?php echo __('Collation');?>: </th> @@ -872,7 +872,7 @@ if ($action == 'tbl_create.php') { ?> <tr class="vtop"> <th><?php echo __('PARTITION definition'); ?>: <?php - echo $common_functions->showMySQLDocu('Partitioning', 'Partitioning'); ?> + echo PMA_Util::showMySQLDocu('Partitioning', 'Partitioning'); ?> </th> </tr> <tr> diff --git a/libraries/tbl_views.lib.php b/libraries/tbl_views.lib.php index d90252d74c..758100c113 100644 --- a/libraries/tbl_views.lib.php +++ b/libraries/tbl_views.lib.php @@ -71,10 +71,10 @@ function PMA_getExistingTranformationData($db) // Get the existing transformation details of the same database // from pma_column_info table $pma_transformation_sql = 'SELECT * FROM ' - . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['column_info']) + . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['column_info']) . ' WHERE `db_name` = \'' - . $common_functions->sqlAddSlashes($db) . '\''; + . PMA_Util::sqlAddSlashes($db) . '\''; return PMA_DBI_try_query($pma_transformation_sql); @@ -99,8 +99,8 @@ function PMA_getNewTransformationDataSql( // Need to store new transformation details for VIEW $new_transformations_sql = 'INSERT INTO ' - . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['column_info']) + . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['column_info']) . ' (`db_name`, `table_name`, `column_name`, `comment`, ' . '`mimetype`, `transformation`, `transformation_options`)' . ' VALUES '; @@ -132,7 +132,7 @@ function PMA_getNewTransformationDataSql( . '\'' . $data_row['mimetype'] . '\', ' . '\'' . $data_row['transformation'] . '\', ' . '\'' - . $common_functions->sqlAddSlashes( + . PMA_Util::sqlAddSlashes( $data_row['transformation_options'] ) . '\')'; diff --git a/libraries/transformations.lib.php b/libraries/transformations.lib.php index d3a3bacd9b..5adf58e46d 100644 --- a/libraries/transformations.lib.php +++ b/libraries/transformations.lib.php @@ -175,10 +175,10 @@ function PMA_getMIME($db, $table, $strict = false) `mimetype`, `transformation`, `transformation_options` - FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['column_info']) . ' - WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($db) . '\' - AND `table_name` = \'' . $common_functions->sqlAddSlashes($table) . '\' + FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['column_info']) . ' + WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($db) . '\' + AND `table_name` = \'' . PMA_Util::sqlAddSlashes($table) . '\' AND ( `mimetype` != \'\'' . (!$strict ? ' OR `transformation` != \'\' OR `transformation_options` != \'\'' : '') . ')'; @@ -273,11 +273,11 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $test_qry = ' SELECT `mimetype`, `comment` - FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['column_info']) . ' - WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($db) . '\' - AND `table_name` = \'' . $common_functions->sqlAddSlashes($table) . '\' - AND `column_name` = \'' . $common_functions->sqlAddSlashes($key) . '\''; + FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['column_info']) . ' + WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($db) . '\' + AND `table_name` = \'' . PMA_Util::sqlAddSlashes($table) . '\' + AND `column_name` = \'' . PMA_Util::sqlAddSlashes($key) . '\''; $test_rs = PMA_queryAsControlUser($test_qry, true, PMA_DBI_QUERY_STORE); @@ -290,30 +290,30 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, || strlen($transformation_options) || strlen($row['comment'])) ) { $upd_query = ' - UPDATE ' . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['column_info']) . ' - SET `mimetype` = \'' . $common_functions->sqlAddSlashes($mimetype) . '\', - `transformation` = \'' . $common_functions->sqlAddSlashes($transformation) . '\', - `transformation_options` = \'' . $common_functions->sqlAddSlashes($transformation_options) . '\''; + UPDATE ' . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['column_info']) . ' + SET `mimetype` = \'' . PMA_Util::sqlAddSlashes($mimetype) . '\', + `transformation` = \'' . PMA_Util::sqlAddSlashes($transformation) . '\', + `transformation_options` = \'' . PMA_Util::sqlAddSlashes($transformation_options) . '\''; } else { - $upd_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']); + $upd_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']); } $upd_query .= ' - WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($db) . '\' - AND `table_name` = \'' . $common_functions->sqlAddSlashes($table) . '\' - AND `column_name` = \'' . $common_functions->sqlAddSlashes($key) . '\''; + WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($db) . '\' + AND `table_name` = \'' . PMA_Util::sqlAddSlashes($table) . '\' + AND `column_name` = \'' . PMA_Util::sqlAddSlashes($key) . '\''; } elseif (strlen($mimetype) || strlen($transformation) || strlen($transformation_options)) { - $upd_query = 'INSERT INTO ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']) + $upd_query = 'INSERT INTO ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']) . ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) ' . ' VALUES(' - . '\'' . $common_functions->sqlAddSlashes($db) . '\',' - . '\'' . $common_functions->sqlAddSlashes($table) . '\',' - . '\'' . $common_functions->sqlAddSlashes($key) . '\',' - . '\'' . $common_functions->sqlAddSlashes($mimetype) . '\',' - . '\'' . $common_functions->sqlAddSlashes($transformation) . '\',' - . '\'' . $common_functions->sqlAddSlashes($transformation_options) . '\')'; + . '\'' . PMA_Util::sqlAddSlashes($db) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($table) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($key) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($mimetype) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($transformation) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($transformation_options) . '\')'; } if (isset($upd_query)) { @@ -382,8 +382,8 @@ function PMA_clearTransformations($db, $table = '', $column = '') $cfgRelation = PMA_getRelationsParam(); $delete_sql = 'DELETE FROM ' - . $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['column_info']) + . PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['column_info']) . ' WHERE '; if (($column != '') && ($table != '')) { diff --git a/libraries/user_preferences.lib.php b/libraries/user_preferences.lib.php index a5e818166d..b76dd0fefe 100644 --- a/libraries/user_preferences.lib.php +++ b/libraries/user_preferences.lib.php @@ -56,12 +56,12 @@ function PMA_load_userprefs() 'type' => 'session'); } // load configuration from pmadb - $query_table = $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['userconfig']); + $query_table = PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['userconfig']); $query = ' SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts FROM ' . $query_table . ' - WHERE `username` = \'' . $common_functions->sqlAddSlashes($cfgRelation['user']) . '\''; + WHERE `username` = \'' . PMA_Util::sqlAddSlashes($cfgRelation['user']) . '\''; $row = PMA_DBI_fetch_single_row($query, 'ASSOC', $GLOBALS['controllink']); return array( @@ -97,25 +97,25 @@ function PMA_save_userprefs(array $config_array) } // save configuration to pmadb - $query_table = $common_functions->backquote($cfgRelation['db']) . '.' - . $common_functions->backquote($cfgRelation['userconfig']); + $query_table = PMA_Util::backquote($cfgRelation['db']) . '.' + . PMA_Util::backquote($cfgRelation['userconfig']); $query = ' SELECT `username` FROM ' . $query_table . ' - WHERE `username` = \'' . $common_functions->sqlAddSlashes($cfgRelation['user']) . '\''; + WHERE `username` = \'' . PMA_Util::sqlAddSlashes($cfgRelation['user']) . '\''; $has_config = PMA_DBI_fetch_value($query, 0, 0, $GLOBALS['controllink']); $config_data = json_encode($config_array); if ($has_config) { $query = ' UPDATE ' . $query_table . ' - SET `config_data` = \'' . $common_functions->sqlAddSlashes($config_data) . '\' - WHERE `username` = \'' . $common_functions->sqlAddSlashes($cfgRelation['user']) . '\''; + SET `config_data` = \'' . PMA_Util::sqlAddSlashes($config_data) . '\' + WHERE `username` = \'' . PMA_Util::sqlAddSlashes($cfgRelation['user']) . '\''; } else { $query = ' INSERT INTO ' . $query_table . ' (`username`, `config_data`) - VALUES (\'' . $common_functions->sqlAddSlashes($cfgRelation['user']) . '\', - \'' . $common_functions->sqlAddSlashes($config_data) . '\')'; + VALUES (\'' . PMA_Util::sqlAddSlashes($cfgRelation['user']) . '\', + \'' . PMA_Util::sqlAddSlashes($config_data) . '\')'; } if (isset($_SESSION['cache'][$cache_key]['userprefs'])) { unset($_SESSION['cache'][$cache_key]['userprefs']); @@ -30,7 +30,7 @@ $show_query = '1'; // Any message to display? if (! empty($message)) { - echo $common_functions->getMessage($message); + echo PMA_Util::getMessage($message); unset($message); } @@ -118,7 +118,7 @@ if ($server > 0 . ' <label for="select_collation_connection">' . "\n" . ' ' . __('Server connection collation') . "\n" // put the doc link in the form so that it appears on the same line - . $common_functions->showMySQLDocu( + . PMA_Util::showMySQLDocu( 'MySQL_Database_Administration', 'Charset-connection' ) @@ -195,7 +195,7 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) { 'li_server_info' ); PMA_printListItem( - __('Software') . ': ' . $common_functions->getServerType(), + __('Software') . ': ' . PMA_Util::getServerType(), 'li_server_type' ); PMA_printListItem( @@ -243,7 +243,7 @@ if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) { $php_ext_string = __('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension'] . ' ' - . $common_functions->showPHPDocu( + . PMA_Util::showPHPDocu( 'book.' . $GLOBALS['cfg']['Server']['extension'] . '.php' ); PMA_printListItem( diff --git a/navigation.php b/navigation.php index 232f125528..ee02fc3444 100644 --- a/navigation.php +++ b/navigation.php @@ -178,7 +178,7 @@ if (! $GLOBALS['server']) { } $_url_params = array('pos' => $pos); - echo $common_functions->getListNavigator( + echo PMA_Util::getListNavigator( count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList'] ); @@ -197,8 +197,8 @@ if (! $GLOBALS['server']) { // or $GLOBALS['cfg']['Servers']['only_db'] is defined and is not an array) // In this case, the database should not be collapsible/expandable -$img_plus = $common_functions->getImage('b_plus.png', '+', array('id' => 'el%dImg')); -$img_minus = $common_functions->getImage('b_minus.png', '-', array('id' => 'el%dImg')); +$img_plus = PMA_Util::getImage('b_plus.png', '+', array('id' => 'el%dImg')); +$img_minus = PMA_Util::getImage('b_minus.png', '-', array('id' => 'el%dImg')); $href_left = '<a onclick="if (toggle(\'%d\')) return false;"' .' href="navigation.php?%s" target="_self">'; @@ -207,7 +207,7 @@ $element_counter = 0; if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) { - $table_list = $common_functions->getTableList( + $table_list = PMA_Util::getTableList( $GLOBALS['db'], null, $tpos, @@ -261,7 +261,7 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) { 'pos' => $tpos, 'db' => $GLOBALS['db'] ); - echo $common_functions->getListNavigator( + echo PMA_Util::getListNavigator( $table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList'] ); @@ -271,7 +271,7 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) { if (count($table_list) <= $GLOBALS['cfg']['MaxTableList'] && $table_count > $GLOBALS['cfg']['MaxTableList'] ) { - echo $common_functions->getListNavigator( + echo PMA_Util::getListNavigator( $table_count, $tpos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxTableList'] ); @@ -286,7 +286,7 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) { echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '" class="'.$class .'" >' - . $common_functions->getImage( + . PMA_Util::getImage( 'b_snewtbl.png', _pgettext('short form', 'Create table'), array('id' => "icon_newtable") @@ -302,7 +302,7 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) { } else { echo '<div id="databaseList">' . "\n"; $_url_params = array('pos' => $pos); - echo $common_functions->getListNavigator( + echo PMA_Util::getListNavigator( count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList'] ); @@ -467,7 +467,7 @@ function PMA_displayDbList($ext_dblist, $offset, $count) || $db['num_tables'] ) { if (isset($tables_full[$db['name']])) { - $tables = $common_functions->getTableList( + $tables = PMA_Util::getTableList( $db['name'], $tables_full[$db['name']] ); @@ -478,12 +478,12 @@ function PMA_displayDbList($ext_dblist, $offset, $count) // but information_schema.TABLES gives `test` // bug #1436171 // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408 - $tables = $common_functions->getTableList( + $tables = PMA_Util::getTableList( $db['name'], $tables_full[strtolower($db['name'])] ); } else { - $tables = $common_functions->getTableList($db['name']); + $tables = PMA_Util::getTableList($db['name']); } $child_visible = (bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']); @@ -616,7 +616,7 @@ function PMA_displayTableList( } } } - $link_title = $common_functions->getTitleForTarget( + $link_title = PMA_Util::getTitleForTarget( $GLOBALS['cfg']['LeftDefaultTabTable'] ); // quick access icon next to each table name @@ -625,7 +625,7 @@ function PMA_displayTableList( . htmlspecialchars($link_title) . ': ' . htmlspecialchars($table['Comment']) .' (' - . $common_functions->formatNumber($table['Rows'], 0) + . PMA_Util::formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"' .' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"' .' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?' @@ -637,13 +637,13 @@ function PMA_displayTableList( 'id' => 'icon_' . htmlspecialchars($table_db . '.' . $table['Name']) ); if (PMA_Table::isView($table_db, $table['Name'])) { - echo $common_functions->getImage( + echo PMA_Util::getImage( 's_views.png', htmlspecialchars($link_title), $attr ); } else { - echo $common_functions->getImage( + echo PMA_Util::getImage( 'b_browse.png', htmlspecialchars($link_title), $attr @@ -657,12 +657,12 @@ function PMA_displayTableList( .urlencode($table['Name']) . '&pos=0'; echo '<a target="frame_content" href="' . $href . '" title="' . htmlspecialchars( - $common_functions->getTitleForTarget( + PMA_Util::getTitleForTarget( $GLOBALS['cfg']['DefaultTabTable'] ) . ': ' . $table['Comment'] .' (' - . $common_functions->formatNumber( + . PMA_Util::formatNumber( $table['Rows'], 0 ) . ' ' . __('Rows') . ')' diff --git a/pmd_display_field.php b/pmd_display_field.php index 55cc1d3a21..7ce3632d2a 100644 --- a/pmd_display_field.php +++ b/pmd_display_field.php @@ -21,22 +21,22 @@ if ($cfgRelation['displaywork']) { $disp = PMA_getDisplayField($db, $table); if ($disp) { if ($display_field != $disp) { - $upd_query = 'UPDATE ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) - . ' SET display_field = \'' . $common_functions->sqlAddSlashes($display_field) . '\'' - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $upd_query = 'UPDATE ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) + . ' SET display_field = \'' . PMA_Util::sqlAddSlashes($display_field) . '\'' + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; } else { - $upd_query = 'DELETE FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $upd_query = 'DELETE FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; } } elseif ($display_field != '') { - $upd_query = 'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) + $upd_query = 'INSERT INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) . '(db_name, table_name, display_field) ' . ' VALUES(' - . '\'' . $common_functions->sqlAddSlashes($db) . '\',' - . '\'' . $common_functions->sqlAddSlashes($table) . '\',' - . '\'' . $common_functions->sqlAddSlashes($display_field) . '\')'; + . '\'' . PMA_Util::sqlAddSlashes($db) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($table) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($display_field) . '\')'; } if (isset($upd_query)) { diff --git a/pmd_pdf.php b/pmd_pdf.php index b357fb5ec8..705b143751 100644 --- a/pmd_pdf.php +++ b/pmd_pdf.php @@ -38,11 +38,11 @@ if (isset($mode)) { die("<script>alert('Pages not found!');history.go(-2);</script>"); } - $pmd_table = $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords']); - $pma_table = $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' - . $common_functions->backquote($cfgRelation['table_coords']); - $scale_q = $common_functions->sqlAddSlashes($scale); + $pmd_table = PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($GLOBALS['cfgRelation']['designer_coords']); + $pma_table = PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($cfgRelation['table_coords']); + $scale_q = PMA_Util::sqlAddSlashes($scale); if ('create_export' == $mode) { $pdf_page_number = PMA_REL_createPage($newpage, $cfgRelation, $db); @@ -54,7 +54,7 @@ if (isset($mode)) { } } - $pdf_page_number_q = $common_functions->sqlAddSlashes($pdf_page_number); + $pdf_page_number_q = PMA_Util::sqlAddSlashes($pdf_page_number); if ('export' == $mode) { $sql = "REPLACE INTO " . $pma_table @@ -62,7 +62,7 @@ if (isset($mode)) { . " SELECT db_name, table_name, " . $pdf_page_number_q . "," . " ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y" . " FROM " . $pmd_table - . " WHERE db_name = '" . $common_functions->sqlAddSlashes($db) . "'"; + . " WHERE db_name = '" . PMA_Util::sqlAddSlashes($db) . "'"; PMA_queryAsControlUser($sql, true, PMA_DBI_QUERY_STORE); } @@ -77,7 +77,7 @@ if (isset($mode)) { AND ' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name` AND - ' . $pmd_table . '.`db_name`=\''. $common_functions->sqlAddSlashes($db) . '\' + ' . $pmd_table . '.`db_name`=\''. PMA_Util::sqlAddSlashes($db) . '\' AND pdf_page_number = ' . $pdf_page_number_q . ';', true, PMA_DBI_QUERY_STORE ); @@ -106,9 +106,9 @@ echo '<fieldset><legend>' . __('Import/Export coordinates for PDF schema') . '</ $choices = array(); $table_info_result = PMA_queryAsControlUser( - 'SELECT * FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) - . '.' . $common_functions->backquote($cfgRelation['pdf_pages']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' + 'SELECT * FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) + . '.' . PMA_Util::backquote($cfgRelation['pdf_pages']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' ); if (PMA_DBI_num_rows($table_info_result) > 0) { @@ -131,7 +131,7 @@ if (1 == count($choices)) { echo $choices['create_export']; echo '<input type="hidden" name="mode" value="create_export" />'; } else { - echo $common_functions->getRadioFields( + echo PMA_Util::getRadioFields( 'mode', $choices, $checked_choice = '', $line_break = true, $escape_label = false, $class = '' ); diff --git a/pmd_relation_new.php b/pmd_relation_new.php index d2fba79604..27572f19fd 100644 --- a/pmd_relation_new.php +++ b/pmd_relation_new.php @@ -23,8 +23,8 @@ $tables = PMA_DBI_get_tables_full($db, $T2); $type_T2 = strtoupper($tables[$T2]['ENGINE']); // native foreign key -if ($common_functions->isForeignKeySupported($type_T1) - && $common_functions->isForeignKeySupported($type_T2) +if (PMA_Util::isForeignKeySupported($type_T1) + && PMA_Util::isForeignKeySupported($type_T2) && $type_T1 == $type_T2 ) { // relation exists? @@ -38,8 +38,8 @@ if ($common_functions->isForeignKeySupported($type_T1) // or UNIQUE key // improve: check all other requirements for InnoDB relations $result = PMA_DBI_query( - 'SHOW INDEX FROM ' . $common_functions->backquote($db) - . '.' . $common_functions->backquote($T1) . ';' + 'SHOW INDEX FROM ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($T1) . ';' ); $index_array1 = array(); // will be use to emphasis prim. keys in the table view while ($row = PMA_DBI_fetch_assoc($result)) { @@ -48,8 +48,8 @@ if ($common_functions->isForeignKeySupported($type_T1) PMA_DBI_free_result($result); $result = PMA_DBI_query( - 'SHOW INDEX FROM ' . $common_functions->backquote($db) - . '.' . $common_functions->backquote($T2) . ';' + 'SHOW INDEX FROM ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($T2) . ';' ); $index_array2 = array(); // will be used to emphasis prim. keys in the table view while ($row = PMA_DBI_fetch_assoc($result)) { @@ -58,14 +58,14 @@ if ($common_functions->isForeignKeySupported($type_T1) PMA_DBI_free_result($result); if (! empty($index_array1[$F1]) && ! empty($index_array2[$F2])) { - $upd_query = 'ALTER TABLE ' . $common_functions->backquote($db) - . '.' . $common_functions->backquote($T2) + $upd_query = 'ALTER TABLE ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($T2) . ' ADD FOREIGN KEY (' - . $common_functions->backquote($F2) . ')' + . PMA_Util::backquote($F2) . ')' . ' REFERENCES ' - . $common_functions->backquote($db) . '.' - . $common_functions->backquote($T1) . '(' - . $common_functions->backquote($F1) . ')'; + . PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($T1) . '(' + . PMA_Util::backquote($F1) . ')'; if ($on_delete != 'nix') { $upd_query .= ' ON DELETE ' . $on_delete; @@ -84,15 +84,15 @@ if ($common_functions->isForeignKeySupported($type_T1) // no need to recheck if the keys are primary or unique at this point, // this was checked on the interface part - $q = 'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) + $q = 'INSERT INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) . '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)' . ' values(' - . '\'' . $common_functions->sqlAddSlashes($db) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($T2) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($F2) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($db) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($T1) . '\',' - . '\'' . $common_functions->sqlAddSlashes($F1) . '\')'; + . '\'' . PMA_Util::sqlAddSlashes($db) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($T2) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($F2) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($db) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($T1) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($F1) . '\')'; if (PMA_queryAsControlUser($q, false, PMA_DBI_QUERY_STORE)) { PMD_return_new(1, __('Internal relation added')); diff --git a/pmd_relation_upd.php b/pmd_relation_upd.php index 72412bab82..0599fe8a9f 100644 --- a/pmd_relation_upd.php +++ b/pmd_relation_upd.php @@ -27,17 +27,17 @@ $type_T2 = strtoupper($tables[$T2]['ENGINE']); $try_to_delete_internal_relation = false; -if ($common_functions->isForeignKeySupported($type_T1) - && $common_functions->isForeignKeySupported($type_T2) +if (PMA_Util::isForeignKeySupported($type_T1) + && PMA_Util::isForeignKeySupported($type_T2) && $type_T1 == $type_T2 ) { // InnoDB $existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign'); if (isset($existrel_foreign[$F2]['constraint'])) { - $upd_query = 'ALTER TABLE ' . $common_functions->backquote($DB2) - . '.' . $common_functions->backquote($T2) . ' DROP FOREIGN KEY ' - . $common_functions->backquote($existrel_foreign[$F2]['constraint']) + $upd_query = 'ALTER TABLE ' . PMA_Util::backquote($DB2) + . '.' . PMA_Util::backquote($T2) . ' DROP FOREIGN KEY ' + . PMA_Util::backquote($existrel_foreign[$F2]['constraint']) . ';'; $upd_rs = PMA_DBI_query($upd_query); } else { @@ -51,14 +51,14 @@ if ($try_to_delete_internal_relation) { // internal relations PMA_queryAsControlUser( 'DELETE FROM ' - . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' + . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . $cfg['Server']['relation'].' WHERE ' - . 'master_db = \'' . $common_functions->sqlAddSlashes($DB2) . '\'' - . ' AND master_table = \'' . $common_functions->sqlAddSlashes($T2) . '\'' - . ' AND master_field = \'' . $common_functions->sqlAddSlashes($F2) . '\'' - . ' AND foreign_db = \'' . $common_functions->sqlAddSlashes($DB1) . '\'' - . ' AND foreign_table = \'' . $common_functions->sqlAddSlashes($T1) . '\'' - . ' AND foreign_field = \'' . $common_functions->sqlAddSlashes($F1) . '\'', + . 'master_db = \'' . PMA_Util::sqlAddSlashes($DB2) . '\'' + . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($T2) . '\'' + . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($F2) . '\'' + . ' AND foreign_db = \'' . PMA_Util::sqlAddSlashes($DB1) . '\'' + . ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($T1) . '\'' + . ' AND foreign_field = \'' . PMA_Util::sqlAddSlashes($F1) . '\'', false, PMA_DBI_QUERY_STORE ); diff --git a/pmd_save_pos.php b/pmd_save_pos.php index 085183fdc8..bb97f31e60 100644 --- a/pmd_save_pos.php +++ b/pmd_save_pos.php @@ -41,24 +41,24 @@ foreach ($t_x as $key => $value) { $KEY = empty($IS_AJAX) ? urldecode($key) : $key; list($DB,$TAB) = explode(".", $KEY); PMA_queryAsControlUser( - 'DELETE FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) - . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords']) - . ' WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($DB) . '\'' - . ' AND `table_name` = \'' . $common_functions->sqlAddSlashes($TAB) . '\'', + 'DELETE FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) + . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['designer_coords']) + . ' WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($DB) . '\'' + . ' AND `table_name` = \'' . PMA_Util::sqlAddSlashes($TAB) . '\'', true, PMA_DBI_QUERY_STORE ); PMA_queryAsControlUser( - 'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) - . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords']) + 'INSERT INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) + . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['designer_coords']) . ' (db_name, table_name, x, y, v, h)' . ' VALUES (' - . '\'' . $common_functions->sqlAddSlashes($DB) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($TAB) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($t_x[$key]) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($t_y[$key]) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($t_v[$key]) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($t_h[$key]) . '\')', + . '\'' . PMA_Util::sqlAddSlashes($DB) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($TAB) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($t_x[$key]) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($t_y[$key]) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($t_v[$key]) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($t_h[$key]) . '\')', true, PMA_DBI_QUERY_STORE ); } diff --git a/querywindow.php b/querywindow.php index fdc1bdd535..d809fbd87f 100644 --- a/querywindow.php +++ b/querywindow.php @@ -79,7 +79,7 @@ if ($no_js) { } } -$titles['Change'] = $common_functions->getIcon('b_edit.png', __('Change')); +$titles['Change'] = PMA_Util::getIcon('b_edit.png', __('Change')); $url_query = PMA_generate_common_url($db, $table); if (! empty($sql_query)) { @@ -135,7 +135,7 @@ if ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full') { echo '<div id="querywindowcontainer">'; if ($tabs) { - echo $common_functions->getHtmlTabs($tabs, array()); + echo PMA_Util::getHtmlTabs($tabs, array()); unset($tabs); } @@ -170,9 +170,9 @@ if (! empty($_sql_history) if (! empty($query['db'])) { echo '['; - echo htmlspecialchars($common_functions->backquote($query['db'])); + echo htmlspecialchars(PMA_Util::backquote($query['db'])); if (! empty($query['table'])) { - echo '.' . htmlspecialchars($common_functions->backquote($query['table'])); + echo '.' . htmlspecialchars(PMA_Util::backquote($query['table'])); } echo '] '; } diff --git a/schema_edit.php b/schema_edit.php index e51bdc1c9b..89ffd62109 100644 --- a/schema_edit.php +++ b/schema_edit.php @@ -34,24 +34,24 @@ $cfgRelation = PMA_getRelationsParam(); */ if (! $cfgRelation['relwork']) { echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'relation', 'config.inc.php') . '<br />' . "\n" - . $common_functions->showDocu('relation') . "\n"; + . PMA_Util::showDocu('relation') . "\n"; exit; } if (! $cfgRelation['displaywork']) { echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n" - . $common_functions->showDocu('table_info') . "\n"; + . PMA_Util::showDocu('table_info') . "\n"; exit; } if (! isset($cfgRelation['table_coords'])) { echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n" - . $common_functions->showDocu('table_coords') . "\n"; + . PMA_Util::showDocu('table_coords') . "\n"; exit; } if (! isset($cfgRelation['pdf_pages'])) { echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n" - . $common_functions->showDocu('pdf_pages') . "\n"; + . PMA_Util::showDocu('pdf_pages') . "\n"; exit; } diff --git a/server_binlog.php b/server_binlog.php index e523a7ea13..ffabda5795 100644 --- a/server_binlog.php +++ b/server_binlog.php @@ -70,7 +70,7 @@ if (empty($_REQUEST['dontlimitchars'])) { * Displays the sub-page heading */ echo '<h2>' . "\n" - . $common_functions->getImage('s_tbl.png') + . PMA_Util::getImage('s_tbl.png') . ' ' . __('Binary log') . "\n" . '</h2>' . "\n"; @@ -95,7 +95,7 @@ if (count($binary_logs) > 1) { echo ' (' . implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( $each_log['File_size'], 3, 2 ) ) @@ -107,7 +107,7 @@ if (count($binary_logs) > 1) { echo count($binary_logs) . ' ' . __('Files') . ', '; if ($full_size > 0) { echo implode( - ' ', $common_functions->formatByteDown($full_size) + ' ', PMA_Util::formatByteDown($full_size) ); } echo '</fieldset>'; @@ -117,7 +117,7 @@ if (count($binary_logs) > 1) { echo '</form>'; } -echo $common_functions->getMessage(PMA_Message::success()); +echo PMA_Util::getMessage(PMA_Message::success()); /** * Displays the page diff --git a/server_databases.php b/server_databases.php index d951a09278..f0e745aa15 100644 --- a/server_databases.php +++ b/server_databases.php @@ -134,7 +134,7 @@ if ((isset($_REQUEST['drop_selected_dbs']) || isset($_REQUEST['query_type'])) * Displays the sub-page heading */ echo '<h2>' . "\n" - . $common_functions->getImage('s_db.png') + . PMA_Util::getImage('s_db.png') . ($dbstats ? __('Databases statistics') : __('Databases')) . "\n" .'</h2>' . "\n"; @@ -178,7 +178,7 @@ if ($databases_count > 0) { 'sort_order' => $sort_order, ); - echo $common_functions->getListNavigator( + echo PMA_Util::getListNavigator( $databases_count, $pos, $_url_params, 'server_databases.php', 'frame_content', $GLOBALS['cfg']['MaxDbList'] ); @@ -197,7 +197,7 @@ if ($databases_count > 0) { . ($is_superuser || $cfg['AllowUserDropDatabase'] ? ' <th></th>' . "\n" : '') . ' <th><a href="server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n" . ' ' . __('Database') . "\n" - . ($sort_by == 'SCHEMA_NAME' ? ' ' . $common_functions->getImage('s_' . $sort_order . '.png', ($sort_order == 'asc' ? __('Ascending') : __('Descending'))) . "\n" : '') + . ($sort_by == 'SCHEMA_NAME' ? ' ' . PMA_Util::getImage('s_' . $sort_order . '.png', ($sort_order == 'asc' ? __('Ascending') : __('Descending'))) . "\n" : '') . ' </a></th>' . "\n"; $table_columns = 3; foreach ($column_order as $stat_name => $stat) { @@ -214,7 +214,7 @@ if ($databases_count > 0) { echo ' <th' . $colspan . '>' . '<a href="server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n" . ' ' . $stat['disp_name'] . "\n" - . ($sort_by == $stat_name ? ' ' . $common_functions->getImage('s_' . $sort_order . '.png', ($sort_order == 'asc' ? __('Ascending') : __('Descending'))) . "\n" : '') + . ($sort_by == $stat_name ? ' ' . PMA_Util::getImage('s_' . $sort_order . '.png', ($sort_order == 'asc' ? __('Ascending') : __('Descending'))) . "\n" : '') . ' </a></th>' . "\n"; } } @@ -271,9 +271,9 @@ if ($databases_count > 0) { foreach ($column_order as $stat_name => $stat) { if (array_key_exists($stat_name, $first_database)) { if ($stat['format'] === 'byte') { - list($value, $unit) = $common_functions->formatByteDown($stat['footer'], 3, 1); + list($value, $unit) = PMA_Util::formatByteDown($stat['footer'], 3, 1); } elseif ($stat['format'] === 'number') { - $value = $common_functions->formatNumber($stat['footer'], 0); + $value = PMA_Util::formatNumber($stat['footer'], 0); } else { $value = htmlentities($stat['footer'], 0); } @@ -319,7 +319,7 @@ if ($databases_count > 0) { . '<input type="checkbox" id="checkall" title="' . __('Check All') . '" /> ' . '<label for="checkall">' . __('Check All') . '</label> ' . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n"; - echo $common_functions->getButtonOrImage( + echo PMA_Util::getButtonOrImage( 'drop_selected_dbs', 'mult_submit' . ($cfg['AjaxEnable'] ? ' ajax' : ''), 'drop_selected_dbs', diff --git a/server_engines.php b/server_engines.php index 0f4d9b8050..2c5f81cd58 100644 --- a/server_engines.php +++ b/server_engines.php @@ -28,7 +28,7 @@ if (empty($_REQUEST['engine']) * Displays the sub-page heading */ echo '<h2>' . "\n" - . $common_functions->getImage('b_engine.png') + . PMA_Util::getImage('b_engine.png') . "\n" . __('Storage Engines') . "\n" . '</h2>' . "\n"; @@ -77,9 +77,9 @@ if (empty($_REQUEST['engine']) $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']); echo '<h2>' . "\n" - . $common_functions->getImage('b_engine.png') + . PMA_Util::getImage('b_engine.png') . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" - . ' ' . $common_functions->showMySQLDocu('', $engine_plugin->getMysqlHelpPage()) . "\n" + . ' ' . PMA_Util::showMySQLDocu('', $engine_plugin->getMysqlHelpPage()) . "\n" . '</h2>' . "\n\n"; echo '<p>' . "\n" . ' <em>' . "\n" diff --git a/server_privileges.php b/server_privileges.php index 848cc51626..4ce95bd3d9 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -118,10 +118,10 @@ if (PMA_isValid($_REQUEST['pred_dbname'])) { } if (isset($dbname)) { - $unescaped_db = $common_functions->unescapeMysqlWildcards($dbname); - $db_and_table = $common_functions->backquote($unescaped_db) . '.'; + $unescaped_db = PMA_Util::unescapeMysqlWildcards($dbname); + $db_and_table = PMA_Util::backquote($unescaped_db) . '.'; if (isset($tablename)) { - $db_and_table .= $common_functions->backquote($tablename); + $db_and_table .= PMA_Util::backquote($tablename); } else { $db_and_table .= '*'; } @@ -145,7 +145,7 @@ if (isset($dbname)) { if (! $is_superuser) { $response->addHTML( '<h2>' . "\n" - . $common_functions->getIcon('b_usrlist.png') + . PMA_Util::getIcon('b_usrlist.png') . __('Privileges') . "\n" . '</h2>' . "\n" ); @@ -161,9 +161,9 @@ $random_n = mt_rand(0, 1000000); */ if (isset($_REQUEST['change_copy'])) { $user_host_condition = ' WHERE `User` = ' - . "'". $common_functions->sqlAddSlashes($_REQUEST['old_username']) . "'" + . "'". PMA_Util::sqlAddSlashes($_REQUEST['old_username']) . "'" . ' AND `Host` = ' - . "'" . $common_functions->sqlAddSlashes($_REQUEST['old_hostname']) . "';"; + . "'" . PMA_Util::sqlAddSlashes($_REQUEST['old_hostname']) . "';"; $row = PMA_DBI_fetch_single_row( 'SELECT * FROM `mysql`.`user` ' . $user_host_condition ); @@ -208,8 +208,8 @@ if (isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) { break; } $sql = "SELECT '1' FROM `mysql`.`user`" - . " WHERE `User` = '" . $common_functions->sqlAddSlashes($username) . "'" - . " AND `Host` = '" . $common_functions->sqlAddSlashes($hostname) . "';"; + . " WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" + . " AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "';"; if (PMA_DBI_fetch_value($sql) == 1) { $message = PMA_Message::error(__('The user %s already exists!')); $message->addParam('[em]\'' . $username . '\'@\'' . $hostname . '\'[/em]'); @@ -318,17 +318,17 @@ if (isset($_REQUEST['delete']) ) . ' ...'; $queries[] = 'DROP USER \'' - . $common_functions->sqlAddSlashes($this_user) - . '\'@\'' . $common_functions->sqlAddSlashes($this_host) . '\';'; + . PMA_Util::sqlAddSlashes($this_user) + . '\'@\'' . PMA_Util::sqlAddSlashes($this_host) . '\';'; if (isset($_REQUEST['drop_users_db'])) { $queries[] = 'DROP DATABASE IF EXISTS ' - . $common_functions->backquote($this_user) . ';'; + . PMA_Util::backquote($this_user) . ';'; $GLOBALS['reload'] = true; if ($GLOBALS['is_ajax_request'] != true) { $response->addHTML( - $common_functions->getReloadNavigationScript() + PMA_Util::getReloadNavigationScript() ); } } @@ -418,7 +418,7 @@ if (isset($_REQUEST['viewing_mode']) && $_REQUEST['viewing_mode'] == 'db') { $response->addHTML($content . "\n"); } else { if (! empty($GLOBALS['message'])) { - $response->addHTML($common_functions->getMessage($GLOBALS['message'])); + $response->addHTML(PMA_Util::getMessage($GLOBALS['message'])); unset($GLOBALS['message']); } } diff --git a/server_replication.php b/server_replication.php index 8bcde314e9..953a895c2e 100644 --- a/server_replication.php +++ b/server_replication.php @@ -29,7 +29,7 @@ require_once 'libraries/server_synchronize.lib.php'; */ if (! $is_superuser) { echo '<h2>' . "\n" - . $common_functions->getIcon('s_replication.png') + . PMA_Util::getIcon('s_replication.png') . __('Replication') . "\n" . '</h2>' . "\n"; PMA_Message::error(__('No Privileges'))->display(); @@ -72,10 +72,10 @@ foreach ($request_params as $one_request_param) { if (isset($GLOBALS['sr_take_action'])) { $refresh = false; if (isset($GLOBALS['slave_changemaster'])) { - $_SESSION['replication']['m_username'] = $sr['username'] = $common_functions->sqlAddSlashes($GLOBALS['username']); - $_SESSION['replication']['m_password'] = $sr['pma_pw'] = $common_functions->sqlAddSlashes($GLOBALS['pma_pw']); - $_SESSION['replication']['m_hostname'] = $sr['hostname'] = $common_functions->sqlAddSlashes($GLOBALS['hostname']); - $_SESSION['replication']['m_port'] = $sr['port'] = $common_functions->sqlAddSlashes($GLOBALS['port']); + $_SESSION['replication']['m_username'] = $sr['username'] = PMA_Util::sqlAddSlashes($GLOBALS['username']); + $_SESSION['replication']['m_password'] = $sr['pma_pw'] = PMA_Util::sqlAddSlashes($GLOBALS['pma_pw']); + $_SESSION['replication']['m_hostname'] = $sr['hostname'] = PMA_Util::sqlAddSlashes($GLOBALS['hostname']); + $_SESSION['replication']['m_port'] = $sr['port'] = PMA_Util::sqlAddSlashes($GLOBALS['port']); $_SESSION['replication']['m_correct'] = ''; $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = __('Unknown error'); @@ -173,14 +173,14 @@ if (isset($GLOBALS['sr_take_action'])) { $dblist[] = $tmp_row[0]; PMA_DBI_query( - 'CREATE DATABASE IF NOT EXISTS ' . $common_functions->backquote($tmp_row[0]), + 'CREATE DATABASE IF NOT EXISTS ' . PMA_Util::backquote($tmp_row[0]), $trg_link ); } else { if (array_search($tmp_row[0], $do_db) !== false) { $dblist[] = $tmp_row[0]; PMA_DBI_query( - 'CREATE DATABASE IF NOT EXISTS ' . $common_functions->backquote($tmp_row[0]), + 'CREATE DATABASE IF NOT EXISTS ' . PMA_Util::backquote($tmp_row[0]), $trg_link ); } @@ -211,7 +211,7 @@ if (isset($GLOBALS['sr_take_action'])) { echo '<div id="replication">'; echo ' <h2>'; -echo ' ' . $common_functions->getImage('s_replication.png'); +echo ' ' . PMA_Util::getImage('s_replication.png'); echo __('Replication'); echo ' </h2>'; diff --git a/server_status.php b/server_status.php index 748bba9a93..5159f4e85e 100644 --- a/server_status.php +++ b/server_status.php @@ -246,7 +246,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { if (strlen($row['sql_text']) > 220) { $implode_sql_text = implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( strlen($row['sql_text']), 2, 2 ) ); @@ -343,7 +343,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { . '... [' . implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( strlen($row['argument']) ), 2, @@ -372,7 +372,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { if (isset($_REQUEST['logging_vars'])) { if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) { - $value = $common_functions->sqlAddSlashes($_REQUEST['varValue']); + $value = PMA_Util::sqlAddSlashes($_REQUEST['varValue']); if (! is_numeric($value)) { $value="'" . $value . "'"; } @@ -399,7 +399,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { PMA_DBI_select_db($_REQUEST['database']); } - if ($profiling == $common_functions->profilingSupported()) { + if ($profiling == PMA_Util::profilingSupported()) { PMA_DBI_query('SET PROFILING=1;'); } @@ -807,13 +807,13 @@ PMA_addJSVar( ); PMA_addJSVar( 'profiling_docu', - $common_functions->showMySQLDocu( + PMA_Util::showMySQLDocu( 'general-thread-states', 'general-thread-states' ) ); PMA_addJSVar( 'explain_docu', - $common_functions->showMySQLDocu('explain-output', 'explain-output') + PMA_Util::showMySQLDocu('explain-output', 'explain-output') ); /** @@ -831,7 +831,7 @@ require 'libraries/server_common.inc.php'; /** * Displays the sub-page heading */ -echo $common_functions->getImage('s_status.png'); +echo PMA_Util::getImage('s_status.png'); echo __('Runtime Information'); @@ -940,7 +940,7 @@ foreach ($sections as $section_id => $section_name) { echo ', '; } if ('doc' == $link_name) { - echo $common_functions->showMySQLDocu($link_url, $link_url); + echo PMA_Util::showMySQLDocu($link_url, $link_url); } else { echo '<a href="' . $link_url . '">' . $link_name . '</a>'; } @@ -964,8 +964,8 @@ foreach ($sections as $section_id => $section_name) { <div id="statustabs_advisor" class="jsfeature"> <div class="tabLinks"> - <?php echo $common_functions->getImage('play.png'); ?> <a href="#startAnalyzer"><?php echo __('Run analyzer'); ?></a> - <?php echo $common_functions->getImage('b_help.png'); ?> <a href="#openAdvisorInstructions"><?php echo __('Instructions'); ?></a> + <?php echo PMA_Util::getImage('play.png'); ?> <a href="#startAnalyzer"><?php echo __('Run analyzer'); ?></a> + <?php echo PMA_Util::getImage('b_help.png'); ?> <a href="#openAdvisorInstructions"><?php echo __('Instructions'); ?></a> </div> <div class="tabInnerContent clearfloat"> </div> @@ -1000,23 +1000,23 @@ function printQueryStatistics() <h3 id="serverstatusqueries"> <?php /* l10n: Questions is the name of a MySQL Status variable */ - echo sprintf(__('Questions since startup: %s'), $common_functions->formatNumber($total_queries, 0)) . ' '; - echo $common_functions->showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions'); + echo sprintf(__('Questions since startup: %s'), PMA_Util::formatNumber($total_queries, 0)) . ' '; + echo PMA_Util::showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions'); ?> <br /> <span> <?php echo 'ø ' . __('per hour') . ': '; - echo $common_functions->formatNumber($total_queries * $hour_factor, 0); + echo PMA_Util::formatNumber($total_queries * $hour_factor, 0); echo '<br />'; echo 'ø ' . __('per minute') . ': '; - echo $common_functions->formatNumber($total_queries * 60 / $server_status['Uptime'], 0); + echo PMA_Util::formatNumber($total_queries * 60 / $server_status['Uptime'], 0); echo '<br />'; if ($total_queries / $server_status['Uptime'] >= 1) { echo 'ø ' . __('per second') . ': '; - echo $common_functions->formatNumber($total_queries / $server_status['Uptime'], 0); + echo PMA_Util::formatNumber($total_queries / $server_status['Uptime'], 0); } ?> </span> @@ -1069,11 +1069,11 @@ function printQueryStatistics() ?> <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>"> <th class="name"><?php echo htmlspecialchars($name); ?></th> - <td class="value"><?php echo htmlspecialchars($common_functions->formatNumber($value, 5, 0, true)); ?></td> + <td class="value"><?php echo htmlspecialchars(PMA_Util::formatNumber($value, 5, 0, true)); ?></td> <td class="value"><?php echo - htmlspecialchars($common_functions->formatNumber($value * $hour_factor, 4, 1, true)); ?></td> + htmlspecialchars(PMA_Util::formatNumber($value * $hour_factor, 4, 1, true)); ?></td> <td class="value"><?php echo - htmlspecialchars($common_functions->formatNumber($value * $perc_factor, 0, 2)); ?>%</td> + htmlspecialchars(PMA_Util::formatNumber($value * $perc_factor, 0, 2)); ?>%</td> </tr> <?php } @@ -1115,7 +1115,7 @@ function printServerTraffic() __('Network traffic since startup: %s'), implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1 @@ -1129,8 +1129,8 @@ function printServerTraffic() <?php echo sprintf( __('This MySQL server has been running for %1$s. It started up on %2$s.'), - $common_functions->timespanFormat($server_status['Uptime']), - $common_functions->localisedDate($start_time) + PMA_Util::timespanFormat($server_status['Uptime']), + PMA_Util::localisedDate($start_time) ) . "\n"; ?> </p> @@ -1170,7 +1170,7 @@ function printServerTraffic() <table id="serverstatustraffic" class="data noclick"> <thead> <tr> - <th colspan="2"><?php echo __('Traffic') . ' ' . $common_functions->showHint(__('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.')); ?></th> + <th colspan="2"><?php echo __('Traffic') . ' ' . PMA_Util::showHint(__('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.')); ?></th> <th>ø <?php echo __('per hour'); ?></th> </tr> </thead> @@ -1180,14 +1180,14 @@ function printServerTraffic() <td class="value"><?php echo implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( $server_status['Bytes_received'], 3, 1 ) ); ?></td> <td class="value"><?php echo implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( $server_status['Bytes_received'] * $hour_factor, 3, 1 ) ); ?></td> @@ -1197,14 +1197,14 @@ function printServerTraffic() <td class="value"><?php echo implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( $server_status['Bytes_sent'], 3, 1 ) ); ?></td> <td class="value"><?php echo implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( $server_status['Bytes_sent'] * $hour_factor, 3, 1 ) ); ?></td> @@ -1214,14 +1214,14 @@ function printServerTraffic() <td class="value"><?php echo implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1 ) ); ?></td> <td class="value"><?php echo implode( ' ', - $common_functions->formatByteDown( + PMA_Util::formatByteDown( ($server_status['Bytes_received'] + $server_status['Bytes_sent']) * $hour_factor, 3, 1 ) @@ -1242,21 +1242,21 @@ function printServerTraffic() <tr class="odd"> <th class="name"><?php echo __('max. concurrent connections'); ?></th> <td class="value"><?php echo - $common_functions->formatNumber($server_status['Max_used_connections'], 0); ?> </td> + PMA_Util::formatNumber($server_status['Max_used_connections'], 0); ?> </td> <td class="value">--- </td> <td class="value">--- </td> </tr> <tr class="even"> <th class="name"><?php echo __('Failed attempts'); ?></th> <td class="value"><?php echo - $common_functions->formatNumber($server_status['Aborted_connects'], 4, 1, true); ?></td> + PMA_Util::formatNumber($server_status['Aborted_connects'], 4, 1, true); ?></td> <td class="value"><?php echo - $common_functions->formatNumber( + PMA_Util::formatNumber( $server_status['Aborted_connects'] * $hour_factor, 4, 2, true ); ?></td> <td class="value"><?php echo $server_status['Connections'] > 0 - ? $common_functions->formatNumber( + ? PMA_Util::formatNumber( $server_status['Aborted_connects'] * 100 / $server_status['Connections'], 0, 2, true ) . '%' @@ -1265,14 +1265,14 @@ function printServerTraffic() <tr class="odd"> <th class="name"><?php echo __('Aborted'); ?></th> <td class="value"><?php echo - $common_functions->formatNumber($server_status['Aborted_clients'], 4, 1, true); ?></td> + PMA_Util::formatNumber($server_status['Aborted_clients'], 4, 1, true); ?></td> <td class="value"><?php echo - $common_functions->formatNumber( + PMA_Util::formatNumber( $server_status['Aborted_clients'] * $hour_factor, 4, 2, true ); ?></td> <td class="value"><?php echo $server_status['Connections'] > 0 - ? $common_functions->formatNumber( + ? PMA_Util::formatNumber( $server_status['Aborted_clients'] * 100 / $server_status['Connections'], 0, 2, true ) . '%' @@ -1281,13 +1281,13 @@ function printServerTraffic() <tr class="even"> <th class="name"><?php echo __('Total'); ?></th> <td class="value"><?php echo - $common_functions->formatNumber($server_status['Connections'], 4, 0); ?></td> + PMA_Util::formatNumber($server_status['Connections'], 4, 0); ?></td> <td class="value"><?php echo - $common_functions->formatNumber( + PMA_Util::formatNumber( $server_status['Connections'] * $hour_factor, 4, 2 ); ?></td> <td class="value"><?php echo - $common_functions->formatNumber(100, 0, 2); ?>%</td> + PMA_Util::formatNumber(100, 0, 2); ?>%</td> </tr> </tbody> </table> @@ -1690,7 +1690,7 @@ function printVariablesTable() echo htmlspecialchars(str_replace('_', ' ', $name)); /* Fields containing % are calculated, they can not be described in MySQL documentation */ if (strpos($name, '%') === false) { - echo $common_functions->showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); + echo PMA_Util::showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); } ?> </th> @@ -1703,17 +1703,17 @@ function printVariablesTable() } } if ('%' === substr($name, -1, 1)) { - echo htmlspecialchars($common_functions->formatNumber($value, 0, 2)) . ' %'; + echo htmlspecialchars(PMA_Util::formatNumber($value, 0, 2)) . ' %'; } elseif (strpos($name, 'Uptime') !== false) { echo htmlspecialchars( - $common_functions->timespanFormat($value) + PMA_Util::timespanFormat($value) ); } elseif (is_numeric($value) && $value == (int) $value && $value > 1000) { - echo htmlspecialchars($common_functions->formatNumber($value, 3, 1)); + echo htmlspecialchars(PMA_Util::formatNumber($value, 3, 1)); } elseif (is_numeric($value) && $value == (int) $value) { - echo htmlspecialchars($common_functions->formatNumber($value, 3, 0)); + echo htmlspecialchars(PMA_Util::formatNumber($value, 3, 0)); } elseif (is_numeric($value)) { - echo htmlspecialchars($common_functions->formatNumber($value, 3, 1)); + echo htmlspecialchars(PMA_Util::formatNumber($value, 3, 1)); } else { echo htmlspecialchars($value); } @@ -1731,7 +1731,7 @@ function printVariablesTable() if (isset($links[$name])) { foreach ($links[$name] as $link_name => $link_url) { if ('doc' == $link_name) { - echo $common_functions->showMySQLDocu($link_url, $link_url); + echo PMA_Util::showMySQLDocu($link_url, $link_url); } else { echo ' <a href="' . $link_url . '">' . $link_name . '</a>' . "\n"; @@ -1757,35 +1757,35 @@ function printMonitor() ?> <div class="tabLinks" style="display:none;"> <a href="#pauseCharts"> - <?php echo $common_functions->getImage('play.png'); ?> + <?php echo PMA_Util::getImage('play.png'); ?> <?php echo __('Start Monitor'); ?> </a> <a href="#settingsPopup" class="popupLink" style="display:none;"> - <?php echo $common_functions->getImage('s_cog.png'); ?> + <?php echo PMA_Util::getImage('s_cog.png'); ?> <?php echo __('Settings'); ?> </a> <?php if (! PMA_DRIZZLE) { ?> <a href="#monitorInstructionsDialog"> - <?php echo $common_functions->getImage('b_help.png'); ?> + <?php echo PMA_Util::getImage('b_help.png'); ?> <?php echo __('Instructions/Setup'); ?> </a> <?php } ?> <a href="#endChartEditMode" style="display:none;"> - <?php echo $common_functions->getImage('s_okay.png'); ?> + <?php echo PMA_Util::getImage('s_okay.png'); ?> <?php echo __('Done rearranging/editing charts'); ?> </a> </div> <div class="popupContent settingsPopup"> <a href="#addNewChart"> - <?php echo $common_functions->getImage('b_chart.png'); ?> + <?php echo PMA_Util::getImage('b_chart.png'); ?> <?php echo __('Add chart'); ?> </a> - <a href="#rearrangeCharts"><?php echo $common_functions->getImage('b_tblops.png'); ?><?php echo __('Rearrange/edit charts'); ?></a> + <a href="#rearrangeCharts"><?php echo PMA_Util::getImage('b_tblops.png'); ?><?php echo __('Rearrange/edit charts'); ?></a> <div class="clearfloat paddingtop"></div> <div class="floatleft"> <?php @@ -1810,7 +1810,7 @@ function printMonitor() </div> <div class="clearfloat paddingtop"> - <b><?php echo __('Chart arrangement'); ?></b> <?php echo $common_functions->showHint(__('The arrangement of the charts is stored to the browsers local storage. You may want to export it if you have a complicated set up.')); ?><br/> + <b><?php echo __('Chart arrangement'); ?></b> <?php echo PMA_Util::showHint(__('The arrangement of the charts is stored to the browsers local storage. You may want to export it if you have a complicated set up.')); ?><br/> <a href="#importMonitorConfig"><?php echo __('Import'); ?></a> <a href="#exportMonitorConfig"><?php echo __('Export'); ?></a> <a href="#clearMonitorConfig"><?php echo __('Reset to default'); ?></a> </div> </div> @@ -1819,7 +1819,7 @@ function printMonitor() <?php echo __('The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to \'TABLE\' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%'); ?> <?php if (PMA_MYSQL_INT_VERSION < 50106) { ?> <p> - <?php echo $common_functions->getImage('s_attention.png'); ?> + <?php echo PMA_Util::getImage('s_attention.png'); ?> <?php echo __('Unfortunately your Database server does not support logging to table, which is a requirement for analyzing the database logs with phpMyAdmin. Logging to table is supported by MySQL 5.1.6 and onwards. You may still use the server charting features however.'); ?> @@ -1842,7 +1842,7 @@ function printMonitor() echo '</p>'; ?> <p> - <?php echo $common_functions->getImage('s_attention.png'); ?> + <?php echo PMA_Util::getImage('s_attention.png'); ?> <?php echo '<strong>'; echo __('Please note:'); diff --git a/server_variables.php b/server_variables.php index 88c85da2da..198e27699f 100644 --- a/server_variables.php +++ b/server_variables.php @@ -40,7 +40,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { header('Content-Type: text/html; charset=UTF-8'); $varValue = PMA_DBI_fetch_single_row( 'SHOW GLOBAL VARIABLES WHERE Variable_name="' - . $common_functions->sqlAddSlashes($_REQUEST['varName']) . '";', + . PMA_Util::sqlAddSlashes($_REQUEST['varName']) . '";', 'NUM' ); if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3]) @@ -48,7 +48,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { ) { exit( implode( - ' ', $common_functions->formatByteDown($varValue[1], 3, 3) + ' ', PMA_Util::formatByteDown($varValue[1], 3, 3) ) ); } @@ -74,12 +74,12 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { 'gb' => 3, 'gib' => 3 ); - $value = floatval($matches[1]) * $common_functions->pow( + $value = floatval($matches[1]) * PMA_Util::pow( 1024, $exp[strtolower($matches[3])] ); } else { - $value = $common_functions->sqlAddSlashes($value); + $value = PMA_Util::sqlAddSlashes($value); } if (! is_numeric($value)) { @@ -95,7 +95,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { // Some values are rounded down etc. $varValue = PMA_DBI_fetch_single_row( 'SHOW GLOBAL VARIABLES WHERE Variable_name="' - . $common_functions->sqlAddSlashes($_REQUEST['varName']) + . PMA_Util::sqlAddSlashes($_REQUEST['varName']) . '";', 'NUM' ); $response->addJSON( @@ -118,9 +118,9 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { /** * Displays the sub-page heading */ -$output = '<h2>' . $common_functions->getImage('s_vars.png') +$output = '<h2>' . PMA_Util::getImage('s_vars.png') . '' . __('Server variables and settings') . "\n" - . $common_functions->showMySQLDocu( + . PMA_Util::showMySQLDocu( 'server_system_variables', 'server_system_variables' ) . '</h2>' . "\n"; @@ -170,7 +170,7 @@ foreach ($serverVars as $name => $value) { // To display variable documentation link if (isset($VARIABLE_DOC_LINKS[$name])) { - $output .= $common_functions->showMySQLDocu( + $output .= PMA_Util::showMySQLDocu( $VARIABLE_DOC_LINKS[$name][1], $VARIABLE_DOC_LINKS[$name][1], false, @@ -214,11 +214,11 @@ function formatVariable($name, $value) && $VARIABLE_DOC_LINKS[$name][3]=='byte' ) { return '<abbr title="' - . $common_functions->formatNumber($value, 0) . '">' - . implode(' ', $common_functions->formatByteDown($value, 3, 3)) + . PMA_Util::formatNumber($value, 0) . '">' + . implode(' ', PMA_Util::formatByteDown($value, 3, 3)) . '</abbr>'; } else { - return $common_functions->formatNumber($value, 0); + return PMA_Util::formatNumber($value, 0); } } return htmlspecialchars($value); @@ -182,7 +182,7 @@ if (isset($_REQUEST['get_enum_values']) && $_REQUEST['get_enum_values'] == true) $field_info_query, null, null, null, PMA_DBI_QUERY_STORE ); - $values = $common_functions->parseEnumSetValues($field_info_result[0]['Type']); + $values = PMA_Util::parseEnumSetValues($field_info_result[0]['Type']); $dropdown = '<option value=""> </option>'; foreach ($values as $value) { @@ -212,7 +212,7 @@ if (isset($_REQUEST['get_set_values']) && $_REQUEST['get_set_values'] == true) { $selected_values = explode(',', $_REQUEST['curr_value']); - $values = $common_functions->parseEnumSetValues($field_info_result[0]['Type']); + $values = PMA_Util::parseEnumSetValues($field_info_result[0]['Type']); $select = ''; foreach ($values as $value) { @@ -281,7 +281,7 @@ if (empty($sql_query) && strlen($table) && strlen($db)) { include_once 'libraries/bookmark.lib.php'; $book_sql_query = PMA_Bookmark_get( $db, - '\'' . $common_functions->sqlAddSlashes($table) . '\'', + '\'' . PMA_Util::sqlAddSlashes($table) . '\'', 'label', false, true @@ -293,11 +293,11 @@ if (empty($sql_query) && strlen($table) && strlen($db)) { ); $GLOBALS['using_bookmark_message']->addParam($table); $GLOBALS['using_bookmark_message']->addMessage( - $common_functions->showDocu('faq6_22') + PMA_Util::showDocu('faq6_22') ); $sql_query = $book_sql_query; } else { - $sql_query = 'SELECT * FROM ' . $common_functions->backquote($table); + $sql_query = 'SELECT * FROM ' . PMA_Util::backquote($table); } unset($book_sql_query); @@ -305,7 +305,7 @@ if (empty($sql_query) && strlen($table) && strlen($db)) { $goto = 'tbl_structure.php'; } else { // Now we can check the parameters - $common_functions->checkParameters(array('sql_query')); + PMA_Util::checkParameters(array('sql_query')); } // instead of doing the test twice @@ -326,7 +326,7 @@ if (! defined('PMA_CHK_DROP') && $is_drop_database && ! $is_superuser ) { - $common_functions->mysqlDie(__('"DROP DATABASE" statements are disabled.'), '', '', $err_url); + PMA_Util::mysqlDie(__('"DROP DATABASE" statements are disabled.'), '', '', $err_url); } // end if // Include PMA_Index class for use in PMA_DisplayResults class @@ -552,7 +552,7 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) { $num_rows = 0; $unlim_num_rows = 0; } else { - if (isset($_SESSION['profiling']) && $common_functions->profilingSupported()) { + if (isset($_SESSION['profiling']) && PMA_Util::profilingSupported()) { PMA_DBI_query('SET PROFILING=1;'); } @@ -604,7 +604,7 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) { $full_err_url = preg_match('@^(db|tbl)_@', $err_url) ? $err_url . '&show_query=1&sql_query=' . urlencode($sql_query) : $err_url; - $common_functions->mysqlDie($error, $full_sql_query, '', $full_err_url); + PMA_Util::mysqlDie($error, $full_sql_query, '', $full_err_url); } exit; } @@ -647,7 +647,7 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) { } // Grabs the profiling results - if (isset($_SESSION['profiling']) && $common_functions->profilingSupported()) { + if (isset($_SESSION['profiling']) && PMA_Util::profilingSupported()) { $profiling_results = PMA_DBI_fetch_result('SHOW PROFILE;'); } @@ -878,7 +878,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { if ($GLOBALS['is_ajax_request'] == true) { if ($cfg['ShowSQL']) { - $extra_data['sql_query'] = $common_functions->getMessage( + $extra_data['sql_query'] = PMA_Util::getMessage( $message, $GLOBALS['sql_query'], 'success' ); } @@ -966,7 +966,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { if (isset($message)) { $message = PMA_Message::success($message); - echo $common_functions->getMessage( + echo PMA_Util::getMessage( $message, $GLOBALS['sql_query'], 'success' ); } @@ -1008,7 +1008,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { unset($show_query); } if (isset($printview) && $printview == '1') { - $common_functions->checkParameters(array('db', 'full_sql_query')); + PMA_Util::checkParameters(array('db', 'full_sql_query')); $response = PMA_Response::getInstance(); $header = $response->getHeader(); @@ -1032,7 +1032,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { echo "<p>"; echo "<strong>" . __('Host') . ":</strong> $hostname<br />"; echo "<strong>" . __('Database') . ":</strong> " . htmlspecialchars($db) . "<br />"; - echo "<strong>" . __('Generation Time') . ":</strong> " . $common_functions->localisedDate() . "<br />"; + echo "<strong>" . __('Generation Time') . ":</strong> " . PMA_Util::localisedDate() . "<br />"; echo "<strong>" . __('Generated by') . ":</strong> $versions<br />"; echo "<strong>" . __('SQL query') . ":</strong> " . htmlspecialchars($full_sql_query) . ";"; if (isset($num_rows)) { @@ -1089,7 +1089,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { // Display previous update query (from tbl_replace) if (isset($disp_query) && ($cfg['ShowSQL'] == true) && empty($sql_data)) { - echo $common_functions->getMessage($disp_message, $disp_query, 'success'); + echo PMA_Util::getMessage($disp_message, $disp_query, 'success'); } if (isset($profiling_results)) { @@ -1105,7 +1105,7 @@ $(makeProfilingChart); echo '<div style="float: left;">'; echo '<table>' . "\n"; echo ' <tr>' . "\n"; - echo ' <th>' . __('Status') . $common_functions->showMySQLDocu('general-thread-states', 'general-thread-states') . '</th>' . "\n"; + echo ' <th>' . __('Status') . PMA_Util::showMySQLDocu('general-thread-states', 'general-thread-states') . '</th>' . "\n"; echo ' <th>' . __('Time') . '</th>' . "\n"; echo ' </tr>' . "\n"; @@ -1113,7 +1113,7 @@ $(makeProfilingChart); foreach ($profiling_results as $one_result) { echo ' <tr>' . "\n"; echo '<td>' . ucwords($one_result['Status']) . '</td>' . "\n"; - echo '<td class="right">' . ($common_functions->formatNumber($one_result['Duration'], 3, 1)) . 's</td>' . "\n"; + echo '<td class="right">' . (PMA_Util::formatNumber($one_result['Duration'], 3, 1)) . 's</td>' . "\n"; if (isset($chart_json[ucwords($one_result['Status'])])) { $chart_json[ucwords($one_result['Status'])] += $one_result['Duration']; } else { @@ -1214,7 +1214,7 @@ $(makeProfilingChart); <input type="hidden" name="fields[query]" value="<?php echo urlencode(isset($complete_query) ? $complete_query : $sql_query); ?>" /> <fieldset> <legend><?php - echo $common_functions->getIcon('b_bookmark.png', __('Bookmark this SQL query'), true); + echo PMA_Util::getIcon('b_bookmark.png', __('Bookmark this SQL query'), true); ?> </legend> @@ -1239,7 +1239,7 @@ $(makeProfilingChart); // Do print the page if required if (isset($printview) && $printview == '1') { - echo $common_functions->getButton(); + echo PMA_Util::getButton(); } // end print case if ($GLOBALS['is_ajax_request'] != true) { diff --git a/tbl_addfield.php b/tbl_addfield.php index ffeadee1ef..19d30e942a 100644 --- a/tbl_addfield.php +++ b/tbl_addfield.php @@ -11,7 +11,7 @@ require_once 'libraries/common.inc.php'; // Check parameters -$common_functions->checkParameters(array('db', 'table')); +PMA_Util::checkParameters(array('db', 'table')); /** @@ -105,10 +105,10 @@ if (isset($_REQUEST['do_save_data'])) { if ($_REQUEST['field_where'] == 'first') { $definition .= ' FIRST'; } else { - $definition .= ' AFTER ' . $common_functions->backquote($_REQUEST['after_field']); + $definition .= ' AFTER ' . PMA_Util::backquote($_REQUEST['after_field']); } } else { - $definition .= ' AFTER ' . $common_functions->backquote($_REQUEST['field_name'][$i-1]); + $definition .= ' AFTER ' . PMA_Util::backquote($_REQUEST['field_name'][$i-1]); } } $definitions[] = $definition; @@ -118,7 +118,7 @@ if (isset($_REQUEST['do_save_data'])) { if (count($field_primary)) { $fields = array(); foreach ($field_primary as $field_nr) { - $fields[] = $common_functions->backquote($_REQUEST['field_name'][$field_nr]); + $fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]); } $definitions[] = ' ADD PRIMARY KEY (' . implode(', ', $fields) . ') '; unset($fields); @@ -128,7 +128,7 @@ if (isset($_REQUEST['do_save_data'])) { if (count($field_index)) { $fields = array(); foreach ($field_index as $field_nr) { - $fields[] = $common_functions->backquote($_REQUEST['field_name'][$field_nr]); + $fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]); } $definitions[] = ' ADD INDEX (' . implode(', ', $fields) . ') '; unset($fields); @@ -138,7 +138,7 @@ if (isset($_REQUEST['do_save_data'])) { if (count($field_unique)) { $fields = array(); foreach ($field_unique as $field_nr) { - $fields[] = $common_functions->backquote($_REQUEST['field_name'][$field_nr]); + $fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]); } $definitions[] = ' ADD UNIQUE (' . implode(', ', $fields) . ') '; unset($fields); @@ -148,7 +148,7 @@ if (isset($_REQUEST['do_save_data'])) { if (count($field_fulltext)) { $fields = array(); foreach ($field_fulltext as $field_nr) { - $fields[] = $common_functions->backquote($_REQUEST['field_name'][$field_nr]); + $fields[] = PMA_Util::backquote($_REQUEST['field_name'][$field_nr]); } $definitions[] = ' ADD FULLTEXT (' . implode(', ', $fields) . ') '; unset($fields); @@ -156,8 +156,8 @@ if (isset($_REQUEST['do_save_data'])) { // To allow replication, we first select the db to use and then run queries // on this db. - PMA_DBI_select_db($db) or $common_functions->mysqlDie(PMA_getError(), 'USE ' . $common_functions->backquote($db), '', $err_url); - $sql_query = 'ALTER TABLE ' . $common_functions->backquote($table) . ' ' . implode(', ', $definitions) . ';'; + PMA_DBI_select_db($db) or PMA_Util::mysqlDie(PMA_getError(), 'USE ' . PMA_Util::backquote($db), '', $err_url); + $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ' . implode(', ', $definitions) . ';'; $result = PMA_DBI_try_query($sql_query); if ($result === true) { @@ -193,7 +193,7 @@ if (isset($_REQUEST['do_save_data'])) { $response->addJSON('message', $message); $response->addJSON( 'sql_query', - $common_functions->getMessage(null, $sql_query) + PMA_Util::getMessage(null, $sql_query) ); exit; } @@ -201,7 +201,7 @@ if (isset($_REQUEST['do_save_data'])) { $active_page = 'tbl_structure.php'; include 'tbl_structure.php'; } else { - $common_functions->mysqlDie('', '', '', $err_url, false); + PMA_Util::mysqlDie('', '', '', $err_url, false); // An error happened while inserting/updating a table definition. // to prevent total loss of that data, we embed the form once again. // The variable $regenerate will be used to restore data in libraries/tbl_properties.inc.php diff --git a/tbl_alter.php b/tbl_alter.php index fff7fcc57d..f7febd59ef 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -19,7 +19,7 @@ if (isset($_REQUEST['field'])) { } // Check parameters -$common_functions->checkParameters(array('db', 'table')); +PMA_Util::checkParameters(array('db', 'table')); /** * Gets tables informations @@ -59,7 +59,7 @@ if (isset($_REQUEST['move_columns']) // it is not, let's move it to index $i $data = $columns[$column]; - $extracted_columnspec = $common_functions->extractColumnSpec($data['Type']); + $extracted_columnspec = PMA_Util::extractColumnSpec($data['Type']); if (isset($data['Extra']) && $data['Extra'] == 'on update CURRENT_TIMESTAMP') { $extracted_columnspec['attribute'] = $data['Extra']; unset($data['Extra']); @@ -108,7 +108,7 @@ if (isset($_REQUEST['move_columns']) $response->isSuccess(false); exit; } - $move_query = 'ALTER TABLE ' . $common_functions->backquote($table) . ' '; + $move_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' '; $move_query .= implode(', ', $changes); // move columns $result = PMA_DBI_try_query($move_query); @@ -187,14 +187,14 @@ if (isset($_REQUEST['do_save_data'])) { // To allow replication, we first select the db to use and then run queries // on this db. if (! PMA_DBI_select_db($db)) { - $common_functions->mysqlDie( + PMA_Util::mysqlDie( PMA_DBI_getError(), - 'USE ' . $common_functions->backquote($db) . ';', + 'USE ' . PMA_Util::backquote($db) . ';', '', $err_url ); } - $sql_query = 'ALTER TABLE ' . $common_functions->backquote($table) . ' '; + $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' '; $sql_query .= implode(', ', $changes) . $key_query; $sql_query .= ';'; $result = PMA_DBI_try_query($sql_query); @@ -248,7 +248,7 @@ if (isset($_REQUEST['do_save_data'])) { $response->addJSON('message', $message); $response->addJSON( 'sql_query', - $common_functions->getMessage(null, $sql_query) + PMA_Util::getMessage(null, $sql_query) ); exit; } @@ -256,7 +256,7 @@ if (isset($_REQUEST['do_save_data'])) { $active_page = 'tbl_structure.php'; include 'tbl_structure.php'; } else { - $common_functions->mysqlDie('', '', '', $err_url, false); + PMA_Util::mysqlDie('', '', '', $err_url, false); // An error happened while inserting/updating a table definition. // to prevent total loss of that data, we embed the form once again. // The variable $regenerate will be used to restore data in libraries/tbl_properties.inc.php @@ -275,7 +275,7 @@ if (isset($_REQUEST['do_save_data'])) { */ if ($abort == false) { if (! isset($selected)) { - $common_functions->checkParameters(array('field')); + PMA_Util::checkParameters(array('field')); $selected[] = $_REQUEST['field']; $selected_cnt = 1; } else { // from a multiple submit @@ -306,7 +306,7 @@ if ($abort == false) { // in MySQL 4.0.25). $show_create_table = PMA_DBI_fetch_value( - 'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.' . $common_functions->backquote($table), + 'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table), 0, 1 ); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); diff --git a/tbl_change.php b/tbl_change.php index 1498347216..7cce7392d2 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -126,7 +126,7 @@ if (! empty($disp_message)) { if (! isset($disp_query)) { $disp_query = null; } - $response->addHTML($common_functions->getMessage($disp_message, $disp_query)); + $response->addHTML(PMA_Util::getMessage($disp_message, $disp_query)); } /** @@ -134,7 +134,7 @@ if (! empty($disp_message)) { * @todo should be handled by class Table */ $show_create_table = PMA_DBI_fetch_value( - 'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.' . $common_functions->backquote($table), + 'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table), 0, 1 ); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); @@ -212,7 +212,7 @@ if ($is_upload) { $html_output .= '>'; $html_output .= PMA_generate_common_hidden_inputs($_form_params); -$titles['Browse'] = $common_functions->getIcon('b_browse.png', __('Browse foreign values')); +$titles['Browse'] = PMA_Util::getIcon('b_browse.png', __('Browse foreign values')); // user can toggle the display of Function column and column types // (currently does not work for multi-edits) @@ -262,7 +262,7 @@ foreach ($rows as $row_id => $current_row) { } $extracted_columnspec - = $common_functions->extractColumnSpec($column['Type']); + = PMA_Util::extractColumnSpec($column['Type']); if (-1 === $column['len']) { $column['len'] = PMA_DBI_field_len($current_result, $i); @@ -301,7 +301,7 @@ foreach ($rows as $row_id => $current_row) { } //End if // Get a list of GIS data types. - $gis_data_types = $common_functions->getGISDatatypes(); + $gis_data_types = PMA_Util::getGISDatatypes(); // Prepares the field value $real_null_value = false; @@ -327,7 +327,7 @@ foreach ($rows as $row_id => $current_row) { $tabindex = $idindex; // Get a list of data types that are not yet supported. - $no_support_types = $common_functions->unsupportedDatatypes(); + $no_support_types = PMA_Util::unsupportedDatatypes(); // The function column // ------------------- @@ -395,7 +395,7 @@ $html_output .= PMA_getActionsPanel( if ($biggest_max_file_size > 0) { $html_output .= ' ' - . $common_functions->generateHiddenMaxFileSize( + . PMA_Util::generateHiddenMaxFileSize( $biggest_max_file_size ) . "\n"; } diff --git a/tbl_create.php b/tbl_create.php index a8002cacb0..fe7eee1dc8 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -11,14 +11,14 @@ require_once 'libraries/common.inc.php'; $action = 'tbl_create.php'; -$titles = $common_functions->buildActionTitles(); +$titles = PMA_Util::buildActionTitles(); // Check parameters -$common_functions->checkParameters(array('db')); +PMA_Util::checkParameters(array('db')); /* Check if database name is empty */ if (strlen($db) == 0) { - $common_functions->mysqlDie( + PMA_Util::mysqlDie( __('The database name is empty!'), '', '', 'main.php' ); } @@ -28,7 +28,7 @@ if (strlen($db) == 0) { */ if (PMA_DBI_get_columns($db, $table)) { // table exists already - $common_functions->mysqlDie( + PMA_Util::mysqlDie( sprintf(__('Table %s already exists!'), htmlspecialchars($table)), '', '', @@ -52,7 +52,7 @@ if (isset($_REQUEST['submit_num_fields'])) { * Selects the database to work with */ if (!PMA_DBI_select_db($db)) { - $common_functions->mysqlDie( + PMA_Util::mysqlDie( sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)), '', '', @@ -129,7 +129,7 @@ if (isset($_REQUEST['do_save_data'])) { if (isset($_REQUEST['field_name'][$j]) && strlen($_REQUEST['field_name'][$j]) ) { - $primary .= $common_functions->backquote($_REQUEST['field_name'][$j]) . ', '; + $primary .= PMA_Util::backquote($_REQUEST['field_name'][$j]) . ', '; } } // end for unset($primary_cnt); @@ -147,7 +147,7 @@ if (isset($_REQUEST['do_save_data'])) { if (isset($_REQUEST['field_name'][$j]) && strlen($_REQUEST['field_name'][$j]) ) { - $index .= $common_functions->backquote($_REQUEST['field_name'][$j]) . ', '; + $index .= PMA_Util::backquote($_REQUEST['field_name'][$j]) . ', '; } } // end for unset($index_cnt); @@ -165,7 +165,7 @@ if (isset($_REQUEST['do_save_data'])) { if (isset($_REQUEST['field_name'][$j]) && strlen($_REQUEST['field_name'][$j]) ) { - $unique .= $common_functions->backquote($_REQUEST['field_name'][$j]) . ', '; + $unique .= PMA_Util::backquote($_REQUEST['field_name'][$j]) . ', '; } } // end for unset($unique_cnt); @@ -183,7 +183,7 @@ if (isset($_REQUEST['do_save_data'])) { if (isset($_REQUEST['field_name'][$j]) && strlen($_REQUEST['field_name'][$j]) ) { - $fulltext .= $common_functions->backquote($_REQUEST['field_name'][$j]) . ', '; + $fulltext .= PMA_Util::backquote($_REQUEST['field_name'][$j]) . ', '; } } // end for @@ -194,8 +194,8 @@ if (isset($_REQUEST['do_save_data'])) { unset($fulltext); // Builds the 'create table' statement - $sql_query = 'CREATE TABLE ' . $common_functions->backquote($db) . '.' - . $common_functions->backquote($table) . ' (' . $sql_query . ')'; + $sql_query = 'CREATE TABLE ' . PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($table) . ' (' . $sql_query . ')'; // Adds table type, character set, comments and partition definition if (!empty($_REQUEST['tbl_storage_engine']) @@ -208,10 +208,10 @@ if (isset($_REQUEST['do_save_data'])) { } if (!empty($_REQUEST['comment'])) { $sql_query .= ' COMMENT = \'' - . $common_functions->sqlAddSlashes($_REQUEST['comment']) . '\''; + . PMA_Util::sqlAddSlashes($_REQUEST['comment']) . '\''; } if (!empty($_REQUEST['partition_definition'])) { - $sql_query .= ' ' . $common_functions->sqlAddSlashes( + $sql_query .= ' ' . PMA_Util::sqlAddSlashes( $_REQUEST['partition_definition'] ); } @@ -245,7 +245,7 @@ if (isset($_REQUEST['do_save_data'])) { $message = PMA_Message::success(__('Table %1$s has been created.')); $message->addParam( - $common_functions->backquote($db) . '.' . $common_functions->backquote($table) + PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) ); if ($GLOBALS['is_ajax_request'] == true) { @@ -263,8 +263,8 @@ if (isset($_REQUEST['do_save_data'])) { $is_show_stats = $cfg['ShowStats']; $tbl_stats_result = PMA_DBI_query( - 'SHOW TABLE STATUS FROM ' . $common_functions->backquote($db) - . ' LIKE \'' . $common_functions->sqlAddSlashes($table, true) . '\';' + 'SHOW TABLE STATUS FROM ' . PMA_Util::backquote($db) + . ' LIKE \'' . PMA_Util::sqlAddSlashes($table, true) . '\';' ); $tbl_stats = PMA_DBI_fetch_assoc($tbl_stats_result); PMA_DBI_free_result($tbl_stats_result); @@ -278,13 +278,13 @@ if (isset($_REQUEST['do_save_data'])) { $tblsize = doubleval($tbl_stats['Data_length']) + doubleval($tbl_stats['Index_length']); $sum_size += $tblsize; - list($formatted_size, $unit) = $common_functions->formatByteDown( + list($formatted_size, $unit) = PMA_Util::formatByteDown( $tblsize, 3, ($tblsize > 0) ? 1 : 0 ); if (isset($tbl_stats['Data_free']) && $tbl_stats['Data_free'] > 0) { - list($formatted_overhead, $overhead_unit) = $common_functions->formatByteDown( + list($formatted_overhead, $overhead_unit) = PMA_Util::formatByteDown( $tbl_stats['Data_free'], 3, ($tbl_stats['Data_free'] > 0) ? 1 : 0 @@ -317,13 +317,13 @@ if (isset($_REQUEST['do_save_data'])) { if (PMA_Tracker::isTracked($db, $truename)) { $new_table_string .= '<a href="tbl_tracking.php' . PMA_generate_common_url($tbl_url_params) . '">'; - $new_table_string .= $common_functions->getImage( + $new_table_string .= PMA_Util::getImage( 'eye.png', __('Tracking is active.') ); } elseif (PMA_Tracker::getVersion($db, $truename) > 0) { $new_table_string .= '<a href="tbl_tracking.php' . PMA_generate_common_url($tbl_url_params) . '">'; - $new_table_string .= $common_functions->getImage( + $new_table_string .= PMA_Util::getImage( 'eye_grey.png', __('Tracking is not active.') ); } @@ -354,7 +354,7 @@ if (isset($_REQUEST['do_save_data'])) { $new_table_string .= '<td>' . '<a class="drop_table_anchor" href="sql.php' . PMA_generate_common_url($tbl_url_params) . '&sql_query=' - . urlencode('DROP TABLE ' . $common_functions->backquote($table)) . '">' + . urlencode('DROP TABLE ' . PMA_Util::backquote($table)) . '">' . $titles['Drop'] . '</a>' . '</td>' . "\n"; @@ -416,7 +416,7 @@ if (isset($_REQUEST['do_save_data'])) { $response->isSuccess(false); $response->addJSON('message', PMA_DBI_getError()); } else { - $common_functions->mysqlDie('', '', '', $err_url, false); + PMA_Util::mysqlDie('', '', '', $err_url, false); // An error happened while inserting/updating a table definition. // To prevent total loss of that data, we embed the form once again. // The variable $regenerate will be used to restore data in diff --git a/tbl_get_field.php b/tbl_get_field.php index b358b399e6..a537a82d41 100644 --- a/tbl_get_field.php +++ b/tbl_get_field.php @@ -13,13 +13,13 @@ require_once 'libraries/common.inc.php'; require_once 'libraries/mime.lib.php'; /* Check parameters */ -$common_functions->checkParameters( +PMA_Util::checkParameters( array('db', 'table', 'where_clause', 'transform_key') ); /* Select database */ if (!PMA_DBI_select_db($db)) { - $common_functions->mysqlDie( + PMA_Util::mysqlDie( sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)), '', '' ); @@ -27,18 +27,18 @@ if (!PMA_DBI_select_db($db)) { /* Check if table exists */ if (!PMA_DBI_get_columns($db, $table)) { - $common_functions->mysqlDie(__('Invalid table name')); + PMA_Util::mysqlDie(__('Invalid table name')); } /* Grab data */ -$sql = 'SELECT ' . $common_functions->backquote($transform_key) - . ' FROM ' . $common_functions->backquote($table) +$sql = 'SELECT ' . PMA_Util::backquote($transform_key) + . ' FROM ' . PMA_Util::backquote($table) . ' WHERE ' . $where_clause . ';'; $result = PMA_DBI_fetch_value($sql); /* Check return code */ if ($result === false) { - $common_functions->mysqlDie(__('MySQL returned an empty result set (i.e. zero rows).'), $sql); + PMA_Util::mysqlDie(__('MySQL returned an empty result set (i.e. zero rows).'), $sql); } /* Avoid corrupting data */ diff --git a/tbl_indexes.php b/tbl_indexes.php index fd0258b9e9..14477a6f5f 100644 --- a/tbl_indexes.php +++ b/tbl_indexes.php @@ -48,8 +48,8 @@ if (isset($_REQUEST['do_save_data'])) { $error = false; // $sql_query is the one displayed in the query box - $sql_query = 'ALTER TABLE ' . $common_functions->backquote($db) - . '.' . $common_functions->backquote($table); + $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($table); // Drops the old index if (! empty($_REQUEST['old_index'])) { @@ -57,7 +57,7 @@ if (isset($_REQUEST['do_save_data'])) { $sql_query .= ' DROP PRIMARY KEY,'; } else { $sql_query .= ' DROP INDEX ' - . $common_functions->backquote($_REQUEST['old_index']) . ','; + . PMA_Util::backquote($_REQUEST['old_index']) . ','; } } // end if @@ -81,13 +81,13 @@ if (isset($_REQUEST['do_save_data'])) { $error = PMA_Message::error(__('Can\'t rename index to PRIMARY!')); } $sql_query .= ' ADD ' . $index->getType() . ' ' - . ($index->getName() ? $common_functions->backquote($index->getName()) : ''); + . ($index->getName() ? PMA_Util::backquote($index->getName()) : ''); break; } // end switch $index_fields = array(); foreach ($index->getColumns() as $key => $column) { - $index_fields[$key] = $common_functions->backquote($column->getName()); + $index_fields[$key] = PMA_Util::backquote($column->getName()); if ($column->getSubPart()) { $index_fields[$key] .= '(' . $column->getSubPart() . ')'; } @@ -114,7 +114,7 @@ if (isset($_REQUEST['do_save_data'])) { $response->addJSON('index_table', PMA_Index::getView($table, $db)); $response->addJSON( 'sql_query', - $common_functions->getMessage(null, $sql_query) + PMA_Util::getMessage(null, $sql_query) ); } else { $active_page = 'tbl_structure.php'; @@ -227,7 +227,7 @@ echo PMA_CommonFunctions::getInstance()->showHint( <strong> <label for="select_index_type"> <?php echo __('Index type:'); ?> - <?php echo $common_functions->showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?> + <?php echo PMA_Util::showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?> </label> </strong> </div> diff --git a/tbl_move_copy.php b/tbl_move_copy.php index 53aa048c39..b21f295585 100644 --- a/tbl_move_copy.php +++ b/tbl_move_copy.php @@ -11,7 +11,7 @@ require_once 'libraries/common.inc.php'; // Check parameters -$common_functions->checkParameters(array('db', 'table')); +PMA_Util::checkParameters(array('db', 'table')); /** * Defines the url to return to in case of error in a sql statement @@ -56,11 +56,11 @@ if (PMA_isValid($_REQUEST['new_name'])) { } else { $message = PMA_Message::success(__('Table %s has been copied to %s.')); } - $old = $common_functions->backquote($db) . '.' - . $common_functions->backquote($table); + $old = PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($table); $message->addParam($old); - $new = $common_functions->backquote($_REQUEST['target_db']) . '.' - . $common_functions->backquote($_REQUEST['new_name']); + $new = PMA_Util::backquote($_REQUEST['target_db']) . '.' + . PMA_Util::backquote($_REQUEST['new_name']); $message->addParam($new); /* Check: Work on new table or on old table? */ @@ -87,7 +87,7 @@ if ($GLOBALS['is_ajax_request'] == true) { $response->addJSON('db', $GLOBALS['db']); $response->addJSON( 'sql_query', - $common_functions->getMessage(null, $sql_query) + PMA_Util::getMessage(null, $sql_query) ); } else { $response->isSuccess(false); diff --git a/tbl_operations.php b/tbl_operations.php index 014d4c5feb..b0b81e54d3 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -138,7 +138,7 @@ if (isset($_REQUEST['submitoptions'])) { if (count($table_alters) > 0) { $sql_query = 'ALTER TABLE ' - . $common_functions->backquote($GLOBALS['table']); + . PMA_Util::backquote($GLOBALS['table']); $sql_query .= "\r\n" . implode("\r\n", $table_alters); $sql_query .= ';'; $result .= PMA_DBI_query($sql_query) ? true : false; @@ -192,7 +192,7 @@ if (isset($result) && empty($message_to_show)) { $response->isSuccess($_message->isSuccess()); $response->addJSON('message', $_message); $response->addJSON( - 'sql_query', $common_functions->getMessage(null, $sql_query) + 'sql_query', PMA_Util::getMessage(null, $sql_query) ); exit; } @@ -211,7 +211,7 @@ if (isset($result) && empty($message_to_show)) { } $response->addHTML( - $common_functions->getMessage($_message, $sql_query, $_type) + PMA_Util::getMessage($_message, $sql_query, $_type) ); unset($_message, $_type); } @@ -298,7 +298,7 @@ if (! (isset($db_is_information_schema) && $db_is_information_schema)) { && ! (isset($db_is_information_schema) && $db_is_information_schema) ) { $this_sql_query = 'TRUNCATE TABLE ' - . $common_functions->backquote($GLOBALS['table']); + . PMA_Util::backquote($GLOBALS['table']); $truncate_table_url_params = array_merge( $url_params, array( @@ -314,7 +314,7 @@ if (! (isset($db_is_information_schema) && $db_is_information_schema)) { } if (! (isset($db_is_information_schema) && $db_is_information_schema)) { $this_sql_query = 'DROP TABLE ' - . $common_functions->backquote($GLOBALS['table']); + . PMA_Util::backquote($GLOBALS['table']); $drop_table_url_params = array_merge( $url_params, array( diff --git a/tbl_printview.php b/tbl_printview.php index a6bb9aeff8..7ea8fcc8e0 100644 --- a/tbl_printview.php +++ b/tbl_printview.php @@ -60,7 +60,7 @@ if ($multi_tables) { $tbl_list = ''; foreach ($the_tables as $key => $table) { $tbl_list .= (empty($tbl_list) ? '' : ', ') - . $common_functions->backquote($table); + . PMA_Util::backquote($table); } echo '<strong>'. __('Showing tables') . ': ' . htmlspecialchars($tbl_list) . '</strong>' . "\n"; @@ -101,7 +101,7 @@ foreach ($the_tables as $key => $table) { // in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910). $show_create_table = PMA_DBI_fetch_value( - 'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.' + 'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_CommonFunctions::getInstance()->backquote($table), 0, 1 ); @@ -142,7 +142,7 @@ foreach ($the_tables as $key => $table) { echo '</thead>'; echo '<tbody>'; foreach ($columns as $row) { - $extracted_columnspec = $common_functions->extractColumnSpec($row['Type']); + $extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']); $type = $extracted_columnspec['print_type']; $attribute = $extracted_columnspec['attribute']; @@ -244,22 +244,22 @@ foreach ($the_tables as $key => $table) { $mergetable = PMA_Table::isMerge($db, $table); - list($data_size, $data_unit) = $common_functions->formatByteDown( + list($data_size, $data_unit) = PMA_Util::formatByteDown( $showtable['Data_length'] ); if ($mergetable == false) { list($index_size, $index_unit) - = $common_functions->formatByteDown( + = PMA_Util::formatByteDown( $showtable['Index_length'] ); } if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) { list($free_size, $free_unit) - = $common_functions->formatByteDown( + = PMA_Util::formatByteDown( $showtable['Data_free'] ); list($effect_size, $effect_unit) - = $common_functions->formatByteDown( + = PMA_Util::formatByteDown( $showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'] ); @@ -267,16 +267,16 @@ foreach ($the_tables as $key => $table) { unset($free_size); unset($free_unit); list($effect_size, $effect_unit) - = $common_functions->formatByteDown( + = PMA_Util::formatByteDown( $showtable['Data_length'] + $showtable['Index_length'] ); } - list($tot_size, $tot_unit) = $common_functions->formatByteDown( + list($tot_size, $tot_unit) = PMA_Util::formatByteDown( $showtable['Data_length'] + $showtable['Index_length'] ); if ($num_rows > 0) { list($avg_size, $avg_unit) - = $common_functions->formatByteDown( + = PMA_Util::formatByteDown( ($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, @@ -364,7 +364,7 @@ foreach ($the_tables as $key => $table) { echo '<tr>'; echo '<td>' . __('Rows') . '</td>'; echo '<td class="right">'; - echo $common_functions->formatNumber($showtable['Rows'], 0); + echo PMA_Util::formatNumber($showtable['Rows'], 0); echo '</td>'; echo '</tr>'; } @@ -375,7 +375,7 @@ foreach ($the_tables as $key => $table) { echo '<tr>'; echo '<td>' . __('Row length') . ' ø</td>'; echo '<td>'; - echo $common_functions->formatNumber( + echo PMA_Util::formatNumber( $showtable['Avg_row_length'], 0 ); echo '</td>'; @@ -398,7 +398,7 @@ foreach ($the_tables as $key => $table) { echo '<tr>'; echo '<td>' . __('Next autoindex'). ' </td>'; echo '<td class="right">'; - echo $common_functions->formatNumber( + echo PMA_Util::formatNumber( $showtable['Auto_increment'], 0 ); echo '</td>'; @@ -409,7 +409,7 @@ foreach ($the_tables as $key => $table) { echo '<tr>'; echo '<td>' . __('Creation') . '</td>'; echo '<td class="right">'; - echo $common_functions->localisedDate( + echo PMA_Util::localisedDate( strtotime($showtable['Create_time']) ); echo '</td>'; @@ -420,7 +420,7 @@ foreach ($the_tables as $key => $table) { echo '<tr>'; echo '<td>' . __('Last update') . '</td>'; echo '<td class="right">'; - echo $common_functions->localisedDate( + echo PMA_Util::localisedDate( strtotime($showtable['Update_time']) ); echo '</td>'; @@ -431,7 +431,7 @@ foreach ($the_tables as $key => $table) { echo '<tr>'; echo '<td>' . __('Last check') . '</td>'; echo '<td class="right">'; - echo $common_functions->localisedDate( + echo PMA_Util::localisedDate( strtotime($showtable['Check_time']) ); echo '</td>'; @@ -457,7 +457,7 @@ foreach ($the_tables as $key => $table) { /** * Displays the footer */ -echo $common_functions->getButton(); +echo PMA_Util::getButton(); echo "<div id='PMA_disable_floating_menubar'></div>\n"; ?> diff --git a/tbl_relation.php b/tbl_relation.php index 39f358c784..6bcf7b58b1 100644 --- a/tbl_relation.php +++ b/tbl_relation.php @@ -130,7 +130,7 @@ $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['relwork']) { $existrel = PMA_getForeigners($db, $table, '', 'internal'); } -if ($common_functions->isForeignKeySupported($tbl_storage_engine)) { +if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) { $existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign'); } if ($cfgRelation['displaywork']) { @@ -155,29 +155,29 @@ if (isset($destination) && $cfgRelation['relwork']) { $foreign_string = trim($foreign_string, '`'); list($foreign_db, $foreign_table, $foreign_field) = explode('.', $foreign_string); if (! isset($existrel[$master_field])) { - $upd_query = 'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) + $upd_query = 'INSERT INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) . '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)' . ' values(' - . '\'' . $common_functions->sqlAddSlashes($db) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($table) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($master_field) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($foreign_db) . '\', ' - . '\'' . $common_functions->sqlAddSlashes($foreign_table) . '\',' - . '\'' . $common_functions->sqlAddSlashes($foreign_field) . '\')'; + . '\'' . PMA_Util::sqlAddSlashes($db) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($table) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($master_field) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($foreign_db) . '\', ' + . '\'' . PMA_Util::sqlAddSlashes($foreign_table) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($foreign_field) . '\')'; } elseif ($existrel[$master_field]['foreign_db'] . '.' .$existrel[$master_field]['foreign_table'] . '.' . $existrel[$master_field]['foreign_field'] != $foreign_string) { - $upd_query = 'UPDATE ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) . ' SET' - . ' foreign_db = \'' . $common_functions->sqlAddSlashes($foreign_db) . '\', ' - . ' foreign_table = \'' . $common_functions->sqlAddSlashes($foreign_table) . '\', ' - . ' foreign_field = \'' . $common_functions->sqlAddSlashes($foreign_field) . '\' ' - . ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND master_table = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND master_field = \'' . $common_functions->sqlAddSlashes($master_field) . '\''; + $upd_query = 'UPDATE ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) . ' SET' + . ' foreign_db = \'' . PMA_Util::sqlAddSlashes($foreign_db) . '\', ' + . ' foreign_table = \'' . PMA_Util::sqlAddSlashes($foreign_table) . '\', ' + . ' foreign_field = \'' . PMA_Util::sqlAddSlashes($foreign_field) . '\' ' + . ' WHERE master_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($master_field) . '\''; } // end if... else.... } elseif (isset($existrel[$master_field])) { - $upd_query = 'DELETE FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) - . ' WHERE master_db = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND master_table = \'' . $common_functions->sqlAddSlashes($table) . '\'' - . ' AND master_field = \'' . $common_functions->sqlAddSlashes($master_field) . '\''; + $upd_query = 'DELETE FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['relation']) + . ' WHERE master_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($table) . '\'' + . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($master_field) . '\''; } // end if... else.... if ($upd_query) { PMA_queryAsControlUser($upd_query); @@ -210,9 +210,9 @@ if (isset($_REQUEST['destination_foreign'])) { // backquotes but MySQL 4.0.16 did not like the syntax // (for example: `base2`.`table1`) - $sql_query = 'ALTER TABLE ' . $common_functions->backquote($table) + $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD FOREIGN KEY (' - . $common_functions->backquote($master_field) . ')' + . PMA_Util::backquote($master_field) . ')' . ' REFERENCES ' . $foreign_db . '.' . $foreign_table . '(' @@ -228,9 +228,9 @@ if (isset($_REQUEST['destination_foreign'])) { $display_query .= $sql_query . "\n"; // end repeated code - } elseif ($common_functions->backquote($existrel_foreign[$master_field]['foreign_db']) != $foreign_db - || $common_functions->backquote($existrel_foreign[$master_field]['foreign_table']) != $foreign_table - || $common_functions->backquote($existrel_foreign[$master_field]['foreign_field']) != $foreign_field + } elseif (PMA_Util::backquote($existrel_foreign[$master_field]['foreign_db']) != $foreign_db + || PMA_Util::backquote($existrel_foreign[$master_field]['foreign_table']) != $foreign_table + || PMA_Util::backquote($existrel_foreign[$master_field]['foreign_field']) != $foreign_field || ($_REQUEST['on_delete'][$master_field_md5] != (!empty($existrel_foreign[$master_field]['on_delete']) ? $existrel_foreign[$master_field]['on_delete'] : 'RESTRICT')) || ($_REQUEST['on_update'][$master_field_md5] != (!empty($existrel_foreign[$master_field]['on_update']) ? $existrel_foreign[$master_field]['on_update'] : 'RESTRICT')) ) { @@ -239,11 +239,11 @@ if (isset($_REQUEST['destination_foreign'])) { // an option has been changed for ON DELETE or ON UPDATE // remove existing key and add the new one - $sql_query = 'ALTER TABLE ' . $common_functions->backquote($table) + $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' DROP FOREIGN KEY ' - . $common_functions->backquote($existrel_foreign[$master_field]['constraint']) . ', ' + . PMA_Util::backquote($existrel_foreign[$master_field]['constraint']) . ', ' . 'ADD FOREIGN KEY (' - . $common_functions->backquote($master_field) . ')' + . PMA_Util::backquote($master_field) . ')' . ' REFERENCES ' . $foreign_db . '.' . $foreign_table . '(' @@ -262,9 +262,9 @@ if (isset($_REQUEST['destination_foreign'])) { } // end if... else.... } elseif (isset($existrel_foreign[$master_field])) { - $sql_query = 'ALTER TABLE ' . $common_functions->backquote($table) + $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' DROP FOREIGN KEY ' - . $common_functions->backquote($existrel_foreign[$master_field]['constraint']); + . PMA_Util::backquote($existrel_foreign[$master_field]['constraint']); $sql_query .= ';'; $display_query .= $sql_query . "\n"; } // end if... else.... @@ -278,14 +278,14 @@ if (isset($_REQUEST['destination_foreign'])) { if (substr($tmp_error, 1, 4) == '1216' || substr($tmp_error, 1, 4) == '1452' ) { - $common_functions->mysqlDie($tmp_error, $sql_query, false, '', false); - echo $common_functions->showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n"; + PMA_Util::mysqlDie($tmp_error, $sql_query, false, '', false); + echo PMA_Util::showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n"; } if (substr($tmp_error, 1, 4) == '1005') { $message = PMA_Message::error(__('Error creating foreign key on %1$s (check data types)')); $message->addParam($master_field); $message->display(); - echo $common_functions->showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n"; + echo PMA_Util::showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n"; } unset($tmp_error); $sql_query = ''; @@ -293,9 +293,9 @@ if (isset($_REQUEST['destination_foreign'])) { } // end foreach if (!empty($display_query)) { if ($seen_error) { - echo $common_functions->getMessage(__('Error'), null, 'error'); + echo PMA_Util::getMessage(__('Error'), null, 'error'); } else { - echo $common_functions->getMessage(__('Your SQL query has been executed successfully'), null, 'success'); + echo PMA_Util::getMessage(__('Your SQL query has been executed successfully'), null, 'success'); } } } // end if isset($destination_foreign) @@ -307,22 +307,22 @@ if ($cfgRelation['displaywork'] && isset($display_field)) { $upd_query = false; if ($disp) { if ($display_field != '') { - $upd_query = 'UPDATE ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) - . ' SET display_field = \'' . $common_functions->sqlAddSlashes($display_field) . '\'' - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $upd_query = 'UPDATE ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) + . ' SET display_field = \'' . PMA_Util::sqlAddSlashes($display_field) . '\'' + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; } else { - $upd_query = 'DELETE FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) - . ' WHERE db_name = \'' . $common_functions->sqlAddSlashes($db) . '\'' - . ' AND table_name = \'' . $common_functions->sqlAddSlashes($table) . '\''; + $upd_query = 'DELETE FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) + . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'' + . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''; } } elseif ($display_field != '') { - $upd_query = 'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) + $upd_query = 'INSERT INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['table_info']) . '(db_name, table_name, display_field) ' . ' VALUES(' - . '\'' . $common_functions->sqlAddSlashes($db) . '\',' - . '\'' . $common_functions->sqlAddSlashes($table) . '\',' - . '\'' . $common_functions->sqlAddSlashes($display_field) . '\')'; + . '\'' . PMA_Util::sqlAddSlashes($db) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($table) . '\',' + . '\'' . PMA_Util::sqlAddSlashes($display_field) . '\')'; } if ($upd_query) { @@ -335,7 +335,7 @@ if (isset($destination) && $cfgRelation['relwork']) { $existrel = PMA_getForeigners($db, $table, '', 'internal'); } if (isset($destination_foreign) - && $common_functions->isForeignKeySupported($tbl_storage_engine) + && PMA_Util::isForeignKeySupported($tbl_storage_engine) ) { $existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign'); } @@ -357,19 +357,19 @@ echo PMA_generate_common_hidden_inputs($db, $table); // relations if ($cfgRelation['relwork'] - || $common_functions->isForeignKeySupported($tbl_storage_engine) + || PMA_Util::isForeignKeySupported($tbl_storage_engine) ) { // To choose relations we first need all tables names in current db // and if the main table supports foreign keys // we use SHOW TABLE STATUS because we need to find other tables of the // same engine. - if ($common_functions->isForeignKeySupported($tbl_storage_engine)) { - $tab_query = 'SHOW TABLE STATUS FROM ' . $common_functions->backquote($db); + if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) { + $tab_query = 'SHOW TABLE STATUS FROM ' . PMA_Util::backquote($db); // [0] of the row is the name // [1] is the type } else { - $tab_query = 'SHOW TABLES FROM ' . $common_functions->backquote($db); + $tab_query = 'SHOW TABLES FROM ' . PMA_Util::backquote($db); // [0] of the row is the name } @@ -388,7 +388,7 @@ if ($cfgRelation['relwork'] // if foreign keys are supported, collect all keys from other // tables of the same engine - if ($common_functions->isForeignKeySupported($tbl_storage_engine) + if (PMA_Util::isForeignKeySupported($tbl_storage_engine) && isset($curr_table[1]) && strtoupper($curr_table[1]) == $tbl_storage_engine ) { @@ -420,12 +420,12 @@ if (count($columns) > 0) { <?php if ($cfgRelation['relwork']) { echo '<th>' . __('Internal relation'); - if ($common_functions->isForeignKeySupported($tbl_storage_engine)) { - echo $common_functions->showHint(__('An internal relation is not necessary when a corresponding FOREIGN KEY relation exists.')); + if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) { + echo PMA_Util::showHint(__('An internal relation is not necessary when a corresponding FOREIGN KEY relation exists.')); } echo '</th>'; } - if ($common_functions->isForeignKeySupported($tbl_storage_engine)) { + if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) { // this does not have to be translated, it's part of the MySQL syntax echo '<th colspan="2">' . __('Foreign key constraint') . ' (' . $tbl_storage_engine . ')'; echo '</th>'; @@ -484,7 +484,7 @@ if (count($columns) > 0) { <?php } // end if (internal relations) - if ($common_functions->isForeignKeySupported($tbl_storage_engine)) { + if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) { echo '<td>'; if (!empty($save_row[$i]['Key'])) { ?> @@ -494,9 +494,9 @@ if (count($columns) > 0) { if (isset($existrel_foreign[$myfield])) { // need to PMA_CommonFunctions::getInstance()->backquote to support a dot character inside // an element - $foreign_field = $common_functions->backquote($existrel_foreign[$myfield]['foreign_db']) . '.' - . $common_functions->backquote($existrel_foreign[$myfield]['foreign_table']) . '.' - . $common_functions->backquote($existrel_foreign[$myfield]['foreign_field']); + $foreign_field = PMA_Util::backquote($existrel_foreign[$myfield]['foreign_db']) . '.' + . PMA_Util::backquote($existrel_foreign[$myfield]['foreign_table']) . '.' + . PMA_Util::backquote($existrel_foreign[$myfield]['foreign_field']); } else { $foreign_field = false; } diff --git a/tbl_replace.php b/tbl_replace.php index 5f483d9972..10117acdd7 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -23,7 +23,7 @@ require_once 'libraries/common.inc.php'; require_once 'libraries/insert_edit.lib.php'; // Check parameters -$common_functions->checkParameters(array('db', 'table', 'goto')); +PMA_Util::checkParameters(array('db', 'table', 'goto')); PMA_DBI_select_db($GLOBALS['db']); @@ -221,8 +221,8 @@ foreach ($loop_array as $rownumber => $where_clause) { $value_sets[] = implode(', ', $query_values); } else { // build update query - $query[] = 'UPDATE ' . $common_functions->backquote($GLOBALS['db']) - . '.' . $common_functions->backquote($GLOBALS['table']) + $query[] = 'UPDATE ' . PMA_Util::backquote($GLOBALS['db']) + . '.' . PMA_Util::backquote($GLOBALS['table']) . ' SET ' . implode(', ', $query_values) . ' WHERE ' . $where_clause . ($_REQUEST['clause_is_unique'] ? '' : ' LIMIT 1'); @@ -367,7 +367,7 @@ if ($response->isAjax()) { ); $extra_data['sql_query'] - = $common_functions->getMessage($message, $GLOBALS['display_query']); + = PMA_Util::getMessage($message, $GLOBALS['display_query']); $response = PMA_Response::getInstance(); $response->isSuccess($message->isSuccess()); diff --git a/tbl_structure.php b/tbl_structure.php index 021c87f156..688e114521 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -62,16 +62,16 @@ if (! empty($submit_mult) && isset($_REQUEST['selected_fld'])) { $sql_query = ''; foreach ($_REQUEST['selected_fld'] as $idx => $sval) { if ($sql_query == '') { - $sql_query .= 'SELECT ' . $common_functions->backquote($sval); + $sql_query .= 'SELECT ' . PMA_Util::backquote($sval); } else { - $sql_query .= ', ' . $common_functions->backquote($sval); + $sql_query .= ', ' . PMA_Util::backquote($sval); } } // what is this htmlspecialchars() for?? //$sql_query .= ' FROM ' . backquote(htmlspecialchars($table)); - $sql_query .= ' FROM ' . $common_functions->backquote($db) - . '.' . $common_functions->backquote($table); + $sql_query .= ' FROM ' . PMA_Util::backquote($db) + . '.' . PMA_Util::backquote($table); include 'sql.php'; exit; } else { @@ -141,8 +141,8 @@ $fields = (array) PMA_DBI_get_columns($db, $table, null, true); // in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910). $show_create_table = PMA_DBI_fetch_value( - 'SHOW CREATE TABLE ' . $common_functions->backquote($db) . '.' - . $common_functions->backquote($table), + 'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' + . PMA_Util::backquote($table), 0, 1 ); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); @@ -228,7 +228,7 @@ foreach ($fields as $row) { $columns_list[] = $row['Field']; $type = $row['Type']; - $extracted_columnspec = $common_functions->extractColumnSpec($row['Type']); + $extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']); if ('set' == $extracted_columnspec['type'] || 'enum' == $extracted_columnspec['type'] diff --git a/tbl_tracking.php b/tbl_tracking.php index e39fc7c99c..6bfd10d04c 100644 --- a/tbl_tracking.php +++ b/tbl_tracking.php @@ -290,7 +290,7 @@ if (isset($_REQUEST['snapshot'])) { $drop_create_statements .= $data['ddlog'][1]['statement']; } // Print SQL code - echo $common_functions->getMessage( + echo PMA_Util::getMessage( sprintf( __('Version %s snapshot (SQL code)'), htmlspecialchars($_REQUEST['version']) @@ -335,10 +335,10 @@ if (isset($_REQUEST['snapshot'])) { <td><?php if (isset($field['Default'])) { $extracted_columnspec - = $common_functions->extractColumnSpec($field['Type']); + = PMA_Util::extractColumnSpec($field['Type']); if ($extracted_columnspec['type'] == 'bit') { // here, $field['Default'] contains something like b'010' - echo $common_functions->convertBitDefaultValue($field['Default']); + echo PMA_Util::convertBitDefaultValue($field['Default']); } else { echo htmlspecialchars($field['Default']); } @@ -501,7 +501,7 @@ if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) { // Prepare delete link content here $drop_image_or_text = ''; if (true == $GLOBALS['cfg']['PropertiesIconic']) { - $drop_image_or_text .= $common_functions->getImage('b_drop.png', __('Delete tracking data row from report')); + $drop_image_or_text .= PMA_Util::getImage('b_drop.png', __('Delete tracking data row from report')); } if ('both' === $GLOBALS['cfg']['PropertiesIconic'] || false === $GLOBALS['cfg']['PropertiesIconic']) { $drop_image_or_text .= __('Delete'); @@ -536,7 +536,7 @@ if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) { if (strlen($entry['statement']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) { $statement = substr($entry['statement'], 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) . '[...]'; } else { - $statement = $common_functions->formatSql(PMA_SQP_parse($entry['statement'])); + $statement = PMA_Util::formatSql(PMA_SQP_parse($entry['statement'])); } $timestamp = strtotime($entry['date']); @@ -594,7 +594,7 @@ if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) { if (strlen($entry['statement']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) { $statement = substr($entry['statement'], 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) . '[...]'; } else { - $statement = $common_functions->formatSql(PMA_SQP_parse($entry['statement'])); + $statement = PMA_Util::formatSql(PMA_SQP_parse($entry['statement'])); } $timestamp = strtotime($entry['date']); @@ -658,9 +658,9 @@ if (isset($_REQUEST['report']) || isset($_REQUEST['report_export'])) { */ $sql_query = " SELECT DISTINCT db_name, table_name FROM " . - $common_functions->backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . - $common_functions->backquote($GLOBALS['cfg']['Server']['tracking']) . - " WHERE db_name = '" . $common_functions->sqlAddSlashes($GLOBALS['db']) . "' " . + PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . + PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']) . + " WHERE db_name = '" . PMA_Util::sqlAddSlashes($GLOBALS['db']) . "' " . " ORDER BY db_name, table_name"; $sql_result = PMA_queryAsControlUser($sql_query); @@ -698,10 +698,10 @@ if (PMA_DBI_num_rows($sql_result) > 0) { */ $sql_query = " SELECT * FROM " . - $common_functions->backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . - $common_functions->backquote($GLOBALS['cfg']['Server']['tracking']) . - " WHERE db_name = '" . $common_functions->sqlAddSlashes($_REQUEST['db']) . "' ". - " AND table_name = '" . $common_functions->sqlAddSlashes($_REQUEST['table']) ."' ". + PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . + PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']) . + " WHERE db_name = '" . PMA_Util::sqlAddSlashes($_REQUEST['db']) . "' ". + " AND table_name = '" . PMA_Util::sqlAddSlashes($_REQUEST['table']) ."' ". " ORDER BY version DESC "; $sql_result = PMA_queryAsControlUser($sql_query); diff --git a/user_password.php b/user_password.php index bcf29f14be..15b3e7b2d4 100644 --- a/user_password.php +++ b/user_password.php @@ -173,9 +173,9 @@ function PMA_ChangePassUrlParamsAndSubmitQuery( $err_url = 'user_password.php' . PMA_generate_common_url($_url_params); $local_query = 'SET password = ' . (($password == '') ? '\'\'' - : $hashing_function . '(\'' . $common_functions->sqlAddSlashes($password) . '\')'); + : $hashing_function . '(\'' . PMA_Util::sqlAddSlashes($password) . '\')'); $result = @PMA_DBI_try_query($local_query) - or $common_functions->mysqlDie( + or PMA_Util::mysqlDie( PMA_DBI_getError(), $sql_query, false, $err_url ); } |