mirror of
https://github.com/vrana/adminer.git
synced 2026-05-06 07:25:36 +02:00
Trim trailing whitespace
This commit is contained in:
@@ -8,14 +8,14 @@
|
||||
*/
|
||||
class AdminerDatabaseHide {
|
||||
protected $disabled;
|
||||
|
||||
|
||||
/**
|
||||
* @param array case insensitive database names in values
|
||||
*/
|
||||
function __construct($disabled) {
|
||||
$this->disabled = array_map('strtolower', $disabled);
|
||||
}
|
||||
|
||||
|
||||
function databases($flush = true) {
|
||||
$return = array();
|
||||
foreach (get_databases($flush) as $db) {
|
||||
@@ -25,5 +25,5 @@ class AdminerDatabaseHide {
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
class AdminerDesigns {
|
||||
/** @access protected */
|
||||
var $designs;
|
||||
|
||||
|
||||
/**
|
||||
* @param array URL in key, name in value
|
||||
*/
|
||||
function __construct($designs) {
|
||||
$this->designs = $designs;
|
||||
}
|
||||
|
||||
|
||||
function headers() {
|
||||
if (isset($_POST["design"]) && verify_token()) {
|
||||
restart_session();
|
||||
@@ -24,7 +24,7 @@ class AdminerDesigns {
|
||||
redirect($_SERVER["REQUEST_URI"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function css() {
|
||||
$return = array();
|
||||
if (array_key_exists($_SESSION["design"], $this->designs)) {
|
||||
@@ -32,7 +32,7 @@ class AdminerDesigns {
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
function navigation($missing) {
|
||||
echo "<form action='' method='post' style='position: fixed; bottom: .5em; right: .5em;'>";
|
||||
echo html_select("design", array("" => "(design)") + $this->designs, $_SESSION["design"], "this.form.submit();");
|
||||
|
||||
@@ -305,7 +305,7 @@ if (isset($_GET["elastic5"])) {
|
||||
function db_collation($db, $collations) {
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
function engines() {
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ if (isset($_GET["firebird"])) {
|
||||
;
|
||||
|
||||
function connect($server, $username, $password) {
|
||||
$this->_link = ibase_connect($server, $username, $password);
|
||||
$this->_link = ibase_connect($server, $username, $password);
|
||||
if ($this->_link) {
|
||||
$url_parts = explode(':', $server);
|
||||
$this->service_link = ibase_service_attach($url_parts[0], $username, $password);
|
||||
@@ -109,9 +109,9 @@ if (isset($_GET["firebird"])) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Min_Driver extends Min_SQL {
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ if (isset($_GET["firebird"])) {
|
||||
}
|
||||
|
||||
function limit($query, $where, $limit, $offset = 0, $separator = " ") {
|
||||
$return = '';
|
||||
$return = '';
|
||||
$return .= ($limit !== null ? $separator . "FIRST $limit" . ($offset ? " SKIP $offset" : "") : "");
|
||||
$return .= " $query$where";
|
||||
return $return;
|
||||
@@ -171,7 +171,7 @@ if (isset($_GET["firebird"])) {
|
||||
while ($row = ibase_fetch_assoc($result)) {
|
||||
$return[$row['RDB$RELATION_NAME']] = 'table';
|
||||
}
|
||||
ksort($return);
|
||||
ksort($return);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ if (isset($_GET["simpledb"])) {
|
||||
function rollback() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function slowQuery($query, $timeout) {
|
||||
$this->_conn->timeout = $timeout;
|
||||
return $query;
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||
*/
|
||||
class AdminerDumpAlter {
|
||||
|
||||
|
||||
function dumpFormat() {
|
||||
if (DRIVER == 'server') {
|
||||
return array('sql_alter' => 'Alter');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _database() {
|
||||
// drop old tables
|
||||
$query = "SELECT TABLE_NAME, ENGINE, TABLE_COLLATION, TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()";
|
||||
@@ -52,7 +52,7 @@ DROP PROCEDURE adminer_alter;
|
||||
SELECT @adminer_alter;
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
function dumpDatabase($db) {
|
||||
static $first = true;
|
||||
if ($_POST["format"] == "sql_alter") {
|
||||
@@ -66,7 +66,7 @@ SELECT @adminer_alter;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function dumpTable($table, $style, $is_view = 0) {
|
||||
if ($_POST["format"] == "sql_alter") {
|
||||
$create = create_sql($table, $_POST["auto_increment"], $style);
|
||||
@@ -152,7 +152,7 @@ DROP PROCEDURE adminer_alter;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function dumpData() {
|
||||
if ($_POST["format"] == "sql_alter") {
|
||||
return true;
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
class AdminerDumpBz2 {
|
||||
/** @access protected */
|
||||
var $filename, $fp;
|
||||
|
||||
|
||||
function dumpOutput() {
|
||||
if (!function_exists('bzopen')) {
|
||||
return array();
|
||||
}
|
||||
return array('bz2' => 'bzip2');
|
||||
}
|
||||
|
||||
|
||||
function _bz2($string, $state) {
|
||||
bzwrite($this->fp, $string);
|
||||
if ($state & PHP_OUTPUT_HANDLER_END) {
|
||||
@@ -28,7 +28,7 @@ class AdminerDumpBz2 {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
function dumpHeaders($identifier, $multi_table = false) {
|
||||
if ($_POST["output"] == "bz2") {
|
||||
$this->filename = tempnam("", "bz2");
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||
*/
|
||||
class AdminerDumpDate {
|
||||
|
||||
|
||||
function dumpFilename($identifier) {
|
||||
$connection = connection();
|
||||
return friendly_url(($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost")) . "-" . $connection->result("SELECT NOW()"));
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class AdminerDumpJson {
|
||||
/** @access protected */
|
||||
var $database = false;
|
||||
|
||||
|
||||
function dumpFormat() {
|
||||
return array('json' => 'JSON');
|
||||
}
|
||||
@@ -19,11 +19,11 @@ class AdminerDumpJson {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _database() {
|
||||
echo "}\n";
|
||||
}
|
||||
|
||||
|
||||
function dumpData($table, $style, $query) {
|
||||
if ($_POST["format"] == "json") {
|
||||
if ($this->database) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class AdminerDumpXml {
|
||||
/** @access protected */
|
||||
var $database = false;
|
||||
|
||||
|
||||
function dumpFormat() {
|
||||
return array('xml' => 'XML');
|
||||
}
|
||||
@@ -19,11 +19,11 @@ class AdminerDumpXml {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _database() {
|
||||
echo "</database>\n";
|
||||
}
|
||||
|
||||
|
||||
function dumpData($table, $style, $query) {
|
||||
if ($_POST["format"] == "xml") {
|
||||
if (!$this->database) {
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
*/
|
||||
class AdminerEditForeign {
|
||||
var $_limit;
|
||||
|
||||
|
||||
function __construct($limit = 0) {
|
||||
$this->_limit = $limit;
|
||||
}
|
||||
|
||||
|
||||
function editInput($table, $field, $attrs, $value) {
|
||||
static $foreignTables = array();
|
||||
static $values = array();
|
||||
@@ -39,5 +39,5 @@ class AdminerEditForeign {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class AdminerEmailTable {
|
||||
/** @access protected */
|
||||
var $table, $id, $title, $subject, $message;
|
||||
|
||||
|
||||
/**
|
||||
* @param string quoted table name
|
||||
* @param string quoted column name
|
||||
@@ -24,7 +24,7 @@ class AdminerEmailTable {
|
||||
$this->subject = $subject;
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
|
||||
function selectEmailPrint($emailFields, $columns) {
|
||||
if ($emailFields) {
|
||||
print_fieldset("email", ('E-mail'));
|
||||
@@ -46,7 +46,7 @@ class AdminerEmailTable {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function selectEmailProcess($where, $foreignKeys) {
|
||||
$connection = connection();
|
||||
if ($_POST["email_id"]) {
|
||||
@@ -56,5 +56,5 @@ class AdminerEmailTable {
|
||||
$_POST["email_message"] = $row[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||
*/
|
||||
class AdminerEnumOption {
|
||||
|
||||
|
||||
function editInput($table, $field, $attrs, $value) {
|
||||
if ($field["type"] == "enum") {
|
||||
$options = array();
|
||||
@@ -36,5 +36,5 @@ class AdminerEnumOption {
|
||||
return "<select$attrs>" . optionlist($options, (string) $selected, 1) . "</select>"; // 1 - use keys
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||
*/
|
||||
class AdminerForeignSystem {
|
||||
|
||||
|
||||
function foreignKeys($table) {
|
||||
if (DRIVER == "server" && DB == "mysql") {
|
||||
switch ($table) {
|
||||
@@ -52,5 +52,5 @@ class AdminerForeignSystem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
class AdminerFrames {
|
||||
/** @access protected */
|
||||
var $sameOrigin;
|
||||
|
||||
|
||||
/**
|
||||
* @param bool allow running from the same origin only
|
||||
*/
|
||||
function __construct($sameOrigin = false) {
|
||||
$this->sameOrigin = $sameOrigin;
|
||||
}
|
||||
|
||||
|
||||
function headers() {
|
||||
if ($this->sameOrigin) {
|
||||
header("X-Frame-Options: SameOrigin");
|
||||
@@ -24,5 +24,5 @@ class AdminerFrames {
|
||||
header_remove("X-Frame-Options");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class AdminerLoginIp {
|
||||
var $ips;
|
||||
/** @access protected */
|
||||
var $forwarded_for;
|
||||
|
||||
|
||||
/** Set allowed IP addresses
|
||||
* @param array IP address prefixes
|
||||
* @param array X-Forwarded-For prefixes if IP address matches, empty array means anything
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
class AdminerLoginOtp {
|
||||
/** @access protected */
|
||||
var $secret;
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* @param string decoded secret, e.g. base64_decode("SECRET")
|
||||
*/
|
||||
function __construct($secret) {
|
||||
@@ -19,7 +19,7 @@ class AdminerLoginOtp {
|
||||
$_SESSION["otp"] = (string) $_POST["auth"]["otp"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function loginFormField($name, $heading, $value) {
|
||||
if ($name == 'password') {
|
||||
return $heading . $value
|
||||
@@ -43,7 +43,7 @@ class AdminerLoginOtp {
|
||||
return 'Invalid OTP.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getOtp($timeSlot) {
|
||||
$data = str_pad(pack('N', $timeSlot), 8, "\0", STR_PAD_LEFT);
|
||||
$hash = hash_hmac('sha1', $data, $this->secret, true);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class AdminerLoginPasswordLess {
|
||||
/** @access protected */
|
||||
var $password_hash;
|
||||
|
||||
|
||||
/** Set allowed password
|
||||
* @param string result of password_hash
|
||||
*/
|
||||
@@ -21,7 +21,7 @@ class AdminerLoginPasswordLess {
|
||||
$password = get_password();
|
||||
return array(SERVER, $_GET["username"], (password_verify($password, $this->password_hash) ? "" : $password));
|
||||
}
|
||||
|
||||
|
||||
function login($login, $password) {
|
||||
if ($password != "") {
|
||||
return true;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class AdminerLoginServers {
|
||||
/** @access protected */
|
||||
var $servers;
|
||||
|
||||
|
||||
/** Set supported servers
|
||||
* @param array array($description => array("server" => , "driver" => "server|pgsql|sqlite|..."))
|
||||
*/
|
||||
@@ -20,17 +20,17 @@ class AdminerLoginServers {
|
||||
$_POST["auth"]["driver"] = $this->servers[$key]["driver"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function credentials() {
|
||||
return array($this->servers[SERVER]["server"], $_GET["username"], get_password());
|
||||
}
|
||||
|
||||
|
||||
function login($login, $password) {
|
||||
if (!$this->servers[SERVER]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function loginFormField($name, $heading, $value) {
|
||||
if ($name == 'driver') {
|
||||
return '';
|
||||
@@ -38,5 +38,5 @@ class AdminerLoginServers {
|
||||
return $heading . "<select name='auth[server]'>" . optionlist(array_keys($this->servers), SERVER) . "</select>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ class AdminerLoginSsl {
|
||||
function connectSsl() {
|
||||
return $this->ssl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,17 +18,17 @@ CREATE TABLE login (
|
||||
class AdminerLoginTable {
|
||||
/** @access protected */
|
||||
var $database;
|
||||
|
||||
|
||||
/** Set database of login table
|
||||
* @param string
|
||||
*/
|
||||
function __construct($database) {
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
|
||||
function login($login, $password) {
|
||||
$connection = connection();
|
||||
return (bool) $connection->result("SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . q($login) . " AND password_sha1 = " . q(sha1($password)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,20 +8,20 @@
|
||||
*/
|
||||
class AdminerMasterSlave {
|
||||
private $masters = array();
|
||||
|
||||
|
||||
/**
|
||||
* @param array ($slave => $master)
|
||||
*/
|
||||
function __construct($masters) {
|
||||
$this->masters = $masters;
|
||||
}
|
||||
|
||||
|
||||
function credentials() {
|
||||
if ($_POST && isset($this->masters[SERVER])) {
|
||||
return array($this->masters[SERVER], $_GET["username"], get_session("pwds"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function login($login, $password) {
|
||||
if (!$_POST && ($master = &$_SESSION["master"])) {
|
||||
$connection = connection();
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
class AdminerPlugin extends Adminer {
|
||||
/** @access protected */
|
||||
var $plugins;
|
||||
|
||||
|
||||
function _findRootClass($class) { // is_subclass_of(string, string) is available since PHP 5.0.3
|
||||
do {
|
||||
$return = $class;
|
||||
} while ($class = get_parent_class($class));
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/** Register plugins
|
||||
* @param array object instances or null to register all classes starting by 'Adminer'
|
||||
*/
|
||||
@@ -32,11 +32,11 @@ class AdminerPlugin extends Adminer {
|
||||
$this->plugins = $plugins;
|
||||
//! it is possible to use ReflectionObject to find out which plugins defines which methods at once
|
||||
}
|
||||
|
||||
|
||||
function _callParent($function, $args) {
|
||||
return call_user_func_array(array('parent', $function), $args);
|
||||
}
|
||||
|
||||
|
||||
function _applyPlugin($function, $args) {
|
||||
foreach ($this->plugins as $plugin) {
|
||||
if (method_exists($plugin, $function)) {
|
||||
@@ -57,7 +57,7 @@ class AdminerPlugin extends Adminer {
|
||||
}
|
||||
return $this->_callParent($function, $args);
|
||||
}
|
||||
|
||||
|
||||
function _appendPlugin($function, $args) {
|
||||
$return = $this->_callParent($function, $args);
|
||||
foreach ($this->plugins as $plugin) {
|
||||
@@ -70,14 +70,14 @@ class AdminerPlugin extends Adminer {
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
// appendPlugin
|
||||
|
||||
|
||||
function dumpFormat() {
|
||||
$args = func_get_args();
|
||||
return $this->_appendPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
|
||||
function dumpOutput() {
|
||||
$args = func_get_args();
|
||||
return $this->_appendPlugin(__FUNCTION__, $args);
|
||||
@@ -94,7 +94,7 @@ class AdminerPlugin extends Adminer {
|
||||
}
|
||||
|
||||
// applyPlugin
|
||||
|
||||
|
||||
function name() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
class AdminerSqlLog {
|
||||
/** @access protected */
|
||||
var $filename;
|
||||
|
||||
|
||||
/**
|
||||
* @param string defaults to "$database.sql"
|
||||
*/
|
||||
function __construct($filename = "") {
|
||||
$this->filename = $filename;
|
||||
}
|
||||
|
||||
|
||||
function messageQuery($query, $time, $failed = false) {
|
||||
$this->_log($query);
|
||||
}
|
||||
@@ -37,5 +37,5 @@ class AdminerSqlLog {
|
||||
flock($fp, LOCK_UN);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ CREATE TABLE translation (
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||
*/
|
||||
class AdminerTranslation {
|
||||
|
||||
|
||||
function _translate($idf) {
|
||||
static $translations, $lang;
|
||||
if ($lang === null) {
|
||||
@@ -37,19 +37,19 @@ class AdminerTranslation {
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
function tableName(&$tableStatus) {
|
||||
$tableStatus["Comment"] = $this->_translate($tableStatus["Comment"]);
|
||||
}
|
||||
|
||||
|
||||
function fieldName(&$field, $order = 0) {
|
||||
$field["comment"] = $this->_translate($field["comment"]);
|
||||
}
|
||||
|
||||
|
||||
function editVal(&$val, $field) {
|
||||
if ($field["type"] == "enum") {
|
||||
$val = $this->_translate($val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||
*/
|
||||
class AdminerVersionNoverify {
|
||||
|
||||
|
||||
function head() {
|
||||
echo script("verifyVersion = function () {};");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user