Codding standards

This commit is contained in:
Loïc Chapeaux
2002-07-06 22:10:32 +00:00
parent 4e257f3873
commit b93a2a2650
15 changed files with 632 additions and 520 deletions

View File

@@ -8,6 +8,7 @@
* All directives are explained in Documentation.html * All directives are explained in Documentation.html
*/ */
/** /**
* Sets the php error reporting - Please do not change this line! * Sets the php error reporting - Please do not change this line!
*/ */
@@ -23,17 +24,24 @@ $old_error_rep = error_reporting(E_ALL);
* It must contain characters that are valid for a URL, and the path is * It must contain characters that are valid for a URL, and the path is
* case sensitive on some Web servers, for example Unix-based servers. * case sensitive on some Web servers, for example Unix-based servers.
* *
* In most cases you can leave this variable alone, as the correct value * In most cases you can leave this variable alone, as the correct value
* will be detected automatically. However, we recommened that you do * will be detected automatically. However, we recommened that you do
* test to see that the auto-detection code works in your system. * test to see that the auto-detection code works in your system.
* *
* If the auto-detection code does work properly, you can set the * If the auto-detection code does work properly, you can set the
* $cfg['PmaAbsoluteUri_DisableWarning'] variable at the bottom of * $cfg['PmaAbsoluteUri_DisableWarning'] variable below.
* this file.
*/ */
$cfg['PmaAbsoluteUri'] = ''; $cfg['PmaAbsoluteUri'] = '';
/**
* Disable the default warning about $cfg['PmaAbsoluteUri'] not being set
* You should use this if and ONLY if the PmaAbsoluteUri auto-detection
* works perfectly.
*/
$cfg['PmaAbsoluteUri_DisableWarning'] = FALSE;
/** /**
* Server(s) configuration * Server(s) configuration
*/ */
@@ -91,12 +99,12 @@ $cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ''; $cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['only_db'] = ''; $cfg['Servers'][$i]['only_db'] = '';
$cfg['Servers'][$i]['verbose'] = ''; $cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['pmadb'] = ''; $cfg['Servers'][$i]['pmadb'] = '';
$cfg['Servers'][$i]['bookmarktable'] = ''; $cfg['Servers'][$i]['bookmarktable'] = '';
$cfg['Servers'][$i]['relation'] = ''; $cfg['Servers'][$i]['relation'] = '';
$cfg['Servers'][$i]['table_info'] = ''; $cfg['Servers'][$i]['table_info'] = '';
$cfg['Servers'][$i]['table_coords'] = ''; $cfg['Servers'][$i]['table_coords'] = '';
$cfg['Servers'][$i]['column_comments'] =''; $cfg['Servers'][$i]['column_comments'] = '';
$cfg['Servers'][$i]['pdf_pages'] = ''; $cfg['Servers'][$i]['pdf_pages'] = '';
$cfg['Servers'][$i]['AllowDeny']['order'] $cfg['Servers'][$i]['AllowDeny']['order']
= ''; = '';
@@ -115,12 +123,12 @@ $cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ''; $cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['only_db'] = ''; $cfg['Servers'][$i]['only_db'] = '';
$cfg['Servers'][$i]['verbose'] = ''; $cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['pmadb'] = ''; $cfg['Servers'][$i]['pmadb'] = '';
$cfg['Servers'][$i]['bookmarktable'] = ''; $cfg['Servers'][$i]['bookmarktable'] = '';
$cfg['Servers'][$i]['relation'] = ''; $cfg['Servers'][$i]['relation'] = '';
$cfg['Servers'][$i]['table_info'] = ''; $cfg['Servers'][$i]['table_info'] = '';
$cfg['Servers'][$i]['table_coords'] = ''; $cfg['Servers'][$i]['table_coords'] = '';
$cfg['Servers'][$i]['column_comments'] =''; $cfg['Servers'][$i]['column_comments'] = '';
$cfg['Servers'][$i]['pdf_pages'] = ''; $cfg['Servers'][$i]['pdf_pages'] = '';
$cfg['Servers'][$i]['AllowDeny']['order'] $cfg['Servers'][$i]['AllowDeny']['order']
= ''; = '';
@@ -191,22 +199,20 @@ $cfg['ZipDump'] = TRUE; // Allow the use of zip/gzip/bzip
$cfg['GZipDump'] = TRUE; // compression for $cfg['GZipDump'] = TRUE; // compression for
$cfg['BZipDump'] = TRUE; // dump files $cfg['BZipDump'] = TRUE; // dump files
// Default Tabs display settings // Default Tabs display settings
$cfg['DefaultTabDatabase'] = 'db_details_structure.php3'; $cfg['DefaultTabDatabase'] = 'db_details_structure.php3';
// Possible values: // Possible values:
// 'db_details_structure.php3' = tables list // 'db_details_structure.php3' = tables list
// 'db_details.php3' = sql form // 'db_details.php3' = sql form
// 'db_search.php3' = search query // 'db_search.php3' = search query
$cfg['DefaultTabTable'] = 'tbl_properties_structure.php3'; $cfg['DefaultTabTable'] = 'tbl_properties_structure.php3';
// Possible values: // Possible values:
// 'tbl_properties_structure.php3' = fields list // 'tbl_properties_structure.php3' = fields list
// 'tbl_properties.php3' = sql form // 'tbl_properties.php3' = sql form
// 'tbl_select.php3 = select page // 'tbl_select.php3 = select page
// 'tbl_change.php3 = insert row page // 'tbl_change.php3 = insert row page
/** /**
* Link to the official MySQL documentation * Link to the official MySQL documentation
* Be sure to include no trailing slash on the path * Be sure to include no trailing slash on the path
@@ -215,14 +221,11 @@ $cfg['ManualBaseShort'] = 'http://www.mysql.com/doc';
/** /**
* Language settings * Language and charset conversion settings
*/ */
// Default language to use, if not browser-defined or user-defined // Default language to use, if not browser-defined or user-defined
$cfg['DefaultLang'] = 'en'; $cfg['DefaultLang'] = 'en';
/**
* Charset conversion settings
*/
// Default charset to use for recoding of MySQL queries, does not take // Default charset to use for recoding of MySQL queries, does not take
// any effect when charsets recoding is switched off by // any effect when charsets recoding is switched off by
// $cfg['AllowAnywhereRecoding'] or in language file // $cfg['AllowAnywhereRecoding'] or in language file
@@ -271,8 +274,7 @@ $cfg['ModifyDeleteAtRight'] = FALSE; // show edit/delete links on right s
$cfg['DefaultDisplay'] = 'horizontal'; // default display direction (horizontal|vertical) $cfg['DefaultDisplay'] = 'horizontal'; // default display direction (horizontal|vertical)
$cfg['RepeatCells'] = 100; // repeat header names every X cells? (0 = deactivate) $cfg['RepeatCells'] = 100; // repeat header names every X cells? (0 = deactivate)
// Note: this feature will be // Syntax coloring (Note: this feature will be implemented after 2.3.0)
// implemented after 2.3.0
$cfg['UseSyntaxColoring'] = TRUE; // use syntaxcoloring on output of SQL, might be a little slower $cfg['UseSyntaxColoring'] = TRUE; // use syntaxcoloring on output of SQL, might be a little slower
$cfg['colorFunctions'] = '#FF0000'; // Colors used for Syntaxcoloring of SQL Statements $cfg['colorFunctions'] = '#FF0000'; // Colors used for Syntaxcoloring of SQL Statements
$cfg['colorKeywords'] = '#990099'; $cfg['colorKeywords'] = '#990099';
@@ -280,6 +282,7 @@ $cfg['colorStrings'] = '#008000';
$cfg['colorColType'] = '#FF9900'; $cfg['colorColType'] = '#FF9900';
$cfg['colorAdd'] = '#0000FF'; $cfg['colorAdd'] = '#0000FF';
/** /**
* Available charsets for MySQL conversion. currently contains all which could * Available charsets for MySQL conversion. currently contains all which could
* be found in lang/* files and few more. * be found in lang/* files and few more.
@@ -287,7 +290,6 @@ $cfg['colorAdd'] = '#0000FF';
* Charsets will be shown in same order as here listed, so if you frequently * Charsets will be shown in same order as here listed, so if you frequently
* use some of these move them to the top. * use some of these move them to the top.
*/ */
$cfg['AvailableCharsets'] = array( $cfg['AvailableCharsets'] = array(
'iso-8859-1', 'iso-8859-1',
'iso-8859-2', 'iso-8859-2',
@@ -320,6 +322,7 @@ $cfg['AvailableCharsets'] = array(
'SHIFT_JIS' 'SHIFT_JIS'
); );
/** /**
* MySQL settings * MySQL settings
*/ */
@@ -392,8 +395,9 @@ if ($cfg['ShowFunctionFields']) {
); );
} // end if } // end if
if($cfg['UseSyntaxColoring']) { // Keywords for syntax coloring
$cfg['keywords']=array( if ($cfg['UseSyntaxColoring']) {
$cfg['keywords'] = array(
'SELECT', 'SELECT',
'INSERT', 'INSERT',
'LEFT', 'LEFT',
@@ -416,8 +420,10 @@ if($cfg['UseSyntaxColoring']) {
'VALUES' 'VALUES'
); );
} // end if } // end if
if($cfg['UseSyntaxColoring']) {
$cfg['additional']=array( // Other reserved words for syntax coloring
if ($cfg['UseSyntaxColoring']) {
$cfg['additional'] = array(
'TABLE', 'TABLE',
'DEFAULT', 'DEFAULT',
'NULL', 'NULL',
@@ -445,24 +451,20 @@ if($cfg['UseSyntaxColoring']) {
); );
} }
/**
* Disable the default warning about $cfg['PmaAbsoluteUri'] not being set
* You should use this if and ONLY if the PmaAbsoluteUri auto-detection
* works perfectly.
*/
$cfg['PmaAbsoluteUri_DisableWarning'] = FALSE;
/** /**
* Unset magic_quotes_runtime - do not change! * Unset magic_quotes_runtime - do not change!
*/ */
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
/** /**
* Restore old error_reporting mode - do not change either! * Restore old error_reporting mode - do not change either!
*/ */
error_reporting($old_error_rep); error_reporting($old_error_rep);
unset($old_error_rep); unset($old_error_rep);
/** /**
* File Revision - do not change either! * File Revision - do not change either!
*/ */

View File

@@ -47,39 +47,36 @@ $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
: (PMA_PHP_INT_VERSION < 30016 || intval(@get_cfg_var('upload_max_filesize'))); : (PMA_PHP_INT_VERSION < 30016 || intval(@get_cfg_var('upload_max_filesize')));
?> ?>
<!-- DATABASE WORK --> <!-- Query box, sql file loader and bookmark support -->
<a name="querybox"></a> <a name="querybox"></a>
<ul> <form method="post" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
<!-- Query box, sql file loader and bookmark support --> onsubmit="return checkSqlQuery(this)">
<li> <input type="hidden" name="is_js_confirmed" value="0" />
<form method="post" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
onsubmit="return checkSqlQuery(this)"> <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<input type="hidden" name="is_js_confirmed" value="0" /> <input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" /> <input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> <input type="hidden" name="pos" value="0" />
<input type="hidden" name="server" value="<?php echo $server; ?>" /> <input type="hidden" name="goto" value="db_details.php3" />
<input type="hidden" name="db" value="<?php echo $db; ?>" /> <input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" />
<input type="hidden" name="pos" value="0" /> <input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
<input type="hidden" name="goto" value="db_details.php3" /> <?php echo sprintf($strRunSQLQuery, $db) . ' ' . PMA_showDocuShort('S/E/SELECT.html'); ?>&nbsp;:<br />
<input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" /> <div style="margin-bottom: 5px">
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
<?php echo sprintf($strRunSQLQuery, $db) . ' ' . PMA_showDocuShort('S/E/SELECT.html'); ?>&nbsp;:<br />
<div style="margin-bottom: 5px">
<textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" wrap="virtual" <textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" wrap="virtual"
onfocus="if (typeof(document.layers) == 'undefined' || typeof(textarea_selected) == 'undefined') {textarea_selected = 1; this.form.elements['sql_query'].select();}"> onfocus="if (typeof(document.layers) == 'undefined' || typeof(textarea_selected) == 'undefined') {textarea_selected = 1; this.form.elements['sql_query'].select();}">
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?> <?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
</textarea><br /> </textarea><br />
<input type="checkbox" name="show_query" value="y" id="checkbox_show_query" checked="checked" />&nbsp; <input type="checkbox" name="show_query" value="y" id="checkbox_show_query" checked="checked" />&nbsp;
<label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br /> <label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
</div> </div>
<?php <?php
// loic1: displays import dump feature only if file upload available // loic1: displays import dump feature only if file upload available
if ($is_upload) { if ($is_upload) {
echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . '&nbsp;:<br />' . "\n"; echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . '&nbsp;:<br />' . "\n";
?> ?>
<div style="margin-bottom: 5px"> <div style="margin-bottom: 5px">
<input type="file" name="sql_file" class="textfield" /><br /> <input type="file" name="sql_file" class="textfield" /><br />
</div> </div>
<?php <?php
} // end if } // end if
echo "\n"; echo "\n";
@@ -87,31 +84,29 @@ echo "\n";
// Bookmark Support // Bookmark Support
if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) { if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) { if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n"; echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
echo ' <div style="margin-bottom: 5px">' . "\n"; echo ' <div style="margin-bottom: 5px">' . "\n";
echo ' <select name="id_bookmark">' . "\n"; echo ' <select name="id_bookmark">' . "\n";
echo ' <option value=""></option>' . "\n"; echo ' <option value=""></option>' . "\n";
while (list($key, $value) = each($bookmark_list)) { while (list($key, $value) = each($bookmark_list)) {
echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n"; echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
} }
echo ' </select>' . "\n"; echo ' </select>' . "\n";
echo ' <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n"; echo ' <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n";
echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n"; echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n"; echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
echo ' <br />' . "\n"; echo ' <br />' . "\n";
echo ' </div>' . "\n"; echo ' </div>' . "\n";
} }
} }
// Encoding setting form appended by Y.Kawada // 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(' '); echo PMA_set_enc_form(' ');
} }
?> ?>
<input type="submit" name="SQL" value="<?php echo $strGo; ?>" /> <input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
</form> </form>
</li>
</ul>
<?php <?php

View File

@@ -10,8 +10,8 @@
if (PMA_MYSQL_INT_VERSION >= 32303) { if (PMA_MYSQL_INT_VERSION >= 32303) {
// Special speedup for newer MySQL Versions (in 4.0 format changed) // Special speedup for newer MySQL Versions (in 4.0 format changed)
if ($cfg['SkipLockedTables'] == TRUE && PMA_MYSQL_INT_VERSION >= 32330) { if ($cfg['SkipLockedTables'] == TRUE && PMA_MYSQL_INT_VERSION >= 32330) {
$local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db); $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
$db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
// Blending out tables in use // Blending out tables in use
if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) { if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
while ($tmp = PMA_mysql_fetch_row($db_info_result)) { while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
@@ -23,8 +23,8 @@ if (PMA_MYSQL_INT_VERSION >= 32303) {
mysql_free_result($db_info_result); mysql_free_result($db_info_result);
if (isset($sot_cache)) { if (isset($sot_cache)) {
$local_query = 'SHOW TABLES FROM ' . PMA_backquote($db); $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
$db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) { if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
while ($tmp = PMA_mysql_fetch_row($db_info_result)) { while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
if (!isset($sot_cache[$tmp[0]])) { if (!isset($sot_cache[$tmp[0]])) {
@@ -43,8 +43,8 @@ if (PMA_MYSQL_INT_VERSION >= 32303) {
} }
} }
if (!isset($sot_ready)) { if (!isset($sot_ready)) {
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db); $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
$db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) { if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) { while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
$tables[] = $sts_tmp; $tables[] = $sts_tmp;
@@ -55,8 +55,8 @@ if (PMA_MYSQL_INT_VERSION >= 32303) {
$num_tables = (isset($tables) ? count($tables) : 0); $num_tables = (isset($tables) ? count($tables) : 0);
} // end if (PMA_MYSQL_INT_VERSION >= 32303) } // end if (PMA_MYSQL_INT_VERSION >= 32303)
else { else {
$db_info_result = PMA_mysql_list_tables($db); $db_info_result = PMA_mysql_list_tables($db);
$num_tables = ($db_info_result) ? @mysql_numrows($db_info_result) : 0; $num_tables = ($db_info_result) ? @mysql_numrows($db_info_result) : 0;
for ($i = 0; $i < $num_tables; $i++) { for ($i = 0; $i < $num_tables; $i++) {
$tables[] = PMA_mysql_tablename($db_info_result, $i); $tables[] = PMA_mysql_tablename($db_info_result, $i);
} }

View File

@@ -1,9 +1,13 @@
<?php <?php
/* $Id$ */ /* $Id$ */
// count amount of navigation tabs
/**
* Counts amount of navigation tabs
*/
$db_details_links_count_tabs = 0; $db_details_links_count_tabs = 0;
/** /**
* Prepares links * Prepares links
*/ */
@@ -23,7 +27,7 @@ else {
// Drop link if allowed // Drop link if allowed
if (!$cfg['AllowUserDropDatabase']) { if (!$cfg['AllowUserDropDatabase']) {
// Check if the user is a Superuser // Check if the user is a Superuser
$links_result = @PMA_mysql_query('USE mysql'); $links_result = @PMA_mysql_query('USE mysql');
$cfg['AllowUserDropDatabase'] = (!PMA_mysql_error()); $cfg['AllowUserDropDatabase'] = (!PMA_mysql_error());
} }
if ($cfg['AllowUserDropDatabase']) { if ($cfg['AllowUserDropDatabase']) {
@@ -32,7 +36,7 @@ if ($cfg['AllowUserDropDatabase']) {
. urlencode('DROP DATABASE ' . PMA_backquote($db)) . urlencode('DROP DATABASE ' . PMA_backquote($db))
. '&amp;zero_rows=' . '&amp;zero_rows='
. urlencode(sprintf($strDatabaseHasBeenDropped, htmlspecialchars(PMA_backquote($db)))) . urlencode(sprintf($strDatabaseHasBeenDropped, htmlspecialchars(PMA_backquote($db))))
. '&amp;goto=main.php3&amp;back=db_details' . $sub_part . '.php3&amp;reload=1"'; . '&amp;goto=main.php3&amp;back=db_details' . $sub_part . '.php3&amp;reload=1';
$att5 = 'class="drop" ' $att5 = 'class="drop" '
. 'onclick="return confirmLink(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"'; . 'onclick="return confirmLink(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"';
} }
@@ -44,31 +48,27 @@ else {
* Displays tab links * Displays tab links
*/ */
?> ?>
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="tabs"> <table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs">
<tr> <tr>
<td width="8">&nbsp;</td> <td width="8">&nbsp;</td>
<?php <?php
echo printTab($strStructure,"db_details_structure.php3",$url_query); echo PMA_printTab($strStructure, 'db_details_structure.php3', $url_query);
echo printTab($strSQL,"db_details.php3",$url_query."&amp;db_query_force=1"); echo PMA_printTab($strSQL, 'db_details.php3', $url_query . '&amp;db_query_force=1');
echo printTab($strExport,$lnk3,$arg3); echo PMA_printTab($strExport, $lnk3, $arg3);
echo printTab($strSearch,$lnk4,$arg4); echo PMA_printTab($strSearch, $lnk4, $arg4);
/** // Query by example and dump of the db are only displayed if there is at least
* Query by example and dump of the db // one table in the db
* Only displayed if there is at least one table in the db
*/
if ($num_tables > 0) { if ($num_tables > 0) {
echo printTab($strQBE,"db_details_qbe.php3",$url_query); echo PMA_printTab($strQBE, 'db_details_qbe.php3', $url_query);
} // end if } // end if
/** // Displays drop link
* Displays drop link
*/
if ($lnk5) { if ($lnk5) {
echo printTab($strDrop,$lnk5,$arg5,$att5); echo PMA_printTab($strDrop, $lnk5, $arg5, $att5);
} // end if } // end if
echo "\n"; echo "\n";
?> ?>
</tr> </tr>
</table> </table>
<br /> <br />

View File

@@ -10,7 +10,7 @@ if (empty($is_info)) {
include('./db_details_common.php3'); include('./db_details_common.php3');
$url_query .= '&amp;goto=db_details_structure.php3'; $url_query .= '&amp;goto=db_details_structure.php3';
//Drop/delete multiple tables if required // Drops/deletes multiple tables if required
if ((!empty($submit_mult) && isset($selected_tbl)) if ((!empty($submit_mult) && isset($selected_tbl))
|| isset($mult_btn)) { || isset($mult_btn)) {
$action = 'db_details_structure.php3'; $action = 'db_details_structure.php3';
@@ -22,8 +22,10 @@ if (empty($is_info)) {
include('./db_details_db_info.php3'); include('./db_details_db_info.php3');
echo "\n"; echo "\n";
} }
/** /**
* Settings for Relationstuff * Settings for relations stuff
*/ */
require('./libraries/relation.lib.php3'); require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
@@ -448,47 +450,48 @@ echo ' ' . '&nbsp;<input type="submit" value="' . $strGo . '" />' . "\n";
<?php <?php
// is this OK to check for 'class' support? // is this OK to check for 'class' support?
if ($cfgRelation['pdfwork'] && $num_tables > 0) { if ($cfgRelation['pdfwork'] && $num_tables > 0) {
$takeaway = $url_query . '&amp;table=' . urlencode($table);
?> ?>
<!-- Work on PDF Pages --> <!-- Work on PDF Pages -->
<li> <li>
<?php <a href="pdf_pages.php3?<?php echo $takeaway; ?>"><?php echo $strEditPDFPages; ?></a>
$takeaway = $url_query . '&amp;table=' . urlencode($table);
?>
<a href="pdf_pages.php3?<?php echo $takeaway; ?>"><?php echo $strEditPDFPages ;?></a>
</li> </li>
<!-- PDF schema -->
<?php
// We only show this if we find something in the new pdf_pages table
<!-- PDF schema -->
<?php
// We only show this if we find something in the new pdf_pages table
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . $db . '\''; . ' WHERE db_name = \'' . PMA_backquote($db) . '\'';
$test_rs = PMA_query_as_cu($test_query); $test_rs = PMA_query_as_cu($test_query);
if(mysql_num_rows($test_rs) > 0){ if ($test_rs && mysql_num_rows($test_rs) > 0) {
echo "\n";
?> ?>
<li> <li>
<form method="post" action="pdf_schema.php3"> <form method="post" action="pdf_schema.php3">
<input type="hidden" name="server" value="<?php echo $server; ?>" /> <input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" /> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<input type="hidden" name="db" value="<?php echo $db; ?>" /> <input type="hidden" name="db" value="<?php echo $db; ?>" />
<?php echo $strDisplayPDF; ?>&nbsp;:<br /> <?php echo $strDisplayPDF; ?>&nbsp;:<br />
<?php echo $strPageNumber; ?>&nbsp; <?php echo $strPageNumber; ?>&nbsp;
<select name="pdf_page_number"> <select name="pdf_page_number">
<?php <?php
while ($pages = @PMA_mysql_fetch_array($test_rs)) { while ($pages = @PMA_mysql_fetch_array($test_rs)) {
echo '<option value="'.$pages['page_nr'].'">'.$pages['page_nr'].': '.$pages['page_descr'].'</option>'."\n"; echo "\n" . ' '
} . '<option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . $pages['page_descr'] . '</option>';
?> } // end while
</select><br /> echo "\n";
<input type="checkbox" name="show_grid" id="show_grid_opt" /> ?>
<label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br /> </select><br />
<input type="checkbox" name="show_color" id="show_color_opt" checked="checked" /> <input type="checkbox" name="show_grid" id="show_grid_opt" />
<label for="show_color_opt"><?php echo $strShowColor; ?></label><br /> <label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
<input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" /> <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" />
<label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label> <label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
&nbsp;&nbsp;<input type="submit" value="<?php echo $strGo; ?>" /> <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" />
</form> <label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label>
</li> &nbsp;&nbsp;<input type="submit" value="<?php echo $strGo; ?>" />
</form>
</li>
<?php <?php
} // end if } // end if
} // end if } // end if

View File

@@ -1,6 +1,7 @@
<?php <?php
/* $Id$ */ /* $Id$ */
/** /**
* Gets the variables sent to this script and send headers * Gets the variables sent to this script and send headers
*/ */
@@ -83,14 +84,16 @@ if ($server > 0) {
// Get the valid databases list // Get the valid databases list
$num_dbs = count($dblist); $num_dbs = count($dblist);
$dbs = @mysql_list_dbs() or PMA_mysqlDie('', 'mysql_list_dbs()', '', 'main.php3?lang' . $lang . '&amp;server=' . $server); $dbs = @mysql_list_dbs() or PMA_mysqlDie('', 'mysql_list_dbs()', '', 'main.php3?lang' . $lang . '&amp;server=' . $server);
while ($a_db = PMA_mysql_fetch_object($dbs)) { if ($dbs) {
if (!$num_dbs) { while ($a_db = PMA_mysql_fetch_object($dbs)) {
$dblist[] = $a_db->Database; if (!$num_dbs) {
} else { $dblist[] = $a_db->Database;
$true_dblist[$a_db->Database] = ''; } else {
} $true_dblist[$a_db->Database] = '';
} // end while }
@mysql_free_result($dbs); } // end while
mysql_free_result($dbs);
} // end if
if ($num_dbs && empty($true_dblist)) { if ($num_dbs && empty($true_dblist)) {
$dblist = array(); $dblist = array();
} else if ($num_dbs) { } else if ($num_dbs) {
@@ -141,7 +144,7 @@ if ($server > 0) {
*/ */
if ($num_dbs > 0) { if ($num_dbs > 0) {
// Defines the urls used to sort the table // Defines the urls used to sort the table
$common_url = 'db_stats.php3?lang=' . $lang . '&amp;server=' . $server . '&amp;convcharset=' . $convcharset; $common_url = 'db_stats.php3?lang=' . $lang . '&amp;convcharset=' . $convcharset . '&amp;server=' . $server;
if (empty($sort_by)) { if (empty($sort_by)) {
$sort_by = 'db_name'; $sort_by = 'db_name';
$sort_order = 'asc'; $sort_order = 'asc';
@@ -230,8 +233,12 @@ if ($num_dbs > 0) {
$tables = @PMA_mysql_list_tables($db); $tables = @PMA_mysql_list_tables($db);
// Number of tables // Number of tables
$dbs_array[$db][0] = ($tables) ? @mysql_numrows($tables) : 0; if ($tables) {
@mysql_free_result($tables); $dbs_array[$db][0] = mysql_numrows($tables);
mysql_free_result($tables);
} else {
$dbs_array[$db][0] = 0;
}
$total_array[0] += $dbs_array[$db][0]; $total_array[0] += $dbs_array[$db][0];
// Size of data and indexes // Size of data and indexes
@@ -252,8 +259,8 @@ if ($num_dbs > 0) {
$total_array[1] += $dbs_array[$db][1]; $total_array[1] += $dbs_array[$db][1];
$total_array[2] += $dbs_array[$db][2]; $total_array[2] += $dbs_array[$db][2];
$total_array[3] += $dbs_array[$db][3]; $total_array[3] += $dbs_array[$db][3];
mysql_free_result($result);
} // end if } // end if
@mysql_free_result($result);
} // end if MySQL 3.23.03+ } // end if MySQL 3.23.03+
} // end for } // end for
@@ -287,7 +294,7 @@ if ($num_dbs > 0) {
echo ' <td align="center" bgcolor="'. $bgcolor . '">' . "\n"; echo ' <td align="center" bgcolor="'. $bgcolor . '">' . "\n";
echo ' &nbsp;<input type="checkbox" name="selected_db[]" value="' . urlencode($db_name) . '"' . $do_check . ' />&nbsp;' . "\n"; echo ' &nbsp;<input type="checkbox" name="selected_db[]" value="' . urlencode($db_name) . '"' . $do_check . ' />&nbsp;' . "\n";
echo ' </td>' . "\n"; echo ' </td>' . "\n";
echo ' <td bgcolor="'. $bgcolor . '">&nbsp;<a href="index.php3?lang=' . $lang . '&amp;server=' . $server . '&amp;db=' . urlencode($db_name) . '&amp;convcharset=' . $convcharset . '" target="_parent">' . $db_name . '</a>&nbsp;</td>' . "\n"; echo ' <td bgcolor="'. $bgcolor . '">&nbsp;<a href="index.php3?lang=' . $lang . '&amp;convcharset=' . $convcharset . '&amp;server=' . $server . '&amp;db=' . urlencode($db_name) . '" target="_parent">' . $db_name . '</a>&nbsp;</td>' . "\n";
echo ' <td align="right" bgcolor="'. $bgcolor . '">&nbsp;' . $dbs_array[$db_name][0] . '&nbsp;</td>' . "\n"; echo ' <td align="right" bgcolor="'. $bgcolor . '">&nbsp;' . $dbs_array[$db_name][0] . '&nbsp;</td>' . "\n";
echo ' <td align="right" bgcolor="'. $bgcolor . '">&nbsp;' . $data_size . '<bdo dir="' . $text_dir . '"> </bdo>' . $data_unit . '&nbsp;</td>' . "\n"; echo ' <td align="right" bgcolor="'. $bgcolor . '">&nbsp;' . $data_size . '<bdo dir="' . $text_dir . '"> </bdo>' . $data_unit . '&nbsp;</td>' . "\n";
echo ' <td align="right" bgcolor="'. $bgcolor . '">&nbsp;' . $idx_size . '<bdo dir="' . $text_dir . '"> </bdo>' . $idx_unit . '&nbsp;</td>' . "\n"; echo ' <td align="right" bgcolor="'. $bgcolor . '">&nbsp;' . $idx_size . '<bdo dir="' . $text_dir . '"> </bdo>' . $idx_unit . '&nbsp;</td>' . "\n";

View File

@@ -193,10 +193,14 @@ echo "\n";
</head> </head>
<body bgcolor="<?php <?php
echo $GLOBALS['cfg']['RightBgColor']; if ($GLOBALS['cfg']['RightBgImage'] != '') {
if ($GLOBALS['cfg']['RightBgImage'] != '') echo '" background="' . $GLOBALS['cfg']['RightBgImage']; $bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
?>"> } else {
$bkg_img = '';
}
?>
<body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
<?php <?php
if (isset($GLOBALS['db'])) { if (isset($GLOBALS['db'])) {
$header_url_qry = '?lang=' . urlencode($GLOBALS['lang']) $header_url_qry = '?lang=' . urlencode($GLOBALS['lang'])

View File

@@ -168,7 +168,7 @@ echo "\n";
<body bgcolor="<?php echo $cfg['LeftBgColor']; ?>"> <body bgcolor="<?php echo $cfg['LeftBgColor']; ?>">
<!-- Link to the welcome page --> <!-- Link to the welcome page -->
<div id="el1Parent" class="parent" style="margin-bottom: 5px"> <div id="el1Parent" class="parent" style="margin-bottom: 5px">
<nobr><a class="item" href="main.php3?lang=<?php echo $lang; ?>&amp;server=<?php echo $server; ?>&amp;convcharset=<?php echo $convcharset;?>"><span class="heada"><b><?php echo $strHome; ?></b></span></a></nobr> <nobr><a class="item" href="main.php3?lang=<?php echo $lang; ?>&amp;convcharset=<?php echo $convcharset; ?>&amp;server=<?php echo $server; ?>"><span class="heada"><b><?php echo $strHome; ?></b></span></a></nobr>
</div> </div>
@@ -191,7 +191,7 @@ if ($num_dbs > 1) {
echo ' <input type="hidden" name="convcharset" value="' . $convcharset . '" />' . "\n"; echo ' <input type="hidden" name="convcharset" value="' . $convcharset . '" />' . "\n";
echo ' <input type="hidden" name="server" value="' . $server . '" />' . "\n"; echo ' <input type="hidden" name="server" value="' . $server . '" />' . "\n";
echo ' <select name="lightm_db" onchange="this.form.submit()">' . "\n"; echo ' <select name="lightm_db" onchange="this.form.submit()">' . "\n";
echo ' <option value="">(' .$strDatabases. ') ...</option>' . "\n"; echo ' <option value="">(' . $strDatabases . ') ...</option>' . "\n";
$table_list = ''; $table_list = '';
$table_list_header = ''; $table_list_header = '';
$db_name = ''; $db_name = '';

View File

@@ -31,8 +31,8 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
* the authentication libraries must be before the connection to db but * the authentication libraries must be before the connection to db but
* after the PMA_isInto() function * after the PMA_isInto() function
* *
* the PMA_mysqlDie() function must be before the connection to db but after * the PMA_mysqlDie() function must be before the connection to db but
* mysql extension has been loaded * after mysql extension has been loaded
* *
* the PMA_mysqlDie() function needs the PMA_format_sql() Function * the PMA_mysqlDie() function needs the PMA_format_sql() Function
* *
@@ -78,7 +78,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
// Sends the Content-Type header // Sends the Content-Type header
header('Content-Type: text/html; charset=' . $charset); header('Content-Type: text/html; charset=' . $charset);
// Displays the error message // Displays the error message
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
@@ -103,8 +103,8 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
</body> </body>
</html> </html>
<?php <?php
exit; exit();
} }
/** /**
@@ -136,7 +136,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
include('./libraries/charset_conversion.lib.php3'); include('./libraries/charset_conversion.lib.php3');
// For compatibility with old config.inc.php3 // For compatibility with old config.inc.php3
if (!isset($cfg['FileRevision']) || (int)substr($cfg['FileRevision'],13,3) < 116) { if (!isset($cfg['FileRevision']) || (int) substr($cfg['FileRevision'], 13, 3) < 116) {
include('./libraries/config_import.lib.php3'); include('./libraries/config_import.lib.php3');
} }
@@ -199,6 +199,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
return $a_string; return $a_string;
} // end of the 'PMA_sqlAddslashes()' function } // end of the 'PMA_sqlAddslashes()' function
/** /**
* format sql strings * format sql strings
* *
@@ -206,9 +207,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* *
* @return string the formatted sql * @return string the formatted sql
* *
* @global array the configuration array
* @global boolean whether the current statement is a multiple one or not
*
* @access public * @access public
* *
* @author Mike Beck<mikebeck@users.sourceforge.net> * @author Mike Beck <mikebeck@users.sourceforge.net>
*/ */
function PMA_format_sql ($sql) { function PMA_format_sql ($sql) {
global $cfg, $mult; global $cfg, $mult;
@@ -216,109 +220,122 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// lem9: bypass this function for now // lem9: bypass this function for now
return $sql; return $sql;
$_sfuncs = '^' . implode('$|^', $cfg['Functions']) . '$'; $sfuncs = '^' . implode('$|^', $cfg['Functions']) . '$';
$_skeyw = '^' . implode('$|^', $cfg['keywords']) . '$'; $skeyw = '^' . implode('$|^', $cfg['keywords']) . '$';
$_scoltype = '^' . implode('$|^', $cfg['ColumnTypes']) . '$'; $scoltype = '^' . implode('$|^', $cfg['ColumnTypes']) . '$';
$_add = '^' . implode('$|^', $cfg['additional']) . '$'; $add = '^' . implode('$|^', $cfg['additional']) . '$';
// first of all lets remove all newlines - we'll add our own later // First of all lets remove all newlines - we'll add our own later
$sql = str_replace("\n", ' ', $sql); $sql = str_replace("\n", ' ', $sql);
// there should always be blanks around = and after , () // There should always be blanks around = and after , ()
// fixme - i would like to replace ';' with '; ' but then i need // fixme - i would like to replace ';' with '; ' but then i need
// to know how to do that without getting ; within strings as well // to know how to do that without getting ; within strings as well
$sql = str_replace('=', ' = ', $sql); $sql = str_replace('=', ' = ', $sql);
$sql = str_replace(',', ', ', $sql); $sql = str_replace(',', ', ', $sql);
$sql = str_replace(')', ' ) ', $sql); $sql = str_replace(')', ' ) ', $sql);
$sql = str_replace('(', ' ( ', $sql); $sql = str_replace('(', ' ( ', $sql);
// now split everything by the blanks // Now split everything by the blanks
$_sql_parts=explode(' ',$sql); $sql_parts = explode(' ', $sql);
// start a loop over the parts check each word and put them back into $sql // Start a loop over the parts check each word and put them back into
// $sql
unset($sql); unset($sql);
$s_nr=0; $s_nr = 0;
while (list($_num,$_word) = each($_sql_parts)) { while (list($num, $word) = each($sql_parts)) {
// we might have added to many blanks when checking for = and , // We might have added to many blanks when checking for = and,
// which might lead to empty members in the array // which might lead to empty members in the array
if(strlen($_word)==0){continue;} if (strlen($word) == 0) {
$_is_string = FALSE; continue;
// Anything inside quots might be more than one word }
// so as we splitted by the blanks we have to try to get those parts back $is_string = FALSE;
// together
if (substr($_word, 0, 1) == '\'' || substr($_word, 0, 1 == '"') // Anything inside quots might be more than one word
&& (!isset($_temp))) { // so as we splitted by the blanks we have to try to get those
// start of a string // parts back together
$_temp = $_word; if ((substr($word, 0, 1) == '\'' || substr($word, 0, 1) == '"')
$_is_string = TRUE; && !isset($temp)) {
}else { // start of a string
if(isset($_temp)) { $temp = $word;
// we are continuing a string $is_string = TRUE;
$_temp .= $_word; } else {
$_is_string = TRUE; if (isset($temp)) {
// We are continuing a string
$temp .= $word;
$is_string = TRUE;
} }
} } // end if... else...
if(substr($_word, strlen($_word)-1, 1) == '\''
|| substr($_word, strlen($_word)-1, 1) == '"') { if (substr($word, strlen($word) - 1, 1) == '\''
// End of a String || substr($word, strlen($word) - 1, 1) == '"') {
$_word = '<font color="' . $cfg['colorStrings'] . '">' . htmlspecialchars($_temp) . '</font>'; // End of a String
unset($_temp); $word = '<font color="' . $cfg['colorStrings'] . '">' . htmlspecialchars($temp) . '</font>';
// debug echo "fertig " . $_word . '<br />'; unset($temp);
$_is_string = FALSE; // Debug echo "fertig " . $word . '<br />';
} $is_string = FALSE;
if(!isset($_is_string) || $_is_string == FALSE) { } // end if
// no String
if(eregi($_sfuncs, $_word)) { if (!isset($is_string) || $is_string == FALSE) {
$_word = '<font color="' . $cfg['colorFunctions'].'">' . htmlspecialchars($_word) . '</font>'; // No String
} else if(eregi($_skeyw, $_word)) { if (eregi($sfuncs, $word)) {
$_word = '<font color="' . $cfg['colorKeywords'].'">' . htmlspecialchars($_word) . '</font>'; $word = '<font color="' . $cfg['colorFunctions'].'">' . htmlspecialchars($word) . '</font>';
if(isset($mult) && $mult == TRUE){ } else if (eregi($skeyw, $word)) {
} else { $word = '<font color="' . $cfg['colorKeywords'].'">' . htmlspecialchars($word) . '</font>';
$_word = "\n" . $_word; if (!isset($mult) || $mult != TRUE) {
$word = "\n" . $word;
} }
} else if(eregi($_scoltype, $_word)) { } else if (eregi($scoltype, $word)) {
$_word = '<font color="' . $cfg['colorColType'].'">' . htmlspecialchars($_word) . '</font>'; $word = '<font color="' . $cfg['colorColType'].'">' . htmlspecialchars($word) . '</font>';
} else if(eregi($_add, $_word)) { } else if (eregi($add, $word)) {
$_word = '<font color="' . $cfg['colorAdd'].'">' . htmlspecialchars($_word) . '</font>'; $word = '<font color="' . $cfg['colorAdd'].'">' . htmlspecialchars($word) . '</font>';
} else if($_word=='(') { } else if ($word == '(') {
if(isset($_brack_o)){ if (isset($brack_o)) {
$_skey=count($_brack_o); $skey = count($brack_o);
} else { } else {
$_skey = 0; $skey = 0;
} }
$_brack_o[$_skey]=$s_nr; $brack_o[$skey] = $s_nr;
} else if($_word==')') { } else if ($word == ')') {
if(isset($_brack_o)){ if (isset($brack_o)) {
unset($_brack_o[count($_brack_o)-1]); unset($brack_o[count($brack_o) - 1]);
if(count($_brack_o)==0){ unset($_brack_o);} if (count($brack_o) == 0) {
unset($brack_o);
}
} else { } else {
$_brack_c[]=$s_nr; $brack_c[] = $s_nr;
} }
} else if($_word==';') { } else if ($word == ';') {
$_word = ";\n"; $word = ';' . "\n";
} }
} }
if(!isset($_temp) || strlen($_temp) == 0) {
$_sql_p[$s_nr] = $_word; if (!isset($temp) || strlen($temp) == 0) {
$sql_p[$s_nr] = $word;
$s_nr++; $s_nr++;
} }
} // End while } // end while
if(isset($_brack_o)) {
while (list($_num,$elem) = each($_brack_o)) { if (isset($brack_o)) {
$_sql_p[$elem] = '<font color="red">' . $_sql_p[$elem] . '</font>'; while (list($num, $elem) = each($brack_o)) {
$sql_p[$elem] = '<font color="red">' . $sql_p[$elem] . '</font>';
echo '<br /><font color="red">' . $GLOBALS['strMissingBracket'] . '</font><br />'; echo '<br /><font color="red">' . $GLOBALS['strMissingBracket'] . '</font><br />';
} }
} }
if(isset($_brack_c)) {
while (list($_num,$elem) = each($_brack_c)) { if (isset($brack_c)) {
$_sql_p[$elem] = '<font color="red">' . $_sql_p[$elem] . '</font>'; while (list($num, $elem) = each($brack_c)) {
$sql_p[$elem] = '<font color="red">' . $sql_p[$elem] . '</font>';
echo '<br /><font color="red">' . $GLOBALS['strMissingBracket'] . '</font><br />'; echo '<br /><font color="red">' . $GLOBALS['strMissingBracket'] . '</font><br />';
} }
} }
$sql = implode(' ',$_sql_p);
$sql = implode(' ', $_sql_p);
$sql = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', $sql); $sql = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', $sql);
$sql = ereg_replace('<br />[ ]*<br />','<br />', $sql); $sql = ereg_replace('<br />[ ]*<br />', '<br />', $sql);
return $sql; return $sql;
} // End of PMA_format_sql function } // end of the "PMA_format_sql()" function
/** /**
* Displays a MySQL error message in the right frame. * Displays a MySQL error message in the right frame.
@@ -328,12 +345,15 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* @param boolean whether to show a "modify" link or not * @param boolean whether to show a "modify" link or not
* @param string the "back" link url (full path is not required) * @param string the "back" link url (full path is not required)
* *
* @global array the configuration array
*
* @access public * @access public
*/ */
function PMA_mysqlDie($error_message = '', $the_query = '', function PMA_mysqlDie($error_message = '', $the_query = '',
$is_modify_link = TRUE, $back_url = '') $is_modify_link = TRUE, $back_url = '')
{ {
global $cfg; global $cfg;
if (empty($GLOBALS['is_header_sent'])) { if (empty($GLOBALS['is_header_sent'])) {
// rabus: If we include header.inc.php3 here, we get a huge set of // rabus: If we include header.inc.php3 here, we get a huge set of
// "Undefined variable" errors (see bug #549570)! // "Undefined variable" errors (see bug #549570)!
@@ -358,15 +378,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
echo ' ' . $GLOBALS['strSQLQuery'] . '&nbsp;:&nbsp;' . "\n"; echo ' ' . $GLOBALS['strSQLQuery'] . '&nbsp;:&nbsp;' . "\n";
if ($is_modify_link) { if ($is_modify_link) {
echo ' [' echo ' ['
. '<a href="db_details.php3?convcharset=' . $GLOBALS['convcharset'] . '&amp;lang=' . $GLOBALS['lang'] . '&amp;server=' . urlencode($GLOBALS['server']) . '&amp;db=' . urlencode($GLOBALS['db']) . '&amp;sql_query=' . urlencode($the_query) . '&amp;show_query=y">' . $GLOBALS['strEdit'] . '</a>' . '<a href="db_details.php3?lang=' . $GLOBALS['lang'] . '&amp;convcharset=' . $GLOBALS['convcharset'] . '&amp;server=' . urlencode($GLOBALS['server']) . '&amp;db=' . urlencode($GLOBALS['db']) . '&amp;sql_query=' . urlencode($the_query) . '&amp;show_query=y">' . $GLOBALS['strEdit'] . '</a>'
. ']' . "\n"; . ']' . "\n";
} // end if } // end if
if($cfg['UseSyntaxColoring']){ echo '<p>' . "\n"
echo '<p>' . "\n" . PMA_format_sql($query_base) . "\n" . '</p>' . "\n"; . ' ' . ($cfg['UseSyntaxColoring'] ? PMA_format_sql($query_base) : $query_base) . "\n"
} else { . '</p>' . "\n";
echo '<p>' . "\n" . $query_base . "\n" . '</p>' . "\n";
}
echo '</p>' . "\n";
} // end if } // end if
if (!empty($error_message)) { if (!empty($error_message)) {
$error_message = htmlspecialchars($error_message); $error_message = htmlspecialchars($error_message);
@@ -489,29 +506,25 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* set properly and, depending on browsers, inserting or updating a * set properly and, depending on browsers, inserting or updating a
* record might fail * record might fail
*/ */
$display_pmaAbsoluteUri_warning = 0;
$DisplayPmaAbsoluteUriWarning = 0; // Olivier: Setup a default value to let the people and lazy syadmins
// work anyway, but display a big warning on the main.php3
// page.
if (empty($cfg['PmaAbsoluteUri'])) { if (empty($cfg['PmaAbsoluteUri'])) {
$cfg['PmaAbsoluteUri'] = (!empty($HTTP_SERVER_VARS['HTTPS']) ? 'https' : 'http') . '://'
// Setup a default value to let the people and lazy syadmins work anyway, . $HTTP_SERVER_VARS['HTTP_HOST']
// but display a big warning on the main.php3 page. --Olivier . (!empty($HTTP_SERVER_VARS['SERVER_PORT']) ? ':' . $HTTP_SERVER_VARS['SERVER_PORT'] : '')
. substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1);
$cfg['PmaAbsoluteUri'] = (!empty($HTTP_SERVER_VARS['HTTPS']) ? 'https' : 'http') . '://' // We display the warning by default, but not if it is disabled thru
. $HTTP_SERVER_VARS['SERVER_NAME'] // via the $cfg['PmaAbsoluteUri_DisableWarning'] variable.
. (!empty($HTTP_SERVER_VARS['SERVER_PORT']) ? ':' . $HTTP_SERVER_VARS['SERVER_PORT'] : '') // This is intended for sysadmins that actually want the default
. substr($HTTP_SERVER_VARS['SCRIPT_NAME'], 0, strrpos($HTTP_SERVER_VARS['SCRIPT_NAME'], '/')+1); // behaviour of auto-detection due to their setup.
// See the mailing list message:
// We display the warning by default, but not if it is disabled thru // http://sourceforge.net/mailarchive/forum.php?thread_id=859093&forum_id=2141
// via the $cfg['PmaAbsoluteUri_DisableWarning'] variable.
// This is intended for sysadmins that actually want the default behaviour
// of auto-detection due to their setup.
// See the mailing list message:
// http://sourceforge.net/mailarchive/forum.php?thread_id=859093&forum_id=2141
if ($cfg['PmaAbsoluteUri_DisableWarning'] === FALSE) { if ($cfg['PmaAbsoluteUri_DisableWarning'] === FALSE) {
$DisplayPmaAbsoluteUriWarning = 1; $display_pmaAbsoluteUri_warning = 1;
} }
} }
// Adds a trailing slash et the end of the phpMyAdmin uri if it does not // Adds a trailing slash et the end of the phpMyAdmin uri if it does not
// exist // exist
@@ -524,13 +537,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* Make sure $cfg['DefaultTabDatabase'] and $cfg['DefaultTabTable'] are set. * Make sure $cfg['DefaultTabDatabase'] and $cfg['DefaultTabTable'] are set.
* Todo: check if it is set to a *valid* value. * Todo: check if it is set to a *valid* value.
*/ */
if (empty($cfg['DefaultTabDatabase'])) { if (empty($cfg['DefaultTabDatabase'])) {
$cfg['DefaultTabDatabase'] = 'db_details_structure.php3'; $cfg['DefaultTabDatabase'] = 'db_details_structure.php3';
} }
if (empty($cfg['DefaultTabTable'])) { if (empty($cfg['DefaultTabTable'])) {
$cfg['DefaultTabTable'] = 'tbl_properties_structure.php3'; $cfg['DefaultTabTable'] = 'tbl_properties_structure.php3';
} }
@@ -604,7 +616,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if (isset($cfg['Server']['AllowDeny']) && $cfg['Server']['AllowDeny']['order']) { if (isset($cfg['Server']['AllowDeny']) && $cfg['Server']['AllowDeny']['order']) {
include('./libraries/ip_allow_deny.lib.php3'); include('./libraries/ip_allow_deny.lib.php3');
$allowDeny_forbidden = FALSE; //default $allowDeny_forbidden = FALSE; // default
if ($cfg['Server']['AllowDeny']['order'] == 'allow,deny') { if ($cfg['Server']['AllowDeny']['order'] == 'allow,deny') {
$allowDeny_forbidden = TRUE; $allowDeny_forbidden = TRUE;
if (PMA_allowDeny('allow')) { if (PMA_allowDeny('allow')) {
@@ -942,7 +954,8 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* *
* @param mixed the database, table or field name to "backquote" or * @param mixed the database, table or field name to "backquote" or
* array of it * array of it
* @param boolean a flag to bypass this function (used by dump functions) * @param boolean a flag to bypass this function (used by dump
* functions)
* *
* @return mixed the "backquoted" database, table or field name if the * @return mixed the "backquoted" database, table or field name if the
* current MySQL release is >= 3.23.6, the original one * current MySQL release is >= 3.23.6, the original one
@@ -959,7 +972,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if (is_array($a_name)) { if (is_array($a_name)) {
$result = array(); $result = array();
reset($a_name); reset($a_name);
while(list($key,$val) = each($a_name)) { while(list($key, $val) = each($a_name)) {
$result[$key] = '`' . $val . '`'; $result[$key] = '`' . $val . '`';
} }
return $result; return $result;
@@ -1061,17 +1074,20 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* *
* @param string the message to display * @param string the message to display
* *
* @global array the configuration array
*
* @access public * @access public
*/ */
function PMA_showMessage($message) function PMA_showMessage($message)
{ {
global $cfg; global $cfg;
// Reloads the navigation frame via JavaScript if required // Reloads the navigation frame via JavaScript if required
if (isset($GLOBALS['reload']) && $GLOBALS['reload']) { if (isset($GLOBALS['reload']) && $GLOBALS['reload']) {
echo "\n"; echo "\n";
$reload_url = './left.php3' $reload_url = './left.php3'
. '?convcharset=' . $GLOBALS['convcharset'] . '?lang=' . $GLOBALS['lang']
. '&lang=' . $GLOBALS['lang'] . '&convcharset=' . $GLOBALS['convcharset']
. '&server=' . $GLOBALS['server'] . '&server=' . $GLOBALS['server']
. ((!empty($GLOBALS['db'])) ? '&db=' . urlencode($GLOBALS['db']) : ''); . ((!empty($GLOBALS['db'])) ? '&db=' . urlencode($GLOBALS['db']) : '');
?> ?>
@@ -1084,7 +1100,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
} }
// Corrects the tooltip text via JS if required // Corrects the tooltip text via JS if required
else if (isset($GLOBALS['table']) && $GLOBALS['cfg']['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303) { else if (isset($GLOBALS['table']) && $cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303) {
$result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\''); $result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
if ($result) { if ($result) {
$tmp = PMA_mysql_fetch_array($result, MYSQL_ASSOC); $tmp = PMA_mysql_fetch_array($result, MYSQL_ASSOC);
@@ -1113,17 +1129,17 @@ if (typeof(document.getElementById) != 'undefined'
echo "\n"; echo "\n";
?> ?>
<div align="<?php echo $GLOBALS['cell_align_left']; ?>"> <div align="<?php echo $GLOBALS['cell_align_left']; ?>">
<table border="<?php echo $GLOBALS['cfg']['Border']; ?>" cellpadding="5"> <table border="<?php echo $cfg['Border']; ?>" cellpadding="5">
<tr> <tr>
<td bgcolor="<?php echo $GLOBALS['cfg']['ThBgcolor']; ?>"> <td bgcolor="<?php echo $cfg['ThBgcolor']; ?>">
<b><?php echo (get_magic_quotes_gpc()) ? stripslashes($message) : $message; ?></b><br /> <b><?php echo (get_magic_quotes_gpc()) ? stripslashes($message) : $message; ?></b><br />
</td> </td>
</tr> </tr>
<?php <?php
if ($GLOBALS['cfg']['ShowSQL'] == TRUE && !empty($GLOBALS['sql_query'])) { if ($cfg['ShowSQL'] == TRUE && !empty($GLOBALS['sql_query'])) {
// Basic url query part // Basic url query part
$url_qpart = '?lang=' . $GLOBALS['lang'] $url_qpart = '?convcharset=' . $GLOBALS['convcharset']
. '&amp;convcharset=' . $GLOBALS['convcharset'] . '&amp;lang=' . $GLOBALS['lang']
. '&amp;server=' . $GLOBALS['server'] . '&amp;server=' . $GLOBALS['server']
. ((!empty($GLOBALS['db'])) ? '&amp;db=' . urlencode($GLOBALS['db']) : '') . ((!empty($GLOBALS['db'])) ? '&amp;db=' . urlencode($GLOBALS['db']) : '')
. ((!empty($GLOBALS['table'])) ? '&amp;table=' . urlencode($GLOBALS['table']) : ''); . ((!empty($GLOBALS['table'])) ? '&amp;table=' . urlencode($GLOBALS['table']) : '');
@@ -1131,7 +1147,7 @@ if (typeof(document.getElementById) != 'undefined'
echo "\n"; echo "\n";
?> ?>
<tr> <tr>
<td bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"> <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php <?php
echo "\n"; echo "\n";
// Html format the query to be displayed // Html format the query to be displayed
@@ -1141,23 +1157,19 @@ if (typeof(document.getElementById) != 'undefined'
$sqlnr = 1; $sqlnr = 1;
if (!empty($GLOBALS['show_as_php'])) { if (!empty($GLOBALS['show_as_php'])) {
$new_line = '&quot;;<br />' . "\n" . ' $sql .= &quot;'; $new_line = '&quot;;<br />' . "\n" . ' $sql .= &quot;';
}else{ } else if ($cfg['UseSyntaxColoring'] == FALSE) {
if($cfg['UseSyntaxColoring'] == FALSE){ $new_line = '<br />' . "\n";
$new_line = "<br />\n";
}
} }
if(isset($new_line)){ if (isset($new_line)) {
$query_base = htmlspecialchars($GLOBALS['sql_query']); $query_base = htmlspecialchars($GLOBALS['sql_query']);
$query_base = ereg_replace("((\015\012)|(\015)|(\012))+", $new_line, $query_base); $query_base = ereg_replace("((\015\012)|(\015)|(\012))+", $new_line, $query_base);
}else{ } else {
$query_base = $GLOBALS['sql_query']; $query_base = $GLOBALS['sql_query'];
} }
if (!empty($GLOBALS['show_as_php'])) { if (!empty($GLOBALS['show_as_php'])) {
$query_base = '$sql = &quot;' . $query_base; $query_base = '$sql = &quot;' . $query_base;
} else { } else if ($cfg['UseSyntaxColoring']) {
if($cfg['UseSyntaxColoring']) { $query_base = PMA_format_sql($query_base);
$query_base = PMA_format_sql($query_base);
}
} }
// Prepares links that may be displayed to edit/explain the query // Prepares links that may be displayed to edit/explain the query
@@ -1183,7 +1195,7 @@ if (typeof(document.getElementById) != 'undefined'
if (!eregi('^EXPLAIN[[:space:]]+', $GLOBALS['sql_query'])) { if (!eregi('^EXPLAIN[[:space:]]+', $GLOBALS['sql_query'])) {
$explain_link = '[<a href="sql.php3' $explain_link = '[<a href="sql.php3'
. $url_qpart . $url_qpart
. '&amp;sql_query=' . urlencode('EXPLAIN '.$GLOBALS['sql_query']) . '">' . $GLOBALS['strExplain'] . '</a>]&nbsp;'; . '&amp;sql_query=' . urlencode('EXPLAIN ' . $GLOBALS['sql_query']) . '">' . $GLOBALS['strExplain'] . '</a>]&nbsp;';
} else { } else {
$explain_link = ''; $explain_link = '';
} }
@@ -1358,34 +1370,47 @@ if (typeof(document.getElementById) != 'undefined'
return strftime($date, $timestamp); return strftime($date, $timestamp);
} // end of the 'PMA_localisedDate()' function } // end of the 'PMA_localisedDate()' function
/** /**
* Prints out a tab for tabbed navigation. * Prints out a tab for tabbed navigation.
* If the variables $link and $args ar left empty, an inactive tab is created * If the variables $link and $args ar left empty, an inactive tab is created
* *
* @param $text the text to be displayed as link * @param string the text to be displayed as link
* @param $link main link file, e.g. "test.php3" * @param string main link file, e.g. "test.php3"
* @param $args link arguments * @param string link arguments
* @param string link attributes
* *
* @return string two table cells, the first beeing a separator, the second the tab itself * @return string two table cells, the first beeing a separator, the second the tab itself
* *
* @access public * @access public
*/ */
function printTab($text,$link,$args="",$attr="") { function PMA_printTab($text, $link, $args = '', $attr = '') {
global $PHP_SELF; global $PHP_SELF;
global $db_details_links_count_tabs; global $db_details_links_count_tabs;
$bgcolor = (basename($PHP_SELF) == $link) ? "silver" : "#DFDFDF"; $bgcolor = (basename($PHP_SELF) == $link) ? 'silver' : '#DFDFDF';
$db_details_links_count_tabs++; $db_details_links_count_tabs++;
if (!empty($attr)) {
$attr = ' ' . $attr;
}
$out = "\n" . ' '
. '<td bgcolor="' . $bgcolor . '" align="center" width="64" nowrap="nowrap" class="tab">'
. "\n" . ' ';
if (strlen($link) > 0) {
$out .= '<a href="' . $link . '?' . $args . '"' . $attr . '>'
. '<b>' . $text . '</b></a>';
} else {
$out .= '<b>' . $text . '</b>';
}
$out .= "\n" . ' '
. '</td>'
. "\n" . ' '
. '<td width="8">&nbsp;</td>';
$out = "\n\t\t<td bgcolor=\"$bgcolor\" align=\"center\" width=\"64\" nowrap=\"nowrap\" class=\"tab\">";
if (strlen($link)>0)
$out .= "<a href=\"$link?$args\" $attr><b>$text</b></a>";
else
$out .= "<b>$text</b>";
$out .= "</td>";
$out .= "\n\t\t<td width=\"8\">&nbsp;</td>";
return $out; return $out;
} } // end of the 'PMA_printTab()' function
// Kanji encoding convert feature appended by Y.Kawada (2002/2/20) // Kanji encoding convert feature appended by Y.Kawada (2002/2/20)

View File

@@ -5,7 +5,7 @@
/** /**
* This library grabs the names and values of the variables sent or posted to a * This library grabs the names and values of the variables sent or posted to a
* script in the '$HTTP_*_VARS' arrays and sets simple globals variables from * script in the '$HTTP_*_VARS' arrays and sets simple globals variables from
* them * them. It does the same work for the $PHP_SELF variable.
* *
* loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+ * loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
*/ */
@@ -34,5 +34,11 @@ if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
} }
} // end if } // end if
if (!empty($_SERVER) && isset($_SERVER['PHP_SELF'])) {
$PHP_SELF = $_SERVER['PHP_SELF'];
} else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['PHP_SELF'])) {
$PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
} // end if
} // $__PMA_GRAB_GLOBALS_LIB__ } // $__PMA_GRAB_GLOBALS_LIB__
?> ?>

View File

@@ -251,7 +251,7 @@ if ($server > 0) {
$db_to_create = ''; $db_to_create = '';
} }
$common_url_query = 'lang=' . $lang . '&amp;server=' . $server . '&amp;convcharset=' . $convcharset; $common_url_query = 'lang=' . $lang . '&amp;convcharset=' . $convcharset . '&amp;server=' . $server;
if ($is_superuser) { if ($is_superuser) {
$cfg['ShowMysqlInfo'] = TRUE; $cfg['ShowMysqlInfo'] = TRUE;
@@ -446,8 +446,8 @@ if (empty($cfg['Lang'])) {
<td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td> <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
<td nowrap="nowrap"> <td nowrap="nowrap">
<form method="post" action="index.php3" target="_parent"> <form method="post" action="index.php3" target="_parent">
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<input type="hidden" name="server" value="<?php echo $server; ?>" />
Language <a href="./translators.html" target="documentation">(*)</a>: Language <a href="./translators.html" target="documentation">(*)</a>:
<select name="lang" dir="ltr" onchange="this.form.submit();"> <select name="lang" dir="ltr" onchange="this.form.submit();">
<?php <?php
@@ -488,11 +488,11 @@ if (empty($cfg['Lang'])) {
</tr> </tr>
<?php <?php
} }
echo "\n";
?> if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
<?php && $allow_recoding) {
if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding) { echo "\n";
?> ?>
<!-- Charset Selection --> <!-- Charset Selection -->
<tr> <tr>
<td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td> <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
@@ -521,8 +521,8 @@ if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $al
</td> </td>
</tr> </tr>
<?php <?php
echo "\n";
} }
echo "\n";
?> ?>
<!-- Documentation --> <!-- Documentation -->
@@ -566,12 +566,14 @@ echo "\n";
<?php <?php
/**
* Displays the "empty $cfg['PmaAbsoluteUri'] warning"
if ($DisplayPmaAbsoluteUriWarning) { */
echo '<p class="warning">'. $strPmaUriError . '</p>' . "\n"; if ($display_pmaAbsoluteUri_warning) {
echo '<p class="warning">' . $strPmaUriError . '</p>' . "\n";
} }
/** /**
* Displays the footer * Displays the footer
*/ */

View File

@@ -1,9 +1,7 @@
<?php <?php
/** /* $Id$ */
* pdf_pages.php3 mikebeck 2002-05-23
* create and edit the pages to output in pdf
*
*/
/** /**
* Gets some core libraries * Gets some core libraries
*/ */
@@ -12,209 +10,249 @@ require('./libraries/common.lib.php3');
include('./db_details_common.php3'); include('./db_details_common.php3');
/** /**
* Settings for Relationstuff * Settings for relation stuff
*/ */
require('./libraries/relation.lib.php3'); require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
/** /**
* now in ./libraries/relation.lib.php3 we check for all tables * Now in ./libraries/relation.lib.php3 we check for all tables
* that we need, but if we don't find them we are quiet about it * that we need, but if we don't find them we are quiet about it
* so people can work without. * so people can work without.
* this page is absolutely useless if you didn't set up your tables * This page is absolutely useless if you didn't set up your tables
* correctly, so it is a good place to see which tables we can and * correctly, so it is a good place to see which tables we can and
* complain ;-) * complain ;-)
*/ */
if (!$cfgRelation['relwork']) {
if(!$cfgRelation['relwork']) { echo sprintf($strNotSet, 'relation', 'config.inc.php3') . '<br />' . "\n"
echo sprintf($strNotSet,'relation','config.inc.php3') . '<br /><a href="Documentation.html#relation" target="documentation">' . $strDocu . '</a>'; . '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
die(); exit();
}
if(!$cfgRelation['displaywork']) {
echo sprintf($strNotSet,'table_info','config.inc.php3') . '<br /><a href="Documentation.html#table_info" target="documentation">' . $strDocu . '</a>';
die();
}
if(!isset($cfgRelation['table_coords'])){
echo sprintf($strNotSet,'table_coords','config.inc.php3') . '<br /><a href="Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>';
die();
}
if(!isset($cfgRelation['pdf_pages'])) {
echo sprintf($strNotSet,'pdf_page','config.inc.php3') . '<br /><a href="Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>';
die();
} }
if ($cfgRelation['pdfwork']){ if (!$cfgRelation['displaywork']) {
// now is the time to work on all changes echo sprintf($strNotSet, 'table_info', 'config.inc.php3') . '<br />' . "\n"
if(isset($do)){ . '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
switch($do){ exit();
}
if (!isset($cfgRelation['table_coords'])){
echo sprintf($strNotSet, 'table_coords', 'config.inc.php3') . '<br />' . "\n"
. '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
exit();
}
if (!isset($cfgRelation['pdf_pages'])) {
echo sprintf($strNotSet, 'pdf_page', 'config.inc.php3') . '<br />' . "\n"
. '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
exit();
}
if ($cfgRelation['pdfwork']) {
// Now is the time to work on all changes
if (isset($do)) {
switch ($do) {
case 'createpage': case 'createpage':
if(!isset($newpage) || $newpage==''){ if (!isset($newpage) || $newpage == '') {
$newpage = $strNoDescription; $newpage = $strNoDescription;
} }
$ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages']) $ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages'])
. ' (db_name,page_descr) ' . ' (db_name, page_descr)'
. ' VALUES (\'' . $db . '\',\'' . $newpage . '\')'; . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
PMA_query_as_cu($ins_query); PMA_query_as_cu($ins_query);
break; break;
case 'edcoord':
while (list($key,$arrvalue) = each($ctable)) {
if(!isset($arrvalue['x']) || $arrvalue['x'] == ''){$arrvalue['x']=0;}
if(!isset($arrvalue['y']) || $arrvalue['y'] == ''){$arrvalue['y']=0;}
if(isset($arrvalue['name']) && $arrvalue['name'] != '--'){
$test_query = 'SELECT * FROM '.PMA_backquote($cfgRelation['table_coords']) case 'edcoord':
. ' WHERE db_name = \'' . $db . '\'' while (list($key, $arrvalue) = each($ctable)) {
. ' AND table_name = \'' . $arrvalue['name'] . '\'' . if (!isset($arrvalue['x']) || $arrvalue['x'] == '') {
' AND pdf_page_number = '.$chpage; $arrvalue['x'] = 0;
$test_rs = PMA_query_as_cu($test_query); }
if(mysql_num_rows($test_rs)>0){ if (!isset($arrvalue['y']) || $arrvalue['y'] == '') {
if(isset($arrvalue['delete']) && $arrvalue['delete'] == 'y'){ $arrvalue['y'] = 0;
$ch_query = 'DELETE FROM '.PMA_backquote($cfgRelation['table_coords']) }
. ' WHERE db_name = \'' . $db . '\'' if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
. ' AND table_name = \''.$arrvalue['name'] . '\'' $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
. ' AND pdf_page_number = '.$chpage; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
}else{ . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
$ch_query = 'UPDATE '.PMA_backquote($cfgRelation['table_coords']) . ' AND pdf_page_number = ' . $chpage;
. ' SET x='.$arrvalue['x'] . ', y= '. $arrvalue['y'] $test_rs = PMA_query_as_cu($test_query);
. ' WHERE db_name = \'' . $db . '\'' if ($test_rs && mysql_num_rows($test_rs) > 0) {
. ' AND table_name = \''.$arrvalue['name'] . '\'' if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
. ' AND pdf_page_number = '.$chpage; $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage;
} else {
$ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' '
. 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage;
} }
}else{ } else {
$ch_query = 'INSERT INTO '.PMA_backquote($cfgRelation['table_coords']) $ch_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
. ' (db_name,table_name,pdf_page_number,x,y) ' . '(db_name, table_name, pdf_page_number, x, y) '
. ' VALUES (\'' . $db . '\',\''.$arrvalue['name'].'\',' . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
. $chpage.','
. $arrvalue['x'].','.$arrvalue['y'].')';
} }
PMA_query_as_cu($ch_query); PMA_query_as_cu($ch_query);
} } // end if
} } // end while
break; break;
} } // end switch
} // End if (isset($do)) } // end if (isset($do))
// we will need an array of all tables in this db // We will need an array of all tables in this db
$selectboxall[] = '--'; $selectboxall[] = '--';
$alltab_qry = 'SHOW TABLES FROM ' . PMA_backquote($db); $alltab_qry = 'SHOW TABLES FROM ' . PMA_backquote($db);
$alltab_rs = @PMA_mysql_query($alltab_qry) or PMA_mysqlDie('', $alltab_qry, '', $err_url_0); $alltab_rs = @PMA_mysql_query($alltab_qry) or PMA_mysqlDie('', $alltab_qry, '', $err_url_0);
while (list($table) = @PMA_mysql_fetch_array($alltab_rs)) { while (list($table) = @PMA_mysql_fetch_array($alltab_rs)) {
$selectboxall[] = $table; $selectboxall[] = $table;
} }
// now first show some possibility to choose a page for the pdf // Now first show some possibility to choose a page for the pdf
$page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . $db . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$page_rs = PMA_query_as_cu($page_query); $page_rs = PMA_query_as_cu($page_query);
if(mysql_num_rows($page_rs)>0){ if ($page_rs && mysql_num_rows($page_rs) > 0) {
?> ?>
<form action="pdf_pages.php3" method="post" name="selpage"> <form action="pdf_pages.php3" method="post" name="selpage">
<?php echo $strChoosePage; ?> <?php echo $strChoosePage . "\n"; ?>
<input type="hidden" name="db" value="<?php echo $db; ?>" /> <input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" /> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<input type="hidden" name="server" value="<?php echo $server; ?>" /> <input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="table" value="<?php echo $table; ?>" /> <input type="hidden" name="table" value="<?php echo $table; ?>" />
<input type="hidden" name="do" value="choosepage" /> <input type="hidden" name="do" value="choosepage" />
<select name="chpage" onChange="this.form.submit()"> <select name="chpage" onchange="this.form.submit()">
<?php <?php
while ($curr_page = @PMA_mysql_fetch_array($page_rs)) { while ($curr_page = @PMA_mysql_fetch_array($page_rs)) {
echo '<option value="'.$curr_page['page_nr'].'"'; echo "\n" . ' '
if (isset($chpage) && $chpage==$curr_page['page_nr']) { . '<option value="' . $curr_page['page_nr'] . '"';
echo ' selected="selected"'; if (isset($chpage) && $chpage == $curr_page['page_nr']) {
} echo ' selected="selected"';
echo '>'; }
echo $curr_page['page_nr'] . ': '.$curr_page['page_descr'].'</option>'; echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
} } // end while
echo "\n";
?> ?>
</select> </select>
<input type="submit" value="<?php echo $strGo; ?>" /> <input type="submit" value="<?php echo $strGo; ?>" />
</form> </form>
<?php <?php
} }
// possibility to create a new page: echo "\n";
// Possibility to create a new page:
?> ?>
<form action="pdf_pages.php3" method="post" name="crpage"> <form action="pdf_pages.php3" method="post" name="crpage">
<?php echo $strCreatePage; ?> <?php echo $strCreatePage . "\n"; ?>
<input type="hidden" name="db" value="<?php echo $db; ?>" /> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" /> <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> <input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="server" value="<?php echo $server; ?>" /> <input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="table" value="<?php echo $table; ?>" /> <input type="hidden" name="table" value="<?php echo $table; ?>" />
<input type="hidden" name="do" value="createpage" /> <input type="hidden" name="do" value="createpage" />
<input type="text" name="newpage" size="20" maxlength="50" /> <input type="text" name="newpage" size="20" maxlength="50" />
<input type="submit" value="<?php echo $strGo; ?>" /> <input type="submit" value="<?php echo $strGo; ?>" />
</form> </form>
<?php <?php
// now if we allready have choosen a pagenumer then we should show the tables involved // Now if we allready have choosen a page number then we should show the
if(isset($chpage) && $chpage>0){ // tables involved
if (isset($chpage) && $chpage > 0) {
echo "\n";
?> ?>
<hr /><h2><?php echo $strSelectTables ;?></h2> <hr />
<form action="pdf_pages.php3" method="post" name="edcoord">
<input type="hidden" name="db" value="<?php echo $db; ?>" /> <h2><?php echo $strSelectTables ;?></h2>
<input type="hidden" name="lang" value="<?php echo $lang; ?>" /> <form action="pdf_pages.php3" method="post" name="edcoord">
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="server" value="<?php echo $server; ?>" /> <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<input type="hidden" name="table" value="<?php echo $table; ?>" /> <input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="chpage" value="<?php echo $chpage; ?>" /> <input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="do" value="edcoord" /> <input type="hidden" name="table" value="<?php echo $table; ?>" />
<table border=0> <input type="hidden" name="chpage" value="<?php echo $chpage; ?>" />
<tr><th><?php echo $strTable;?></th><th><?php echo $strDelete;?></th><th>X</th><th>Y</th></tr> <input type="hidden" name="do" value="edcoord" />
<table border="0">
<tr>
<th><?php echo $strTable; ?></th>
<th><?php echo $strDelete; ?></th>
<th>X</th>
<th>Y</th>
</tr>
<?php <?php
if(isset($ctable)){unset($ctable);} if (isset($ctable)) {
unset($ctable);
}
$page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords']) $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . $db . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number=' . $chpage; . ' AND pdf_page_number = ' . $chpage;
$page_rs = PMA_query_as_cu($page_query); $page_rs = PMA_query_as_cu($page_query);
$i=0; $i = 0;
while ($sh_page = @PMA_mysql_fetch_array($page_rs)) { while ($sh_page = @PMA_mysql_fetch_array($page_rs)) {
echo '<tr '; echo "\n" . ' <tr ';
if($i % 2==0){ if ($i % 2 == 0) {
echo 'bgcolor="'.$cfg['BgcolorOne'].'"'; echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
}else{ } else {
echo 'bgcolor="'.$cfg['BgcolorTwo'].'"'; echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
} }
echo '>'; echo '>';
echo '<td><select name="ctable['.$i.'][name]">'; echo "\n" . ' <td>'
. "\n" . ' <select name="ctable[' . $i . '][name]">';
reset($selectboxall); reset($selectboxall);
while (list($key,$value) = each($selectboxall)) { while (list($key, $value) = each($selectboxall)) {
echo '<option value="'.$value.'"'; echo "\n" . ' <option value="' . $value . '"';
if($value==$sh_page['table_name']){ if ($value == $sh_page['table_name']) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>'.$value.'</option>'."\n"; echo '>' . $value . '</option>';
} } // end while
echo '</select></td>'."\n"; echo "\n" . ' </select>'
echo '<td><INPUT type="checkbox" name="ctable['.$i.'][delete]" value="y" />'.$strDelete.'</td>'."\n"; . "\n" . ' </td>';
echo '<td><INPUT type="text" name="ctable['.$i.'][x]" value="'.$sh_page['x'].'"></td>'."\n"; echo "\n" . ' <td>'
echo '<td><INPUT type="text" name="ctable['.$i.'][y]" value="'.$sh_page['y'].'"></td>'."\n"; . "\n" . ' <input type="checkbox" name="ctable[' . $i . '][delete]" value="y" />' . $strDelete;
echo '</tr>'."\n"; echo "\n" . ' </td>';
echo "\n" . ' <td>'
. "\n" . ' <input type="text" name="ctable[' . $i . '][x]" value="' . $sh_page['x'] . '" />';
echo "\n" . ' </td>';
echo "\n" . ' <td>'
. "\n" . ' <input type="text" name="ctable[' . $i . '][y]" value="' . $sh_page['y'] . '" />';
echo "\n" . ' </td>';
echo "\n" . ' </tr>';
$i++; $i++;
} } // end while
// do one more empty row // Do one more empty row
echo '<tr '; echo "\n" . ' <tr ';
if($i % 2==0){ if ($i % 2 == 0) {
echo 'bgcolor="'.$cfg['BgcolorOne'].'"'; echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
}else{ } else {
echo 'bgcolor="'.$cfg['BgcolorTwo'].'"'; echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
} }
echo '>'; echo '>';
echo '<td><select name="ctable['.$i.'][name]">'; echo "\n" . ' <td>'
. "\n" . ' <select name="ctable[' . $i . '][name]">';
reset($selectboxall); reset($selectboxall);
while (list($key,$value) = each($selectboxall)) { while (list($key, $value) = each($selectboxall)) {
echo '<option value="'.$value.'"'; echo "\n" . ' <option value="' . $value . '">' . $value . '</option>';
echo '>'.$value.'</option>'."\n";
} }
echo '</select></td>'."\n"; echo "\n" . ' </select>'
echo '<td><INPUT type="checkbox" name="ctable['.$i.'][delete]" value="y" />'.$strDelete.'</td>'."\n"; . "\n" . ' </td>';
echo '<td><INPUT type="text" name="ctable['.$i.'][x]"></td>'."\n"; echo "\n" . ' <td>'
echo '<td><INPUT type="text" name="ctable['.$i.'][y]"></td>'."\n"; . "\n" . ' <input type="checkbox" name="ctable[' . $i . '][delete]" value="y" />' . $strDelete;
echo '</tr>'."\n"; echo "\n" . ' </td>';
echo '</table><input type="submit" value="'.$strGo.'" /></form>'."\n"; echo "\n" . ' <td>'
} . "\n" . ' <input type="text" name="ctable[' . $i . '][x]" value="' . $sh_page['x'] . '" />';
} echo "\n" . ' </td>';
echo "\n" . ' <td>'
. "\n" . ' <input type="text" name="ctable[' . $i . '][y]" value="' . $sh_page['y'] . '" />';
echo "\n" . ' </td>';
echo "\n" . ' </tr>';
echo "\n" . ' </table>' . "\n";
echo "\n" . ' <input type="submit" value="' . $strGo . '" />';
echo "\n" . '</form>' . "\n\n";
} // end if
} // end if ($cfgRelation['pdfwork'])
/** /**

View File

@@ -11,26 +11,47 @@
*/ */
require('./libraries/grab_globals.lib.php3'); require('./libraries/grab_globals.lib.php3');
require('./libraries/common.lib.php3'); require('./libraries/common.lib.php3');
require('./libraries/relation.lib.php3');
/**
* Settings for relation stuff
*/
require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
if(!$cfgRelation['relwork']) {
echo sprintf($strNotSet,'relation','config.inc.php3') . '<br /><a href="Documentation.html#relation" target="documentation">' . $strDocu . '</a>';
die(); /**
* Now in ./libraries/relation.lib.php3 we check for all tables
* that we need, but if we don't find them we are quiet about it
* so people can work without.
* This page is absolutely useless if you didn't set up your tables
* correctly, so it is a good place to see which tables we can and
* complain ;-)
*/
if (!$cfgRelation['relwork']) {
echo sprintf($strNotSet, 'relation', 'config.inc.php3') . '<br />' . "\n"
. '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
exit();
} }
if(!$cfgRelation['displaywork']) {
echo sprintf($strNotSet,'table_info','config.inc.php3') . '<br /><a href="Documentation.html#table_info" target="documentation">' . $strDocu . '</a>'; if (!$cfgRelation['displaywork']) {
die(); echo sprintf($strNotSet, 'table_info', 'config.inc.php3') . '<br />' . "\n"
. '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
exit();
} }
if(!isset($cfgRelation['table_coords'])){
echo sprintf($strNotSet,'table_coords','config.inc.php3') . '<br /><a href="Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>'; if (!isset($cfgRelation['table_coords'])){
die(); echo sprintf($strNotSet, 'table_coords', 'config.inc.php3') . '<br />' . "\n"
. '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
exit();
} }
if(!isset($cfgRelation['pdf_pages'])) { if (!isset($cfgRelation['pdf_pages'])) {
echo sprintf($strNotSet,'pdf_page','config.inc.php3') . '<br /><a href="Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>'; echo sprintf($strNotSet, 'pdf_page', 'config.inc.php3') . '<br />' . "\n"
die(); . '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
exit();
} }
/** /**
* Gets the "fpdf" libraries and defines the pdf font path * Gets the "fpdf" libraries and defines the pdf font path
*/ */
@@ -388,15 +409,19 @@ class PMA_RT_Table
$pdf->SetFont($ff, ''); $pdf->SetFont($ff, '');
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
$pdf->SetFillColor(255); $pdf->SetFillColor(255);
reset($this->fields); reset($this->fields);
while (list(, $field) = each($this->fields)) { while (list(, $field) = each($this->fields)) {
if(in_array($field,$this->primary)){$pdf->SetFillColor(215,121,123);} if (in_array($field, $this->primary)) {
if($field == $this->displayfield){$pdf->SetFillColor(142,159,224);} $pdf->SetFillColor(215, 121, 123);
}
if ($field == $this->displayfield) {
$pdf->SetFillColor(142, 159, 224);
}
$pdf->PMA_PDF_cellScale($this->width, $this->height_cell, ' ' . $field, 1, 1, 'L', 1); $pdf->PMA_PDF_cellScale($this->width, $this->height_cell, ' ' . $field, 1, 1, 'L', 1);
$pdf->PMA_PDF_setXScale($this->x); $pdf->PMA_PDF_setXScale($this->x);
$pdf->SetFillColor(255); $pdf->SetFillColor(255);
} } // end while
if ($pdf->PageNo() > 1) { if ($pdf->PageNo() > 1) {
$pdf->PMA_PDF_die($GLOBALS['strScaleFactorSmall']); $pdf->PMA_PDF_die($GLOBALS['strScaleFactorSmall']);
@@ -413,6 +438,8 @@ class PMA_RT_Table
* @global object The current PDF document * @global object The current PDF document
* @global integer The current page number (from the * @global integer The current page number (from the
* $cfg['Servers'][$i]['table_coords'] table) * $cfg['Servers'][$i]['table_coords'] table)
* @global array The relations settings
* @global string The current db name
* *
* @access private * @access private
* *
@@ -421,7 +448,7 @@ class PMA_RT_Table
*/ */
function PMA_RT_Table($table_name, $ff) function PMA_RT_Table($table_name, $ff)
{ {
global $pdf, $pdf_page_number,$cfgRelation,$db; global $pdf, $pdf_page_number, $cfgRelation, $db;
$this->table_name = $table_name; $this->table_name = $table_name;
$sql = 'DESCRIBE ' . PMA_backquote($table_name); $sql = 'DESCRIBE ' . PMA_backquote($table_name);
@@ -441,9 +468,9 @@ class PMA_RT_Table
//x and y //x and y
$sql = 'SELECT x, y FROM ' $sql = 'SELECT x, y FROM '
. PMA_backquote($cfgRelation['table_coords']) . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\''
. ' AND pdf_page_number = ' . $pdf_page_number; . ' AND pdf_page_number = ' . $pdf_page_number;
$result = PMA_query_as_cu($sql); $result = PMA_query_as_cu($sql);
if (!$result || !mysql_num_rows($result)) { if (!$result || !mysql_num_rows($result)) {
@@ -453,20 +480,19 @@ class PMA_RT_Table
$this->x = (double) $this->x; $this->x = (double) $this->x;
$this->y = (double) $this->y; $this->y = (double) $this->y;
//displayfield // displayfield
$this->displayfield = getDisplayField($db,$table_name); $this->displayfield = getDisplayField($db, $table_name);
// index // index
$sql = 'SHOW index from '.PMA_backquote($table_name); $sql = 'SHOW index FROM ' . PMA_backquote($table_name);
$result = PMA_mysql_query($sql); $result = PMA_mysql_query($sql);
if ($result && mysql_num_rows($result) > 0) {
if(mysql_num_rows($result)>0){
while ($row = PMA_mysql_fetch_array($result)) { while ($row = PMA_mysql_fetch_array($result)) {
if($row['Key_name'] == 'PRIMARY'){ if ($row['Key_name'] == 'PRIMARY') {
$this->primary[] = $row['Column_name']; $this->primary[] = $row['Column_name'];
} }
} }
} } // end if
} // end of the "PMA_RT_Table()" method } // end of the "PMA_RT_Table()" method
} // end class "PMA_RT_Table" } // end class "PMA_RT_Table"
@@ -794,6 +820,8 @@ class PMA_RT
* @param boolean Whether to draw grids or not * @param boolean Whether to draw grids or not
* *
* @global object The current PDF document * @global object The current PDF document
* @global string The current db name
* @global array The relations settings
* *
* @access private * @access private
* *
@@ -818,23 +846,22 @@ class PMA_RT
$pdf->SetFont($this->ff, '', 14); $pdf->SetFont($this->ff, '', 14);
$pdf->SetAutoPageBreak('auto'); $pdf->SetAutoPageBreak('auto');
// get tables on this page // Gets tables on this page
$tab_sql = 'SELECT table_name FROM ' . PMA_backquote($cfgRelation['table_coords']) $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . $db . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number=' .$which_rel; . ' AND pdf_page_number = ' . $which_rel;
$tab_rs = PMA_query_as_cu($tab_sql); $tab_rs = PMA_query_as_cu($tab_sql);
while ($curr_table = @PMA_mysql_fetch_array($tab_rs)) { while ($curr_table = @PMA_mysql_fetch_array($tab_rs)) {
$alltables[] = $curr_table['table_name']; $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
$intable = "'" . implode("','",$alltables) . "'"; $intable = '\'' . implode('\', \'', $alltables) . '\'';
} }
$sql = 'SELECT *' $sql = 'SELECT * FROM ' . PMA_backquote($cfgRelation['relation'])
. ' FROM ' . PMA_backquote($cfgRelation['relation']) . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' '
. ' WHERE master_db = \'' . $db . '\' ' . ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\' '
. ' AND foreign_db = \'' . $db . '\' ' . ' AND master_table IN (' . $intable . ')'
. ' AND master_table IN (' . $intable .')' . ' AND foreign_table IN (' . $intable . ')';
. ' AND foreign_table IN (' . $intable .')';
$result = PMA_query_as_cu($sql); $result = PMA_query_as_cu($sql);
if (!$result || !mysql_num_rows($result)) { if (!$result || !mysql_num_rows($result)) {
@@ -843,7 +870,7 @@ class PMA_RT
while ($row = PMA_mysql_fetch_array($result)) { while ($row = PMA_mysql_fetch_array($result)) {
$this->PMA_RT_addRelation($row['master_table'] , $row['master_field'], $row['foreign_table'], $row['foreign_field']); $this->PMA_RT_addRelation($row['master_table'] , $row['master_field'], $row['foreign_table'], $row['foreign_field']);
} }
// Defines the scale factor // Defines the scale factor
if ($scale == 'auto') { if ($scale == 'auto') {
$this->scale = ceil(max(($this->x_max - $this->x_min) / (297 - $this->r_marg - $this->l_marg), ($this->y_max - $this->y_min) / (210 - $this->t_marg - $this->b_marg)) * 100) / 100; $this->scale = ceil(max(($this->x_max - $this->x_min) / (297 - $this->r_marg - $this->l_marg), ($this->y_max - $this->y_min) / (210 - $this->t_marg - $this->b_marg)) * 100) / 100;

View File

@@ -321,7 +321,9 @@ if ($sql_query != '') {
$pieces = array(); $pieces = array();
PMA_splitSqlFile($pieces, $sql_query, PMA_MYSQL_INT_VERSION); PMA_splitSqlFile($pieces, $sql_query, PMA_MYSQL_INT_VERSION);
$pieces_count = count($pieces); $pieces_count = count($pieces);
if($pieces_count>1){$is_multiple = TRUE;} if ($pieces_count > 1) {
$is_multiple = TRUE;
}
// Copy of the cleaned sql statement for display purpose only (see near the // Copy of the cleaned sql statement for display purpose only (see near the
// beginning of "db_details.php3" & "tbl_properties.php3") // beginning of "db_details.php3" & "tbl_properties.php3")

View File

@@ -46,20 +46,21 @@ $att7 = 'class="drop" onclick="return confirmLink(this, \'DROP TABLE ' . PMA_jsF
* Displays links * Displays links
*/ */
?> ?>
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="tabs"> <table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs">
<tr> <tr>
<td width="8">&nbsp;</td> <td width="8">&nbsp;</td>
<?php <?php
echo printTab($strStructure, 'tbl_properties_structure.php3', $url_query); echo PMA_printTab($strStructure, 'tbl_properties_structure.php3', $url_query);
echo printTab($strBrowse, $lnk2, $arg2); echo PMA_printTab($strBrowse, $lnk2, $arg2);
echo printTab($strSQL, 'tbl_properties.php3', $url_query); echo PMA_printTab($strSQL, 'tbl_properties.php3', $url_query);
echo printTab($strSelect, $lnk4, $arg4); echo PMA_printTab($strSelect, $lnk4, $arg4);
echo printTab($strInsert, 'tbl_change.php3', $url_query); echo PMA_printTab($strInsert, 'tbl_change.php3', $url_query);
echo printTab($strExport, 'tbl_properties_export.php3', $url_query); echo PMA_printTab($strExport, 'tbl_properties_export.php3', $url_query);
echo printTab($strOperations, 'tbl_properties_operations.php3', $url_query); echo PMA_printTab($strOperations, 'tbl_properties_operations.php3', $url_query);
echo printTab($strOptions, 'tbl_properties_options.php3', $url_query); echo PMA_printTab($strOptions, 'tbl_properties_options.php3', $url_query);
echo printTab($strEmpty, $lnk6, $arg6, $att6); echo PMA_printTab($strEmpty, $lnk6, $arg6, $att6);
echo printTab($strDrop, 'sql.php3', $arg7, $att7); echo PMA_printTab($strDrop, 'sql.php3', $arg7, $att7);
echo "\n";
?> ?>
</tr> </tr>
</table> </table>