coding standards

This commit is contained in:
Loïc Chapeaux
2002-05-24 08:51:59 +00:00
parent 7016d9d0fe
commit ea75e3d0d9

View File

@@ -52,22 +52,24 @@ if (!empty($cfg['Server']['relation'])
} // end if... else.... } // end if... else....
} // end while } // end while
} // end if } // end if
if (!empty($cfg['Server']['table_info']) if (!empty($cfg['Server']['table_info'])
&& isset($submit_show) && $submit_show == 'true') { && isset($submit_show) && $submit_show == 'true') {
$test_query = 'SELECT display_field from ' . PMA_backquote($cfg['Server']['table_info']) $test_query = 'SELECT display_field FROM ' . PMA_backquote($cfg['Server']['table_info'])
. ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$test_rs = mysql_query($test_query) or PMA_mysqlDie('', $test_query, '', $err_url_0); $test_rs = mysql_query($test_query) or PMA_mysqlDie('', $test_query, '', $err_url_0);
if(mysql_num_rows($test_rs) > 0){ if ($test_rs && mysql_num_rows($test_rs) > 0) {
$upd_query = 'UPDATE ' . PMA_backquote($cfg['Server']['table_info']) . ' SET' $upd_query = 'UPDATE ' . PMA_backquote($cfg['Server']['table_info']) . ' SET'
. ' display_field = \'' . PMA_sqlAddslashes($display_field) . '\'' . ' display_field = \'' . PMA_sqlAddslashes($display_field) . '\''
. ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$upd_rs = mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); $upd_rs = mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0);
} else { } else {
$ins_query = 'insert into ' . PMA_backquote($cfg['Server']['table_info']) . ' (table_name,display_field)' $ins_query = 'INSERT INTO ' . PMA_backquote($cfg['Server']['table_info']) . ' (table_name, display_field)'
. ' values(\'' . PMA_sqlAddslashes($table) . '\',\'' . PMA_sqlAddslashes($display_field) .'\') '; . ' VALUES(\'' . PMA_sqlAddslashes($table) . '\', \'' . PMA_sqlAddslashes($display_field) .'\')';
$ins_rs = mysql_query($ins_query) or PMA_mysqlDie('', $ins_query, '', $err_url_0); $ins_rs = mysql_query($ins_query) or PMA_mysqlDie('', $ins_query, '', $err_url_0);
} }
} } // end if
/** /**
* Dialog * Dialog
@@ -126,9 +128,11 @@ $col_rs = mysql_query($col_query) or PMA_mysqlDie('', $col_query, '', $err_ur
if ($col_rs && mysql_num_rows($col_rs) > 0) { if ($col_rs && mysql_num_rows($col_rs) > 0) {
?> ?>
<form method="post" action="tbl_relation.php3"> <form method="post" action="tbl_relation.php3">
<input type="hidden" name="submit_rel" value="true" /> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="table" value="<?php echo $table; ?>" /> <input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="db" value="<?php echo $db; ?>" /> <input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="table" value="<?php echo $table; ?>" />
<input type="hidden" name="submit_rel" value="true" />
<table> <table>
<tr> <tr>
@@ -175,19 +179,26 @@ if ($col_rs && mysql_num_rows($col_rs) > 0) {
</form> </form>
<?php <?php
} // end if } // end if
if (!empty($cfg['Server']['table_info'])) { if (!empty($cfg['Server']['table_info'])) {
echo "\n";
?> ?>
<form action="tbl_relation.php3" method="post"> <form method="post" action="tbl_relation.php3">
<input type="hidden" name="submit_show" value="true" /> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="table" value="<?php echo $table; ?>" /> <input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="db" value="<?php echo $db; ?>" /> <input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="table" value="<?php echo $table; ?>" />
<input type="hidden" name="submit_show" value="true" />
<p><?php echo $strChangeDisplay; ?></P> <p><?php echo $strChangeDisplay; ?></P>
<select name="display_field" onchange="this.form.submit(); "> <select name="display_field" onchange="this.form.submit(); ">
<?php <?php
$disp_query = 'SELECT display_field from ' . PMA_backquote($cfg['Server']['table_info']) echo "\n";
$disp_query = 'SELECT display_field FROM ' . PMA_backquote($cfg['Server']['table_info'])
. ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$disp_rs = mysql_query($disp_query) or PMA_mysqlDie('', $disp_query, '', $err_url_0); $disp_rs = mysql_query($disp_query) or PMA_mysqlDie('', $disp_query, '', $err_url_0);
$row = mysql_fetch_array($disp_rs); $row = ($disp_rs ? mysql_fetch_array($disp_rs) : '');
if (isset($row['display_field'])) { if (isset($row['display_field'])) {
$disp = $row['display_field']; $disp = $row['display_field'];
} }
@@ -199,7 +210,8 @@ if (!empty($cfg['Server']['table_info'])){
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>' . htmlspecialchars($row['Field']) . '</option>'. "\n"; echo '>' . htmlspecialchars($row['Field']) . '</option>'. "\n";
}?> } // end while
?>
</select> </select>
<input type="submit" value="<?php echo $strGo; ?>" /> <input type="submit" value="<?php echo $strGo; ?>" />
</form> </form>