Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michal Čihař 2012-04-25 20:25:37 +02:00
commit d507c1d749
26 changed files with 226 additions and 172 deletions

View File

@ -16,8 +16,7 @@ require_once 'libraries/plugin_interface.lib.php';
* Sets globals from all $_POST (in export.php only)
* Would it not be tiresome to list all export-plugin options here?
*/
foreach ($_POST as $one_post_param => $one_post_value)
{
foreach ($_POST as $one_post_param => $one_post_value) {
$GLOBALS[$one_post_param] = $one_post_value;
}

View File

@ -417,22 +417,22 @@ class PMA_Config
$link = 'https://api.github.com/repos/phpmyadmin/phpmyadmin/git/commits/' . $hash;
$is_found = $this->checkHTTP($link, !$commit);
switch($is_found) {
case false:
$is_remote_commit = false;
$_SESSION['PMA_VERSION_REMOTECOMMIT_' . $hash] = false;
break;
case null:
// no remote link for now, but don't cache this as Github is down
$is_remote_commit = false;
break;
default:
$is_remote_commit = true;
$_SESSION['PMA_VERSION_REMOTECOMMIT_' . $hash] = true;
if ($commit === false) {
// if no local commit data, try loading from Github
$commit_json = json_decode($is_found);
}
break;
case false:
$is_remote_commit = false;
$_SESSION['PMA_VERSION_REMOTECOMMIT_' . $hash] = false;
break;
case null:
// no remote link for now, but don't cache this as Github is down
$is_remote_commit = false;
break;
default:
$is_remote_commit = true;
$_SESSION['PMA_VERSION_REMOTECOMMIT_' . $hash] = true;
if ($commit === false) {
// if no local commit data, try loading from Github
$commit_json = json_decode($is_found);
}
break;
}
}
@ -445,18 +445,18 @@ class PMA_Config
$link = 'https://api.github.com/repos/phpmyadmin/phpmyadmin/git/trees/' . $branch;
$is_found = $this->checkHTTP($link);
switch($is_found) {
case true:
$is_remote_branch = true;
$_SESSION['PMA_VERSION_REMOTEBRANCH_' . $hash] = true;
break;
case false:
$is_remote_branch = false;
$_SESSION['PMA_VERSION_REMOTEBRANCH_' . $hash] = false;
break;
case null:
// no remote link for now, but don't cache this as Github is down
$is_remote_branch = false;
break;
case true:
$is_remote_branch = true;
$_SESSION['PMA_VERSION_REMOTEBRANCH_' . $hash] = true;
break;
case false:
$is_remote_branch = false;
$_SESSION['PMA_VERSION_REMOTEBRANCH_' . $hash] = false;
break;
case null:
// no remote link for now, but don't cache this as Github is down
$is_remote_branch = false;
break;
}
}
}
@ -469,22 +469,19 @@ class PMA_Config
$dataline = array_shift($commit);
$datalinearr = explode(' ', $dataline, 2);
$linetype = $datalinearr[0];
if (in_array($linetype, array('author', 'committer')))
{
if (in_array($linetype, array('author', 'committer'))) {
$user = $datalinearr[1];
preg_match('/([^<]+)<([^>]+)> ([0-9]+)( [^ ]+)?/', $user, $user);
$user2 = array(
'name' => trim($user[1]),
'email' => trim($user[2]),
'date' => date('Y-m-d H:i:s', $user[3]));
if (isset($user[4]))
{
if (isset($user[4])) {
$user2['date'] .= $user[4];
}
$$linetype = $user2;
}
}
while ($dataline != '');
} while ($dataline != '');
$message = trim(implode(' ', $commit));
} elseif (isset($commit_json)) {
@ -1185,7 +1182,7 @@ class PMA_Config
}
// Reconstruct URL using parsed parts
if($this->get('SSLPort')) {
if ($this->get('SSLPort')) {
$port_number = $this->get('SSLPort');
} else {
$port_number = 443;

View File

@ -189,7 +189,8 @@ class PMA_Table
// use cached data or load information with SHOW command
if (isset(PMA_Table::$cache[$db][$table])
|| $GLOBALS['cfg']['Server']['DisableIS']) {
|| $GLOBALS['cfg']['Server']['DisableIS']
) {
$type = PMA_Table::sGetStatusInfo($db, $table, 'TABLE_TYPE');
return $type == 'VIEW';
}
@ -293,7 +294,8 @@ class PMA_Table
// if called static, with parameters
if (! empty($db) && ! empty($table)) {
$engine = PMA_Table::sGetStatusInfo(
$db, $table, 'ENGINE', null, true);
$db, $table, 'ENGINE', null, true
);
}
return (! empty($engine) && ((strtoupper($engine) == 'MERGE') || (strtoupper($engine) == 'MRG_MYISAM')));
@ -381,9 +383,8 @@ class PMA_Table
static function generateFieldSpec($name, $type, $length = '', $attribute = '',
$collation = '', $null = false, $default_type = 'USER_DEFINED',
$default_value = '', $extra = '', $comment = '',
&$field_primary, $index, $default_orig, $move_to)
{
&$field_primary, $index, $default_orig, $move_to
) {
$is_timestamp = strpos(strtoupper($type), 'TIMESTAMP') !== false;
$query = PMA_backquote($name) . ' ' . $type;
@ -606,8 +607,8 @@ class PMA_Table
*/
static public function generateAlter($oldcol, $newcol, $type, $length,
$attribute, $collation, $null, $default_type, $default_value,
$extra, $comment = '', &$field_primary, $index, $default_orig, $move_to)
{
$extra, $comment = '', &$field_primary, $index, $default_orig, $move_to
) {
return PMA_backquote($oldcol) . ' '
. PMA_Table::generateFieldSpec(
$newcol, $type, $length, $attribute,
@ -1153,6 +1154,7 @@ class PMA_Table
* @param string $new_name new table name
* @param string $new_db new database name
* @param bool $is_view is this for a VIEW rename?
*
* @todo remove the $is_view parameter (also in callers)
*
* @return bool success

View File

@ -53,12 +53,12 @@ function Swekey_auth_check()
if (! isset($_SESSION['SWEKEY']['CONF_DEBUG'])) {
$_SESSION['SWEKEY']['CONF_DEBUG'] = false;
}
}
}
// check if a web key has been authenticated
if ($_SESSION['SWEKEY']['ENABLED']) {
if (empty($_SESSION['SWEKEY']['AUTHENTICATED_SWEKEY'])) {
return false;
return false;
}
}
@ -197,17 +197,17 @@ function Swekey_auth_error()
if (! isset($swekey_id)) {
?>
<script>
if (key.length != 32) {
window.location.search="?swekey_id=" + key + "&token=<?php echo $_SESSION[' PMA_token ']; ?>";
} else {
var url = "" + window.location;
if (url.indexOf("?") > 0) {
url = url.substr(0, url.indexOf("?"));
if (key.length != 32) {
window.location.search="?swekey_id=" + key + "&token=<?php echo $_SESSION[' PMA_token ']; ?>";
} else {
var url = "" + window.location;
if (url.indexOf("?") > 0) {
url = url.substr(0, url.indexOf("?"));
}
Swekey_SetUnplugUrl(key, "pma_login", url + "?session_to_unset=<?php echo session_id();?>&token=<?php echo $_SESSION[' PMA_token ']; ?>");
var otp = Swekey_GetOtp(key, <?php echo '"'.$_SESSION['SWEKEY']['RND_TOKEN'].'"';?>);
window.location.search="?swekey_id=" + key + "&swekey_otp=" + otp + "&token=<?php echo $_SESSION[' PMA_token ']; ?>";
}
Swekey_SetUnplugUrl(key, "pma_login", url + "?session_to_unset=<?php echo session_id();?>&token=<?php echo $_SESSION[' PMA_token ']; ?>");
var otp = Swekey_GetOtp(key, <?php echo '"'.$_SESSION['SWEKEY']['RND_TOKEN'].'"';?>);
window.location.search="?swekey_id=" + key + "&swekey_otp=" + otp + "&token=<?php echo $_SESSION[' PMA_token ']; ?>";
}
</script>
<?php
return __('Authenticating...');
@ -237,7 +237,7 @@ function Swekey_login($input_name, $input_go)
if (empty($_SESSION['SWEKEY']['FORCE_USER'])) {
echo 'var user = null;';
} else {
echo 'var user = "'.$_SESSION['SWEKEY']['FORCE_USER'].'";';
echo 'var user = "'.$_SESSION['SWEKEY']['FORCE_USER'].'";';
}
?>

View File

@ -18,25 +18,25 @@
/**
* Errors codes
*/
define ("SWEKEY_ERR_INVALID_DEV_STATUS", 901); // The satus of the device is not SWEKEY_STATUS_OK
define ("SWEKEY_ERR_INTERNAL", 902); // Should never occurd
define ("SWEKEY_ERR_OUTDATED_RND_TOKEN", 910); // You random token is too old
define ("SWEKEY_ERR_INVALID_OTP", 911); // The otp was not correct
define("SWEKEY_ERR_INVALID_DEV_STATUS", 901); // The satus of the device is not SWEKEY_STATUS_OK
define("SWEKEY_ERR_INTERNAL", 902); // Should never occurd
define("SWEKEY_ERR_OUTDATED_RND_TOKEN", 910); // You random token is too old
define("SWEKEY_ERR_INVALID_OTP", 911); // The otp was not correct
/**
* Those errors are considered as an attack and your site will be blacklisted during one minute
* if you receive one of those errors
*/
define ("SWEKEY_ERR_BADLY_ENCODED_REQUEST", 920);
define ("SWEKEY_ERR_INVALID_RND_TOKEN", 921);
define ("SWEKEY_ERR_DEV_NOT_FOUND", 922);
define("SWEKEY_ERR_BADLY_ENCODED_REQUEST", 920);
define("SWEKEY_ERR_INVALID_RND_TOKEN", 921);
define("SWEKEY_ERR_DEV_NOT_FOUND", 922);
/**
* Default values for configuration.
*/
define ('SWEKEY_DEFAULT_CHECK_SERVER', 'https://auth-check.musbe.net');
define ('SWEKEY_DEFAULT_RND_SERVER', 'https://auth-rnd-gen.musbe.net');
define ('SWEKEY_DEFAULT_STATUS_SERVER', 'https://auth-status.musbe.net');
define('SWEKEY_DEFAULT_CHECK_SERVER', 'https://auth-check.musbe.net');
define('SWEKEY_DEFAULT_RND_SERVER', 'https://auth-rnd-gen.musbe.net');
define('SWEKEY_DEFAULT_STATUS_SERVER', 'https://auth-status.musbe.net');
/**
* The last error of an operation is alway put in this global var
@ -54,22 +54,26 @@ $gSwekeyLastResult = "<not set>";
*/
global $gSwekeyCheckServer;
if (! isset($gSwekeyCheckServer))
if (! isset($gSwekeyCheckServer)) {
$gSwekeyCheckServer = SWEKEY_DEFAULT_CHECK_SERVER;
}
global $gSwekeyRndTokenServer;
if (! isset($gSwekeyRndTokenServer))
if (! isset($gSwekeyRndTokenServer)) {
$gSwekeyRndTokenServer = SWEKEY_DEFAULT_RND_SERVER;
}
global $gSwekeyStatusServer;
if (! isset($gSwekeyStatusServer))
if (! isset($gSwekeyStatusServer)) {
$gSwekeyStatusServer = SWEKEY_DEFAULT_STATUS_SERVER;
}
global $gSwekeyCA;
global $gSwekeyTokenCacheEnabled;
if (! isset($gSwekeyTokenCacheEnabled))
if (! isset($gSwekeyTokenCacheEnabled)) {
$gSwekeyTokenCacheEnabled = true;
}
/**
* Change the address of the Check server.
@ -81,10 +85,11 @@ if (! isset($gSwekeyTokenCacheEnabled))
function Swekey_SetCheckServer($server)
{
global $gSwekeyCheckServer;
if (empty($server))
if (empty($server)) {
$gSwekeyCheckServer = SWEKEY_DEFAULT_CHECK_SERVER;
else
} else {
$gSwekeyCheckServer = $server;
}
}
/**
@ -97,10 +102,11 @@ function Swekey_SetCheckServer($server)
function Swekey_SetRndTokenServer($server)
{
global $gSwekeyRndTokenServer;
if (empty($server))
if (empty($server)) {
$gSwekeyRndTokenServer = SWEKEY_DEFAULT_RND_SERVER;
else
} else {
$gSwekeyRndTokenServer = $server;
}
}
/**
@ -113,10 +119,11 @@ function Swekey_SetRndTokenServer($server)
function Swekey_SetStatusServer($server)
{
global $gSwekeyStatusServer;
if (empty($server))
if (empty($server)) {
$gSwekeyStatusServer = SWEKEY_DEFAULT_STATUS_SERVER;
else
} else {
$gSwekeyStatusServer = $server;
}
}
/**
@ -128,7 +135,7 @@ function Swekey_SetStatusServer($server)
function Swekey_SetCAFile($cafile)
{
global $gSwekeyCA;
$gSwekeyCA = $cafile;
$gSwekeyCA = $cafile;
}
/**
@ -271,8 +278,7 @@ function Swekey_HttpGet($url, &$response_code)
$res = $reply->getBody();
$info = $r->getResponseInfo();
$response_code = $info['response_code'];
if ($response_code != 200)
{
if ($response_code != 200) {
$gSwekeyLastError = $response_code;
error_log("SWEKEY_ERROR:Error ".$gSwekeyLastError." getting ".$url);
return "";
@ -298,8 +304,8 @@ function Swekey_HttpGet($url, &$response_code)
$res = @file_get_contents($url);
$response_code = substr($http_response_header[0], 9, 3); //HTTP/1.0
if ($response_code == 200) {
$gSwekeyLastResult = $res;
return $res;
$gSwekeyLastResult = $res;
return $res;
}
$gSwekeyLastError = $response_code;
@ -389,7 +395,7 @@ function Swekey_GetFastHalfRndToken()
}
}
return $res."00000000000000000000000000000000";
return $res."00000000000000000000000000000000";
}
/**
@ -403,9 +409,9 @@ function Swekey_GetFastHalfRndToken()
function Swekey_GetFastRndToken()
{
$res = Swekey_GetFastHalfRndToken();
if (strlen($res) == 64)
if (strlen($res) == 64) {
return substr($res, 0, 32).strtoupper(md5("Musbe Authentication Key" + mt_rand() + date(DATE_ATOM)));
}
return "";
}
@ -430,22 +436,22 @@ function Swekey_CheckOtp($id, $rt, $otp)
* Values that are associated with a key.
* The following values can be returned by the Swekey_GetStatus() function
*/
define ("SWEKEY_STATUS_OK", 0);
define ("SWEKEY_STATUS_NOT_FOUND", 1); // The key does not exist in the db
define ("SWEKEY_STATUS_INACTIVE", 2); // The key has never been activated
define ("SWEKEY_STATUS_LOST", 3); // The user has lost his key
define ("SWEKEY_STATUS_STOLEN", 4); // The key was stolen
define ("SWEKEY_STATUS_FEE_DUE", 5); // The annual fee was not paid
define ("SWEKEY_STATUS_OBSOLETE", 6); // The hardware is no longer supported
define ("SWEKEY_STATUS_UNKOWN", 201); // We could not connect to the authentication server
define("SWEKEY_STATUS_OK", 0);
define("SWEKEY_STATUS_NOT_FOUND", 1); // The key does not exist in the db
define("SWEKEY_STATUS_INACTIVE", 2); // The key has never been activated
define("SWEKEY_STATUS_LOST", 3); // The user has lost his key
define("SWEKEY_STATUS_STOLEN", 4); // The key was stolen
define("SWEKEY_STATUS_FEE_DUE", 5); // The annual fee was not paid
define("SWEKEY_STATUS_OBSOLETE", 6); // The hardware is no longer supported
define("SWEKEY_STATUS_UNKOWN", 201); // We could not connect to the authentication server
/**
* Values that are associated with a key.
* The Javascript Api can also return the following values
*/
define ("SWEKEY_STATUS_REPLACED", 100); // This key has been replaced by a backup key
define ("SWEKEY_STATUS_BACKUP_KEY", 101); // This key is a backup key that is not activated yet
define ("SWEKEY_STATUS_NOTPLUGGED", 200); // This key is not plugged in the computer
define("SWEKEY_STATUS_REPLACED", 100); // This key has been replaced by a backup key
define("SWEKEY_STATUS_BACKUP_KEY", 101); // This key is a backup key that is not activated yet
define("SWEKEY_STATUS_NOTPLUGGED", 200); // This key is not plugged in the computer
/**
@ -459,17 +465,28 @@ function Swekey_GetStatusStr($status)
{
switch($status)
{
case SWEKEY_STATUS_OK : return 'OK';
case SWEKEY_STATUS_NOT_FOUND : return 'Key does not exist in the db';
case SWEKEY_STATUS_INACTIVE : return 'Key not activated';
case SWEKEY_STATUS_LOST : return 'Key was lost';
case SWEKEY_STATUS_STOLEN : return 'Key was stolen';
case SWEKEY_STATUS_FEE_DUE : return 'The annual fee was not paid';
case SWEKEY_STATUS_OBSOLETE : return 'Key no longer supported';
case SWEKEY_STATUS_REPLACED : return 'This key has been replaced by a backup key';
case SWEKEY_STATUS_BACKUP_KEY : return 'This key is a backup key that is not activated yet';
case SWEKEY_STATUS_NOTPLUGGED : return 'This key is not plugged in the computer';
case SWEKEY_STATUS_UNKOWN : return 'Unknow Status, could not connect to the authentication server';
case SWEKEY_STATUS_OK :
return 'OK';
case SWEKEY_STATUS_NOT_FOUND :
return 'Key does not exist in the db';
case SWEKEY_STATUS_INACTIVE :
return 'Key not activated';
case SWEKEY_STATUS_LOST :
return 'Key was lost';
case SWEKEY_STATUS_STOLEN :
return 'Key was stolen';
case SWEKEY_STATUS_FEE_DUE :
return 'The annual fee was not paid';
case SWEKEY_STATUS_OBSOLETE :
return 'Key no longer supported';
case SWEKEY_STATUS_REPLACED :
return 'This key has been replaced by a backup key';
case SWEKEY_STATUS_BACKUP_KEY :
return 'This key is a backup key that is not activated yet';
case SWEKEY_STATUS_NOTPLUGGED :
return 'This key is not plugged in the computer';
case SWEKEY_STATUS_UNKOWN :
return 'Unknow Status, could not connect to the authentication server';
}
return 'unknown status '.$status;
}
@ -486,9 +503,9 @@ function Swekey_GetStatus($id)
{
global $gSwekeyStatusServer;
$res = Swekey_HttpGet($gSwekeyStatusServer.'/GET-STATUS/'.$id, $response_code);
if ($response_code == 200)
if ($response_code == 200) {
return intval($res);
}
return SWEKEY_STATUS_UNKOWN;
}

View File

@ -3318,8 +3318,7 @@ function PMA_browseUploadFile($max_upload_size)
{
if ($GLOBALS['is_upload'] && !empty($GLOBALS['cfg']['UploadDir'])) {
echo '<label for="radio_import_file">';
}
else {
} else {
echo '<label for="input_import_file">';
}
echo __("Browse your computer:") . '</label>';
@ -3345,7 +3344,8 @@ function PMA_selectUploadFile($import_list, $uploaddir)
echo '<label for="radio_local_import_file">'
. sprintf(
__("Select from the web server upload directory <b>%s</b>:"),
htmlspecialchars(PMA_userDir($uploaddir)))
htmlspecialchars(PMA_userDir($uploaddir))
)
. '</label>';
$extensions = '';
foreach ($import_list as $key => $val) {

View File

@ -738,16 +738,16 @@ function PMA_includeJS($url, $ie_conditional = false)
if ($ie_conditional !== false) {
if ($ie_conditional === true) {
$include .= '<!--[if IE]>' . "\n ";
}
else {
} else {
$include .= '<!--[if IE ' . $ie_conditional . ']>' . "\n ";
}
}
if (strpos($url, '?') === false) {
$include .= '<script src="js/' . $url . '?ts=' . filemtime('js/' . $url) . '" type="text/javascript"></script>' . "\n";
}
else {
$include .= '<script src="js/' . $url . '" type="text/javascript"></script>' . "\n";
$include .= '<script src="js/' . $url . '?ts=' . filemtime('js/' . $url)
. '" type="text/javascript"></script>' . "\n";
} else {
$include .= '<script src="js/' . $url
. '" type="text/javascript"></script>' . "\n";
}
if ($ie_conditional !== false) {
$include .= '<![endif]-->' . "\n";

View File

@ -31,7 +31,7 @@ mysqli_report(MYSQLI_REPORT_OFF);
* some older mysql client libs are missing these constants ...
*/
if (! defined('MYSQLI_BINARY_FLAG')) {
define('MYSQLI_BINARY_FLAG', 128);
define('MYSQLI_BINARY_FLAG', 128);
}
/**
@ -61,6 +61,7 @@ if (! defined('MYSQLI_TYPE_VARCHAR')) {
* @param string $server_socket
* @param int $client_flags
* @param bool $persistent
*
* @return bool
*/
function PMA_DBI_real_connect($link, $host, $user, $password, $dbname, $server_port, $server_socket, $client_flags = null, $persistent = false)
@ -105,6 +106,7 @@ function PMA_DBI_real_connect($link, $host, $user, $password, $dbname, $server_p
* @param bool $is_controluser
* @param array $server host/port/socket
* @param bool $auxiliary_connection (when true, don't go back to login if connection fails)
*
* @return mixed false on error or a mysqli object on success
*/
function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false)
@ -213,6 +215,7 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu
*
* @param string $dbname database name to select
* @param mysqli $link the mysqli object
*
* @return boolean
*/
function PMA_DBI_select_db($dbname, $link = null)
@ -233,6 +236,7 @@ function PMA_DBI_select_db($dbname, $link = null)
* @param string $query query to execute
* @param mysqli $link mysqli object
* @param int $options
*
* @return mysqli_result|bool
*/
function PMA_DBI_real_query($query, $link, $options)
@ -252,6 +256,7 @@ function PMA_DBI_real_query($query, $link, $options)
* returns array of rows with associative and numeric keys from $result
*
* @param mysqli_result $result result set identifier
*
* @return array
*/
function PMA_DBI_fetch_array($result)
@ -263,6 +268,7 @@ function PMA_DBI_fetch_array($result)
* returns array of rows with associative keys from $result
*
* @param mysqli_result $result result set identifier
*
* @return array
*/
function PMA_DBI_fetch_assoc($result)
@ -274,6 +280,7 @@ function PMA_DBI_fetch_assoc($result)
* returns array of rows with numeric keys from $result
*
* @param mysqli_result $result result set identifier
*
* @return array
*/
function PMA_DBI_fetch_row($result)
@ -286,6 +293,7 @@ function PMA_DBI_fetch_row($result)
*
* @param $result
* @param $offset
*
* @return bool true on success, false on failure
*/
function PMA_DBI_data_seek($result, $offset)
@ -297,6 +305,8 @@ function PMA_DBI_data_seek($result, $offset)
* Frees memory associated with the result
*
* @param mysqli_result $result
*
* @return void
*/
function PMA_DBI_free_result($result)
{
@ -309,6 +319,7 @@ function PMA_DBI_free_result($result)
* Check if there are any more query results from a multi query
*
* @param mysqli $link the mysqli object
*
* @return bool true or false
*/
function PMA_DBI_more_results($link = null)
@ -327,6 +338,7 @@ function PMA_DBI_more_results($link = null)
* Prepare next result from multi_query
*
* @param mysqli $link the mysqli object
*
* @return bool true or false
*/
function PMA_DBI_next_result($link = null)
@ -345,6 +357,7 @@ function PMA_DBI_next_result($link = null)
* Returns a string representing the type of connection used
*
* @param resource $link mysql link
*
* @return string type of connection used
*/
function PMA_DBI_get_host_info($link = null)
@ -363,6 +376,7 @@ function PMA_DBI_get_host_info($link = null)
* Returns the version of the MySQL protocol used
*
* @param resource $link mysql link
*
* @return integer version of the MySQL protocol used
*/
function PMA_DBI_get_proto_info($link = null)
@ -391,6 +405,7 @@ function PMA_DBI_get_client_info()
* returns last error message or false if no errors occured
*
* @param resource $link mysql link
*
* @return string|bool $error or false
*/
function PMA_DBI_getError($link = null)
@ -431,6 +446,7 @@ function PMA_DBI_getError($link = null)
* returns the number of rows returned by last query
*
* @param mysqli_result $result result set identifier
*
* @return string|int
*/
function PMA_DBI_num_rows($result)
@ -447,6 +463,7 @@ function PMA_DBI_num_rows($result)
* returns last inserted auto_increment id for given $link or $GLOBALS['userlink']
*
* @param mysqli $link the mysqli object
*
* @return string|int
*/
function PMA_DBI_insert_id($link = null)
@ -472,6 +489,7 @@ function PMA_DBI_insert_id($link = null)
*
* @param mysqli $link the mysqli object
* @param boolean $get_from_cache
*
* @return string|int
*/
function PMA_DBI_affected_rows($link = null, $get_from_cache = true)
@ -494,6 +512,7 @@ function PMA_DBI_affected_rows($link = null, $get_from_cache = true)
* returns metainfo for fields in $result
*
* @param mysqli_result $result result set identifier
*
* @return array meta info for fields in $result
*/
function PMA_DBI_get_fields_meta($result)
@ -574,6 +593,7 @@ function PMA_DBI_get_fields_meta($result)
* return number of fields in given $result
*
* @param mysqli_result $result result set identifier
*
* @return int field count
*/
function PMA_DBI_num_fields($result)
@ -586,6 +606,7 @@ function PMA_DBI_num_fields($result)
*
* @param mysqli_result $result result set identifier
* @param int $i field
*
* @return int length of field
*/
function PMA_DBI_field_len($result, $i)
@ -598,6 +619,7 @@ function PMA_DBI_field_len($result, $i)
*
* @param mysqli_result $result result set identifier
* @param int $i field
*
* @return string name of $i. field in $result
*/
function PMA_DBI_field_name($result, $i)
@ -610,6 +632,7 @@ function PMA_DBI_field_name($result, $i)
*
* @param mysqli_result $result result set identifier
* @param int $i field
*
* @return string field flags
*/
function PMA_DBI_field_flags($result, $i)

View File

@ -935,10 +935,8 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
$is_in_sort = false;
$sort_name = str_replace('`', '', $sort_tbl) . $name_to_use_in_sort;
if (
$sort_name == str_replace('`', '', $new_sort_expression_nodirection)
||
$sort_name == str_replace('`', '', $sort_expression_nodirection)
if ($sort_name == str_replace('`', '', $new_sort_expression_nodirection)
|| $sort_name == str_replace('`', '', $sort_expression_nodirection)
) {
$is_in_sort = true;
}

View File

@ -400,7 +400,7 @@ if (isset($plugin_list)) {
$triggers = PMA_DBI_get_triggers($db, $table);
foreach($triggers as $trigger) {
foreach ($triggers as $trigger) {
$dump .= '<tr class="print-category">';
$dump .= '<td class="print">' . htmlspecialchars($trigger['name']) . '</td>';
$dump .= '<td class="print">' . htmlspecialchars($trigger['action_timing']) . '</td>';

View File

@ -513,7 +513,7 @@ if (isset($plugin_list)) {
$triggers = PMA_DBI_get_triggers($db, $table);
foreach($triggers as $trigger) {
foreach ($triggers as $trigger) {
$GLOBALS['odt_buffer'] .= '<table:table-row>';
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
. '<text:p>' . htmlspecialchars($trigger['name']) . '</text:p>'

View File

@ -397,7 +397,7 @@ if (isset($plugin_list)) {
$triggers = PMA_DBI_get_triggers($db, $table);
foreach($triggers as $trigger) {
foreach ($triggers as $trigger) {
$dump .= '|' . $trigger['name'];
$dump .= '|' . $trigger['action_timing'];
$dump .= '|' . $trigger['event_manipulation'];

View File

@ -193,7 +193,9 @@ while (!($GLOBALS['finished'] && $i >= $len) && !$error && !$timeout_passed) {
}
// Was not the quote escaped?
$j = $pos - 1;
while ($buffer[$j] == '\\') $j--;
while ($buffer[$j] == '\\') {
$j--;
}
// Even count means it was not escaped
$endq = (((($pos - 1) - $j) % 2) == 0);
// Skip the string

View File

@ -251,11 +251,10 @@ if (!empty($submit_mult) && !empty($what)) {
$_url_params['table']= $table;
}
foreach ($selected as $idx => $sval) {
if ($what == 'row_delete'){
if ($what == 'row_delete') {
$_url_params['selected'][] = 'DELETE FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table)
. ' WHERE ' . urldecode($sval) . ' LIMIT 1;';
}
else {
} else {
$_url_params['selected'][] = $sval;
}
}
@ -506,11 +505,15 @@ if (!empty($submit_mult) && !empty($what)) {
include './sql.php';
} elseif (!$run_parts) {
PMA_DBI_select_db($db);
if(!isset($_REQUEST['fk_check']) && $query_type == 'drop_tbl') { // for disabling foreign key checks while dropping tables
// for disabling foreign key checks while dropping tables
if (! isset($_REQUEST['fk_check']) && $query_type == 'drop_tbl') {
PMA_DBI_query('SET FOREIGN_KEY_CHECKS = 0;');
}
$result = PMA_DBI_try_query($sql_query);
if(!isset($_REQUEST['fk_check']) && $query_type == 'drop_tbl' && $default_fk_check_value) {
if (! isset($_REQUEST['fk_check'])
&& $query_type == 'drop_tbl'
&& $default_fk_check_value
) {
PMA_DBI_query('SET FOREIGN_KEY_CHECKS = 1;');
}
if ($result && !empty($sql_query_views)) {

View File

@ -276,8 +276,9 @@ function PMA_replication_master_replicated_dbs($link = null)
$tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $link);
while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
if (PMA_is_system_schema($tmp_row[0]))
if (PMA_is_system_schema($tmp_row[0])) {
continue;
}
if (count($do_db) == 0) {
if (array_search($tmp_row[0], $ignore_db) !== false) {
continue;

View File

@ -55,7 +55,7 @@ function PMA_RTE_getList($type, $items)
$retval .= " <th>" . __('Returns') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n"; // see comment above
for($i = 0; $i < 7; $i++) {
for ($i = 0; $i < 7; $i++) {
$retval .= " <td></td>\n";
}
break;
@ -69,7 +69,7 @@ function PMA_RTE_getList($type, $items)
$retval .= " <th>" . __('Event') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n"; // see comment above
for($i = 0; $i < (empty($table) ? 7 : 6); $i++) {
for ($i = 0; $i < (empty($table) ? 7 : 6); $i++) {
$retval .= " <td></td>\n";
}
break;
@ -80,7 +80,7 @@ function PMA_RTE_getList($type, $items)
$retval .= " <th>" . __('Type') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n"; // see comment above
for($i = 0; $i < 6; $i++) {
for ($i = 0; $i < 6; $i++) {
$retval .= " <td></td>\n";
}
break;

View File

@ -130,9 +130,9 @@ class Linux
$mem['MemUsed'] = $mem['MemTotal'] - $mem['MemFree'] - $mem['Cached'] - $mem['Buffers'];
$mem['SwapUsed'] = $mem['SwapTotal'] - $mem['SwapFree'] - $mem['SwapCached'];
foreach ($mem as $idx=>$value)
foreach ($mem as $idx=>$value) {
$mem[$idx] = intval($value);
}
return $mem;
}
}

View File

@ -33,14 +33,16 @@ if (PMA_foreignkey_supported($type_T1) && PMA_foreignkey_supported($type_T2) &&
// improve: check all other requirements for InnoDB relations
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($T1) . ';');
$index_array1 = array(); // will be use to emphasis prim. keys in the table view
while ($row = PMA_DBI_fetch_assoc($result))
while ($row = PMA_DBI_fetch_assoc($result)) {
$index_array1[$row['Column_name']] = 1;
}
PMA_DBI_free_result($result);
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($T2) . ';');
$index_array2 = array(); // will be used to emphasis prim. keys in the table view
while ($row = PMA_DBI_fetch_assoc($result))
while ($row = PMA_DBI_fetch_assoc($result)) {
$index_array2[$row['Column_name']] = 1;
}
PMA_DBI_free_result($result);
if (! empty($index_array1[$F1]) && ! empty($index_array2[$F2])) {

View File

@ -121,12 +121,12 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') ==
<?php echo PMA_generate_common_hidden_inputs() . "\n"; ?>
<input type="hidden" name="json" value="<?php echo htmlspecialchars($json) ?>" />
<input type="hidden" name="fix_errors" value="1" />
<?php if (!empty($_POST['import_merge'])): ?>
<?php if (! empty($_POST['import_merge'])) { ?>
<input type="hidden" name="import_merge" value="1" />
<?php endif; ?>
<?php if ($return_url): ?>
<?php } ?>
<?php if ($return_url) { ?>
<input type="hidden" name="return_url" value="<?php echo htmlspecialchars($return_url) ?>" />
<?php endif; ?>
<?php } ?>
<p><?php echo __('Do you want to import remaining settings?') ?></p>
<input type="submit" name="submit_import" value="<?php echo __('Yes') ?>" />
<input type="submit" name="submit_ignore" value="<?php echo __('No') ?>" />

View File

@ -213,12 +213,14 @@ if ($databases_count > 0) {
}
foreach ($replication_types as $type) {
if ($type=="master")
$name = __('Master replication');
elseif ($type == "slave")
$name = __('Slave replication');
if (${"server_{$type}_status"})
echo ' <th>'. $name .'</th>' . "\n";
if ($type=="master") {
$name = __('Master replication');
} elseif ($type == "slave") {
$name = __('Slave replication');
}
if (${"server_{$type}_status"}) {
echo ' <th>'. $name .'</th>' . "\n";
}
}
if ($is_superuser && ! PMA_DRIZZLE) {

View File

@ -211,8 +211,8 @@ function PMA_wildcardEscapeForGrant($dbname, $tablename)
$db_and_table = '*.*';
} else {
if (strlen($tablename)) {
$db_and_table =
PMA_backquote(PMA_unescape_mysql_wildcards($dbname)) . '.'
$db_and_table
= PMA_backquote(PMA_unescape_mysql_wildcards($dbname)) . '.'
. PMA_backquote($tablename);
} else {
$db_and_table = PMA_backquote($dbname) . '.*';
@ -388,8 +388,8 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false)
unset($row1);
$users_grants = explode(',', $row['Table_priv']);
foreach ($av_grants as $current_grant) {
$row[$current_grant . '_priv'] =
in_array($current_grant, $users_grants) ? 'Y' : 'N';
$row[$current_grant . '_priv']
= in_array($current_grant, $users_grants) ? 'Y' : 'N';
}
unset($current_grant);
unset($av_grants);
@ -582,15 +582,17 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true)
$users_grants = explode(',', $row['Table_priv']);
foreach ($av_grants as $current_grant) {
$row[$current_grant . '_priv'] =
in_array($current_grant, $users_grants) ? 'Y' : 'N';
$row[$current_grant . '_priv']
= in_array($current_grant, $users_grants) ? 'Y' : 'N';
}
unset($row['Table_priv'], $current_grant, $av_grants, $users_grants);
// get collumns
$res = PMA_DBI_try_query('SHOW COLUMNS FROM '
$res = PMA_DBI_try_query(
'SHOW COLUMNS FROM '
. PMA_backquote(PMA_unescape_mysql_wildcards($db))
. '.' . PMA_backquote($table) . ';');
. '.' . PMA_backquote($table) . ';'
);
$columns = array();
if ($res) {
while ($row1 = PMA_DBI_fetch_row($res)) {

View File

@ -151,8 +151,9 @@ foreach ($serverVars as $name => $value) {
<td class="value"><?php echo formatVariable($name, $value); ?></td>
<td class="value"><?php
// To display variable documentation link
if (isset($VARIABLE_DOC_LINKS[$name]))
if (isset($VARIABLE_DOC_LINKS[$name])) {
echo PMA_showMySQLDocu($VARIABLE_DOC_LINKS[$name][1], $VARIABLE_DOC_LINKS[$name][1], false, $VARIABLE_DOC_LINKS[$name][2] . '_' . $VARIABLE_DOC_LINKS[$name][0]);
}
?></td>
<?php
if ($has_session_value) {
@ -177,9 +178,11 @@ function formatVariable($name, $value)
global $VARIABLE_DOC_LINKS;
if (is_numeric($value)) {
if (isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte')
if (isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte') {
return '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ', PMA_formatByteDown($value, 3, 3)).'</abbr>';
else return PMA_formatNumber($value, 0);
} else {
return PMA_formatNumber($value, 0);
}
}
return htmlspecialchars($value);
}

View File

@ -128,7 +128,7 @@ display_form_top(
);
?>
<div class="form">
<?php if ($cf->getServerCount() > 0): ?>
<?php if ($cf->getServerCount() > 0) { ?>
<table cellspacing="0" class="datatable" style="table-layout: fixed">
<tr>
<th>#</th>
@ -136,7 +136,7 @@ display_form_top(
<th><?php echo __('Authentication type') ?></th>
<th colspan="2">DSN</th>
</tr>
<?php foreach ($cf->getServers() as $id => $server): ?>
<?php foreach ($cf->getServers() as $id => $server) { ?>
<tr>
<td><?php echo $id ?></td>
<td><?php echo htmlspecialchars($cf->getServerName($id)) ?></td>
@ -149,9 +149,9 @@ display_form_top(
</small>
</td>
</tr>
<?php endforeach; ?>
<?php } ?>
</table>
<?php else: ?>
<?php } ?>
<table width="100%">
<tr>
<td>

View File

@ -304,9 +304,10 @@ echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params, '', 'topmenu2');
$tmp_geom_func = isset($geom_func[$i]) ? $geom_func[$i] : null;
$whereClause = PMA_tbl_search_getWhereClause($fields[$i], $names[$i], $types[$i], $collations[$i], $func_type, $unaryFlag, $tmp_geom_func);
if($whereClause)
if ($whereClause) {
$w[] = $whereClause;
} // end for
}
} // end while
if ($w) {
$sql_query .= ' WHERE ' . implode(' AND ', $w);
}

View File

@ -405,10 +405,11 @@ if (isset($_REQUEST['report']) && (isset($_REQUEST['delete_ddlog']) || isset($_R
if ($delete_id == (int)$delete_id) {
unset($data['ddlog'][$delete_id]);
if (PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], 'DDL', $data['ddlog']))
if (PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], 'DDL', $data['ddlog'])) {
$msg = PMA_Message::success(__('Tracking data definition successfully deleted'));
else
} else {
$msg = PMA_Message::rawError(__('Query error'));
}
$msg->display();
}
}
@ -422,10 +423,11 @@ if (isset($_REQUEST['report']) && (isset($_REQUEST['delete_ddlog']) || isset($_R
if ($delete_id == (int)$delete_id) {
unset($data['dmlog'][$delete_id]);
if (PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], 'DML', $data['dmlog']))
if (PMA_Tracker::changeTrackingData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version'], 'DML', $data['dmlog'])) {
$msg = PMA_Message::success(__('Tracking data manipulation successfully deleted'));
else
} else {
$msg = PMA_Message::rawError(__('Query error'));
}
$msg->display();
}
}

View File

@ -39,7 +39,7 @@ if (isset($_REQUEST['nopass'])) {
}
$change_password_message = PMA_setChangePasswordMsg();
$message = $change_password_message['msg'];
if(! $change_password_message['error']) {
if (! $change_password_message['error']) {
PMA_changePassword($password, $message, $change_password_message);
} else {
PMA_getChangePassMessage($change_password_message);