coding standards

This commit is contained in:
Loïc Chapeaux
2002-07-05 12:37:50 +00:00
parent 0f4e3eb2e7
commit b822c3a0e0
3 changed files with 39 additions and 24 deletions

View File

@@ -9,12 +9,18 @@ if (!isset($selected_tbl)) {
include('./libraries/grab_globals.lib.php3'); include('./libraries/grab_globals.lib.php3');
include('./header.inc.php3'); include('./header.inc.php3');
} }
require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam();
/**
* Gets the relations settings
*/
require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
$comments = getComments($db,$table); $comments = getComments($db, $table);
} }
/** /**
* Defines the url to return to in case of error in a sql statement * Defines the url to return to in case of error in a sql statement
*/ */
@@ -60,15 +66,14 @@ if ($multi_tables) {
echo '<b>'. $strShowTables . '&nbsp;:&nbsp;' . $tbl_list . '</b>' . "\n"; echo '<b>'. $strShowTables . '&nbsp;:&nbsp;' . $tbl_list . '</b>' . "\n";
echo '<hr />' . "\n"; echo '<hr />' . "\n";
} // end if } // end if
reset($the_tables);
$tablecount = count($the_tables); $tables_cnt = count($the_tables);
reset($the_tables); reset($the_tables);
$counter = 0; $counter = 0;
while (list($key, $table) = each($the_tables)) { while (list($key, $table) = each($the_tables)) {
$table = urldecode($table); $table = urldecode($table);
if($counter+1>=$tablecount) { if ($counter + 1 >= $tables_cnt) {
$breakstyle = ''; $breakstyle = '';
} else { } else {
$breakstyle = ' style="page-break-after: always;"'; $breakstyle = ' style="page-break-after: always;"';
@@ -141,6 +146,7 @@ while (list($key, $table) = each($the_tables)) {
mysql_free_result($result); mysql_free_result($result);
} }
/** /**
* Gets fields properties * Gets fields properties
*/ */
@@ -148,12 +154,11 @@ while (list($key, $table) = each($the_tables)) {
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$fields_cnt = mysql_num_rows($result); $fields_cnt = mysql_num_rows($result);
// check if we can use Relations (Mike Beck) // Check if we can use Relations (Mike Beck)
if ($cfgRelation['relation']) {
if ( $cfgRelation['relation']) {
// Find which tables are related with the current one and write it in // Find which tables are related with the current one and write it in
// an array // an array
$res_rel = getForeigners($db,$table); $res_rel = getForeigners($db, $table);
if (count($res_rel) > 0) { if (count($res_rel) > 0) {
$have_rel = TRUE; $have_rel = TRUE;
@@ -188,7 +193,7 @@ while (list($key, $table) = each($the_tables)) {
if ($have_rel) { if ($have_rel) {
echo '<th>' . ucfirst($strLinksTo) . '</th>'; echo '<th>' . ucfirst($strLinksTo) . '</th>';
} }
if($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
echo '<th>' . ucfirst($strComments) . '</th>'; echo '<th>' . ucfirst($strComments) . '</th>';
} }
echo "\n"; echo "\n";

View File

@@ -30,7 +30,8 @@ if (isset($show_query) && $show_query == 'y') {
} }
unset($sql_query); unset($sql_query);
/*
/**
* Get the list and number of fields * Get the list and number of fields
*/ */
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table); $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
@@ -46,13 +47,14 @@ else {
mysql_free_result($result); mysql_free_result($result);
} }
/** /**
* Work on the table * Work on the table
*/ */
// loic1: defines wether file upload is available or not // loic1: defines wether file upload is available or not
// lem9: we should check if PHP 4.0.0 really implements the "file_uploads" // lem9: we should check if PHP 4.0.0 really implements the "file_uploads"
// variable, because I got a support request and his 4.0.0 did not have it // variable, because I got a support request and his 4.0.0 did not have it
$is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get')) $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
? ((strtolower(ini_get('file_uploads')) == 'on' || ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize'))) ? ((strtolower(ini_get('file_uploads')) == 'on' || ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
// loic1: php 3.0.15 and lower bug -> always enabled // loic1: php 3.0.15 and lower bug -> always enabled
@@ -80,15 +82,16 @@ require('./tbl_properties_table_info.php3');
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" /> <input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showDocuShort('S/E/SELECT.html') . '&nbsp;&nbsp;&nbsp;' . $strFields . ':'; ?> <?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showDocuShort('S/E/SELECT.html') . '&nbsp;&nbsp;&nbsp;' . $strFields . ':'; ?>
<select name="dummy" size="1"> <select name="dummy" size="1">
<?php <?php
echo "\n"; echo "\n";
for ($i = 0 ; $i < $fields_cnt; $i++) { for ($i = 0 ; $i < $fields_cnt; $i++) {
echo ' <option value="' . urlencode($fields_list[$i]) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n"; echo ' '
} . '<option value="' . urlencode($fields_list[$i]) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
?> }
</select> ?>
<input type="button" name="insert" value="<?php echo($strInsert); ?>" onclick="sqlform.sql_query.value = sqlform.sql_query.value + sqlform.dummy.value" /> </select>
<br /> <input type="button" name="insert" value="<?php echo($strInsert); ?>" onclick="sqlform.sql_query.value = sqlform.sql_query.value + sqlform.dummy.value" />
<br />
<div style="margin-bottom: 5px"> <div style="margin-bottom: 5px">
<textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" wrap="virtual" <textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" 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();}">

View File

@@ -26,9 +26,15 @@ $err_url = 'tbl_properties.php3'
. '&amp;table=' . urlencode($table); . '&amp;table=' . urlencode($table);
/**
* Ensures the database and the table exist (else move to the "parent" script)
*/
require('./libraries/db_table_exists.lib.php3'); require('./libraries/db_table_exists.lib.php3');
// Displays headers
/**
* Displays headers
*/
if (!isset($message)) { if (!isset($message)) {
$js_to_run = 'functions.js'; $js_to_run = 'functions.js';
include('./header.inc.php3'); include('./header.inc.php3');
@@ -36,6 +42,7 @@ if (!isset($message)) {
PMA_showMessage($message); PMA_showMessage($message);
} }
/** /**
* Set parameters for links * Set parameters for links
*/ */