(not complete) PEAR coding standard

This commit is contained in:
Sebastian Mendel
2006-01-17 17:03:02 +00:00
parent 9518c45bdf
commit 0ae8842353
97 changed files with 4447 additions and 3950 deletions

View File

@@ -17,6 +17,7 @@ $Source$
- clarified some variable names
* db_sarch.php:
fixed bug: Undefined variable: num_tables
* [really much files]: (not complete) PEAR coding standard
2006-01-16 Marc Delisle <lem9@users.sourceforge.net>
* server_privileges.php: typo

View File

@@ -52,7 +52,7 @@ if ($cfgRelation['commwork']) {
* Selects the database and gets tables names
*/
PMA_DBI_select_db($db);
$rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
$rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
$count = 0;
while ($row = PMA_DBI_fetch_assoc($rowset)) {
@@ -128,7 +128,7 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) {
/**
* Gets fields properties
*/
$result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
$fields_cnt = PMA_DBI_num_rows($result);
// Check if we can use Relations (Mike Beck)
if (!empty($cfgRelation['relation'])) {
@@ -141,8 +141,7 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) {
} else {
$have_rel = FALSE;
}
}
else {
} else {
$have_rel = FALSE;
} // end if
@@ -237,7 +236,7 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) {
<td<?php echo $type_nowrap; ?> xml:lang="en" dir="ltr"><?php echo $type; ?></td>
<?php /* <td<?php echo $type_nowrap; ?>><?php echo $strAttribute; ?></td>*/ ?>
<td><?php echo (($row['Null'] == '' || $row['Null'] == 'NO') ? $strNo : $strYes); ?></td>
<td nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?></td>
<td nowrap="nowrap"><?php if (isset($row['Default'])) { echo $row['Default']; } ?></td>
<?php /* <td<?php echo $type_nowrap; ?>><?php echo $row['Extra']; ?></td>*/ ?>
<?php
if ($have_rel) {

View File

@@ -62,7 +62,7 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
if (isset($lines) && is_array($lines) && count($lines) > 0) {
foreach ($lines AS $lkey => $line) {
//echo '<p>' . $line . '</p>';
$inf = explode('|',$line);
$inf = explode('|', $line);
if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) {
$qry = '
INSERT INTO
@@ -125,14 +125,11 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
if (empty($DOCUMENT_ROOT)) {
if (!empty($_SERVER) && isset($_SERVER['DOCUMENT_ROOT'])) {
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
}
else if (!empty($_ENV) && isset($_ENV['DOCUMENT_ROOT'])) {
} elseif (!empty($_ENV) && isset($_ENV['DOCUMENT_ROOT'])) {
$DOCUMENT_ROOT = $_ENV['DOCUMENT_ROOT'];
}
else if (@getenv('DOCUMENT_ROOT')) {
} elseif (@getenv('DOCUMENT_ROOT')) {
$DOCUMENT_ROOT = getenv('DOCUMENT_ROOT');
}
else {
} else {
$DOCUMENT_ROOT = '.';
}
} // end if
@@ -173,15 +170,13 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
echo $strFileCouldNotBeRead;
exit();
}
}
else {
} else {
$sql_file_new = $tmp_subdir . basename($sql_file);
move_uploaded_file($sql_file, $sql_file_new);
$docsql_text = PMA_readFile($sql_file_new, $sql_file_compression);
unlink($sql_file_new);
}
}
else {
} else {
// read from the normal upload dir
$docsql_text = PMA_readFile($sql_file, $sql_file_compression);
}
@@ -228,7 +223,7 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
*/
?>
<form method="post" action="db_details_importdocsql.php" <?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?>>
<form method="post" action="db_details_importdocsql.php" <?php if ($is_upload) { echo ' enctype="multipart/form-data"'; } ?>>
<?php echo PMA_generate_common_hidden_inputs($db); ?>
<input type="hidden" name="submit_show" value="true" />
<input type="hidden" name="do" value="import" />

View File

@@ -152,7 +152,7 @@ $row_count = 0;
$hidden_fields = array();
$odd_row = true;
foreach ( $tables as $keyname => $each_table ) {
if ( $each_table['TABLE_ROWS'] === NULL || $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) {
if ( $each_table['TABLE_ROWS'] === null || $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) {
$each_table['TABLE_ROWS'] = PMA_countRecords( $db,
$each_table['TABLE_NAME'], $return = true, $force_exact = true );
}
@@ -452,21 +452,21 @@ echo ' <option value="' . $strAnalyzeTable . '" >'
/* Printable view of a table */
echo '<p>';
echo '<a href="db_printview.php?' . $url_query . '">';
if ( $cfg['PropertiesIconic'] ) {
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage
.'b_print.png" width="16" height="16" alt="" />';
}
echo $strPrintView . '</a> ';
echo '<a href="./db_datadict.php?' . $url_query . '">';
if($cfg['PropertiesIconic']){
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage
.'b_tblanalyse.png" width="16" height="16" alt="" />';
}
echo $strDataDict . '</a>';
echo '</p>';
if ( empty( $db_is_information_schema ) ) {
if (empty($db_is_information_schema)) {
require('./libraries/display_create_table.lib.php');
} // end if (Create Table dialog)

View File

@@ -80,7 +80,7 @@ if (isset($db) &&
// Duplicate the bookmarks for this db (done once for each db)
if ($db != $newname) {
$get_fields = array('user','label','query');
$get_fields = array('user', 'label', 'query');
$where_fields = array('dbase' => $db);
$new_fields = array('dbase' => $newname);
PMA_duplicate_table_info('bookmarkwork', 'bookmark', $get_fields,
@@ -332,7 +332,7 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
SELECT *
FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE);
$test_rs = PMA_query_as_cu($test_query, null, PMA_DBI_QUERY_STORE);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { ?>
<!-- PDF schema -->

View File

@@ -44,7 +44,7 @@ if ($cfg['SkipLockedTables'] == TRUE) {
unset($result);
if (isset($sot_cache)) {
$result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
while ($tmp = PMA_DBI_fetch_row($result)) {
if (!isset($sot_cache[$tmp[0]])) {
@@ -134,7 +134,7 @@ else {
if (isset($sts_data['Type'])) {
if ($sts_data['Type'] == 'MRG_MyISAM') {
$mergetable = TRUE;
} else if (!preg_match('@ISAM|HEAP@i', $sts_data['Type'])) {
} elseif (!preg_match('@ISAM|HEAP@i', $sts_data['Type'])) {
$nonisam = TRUE;
}
}
@@ -149,18 +149,17 @@ else {
} else {
list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 0);
}
} else if ($cfg['ShowStats']) {
} elseif ($cfg['ShowStats']) {
$formated_size = '&nbsp;-&nbsp;';
$unit = '';
}
$sum_entries += $sts_data['Rows'];
}
// MyISAM MERGE Table
else if ($cfg['ShowStats'] && $mergetable == TRUE) {
elseif ($cfg['ShowStats'] && $mergetable == TRUE) {
$formated_size = '&nbsp;-&nbsp;';
$unit = '';
}
else if ($cfg['ShowStats']) {
} elseif ($cfg['ShowStats']) {
$formated_size = 'unknown';
$unit = '';
}

View File

@@ -59,10 +59,11 @@ header('Content-Type: text/html; charset=' . $charset);
<body>
<h1>phpMyAdmin - <?php echo $type; ?></h1>
<p><?php
if (get_magic_quotes_gpc())
if (get_magic_quotes_gpc()) {
echo PMA_sanitize(stripslashes($_REQUEST['error']));
else
} else {
echo PMA_sanitize($_REQUEST['error']);
}
?></p>
</body>
</html>

View File

@@ -80,7 +80,7 @@ function PMA_exportOutputHandler($line)
$dump_buffer = bzcompress($dump_buffer);
}
// as a gzipped file
else if ($GLOBALS['compression'] == 'gzip' && @function_exists('gzencode')) {
elseif ($GLOBALS['compression'] == 'gzip' && @function_exists('gzencode')) {
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
}
@@ -172,17 +172,26 @@ $onfly_compression = $GLOBALS['cfg']['CompressOnFly'] && isset($compression) &&
if ($onfly_compression) {
$memory_limit = trim(@ini_get('memory_limit'));
// 2 MB as default
if (empty($memory_limit)) $memory_limit = 2 * 1024 * 1024;
if (empty($memory_limit)) {
$memory_limit = 2 * 1024 * 1024;
}
if (strtolower(substr($memory_limit, -1)) == 'm') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
elseif (strtolower(substr($memory_limit, -1)) == 'k') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
elseif (strtolower(substr($memory_limit, -1)) == 'g') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
else $memory_limit = (int)$memory_limit;
if (strtolower(substr($memory_limit, -1)) == 'm') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'k') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'g') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
} else {
$memory_limit = (int)$memory_limit;
}
// Some of memory is needed for other thins and as treshold.
// Nijel: During export I had allocated (see memory_get_usage function)
// approx 1.2MB so this comes from that.
if ($memory_limit > 1500000) $memory_limit -= 1500000;
if ($memory_limit > 1500000) {
$memory_limit -= 1500000;
}
// Some memory is needed for compression, assume 1/3
$memory_limit *= 2/3;
@@ -193,17 +202,17 @@ if ($asfile) {
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
if ($export_type == 'server') {
if (isset($remember_template)) {
setcookie('pma_server_filename_template', $filename_template , 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
setcookie('pma_server_filename_template', $filename_template, 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
$filename = str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template));
} elseif ($export_type == 'database') {
if (isset($remember_template)) {
setcookie('pma_db_filename_template', $filename_template , 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
setcookie('pma_db_filename_template', $filename_template, 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
$filename = str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template)));
} else {
if (isset($remember_template)) {
setcookie('pma_table_filename_template', $filename_template , 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
setcookie('pma_table_filename_template', $filename_template, 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
$filename = str_replace('__TABLE__', $table, str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template))));
}
@@ -219,22 +228,22 @@ if ($asfile) {
if ($type == 'csv') {
$filename .= '.csv';
$mime_type = 'text/comma-separated-values';
} else if ($type == 'htmlexcel') {
} elseif ($type == 'htmlexcel') {
$filename .= '.xls';
$mime_type = 'application/vnd.ms-excel';
} else if ($type == 'htmlword') {
} elseif ($type == 'htmlword') {
$filename .= '.doc';
$mime_type = 'application/vnd.ms-word';
} else if ($type == 'xls') {
} elseif ($type == 'xls') {
$filename .= '.xls';
$mime_type = 'application/vnd.ms-excel';
} else if ($type == 'xml') {
} elseif ($type == 'xml') {
$filename .= '.xml';
$mime_type = 'text/xml';
} else if ($type == 'latex') {
} elseif ($type == 'latex') {
$filename .= '.tex';
$mime_type = 'application/x-tex';
} else if ($type == 'pdf') {
} elseif ($type == 'pdf') {
$filename .= '.pdf';
$mime_type = 'application/pdf';
} else {
@@ -255,7 +264,7 @@ if ($asfile) {
// browsers don't like this:
//$content_encoding = 'x-bzip2';
$mime_type = 'application/x-bzip2';
} else if (isset($compression) && $compression == 'gzip') {
} elseif (isset($compression) && $compression == 'gzip') {
$filename .= '.gz';
// Needed to avoid recompression by server modules like mod_gzip.
// It seems necessary to check about zlib.output_compression
@@ -264,7 +273,7 @@ if ($asfile) {
$content_encoding = 'x-gzip';
$mime_type = 'application/x-gzip';
}
} else if (isset($compression) && $compression == 'zip') {
} elseif (isset($compression) && $compression == 'zip') {
$filename .= '.zip';
$mime_type = 'application/zip';
}
@@ -272,7 +281,7 @@ if ($asfile) {
// Open file on server if needed
if ($save_on_server) {
$save_filename = PMA_userDir($cfg['SaveDir']) . preg_replace('@[/\\\\]@','_',$filename);
$save_filename = PMA_userDir($cfg['SaveDir']) . preg_replace('@[/\\\\]@', '_', $filename);
unset($message);
if (file_exists($save_filename) && empty($onserverover)) {
$message = sprintf($strFileAlreadyExists, htmlspecialchars($save_filename));
@@ -317,9 +326,9 @@ if (!$save_on_server) {
}
header('Content-Type: ' . $mime_type);
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// lem9: Tested behavior of
// lem9: Tested behavior of
// IE 5.50.4807.2300
// IE 6.0.2800.1106 (small glitch, asks twice when I click Open)
// IE 6.0.2800.1106 (small glitch, asks twice when I click Open)
// IE 6.0.2900.2180
// Firefox 1.0.6
// in http and https
@@ -374,7 +383,9 @@ if ($export_type == 'database') {
do {
// Add possibly some comments to export
if (!PMA_exportHeader()) break;
if (!PMA_exportHeader()) {
break;
}
// Will we need relation & co. setup?
$do_relation = isset($GLOBALS[$what . '_relation']);
@@ -411,29 +422,35 @@ if ($export_type == 'server') {
foreach ($dblist AS $current_db) {
if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))
|| !isset($tmp_select)) {
if (!PMA_exportDBHeader($current_db))
if (!PMA_exportDBHeader($current_db)) {
break 2;
if (!PMA_exportDBCreate($current_db))
}
if (!PMA_exportDBCreate($current_db)) {
break 2;
}
$tables = PMA_DBI_get_tables($current_db);
foreach ($tables as $table) {
$local_query = 'SELECT * FROM ' . PMA_backquote($current_db) . '.' . PMA_backquote($table);
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates))
if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) {
break 3;
}
}
if (isset($GLOBALS[$what . '_data'])) {
if (!PMA_exportData($current_db, $table, $crlf, $err_url, $local_query))
if (!PMA_exportData($current_db, $table, $crlf, $err_url, $local_query)) {
break 3;
}
}
}
if (!PMA_exportDBFooter($current_db))
if (!PMA_exportDBFooter($current_db)) {
break 2;
}
}
}
} elseif ($export_type == 'database') {
if (!PMA_exportDBHeader($db))
if (!PMA_exportDBHeader($db)) {
break;
}
if (isset($table_select)) {
$tmp_select = implode($table_select, '|');
@@ -446,20 +463,24 @@ if ($export_type == 'server') {
|| !isset($tmp_select)) {
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates))
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) {
break 2;
}
}
if (isset($GLOBALS[$what . '_data'])) {
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query))
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
break 2;
}
}
}
}
if (!PMA_exportDBFooter($db))
if (!PMA_exportDBFooter($db)) {
break;
}
} else {
if (!PMA_exportDBHeader($db))
if (!PMA_exportDBHeader($db)) {
break;
}
// We export just one table
if ($limit_to > 0 && $limit_from >= 0) {
@@ -478,17 +499,22 @@ if ($export_type == 'server') {
}
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates))
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) {
break;
}
}
if (isset($GLOBALS[$what . '_data'])) {
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query))
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
break;
}
}
if (!PMA_exportDBFooter($db))
if (!PMA_exportDBFooter($db)) {
break;
}
}
if (!PMA_exportFooter()) {
break;
}
if (!PMA_exportFooter()) break;
} while (FALSE);
// End of fake loop
@@ -528,7 +554,7 @@ if (!empty($asfile)) {
}
}
// 2. as a bzipped file
else if (isset($compression) && $compression == 'bzip') {
elseif (isset($compression) && $compression == 'bzip') {
if (@function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
if ($dump_buffer === -8) {
@@ -539,7 +565,7 @@ if (!empty($asfile)) {
}
}
// 3. as a gzipped file
else if (isset($compression) && $compression == 'gzip') {
elseif (isset($compression) && $compression == 'gzip') {
if (@function_exists('gzencode')) {
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
@@ -592,7 +618,7 @@ else {
if (document.getElementById('textSQLDUMP')) {
bodyWidth = self.innerWidth;
bodyHeight = self.innerHeight;
if(!bodyWidth && !bodyHeight){
if (!bodyWidth && !bodyHeight) {
if (document.compatMode && document.compatMode == "BackCompat") {
bodyWidth = document.body.clientWidth;
bodyHeight = document.body.clientHeight;

View File

@@ -125,7 +125,7 @@ if (!empty($id_bookmark)) {
require_once('./libraries/bookmark.lib.php');
switch ($action_bookmark) {
case 0: // bookmarked query that have to be run
$import_text = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark,'id', isset($action_bookmark_all));
$import_text = PMA_queryBookmarks($db, $cfg['Bookmark'], $id_bookmark, 'id', isset($action_bookmark_all));
if (isset($bookmark_variable) && !empty($bookmark_variable)) {
$import_text = preg_replace('|/\*(.*)\[VARIABLE\](.*)\*/|imsU', '${1}' . PMA_sqlAddslashes($bookmark_variable) . '${2}', $import_text);
}
@@ -156,7 +156,7 @@ if (!empty($bkm_label) && !empty($import_text)) {
// Should we replace bookmark?
if (isset($bkm_replace)) {
$bookmarks = PMA_listBookmarks($db, $cfg['Bookmark']);
foreach($bookmarks as $key => $val) {
foreach ($bookmarks as $key => $val) {
if ($val == $bkm_label) {
PMA_deleteBookmarks($db, $cfg['Bookmark'], $key);
}
@@ -180,10 +180,15 @@ if ($memory_limit = -1) {
}
// Calculate value of the limit
if (strtolower(substr($memory_limit, -1)) == 'm') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
elseif (strtolower(substr($memory_limit, -1)) == 'k') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
elseif (strtolower(substr($memory_limit, -1)) == 'g') $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
else $memory_limit = (int)$memory_limit;
if (strtolower(substr($memory_limit, -1)) == 'm') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'k') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
} elseif (strtolower(substr($memory_limit, -1)) == 'g') {
$memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
} else {
$memory_limit = (int)$memory_limit;
}
$read_limit = $memory_limit / 4; // Just to be sure, there might be lot of memory needed for uncompression
@@ -194,7 +199,7 @@ if (!empty($local_import_file) && !empty($cfg['UploadDir'])) {
$local_import_file = PMA_securePath($local_import_file);
$import_file = PMA_userDir($cfg['UploadDir']) . $local_import_file;
} else if (empty($import_file) || !is_uploaded_file($import_file)) {
} elseif (empty($import_file) || !is_uploaded_file($import_file)) {
$import_file = 'none';
}
@@ -300,7 +305,7 @@ if ($cfg['AllowAnywhereRecoding'] && $allow_recoding
if ($charset_of_file != $charset) {
$charset_conversion = TRUE;
}
} else if (PMA_MYSQL_INT_VERSION >= 40100
} elseif (PMA_MYSQL_INT_VERSION >= 40100
&& isset($charset_of_file) && $charset_of_file != 'utf8') {
PMA_DBI_query('SET NAMES \'' . $charset_of_file . '\'');
// We can not show query in this case, it is in different charset

View File

@@ -48,11 +48,9 @@ session_write_close();
if (empty($HTTP_HOST)) {
if (!empty($_ENV) && isset($_ENV['HTTP_HOST'])) {
$HTTP_HOST = $_ENV['HTTP_HOST'];
}
elseif (@getenv('HTTP_HOST')) {
} elseif (@getenv('HTTP_HOST')) {
$HTTP_HOST = getenv('HTTP_HOST');
}
else {
} else {
$HTTP_HOST = '';
}
}
@@ -72,7 +70,7 @@ unset( $cfgRelation );
$drops = array( 'lang', 'server', 'convcharset', 'collation_connection',
'db', 'table' );
foreach( $drops as $each_drop ) {
foreach ( $drops as $each_drop ) {
if ( ! array_key_exists( $each_drop, $_GET ) ) {
unset( $_GET[$each_drop] );
}
@@ -122,7 +120,7 @@ header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
<script type="text/javascript" language="javascript">
// <![CDATA[
// definitions used in querywindow.js
var common_query = '<?php echo PMA_generate_common_url('','','&');?>';
var common_query = '<?php echo PMA_generate_common_url('', '', '&');?>';
var opendb_url = '<?php echo $GLOBALS['cfg']['DefaultTabDatabase']; ?>';
var safari_browser = <?php echo PMA_USR_BROWSER_AGENT == 'SAFARI' ? 'true' : 'false' ?>;
var querywindow_height = <?php echo $GLOBALS['cfg']['QueryWindowHeight']; ?>;

View File

@@ -430,7 +430,7 @@ function PMA_displayTableList($tables, $visible = false,
} else {
echo '<ul id="subel' . $element_counter . '" style="display: none">';
}
foreach( $tables as $group => $table ) {
foreach ( $tables as $group => $table ) {
if ( isset( $table['is' . $sep . 'group'] ) ) {
$common_url_query = $GLOBALS['common_url_query']
. '&amp;tbl_group=' . urlencode( $tab_group_full . $group );

View File

@@ -158,7 +158,7 @@ class PMA_Config
} elseif (preg_match('@OmniWeb/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {
$this->set('PMA_USR_BROWSER_VER', $log_version[1]);
$this->set('PMA_USR_BROWSER_AGENT', 'OMNIWEB');
//} else if (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
//} elseif (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
// Konqueror 2.2.2 says Konqueror/2.2.2
// Konqueror 3.0.3 says Konqueror/3
} elseif (preg_match('@(Konqueror/)(.*)(;)@', $HTTP_USER_AGENT, $log_version)) {

View File

@@ -34,53 +34,56 @@ class PMA_Theme_Manager {
/**
* @var object PMA_Theme active theme
*/
var $theme = NULL;
var $theme = null;
function __construct() {
$this->themes_path = trim( $GLOBALS['cfg']['ThemePath'] ) ;
function __construct()
{
$this->themes_path = trim($GLOBALS['cfg']['ThemePath']) ;
$this->per_server = (bool) $GLOBALS['cfg']['ThemePerServer'];
$this->theme = new PMA_Theme;
if ( ! $this->_checkThemeFolder( $this->themes_path ) ) {
if ( ! $this->_checkThemeFolder($this->themes_path)) {
return;
}
$this->loadThemes( $this->themes_path );
$this->loadThemes($this->themes_path);
if ( ! $this->checkTheme( $GLOBALS['cfg']['ThemeDefault'] ) ) {
if ( ! $this->checkTheme($GLOBALS['cfg']['ThemeDefault'])) {
$GLOBALS['PMA_errors'][] = sprintf( $GLOBALS['strThemeDefaultNotFound'],
$GLOBALS['cfg']['ThemeDefault'] );
trigger_error(
sprintf( $GLOBALS['strThemeDefaultNotFound'],
$GLOBALS['cfg']['ThemeDefault'] ),
E_USER_WARNING );
sprintf($GLOBALS['strThemeDefaultNotFound'],
$GLOBALS['cfg']['ThemeDefault']),
E_USER_WARNING);
$GLOBALS['cfg']['ThemeDefault'] = false;
}
$this->theme_default = $GLOBALS['cfg']['ThemeDefault'];
// check if user have a theme cookie
if ( ! $this->getThemeCookie()
|| ! $this->setActiveTheme( $this->getThemeCookie() ) ) {
if ( $GLOBALS['cfg']['ThemeDefault'] ) {
$this->setActiveTheme( $GLOBALS['cfg']['ThemeDefault'] );
if (! $this->getThemeCookie()
|| ! $this->setActiveTheme($this->getThemeCookie())) {
if ($GLOBALS['cfg']['ThemeDefault']) {
$this->setActiveTheme($GLOBALS['cfg']['ThemeDefault']);
} else {
$this->setActiveTheme( 'original' );
$this->setActiveTheme('original');
}
}
}
function __wakeup() {
$this->loadThemes( $this->themes_path );
function __wakeup()
{
$this->loadThemes($this->themes_path);
}
function setActiveTheme( $theme = NULL ) {
if ( ! $this->checkTheme( $theme ) ) {
$GLOBALS['PMA_errors'][] = sprintf( $GLOBALS['strThemeNotFound'],
$theme );
function setActiveTheme($theme = null)
{
if ( ! $this->checkTheme($theme)) {
$GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strThemeNotFound'],
$theme);
trigger_error(
sprintf( $GLOBALS['strThemeNotFound'], $theme ),
E_USER_WARNING );
sprintf($GLOBALS['strThemeNotFound'], $theme),
E_USER_WARNING);
return false;
}
@@ -96,9 +99,10 @@ class PMA_Theme_Manager {
/**
* @return string cookie name
*/
function getThemeCookieName() {
function getThemeCookieName()
{
// Allow different theme per server
if ( isset( $GLOBALS['server'] ) && $this->per_server ) {
if (isset($GLOBALS['server']) && $this->per_server) {
return $this->cookie_name . '-' . $GLOBALS['server'];
} else {
return $this->cookie_name;
@@ -109,8 +113,9 @@ class PMA_Theme_Manager {
* returns name of theme stored in the cookie
* @return string theme name from cookie
*/
function getThemeCookie() {
if ( isset( $_COOKIE[$this->getThemeCookieName()] ) ) {
function getThemeCookie()
{
if (isset($_COOKIE[$this->getThemeCookieName()])) {
return $_COOKIE[$this->getThemeCookieName()];
}
@@ -126,16 +131,18 @@ class PMA_Theme_Manager {
* @uses PMA_Theme_Manager::$theme_default
* @uses PMA_Theme::getId()
*/
function setThemeCookie() {
PMA_setCookie( $this->getThemeCookieName(), $this->theme->id,
$this->theme_default );
function setThemeCookie()
{
PMA_setCookie($this->getThemeCookieName(), $this->theme->id,
$this->theme_default);
return true;
}
/**
* old PHP 4 constructor
*/
function PMA_Theme_Manager() {
function PMA_Theme_Manager()
{
$this->__construct();
}
@@ -144,15 +151,16 @@ class PMA_Theme_Manager {
* @param string $folder
* @return boolean
*/
/*private*/ function _checkThemeFolder( $folder ) {
if ( ! is_dir( $folder ) ) {
/*private*/ function _checkThemeFolder($folder)
{
if (! is_dir($folder)) {
$GLOBALS['PMA_errors'][] =
sprintf( $GLOBALS['strThemePathNotFound'],
$folder );
sprintf($GLOBALS['strThemePathNotFound'],
$folder);
trigger_error(
sprintf( $GLOBALS['strThemePathNotFound'],
$folder ),
E_USER_WARNING );
sprintf($GLOBALS['strThemePathNotFound'],
$folder),
E_USER_WARNING);
return false;
}
@@ -164,31 +172,32 @@ class PMA_Theme_Manager {
*
* @param string $folder themes folders
*/
function loadThemes( $folder ) {
if ( $handleThemes = opendir( $folder ) ) {
function loadThemes($folder)
{
if ($handleThemes = opendir($folder)) {
// check for themes directory
while ( FALSE !== ($PMA_Theme = readdir($handleThemes)) ) {
if ( array_key_exists( $PMA_Theme, $this->themes ) ) {
while (FALSE !== ($PMA_Theme = readdir($handleThemes))) {
if (array_key_exists($PMA_Theme, $this->themes)) {
$new_themes[$PMA_Theme] = $this->themes[$PMA_Theme];
continue;
}
$new_theme = PMA_Theme::load( $folder . '/' . $PMA_Theme );
if ( $new_theme ) {
$new_theme->setId( $PMA_Theme );
$new_theme = PMA_Theme::load($folder . '/' . $PMA_Theme);
if ($new_theme) {
$new_theme->setId($PMA_Theme);
$new_themes[$PMA_Theme] = $new_theme;
}
} // end get themes
closedir( $handleThemes );
closedir($handleThemes);
} else {
trigger_error(
'phpMyAdmin-ERROR: can not open themes folder: ' . $folder,
E_USER_WARNING );
E_USER_WARNING);
return false;
} // end check for themes directory
$this->themes = $new_themes;
ksort( $this->themes );
ksort($this->themes);
}
/**
@@ -196,8 +205,9 @@ class PMA_Theme_Manager {
*
* @param string $theme name fo theme to check for
*/
function checkTheme( $theme ) {
if ( ! array_key_exists( $theme, $this->themes ) ) {
function checkTheme($theme)
{
if (! array_key_exists($theme, $this->themes)) {
return false;
}
@@ -209,10 +219,11 @@ class PMA_Theme_Manager {
*
* @param boolean $form wether enclosed by from tags or not
*/
function getHtmlSelectBox( $form = true ) {
function getHtmlSelectBox($form = true)
{
$select_box = '';
if ( $form ) {
if ($form) {
$select_box .= '<form name="setTheme" method="post" action="index.php"'
.' target="_parent">';
$select_box .= PMA_generate_common_hidden_inputs();
@@ -227,16 +238,16 @@ class PMA_Theme_Manager {
$select_box .= '<select name="set_theme" xml:lang="en" dir="ltr"'
.' onchange="this.form.submit();" >';
foreach ( $this->themes as $each_theme_id => $each_theme ) {
foreach ($this->themes as $each_theme_id => $each_theme) {
$select_box .= '<option value="' . $each_theme_id . '"';
if ( $this->active_theme === $each_theme_id ) {
if ($this->active_theme === $each_theme_id) {
$select_box .= ' selected="selected"';
}
$select_box .= '>' . htmlspecialchars( $each_theme->getName() ) . '</option>';
$select_box .= '>' . htmlspecialchars($each_theme->getName()) . '</option>';
}
$select_box .= '</select>';
if ( $form ) {
if ($form) {
$select_box .= '<noscript><input type="submit" value="' . $GLOBALS['strGo'] . '" /></noscript>';
$select_box .= '</form>';
}
@@ -247,7 +258,8 @@ class PMA_Theme_Manager {
/**
* enables backward compatibility
*/
function makeBc() {
function makeBc()
{
$GLOBALS['theme'] = $this->theme->getId();
$GLOBALS['pmaThemePath'] = $this->theme->getPath();
$GLOBALS['pmaThemeImage'] = $this->theme->getImgPath();
@@ -255,8 +267,8 @@ class PMA_Theme_Manager {
/**
* load layout file if exists
*/
if ( @file_exists( $GLOBALS['pmaThemePath'] . 'layout.inc.php' ) ) {
include( $GLOBALS['pmaThemePath'] . 'layout.inc.php' );
if (@file_exists($GLOBALS['pmaThemePath'] . 'layout.inc.php')) {
include $GLOBALS['pmaThemePath'] . 'layout.inc.php';
}
@@ -268,9 +280,9 @@ class PMA_Theme_Manager {
* @uses $this->themes
* @uses PMA_Theme::printPreview()
*/
function printPreviews() {
foreach ( $this->themes as $each_theme ) {
function printPreviews()
{
foreach ($this->themes as $each_theme) {
$each_theme->printPreview();
} // end 'open themes'
}

View File

@@ -82,14 +82,12 @@ function PMA_auth()
// server name
if (!empty($GLOBALS['pma_cookie_servername'])) {
$default_server = $GLOBALS['pma_cookie_servername'];
}
else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {
} elseif (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {
$default_server = $_COOKIE['pma_cookie_servername-' . $server];
}
$autocomplete = '';
}
else {
} else {
$default_user = '';
$autocomplete = ' autocomplete="off"';
}
@@ -231,7 +229,7 @@ echo sprintf( $GLOBALS['strWelcome'],
<?php
if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) {
foreach( $GLOBALS['PMA_errors'] as $error ) {
foreach ( $GLOBALS['PMA_errors'] as $error ) {
echo '<div class="error">' . $error . '</div>' . "\n";
}
}
@@ -297,11 +295,11 @@ function PMA_auth_check()
// The user wants to be logged out -> delete password cookie
if (!empty($old_usr)) {
setcookie('pma_cookie_password-' . $server, '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
setcookie('pma_cookie_password-' . $server, '', 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
// The user just logged in
else if (!empty($pma_username)) {
elseif (!empty($pma_username)) {
$PHP_AUTH_USER = $pma_username;
$PHP_AUTH_PW = (empty($pma_password)) ? '' : $pma_password;
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
@@ -319,8 +317,7 @@ function PMA_auth_check()
if (!empty($pma_cookie_servername)) {
$pma_auth_server = $pma_cookie_servername;
$from_cookie = TRUE;
}
else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {
} elseif (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {
$pma_auth_server = $_COOKIE['pma_cookie_servername-' . $server];
$from_cookie = TRUE;
}
@@ -356,11 +353,9 @@ function PMA_auth_check()
// password
if (!empty($pma_cookie_password)) {
$PHP_AUTH_PW = $pma_cookie_password;
}
else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_password-' . $server])) {
} elseif (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_password-' . $server])) {
$PHP_AUTH_PW = $_COOKIE['pma_cookie_password-' . $server];
}
else {
} else {
$from_cookie = FALSE;
}
$PHP_AUTH_PW = PMA_blowfish_decrypt($PHP_AUTH_PW, $GLOBALS['cfg']['blowfish_secret'] . $decrypted_time);
@@ -458,7 +453,7 @@ function PMA_auth_set_user()
$GLOBALS['is_https']);
} else {
// Delete servername cookie
setcookie('pma_cookie_servername-' . $server, '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
setcookie('pma_cookie_servername-' . $server, '', 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
}
@@ -502,19 +497,19 @@ function PMA_auth_fails()
global $conn_error, $server;
// Deletes password cookie and displays the login form
setcookie('pma_cookie_password-' . $server, '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
setcookie('pma_cookie_password-' . $server, '', 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
$conn_error = $GLOBALS['strAccessDenied'];
} else if (isset($GLOBALS['no_activity']) && $GLOBALS['no_activity']) {
$conn_error = sprintf($GLOBALS['strNoActivity'],$GLOBALS['cfg']['LoginCookieValidity']);
} elseif (isset($GLOBALS['no_activity']) && $GLOBALS['no_activity']) {
$conn_error = sprintf($GLOBALS['strNoActivity'], $GLOBALS['cfg']['LoginCookieValidity']);
// Remember where we got timeout to return on same place
if (isset($_SERVER['SCRIPT_NAME'])) {
$GLOBALS['target'] = basename($_SERVER['SCRIPT_NAME']);
}
} else if (PMA_DBI_getError()) {
} elseif (PMA_DBI_getError()) {
$conn_error = PMA_sanitize(PMA_DBI_getError());
} else if (isset($php_errormsg)) {
} elseif (isset($php_errormsg)) {
$conn_error = $php_errormsg;
} else {
$conn_error = $GLOBALS['strCannotLogin'];

View File

@@ -21,7 +21,7 @@
*/
function PMA_auth() {
header('WWW-Authenticate: Basic realm="phpMyAdmin ' . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'',$GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose']))) . '"');
header('WWW-Authenticate: Basic realm="phpMyAdmin ' . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose']))) . '"');
header('HTTP/1.0 401 Unauthorized');
header('status: 401 Unauthorized');
@@ -83,19 +83,19 @@ function PMA_auth_check()
$PHP_AUTH_USER = $_SERVER['PHP_AUTH_USER'];
}
// CGI, might be encoded, see bellow
else if (@getenv('REMOTE_USER')) {
elseif (@getenv('REMOTE_USER')) {
$PHP_AUTH_USER = getenv('REMOTE_USER');
}
// WebSite Professional
else if (@getenv('AUTH_USER')) {
elseif (@getenv('AUTH_USER')) {
$PHP_AUTH_USER = getenv('AUTH_USER');
}
// IIS, might be encoded, see bellow
else if (@getenv('HTTP_AUTHORIZATION')) {
elseif (@getenv('HTTP_AUTHORIZATION')) {
$PHP_AUTH_USER = getenv('HTTP_AUTHORIZATION');
}
// FastCGI, might be encoded, see bellow
else if (@getenv('Authorization')) {
elseif (@getenv('Authorization')) {
$PHP_AUTH_USER = getenv('Authorization');
}
}
@@ -107,11 +107,11 @@ function PMA_auth_check()
$PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];
}
// Apache/CGI
else if (@getenv('REMOTE_PASSWORD')) {
elseif (@getenv('REMOTE_PASSWORD')) {
$PHP_AUTH_PW = getenv('REMOTE_PASSWORD');
}
// WebSite Professional
else if (@getenv('AUTH_PASSWORD')) {
elseif (@getenv('AUTH_PASSWORD')) {
$PHP_AUTH_PW = getenv('AUTH_PASSWORD');
}
}

View File

@@ -441,10 +441,10 @@ class Horde_Cipher_blowfish {
$R = null;
$retarray = array_values(unpack('N*', $block));
if(isset($retarray[0])) {
if (isset($retarray[0])) {
$L = $retarray[0];
}
if(isset($retarray[1])) {
if (isset($retarray[1])) {
$R = $retarray[1];
}
// end change for phpMyAdmin
@@ -534,7 +534,7 @@ function PMA_blowfish_encrypt($data, $secret) {
for ($i=0; $i<strlen($data); $i+=8) {
$block = substr($data, $i, 8);
if (strlen($block) < 8) {
$block = full_str_pad($block,8,"\0", 1);
$block = full_str_pad($block, 8, "\0", 1);
}
$encrypt .= $pma_cipher->encryptBlock($block, $secret);
}

View File

@@ -102,7 +102,9 @@ function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id', $action_bo
. ' OR user = \'\')' )
. ' AND ' . PMA_backquote($id_field) . ' = ' . $id;
$result = PMA_DBI_try_query($query, $controllink);
if (!$result) return FALSE;
if (!$result) {
return FALSE;
}
list($bookmark_query) = PMA_DBI_fetch_row($result) or array(FALSE);
return $bookmark_query;
@@ -132,7 +134,7 @@ function &PMA_queryDBBookmarks($db, $cfgBookmark, &$table_array)
}
$search_for = array();
foreach($table_array AS $table => $table_sortkey) {
foreach ($table_array AS $table => $table_sortkey) {
$search_for[] = "'" . PMA_sqlAddslashes($table) . "'";
}
@@ -140,7 +142,9 @@ function &PMA_queryDBBookmarks($db, $cfgBookmark, &$table_array)
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''
. (count($search_for) > 0 ? ' AND label IN (' . implode(', ', $search_for) . ')' : '');
$result = PMA_DBI_try_query($query, $controllink, PMA_DBI_QUERY_STORE);
if (!$result || PMA_DBI_num_rows($result) < 1) return $bookmarks;
if (!$result || PMA_DBI_num_rows($result) < 1) {
return $bookmarks;
}
while ($row = PMA_DBI_fetch_assoc($result)) {
$bookmarks[$row['label']] = $row['query'];
}

View File

@@ -24,7 +24,7 @@ if (isset($cfg['AllowAnywhereRecoding'])
}
}
$PMA_recoding_engine = 'recode';
} else if ($cfg['RecodingEngine'] == 'iconv') {
} elseif ($cfg['RecodingEngine'] == 'iconv') {
if (!@extension_loaded('iconv')) {
PMA_dl('iconv');
if (!@extension_loaded('iconv')) {
@@ -36,7 +36,7 @@ if (isset($cfg['AllowAnywhereRecoding'])
} else {
if (@extension_loaded('iconv')) {
$PMA_recoding_engine = 'iconv';
} else if (@extension_loaded('recode')) {
} elseif (@extension_loaded('recode')) {
$PMA_recoding_engine = 'recode';
} else {
PMA_dl('iconv');
@@ -75,7 +75,7 @@ if (isset($cfg['AllowAnywhereRecoding'])
if ($PMA_recoding_engine == 'iconv') {
if (@function_exists('iconv')) {
$PMA_recoding_engine = PMA_CHARSET_ICONV;
} else if (@function_exists('libiconv')) {
} elseif (@function_exists('libiconv')) {
$PMA_recoding_engine = PMA_CHARSET_LIBICONV;
} else {
$PMA_recoding_engine = PMA_CHARSET_NONE;
@@ -87,7 +87,7 @@ if (isset($cfg['AllowAnywhereRecoding'])
require_once('./libraries/footer.inc.php');
exit();
}
} else if ($PMA_recoding_engine == 'recode') {
} elseif ($PMA_recoding_engine == 'recode') {
if (@function_exists('recode_string')) {
$PMA_recoding_engine = PMA_CHARSET_RECODE;
} else {
@@ -101,7 +101,7 @@ if (isset($cfg['AllowAnywhereRecoding'])
} else {
if (@function_exists('iconv')) {
$PMA_recoding_engine = PMA_CHARSET_ICONV;
} else if (@function_exists('libiconv')) {
} elseif (@function_exists('libiconv')) {
$PMA_recoding_engine = PMA_CHARSET_LIBICONV;
} elseif (@function_exists('recode_string')) {
$PMA_recoding_engine = PMA_CHARSET_RECODE;
@@ -143,8 +143,7 @@ function PMA_convert_display_charset($what) {
// this constant is not defined before the login:
|| (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) ) { // lem9: even if AllowAnywhereRecoding is TRUE, do not recode for MySQL >= 4.1.x since MySQL does the job
return $what;
}
else if (is_array($what)) {
} elseif (is_array($what)) {
$result = array();
foreach ($what AS $key => $val) {
if (is_string($val) || is_array($val)) {
@@ -158,8 +157,7 @@ function PMA_convert_display_charset($what) {
}
} // end while
return $result;
}
else if (is_string($what)) {
} elseif (is_string($what)) {
switch ($GLOBALS['PMA_recoding_engine']) {
case PMA_CHARSET_RECODE:
@@ -171,8 +169,7 @@ function PMA_convert_display_charset($what) {
default:
return $what;
}
}
else if (is_object($what)) {
} elseif (is_object($what)) {
// isn't it object returned from mysql_fetch_field ?
if (@is_string($what->name)) {
$what->name = PMA_convert_display_charset($what->name);
@@ -184,8 +181,7 @@ function PMA_convert_display_charset($what) {
$what->Database = PMA_convert_display_charset($what->Database);
}
return $what;
}
else {
} else {
// when we don't know what it is we don't touch it...
return $what;
}
@@ -243,7 +239,9 @@ function PMA_convert_charset($what) {
* @author nijel
*/
function PMA_convert_string($src_charset, $dest_charset, $what) {
if ($src_charset == $dest_charset) return $what;
if ($src_charset == $dest_charset) {
return $what;
}
switch ($GLOBALS['PMA_recoding_engine']) {
case PMA_CHARSET_RECODE:
return recode_string($src_charset . '..' . $dest_charset, $what);

View File

@@ -9,7 +9,7 @@
/**
* returns true (int > 0) if current user is superuser
* otherwise 0
*
*
* @return integer $is_superuser
*/
function PMA_isSuperuser() {
@@ -33,9 +33,9 @@ function PMA_analyseShowGrant($rs_usr, &$is_create_db_priv, &$db_to_create, &$is
$re0 = '(^|(\\\\\\\\)+|[^\])'; // non-escaped wildcards
$re1 = '(^|[^\])(\\\)+'; // escaped wildcards
while ($row = PMA_DBI_fetch_row($rs_usr)) {
$show_grants_dbname = substr($row[0], strpos($row[0], ' ON ') + 4,(strpos($row[0], '.', strpos($row[0], ' ON ')) - strpos($row[0], ' ON ') - 4));
$show_grants_dbname = ereg_replace('^`(.*)`','\\1', $show_grants_dbname);
$show_grants_str = substr($row[0],6,(strpos($row[0],' ON ')-6));
$show_grants_dbname = substr($row[0], strpos($row[0], ' ON ') + 4, (strpos($row[0], '.', strpos($row[0], ' ON ')) - strpos($row[0], ' ON ') - 4));
$show_grants_dbname = ereg_replace('^`(.*)`', '\\1', $show_grants_dbname);
$show_grants_str = substr($row[0], 6, (strpos($row[0], ' ON ') - 6));
if ($show_grants_str == 'RELOAD') {
$is_reload_priv = true;
}
@@ -47,13 +47,12 @@ function PMA_analyseShowGrant($rs_usr, &$is_create_db_priv, &$db_to_create, &$is
$db_to_create = '';
$dbs_where_create_table_allowed[] = '*';
break;
} // end if
else {
} else {
// this array may contain wildcards
$dbs_where_create_table_allowed[] = $show_grants_dbname;
// before MySQL 4.1.0, we cannot use backquotes around a dbname
// for the USE command, so the USE will fail if the dbname contains
// for the USE command, so the USE will fail if the dbname contains
// a "-" and we cannot detect if such a db already exists;
// since 4.1.0, we need to use backquotes if the dbname contains a "-"
// in a USE command
@@ -67,7 +66,7 @@ function PMA_analyseShowGrant($rs_usr, &$is_create_db_priv, &$db_to_create, &$is
if ( (ereg($re0 . '%|_', $show_grants_dbname)
&& !ereg('\\\\%|\\\\_', $show_grants_dbname))
// does this db exist?
|| (!PMA_DBI_try_query('USE ' . ereg_replace($re1 .'(%|_)', '\\1\\3',$dbname_to_test), NULL, PMA_DBI_QUERY_STORE) && substr(PMA_DBI_getError(), 1, 4) != 1044)
|| (!PMA_DBI_try_query('USE ' . ereg_replace($re1 .'(%|_)', '\\1\\3', $dbname_to_test), null, PMA_DBI_QUERY_STORE) && substr(PMA_DBI_getError(), 1, 4) != 1044)
) {
$db_to_create = ereg_replace($re0 . '%', '\\1...', ereg_replace($re0 . '_', '\\1?', $show_grants_dbname));
$db_to_create = ereg_replace($re1 . '(%|_)', '\\1\\3', $db_to_create);
@@ -78,7 +77,7 @@ function PMA_analyseShowGrant($rs_usr, &$is_create_db_priv, &$db_to_create, &$is
//
// we don't break, we want all possible databases
//break;
} // end if
} // end if
} // end elseif
} // end if
} // end while
@@ -93,7 +92,7 @@ function PMA_analyseShowGrant($rs_usr, &$is_create_db_priv, &$db_to_create, &$is
if (PMA_MYSQL_INT_VERSION >= 40102) {
$rs_usr = PMA_DBI_try_query('SHOW GRANTS', $userlink, PMA_DBI_QUERY_STORE);
if ($rs_usr) {
PMA_analyseShowGrant($rs_usr,$is_create_db_priv, $db_to_create, $is_reload_priv, $dbs_where_create_table_allowed);
PMA_analyseShowGrant($rs_usr, $is_create_db_priv, $db_to_create, $is_reload_priv, $dbs_where_create_table_allowed);
PMA_DBI_free_result($rs_usr);
unset($rs_usr);
}
@@ -104,7 +103,7 @@ if (PMA_MYSQL_INT_VERSION >= 40102) {
// $userlink so maybe the SELECT will fail
if (!$is_create_db_priv) {
$res = PMA_DBI_query('SELECT USER();', NULL, PMA_DBI_QUERY_STORE);
$res = PMA_DBI_query('SELECT USER();', null, PMA_DBI_QUERY_STORE);
list($mysql_cur_user_and_host) = PMA_DBI_fetch_row($res);
$mysql_cur_user = substr($mysql_cur_user_and_host, 0, strrpos($mysql_cur_user_and_host, '@'));
@@ -149,8 +148,7 @@ if (PMA_MYSQL_INT_VERSION >= 40102) {
} // end while
PMA_DBI_free_result($rs_usr);
unset($rs_usr, $row, $re0, $re1);
} // end if
else {
} else {
// Finally, let's try to get the user's privileges by using SHOW
// GRANTS...
// Maybe we'll find a little CREATE priv there :)
@@ -162,7 +160,7 @@ if (PMA_MYSQL_INT_VERSION >= 40102) {
}
unset($local_query);
if ($rs_usr) {
PMA_analyseShowGrant($rs_usr,$is_create_db_priv, $db_to_create, $is_reload_priv, $dbs_where_create_table_allowed);
PMA_analyseShowGrant($rs_usr, $is_create_db_priv, $db_to_create, $is_reload_priv, $dbs_where_create_table_allowed);
PMA_DBI_free_result($rs_usr);
unset($rs_usr);
} // end if

View File

@@ -54,7 +54,7 @@
function PMA_securePath($path)
{
// change .. to .
$path = preg_replace('@\.\.*@','.',$path);
$path = preg_replace('@\.\.*@', '.', $path);
return $path;
} // end function
@@ -280,8 +280,7 @@ function PMA_safe_db_list($only_db_check, $controllink, $dblist_cnt, $userlink,
while ($uva_row = PMA_DBI_fetch_row($uva_alldbs)) {
$dblist[] = $uva_row[0];
} // end while
} // end if
else {
} else {
while ($uva_row = PMA_DBI_fetch_row($uva_alldbs)) {
$uva_db = $uva_row[0];
if (isset($uva_mydbs[$uva_db]) && $uva_mydbs[$uva_db] == 1) {
@@ -648,11 +647,11 @@ if (!defined('PMA_MINIMUM_COMMON')) {
}
break;
case 'html':
$formatted_sql = PMA_SQP_formatHtml($parsed_sql,'color');
$formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'color');
break;
case 'text':
//$formatted_sql = PMA_SQP_formatText($parsed_sql);
$formatted_sql = PMA_SQP_formatHtml($parsed_sql,'text');
$formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'text');
break;
default:
break;
@@ -677,7 +676,9 @@ if (!defined('PMA_MINIMUM_COMMON')) {
{
global $cfg;
if ($cfg['MySQLManualType'] == 'none' || empty($cfg['MySQLManualBase'])) return '';
if ($cfg['MySQLManualType'] == 'none' || empty($cfg['MySQLManualBase'])) {
return '';
}
// Fixup for newly used names:
$chapter = str_replace('_', '-', strtolower($chapter));
@@ -685,19 +686,25 @@ if (!defined('PMA_MINIMUM_COMMON')) {
switch ($cfg['MySQLManualType']) {
case 'chapters':
if (empty($chapter)) $chapter = 'index';
if (empty($chapter)) {
$chapter = 'index';
}
$url = $cfg['MySQLManualBase'] . '/' . $chapter . '.html#' . $link;
break;
case 'big':
$url = $cfg['MySQLManualBase'] . '#' . $link;
break;
case 'searchable':
if (empty($link)) $link = 'index';
if (empty($link)) {
$link = 'index';
}
$url = $cfg['MySQLManualBase'] . '/' . $link . '.html';
break;
case 'viewable':
default:
if (empty($link)) $link = 'index';
if (empty($link)) {
$link = 'index';
}
$mysql = '5.0';
if (defined('PMA_MYSQL_INT_VERSION')) {
if (PMA_MYSQL_INT_VERSION < 50000) {
@@ -716,7 +723,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
return '<a href="' . $url . '" target="mysql_doc"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_sqlhelp.png" width="16" height="16" alt="' . $GLOBALS['strDocu'] . '" title="' . $GLOBALS['strDocu'] . '" /></a>';
} elseif ($GLOBALS['cfg']['ReplaceHelpImg']) {
return '<a href="' . $url . '" target="mysql_doc"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . $GLOBALS['strDocu'] . '" title="' . $GLOBALS['strDocu'] . '" /></a>';
}else{
} else {
return '[<a href="' . $url . '" target="mysql_doc">' . $GLOBALS['strDocu'] . '</a>]';
}
} // end of the 'PMA_showMySQLDocu()' function
@@ -789,7 +796,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
// ---
// modified to show me the help on sql errors (Michael Keck)
echo ' <p><strong>' . $GLOBALS['strSQLQuery'] . ':</strong>' . "\n";
if (strstr(strtolower($formatted_sql),'select')) { // please show me help to the error on select
if (strstr(strtolower($formatted_sql), 'select')) { // please show me help to the error on select
echo PMA_showMySQLDocu('SQL-Syntax', 'SELECT');
}
if ($is_modify_link && isset($db)) {
@@ -1044,7 +1051,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
uksort($tables, 'strnatcasecmp');
}
}
if (count($tables) < 1) {
return $tables;
}
@@ -1816,8 +1823,7 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
if ($tab['text'] == $GLOBALS['strEmpty']
|| $tab['text'] == $GLOBALS['strDrop']) {
$tab['class'] = 'caution';
}
elseif (!empty($tab['active'])
} elseif (!empty($tab['active'])
|| (isset($GLOBALS['active_page'])
&& $GLOBALS['active_page'] == $tab['link'])
|| basename($_SERVER['PHP_SELF']) == $tab['link'])
@@ -1910,24 +1916,22 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
function PMA_linkOrButton($url, $message, $tag_params = array(),
$new_form = true, $strip_img = false, $target = '')
{
if (!is_array($tag_params))
{
if (! is_array($tag_params)) {
$tmp = $tag_params;
$tag_params = array();
if (!empty($tmp))
{
if (!empty($tmp)) {
$tag_params['onclick'] = 'return confirmLink(this, \'' . $tmp . '\')';
}
unset($tmp);
}
if (!empty($target)) {
if (! empty($target)) {
$tag_params['target'] = htmlentities($target);
}
$tag_params_strings = array();
foreach ($tag_params as $par_name => $par_value) {
// htmlentities() only on non javascript
$par_value = substr($par_name,0 ,2) == 'on'
$par_value = substr($par_name, 0, 2) == 'on'
? $par_value
: htmlentities($par_value);
$tag_params_strings[] = $par_name . '="' . $par_value . '"';
@@ -1939,8 +1943,7 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
$ret = "\n" . '<a href="' . $url . '" '
. implode(' ', $tag_params_strings) . '>'
. $message . '</a>' . "\n";
}
else {
} else {
// no spaces (linebreaks) at all
// or after the hidden fields
// IE will display them all
@@ -2103,14 +2106,18 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
{
global $PHP_SELF, $checked_special;
if (!isset($checked_special)) $checked_special = false;
if (!isset($checked_special)) {
$checked_special = false;
}
$reported_script_name = basename($PHP_SELF);
$found_error = false;
$error_message = '';
foreach ($params AS $param) {
if ($request && $param != 'db' && $param != 'table') $checked_special = true;
if ($request && $param != 'db' && $param != 'table') {
$checked_special = true;
}
if (!isset($GLOBALS[$param])) {
$error_message .= $reported_script_name . ': Missing parameter: ' . $param . ' <a href="./Documentation.html#faqmissingparameters" target="documentation"> (FAQ 2.8)</a><br />';
@@ -2313,7 +2320,7 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
$i = $sliceStart;
$x = $nbTotalPage - $sliceEnd;
$met_boundary = false;
while($i <= $x) {
while ($i <= $x) {
if ($i >= ($pageNow - $range) && $i <= ($pageNow + $range)) {
// If our pageselector comes near the current page, we use 1
// counter increments
@@ -2392,7 +2399,7 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
}
}
if ($default_current_timestamp && strpos(' ' . strtoupper($type),'TIMESTAMP') == 1) {
if ($default_current_timestamp && strpos(' ' . strtoupper($type), 'TIMESTAMP') == 1) {
$query .= ' DEFAULT CURRENT_TIMESTAMP';
// 0 is empty in PHP
} elseif (!empty($default) || $default == '0' || $default != $default_orig) {

View File

@@ -288,7 +288,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
FROM `information_schema`.`TABLES`
WHERE `TABLE_SCHEMA` IN (\'' . implode("', '", $databases) . '\')
' . $sql_where_table;
$tables = PMA_DBI_fetch_result($sql, array('TABLE_SCHEMA','TABLE_NAME'),
$tables = PMA_DBI_fetch_result($sql, array('TABLE_SCHEMA', 'TABLE_NAME'),
null, $link);
unset( $sql_where_table, $sql );
} else {
@@ -964,7 +964,7 @@ function PMA_DBI_fetch_result( $result, $key = null, $value = null,
if ( is_array($key) ) {
while ( $row = $fetch_function($result) ) {
$result_target =& $resultrows;
foreach( $key as $key_index ) {
foreach ( $key as $key_index ) {
if ( ! isset( $result_target[$row[$key_index]] ) ) {
$result_target[$row[$key_index]] = array();
}
@@ -981,7 +981,7 @@ function PMA_DBI_fetch_result( $result, $key = null, $value = null,
if ( is_array($key) ) {
while ( $row = $fetch_function($result) ) {
$result_target =& $resultrows;
foreach( $key as $key_index ) {
foreach ( $key as $key_index ) {
if ( ! isset( $result_target[$row[$key_index]] ) ) {
$result_target[$row[$key_index]] = array();
}

View File

@@ -68,7 +68,7 @@ if ( true === $cfg['SkipLockedTables'] ) {
PMA_DBI_free_result($db_info_result);
if (isset($sot_cache)) {
$db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE);
$db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', null, PMA_DBI_QUERY_STORE);
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
if (!isset($sot_cache[$tmp[0]])) {
@@ -123,7 +123,7 @@ if ( ! isset( $sot_ready ) ) {
}
if ( $cfg['ShowTooltip'] ) {
foreach( $tables as $each_table ) {
foreach ( $tables as $each_table ) {
fillTooltip( $tooltip_truename, $tooltip_aliasname, $each_table );
}
}

View File

@@ -19,7 +19,7 @@ if (empty($sub_part)) {
// priv CREATE TEMPORARY TABLES or LOCK TABLES can do a 'USE mysql'
// (even if they cannot see the tables)
$is_superuser = PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', NULL, PMA_DBI_QUERY_STORE);
$is_superuser = PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', null, PMA_DBI_QUERY_STORE);
/**
* Prepares links

View File

@@ -21,7 +21,7 @@ if (!isset($is_db) || !$is_db) {
if (!isset($is_table) || !$is_table) {
// Not a valid table name -> back to the db_details.php
if (isset($table) && strlen($table)) {
$is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
$is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', null, PMA_DBI_QUERY_STORE);
}
if (! isset($table) && ! strlen($table)
|| !($is_table && @PMA_DBI_num_rows($is_table))) {
@@ -31,7 +31,7 @@ if (!isset($is_table) || !$is_table) {
if (isset($table) && strlen($table)) {
PMA_DBI_free_result($is_table);
// SHOW TABLES doesn't show temporary tables, so try select (as it can happen just in case temporary table, it should be fast):
$is_table2 = PMA_DBI_try_query('SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, TRUE) . '`;', NULL, PMA_DBI_QUERY_STORE);
$is_table2 = PMA_DBI_try_query('SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, TRUE) . '`;', null, PMA_DBI_QUERY_STORE);
$redirect = !($is_table2 && @PMA_DBI_num_rows($is_table2));
PMA_DBI_free_result($is_table2);
}
@@ -40,8 +40,10 @@ if (!isset($is_table) || !$is_table) {
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'db_details.php?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
}
}
if ($redirect) exit;
} else if (isset($is_table)) {
if ($redirect) {
exit;
}
} elseif (isset($is_table)) {
PMA_DBI_free_result($is_table);
}
} // end if (ensures table exists)

View File

@@ -67,8 +67,8 @@ if ( ! empty( $GLOBALS['DBG'] )
if ( $time_avg_hit > $GLOBALS['cfg']['DBG']['profile']['threshold'] ) {
echo '<tr class="' . $odd_row ? 'odd' : 'even' . '">' .
// gma changed "$mod_name" to "substr($mod_name,$cwdlen+1)"
'<td>' . substr($mod_name,$cwdlen+1) . '</td>' .
// gma changed "$mod_name" to "substr($mod_name, $cwdlen+1)"
'<td>' . substr($mod_name, $cwdlen+1) . '</td>' .
'<td>' . $line_no . '</td>' .
'<td>' . $dbg_prof_results['hit_count'][$idx] . '</td>' .
'<td>' . $time_avg_hit . '</td>' .

View File

@@ -60,7 +60,7 @@ function PMA_DBI_connect($user, $password, $is_controluser = FALSE) {
return $link;
}
function PMA_DBI_select_db($dbname, $link = NULL) {
function PMA_DBI_select_db($dbname, $link = null) {
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
@@ -74,7 +74,7 @@ function PMA_DBI_select_db($dbname, $link = NULL) {
return mysql_select_db($dbname, $link);
}
function PMA_DBI_try_query($query, $link = NULL, $options = 0) {
function PMA_DBI_try_query($query, $link = null, $options = 0) {
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
@@ -106,7 +106,9 @@ function PMA_mysql_fetch_array($result, $type = FALSE) {
}
/* No data returned => do not touch it */
if (! $data) return $data;
if (! $data) {
return $data;
}
if (!defined('PMA_MYSQL_INT_VERSION') || PMA_MYSQL_INT_VERSION >= 40100
|| !(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
@@ -121,11 +123,19 @@ function PMA_mysql_fetch_array($result, $type = FALSE) {
$flags = mysql_field_flags($result, $i);
/* Field is BINARY (either marked manually, or it is BLOB) => do not convert it */
if (stristr($flags, 'BINARY')) {
if (isset($data[$i])) $ret[$i] = $data[$i];
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = $data[$name];
if (isset($data[$i])) {
$ret[$i] = $data[$i];
}
if (isset($data[$name])) {
$ret[PMA_convert_display_charset($name)] = $data[$name];
}
} else {
if (isset($data[$i])) $ret[$i] = PMA_convert_display_charset($data[$i]);
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]);
if (isset($data[$i])) {
$ret[$i] = PMA_convert_display_charset($data[$i]);
}
if (isset($data[$name])) {
$ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]);
}
}
}
return $ret;
@@ -165,15 +175,16 @@ function PMA_DBI_free_result() {
* @param resource $link mysql link
* @return string type of connection used
*/
function PMA_DBI_get_host_info( $link = NULL ) {
if ( NULL === $link ) {
if ( isset( $GLOBALS['userlink'] ) ) {
function PMA_DBI_get_host_info($link = null)
{
if (null === $link) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
return mysql_get_host_info( $link );
return mysql_get_host_info($link);
}
/**
@@ -183,15 +194,16 @@ function PMA_DBI_get_host_info( $link = NULL ) {
* @param resource $link mysql link
* @return integer version of the MySQL protocol used
*/
function PMA_DBI_get_proto_info( $link = NULL ) {
if ( NULL === $link ) {
if ( isset( $GLOBALS['userlink'] ) ) {
function PMA_DBI_get_proto_info($link = null)
{
if (null === $link) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
return mysql_get_proto_info( $link );
return mysql_get_proto_info($link);
}
/**
@@ -219,9 +231,10 @@ function PMA_DBI_get_client_info() {
* @param resource $link mysql link
* @return string|boolean $error or false
*/
function PMA_DBI_getError( $link = NULL ) {
unset( $GLOBALS['errno'] );
if ( NULL === $link && isset( $GLOBALS['userlink'] ) ) {
function PMA_DBI_getError($link = null)
{
unset($GLOBALS['errno']);
if (null === $link && isset($GLOBALS['userlink'])) {
$link =& $GLOBALS['userlink'];
// Do not stop now. On the initial connection, we don't have a $link,
@@ -230,38 +243,39 @@ function PMA_DBI_getError( $link = NULL ) {
// return FALSE;
}
if ( NULL !== $link ) {
$error_number = mysql_errno( $link );
$error_message = mysql_error( $link );
if (null !== $link) {
$error_number = mysql_errno($link);
$error_message = mysql_error($link);
} else {
$error_number = mysql_errno();
$error_message = mysql_error();
}
if ( 0 == $error_number ) {
if (0 == $error_number) {
return false;
}
// keep the error number for further check after the call to PMA_DBI_getError()
$GLOBALS['errno'] = $error_number;
if ( ! empty( $error_message ) ) {
$error_message = PMA_DBI_convert_message( $error_message );
if (! empty($error_message)) {
$error_message = PMA_DBI_convert_message($error_message);
}
// Some errors messages cannot be obtained by mysql_error()
if ( $error_number == 2002 ) {
if ($error_number == 2002) {
$error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem'];
} elseif ( $error_number == 2003 ) {
$error = '#' . ((string) $error_number ) . ' - ' . $GLOBALS['strServerNotResponding'];
} elseif ( defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100 ) {
$error = '#' . ((string) $error_number ) . ' - ' . $error_message;
} elseif ($error_number == 2003 ) {
$error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding'];
} elseif (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) {
$error = '#' . ((string) $error_number) . ' - ' . $error_message;
} else {
$error = '#' . ((string) $error_number ) . ' - ' . PMA_convert_display_charset( $error_message );
$error = '#' . ((string) $error_number) . ' - ' . PMA_convert_display_charset($error_message);
}
return $error;
}
function PMA_DBI_close($link = NULL) {
function PMA_DBI_close($link = null)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
@@ -280,7 +294,8 @@ function PMA_DBI_num_rows($result) {
}
}
function PMA_DBI_insert_id($link = NULL) {
function PMA_DBI_insert_id($link = null)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
@@ -291,7 +306,8 @@ function PMA_DBI_insert_id($link = NULL) {
return mysql_insert_id($link);
}
function PMA_DBI_affected_rows($link = NULL) {
function PMA_DBI_affected_rows($link = null)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];

View File

@@ -31,7 +31,8 @@ define('NUM_FLAG', 32768);
define('PART_KEY_FLAG', 16384);
define('UNIQUE_FLAG', 65536);
function PMA_DBI_connect($user, $password, $is_controluser = FALSE) {
function PMA_DBI_connect($user, $password, $is_controluser = FALSE)
{
global $cfg, $php_errormsg;
$server_port = (empty($cfg['Server']['port']))
@@ -44,7 +45,7 @@ function PMA_DBI_connect($user, $password, $is_controluser = FALSE) {
// NULL enables connection to the default socket
$server_socket = (empty($cfg['Server']['socket']))
? NULL
? null
: $cfg['Server']['socket'];
$link = mysqli_init();
@@ -64,7 +65,8 @@ function PMA_DBI_connect($user, $password, $is_controluser = FALSE) {
return $link;
}
function PMA_DBI_select_db($dbname, $link = NULL) {
function PMA_DBI_select_db($dbname, $link = null)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
@@ -78,7 +80,8 @@ function PMA_DBI_select_db($dbname, $link = NULL) {
return mysqli_select_db($link, $dbname);
}
function PMA_DBI_try_query($query, $link = NULL, $options = 0) {
function PMA_DBI_try_query($query, $link = null, $options = 0)
{
if ($options == ($options | PMA_DBI_QUERY_STORE)) {
$method = MYSQLI_STORE_RESULT;
} elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
@@ -107,7 +110,8 @@ function PMA_DBI_try_query($query, $link = NULL, $options = 0) {
// The following function is meant for internal use only.
// Do not call it from outside this library!
function PMA_mysqli_fetch_array($result, $type = FALSE) {
function PMA_mysqli_fetch_array($result, $type = FALSE)
{
global $cfg, $allow_recoding, $charset, $convcharset;
if ($type != FALSE) {
@@ -117,7 +121,9 @@ function PMA_mysqli_fetch_array($result, $type = FALSE) {
}
/* No data returned => do not touch it */
if (! $data) return $data;
if (! $data) {
return $data;
}
if (!defined('PMA_MYSQL_INT_VERSION') || PMA_MYSQL_INT_VERSION >= 40100
|| !(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)) {
@@ -167,15 +173,18 @@ function PMA_mysqli_fetch_array($result, $type = FALSE) {
}
}
function PMA_DBI_fetch_array($result) {
function PMA_DBI_fetch_array($result)
{
return PMA_mysqli_fetch_array($result, MYSQLI_BOTH);
}
function PMA_DBI_fetch_assoc($result) {
function PMA_DBI_fetch_assoc($result)
{
return PMA_mysqli_fetch_array($result, MYSQLI_ASSOC);
}
function PMA_DBI_fetch_row($result) {
function PMA_DBI_fetch_row($result)
{
return PMA_mysqli_fetch_array($result, MYSQLI_NUM);
}
@@ -184,10 +193,11 @@ function PMA_DBI_fetch_row($result) {
*
* @param result $result,... one or more mysql result resources
*/
function PMA_DBI_free_result() {
foreach ( func_get_args() as $result ) {
if ( is_object($result)
&& is_a($result, 'mysqli_result') ) {
function PMA_DBI_free_result()
{
foreach (func_get_args() as $result) {
if (is_object($result)
&& is_a($result, 'mysqli_result')) {
mysqli_free_result($result);
}
}
@@ -200,15 +210,16 @@ function PMA_DBI_free_result() {
* @param resource $link mysql link
* @return string type of connection used
*/
function PMA_DBI_get_host_info( $link = NULL ) {
if ( NULL === $link ) {
if ( isset( $GLOBALS['userlink'] ) ) {
function PMA_DBI_get_host_info($link = null)
{
if (null === $link) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
return mysqli_get_host_info( $link );
return mysqli_get_host_info($link);
}
/**
@@ -218,15 +229,16 @@ function PMA_DBI_get_host_info( $link = NULL ) {
* @param resource $link mysql link
* @return integer version of the MySQL protocol used
*/
function PMA_DBI_get_proto_info( $link = NULL ) {
if ( NULL === $link ) {
if ( isset( $GLOBALS['userlink'] ) ) {
function PMA_DBI_get_proto_info( $link = null )
{
if (null === $link) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
return mysqli_get_proto_info( $link );
return mysqli_get_proto_info($link);
}
/**
@@ -256,10 +268,11 @@ function PMA_DBI_get_client_info() {
* @param resource $link mysql link
* @return string|boolean $error or false
*/
function PMA_DBI_getError( $link = NULL ) {
unset( $GLOBALS['errno'] );
function PMA_DBI_getError($link = null)
{
unset($GLOBALS['errno']);
if ( NULL === $link && isset( $GLOBALS['userlink'] ) ) {
if (null === $link && isset($GLOBALS['userlink'])) {
$link =& $GLOBALS['userlink'];
// Do not stop now. We still can get the error code
// with mysqli_connect_errno()
@@ -267,27 +280,27 @@ function PMA_DBI_getError( $link = NULL ) {
// return false;
}
if ( NULL !== $link ) {
$error_number = mysqli_errno( $link );
$error_message = mysqli_error( $link );
if (null !== $link) {
$error_number = mysqli_errno($link);
$error_message = mysqli_error($link);
} else {
$error_number = mysqli_connect_errno();
$error_message = mysqli_connect_error();
}
if ( 0 == $error_number ) {
if (0 == $error_number) {
return false;
}
// keep the error number for further check after the call to PMA_DBI_getError()
$GLOBALS['errno'] = $error_number;
if ( ! empty( $error_message ) ) {
$error_message = PMA_DBI_convert_message( $error_message );
if (! empty($error_message)) {
$error_message = PMA_DBI_convert_message($error_message);
}
if ( $error_number == 2002 ) {
if ($error_number == 2002) {
$error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem'];
} elseif ( defined( 'PMA_MYSQL_INT_VERSION' ) && PMA_MYSQL_INT_VERSION >= 40100 ) {
} elseif (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) {
$error = '#' . ((string) $error_number) . ' - ' . $error_message;
} else {
$error = '#' . ((string) $error_number) . ' - ' . PMA_convert_display_charset($error_message);
@@ -295,7 +308,8 @@ function PMA_DBI_getError( $link = NULL ) {
return $error;
}
function PMA_DBI_close($link = NULL) {
function PMA_DBI_close($link = null)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
@@ -306,7 +320,8 @@ function PMA_DBI_close($link = NULL) {
return @mysqli_close($link);
}
function PMA_DBI_num_rows($result) {
function PMA_DBI_num_rows($result)
{
// see the note for PMA_DBI_try_query();
if (!is_bool($result)) {
return @mysqli_num_rows($result);
@@ -315,7 +330,8 @@ function PMA_DBI_num_rows($result) {
}
}
function PMA_DBI_insert_id($link = '') {
function PMA_DBI_insert_id($link = '')
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
@@ -326,7 +342,8 @@ function PMA_DBI_insert_id($link = '') {
return mysqli_insert_id($link);
}
function PMA_DBI_affected_rows($link = NULL) {
function PMA_DBI_affected_rows($link = null)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
@@ -337,7 +354,8 @@ function PMA_DBI_affected_rows($link = NULL) {
return mysqli_affected_rows($link);
}
function PMA_DBI_get_fields_meta($result) {
function PMA_DBI_get_fields_meta($result)
{
// Build an associative array for a type look up
$typeAr = Array();
$typeAr[MYSQLI_TYPE_DECIMAL] = 'real';
@@ -392,23 +410,27 @@ function PMA_DBI_get_fields_meta($result) {
return $fields;
}
function PMA_DBI_num_fields($result) {
function PMA_DBI_num_fields($result)
{
return mysqli_num_fields($result);
}
function PMA_DBI_field_len($result, $i) {
function PMA_DBI_field_len($result, $i)
{
$info = mysqli_fetch_field_direct($result, $i);
// stdClass::$length will be integrated in
// mysqli-ext when mysql4.1 has been released.
return @$info->length;
}
function PMA_DBI_field_name($result, $i) {
function PMA_DBI_field_name($result, $i)
{
$info = mysqli_fetch_field_direct($result, $i);
return $info->name;
}
function PMA_DBI_field_flags($result, $i) {
function PMA_DBI_field_flags($result, $i)
{
$f = mysqli_fetch_field_direct($result, $i);
$f = $f->flags;
$flags = '';

View File

@@ -17,7 +17,7 @@ if ($is_create_db_priv) {
<?php
if (PMA_MYSQL_INT_VERSION >= 40101) {
require_once('./libraries/mysql_charsets.lib.php');
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', NULL, NULL, TRUE, 5);
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', null, null, TRUE, 5);
}
?>
<input type="submit" value="<?php echo $strCreate; ?>" id="buttonGo" />

View File

@@ -22,7 +22,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100) {
$is_create_table_priv = true;
}
foreach( $dbs_where_create_table_allowed as $allowed_db ) {
foreach ( $dbs_where_create_table_allowed as $allowed_db ) {
// if we find the exact db name, we stop here
if ($allowed_db == $db) {

View File

@@ -853,7 +853,7 @@ function show_checked_option() {
$temp_charset = reset($cfg['AvailableCharsets']);
echo ' <select id="select_charset_of_file" name="charset_of_file" size="1">' . "\n";
foreach($cfg['AvailableCharsets'] as $key => $temp_charset) {
foreach ($cfg['AvailableCharsets'] as $key => $temp_charset) {
echo ' <option value="' . $temp_charset . '"';
if ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
|| $temp_charset == $cfg['Export']['charset']) {

View File

@@ -48,8 +48,10 @@ echo PMA_pluginGetJavascript($import_list);
<?php
if (!empty($cfg['UploadDir'])) {
$extensions = '';
foreach($import_list as $key => $val) {
if (!empty($extensions)) $extensions .= '|';
foreach ($import_list as $key => $val) {
if (!empty($extensions)) {
$extensions .= '|';
}
$extensions .= $val['extension'];
}
$matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@';
@@ -101,9 +103,15 @@ echo '</div>' . "\n";
// zip, gzip and bzip2 encode features
$compressions = $strNone;
if ($cfg['GZipDump'] && @function_exists('gzopen')) $compressions .= ', gzip';
if ($cfg['BZipDump'] && @function_exists('bzopen')) $compressions .= ', bzip2';
if ($cfg['ZipDump'] && @function_exists('gzinflate')) $compressions .= ', zip';
if ($cfg['GZipDump'] && @function_exists('gzopen')) {
$compressions .= ', gzip';
}
if ($cfg['BZipDump'] && @function_exists('bzopen')) {
$compressions .= ', bzip2';
}
if ($cfg['ZipDump'] && @function_exists('gzinflate')) {
$compressions .= ', zip';
}
// We don't have show anything about compression, when no supported
if ($compressions != $strNone) {

View File

@@ -86,7 +86,7 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
// 2.1 Statement is a "SELECT COUNT", a
// "CHECK/ANALYZE/REPAIR/OPTIMIZE", an "EXPLAIN" one or
// contains a "PROC ANALYSE" part
else if ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
elseif ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
$do_display['edit_lnk'] = 'nn'; // no edit link
$do_display['del_lnk'] = 'nn'; // no delete link
$do_display['sort_lnk'] = (string) '0';
@@ -101,14 +101,13 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
$do_display['pview_lnk'] = (string) '1';
}
// 2.2 Statement is a "SHOW..."
else if ($GLOBALS['is_show']) {
elseif ($GLOBALS['is_show']) {
// 2.2.1 TODO : defines edit/delete links depending on show statement
$tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', $GLOBALS['sql_query'], $which = array() );
if (isset($which[1]) && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) {
$do_display['edit_lnk'] = 'nn'; // no edit link
$do_display['del_lnk'] = 'kp'; // "kill process" type edit link
}
else {
} else {
// Default case -> no links
$do_display['edit_lnk'] = 'nn'; // no edit link
$do_display['del_lnk'] = 'nn'; // no delete link
@@ -155,8 +154,7 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
// 3. Gets the total number of rows if it is unknown
if (isset($unlim_num_rows) && $unlim_num_rows != '') {
$the_total = $unlim_num_rows;
}
else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
} elseif (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
&& (isset($db) && strlen($db) && !empty($table))) {
$the_total = PMA_countRecords($db, $table, TRUE);
}
@@ -477,10 +475,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
// we need $sort_expression and $sort_expression_nodir
// even if there are many table references
$sort_expression = trim(str_replace(' ', ' ',$analyzed_sql[0]['order_by_clause']));
$sort_expression = trim(str_replace(' ', ' ', $analyzed_sql[0]['order_by_clause']));
// Get rid of ASC|DESC (TODO: analyzer)
preg_match('@(.*)([[:space:]]*(ASC|DESC))@si',$sort_expression,$matches = array());
preg_match('@(.*)([[:space:]]*(ASC|DESC))@si', $sort_expression, $matches = array());
$sort_expression_nodir = isset($matches[1]) ? trim($matches[1]) : $sort_expression;
// sorting by indexes, only if it makes sense (only one table ref)
@@ -526,9 +524,15 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
$span = $fields_cnt;
if ($is_display['edit_lnk'] != 'nn') $span++;
if ($is_display['del_lnk'] != 'nn') $span++;
if ($is_display['del_lnk'] != 'kp' && $is_display['del_lnk'] != 'nn') $span++;
if ($is_display['edit_lnk'] != 'nn') {
$span++;
}
if ($is_display['del_lnk'] != 'nn') {
$span++;
}
if ($is_display['del_lnk'] != 'kp' && $is_display['del_lnk'] != 'nn') {
$span++;
}
} else {
$span = $num_rows + floor($num_rows/$repeat_cells) + 1;
}
@@ -651,7 +655,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
} // end vertical mode
}
// ... else if no button, displays empty(ies) col(s) if required
// ... elseif no button, displays empty(ies) col(s) if required
elseif ($GLOBALS['cfg']['ModifyDeleteAtLeft']
&& ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
$vertical_display['emptypre'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 0;
@@ -807,10 +811,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
// enable sord order swapping for image
$order_link_params = array();
if (isset($order_img) && $order_img!='') {
if (strstr($order_img,'asc')) {
if (strstr($order_img, 'asc')) {
$order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
$order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
} else if (strstr($order_img,'desc')) {
} elseif (strstr($order_img, 'desc')) {
$order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
$order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
}
@@ -825,7 +829,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
?>
<th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?>>
<th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') { echo 'valign="bottom"'; } ?>>
<?php echo $order_link; ?>
<?php echo $comments; ?>
</th>
@@ -841,7 +845,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
else {
if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
?>
<th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') echo 'valign="bottom"'; ?> <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css' ? 'style="direction: ltr; writing-mode: tb-rl;"' : ''); ?>>
<th <?php echo $column_style; ?> <?php if ($disp_direction == 'horizontalflipped') { echo 'valign="bottom"'; } ?> <?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css' ? 'style="direction: ltr; writing-mode: tb-rl;"' : ''); ?>>
<?php echo ($disp_direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake'? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name)) . "\n"; ?>
<?php echo $comments; ?>
</th>
@@ -875,9 +879,9 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
} // end vertical mode
}
// ... else if no button, displays empty cols if required
// ... elseif no button, displays empty cols if required
// (unless coming from Browse mode print view)
else if ($GLOBALS['cfg']['ModifyDeleteAtRight']
elseif ($GLOBALS['cfg']['ModifyDeleteAtRight']
&& ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn')
&& (!$GLOBALS['is_header_sent'])) {
$vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 3 : 1;
@@ -1118,7 +1122,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
$del_str .= ' ' . $GLOBALS['strDelete'] . '</div>';
}
}
} else if ($is_display['del_lnk'] == 'kp') { // kill process case
} elseif ($is_display['del_lnk'] == 'kp') { // kill process case
$lnk_goto = 'sql.php'
. '?' . str_replace('&amp;', '&', $url_query)
. '&sql_query=' . urlencode($url_sql_query)
@@ -1223,7 +1227,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
//if (!isset($row[$meta->name])
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $column_style . $bgcolor . '><i>NULL</i></td>' . "\n";
} else if ($row[$i] != '') {
} elseif ($row[$i] != '') {
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $column_style . $bgcolor . ' class="nowrap">';
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
@@ -1245,16 +1249,14 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
. ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
. ' WHERE ' . PMA_backquote($map[$meta->name][1])
. ' = ' . $row[$i];
$dispresult = PMA_DBI_try_query($dispsql, NULL, PMA_DBI_QUERY_STORE);
$dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
}
else {
} else {
$dispval = $GLOBALS['strLinkNotFound'];
}
@PMA_DBI_free_result($dispresult);
}
else {
} else {
$dispval = '';
} // end if... else...
@@ -1279,7 +1281,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
// b l o b
} else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) {
} elseif ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) {
// loic1 : PMA_mysql_fetch_fields returns BLOB in place of
// TEXT fields type, however TEXT fields must be displayed
// even if $GLOBALS['cfg']['ShowBlob'] is false -> get the true type
@@ -1302,7 +1304,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
} else {
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' <td' . $column_style . $bgcolor . '><i>NULL</i></td>' . "\n";
} else if ($row[$i] != '') {
} elseif ($row[$i] != '') {
// garvin: if a transform function for blob is set, none of these replacements will be made
if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) {
$row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
@@ -1319,7 +1321,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
} else {
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' <td' . $column_style . $bgcolor . '><i>NULL</i></td>' . "\n";
} else if ($row[$i] != '') {
} elseif ($row[$i] != '') {
// loic1: support blanks in the key
$relation_id = $row[$i];
@@ -1371,16 +1373,14 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
. ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
. ' WHERE ' . PMA_backquote($map[$meta->name][1])
. ' = \'' . PMA_sqlAddslashes($row[$i]) . '\'';
$dispresult = PMA_DBI_try_query($dispsql, NULL, PMA_DBI_QUERY_STORE);
$dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetch_row($dispresult);
@PMA_DBI_free_result($dispresult);
}
else {
} else {
$dispval = $GLOBALS['strLinkNotFound'];
}
}
else {
} else {
$dispval = '';
}
$title = (!empty($dispval))? ' title="' . htmlspecialchars($dispval) . '"' : '';
@@ -1716,7 +1716,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
? $total - 1
: $pos_next - 1;
PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec (" . PMA_formatNumber( $total, 0 ) . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')');
} else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
} elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
PMA_showMessage($GLOBALS['strSQLQuery']);
}
@@ -1735,7 +1735,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
if ($is_display['nav_bar'] == '1') {
PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
echo "\n";
} else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
} elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
echo "\n" . '<br /><br />' . "\n";
}
@@ -1762,7 +1762,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
$exist_rel = PMA_getForeigners($db, $table, '', 'both');
if ($exist_rel) {
foreach ($exist_rel AS $master_field => $rel) {
$display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']);
$display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'],
$rel['foreign_field'],
$display_field,
@@ -1862,7 +1862,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
if ($is_display['nav_bar'] == '1') {
echo '<br />' . "\n";
PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_sql_query);
} else if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
} elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
echo "\n" . '<br /><br />' . "\n";
}
} // end of the 'PMA_displayTable()' function

View File

@@ -28,7 +28,7 @@ if ( $doWriteModifyAt == 'left' ){
. PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''), FALSE)
. ' </td>' . "\n";
}
} else if ($doWriteModifyAt == 'right') {
} elseif ($doWriteModifyAt == 'right') {
if (!empty($del_url)) {
echo ' <td align="center">' . "\n"
. PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''), FALSE)

View File

@@ -124,7 +124,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
global $escaped;
// Gets the data from the database
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
$fields_cnt = PMA_DBI_num_fields($result);
// If required, get fields name at the first line
@@ -141,7 +141,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$schema_insert .= $export_separator;
} // end for
$schema_insert =trim(substr($schema_insert, 0, -1));
if (!PMA_exportOutputHandler($schema_insert . $add_character)) return FALSE;
if (!PMA_exportOutputHandler($schema_insert . $add_character)) {
return FALSE;
}
} // end if
// Format the data
@@ -150,8 +152,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
for ($j = 0; $j < $fields_cnt; $j++) {
if (!isset($row[$j]) || is_null($row[$j])) {
$schema_insert .= $GLOBALS[$what . '_replace_null'];
}
else if ($row[$j] == '0' || $row[$j] != '') {
} elseif ($row[$j] == '0' || $row[$j] != '') {
// loic1 : always enclose fields
if ($what == 'excel') {
$row[$j] = ereg_replace("\015(\012)?", "\012", $row[$j]);
@@ -163,8 +164,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
. str_replace($enclosed, $escaped . $enclosed, $row[$j])
. $enclosed;
}
}
else {
} else {
$schema_insert .= '';
}
if ($j < $fields_cnt-1) {
@@ -172,7 +172,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
} // end for
if (!PMA_exportOutputHandler($schema_insert . $add_character)) return FALSE;
if (!PMA_exportOutputHandler($schema_insert . $add_character)) {
return FALSE;
}
} // end while
PMA_DBI_free_result($result);

View File

@@ -122,7 +122,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
global $what;
// Gets the data from the database
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
$fields_cnt = PMA_DBI_num_fields($result);
// If required, get fields name at the first line
@@ -132,7 +132,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$schema_insert .= '<td class=xl2216681 nowrap><b>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</b></td>';
} // end for
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) return FALSE;
if (!PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
} // end if
// Format the data
@@ -141,7 +143,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
for ($j = 0; $j < $fields_cnt; $j++) {
if (!isset($row[$j]) || is_null($row[$j])) {
$value = $GLOBALS[$what . '_replace_null'];
} else if ($row[$j] == '0' || $row[$j] != '') {
} elseif ($row[$j] == '0' || $row[$j] != '') {
$value = $row[$j];
} else {
$value = '';
@@ -149,7 +151,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$schema_insert .= '<td class=xl2216681 nowrap>' . htmlspecialchars($value) . '</td>';
} // end for
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) return FALSE;
if (!PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
} // end while
PMA_DBI_free_result($result);

View File

@@ -101,14 +101,19 @@ function PMA_exportDBCreate($db) {
*
* @access public
*/
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
global $what;
if (!PMA_exportOutputHandler('<h2>' . $GLOBALS['strDumpingData'] . ' ' .$table . '</h2>')) return FALSE;
if (!PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) return FALSE;
if (!PMA_exportOutputHandler('<h2>' . $GLOBALS['strDumpingData'] . ' ' . $table . '</h2>')) {
return FALSE;
}
if (!PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
return FALSE;
}
// Gets the data from the database
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
$fields_cnt = PMA_DBI_num_fields($result);
// If required, get fields name at the first line
@@ -118,7 +123,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</b></td>';
} // end for
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) return FALSE;
if (!PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
} // end if
// Format the data
@@ -127,7 +134,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
for ($j = 0; $j < $fields_cnt; $j++) {
if (!isset($row[$j]) || is_null($row[$j])) {
$value = $GLOBALS[$what . '_replace_null'];
} else if ($row[$j] == '0' || $row[$j] != '') {
} elseif ($row[$j] == '0' || $row[$j] != '') {
$value = $row[$j];
} else {
$value = '';
@@ -135,10 +142,14 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$schema_insert .= '<td class="print">' . htmlspecialchars($value) . '</td>';
} // end for
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) return FALSE;
if (!PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
} // end while
PMA_DBI_free_result($result);
if (!PMA_exportOutputHandler('</table>')) return FALSE;
if (!PMA_exportOutputHandler('</table>')) {
return FALSE;
}
return TRUE;
}
@@ -147,7 +158,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
{
global $cfgRelation;
if (!PMA_exportOutputHandler('<h2>' . $GLOBALS['strTableStructure'] . ' ' .$table . '</h2>')) return FALSE;
if (!PMA_exportOutputHandler('<h2>' . $GLOBALS['strTableStructure'] . ' ' .$table . '</h2>')) {
return FALSE;
}
/**
* Get the unique keys in the table
@@ -156,7 +169,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$keys_result = PMA_DBI_query($keys_query);
$unique_keys = array();
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
if ($key['Non_unique'] == 0) $unique_keys[] = $key['Column_name'];
if ($key['Non_unique'] == 0) {
$unique_keys[] = $key['Column_name'];
}
}
PMA_DBI_free_result($keys_result);
@@ -179,15 +194,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
} else {
$have_rel = FALSE;
}
}
else {
} else {
$have_rel = FALSE;
} // end if
/**
* Displays the table structure
*/
if (!PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) return FALSE;
if (!PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
return FALSE;
}
$columns_cnt = 4;
if ($do_relation && $have_rel) {
@@ -218,7 +234,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
}
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) return FALSE;
if (!PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
while ($row = PMA_DBI_fetch_assoc($result)) {
@@ -294,7 +312,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$schema_insert .= '</tr>';
if (!PMA_exportOutputHandler($schema_insert)) return FALSE;
if (!PMA_exportOutputHandler($schema_insert)) {
return FALSE;
}
} // end while
PMA_DBI_free_result($result);

View File

@@ -129,7 +129,7 @@ function PMA_exportDBCreate($db) {
* @access public
*/
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$result = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
$columns_cnt = PMA_DBI_num_fields($result);
for ($i = 0; $i < $columns_cnt; $i++) {
@@ -150,7 +150,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$buffer .= ' \\caption{' . str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_data_caption'])
. '} \\label{' . str_replace('__TABLE__', $table, $GLOBALS['latex_data_label']) . '} \\\\';
}
if (!PMA_exportOutputHandler($buffer)) return FALSE;
if (!PMA_exportOutputHandler($buffer)) {
return FALSE;
}
// show column names
if (isset($GLOBALS['latex_showcolumns'])) {
@@ -159,14 +161,20 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$buffer .= '\\multicolumn{1}{|c|}{\\textbf{' . PMA_texEscape(stripslashes($columns[$i])) . '}} & ';
}
$buffer = substr($buffer,0,-2) . '\\\\ \\hline \hline ';
if (!PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) return FALSE;
$buffer = substr($buffer, 0, -2) . '\\\\ \\hline \hline ';
if (!PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
return FALSE;
}
if (isset($GLOBALS['latex_caption'])) {
if (!PMA_exportOutputHandler('\\caption{' . str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_data_continued_caption']) . '} \\\\ ')) return FALSE;
}
if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) return FALSE;
if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
return FALSE;
}
} else {
if (!PMA_exportOutputHandler('\\\\ \hline')) return FALSE;
if (!PMA_exportOutputHandler('\\\\ \hline')) {
return FALSE;
}
}
// print the whole table
@@ -189,11 +197,15 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
}
$buffer .= ' \\\\ \\hline ' . $crlf;
if (!PMA_exportOutputHandler($buffer)) return FALSE;
if (!PMA_exportOutputHandler($buffer)) {
return FALSE;
}
}
$buffer = ' \\end{longtable}' . $crlf;
if (!PMA_exportOutputHandler($buffer)) return FALSE;
if (!PMA_exportOutputHandler($buffer)) {
return FALSE;
}
PMA_DBI_free_result($result);
return TRUE;
@@ -227,7 +239,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$keys_result = PMA_DBI_query($keys_query);
$unique_keys = array();
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
if ($key['Non_unique'] == 0) $unique_keys[] = $key['Column_name'];
if ($key['Non_unique'] == 0) {
$unique_keys[] = $key['Column_name'];
}
}
PMA_DBI_free_result($keys_result);
@@ -250,8 +264,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
} else {
$have_rel = FALSE;
}
}
else {
} else {
$have_rel = FALSE;
} // end if
@@ -260,7 +273,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
*/
$buffer = $crlf . '%' . $crlf . '% ' . $GLOBALS['strStructure'] . ': ' . $table . $crlf . '%' . $crlf
. ' \\begin{longtable}{';
if (!PMA_exportOutputHandler($buffer)) return FALSE;
if (!PMA_exportOutputHandler($buffer)) {
return FALSE;
}
$columns_cnt = 4;
$alignment = '|l|c|c|c|';
@@ -308,7 +323,9 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
}
$buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ';
if (!PMA_exportOutputHandler($buffer)) return FALSE;
if (!PMA_exportOutputHandler($buffer)) {
return FALSE;
}
while ($row = PMA_DBI_fetch_assoc($result)) {
@@ -379,16 +396,18 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$local_buffer = PMA_texEscape($local_buffer);
if ($row['Key']=='PRI') {
$pos=strpos($local_buffer, "\000");
$local_buffer = '\\textit{' . substr($local_buffer,0,$pos) . '}' . substr($local_buffer,$pos);
$local_buffer = '\\textit{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
}
if (in_array($field_name, $unique_keys)) {
$pos=strpos($local_buffer, "\000");
$local_buffer = '\\textbf{' . substr($local_buffer,0,$pos) . '}' . substr($local_buffer,$pos);
$local_buffer = '\\textbf{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
}
$buffer = str_replace("\000", ' & ', $local_buffer);
$buffer .= ' \\\\ \\hline ' . $crlf;
if (!PMA_exportOutputHandler($buffer)) return FALSE;
if (!PMA_exportOutputHandler($buffer)) {
return FALSE;
}
} // end while
PMA_DBI_free_result($result);

View File

@@ -83,7 +83,7 @@ class PMA_PDF extends PMA_FPDF
}
$this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*2);
$this->cellFontSize = $this->FontSizePt ;
$this->SetFont(PMA_PDF_FONT, '' ,($this->titleFontSize ? $this->titleFontSize : $this->FontSizePt ));
$this->SetFont(PMA_PDF_FONT, '', ($this->titleFontSize ? $this->titleFontSize : $this->FontSizePt));
$this->Cell(0, $this->FontSizePt, $this->titleText, 0, 1, 'C');
$l = ($this->lMargin);
$this->SetFont(PMA_PDF_FONT, '', $this->cellFontSize);
@@ -204,7 +204,7 @@ class PMA_PDF extends PMA_FPDF
// Pass 1 for column widths
// TODO: force here a LIMIT to speed up pass 1 ?
$this->results = PMA_DBI_query($query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
$this->numFields = PMA_DBI_num_fields($this->results);
$this->fields = PMA_DBI_get_fields_meta($this->results);
@@ -272,7 +272,7 @@ class PMA_PDF extends PMA_FPDF
// Pass 2
$this->results = PMA_DBI_query($query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
$this->Open();
$this->setY($this->tMargin);
$this->AddPage();

View File

@@ -14,7 +14,7 @@ $GLOBALS['comment_marker'] = '-- ';
* Avoids undefined variables, use NULL so isset() returns false
*/
if ( ! isset( $use_backquotes ) ) {
$use_backquotes = NULL;
$use_backquotes = null;
}
/**
@@ -24,7 +24,8 @@ if ( ! isset( $use_backquotes ) ) {
*
* @return bool Whether it suceeded
*/
function PMA_exportComment($text) {
function PMA_exportComment($text)
{
return PMA_exportOutputHandler($GLOBALS['comment_marker'] . $text . $GLOBALS['crlf']);
}
@@ -35,7 +36,8 @@ function PMA_exportComment($text) {
*
* @access public
*/
function PMA_exportFooter() {
function PMA_exportFooter()
{
global $crlf;
$foot = '';
@@ -58,7 +60,8 @@ function PMA_exportFooter() {
*
* @access public
*/
function PMA_exportHeader() {
function PMA_exportHeader()
{
global $crlf;
global $cfg;
@@ -107,10 +110,13 @@ function PMA_exportHeader() {
*
* @access public
*/
function PMA_exportDBCreate($db) {
function PMA_exportDBCreate($db)
{
global $crlf;
if (isset($GLOBALS['drop_database'])) {
if (!PMA_exportOutputHandler('DROP DATABASE ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : $db) . ';' . $crlf)) return FALSE;
if (!PMA_exportOutputHandler('DROP DATABASE ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : $db) . ';' . $crlf)) {
return FALSE;
}
}
$create_query = 'CREATE DATABASE ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : $db);
if (PMA_MYSQL_INT_VERSION >= 40101) {
@@ -122,7 +128,9 @@ function PMA_exportDBCreate($db) {
}
}
$create_query .= ';' . $crlf;
if (!PMA_exportOutputHandler($create_query)) return FALSE;
if (!PMA_exportOutputHandler($create_query)) {
return FALSE;
}
if (isset($GLOBALS['use_backquotes']) && PMA_MYSQL_INT_VERSION >= 40100 && isset($GLOBALS['sql_compat']) && $GLOBALS['sql_compat'] == 'NONE') {
return PMA_exportOutputHandler('USE ' . PMA_backquote($db) . ';' . $crlf);
}
@@ -138,7 +146,8 @@ function PMA_exportDBCreate($db) {
*
* @access public
*/
function PMA_exportDBHeader($db) {
function PMA_exportDBHeader($db)
{
global $crlf;
$head = $GLOBALS['comment_marker'] . $crlf
. $GLOBALS['comment_marker'] . $GLOBALS['strDatabase'] . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
@@ -155,7 +164,8 @@ function PMA_exportDBHeader($db) {
*
* @access public
*/
function PMA_exportDBFooter($db) {
function PMA_exportDBFooter($db)
{
$result = TRUE;
if (isset($GLOBALS['sql_constraints'])) {
$result = PMA_exportOutputHandler($GLOBALS['sql_constraints']);
@@ -193,7 +203,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
$new_crlf = $crlf;
// need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
$result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table) . '\'', NULL, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table) . '\'', null, PMA_DBI_QUERY_STORE);
if ($result != FALSE) {
if (PMA_DBI_num_rows($result) > 0) {
$tmpres = PMA_DBI_fetch_assoc($result);
@@ -233,7 +243,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 0');
}
$result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), NULL, PMA_DBI_QUERY_UNBUFFERED);
$result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), null, PMA_DBI_QUERY_UNBUFFERED);
if ($result != FALSE && ($row = PMA_DBI_fetch_row($result))) {
$create_query = $row[1];
unset($row);
@@ -261,7 +271,9 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
// lets find first line with constraints
for ($i = 0; $i < $sql_count; $i++) {
if (preg_match('@^[\s]*(CONSTRAINT|FOREIGN[\s]+KEY)@', $sql_lines[$i])) break;
if (preg_match('@^[\s]*(CONSTRAINT|FOREIGN[\s]+KEY)@', $sql_lines[$i])) {
break;
}
}
// If we really found a constraint
@@ -292,7 +304,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
$sql_constraints .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf;
$first = TRUE;
for($j = $i; $j < $sql_count; $j++) {
for ($j = $i; $j < $sql_count; $j++) {
if (preg_match('@CONSTRAINT|FOREIGN[\s]+KEY@', $sql_lines[$j])) {
if (!$first) {
$sql_constraints .= $crlf;
@@ -362,13 +374,14 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_comm
} else {
$have_rel = FALSE;
}
}
else {
} else {
$have_rel = FALSE;
} // end if
if ($do_mime && $cfgRelation['mimework']) {
if (!($mime_map = PMA_getMIME($db, $table, true))) unset($mime_map);
if (!($mime_map = PMA_getMIME($db, $table, true))) {
unset($mime_map);
}
}
if (isset($comments_map) && count($comments_map) > 0) {
@@ -422,7 +435,8 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_comm
*
* @access public
*/
function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $comments = FALSE, $mime = FALSE, $dates = FALSE) {
function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $comments = FALSE, $mime = FALSE, $dates = FALSE)
{
$formatted_table_name = (isset($GLOBALS['use_backquotes']))
? PMA_backquote($table)
: '\'' . $table . '\'';
@@ -475,7 +489,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
. $GLOBALS['comment_marker'] . $GLOBALS['strDumpingData'] . ' ' . $formatted_table_name . $crlf
. $GLOBALS['comment_marker'] . $crlf .$crlf;
if (!PMA_exportOutputHandler($head)) return FALSE;
if (!PMA_exportOutputHandler($head)) {
return FALSE;
}
$buffer = '';
@@ -484,7 +500,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
// are used, we did not get the true column name in case of aliases)
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($sql_query));
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
if ($result != FALSE) {
$fields_cnt = PMA_DBI_num_fields($result);
@@ -506,8 +522,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'update') {
// update
$schema_insert = 'UPDATE ';
if (isset($GLOBALS['sql_ignore']))
if (isset($GLOBALS['sql_ignore'])) {
$schema_insert .= 'IGNORE ';
}
$schema_insert .= PMA_backquote($table, $use_backquotes) . ' SET ';
} else {
// insert or replace
@@ -543,7 +560,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
$search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
$replace = array('\0', '\n', '\r', '\Z');
$current_row = 0;
$query_size = 0;
$query_size = 0;
$separator = isset($GLOBALS['extended_ins']) ? ',' : ';';
while ($row = PMA_DBI_fetch_row($result)) {
@@ -554,7 +571,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
$values[] = 'NULL';
// a number
// timestamp is numeric on some MySQL 4.1, BLOBs are sometimes numeric
} elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp'
} elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp'
&& ! $fields_meta[$j]->blob) {
$values[] = $row[$j];
// a binary field
@@ -601,7 +618,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
} else {
$insert_line = '(' . implode(', ', $values) . ')';
if (isset($GLOBALS['max_query_size']) && $GLOBALS['max_query_size'] > 0 && $query_size + strlen($insert_line) > $GLOBALS['max_query_size']) {
if (!PMA_exportOutputHandler(';' . $crlf)) return FALSE;
if (!PMA_exportOutputHandler(';' . $crlf)) {
return FALSE;
}
$query_size = 0;
$current_row = 1;
$insert_line = $schema_insert . $insert_line;
@@ -616,11 +635,15 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
}
unset($values);
if (!PMA_exportOutputHandler(($current_row == 1 ? '' : $separator . $crlf) . $insert_line)) return FALSE;
if (!PMA_exportOutputHandler(($current_row == 1 ? '' : $separator . $crlf) . $insert_line)) {
return FALSE;
}
} // end while
if ($current_row > 0) {
if (!PMA_exportOutputHandler(';' . $crlf)) return FALSE;
if (!PMA_exportOutputHandler(';' . $crlf)) {
return FALSE;
}
}
} // end if ($result != FALSE)
PMA_DBI_free_result($result);

View File

@@ -15,7 +15,8 @@ require_once('Spreadsheet/Excel/Writer.php');
*
* @return bool Whether it suceeded
*/
function PMA_exportComment($text) {
function PMA_exportComment($text)
{
return TRUE;
}
@@ -26,7 +27,8 @@ function PMA_exportComment($text) {
*
* @access public
*/
function PMA_exportFooter() {
function PMA_exportFooter()
{
global $workbook;
global $tmp_filename;
@@ -35,7 +37,9 @@ function PMA_exportFooter() {
echo $res->getMessage();
return FALSE;
}
if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) return FALSE;
if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
return FALSE;
}
unlink($tmp_filename);
return TRUE;
@@ -48,11 +52,14 @@ function PMA_exportFooter() {
*
* @access public
*/
function PMA_exportHeader() {
function PMA_exportHeader()
{
global $workbook;
global $tmp_filename;
if (empty($GLOBALS['cfg']['TempDir'])) return FALSE;
if (empty($GLOBALS['cfg']['TempDir'])) {
return FALSE;
}
$tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_');
$workbook = new Spreadsheet_Excel_Writer($tmp_filename);
@@ -68,7 +75,8 @@ function PMA_exportHeader() {
*
* @access public
*/
function PMA_exportDBHeader($db) {
function PMA_exportDBHeader($db)
{
return TRUE;
}
@@ -81,7 +89,8 @@ function PMA_exportDBHeader($db) {
*
* @access public
*/
function PMA_exportDBFooter($db) {
function PMA_exportDBFooter($db)
{
return TRUE;
}
@@ -94,7 +103,8 @@ function PMA_exportDBFooter($db) {
*
* @access public
*/
function PMA_exportDBCreate($db) {
function PMA_exportDBCreate($db)
{
return TRUE;
}
@@ -111,7 +121,8 @@ function PMA_exportDBCreate($db) {
*
* @access public
*/
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
global $what;
global $workbook;
@@ -119,7 +130,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$workbook->setTempDir(realpath($GLOBALS['cfg']['TempDir']));
// Gets the data from the database
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
$fields_cnt = PMA_DBI_num_fields($result);
$col = 0;
@@ -138,7 +149,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
for ($j = 0; $j < $fields_cnt; $j++) {
if (!isset($row[$j]) || is_null($row[$j])) {
$worksheet->write($col, $j, $GLOBALS['xls_replace_null']);
} else if ($row[$j] == '0' || $row[$j] != '') {
} elseif ($row[$j] == '0' || $row[$j] != '') {
// FIXME: we should somehow handle character set here!
$worksheet->write($col, $j, $row[$j]);
} else {

View File

@@ -124,7 +124,7 @@ function PMA_exportDBCreate($db) {
* @access public
*/
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
$columns_cnt = PMA_DBI_num_fields($result);
for ($i = 0; $i < $columns_cnt; $i++) {
@@ -133,7 +133,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
unset($i);
$buffer = ' <!-- ' . $GLOBALS['strTable'] . ' ' . $table . ' -->' . $crlf;
if (!PMA_exportOutputHandler($buffer)) return FALSE;
if (!PMA_exportOutputHandler($buffer)) {
return FALSE;
}
while ($record = PMA_DBI_fetch_row($result)) {
$buffer = ' <' . $table . '>' . $crlf;
@@ -145,7 +147,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
}
$buffer .= ' </' . $table . '>' . $crlf;
if (!PMA_exportOutputHandler($buffer)) return FALSE;
if (!PMA_exportOutputHandler($buffer)) {
return FALSE;
}
}
PMA_DBI_free_result($result);

View File

@@ -10,7 +10,8 @@
* @param string regullar expression to match files
* @returns array sorted file list on success, FALSE on failure
*/
function PMA_getDirContent($dir, $expression = '') {
function PMA_getDirContent($dir, $expression = '')
{
if ($handle = @opendir($dir)) {
$result = array();
if (substr($dir, -1) != '/') {
@@ -37,11 +38,14 @@ function PMA_getDirContent($dir, $expression = '') {
* @param string currently active choice
* @returns array sorted file list on success, FALSE on failure
*/
function PMA_getFileSelectOptions($dir, $extensions = '', $active = '') {
function PMA_getFileSelectOptions($dir, $extensions = '', $active = '')
{
$list = PMA_getDirContent($dir, $extensions);
if ($list === FALSE) return FALSE;
if ($list === FALSE) {
return FALSE;
}
$result = '';
foreach($list as $key => $val) {
foreach ($list as $key => $val) {
$result .= '<option value="'. htmlspecialchars($val) . '"';
if ($val == $active) {
$result .= ' selected="selected"';
@@ -56,21 +60,28 @@ function PMA_getFileSelectOptions($dir, $extensions = '', $active = '') {
*
* @returns string | separated list of extensions usable in PMA_getDirContent
*/
function PMA_supportedDecompressions() {
function PMA_supportedDecompressions()
{
global $cfg;
$compressions = '';
if ($cfg['GZipDump'] && @function_exists('gzopen')) {
if (!empty($compressions)) $compressions .= '|';
if (!empty($compressions)) {
$compressions .= '|';
}
$compressions .= 'gz';
}
if ($cfg['BZipDump'] && @function_exists('bzopen')) {
if (!empty($compressions)) $compressions .= '|';
if (!empty($compressions)) {
$compressions .= '|';
}
$compressions .= 'bz2';
}
if ($cfg['ZipDump'] && @function_exists('gzinflate')) {
if (!empty($compressions)) $compressions .= '|';
if (!empty($compressions)) {
$compressions .= '|';
}
$compressions .= 'zip';
}

View File

@@ -68,13 +68,17 @@ require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
<?php
// Link to itself to replicate windows including frameset
if (!isset($GLOBALS['checked_special'])) $GLOBALS['checked_special'] = FALSE;
if (!isset($GLOBALS['checked_special'])) {
$GLOBALS['checked_special'] = FALSE;
}
if (isset($_SERVER['SCRIPT_NAME']) && empty($_POST) && !$GLOBALS['checked_special']) {
echo '<div id="selflink">' . "\n";
echo '<a href="index.php?target=' . basename($_SERVER['SCRIPT_NAME']);
$url = PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : '');
if (!empty($url)) echo '&amp;' . $url;
if (!empty($url)) {
echo '&amp;' . $url;
}
echo '" target="_blank">' . $GLOBALS['strOpenNewWindow'] . '</a>' . "\n";
echo '</div>' . "\n";
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -64,8 +64,7 @@ if ($foreigners && isset($foreigners[$field])) {
}
@PMA_DBI_free_result($disp);
}
}
else {
} else {
unset($disp_row);
$foreign_link = true;
}

View File

@@ -63,7 +63,7 @@ if (empty($GLOBALS['is_header_sent'])) {
</script>
<script src="./js/functions.js" type="text/javascript" language="javascript"></script>
<?php
} else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
} elseif (isset($js_to_run) && $js_to_run == 'user_password.js') {
echo "\n";
?>
// js form validation stuff
@@ -75,7 +75,7 @@ if (empty($GLOBALS['is_header_sent'])) {
</script>
<script src="./js/user_password.js" type="text/javascript" language="javascript"></script>
<?php
} else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
} elseif (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
echo "\n";
?>
// js form validation stuff
@@ -88,7 +88,7 @@ if (empty($GLOBALS['is_header_sent'])) {
<script src="./js/server_privileges.js" type="text/javascript" language="javascript"></script>
<script src="./js/functions.js" type="text/javascript" language="javascript"></script>
<?php
} else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
} elseif (isset($js_to_run) && $js_to_run == 'indexes.js') {
echo "\n";
?>
// js index validation stuff
@@ -98,7 +98,7 @@ if (empty($GLOBALS['is_header_sent'])) {
</script>
<script src="./js/indexes.js" type="text/javascript" language="javascript"></script>
<?php
} else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
} elseif (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
echo "\n";
?>
//-->
@@ -194,7 +194,7 @@ if (empty($GLOBALS['is_header_sent'])) {
*/
if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
if (strstr($show_comment, '; InnoDB free')) {
$show_comment = preg_replace('@; InnoDB free:.*?$@' , '', $show_comment);
$show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
}
echo '<span class="table_comment" id="span_table_comment">'
.'&quot;' . htmlspecialchars($show_comment)

View File

@@ -28,10 +28,11 @@ echo "<?xml version=\"1.0\" encoding=\"" . $GLOBALS['charset'] . "\"?".">";
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<title><?php
if(!empty($page_title))
if (!empty($page_title)) {
echo htmlspecialchars($page_title);
else
} else {
echo 'phpMyAdmin';
}
?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>" />

View File

@@ -15,7 +15,8 @@ define('PMA_CHK_DROP', 1);
* @return boolean true if timeout is close
* @access public
*/
function PMA_checkTimeout() {
function PMA_checkTimeout()
{
global $timestamp, $maximum_time, $timeout_passed;
if ($maximum_time == 0) {
return FALSE;
@@ -37,16 +38,23 @@ function PMA_checkTimeout() {
* @return string MIME type of compression, none for none
* @access public
*/
function PMA_detectCompression($filepath) {
function PMA_detectCompression($filepath)
{
$file = @fopen($filepath, 'rb');
if (!$file) {
return FALSE;
}
$test = fread($file, 4);
fclose($file);
if ($test[0] == chr(31) && $test[1] == chr(139)) return 'application/gzip';
if (substr($test, 0, 3) == 'BZh') return 'application/bzip2';
if ($test == "PK\003\004") return 'application/zip';
if ($test[0] == chr(31) && $test[1] == chr(139)) {
return 'application/gzip';
}
if (substr($test, 0, 3) == 'BZh') {
return 'application/bzip2';
}
if ($test == "PK\003\004") {
return 'application/zip';
}
return 'none';
}
@@ -58,7 +66,8 @@ function PMA_detectCompression($filepath) {
* @param string query to display, this might be commented
* @access public
*/
function PMA_importRunQuery($sql = '', $full = '') {
function PMA_importRunQuery($sql = '', $full = '')
{
global $import_run_buffer, $go_sql, $complete_query, $display_query, $sql_query, $cfg, $my_die, $error, $reload, $finished, $timeout_passed, $skip_queries, $executed_queries, $max_sql_len, $read_multiply, $cfg, $sql_query_disabled, $db, $run_query, $is_superuser;
$read_multiply = 1;
if (isset($import_run_buffer)) {
@@ -110,7 +119,7 @@ function PMA_importRunQuery($sql = '', $full = '') {
$error = TRUE;
return;
}
} else if ($cfg['VerboseMultiSubmit']) {
} elseif ($cfg['VerboseMultiSubmit']) {
$a_num_rows = (int)@PMA_DBI_num_rows($result);
$a_aff_rows = (int)@PMA_DBI_affected_rows();
if ($a_num_rows > 0) {
@@ -181,19 +190,29 @@ function PMA_importRunQuery($sql = '', $full = '') {
* @return string part of file/buffer
* @access public
*/
function PMA_importGetNextChunk($size = 32768) {
function PMA_importGetNextChunk($size = 32768)
{
global $import_file, $import_text, $finished, $compression, $import_handle, $offset, $charset_conversion, $charset_of_file, $charset, $read_multiply, $read_limit;
// Add some progression while reading large amount of data
if ($read_multiply <= 8) $size *= $read_multiply;
else $size *= 8;
if ($read_multiply <= 8) {
$size *= $read_multiply;
} else {
$size *= 8;
}
$read_multiply++;
// We can not read too much
if ($size > $read_limit) $size = $read_limit;
if ($size > $read_limit) {
$size = $read_limit;
}
if (PMA_checkTimeout()) return FALSE;
if ($finished) return TRUE;
if (PMA_checkTimeout()) {
return FALSE;
}
if ($finished) {
return TRUE;
}
if ($import_file == 'none') {
// Well this is not yet supported and tested, but should return content of textarea

View File

@@ -75,7 +75,7 @@ if ($plugin_param == 'table') {
}
$val = trim($val);
$found = FALSE;
foreach($tmp_fields as $id => $field) {
foreach ($tmp_fields as $id => $field) {
if ($field['Field'] == $val) {
$found = TRUE;
break;
@@ -118,7 +118,9 @@ if ($plugin_param == 'table') {
$buffer .= $data;
// Do not parse string when we're not at the end and don't have new line inside
if (($csv_new_line == 'auto' && strpos($buffer, "\r") === FALSE && strpos($buffer, "\n") === FALSE)
|| ($csv_new_line != 'auto' && strpos($buffer, $csv_new_line) === FALSE)) continue;
|| ($csv_new_line != 'auto' && strpos($buffer, $csv_new_line) === FALSE)) {
continue;
}
}
// Current length of our buffer
@@ -140,7 +142,9 @@ if ($plugin_param == 'table') {
// Grab empty field
if ($ch == $csv_terminated) {
$values[] = '';
if ($i == $len - 1) break;
if ($i == $len - 1) {
break;
}
$i++;
$ch = $buffer[$i];
continue;
@@ -149,7 +153,9 @@ if ($plugin_param == 'table') {
// Grab one field
if ($ch == $csv_enclosed) {
$need_end = TRUE;
if ($i == $len - 1) break;
if ($i == $len - 1) {
break;
}
$i++;
$ch = $buffer[$i];
} else {
@@ -157,7 +163,7 @@ if ($plugin_param == 'table') {
}
$fail = FALSE;
$value = '';
while(($need_end && $ch != $csv_enclosed) || (!$need_end && !($ch == $csv_terminated || $ch == $csv_new_line || ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n"))))) {
while (($need_end && $ch != $csv_enclosed) || (!$need_end && !($ch == $csv_terminated || $ch == $csv_new_line || ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n"))))) {
if ($ch == $csv_escaped) {
if ($i == $len - 1) {
$fail = TRUE;
@@ -176,11 +182,15 @@ if ($plugin_param == 'table') {
$i++;
$ch = $buffer[$i];
}
if ($fail) break;
if ($fail) {
break;
}
$values[] = $value;
// Need to strip trailing enclosing char?
if ($need_end && $ch == $csv_enclosed) {
if ($i == $len - 1) break;
if ($i == $len - 1) {
break;
}
$i++;
$ch = $buffer[$i];
}
@@ -190,7 +200,9 @@ if ($plugin_param == 'table') {
}
// Go to next char
if ($ch == $csv_terminated) {
if ($i == $len - 1) break;
if ($i == $len - 1) {
break;
}
$i++;
$ch = $buffer[$i];
}
@@ -199,7 +211,9 @@ if ($plugin_param == 'table') {
// End of line
if ($csv_finish || $ch == $csv_new_line || ($csv_new_line == 'auto' && ($ch == "\r" || $ch == "\n"))) {
if ($csv_new_line == 'auto' && $ch == "\r") { // Handle "\r\n"
if ($i >= ($len - 2) && !$finished) break; // We need more data to decide new line
if ($i >= ($len - 2) && !$finished) {
break; // We need more data to decide new line
}
if ($buffer[$i + 1] == "\n") {
$i++;
}
@@ -218,7 +232,7 @@ if ($plugin_param == 'table') {
$first = TRUE;
$sql = $sql_template;
foreach($values as $key => $val) {
foreach ($values as $key => $val) {
if (!$first) {
$sql .= ', ';
}

View File

@@ -29,34 +29,52 @@ if (isset($plugin_list)) {
// Append new data to buffer
$buffer .= $data;
// Do not parse string when we're not at the end and don't have ; inside
if ((strpos($buffer, ';') === FALSE) && !$finished) continue;
if ((strpos($buffer, ';') === FALSE) && !$finished) {
continue;
}
}
// Current length of our buffer
$len = strlen($buffer);
// Grab some SQL queries out of it
while($i < $len) {
while ($i < $len) {
// Find first interesting character, several strpos seem to be faster than simple loop in php:
//while(($i < $len) && (strpos('\'";#-/', $buffer[$i]) === FALSE)) $i++;
//while (($i < $len) && (strpos('\'";#-/', $buffer[$i]) === FALSE)) $i++;
//if ($i == $len) break;
$oi = $i;
$p1 = strpos($buffer, '\'', $i);
if ($p1 === FALSE) $p1 = 2147483647;
if ($p1 === FALSE) {
$p1 = 2147483647;
}
$p2 = strpos($buffer, '"', $i);
if ($p2 === FALSE) $p2 = 2147483647;
if ($p2 === FALSE) {
$p2 = 2147483647;
}
$p3 = strpos($buffer, ';', $i);
if ($p3 === FALSE) $p3 = 2147483647;
if ($p3 === FALSE) {
$p3 = 2147483647;
}
$p4 = strpos($buffer, '#', $i);
if ($p4 === FALSE) $p4 = 2147483647;
if ($p4 === FALSE) {
$p4 = 2147483647;
}
$p5 = strpos($buffer, '--', $i);
if ($p5 === FALSE) $p5 = 2147483647;
if ($p5 === FALSE) {
$p5 = 2147483647;
}
$p6 = strpos($buffer, '/*', $i);
if ($p6 === FALSE) $p6 = 2147483647;
if ($p6 === FALSE) {
$p6 = 2147483647;
}
$p7 = strpos($buffer, '`', $i);
if ($p7 === FALSE) $p7 = 2147483647;
if ($p7 === FALSE) {
$p7 = 2147483647;
}
$i = min ($p1, $p2, $p3, $p4, $p5, $p6, $p7);
if ($i == 2147483647) {
$i = $oi;
if (!$finished) break;
if (!$finished) {
break;
}
// at the end there might be some whitespace...
if (trim($buffer) == '') {
$buffer = '';
@@ -94,7 +112,9 @@ if (isset($plugin_list)) {
// Skip the string
$i = $pos;
}
if (!$endq) break;
if (!$endq) {
break;
}
$i++;
// Aren't we at the end?
if ($finished && $i == $len) {
@@ -131,7 +151,9 @@ if (isset($plugin_list)) {
}
}
// Skip *
if ($ch == '/') $i++;
if ($ch == '/') {
$i++;
}
// Skip last char
$i++;
// Next query part will start here
@@ -161,7 +183,9 @@ if (isset($plugin_list)) {
$i = 0;
$start_pos = 0;
// Any chance we will get a complete query?
if ((strpos($buffer, ';') === FALSE) && !$finished) break;
if ((strpos($buffer, ';') === FALSE) && !$finished) {
break;
}
} else {
$i++;
$start_pos = $i;

View File

@@ -25,88 +25,72 @@ function PMA_getIp()
if (empty($REMOTE_ADDR)) {
if (!empty($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) {
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
}
else if (!empty($_ENV) && isset($_ENV['REMOTE_ADDR'])) {
} elseif (!empty($_ENV) && isset($_ENV['REMOTE_ADDR'])) {
$REMOTE_ADDR = $_ENV['REMOTE_ADDR'];
}
else if (@getenv('REMOTE_ADDR')) {
} elseif (@getenv('REMOTE_ADDR')) {
$REMOTE_ADDR = getenv('REMOTE_ADDR');
}
} // end if
if (empty($HTTP_X_FORWARDED_FOR)) {
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$HTTP_X_FORWARDED_FOR = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
} elseif (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
$HTTP_X_FORWARDED_FOR = $_ENV['HTTP_X_FORWARDED_FOR'];
}
else if (@getenv('HTTP_X_FORWARDED_FOR')) {
} elseif (@getenv('HTTP_X_FORWARDED_FOR')) {
$HTTP_X_FORWARDED_FOR = getenv('HTTP_X_FORWARDED_FOR');
}
} // end if
if (empty($HTTP_X_FORWARDED)) {
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED'])) {
$HTTP_X_FORWARDED = $_SERVER['HTTP_X_FORWARDED'];
}
else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED'])) {
} elseif (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED'])) {
$HTTP_X_FORWARDED = $_ENV['HTTP_X_FORWARDED'];
}
else if (@getenv('HTTP_X_FORWARDED')) {
} elseif (@getenv('HTTP_X_FORWARDED')) {
$HTTP_X_FORWARDED = getenv('HTTP_X_FORWARDED');
}
} // end if
if (empty($HTTP_FORWARDED_FOR)) {
if (!empty($_SERVER) && isset($_SERVER['HTTP_FORWARDED_FOR'])) {
$HTTP_FORWARDED_FOR = $_SERVER['HTTP_FORWARDED_FOR'];
}
else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED_FOR'])) {
} elseif (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED_FOR'])) {
$HTTP_FORWARDED_FOR = $_ENV['HTTP_FORWARDED_FOR'];
}
else if (@getenv('HTTP_FORWARDED_FOR')) {
} elseif (@getenv('HTTP_FORWARDED_FOR')) {
$HTTP_FORWARDED_FOR = getenv('HTTP_FORWARDED_FOR');
}
} // end if
if (empty($HTTP_FORWARDED)) {
if (!empty($_SERVER) && isset($_SERVER['HTTP_FORWARDED'])) {
$HTTP_FORWARDED = $_SERVER['HTTP_FORWARDED'];
}
else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED'])) {
} elseif (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED'])) {
$HTTP_FORWARDED = $_ENV['HTTP_FORWARDED'];
}
else if (@getenv('HTTP_FORWARDED')) {
} elseif (@getenv('HTTP_FORWARDED')) {
$HTTP_FORWARDED = getenv('HTTP_FORWARDED');
}
} // end if
if (empty($HTTP_VIA)) {
if (!empty($_SERVER) && isset($_SERVER['HTTP_VIA'])) {
$HTTP_VIA = $_SERVER['HTTP_VIA'];
}
else if (!empty($_ENV) && isset($_ENV['HTTP_VIA'])) {
} elseif (!empty($_ENV) && isset($_ENV['HTTP_VIA'])) {
$HTTP_VIA = $_ENV['HTTP_VIA'];
}
else if (@getenv('HTTP_VIA')) {
} elseif (@getenv('HTTP_VIA')) {
$HTTP_VIA = getenv('HTTP_VIA');
}
} // end if
if (empty($HTTP_X_COMING_FROM)) {
if (!empty($_SERVER) && isset($_SERVER['HTTP_X_COMING_FROM'])) {
$HTTP_X_COMING_FROM = $_SERVER['HTTP_X_COMING_FROM'];
}
else if (!empty($_ENV) && isset($_ENV['HTTP_X_COMING_FROM'])) {
} elseif (!empty($_ENV) && isset($_ENV['HTTP_X_COMING_FROM'])) {
$HTTP_X_COMING_FROM = $_ENV['HTTP_X_COMING_FROM'];
}
else if (@getenv('HTTP_X_COMING_FROM')) {
} elseif (@getenv('HTTP_X_COMING_FROM')) {
$HTTP_X_COMING_FROM = getenv('HTTP_X_COMING_FROM');
}
} // end if
if (empty($HTTP_COMING_FROM)) {
if (!empty($_SERVER) && isset($_SERVER['HTTP_COMING_FROM'])) {
$HTTP_COMING_FROM = $_SERVER['HTTP_COMING_FROM'];
}
else if (!empty($_ENV) && isset($_ENV['HTTP_COMING_FROM'])) {
} elseif (!empty($_ENV) && isset($_ENV['HTTP_COMING_FROM'])) {
$HTTP_COMING_FROM = $_ENV['HTTP_COMING_FROM'];
}
else if (@getenv('HTTP_COMING_FROM')) {
} elseif (@getenv('HTTP_COMING_FROM')) {
$HTTP_COMING_FROM = getenv('HTTP_COMING_FROM');
}
} // end if
@@ -120,19 +104,19 @@ function PMA_getIp()
$proxy_ip = '';
if (!empty($HTTP_X_FORWARDED_FOR)) {
$proxy_ip = $HTTP_X_FORWARDED_FOR;
} else if (!empty($HTTP_X_FORWARDED)) {
} elseif (!empty($HTTP_X_FORWARDED)) {
$proxy_ip = $HTTP_X_FORWARDED;
} else if (!empty($HTTP_FORWARDED_FOR)) {
} elseif (!empty($HTTP_FORWARDED_FOR)) {
$proxy_ip = $HTTP_FORWARDED_FOR;
} else if (!empty($HTTP_FORWARDED)) {
} elseif (!empty($HTTP_FORWARDED)) {
$proxy_ip = $HTTP_FORWARDED;
} else if (!empty($HTTP_VIA)) {
} elseif (!empty($HTTP_VIA)) {
$proxy_ip = $HTTP_VIA;
} else if (!empty($HTTP_X_COMING_FROM)) {
} elseif (!empty($HTTP_X_COMING_FROM)) {
$proxy_ip = $HTTP_X_COMING_FROM;
} else if (!empty($HTTP_COMING_FROM)) {
} elseif (!empty($HTTP_COMING_FROM)) {
$proxy_ip = $HTTP_COMING_FROM;
} // end if... else if...
} // end if... elseif...
// Returns the true IP if it has been found, else FALSE
if (empty($proxy_ip)) {

View File

@@ -232,7 +232,7 @@ if ( !empty($submit_mult) && !empty($what)) {
echo PMA_generate_common_hidden_inputs($db);
} elseif (strpos(' ' . $action, 'tbl_properties') == 1
|| $what == 'row_delete') {
echo PMA_generate_common_hidden_inputs($db,$table);
echo PMA_generate_common_hidden_inputs($db, $table);
} else {
echo PMA_generate_common_hidden_inputs();
}
@@ -393,7 +393,7 @@ elseif ($mult_btn == $strYes) {
break;
} // end switch
// All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
// All "DROP TABLE", "DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
// statements will be run at once below
if ($run_parts) {
$sql_query .= $a_query . ';' . "\n";

View File

@@ -50,7 +50,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
define('PMA_CSDROPDOWN_COLLATION', 0);
define('PMA_CSDROPDOWN_CHARSET', 1);
function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION, $name = NULL, $id = NULL, $default = NULL, $label = TRUE, $indent = 0, $submitOnChange = FALSE, $displayUnavailable = FALSE) {
function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION, $name = null, $id = null, $default = null, $label = TRUE, $indent = 0, $submitOnChange = FALSE, $displayUnavailable = FALSE) {
global $mysql_charsets, $mysql_charsets_descriptions, $mysql_charsets_available, $mysql_collations, $mysql_collations_available;
if (empty($name)) {

View File

@@ -242,7 +242,7 @@ function PMA_pluginGetJavascript(&$list) {
//<![CDATA[
function hide_them_all() {
';
foreach($list as $plugin_name => $val) {
foreach ($list as $plugin_name => $val) {
$ret .= 'document.getElementById("' . $plugin_name . '_options").style.display = "none";' . "\n";
}
$ret .= '
@@ -251,7 +251,7 @@ function PMA_pluginGetJavascript(&$list) {
function init_options() {
hide_them_all();
';
foreach($list as $plugin_name => $val) {
foreach ($list as $plugin_name => $val) {
$ret .= 'if (document.getElementById("radio_plugin_' . $plugin_name . '").checked) {' . "\n";
$ret .= 'document.getElementById("' . $plugin_name . '_options").style.display = "block";' . "\n";
$ret .= ' } else ' . "\n";
@@ -269,7 +269,7 @@ function PMA_pluginGetJavascript(&$list) {
if (farr[len - 1] == "gz" || farr[len - 1] == "bz2" || farr[len -1] == "zip") len--;
switch (farr[len - 1]) {
';
foreach($list as $plugin_name => $val) {
foreach ($list as $plugin_name => $val) {
$ret .= 'case "' . $val['extension'] . '" :';
$ret .= 'document.getElementById("radio_plugin_' . $plugin_name . '").checked = true;';
$ret .= 'init_options();';

View File

@@ -44,7 +44,7 @@ function PMA_splitSqlFile(&$ret, $sql, $release)
}
// Backquotes or no backslashes before quotes: it's indeed the
// end of the string -> exit the loop
else if ($string_start == '`' || $sql[$i-1] != '\\') {
elseif ($string_start == '`' || $sql[$i-1] != '\\') {
$string_start = '';
$in_string = FALSE;
break;
@@ -74,17 +74,19 @@ function PMA_splitSqlFile(&$ret, $sql, $release)
} // end if (in string)
// lets skip comments (/*, -- and #)
else if (($char == '-' && $sql_len > $i + 2 && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') || $char == '#' || ($char == '/' && $sql_len > $i + 1 && $sql[$i + 1] == '*')) {
elseif (($char == '-' && $sql_len > $i + 2 && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') || $char == '#' || ($char == '/' && $sql_len > $i + 1 && $sql[$i + 1] == '*')) {
$i = strpos($sql, $char == '/' ? '*/' : "\n", $i);
// didn't we hit end of string?
if ($i === FALSE) {
break;
}
if ($char == '/') $i++;
if ($char == '/') {
$i++;
}
}
// We are not in a string, first check for delimiter...
else if ($char == ';') {
elseif ($char == ';') {
// if delimiter found, add the parsed part to the returned array
$ret[] = array('query' => substr($sql, 0, $i), 'empty' => $nothing);
$nothing = TRUE;
@@ -96,14 +98,14 @@ function PMA_splitSqlFile(&$ret, $sql, $release)
// The submited statement(s) end(s) here
return TRUE;
}
} // end else if (is delimiter)
} // end elseif (is delimiter)
// ... then check for start of a string,...
else if (($char == '"') || ($char == '\'') || ($char == '`')) {
elseif (($char == '"') || ($char == '\'') || ($char == '`')) {
$in_string = TRUE;
$nothing = FALSE;
$string_start = $char;
} // end else if (is start of string)
} // end elseif (is start of string)
elseif ($nothing) {
$nothing = FALSE;
@@ -151,8 +153,12 @@ function PMA_readFile($path, $mime = '') {
}
$test = fread($file, 3);
fclose($file);
if ($test[0] == chr(31) && $test[1] == chr(139)) return PMA_readFile($path, 'application/x-gzip');
if ($test == 'BZh') return PMA_readFile($path, 'application/x-bzip');
if ($test[0] == chr(31) && $test[1] == chr(139)) {
return PMA_readFile($path, 'application/x-gzip');
}
if ($test == 'BZh') {
return PMA_readFile($path, 'application/x-bzip');
}
return PMA_readFile($path, 'text/plain');
case 'text/plain':
$file = @fopen($path, 'rb');

View File

@@ -119,17 +119,17 @@ function PMA_getRelationsParam($verbose = FALSE)
while ($curr_table = @PMA_DBI_fetch_row($tab_rs)) {
if ($curr_table[0] == $cfg['Server']['bookmarktable']) {
$cfgRelation['bookmark'] = $curr_table[0];
} else if ($curr_table[0] == $cfg['Server']['relation']) {
} elseif ($curr_table[0] == $cfg['Server']['relation']) {
$cfgRelation['relation'] = $curr_table[0];
} else if ($curr_table[0] == $cfg['Server']['table_info']) {
} elseif ($curr_table[0] == $cfg['Server']['table_info']) {
$cfgRelation['table_info'] = $curr_table[0];
} else if ($curr_table[0] == $cfg['Server']['table_coords']) {
} elseif ($curr_table[0] == $cfg['Server']['table_coords']) {
$cfgRelation['table_coords'] = $curr_table[0];
} else if ($curr_table[0] == $cfg['Server']['column_info']) {
} elseif ($curr_table[0] == $cfg['Server']['column_info']) {
$cfgRelation['column_info'] = $curr_table[0];
} else if ($curr_table[0] == $cfg['Server']['pdf_pages']) {
} elseif ($curr_table[0] == $cfg['Server']['pdf_pages']) {
$cfgRelation['pdf_pages'] = $curr_table[0];
} else if ($curr_table[0] == $cfg['Server']['history']) {
} elseif ($curr_table[0] == $cfg['Server']['history']) {
$cfgRelation['history'] = $curr_table[0];
}
} // end while
@@ -157,9 +157,9 @@ function PMA_getRelationsParam($verbose = FALSE)
while ($curr_mime_field = @PMA_DBI_fetch_row($mime_rs)) {
if ($curr_mime_field[0] == 'mimetype') {
$mime_field_mimetype = TRUE;
} else if ($curr_mime_field[0] == 'transformation') {
} elseif ($curr_mime_field[0] == 'transformation') {
$mime_field_transformation = TRUE;
} else if ($curr_mime_field[0] == 'transformation_options') {
} elseif ($curr_mime_field[0] == 'transformation_options') {
$mime_field_transformation_options = TRUE;
}
}
@@ -315,7 +315,7 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') {
$show_create_table_query = 'SHOW CREATE TABLE '
. PMA_backquote($db) . '.' . PMA_backquote($table);
$show_create_table_res = PMA_DBI_query($show_create_table_query);
list(,$show_create_table) = PMA_DBI_fetch_row($show_create_table_res);
list(, $show_create_table) = PMA_DBI_fetch_row($show_create_table_res);
PMA_DBI_free_result($show_create_table_res);
unset($show_create_table_res, $show_create_table_query);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
@@ -468,7 +468,7 @@ function PMA_getComments($db, $table = '') {
if (PMA_MYSQL_INT_VERSION >= 40100) {
$fields = PMA_DBI_get_fields($db, $table);
if ($fields) {
foreach($fields as $key=>$field) {
foreach ($fields as $key=>$field) {
$tmp_col = $field['Field'];
if (!empty($field['Comment'])) {
$native_comment[$tmp_col] = $field['Comment'];
@@ -520,9 +520,9 @@ function PMA_getComments($db, $table = '') {
$comment[$col] = $native_comment[$col];
} else {
// no native comment, so migrate pmadb-style to native
PMA_setComment($db, $table, $col, $comment[$col],'','native');
PMA_setComment($db, $table, $col, $comment[$col], '', 'native');
// and erase the pmadb-style comment
PMA_setComment($db, $table, $col, '','','pmadb');
PMA_setComment($db, $table, $col, '', '', 'pmadb');
}
}
}
@@ -583,7 +583,7 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
if ($mode == 'native' && isset($table) && strlen($table)) {
$query = 'ALTER TABLE ' . PMA_backquote($table) . ' CHANGE '
. PMA_generateAlterTable($col, $col, '', '', '', '', FALSE, '', FALSE, '', $comment, '', '');
PMA_DBI_try_query($query, NULL, PMA_DBI_QUERY_STORE);
PMA_DBI_try_query($query, null, PMA_DBI_QUERY_STORE);
return TRUE;
}
@@ -636,7 +636,7 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\'';
}
} else if (strlen($comment) > 0) {
} elseif (strlen($comment) > 0) {
$upd_query = '
INSERT INTO
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
@@ -879,18 +879,18 @@ function PMA_foreignDropdown($disp, $foreign_field, $foreign_display, $data, $ma
// put the dropdown sections in correct order
$c = count($cfg['ForeignKeyDropdownOrder']);
if($c == 2) {
if ($c == 2) {
$top = $reloptions[$cfg['ForeignKeyDropdownOrder'][0]];
$bot = $reloptions[$cfg['ForeignKeyDropdownOrder'][1]];
} elseif($c == 1) {
} elseif ($c == 1) {
$bot = $reloptions[$cfg['ForeignKeyDropdownOrder'][0]];
$top = NULL;
$top = null;
} else {
$top = $reloptions['id-content'];
$bot = $reloptions['content-id'];
}
$str_bot = implode('', $bot);
if($top !== NULL) {
if ($top !== null) {
$str_top = implode('', $top);
$top_count = count($top);
if ($max == -1 || $top_count < $max) {

View File

@@ -23,10 +23,11 @@
* @uses explode()
* @return bool success if valid lang is found, otherwise false
*/
function PMA_langCheck() {
function PMA_langCheck()
{
// check forced language
if ( ! empty( $GLOBALS['cfg']['Lang'] ) ) {
if ( PMA_langSet( $GLOBALS['cfg']['Lang'] ) ) {
if (! empty($GLOBALS['cfg']['Lang'])) {
if (PMA_langSet($GLOBALS['cfg']['Lang'])) {
return true;
} else {
$GLOBALS['lang_failed_cfg'] = $GLOBALS['cfg']['Lang'];
@@ -34,8 +35,8 @@ function PMA_langCheck() {
}
// check user requested language
if ( ! empty( $_REQUEST['lang'] ) ) {
if ( PMA_langSet( $_REQUEST['lang'] ) ) {
if (! empty($_REQUEST['lang'])) {
if (PMA_langSet($_REQUEST['lang'])) {
return true;
} else {
$GLOBALS['lang_failed_request'] = $_REQUEST['lang'];
@@ -43,8 +44,8 @@ function PMA_langCheck() {
}
// check previous set language
if ( ! empty( $_COOKIE['pma_lang'] ) ) {
if ( PMA_langSet( $_COOKIE['pma_lang'] ) ) {
if (! empty($_COOKIE['pma_lang'])) {
if (PMA_langSet($_COOKIE['pma_lang'])) {
return true;
} else {
$GLOBALS['lang_failed_cookie'] = $_COOKIE['pma_lang'];
@@ -52,21 +53,21 @@ function PMA_langCheck() {
}
// try to findout user's language by checking its HTTP_ACCEPT_LANGUAGE variable
if ( ! empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) {
foreach ( explode( ',', $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) as $lang ) {
if ( PMA_langDetect( $lang, 1 ) ) {
if (! empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) {
if (PMA_langDetect($lang, 1)) {
return true;
}
}
}
// try to findout user's language by checking its HTTP_USER_AGENT variable
if ( PMA_langDetect($_SERVER['HTTP_USER_AGENT'], 2) ) {
if (PMA_langDetect($_SERVER['HTTP_USER_AGENT'], 2)) {
return true;
}
// Didn't catch any valid lang : we use the default settings
if ( PMA_langSet($GLOBALS['cfg']['DefaultLang']) ) {
if (PMA_langSet($GLOBALS['cfg']['DefaultLang'])) {
return true;
}
@@ -82,8 +83,9 @@ function PMA_langCheck() {
* @param string $lang language to set
* @return bool success
*/
function PMA_langSet( &$lang ) {
if ( empty( $lang ) || empty( $GLOBALS['available_languages'][$lang] ) ) {
function PMA_langSet(&$lang)
{
if (empty($lang) || empty($GLOBALS['available_languages'][$lang])) {
return false;
}
$GLOBALS['lang'] = $lang;
@@ -103,9 +105,14 @@ function PMA_langSet( &$lang ) {
*
* @access private
*/
function PMA_langDetect( &$str, $envType ) {
if ( empty( $str ) ) return false;
if ( empty( $GLOBALS['available_languages'] ) ) return false;
function PMA_langDetect(&$str, $envType)
{
if (empty($str)) {
return false;
}
if (empty($GLOBALS['available_languages'])) {
return false;
}
foreach ($GLOBALS['available_languages'] as $lang => $value) {
// $envType = 1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable,
@@ -116,7 +123,7 @@ function PMA_langDetect( &$str, $envType ) {
}
if (($envType == 1 && eregi('^(' . $expr . ')(;q=[0-9]\\.[0-9])?$', $str))
|| ($envType == 2 && eregi('(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))', $str))) {
if ( PMA_langSet( $lang ) ) {
if (PMA_langSet($lang)) {
return true;
}
}
@@ -133,14 +140,14 @@ $lang_path = './lang/';
/**
* first check for lang dir exists
*/
if ( ! is_dir( $lang_path ) ) {
if (! is_dir($lang_path)) {
// language directory not found
trigger_error( 'phpMyAdmin-ERROR: path not found: '
trigger_error('phpMyAdmin-ERROR: path not found: '
. $lang_path . ', check your language directory.',
E_USER_WARNING );
E_USER_WARNING);
// and tell the user
PMA_sendHeaderLocation( 'error.php?error='
. urlencode( 'path to languages is invalid: ' . $lang_path ) );
PMA_sendHeaderLocation('error.php?error='
. urlencode( 'path to languages is invalid: ' . $lang_path));
// stop execution
exit;
}
@@ -318,9 +325,9 @@ $available_languages = array(
);
// Language filtering support
if ( ! empty( $GLOBALS['cfg']['FilterLanguages'] ) ) {
if (! empty($GLOBALS['cfg']['FilterLanguages'])) {
$new_lang = array();
foreach($available_languages as $key => $val) {
foreach ($available_languages as $key => $val) {
if (preg_match('@' . $GLOBALS['cfg']['FilterLanguages'] . '@', $key)) {
$new_lang[$key] = $val;
}
@@ -328,18 +335,18 @@ if ( ! empty( $GLOBALS['cfg']['FilterLanguages'] ) ) {
if (count($new_lang) > 0) {
$available_languages = $new_lang;
}
unset( $key, $val, $new_lang );
unset($key, $val, $new_lang);
}
/**
* check for language files
*/
foreach ( $available_languages as $each_lang_key => $each_lang ) {
if ( ! file_exists( $lang_path . $each_lang[1] . '.inc.php' ) ) {
unset( $available_languages[$each_lang_key] );
foreach ($available_languages as $each_lang_key => $each_lang) {
if (! file_exists($lang_path . $each_lang[1] . '.inc.php')) {
unset($available_languages[$each_lang_key]);
}
}
unset( $each_lang_key, $each_lang );
unset($each_lang_key, $each_lang);
// MySQL charsets map
$mysql_charset_map = array(
@@ -373,7 +380,7 @@ $mysql_charset_map = array(
*/
// Checks whether charset recoding should be allowed or not
$allow_recoding = FALSE; // Default fallback value
if ( empty($convcharset) ) {
if (empty($convcharset)) {
if (isset($_COOKIE['pma_charset'])) {
$convcharset = $_COOKIE['pma_charset'];
} else {
@@ -381,36 +388,36 @@ if ( empty($convcharset) ) {
}
}
if ( ! PMA_langCheck() ) {
if (! PMA_langCheck()) {
// fallback language
$fall_back_lang = 'en-utf-8'; $line = __LINE__;
if ( ! PMA_langSet( $fall_back_lang ) ) {
trigger_error( 'phpMyAdmin-ERROR: invalid lang code: '
if (! PMA_langSet($fall_back_lang)) {
trigger_error('phpMyAdmin-ERROR: invalid lang code: '
. __FILE__ . '#' . $line . ', check hard coded fall back language.',
E_USER_WARNING );
E_USER_WARNING);
// stop execution
// and tell the user that his choosen language is invalid
PMA_sendHeaderLocation( 'error.php?error='
. urlencode( 'Could not load any language, please check your language settings and folder' ) );
PMA_sendHeaderLocation('error.php?error='
. urlencode('Could not load any language, please check your language settings and folder'));
exit;
}
}
// Defines the associated filename and load the translation
$lang_file = $lang_path . $available_languages[$GLOBALS['lang']][1] . '.inc.php';
require_once( $lang_file );
require_once($lang_file);
// now, that we have loaded the language strings we can send the errors
if ( $lang_failed_cfg ) {
$GLOBALS['PMA_errors'][] = sprintf( $strLanguageUnknown, $lang_failed_cfg );
if ($lang_failed_cfg) {
$GLOBALS['PMA_errors'][] = sprintf($strLanguageUnknown, $lang_failed_cfg);
}
if ( $lang_failed_cookie ) {
$GLOBALS['PMA_errors'][] = sprintf( $strLanguageUnknown, $lang_failed_cookie );
if ($lang_failed_cookie) {
$GLOBALS['PMA_errors'][] = sprintf($strLanguageUnknown, $lang_failed_cookie);
}
if ( $lang_failed_request ) {
$GLOBALS['PMA_errors'][] = sprintf( $strLanguageUnknown, $lang_failed_request );
if ($lang_failed_request) {
$GLOBALS['PMA_errors'][] = sprintf($strLanguageUnknown, $lang_failed_request);
}
unset( $lang_file, $lang_path, $strLanguageFileNotFound, $line, $fall_back_lang,
$lang_failed_cfg, $lang_failed_cookie, $lang_failed_request, $strLanguageUnknown );
unset($lang_file, $lang_path, $strLanguageFileNotFound, $line, $fall_back_lang,
$lang_failed_cfg, $lang_failed_cookie, $lang_failed_request, $strLanguageUnknown);
?>

View File

@@ -56,7 +56,7 @@ function PMA_select_server($form, $left) {
if ($list){
if ($selected && !$left) {
echo '&raquo; <b>' . htmlspecialchars($label) . '</b><br />';
}else{
} else {
echo '&raquo; <a class="item" href="index.php?server=' . $key . '&amp;lang=' . $lang . '&amp;convcharset=' . $convcharset . '" target="_top">' . htmlspecialchars($label) . '</a><br />';
}
} else {

View File

@@ -51,7 +51,7 @@ if ($is_superuser) {
}
$has_binlogs = FALSE;
$binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', NULL, PMA_DBI_QUERY_STORE);
$binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
if ($binlogs) {
if (PMA_DBI_num_rows($binlogs) > 0) {
$binary_logs = array();

View File

@@ -24,52 +24,50 @@ if (!@function_exists('session_name')) {
require_once('./libraries/select_lang.lib.php');
// Displays the error message
// (do not use &amp; for parameters sent by header)
header( 'Location: error.php'
. '?lang=' . urlencode( $available_languages[$lang][2] )
. '&char=' . urlencode( $charset )
. '&dir=' . urlencode( $text_dir )
. '&type=' . urlencode( $strError )
. '&error=' . urlencode(
sprintf($strCantLoad, 'session'))
);
header('Location: error.php'
. '?lang=' . urlencode($available_languages[$lang][2])
. '&char=' . urlencode($charset)
. '&dir=' . urlencode($text_dir)
. '&type=' . urlencode($strError)
. '&error=' . urlencode(sprintf($strCantLoad, 'session')));
exit();
}
// session cookie settings
session_set_cookie_params( 0, PMA_Config::getCookiePath(),
'', PMA_Config::isHttps() );
session_set_cookie_params(0, PMA_Config::getCookiePath(),
'', PMA_Config::isHttps());
// disable starting of sessions before all settings are done
ini_set( 'session.auto_start', false );
ini_set('session.auto_start', false);
// cookies are safer
ini_set( 'session.use_cookies', true );
ini_set('session.use_cookies', true);
// but not all user allow cookies
ini_set( 'session.use_only_cookies', false );
ini_set( 'session.use_trans_sid', true );
ini_set( 'url_rewriter.tags',
'a=href,frame=src,input=src,form=fakeentry,fieldset=' );
ini_set( 'arg_separator.output' , '&amp;' );
ini_set('session.use_only_cookies', false);
ini_set('session.use_trans_sid', true);
ini_set('url_rewriter.tags',
'a=href,frame=src,input=src,form=fakeentry,fieldset=');
ini_set('arg_separator.output', '&amp;');
// delete session/cookies when browser is closed
ini_set( 'session.cookie_lifetime', 0 );
ini_set('session.cookie_lifetime', 0);
// warn but dont work with bug
ini_set( 'session.bug_compat_42', false );
ini_set( 'session.bug_compat_warn', true );
ini_set('session.bug_compat_42', false);
ini_set('session.bug_compat_warn', true);
// use more secure session ids (with PHP 5)
if ( version_compare( PHP_VERSION, '5.0.0', 'ge' )
&& substr( PHP_OS, 0 ,3 ) != 'WIN' ) {
ini_set( 'session.hash_function', 1 );
ini_set( 'session.hash_bits_per_character', 6 );
if (version_compare( PHP_VERSION, '5.0.0', 'ge')
&& substr(PHP_OS, 0, 3) != 'WIN') {
ini_set('session.hash_function', 1);
ini_set('session.hash_bits_per_character', 6);
}
// start the session
// on some servers (for example, sourceforge.net), we get a permission error
// on the session data directory, so I add some "@"
@session_name( 'phpMyAdmin' );
@session_name('phpMyAdmin');
@session_start();
/**
@@ -82,12 +80,13 @@ if ( version_compare( PHP_VERSION, '5.0.0', 'ge' )
* @uses strip_tags() to prevent XSS attacks in SID
* @uses function_exists() for session_regenerate_id()
*/
function PMA_secureSession() {
function PMA_secureSession()
{
// prevent session fixation and XSS
if ( function_exists( 'session_regenerate_id' ) ) {
session_regenerate_id( true );
if (function_exists('session_regenerate_id')) {
session_regenerate_id(true);
} else {
session_id( strip_tags( session_id() ) );
session_id(strip_tags(session_id()));
}
}
?>

View File

@@ -58,9 +58,10 @@ require_once('./libraries/bookmark.lib.php'); // used for file listing
* what part to display
* false if not inside querywindow
*/
function PMA_sqlQueryForm( $query = true, $display_tab = false ) {
function PMA_sqlQueryForm($query = true, $display_tab = false)
{
// check tab to display if inside querywindow
if ( ! $display_tab ) {
if (! $display_tab) {
$display_tab = 'full';
$is_querywindow = false;
} else {
@@ -68,12 +69,12 @@ function PMA_sqlQueryForm( $query = true, $display_tab = false ) {
}
// query to show
if ( true === $query ) {
$query = empty( $GLOBALS['sql_query'] ) ? '' : $GLOBALS['sql_query'];
if (true === $query) {
$query = empty($GLOBALS['sql_query']) ? '' : $GLOBALS['sql_query'];
}
// set enctype to multipart for file uploads
if ( $GLOBALS['is_upload'] ) {
if ($GLOBALS['is_upload']) {
$enctype = ' enctype="multipart/form-data"';
} else {
$enctype = '';
@@ -81,25 +82,25 @@ function PMA_sqlQueryForm( $query = true, $display_tab = false ) {
$table = '';
$db = '';
if ( ! isset( $GLOBALS['db'] ) || ! strlen($GLOBALS['db']) ) {
if (! isset($GLOBALS['db']) || ! strlen($GLOBALS['db'])) {
// prepare for server related
$goto = empty( $GLOBALS['goto'] ) ?
$goto = empty($GLOBALS['goto']) ?
'server_sql.php' : $GLOBALS['goto'];
} elseif ( ! isset( $GLOBALS['table'] ) || ! strlen($GLOBALS['table']) ) {
} elseif (! isset($GLOBALS['table']) || ! strlen($GLOBALS['table'])) {
// prepare for db related
$db = $GLOBALS['db'];
$goto = empty( $GLOBALS['goto'] ) ?
$goto = empty($GLOBALS['goto']) ?
'db_details.php' : $GLOBALS['goto'];
} else {
$table = $GLOBALS['table'];
$db = $GLOBALS['db'];
$goto = empty( $GLOBALS['goto'] ) ?
$goto = empty($GLOBALS['goto']) ?
'tbl_properties.php' : $GLOBALS['goto'];
}
// start output
if ( $is_querywindow ) {
if ($is_querywindow) {
?>
<form method="post" id="sqlqueryform" target="frame_content"
action="import.php"<?php echo $enctype; ?> name="sqlform"
@@ -113,45 +114,45 @@ function PMA_sqlQueryForm( $query = true, $display_tab = false ) {
.' onsubmit="return checkSqlQuery(this)" name="sqlform">' . "\n";
}
if ( $is_querywindow ) {
if ($is_querywindow) {
echo '<input type="hidden" name="focus_querywindow" value="true" />'
."\n";
if ( $display_tab != 'sql' && $display_tab != 'full' ) {
if ($display_tab != 'sql' && $display_tab != 'full') {
echo '<input type="hidden" name="sql_query" value="" />' . "\n";
echo '<input type="hidden" name="show_query" value="1" />' . "\n";
}
}
echo '<input type="hidden" name="is_js_confirmed" value="0" />' . "\n"
.PMA_generate_common_hidden_inputs( $db, $table ) . "\n"
.PMA_generate_common_hidden_inputs($db, $table) . "\n"
.'<input type="hidden" name="pos" value="0" />' . "\n"
.'<input type="hidden" name="goto" value="'
.htmlspecialchars( $goto ) . '" />' . "\n"
.htmlspecialchars($goto) . '" />' . "\n"
.'<input type="hidden" name="zero_rows" value="'
. htmlspecialchars( $GLOBALS['strSuccess'] ) . '" />' . "\n"
. htmlspecialchars($GLOBALS['strSuccess']) . '" />' . "\n"
.'<input type="hidden" name="prev_sql_query" value="'
. htmlspecialchars( $query ) . '" />' . "\n";
. htmlspecialchars($query) . '" />' . "\n";
// display querybox
if ( $display_tab === 'full' || $display_tab === 'sql' ) {
PMA_sqlQueryFormInsert( $query, $is_querywindow );
if ($display_tab === 'full' || $display_tab === 'sql') {
PMA_sqlQueryFormInsert($query, $is_querywindow);
}
// display uploads
if ( $display_tab === 'files' && $GLOBALS['is_upload'] ) {
if ($display_tab === 'files' && $GLOBALS['is_upload']) {
PMA_sqlQueryFormUpload();
}
// Bookmark Support
if ( $display_tab === 'full' || $display_tab === 'history' ) {
if ( ! empty( $GLOBALS['cfg']['Bookmark'] )
if ($display_tab === 'full' || $display_tab === 'history') {
if (! empty( $GLOBALS['cfg']['Bookmark'])
&& $GLOBALS['cfg']['Bookmark']['db']
&& $GLOBALS['cfg']['Bookmark']['table'] ) {
&& $GLOBALS['cfg']['Bookmark']['table']) {
PMA_sqlQueryFormBookmark();
}
}
// Encoding setting form appended by Y.Kawada
if ( function_exists('PMA_set_enc_form') ) {
if (function_exists('PMA_set_enc_form')) {
echo PMA_set_enc_form(' ');
}
@@ -177,17 +178,18 @@ function PMA_sqlQueryForm( $query = true, $display_tab = false ) {
* @param string $query query to display in the textarea
* @param boolean $is_querywindow if inside querywindow or not
*/
function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false)
{
// enable auto select text in textarea
if ( $GLOBALS['cfg']['TextareaAutoSelect'] ) {
if ($GLOBALS['cfg']['TextareaAutoSelect']) {
$auto_sel = ' onfocus="selectContent( this, sql_box_locked, true )"';
} else {
$auto_sel = '';
}
// enable locking if inside query window
if ( $is_querywindow ) {
if ($is_querywindow) {
$locking = ' onkeypress="document.sqlform.elements[\'LockFromUpdate\'].'
.'checked = true;"';
} else {
@@ -197,29 +199,29 @@ function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
$table = '';
$db = '';
$fields_list = array();
if ( ! isset( $GLOBALS['db'] ) || ! strlen($GLOBALS['db']) ) {
if (! isset($GLOBALS['db']) || ! strlen($GLOBALS['db'])) {
// prepare for server related
$legend = sprintf( $GLOBALS['strRunSQLQueryOnServer'],
$legend = sprintf($GLOBALS['strRunSQLQueryOnServer'],
htmlspecialchars(
$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host'] ) );
} elseif ( ! isset( $GLOBALS['table'] ) || ! strlen($GLOBALS['table']) ) {
$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host']));
} elseif (! isset($GLOBALS['table']) || ! strlen($GLOBALS['table'])) {
// prepare for db related
$db = $GLOBALS['db'];
// if you want navigation:
$strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . PMA_generate_common_url( $db ) . '"';
if ( $is_querywindow ) {
. '?' . PMA_generate_common_url($db) . '"';
if ($is_querywindow) {
$strDBLink .= ' target="_self"'
. ' onclick="this.target=window.opener.frames[1].name"';
}
$strDBLink .= '>'
. htmlspecialchars( $db ) . '</a>';
. htmlspecialchars($db) . '</a>';
// else use
// $strDBLink = htmlspecialchars( $db );
$legend = sprintf( $GLOBALS['strRunSQLQuery'], $strDBLink );
if ( empty( $query ) ) {
$query = str_replace( '%d',
PMA_backquote( $db ), $GLOBALS['cfg']['DefaultQueryDatabase'] );
// $strDBLink = htmlspecialchars($db);
$legend = sprintf($GLOBALS['strRunSQLQuery'], $strDBLink);
if (empty($query)) {
$query = str_replace('%d',
PMA_backquote($db), $GLOBALS['cfg']['DefaultQueryDatabase']);
}
} else {
$table = $GLOBALS['table'];
@@ -228,37 +230,37 @@ function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
// we do a try_query here, because we could be in the query window,
// trying to synchonize and the table has not yet been created
$fields_list = PMA_DBI_fetch_result(
'SHOW FULL COLUMNS FROM ' . PMA_backquote( $db )
. '.' . PMA_backquote( $GLOBALS['table'] ));
'SHOW FULL COLUMNS FROM ' . PMA_backquote($db)
. '.' . PMA_backquote($GLOBALS['table']));
$strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . PMA_generate_common_url( $db ) . '"';
if ( $is_querywindow ) {
. '?' . PMA_generate_common_url($db) . '"';
if ($is_querywindow) {
$strDBLink .= ' target="_self"'
. ' onclick="this.target=window.opener.frames[1].name"';
}
$strDBLink .= '>'
. htmlspecialchars( $db ) . '</a>';
. htmlspecialchars($db) . '</a>';
// else use
// $strDBLink = htmlspecialchars( $db );
$legend = sprintf( $GLOBALS['strRunSQLQuery'], $strDBLink );
if ( empty( $query ) && count( $fields_list ) ) {
// $strDBLink = htmlspecialchars($db);
$legend = sprintf($GLOBALS['strRunSQLQuery'], $strDBLink);
if (empty($query) && count($fields_list)) {
$field_names = array();
foreach ( $fields_list as $field ) {
foreach ($fields_list as $field) {
$field_names[] = PMA_backquote($field['Field']);
}
$query =
str_replace( '%d', PMA_backquote( $db ),
str_replace( '%t', PMA_backquote( $table ),
str_replace( '%f',
implode( ', ', $field_names ),
$GLOBALS['cfg']['DefaultQueryTable'] ) ) );
str_replace('%d', PMA_backquote($db),
str_replace('%t', PMA_backquote($table),
str_replace('%f',
implode(', ', $field_names ),
$GLOBALS['cfg']['DefaultQueryTable'])));
unset($field_names);
}
}
$legend .= ': ' . PMA_showMySQLDocu( 'SQL-Syntax', 'SELECT' );
$legend .= ': ' . PMA_showMySQLDocu('SQL-Syntax', 'SELECT');
if ( count( $fields_list ) ) {
if (count($fields_list)) {
$sqlquerycontainer_id = 'sqlquerycontainer';
} else {
$sqlquerycontainer_id = 'sqlquerycontainerfull';
@@ -277,17 +279,17 @@ function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
.$auto_sel . $locking . '>' . $query . '</textarea>' . "\n";
echo '</div>' . "\n";
if ( count( $fields_list ) ) {
if (count($fields_list)) {
echo '<div id="tablefieldscontainer">' . "\n"
.'<label>' . $GLOBALS['strFields'] . '</label>' . "\n"
.'<select id="tablefields" name="dummy" '
.'size="' . ($GLOBALS['cfg']['TextareaRows'] - 2) . '" '
.'multiple="multiple" ondblclick="insertValueQuery()">' . "\n";
foreach ( $fields_list as $field ) {
foreach ($fields_list as $field) {
echo '<option value="'
.PMA_backquote( htmlspecialchars( $field['Field'] ) ) . '"';
if ( isset( $field['Field'] ) && strlen($field['Field']) && isset($field['Comment']) ) {
echo ' title="' . htmlspecialchars( $field['Comment'] ) . '"';
.PMA_backquote(htmlspecialchars($field['Field'])) . '"';
if (isset($field['Field']) && strlen($field['Field']) && isset($field['Comment'])) {
echo ' title="' . htmlspecialchars($field['Comment']) . '"';
}
echo '>' . htmlspecialchars( $field['Field'] ) . '</option>' . "\n";
}
@@ -309,9 +311,9 @@ function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
echo '<div class="clearfloat"></div>' . "\n";
echo '</div>' . "\n";
if ( ! empty( $GLOBALS['cfg']['Bookmark'] )
if (! empty($GLOBALS['cfg']['Bookmark'])
&& $GLOBALS['cfg']['Bookmark']['db']
&& $GLOBALS['cfg']['Bookmark']['table'] ) {
&& $GLOBALS['cfg']['Bookmark']['table']) {
?>
<div id="bookmarkoptions">
<div class="formelement">
@@ -341,7 +343,7 @@ function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
echo '<fieldset id="queryboxfooter" class="tblFooters">' . "\n";
echo '<div class="formelement">' . "\n";
if ( $is_querywindow ) {
if ($is_querywindow) {
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
@@ -382,9 +384,10 @@ function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
* @uses count()
* @uses htmlspecialchars()
*/
function PMA_sqlQueryFormBookmark() {
function PMA_sqlQueryFormBookmark()
{
$bookmark_list = PMA_listBookmarks(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', $GLOBALS['cfg']['Bookmark'] );
if ( ! $bookmark_list || count( $bookmark_list ) < 1 ) {
if (! $bookmark_list || count($bookmark_list) < 1) {
return;
}
@@ -394,16 +397,16 @@ function PMA_sqlQueryFormBookmark() {
echo '<div class="formelement">';
echo '<select name="id_bookmark">' . "\n";
echo '<option value=""></option>' . "\n";
foreach ( $bookmark_list as $key => $value ) {
echo '<option value="' . htmlspecialchars( $key ) . '">'
.htmlspecialchars( $value ) . '</option>' . "\n";
foreach ($bookmark_list as $key => $value) {
echo '<option value="' . htmlspecialchars($key) . '">'
.htmlspecialchars($value) . '</option>' . "\n";
}
// &nbsp; is required for correct display with styles/line height
echo '</select>&nbsp;' . "\n";
echo '</div>' . "\n";
echo '<div class="formelement">' . "\n";
echo $GLOBALS['strVar'];
if ( $GLOBALS['cfg']['ReplaceHelpImg'] ) {
if ($GLOBALS['cfg']['ReplaceHelpImg']) {
echo ' <a href="./Documentation.html#faqbookmark"'
.' target="documentation">'
.'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png"'
@@ -470,7 +473,7 @@ function PMA_sqlQueryFormBookmark() {
* @uses PMA_CSDROPDOWN_CHARSET
* @uses empty()
*/
function PMA_sqlQueryFormUpload() {
function PMA_sqlQueryFormUpload(){
$errors = array ();
$matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@'; // we allow only SQL here
@@ -487,9 +490,9 @@ function PMA_sqlQueryFormUpload() {
echo $GLOBALS['strLocationTextfile'] . '</legend>';
echo '<div class="formelement">';
echo '<input type="file" name="sql_file" class="textfield" /> ';
echo PMA_displayMaximumUploadSize( $GLOBALS['max_upload_size'] );
echo PMA_displayMaximumUploadSize($GLOBALS['max_upload_size']);
// some browsers should respect this :)
echo PMA_generateHiddenMaxFileSize( $GLOBALS['max_upload_size'] ) . "\n";
echo PMA_generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n";
echo '</div>';
if ($files === FALSE) {
@@ -514,25 +517,25 @@ function PMA_sqlQueryFormUpload() {
&& $GLOBALS['allow_recoding'] ) {
echo $GLOBALS['strCharsetOfFile'] . "\n"
. '<select name="charset_of_file" size="1">' . "\n";
foreach( $GLOBALS['cfg']['AvailableCharsets'] as $temp_charset ) {
foreach ($GLOBALS['cfg']['AvailableCharsets'] as $temp_charset) {
echo '<option value="' . $temp_charset . '"';
if ( $temp_charset == $GLOBALS['charset'] ) {
if ($temp_charset == $GLOBALS['charset']) {
echo ' selected="selected"';
}
echo '>' . $temp_charset . '</option>' . "\n";
}
echo '</select>' . "\n";
} elseif ( PMA_MYSQL_INT_VERSION >= 40100 ) {
} elseif (PMA_MYSQL_INT_VERSION >= 40100) {
echo $GLOBALS['strCharsetOfFile'] . "\n";
echo PMA_generateCharsetDropdownBox( PMA_CSDROPDOWN_CHARSET,
'charset_of_file', NULL, 'utf8', FALSE );
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET,
'charset_of_file', null, 'utf8', FALSE);
} // end if (recoding)
echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo']
.'" />' . "\n";
echo '<div class="clearfloat"></div>' . "\n";
echo '</fieldset>';
foreach( $errors as $error => $message ) {
foreach ( $errors as $error => $message ) {
echo '<div>' . $error . '</div>';
echo '<div>' . $message . '</div>';
}

View File

@@ -64,7 +64,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
global $timer;
$t = $timer;
$arr[] = array('type' => $type, 'data' => $data , 'time' => $t);
$arr[] = array('type' => $type, 'data' => $data, 'time' => $t);
$timer = microtime();
$arrsize++;
} // end of the "PMA_SQP_arrayAdd()" function
@@ -77,7 +77,8 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
* @access public
*/
// Added, Robbat2 - 13 Janurary 2003, 2:59PM
function PMA_SQP_resetError() {
function PMA_SQP_resetError()
{
global $SQP_errorString;
$SQP_errorString = '';
unset($SQP_errorString);
@@ -91,7 +92,8 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
* @access public
*/
// Added, Robbat2 - 13 Janurary 2003, 2:59PM
function PMA_SQP_getErrorString() {
function PMA_SQP_getErrorString()
{
global $SQP_errorString;
return isset($SQP_errorString) ? $SQP_errorString : '';
}
@@ -104,7 +106,8 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
* @access public
*/
// Added, Robbat2 - 13 Janurary 2003, 2:59PM
function PMA_SQP_isError() {
function PMA_SQP_isError()
{
global $SQP_errorString;
return isset($SQP_errorString) && !empty($SQP_errorString);
}
@@ -320,7 +323,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
if (($pos < $len) && PMA_STR_charIsEscaped($sql, $pos)) {
$pos ++;
continue;
} else if (($pos + 1 < $len) && (PMA_substr($sql, $pos, 1) == $quotetype) && (PMA_substr($sql, $pos + 1, 1) == $quotetype)) {
} elseif (($pos + 1 < $len) && (PMA_substr($sql, $pos, 1) == $quotetype) && (PMA_substr($sql, $pos + 1, 1) == $quotetype)) {
$pos = $pos + 2;
continue;
} else {
@@ -394,11 +397,15 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
if ($is_hex_digit) {
$count2++;
$pos = strspn($sql, '0123456789abcdefABCDEF', $count2);
if ($pos > $count2) $count2 = $pos;
if ($pos > $count2) {
$count2 = $pos;
}
unset($pos);
} elseif ($is_digit) {
$pos = strspn($sql, '0123456789', $count2);
if ($pos > $count2) $count2 = $pos;
if ($pos > $count2) {
$count2 = $pos;
}
unset($pos);
}
}
@@ -451,13 +458,12 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
$type = 'digit';
if ($is_float_digit) {
$type .= '_float';
} else if ($is_hex_digit) {
} elseif ($is_hex_digit) {
$type .= '_hex';
} else {
$type .= '_integer';
}
}
else {
} else {
if ($is_sql_variable != FALSE) {
$type = 'alpha_variable';
} else {
@@ -499,12 +505,10 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
break;
}
PMA_SQP_arrayAdd($sql_array, 'punct' . $t_suffix, $punct_data, $arraysize);
}
else if (PMA_STR_binarySearchInArr($punct_data, $allpunct_list_pair, $allpunct_list_pair_size)) {
} elseif (PMA_STR_binarySearchInArr($punct_data, $allpunct_list_pair, $allpunct_list_pair_size)) {
// Ok, we have one of the valid combined punct expressions
PMA_SQP_arrayAdd($sql_array, 'punct', $punct_data, $arraysize);
}
else {
} else {
// Bad luck, lets split it up more
$first = $punct_data[0];
$first2 = $punct_data[0] . $punct_data[1];
@@ -513,17 +517,17 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
if (($first == ',') || ($first == ';') || ($first == '.') || ($first == '*')) {
$count2 = $count1 + 1;
$punct_data = $first;
} else if (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || PMA_substr($sql, $count2, 1) <= ' ') )) {
} elseif (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || PMA_substr($sql, $count2, 1) <= ' ') )) {
$count2 -= 2;
$punct_data = PMA_substr($sql, $count1, $count2 - $count1);
} else if (($last == '-') || ($last == '+') || ($last == '!')) {
} elseif (($last == '-') || ($last == '+') || ($last == '!')) {
$count2--;
$punct_data = PMA_substr($sql, $count1, $count2 - $count1);
// TODO: for negation operator, split in 2 tokens ?
// "select x&~1 from t"
// becomes "select x & ~ 1 from t" ?
} else if ($last != '~') {
} elseif ($last != '~') {
$debugstr = $GLOBALS['strSQPBugUnknownPunctuation'] . ' @ ' . ($count1+1) . "\n"
. 'STR: ' . htmlspecialchars($punct_data);
PMA_SQP_throwError($debugstr, $sql);
@@ -531,7 +535,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
}
PMA_SQP_arrayAdd($sql_array, 'punct', $punct_data, $arraysize);
continue;
} // end if... else if... else
} // end if... elseif... else
continue;
}
@@ -547,116 +551,116 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
if ($arraysize > 0) {
$t_next = $sql_array[0]['type'];
$t_prev = '';
$t_bef_prev = '';
$t_cur = '';
$d_next = $sql_array[0]['data'];
$d_prev = '';
$d_bef_prev = '';
$d_cur = '';
$d_next_upper = $t_next == 'alpha' ? strtoupper($d_next) : $d_next;
$d_prev_upper = '';
$d_bef_prev_upper = '';
$d_cur_upper = '';
$t_next = $sql_array[0]['type'];
$t_prev = '';
$t_bef_prev = '';
$t_cur = '';
$d_next = $sql_array[0]['data'];
$d_prev = '';
$d_bef_prev = '';
$d_cur = '';
$d_next_upper = $t_next == 'alpha' ? strtoupper($d_next) : $d_next;
$d_prev_upper = '';
$d_bef_prev_upper = '';
$d_cur_upper = '';
}
for ($i = 0; $i < $arraysize; $i++) {
$t_bef_prev = $t_prev;
$t_prev = $t_cur;
$t_cur = $t_next;
$d_bef_prev = $d_prev;
$d_prev = $d_cur;
$d_cur = $d_next;
$d_bef_prev_upper = $d_prev_upper;
$d_prev_upper = $d_cur_upper;
$d_cur_upper = $d_next_upper;
if (($i + 1) < $arraysize) {
$t_next = $sql_array[$i + 1]['type'];
$d_next = $sql_array[$i + 1]['data'];
$d_next_upper = $t_next == 'alpha' ? strtoupper($d_next) : $d_next;
} else {
$t_next = '';
$d_next = '';
$d_next_upper = '';
}
//DEBUG echo "[prev: <b>".$d_prev."</b> ".$t_prev."][cur: <b>".$d_cur."</b> ".$t_cur."][next: <b>".$d_next."</b> ".$t_next."]<br />";
if ($t_cur == 'alpha') {
$t_suffix = '_identifier';
if (($t_next == 'punct_qualifier') || ($t_prev == 'punct_qualifier')) {
$t_suffix = '_identifier';
} else if (($t_next == 'punct_bracket_open_round')
&& PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_function_name, $PMA_SQPdata_function_name_cnt)) {
// FIXME-2005-10-16: in the case of a CREATE TABLE containing a TIMESTAMP,
// since TIMESTAMP() is also a function, it's found here and
// the token is wrongly marked as alpha_functionName. But we
// compensate for this when analysing for timestamp_not_null
// later in this script.
$t_suffix = '_functionName';
} else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_type, $PMA_SQPdata_column_type_cnt)) {
$t_suffix = '_columnType';
// Temporary fix for BUG #621357
//TODO FIX PROPERLY NEEDS OVERHAUL OF SQL TOKENIZER
if ($d_cur_upper == 'SET' && $t_next != 'punct_bracket_open_round') {
$t_suffix = '_reservedWord';
}
//END OF TEMPORARY FIX
// CHARACTER is a synonym for CHAR, but can also be meant as
// CHARACTER SET. In this case, we have a reserved word.
if ($d_cur_upper == 'CHARACTER' && $d_next_upper == 'SET') {
$t_suffix = '_reservedWord';
}
// experimental
// current is a column type, so previous must not be
// a reserved word but an identifier
// CREATE TABLE SG_Persons (first varchar(64))
//if ($sql_array[$i-1]['type'] =='alpha_reservedWord') {
// $sql_array[$i-1]['type'] = 'alpha_identifier';
//}
} else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_reserved_word, $PMA_SQPdata_reserved_word_cnt)) {
$t_suffix = '_reservedWord';
} else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_attrib, $PMA_SQPdata_column_attrib_cnt)) {
$t_suffix = '_columnAttrib';
// INNODB is a MySQL table type, but in "SHOW INNODB STATUS",
// it should be regarded as a reserved word.
if ($d_cur_upper == 'INNODB' && $d_prev_upper == 'SHOW' && $d_next_upper == 'STATUS') {
$t_suffix = '_reservedWord';
}
if ($d_cur_upper == 'DEFAULT' && $d_next_upper == 'CHARACTER') {
$t_suffix = '_reservedWord';
}
// Binary as character set
if ($d_cur_upper == 'BINARY' && (
($d_bef_prev_upper == 'CHARACTER' && $d_prev_upper == 'SET')
|| ($d_bef_prev_upper == 'SET' && $d_prev_upper == '=')
|| ($d_bef_prev_upper == 'CHARSET' && $d_prev_upper == '=')
|| $d_prev_upper == 'CHARSET'
) && PMA_STR_binarySearchInArr($d_cur, $mysql_charsets, count($mysql_charsets))) {
$t_suffix = '_charset';
}
} elseif (PMA_STR_binarySearchInArr($d_cur, $mysql_charsets, $mysql_charsets_count)
|| PMA_STR_binarySearchInArr($d_cur, $mysql_collations_flat, $mysql_collations_count)
|| ($d_cur{0} == '_' && PMA_STR_binarySearchInArr(substr($d_cur, 1), $mysql_charsets, $mysql_charsets_count))) {
$t_suffix = '_charset';
$t_bef_prev = $t_prev;
$t_prev = $t_cur;
$t_cur = $t_next;
$d_bef_prev = $d_prev;
$d_prev = $d_cur;
$d_cur = $d_next;
$d_bef_prev_upper = $d_prev_upper;
$d_prev_upper = $d_cur_upper;
$d_cur_upper = $d_next_upper;
if (($i + 1) < $arraysize) {
$t_next = $sql_array[$i + 1]['type'];
$d_next = $sql_array[$i + 1]['data'];
$d_next_upper = $t_next == 'alpha' ? strtoupper($d_next) : $d_next;
} else {
// Do nothing
$t_next = '';
$d_next = '';
$d_next_upper = '';
}
// check if present in the list of forbidden words
if ($t_suffix == '_reservedWord' && PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_forbidden_word, $PMA_SQPdata_forbidden_word_cnt)) {
$sql_array[$i]['forbidden'] = TRUE;
} else {
$sql_array[$i]['forbidden'] = FALSE;
//DEBUG echo "[prev: <b>".$d_prev."</b> ".$t_prev."][cur: <b>".$d_cur."</b> ".$t_cur."][next: <b>".$d_next."</b> ".$t_next."]<br />";
if ($t_cur == 'alpha') {
$t_suffix = '_identifier';
if (($t_next == 'punct_qualifier') || ($t_prev == 'punct_qualifier')) {
$t_suffix = '_identifier';
} elseif (($t_next == 'punct_bracket_open_round')
&& PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_function_name, $PMA_SQPdata_function_name_cnt)) {
// FIXME-2005-10-16: in the case of a CREATE TABLE containing a TIMESTAMP,
// since TIMESTAMP() is also a function, it's found here and
// the token is wrongly marked as alpha_functionName. But we
// compensate for this when analysing for timestamp_not_null
// later in this script.
$t_suffix = '_functionName';
} elseif (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_type, $PMA_SQPdata_column_type_cnt)) {
$t_suffix = '_columnType';
// Temporary fix for BUG #621357
//TODO FIX PROPERLY NEEDS OVERHAUL OF SQL TOKENIZER
if ($d_cur_upper == 'SET' && $t_next != 'punct_bracket_open_round') {
$t_suffix = '_reservedWord';
}
//END OF TEMPORARY FIX
// CHARACTER is a synonym for CHAR, but can also be meant as
// CHARACTER SET. In this case, we have a reserved word.
if ($d_cur_upper == 'CHARACTER' && $d_next_upper == 'SET') {
$t_suffix = '_reservedWord';
}
// experimental
// current is a column type, so previous must not be
// a reserved word but an identifier
// CREATE TABLE SG_Persons (first varchar(64))
//if ($sql_array[$i-1]['type'] =='alpha_reservedWord') {
// $sql_array[$i-1]['type'] = 'alpha_identifier';
//}
} elseif (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_reserved_word, $PMA_SQPdata_reserved_word_cnt)) {
$t_suffix = '_reservedWord';
} elseif (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_attrib, $PMA_SQPdata_column_attrib_cnt)) {
$t_suffix = '_columnAttrib';
// INNODB is a MySQL table type, but in "SHOW INNODB STATUS",
// it should be regarded as a reserved word.
if ($d_cur_upper == 'INNODB' && $d_prev_upper == 'SHOW' && $d_next_upper == 'STATUS') {
$t_suffix = '_reservedWord';
}
if ($d_cur_upper == 'DEFAULT' && $d_next_upper == 'CHARACTER') {
$t_suffix = '_reservedWord';
}
// Binary as character set
if ($d_cur_upper == 'BINARY' && (
($d_bef_prev_upper == 'CHARACTER' && $d_prev_upper == 'SET')
|| ($d_bef_prev_upper == 'SET' && $d_prev_upper == '=')
|| ($d_bef_prev_upper == 'CHARSET' && $d_prev_upper == '=')
|| $d_prev_upper == 'CHARSET'
) && PMA_STR_binarySearchInArr($d_cur, $mysql_charsets, count($mysql_charsets))) {
$t_suffix = '_charset';
}
} elseif (PMA_STR_binarySearchInArr($d_cur, $mysql_charsets, $mysql_charsets_count)
|| PMA_STR_binarySearchInArr($d_cur, $mysql_collations_flat, $mysql_collations_count)
|| ($d_cur{0} == '_' && PMA_STR_binarySearchInArr(substr($d_cur, 1), $mysql_charsets, $mysql_charsets_count))) {
$t_suffix = '_charset';
} else {
// Do nothing
}
// check if present in the list of forbidden words
if ($t_suffix == '_reservedWord' && PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_forbidden_word, $PMA_SQPdata_forbidden_word_cnt)) {
$sql_array[$i]['forbidden'] = TRUE;
} else {
$sql_array[$i]['forbidden'] = FALSE;
}
$sql_array[$i]['type'] .= $t_suffix;
}
$sql_array[$i]['type'] .= $t_suffix;
}
} // end for
// Stores the size of the array inside the array, as count() is a slow
@@ -684,7 +688,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
return TRUE;
} else {
if (strpos($whatWeWant, $typeSeperator) === FALSE) {
return strncmp($whatWeWant, $toCheck , strpos($toCheck, $typeSeperator)) == 0;
return strncmp($whatWeWant, $toCheck, strpos($toCheck, $typeSeperator)) == 0;
} else {
return FALSE;
}
@@ -703,7 +707,9 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
*/
function PMA_SQP_analyze($arr)
{
if ($arr == array()) return array();
if ($arr == array()) {
return array();
}
$result = array();
$size = $arr['len'];
$subresult = array(
@@ -959,7 +965,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
// ==============================================================
if ($arr[$i]['type'] == 'alpha_reservedWord'
// && $arr[$i]['forbidden'] == FALSE) {
){
) {
// We don't know what type of query yet, so run this
if ($subresult['querytype'] == '') {
$subresult['querytype'] = strtoupper($arr[$i]['data']);
@@ -1019,13 +1025,13 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
//TODO: check embedded double quotes or backticks?
// and/or remove just the first and last character?
case 'quote_backtick':
$identifier = str_replace('`','',$arr[$i]['data']);
$identifier = str_replace('`', '', $arr[$i]['data']);
break;
case 'quote_double':
$identifier = str_replace('"','',$arr[$i]['data']);
$identifier = str_replace('"', '', $arr[$i]['data']);
break;
case 'quote_single':
$identifier = str_replace("'","",$arr[$i]['data']);
$identifier = str_replace("'", "", $arr[$i]['data']);
break;
} // end switch
@@ -1243,9 +1249,9 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
// but it's a modifier of the GROUP_CONCAT so
// it's not the real end of table refs
if (($i == $size-1)
|| ($arr[$i]['type'] == 'alpha_reservedWord'
&& !$in_group_concat
&& PMA_STR_binarySearchInArr($upper_data, $words_ending_table_ref, $words_ending_table_ref_cnt))) {
|| ($arr[$i]['type'] == 'alpha_reservedWord'
&& !$in_group_concat
&& PMA_STR_binarySearchInArr($upper_data, $words_ending_table_ref, $words_ending_table_ref_cnt))) {
$seen_end_of_table_ref = TRUE;
// to be able to save the last table ref, but do not
// set it true if we found a word like "ON" that has
@@ -1726,7 +1732,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
if ($arr[$i]['type'] == 'quote_backtick') {
// remove backquotes
$identifier = str_replace('`','',$arr[$i]['data']);
$identifier = str_replace('`', '', $arr[$i]['data']);
} else {
$identifier = $arr[$i]['data'];
}
@@ -1763,7 +1769,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
} else {
// for MySQL 4.0.16, identifier is
// `table` or `db.table`
$db_table = explode('.',$identifier);
$db_table = explode('.', $identifier);
if (isset($db_table[1])) {
$foreign[$foreign_key_number]['ref_db_name'] = $db_table[0];
$foreign[$foreign_key_number]['ref_table_name'] = $db_table[1];
@@ -1978,7 +1984,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
// array_push($typearr, $arr[$i + 1]['type']);
$typearr[4] = $arr[$i + 1]['type'];
} else {
//array_push($typearr, NULL);
//array_push($typearr, null);
$typearr[4] = '';
}

View File

@@ -54,8 +54,8 @@ if (!function_exists('class_exists') || !class_exists('SOAP_Client')) {
var $connection_technology_version;
var $interactive;
var $service_link = NULL;
var $session_data = NULL;
var $service_link = null;
var $session_data = null;
/**
@@ -103,7 +103,7 @@ if (!function_exists('class_exists') || !class_exists('SOAP_Client')) {
$interactive)
{
$use_array = array( "a_userName" => $username, "a_password" => $password, "a_callingProgram" => $calling_program, "a_callingProgramVersion" => $calling_program_version, "a_targetDbms" => $target_dbms, "a_targetDbmsVersion" => $target_dbms_version, "a_connectionTechnology" => $connection_technology, "a_connectionTechnologyVersion" => $connection_technology_version, "a_interactive" => $interactive);
$ret = $obj->call("openSession",$use_array);
$ret = $obj->call("openSession", $use_array);
// This is the old version that needed the overload extension
/* $ret = $obj->openSession($username, $password,
@@ -131,7 +131,7 @@ if (!function_exists('class_exists') || !class_exists('SOAP_Client')) {
function _validateSQL($obj, $session, $sql, $method)
{
$use_array = array("a_sessionId" => $session->sessionId, "a_sessionKey" => $session->sessionKey, "a_SQL" => $sql, "a_resultType" => $this->output_type);
$res = $obj->call("validateSQL",$use_array);
$res = $obj->call("validateSQL", $use_array);
// This is the old version that needed the overload extension
// $res = $obj->validateSQL($session->sessionId, $session->sessionKey, $sql, $this->output_type);
@@ -185,8 +185,8 @@ if (!function_exists('class_exists') || !class_exists('SOAP_Client')) {
$this->connection_technology_version = phpversion();
$this->interactive = 1;
$this->service_link = NULL;
$this->session_data = NULL;
$this->service_link = null;
$this->session_data = null;
} // end of the "PMA_SQLValidator()" function
@@ -347,7 +347,7 @@ if (!function_exists('class_exists') || !class_exists('SOAP_Client')) {
$this->connection_technology, $this->connection_technology_version,
$this->interactive);
if (isset($this->session_data) && ($this->session_data != NULL)
if (isset($this->session_data) && ($this->session_data != null)
&& ($this->session_data->target != $this->url)) {
// Reopens the service on the new URL that was provided
$url = $this->session_data->target;

View File

@@ -371,7 +371,7 @@ function PMA_STR_binarySearchInArr($str, $arr, $arrsize)
$res = strcmp($str, $arr[$mid]);
if ($res == 0) {
$found = TRUE;
} else if ($res < 0) {
} elseif ($res < 0) {
$top = $mid - 1;
} else {
$bottom = $mid + 1;

View File

@@ -60,14 +60,14 @@ function PMA_check_indexes($idx_collection, $table = true) {
return $output;
}
foreach($idx_collection['ALL'] AS $w_keyname => $w_count) {
foreach ($idx_collection['ALL'] AS $w_keyname => $w_count) {
if (isset($idx_collection['PRIMARY'][$w_keyname]) && (isset($idx_collection['INDEX'][$w_keyname]) || isset($idx_collection['UNIQUE'][$w_keyname]))) {
$output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningPrimary'], htmlspecialchars($w_keyname)), $table);
} elseif (isset($idx_collection['UNIQUE'][$w_keyname]) && isset($idx_collection['INDEX'][$w_keyname])) {
$output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningUnique'], htmlspecialchars($w_keyname)), $table);
}
foreach($index_types AS $index_type) {
foreach ($index_types AS $index_type) {
if (isset($idx_collection[$index_type][$w_keyname]) && $idx_collection[$index_type][$w_keyname] > 1) {
$output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningMultiple'], $index_type, htmlspecialchars($w_keyname)), $table);
}

View File

@@ -169,7 +169,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
for ($j = $i; $j < $cnt; $j++) {
if ($parsed_sql[$j]['type'] == 'alpha_reservedWord'
&& strtoupper($parsed_sql[$j]['data']) == 'CONSTRAINT') {
&& strtoupper($parsed_sql[$j]['data']) == 'CONSTRAINT') {
if ($parsed_sql[$j+1]['type'] == 'quote_backtick') {
$parsed_sql[$j+1]['data'] = '';
}

View File

@@ -4,7 +4,7 @@
// Check parameters
require_once('./libraries/common.lib.php');
PMA_checkParameters(array('db','table','action','num_fields'));
PMA_checkParameters(array('db', 'table', 'action', 'num_fields'));
// Get available character sets and storage engines
@@ -50,8 +50,7 @@ if ($action == 'tbl_create.php') {
?>
<input type="hidden" name="reload" value="1" />
<?php
}
elseif ($action == 'tbl_addfield.php') {
} elseif ($action == 'tbl_addfield.php') {
?>
<input type="hidden" name="field_where" value="<?php echo $field_where; ?>" />
<input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
@@ -244,8 +243,7 @@ for ( $i = 0 ; $i <= $num_fields; $i++ ) {
if (empty($row['Type'])) {
$row['Type'] = '';
$type = '';
}
else {
} else {
$type = $row['Type'];
}
// set or enum types: slashes single quotes inside options
@@ -323,7 +321,7 @@ for ( $i = 0 ; $i <= $num_fields; $i++ ) {
$ci++;
if (PMA_MYSQL_INT_VERSION >= 40100) {
$tmp_collation = empty($row['Collation']) ? NULL : $row['Collation'];
$tmp_collation = empty($row['Collation']) ? null : $row['Collation'];
$content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[]', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, FALSE);
unset($tmp_collation);
$ci++;
@@ -403,7 +401,7 @@ for ( $i = 0 ; $i <= $num_fields; $i++ ) {
$ci++;
if (isset($row)
&& !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {
&& !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {
$row['Default'] = 'NULL';
}
@@ -613,7 +611,7 @@ var odd_row = <?php echo $odd_row; ?>;
function addField() {
var new_fields = document.getElementById('added_fields').value;
var new_field_container = document.getElementById('table_columns');
var new_field = '<?php echo preg_replace( '<27>\s+<2B>', ' ', preg_replace( '<27>\'<27>', '\\\'', $new_field ) ); ?>';
var new_field = '<?php echo preg_replace( '<27>\s+<2B>', ' ', preg_replace( '<27>\'<27>', '\\\'', $new_field ) ); ?>';
var i = 0;
for ( i = 0; i < new_fields; i++ ) {
if ( odd_row ) {
@@ -653,13 +651,13 @@ if ($action == 'tbl_create.php') {
</td>
<td width="25">&nbsp;</td>
<td>
<?php echo PMA_generateEnginesDropdown('tbl_type', NULL, FALSE, (isset($GLOBALS['tbl_type']) ? $GLOBALS['tbl_type'] : NULL), 3); ?>
<?php echo PMA_generateEnginesDropdown('tbl_type', null, FALSE, (isset($GLOBALS['tbl_type']) ? $GLOBALS['tbl_type'] : null), 3); ?>
</td>
<?php
if ( PMA_MYSQL_INT_VERSION >= 40100 ) {
echo ' <td width="25">&nbsp;</td>' . "\n"
. ' <td>' . "\n"
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, (isset($tbl_collation) ? $tbl_collation : NULL), FALSE, 3)
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null, (isset($tbl_collation) ? $tbl_collation : null), FALSE, 3)
. ' </td>' . "\n";
}
?>

View File

@@ -10,7 +10,7 @@ require_once('./libraries/common.lib.php');
require_once('./libraries/bookmark.lib.php');
// Check parameters
PMA_checkParameters(array('db','table'));
PMA_checkParameters(array('db', 'table'));
if ( PMA_MYSQL_INT_VERSION >= 50002 && $db === 'information_schema' ) {
$db_is_information_schema = true;

View File

@@ -66,7 +66,7 @@ $tabs['export']['args']['single_table'] = 'true';
$tabs['export']['text'] = $strExport;
/**
* Don't display , "Import", "Operations" and "Empty"
* Don't display "Import", "Operations" and "Empty"
* for views and information_schema
*/
if ( ! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema )) {

View File

@@ -9,7 +9,7 @@
require_once('./libraries/common.lib.php');
PMA_checkParameters(array('db','encoded_key'));
PMA_checkParameters(array('db', 'encoded_key'));
// f i e l d u p l o a d e d f r o m a f i l e
@@ -112,8 +112,11 @@ if (!$check_stop) {
// f i e l d v a l u e i n t h e f o r m
if (isset($me_fields_type[$encoded_key])) $type = $me_fields_type[$encoded_key];
else $type = '';
if (isset($me_fields_type[$encoded_key])) {
$type = $me_fields_type[$encoded_key];
} else {
$type = '';
}
$f = 'field_' . md5($key);
$t_fval = (isset($$f) ? $$f : null);

View File

@@ -19,7 +19,7 @@ function PMA_transformation_getOptions($string) {
// strip possible slashes to behave like documentation says
$result = array();
foreach($transform_options as $val) {
foreach ($transform_options as $val) {
$result[] = stripslashes($val);
}
return $result;
@@ -59,7 +59,7 @@ function PMA_getAvailableMIMEtypes() {
$stack['transformation'][] = $mimetype . ': ' . $base[1];
$stack['transformation_file'][] = $file;
} else if (preg_match('|^.*\.inc\.php$|', trim($file), $match)) {
} elseif (preg_match('|^.*\.inc\.php$|', trim($file), $match)) {
// File is a plain mimetype, no functions.
$base = str_replace('.inc.php', '', $file);
@@ -161,7 +161,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformat
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
}
} else if (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) {
} elseif (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) {
$upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) '
. ' VALUES('

View File

@@ -106,8 +106,9 @@
* @uses SimpleUnzip::ReadFile() Opens file on new if specified
* @since 1.0
*/
function SimpleUnzip($in_FileName = '') {
if($in_FileName !== '') {
function SimpleUnzip($in_FileName = '')
{
if ($in_FileName !== '') {
SimpleUnzip::ReadFile($in_FileName);
}
} // end of the 'SimpleUnzip' constructor
@@ -120,7 +121,8 @@
* @uses $Entries
* @since 1.0
*/
function Count() {
function Count()
{
return count($this->Entries);
} // end of the 'Count()' method
@@ -133,7 +135,8 @@
* @access public
* @since 1.0
*/
function GetData($in_Index) {
function GetData($in_Index)
{
return $this->Entries[$in_Index]->Data;
} // end of the 'GetData()' method
@@ -146,7 +149,8 @@
* @access public
* @since 1.0
*/
function GetEntry($in_Index) {
function GetEntry($in_Index)
{
return $this->Entries[$in_Index];
} // end of the 'GetEntry()' method
@@ -159,7 +163,8 @@
* @access public
* @since 1.0
*/
function GetError($in_Index) {
function GetError($in_Index)
{
return $this->Entries[$in_Index]->Error;
} // end of the 'GetError()' method
@@ -172,7 +177,8 @@
* @access public
* @since 1.0
*/
function GetErrorMsg($in_Index) {
function GetErrorMsg($in_Index)
{
return $this->Entries[$in_Index]->ErrorMsg;
} // end of the 'GetErrorMsg()' method
@@ -185,7 +191,8 @@
* @access public
* @since 1.0
*/
function GetName($in_Index) {
function GetName($in_Index)
{
return $this->Entries[$in_Index]->Name;
} // end of the 'GetName()' method
@@ -198,7 +205,8 @@
* @access public
* @since 1.0
*/
function GetPath($in_Index) {
function GetPath($in_Index)
{
return $this->Entries[$in_Index]->Path;
} // end of the 'GetPath()' method
@@ -211,7 +219,8 @@
* @access public
* @since 1.0
*/
function GetTime($in_Index) {
function GetTime($in_Index)
{
return $this->Entries[$in_Index]->Time;
} // end of the 'GetTime()' method
@@ -224,7 +233,8 @@
* @access public
* @since 1.0
*/
function ReadFile($in_FileName) {
function ReadFile($in_FileName)
{
$this->Entries = array();
// Get file parameters
@@ -261,7 +271,7 @@
array_shift($aE);
// Loop through the entries
foreach($aE as $vZ) {
foreach ($aE as $vZ) {
$aI = array();
$aI['E'] = 0;
$aI['EM'] = '';
@@ -272,7 +282,7 @@
$nF = $aP['FNL'];
// Special case : value block after the compressed data
if($aP['GPF'] & 0x0008) {
if ($aP['GPF'] & 0x0008) {
$aP1 = unpack('V1CRC/V1CS/V1UCS', substr($vZ, -12));
$aP['CRC'] = $aP1['CRC'];
@@ -285,7 +295,7 @@
// Getting stored filename
$aI['N'] = substr($vZ, 26, $nF);
if(substr($aI['N'], -1) == '/') {
if (substr($aI['N'], -1) == '/') {
// is a directory entry - will be skipped
continue;
}
@@ -297,16 +307,14 @@
$vZ = substr($vZ, 26 + $nF);
if(strlen($vZ) != $aP['CS']) {
if (strlen($vZ) != $aP['CS']) {
$aI['E'] = 1;
$aI['EM'] = 'Compressed size is not equal with the value in header information.';
}
else {
if($bE) {
} else {
if ($bE) {
$aI['E'] = 5;
$aI['EM'] = 'File is encrypted, which is not supported from this class.';
}
else {
} else {
switch($aP['CM']) {
case 0: // Stored
// Here is nothing to do, the file ist flat.
@@ -318,21 +326,19 @@
case 12: // BZIP2
// 2003-12-02 - HB >
if(! extension_loaded('bz2')) {
if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
if (! extension_loaded('bz2')) {
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
@dl('php_bz2.dll');
}
else {
} else {
@dl('bz2.so');
}
}
if(extension_loaded('bz2')) {
if (extension_loaded('bz2')) {
// 2003-12-02 - HB <
$vZ = bzdecompress($vZ);
// 2003-12-02 - HB >
}
else {
} else {
$aI['E'] = 7;
$aI['EM'] = "PHP BZIP2 extension not available.";
}
@@ -346,19 +352,17 @@
}
// 2003-12-02 - HB >
if(! $aI['E']) {
if (! $aI['E']) {
// 2003-12-02 - HB <
if($vZ === FALSE) {
if ($vZ === FALSE) {
$aI['E'] = 2;
$aI['EM'] = 'Decompression of data failed.';
}
else {
if(strlen($vZ) != $aP['UCS']) {
} else {
if (strlen($vZ) != $aP['UCS']) {
$aI['E'] = 3;
$aI['EM'] = 'Uncompressed size is not equal with the value in header information.';
}
else {
if(crc32($vZ) != $aP['CRC']) {
} else {
if (crc32($vZ) != $aP['CRC']) {
$aI['E'] = 4;
$aI['EM'] = 'CRC32 checksum is not equal with the value in header information.';
}
@@ -475,7 +479,8 @@
* @access public
* @since 1.0
*/
function SimpleUnzipEntry($in_Entry) {
function SimpleUnzipEntry($in_Entry)
{
$this->Data = $in_Entry['D'];
$this->Error = $in_Entry['E'];
$this->ErrorMsg = $in_Entry['EM'];

View File

@@ -65,17 +65,21 @@ function PMA_generate_common_hidden_inputs( $db = '', $table = '', $indent = 0,
}
if ( ! is_array($skip) ) {
if ( isset( $params[$skip] ) ) unset( $params[$skip] );
if ( isset( $params[$skip] ) ) {
unset( $params[$skip] );
}
} else {
foreach( $skip as $skipping ) {
if ( isset( $params[$skipping] ) ) unset( $params[$skipping] );
foreach ( $skip as $skipping ) {
if ( isset( $params[$skipping] ) ) {
unset( $params[$skipping] );
}
}
}
$spaces = str_repeat( ' ', $indent );
$return = '';
foreach( $params as $key => $val ) {
foreach ( $params as $key => $val ) {
$return .= $spaces . '<input type="hidden" name="' . htmlspecialchars( $key ) . '" value="' . htmlspecialchars( $val ) . '" />' . "\n";
}
@@ -166,25 +170,25 @@ function PMA_generate_common_url ($db = '', $table = '', $delim = '&amp;')
}
if ( $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']
&& ! empty( $GLOBALS['server'] ) ) {
&& ! empty( $GLOBALS['server'] ) ) {
$params['server'] = $GLOBALS['server'];
}
if ( empty( $_COOKIE['pma_lang'] )
&& ! empty( $GLOBALS['lang'] ) ) {
&& ! empty( $GLOBALS['lang'] ) ) {
$params['lang'] = $GLOBALS['lang'];
}
if ( empty( $_COOKIE['pma_charset'] )
&& ! empty( $GLOBALS['convcharset'] ) ) {
&& ! empty( $GLOBALS['convcharset'] ) ) {
$params['convcharset'] = $GLOBALS['convcharset'];
}
if ( empty( $_COOKIE['pma_collation_connection'] )
&& ! empty( $GLOBALS['collation_connection'] ) ) {
&& ! empty( $GLOBALS['collation_connection'] ) ) {
$params['collation_connection'] = $GLOBALS['collation_connection'];
}
$param_strings = array();
foreach( $params as $key => $val ) {
foreach ( $params as $key => $val ) {
$param_strings[] = urlencode( $key ) . '=' . urlencode( $val );
}

View File

@@ -90,8 +90,8 @@ if (!$cfg['LeftDisplayServers'] && (count($cfg['Servers']) > 1 || $server == 0 &
if ( $server > 0 ) {
echo '<ul>' . "\n";
PMA_printListItem( $strProtocolVersion . ': ' . PMA_DBI_get_proto_info()
, 'li_mysql_proto' );
PMA_printListItem( $strProtocolVersion . ': ' . PMA_DBI_get_proto_info(),
'li_mysql_proto' );
PMA_printListItem( $strServer . ': ' . $server_info, 'li_server_info' );
PMA_printListItem( $strUser . ': ' . htmlspecialchars( $mysql_cur_user_and_host ),
'li_user_info' );
@@ -131,7 +131,7 @@ if ( $server > 0 ) {
. ' </li>' . "\n"
. ' <li id="li_select_mysql_collation">';
echo ' <form method="post" action="index.php" target="_parent">' . "\n"
. PMA_generate_common_hidden_inputs(NULL, NULL, 4, 'collation_connection')
. PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
. ' <label for="select_collation_connection">' . "\n"
. ' ' . $strMySQLConnectionCollation . ': ' . "\n"
. ' </label>' . "\n"
@@ -172,7 +172,7 @@ if ( $server > 0 ) {
'./server_privileges.php?' . $common_url_query );
}
$binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', NULL, PMA_DBI_QUERY_STORE);
$binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
if ( $binlogs ) {
if (PMA_DBI_num_rows($binlogs) > 0) {
PMA_printListItem( $strBinaryLog, 'li_mysql_binlogs',
@@ -235,7 +235,7 @@ if (empty($cfg['Lang'])) {
if ( isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
&& $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
&& $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
echo '<li id="li_select_charset">';
?>
<form method="post" action="index.php" target="_parent">
@@ -300,7 +300,7 @@ PMA_printListItem( $strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdm
<?php
if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) {
foreach( $GLOBALS['PMA_errors'] as $error ) {
foreach ( $GLOBALS['PMA_errors'] as $error ) {
echo '<div class="error">' . $error . '</div>' . "\n";
}
}
@@ -371,19 +371,20 @@ if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION < 32332) {
* @param string $id id, used for css styles
* @param string $url make item as link with $url as target
*/
function PMA_printListItem( $name, $id = NULL, $url = NULL, $mysql_help_page = NULL ) {
function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null)
{
echo '<li id="' . $id . '">';
if ( NULL !== $url ) {
if (null !== $url) {
echo '<a href="' . $url . '">';
}
echo $name;
if ( NULL !== $url ) {
if (null !== $url) {
echo '</a>' . "\n";
}
if ( NULL !== $mysql_help_page ) {
echo PMA_showMySQLDocu( '', $mysql_help_page );
if (null !== $mysql_help_page) {
echo PMA_showMySQLDocu('', $mysql_help_page);
}
echo '</li>';
}

View File

@@ -99,7 +99,7 @@ if ($cfgRelation['pdfwork']) {
// first put all the master tables at beginning
// of the list, so they are near the center of
// the schema
while (list(,$master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
$all_tables[] = $master_table;
}
@@ -223,7 +223,7 @@ if ($cfgRelation['pdfwork']) {
// We will need an array of all tables in this db
$selectboxall = array('--');
$alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
$alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
$selectboxall[] = $val[0];
}

File diff suppressed because it is too large Load Diff

View File

@@ -93,8 +93,7 @@ if (!empty($bug_encoded)) {
} else {
$result = 'Error: &quot;gzuncompress()&quot; is unavailable!' . "\n";
}
}
else {
} else {
$result = PMA_printDecodedBug($bug_decoded);
} // end if... else...

View File

@@ -339,7 +339,7 @@ function get_action($name, $title, $added = '', $enabled = TRUE) {
function get_url_action($url, $title, $params = array()) {
$ret = '';
$ret .= '<form class="action" method="GET" action="' . $url . '" target="_blank">';
foreach($params as $key => $val) {
foreach ($params as $key => $val) {
$ret .= '<input type="hidden" name="' . $key . '" value="' . $val . '" />';
}
$ret .= '<input type="submit" value="' . $title . '" />';
@@ -418,7 +418,7 @@ function get_cfg_val($name, $val) {
$ret = '';
if (is_array($val)) {
$ret .= "\n";
foreach($val as $k => $v) {
foreach ($val as $k => $v) {
if (!isset($type)) {
if (is_string($k)) {
$type = 'string';
@@ -463,9 +463,9 @@ function get_cfg_string($cfg) {
if (count($c['Servers']) > 0) {
$ret .= "/* Servers configuration */\n\$i = 0;\n";
foreach($c['Servers'] as $cnt => $srv) {
foreach ($c['Servers'] as $cnt => $srv) {
$ret .= "\n/* Server " . get_server_name($srv, $cnt) . " */\n\$i++;\n";
foreach($srv as $key => $val) {
foreach ($srv as $key => $val) {
$ret .= get_cfg_val("\$cfg['Servers'][\$i]['$key']", $val);
}
}
@@ -473,7 +473,7 @@ function get_cfg_string($cfg) {
}
unset($c['Servers']);
foreach($c as $key => $val) {
foreach ($c as $key => $val) {
$ret .= get_cfg_val("\$cfg['$key']", $val);
}
@@ -510,12 +510,15 @@ function compress_servers(&$cfg) {
*
* @return array array with grabbed values
*/
function grab_values($list) {
function grab_values($list)
{
$a = split(';', $list);
$res = array();
foreach($a as $val) {
foreach ($a as $val) {
$v = split(':', $val);
if (!isset($v[1])) $v[1] = '';
if (!isset($v[1])) {
$v[1] = '';
}
switch($v[1]) {
case 'bool':
$res[$v[0]] = isset($_POST[$v[0]]);
@@ -535,7 +538,7 @@ function grab_values($list) {
$cur = $_POST[$v[0]];
if ($cur == 'TRUE') {
$res[$v[0]] = TRUE;
} else if ($cur == 'FALSE') {
} elseif ($cur == 'FALSE') {
$res[$v[0]] = FALSE;
} else {
$res[$v[0]] = $cur;
@@ -566,7 +569,7 @@ function grab_values($list) {
function show_overview($title, $list, $buttons = '') {
echo '<fieldset class="overview">' . "\n";
echo '<legend>' . $title . '</legend>' . "\n";
foreach($list as $val) {
foreach ($list as $val) {
echo '<div class="row">';
echo '<div class="desc">';
echo $val[0];
@@ -605,18 +608,24 @@ function show_overview($title, $list, $buttons = '') {
function show_config_form($list, $legend, $help, $defaults = array(), $save = '', $prefix = '') {
global $PMA_Config;
if (empty($save)) $save = 'Update';
if (empty($save)) {
$save = 'Update';
}
echo '<fieldset class="optbox">' . "\n";
echo '<legend>' . $legend . '</legend>' . "\n";
echo '<p>' . $help . '</p>' . "\n";
foreach($list as $val) {
foreach ($list as $val) {
echo '<div class="opts">';
$type = 'text';
if (isset($val[3])) {
if (is_array($val[3])) $type = 'select';
elseif (is_bool($val[3])) $type = 'check';
elseif ($val[3] == 'password') $type = 'password';
if (is_array($val[3])) {
$type = 'select';
} elseif (is_bool($val[3])) {
$type = 'check';
} elseif ($val[3] == 'password') {
$type = 'password';
}
}
switch ($type) {
case 'text':
@@ -866,7 +875,7 @@ function show_server_form($defaults = array(), $number = FALSE) {
echo '<input type="hidden" name="server" value="' . $number . '" />';
}
$hi = array ('bookmarktable', 'relation', 'table_info', 'table_coords', 'pdf_pages', 'column_info', 'history', 'AllowDeny');
foreach($hi as $k) {
foreach ($hi as $k) {
if (isset($defaults[$k]) && (!is_string($defaults[$k]) || strlen($defaults[$k]) > 0)) {
echo '<input type="hidden" name="' . $k . '" value="' . htmlspecialchars(serialize($defaults[$k])) . '" />';
}
@@ -1078,7 +1087,9 @@ function show_window_form($defaults = array()) {
* @return string HTML for server selection
*/
function get_server_selection($cfg) {
if (count($cfg['Servers']) == 0) return '';
if (count($cfg['Servers']) == 0) {
return '';
}
$ret = '<select name="server">';
foreach ($cfg['Servers'] as $key => $val) {
$ret .= '<option value="' . $key . '">' . get_server_name($val, $key) . '</option>';
@@ -1287,7 +1298,7 @@ switch ($action) {
}
if (function_exists('mysqli_get_client_info')) {
$defaults['extension'] = 'mysqli';
} else if (function_exists('mysql_get_client_info')) {
} elseif (function_exists('mysql_get_client_info')) {
$defaults['extension'] = 'mysql';
} else {
message('warning', 'Could not load neither mysql nor mysqli extension, you might not be able to use phpMyAdmin!');
@@ -1300,11 +1311,15 @@ switch ($action) {
show_server_form($defaults);
break;
case 'editserver':
if (!isset($_POST['server'])) footer();
if (!isset($_POST['server'])) {
footer();
}
show_server_form($configuration['Servers'][$_POST['server']], $_POST['server']);
break;
case 'deleteserver':
if (!isset($_POST['server'])) footer();
if (!isset($_POST['server'])) {
footer();
}
message('notice', 'Deleted server ' . get_server_name($configuration['Servers'][$_POST['server']], $_POST['server']));
unset($configuration['Servers'][$_POST['server']]);
compress_servers($configuration);
@@ -1314,7 +1329,7 @@ switch ($action) {
if (count($configuration['Servers']) == 0) {
message('notice', 'No servers defined, so none can be shown');
} else {
foreach($configuration['Servers'] as $i => $srv) {
foreach ($configuration['Servers'] as $i => $srv) {
$data = array();
if (!empty($srv['verbose'])) {
$data[] = array('Verbose name', $srv['verbose']);
@@ -1434,7 +1449,7 @@ switch ($action) {
if (!isset($d['RecodingEngine'])) {
if (@extension_loaded('iconv')) {
$d['RecodingEngine'] = 'iconv';
} else if (@extension_loaded('recode')) {
} elseif (@extension_loaded('recode')) {
$d['RecodingEngine'] = 'recode';
} else {
PMA_dl('iconv');

View File

@@ -77,7 +77,7 @@ if (open(LATEST, "wget -o /dev/null -O - $source_url|")) {
my $i = 0;
while(my $line = <LATEST>) {
while (my $line = <LATEST>) {
chomp($line);
if ($line =~ /http/) {
$urls[$i++] = $line;
@@ -107,7 +107,7 @@ if (open(DEFINES, $targetdirectory .'/libraries/Config.class.php')) {
my $versionStatus = 0;
$installedversion = "unknownversion";
while(my $line = <DEFINES>) {
while (my $line = <DEFINES>) {
next unless $line =~ /'PMA_VERSION',\ '(.*)?'\);$/;
$installedversion = $1;

View File

@@ -24,7 +24,9 @@ echo '<h2>' . "\n"
. ' ' . $strBinaryLog . "\n"
. '</h2>' . "\n";
if (!isset($log)) $log = '';
if (!isset($log)) {
$log = '';
}
/**
* Display log selector.
@@ -35,7 +37,7 @@ if (count($binary_logs) > 1) {
echo '<fieldset><legend>';
echo $strSelectBinaryLog;
echo '</legend><select name="log">';
foreach($binary_logs as $name) {
foreach ($binary_logs as $name) {
echo '<option value="' . $name . '"' . ($name == $log ? ' selected="selected"' : '') . '>' . $name . '</option>';
}
echo '</select>';
@@ -48,7 +50,9 @@ if (count($binary_logs) > 1) {
$sql_query = 'SHOW BINLOG EVENTS';
if (!empty($log)) $sql_query .= ' IN \'' . $log . '\'';
if (!empty($log)) {
$sql_query .= ' IN \'' . $log . '\'';
}
/**
* Sends the query and buffers the result

View File

@@ -110,8 +110,8 @@ echo '<h2>' . "\n"
/**
* Gets the databases list
*/
if ( $server > 0 ) {
$databases = PMA_DBI_get_databases_full( NULL, $dbstats );
if ($server > 0) {
$databases = PMA_DBI_get_databases_full(null, $dbstats);
} else {
$databases = array();
}
@@ -120,13 +120,13 @@ if ( $server > 0 ) {
/**
* Displays the page
*/
if ( count($databases) > 0 ) {
if (count($databases) > 0) {
// sorts the array
usort( $databases, 'PMA_dbCmp' );
// table col order
// there is no db specific collation or charset prior 4.1.0
if ( PMA_MYSQL_INT_VERSION >= 40100 ) {
if (PMA_MYSQL_INT_VERSION >= 40100) {
$column_order['DEFAULT_COLLATION_NAME'] = array(
'disp_name' => $strCollation,
'description_function' => 'PMA_getCollationDescr',

View File

@@ -120,7 +120,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
$GLOBALS['userlink'] );
$row1 = PMA_DBI_fetch_assoc($res);
PMA_DBI_free_result($res);
$av_grants = explode ('\',\'' , substr($row1['Type'], 5, strlen($row1['Type']) - 7));
$av_grants = explode ('\',\'', substr($row1['Type'], 5, strlen($row1['Type']) - 7));
unset($row1);
$users_grants = explode(',', $row['Table_priv']);
foreach ($av_grants as $current_grant) {
@@ -158,7 +158,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
} else {
$privs[] = 'USAGE';
}
} else if ($allPrivileges && (!isset($GLOBALS['grant_count']) || count($privs) == $GLOBALS['grant_count'])) {
} elseif ($allPrivileges && (!isset($GLOBALS['grant_count']) || count($privs) == $GLOBALS['grant_count'])) {
if ($enableHTML) {
$privs = array('<dfn title="' . $GLOBALS['strPrivDescAllPrivileges'] . '">ALL PRIVILEGES</dfn>');
} else {
@@ -255,7 +255,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
if ($table == '*') {
if ($db == '*') {
$sql_query = 'SHOW COLUMNS FROM `mysql`.`user`;';
} else if ($table == '*') {
} elseif ($table == '*') {
$sql_query = 'SHOW COLUMNS FROM `mysql`.`db`;';
}
$res = PMA_DBI_query($sql_query);
@@ -282,7 +282,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
$row1 = PMA_DBI_fetch_assoc($res);
PMA_DBI_free_result($res);
$av_grants = explode ('\',\'' , substr($row1['Type'], strpos($row1['Type'], '(') + 2, strpos($row1['Type'], ')') - strpos($row1['Type'], '(') - 3));
$av_grants = explode ('\',\'', substr($row1['Type'], strpos($row1['Type'], '(') + 2, strpos($row1['Type'], ')') - strpos($row1['Type'], '(') - 3));
unset($res, $row1);
$users_grants = explode(',', $row['Table_priv']);
@@ -349,7 +349,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
// privs that are not attached to a specific column
echo $spaces . ' <div class="item">' . "\n";
foreach($row as $current_grant => $current_grant_value) {
foreach ($row as $current_grant => $current_grant_value) {
if (in_array(substr($current_grant, 0, (strlen($current_grant) - 5)), array('Select', 'Insert', 'Update', 'References'))) {
continue;
}
@@ -374,7 +374,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
echo $spaces . ' <label for="checkbox_' . $current_grant . '"><tt><dfn title="' . (isset($GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5)) . 'Tbl']) . '">' . strtoupper(substr($current_grant, 0, strlen($current_grant) - 5)) . '</dfn></tt></label>' . "\n"
. $spaces . ' </div>' . "\n";
} // end foreach()
} // end foreach ()
echo $spaces . ' </div>' . "\n";
// for Safari 2.0.2
@@ -563,15 +563,19 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) {
$fields_info = PMA_DBI_get_fields('mysql', 'user');
$username_length = 16;
$hostname_length = 41;
foreach($fields_info as $key => $val) {
foreach ($fields_info as $key => $val) {
if ($val['Field'] == 'User') {
strtok($val['Type'], '()');
$v = strtok('()');
if (is_int($v)) $username_length = $v;
if (is_int($v)) {
$username_length = $v;
}
} elseif ($val['Field'] == 'Host') {
strtok($val['Type'], '()');
$v = strtok('()');
if (is_int($v)) $hostname_length = $v;
if (is_int($v)) {
$hostname_length = $v;
}
}
}
unset($fields_info);
@@ -743,7 +747,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
.' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted')
.' AND ' . PMA_convert_using('Host')
.' = ' . PMA_convert_using($hostname, 'quoted') . ';',
NULL, PMA_DBI_QUERY_STORE );
null, PMA_DBI_QUERY_STORE);
if (PMA_DBI_num_rows($res) == 1) {
PMA_DBI_free_result($res);
$message = sprintf($GLOBALS['strUserAlreadyExists'], '[i]\'' . $username . '\'@\'' . $hostname . '\'[/i]');
@@ -751,7 +755,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
} else {
PMA_DBI_free_result($res);
if ( 50002 <= PMA_MYSQL_INT_VERSION ) {
if (50002 <= PMA_MYSQL_INT_VERSION) {
// MySQL 5 requires CREATE USER before any GRANT on this user can done
$create_user_real = 'CREATE USER \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\'';
}
@@ -884,7 +888,7 @@ if (!empty($change_copy)) {
.' AND ' . PMA_convert_using('`Table_name`')
.' = ' . PMA_convert_using($row['Table_name'], 'quoted')
.';',
NULL, PMA_DBI_QUERY_STORE );
null, PMA_DBI_QUERY_STORE);
$tmp_privs1 = PMA_extractPrivInfo($row);
$tmp_privs2 = array(
@@ -1062,9 +1066,9 @@ if (!empty($change_pw)) {
$sql_query = 'SET PASSWORD FOR \'' . $username . '\'@\'' . $hostname . '\' = \'\';';
PMA_DBI_query($sql_query);
$message = sprintf($GLOBALS['strPasswordChanged'], '\'' . $username . '\'@\'' . $hostname . '\'');
} else if (empty($pma_pw) || empty($pma_pw2)) {
} elseif (empty($pma_pw) || empty($pma_pw2)) {
$message = $GLOBALS['strPasswordEmpty'];
} else if ($pma_pw != $pma_pw2) {
} elseif ($pma_pw != $pma_pw2) {
$message = $GLOBALS['strPasswordNotSame'];
} else {
$hidden_pw = '';
@@ -1286,16 +1290,16 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
$sql_query .= (isset($initial) ? PMA_RangeOfUsers($initial) : '');
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
$res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE);
$res = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_STORE);
if ( ! $res ) {
if (! $res) {
// the query failed! This may have two reasons:
// - the user does not have enough privileges
// - the privilege tables use a structure of an earlier version.
// so let's try a more simple query
$sql_query = 'SELECT * FROM `mysql`.`user`';
$res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE);
$res = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_STORE);
if (!$res) {
echo '<i>' . $GLOBALS['strNoPrivileges'] . '</i>' . "\n";
@@ -1377,7 +1381,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
}
}
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(' . PMA_convert_using('User') . ',1)) FROM `user` ORDER BY `User` ASC', NULL, PMA_DBI_QUERY_STORE);
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(' . PMA_convert_using('User') . ',1)) FROM `user` ORDER BY `User` ASC', null, PMA_DBI_QUERY_STORE);
while (list($tmp_initial) = PMA_DBI_fetch_row($initials)) {
$array_initials[$tmp_initial] = TRUE;
}
@@ -1557,7 +1561,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
}
}
echo ' : ' . $GLOBALS['strEditPrivileges'] . '</h2>' . "\n";
$res = PMA_DBI_query('SELECT \'foo\' FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', NULL, PMA_DBI_QUERY_STORE);
$res = PMA_DBI_query('SELECT \'foo\' FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', null, PMA_DBI_QUERY_STORE);
$user_does_not_exists = (PMA_DBI_num_rows( $res ) < 1);
PMA_DBI_free_result($res);
unset($res);
@@ -1842,7 +1846,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
} else {
echo ' <input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '"/>' . "\n"
. ' <label for="text_tablename">' . $GLOBALS['strAddPrivilegesOnTbl'] . ':</label>' . "\n";
if ($res = @PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($dbname) . ';', NULL, PMA_DBI_QUERY_STORE)) {
if ($res = @PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($dbname) . ';', null, PMA_DBI_QUERY_STORE)) {
$pred_tbl_array = array();
while ($row = PMA_DBI_fetch_row($res)) {
if (!isset($found_rows) || !in_array($row[0], $found_rows)) {
@@ -2121,7 +2125,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
}
echo '</tbody>' . "\n"
. '</table>' . "\n";
} // end if (empty($adduser) && empty($checkprivs)) ... else if ... else ...
} // end if (empty($adduser) && empty($checkprivs)) ... elseif ... else ...
/**

View File

@@ -304,7 +304,7 @@ foreach ( $server_status as $name => $value ) {
unset( $server_status[$name] );
} else {
foreach ( $allocations as $filter => $section ) {
if ( preg_match( '<27>^' . $filter . '<27>i', $name )
if ( preg_match( '<27>^' . $filter . '<27>i', $name )
&& isset( $server_status[$name] ) ) {
unset( $server_status[$name] );
$sections[$section]['vars'][$name] = $value;
@@ -446,7 +446,7 @@ foreach ( $sections as $section_name => $section ) {
$server_status['Connections'] > 0
? number_format(
$server_status['Aborted_clients'] * 100 / $server_status['Connections'],
2 , $GLOBALS['number_decimal_separator'],
2, $GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator']) . '%'
: '--- '; ?></td>
</tr>

49
sql.php
View File

@@ -276,7 +276,7 @@ else {
// Gets the number of rows per page
if (empty($session_max_rows)) {
$session_max_rows = $cfg['MaxRows'];
} else if ($session_max_rows != 'all') {
} elseif ($session_max_rows != 'all') {
$cfg['MaxRows'] = $session_max_rows;
}
// Defines the display mode (horizontal/vertical) and header "frequency"
@@ -303,19 +303,19 @@ else {
$is_count = !$is_group && (preg_match('@^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)@i', $sql_query));
$is_export = (preg_match('@[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+@i', $sql_query));
$is_analyse = (preg_match('@[[:space:]]+PROCEDURE[[:space:]]+ANALYSE@i', $sql_query));
} else if (preg_match('@^EXPLAIN[[:space:]]+@i', $sql_query)) {
} elseif (preg_match('@^EXPLAIN[[:space:]]+@i', $sql_query)) {
$is_explain = TRUE;
} else if (preg_match('@^DELETE[[:space:]]+@i', $sql_query)) {
} elseif (preg_match('@^DELETE[[:space:]]+@i', $sql_query)) {
$is_delete = TRUE;
$is_affected = TRUE;
} else if (preg_match('@^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+@i', $sql_query)) {
} elseif (preg_match('@^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+@i', $sql_query)) {
$is_insert = TRUE;
$is_affected = TRUE;
} else if (preg_match('@^UPDATE[[:space:]]+@i', $sql_query)) {
} elseif (preg_match('@^UPDATE[[:space:]]+@i', $sql_query)) {
$is_affected = TRUE;
} else if (preg_match('@^SHOW[[:space:]]+@i', $sql_query)) {
} elseif (preg_match('@^SHOW[[:space:]]+@i', $sql_query)) {
$is_show = TRUE;
} else if (preg_match('@^(CHECK|ANALYZE|REPAIR|OPTIMIZE)[[:space:]]+TABLE[[:space:]]+@i', $sql_query)) {
} elseif (preg_match('@^(CHECK|ANALYZE|REPAIR|OPTIMIZE)[[:space:]]+TABLE[[:space:]]+@i', $sql_query)) {
$is_maint = TRUE;
}
@@ -372,15 +372,14 @@ else {
if (isset($GLOBALS['show_as_php']) || !empty($GLOBALS['validatequery'])) {
unset($result);
$num_rows = 0;
}
else {
} else {
// garvin: Measure query time. TODO-Item http://sourceforge.net/tracker/index.php?func=detail&aid=571934&group_id=23067&atid=377411
list($usec, $sec) = explode(' ',microtime());
list($usec, $sec) = explode(' ', microtime());
$querytime_before = ((float)$usec + (float)$sec);
$result = @PMA_DBI_try_query($full_sql_query, NULL, PMA_DBI_QUERY_STORE);
$result = @PMA_DBI_try_query($full_sql_query, null, PMA_DBI_QUERY_STORE);
list($usec, $sec) = explode(' ',microtime());
list($usec, $sec) = explode(' ', microtime());
$querytime_after = ((float)$usec + (float)$sec);
$GLOBALS['querytime'] = $querytime_after - $querytime_before;
@@ -401,7 +400,7 @@ else {
if (!$is_affected) {
$num_rows = ($result) ? @PMA_DBI_num_rows($result) : 0;
} else if (!isset($num_rows)) {
} elseif (!isset($num_rows)) {
$num_rows = @PMA_DBI_affected_rows();
}
@@ -409,7 +408,7 @@ else {
// This could happen if the user sends a query like "USE `database`;"
$res = PMA_DBI_query('SELECT DATABASE() AS \'db\';');
$row = PMA_DBI_fetch_row($res);
if (is_array($row) && isset($row[0]) && (strcasecmp($db,$row[0]) != 0)) {
if (is_array($row) && isset($row[0]) && (strcasecmp($db, $row[0]) != 0)) {
$db = $row[0];
$reload = 1;
}
@@ -430,8 +429,7 @@ else {
// if we did not append a limit, set this to get a correct
// "Showing rows..." message
$GLOBALS['session_max_rows'] = 'all';
}
else if ($is_select) {
} elseif ($is_select) {
// c o u n t q u e r y
@@ -465,7 +463,7 @@ else {
if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
$count_what = 'DISTINCT ';
$first_expr = TRUE;
foreach($analyzed_sql[0]['select_expr'] as $part) {
foreach ($analyzed_sql[0]['select_expr'] as $part) {
$count_what .= (!$first_expr ? ', ' : '') . $part['expr'];
$first_expr = FALSE;
}
@@ -599,14 +597,14 @@ else {
if ($num_rows < 1 || $is_affected) {
if ($is_delete) {
$message = $strDeletedRows . '&nbsp;' . $num_rows;
} else if ($is_insert) {
} elseif ($is_insert) {
$message = $strInsertedRows . '&nbsp;' . $num_rows;
$insert_id = PMA_DBI_insert_id();
if ($insert_id != 0) {
// insert_id is id of FIRST record inserted in one insert, so if we inserted multiple rows, we had to increment this
$message .= '[br]'.$strInsertedRowId . '&nbsp;' . ($insert_id + $num_rows - 1);
}
} else if ($is_affected) {
} elseif ($is_affected) {
$message = $strAffectedRows . '&nbsp;' . $num_rows;
// Ok, here is an explanation for the !$is_select.
@@ -617,11 +615,11 @@ else {
// The $zero_rows containing $strSuccess and sent with
// the form should not have priority over
// errors like $strEmptyResultSet
} else if (!empty($zero_rows) && !$is_select) {
} elseif (!empty($zero_rows) && !$is_select) {
$message = $zero_rows;
} else if (!empty($GLOBALS['show_as_php'])) {
} elseif (!empty($GLOBALS['show_as_php'])) {
$message = $strPhp;
} else if (!empty($GLOBALS['validatequery'])) {
} elseif (!empty($GLOBALS['validatequery'])) {
$message = $strValidateSQL;
} else {
$message = $strEmptyResultSet;
@@ -643,7 +641,7 @@ else {
if (!isset($table)) {
$goto = 'db_details.php';
} else {
$is_table = @PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
$is_table = @PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', null, PMA_DBI_QUERY_STORE);
if (!($is_table && @PMA_DBI_num_rows($is_table))) {
$goto = 'db_details.php';
unset($table);
@@ -675,8 +673,7 @@ else {
}
$active_page = $goto;
require('./' . $goto);
} // end if file_exist
else {
} else {
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . str_replace('&amp;', '&', $goto) . '&message=' . urlencode($message));
} // end else
exit();
@@ -747,7 +744,7 @@ else {
// BEGIN INDEX CHECK See if indexes should be checked.
if (isset($query_type) && $query_type == 'check_tbl' && isset($selected) && is_array($selected)) {
foreach($selected AS $idx => $tbl_name) {
foreach ($selected AS $idx => $tbl_name) {
$indexes = $indexes_info = $indexes_data = array();
$tbl_ret_keys = PMA_get_indexes(urldecode($tbl_name), $err_url_0);

View File

@@ -32,7 +32,7 @@ if (isset($submit_num_fields)) {
}
$num_fields = $orig_num_fields + $added_fields;
$regenerate = TRUE;
} else if (isset($do_save_data)) {
} elseif (isset($do_save_data)) {
$query = '';
// Transforms the radio button field_key into 3 arrays

View File

@@ -136,7 +136,7 @@ unset($show_create_table);
* Get the list of the fields of the current table
*/
PMA_DBI_select_db($db);
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
if (isset($primary_key)) {
if (is_array($primary_key)) {
$primary_key_array = $primary_key;
@@ -148,7 +148,7 @@ if (isset($primary_key)) {
$result = array();
foreach ($primary_key_array AS $rowcount => $primary_key) {
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';';
$result[$rowcount] = PMA_DBI_query($local_query, NULL, PMA_DBI_QUERY_STORE);
$result[$rowcount] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);
$row[$rowcount] = PMA_DBI_fetch_assoc($result[$rowcount]);
$primary_keys[$rowcount] = $primary_key;
@@ -178,7 +178,7 @@ if (isset($primary_key)) {
} // end if (no record returned)
}
} else {
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', NULL, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE);
unset($row);
}
@@ -212,7 +212,7 @@ document.onkeydown = onKeyDownArrowsHandler;
<?php } ?>
<!-- Change table properties form -->
<form method="post" action="tbl_replace.php" name="insertForm" <?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?>>
<form method="post" action="tbl_replace.php" name="insertForm" <?php if ($is_upload) { echo ' enctype="multipart/form-data"'; } ?>>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="goto" value="<?php echo urlencode($goto); ?>" />
<input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />
@@ -361,7 +361,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
&& !isset($row_table_def['Default'])
&& isset($row_table_def['Null'])
&& $row_table_def['Null'] == 'YES') {
$row_table_def['Default'] = NULL;
$row_table_def['Default'] = null;
}
if ($row_table_def['Type'] == 'datetime'
@@ -378,7 +378,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
// UPDATE case with an empty and not NULL value under PHP4
elseif (empty($vrow[$rowfield]) && is_null($vrow[$rowfield])) {
$vrow[$rowfield] = date('Y-m-d H:i:s', time());
} // end if... else if...
} // end if... elseif...
}
$len = (preg_match('@float|double@', $row_table_def['Type']))
? 100
@@ -484,7 +484,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
if (($cfg['ProtectBinary'] && $is_blob && !$is_upload)
|| ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
} else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
} elseif (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
} else {
?>
@@ -591,9 +591,9 @@ foreach ($loop_array AS $vrowcount => $vrow) {
} else {
$onclick .= '2, ';
}
} else if (strstr($row_table_def['True_Type'], 'set')) {
} elseif (strstr($row_table_def['True_Type'], 'set')) {
$onclick .= '3, ';
} else if ($foreigners && isset($foreigners[$field])) {
} elseif ($foreigners && isset($foreigners[$field])) {
$onclick .= '4, ';
} else {
$onclick .= '5, ';
@@ -624,7 +624,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
</script>
</td>
<?php
} else if (isset($disp_row) && is_array($disp_row)) {
} elseif (isset($disp_row) && is_array($disp_row)) {
?>
<td bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?>
@@ -636,8 +636,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
</td>
<?php
unset($disp_row);
}
else if ($cfg['LongtextDoubleTextarea'] && strstr($type, 'longtext')) {
} elseif ($cfg['LongtextDoubleTextarea'] && strstr($type, 'longtext')) {
?>
<td bgcolor="<?php echo $bgcolor; ?>">&nbsp;</td>
</tr>
@@ -648,8 +647,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $jsvkey; ?>')" tabindex="<?php echo ($tabindex + $tabindex_for_value); ?>"><?php echo $special_chars; ?></textarea>
</td>
<?php
}
else if (strstr($type, 'text')) {
} elseif (strstr($type, 'text')) {
?>
<td bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?>
@@ -661,8 +659,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
if (strlen($special_chars) > 32000) {
echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n";
}
}
else if ($type == 'enum') {
} elseif ($type == 'enum') {
$enum = PMA_getEnumSetOptions($row_table_def['Type']);
$enum_cnt = count($enum);
?>
@@ -698,8 +695,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
?>
</select>
<?php
} // end if
else {
} else {
echo "\n";
for ($j = 0; $j < $enum_cnt; $j++) {
// Removes automatic MySQL escape format
@@ -721,8 +717,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
</td>
<?php
echo "\n";
}
else if ($type == 'set') {
} elseif ($type == 'set') {
$set = PMA_getEnumSetOptions($row_table_def['Type']);
if (isset($vset)) {
@@ -757,7 +752,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
}
// Change by Bernard M. Piller <bernard@bmpsystems.com>
// We don't want binary data destroyed
else if ($is_binary || $is_blob) {
elseif ($is_binary || $is_blob) {
if (($cfg['ProtectBinary'] && $is_blob)
|| ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
echo "\n";
@@ -775,7 +770,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="protected" />
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" />
<?php
} else if ($is_blob) {
} elseif ($is_blob) {
echo "\n";
?>
<td bgcolor="<?php echo $bgcolor; ?>">
@@ -844,7 +839,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
echo '</td>';
} // end else if ( binary or blob)
} // end elseif ( binary or blob)
else {
// For char or varchar, respect the maximum length (M); for other
// types (int or float), the length is not a limit on the values that
@@ -855,8 +850,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
if ($is_char) {
$fieldsize = (($len > 40) ? 40 : $len);
$maxlength = $len;
}
else {
} else {
$fieldsize = 20;
$maxlength = 99;
} // end if... else...
@@ -948,15 +942,15 @@ if (!empty($disp_message)) {
<option value="back" <?php echo $selected_after_insert_back; ?>><?php echo $strAfterInsertBack; ?></option>
<option value="new_insert" <?php echo $selected_after_insert_new_insert; ?>><?php echo $strAfterInsertNewInsert; ?></option>
<?php
if (isset($primary_key))
{?>
if (isset($primary_key)) {
?>
<option value="same_insert"><?php echo $strAfterInsertSame; ?></option>
<?php
<?php
// If we have just numeric primary key, we can also edit next
if (preg_match('@^[\s]*`[^`]*` = [0-9]+@', $primary_key)) {
?>
?>
<option value="edit_next"><?php echo $strAfterInsertNext; ?></option>
<?php
<?php
}
}
?>

View File

@@ -37,7 +37,7 @@ $abort = FALSE;
if (isset($submit_num_fields)) {
$regenerate = TRUE;
$num_fields = $orig_num_fields + $added_fields;
} else if (isset($do_save_data)) {
} elseif (isset($do_save_data)) {
$sql_query = $query_cpy = '';
// Transforms the radio button field_key into 3 arrays

View File

@@ -36,7 +36,7 @@ if (!defined('PMA_IDX_INCLUDED')) {
// Not a valid table name -> back to the default db_details sub-page
if ( isset($table) && strlen($table) ) {
$is_table = PMA_DBI_query('SHOW TABLES LIKE \''
. PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE);
. PMA_sqlAddslashes($table, TRUE) . '\'', null, PMA_DBI_QUERY_STORE);
}
if ( ! isset($table) || ! strlen($table)
|| !( $is_table && PMA_DBI_num_rows($is_table) ) ) {
@@ -125,10 +125,10 @@ if (!defined('PMA_IDX_INCLUDED')
if ($index_type == 'PRIMARY') {
if ($index == '') {
$index = 'PRIMARY';
} else if ($index != 'PRIMARY') {
} elseif ($index != 'PRIMARY') {
PMA_mysqlDie($strPrimaryKeyName, '', FALSE, $err_url);
}
} else if ($index == 'PRIMARY') {
} elseif ($index == 'PRIMARY') {
PMA_mysqlDie($strCantRenameIdxToPrimary, '', FALSE, $err_url);
}
@@ -191,7 +191,7 @@ if (!defined('PMA_IDX_INCLUDED')
/**
* Edits an index or defines a new one
*/
else if (!defined('PMA_IDX_INCLUDED')
elseif (!defined('PMA_IDX_INCLUDED')
&& (isset($index) || isset($create_index))) {
// Prepares the form values
@@ -227,9 +227,9 @@ else if (!defined('PMA_IDX_INCLUDED')
|| (PMA_MYSQL_INT_VERSION >= 40002
&& $edited_index_info['Index_type'] == 'FULLTEXT')) {
$index_type = 'FULLTEXT';
} else if ($index == 'PRIMARY') {
} elseif ($index == 'PRIMARY') {
$index_type = 'PRIMARY';
} else if ($edited_index_info['Non_unique'] == '0') {
} elseif ($edited_index_info['Non_unique'] == '0') {
$index_type = 'UNIQUE';
} else {
$index_type = 'INDEX';
@@ -343,7 +343,7 @@ else if (!defined('PMA_IDX_INCLUDED')
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
<td><select name="column[]">
<option value="--ignore--"
<?php if ('--ignore--' == $selected) echo ' selected="selected"'; ?>>
<?php if ('--ignore--' == $selected) { echo ' selected="selected"'; } ?>>
-- <?php echo $strIgnore; ?> --</option>
<?php
foreach ($fields_names AS $key => $val) {

View File

@@ -43,11 +43,11 @@ if (isset($new_name) && trim($new_name) != '') {
} else {
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
if (isset($switch_to_new) && $switch_to_new == 'true') {
setcookie('pma_switch_to_new', 'true', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
setcookie('pma_switch_to_new', 'true', 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
$db = $target_db;
$table = $new_name;
} else {
setcookie('pma_switch_to_new', '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
setcookie('pma_switch_to_new', '', 0, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
}
}

View File

@@ -44,12 +44,12 @@ PMA_DBI_select_db($db);
/**
* Multi-tables printview thanks to Christophe Gesch<63> from the "MySQL Form
* Multi-tables printview thanks to Christophe Gesch<63> from the "MySQL Form
* Generator for PHPMyAdmin" (http://sourceforge.net/projects/phpmysqlformgen/)
*/
if (isset($selected_tbl) && is_array($selected_tbl)) {
$the_tables = $selected_tbl;
} else if (isset($table)) {
} elseif (isset($table)) {
$the_tables[] = $table;
}
$multi_tables = (count($the_tables) > 1);
@@ -102,7 +102,7 @@ foreach ($the_tables AS $key => $table) {
/**
* Gets fields properties
*/
$result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
$fields_cnt = PMA_DBI_num_rows($result);
// Check if we can use Relations (Mike Beck)
@@ -116,8 +116,7 @@ foreach ($the_tables AS $key => $table) {
} else {
$have_rel = FALSE;
}
}
else {
} else {
$have_rel = FALSE;
} // end if
@@ -220,7 +219,7 @@ foreach ($the_tables AS $key => $table) {
<td width="80" class="print"<?php echo $type_nowrap; ?>><?php echo $type; ?><bdo dir="ltr"></bdo></td>
<!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>-->
<td width="40" class="print"><?php echo (($row['Null'] == '' || $row['Null'] == 'NO') ? $strNo : $strYes); ?>&nbsp;</td>
<td width="70" class="print" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
<td width="70" class="print" nowrap="nowrap"><?php if (isset($row['Default'])) {7echo $row['Default']; } ?>&nbsp;</td>
<!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>-->
<?php
echo "\n";
@@ -413,7 +412,7 @@ foreach ($the_tables AS $key => $table) {
echo ' ';
if ($showtable['Row_format'] == 'Fixed') {
echo $strFixed;
} else if ($showtable['Row_format'] == 'Dynamic') {
} elseif ($showtable['Row_format'] == 'Dynamic') {
echo $strDynamic;
} else {
echo $showtable['Row_format'];

View File

@@ -215,7 +215,7 @@ if (strstr($show_comment, '; InnoDB free') === false) {
}
} else {
// remove InnoDB comment from end, just the minimal part (*? is non greedy)
$comment = preg_replace('@; InnoDB free:.*?$@' , '', $show_comment);
$comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
}
// PACK_KEYS: MyISAM or ISAM

View File

@@ -75,7 +75,7 @@ while ($row = PMA_DBI_fetch_assoc($result)) {
PMA_DBI_free_result($result);
// 3. Get fields
$fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
$fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
$fields_cnt = PMA_DBI_num_rows($fields_rs);
// Get more complete field information
@@ -362,7 +362,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <td>' . (empty($field_charset) ? '' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>' . "\n" : '' ?>
<td nowrap="nowrap" style="font-size: 70%"><?php echo $attribute; ?></td>
<td><?php echo (($row['Null'] == 'YES') ? $strYes : $strNo); ?></td>
<td nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?></td>
<td nowrap="nowrap"><?php if (isset($row['Default'])) { echo $row['Default']; } ?></td>
<td nowrap="nowrap"><?php echo $row['Extra']; ?></td>
<td align="center">
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode( 'SELECT COUNT(*) AS `' . $strRows . '`, `' . $row['Field'] . '` FROM `' . $table . '` GROUP BY `' . $row['Field'] . '` ORDER BY `' . $row['Field'] . '`' ); ?>">
@@ -411,7 +411,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
} else {
echo "\n";
?>
<a href="sql.php?<?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']))); ?>">
<a href="sql.php?<?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 $titles['Index']; ?></a>
<?php
}
@@ -425,7 +425,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
} else {
echo "\n";
?>
<a href="sql.php?<?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']))); ?>">
<a href="sql.php?<?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 $titles['Unique']; ?></a>
<?php
}
@@ -438,7 +438,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
echo "\n";
?>
<td align="center" nowrap="nowrap">
<a href="sql.php?<?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']))); ?>">
<a href="sql.php?<?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 $titles['IdxFulltext']; ?></a>
</td>
<?php
@@ -461,7 +461,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
echo '</tbody>' . "\n"
.'</table>' . "\n";
$checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db,$table);
$checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db, $table);
?>
<img class="selectallarrow" src="<?php echo $pmaThemeImage . 'arrow_' . $text_dir . '.png'; ?>"
@@ -723,11 +723,9 @@ if ( $cfg['ShowStats'] ) {
<td class="value"><?php
if ($showtable['Row_format'] == 'Fixed') {
echo $strFixed;
}
else if ($showtable['Row_format'] == 'Dynamic') {
} elseif ($showtable['Row_format'] == 'Dynamic') {
echo $strDynamic;
}
else {
} else {
echo $showtable['Row_format'];
}
?></td>

View File

@@ -39,8 +39,8 @@ $options_array = array('CASCADE' => 'CASCADE', 'SET_NULL' => 'SET NULL', 'NO_ACT
*
* @access public
*/
function PMA_generate_dropdown($dropdown_question,$radio_name,$choices,$selected_value) {
function PMA_generate_dropdown($dropdown_question, $radio_name, $choices, $selected_value)
{
echo $dropdown_question . '&nbsp;&nbsp;';
echo '<select name="' . $radio_name . '">' . "\n";
@@ -281,7 +281,7 @@ if ($cfgRelation['relwork'] || $tbl_type=='INNODB') {
}
// [0] of the row is the name
$tab_rs = PMA_DBI_query($tab_query, NULL, PMA_DBI_QUERY_STORE);
$tab_rs = PMA_DBI_query($tab_query, null, PMA_DBI_QUERY_STORE);
$selectboxall['nix'] = '--';
$selectboxall_innodb['nix'] = '--';
@@ -290,7 +290,7 @@ if ($cfgRelation['relwork'] || $tbl_type=='INNODB') {
PMA_DBI_select_db($db);
// need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
$fi_rs = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($curr_table[0]) . ';', NULL, PMA_DBI_QUERY_STORE);
$fi_rs = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($curr_table[0]) . ';', null, PMA_DBI_QUERY_STORE);
if ($fi_rs && PMA_DBI_num_rows($fi_rs) > 0) {
$seen_a_primary = FALSE;
while ($curr_field = PMA_DBI_fetch_assoc($fi_rs)) {
@@ -337,7 +337,7 @@ if ($cfgRelation['relwork'] || $tbl_type=='INNODB') {
PMA_DBI_select_db($db);
// need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
$fi_rs = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($curr_table[0]) . ';', NULL, PMA_DBI_QUERY_STORE);
$fi_rs = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($curr_table[0]) . ';', null, PMA_DBI_QUERY_STORE);
if ($fi_rs && PMA_DBI_num_rows($fi_rs) > 0) {
while ($curr_field = PMA_DBI_fetch_assoc($fi_rs)) {
$field_full = $db . '.' . $curr_field['Table'] . '.' . $curr_field['Column_name'];
@@ -358,7 +358,7 @@ if ($cfgRelation['relwork'] || $tbl_type=='INNODB') {
// Now find out the columns of our $table
// need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
$col_rs = PMA_DBI_try_query('SHOW COLUMNS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
$col_rs = PMA_DBI_try_query('SHOW COLUMNS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
while ($row = PMA_DBI_fetch_assoc($col_rs)) {

View File

@@ -8,7 +8,7 @@
require_once('./libraries/common.lib.php');
// Check parameters
PMA_checkParameters(array('db','table','goto'));
PMA_checkParameters(array('db', 'table', 'goto'));
PMA_DBI_select_db($db);
@@ -122,7 +122,9 @@ $message = '';
foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
// skip fields to be ignored
if (!$using_key && isset($GLOBALS['insert_ignore_' . $enc_primary_key])) continue;
if (!$using_key && isset($GLOBALS['insert_ignore_' . $enc_primary_key])) {
continue;
}
// Restore the "primary key" to a convenient format
$primary_key = urldecode($enc_primary_key);
@@ -155,9 +157,9 @@ foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
if (empty($me_funcs[$encoded_key])) {
$cur_value = $val . ', ';
} else if (preg_match('@^(UNIX_TIMESTAMP)$@', $me_funcs[$encoded_key]) && $val != '\'\'') {
} elseif (preg_match('@^(UNIX_TIMESTAMP)$@', $me_funcs[$encoded_key]) && $val != '\'\'') {
$cur_value = $me_funcs[$encoded_key] . '(' . $val . '), ';
} else if (preg_match('@^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$@', $me_funcs[$encoded_key])) {
} elseif (preg_match('@^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$@', $me_funcs[$encoded_key])) {
$cur_value = $me_funcs[$encoded_key] . '(), ';
} else {
$cur_value = $me_funcs[$encoded_key] . '(' . $val . '), ';
@@ -166,17 +168,17 @@ foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
if ($is_insert) {
// insert, no need to add column
$valuelist .= $cur_value;
} else if (isset($me_fields_null_prev) && isset($me_fields_null_prev[$encoded_key]) && !isset($me_fields_null[$encoded_key])) {
} elseif (isset($me_fields_null_prev) && isset($me_fields_null_prev[$encoded_key]) && !isset($me_fields_null[$encoded_key])) {
// field had the null checkbox
// field no longer has the null checkbox
// field does not have the same value
$valuelist .= PMA_backquote($key) . ' = ' . $cur_value;
} else if (empty($me_funcs[$encoded_key])
} elseif (empty($me_funcs[$encoded_key])
&& isset($me_fields_prev) && isset($me_fields_prev[$encoded_key])
&& ("'" . PMA_sqlAddslashes(urldecode($me_fields_prev[$encoded_key])) . "'" == $val)) {
// No change for this column and no MySQL function is used -> next column
continue;
} else if (!empty($val)) {
} elseif (!empty($val)) {
// TODO: avoid setting a field to NULL when it's already NULL
$valuelist .= PMA_backquote($key) . ' = ' . $cur_value;
}

View File

@@ -49,7 +49,7 @@ if (!isset($param) || $param[0] == '') {
$err_url = $goto . '?' . PMA_generate_common_url($db, $table);
// Gets the list and number of fields
$result = PMA_DBI_query('SHOW' . (PMA_MYSQL_INT_VERSION >= 40100 ? ' FULL' : '') . ' FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query('SHOW' . (PMA_MYSQL_INT_VERSION >= 40100 ? ' FULL' : '') . ' FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
$fields_cnt = PMA_DBI_num_rows($result);
// rabue: we'd better ensure, that all arrays are empty.
$fields_list = $fields_null = $fields_type = $fields_collation = array();

View File

@@ -22,12 +22,12 @@ require_once('./libraries/db_table_exists.lib.php');
* Get the list of the fields of the current table
*/
PMA_DBI_select_db($db);
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table), NULL, PMA_DBI_QUERY_STORE);
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table), null, PMA_DBI_QUERY_STORE);
if (isset($primary_key)) {
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';', NULL, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';', null, PMA_DBI_QUERY_STORE);
$row = PMA_DBI_fetch_assoc($result);
} else {
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', NULL, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE);
$row = PMA_DBI_fetch_assoc($result);
}
@@ -87,7 +87,7 @@ if (!isset($resize)) {
if ($ratioWidth < $ratioHeight){
$destWidth = $srcWidth/$ratioHeight;
$destHeight = $newHeight;
}else{
} else {
$destWidth = $newWidth;
$destHeight = $srcHeight/$ratioWidth;
}
@@ -101,7 +101,7 @@ if (!isset($resize)) {
ImageCopyResampled( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight );
if ($resize == 'jpeg') {
ImageJPEG( $destImage,'',75 );
ImageJPEG( $destImage, '', 75 );
}
if ($resize == 'png') {
ImagePNG( $destImage);