coding standards
This commit is contained in:
@@ -8,12 +8,14 @@
|
|||||||
require('./libraries/grab_globals.lib.php3');
|
require('./libraries/grab_globals.lib.php3');
|
||||||
require('./libraries/common.lib.php3');
|
require('./libraries/common.lib.php3');
|
||||||
|
|
||||||
/*
|
|
||||||
* Defines an array of functions (should possibly be in config.inc.
|
/**
|
||||||
* so i can also use it in tbl_qbe
|
* Defines arrays of functions (should possibly be in config.inc.php3
|
||||||
*/
|
* so it can also be used in tbl_qbe.php3)
|
||||||
$numfunctions = array('=','>','>=','<','<=','!=');
|
*/
|
||||||
$textfunctions = array('LIKE','=','!=');
|
$numfunctions = array('=', '>', '>=', '<', '<=', '!=');
|
||||||
|
$textfunctions = array('LIKE', '=', '!=');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not selection yet required -> displays the selection form
|
* Not selection yet required -> displays the selection form
|
||||||
@@ -111,20 +113,24 @@ if (!isset($param) || $param[0] == '') {
|
|||||||
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo $fields_type[$i]; ?></td>
|
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo $fields_type[$i]; ?></td>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<select name="func[]">
|
<select name="func[]">
|
||||||
<?php
|
<?php
|
||||||
reset($numfunctions);
|
reset($numfunctions);
|
||||||
reset($textfunctions);
|
reset($textfunctions);
|
||||||
if (eregi('char|blob|text|set|enum', $fields_type[$i])){
|
if (eregi('char|blob|text|set|enum', $fields_type[$i])) {
|
||||||
while (list($k,$fc) = each($textfunctions)){
|
while (list($k, $fc) = each($textfunctions)) {
|
||||||
echo ' <option value="'.$fc.'">'.htmlentities($fc).'</option>' . "\n";
|
echo "\n" . ' '
|
||||||
}
|
. '<option value="' . $fc . '">' . htmlentities($fc) . '</option>';
|
||||||
}else{
|
} // end while
|
||||||
while (list($k,$fc) = each($numfunctions)){
|
} else {
|
||||||
echo ' <option value="'.$fc.'">'.htmlentities($fc).'</option>' . "\n";
|
while (list($k, $fc) = each($numfunctions)) {
|
||||||
}
|
echo "\n" . ' '
|
||||||
}
|
. '<option value="' . $fc . '">' . htmlentities($fc) . '</option>';
|
||||||
?>
|
} // end while
|
||||||
</select></td>
|
} // end if... else...
|
||||||
|
echo "\n";
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<input type="text" name="fields[]" size="40" class="textfield" />
|
<input type="text" name="fields[]" size="40" class="textfield" />
|
||||||
<input type="hidden" name="names[]" value="<?php echo urlencode($fields_list[$i]); ?>" />
|
<input type="hidden" name="names[]" value="<?php echo urlencode($fields_list[$i]); ?>" />
|
||||||
@@ -190,18 +196,19 @@ else {
|
|||||||
for ($i = 0; $i < count($fields); $i++) {
|
for ($i = 0; $i < count($fields); $i++) {
|
||||||
if (!empty($fields) && $fields[$i] != '') {
|
if (!empty($fields) && $fields[$i] != '') {
|
||||||
if (strtoupper($fields[$i]) == 'NULL' || strtoupper($fields[$i]) == 'NOT NULL') {
|
if (strtoupper($fields[$i]) == 'NULL' || strtoupper($fields[$i]) == 'NOT NULL') {
|
||||||
$quot = '';
|
$quot = '';
|
||||||
$func[$i] = 'IS';
|
$func[$i] = 'IS';
|
||||||
}
|
}
|
||||||
if (eregi('char|blob|text|set|enum|date|time|year', $types[$i])){
|
if (eregi('char|blob|text|set|enum|date|time|year', $types[$i])) {
|
||||||
$quot = '\'';
|
$quot = '\'';
|
||||||
}else{
|
} else {
|
||||||
$quot = '';
|
$quot = '';
|
||||||
}
|
}
|
||||||
$sql_query .= ' AND ' . PMA_backquote(urldecode($names[$i])) . " $func[$i] $quot$fields[$i]$quot";
|
$sql_query .= ' AND ' . PMA_backquote(urldecode($names[$i])) . " $func[$i] $quot$fields[$i]$quot";
|
||||||
} // end if
|
} // end if
|
||||||
} // end for
|
} // end for
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
if ($orderField != '--nil--') {
|
if ($orderField != '--nil--') {
|
||||||
$sql_query .= ' ORDER BY ' . PMA_backquote(urldecode($orderField)) . ' ' . $order;
|
$sql_query .= ' ORDER BY ' . PMA_backquote(urldecode($orderField)) . ' ' . $order;
|
||||||
} // end if
|
} // end if
|
||||||
|
@@ -33,7 +33,6 @@ $err_url = 'user_details.php3'
|
|||||||
* @global string the current charset for MySQL
|
* @global string the current charset for MySQL
|
||||||
* @global integer the server to use (refers to the number in the
|
* @global integer the server to use (refers to the number in the
|
||||||
* configuration file)
|
* configuration file)
|
||||||
* @global string the current charset for MySQL
|
|
||||||
*
|
*
|
||||||
* @see PMA_checkDb()
|
* @see PMA_checkDb()
|
||||||
*
|
*
|
||||||
@@ -42,7 +41,7 @@ $err_url = 'user_details.php3'
|
|||||||
* user while these privileges applies to all users.
|
* user while these privileges applies to all users.
|
||||||
*/
|
*/
|
||||||
function PMA_tableGrants(&$host_db_result, $dbcheck = FALSE) {
|
function PMA_tableGrants(&$host_db_result, $dbcheck = FALSE) {
|
||||||
global $lang, $convcharset, $server, $convertcharset;
|
global $lang, $convcharset, $server;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- Table of grants -->
|
<!-- Table of grants -->
|
||||||
@@ -72,7 +71,7 @@ function PMA_tableGrants(&$host_db_result, $dbcheck = FALSE) {
|
|||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
// 2. Table body
|
// 2. Table body
|
||||||
$url_query = 'lang=' . $lang . '&server=' . $server . '&db=mysql&table=user&convcharset=' . $convcharset;
|
$url_query = 'lang=' . $lang . '&convcharset=' . $convcharset . '&server=' . $server . '&db=mysql&table=user';
|
||||||
|
|
||||||
while ($row = (is_array($host_db_result) ? $host_db_result : PMA_mysql_fetch_array($host_db_result))) {
|
while ($row = (is_array($host_db_result) ? $host_db_result : PMA_mysql_fetch_array($host_db_result))) {
|
||||||
$local_query = 'SHOW GRANTS FOR \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'';
|
$local_query = 'SHOW GRANTS FOR \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'';
|
||||||
@@ -322,22 +321,22 @@ function PMA_tablePrivileges($form, $row = FALSE)
|
|||||||
* @return boolean always true
|
* @return boolean always true
|
||||||
*
|
*
|
||||||
* @global string the current language
|
* @global string the current language
|
||||||
|
* @global string the current charset for MySQL
|
||||||
* @global integer the server to use (refers to the number in the
|
* @global integer the server to use (refers to the number in the
|
||||||
* configuration file)
|
* configuration file)
|
||||||
* @global string the current charset for MySQL
|
|
||||||
*
|
*
|
||||||
* @see PMA_tablePrivileges()
|
* @see PMA_tablePrivileges()
|
||||||
*/
|
*/
|
||||||
function PMA_normalOperations()
|
function PMA_normalOperations()
|
||||||
{
|
{
|
||||||
global $lang, $server, $convcharset;
|
global $lang, $convcharset, $server;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<div style="margin-bottom: 10px">
|
<div style="margin-bottom: 10px">
|
||||||
<a href="user_details.php3?lang=<?php echo $lang; ?>&server=<?php echo $server; ?>&db=mysql&table=user&mode=reload&convcharset=<?php echo $convcharset; ?>">
|
<a href="user_details.php3?lang=<?php echo $lang; ?>&convcharset=<?php echo $convcharset; ?>&server=<?php echo $server; ?>&db=mysql&table=user&mode=reload">
|
||||||
<?php echo $GLOBALS['strReloadMySQL']; ?></a>
|
<?php echo $GLOBALS['strReloadMySQL']; ?></a>
|
||||||
<?php echo PMA_showDocuShort('F/L/FLUSH.html') . "\n"; ?>
|
<?php echo PMA_showDocuShort('F/L/FLUSH.html') . "\n"; ?>
|
||||||
</div>
|
</div>
|
||||||
@@ -456,9 +455,9 @@ function PMA_normalOperations()
|
|||||||
* @return boolean always true
|
* @return boolean always true
|
||||||
*
|
*
|
||||||
* @global string the current language
|
* @global string the current language
|
||||||
|
* @global string the current charset for MySQL
|
||||||
* @global integer the server to use (refers to the number in the
|
* @global integer the server to use (refers to the number in the
|
||||||
* configuration file)
|
* configuration file)
|
||||||
* @global string the current charset for MySQL
|
|
||||||
* @global string the host name to check grants for
|
* @global string the host name to check grants for
|
||||||
* @global string the username to check grants for
|
* @global string the username to check grants for
|
||||||
* @global string the database to check grants for
|
* @global string the database to check grants for
|
||||||
@@ -468,7 +467,7 @@ function PMA_normalOperations()
|
|||||||
*/
|
*/
|
||||||
function PMA_grantOperations($grants)
|
function PMA_grantOperations($grants)
|
||||||
{
|
{
|
||||||
global $lang, $server, $convcharset, $host, $pma_user;
|
global $lang, $convcharset, $server, $host, $pma_user;
|
||||||
global $dbgrant, $tablegrant, $newdb;
|
global $dbgrant, $tablegrant, $newdb;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -476,7 +475,7 @@ function PMA_grantOperations($grants)
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
<div style="margin-bottom: 10px">
|
<div style="margin-bottom: 10px">
|
||||||
<a href="user_details.php3?lang=<?php echo $lang; ?>&server=<?php echo $server; ?>&db=mysql&table=user&convcharset=<?php echo $convcharset; ?>">
|
<a href="user_details.php3?lang=<?php echo $lang; ?>&convcharset=<?php echo $convcharset; ?>&server=<?php echo $server; ?>&db=mysql&table=user">
|
||||||
<?php echo $GLOBALS['strBack']; ?></a>
|
<?php echo $GLOBALS['strBack']; ?></a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -653,15 +652,15 @@ function PMA_grantOperations($grants)
|
|||||||
* @return boolean always true
|
* @return boolean always true
|
||||||
*
|
*
|
||||||
* @global string the current language
|
* @global string the current language
|
||||||
|
* @global string the current charset for MySQL
|
||||||
* @global integer the server to use (refers to the number in the
|
* @global integer the server to use (refers to the number in the
|
||||||
* configuration file)
|
* configuration file)
|
||||||
* @global string the current charset for MySQL
|
|
||||||
*
|
*
|
||||||
* @see PMA_tablePrivileges()
|
* @see PMA_tablePrivileges()
|
||||||
*/
|
*/
|
||||||
function PMA_editOperations($host, $user)
|
function PMA_editOperations($host, $user)
|
||||||
{
|
{
|
||||||
global $lang, $server, $convcharset;
|
global $lang, $convcharset, $server;
|
||||||
|
|
||||||
$result = PMA_mysql_query('SELECT * FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($user) . '\' AND Host = \'' . PMA_sqlAddslashes($host) . '\'');
|
$result = PMA_mysql_query('SELECT * FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($user) . '\' AND Host = \'' . PMA_sqlAddslashes($host) . '\'');
|
||||||
$rows = ($result) ? @mysql_num_rows($result) : 0;
|
$rows = ($result) ? @mysql_num_rows($result) : 0;
|
||||||
@@ -677,7 +676,7 @@ function PMA_editOperations($host, $user)
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
<div style="margin-bottom: 10px">
|
<div style="margin-bottom: 10px">
|
||||||
<a href="user_details.php3?lang=<?php echo $lang; ?>&server=<?php echo $server; ?>&db=mysql&table=user&convcharset=<?php echo $convcharset; ?>">
|
<a href="user_details.php3?lang=<?php echo $lang; ?>&convcharset=<?php echo $convcharset; ?>&server=<?php echo $server; ?>&db=mysql&table=user">
|
||||||
<?php echo $GLOBALS['strBack']; ?></a>
|
<?php echo $GLOBALS['strBack']; ?></a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -784,13 +783,13 @@ function PMA_editOperations($host, $user)
|
|||||||
* @return boolean always true
|
* @return boolean always true
|
||||||
*
|
*
|
||||||
* @global string the current language
|
* @global string the current language
|
||||||
|
* @global string the current charset for MySQL
|
||||||
* @global integer the server to use (refers to the number in the
|
* @global integer the server to use (refers to the number in the
|
||||||
* configuration file)
|
* configuration file)
|
||||||
* @global string the current charset for MySQL
|
|
||||||
*/
|
*/
|
||||||
function PMA_tableUsers($host = FALSE, $user = FALSE)
|
function PMA_tableUsers($host = FALSE, $user = FALSE)
|
||||||
{
|
{
|
||||||
global $lang, $server, $convcharset;
|
global $lang, $convcharset, $server;
|
||||||
|
|
||||||
$local_query = 'SELECT * FROM mysql.user ';
|
$local_query = 'SELECT * FROM mysql.user ';
|
||||||
if ($host || $user) {
|
if ($host || $user) {
|
||||||
@@ -873,16 +872,14 @@ function PMA_tableUsers($host = FALSE, $user = FALSE)
|
|||||||
$query = 'lang=' . $lang . '&server=' . $server . '&db=mysql&table=user&convcharset=' . $convcharset;
|
$query = 'lang=' . $lang . '&server=' . $server . '&db=mysql&table=user&convcharset=' . $convcharset;
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
$edit_url = 'user_details.php3'
|
$edit_url = 'user_details.php3'
|
||||||
. '?lang=' . $lang . '&server=' . $server
|
. '?lang=' . $lang . '&convcharset=' . $convcharset . '&server=' . $server
|
||||||
. '&convcharset=' . $convcharset
|
|
||||||
. '&edit=1&host=' . urlencode($row['Host']) . '&pma_user=' . urlencode($row['User']);
|
. '&edit=1&host=' . urlencode($row['Host']) . '&pma_user=' . urlencode($row['User']);
|
||||||
}
|
}
|
||||||
$delete_url = 'user_details.php3'
|
$delete_url = 'user_details.php3'
|
||||||
. '?' . $query
|
. '?' . $query
|
||||||
. '&delete=1&confirm=1&delete_host=' . urlencode($row['Host']) . '&delete_user=' . urlencode($row['User']);
|
. '&delete=1&confirm=1&delete_host=' . urlencode($row['Host']) . '&delete_user=' . urlencode($row['User']);
|
||||||
$check_url = 'user_details.php3'
|
$check_url = 'user_details.php3'
|
||||||
. '?lang=' . $lang . '&server=' . $server
|
. '?lang=' . $lang . '&convcharset=' . $convcharset . '&server=' . $server
|
||||||
. '&convcharset=' . $convcharset
|
|
||||||
. '&grants=1&host=' . urlencode($row['Host']) . '&pma_user=' . urlencode($row['User']);
|
. '&grants=1&host=' . urlencode($row['Host']) . '&pma_user=' . urlencode($row['User']);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -949,12 +946,12 @@ function PMA_tableUsers($host = FALSE, $user = FALSE)
|
|||||||
* @param string ... the username to delete
|
* @param string ... the username to delete
|
||||||
*
|
*
|
||||||
* @global string the current language
|
* @global string the current language
|
||||||
|
* @global string the current charset for MySQL
|
||||||
* @global integer the server to use (refers to the number in the
|
* @global integer the server to use (refers to the number in the
|
||||||
* configuration file)
|
* configuration file)
|
||||||
* @global string the current charset for MySQL
|
|
||||||
*/
|
*/
|
||||||
function PMA_confirm($the_host, $the_user) {
|
function PMA_confirm($the_host, $the_user) {
|
||||||
global $lang, $server, $convcharset;
|
global $lang, $convcharset, $server;
|
||||||
|
|
||||||
if (get_magic_quotes_gpc() == 1) {
|
if (get_magic_quotes_gpc() == 1) {
|
||||||
$the_host = stripslashes($the_host);
|
$the_host = stripslashes($the_host);
|
||||||
@@ -1472,7 +1469,7 @@ else if (isset($check) && $check) {
|
|||||||
?>
|
?>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="user_details.php3?lang=<?php echo $lang;?>&server=<?php echo $server; ?>&db=mysql&table=user&convcharset=<?php echo $convcharset; ?>">
|
<a href="user_details.php3?lang=<?php echo $lang;?>&convcharset=<?php echo $convcharset; ?>&server=<?php echo $server; ?>&db=mysql&table=user">
|
||||||
<?php echo $strBack; ?></a>
|
<?php echo $strBack; ?></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -49,9 +49,9 @@ if (isset($nopass)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Defines the url to return to in case of error in the sql statement
|
// Defines the url to return to in case of error in the sql statement
|
||||||
$common_url_query = 'lang=' . $lang
|
$common_url_query = 'lang=' . $lang
|
||||||
. '&server=' . $server
|
. '&convcharset=' . $convcharset
|
||||||
. '&convcharset=' . $convcharset;
|
. '&server=' . $server;
|
||||||
|
|
||||||
$err_url = 'user_password.php3?' . $common_url_query;
|
$err_url = 'user_password.php3?' . $common_url_query;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user