mirror of
https://github.com/vrana/adminer.git
synced 2025-08-18 20:31:19 +02:00
Trim trailing whitespace
This commit is contained in:
@@ -39,7 +39,7 @@ class Adminer {
|
||||
function bruteForceKey() {
|
||||
return $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
|
||||
/** Get server name displayed in breadcrumbs
|
||||
* @param string
|
||||
* @return string HTML code or null
|
||||
@@ -128,7 +128,7 @@ class Adminer {
|
||||
echo "<p><input type='submit' value='" . lang('Login') . "'>\n";
|
||||
echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
|
||||
}
|
||||
|
||||
|
||||
/** Get login form field
|
||||
* @param string
|
||||
* @param string HTML
|
||||
@@ -479,7 +479,7 @@ class Adminer {
|
||||
echo "</script>\n";
|
||||
echo "</div></fieldset>\n";
|
||||
}
|
||||
|
||||
|
||||
/** Print command box in select
|
||||
* @return bool whether to print default commands
|
||||
*/
|
||||
|
@@ -72,14 +72,14 @@ if ($auth) {
|
||||
) {
|
||||
redirect(auth_url($vendor, $server, $username, $db));
|
||||
}
|
||||
|
||||
|
||||
} elseif ($_POST["logout"] && (!$has_token || verify_token())) {
|
||||
foreach (array("pwds", "db", "dbs", "queries") as $key) {
|
||||
set_session($key, null);
|
||||
}
|
||||
unset_permanent();
|
||||
redirect(substr(preg_replace('~\b(username|db|ns)=[^&]*&~', '', ME), 0, -1), lang('Logout successful.') . ' ' . lang('Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.'));
|
||||
|
||||
|
||||
} elseif ($permanent && !$_SESSION["pwds"]) {
|
||||
session_regenerate_id();
|
||||
$private = $adminer->permanentLogin();
|
||||
@@ -199,7 +199,7 @@ if ($_POST) {
|
||||
: lang('Invalid CSRF token. Send the form again.') . ' ' . lang('If you did not send this request from Adminer then close this page.')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// posted form with no data means that post_max_size exceeded because Adminer always sends token at least
|
||||
$error = lang('Too big POST data. Reduce the data or increase the %s configuration directive.', "'post_max_size'");
|
||||
|
@@ -8,7 +8,7 @@ function connect_error() {
|
||||
if ($_POST["db"] && !$error) {
|
||||
queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
|
||||
}
|
||||
|
||||
|
||||
page_header(lang('Select database'), $error, false);
|
||||
echo "<p class='links'>\n";
|
||||
foreach (array(
|
||||
@@ -39,9 +39,9 @@ function connect_error() {
|
||||
. "<td>" . lang('Size') . " - <a href='" . h(ME) . "dbsize=1'>" . lang('Compute') . "</a>" . script("qsl('a').onclick = partial(ajaxSetHtml, '" . js_escape(ME) . "script=connect');", "")
|
||||
. "</thead>\n"
|
||||
;
|
||||
|
||||
|
||||
$databases = ($_GET["dbsize"] ? count_tables($databases) : array_flip($databases));
|
||||
|
||||
|
||||
foreach ($databases as $db => $tables) {
|
||||
$root = h(ME) . "db=" . urlencode($db);
|
||||
$id = h("Db-" . $db);
|
||||
@@ -53,7 +53,7 @@ function connect_error() {
|
||||
echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?");
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
echo "</table>\n";
|
||||
echo (support("database")
|
||||
? "<div class='footer'><div>\n"
|
||||
@@ -69,7 +69,7 @@ function connect_error() {
|
||||
echo script("tableCheck();");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
page_footer("db");
|
||||
}
|
||||
|
||||
|
@@ -22,14 +22,14 @@ function get_driver($id) {
|
||||
|
||||
/*abstract*/ class Min_SQL {
|
||||
var $_conn;
|
||||
|
||||
|
||||
/** Create object for performing database operations
|
||||
* @param Min_DB
|
||||
*/
|
||||
function __construct($connection) {
|
||||
$this->_conn = $connection;
|
||||
}
|
||||
|
||||
|
||||
/** Select data from table
|
||||
* @param string
|
||||
* @param array result of $adminer->selectColumnsProcess()[0]
|
||||
@@ -61,7 +61,7 @@ function get_driver($id) {
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/** Delete data from table
|
||||
* @param string
|
||||
* @param string " WHERE ..."
|
||||
@@ -72,7 +72,7 @@ function get_driver($id) {
|
||||
$query = "FROM " . table($table);
|
||||
return queries("DELETE" . ($limit ? limit1($table, $query, $queryWhere) : " $query$queryWhere"));
|
||||
}
|
||||
|
||||
|
||||
/** Update data in table
|
||||
* @param string
|
||||
* @param array escaped columns in keys, quoted data in values
|
||||
@@ -89,7 +89,7 @@ function get_driver($id) {
|
||||
$query = table($table) . " SET$separator" . implode(",$separator", $values);
|
||||
return queries("UPDATE" . ($limit ? limit1($table, $query, $queryWhere, $separator) : " $query$queryWhere"));
|
||||
}
|
||||
|
||||
|
||||
/** Insert data into table
|
||||
* @param string
|
||||
* @param array escaped columns in keys, quoted data in values
|
||||
@@ -101,7 +101,7 @@ function get_driver($id) {
|
||||
: " DEFAULT VALUES"
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/** Insert or update data in table
|
||||
* @param string
|
||||
* @param array
|
||||
@@ -111,28 +111,28 @@ function get_driver($id) {
|
||||
/*abstract*/ function insertUpdate($table, $rows, $primary) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** Begin transaction
|
||||
* @return bool
|
||||
*/
|
||||
function begin() {
|
||||
return queries("BEGIN");
|
||||
}
|
||||
|
||||
|
||||
/** Commit transaction
|
||||
* @return bool
|
||||
*/
|
||||
function commit() {
|
||||
return queries("COMMIT");
|
||||
}
|
||||
|
||||
|
||||
/** Rollback transaction
|
||||
* @return bool
|
||||
*/
|
||||
function rollback() {
|
||||
return queries("ROLLBACK");
|
||||
}
|
||||
|
||||
|
||||
/** Return query with a timeout
|
||||
* @param string
|
||||
* @param int seconds
|
||||
@@ -140,7 +140,7 @@ function get_driver($id) {
|
||||
*/
|
||||
function slowQuery($query, $timeout) {
|
||||
}
|
||||
|
||||
|
||||
/** Convert column to be searchable
|
||||
* @param string escaped column name
|
||||
* @param array array("op" => , "val" => )
|
||||
@@ -178,19 +178,19 @@ function get_driver($id) {
|
||||
function quoteBinary($s) {
|
||||
return q($s);
|
||||
}
|
||||
|
||||
|
||||
/** Get warnings about the last command
|
||||
* @return string HTML
|
||||
*/
|
||||
function warnings() {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/** Get help link for table
|
||||
* @param string
|
||||
* @return string relative URL or null
|
||||
*/
|
||||
function tableHelp($name) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -243,7 +243,7 @@ function get_partitions_info($table) {
|
||||
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($table);
|
||||
$result = $connection->query("SELECT PARTITION_METHOD, PARTITION_EXPRESSION, PARTITION_ORDINAL_POSITION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
|
||||
$return = array();
|
||||
list($return["partition_by"], $return["partition"], $return["partitions"]) = $result->fetch_row();
|
||||
list($return["partition_by"], $return["partition"], $return["partitions"]) = $result->fetch_row();
|
||||
$partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
|
||||
$return["partition_names"] = array_keys($partitions);
|
||||
$return["partition_values"] = array_values($partitions);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
if (extension_loaded('pdo')) {
|
||||
/*abstract*/ class Min_PDO {
|
||||
var $_result, $server_info, $affected_rows, $errno, $error, $pdo;
|
||||
|
||||
|
||||
function __construct() {
|
||||
global $adminer;
|
||||
$pos = array_search("SQL", $adminer->operators);
|
||||
@@ -11,7 +11,7 @@ if (extension_loaded('pdo')) {
|
||||
unset($adminer->operators[$pos]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function dsn($dsn, $username, $password, $options = array()) {
|
||||
$options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT;
|
||||
$options[PDO::ATTR_STATEMENT_CLASS] = array('Min_PDOStatement');
|
||||
@@ -22,13 +22,13 @@ if (extension_loaded('pdo')) {
|
||||
}
|
||||
$this->server_info = @$this->pdo->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
}
|
||||
|
||||
|
||||
/*abstract function select_db($database);*/
|
||||
|
||||
|
||||
function quote($string) {
|
||||
return $this->pdo->quote($string);
|
||||
}
|
||||
|
||||
|
||||
function query($query, $unbuffered = false) {
|
||||
$result = $this->pdo->query($query);
|
||||
$this->error = "";
|
||||
@@ -42,11 +42,11 @@ if (extension_loaded('pdo')) {
|
||||
$this->store_result($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function multi_query($query) {
|
||||
return $this->_result = $this->query($query);
|
||||
}
|
||||
|
||||
|
||||
function store_result($result = null) {
|
||||
if (!$result) {
|
||||
$result = $this->_result;
|
||||
@@ -61,7 +61,7 @@ if (extension_loaded('pdo')) {
|
||||
$this->affected_rows = $result->rowCount();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function next_result() {
|
||||
if (!$this->_result) {
|
||||
return false;
|
||||
@@ -69,7 +69,7 @@ if (extension_loaded('pdo')) {
|
||||
$this->_result->_offset = 0;
|
||||
return @$this->_result->nextRowset(); // @ - PDO_PgSQL doesn't support it
|
||||
}
|
||||
|
||||
|
||||
function result($query, $field = 0) {
|
||||
$result = $this->query($query);
|
||||
if (!$result) {
|
||||
@@ -79,18 +79,18 @@ if (extension_loaded('pdo')) {
|
||||
return $row[$field];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Min_PDOStatement extends PDOStatement {
|
||||
var $_offset = 0, $num_rows;
|
||||
|
||||
|
||||
function fetch_assoc() {
|
||||
return $this->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
|
||||
function fetch_row() {
|
||||
return $this->fetch(PDO::FETCH_NUM);
|
||||
}
|
||||
|
||||
|
||||
function fetch_field() {
|
||||
$row = (object) $this->getColumnMeta($this->_offset++);
|
||||
$row->orgtable = $row->table;
|
||||
|
@@ -3,20 +3,20 @@
|
||||
class TmpFile {
|
||||
var $handler;
|
||||
var $size;
|
||||
|
||||
|
||||
function __construct() {
|
||||
$this->handler = tmpfile();
|
||||
}
|
||||
|
||||
|
||||
function write($contents) {
|
||||
$this->size += strlen($contents);
|
||||
fwrite($this->handler, $contents);
|
||||
}
|
||||
|
||||
|
||||
function send() {
|
||||
fseek($this->handler, 0);
|
||||
fpassthru($this->handler);
|
||||
fclose($this->handler);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user