PEAR codding standards

This commit is contained in:
Loïc Chapeaux
2001-11-23 01:04:57 +00:00
parent 1b39d111d5
commit 05fefd4211
39 changed files with 752 additions and 745 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2001-11-23 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* light changes (function and constant names) in most of the scripts:
they're now about to fully fit the PEAR codding standards.
2001-11-22 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* header.inc.php3, lines 142-148: merged patch #479083 - display name
of server after db/table thanks to

View File

@@ -24,16 +24,16 @@ $err_url = 'main.php3'
if (get_magic_quotes_gpc()) {
$db = stripslashes($db);
}
if (MYSQL_INT_VERSION < 32306) {
check_reserved_words($db, $err_url);
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($db, $err_url);
}
/**
* Executes the db creation sql query
*/
$local_query = 'CREATE DATABASE ' . backquote($db);
$result = mysql_query('CREATE DATABASE ' . backquote($db)) or mysql_die('', $local_query, FALSE, $err_url);
$local_query = 'CREATE DATABASE ' . PMA_backquote($db);
$result = mysql_query('CREATE DATABASE ' . PMA_backquote($db)) or PMA_mysqlDie('', $local_query, FALSE, $err_url);
/**

View File

@@ -54,7 +54,7 @@ window.parent.frames['nav'].location.replace('./left.php3?lang=<?php echo $lang;
}
echo "\n";
} else {
show_message($message);
PMA_showMessage($message);
}
@@ -73,11 +73,11 @@ if ((!empty($submit_mult) && isset($selected_tbl))
* tables if possible
*/
// staybyte: speedup view on locked tables - 11 June 2001
if (MYSQL_INT_VERSION >= 32303) {
if (PMA_MYSQL_INT_VERSION >= 32303) {
// Special speedup for newer MySQL Versions (in 4.0 format changed)
if ($cfgSkipLockedTables == TRUE && MYSQL_INT_VERSION >= 32330) {
$local_query = 'SHOW OPEN TABLES FROM ' . backquote($db);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
if ($cfgSkipLockedTables == TRUE && PMA_MYSQL_INT_VERSION >= 32330) {
$local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
// Blending out tables in use
if ($result != FALSE && mysql_num_rows($result) > 0) {
while ($tmp = mysql_fetch_row($result)) {
@@ -89,13 +89,13 @@ if (MYSQL_INT_VERSION >= 32303) {
mysql_free_result($result);
if (isset($sot_cache)) {
$local_query = 'SHOW TABLES FROM ' . backquote($db);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
$local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
if ($result != FALSE && mysql_num_rows($result) > 0) {
while ($tmp = mysql_fetch_row($result)) {
if (!isset($sot_cache[$tmp[0]])) {
$local_query = 'SHOW TABLE STATUS FROM ' . backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
$sts_result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
$sts_result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$sts_tmp = mysql_fetch_array($sts_result);
$tables[] = $sts_tmp;
} else { // table in use
@@ -109,8 +109,8 @@ if (MYSQL_INT_VERSION >= 32303) {
}
}
if (!isset($sot_ready)) {
$local_query = 'SHOW TABLE STATUS FROM ' . backquote($db);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
if ($result != FALSE && mysql_num_rows($result) > 0) {
while ($sts_tmp = mysql_fetch_array($result)) {
$tables[] = $sts_tmp;
@@ -119,7 +119,7 @@ if (MYSQL_INT_VERSION >= 32303) {
}
}
$num_tables = (isset($tables) ? count($tables) : 0);
} // end if (MYSQL_INT_VERSION >= 32303)
} // end if (PMA_MYSQL_INT_VERSION >= 32303)
else {
$result = mysql_list_tables($db);
$num_tables = @mysql_numrows($result);
@@ -145,7 +145,7 @@ if ($num_tables == 0) {
}
// 2. Shows table informations on mysql >= 3.23 - staybyte - 11 June 2001
else if (MYSQL_INT_VERSION >= 32300) {
else if (PMA_MYSQL_INT_VERSION >= 32300) {
?>
<form action="db_details.php3">
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
@@ -187,7 +187,7 @@ else if (MYSQL_INT_VERSION >= 32300) {
&nbsp;<b><?php echo htmlspecialchars($table); ?>&nbsp;</b>&nbsp;
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&amp;pos=0">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table)); ?>&amp;pos=0">
<?php echo $strBrowse; ?></a>
</td>
<td>
@@ -203,13 +203,13 @@ else if (MYSQL_INT_VERSION >= 32300) {
<?php echo $strProperties; ?></a>
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
<a href="sql.php3?<?php echo $url_query; ?>&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
<?php echo $strDrop; ?></a>
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DELETE FROM <?php echo js_format($table); ?>')">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DELETE FROM <?php echo PMA_jsFormat($table); ?>')">
<?php echo $strEmpty; ?></a>
</td>
<?php
@@ -230,9 +230,9 @@ else if (MYSQL_INT_VERSION >= 32300) {
$tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
$sum_size += $tblsize;
if ($tblsize > 0) {
list($formated_size, $unit) = format_byte_down($tblsize, 3, 1);
list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
} else {
list($formated_size, $unit) = format_byte_down($tblsize, 3, 0);
list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 0);
}
} else if ($cfgShowStats) {
$formated_size = '&nbsp;-&nbsp;';
@@ -288,7 +288,7 @@ else if (MYSQL_INT_VERSION >= 32300) {
}
// Show Summary
if ($cfgShowStats) {
list($sum_formated, $unit) = format_byte_down($sum_size, 3, 1);
list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
}
echo "\n";
?>
@@ -371,7 +371,7 @@ else {
<b>&nbsp;<?php echo $tables[$i]; ?>&nbsp;</b>
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($tables[$i])); ?>&amp;pos=0"><?php echo $strBrowse; ?></a>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($tables[$i])); ?>&amp;pos=0"><?php echo $strBrowse; ?></a>
</td>
<td>
<a href="tbl_select.php3?<?php echo $url_query; ?>"><?php echo $strSelect; ?></a>
@@ -383,13 +383,13 @@ else {
<a href="tbl_properties.php3?<?php echo $url_query; ?>"><?php echo $strProperties; ?></a>
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . backquote($tables[$i])); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($tables[$i]))); ?>"><?php echo $strDrop; ?></a>
<a href="sql.php3?<?php echo $url_query; ?>&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($tables[$i])); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($tables[$i]))); ?>"><?php echo $strDrop; ?></a>
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . backquote($tables[$i])); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($tables[$i]))); ?>"><?php echo $strEmpty; ?></a>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . PMA_backquote($tables[$i])); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($tables[$i]))); ?>"><?php echo $strEmpty; ?></a>
</td>
<td align="right">
<?php count_records($db, $tables[$i]); echo "\n"; ?>
<?php PMA_countRecords($db, $tables[$i]); echo "\n"; ?>
</td>
</tr>
<?php
@@ -410,7 +410,7 @@ else {
</table>
</form>
<?php
<?php
} // end case mysql < 3.23
echo "\n";
@@ -467,7 +467,7 @@ if ($num_tables > 0) {
<input type="hidden" name="goto" value="db_details.php3" />
<input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" />
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
<?php echo sprintf($strRunSQLQuery, $db) . ' ' . show_docu('manual_Reference.html#SELECT'); ?>&nbsp;:<br />
<?php echo sprintf($strRunSQLQuery, $db) . ' ' . PMA_showDocu('manual_Reference.html#SELECT'); ?>&nbsp;:<br />
<div style="margin-bottom: 5px">
<textarea name="sql_query" cols="<?php echo $cfgTextareaCols; ?>" rows="<?php echo $cfgTextareaRows; ?>" wrap="virtual">
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
@@ -477,7 +477,7 @@ if ($num_tables > 0) {
</div>
<?php
// loic1: displays import dump feature only if file upload available
$is_upload = (PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
$is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
? ((strtolower(ini_get('file_uploads')) == 'on' || ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
: (intval(@get_cfg_var('upload_max_filesize')));
if ($is_upload) {
@@ -491,7 +491,7 @@ echo "\n";
// Bookmark Support
if ($cfgBookmark['db'] && $cfgBookmark['table']) {
if (($bookmark_list = list_bookmarks($db, $cfgBookmark)) && count($bookmark_list) > 0) {
if (($bookmark_list = PMA_listBookmarks($db, $cfgBookmark)) && count($bookmark_list) > 0) {
echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
echo ' <div style="margin-bottom: 5px">' . "\n";
echo ' <select name="id_bookmark">' . "\n";
@@ -546,7 +546,7 @@ if ($num_tables > 0) {
$i = 0;
echo "\n";
while ($i < $num_tables) {
$table = ((MYSQL_INT_VERSION >= 32300) ? $tables[$i]['Name'] : $tables[$i]);
$table = ((PMA_MYSQL_INT_VERSION >= 32300) ? $tables[$i]['Name'] : $tables[$i]);
echo ' <option value="' . $table . '">' . $table . '</option>' . "\n";
$i++;
}
@@ -587,7 +587,7 @@ if ($num_tables > 0) {
</tr>
<?php
// Add backquotes checkbox
if (MYSQL_INT_VERSION >= 32306) {
if (PMA_MYSQL_INT_VERSION >= 32306) {
?>
<tr>
<td<?php echo $colspan; ?>>
@@ -605,7 +605,7 @@ if ($num_tables > 0) {
<?php echo $strSend . "\n"; ?>
<?php
// gzip and bzip2 encode features
if (PHP_INT_VERSION >= 40004) {
if (PMA_PHP_INT_VERSION >= 40004) {
$is_zip = (isset($cfgZipDump) && $cfgZipDump && @function_exists('gzcompress'));
$is_gzip = (isset($cfgGZipDump) && $cfgGZipDump && @function_exists('gzencode'));
$is_bzip = (isset($cfgBZipDump) && $cfgBZipDump && @function_exists('bzcompress'));
@@ -683,10 +683,10 @@ if ($cfgAllowUserDropDatabase || $is_superuser) {
?>
<!-- Drop database -->
<li>
<a href="sql.php3?server=<?php echo $server; ?>&amp;lang=<?php echo $lang; ?>&amp;db=<?php echo urlencode($db); ?>&amp;sql_query=<?php echo urlencode('DROP DATABASE ' . backquote($db)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strDatabaseHasBeenDropped, htmlspecialchars(backquote($db)))); ?>&amp;goto=main.php3&amp;back=db_details.php3&amp;reload=1"
onclick="return confirmLink(this, 'DROP DATABASE <?php echo js_format($db); ?>')">
<a href="sql.php3?server=<?php echo $server; ?>&amp;lang=<?php echo $lang; ?>&amp;db=<?php echo urlencode($db); ?>&amp;sql_query=<?php echo urlencode('DROP DATABASE ' . PMA_backquote($db)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strDatabaseHasBeenDropped, htmlspecialchars(PMA_backquote($db)))); ?>&amp;goto=main.php3&amp;back=db_details.php3&amp;reload=1"
onclick="return confirmLink(this, 'DROP DATABASE <?php echo PMA_jsFormat($db); ?>')">
<?php echo $strDropDB . ' ' . htmlspecialchars($db); ?></a>
<?php echo show_docu('manual_Reference.html#DROP_DATABASE') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#DROP_DATABASE') . "\n"; ?>
</li>
<?php
}

View File

@@ -23,11 +23,11 @@ $err_url = 'db_details.php3'
* tables if possible
*/
// staybyte: speedup view on locked tables - 11 June 2001
if (MYSQL_INT_VERSION >= 32303) {
if (PMA_MYSQL_INT_VERSION >= 32303) {
// Special speedup for newer MySQL Versions (in 4.0 format changed)
if ($cfgSkipLockedTables == TRUE && MYSQL_INT_VERSION >= 32330) {
$local_query = 'SHOW OPEN TABLES FROM ' . backquote($db);
$result = mysql_query($query) or mysql_die('', $local_query, '', $err_url);
if ($cfgSkipLockedTables == TRUE && PMA_MYSQL_INT_VERSION >= 32330) {
$local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
$result = mysql_query($query) or PMA_mysqlDie('', $local_query, '', $err_url);
// Blending out tables in use
if ($result != FALSE && mysql_num_rows($result) > 0) {
while ($tmp = mysql_fetch_array($result)) {
@@ -39,13 +39,13 @@ if (MYSQL_INT_VERSION >= 32303) {
mysql_free_result($result);
if (isset($sot_cache)) {
$local_query = 'SHOW TABLES FROM ' . backquote($db);
$result = mysql_query($query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
$result = mysql_query($query) or PMA_mysqlDie('', $local_query, '', $err_url);
if ($result != FALSE && mysql_num_rows($result) > 0) {
while ($tmp = mysql_fetch_array($result)) {
if (!isset($sot_cache[$tmp[0]])) {
$local_query = 'SHOW TABLE STATUS FROM ' . backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
$sts_result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
$sts_result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$sts_tmp = mysql_fetch_array($sts_result);
$tables[] = $sts_tmp;
} else { // table in use
@@ -59,8 +59,8 @@ if (MYSQL_INT_VERSION >= 32303) {
}
}
if (!isset($sot_ready)) {
$local_query = 'SHOW TABLE STATUS FROM ' . backquote($db);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
if ($result != FALSE && mysql_num_rows($result) > 0) {
while ($sts_tmp = mysql_fetch_array($result)) {
$tables[] = $sts_tmp;
@@ -69,7 +69,7 @@ if (MYSQL_INT_VERSION >= 32303) {
}
}
$num_tables = (isset($tables) ? count($tables) : 0);
} // end if (MYSQL_INT_VERSION >= 32303)
} // end if (PMA_MYSQL_INT_VERSION >= 32303)
else {
$result = mysql_list_tables($db);
$num_tables = @mysql_numrows($result);
@@ -89,7 +89,7 @@ if ($num_tables == 0) {
echo $strNoTablesFound;
}
// 2. Shows table informations on mysql >= 3.23 - staybyte - 11 June 2001
else if (MYSQL_INT_VERSION >= 32300) {
else if (PMA_MYSQL_INT_VERSION >= 32300) {
?>
<!-- The tables list -->
@@ -134,9 +134,9 @@ else if (MYSQL_INT_VERSION >= 32300) {
$tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
$sum_size += $tblsize;
if ($tblsize > 0) {
list($formated_size, $unit) = format_byte_down($tblsize, 3, 1);
list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
} else {
list($formated_size, $unit) = format_byte_down($tblsize, 3, 0);
list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 0);
}
} else if ($cfgShowStats) {
$formated_size = '&nbsp;-&nbsp;';
@@ -191,7 +191,7 @@ else if (MYSQL_INT_VERSION >= 32300) {
}
// Show Summary
if ($cfgShowStats) {
list($sum_formated, $unit) = format_byte_down($sum_size, 3, 1);
list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
}
echo "\n";
?>
@@ -243,7 +243,7 @@ else {
<b><?php echo htmlspecialchars($tables[$i]); ?>&nbsp;</b>
</td>
<td align="right" nowrap="nowrap">
&nbsp;<?php count_records($db, $tables[$i]); ?>
&nbsp;<?php PMA_countRecords($db, $tables[$i]); ?>
</td>
</tr>
<?php

View File

@@ -37,7 +37,7 @@ if ((!empty($submit_mult) && isset($selected_db))
*
* @access private
*/
function pmaDbCmp($a, $b)
function PMA_dbCmp($a, $b)
{
global $dbs_array;
global $col;
@@ -58,7 +58,7 @@ function pmaDbCmp($a, $b)
$tmp = (($dbs_array[$a][$col] < $dbs_array[$b][$col]) ? -1 : 1);
return (($is_asc) ? $tmp : -$tmp);
}
} // end of the 'pmaDbCmp()' function
} // end of the 'PMA_dbCmp()' function
/**
@@ -69,7 +69,7 @@ function pmaDbCmp($a, $b)
if ($server > 0) {
// Get the valid databases list
$num_dbs = count($dblist);
$dbs = @mysql_list_dbs() or mysql_die('', 'mysql_list_dbs()', '', 'main.php3?lang' . $lang . '&amp;server=' . $server);
$dbs = @mysql_list_dbs() or PMA_mysqlDie('', 'mysql_list_dbs()', '', 'main.php3?lang' . $lang . '&amp;server=' . $server);
while ($a_db = mysql_fetch_object($dbs)) {
if (!$num_dbs) {
$dblist[] = $a_db->Database;
@@ -116,7 +116,7 @@ if ($server > 0) {
</tr>
<tr>
<th align="<?php echo $cell_align_left; ?>"><big><?php echo $strGenTime . ' :'; ?></big></th>
<th align="<?php echo $cell_align_left; ?>"><big><?php echo localised_date(); ?></big></th>
<th align="<?php echo $cell_align_left; ?>"><big><?php echo PMA_localisedDate(); ?></big></th>
</tr>
</table>
<br /><br />
@@ -148,7 +148,7 @@ if ($num_dbs > 0) {
if ($sort_by == 'db_name') {
$url_sort[0]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc');
$url_sort[0]['img_tag'] = $img_tag;
$col = 'key'; // used in 'pmaDbCmp()'
$col = 'key'; // used in 'PMA_dbCmp()'
} else if ($sort_by == 'tbl_cnt') {
$url_sort[1]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc');
$url_sort[1]['img_tag'] = $img_tag;
@@ -224,7 +224,7 @@ if ($num_dbs > 0) {
$dbs_array[$db][2] = 0; // index size column
$dbs_array[$db][3] = 0; // full size column
$local_query = 'SHOW TABLE STATUS FROM ' . backquote($db);
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
$result = @mysql_query($local_query);
// needs the "@" below otherwise, warnings in case of special DB names
if (@mysql_num_rows($result)) {
@@ -242,7 +242,7 @@ if ($num_dbs > 0) {
mysql_close();
// Sorts the dbs arrays
uksort($dbs_array, 'pmaDbCmp');
uksort($dbs_array, 'PMA_dbCmp');
reset($dbs_array);
// Displays the tables stats per database
@@ -250,9 +250,9 @@ if ($num_dbs > 0) {
while (list($db_name, $db_prop) = each($dbs_array)) {
$bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo;
list($data_size, $data_unit) = format_byte_down($dbs_array[$db_name][1], 3, 1);
list($idx_size, $idx_unit) = format_byte_down($dbs_array[$db_name][2], 3, 1);
list($tot_size, $tot_unit) = format_byte_down($dbs_array[$db_name][3], 3, 1);
list($data_size, $data_unit) = PMA_formatByteDown($dbs_array[$db_name][1], 3, 1);
list($idx_size, $idx_unit) = PMA_formatByteDown($dbs_array[$db_name][2], 3, 1);
list($tot_size, $tot_unit) = PMA_formatByteDown($dbs_array[$db_name][3], 3, 1);
echo ' <tr bgcolor="'. $bgcolor . '">' . "\n";
echo ' <td align="center">' . "\n";
@@ -270,9 +270,9 @@ if ($num_dbs > 0) {
unset($dbs_array);
// Displays the server stats
list($data_size, $data_unit) = format_byte_down($total_array[1], 3, 1);
list($idx_size, $idx_unit) = format_byte_down($total_array[2], 3, 1);
list($tot_size, $tot_unit) = format_byte_down($total_array[3], 3, 1);
list($data_size, $data_unit) = PMA_formatByteDown($total_array[1], 3, 1);
list($idx_size, $idx_unit) = PMA_formatByteDown($total_array[2], 3, 1);
list($tot_size, $tot_unit) = PMA_formatByteDown($total_array[3], 3, 1);
echo ' <tr>' . "\n";
echo ' <th>&nbsp;</th>' . "\n";

View File

@@ -26,6 +26,6 @@ if (isset($userlink) && $userlink) {
*/
if (isset($cfgOBGzip) && $cfgOBGzip
&& isset($ob_mode) && $ob_mode) {
out_buffer_post($ob_mode);
PMA_outBufferPost($ob_mode);
}
?>

View File

@@ -8,9 +8,9 @@
require('./libraries/common.lib.php3');
require('./libraries/ob.lib.php3');
if ($cfgOBGzip) {
$ob_mode = out_buffer_mode_get();
$ob_mode = PMA_outBufferModeGet();
if ($ob_mode) {
out_buffer_pre($ob_mode);
PMA_outBufferPre($ob_mode);
}
}
@@ -33,7 +33,7 @@ header('Content-Type: text/html; charset=' . $charset);
* Sends the beginning of the html page then returns to the calling script
*/
// Gets the font sizes to use
set_font_sizes();
PMA_setFontSizes();
// Defines the cell alignment values depending on text direction
if ($text_dir == 'ltr') {
$cell_align_left = 'left';
@@ -78,7 +78,7 @@ if (isset($table)) {
if (!empty($cfgServer) && isset($cfgServer['host'])) {
$title = (isset($title) ? $title . ' ' . trim($strRunning) . ' ' . str_replace('\'', '\\\'', $cfgServer['host']) : str_replace('\'', '\\\'', $cfgServer['host']));
}
$title = (isset($title) ? $title . ' - phpMyAdmin ' . PHPMYADMIN_VERSION : 'phpMyAdmin ' . PHPMYADMIN_VERSION);
$title = (isset($title) ? $title . ' - phpMyAdmin ' . PMA_VERSION : 'phpMyAdmin ' . PMA_VERSION);
?>
<script type="text/javascript" language="javascript">
<!--

View File

@@ -9,7 +9,7 @@ require('./libraries/grab_globals.lib.php3');
require('./libraries/common.lib.php3');
// Gets the default font sizes
set_font_sizes();
PMA_setFontSizes();
// Gets the host name
if (empty($HTTP_HOST)) {
@@ -37,7 +37,7 @@ $url_query = 'lang=' . $lang
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
<head>
<title>phpMyAdmin <?php echo PHPMYADMIN_VERSION; ?> - <?php echo $HTTP_HOST; ?></title>
<title>phpMyAdmin <?php echo PMA_VERSION; ?> - <?php echo $HTTP_HOST; ?></title>
<style type="text/css">
<!--
body {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>}

View File

@@ -30,17 +30,17 @@ if (isset($btnLDI) && ($textfile != 'none')) {
}
// Formats the data posted to this script
$textfile = sql_addslashes($textfile);
$textfile = PMA_sqlAddslashes($textfile);
if (get_magic_quotes_gpc()) {
$field_terminater = stripslashes($field_terminater);
$enclosed = sql_addslashes(stripslashes($enclosed));
$escaped = sql_addslashes(stripslashes($escaped));
$enclosed = PMA_sqlAddslashes(stripslashes($enclosed));
$escaped = PMA_sqlAddslashes(stripslashes($escaped));
$line_terminator = stripslashes($line_terminator);
$column_name = sql_addslashes(stripslashes($column_name));
$column_name = PMA_sqlAddslashes(stripslashes($column_name));
} else {
$enclosed = sql_addslashes($enclosed);
$escaped = sql_addslashes($escaped);
$column_name = sql_addslashes($column_name);
$enclosed = PMA_sqlAddslashes($enclosed);
$escaped = PMA_sqlAddslashes($escaped);
$column_name = PMA_sqlAddslashes($column_name);
}
// Builds the query
@@ -48,7 +48,7 @@ if (isset($btnLDI) && ($textfile != 'none')) {
if (!empty($replace)) {
$query .= ' ' . $replace;
}
$query .= ' INTO TABLE ' . backquote($into_table);
$query .= ' INTO TABLE ' . PMA_backquote($into_table);
if (isset($field_terminater)) {
$query .= ' FIELDS TERMINATED BY \'' . $field_terminater . '\'';
}
@@ -65,14 +65,14 @@ if (isset($btnLDI) && ($textfile != 'none')) {
$query .= ' LINES TERMINATED BY \'' . $line_terminator . '\'';
}
if (strlen($column_name) > 0) {
if (MYSQL_INT_VERSION >= 32306) {
if (PMA_MYSQL_INT_VERSION >= 32306) {
$query .= ' (';
$tmp = split(',( ?)', $column_name);
for ($i = 0; $i < count($tmp); $i++) {
if ($i > 0) {
$query .= ', ';
}
$query .= backquote(trim($tmp[$i]));
$query .= PMA_backquote(trim($tmp[$i]));
} // end for
$query .= ')';
} else {

View File

@@ -49,7 +49,7 @@ require('./header.inc.php3');
</tr>
<tr>
<td><?php echo $strLinesTerminatedBy; ?></td>
<td><input type="text" name="line_terminator" size="8" maxlength="8" value="<?php echo ((which_crlf() == "\n") ? '\n' : '\r\n'); ?>" /></td>
<td><input type="text" name="line_terminator" size="8" maxlength="8" value="<?php echo ((PMA_whichCrlf() == "\n") ? '\n' : '\r\n'); ?>" /></td>
<td><?php echo $strCarriage; ?><br /><?php echo $strLineFeed; ?></td>
</tr>
<tr>
@@ -58,7 +58,7 @@ require('./header.inc.php3');
<td><?php echo $strIfYouWish; ?></td>
</tr>
<tr>
<td colspan="3" align="center"><?php print show_docu('manual_Reference.html#LOAD_DATA'); ?></td>
<td colspan="3" align="center"><?php print PMA_showDocu('manual_Reference.html#LOAD_DATA'); ?></td>
</tr>
<tr>
<td colspan="3" align="center">

View File

@@ -19,7 +19,7 @@ require('./libraries/common.lib.php3');
* before the user choose among available ones at the welcome screen.
*/
if ($server > 0) {
available_databases(); // this function is defined in "common.lib.php3"
PMA_availableDatabases(); // this function is defined in "common.lib.php3"
} else {
$num_dbs = 0;
}
@@ -43,7 +43,7 @@ header('Content-Type: text/html; charset=' . $charset);
* Displays the frame
*/
// Gets the font sizes to use
set_font_sizes();
PMA_setFontSizes();
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -187,10 +187,10 @@ if ($num_dbs > 1) {
}
// Get additional infomation about tables for tooltip
if ($cfgShowTooltip && MYSQL_INT_VERSION >= 32303
if ($cfgShowTooltip && PMA_MYSQL_INT_VERSION >= 32303
&& $num_tables) {
$tooltip = array();
$result = mysql_query('SHOW TABLE STATUS FROM ' . backquote($db));
$result = mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
while ($tmp = mysql_fetch_array($result)) {
$tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '')
. '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')';
@@ -228,7 +228,7 @@ if ($num_dbs > 1) {
echo "\n";
?>
<nobr><img src="images/spacer.gif" border="0" width="9" height="9" alt="" />
<a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&amp;pos=0&amp;goto=tbl_properties.php3">
<a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table)); ?>&amp;pos=0&amp;goto=tbl_properties.php3">
<img src="images/browse.gif" border="0" alt="<?php echo "$strBrowse: $table"; ?>" /></a><bdo dir="<?php echo $text_dir; ?>">&nbsp;</bdo>
<a class="tblItem" title="<?php echo str_replace('"', '&quot;', $tooltip[$table]); ?>" target="phpmain" href="tbl_properties.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>">
<?php echo $table; ?></a></nobr><br />
@@ -273,10 +273,10 @@ else if ($num_dbs == 1) {
}
// Get additional infomation about tables for tooltip
if ($cfgShowTooltip && MYSQL_INT_VERSION >= 32303
if ($cfgShowTooltip && PMA_MYSQL_INT_VERSION >= 32303
&& $num_tables) {
$tooltip = array();
$result = mysql_query('SHOW TABLE STATUS FROM ' . backquote($db));
$result = mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
while ($tmp = mysql_fetch_array($result)) {
$tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '')
. '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')';
@@ -297,7 +297,7 @@ else if ($num_dbs == 1) {
$table = mysql_tablename($tables, $j);
echo "\n";
?>
<nobr><a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&amp;pos=0&amp;goto=tbl_properties.php3">
<nobr><a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table)); ?>&amp;pos=0&amp;goto=tbl_properties.php3">
<img src="images/browse.gif" border="0" alt="<?php echo "$strBrowse: $table"; ?>" /></a><bdo dir="<?php echo $text_dir; ?>">&nbsp;</bdo>
<a class="tblItem" title="<?php echo str_replace('"', '&quot;', $tooltip[$table]); ?>" target="phpmain" href="tbl_properties.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>">
<?php echo $table; ?></a></nobr><br />

View File

@@ -8,8 +8,8 @@
if (!defined('__LIB_BOOKMARK__')){
define('__LIB_BOOKMARK__', 1);
if (!defined('PMA_BOOKMARK_LIB_INCLUDED')){
define('PMA_BOOKMARK_LIB_INCLUDED', 1);
/**
* Defines the bookmark parameters for the current user
@@ -19,9 +19,9 @@ if (!defined('__LIB_BOOKMARK__')){
* @global array the list of settings for the current server
* @global integer the id of the current server
*
* @access public
* @access public
*/
function get_bookmarks_param()
function PMA_getBookmarksParam()
{
global $cfgServer;
global $server;
@@ -38,7 +38,7 @@ if (!defined('__LIB_BOOKMARK__')){
$cfgBookmark['table'] = $cfgServer['bookmarktable'];
return $cfgBookmark;
} // end of the 'get_bookmarks_param()' function
} // end of the 'PMA_getBookmarksParam()' function
/**
@@ -49,13 +49,13 @@ if (!defined('__LIB_BOOKMARK__')){
*
* @return mixed the bookmarks list if defined, false else
*
* @access public
* @access public
*/
function list_bookmarks($db, $cfgBookmark)
function PMA_listBookmarks($db, $cfgBookmark)
{
$query = 'SELECT label, id FROM '. backquote($cfgBookmark['db']) . '.' . backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . sql_addslashes($db) . '\''
. ' AND user = \'' . sql_addslashes($cfgBookmark['user']) . '\'';
$query = 'SELECT label, id FROM '. PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'';
if (isset($GLOBALS['dbh'])) {
$result = mysql_query($query, $GLOBALS['dbh']);
} else {
@@ -75,7 +75,7 @@ if (!defined('__LIB_BOOKMARK__')){
else {
return FALSE;
}
} // end of the 'list_bookmarks()' function
} // end of the 'PMA_listBookmarks()' function
/**
@@ -87,13 +87,13 @@ if (!defined('__LIB_BOOKMARK__')){
*
* @return string the sql query
*
* @access public
* @access public
*/
function query_bookmarks($db, $cfgBookmark, $id)
function PMA_queryBookmarks($db, $cfgBookmark, $id)
{
$query = 'SELECT query FROM ' . backquote($cfgBookmark['db']) . '.' . backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . sql_addslashes($db) . '\''
. ' AND user = \'' . sql_addslashes($cfgBookmark['user']) . '\''
$query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
. ' AND id = ' . $id;
if (isset($GLOBALS['dbh'])) {
$result = mysql_query($query, $GLOBALS['dbh']);
@@ -103,7 +103,7 @@ if (!defined('__LIB_BOOKMARK__')){
$bookmark_query = mysql_result($result, 0, 'query');
return $bookmark_query;
} // end of the 'query_bookmarks()' function
} // end of the 'PMA_queryBookmarks()' function
/**
@@ -112,18 +112,18 @@ if (!defined('__LIB_BOOKMARK__')){
* @param array the properties of the bookmark to add
* @param array the bookmark parameters for the current user
*
* @access public
* @access public
*/
function add_bookmarks($fields, $cfgBookmark)
function PMA_addBookmarks($fields, $cfgBookmark)
{
$query = 'INSERT INTO ' . backquote($cfgBookmark['db']) . '.' . backquote($cfgBookmark['table'])
. ' (id, dbase, user, query, label) VALUES (\'\', \'' . sql_addslashes($fields['dbase']) . '\', \'' . sql_addslashes($fields['user']) . '\', \'' . sql_addslashes(urldecode($fields['query'])) . '\', \'' . sql_addslashes($fields['label']) . '\')';
$query = 'INSERT INTO ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
. ' (id, dbase, user, query, label) VALUES (\'\', \'' . PMA_sqlAddslashes($fields['dbase']) . '\', \'' . PMA_sqlAddslashes($fields['user']) . '\', \'' . PMA_sqlAddslashes(urldecode($fields['query'])) . '\', \'' . PMA_sqlAddslashes($fields['label']) . '\')';
if (isset($GLOBALS['dbh'])) {
$result = mysql_query($query, $GLOBALS['dbh']);
} else {
$result = mysql_query($query);
}
} // end of the 'add_bookmarks()' function
} // end of the 'PMA_addBookmarks()' function
/**
@@ -133,26 +133,26 @@ if (!defined('__LIB_BOOKMARK__')){
* @param array the bookmark parameters for the current user
* @param integer the id of the bookmark to get
*
* @access public
* @access public
*/
function delete_bookmarks($db, $cfgBookmark, $id)
function PMA_deleteBookmarks($db, $cfgBookmark, $id)
{
$query = 'DELETE FROM ' . backquote($cfgBookmark['db']) . '.' . backquote($cfgBookmark['table'])
. ' WHERE user = \'' . sql_addslashes($cfgBookmark['user']) . '\''
$query = 'DELETE FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
. ' WHERE user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''
. ' AND id = ' . $id;
if (isset($GLOBALS['dbh'])) {
$result = mysql_query($query, $GLOBALS['dbh']);
} else {
$result = mysql_query($query);
}
} // end of the 'delete_bookmarks()' function
} // end of the 'PMA_deleteBookmarks()' function
/**
* Bookmark Support
*/
$cfgBookmark = get_bookmarks_param();
$cfgBookmark = PMA_getBookmarksParam();
} // $__LIB_BOOKMARK__
} // $__PMA_BOOKMARK_LIB__
?>

View File

@@ -8,8 +8,8 @@
if (!defined('__LIB_BUILD_DUMP__')){
define('__LIB_BUILD_DUMP__', 1);
if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
define('PMA_BUILD_DUMP_LIB_INCLUDED', 1);
/**
* Uses the 'htmlspecialchars()' php function on databases, tables and fields
@@ -19,18 +19,18 @@ if (!defined('__LIB_BUILD_DUMP__')){
*
* @return string the formatted string
*
* @access private
* @access private
*/
function html_format($a_string = '')
function PMA_htmlFormat($a_string = '')
{
return (empty($GLOBALS['asfile']) ? htmlspecialchars($a_string) : $a_string);
} // end of the 'html_format()' function
} // end of the 'PMA_htmlFormat()' function
/**
* Returns $table's CREATE definition
*
* Uses the 'html_format()' function defined in 'tbl_dump.php3'
* Uses the 'PMA_htmlFormat()' function defined in 'tbl_dump.php3'
*
* @param string the database name
* @param string the table name
@@ -43,47 +43,47 @@ if (!defined('__LIB_BUILD_DUMP__')){
* @global boolean whether to use backquotes to allow the use of special
* characters in database, table and fields names or not
*
* @see html_format()
* @see PMA_htmlFormat()
*
* @access public
* @access public
*/
function get_table_def($db, $table, $crlf, $error_url)
function PMA_getTableDef($db, $table, $crlf, $error_url)
{
global $drop;
global $use_backquotes;
$schema_create = '';
if (!empty($drop)) {
$schema_create .= 'DROP TABLE IF EXISTS ' . backquote(html_format($table), $use_backquotes) . ';' . $crlf;
$schema_create .= 'DROP TABLE IF EXISTS ' . PMA_backquote(PMA_htmlFormat($table), $use_backquotes) . ';' . $crlf;
}
// Steve Alberty's patch for complete table dump,
// modified by Lem9 to allow older MySQL versions to continue to work
if (MYSQL_INT_VERSION >= 32321) {
if (PMA_MYSQL_INT_VERSION >= 32321) {
// Whether to quote table and fields names or not
if ($use_backquotes) {
mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1');
} else {
mysql_query('SET SQL_QUOTE_SHOW_CREATE = 0');
}
$result = mysql_query('SHOW CREATE TABLE ' . backquote($db) . '.' . backquote($table));
$result = mysql_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table));
if ($result != FALSE && mysql_num_rows($result) > 0) {
$tmpres = mysql_fetch_array($result);
$schema_create .= str_replace("\n", $crlf, html_format($tmpres[1]));
$schema_create .= str_replace("\n", $crlf, PMA_htmlFormat($tmpres[1]));
}
mysql_free_result($result);
return $schema_create;
} // end if MySQL >= 3.23.20
// For MySQL < 3.23.20
$schema_create .= 'CREATE TABLE ' . html_format(backquote($table), $use_backquotes) . ' (' . $crlf;
$schema_create .= 'CREATE TABLE ' . PMA_htmlFormat(PMA_backquote($table), $use_backquotes) . ' (' . $crlf;
$local_query = 'SHOW FIELDS FROM ' . backquote($db) . '.' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $error_url);
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
while ($row = mysql_fetch_array($result)) {
$schema_create .= ' ' . html_format(backquote($row['Field'], $use_backquotes)) . ' ' . $row['Type'];
$schema_create .= ' ' . PMA_htmlFormat(PMA_backquote($row['Field'], $use_backquotes)) . ' ' . $row['Type'];
if (isset($row['Default']) && $row['Default'] != '') {
$schema_create .= ' DEFAULT \'' . html_format(sql_addslashes($row['Default'])) . '\'';
$schema_create .= ' DEFAULT \'' . PMA_htmlFormat(PMA_sqlAddslashes($row['Default'])) . '\'';
}
if ($row['Null'] != 'YES') {
$schema_create .= ' NOT NULL';
@@ -96,8 +96,8 @@ if (!defined('__LIB_BUILD_DUMP__')){
mysql_free_result($result);
$schema_create = ereg_replace(',' . $crlf . '$', '', $schema_create);
$local_query = 'SHOW KEYS FROM ' . backquote($db) . '.' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $error_url);
$local_query = 'SHOW KEYS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
while ($row = mysql_fetch_array($result))
{
$kname = $row['Key_name'];
@@ -114,9 +114,9 @@ if (!defined('__LIB_BUILD_DUMP__')){
$index[$kname] = array();
}
if ($sub_part > 1) {
$index[$kname][] = html_format(backquote($row['Column_name'], $use_backquotes)) . '(' . $sub_part . ')';
$index[$kname][] = PMA_htmlFormat(PMA_backquote($row['Column_name'], $use_backquotes)) . '(' . $sub_part . ')';
} else {
$index[$kname][] = html_format(backquote($row['Column_name'], $use_backquotes));
$index[$kname][] = PMA_htmlFormat(PMA_backquote($row['Column_name'], $use_backquotes));
}
} // end while
mysql_free_result($result);
@@ -138,7 +138,7 @@ if (!defined('__LIB_BUILD_DUMP__')){
$schema_create .= $crlf . ')';
return $schema_create;
} // end of the 'get_table_def()' function
} // end of the 'PMA_getTableDef()' function
/**
@@ -162,24 +162,24 @@ if (!defined('__LIB_BUILD_DUMP__')){
* @global boolean whether to use backquotes to allow the use of special
* characters in database, table and fields names or not
*
* @access private
* @access private
*
* @see get_table_content()
* @see PMA_getTableContent()
*
* @author staybyte
*/
function get_table_content_fast($db, $table, $add_query = '', $handler, $error_url)
function PMA_getTableContentFast($db, $table, $add_query = '', $handler, $error_url)
{
global $use_backquotes;
$local_query = 'SELECT * FROM ' . backquote($db) . '.' . backquote($table) . $add_query;
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $error_url);
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
if ($result != FALSE) {
$fields_cnt = mysql_num_fields($result);
// Checks whether the field is an integer or not
for ($j = 0; $j < $fields_cnt; $j++) {
$field_set[$j] = backquote(mysql_field_name($result, $j), $use_backquotes);
$field_set[$j] = PMA_backquote(mysql_field_name($result, $j), $use_backquotes);
$type = mysql_field_type($result, $j);
if ($type == 'tinyint' || $type == 'smallint' || $type == 'mediumint' || $type == 'int' ||
$type == 'bigint' ||$type == 'timestamp') {
@@ -192,10 +192,10 @@ if (!defined('__LIB_BUILD_DUMP__')){
// Sets the scheme
if (isset($GLOBALS['showcolumns'])) {
$fields = implode(', ', $field_set);
$schema_insert = 'INSERT INTO ' . backquote(html_format($table), $use_backquotes)
. ' (' . html_format($fields) . ') VALUES (';
$schema_insert = 'INSERT INTO ' . PMA_backquote(PMA_htmlFormat($table), $use_backquotes)
. ' (' . PMA_htmlFormat($fields) . ') VALUES (';
} else {
$schema_insert = 'INSERT INTO ' . backquote(html_format($table), $use_backquotes)
$schema_insert = 'INSERT INTO ' . PMA_backquote(PMA_htmlFormat($table), $use_backquotes)
. ' VALUES (';
}
@@ -216,7 +216,7 @@ if (!defined('__LIB_BUILD_DUMP__')){
}
// a string
else {
$values[] = "'" . str_replace($search, $replace, sql_addslashes($row[$j])) . "'";
$values[] = "'" . str_replace($search, $replace, PMA_sqlAddslashes($row[$j])) . "'";
}
} else {
$values[] = "''";
@@ -250,7 +250,7 @@ if (!defined('__LIB_BUILD_DUMP__')){
mysql_free_result($result);
return TRUE;
} // end of the 'get_table_content_fast()' function
} // end of the 'PMA_getTableContentFast()' function
/**
@@ -274,16 +274,16 @@ if (!defined('__LIB_BUILD_DUMP__')){
* @global boolean whether to use backquotes to allow the use of special
* characters in database, table and fields names or not
*
* @access private
* @access private
*
* @see get_table_content()
* @see PMA_getTableContent()
*/
function get_table_content_old($db, $table, $add_query = '', $handler, $error_url)
function PMA_getTableContentOld($db, $table, $add_query = '', $handler, $error_url)
{
global $use_backquotes;
$local_query = 'SELECT * FROM ' . backquote($db) . '.' . backquote($table) . $add_query;
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $error_url);
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
$i = 0;
$isFirstRow = TRUE;
$fields_cnt = mysql_num_fields($result);
@@ -293,7 +293,7 @@ if (!defined('__LIB_BUILD_DUMP__')){
while ($row = mysql_fetch_row($result)) {
$table_list = '(';
for ($j = 0; $j < $fields_cnt; $j++) {
$table_list .= backquote(mysql_field_name($result, $j), $use_backquotes) . ', ';
$table_list .= PMA_backquote(mysql_field_name($result, $j), $use_backquotes) . ', ';
}
$table_list = substr($table_list, 0, -2);
$table_list .= ')';
@@ -302,10 +302,10 @@ if (!defined('__LIB_BUILD_DUMP__')){
$schema_insert = '(';
} else {
if (isset($GLOBALS['showcolumns'])) {
$schema_insert = 'INSERT INTO ' . backquote(html_format($table), $use_backquotes)
. ' ' . html_format($table_list) . ' VALUES (';
$schema_insert = 'INSERT INTO ' . PMA_backquote(PMA_htmlFormat($table), $use_backquotes)
. ' ' . PMA_htmlFormat($table_list) . ' VALUES (';
} else {
$schema_insert = 'INSERT INTO ' . backquote(html_format($table), $use_backquotes)
$schema_insert = 'INSERT INTO ' . PMA_backquote(PMA_htmlFormat($table), $use_backquotes)
. ' VALUES (';
}
$isFirstRow = FALSE;
@@ -357,11 +357,11 @@ if (!defined('__LIB_BUILD_DUMP__')){
}
return TRUE;
} // end of the 'get_table_content_old()' function
} // end of the 'PMA_getTableContentOld()' function
/**
* Dispatches between the versions of 'get_table_content' to use depending
* Dispatches between the versions of 'getTableContent' to use depending
* on the php version
*
* Last revision 13 July 2001: Patch for limiting dump size from
@@ -376,13 +376,13 @@ if (!defined('__LIB_BUILD_DUMP__')){
* ($sql_insert)
* @param string the url to go back in case of error
*
* @access public
* @access public
*
* @see get_table_content_fast(), get_table_content_old()
* @see PMA_getTableContentFast(), PMA_getTableContentOld()
*
* @author staybyte
*/
function get_table_content($db, $table, $limit_from = 0, $limit_to = 0, $handler, $error_url)
function PMA_getTableContent($db, $table, $limit_from = 0, $limit_to = 0, $handler, $error_url)
{
// Defines the offsets to use
if ($limit_from > 0) {
@@ -397,12 +397,12 @@ if (!defined('__LIB_BUILD_DUMP__')){
}
// Call the working function depending on the php version
if (PHP_INT_VERSION >= 40005) {
get_table_content_fast($db, $table, $add_query, $handler, $error_url);
if (PMA_PHP_INT_VERSION >= 40005) {
PMA_getTableContentFast($db, $table, $add_query, $handler, $error_url);
} else {
get_table_content_old($db, $table, $add_query, $handler, $error_url);
PMA_getTableContentOld($db, $table, $add_query, $handler, $error_url);
}
} // end of the 'get_table_content()' function
} // end of the 'PMA_getTableContent()' function
/**
@@ -426,9 +426,9 @@ if (!defined('__LIB_BUILD_DUMP__')){
*
* @return boolean always true
*
* @access public
* @access public
*/
function get_table_csv($db, $table, $limit_from = 0, $limit_to = 0, $sep, $enc_by, $esc_by, $handler, $error_url)
function PMA_getTableCsv($db, $table, $limit_from = 0, $limit_to = 0, $sep, $enc_by, $esc_by, $handler, $error_url)
{
global $what;
@@ -473,8 +473,8 @@ if (!defined('__LIB_BUILD_DUMP__')){
}
// Gets the data from the database
$local_query = 'SELECT * FROM ' . backquote($db) . '.' . backquote($table) . $add_query;
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $error_url);
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
$fields_cnt = mysql_num_fields($result);
@set_time_limit($GLOBALS['cfgExecTimeLimit']);
@@ -509,7 +509,7 @@ if (!defined('__LIB_BUILD_DUMP__')){
mysql_free_result($result);
return TRUE;
} // end of the 'get_table_csv()' function
} // end of the 'PMA_getTableCsv()' function
} // $__LIB_BUILD_DUMP__
} // $__PMA_BUILD_DUMP_LIB__
?>

View File

@@ -9,8 +9,8 @@
if (!defined('__LIB_COMMON__')){
define('__LIB_COMMON__', 1);
if (!defined('PMA_COMMON_LIB_INCLUDED')){
define('PMA_COMMON_LIB_INCLUDED', 1);
/**
* Order of sections for common.lib.php3:
@@ -23,24 +23,24 @@ if (!defined('__LIB_COMMON__')){
* the include of libraries/defines.lib.php3 must be after the connection
* to db to get the MySql version
*
* the sql_addslashes() function must be before the connection to db
* the PMA_sqlAddslashes() function must be before the connection to db
*
* the auth() function must be before the connection to db but after the
* pmaIsInto() function
* the PMA_auth() function must be before the connection to db but after
* the PMA_isInto() function
*
* the mysql_die() function must be before the connection to db but after
* the PMA_mysqlDie() function must be before the connection to db but after
* mysql extension has been loaded
*
* ... so the required order is:
*
* - definition of auth()
* - definition of PMA_auth()
* - parsing of the configuration file
* - first load of the libraries/define.lib.php3 library (won't get the
* MySQL release number)
* - load of mysql extension (if necessary)
* - definition of sql_addslashes()
* - definition of mysql_die()
* - definition of pmaIsInto()
* - definition of PMA_sqlAddslashes()
* - definition of PMA_mysqlDie()
* - definition of PMA_isInto()
* - db connection
* - advanced authentication work if required
* - second load of the libraries/define.lib.php3 library to get the MySQL
@@ -67,7 +67,7 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function auth()
function PMA_auth()
{
header('WWW-Authenticate: Basic realm="phpMyAdmin ' . trim($GLOBALS['strRunning']) . ' ' . $GLOBALS['cfgServer']['host'] . '"');
header('HTTP/1.0 401 Unauthorized');
@@ -93,7 +93,7 @@ if (!defined('__LIB_COMMON__')){
<?php
echo "\n";
exit();
} // end of the 'auth()' function
} // end of the 'PMA_auth()' function
/**
@@ -165,8 +165,8 @@ if (!defined('__LIB_COMMON__')){
// If zlib output compression is set in the php configuration file, no
// output buffering should be run
if (PHP_INT_VERSION < 40000
|| (PHP_INT_VERSION >= 40005 && @ini_get('zlib.output_compression'))) {
if (PMA_PHP_INT_VERSION < 40000
|| (PMA_PHP_INT_VERSION >= 40005 && @ini_get('zlib.output_compression'))) {
$cfgOBGzip = FALSE;
}
@@ -176,15 +176,15 @@ if (!defined('__LIB_COMMON__')){
* Loads the mysql extensions if it is not loaded yet
* staybyte - 26. June 2001
*/
if (((PHP_INT_VERSION >= 40000 && !@ini_get('safe_mode'))
|| (PHP_INT_VERSION > 30009 && !@get_cfg_var('safe_mode')))
if (((PMA_PHP_INT_VERSION >= 40000 && !@ini_get('safe_mode'))
|| (PMA_PHP_INT_VERSION > 30009 && !@get_cfg_var('safe_mode')))
&& @function_exists('dl')) {
if (PHP_INT_VERSION < 40000) {
if (PMA_PHP_INT_VERSION < 40000) {
$extension = 'MySQL';
} else {
$extension = 'mysql';
}
if (PMA_WINDOWS) {
if (PMA_IS_WINDOWS) {
$suffix = '.dll';
} else {
$suffix = '.so';
@@ -211,7 +211,7 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function sql_addslashes($a_string = '', $is_like = FALSE)
function PMA_sqlAddslashes($a_string = '', $is_like = FALSE)
{
if ($is_like) {
$a_string = str_replace('\\', '\\\\\\\\', $a_string);
@@ -221,7 +221,7 @@ if (!defined('__LIB_COMMON__')){
$a_string = str_replace('\'', '\\\'', $a_string);
return $a_string;
} // end of the 'sql_addslashes()' function
} // end of the 'PMA_sqlAddslashes()' function
/**
@@ -234,8 +234,8 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function mysql_die($error_message = '', $the_query = '',
$is_modify_link = TRUE, $back_url = '')
function PMA_mysqlDie($error_message = '', $the_query = '',
$is_modify_link = TRUE, $back_url = '')
{
if (!$error_message) {
$error_message = mysql_error();
@@ -276,7 +276,7 @@ if (!defined('__LIB_COMMON__')){
include('./footer.inc.php3');
exit();
} // end of the 'mysql_die()' function
} // end of the 'PMA_mysqlDie()' function
/**
@@ -290,7 +290,7 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function pmaIsInto($toFind = '', &$in)
function PMA_isInto($toFind = '', &$in)
{
$max = count($in);
for ($i = 0; $i < $max && ($toFind != $in[$i]); $i++) {
@@ -298,7 +298,7 @@ if (!defined('__LIB_COMMON__')){
}
return ($i < $max) ? $i : -1;
} // end of the 'pmaIsInto()' function
} // end of the 'PMA_isInto()' function
/**
@@ -349,7 +349,7 @@ if (!defined('__LIB_COMMON__')){
if (strtolower($cfgServer['connect_type']) == 'tcp') {
$cfgServer['socket'] = '';
}
$server_socket = (empty($cfgServer['socket']) || PHP_INT_VERSION < 30010)
$server_socket = (empty($cfgServer['socket']) || PMA_PHP_INT_VERSION < 30010)
? ''
: ':' . $cfgServer['socket'];
@@ -433,7 +433,7 @@ if (!defined('__LIB_COMMON__')){
// Calls the authentication window or store user's login/password
if ($do_auth) {
auth();
PMA_auth();
} else {
if (get_magic_quotes_gpc()) {
$PHP_AUTH_USER = stripslashes($PHP_AUTH_USER);
@@ -465,7 +465,7 @@ if (!defined('__LIB_COMMON__')){
}
} // end if
if (PHP_INT_VERSION >= 40000) {
if (PMA_PHP_INT_VERSION >= 40000) {
$bkp_track_err = @ini_set('track_errors', 1);
}
@@ -491,7 +491,7 @@ if (!defined('__LIB_COMMON__')){
. $cfgServer['host'] . $server_port . $server_socket . ', '
. $cfgServer['stduser'] . ', '
. $cfgServer['stdpass'] . ')';
mysql_die($conn_error, $local_query, FALSE);
PMA_mysqlDie($conn_error, $local_query, FALSE);
} // end if
} // end if
@@ -504,7 +504,7 @@ if (!defined('__LIB_COMMON__')){
if ($userlink == FALSE) {
// Advanced authentication case
if ($cfgServer['adv_auth']) {
auth();
PMA_auth();
}
// Standard authentication case
else if (mysql_error()) {
@@ -518,10 +518,10 @@ if (!defined('__LIB_COMMON__')){
. $cfgServer['host'] . $server_port . $server_socket . ', '
. $cfgServer['user'] . ', '
. $cfgServer['password'] . ')';
mysql_die($conn_error, $local_query, FALSE);
PMA_mysqlDie($conn_error, $local_query, FALSE);
} // end if
if (PHP_INT_VERSION >= 40000) {
if (PMA_PHP_INT_VERSION >= 40000) {
@ini_set('track_errors', $bkp_track_err);
}
@@ -549,7 +549,7 @@ if (!defined('__LIB_COMMON__')){
}
// Debug
// else if (mysql_error()) {
// mysql_die('', $local_query, FALSE);
// PMA_mysqlDie('', $local_query, FALSE);
// }
while ($row = @mysql_fetch_array($rs)) {
$true_dblist[] = $row['Database'];
@@ -570,8 +570,8 @@ if (!defined('__LIB_COMMON__')){
else {
$auth_query = 'SELECT User, Select_priv '
. 'FROM mysql.user '
. 'WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'';
$rs = mysql_query($auth_query, $dbh); // Debug: or mysql_die('', $auth_query, FALSE);
. 'WHERE User = \'' . PMA_sqlAddslashes($cfgServer['user']) . '\'';
$rs = mysql_query($auth_query, $dbh); // Debug: or PMA_mysqlDie('', $auth_query, FALSE);
} // end if
// Access to "mysql" db allowed -> gets the usable db list
@@ -590,11 +590,11 @@ if (!defined('__LIB_COMMON__')){
// expressions.
if ($row['Select_priv'] != 'Y') {
// lem9: User can be blank (anonymous user)
$local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Select_priv = \'Y\' AND (User = \'' . sql_addslashes($cfgServer['user']) . '\' OR User = \'\')';
$rs = mysql_query($local_query, $dbh); // Debug: or mysql_die('', $local_query, FALSE);
$local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Select_priv = \'Y\' AND (User = \'' . PMA_sqlAddslashes($cfgServer['user']) . '\' OR User = \'\')';
$rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
if (@mysql_numrows($rs) <= 0) {
$local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . sql_addslashes($cfgServer['user']) . '\'';
$rs = mysql_query($local_query, $dbh); // Debug: or mysql_die('', $local_query, FALSE);
$local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($cfgServer['user']) . '\'';
$rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
if (@mysql_numrows($rs)) {
while ($row = mysql_fetch_array($rs)) {
$dblist[] = $row['Db'];
@@ -680,7 +680,7 @@ if (!defined('__LIB_COMMON__')){
* @global array the list of available databases
* @global integer the number of available databases
*/
function available_databases($error_url = '')
function PMA_availableDatabases($error_url = '')
{
global $dblist;
global $num_dbs;
@@ -706,7 +706,7 @@ if (!defined('__LIB_COMMON__')){
// 2. Allowed database list is empty -> gets the list of all databases
// on the server
else {
$dbs = mysql_list_dbs() or mysql_die('', 'mysql_list_dbs()', FALSE, $error_url);
$dbs = mysql_list_dbs() or PMA_mysqlDie('', 'mysql_list_dbs()', FALSE, $error_url);
$num_dbs = @mysql_num_rows($dbs);
$real_num_dbs = 0;
for ($i = 0; $i < $num_dbs; $i++) {
@@ -722,7 +722,7 @@ if (!defined('__LIB_COMMON__')){
} // end else
return TRUE;
} // end of the 'available_databases()' function
} // end of the 'PMA_availableDatabases()' function
/**
@@ -755,31 +755,31 @@ if (!defined('__LIB_COMMON__')){
*
* @version 1.1
*/
function set_font_sizes()
function PMA_setFontSizes()
{
global $font_size, $font_bigger, $font_smaller, $font_smallest;
// IE (<6)/Opera for win case: needs smaller fonts than anyone else
if (USR_OS == 'Win'
&& ((USR_BROWSER_AGENT == 'IE' && USR_BROWSER_VER < 6) || USR_BROWSER_AGENT == 'OPERA')) {
if (PMA_USR_OS == 'Win'
&& ((PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 6) || PMA_USR_BROWSER_AGENT == 'OPERA')) {
$font_size = 'x-small';
$font_bigger = 'large';
$font_smaller = '90%';
$font_smallest = '7pt';
}
// IE6 and other browsers for win case
else if (USR_OS == 'Win') {
else if (PMA_USR_OS == 'Win') {
$font_size = 'small';
$font_bigger = 'large';
$font_smaller = (USR_BROWSER_AGENT == 'IE')
$font_smaller = (PMA_USR_BROWSER_AGENT == 'IE')
? '90%'
: 'x-small';
$font_smallest = 'x-small';
}
// Mac browsers: need bigger fonts except IE 5+ & NS 6+
else if (USR_OS == 'Mac'
&& ((USR_BROWSER_AGENT != 'IE' && USR_BROWSER_AGENT != 'MOZILLA')
|| USR_BROWSER_VER < 5)) {
else if (PMA_USR_OS == 'Mac'
&& ((PMA_USR_BROWSER_AGENT != 'IE' && PMA_USR_BROWSER_AGENT != 'MOZILLA')
|| PMA_USR_BROWSER_VER < 5)) {
$font_size = 'medium';
$font_bigger = 'x-large';
$font_smaller = 'small';
@@ -794,7 +794,7 @@ if (!defined('__LIB_COMMON__')){
}
return true;
} // end of the 'set_font_sizes()' function
} // end of the 'PMA_setFontSizes()' function
/**
@@ -811,16 +811,16 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function backquote($a_name, $do_it = TRUE)
function PMA_backquote($a_name, $do_it = TRUE)
{
if ($do_it
&& MYSQL_INT_VERSION >= 32306
&& PMA_MYSQL_INT_VERSION >= 32306
&& !empty($a_name) && $a_name != '*') {
return '`' . $a_name . '`';
} else {
return $a_name;
}
} // end of the 'backquote()' function
} // end of the 'PMA_backquote()' function
/**
@@ -835,7 +835,7 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function js_format($a_string = '', $add_backquotes = TRUE)
function PMA_jsFormat($a_string = '', $add_backquotes = TRUE)
{
if (is_string($a_string)) {
$a_string = str_replace('"', '&quot;', $a_string);
@@ -846,8 +846,8 @@ if (!defined('__LIB_COMMON__')){
$a_string = str_replace("\015", '\\\\r', $a_string);
}
return (($add_backquotes) ? backquote($a_string) : $a_string);
} // end of the 'js_format()' function
return (($add_backquotes) ? PMA_backquote($a_string) : $a_string);
} // end of the 'PMA_jsFormat()' function
/**
@@ -857,17 +857,17 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function which_crlf()
function PMA_whichCrlf()
{
$the_crlf = "\n";
// The 'USR_OS' constant is defined in "./libraries/defines.lib.php3"
// The 'PMA_USR_OS' constant is defined in "./libraries/defines.lib.php3"
// Win case
if (USR_OS == 'Win') {
if (PMA_USR_OS == 'Win') {
$the_crlf = "\r\n";
}
// Mac case
else if (USR_OS == 'Mac') {
else if (PMA_USR_OS == 'Mac') {
$the_crlf = "\r";
}
// Others
@@ -876,7 +876,7 @@ if (!defined('__LIB_COMMON__')){
}
return $the_crlf;
} // end of the 'which_crlf()' function
} // end of the 'PMA_whichCrlf()' function
/**
@@ -893,9 +893,9 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function count_records($db, $table, $ret = FALSE)
function PMA_countRecords($db, $table, $ret = FALSE)
{
$result = mysql_query('SELECT COUNT(*) AS num FROM ' . backquote($db) . '.' . backquote($table));
$result = mysql_query('SELECT COUNT(*) AS num FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table));
$num = mysql_result($result, 0, 'num');
mysql_free_result($result);
if ($ret) {
@@ -904,7 +904,7 @@ if (!defined('__LIB_COMMON__')){
echo number_format($num, 0, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator']);
return TRUE;
}
} // end of the 'count_records()' function
} // end of the 'PMA_countRecords()' function
/**
@@ -914,7 +914,7 @@ if (!defined('__LIB_COMMON__')){
*
* @access public
*/
function show_message($message)
function PMA_showMessage($message)
{
// Reloads the navigation frame via JavaScript if required
if (isset($GLOBALS['reload']) && $GLOBALS['reload']) {
@@ -989,7 +989,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
</table>
</div><br />
<?php
} // end of the 'show_message()' function
} // end of the 'PMA_showMessage()' function
/**
@@ -1001,12 +1001,12 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
*
* @access public
*/
function show_docu($link)
function PMA_showDocu($link)
{
if (!empty($GLOBALS['cfgManualBase'])) {
return '[<a href="' . $GLOBALS['cfgManualBase'] . '/' . $link .'" target="mysql_doc">' . $GLOBALS['strDocu'] . '</a>]';
}
} // end of the 'show_docu()' function
} // end of the 'PMA_showDocu()' function
/**
@@ -1023,7 +1023,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
* @author staybyte
* @version 1.1 - 07 July 2001
*/
function format_byte_down($value, $limes = 6, $comma = 0)
function PMA_formatByteDown($value, $limes = 6, $comma = 0)
{
$dh = pow(10, $comma);
$li = pow(10, $limes);
@@ -1049,7 +1049,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
}
return array($return_value, $unit);
} // end of the 'format_byte_down' function
} // end of the 'PMA_formatByteDown' function
/**
@@ -1065,7 +1065,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
*
* @author Dell'Aiera Pol; Olivier Blin
*/
function check_reserved_words($the_name, $error_url)
function PMA_checkReservedWords($the_name, $error_url)
{
// The name contains caracters <> a-z, A-Z and "_" -> not a reserved
// word
@@ -1086,11 +1086,11 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
$word_cnt = count($word_list);
for ($i = 0; $i < $word_cnt; $i++) {
if (strtolower($the_name) == $word_list[$i]) {
mysql_die(sprintf($GLOBALS['strInvalidName'], $the_name), '', FALSE, $error_url);
PMA_mysqlDie(sprintf($GLOBALS['strInvalidName'], $the_name), '', FALSE, $error_url);
} // end if
} // end for
} // end if
} // end of the 'check_reserved_words' function
} // end of the 'PMA_checkReservedWords' function
/**
@@ -1102,7 +1102,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
*
* @access public
*/
function localised_date($timestamp = -1)
function PMA_localisedDate($timestamp = -1)
{
global $datefmt, $month, $day_of_week;
@@ -1114,7 +1114,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
$date = ereg_replace('%[bB]', $month[(int)strftime('%m', $timestamp)-1], $date);
return strftime($date, $timestamp);
} // end of the 'localised_date()' function
} // end of the 'PMA_localisedDate()' function
} // $__LIB_COMMON__
} // $__PMA_COMMON_LIB__
?>

View File

@@ -5,23 +5,23 @@
/**
* DEFINES VARIABLES & CONSTANTS
* Overview:
* PHPMYADMIN_VERSION (string) - phpMyAdmin version string
* PHP_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or
* PMA_VERSION (string) - phpMyAdmin version string
* PMA_PHP_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or
* 40006 instead of 4.0.6RC3
* PMA_WINDOWS (bool) - mark if phpMyAdmin running on windows
* server
* MYSQL_INT_VERSION (int) - eg: 32339 instead of 3.23.39
* USR_OS (string) - the plateform (os) of the user
* USR_BROWSER_AGENT (string) - the browser of the user
* USR_BROWSER_VER (double) - the version of this browser
* PMA_IS_WINDOWS (bool) - mark if phpMyAdmin running on windows
* server
* PMA_MYSQL_INT_VERSION (int) - eg: 32339 instead of 3.23.39
* PMA_USR_OS (string) - the plateform (os) of the user
* PMA_USR_BROWSER_AGENT (string) - the browser of the user
* PMA_USR_BROWSER_VER (double) - the version of this browser
*/
// phpMyAdmin release
if (!defined('PHPMYADMIN_VERSION')) {
define('PHPMYADMIN_VERSION', '2.2.2-rc1');
if (!defined('PMA_VERSION')) {
define('PMA_VERSION', '2.2.2-rc1');
}
// php version
if (!defined('PHP_INT_VERSION')) {
if (!defined('PMA_PHP_INT_VERSION')) {
if (!ereg('([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})', phpversion(), $match)) {
$result = ereg('([0-9]{1,2}).([0-9]{1,2})', phpversion(), $match);
}
@@ -32,24 +32,24 @@ if (!defined('PHP_INT_VERSION')) {
if (!isset($match[3])) {
$match[3] = 0;
}
define('PHP_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
define('PMA_PHP_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
unset($match);
} else {
define('PHP_INT_VERSION', 0);
define('PMA_PHP_INT_VERSION', 0);
}
}
// Whether the os php is running on is windows or not
if (!defined('PMA_WINDOWS')) {
if (!defined('PMA_IS_WINDOWS')) {
if (defined('PHP_OS') && eregi('win', PHP_OS)) {
define('PMA_WINDOWS', 1);
define('PMA_IS_WINDOWS', 1);
} else {
define('PMA_WINDOWS', 0);
define('PMA_IS_WINDOWS', 0);
}
}
// MySQL Version
if (!defined('MYSQL_MAJOR_VERSION') && isset($userlink)) {
if (!defined('PMA_MYSQL_INT_VERSION') && isset($userlink)) {
if (!empty($server)) {
$result = mysql_query('SELECT VERSION() AS version');
if ($result != FALSE && @mysql_num_rows($result) > 0) {
@@ -74,7 +74,7 @@ if (!defined('MYSQL_MAJOR_VERSION') && isset($userlink)) {
$match[2] = 0;
}
define('MYSQL_INT_VERSION', (int)sprintf('%d%02d%02d', $match[0], $match[1], intval($match[2])));
define('PMA_MYSQL_INT_VERSION', (int)sprintf('%d%02d%02d', $match[0], $match[1], intval($match[2])));
unset($match);
}
@@ -82,38 +82,38 @@ if (!defined('MYSQL_MAJOR_VERSION') && isset($userlink)) {
// Determines platform (OS), browser and version of the user
// Based on a phpBuilder article:
// see http://www.phpbuilder.net/columns/tim20000821.php3
if (!defined('USR_OS')) {
if (!defined('PMA_USR_OS')) {
if (!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
}
// 1. Platform
if (strstr($HTTP_USER_AGENT, 'Win')) {
define('USR_OS', 'Win');
define('PMA_USR_OS', 'Win');
} else if (strstr($HTTP_USER_AGENT, 'Mac')) {
define('USR_OS', 'Mac');
define('PMA_USR_OS', 'Mac');
} else if (strstr($HTTP_USER_AGENT, 'Linux')) {
define('USR_OS', 'Linux');
define('PMA_USR_OS', 'Linux');
} else if (strstr($HTTP_USER_AGENT, 'Unix')) {
define('USR_OS', 'Unix');
define('PMA_USR_OS', 'Unix');
} else {
define('USR_OS', 'Other');
define('PMA_USR_OS', 'Other');
}
// 2. browser and version
if (ereg('MSIE ([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
define('USR_BROWSER_VER', $log_version[1]);
define('USR_BROWSER_AGENT', 'IE');
define('PMA_USR_BROWSER_VER', $log_version[1]);
define('PMA_USR_BROWSER_AGENT', 'IE');
} else if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
define('USR_BROWSER_VER', $log_version[2]);
define('USR_BROWSER_AGENT', 'OPERA');
define('PMA_USR_BROWSER_VER', $log_version[2]);
define('PMA_USR_BROWSER_AGENT', 'OPERA');
} else if (ereg('Mozilla/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
define('USR_BROWSER_VER', $log_version[1]);
define('USR_BROWSER_AGENT', 'MOZILLA');
define('PMA_USR_BROWSER_VER', $log_version[1]);
define('PMA_USR_BROWSER_AGENT', 'MOZILLA');
} else if (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
define('USR_BROWSER_VER', $log_version[1]);
define('USR_BROWSER_AGENT', 'KONQUEROR');
define('PMA_USR_BROWSER_VER', $log_version[1]);
define('PMA_USR_BROWSER_AGENT', 'KONQUEROR');
} else {
define('USR_BROWSER_VER', 0);
define('USR_BROWSER_AGENT', 'OTHER');
define('PMA_USR_BROWSER_VER', 0);
define('PMA_USR_BROWSER_AGENT', 'OTHER');
}
}
} // $__PMA_DEFINES_LIB__
?>

View File

@@ -8,8 +8,8 @@
if (!defined('__LIB_DISPLAY_TBL__')){
define('__LIB_DISPLAY_TBL__', 1);
if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
define('PMA_DISPLAY_TBL_LIB_INCLUDED', 1);
/**
* Defines the display mode to use for the results of a sql query
@@ -45,11 +45,11 @@ if (!defined('__LIB_DISPLAY_TBL__')){
* @global string the url to return to in case of error in a sql
* statement
*
* @access private
* @access private
*
* @see display_table()
* @see PMA_displayTable()
*/
function set_display_mode(&$the_disp_mode, &$the_total)
function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
{
global $db, $table;
global $unlim_num_rows, $fields_meta;
@@ -140,8 +140,8 @@ if (!defined('__LIB_DISPLAY_TBL__')){
}
else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
&& (!empty($db) && !empty($table))) {
$local_query = 'SELECT COUNT(*) AS total FROM ' . backquote($db) . '.' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SELECT COUNT(*) AS total FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$the_total = mysql_result($result, 0, 'total');
mysql_free_result($result);
}
@@ -160,7 +160,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){
$the_disp_mode = join('', $do_display);
return $do_display;
} // end of the 'set_display_mode()' function
} // end of the 'PMA_setDisplayMode()' function
/**
@@ -184,11 +184,11 @@ if (!defined('__LIB_DISPLAY_TBL__')){
* @global boolean whether to limit the number of displayed characters of
* text type fields or not
*
* @access private
* @access private
*
* @see display_table()
* @see PMA_displayTable()
*/
function display_table_navigation($pos_next, $pos_prev, $encoded_query)
function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query)
{
global $lang, $server, $db, $table;
global $goto;
@@ -348,7 +348,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){
</table>
<?php
} // end of the 'display_table_navigation()' function
} // end of the 'PMA_displayTableNavigation()' function
/**
@@ -374,11 +374,11 @@ if (!defined('__LIB_DISPLAY_TBL__')){
* @global boolean whether to limit the number of displayed characters of
* text type fields or not
*
* @access private
* @access private
*
* @see display_table()
* @see PMA_displayTable()
*/
function display_table_headers(&$is_display, &$fields_meta, $fields_cnt = 0, $encoded_query = '')
function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $encoded_query = '')
{
global $lang, $server, $db, $table;
global $goto;
@@ -482,7 +482,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){
// isn't aliased)
if ($is_join
&& !eregi('([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name, $select_stt[1], $parts)) {
$sort_tbl = backquote($fields_meta[$i]->table) . '.';
$sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.';
} else {
$sort_tbl = '';
}
@@ -493,15 +493,15 @@ if (!defined('__LIB_DISPLAY_TBL__')){
if ($cfgOrder == 'SMART') {
$cfgOrder = (eregi('time|date', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
}
$sort_order = ' ORDER BY ' . $sort_tbl . backquote($fields_meta[$i]->name) . ' ' . $cfgOrder;
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ' . $cfgOrder;
$order_img = '';
}
else if (substr($sql_order, -3) == 'ASC' && $is_in_sort) {
$sort_order = ' ORDER BY ' . $sort_tbl . backquote($fields_meta[$i]->name) . ' DESC';
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' DESC';
$order_img = '&nbsp;<img src="./images/asc_order.gif" border="0" width="7" height="7" alt="ASC" />';
}
else if (substr($sql_order, -4) == 'DESC' && $is_in_sort) {
$sort_order = ' ORDER BY ' . $sort_tbl . backquote($fields_meta[$i]->name) . ' ASC';
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ASC';
$order_img = '&nbsp;<img src="./images/desc_order.gif" border="0" width="7" height="7" alt="DESC" />';
}
if (eregi('(.*)( LIMIT (.*)| PROCEDURE (.*)| FOR UPDATE| LOCK IN SHARE MODE)', $unsorted_sql_query, $regs3)) {
@@ -563,7 +563,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){
echo "\n";
return true;
} // end of the 'display_table_headers()' function
} // end of the 'PMA_displayTableHeaders()' function
/**
@@ -591,11 +591,11 @@ if (!defined('__LIB_DISPLAY_TBL__')){
* @global boolean whether to limit the number of displayed characters of
* text type fields or not
*
* @access private
* @access private
*
* @see display_table()
* @see PMA_displayTable()
*/
function display_table_body(&$dt_result, &$is_display)
function PMA_displayTableBody(&$dt_result, &$is_display)
{
global $lang, $server, $db, $table;
global $goto;
@@ -643,12 +643,12 @@ if (!defined('__LIB_DISPLAY_TBL__')){
if ($is_display['edit_lnk'] == 'ur' /* || $is_display['edit_lnk'] == 'dr' */) {
for ($i = 0; $i < $fields_cnt; ++$i) {
$primary = $fields_meta[$i];
$condition = ' ' . backquote($primary->name) . ' ';
$condition = ' ' . PMA_backquote($primary->name) . ' ';
if (!isset($row[$primary->name])
|| (function_exists('is_null') && is_null($row[$primary->name]))) {
$condition .= 'IS NULL AND';
} else {
$condition .= '= \'' . sql_addslashes($row[$primary->name]) . '\' AND';
$condition .= '= \'' . PMA_sqlAddslashes($row[$primary->name]) . '\' AND';
}
if ($primary->primary_key > 0) {
$primary_key .= $condition;
@@ -706,11 +706,11 @@ if (!defined('__LIB_DISPLAY_TBL__')){
. '&goto=tbl_properties.php3';
$del_url = 'sql.php3'
. '?' . $url_query
. '&amp;sql_query=' . urlencode('DELETE FROM ' . backquote($table) . ' WHERE') . $uva_condition . urlencode(' LIMIT 1')
. '&amp;sql_query=' . urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . urlencode(' LIMIT 1')
. '&amp;zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
. '&amp;goto=' . urlencode($goto);
$js_conf = 'DELETE FROM ' . js_format($table)
. ' WHERE ' . trim(js_format(urldecode($uva_condition), FALSE)) . ' LIMIT 1';
$js_conf = 'DELETE FROM ' . PMA_jsFormat($table)
. ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), FALSE)) . ' LIMIT 1';
$del_str = $GLOBALS['strDelete'];
} else if ($is_display['del_lnk'] == 'kp') { // kill process case
$goto = 'sql.php3'
@@ -846,7 +846,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){
} // end while
return true;
} // end of the 'display_table_body()' function
} // end of the 'PMA_displayTableBody()' function
/**
@@ -874,12 +874,12 @@ if (!defined('__LIB_DISPLAY_TBL__')){
* @global boolean whether to limit the number of displayed characters of
* text type fields or not
*
* @access private
* @access private
*
* @see show_message(), set_display_mode(), display_table_navigation(),
* display_table_headers(), display_table_body()
* @see PMA_showMessage(), PMA_setDisplayMode(), PMA_displayTableNavigation(),
* PMA_displayTableHeaders(), PMA_displayTableBody()
*/
function display_table(&$dt_result, &$the_disp_mode)
function PMA_displayTable(&$dt_result, &$the_disp_mode)
{
global $lang, $server, $db, $table;
global $goto;
@@ -891,7 +891,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){
// 1.1 Gets the informations about which functionnalities should be
// displayed
$total = '';
$is_display = set_display_mode($the_disp_mode, $total);
$is_display = PMA_setDisplayMode($the_disp_mode, $total);
if ($total == '') {
unset($total);
}
@@ -934,9 +934,9 @@ if (!defined('__LIB_DISPLAY_TBL__')){
$last_shown_rec = ($GLOBALS['session_max_rows'] == 'all' || $pos_next > $total)
? $total
: $pos_next;
show_message($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec ($total " . $GLOBALS['strTotal'] . $selectstring . ')');
PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec ($total " . $GLOBALS['strTotal'] . $selectstring . ')');
} else {
show_message($GLOBALS['strSQLQuery']);
PMA_showMessage($GLOBALS['strSQLQuery']);
}
// 2.3 Displays the navigation bars
@@ -944,7 +944,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){
$table = $fields_meta[0]->table;
}
if ($is_display['nav_bar'] == '1') {
display_table_navigation($pos_next, $pos_prev, $encoded_sql_query);
PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
echo "\n";
} else {
echo "\n" . '<br /><br />' . "\n";
@@ -957,8 +957,8 @@ if (!defined('__LIB_DISPLAY_TBL__')){
<table border="<?php echo $GLOBALS['cfgBorder']; ?>" cellpadding="5">
<?php
echo "\n";
display_table_headers($is_display, $fields_meta, $fields_cnt, $encoded_sql_query);
display_table_body($dt_result, $is_display);
PMA_displayTableHeaders($is_display, $fields_meta, $fields_cnt, $encoded_sql_query);
PMA_displayTableBody($dt_result, $is_display);
?>
</table>
<br />
@@ -968,11 +968,11 @@ if (!defined('__LIB_DISPLAY_TBL__')){
// 4. ----- Displays the navigation bar at the bottom if required -----
if ($is_display['nav_bar'] == '1') {
display_table_navigation($pos_next, $pos_prev, $encoded_sql_query);
PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
} else {
echo "\n" . '<br />' . "\n";
}
} // end of the 'display_table()' function
} // end of the 'PMA_displayTable()' function
} // $__LIB_DISPLAY_TBL__
} $__PMA_DISPLAY_TBL_LIB__
?>

View File

@@ -7,8 +7,8 @@
* script in the '$HTTP_*_VARS' arrays and sets simple globals variables from
* them
*/
if (!defined('__LIB_GRAB_GLOBALS__')) {
define('__LIB_GRAB_GLOBALS__', 1);
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
define('PMA_GRAB_GLOBALS_INCLUDED', 1);
if (!empty($HTTP_GET_VARS)) {
extract($HTTP_GET_VARS);
@@ -24,5 +24,5 @@ if (!defined('__LIB_GRAB_GLOBALS__')) {
}
} // end if
} // end __LIB_GRAB_GLOBALS__
} // $__PMA_GRAB_GLOBALS_LIB__
?>

View File

@@ -2,8 +2,8 @@
/* $Id$ */
if (!defined('__OB_LIB__')) {
define('__OB_LIB__', 1);
if (!defined('PMA_OB_LIB_INCLUDED')) {
define('PMA_OB_LIB_INCLUDED', 1);
# Output buffer functions for phpMyAdmin
#
@@ -20,9 +20,9 @@ if (!defined('__OB_LIB__')) {
*
* @return integer the output buffer mode
*/
function out_buffer_mode_get()
function PMA_outBufferModeGet()
{
if (PHP_INT_VERSION >= 40000 && @function_exists('ob_start')) {
if (PMA_PHP_INT_VERSION >= 40000 && @function_exists('ob_start')) {
$mode = 1;
} else {
$mode = 0;
@@ -31,14 +31,14 @@ if (!defined('__OB_LIB__')) {
// If a user sets the output_handler in php.ini to ob_gzhandler, then
// any right frame file in phpMyAdmin will not be handled properly by
// the browser. My fix was to check the ini file within the
// out_buffer_mode_get() function.
// PMA_outBufferModeGet() function.
//
// (Patch by Garth Gillespie, modified by Marc Delisle)
if (PHP_INT_VERSION >= 40000 && @ini_get('output_handler')) {
if (PMA_PHP_INT_VERSION >= 40000 && @ini_get('output_handler')) {
if (@ini_get('output_handler') == 'ob_gzhandler') {
$mode = 0;
}
} else if (PHP_INT_VERSION >= 40000) {
} else if (PMA_PHP_INT_VERSION >= 40000) {
if (@get_cfg_var('output_handler') == 'ob_gzhandler') {
$mode = 0;
}
@@ -53,19 +53,19 @@ if (!defined('__OB_LIB__')) {
header('X-ob_mode: ' . $mode);
return $mode;
} // end of the 'out_buffer_mode_get()' function
} // end of the 'PMA_outBufferModeGet()' function
/**
* This function will need to run at the top of all pages if output
* output buffering is turned on. It also needs to be passed $mode from
* the out_buffer_mode_get() function or it will be useless.
* the PMA_outBufferModeGet() function or it will be useless.
*
* @param integer the output buffer mode
*
* @return boolean whether output buffering is enabled or not
*/
function out_buffer_pre($mode)
function PMA_outBufferPre($mode)
{
switch($mode)
{
@@ -85,19 +85,19 @@ if (!defined('__OB_LIB__')) {
} // end switch
return $retval;
} // end of the 'out_buffer_pre()' function
} // end of the 'PMA_outBufferPre()' function
/**
* This function will need to run at the bottom of all pages if output
* buffering is turned on. It also needs to be passed $mode from the
* out_buffer_mode_get() function or it will be useless.
* PMA_outBufferModeGet() function or it will be useless.
*
* @param integer the output buffer mode
*
* @return boolean whether data has been send from the buffer or not
*/
function out_buffer_post($mode)
function PMA_outBufferPost($mode)
{
switch($mode)
{
@@ -117,8 +117,8 @@ if (!defined('__OB_LIB__')) {
} // end switch
return $retval;
} // end of the 'out_buffer_post()' function
} // end of the 'PMA_outBufferPost()' function
} // $__OB_LIB__
} // $__PMA_OB_LIB__
?>

View File

@@ -74,8 +74,8 @@ $available_languages = array(
);
if (!defined('__PMA_LANG_DETECT__')) {
define('__PMA_LANG_DETECT__', 1);
if (!defined('PMA_IS_LANG_DETECT_FUNCTION')) {
define('PMA_IS_LANG_DETECT_FUNCTION', 1);
/**
* Analyzes some PHP environment variables to find the most probable language
@@ -89,7 +89,7 @@ if (!defined('__PMA_LANG_DETECT__')) {
*
* @access private
*/
function pma_lang_detect($str = '', $envType = '')
function PMA_langDetect($str = '', $envType = '')
{
global $available_languages;
global $lang;
@@ -104,7 +104,7 @@ if (!defined('__PMA_LANG_DETECT__')) {
break;
}
}
} // end of the 'pmcLangDetect()' function
} // end of the 'PMA_langDetect()' function
} // end if
@@ -150,12 +150,12 @@ if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) {
$acceptedCnt = count($accepted);
reset($accepted);
for ($i = 0; $i < $acceptedCnt && empty($lang); $i++) {
pma_lang_detect($accepted[$i], 1);
PMA_langDetect($accepted[$i], 1);
}
}
// 2. try to findout users language by checking it's HTTP_USER_AGENT variable
if (empty($lang) && !empty($HTTP_USER_AGENT)) {
pma_lang_detect($HTTP_USER_AGENT, 2);
PMA_langDetect($HTTP_USER_AGENT, 2);
}
// 3. Didn't catch any valid lang : we use the default settings
@@ -166,4 +166,7 @@ if (empty($lang)) {
// 4. Defines the associated filename and load the translation
$lang_file = $lang_path . $available_languages[$lang][1] . '.inc.php3';
require('./' . $lang_file);
// $__PMA_SELECT_LANG_LIB__
?>

View File

@@ -57,7 +57,7 @@ class zipfile
*
* @access public
*/
function add_file($data, $name)
function addFile($data, $name)
{
$name = str_replace('\\', '/', $name);
@@ -118,7 +118,7 @@ class zipfile
// optional extra field, file comment goes here
// save to central directory
$this -> ctrl_dir[] = $cdrec;
} // end of the 'add_file()' method
} // end of the 'addFile()' method
/**

View File

@@ -21,7 +21,7 @@ if (isset($table)) {
$show_query = 'y';
require('./header.inc.php3');
if (isset($message)) {
show_message($message);
PMA_showMessage($message);
}
else if (isset($reload) && $reload) {
// Reloads the navigation frame via JavaScript if required
@@ -41,20 +41,20 @@ echo "\n";
* Displays the welcome message and the server informations
*/
?>
<h1><?php echo sprintf($strWelcome, ' phpMyAdmin ' . PHPMYADMIN_VERSION); ?></h1>
<h1><?php echo sprintf($strWelcome, ' phpMyAdmin ' . PMA_VERSION); ?></h1>
<?php
// Don't display server info if $server == 0 (no server selected)
if ($server > 0) {
$local_query = 'SELECT VERSION() as version, USER() as user';
$res = mysql_query($local_query) or mysql_die('', $local_query, FALSE, '');
$res = mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, '');
echo '<p><b>MySQL ' . mysql_result($res, 0, 'version') . ' ' . $strRunning . ' ' . $cfgServer['host'];
if (!empty($cfgServer['port'])) {
echo ':' . $cfgServer['port'];
}
// loic1: skip this because it's not a so good idea to display sockets
// used to everybody
// if (!empty($cfgServer['socket']) && PHP_INT_VERSION >= 30010) {
// if (!empty($cfgServer['socket']) && PMA_PHP_INT_VERSION >= 30010) {
// echo ':' . $cfgServer['socket'];
// }
echo ' ' . $strRunningAs . ' ' . mysql_result($res, 0, 'user') . '</b></p><br />' . "\n";
@@ -65,7 +65,7 @@ if ($server > 0) {
* Reload mysql (flush privileges)
*/
if (($server > 0) && isset($mode) && ($mode == 'reload')) {
$result = mysql_query('FLUSH PRIVILEGES'); // Debug: or mysql_die('', 'FLUSH PRIVILEGES', FALSE, 'main.php3?lang=' . $lang . '&amp;server=' . $server);
$result = mysql_query('FLUSH PRIVILEGES'); // Debug: or PMA_mysqlDie('', 'FLUSH PRIVILEGES', FALSE, 'main.php3?lang=' . $lang . '&amp;server=' . $server);
echo '<p><b>';
if ($result != 0) {
echo $strMySQLReloaded;
@@ -111,7 +111,7 @@ if ($server == 0 || count($cfgServers) > 1) {
}
// loic1: skip this because it's not a so good idea to display
// sockets used to everybody
// if (!empty($val['socket']) && PHP_INT_VERSION >= 30010) {
// if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {
// echo ':' . $val['socket'];
// }
}
@@ -157,8 +157,8 @@ if ($server > 0) {
$is_reload_priv = FALSE;
$is_superuser = @mysql_query('USE mysql', $userlink);
if ($dbh) {
$local_query = 'SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\' OR User = \'\'';
$rs_usr = mysql_query($local_query, $dbh); // Debug: or mysql_die('', $local_query, FALSE);
$local_query = 'SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($cfgServer['user']) . '\' OR User = \'\'';
$rs_usr = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
if ($rs_usr) {
$result_usr = mysql_fetch_array($rs_usr);
$is_create_priv = ($result_usr['Create_priv'] == 'Y');
@@ -173,8 +173,8 @@ if ($server > 0) {
// the one he just dropped :)
// (Note: we only get here after a browser reload, I don't know why)
if (!$is_create_priv) {
$local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Create_priv = \'Y\' AND (User = \'' . sql_addslashes($cfgServer['user']) . '\' OR User = \'\')';
$rs_usr = mysql_query($local_query, $dbh); // Debug: or mysql_die('', $local_query, FALSE);
$local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Create_priv = \'Y\' AND (User = \'' . PMA_sqlAddslashes($cfgServer['user']) . '\' OR User = \'\')';
$rs_usr = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
if (@mysql_numrows($rs_usr) > 0) {
while ($row = mysql_fetch_array($rs_usr)) {
if (!mysql_select_db($row['Db'], $dbh)) {
@@ -215,7 +215,7 @@ if ($server > 0) {
<td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
<td>
<form method="post" action="db_create.php3">
<?php echo $strCreateNewDatabase . '&nbsp;' . show_docu('manual_Reference.html#CREATE_DATABASE'); ?><br />
<?php echo $strCreateNewDatabase . '&nbsp;' . PMA_showDocu('manual_Reference.html#CREATE_DATABASE'); ?><br />
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="reload" value="1" />
@@ -240,7 +240,7 @@ if ($server > 0) {
<td>
<a href="sql.php3?<?php echo $common_url_query; ?>&amp;db=mysql&amp;sql_query=<?php echo urlencode('SHOW STATUS'); ?>&amp;goto=main.php3">
<?php echo $strMySQLShowStatus; ?></a>&nbsp;
<?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#SHOW') . "\n"; ?>
</td>
</tr>
<?php
@@ -253,7 +253,7 @@ if ($server > 0) {
<td>
<a href="sql.php3?<?php echo $common_url_query; ?>&amp;db=mysql&amp;sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>&amp;goto=main.php3">
<?php echo $strMySQLShowVars;?></a>&nbsp;
<?php echo show_docu('manual_Performance.html#Performance') . "\n"; ?>
<?php echo PMA_showDocu('manual_Performance.html#Performance') . "\n"; ?>
</td>
</tr>
<?php
@@ -267,7 +267,7 @@ if ($server > 0) {
<td>
<a href="sql.php3?<?php echo $common_url_query; ?>&amp;db=mysql&amp;sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>&amp;goto=main.php3">
<?php echo $strMySQLShowProcess; ?></a>&nbsp;
<?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#SHOW') . "\n"; ?>
</td>
</tr>
<?php
@@ -281,7 +281,7 @@ if ($server > 0) {
<td>
<a href="main.php3?<?php echo $common_url_query; ?>&amp;mode=reload">
<?php echo $strReloadMySQL; ?></a>&nbsp;
<?php echo show_docu('manual_Reference.html#FLUSH') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#FLUSH') . "\n"; ?>
</td>
</tr>
<?php
@@ -295,11 +295,11 @@ if ($server > 0) {
<td>
<a href="user_details.php3?<?php echo $common_url_query; ?>&amp;db=mysql&amp;table=user">
<?php echo $strUsers; ?></a>&nbsp;
<?php echo show_docu('manual_Privilege_system.html#Privilege_system') . "\n"; ?>
<?php echo PMA_showDocu('manual_Privilege_system.html#Privilege_system') . "\n"; ?>
</td>
</tr>
<?php
if (MYSQL_INT_VERSION >= 32303) {
if (PMA_MYSQL_INT_VERSION >= 32303) {
echo "\n";
?>
<tr>
@@ -369,19 +369,19 @@ if (empty($cfgLang)) {
/**
* Sorts available languages by their true names
*
* @param array the array to be sorted
* @param mixed a required parameter
* @param array the array to be sorted
* @param mixed a required parameter
*
* @return the sorted array
* @return the sorted array
*
* @access private
* @access private
*/
function pmaComp(&$a, $b)
function PMA_cmp(&$a, $b)
{
return (strcmp($a[1], $b[1]));
} // end of the 'pmaComp()' function
} // end of the 'PMA_cmp()' function
uasort($available_languages, 'pmaComp');
uasort($available_languages, 'PMA_cmp');
reset($available_languages);
while (list($id, $tmplang) = each($available_languages)) {
$lang_name = ucfirst(substr(strstr($tmplang[0], '|'), 1));

View File

@@ -34,32 +34,32 @@ if (!empty($submit_mult)
switch ($what) {
case 'drop_db':
$full_query .= 'DROP DATABASE '
. backquote(htmlspecialchars(urldecode($selected[$i])))
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
. ';<br />';
break;
case 'drop_tbl':
$full_query .= (empty($full_query) ? 'DROP TABLE ' : ', ')
. backquote(htmlspecialchars(urldecode($selected[$i])))
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
. (($i == $selected_cnt - 1) ? ';<br />' : '');
break;
case 'empty_tbl':
$full_query .= 'DELETE FROM '
. backquote(htmlspecialchars(urldecode($selected[$i])))
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
. ';<br />';
break;
case 'drop_fld':
if ($full_query == '') {
$full_query .= 'ALTER TABLE '
. backquote(htmlspecialchars($table))
. PMA_backquote(htmlspecialchars($table))
. '<br />&nbsp;&nbsp;DROP '
. backquote(htmlspecialchars(urldecode($selected[$i])))
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
. ',';
} else {
$full_query .= '<br />&nbsp;&nbsp;DROP '
. backquote(htmlspecialchars(urldecode($selected[$i])))
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
. ',';
}
if ($i == $selected_cnt-1) {
@@ -111,25 +111,25 @@ else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
switch ($query_type) {
case 'drop_db':
$a_query = 'DROP DATABASE '
. backquote(urldecode($selected[$i]));
. PMA_backquote(urldecode($selected[$i]));
$reload = 1;
break;
case 'drop_tbl':
$sql_query .= (empty($sql_query) ? 'DROP TABLE ' : ', ')
. backquote(urldecode($selected[$i]))
. PMA_backquote(urldecode($selected[$i]))
. (($i == $selected_cnt-1) ? ';' : '');
$reload = 1;
break;
case 'empty_tbl':
$a_query = 'DELETE FROM '
. backquote(urldecode($selected[$i]));
. PMA_backquote(urldecode($selected[$i]));
break;
case 'drop_fld':
$sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . backquote($table) : ',')
. ' DROP ' . backquote(urldecode($selected[$i]))
$sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) : ',')
. ' DROP ' . PMA_backquote(urldecode($selected[$i]))
. (($i == $selected_cnt-1) ? ';' : '');
break;
} // end switch
@@ -141,16 +141,16 @@ else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
if ($query_type != 'drop_db') {
mysql_select_db($db);
}
$result = @mysql_query($a_query) or mysql_die('', $a_query, FALSE, $err_url);
$result = @mysql_query($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
} // end if
} // end for
if ($query_type == 'drop_tbl' || $query_type == 'drop_fld') {
mysql_select_db($db);
$result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url);
$result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
}
show_message($strSuccess);
PMA_showMessage($strSuccess);
}
?>

View File

@@ -16,7 +16,7 @@
*
* @access public
*/
function split_sql_file(&$ret, $sql, $release)
function PMA_splitSqlFile(&$ret, $sql, $release)
{
$sql = trim($sql);
$sql_len = strlen($sql);
@@ -125,7 +125,7 @@ function split_sql_file(&$ret, $sql, $release)
}
return TRUE;
} // end of the 'split_sql_file()' function
} // end of the 'PMA_splitSqlFile()' function
@@ -172,14 +172,14 @@ if (!empty($id_bookmark)) {
include('./libraries/bookmark.lib.php3');
switch($action_bookmark) {
case 0: // bookmarked query that have to be run
$sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark);
$sql_query = PMA_queryBookmarks($db, $cfgBookmark, $id_bookmark);
break;
case 1: // bookmarked query that have to be displayed
$sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark);
$sql_query = PMA_queryBookmarks($db, $cfgBookmark, $id_bookmark);
$view_bookmark = 1;
break;
case 2: // bookmarked query that have to be deleted
$sql_query = delete_bookmarks($db, $cfgBookmark, $id_bookmark);
$sql_query = PMA_deleteBookmarks($db, $cfgBookmark, $id_bookmark);
break;
}
} // end if
@@ -219,7 +219,7 @@ if (!$cfgAllowUserDropDatabase
$result = @mysql_query('USE mysql');
if (mysql_error()) {
include('./header.inc.php3');
mysql_die($strNoDropDatabases, '', '', $err_url);
PMA_mysqlDie($strNoDropDatabases, '', '', $err_url);
}
}
define('PMA_CHK_DROP', 1);
@@ -230,7 +230,7 @@ define('PMA_CHK_DROP', 1);
*/
if ($sql_query != '') {
$pieces = array();
split_sql_file($pieces, $sql_query, MYSQL_INT_VERSION);
PMA_splitSqlFile($pieces, $sql_query, PMA_MYSQL_INT_VERSION);
$pieces_count = count($pieces);
// Copy of the cleaned sql statement for display purpose only (see near the
@@ -281,7 +281,7 @@ if ($sql_query != '') {
if (isset($my_die)) {
$js_to_run = 'functions.js';
include('./header.inc.php3');
mysql_die('', $my_die, '', $err_url);
PMA_mysqlDie('', $my_die, '', $err_url);
}
@@ -300,7 +300,7 @@ if ($goto == 'tbl_properties.php3') {
if (!isset($table)) {
$goto = 'db_details.php3';
} else {
$is_table = @mysql_query('SHOW TABLES LIKE \'' . sql_addslashes($table, TRUE) . '\'');
$is_table = @mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
if (!@mysql_numrows($is_table)) {
$goto = 'db_details.php3';
unset($table);

View File

@@ -40,7 +40,7 @@ if (!defined('PMA_CHK_DROP')
$result = @mysql_query('USE mysql');
if (mysql_error()) {
include('./header.inc.php3');
mysql_die($strNoDropDatabases, '', '', $err_url);
PMA_mysqlDie($strNoDropDatabases, '', '', $err_url);
} // end if
} // end if
@@ -53,7 +53,7 @@ if (isset($store_bkm)) {
$fields['label'] = stripslashes($fields['label']);
}
include('./libraries/bookmark.lib.php3');
add_bookmarks($fields, $cfgBookmark);
PMA_addBookmarks($fields, $cfgBookmark);
header('Location: ' . $cfgPmaAbsoluteUri . $goto);
}
@@ -230,7 +230,7 @@ else {
$full_err_url = (ereg('^(db_details|tbl_properties)', $err_url))
? $err_url . '&amp;show_query=y&amp;sql_query=' . urlencode($sql_query)
: $err_url;
mysql_die($error, $full_sql_query, '', $full_err_url);
PMA_mysqlDie($error, $full_sql_query, '', $full_err_url);
}
// Gets the number of rows affected/returned
@@ -289,7 +289,7 @@ else {
if (!isset($table)) {
$goto = 'db_details.php3';
} else {
$is_table = @mysql_query('SHOW TABLES LIKE \'' . sql_addslashes($table, TRUE) . '\'');
$is_table = @mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
if (!@mysql_numrows($is_table)) {
$goto = 'db_details.php3';
unset($table);
@@ -344,11 +344,11 @@ else {
// Displays the results in a table
include('./libraries/display_tbl.lib.php3');
if (empty($disp_mode)) {
// see the "set_display_mode()" function in
// see the "PMA_setDisplayMode()" function in
// libraries/display_tbl.lib.php3
$disp_mode = 'urdr11110';
}
display_table($result, $disp_mode);
PMA_displayTable($result, $disp_mode);
mysql_free_result($result);
// Displays "Insert a new row" link if required

View File

@@ -34,11 +34,11 @@ if (isset($submit)) {
if (get_magic_quotes_gpc()) {
$field_name[$i] = stripslashes($field_name[$i]);
}
if (MYSQL_INT_VERSION < 32306) {
check_reserved_words($field_name[$i], $err_url);
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($field_name[$i], $err_url);
}
$query .= backquote($field_name[$i]) . ' ' . $field_type[$i];
$query .= PMA_backquote($field_name[$i]) . ' ' . $field_type[$i];
if ($field_length[$i] != ''
&& !eregi('^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT)$', $field_type[$i])) {
if (get_magic_quotes_gpc()) {
@@ -54,9 +54,9 @@ if (isset($submit)) {
if (strtoupper($field_default[$i]) == 'NULL') {
$query .= ' DEFAULT NULL';
} else if (get_magic_quotes_gpc()) {
$query .= ' DEFAULT \'' . sql_addslashes(stripslashes($field_default[$i])) . '\'';
$query .= ' DEFAULT \'' . PMA_sqlAddslashes(stripslashes($field_default[$i])) . '\'';
} else {
$query .= ' DEFAULT \'' . sql_addslashes($field_default[$i]) . '\'';
$query .= ' DEFAULT \'' . PMA_sqlAddslashes($field_default[$i]) . '\'';
}
}
if ($field_null[$i] != '') {
@@ -84,16 +84,16 @@ if (isset($submit)) {
$query .= ' FIRST';
} else {
if (get_magic_quotes_gpc()) {
$query .= ' AFTER ' . backquote(stripslashes(urldecode($after_field)));
$query .= ' AFTER ' . PMA_backquote(stripslashes(urldecode($after_field)));
} else {
$query .= ' AFTER ' . backquote(urldecode($after_field));
$query .= ' AFTER ' . PMA_backquote(urldecode($after_field));
}
}
} else {
if (get_magic_quotes_gpc()) {
$query .= ' AFTER ' . backquote(stripslashes($field_name[$i-1]));
$query .= ' AFTER ' . PMA_backquote(stripslashes($field_name[$i-1]));
} else {
$query .= ' AFTER ' . backquote($field_name[$i-1]);
$query .= ' AFTER ' . PMA_backquote($field_name[$i-1]);
}
}
}
@@ -101,8 +101,8 @@ if (isset($submit)) {
} // end for
$query = ereg_replace(', ADD $', '', $query);
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD ' . $query;
$result = mysql_query($sql_query) or mysql_die('', '', '', $err_url);
$sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD ' . $query;
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy = $sql_query . ';';
// Builds the primary keys statements and updates the table
@@ -111,12 +111,12 @@ if (isset($submit)) {
$primary_cnt = count($field_primary);
for ($i = 0; $i < $primary_cnt; $i++) {
$j = $field_primary[$i];
$primary .= backquote($field_name[$j]) . ', ';
$primary .= PMA_backquote($field_name[$j]) . ', ';
} // end for
$primary = ereg_replace(', $', '', $primary);
if (!empty($primary)) {
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')';
$result = mysql_query($sql_query) or mysql_die('', '', '', $err_url);
$sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')';
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if
@@ -127,12 +127,12 @@ if (isset($submit)) {
$index_cnt = count($field_index);
for ($i = 0; $i < $index_cnt; $i++) {
$j = $field_index[$i];
$index .= backquote($field_name[$j]) . ', ';
$index .= PMA_backquote($field_name[$j]) . ', ';
} // end for
$index = ereg_replace(', $', '', $index);
if (!empty($index)) {
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD INDEX (' . $index . ')';
$result = mysql_query($sql_query) or mysql_die('', '', '', $err_url);
$sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD INDEX (' . $index . ')';
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if
@@ -143,12 +143,12 @@ if (isset($submit)) {
$unique_cnt = count($field_unique);
for ($i = 0; $i < $unique_cnt; $i++) {
$j = $field_unique[$i];
$unique .= backquote($field_name[$j]) . ', ';
$unique .= PMA_backquote($field_name[$j]) . ', ';
} // end for
$unique = ereg_replace(', $', '', $unique);
if (!empty($unique)) {
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $unique . ')';
$result = mysql_query($sql_query) or mysql_die('', '', '', $err_url);
$sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD UNIQUE (' . $unique . ')';
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if
@@ -156,16 +156,16 @@ if (isset($submit)) {
// Builds the fulltext statements and updates the table
$fulltext = '';
if (MYSQL_INT_VERSION >= 32323 && isset($field_fulltext)) {
if (PMA_MYSQL_INT_VERSION >= 32323 && isset($field_fulltext)) {
$fulltext_cnt = count($field_fulltext);
for ($i = 0; $i < $fulltext_cnt; $i++) {
$j = $field_fulltext[$i];
$fulltext .= backquote($field_name[$j]) . ', ';
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
} // end for
$fulltext = ereg_replace(', $', '', $fulltext);
if (!empty($fulltext)) {
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
$result = mysql_query($sql_query) or mysql_die('', '', '', $err_url);
$sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if

View File

@@ -36,8 +36,8 @@ if (isset($submit)) {
$field_length[$i] = stripslashes($field_length[$i]);
}
if (MYSQL_INT_VERSION < 32306) {
check_reserved_words($field_name[$i], $err_url);
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($field_name[$i], $err_url);
}
// Some fields have been urlencoded or double quotes have been translated
@@ -59,7 +59,7 @@ if (isset($submit)) {
} else {
$query .= ', CHANGE ';
}
$query .= backquote($field_orig[$i]) . ' ' . backquote($field_name[$i]) . ' ' . $field_type[$i];
$query .= PMA_backquote($field_orig[$i]) . ' ' . PMA_backquote($field_name[$i]) . ' ' . $field_type[$i];
// Some field types shouldn't have lengths
if ($field_length[$i] != ''
&& !eregi('^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT)$', $field_type[$i])) {
@@ -72,7 +72,7 @@ if (isset($submit)) {
if (strtoupper($field_default[$i]) == 'NULL') {
$query .= ' DEFAULT NULL';
} else {
$query .= ' DEFAULT \'' . sql_addslashes($field_default[$i]) . '\'';
$query .= ' DEFAULT \'' . PMA_sqlAddslashes($field_default[$i]) . '\'';
}
}
if ($field_null[$i] != '') {
@@ -84,8 +84,8 @@ if (isset($submit)) {
} // end for
// Optimization fix - 2 May 2001 - Robbat2
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' CHANGE ' . $query;
$result = mysql_query($sql_query) or mysql_die('', '', '', $err_url);
$sql_query = 'ALTER TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' CHANGE ' . $query;
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
$btnDrop = 'Fake';
include('./tbl_properties.php3');
@@ -107,12 +107,12 @@ else {
// TODO: optimize in case of multiple fields to modify
for ($i = 0; $i < $selected_cnt; $i++) {
if (get_magic_quotes_gpc()) {
$field = sql_addslashes(stripslashes($selected[$i]), TRUE);
$field = PMA_sqlAddslashes(stripslashes($selected[$i]), TRUE);
} else {
$field = sql_addslashes($selected[$i], TRUE);
$field = PMA_sqlAddslashes($selected[$i], TRUE);
}
$local_query = 'SHOW FIELDS FROM ' . backquote($db) . '.' . backquote($table) . " LIKE '$field'";
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . " LIKE '$field'";
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$fields_meta[] = mysql_fetch_array($result);
mysql_free_result($result);
}

View File

@@ -29,7 +29,7 @@ if (!empty($message)) {
if (isset($disp_query)) {
$sql_query = (get_magic_quotes_gpc() ? stripslashes($disp_query) : $disp_query);
}
show_message($message);
PMA_showMessage($message);
if (isset($goto_cpy)) {
$goto = $goto_cpy;
unset($goto_cpy);
@@ -70,10 +70,10 @@ if ($goto != 'db_details.php3' && $goto != 'tbl_properties.php3') {
* Get the list of the fields of the current table
*/
mysql_select_db($db);
$table_def = mysql_query('SHOW FIELDS FROM ' . backquote($table));
$table_def = mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
if (isset($primary_key)) {
$local_query = 'SELECT * FROM ' . backquote($table) . ' WHERE ' . $primary_key;
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$row = mysql_fetch_array($result);
// No row returned
if (!$row) {
@@ -93,7 +93,7 @@ if (isset($primary_key)) {
unset($sql_query);
}
$sql_query = $local_query;
show_message($strEmptyResultSet);
PMA_showMessage($strEmptyResultSet);
$goto = $goto_cpy;
unset($goto_cpy);
if (isset($sql_query_cpy)) {
@@ -104,8 +104,8 @@ if (isset($primary_key)) {
}
else
{
$local_query = 'SELECT * FROM ' . backquote($table) . ' LIMIT 1';
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
unset($row);
}

View File

@@ -43,10 +43,10 @@ if (isset($submit)) {
if (get_magic_quotes_gpc()) {
$field_name[$i] = stripslashes($field_name[$i]);
}
if (MYSQL_INT_VERSION < 32306) {
check_reserved_words($field_name[$i], $err_url);
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($field_name[$i], $err_url);
}
$query = backquote($field_name[$i]) . ' ' . $field_type[$i];
$query = PMA_backquote($field_name[$i]) . ' ' . $field_type[$i];
if ($field_length[$i] != '') {
if (get_magic_quotes_gpc()) {
$query .= '(' . stripslashes($field_length[$i]) . ')';
@@ -61,9 +61,9 @@ if (isset($submit)) {
if (strtoupper($field_default[$i]) == 'NULL') {
$query .= ' DEFAULT NULL';
} else if (get_magic_quotes_gpc()) {
$query .= ' DEFAULT \'' . sql_addslashes(stripslashes($field_default[$i])) . '\'';
$query .= ' DEFAULT \'' . PMA_sqlAddslashes(stripslashes($field_default[$i])) . '\'';
} else {
$query .= ' DEFAULT \'' . sql_addslashes($field_default[$i]) . '\'';
$query .= ' DEFAULT \'' . PMA_sqlAddslashes($field_default[$i]) . '\'';
}
}
if ($field_null[$i] != '') {
@@ -101,7 +101,7 @@ if (isset($submit)) {
if (get_magic_quotes_gpc()) {
$field_name[$j] = stripslashes($field_name[$j]);
}
$primary .= backquote($field_name[$j]) . ', ';
$primary .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
unset($primary_cnt);
@@ -121,7 +121,7 @@ if (isset($submit)) {
if (get_magic_quotes_gpc()) {
$field_name[$j] = stripslashes($field_name[$j]);
}
$index .= backquote($field_name[$j]) . ', ';
$index .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
unset($index_cnt);
@@ -141,7 +141,7 @@ if (isset($submit)) {
if (get_magic_quotes_gpc()) {
$field_name[$j] = stripslashes($field_name[$j]);
}
$unique .= backquote($field_name[$j]) . ', ';
$unique .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
unset($unique_cnt);
@@ -161,7 +161,7 @@ if (isset($submit)) {
if (get_magic_quotes_gpc()) {
$field_name[$j] = stripslashes($field_name[$j]);
}
$fulltext .= backquote($field_name[$j]) . ', ';
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
unset($field_fulltext);
@@ -173,24 +173,24 @@ if (isset($submit)) {
unset($fulltext);
// Builds the 'create table' statement
$sql_query = 'CREATE TABLE ' . backquote($table) . ' (' . $sql_query . ')';
$query_cpy = 'CREATE TABLE ' . backquote($table) . ' (' . $query_cpy . "\n" . ')';
$sql_query = 'CREATE TABLE ' . PMA_backquote($table) . ' (' . $sql_query . ')';
$query_cpy = 'CREATE TABLE ' . PMA_backquote($table) . ' (' . $query_cpy . "\n" . ')';
// Adds table type and comments (2 May 2001 - Robbat2)
if (!empty($tbl_type) && ($tbl_type != 'Default')) {
$sql_query .= ' TYPE = ' . $tbl_type;
$query_cpy .= ' TYPE = ' . $tbl_type;
}
if (MYSQL_INT_VERSION >= 32300 && !empty($comment)) {
if (PMA_MYSQL_INT_VERSION >= 32300 && !empty($comment)) {
if (get_magic_quotes_gpc()) {
$comment = stripslashes($comment);
}
$sql_query .= ' COMMENT = \'' . sql_addslashes($comment) . '\'';
$query_cpy .= "\n" . 'COMMENT = \'' . sql_addslashes($comment) . '\'';
$sql_query .= ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
$query_cpy .= "\n" . 'COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
}
// Executes the query
$result = mysql_query($sql_query) or mysql_die('', '', '', $err_url);
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query = $query_cpy . ';';
unset($query_cpy);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated;
@@ -208,11 +208,11 @@ else {
}
// No table name
if (!isset($table) || trim($table) == '') {
mysql_die($strTableEmpty, '', '', $err_url);
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
}
// No valid number of fields
else if (empty($num_fields) || !is_int($num_fields)) {
mysql_die($strFieldsEmpty, '', '', $err_url);
PMA_mysqlDie($strFieldsEmpty, '', '', $err_url);
}
// Table name and number of fields are valid -> show the form
else {
@@ -220,8 +220,8 @@ else {
if (get_magic_quotes_gpc()) {
$table = stripslashes($table);
}
if (MYSQL_INT_VERSION < 32306) {
check_reserved_words($table, $err_url);
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($table, $err_url);
}
$action = 'tbl_create.php3';

View File

@@ -10,7 +10,7 @@
*
* @global string the buffer containing formatted strings
*/
function my_handler($sql_insert)
function PMA_myHandler($sql_insert)
{
global $tmp_buffer;
@@ -24,7 +24,7 @@ function my_handler($sql_insert)
else {
$tmp_buffer .= $sql_insert . $eol_dlm . $GLOBALS['crlf'];
}
} // end of the 'my_handler()' function
} // end of the 'PMA_myHandler()' function
/**
@@ -40,7 +40,7 @@ function my_handler($sql_insert)
* @global string the character to add at the end of lines
* @global string the buffer containing formatted strings
*/
function my_csvhandler($sql_insert)
function PMA_myCsvHandler($sql_insert)
{
global $add_character;
global $tmp_buffer;
@@ -53,7 +53,7 @@ function my_csvhandler($sql_insert)
else {
$tmp_buffer .= $sql_insert . $add_character;
}
} // end of the 'my_csvhandler()' function
} // end of the 'PMA_myCsvHandler()' function
@@ -82,7 +82,7 @@ $err_url = 'tbl_properties.php3'
@set_time_limit($cfgExecTimeLimit);
$dump_buffer = '';
// Defines the default <CR><LF> format
$crlf = which_crlf();
$crlf = PMA_whichCrlf();
/**
@@ -132,7 +132,7 @@ else {
$ext = 'sql';
// loic1: 'application/octet-stream' is the registered IANA type but
// MSIE and Opera seems to prefer 'application/octetstream'
$mime_type = (USR_BROWSER_AGENT == 'IE' || USR_BROWSER_AGENT == 'OPERA')
$mime_type = (PMA_USR_BROWSER_AGENT == 'IE' || PMA_USR_BROWSER_AGENT == 'OPERA')
? 'application/octetstream'
: 'application/octet-stream';
}
@@ -140,7 +140,7 @@ else {
// Send headers
header('Content-Type: ' . $mime_type);
// lem9 & loic1: IE need specific headers
if (USR_BROWSER_AGENT == 'IE') {
if (PMA_USR_BROWSER_AGENT == 'IE') {
header('Content-Disposition: inline; filename="' . $filename . '.' . $ext . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
@@ -174,7 +174,7 @@ else {
// No csv format -> add some comments at the top
if ($what != 'csv' && $what != 'excel') {
$dump_buffer .= '# phpMyAdmin MySQL-Dump' . $crlf
. '# version ' . PHPMYADMIN_VERSION . $crlf
. '# version ' . PMA_VERSION . $crlf
. '# http://phpwizard.net/phpMyAdmin/' . $crlf
. '# http://phpmyadmin.sourceforge.net/ (download page)' . $crlf
. '#' . $crlf
@@ -183,11 +183,11 @@ else {
$dump_buffer .= ':' . $cfgServer['port'];
}
$formatted_db_name = (isset($use_backquotes))
? backquote($db)
? PMA_backquote($db)
: '\'' . $db . '\'';
$dump_buffer .= $crlf
. '# ' . $strGenTime . ': ' . localised_date() . $crlf
. '# ' . $strServerVersion . ': ' . substr(MYSQL_INT_VERSION, 0, 1) . '.' . substr(MYSQL_INT_VERSION, 1, 2) . '.' . substr(MYSQL_INT_VERSION, 3) . $crlf
. '# ' . $strGenTime . ': ' . PMA_localisedDate() . $crlf
. '# ' . $strServerVersion . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . substr(PMA_MYSQL_INT_VERSION, 3) . $crlf
. '# ' . $strPHPVersion . ': ' . phpversion() . $crlf
. '# ' . $strDatabase . ': ' . $formatted_db_name . $crlf;
@@ -204,7 +204,7 @@ else {
$i++;
} else {
$formatted_table_name = (isset($use_backquotes))
? backquote($table)
? PMA_backquote($table)
: '\'' . $table . '\'';
// If only datas, no need to displays table name
if ($what != 'dataonly') {
@@ -212,7 +212,7 @@ else {
. $crlf . '#' . $crlf
. '# ' . $strTableStructure . ' ' . $formatted_table_name . $crlf
. '#' . $crlf . $crlf
. get_table_def($db, $table, $crlf, $err_url) . ';' . $crlf;
. PMA_getTableDef($db, $table, $crlf, $err_url) . ';' . $crlf;
}
// At least data
if (($what == 'data') || ($what == 'dataonly')) {
@@ -223,7 +223,7 @@ else {
if (!isset($limit_from) || !isset($limit_to)) {
$limit_from = $limit_to = 0;
}
get_table_content($db, $table, $limit_from, $limit_to, 'my_handler', $err_url);
PMA_getTableContent($db, $table, $limit_from, $limit_to, 'PMA_myHandler', $err_url);
$dump_buffer .= $tmp_buffer;
} // end if
$i++;
@@ -251,7 +251,7 @@ else {
} // end if
$tmp_buffer = '';
get_table_csv($db, $table, $limit_from, $limit_to, $separator, $enclosed, $escaped, 'my_csvhandler', $err_url);
PMA_getTableCsv($db, $table, $limit_from, $limit_to, $separator, $enclosed, $escaped, 'PMA_myCsvHandler', $err_url);
$dump_buffer .= $tmp_buffer;
} // end 'csv case
} // end building the dump
@@ -262,26 +262,26 @@ else {
*/
// 1. as a gzipped file
if (isset($zip) && $zip == 'zip') {
if (PHP_INT_VERSION >= 40000 && @function_exists('gzcompress')) {
if (PMA_PHP_INT_VERSION >= 40000 && @function_exists('gzcompress')) {
if ($what == 'csv' || $what == 'excel') {
$extbis = '.csv';
} else {
$extbis = '.sql';
}
$zipfile = new zipfile();
$zipfile -> add_file($dump_buffer, $filename . $extbis);
$zipfile -> addFile($dump_buffer, $filename . $extbis);
echo $zipfile -> file();
}
}
// 2. as a bzipped file
else if (isset($bzip) && $bzip == 'bzip') {
if (PHP_INT_VERSION >= 40004 && @function_exists('bzcompress')) {
if (PMA_PHP_INT_VERSION >= 40004 && @function_exists('bzcompress')) {
echo bzcompress($dump_buffer);
}
}
// 3. as a gzipped file
else if (isset($gzip) && $gzip == 'gzip') {
if (PHP_INT_VERSION >= 40004 && @function_exists('gzencode')) {
if (PMA_PHP_INT_VERSION >= 40004 && @function_exists('gzencode')) {
// without the optional parameter level because it bug
echo gzencode($dump_buffer);
}

View File

@@ -25,7 +25,7 @@ $index_types = array(
* informations.
* Skipped if this script is called by "tbl_properties.php3"
*/
if (!defined('_IDX_INCLUDED_')) {
if (!defined('PMA_IDX_INCLUDED')) {
// Not a valid db name -> back to the welcome page
if (!empty($db)) {
$is_db = @mysql_select_db($db);
@@ -36,7 +36,7 @@ if (!defined('_IDX_INCLUDED_')) {
}
// Not a valid table name -> back to the db_details.php3
if (!empty($table)) {
$is_table = @mysql_query("SHOW TABLES LIKE '" . sql_addslashes($table, TRUE) . '\'');
$is_table = @mysql_query("SHOW TABLES LIKE '" . PMA_sqlAddslashes($table, TRUE) . '\'');
}
if (empty($table) || !@mysql_numrows($is_table)) {
header('Location: ' . $cfgPmaAbsoluteUri . 'db_details.php3?lang=' . $lang . '&server=' . $server . '&db=' . urlencode($db) . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
@@ -54,7 +54,7 @@ if (!defined('_IDX_INCLUDED_')) {
/**
* Gets fields and indexes informations
*/
if (defined('_IDX_INCLUDED_')) {
if (defined('PMA_IDX_INCLUDED')) {
$err_url_0 = 'db_details.php3'
. '?lang=' . $lang
. '&amp;server=' . $server
@@ -67,16 +67,16 @@ $prev_index = '';
$indexes_info = array();
$indexes_data = array();
// keys had already been grabbed in "tbl_properties.php3"
if (defined('_IDX_INCLUDED_')) {
if (defined('PMA_IDX_INCLUDED')) {
$idx_cnt = count($ret_keys);
} else {
$local_query = 'SHOW KEYS FROM ' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
$local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$idx_cnt = mysql_num_rows($result);
}
for ($i = 0; $i < $idx_cnt; $i++) {
$row = (defined('_IDX_INCLUDED_') ? $ret_keys[$i] : mysql_fetch_array($result));
$row = (defined('PMA_IDX_INCLUDED') ? $ret_keys[$i] : mysql_fetch_array($result));
if ($row['Key_name'] != $prev_index ){
$indexes[] = $row['Key_name'];
@@ -97,7 +97,7 @@ for ($i = 0; $i < $idx_cnt; $i++) {
}
} // end while
if (defined('_IDX_INCLUDED_')) {
if (defined('PMA_IDX_INCLUDED')) {
unset($ret_keys);
} else if ($result) {
mysql_free_result($result);
@@ -105,11 +105,11 @@ if (defined('_IDX_INCLUDED_')) {
// Get fields and stores their name/type
// fields had already been grabbed in "tbl_properties.php3"
if (defined('_IDX_INCLUDED_')) {
if (defined('PMA_IDX_INCLUDED')) {
mysql_data_seek($fields_rs, 0);
} else {
$local_query = 'SHOW FIELDS FROM ' . backquote($table);
$fields_rs = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table);
$fields_rs = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$fields_cnt = mysql_num_rows($fields_rs);
}
@@ -142,7 +142,7 @@ if (get_magic_quotes_gpc()) {
* Do run the query to build the new index and moves back to
* "tbl_properties.php3"
*/
if (!defined('_IDX_INCLUDED_')
if (!defined('PMA_IDX_INCLUDED')
&& (isset($index) && isset($do_save_data))) {
$err_url = 'tbl_indexes.php3'
@@ -160,20 +160,20 @@ if (!defined('_IDX_INCLUDED_')
if ($index == '') {
$index = 'PRIMARY';
} else if ($index != 'PRIMARY') {
mysql_die($strPrimaryKeyName, '', FALSE, $err_url);
PMA_mysqlDie($strPrimaryKeyName, '', FALSE, $err_url);
}
} else if ($index == 'PRIMARY') {
mysql_die($strCantRenameIdxToPrimary, '', FALSE, $err_url);
PMA_mysqlDie($strCantRenameIdxToPrimary, '', FALSE, $err_url);
}
$sql_query = 'ALTER TABLE ' . backquote($table);
$sql_query = 'ALTER TABLE ' . PMA_backquote($table);
// Drops the old index
if (!empty($old_index)) {
if ($old_index == 'PRIMARY') {
$sql_query .= ' DROP PRIMARY KEY,';
} else {
$sql_query .= ' DROP INDEX ' . backquote($old_index) .',';
$sql_query .= ' DROP INDEX ' . PMA_backquote($old_index) .',';
}
} // end if
@@ -183,30 +183,30 @@ if (!defined('_IDX_INCLUDED_')
$sql_query .= ' ADD PRIMARY KEY (';
break;
case 'FULLTEXT':
$sql_query .= ' ADD FULLTEXT ' . (empty($index) ? '' : backquote($index)) . ' (';
$sql_query .= ' ADD FULLTEXT ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
break;
case 'UNIQUE':
$sql_query .= ' ADD UNIQUE ' . (empty($index) ? '' : backquote($index)) . ' (';
$sql_query .= ' ADD UNIQUE ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
break;
case 'INDEX':
$sql_query .= ' ADD INDEX ' . (empty($index) ? '' : backquote($index)) . ' (';
$sql_query .= ' ADD INDEX ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
break;
} // end switch
$index_fields = '';
while (list($i, $name) = each($column)) {
if ($name != '--ignore--') {
$index_fields .= (empty($index_fields) ? '' : ',')
. backquote(get_magic_quotes_gpc() ? stripslashes($name) : $name)
. PMA_backquote(get_magic_quotes_gpc() ? stripslashes($name) : $name)
. (empty($sub_part[$i]) ? '' : '(' . $sub_part[$i] . ')');
}
} // end while
if (empty($index_fields)){
mysql_die($strNoIndexPartsDefined, '', FALSE, $err_url);
PMA_mysqlDie($strNoIndexPartsDefined, '', FALSE, $err_url);
} else {
$sql_query .= $index_fields . ')';
}
$result = mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url);
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
include('./tbl_properties.php3');
@@ -217,7 +217,7 @@ if (!defined('_IDX_INCLUDED_')
/**
* Edits an index or defines a new one
*/
else if (!defined('_IDX_INCLUDED_')
else if (!defined('PMA_IDX_INCLUDED')
&& (isset($index) || isset($create_index))) {
// Prepares the form values
@@ -317,7 +317,7 @@ else if (!defined('_IDX_INCLUDED_')
<option value="FULLTEXT"<?php if ($index_type == 'FULLTEXT') echo ' selected="selected"'; ?>>FULLTEXT</option>
<option value="INDEX"<?php if ($index_type == 'INDEX') echo ' selected="selected"'; ?>>INDEX</option>
</select>&nbsp;
<?php echo show_docu('manual_Reference.html#ALTER_TABLE') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#ALTER_TABLE') . "\n"; ?>
</td>
</tr>
</table><br />
@@ -396,7 +396,7 @@ else if (!defined('_IDX_INCLUDED_')
<?php
echo "\n";
echo ' ' . $strIndexes . '&nbsp;:' . "\n";
echo ' ' . show_docu('manual_MySQL_Optimization.html#MySQL_indexes') . '<br />' ."\n";
echo ' ' . PMA_showDocu('manual_MySQL_Optimization.html#MySQL_indexes') . '<br />' ."\n";
if ($idx_cnt > 0) {
?>
@@ -436,12 +436,12 @@ else if (!defined('_IDX_INCLUDED_')
. ' </td>' . "\n";
if ($index_name == 'PRIMARY') {
$sql_query = urlencode('ALTER TABLE ' . backquote($table) . ' DROP PRIMARY KEY');
$js_msg = 'ALTER TABLE ' . js_format($table) . ' DROP PRIMARY KEY';
$sql_query = urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY');
$js_msg = 'ALTER TABLE ' . PMA_jsFormat($table) . ' DROP PRIMARY KEY';
$zero_rows = urlencode($strPrimaryKeyHasBeenDropped);
} else {
$sql_query = urlencode('ALTER TABLE ' . backquote($table) . ' DROP INDEX ' . backquote($index_name));
$js_msg = 'ALTER TABLE ' . js_format($table) . ' DROP INDEX ' . js_format($index_name);
$sql_query = urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP INDEX ' . PMA_backquote($index_name));
$js_msg = 'ALTER TABLE ' . PMA_jsFormat($table) . ' DROP INDEX ' . PMA_jsFormat($index_name);
$zero_rows = urlencode(sprintf($strIndexHasBeenDropped, htmlspecialchars($index_name)));
}
echo $index_td
@@ -498,7 +498,7 @@ else if (!defined('_IDX_INCLUDED_')
*/
echo "\n";
if (!defined('_IDX_INCLUDED_')){
if (!defined('PMA_IDX_INCLUDED')){
require('./footer.inc.php3');
}
?>

View File

@@ -12,16 +12,16 @@
* @global string the target database and table names
* @global string the sql query used to copy the data
*/
function my_handler($sql_insert = '')
function PMA_myHandler($sql_insert = '')
{
global $db, $table, $target;
global $sql_insert_data;
$sql_insert = eregi_replace('INSERT INTO (`?)' . $table . '(`?)', 'INSERT INTO ' . $target, $sql_insert);
$result = mysql_query($sql_insert) or mysql_die('', $sql_insert, '', $GLOBALS['err_url']);
$result = mysql_query($sql_insert) or PMA_mysqlDie('', $sql_insert, '', $GLOBALS['err_url']);
$sql_insert_data .= $sql_insert . ';' . "\n";
} // end of the 'my_handler' function
} // end of the 'PMA_myHandler()' function
/**
@@ -65,25 +65,25 @@ if (isset($new_name) && trim($new_name) != '') {
// Ensure the target is valid
if (count($dblist) > 0 &&
(pmaIsInto($db, $dblist) == -1 || pmaIsInto($target_db, $dblist) == -1)) {
(PMA_isInto($db, $dblist) == -1 || PMA_isInto($target_db, $dblist) == -1)) {
exit();
}
if (MYSQL_INT_VERSION < 32306) {
check_reserved_words($target_db, $err_url);
check_reserved_words($new_name, $err_url);
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($target_db, $err_url);
PMA_checkReservedWords($new_name, $err_url);
}
$source = backquote($db) . '.' . backquote($table);
$target = backquote($target_db) . '.' . backquote($new_name);
$source = PMA_backquote($db) . '.' . PMA_backquote($table);
$target = PMA_backquote($target_db) . '.' . PMA_backquote($new_name);
include('./libraries/build_dump.lib.php3');
$sql_structure = get_table_def($db, $table, "\n", $err_url);
$sql_structure = PMA_getTableDef($db, $table, "\n", $err_url);
$sql_structure = eregi_replace('^CREATE TABLE (`?)' . $table . '(`?)', 'CREATE TABLE ' . $target, $sql_structure);
$result = @mysql_query($sql_structure);
if (mysql_error()) {
include('./header.inc.php3');
mysql_die('', $sql_structure, '', $err_url);
PMA_mysqlDie('', $sql_structure, '', $err_url);
} else if (isset($sql_query)) {
$sql_query .= "\n" . $sql_structure . ';';
} else {
@@ -93,17 +93,17 @@ if (isset($new_name) && trim($new_name) != '') {
// Copy the data
if ($result != FALSE && $what == 'data') {
// speedup copy table - staybyte - 22. Juni 2001
if (MYSQL_INT_VERSION >= 32300) {
if (PMA_MYSQL_INT_VERSION >= 32300) {
$sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
$result = @mysql_query($sql_insert_data);
if (mysql_error()) {
include('./header.inc.php3');
mysql_die('', $sql_insert_data, '', $err_url);
PMA_mysqlDie('', $sql_insert_data, '', $err_url);
}
} // end MySQL >= 3.23
else {
$sql_insert_data = '';
get_table_content($db, $table, 0, 0, 'my_handler', $err_url);
PMA_getTableContent($db, $table, 0, 0, 'PMA_myHandler', $err_url);
} // end MySQL < 3.23
$sql_query .= "\n\n" . $sql_insert_data;
}
@@ -114,7 +114,7 @@ if (isset($new_name) && trim($new_name) != '') {
$result = @mysql_query($sql_drop_table);
if (mysql_error()) {
include('./header.inc.php3');
mysql_die('', $sql_drop_table, '', $err_url);
PMA_mysqlDie('', $sql_drop_table, '', $err_url);
}
$sql_query .= "\n\n" . $sql_drop_table . ';';
$db = $target_db;
@@ -134,7 +134,7 @@ if (isset($new_name) && trim($new_name) != '') {
*/
else {
include('./header.inc.php3');
mysql_die($strTableEmpty, '', '', $err_url);
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
}

View File

@@ -29,15 +29,15 @@ mysql_select_db($db);
* Gets table informations
*/
// The 'show table' statement works correct since 3.23.03
if (MYSQL_INT_VERSION >= 32303) {
$local_query = 'SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\'';
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
if (PMA_MYSQL_INT_VERSION >= 32303) {
$local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'';
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$showtable = mysql_fetch_array($result);
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
} else {
$local_query = 'SELECT COUNT(*) AS count FROM ' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SELECT COUNT(*) AS count FROM ' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$showtable = array();
$num_rows = mysql_result($result, 0, 'count');
$show_comment = '';
@@ -50,8 +50,8 @@ if ($result) {
/**
* Gets table keys and retains them
*/
$local_query = 'SHOW KEYS FROM ' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$primary = '';
$indexes = array();
$lastIndex = '';
@@ -91,8 +91,8 @@ if ($result) {
/**
* Gets fields properties
*/
$local_query = 'SHOW FIELDS FROM ' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$fields_cnt = mysql_num_rows($result);
@@ -272,25 +272,25 @@ if ($cfgShowStats) {
if (isset($showtable['Type']) && !eregi('ISAM|HEAP', $showtable['Type'])) {
$nonisam = TRUE;
}
if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE) {
if (PMA_MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE) {
// Gets some sizes
$mergetable = FALSE;
if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
$mergetable = TRUE;
}
list($data_size, $data_unit) = format_byte_down($showtable['Data_length']);
list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length']);
if ($mergetable == FALSE) {
list($index_size, $index_unit) = format_byte_down($showtable['Index_length']);
list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length']);
}
if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
list($free_size, $free_unit) = format_byte_down($showtable['Data_free']);
list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free']);
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
} else {
list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']);
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
}
list($tot_size, $tot_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']);
list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
if ($num_rows > 0) {
list($avg_size, $avg_unit) = format_byte_down(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
}
// Displays them
@@ -439,7 +439,7 @@ if ($cfgShowStats) {
</table>
<?php
} // end if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE)
} // end if (PMA_MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE)
} // end if ($cfgShowStats)

View File

@@ -224,7 +224,7 @@ for ($i = 0 ; $i < $num_fields; $i++) {
} else {
$checked_unique = '';
}
if (MYSQL_INT_VERSION >= 32323
if (PMA_MYSQL_INT_VERSION >= 32323
&&(isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) {
$checked_fulltext = ' checked="checked"';
} else {
@@ -242,14 +242,14 @@ for ($i = 0 ; $i < $num_fields; $i++) {
<input type="checkbox" name="field_unique[]" value="<?php echo $i; ?>"<?php echo $checked_unique; ?> />
</td>
<?php
if (MYSQL_INT_VERSION >= 32323) {
if (PMA_MYSQL_INT_VERSION >= 32323) {
echo "\n";
?>
<td nowrap="nowrap">
<input type="checkbox" name="field_fulltext[]" value="<?php echo $i; ?>"<?php echo $checked_fulltext; ?> />
</td>
<?php
} // end if (MYSQL_INT_VERSION >= 32323)
} // end if (PMA_MYSQL_INT_VERSION >= 32323)
echo "\n";
} // end if (empty($num_indexes))
} // end if ($action ==...)
@@ -264,7 +264,7 @@ for ($i = 0 ; $i < $num_fields; $i++) {
<br />
<?php
if ($action == 'tbl_create.php3' && MYSQL_INT_VERSION >= 32300) {
if ($action == 'tbl_create.php3' && PMA_MYSQL_INT_VERSION >= 32300) {
echo "\n";
?>
<table>
@@ -363,4 +363,4 @@ echo "\n";
</table>
<br />
<center><?php echo show_docu('manual_Reference.html#CREATE_TABLE'); ?></center>
<center><?php echo PMA_showDocu('manual_Reference.html#CREATE_TABLE'); ?></center>

View File

@@ -41,7 +41,7 @@ if (!isset($is_db) || !$is_db) {
if (!isset($is_table) || !$is_table) {
// Not a valid table name -> back to the db_details.php3
if (!empty($table)) {
$is_table = @mysql_query('SHOW TABLES LIKE \'' . sql_addslashes($table, TRUE) . '\'');
$is_table = @mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
}
if (empty($table) || !@mysql_numrows($is_table)) {
header('Location: ' . $cfgPmaAbsoluteUri . 'db_details.php3?lang=' . $lang . '&server=' . $server . '&db=' . urlencode($db) . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
@@ -56,7 +56,7 @@ if (!isset($message)) {
$js_to_run = 'functions.js';
include('./header.inc.php3');
} else {
show_message($message);
PMA_showMessage($message);
}
@@ -109,18 +109,18 @@ if (isset($submitcomment)) {
$comment = stripslashes($comment);
}
if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
$local_query = 'ALTER TABLE ' . backquote($table) . ' COMMENT = \'' . sql_addslashes($comment) . '\'';
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}
}
if (isset($submittype)) {
$local_query = 'ALTER TABLE ' . backquote($table) . ' TYPE = ' . $tbl_type;
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $tbl_type;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}
if (isset($submitorderby) && !empty($order_field)) {
$order_field = backquote(urldecode($order_field));
$local_query = 'ALTER TABLE ' . backquote($table) . 'ORDER BY ' . $order_field;
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$order_field = PMA_backquote(urldecode($order_field));
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . 'ORDER BY ' . $order_field;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}
@@ -129,16 +129,16 @@ if (isset($submitorderby) && !empty($order_field)) {
* browse/select/insert/empty links
*/
// The 'show table' statement works correct since 3.23.03
if (MYSQL_INT_VERSION >= 32303) {
$local_query = 'SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\'';
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
if (PMA_MYSQL_INT_VERSION >= 32303) {
$local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'';
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$showtable = mysql_fetch_array($result);
$tbl_type = strtoupper($showtable['Type']);
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
} else {
$local_query = 'SELECT COUNT(*) AS count FROM ' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
$local_query = 'SELECT COUNT(*) AS count FROM ' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$showtable = array();
$num_rows = mysql_result($result, 0, 'count');
$show_comment = '';
@@ -152,17 +152,17 @@ if ($num_rows > 0) {
?>
<!-- first browse links -->
<p>
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&amp;pos=0">
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table)); ?>&amp;pos=0">
<b><?php echo $strBrowse; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="tbl_select.php3?<?php echo $url_query; ?>">
<b><?php echo $strSelect; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="tbl_change.php3?<?php echo $url_query; ?>">
<b><?php echo $strInsert; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DELETE FROM <?php echo js_format($table); ?>')">
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DELETE FROM <?php echo PMA_jsFormat($table); ?>')">
<b><?php echo $strEmpty; ?></b></a> ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
<b><?php echo $strDrop; ?></b></a> ]
</p>
<?php
@@ -176,8 +176,8 @@ if ($num_rows > 0) {
[ <a href="tbl_change.php3?<?php echo $url_query; ?>">
<b><?php echo $strInsert; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <b><?php echo $strEmpty; ?></b> ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
<b><?php echo $strDrop; ?></b></a> ]
</p>
<?php
@@ -194,8 +194,8 @@ if (!empty($show_comment)) {
} // end (1.)
// 2. Gets table keys and retains them
$local_query = 'SHOW KEYS FROM ' . backquote($table);
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
$local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$primary = '';
$ret_keys = array();
$pk_array = array(); // will be use to emphasis prim. keys in the table view
@@ -211,8 +211,8 @@ mysql_free_result($result);
// 3. Get fields
$local_query = 'SHOW FIELDS FROM ' . backquote($table);
$fields_rs = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0);
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table);
$fields_rs = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$fields_cnt = mysql_num_rows($fields_rs);
@@ -239,7 +239,7 @@ $fields_cnt = mysql_num_rows($fields_rs);
<th><?php echo ucfirst($strNull); ?></th>
<th><?php echo ucfirst($strDefault); ?></th>
<th><?php echo ucfirst($strExtra); ?></th>
<th colspan="<?php echo((MYSQL_INT_VERSION >= 32323) ? '6' : '5'); ?>"><?php echo ucfirst($strAction); ?></th>
<th colspan="<?php echo((PMA_MYSQL_INT_VERSION >= 32323) ? '6' : '5'); ?>"><?php echo ucfirst($strAction); ?></th>
</tr>
<?php
@@ -315,8 +315,8 @@ while ($row = mysql_fetch_array($fields_rs)) {
if ($fields_cnt > 1) {
echo "\n";
?>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' DROP ' . backquote($row['Field'])); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strFieldHasBeenDropped, htmlspecialchars($row['Field']))); ?>"
onclick="return confirmLink(this, 'ALTER TABLE <?php echo js_format($table); ?> DROP <?php echo js_format($row['Field']); ?>')">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP ' . PMA_backquote($row['Field'])); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strFieldHasBeenDropped, htmlspecialchars($row['Field']))); ?>"
onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP <?php echo PMA_jsFormat($row['Field']); ?>')">
<?php echo $strDrop; ?></a>
<?php
} else {
@@ -326,24 +326,24 @@ while ($row = mysql_fetch_array($fields_rs)) {
?>
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' DROP PRIMARY KEY, ADD PRIMARY KEY(' . $primary . backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAPrimaryKey, htmlspecialchars($row['Field']))); ?>"
onclick="return confirmLink(this, 'ALTER TABLE <?php echo js_format($table); ?> DROP PRIMARY KEY, ADD PRIMARY KEY(<?php echo js_format($row['Field']); ?>)')">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY, ADD PRIMARY KEY(' . $primary . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAPrimaryKey, htmlspecialchars($row['Field']))); ?>"
onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP PRIMARY KEY, ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
<?php echo $strPrimary; ?></a>
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' ADD INDEX(' . backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex ,htmlspecialchars($row['Field']))); ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex ,htmlspecialchars($row['Field']))); ?>">
<?php echo $strIndex; ?></a>
</td>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' ADD UNIQUE(' . backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex , htmlspecialchars($row['Field']))); ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex , htmlspecialchars($row['Field']))); ?>">
<?php echo $strUnique; ?></a>
</td>
<?php
if (MYSQL_INT_VERSION >= 32323) {
if (PMA_MYSQL_INT_VERSION >= 32323) {
echo "\n";
?>
<td nowrap="nowrap">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' ADD FULLTEXT(' . backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex , htmlspecialchars($row['Field']))); ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex , htmlspecialchars($row['Field']))); ?>">
<?php echo $strIdxFulltext; ?></a>
</td>
<?php
@@ -358,7 +358,7 @@ echo "\n";
?>
<tr>
<td colspan="<?php echo((MYSQL_INT_VERSION >= 32323) ? '13' : '12'); ?>">
<td colspan="<?php echo((PMA_MYSQL_INT_VERSION >= 32323) ? '13' : '12'); ?>">
<img src="./images/arrow_<?php echo $text_dir; ?>.gif" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
<i><?php echo $strWithChecked; ?></i>&nbsp;&nbsp;
<input type="submit" name="submit_mult" value="<?php echo $strChange; ?>" />
@@ -389,17 +389,17 @@ if ($fields_cnt > 20) {
?>
<!-- Browse links -->
<p>
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&amp;pos=0">
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table)); ?>&amp;pos=0">
<b><?php echo $strBrowse; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="tbl_select.php3?<?php echo $url_query; ?>">
<b><?php echo $strSelect; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="tbl_change.php3?<?php echo $url_query; ?>">
<b><?php echo $strInsert; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DELETE FROM <?php echo js_format($table); ?>')">
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DELETE FROM <?php echo PMA_jsFormat($table); ?>')">
<b><?php echo $strEmpty; ?></b></a> ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
<b><?php echo $strDrop; ?></b></a> ]
</p>
<?php
@@ -413,8 +413,8 @@ if ($fields_cnt > 20) {
[ <a href="tbl_change.php3?<?php echo $url_query; ?>">
<b><?php echo $strInsert; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <b><?php echo $strEmpty; ?></b> ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
<b><?php echo $strDrop; ?></b></a> ]
</p>
<?php
@@ -433,7 +433,7 @@ echo "\n\n";
<tr>
<td>
<?php
define('_IDX_INCLUDED_', 1);
define('PMA_IDX_INCLUDED', 1);
require ('./tbl_indexes.php3');
?>
</td>
@@ -448,25 +448,25 @@ if ($cfgShowStats) {
if (isset($showtable['Type']) && !eregi('ISAM|HEAP', $showtable['Type'])) {
$nonisam = TRUE;
}
if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE) {
if (PMA_MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE) {
// Gets some sizes
$mergetable = FALSE;
if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
$mergetable = TRUE;
}
list($data_size, $data_unit) = format_byte_down($showtable['Data_length']);
list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length']);
if ($mergetable == FALSE) {
list($index_size, $index_unit) = format_byte_down($showtable['Index_length']);
list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length']);
}
if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
list($free_size, $free_unit) = format_byte_down($showtable['Data_free']);
list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free']);
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
} else {
list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']);
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
}
list($tot_size, $tot_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']);
list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
if ($num_rows > 0) {
list($avg_size, $avg_unit) = format_byte_down(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
}
// Displays them
@@ -529,7 +529,7 @@ if ($cfgShowStats) {
?>
<tr>
<td colspan="3" align="center">
[<a href="sql.php3?<?php echo $url_query; ?>&amp;pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>"><?php echo $strOptimizeTable; ?></a>]
[<a href="sql.php3?<?php echo $url_query; ?>&amp;pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php echo $strOptimizeTable; ?></a>]
</td>
<tr>
<?php
@@ -659,17 +659,17 @@ echo "\n";
<input type="hidden" name="goto" value="tbl_properties.php3" />
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . show_docu('manual_Reference.html#SELECT'); ?>&nbsp;:<br />
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showDocu('manual_Reference.html#SELECT'); ?>&nbsp;:<br />
<div style="margin-bottom: 5px">
<textarea name="sql_query" rows="<?php echo $cfgTextareaRows; ?>" cols="<?php echo $cfgTextareaCols; ?>" wrap="virtual">
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : 'SELECT * FROM ' . backquote($table) . ' WHERE 1'); ?>
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE 1'); ?>
</textarea><br />
<input type="checkbox" name="show_query" value="y" checked="checked" />&nbsp;
<?php echo $strShowThisQuery; ?><br />
</div>
<?php
// loic1: displays import dump feature only if file upload available
$is_upload = (PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
$is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
? ((strtolower(ini_get('file_uploads')) == 'on' || ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
: (intval(@get_cfg_var('upload_max_filesize')));
if ($is_upload) {
@@ -684,7 +684,7 @@ echo "\n";
// Bookmark Support
if ($cfgBookmark['db'] && $cfgBookmark['table']) {
if (($bookmark_list = list_bookmarks($db, $cfgBookmark)) && count($bookmark_list) > 0) {
if (($bookmark_list = PMA_listBookmarks($db, $cfgBookmark)) && count($bookmark_list) > 0) {
echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
echo ' <div style="margin-bottom: 5px">' . "\n";
echo ' <select name="id_bookmark" style="vertical-align: middle">' . "\n";
@@ -730,7 +730,7 @@ while (list($junk, $fieldname) = each($aryFields)) {
</li>
<?php
if (MYSQL_INT_VERSION >= 32334) {
if (PMA_MYSQL_INT_VERSION >= 32334) {
?>
<!-- Order the table -->
<li>
@@ -791,7 +791,7 @@ echo "\n";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strFieldsEscapedBy; ?>&nbsp;
<input type="text" name="escaped" size="2" value="\" />&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strLinesTerminatedBy; ?>&nbsp;
<input type="text" name="add_character" size="2" value="<?php echo ((which_crlf() == "\n") ? '\n' : '\r\n'); ?>" />&nbsp;&nbsp;
<input type="text" name="add_character" size="2" value="<?php echo ((PMA_whichCrlf() == "\n") ? '\n' : '\r\n'); ?>" />&nbsp;&nbsp;
</td>
<td valign="middle">
<input type="checkbox" name="drop" value="1" />
@@ -802,7 +802,7 @@ echo "\n";
<?php echo $strExtendedInserts; ?><br />
<?php
// Add backquotes checkbox
if (MYSQL_INT_VERSION >= 32306) {
if (PMA_MYSQL_INT_VERSION >= 32306) {
?>
<input type="checkbox" name="use_backquotes" value="1" />
<?php echo $strUseBackquotes; ?><br />
@@ -815,7 +815,7 @@ echo "\n";
<?php echo $strSend . "\n"; ?>
<?php
// zip, gzip and bzip2 encode features
if (PHP_INT_VERSION >= 40004) {
if (PMA_PHP_INT_VERSION >= 40004) {
$is_zip = (isset($cfgZipDump) && $cfgZipDump && @function_exists('gzcompress'));
$is_gzip = (isset($cfgGZipDump) && $cfgGZipDump && @function_exists('gzencode'));
$is_bzip = (isset($cfgBZipDump) && $cfgBZipDump && @function_exists('bzcompress'));
@@ -850,7 +850,7 @@ echo "\n";
&nbsp;<?php echo $strStartingRecord; ?>&nbsp;
<input type="text" name="limit_from" value="0" size="5" style="vertical-align: middle" />
&nbsp;--&nbsp;<?php echo $strNbRecords; ?>&nbsp;
<input type="text" name="limit_to" size="5" value="<?php echo count_records($db, $table, TRUE); ?>" style="vertical-align: middle" />
<input type="text" name="limit_to" size="5" value="<?php echo PMA_countRecords($db, $table, TRUE); ?>" style="vertical-align: middle" />
</td>
</tr>
<tr>
@@ -905,7 +905,7 @@ echo "\n";
<option value=""></option>
<?php
// The function used below is defined in "common.lib.php3"
available_databases('main.php3?lang=' . $lang . '&amp;server=' . $server);
PMA_availableDatabases('main.php3?lang=' . $lang . '&amp;server=' . $server);
for ($i = 0; $i < $num_dbs; $i++) {
echo ' ';
echo '<option value="' . str_replace('"', '&quot;', $dblist[$i]) . '">' . htmlspecialchars($dblist[$i]) . '</option>';
@@ -979,7 +979,7 @@ for ($i = 0; $i < $num_dbs; $i++) {
</li>
<?php
if (MYSQL_INT_VERSION >= 32322) {
if (PMA_MYSQL_INT_VERSION >= 32322) {
if ($tbl_type == 'MYISAM' or $tbl_type == 'BDB') {
?>
<!-- Table maintenance -->
@@ -993,9 +993,9 @@ if (MYSQL_INT_VERSION >= 32322) {
if ($tbl_type == 'MYISAM') {
?>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('CHECK TABLE ' . backquote($table)); ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('CHECK TABLE ' . PMA_backquote($table)); ?>">
<?php echo $strCheckTable; ?></a>&nbsp;
<?php echo show_docu('manual_Reference.html#CHECK_TABLE') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#CHECK_TABLE') . "\n"; ?>
</td>
<td>&nbsp;-&nbsp;</td>
<?php
@@ -1004,9 +1004,9 @@ if (MYSQL_INT_VERSION >= 32322) {
if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
?>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ANALYZE TABLE ' . backquote($table)); ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ANALYZE TABLE ' . PMA_backquote($table)); ?>">
<?php echo $strAnalyzeTable; ?></a>&nbsp;
<?php echo show_docu('manual_Reference.html#ANALYZE_TABLE') . "\n";?>
<?php echo PMA_showDocu('manual_Reference.html#ANALYZE_TABLE') . "\n";?>
</td>
<?php
}
@@ -1020,9 +1020,9 @@ if (MYSQL_INT_VERSION >= 32322) {
if ($tbl_type == 'MYISAM') {
?>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('REPAIR TABLE ' . backquote($table)); ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('REPAIR TABLE ' . PMA_backquote($table)); ?>">
<?php echo $strRepairTable; ?></a>&nbsp;
<?php echo show_docu('manual_Reference.html#REPAIR_TABLE') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#REPAIR_TABLE') . "\n"; ?>
</td>
<td>&nbsp;-&nbsp;</td>
<?php
@@ -1031,9 +1031,9 @@ if (MYSQL_INT_VERSION >= 32322) {
if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
?>
<td>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>">
<?php echo $strOptimizeTable; ?></a>&nbsp;
<?php echo show_docu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
</td>
<?php
}
@@ -1116,7 +1116,7 @@ if (MYSQL_INT_VERSION >= 32322) {
<option value="MERGE"<?php if ($tbl_type == 'MRG_MYISAM') echo ' selected="selected"'; ?>>Merge</option>
</select>&nbsp;
<input type="submit" name="submittype" value="<?php echo $strGo; ?>" style="vertical-align: middle" />&nbsp;
<?php echo show_docu('manual_Table_types.html#Table_types') . "\n"; ?>
<?php echo PMA_showDocu('manual_Table_types.html#Table_types') . "\n"; ?>
</form>
</li>
<?php
@@ -1131,9 +1131,9 @@ else { // MySQL < 3.23.22
<li style="vertical-align: top">
<div style="margin-bottom: 10px">
<?php echo $strTableMaintenance; ?>&nbsp;:&nbsp;
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>">
<?php echo $strOptimizeTable; ?></a>&nbsp;
<?php echo show_docu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
<?php echo PMA_showDocu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
</div>
</li>
<?php
@@ -1143,15 +1143,15 @@ else { // MySQL < 3.23.22
<!-- Flushes the table -->
<li>
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('FLUSH TABLE ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenFlushed, htmlspecialchars($table))); if ($cfgShowTooltip) echo '&amp;reload=1'; ?>">
<a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('FLUSH TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenFlushed, htmlspecialchars($table))); if ($cfgShowTooltip) echo '&amp;reload=1'; ?>">
<?php echo $strFlushTable; ?></a>
<br /><br />
</li>
<!-- Deletes the table -->
<li>
<a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
<a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
<?php echo $strDropTable; ?></a>
</li>

View File

@@ -129,10 +129,10 @@ while ($i < $tbl_result_cnt) {
// The fields list per selected tables
if ($tbl_names[$tbl] == ' selected="selected"') {
$fld[$k++] = backquote($tbl) . '.*';
$fld[$k++] = PMA_backquote($tbl) . '.*';
while ($j < $fld_results_cnt) {
$fld[$k] = mysql_field_name($fld_results, $j);
$fld[$k] = backquote($tbl) . '.' . backquote($fld[$k]);
$fld[$k] = PMA_backquote($tbl) . '.' . PMA_backquote($fld[$k]);
$k++;
$j++;
} // end while
@@ -505,9 +505,9 @@ for ($y = 0; $y <= $row; $y++) {
} else {
$stripped_or = ${$or}[$x];
}
} else {
$stripped_or = '';
}
} else {
$stripped_or = '';
}
?>
<td align="center" bgcolor="<?php echo $bgcolor; ?>">
<textarea cols="20" rows="2" style="width: <?php echo $widem; ?>" name="Or<?php echo $w . '[' . $z . ']'; ?>"><?php echo htmlspecialchars($stripped_or); ?></textarea>
@@ -699,7 +699,7 @@ for ($x = 0; $x < sizeof($TableList); $x++) {
if ($x) {
$qry_from .= ', ';
}
$qry_from .= backquote(urldecode($TableList[$x]));
$qry_from .= PMA_backquote(urldecode($TableList[$x]));
} // end for
if (!empty($qry_from)) {
$encoded_qry .= urlencode('FROM ' . $qry_from . "\n");

View File

@@ -31,17 +31,17 @@ if (isset($new_name) && trim($new_name) != '') {
}
// Ensure the target is valid
if (count($dblist) > 0 && pmaIsInto($db, $dblist) == -1) {
if (count($dblist) > 0 && PMA_isInto($db, $dblist) == -1) {
exit();
}
if (MYSQL_INT_VERSION < 32306) {
check_reserved_words($new_name, $err_url);
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($new_name, $err_url);
}
include('./header.inc.php3');
mysql_select_db($db);
$sql_query = 'ALTER TABLE ' . backquote($old_name) . ' RENAME ' . backquote($new_name);
$result = mysql_query($sql_query) or mysql_die('', '', '', $err_url);
$sql_query = 'ALTER TABLE ' . PMA_backquote($old_name) . ' RENAME ' . PMA_backquote($new_name);
$result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$message = sprintf($strRenameTableOK, $old_name, $table);
$reload = 1;
}
@@ -52,7 +52,7 @@ if (isset($new_name) && trim($new_name) != '') {
*/
else {
include('./header.inc.php3');
mysql_die($strTableEmpty, '', '', $err_url);
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
}

View File

@@ -74,7 +74,7 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
if ($val == 'null') {
// void
} else {
$val = "'" . sql_addslashes(urldecode($val)) . "'";
$val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'";
}
} else {
$val = "''";
@@ -85,7 +85,7 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
$f = 'field_' . md5($key);
if (!empty($$f)) {
$val = implode(',', $$f);
$val = "'" . sql_addslashes(urldecode($val)) . "'";
$val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'";
} else {
$val = "''";
}
@@ -94,7 +94,7 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
if (get_magic_quotes_gpc()) {
$val = "'" . str_replace('\\"', '"', $val) . "'";
} else {
$val = "'" . sql_addslashes($val) . "'";
$val = "'" . PMA_sqlAddslashes($val) . "'";
}
break;
} // end switch
@@ -102,17 +102,17 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
// No change for this column and no MySQL function is used -> next column
if (empty($funcs[$encoded_key])
&& isset($fields_prev) && isset($fields_prev[$encoded_key])
&& ("'" . sql_addslashes(urldecode($fields_prev[$encoded_key])) . "'" == $val)) {
&& ("'" . PMA_sqlAddslashes(urldecode($fields_prev[$encoded_key])) . "'" == $val)) {
continue;
}
else if (!empty($val)) {
if (empty($funcs[$encoded_key])) {
$valuelist .= backquote($key) . ' = ' . $val . ', ';
$valuelist .= PMA_backquote($key) . ' = ' . $val . ', ';
} else if ($val == '\'\''
&& (ereg('^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$', $funcs[$encoded_key]))) {
$valuelist .= backquote($key) . ' = ' . $funcs[$encoded_key] . '(), ';
$valuelist .= PMA_backquote($key) . ' = ' . $funcs[$encoded_key] . '(), ';
} else {
$valuelist .= backquote($key) . ' = ' . $funcs[$encoded_key] . "($val), ";
$valuelist .= PMA_backquote($key) . ' = ' . $funcs[$encoded_key] . "($val), ";
}
}
} // end while
@@ -120,8 +120,8 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
// Builds the sql upate query
$valuelist = ereg_replace(', $', '', $valuelist);
if (!empty($valuelist)) {
$query = 'UPDATE ' . backquote($table) . ' SET ' . $valuelist . ' WHERE' . $primary_key
. ((MYSQL_INT_VERSION >= 32300) ? ' LIMIT 1' : '');
$query = 'UPDATE ' . PMA_backquote($table) . ' SET ' . $valuelist . ' WHERE' . $primary_key
. ((PMA_MYSQL_INT_VERSION >= 32300) ? ' LIMIT 1' : '');
$message = $strAffectedRows . '&nbsp;';
}
// No change -> move back to the calling script
@@ -148,7 +148,7 @@ else {
while (list($key, $val) = each($fields)) {
$encoded_key = $key;
$key = urldecode($key);
$fieldlist .= backquote($key) . ', ';
$fieldlist .= PMA_backquote($key) . ', ';
switch (strtolower($val)) {
case 'null':
@@ -161,7 +161,7 @@ else {
if ($val == 'null') {
// void
} else {
$val = "'" . sql_addslashes(urldecode($val)) . "'";
$val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'";
}
} else {
$val = "''";
@@ -172,7 +172,7 @@ else {
$f = 'field_' . md5($key);
if (!empty($$f)) {
$val = implode(',', $$f);
$val = "'" . sql_addslashes(urldecode($val)) . "'";
$val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'";
} else {
$val = "''";
}
@@ -181,7 +181,7 @@ else {
if (get_magic_quotes_gpc()) {
$val = "'" . str_replace('\\"', '"', $val) . "'";
} else {
$val = "'" . sql_addslashes($val) . "'";
$val = "'" . PMA_sqlAddslashes($val) . "'";
}
break;
} // end switch
@@ -199,7 +199,7 @@ else {
// Builds the sql insert query
$fieldlist = ereg_replace(', $', '', $fieldlist);
$valuelist = ereg_replace(', $', '', $valuelist);
$query = 'INSERT INTO ' . backquote($table) . ' (' . $fieldlist . ') VALUES (' . $valuelist . ')';
$query = 'INSERT INTO ' . PMA_backquote($table) . ' (' . $fieldlist . ') VALUES (' . $valuelist . ')';
$message = $strInsertedRows . '&nbsp;';
} // end row insertion
@@ -215,7 +215,7 @@ $result = mysql_query($query);
if (!$result) {
$error = mysql_error();
include('./header.inc.php3');
mysql_die($error, '', '', $url_err);
PMA_mysqlDie($error, '', '', $url_err);
} else {
if (@mysql_affected_rows()) {
$message .= @mysql_affected_rows();

View File

@@ -26,7 +26,7 @@ if (!isset($param) || $param[0] == '') {
include('./header.inc.php3');
$result = @mysql_list_fields($db, $table);
if (!$result) {
mysql_die('', 'mysql_list_fields(' . $db . ', ' . $table . ')', '', $err_url);
PMA_mysqlDie('', 'mysql_list_fields(' . $db . ', ' . $table . ')', '', $err_url);
}
else {
// Gets the list and number of fields
@@ -65,7 +65,7 @@ if (!isset($param) || $param[0] == '') {
<li>
<?php echo $strAddSearchConditions; ?><br />
<input type="text" name="where" />&nbsp;
<?php print show_docu("manual_Reference.html#Functions") . "\n"; ?>
<?php print PMA_showDocu("manual_Reference.html#Functions") . "\n"; ?>
<br /><br />
<?php echo '<i>' . $strOr . '</i> ' . $strDoAQuery; ?><br />
<table border="<?php echo $cfgBorder; ?>">
@@ -130,16 +130,16 @@ if (!isset($param) || $param[0] == '') {
*/
else {
// Builds the query
$sql_query = 'SELECT ' . backquote(urldecode($param[0]));
$sql_query = 'SELECT ' . PMA_backquote(urldecode($param[0]));
$i = 0;
$c = count($param);
while ($i < $c) {
if ($i > 0) {
$sql_query .= ',' . backquote(urldecode($param[$i]));
$sql_query .= ',' . PMA_backquote(urldecode($param[$i]));
}
$i++;
}
$sql_query .= ' FROM ' . backquote($table);
$sql_query .= ' FROM ' . PMA_backquote($table);
// The where clause
if ($where != '') {
$sql_query .= ' WHERE ' . ((get_magic_quotes_gpc()) ? stripslashes($where) : $where);
@@ -158,7 +158,7 @@ else {
if (get_magic_quotes_gpc()) {
$fields[$i] = stripslashes($fields[$i]);
}
$fields[$i] = sql_addslashes($fields[$i], TRUE);
$fields[$i] = PMA_sqlAddslashes($fields[$i], TRUE);
}
else if ($types[$i] == 'date' || $types[$i] == 'time') {
$quot = '\'';
@@ -176,12 +176,12 @@ else {
$quot = '';
$cmp = '=';
} // end if
$sql_query .= ' AND ' . backquote(urldecode($names[$i])) . " $cmp $quot$fields[$i]$quot";
$sql_query .= ' AND ' . PMA_backquote(urldecode($names[$i])) . " $cmp $quot$fields[$i]$quot";
} // end if
} // end for
} // end if
if ($orderField != '--nil--') {
$sql_query .= ' ORDER BY ' . backquote(urldecode($orderField)) . ' ' . $order;
$sql_query .= ' ORDER BY ' . PMA_backquote(urldecode($orderField)) . ' ' . $order;
} // end if
$url_query = 'lang=' . $lang

View File

@@ -32,13 +32,13 @@ $err_url = 'user_details.php3'
* @global integer the server to use (refers to the number in the
* configuration file)
*
* @see checkDb()
* @see PMA_checkDb()
*
* @TODO "SHOW GRANTS" statements is available and buggyless since
* MySQL 3.23.4 and it seems not to return privileges of the anonymous
* user while these privileges applies to all users.
*/
function tableGrants(&$host_db_result, $dbcheck = FALSE) {
function PMA_tableGrants(&$host_db_result, $dbcheck = FALSE) {
global $lang, $server;
?>
@@ -112,13 +112,13 @@ function tableGrants(&$host_db_result, $dbcheck = FALSE) {
$bgcolor = ($i % 2) ? $GLOBALS['cfgBgcolorOne'] : $GLOBALS['cfgBgcolorTwo'];
$revoke_url = 'sql.php3'
. '?' . $url_query
. '&amp;sql_query=' . urlencode('REVOKE ' . $priv . ' ON ' . backquote($db) . '.' . backquote($table) . ' FROM \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'')
. '&amp;sql_query=' . urlencode('REVOKE ' . $priv . ' ON ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' FROM \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'')
. '&amp;zero_rows=' . urlencode(sprintf($GLOBALS['strRevokeMessage'], ' <span style="color: #002E80">' . $row['User'] . '@' . $row['Host'] . '</span>'))
. '&amp;goto=user_details.php3';
if ($grantopt) {
$revoke_grant_url = 'sql.php3'
. '?' . $url_query
. '&amp;sql_query=' . urlencode('REVOKE GRANT OPTION ON ' . backquote($db) . '.' . backquote($table) . ' FROM \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'')
. '&amp;sql_query=' . urlencode('REVOKE GRANT OPTION ON ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' FROM \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'')
. '&amp;zero_rows=' . urlencode(sprintf($GLOBALS['strRevokeGrantMessage'], ' <span style="color: #002E80">' . $row['User'] . '@' . $row['Host'] . '</span>'))
. '&amp;goto=user_details.php3';
}
@@ -200,7 +200,7 @@ function tableGrants(&$host_db_result, $dbcheck = FALSE) {
echo "\n";
return TRUE;
} // end of the 'tableGrants()' function
} // end of the 'PMA_tableGrants()' function
/**
@@ -210,9 +210,9 @@ function tableGrants(&$host_db_result, $dbcheck = FALSE) {
*
* @return boolean true/false in case of success/failure
*
* @see tableGrants()
* @see PMA_tableGrants()
*/
function checkDb($dbcheck)
function PMA_checkDb($dbcheck)
{
$local_query = 'SELECT Host, User FROM mysql.user ORDER BY Host, User';
$result = mysql_query($local_query);
@@ -221,10 +221,10 @@ function checkDb($dbcheck)
if (!$host_usr_cnt) {
return FALSE;
}
tableGrants($result, $dbcheck);
PMA_tableGrants($result, $dbcheck);
return TRUE;
} // end of the 'checkDb()' function
} // end of the 'PMA_checkDb()' function
/**
@@ -235,9 +235,9 @@ function checkDb($dbcheck)
*
* @return boolean always true
*
* @see normalOperations()
* @see PMA_normalOperations()
*/
function tablePrivileges($form, $row = FALSE)
function PMA_tablePrivileges($form, $row = FALSE)
{
?>
@@ -286,7 +286,7 @@ function tablePrivileges($form, $row = FALSE)
echo "\n";
return TRUE;
} // end of the 'tablePrivileges()' function
} // end of the 'PMA_tablePrivileges()' function
/**
@@ -298,9 +298,9 @@ function tablePrivileges($form, $row = FALSE)
* @global integer the server to use (refers to the number in the
* configuration file)
*
* @see tablePrivileges()
* @see PMA_tablePrivileges()
*/
function normalOperations()
function PMA_normalOperations()
{
global $lang, $server;
?>
@@ -311,7 +311,7 @@ function normalOperations()
<div style="margin-bottom: 10px">
<a href="user_details.php3?lang=<?php echo $lang; ?>&amp;server=<?php echo $server; ?>&amp;db=mysql&amp;table=user&amp;mode=reload">
<?php echo $GLOBALS['strReloadMySQL']; ?></a>&nbsp;
<?php print show_docu('manual_Reference.html#FLUSH'); ?>
<?php print PMA_showDocu('manual_Reference.html#FLUSH'); ?>
</div>
</li>
@@ -403,7 +403,7 @@ function normalOperations()
</table>
<?php
echo "\n";
tablePrivileges('addUserForm');
PMA_tablePrivileges('addUserForm');
?>
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="server" value="<?php echo $server; ?>" />
@@ -415,7 +415,7 @@ function normalOperations()
<?php
return TRUE;
} // end of the 'normalOperations()' function
} // end of the 'PMA_normalOperations()' function
/**
@@ -433,9 +433,9 @@ function normalOperations()
* @global string the database to check grants for
* @global string the table to check grants for
*
* @see tablePrivileges()
* @see PMA_tablePrivileges()
*/
function grantOperations($grants)
function PMA_grantOperations($grants)
{
global $lang, $server, $host, $pma_user;
global $dbgrant, $tablegrant;
@@ -515,7 +515,7 @@ function grantOperations($grants)
// echo '<option></option>' . "\n";
// }
if (isset($dbgrant)) {
$result = mysql_query('SHOW TABLES FROM ' . backquote($dbgrant));
$result = mysql_query('SHOW TABLES FROM ' . PMA_backquote($dbgrant));
if (@mysql_num_rows($result)) {
while ($row = mysql_fetch_row($result)) {
$selected = ((isset($tablegrant) && $row[0] == $tablegrant) ? ' selected="selected"' : '');
@@ -551,7 +551,7 @@ function grantOperations($grants)
echo ' ' . '</select>' . "\n";
}
else {
$result = mysql_query('SHOW COLUMNS FROM ' . backquote($dbgrant) . '.' . backquote($tablegrant));
$result = mysql_query('SHOW COLUMNS FROM ' . PMA_backquote($dbgrant) . '.' . PMA_backquote($tablegrant));
if (@mysql_num_rows($result)) {
echo ' '
. '<select name="colgrant[]" multiple="multiple" onchange="anycolumn[1].checked = true">' . "\n";
@@ -583,7 +583,7 @@ function grantOperations($grants)
</table>
<?php
echo "\n";
tablePrivileges('userGrants', $grants);
PMA_tablePrivileges('userGrants', $grants);
?>
<input type="submit" name="upd_grants" value="<?php echo $GLOBALS['strGo']; ?>" />
</form>
@@ -594,7 +594,7 @@ function grantOperations($grants)
echo "\n";
return TRUE;
} // end of the 'grantOperations()' function
} // end of the 'PMA_grantOperations()' function
/**
@@ -611,14 +611,14 @@ function grantOperations($grants)
* @global string the host name to check grants for
* @global string the username to check grants for
*
* @see tablePrivileges()
* @see PMA_tablePrivileges()
*/
function editOperations($host, $user)
function PMA_editOperations($host, $user)
{
global $lang, $server;
global $host, $pma_user;
$result = mysql_query('SELECT * FROM mysql.user WHERE User = \'' . sql_addslashes($user) . '\' AND Host = \'' . sql_addslashes($host) . '\'');
$result = mysql_query('SELECT * FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($user) . '\' AND Host = \'' . PMA_sqlAddslashes($host) . '\'');
$rows = @mysql_num_rows($result);
if (!$rows) {
@@ -677,7 +677,7 @@ function editOperations($host, $user)
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="4" align="<?php echo $cell_align_left; ?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $GLOBALS['strOr']; ?></td>
<td colspan="4" align="<?php echo $GLOBALS['cell_align_left']; ?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $GLOBALS['strOr']; ?></td>
</tr>
<tr>
<td>
@@ -709,7 +709,7 @@ function editOperations($host, $user)
<form action="user_details.php3" method="post" name="privForm">
<?php echo $GLOBALS['strEditPrivileges'] . "\n"; ?>
<?php
tablePrivileges('privForm', $row);
PMA_tablePrivileges('privForm', $row);
echo "\n";
?>
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
@@ -725,7 +725,7 @@ function editOperations($host, $user)
echo "\n";
return TRUE;
} // end of the 'editOperations()' function
} // end of the 'PMA_editOperations()' function
/**
@@ -740,7 +740,7 @@ function editOperations($host, $user)
* @global integer the server to use (refers to the number in the
* configuration file)
*/
function tableUsers($host = FALSE, $user = FALSE)
function PMA_tableUsers($host = FALSE, $user = FALSE)
{
global $lang, $server;
@@ -749,8 +749,8 @@ function tableUsers($host = FALSE, $user = FALSE)
$local_query .= ' WHERE 1 ';
}
if ($host) {
$local_query .= ' AND Host = \'' . sql_addslashes($host) . '\'';
$local_query .= ' AND User = \'' . sql_addslashes($user) . '\'';
$local_query .= ' AND Host = \'' . PMA_sqlAddslashes($host) . '\'';
$local_query .= ' AND User = \'' . PMA_sqlAddslashes($user) . '\'';
}
$local_query .= ' ORDER BY Host, User';
$result = mysql_query($local_query);
@@ -894,7 +894,7 @@ function tableUsers($host = FALSE, $user = FALSE)
echo "\n";
return TRUE;
} // end of the 'tableUsers()' function
} // end of the 'PMA_tableUsers()' function
/**
@@ -907,7 +907,7 @@ function tableUsers($host = FALSE, $user = FALSE)
* @global integer the server to use (refers to the number in the
* configuration file)
*/
function confirm($the_host, $the_user) {
function PMA_confirm($the_host, $the_user) {
global $lang, $server;
if (get_magic_quotes_gpc() == 1) {
@@ -933,7 +933,7 @@ function confirm($the_host, $the_user) {
echo "\n";
include('./footer.inc.php3');
} // end of the 'confirm()' function
} // end of the 'PMA_confirm()' function
@@ -943,7 +943,7 @@ function confirm($the_host, $the_user) {
*/
$result = @mysql_query('USE mysql');
if (mysql_error()) {
mysql_die($GLOBALS['strNoRights'], '', FALSE, '');
PMA_mysqlDie($GLOBALS['strNoRights'], '', FALSE, '');
}
$result = @mysql_query('SELECT COUNT(Password) FROM mysql.user');
$password_field = (mysql_result($result, 0) ? 'Password' : 'password');
@@ -980,7 +980,7 @@ if (!isset($submit_updProfile)) {
}
if (isset($message)) {
$show_query = 'y';
show_message($message);
PMA_showMessage($message);
}
if (isset($db_bkp)) {
@@ -998,7 +998,7 @@ if (isset($table_bkp)) {
*/
// Confirms an action
if (isset($confirm) && $confirm) {
confirm($delete_host, $delete_user);
PMA_confirm($delete_host, $delete_user);
exit();
}
@@ -1019,7 +1019,7 @@ else if (isset($delete) && $delete
$delete_host = stripslashes($delete_host);
$delete_user = stripslashes($delete_user);
}
$common_where = ' WHERE Host = \'' . sql_addslashes($delete_host) . '\' AND User = \'' . sql_addslashes($delete_user) . '\'';
$common_where = ' WHERE Host = \'' . PMA_sqlAddslashes($delete_host) . '\' AND User = \'' . PMA_sqlAddslashes($delete_user) . '\'';
// Delete Grants First!
$sql_query = 'DELETE FROM mysql.db' . $common_where;
@@ -1039,9 +1039,9 @@ else if (isset($delete) && $delete
$sql_query = $sql_query_cpy;
unset($sql_query_cpy);
if ($result) {
show_message(sprintf($strDeleteUserMessage, '<span style="color: #002E80">' . $delete_user . '@' . $delete_host . '</span>') . '<br />' . $strRememberReload);
PMA_showMessage(sprintf($strDeleteUserMessage, '<span style="color: #002E80">' . $delete_user . '@' . $delete_host . '</span>') . '<br />' . $strRememberReload);
} else {
show_message($strDeleteFailed);
PMA_showMessage($strDeleteFailed);
}
}
@@ -1088,12 +1088,12 @@ else if (isset($submit_addUser)) {
}
$sql_query = 'INSERT INTO mysql.user '
. 'SET Host = \'' . sql_addslashes($host) . '\', User = \'' . sql_addslashes($pma_user) . '\', ' . $password_field . ' = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . sql_addslashes($pma_pw) . '\')')
. 'SET Host = \'' . PMA_sqlAddslashes($host) . '\', User = \'' . PMA_sqlAddslashes($pma_user) . '\', ' . $password_field . ' = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . PMA_sqlAddslashes($pma_pw) . '\')')
. ', ' . $sql_query;
$result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url);
$result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
unset($host);
unset($pma_user);
show_message($strAddUserMessage . '<br />' . $strRememberReload);
PMA_showMessage($strAddUserMessage . '<br />' . $strRememberReload);
} // end else
}
@@ -1117,7 +1117,7 @@ else if (isset($submit_updProfile)) {
$new_server = stripslashes($new_server);
}
if ($new_server != '' && $new_server != $host) {
$common_upd .= 'Host = \'' . sql_addslashes($new_server) . '\'';
$common_upd .= 'Host = \'' . PMA_sqlAddslashes($new_server) . '\'';
} else if (isset($new_server)) {
unset($new_server);
}
@@ -1129,7 +1129,7 @@ else if (isset($submit_updProfile)) {
}
if ($new_user != '' && $new_user != $pma_user) {
$common_upd .= (empty($common_upd) ? '' : ', ')
. 'User = \'' . sql_addslashes($new_user) . '\'';
. 'User = \'' . PMA_sqlAddslashes($new_user) . '\'';
} else if (isset($new_user)) {
unset($new_user);
}
@@ -1152,17 +1152,17 @@ else if (isset($submit_updProfile)) {
}
else {
$sql_query = (empty($common_upd) ? '' : $common_upd . ', ')
. $password_field . ' = ' . (($new_pw == '') ? '\'\'' : 'PASSWORD(\'' . sql_addslashes($new_pw) . '\')');
. $password_field . ' = ' . (($new_pw == '') ? '\'\'' : 'PASSWORD(\'' . PMA_sqlAddslashes($new_pw) . '\')');
}
if (!empty($sql_query)) {
$common_where = ' WHERE Host = \'' . sql_addslashes($host) . '\' AND User = \'' . sql_addslashes($pma_user) . '\'';
$common_where = ' WHERE Host = \'' . PMA_sqlAddslashes($host) . '\' AND User = \'' . PMA_sqlAddslashes($pma_user) . '\'';
$sql_query_cpy = '';
// Updates profile
$sql_query = 'UPDATE user SET ' . $sql_query . $common_where;
$sql_query_cpy = $sql_query;
$result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url . '&amp;host=' . urlencode($host) . '&amp;pma_user=' . urlencode($pma_user) . '&amp;edit=1');
$result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&amp;host=' . urlencode($host) . '&amp;pma_user=' . urlencode($pma_user) . '&amp;edit=1');
// Updates grants
if (isset($new_server) || isset($new_user)) {
@@ -1189,12 +1189,12 @@ else if (isset($submit_updProfile)) {
echo '<h1>' . "\n";
echo ' ' . $strHost . ' ' . $host . ' - ' . $strUser . ' ' . (($pma_user != '') ? $pma_user : $strAny) . "\n";
echo '</h1>' . "\n";
show_message($strUpdateProfileMessage . '<br />' . $strRememberReload);
PMA_showMessage($strUpdateProfileMessage . '<br />' . $strRememberReload);
} else {
echo '<h1>' . "\n";
echo ' ' . $strHost . ' ' . $host . ' - ' . $strUser . ' ' . (($pma_user != '') ? $pma_user : $strAny) . "\n";
echo '</h1>' . "\n";
show_message($strNoModification);
PMA_showMessage($strNoModification);
}
}
@@ -1224,9 +1224,9 @@ else if (isset($submit_chgPriv)) {
$sql_query = 'UPDATE user SET '
. $sql_query
. ' WHERE Host = \'' . sql_addslashes($host) . '\' AND User = \'' . sql_addslashes($pma_user) . '\'';
$result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url . '&amp;host=' . urlencode($host) . '&amp;pma_user=' . urlencode($pma_user) . '&amp;edit=1');
show_message(sprintf($strUpdatePrivMessage, '<span style="color: #002E80">' . $pma_user . '@' . $host . '</span>') . '<br />' . $strRememberReload);
. ' WHERE Host = \'' . PMA_sqlAddslashes($host) . '\' AND User = \'' . PMA_sqlAddslashes($pma_user) . '\'';
$result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&amp;host=' . urlencode($host) . '&amp;pma_user=' . urlencode($pma_user) . '&amp;edit=1');
PMA_showMessage(sprintf($strUpdatePrivMessage, '<span style="color: #002E80">' . $pma_user . '@' . $host . '</span>') . '<br />' . $strRememberReload);
}
// Revoke/Grant privileges
@@ -1249,7 +1249,7 @@ else if (isset($grants) && $grants) {
if (get_magic_quotes_gpc()) {
$colgrant[$i] = stripslashes($colgrant[$i]);
}
$col_list .= (empty($col_list) ? backquote($colgrant[$i]) : ', ' . backquote($colgrant[$i]));
$col_list .= (empty($col_list) ? PMA_backquote($colgrant[$i]) : ', ' . PMA_backquote($colgrant[$i]));
} // end for
unset($colgrant);
$col_list = ' (' . $col_list . ')';
@@ -1279,15 +1279,15 @@ else if (isset($grants) && $grants) {
}
} // end if
$sql_query .= ' ON '
. (($anydb || $dbgrant == '') ? '*' : backquote($dbgrant))
. (($anydb || $dbgrant == '') ? '*' : PMA_backquote($dbgrant))
. '.'
. (($anytable || $tablegrant == '') ? '*' : backquote($tablegrant));
. (($anytable || $tablegrant == '') ? '*' : PMA_backquote($tablegrant));
$sql_query .= ' TO ' . '\'' . sql_addslashes($pma_user) . '\'' . '@' . '\'' . sql_addslashes($host) . '\'';
$sql_query .= ' TO ' . '\'' . PMA_sqlAddslashes($pma_user) . '\'' . '@' . '\'' . PMA_sqlAddslashes($host) . '\'';
$sql_query = 'GRANT ' . $sql_query . $priv_grant;
$result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url . '&amp;host=' . urlencode($host) . '&amp;pma_user=' . urlencode($pma_user) . '&amp;grants=1');
show_message($strAddPrivMessage . '.<br />' . $strRememberReload);
$result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&amp;host=' . urlencode($host) . '&amp;pma_user=' . urlencode($pma_user) . '&amp;grants=1');
PMA_showMessage($strAddPrivMessage . '.<br />' . $strRememberReload);
} // end if
}
@@ -1298,8 +1298,8 @@ else if (isset($grants) && $grants) {
*/
// Edit an user properies
if (isset($edit) && $edit) {
tableUsers($host, $pma_user);
editOperations($host, $pma_user);
PMA_tableUsers($host, $pma_user);
PMA_editOperations($host, $pma_user);
}
// Revoke/Grant privileges for an user
@@ -1307,7 +1307,7 @@ else if (isset($grants) && $grants) {
// Displays the full list of privileges for this host & user
$infos['Host'] = $host;
$infos['User'] = $pma_user;
tableGrants($infos);
PMA_tableGrants($infos);
// Displays the list of privileges for user on the selected db/table/column
$user_priv = array();
@@ -1317,7 +1317,7 @@ else if (isset($grants) && $grants) {
$list_priv_new = array();
// Gets globals privileges
$result = mysql_query('SELECT * FROM mysql.user WHERE (Host = \'' . sql_addslashes($host) . '\' OR Host = \'%\') AND (User = \'' . sql_addslashes($pma_user) . '\' OR User = \'\')');
$result = mysql_query('SELECT * FROM mysql.user WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\')');
$row = @mysql_fetch_array($result);
if ($row) {
while (list(,$priv) = each($list_priv)) {
@@ -1340,7 +1340,7 @@ else if (isset($grants) && $grants) {
if (get_magic_quotes_gpc()) {
$dbgrant = stripslashes($dbgrant);
}
$result = mysql_query('SELECT * FROM mysql.db WHERE (Host = \'' . sql_addslashes($host) . '\' OR Host = \'%\') AND (User = \'' . sql_addslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . sql_addslashes($dbgrant) . '\'');
$result = mysql_query('SELECT * FROM mysql.db WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . PMA_sqlAddslashes($dbgrant) . '\'');
$row = @mysql_fetch_array($result);
if ($row) {
while (list(,$priv) = each($list_priv)) {
@@ -1363,7 +1363,7 @@ else if (isset($grants) && $grants) {
if (get_magic_quotes_gpc()) {
$tablegrant = stripslashes($tablegrant);
}
$result = mysql_query('SELECT * FROM mysql.tables_priv WHERE (Host = \'' . sql_addslashes($host) . '\' OR Host = \'%\') AND (User = \'' . sql_addslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . sql_addslashes($dbgrant) . '\' AND Table_name = \'' . sql_addslashes($tablegrant) . '\'');
$result = mysql_query('SELECT * FROM mysql.tables_priv WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . PMA_sqlAddslashes($dbgrant) . '\' AND Table_name = \'' . PMA_sqlAddslashes($tablegrant) . '\'');
$row = @mysql_fetch_array($result);
if ($row && $row['Table_priv']) {
while (list(,$priv) = each($list_priv)) {
@@ -1383,12 +1383,12 @@ else if (isset($grants) && $grants) {
// TODO: column privileges
grantOperations($user_priv);
PMA_grantOperations($user_priv);
}
// Check database privileges
else if (isset($check) && $check) {
checkDb($db);
PMA_checkDb($db);
?>
<ul>
<li>
@@ -1408,8 +1408,8 @@ else {
if (!isset($pma_user)) {
$pma_user = FALSE;
}
tableUsers($host, $pma_user) or mysql_die($strNoUsersFound, '', FALSE, '');
normalOperations();
PMA_tableUsers($host, $pma_user) or PMA_mysqlDie($strNoUsersFound, '', FALSE, '');
PMA_normalOperations();
}