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
*/
/**
* Sets the php error reporting - Please do not change this line!
*/
@@ -28,12 +29,19 @@ $old_error_rep = error_reporting(E_ALL);
* test to see that the auto-detection code works in your system.
*
* If the auto-detection code does work properly, you can set the
* $cfg['PmaAbsoluteUri_DisableWarning'] variable at the bottom of
* this file.
* $cfg['PmaAbsoluteUri_DisableWarning'] variable below.
*/
$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
*/
@@ -191,15 +199,12 @@ $cfg['ZipDump'] = TRUE; // Allow the use of zip/gzip/bzip
$cfg['GZipDump'] = TRUE; // compression for
$cfg['BZipDump'] = TRUE; // dump files
// Default Tabs display settings
$cfg['DefaultTabDatabase'] = 'db_details_structure.php3';
// Possible values:
// 'db_details_structure.php3' = tables list
// 'db_details.php3' = sql form
// 'db_search.php3' = search query
$cfg['DefaultTabTable'] = 'tbl_properties_structure.php3';
// Possible values:
// 'tbl_properties_structure.php3' = fields list
@@ -207,6 +212,7 @@ $cfg['DefaultTabTable'] = 'tbl_properties_structure.php3';
// 'tbl_select.php3 = select page
// 'tbl_change.php3 = insert row page
/**
* Link to the official MySQL documentation
* 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
$cfg['DefaultLang'] = 'en';
/**
* Charset conversion settings
*/
// Default charset to use for recoding of MySQL queries, does not take
// any effect when charsets recoding is switched off by
// $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['RepeatCells'] = 100; // repeat header names every X cells? (0 = deactivate)
// Note: this feature will be
// implemented after 2.3.0
// Syntax coloring (Note: this feature will be implemented after 2.3.0)
$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['colorKeywords'] = '#990099';
@@ -280,6 +282,7 @@ $cfg['colorStrings'] = '#008000';
$cfg['colorColType'] = '#FF9900';
$cfg['colorAdd'] = '#0000FF';
/**
* Available charsets for MySQL conversion. currently contains all which could
* 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
* use some of these move them to the top.
*/
$cfg['AvailableCharsets'] = array(
'iso-8859-1',
'iso-8859-2',
@@ -320,6 +322,7 @@ $cfg['AvailableCharsets'] = array(
'SHIFT_JIS'
);
/**
* MySQL settings
*/
@@ -392,6 +395,7 @@ if ($cfg['ShowFunctionFields']) {
);
} // end if
// Keywords for syntax coloring
if ($cfg['UseSyntaxColoring']) {
$cfg['keywords'] = array(
'SELECT',
@@ -416,6 +420,8 @@ if($cfg['UseSyntaxColoring']) {
'VALUES'
);
} // end if
// Other reserved words for syntax coloring
if ($cfg['UseSyntaxColoring']) {
$cfg['additional'] = array(
'TABLE',
@@ -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!
*/
set_magic_quotes_runtime(0);
/**
* Restore old error_reporting mode - do not change either!
*/
error_reporting($old_error_rep);
unset($old_error_rep);
/**
* File Revision - do not change either!
*/

View File

@@ -47,11 +47,8 @@ $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
: (PMA_PHP_INT_VERSION < 30016 || intval(@get_cfg_var('upload_max_filesize')));
?>
<!-- DATABASE WORK -->
<a name="querybox"></a>
<ul>
<!-- Query box, sql file loader and bookmark support -->
<li>
<a name="querybox"></a>
<form method="post" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
onsubmit="return checkSqlQuery(this)">
<input type="hidden" name="is_js_confirmed" value="0" />
@@ -110,8 +107,6 @@ if (function_exists('PMA_set_enc_form')) {
?>
<input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
</form>
</li>
</ul>
<?php

View File

@@ -1,9 +1,13 @@
<?php
/* $Id$ */
// count amount of navigation tabs
/**
* Counts amount of navigation tabs
*/
$db_details_links_count_tabs = 0;
/**
* Prepares links
*/
@@ -32,7 +36,7 @@ if ($cfg['AllowUserDropDatabase']) {
. urlencode('DROP DATABASE ' . PMA_backquote($db))
. '&amp;zero_rows='
. 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" '
. 'onclick="return confirmLink(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"';
}
@@ -44,28 +48,24 @@ else {
* 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>
<td width="8">&nbsp;</td>
<?php
echo printTab($strStructure,"db_details_structure.php3",$url_query);
echo printTab($strSQL,"db_details.php3",$url_query."&amp;db_query_force=1");
echo printTab($strExport,$lnk3,$arg3);
echo printTab($strSearch,$lnk4,$arg4);
echo PMA_printTab($strStructure, 'db_details_structure.php3', $url_query);
echo PMA_printTab($strSQL, 'db_details.php3', $url_query . '&amp;db_query_force=1');
echo PMA_printTab($strExport, $lnk3, $arg3);
echo PMA_printTab($strSearch, $lnk4, $arg4);
/**
* Query by example and dump of the db
* Only displayed if there is at least one table in the db
*/
// Query by example and dump of the db are only displayed if there is at least
// one table in the db
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
/**
* Displays drop link
*/
// Displays drop link
if ($lnk5) {
echo printTab($strDrop,$lnk5,$arg5,$att5);
echo PMA_printTab($strDrop, $lnk5, $arg5, $att5);
} // end if
echo "\n";
?>

View File

@@ -10,7 +10,7 @@ if (empty($is_info)) {
include('./db_details_common.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))
|| isset($mult_btn)) {
$action = 'db_details_structure.php3';
@@ -22,8 +22,10 @@ if (empty($is_info)) {
include('./db_details_db_info.php3');
echo "\n";
}
/**
* Settings for Relationstuff
* Settings for relations stuff
*/
require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam();
@@ -448,22 +450,21 @@ echo ' ' . '&nbsp;<input type="submit" value="' . $strGo . '" />' . "\n";
<?php
// is this OK to check for 'class' support?
if ($cfgRelation['pdfwork'] && $num_tables > 0) {
$takeaway = $url_query . '&amp;table=' . urlencode($table);
?>
<!-- Work on PDF Pages -->
<li>
<?php
$takeaway = $url_query . '&amp;table=' . urlencode($table);
?>
<a href="pdf_pages.php3?<?php echo $takeaway; ?>"><?php echo $strEditPDFPages; ?></a>
</li>
<!-- 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'])
. ' WHERE db_name = \'' . $db . '\'';
. ' WHERE db_name = \'' . PMA_backquote($db) . '\'';
$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>
<form method="post" action="pdf_schema.php3">
@@ -476,8 +477,10 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) {
<select name="pdf_page_number">
<?php
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
echo "\n";
?>
</select><br />
<input type="checkbox" name="show_grid" id="show_grid_opt" />

View File

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

View File

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

View File

@@ -168,7 +168,7 @@ echo "\n";
<body bgcolor="<?php echo $cfg['LeftBgColor']; ?>">
<!-- Link to the welcome page -->
<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>

View File

@@ -31,8 +31,8 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
* the authentication libraries must be before the connection to db but
* after the PMA_isInto() function
*
* the PMA_mysqlDie() function must be before the connection to db but after
* mysql extension has been loaded
* the PMA_mysqlDie() function must be before the connection to db but
* after mysql extension has been loaded
*
* the PMA_mysqlDie() function needs the PMA_format_sql() Function
*
@@ -104,7 +104,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
</html>
<?php
exit;
exit();
}
/**
@@ -199,6 +199,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
return $a_string;
} // end of the 'PMA_sqlAddslashes()' function
/**
* format sql strings
*
@@ -206,6 +207,9 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
*
* @return string the formatted sql
*
* @global array the configuration array
* @global boolean whether the current statement is a multiple one or not
*
* @access public
*
* @author Mike Beck <mikebeck@users.sourceforge.net>
@@ -216,14 +220,14 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// lem9: bypass this function for now
return $sql;
$_sfuncs = '^' . implode('$|^', $cfg['Functions']) . '$';
$_skeyw = '^' . implode('$|^', $cfg['keywords']) . '$';
$_scoltype = '^' . implode('$|^', $cfg['ColumnTypes']) . '$';
$_add = '^' . implode('$|^', $cfg['additional']) . '$';
$sfuncs = '^' . implode('$|^', $cfg['Functions']) . '$';
$skeyw = '^' . implode('$|^', $cfg['keywords']) . '$';
$scoltype = '^' . implode('$|^', $cfg['ColumnTypes']) . '$';
$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);
// 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
// to know how to do that without getting ; within strings as well
$sql = str_replace('=', ' = ', $sql);
@@ -231,94 +235,107 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$sql = str_replace(')', ' ) ', $sql);
$sql = str_replace('(', ' ( ', $sql);
// now split everything by the blanks
$_sql_parts=explode(' ',$sql);
// start a loop over the parts check each word and put them back into $sql
// Now split everything by the blanks
$sql_parts = explode(' ', $sql);
// Start a loop over the parts check each word and put them back into
// $sql
unset($sql);
$s_nr = 0;
while (list($_num,$_word) = each($_sql_parts)) {
// we might have added to many blanks when checking for = and ,
while (list($num, $word) = each($sql_parts)) {
// We might have added to many blanks when checking for = and,
// which might lead to empty members in the array
if(strlen($_word)==0){continue;}
$_is_string = FALSE;
if (strlen($word) == 0) {
continue;
}
$is_string = FALSE;
// 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
// together
if (substr($_word, 0, 1) == '\'' || substr($_word, 0, 1 == '"')
&& (!isset($_temp))) {
// so as we splitted by the blanks we have to try to get those
// parts back together
if ((substr($word, 0, 1) == '\'' || substr($word, 0, 1) == '"')
&& !isset($temp)) {
// start of a string
$_temp = $_word;
$_is_string = TRUE;
$temp = $word;
$is_string = TRUE;
} else {
if(isset($_temp)) {
// we are continuing a string
$_temp .= $_word;
$_is_string = TRUE;
if (isset($temp)) {
// We are continuing a string
$temp .= $word;
$is_string = TRUE;
}
}
if(substr($_word, strlen($_word)-1, 1) == '\''
|| substr($_word, strlen($_word)-1, 1) == '"') {
} // end if... else...
if (substr($word, strlen($word) - 1, 1) == '\''
|| substr($word, strlen($word) - 1, 1) == '"') {
// End of a String
$_word = '<font color="' . $cfg['colorStrings'] . '">' . htmlspecialchars($_temp) . '</font>';
unset($_temp);
// debug echo "fertig " . $_word . '<br />';
$_is_string = FALSE;
$word = '<font color="' . $cfg['colorStrings'] . '">' . htmlspecialchars($temp) . '</font>';
unset($temp);
// Debug echo "fertig " . $word . '<br />';
$is_string = FALSE;
} // end if
if (!isset($is_string) || $is_string == FALSE) {
// No String
if (eregi($sfuncs, $word)) {
$word = '<font color="' . $cfg['colorFunctions'].'">' . htmlspecialchars($word) . '</font>';
} else if (eregi($skeyw, $word)) {
$word = '<font color="' . $cfg['colorKeywords'].'">' . htmlspecialchars($word) . '</font>';
if (!isset($mult) || $mult != TRUE) {
$word = "\n" . $word;
}
if(!isset($_is_string) || $_is_string == FALSE) {
// no String
if(eregi($_sfuncs, $_word)) {
$_word = '<font color="' . $cfg['colorFunctions'].'">' . htmlspecialchars($_word) . '</font>';
} else if(eregi($_skeyw, $_word)) {
$_word = '<font color="' . $cfg['colorKeywords'].'">' . htmlspecialchars($_word) . '</font>';
if(isset($mult) && $mult == TRUE){
} else if (eregi($scoltype, $word)) {
$word = '<font color="' . $cfg['colorColType'].'">' . htmlspecialchars($word) . '</font>';
} else if (eregi($add, $word)) {
$word = '<font color="' . $cfg['colorAdd'].'">' . htmlspecialchars($word) . '</font>';
} else if ($word == '(') {
if (isset($brack_o)) {
$skey = count($brack_o);
} else {
$_word = "\n" . $_word;
$skey = 0;
}
$brack_o[$skey] = $s_nr;
} else if ($word == ')') {
if (isset($brack_o)) {
unset($brack_o[count($brack_o) - 1]);
if (count($brack_o) == 0) {
unset($brack_o);
}
} else if(eregi($_scoltype, $_word)) {
$_word = '<font color="' . $cfg['colorColType'].'">' . htmlspecialchars($_word) . '</font>';
} else if(eregi($_add, $_word)) {
$_word = '<font color="' . $cfg['colorAdd'].'">' . htmlspecialchars($_word) . '</font>';
} else if($_word=='(') {
if(isset($_brack_o)){
$_skey=count($_brack_o);
} else {
$_skey = 0;
$brack_c[] = $s_nr;
}
$_brack_o[$_skey]=$s_nr;
} else if($_word==')') {
if(isset($_brack_o)){
unset($_brack_o[count($_brack_o)-1]);
if(count($_brack_o)==0){ unset($_brack_o);}
} else {
$_brack_c[]=$s_nr;
}
} else if($_word==';') {
$_word = ";\n";
} else if ($word == ';') {
$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++;
}
} // End while
if(isset($_brack_o)) {
while (list($_num,$elem) = each($_brack_o)) {
$_sql_p[$elem] = '<font color="red">' . $_sql_p[$elem] . '</font>';
} // end while
if (isset($brack_o)) {
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 />';
}
}
if(isset($_brack_c)) {
while (list($_num,$elem) = each($_brack_c)) {
$_sql_p[$elem] = '<font color="red">' . $_sql_p[$elem] . '</font>';
if (isset($brack_c)) {
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 />';
}
}
$sql = implode(' ', $_sql_p);
$sql = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', $sql);
$sql = ereg_replace('<br />[ ]*<br />', '<br />', $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.
@@ -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 string the "back" link url (full path is not required)
*
* @global array the configuration array
*
* @access public
*/
function PMA_mysqlDie($error_message = '', $the_query = '',
$is_modify_link = TRUE, $back_url = '')
{
global $cfg;
if (empty($GLOBALS['is_header_sent'])) {
// rabus: If we include header.inc.php3 here, we get a huge set of
// "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";
if ($is_modify_link) {
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";
} // end if
if($cfg['UseSyntaxColoring']){
echo '<p>' . "\n" . PMA_format_sql($query_base) . "\n" . '</p>' . "\n";
} else {
echo '<p>' . "\n" . $query_base . "\n" . '</p>' . "\n";
}
echo '</p>' . "\n";
echo '<p>' . "\n"
. ' ' . ($cfg['UseSyntaxColoring'] ? PMA_format_sql($query_base) : $query_base) . "\n"
. '</p>' . "\n";
} // end if
if (!empty($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
* 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'])) {
// Setup a default value to let the people and lazy syadmins work anyway,
// but display a big warning on the main.php3 page. --Olivier
$cfg['PmaAbsoluteUri'] = (!empty($HTTP_SERVER_VARS['HTTPS']) ? 'https' : 'http') . '://'
. $HTTP_SERVER_VARS['SERVER_NAME']
. $HTTP_SERVER_VARS['HTTP_HOST']
. (!empty($HTTP_SERVER_VARS['SERVER_PORT']) ? ':' . $HTTP_SERVER_VARS['SERVER_PORT'] : '')
. substr($HTTP_SERVER_VARS['SCRIPT_NAME'], 0, strrpos($HTTP_SERVER_VARS['SCRIPT_NAME'], '/')+1);
. substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1);
// We display the warning by default, but not if it is disabled thru
// via the $cfg['PmaAbsoluteUri_DisableWarning'] variable.
// This is intended for sysadmins that actually want the default behaviour
// of auto-detection due to their setup.
// 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) {
$DisplayPmaAbsoluteUriWarning = 1;
$display_pmaAbsoluteUri_warning = 1;
}
}
// Adds a trailing slash et the end of the phpMyAdmin uri if it does not
// exist
@@ -524,7 +537,6 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* Make sure $cfg['DefaultTabDatabase'] and $cfg['DefaultTabTable'] are set.
* Todo: check if it is set to a *valid* value.
*/
if (empty($cfg['DefaultTabDatabase'])) {
$cfg['DefaultTabDatabase'] = 'db_details_structure.php3';
}
@@ -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
* 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
* current MySQL release is >= 3.23.6, the original one
@@ -1061,17 +1074,20 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
*
* @param string the message to display
*
* @global array the configuration array
*
* @access public
*/
function PMA_showMessage($message)
{
global $cfg;
// Reloads the navigation frame via JavaScript if required
if (isset($GLOBALS['reload']) && $GLOBALS['reload']) {
echo "\n";
$reload_url = './left.php3'
. '?convcharset=' . $GLOBALS['convcharset']
. '&lang=' . $GLOBALS['lang']
. '?lang=' . $GLOBALS['lang']
. '&convcharset=' . $GLOBALS['convcharset']
. '&server=' . $GLOBALS['server']
. ((!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
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) . '\'');
if ($result) {
$tmp = PMA_mysql_fetch_array($result, MYSQL_ASSOC);
@@ -1113,17 +1129,17 @@ if (typeof(document.getElementById) != 'undefined'
echo "\n";
?>
<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>
<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 />
</td>
</tr>
<?php
if ($GLOBALS['cfg']['ShowSQL'] == TRUE && !empty($GLOBALS['sql_query'])) {
if ($cfg['ShowSQL'] == TRUE && !empty($GLOBALS['sql_query'])) {
// Basic url query part
$url_qpart = '?lang=' . $GLOBALS['lang']
. '&amp;convcharset=' . $GLOBALS['convcharset']
$url_qpart = '?convcharset=' . $GLOBALS['convcharset']
. '&amp;lang=' . $GLOBALS['lang']
. '&amp;server=' . $GLOBALS['server']
. ((!empty($GLOBALS['db'])) ? '&amp;db=' . urlencode($GLOBALS['db']) : '')
. ((!empty($GLOBALS['table'])) ? '&amp;table=' . urlencode($GLOBALS['table']) : '');
@@ -1131,7 +1147,7 @@ if (typeof(document.getElementById) != 'undefined'
echo "\n";
?>
<tr>
<td bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php
echo "\n";
// Html format the query to be displayed
@@ -1141,10 +1157,8 @@ if (typeof(document.getElementById) != 'undefined'
$sqlnr = 1;
if (!empty($GLOBALS['show_as_php'])) {
$new_line = '&quot;;<br />' . "\n" . ' $sql .= &quot;';
}else{
if($cfg['UseSyntaxColoring'] == FALSE){
$new_line = "<br />\n";
}
} else if ($cfg['UseSyntaxColoring'] == FALSE) {
$new_line = '<br />' . "\n";
}
if (isset($new_line)) {
$query_base = htmlspecialchars($GLOBALS['sql_query']);
@@ -1154,11 +1168,9 @@ if (typeof(document.getElementById) != 'undefined'
}
if (!empty($GLOBALS['show_as_php'])) {
$query_base = '$sql = &quot;' . $query_base;
} else {
if($cfg['UseSyntaxColoring']) {
} else if ($cfg['UseSyntaxColoring']) {
$query_base = PMA_format_sql($query_base);
}
}
// Prepares links that may be displayed to edit/explain the query
if (!isset($GLOBALS['show_query']) || $GLOBALS['show_query'] != 'y') {
@@ -1358,35 +1370,48 @@ if (typeof(document.getElementById) != 'undefined'
return strftime($date, $timestamp);
} // end of the 'PMA_localisedDate()' function
/**
* Prints out a tab for tabbed navigation.
* If the variables $link and $args ar left empty, an inactive tab is created
*
* @param $text the text to be displayed as link
* @param $link main link file, e.g. "test.php3"
* @param $args link arguments
* @param string the text to be displayed as link
* @param string main link file, e.g. "test.php3"
* @param string link arguments
* @param string link attributes
*
* @return string two table cells, the first beeing a separator, the second the tab itself
*
* @access public
*/
function printTab($text,$link,$args="",$attr="") {
function PMA_printTab($text, $link, $args = '', $attr = '') {
global $PHP_SELF;
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++;
$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;
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>';
return $out;
} // end of the 'PMA_printTab()' function
// Kanji encoding convert feature appended by Y.Kawada (2002/2/20)
if (PMA_PHP_INT_VERSION >= 40006

View File

@@ -5,7 +5,7 @@
/**
* 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
* 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+
*/
@@ -34,5 +34,11 @@ if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
}
} // 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__
?>

View File

@@ -251,7 +251,7 @@ if ($server > 0) {
$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) {
$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 nowrap="nowrap">
<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="server" value="<?php echo $server; ?>" />
Language <a href="./translators.html" target="documentation">(*)</a>:
<select name="lang" dir="ltr" onchange="this.form.submit();">
<?php
@@ -488,10 +488,10 @@ if (empty($cfg['Lang'])) {
</tr>
<?php
}
if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
&& $allow_recoding) {
echo "\n";
?>
<?php
if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding) {
?>
<!-- Charset Selection -->
<tr>
@@ -521,8 +521,8 @@ if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $al
</td>
</tr>
<?php
echo "\n";
}
echo "\n";
?>
<!-- Documentation -->
@@ -566,12 +566,14 @@ echo "\n";
<?php
if ($DisplayPmaAbsoluteUriWarning) {
/**
* Displays the "empty $cfg['PmaAbsoluteUri'] warning"
*/
if ($display_pmaAbsoluteUri_warning) {
echo '<p class="warning">' . $strPmaUriError . '</p>' . "\n";
}
/**
* Displays the footer
*/

View File

@@ -1,9 +1,7 @@
<?php
/**
* pdf_pages.php3 mikebeck 2002-05-23
* create and edit the pages to output in pdf
*
*/
/* $Id$ */
/**
* Gets some core libraries
*/
@@ -12,39 +10,45 @@ require('./libraries/common.lib.php3');
include('./db_details_common.php3');
/**
* Settings for Relationstuff
* Settings for relation stuff
*/
require('./libraries/relation.lib.php3');
$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
* 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
* complain ;-)
*/
if (!$cfgRelation['relwork']) {
echo sprintf($strNotSet,'relation','config.inc.php3') . '<br /><a href="Documentation.html#relation" target="documentation">' . $strDocu . '</a>';
die();
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>';
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>';
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'])) {
echo sprintf($strNotSet,'pdf_page','config.inc.php3') . '<br /><a href="Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>';
die();
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
// Now is the time to work on all changes
if (isset($do)) {
switch ($do) {
case 'createpage':
@@ -53,48 +57,50 @@ if ($cfgRelation['pdfwork']){
}
$ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages'])
. ' (db_name, page_descr)'
. ' VALUES (\'' . $db . '\',\'' . $newpage . '\')';
. ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
PMA_query_as_cu($ins_query);
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['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'])
. ' WHERE db_name = \'' . $db . '\''
. ' AND table_name = \'' . $arrvalue['name'] . '\'' .
' AND pdf_page_number = '.$chpage;
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage;
$test_rs = PMA_query_as_cu($test_query);
if(mysql_num_rows($test_rs)>0){
if ($test_rs && mysql_num_rows($test_rs) > 0) {
if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
$ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . $db . '\''
. ' AND table_name = \''.$arrvalue['name'] . '\''
. ' 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'])
$ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' '
. 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
. ' WHERE db_name = \'' . $db . '\''
. ' AND table_name = \''.$arrvalue['name'] . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage;
}
} 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) '
. ' VALUES (\'' . $db . '\',\''.$arrvalue['name'].'\','
. $chpage.','
. $arrvalue['x'].','.$arrvalue['y'].')';
. 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
}
PMA_query_as_cu($ch_query);
}
}
} // end if
} // end while
break;
}
} // End if (isset($do))
} // end switch
} // 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[] = '--';
$alltab_qry = 'SHOW TABLES FROM ' . PMA_backquote($db);
$alltab_rs = @PMA_mysql_query($alltab_qry) or PMA_mysqlDie('', $alltab_qry, '', $err_url_0);
@@ -102,119 +108,151 @@ if ($cfgRelation['pdfwork']){
$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'])
. ' WHERE db_name = \'' . $db . '\'';
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$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">
<?php echo $strChoosePage; ?>
<?php echo $strChoosePage . "\n"; ?>
<input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="table" value="<?php echo $table; ?>" />
<input type="hidden" name="do" value="choosepage" />
<select name="chpage" onChange="this.form.submit()">
<select name="chpage" onchange="this.form.submit()">
<?php
while ($curr_page = @PMA_mysql_fetch_array($page_rs)) {
echo '<option value="'.$curr_page['page_nr'].'"';
echo "\n" . ' '
. '<option value="' . $curr_page['page_nr'] . '"';
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>
<input type="submit" value="<?php echo $strGo; ?>" />
</form>
<?php
}
// possibility to create a new page:
echo "\n";
// Possibility to create a new page:
?>
<form action="pdf_pages.php3" method="post" name="crpage">
<?php echo $strCreatePage; ?>
<input type="hidden" name="db" value="<?php echo $db; ?>" />
<?php echo $strCreatePage . "\n"; ?>
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<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="do" value="createpage" />
<input type="text" name="newpage" size="20" maxlength="50" />
<input type="submit" value="<?php echo $strGo; ?>" />
</form>
<?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
// tables involved
if (isset($chpage) && $chpage > 0) {
echo "\n";
?>
<hr /><h2><?php echo $strSelectTables ;?></h2>
<hr />
<h2><?php echo $strSelectTables ;?></h2>
<form action="pdf_pages.php3" method="post" name="edcoord">
<input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<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="chpage" value="<?php echo $chpage; ?>" />
<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>
<table border="0">
<tr>
<th><?php echo $strTable; ?></th>
<th><?php echo $strDelete; ?></th>
<th>X</th>
<th>Y</th>
</tr>
<?php
if(isset($ctable)){unset($ctable);}
if (isset($ctable)) {
unset($ctable);
}
$page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . $db . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number = ' . $chpage;
$page_rs = PMA_query_as_cu($page_query);
$i = 0;
while ($sh_page = @PMA_mysql_fetch_array($page_rs)) {
echo '<tr ';
echo "\n" . ' <tr ';
if ($i % 2 == 0) {
echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
} else {
echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
}
echo '>';
echo '<td><select name="ctable['.$i.'][name]">';
echo "\n" . ' <td>'
. "\n" . ' <select name="ctable[' . $i . '][name]">';
reset($selectboxall);
while (list($key, $value) = each($selectboxall)) {
echo '<option value="'.$value.'"';
echo "\n" . ' <option value="' . $value . '"';
if ($value == $sh_page['table_name']) {
echo ' selected="selected"';
}
echo '>'.$value.'</option>'."\n";
}
echo '</select></td>'."\n";
echo '<td><INPUT type="checkbox" name="ctable['.$i.'][delete]" value="y" />'.$strDelete.'</td>'."\n";
echo '<td><INPUT type="text" name="ctable['.$i.'][x]" value="'.$sh_page['x'].'"></td>'."\n";
echo '<td><INPUT type="text" name="ctable['.$i.'][y]" value="'.$sh_page['y'].'"></td>'."\n";
echo '</tr>'."\n";
echo '>' . $value . '</option>';
} // end while
echo "\n" . ' </select>'
. "\n" . ' </td>';
echo "\n" . ' <td>'
. "\n" . ' <input type="checkbox" name="ctable[' . $i . '][delete]" value="y" />' . $strDelete;
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++;
}
// do one more empty row
echo '<tr ';
} // end while
// Do one more empty row
echo "\n" . ' <tr ';
if ($i % 2 == 0) {
echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
} else {
echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
}
echo '>';
echo '<td><select name="ctable['.$i.'][name]">';
echo "\n" . ' <td>'
. "\n" . ' <select name="ctable[' . $i . '][name]">';
reset($selectboxall);
while (list($key, $value) = each($selectboxall)) {
echo '<option value="'.$value.'"';
echo '>'.$value.'</option>'."\n";
}
echo '</select></td>'."\n";
echo '<td><INPUT type="checkbox" name="ctable['.$i.'][delete]" value="y" />'.$strDelete.'</td>'."\n";
echo '<td><INPUT type="text" name="ctable['.$i.'][x]"></td>'."\n";
echo '<td><INPUT type="text" name="ctable['.$i.'][y]"></td>'."\n";
echo '</tr>'."\n";
echo '</table><input type="submit" value="'.$strGo.'" /></form>'."\n";
}
echo "\n" . ' <option value="' . $value . '">' . $value . '</option>';
}
echo "\n" . ' </select>'
. "\n" . ' </td>';
echo "\n" . ' <td>'
. "\n" . ' <input type="checkbox" name="ctable[' . $i . '][delete]" value="y" />' . $strDelete;
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>';
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/common.lib.php3');
require('./libraries/relation.lib.php3');
/**
* Settings for relation stuff
*/
require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam();
/**
* 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 /><a href="Documentation.html#relation" target="documentation">' . $strDocu . '</a>';
die();
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>';
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>';
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'])) {
echo sprintf($strNotSet,'pdf_page','config.inc.php3') . '<br /><a href="Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>';
die();
echo sprintf($strNotSet, 'pdf_page', 'config.inc.php3') . '<br />' . "\n"
. '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
exit();
}
/**
* Gets the "fpdf" libraries and defines the pdf font path
*/
@@ -391,12 +412,16 @@ class PMA_RT_Table
reset($this->fields);
while (list(, $field) = each($this->fields)) {
if(in_array($field,$this->primary)){$pdf->SetFillColor(215,121,123);}
if($field == $this->displayfield){$pdf->SetFillColor(142,159,224);}
if (in_array($field, $this->primary)) {
$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_setXScale($this->x);
$pdf->SetFillColor(255);
}
} // end while
if ($pdf->PageNo() > 1) {
$pdf->PMA_PDF_die($GLOBALS['strScaleFactorSmall']);
@@ -413,6 +438,8 @@ class PMA_RT_Table
* @global object The current PDF document
* @global integer The current page number (from the
* $cfg['Servers'][$i]['table_coords'] table)
* @global array The relations settings
* @global string The current db name
*
* @access private
*
@@ -457,16 +484,15 @@ class PMA_RT_Table
$this->displayfield = getDisplayField($db, $table_name);
// index
$sql = 'SHOW index from '.PMA_backquote($table_name);
$sql = 'SHOW index FROM ' . PMA_backquote($table_name);
$result = PMA_mysql_query($sql);
if(mysql_num_rows($result)>0){
if ($result && mysql_num_rows($result) > 0) {
while ($row = PMA_mysql_fetch_array($result)) {
if ($row['Key_name'] == 'PRIMARY') {
$this->primary[] = $row['Column_name'];
}
}
}
} // end if
} // end of the "PMA_RT_Table()" method
} // end class "PMA_RT_Table"
@@ -794,6 +820,8 @@ class PMA_RT
* @param boolean Whether to draw grids or not
*
* @global object The current PDF document
* @global string The current db name
* @global array The relations settings
*
* @access private
*
@@ -818,21 +846,20 @@ class PMA_RT
$pdf->SetFont($this->ff, '', 14);
$pdf->SetAutoPageBreak('auto');
// get tables on this page
// Gets tables on this page
$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;
$tab_rs = PMA_query_as_cu($tab_sql);
while ($curr_table = @PMA_mysql_fetch_array($tab_rs)) {
$alltables[] = $curr_table['table_name'];
$intable = "'" . implode("','",$alltables) . "'";
$alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
$intable = '\'' . implode('\', \'', $alltables) . '\'';
}
$sql = 'SELECT *'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $db . '\' '
. ' AND foreign_db = \'' . $db . '\' '
$sql = 'SELECT * FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' '
. ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\' '
. ' AND master_table IN (' . $intable . ')'
. ' AND foreign_table IN (' . $intable . ')';
$result = PMA_query_as_cu($sql);

View File

@@ -321,7 +321,9 @@ if ($sql_query != '') {
$pieces = array();
PMA_splitSqlFile($pieces, $sql_query, PMA_MYSQL_INT_VERSION);
$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
// 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
*/
?>
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="tabs">
<table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs">
<tr>
<td width="8">&nbsp;</td>
<?php
echo printTab($strStructure, 'tbl_properties_structure.php3', $url_query);
echo printTab($strBrowse, $lnk2, $arg2);
echo printTab($strSQL, 'tbl_properties.php3', $url_query);
echo printTab($strSelect, $lnk4, $arg4);
echo printTab($strInsert, 'tbl_change.php3', $url_query);
echo printTab($strExport, 'tbl_properties_export.php3', $url_query);
echo printTab($strOperations, 'tbl_properties_operations.php3', $url_query);
echo printTab($strOptions, 'tbl_properties_options.php3', $url_query);
echo printTab($strEmpty, $lnk6, $arg6, $att6);
echo printTab($strDrop, 'sql.php3', $arg7, $att7);
echo PMA_printTab($strStructure, 'tbl_properties_structure.php3', $url_query);
echo PMA_printTab($strBrowse, $lnk2, $arg2);
echo PMA_printTab($strSQL, 'tbl_properties.php3', $url_query);
echo PMA_printTab($strSelect, $lnk4, $arg4);
echo PMA_printTab($strInsert, 'tbl_change.php3', $url_query);
echo PMA_printTab($strExport, 'tbl_properties_export.php3', $url_query);
echo PMA_printTab($strOperations, 'tbl_properties_operations.php3', $url_query);
echo PMA_printTab($strOptions, 'tbl_properties_options.php3', $url_query);
echo PMA_printTab($strEmpty, $lnk6, $arg6, $att6);
echo PMA_printTab($strDrop, 'sql.php3', $arg7, $att7);
echo "\n";
?>
</tr>
</table>