Code cosmetics : removed trailing tabs
This commit is contained in:
parent
f21795b27d
commit
e3c1f24ad6
|
@ -28,13 +28,13 @@ if (!$error && $_POST) {
|
||||||
}
|
}
|
||||||
$call[] = (isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val);
|
$call[] = (isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . table($PROCEDURE) . "(" . implode(", ", $call) . ")";
|
$query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . table($PROCEDURE) . "(" . implode(", ", $call) . ")";
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
$result = $connection->multi_query($query);
|
$result = $connection->multi_query($query);
|
||||||
$affected = $connection->affected_rows; // getting warnigns overwrites this
|
$affected = $connection->affected_rows; // getting warnigns overwrites this
|
||||||
echo $adminer->selectQuery($query, $start, !$result);
|
echo $adminer->selectQuery($query, $start, !$result);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
echo "<p class='error'>" . error() . "\n";
|
echo "<p class='error'>" . error() . "\n";
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,7 +42,7 @@ if (!$error && $_POST) {
|
||||||
if (is_object($connection2)) {
|
if (is_object($connection2)) {
|
||||||
$connection2->select_db(DB);
|
$connection2->select_db(DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$result = $connection->store_result();
|
$result = $connection->store_result();
|
||||||
if (is_object($result)) {
|
if (is_object($result)) {
|
||||||
|
@ -53,7 +53,7 @@ if (!$error && $_POST) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
} while ($connection->next_result());
|
} while ($connection->next_result());
|
||||||
|
|
||||||
if ($out) {
|
if ($out) {
|
||||||
select($connection->query("SELECT " . implode(", ", $out)));
|
select($connection->query("SELECT " . implode(", ", $out)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ if (isset($_GET["elastic"])) {
|
||||||
|
|
||||||
function db_collation($db, $collations) {
|
function db_collation($db, $collations) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function engines() {
|
function engines() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ if (isset($_GET["mongo"])) {
|
||||||
$this->error = $e->getMessage();
|
$this->error = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function query($query) {
|
function query($query) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ if (isset($_GET["mongo"])) {
|
||||||
|
|
||||||
class Min_Driver extends Min_SQL {
|
class Min_Driver extends Min_SQL {
|
||||||
public $primary = "_id";
|
public $primary = "_id";
|
||||||
|
|
||||||
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
|
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
|
||||||
$select = ($select == array("*")
|
$select = ($select == array("*")
|
||||||
? array()
|
? array()
|
||||||
|
@ -127,7 +127,7 @@ if (isset($_GET["mongo"])) {
|
||||||
->skip($page * $limit)
|
->skip($page * $limit)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert($table, $set) {
|
function insert($table, $set) {
|
||||||
try {
|
try {
|
||||||
$return = $this->_conn->_db->selectCollection($table)->insert($set);
|
$return = $this->_conn->_db->selectCollection($table)->insert($set);
|
||||||
|
@ -219,7 +219,7 @@ if (isset($_GET["mongo"])) {
|
||||||
$this->_link = new $class($uri, $options);
|
$this->_link = new $class($uri, $options);
|
||||||
$this->executeCommand('admin', array('ping' => 1));
|
$this->executeCommand('admin', array('ping' => 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
function executeCommand($db, $command) {
|
function executeCommand($db, $command) {
|
||||||
$class = 'MongoDB\Driver\Command';
|
$class = 'MongoDB\Driver\Command';
|
||||||
try {
|
try {
|
||||||
|
@ -229,7 +229,7 @@ if (isset($_GET["mongo"])) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function executeBulkWrite($namespace, $bulk, $counter) {
|
function executeBulkWrite($namespace, $bulk, $counter) {
|
||||||
try {
|
try {
|
||||||
$results = $this->_link->executeBulkWrite($namespace, $bulk);
|
$results = $this->_link->executeBulkWrite($namespace, $bulk);
|
||||||
|
@ -575,7 +575,7 @@ if (isset($_GET["mongo"])) {
|
||||||
"(date)>=",
|
"(date)>=",
|
||||||
"(date)<=",
|
"(date)<=",
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function table($idf) {
|
function table($idf) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ if ($_POST && !$error) {
|
||||||
: "AT " . q($row["STARTS"])
|
: "AT " . q($row["STARTS"])
|
||||||
) . " ON COMPLETION" . ($row["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
|
) . " ON COMPLETION" . ($row["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
|
||||||
;
|
;
|
||||||
|
|
||||||
queries_redirect(substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')), queries(($EVENT != ""
|
queries_redirect(substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')), queries(($EVENT != ""
|
||||||
? "ALTER EVENT " . idf_escape($EVENT) . $schedule
|
? "ALTER EVENT " . idf_escape($EVENT) . $schedule
|
||||||
. ($EVENT != $row["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($row["EVENT_NAME"]) : "")
|
. ($EVENT != $row["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($row["EVENT_NAME"]) : "")
|
||||||
|
|
|
@ -6,7 +6,7 @@ $row = $_POST;
|
||||||
if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-js"]) {
|
if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-js"]) {
|
||||||
$message = ($_POST["drop"] ? lang('Foreign key has been dropped.') : ($name != "" ? lang('Foreign key has been altered.') : lang('Foreign key has been created.')));
|
$message = ($_POST["drop"] ? lang('Foreign key has been dropped.') : ($name != "" ? lang('Foreign key has been altered.') : lang('Foreign key has been created.')));
|
||||||
$location = ME . "table=" . urlencode($TABLE);
|
$location = ME . "table=" . urlencode($TABLE);
|
||||||
|
|
||||||
if (!$_POST["drop"]) {
|
if (!$_POST["drop"]) {
|
||||||
$row["source"] = array_filter($row["source"], 'strlen');
|
$row["source"] = array_filter($row["source"], 'strlen');
|
||||||
ksort($row["source"]); // enforce input order
|
ksort($row["source"]); // enforce input order
|
||||||
|
@ -16,7 +16,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-
|
||||||
}
|
}
|
||||||
$row["target"] = $target;
|
$row["target"] = $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($jush == "sqlite") {
|
if ($jush == "sqlite") {
|
||||||
queries_redirect($location, $message, recreate_table($TABLE, $TABLE, array(), array(), array(" $name" => ($_POST["drop"] ? "" : " " . format_foreign_key($row)))));
|
queries_redirect($location, $message, recreate_table($TABLE, $TABLE, array(), array(), array(" $name" => ($_POST["drop"] ? "" : " " . format_foreign_key($row)))));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Adminer {
|
||||||
function bruteForceKey() {
|
function bruteForceKey() {
|
||||||
return $_SERVER["REMOTE_ADDR"];
|
return $_SERVER["REMOTE_ADDR"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get server name displayed in breadcrumbs
|
/** Get server name displayed in breadcrumbs
|
||||||
* @param string
|
* @param string
|
||||||
* @return string HTML code or null
|
* @return string HTML code or null
|
||||||
|
@ -128,7 +128,7 @@ class Adminer {
|
||||||
echo "<p><input type='submit' value='" . lang('Login') . "'>\n";
|
echo "<p><input type='submit' value='" . lang('Login') . "'>\n";
|
||||||
echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
|
echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get login form field
|
/** Get login form field
|
||||||
* @param string
|
* @param string
|
||||||
* @param string HTML
|
* @param string HTML
|
||||||
|
@ -480,7 +480,7 @@ class Adminer {
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
echo "</div></fieldset>\n";
|
echo "</div></fieldset>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print command box in select
|
/** Print command box in select
|
||||||
* @return bool whether to print default commands
|
* @return bool whether to print default commands
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -72,14 +72,14 @@ if ($auth) {
|
||||||
) {
|
) {
|
||||||
redirect(auth_url($vendor, $server, $username, $db));
|
redirect(auth_url($vendor, $server, $username, $db));
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($_POST["logout"] && (!$has_token || verify_token())) {
|
} elseif ($_POST["logout"] && (!$has_token || verify_token())) {
|
||||||
foreach (array("pwds", "db", "dbs", "queries") as $key) {
|
foreach (array("pwds", "db", "dbs", "queries") as $key) {
|
||||||
set_session($key, null);
|
set_session($key, null);
|
||||||
}
|
}
|
||||||
unset_permanent();
|
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>.'));
|
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"]) {
|
} elseif ($permanent && !$_SESSION["pwds"]) {
|
||||||
session_regenerate_id();
|
session_regenerate_id();
|
||||||
$private = $adminer->permanentLogin();
|
$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.')
|
: 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") {
|
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
// posted form with no data means that post_max_size exceeded because Adminer always sends token at least
|
// 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'");
|
$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) {
|
if ($_POST["db"] && !$error) {
|
||||||
queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
|
queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
page_header(lang('Select database'), $error, false);
|
page_header(lang('Select database'), $error, false);
|
||||||
echo "<p class='links'>\n";
|
echo "<p class='links'>\n";
|
||||||
foreach (array(
|
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');", "")
|
. "<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"
|
. "</thead>\n"
|
||||||
;
|
;
|
||||||
|
|
||||||
$databases = ($_GET["dbsize"] ? count_tables($databases) : array_flip($databases));
|
$databases = ($_GET["dbsize"] ? count_tables($databases) : array_flip($databases));
|
||||||
|
|
||||||
foreach ($databases as $db => $tables) {
|
foreach ($databases as $db => $tables) {
|
||||||
$root = h(ME) . "db=" . urlencode($db);
|
$root = h(ME) . "db=" . urlencode($db);
|
||||||
$id = h("Db-" . $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 "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?");
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
echo (support("database")
|
echo (support("database")
|
||||||
? "<div class='footer'><div>\n"
|
? "<div class='footer'><div>\n"
|
||||||
|
@ -69,7 +69,7 @@ function connect_error() {
|
||||||
echo script("tableCheck();");
|
echo script("tableCheck();");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
page_footer("db");
|
page_footer("db");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@ function add_driver($id, $name) {
|
||||||
|
|
||||||
/*abstract*/ class Min_SQL {
|
/*abstract*/ class Min_SQL {
|
||||||
var $_conn;
|
var $_conn;
|
||||||
|
|
||||||
/** Create object for performing database operations
|
/** Create object for performing database operations
|
||||||
* @param Min_DB
|
* @param Min_DB
|
||||||
*/
|
*/
|
||||||
function __construct($connection) {
|
function __construct($connection) {
|
||||||
$this->_conn = $connection;
|
$this->_conn = $connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Select data from table
|
/** Select data from table
|
||||||
* @param string
|
* @param string
|
||||||
* @param array result of $adminer->selectColumnsProcess()[0]
|
* @param array result of $adminer->selectColumnsProcess()[0]
|
||||||
|
@ -52,7 +52,7 @@ function add_driver($id, $name) {
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Delete data from table
|
/** Delete data from table
|
||||||
* @param string
|
* @param string
|
||||||
* @param string " WHERE ..."
|
* @param string " WHERE ..."
|
||||||
|
@ -63,7 +63,7 @@ function add_driver($id, $name) {
|
||||||
$query = "FROM " . table($table);
|
$query = "FROM " . table($table);
|
||||||
return queries("DELETE" . ($limit ? limit1($table, $query, $queryWhere) : " $query$queryWhere"));
|
return queries("DELETE" . ($limit ? limit1($table, $query, $queryWhere) : " $query$queryWhere"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update data in table
|
/** Update data in table
|
||||||
* @param string
|
* @param string
|
||||||
* @param array escaped columns in keys, quoted data in values
|
* @param array escaped columns in keys, quoted data in values
|
||||||
|
@ -80,7 +80,7 @@ function add_driver($id, $name) {
|
||||||
$query = table($table) . " SET$separator" . implode(",$separator", $values);
|
$query = table($table) . " SET$separator" . implode(",$separator", $values);
|
||||||
return queries("UPDATE" . ($limit ? limit1($table, $query, $queryWhere, $separator) : " $query$queryWhere"));
|
return queries("UPDATE" . ($limit ? limit1($table, $query, $queryWhere, $separator) : " $query$queryWhere"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Insert data into table
|
/** Insert data into table
|
||||||
* @param string
|
* @param string
|
||||||
* @param array escaped columns in keys, quoted data in values
|
* @param array escaped columns in keys, quoted data in values
|
||||||
|
@ -92,7 +92,7 @@ function add_driver($id, $name) {
|
||||||
: " DEFAULT VALUES"
|
: " DEFAULT VALUES"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Insert or update data in table
|
/** Insert or update data in table
|
||||||
* @param string
|
* @param string
|
||||||
* @param array
|
* @param array
|
||||||
|
@ -102,28 +102,28 @@ function add_driver($id, $name) {
|
||||||
/*abstract*/ function insertUpdate($table, $rows, $primary) {
|
/*abstract*/ function insertUpdate($table, $rows, $primary) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Begin transaction
|
/** Begin transaction
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function begin() {
|
function begin() {
|
||||||
return queries("BEGIN");
|
return queries("BEGIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Commit transaction
|
/** Commit transaction
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function commit() {
|
function commit() {
|
||||||
return queries("COMMIT");
|
return queries("COMMIT");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Rollback transaction
|
/** Rollback transaction
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function rollback() {
|
function rollback() {
|
||||||
return queries("ROLLBACK");
|
return queries("ROLLBACK");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return query with a timeout
|
/** Return query with a timeout
|
||||||
* @param string
|
* @param string
|
||||||
* @param int seconds
|
* @param int seconds
|
||||||
|
@ -131,7 +131,7 @@ function add_driver($id, $name) {
|
||||||
*/
|
*/
|
||||||
function slowQuery($query, $timeout) {
|
function slowQuery($query, $timeout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert column to be searchable
|
/** Convert column to be searchable
|
||||||
* @param string escaped column name
|
* @param string escaped column name
|
||||||
* @param array array("op" => , "val" => )
|
* @param array array("op" => , "val" => )
|
||||||
|
@ -161,19 +161,19 @@ function add_driver($id, $name) {
|
||||||
function quoteBinary($s) {
|
function quoteBinary($s) {
|
||||||
return q($s);
|
return q($s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get warnings about the last command
|
/** Get warnings about the last command
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
function warnings() {
|
function warnings() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get help link for table
|
/** Get help link for table
|
||||||
* @param string
|
* @param string
|
||||||
* @return string relative URL or null
|
* @return string relative URL or null
|
||||||
*/
|
*/
|
||||||
function tableHelp($name) {
|
function tableHelp($name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
if (extension_loaded('pdo')) {
|
if (extension_loaded('pdo')) {
|
||||||
/*abstract*/ class Min_PDO {
|
/*abstract*/ class Min_PDO {
|
||||||
var $_result, $server_info, $affected_rows, $errno, $error, $pdo;
|
var $_result, $server_info, $affected_rows, $errno, $error, $pdo;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
global $adminer;
|
global $adminer;
|
||||||
$pos = array_search("SQL", $adminer->operators);
|
$pos = array_search("SQL", $adminer->operators);
|
||||||
|
@ -11,7 +11,7 @@ if (extension_loaded('pdo')) {
|
||||||
unset($adminer->operators[$pos]);
|
unset($adminer->operators[$pos]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dsn($dsn, $username, $password, $options = array()) {
|
function dsn($dsn, $username, $password, $options = array()) {
|
||||||
$options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT;
|
$options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT;
|
||||||
$options[PDO::ATTR_STATEMENT_CLASS] = array('Min_PDOStatement');
|
$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);
|
$this->server_info = @$this->pdo->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*abstract function select_db($database);*/
|
/*abstract function select_db($database);*/
|
||||||
|
|
||||||
function quote($string) {
|
function quote($string) {
|
||||||
return $this->pdo->quote($string);
|
return $this->pdo->quote($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
$result = $this->pdo->query($query);
|
$result = $this->pdo->query($query);
|
||||||
$this->error = "";
|
$this->error = "";
|
||||||
|
@ -42,11 +42,11 @@ if (extension_loaded('pdo')) {
|
||||||
$this->store_result($result);
|
$this->store_result($result);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function multi_query($query) {
|
function multi_query($query) {
|
||||||
return $this->_result = $this->query($query);
|
return $this->_result = $this->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
function store_result($result = null) {
|
function store_result($result = null) {
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$result = $this->_result;
|
$result = $this->_result;
|
||||||
|
@ -61,7 +61,7 @@ if (extension_loaded('pdo')) {
|
||||||
$this->affected_rows = $result->rowCount();
|
$this->affected_rows = $result->rowCount();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function next_result() {
|
function next_result() {
|
||||||
if (!$this->_result) {
|
if (!$this->_result) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -69,7 +69,7 @@ if (extension_loaded('pdo')) {
|
||||||
$this->_result->_offset = 0;
|
$this->_result->_offset = 0;
|
||||||
return @$this->_result->nextRowset(); // @ - PDO_PgSQL doesn't support it
|
return @$this->_result->nextRowset(); // @ - PDO_PgSQL doesn't support it
|
||||||
}
|
}
|
||||||
|
|
||||||
function result($query, $field = 0) {
|
function result($query, $field = 0) {
|
||||||
$result = $this->query($query);
|
$result = $this->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
@ -79,18 +79,18 @@ if (extension_loaded('pdo')) {
|
||||||
return $row[$field];
|
return $row[$field];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Min_PDOStatement extends PDOStatement {
|
class Min_PDOStatement extends PDOStatement {
|
||||||
var $_offset = 0, $num_rows;
|
var $_offset = 0, $num_rows;
|
||||||
|
|
||||||
function fetch_assoc() {
|
function fetch_assoc() {
|
||||||
return $this->fetch(PDO::FETCH_ASSOC);
|
return $this->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetch_row() {
|
function fetch_row() {
|
||||||
return $this->fetch(PDO::FETCH_NUM);
|
return $this->fetch(PDO::FETCH_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetch_field() {
|
function fetch_field() {
|
||||||
$row = (object) $this->getColumnMeta($this->_offset++);
|
$row = (object) $this->getColumnMeta($this->_offset++);
|
||||||
$row->orgtable = $row->table;
|
$row->orgtable = $row->table;
|
||||||
|
|
|
@ -3,20 +3,20 @@
|
||||||
class TmpFile {
|
class TmpFile {
|
||||||
var $handler;
|
var $handler;
|
||||||
var $size;
|
var $size;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->handler = tmpfile();
|
$this->handler = tmpfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
function write($contents) {
|
function write($contents) {
|
||||||
$this->size += strlen($contents);
|
$this->size += strlen($contents);
|
||||||
fwrite($this->handler, $contents);
|
fwrite($this->handler, $contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
function send() {
|
function send() {
|
||||||
fseek($this->handler, 0);
|
fseek($this->handler, 0);
|
||||||
fpassthru($this->handler);
|
fpassthru($this->handler);
|
||||||
fclose($this->handler);
|
fclose($this->handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
function adminer_object() {
|
function adminer_object() {
|
||||||
// required to run any plugin
|
// required to run any plugin
|
||||||
include_once "../plugins/plugin.php";
|
include_once "../plugins/plugin.php";
|
||||||
|
|
||||||
// autoloader
|
// autoloader
|
||||||
foreach (glob("../plugins/*.php") as $filename) {
|
foreach (glob("../plugins/*.php") as $filename) {
|
||||||
include_once $filename;
|
include_once $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable extra drivers just by including them
|
// enable extra drivers just by including them
|
||||||
//~ include "../plugins/drivers/simpledb.php";
|
//~ include "../plugins/drivers/simpledb.php";
|
||||||
|
|
||||||
$plugins = array(
|
$plugins = array(
|
||||||
// specify enabled plugins here
|
// specify enabled plugins here
|
||||||
new AdminerDatabaseHide(array('information_schema')),
|
new AdminerDatabaseHide(array('information_schema')),
|
||||||
|
@ -32,13 +32,13 @@ function adminer_object() {
|
||||||
new AdminerTablesFilter,
|
new AdminerTablesFilter,
|
||||||
new AdminerEditForeign,
|
new AdminerEditForeign,
|
||||||
);
|
);
|
||||||
|
|
||||||
/* It is possible to combine customization and plugins:
|
/* It is possible to combine customization and plugins:
|
||||||
class AdminerCustomization extends AdminerPlugin {
|
class AdminerCustomization extends AdminerPlugin {
|
||||||
}
|
}
|
||||||
return new AdminerCustomization($plugins);
|
return new AdminerCustomization($plugins);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return new AdminerPlugin($plugins);
|
return new AdminerPlugin($plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,12 +61,12 @@ foreach ($schema as $name => $table) {
|
||||||
echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;'>";
|
echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;'>";
|
||||||
echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><b>' . h($name) . "</b></a>";
|
echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><b>' . h($name) . "</b></a>";
|
||||||
echo script("qsl('div').onmousedown = schemaMousedown;");
|
echo script("qsl('div').onmousedown = schemaMousedown;");
|
||||||
|
|
||||||
foreach ($table["fields"] as $field) {
|
foreach ($table["fields"] as $field) {
|
||||||
$val = '<span' . type_class($field["type"]) . ' title="' . h($field["full_type"] . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>';
|
$val = '<span' . type_class($field["type"]) . ' title="' . h($field["full_type"] . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>';
|
||||||
echo "<br>" . ($field["primary"] ? "<i>$val</i>" : $val);
|
echo "<br>" . ($field["primary"] ? "<i>$val</i>" : $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ((array) $table["references"] as $target_name => $refs) {
|
foreach ((array) $table["references"] as $target_name => $refs) {
|
||||||
foreach ($refs as $left => $ref) {
|
foreach ($refs as $left => $ref) {
|
||||||
$left1 = $left - $table_pos[$name][1];
|
$left1 = $left - $table_pos[$name][1];
|
||||||
|
@ -76,7 +76,7 @@ foreach ($schema as $name => $table) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ((array) $referenced[$name] as $target_name => $refs) {
|
foreach ((array) $referenced[$name] as $target_name => $refs) {
|
||||||
foreach ($refs as $left => $columns) {
|
foreach ($refs as $left => $columns) {
|
||||||
$left1 = $left - $table_pos[$name][1];
|
$left1 = $left - $table_pos[$name][1];
|
||||||
|
@ -86,7 +86,7 @@ foreach ($schema as $name => $table) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\n</div>\n";
|
echo "\n</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -523,7 +523,7 @@ if (!$columns && support("table")) {
|
||||||
}
|
}
|
||||||
echo "</fieldset>\n";
|
echo "</fieldset>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<fieldset>";
|
echo "<fieldset>";
|
||||||
echo "<legend>" . lang('Whole result') . "</legend>";
|
echo "<legend>" . lang('Whole result') . "</legend>";
|
||||||
$display_rows = ($exact_count ? "" : "~ ") . $found_rows;
|
$display_rows = ($exact_count ? "" : "~ ") . $found_rows;
|
||||||
|
|
|
@ -225,7 +225,7 @@ if (!isset($_GET["import"])) {
|
||||||
echo script(($_POST ? "" : "qs('textarea').focus();\n") . "qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '" . js_escape(remove_from_uri("sql|limit|error_stops|only_errors|history")) . "');");
|
echo script(($_POST ? "" : "qs('textarea').focus();\n") . "qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '" . js_escape(remove_from_uri("sql|limit|error_stops|only_errors|history")) . "');");
|
||||||
echo "<p>$execute\n";
|
echo "<p>$execute\n";
|
||||||
echo lang('Limit rows') . ": <input type='number' name='limit' class='size' value='" . h($_POST ? $_POST["limit"] : $_GET["limit"]) . "'>\n";
|
echo lang('Limit rows') . ": <input type='number' name='limit' class='size' value='" . h($_POST ? $_POST["limit"] : $_GET["limit"]) . "'>\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "<fieldset><legend>" . lang('File upload') . "</legend><div>";
|
echo "<fieldset><legend>" . lang('File upload') . "</legend><div>";
|
||||||
$gz = (extension_loaded("zlib") ? "[.gz]" : "");
|
$gz = (extension_loaded("zlib") ? "[.gz]" : "");
|
||||||
|
|
|
@ -23,7 +23,7 @@ code { background: #eee; }
|
||||||
tbody tr:hover td, tbody tr:hover th { background: #eee; }
|
tbody tr:hover td, tbody tr:hover th { background: #eee; }
|
||||||
pre { margin: 1em 0 0; }
|
pre { margin: 1em 0 0; }
|
||||||
pre, textarea { font: 100%/1.25 monospace; }
|
pre, textarea { font: 100%/1.25 monospace; }
|
||||||
input, select { vertical-align: middle; }
|
input { vertical-align: middle; }
|
||||||
input.default { box-shadow: 1px 1px 1px #777; }
|
input.default { box-shadow: 1px 1px 1px #777; }
|
||||||
input.required { box-shadow: 1px 1px 1px red; }
|
input.required { box-shadow: 1px 1px 1px red; }
|
||||||
input.maxlength { box-shadow: 1px 1px 1px red; }
|
input.maxlength { box-shadow: 1px 1px 1px red; }
|
||||||
|
|
|
@ -28,7 +28,7 @@ if (!is_view($table_status)) {
|
||||||
}
|
}
|
||||||
echo '<p class="links"><a href="' . h(ME) . 'indexes=' . urlencode($TABLE) . '">' . lang('Alter indexes') . "</a>\n";
|
echo '<p class="links"><a href="' . h(ME) . 'indexes=' . urlencode($TABLE) . '">' . lang('Alter indexes') . "</a>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fk_support($table_status)) {
|
if (fk_support($table_status)) {
|
||||||
echo "<h3 id='foreign-keys'>" . lang('Foreign keys') . "</h3>\n";
|
echo "<h3 id='foreign-keys'>" . lang('Foreign keys') . "</h3>\n";
|
||||||
$foreign_keys = foreign_keys($TABLE);
|
$foreign_keys = foreign_keys($TABLE);
|
||||||
|
|
11
compile.php
11
compile.php
|
@ -196,7 +196,7 @@ function php_shrink($input) {
|
||||||
$short_variables = array();
|
$short_variables = array();
|
||||||
$shortening = true;
|
$shortening = true;
|
||||||
$tokens = token_get_all($input);
|
$tokens = token_get_all($input);
|
||||||
|
|
||||||
// remove unnecessary { }
|
// remove unnecessary { }
|
||||||
//! change also `while () { if () {;} }` to `while () if () ;` but be careful about `if () { if () { } } else { }
|
//! change also `while () { if () {;} }` to `while () if () ;` but be careful about `if () { if () { } } else { }
|
||||||
$shorten = 0;
|
$shorten = 0;
|
||||||
|
@ -223,13 +223,13 @@ function php_shrink($input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tokens = array_values($tokens);
|
$tokens = array_values($tokens);
|
||||||
|
|
||||||
foreach ($tokens as $i => $token) {
|
foreach ($tokens as $i => $token) {
|
||||||
if ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
|
if ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
|
||||||
$short_variables[$token[1]]++;
|
$short_variables[$token[1]]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arsort($short_variables);
|
arsort($short_variables);
|
||||||
$chars = implode(range('a', 'z')) . '_' . implode(range('A', 'Z'));
|
$chars = implode(range('a', 'z')) . '_' . implode(range('A', 'Z'));
|
||||||
// preserve variable names between versions if possible
|
// preserve variable names between versions if possible
|
||||||
|
@ -240,7 +240,7 @@ function php_shrink($input) {
|
||||||
foreach (array_keys($short_variables) as $number => $key) {
|
foreach (array_keys($short_variables) as $number => $key) {
|
||||||
$short_variables[$key] = short_identifier($number, $chars); // could use also numbers and \x7f-\xff
|
$short_variables[$key] = short_identifier($number, $chars); // could use also numbers and \x7f-\xff
|
||||||
}
|
}
|
||||||
|
|
||||||
$set = array_flip(preg_split('//', '!"#$%&\'()*+,-./:;<=>?@[]^`{|}'));
|
$set = array_flip(preg_split('//', '!"#$%&\'()*+,-./:;<=>?@[]^`{|}'));
|
||||||
$space = '';
|
$space = '';
|
||||||
$output = '';
|
$output = '';
|
||||||
|
@ -377,9 +377,6 @@ foreach (glob(dirname(__FILE__) . "/adminer/drivers/" . ($driver ? $driver : "*"
|
||||||
$file = file_get_contents($filename);
|
$file = file_get_contents($filename);
|
||||||
foreach ($functions as $val) {
|
foreach ($functions as $val) {
|
||||||
if (!strpos($file, "$val(")) {
|
if (!strpos($file, "$val(")) {
|
||||||
if (!defined('STDERR')) {
|
|
||||||
define('STDERR', fopen('php://stderr', 'w'));
|
|
||||||
}
|
|
||||||
fprintf(STDERR, "Missing $val in $filename\n");
|
fprintf(STDERR, "Missing $val in $filename\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ if ($adminer->homepage()) {
|
||||||
echo '<th>' . lang('Table');
|
echo '<th>' . lang('Table');
|
||||||
echo '<td>' . lang('Rows');
|
echo '<td>' . lang('Rows');
|
||||||
echo "</thead>\n";
|
echo "</thead>\n";
|
||||||
|
|
||||||
foreach (table_status() as $table => $row) {
|
foreach (table_status() as $table => $row) {
|
||||||
$name = $adminer->tableName($row);
|
$name = $adminer->tableName($row);
|
||||||
if (isset($row["Engine"]) && $name != "") {
|
if (isset($row["Engine"]) && $name != "") {
|
||||||
|
@ -25,7 +25,7 @@ if ($adminer->homepage()) {
|
||||||
echo "<td align='right'><a href='" . h(ME . "edit=") . urlencode($table) . "'>" . ($row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "</a>";
|
echo "<td align='right'><a href='" . h(ME . "edit=") . urlencode($table) . "'>" . ($row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Adminer {
|
||||||
function bruteForceKey() {
|
function bruteForceKey() {
|
||||||
return $_SERVER["REMOTE_ADDR"];
|
return $_SERVER["REMOTE_ADDR"];
|
||||||
}
|
}
|
||||||
|
|
||||||
function serverName($server) {
|
function serverName($server) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
function adminer_object() {
|
function adminer_object() {
|
||||||
include_once "../plugins/plugin.php";
|
include_once "../plugins/plugin.php";
|
||||||
include_once "../plugins/login-password-less.php";
|
include_once "../plugins/login-password-less.php";
|
||||||
|
|
||||||
class AdminerCustomization extends AdminerPlugin {
|
class AdminerCustomization extends AdminerPlugin {
|
||||||
function loginFormField($name, $heading, $value) {
|
function loginFormField($name, $heading, $value) {
|
||||||
return parent::loginFormField($name, $heading, str_replace('value="server"', 'value="sqlite"', $value));
|
return parent::loginFormField($name, $heading, str_replace('value="server"', 'value="sqlite"', $value));
|
||||||
|
@ -11,7 +11,7 @@ function adminer_object() {
|
||||||
return "PATH_TO_YOUR_SQLITE_HERE";
|
return "PATH_TO_YOUR_SQLITE_HERE";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AdminerCustomization(array(
|
return new AdminerCustomization(array(
|
||||||
// TODO: inline the result of password_hash() so that the password is not visible in source codes
|
// TODO: inline the result of password_hash() so that the password is not visible in source codes
|
||||||
new AdminerLoginPasswordLess(password_hash("YOUR_PASSWORD_HERE", PASSWORD_DEFAULT)),
|
new AdminerLoginPasswordLess(password_hash("YOUR_PASSWORD_HERE", PASSWORD_DEFAULT)),
|
||||||
|
|
Loading…
Reference in a new issue