1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-30 01:30:12 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Jakub Vrana
5ef2068837 Release 4.7.6 2020-01-31 11:23:04 +01:00
13 changed files with 27 additions and 67 deletions

View File

@@ -112,7 +112,7 @@ if ($adminer->homepage()) {
}
echo "<tr><td><th>" . lang('%d in total', count($tables_list));
echo "<td>" . h($jush == "sql" ? $connection->result("SELECT @@default_storage_engine") : "");
echo "<td>" . h($jush == "sql" ? $connection->result("SELECT @@storage_engine") : "");
echo "<td>" . h(db_collation(DB, collations()));
foreach (array("Data_length", "Index_length", "Data_free") as $key) {
echo "<td align='right' id='sum-$key'>";

View File

@@ -306,7 +306,7 @@ if (isset($_GET["clickhouse"])) {
function fields($table) {
$return = array();
$result = get_rows("SELECT name, type, default_expression FROM system.columns WHERE " . idf_escape('table') . " = " . q($table));
foreach ($result as $row) {
foreach($result as $row) {
$type = trim($row['type']);
$nullable = strpos($type, 'Nullable(') === 0;
$return[trim($row['name'])] = array(

View File

@@ -267,7 +267,7 @@ if (!defined("DRIVER")) {
}
function query($query, $unbuffered = false) {
$this->pdo->setAttribute(1000, !$unbuffered); // 1000 - PDO::MYSQL_ATTR_USE_BUFFERED_QUERY
$this->setAttribute(1000, !$unbuffered); // 1000 - PDO::MYSQL_ATTR_USE_BUFFERED_QUERY
return parent::query($query, $unbuffered);
}
}

View File

@@ -162,7 +162,7 @@ stop_session(true);
if (isset($_GET["username"]) && is_string(get_password())) {
list($host, $port) = explode(":", SERVER, 2);
if (+$port && ($port < 1024 || $port > 65535)) {
if (is_numeric($port) && ($port < 1024 || $port > 65535)) {
auth_error(lang('Connecting to privileged ports is not allowed.'));
}
check_invalid_login();

View File

@@ -1,5 +1,5 @@
<?php
error_reporting(6133); // errors
error_reporting(6135); // errors and warnings
include "../adminer/include/coverage.inc.php";
@@ -60,7 +60,7 @@ if (!defined("SID")) {
// disable magic quotes to be able to use database escaping function
remove_slashes(array(&$_GET, &$_POST, &$_COOKIE), $filter);
if (function_exists("get_magic_quotes_runtime") && get_magic_quotes_runtime()) {
if (get_magic_quotes_runtime()) {
set_magic_quotes_runtime(false);
}
@set_time_limit(0); // @ - can be disabled
@@ -84,7 +84,7 @@ include "../adminer/drivers/mysql.inc.php"; // must be included as last driver
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
define("DB", $_GET["db"]); // for the sake of speed and size
define("ME", preg_replace('~\?.*~', '', relative_uri()) . '?'
define("ME", str_replace(":", "%3a", preg_replace('~^[^?]*/([^?]*).*~', '\1', $_SERVER["REQUEST_URI"])) . '?'
. (sid() ? SID . '&' : '')
. (SERVER !== null ? DRIVER . "=" . urlencode(SERVER) . '&' : '')
. (isset($_GET["username"]) ? "username=" . urlencode($_GET["username"]) . '&' : '')

View File

@@ -62,7 +62,7 @@ function number_type() {
* @return null modified in place
*/
function remove_slashes($process, $filter = false) {
if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) {
if (get_magic_quotes_gpc()) {
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
@@ -721,19 +721,12 @@ function format_time($start) {
return lang('%.3f s', max(0, microtime(true) - $start));
}
/** Get relative REQUEST_URI
* @return string
*/
function relative_uri() {
return str_replace(":", "%3a", preg_replace('~^[^?]*/([^?]*)~', '\1', $_SERVER["REQUEST_URI"]));
}
/** Remove parameter from query string
* @param string
* @return string
*/
function remove_from_uri($param = "") {
return substr(preg_replace("~(?<=[?&])($param" . (SID ? "" : "|" . session_name()) . ")=[^&]*&~", '', relative_uri() . "&"), 0, -1);
return substr(preg_replace("~(?<=[?&])($param" . (SID ? "" : "|" . session_name()) . ")=[^&]*&~", '', "$_SERVER[REQUEST_URI]&"), 0, -1);
}
/** Generate page number for pagination
@@ -849,18 +842,19 @@ function friendly_url($val) {
/** Print hidden fields
* @param array
* @param array
* @param string
* @return bool
*/
function hidden_fields($process, $ignore = array(), $prefix = '') {
function hidden_fields($process, $ignore = array()) {
$return = false;
foreach ($process as $key => $val) {
while (list($key, $val) = each($process)) {
if (!in_array($key, $ignore)) {
if (is_array($val)) {
hidden_fields($val, array(), $key);
foreach ($val as $k => $v) {
$process[$key . "[$k]"] = $v;
}
} else {
$return = true;
echo '<input type="hidden" name="' . h($prefix ? $prefix . "[$key]" : $key) . '" value="' . h($val) . '">';
echo '<input type="hidden" name="' . h($key) . '" value="' . h($val) . '">';
}
}
}

View File

@@ -1,8 +1,8 @@
<?php
// PDO can be used in several database drivers
if (extension_loaded('pdo')) {
/*abstract*/ class Min_PDO {
var $_result, $server_info, $affected_rows, $errno, $error, $pdo;
/*abstract*/ class Min_PDO extends PDO {
var $_result, $server_info, $affected_rows, $errno, $error;
function __construct() {
global $adminer;
@@ -14,26 +14,21 @@ if (extension_loaded('pdo')) {
function dsn($dsn, $username, $password, $options = array()) {
try {
$this->pdo = new PDO($dsn, $username, $password, $options);
parent::__construct($dsn, $username, $password, $options);
} catch (Exception $ex) {
auth_error(h($ex->getMessage()));
}
$this->pdo->setAttribute(3, 1); // 3 - PDO::ATTR_ERRMODE, 1 - PDO::ERRMODE_WARNING
$this->pdo->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS
$this->server_info = @$this->pdo->getAttribute(4); // 4 - PDO::ATTR_SERVER_VERSION
$this->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS
$this->server_info = @$this->getAttribute(4); // 4 - 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);
$result = parent::query($query);
$this->error = "";
if (!$result) {
list(, $this->errno, $this->error) = $this->pdo->errorInfo();
list(, $this->errno, $this->error) = $this->errorInfo();
if (!$this->error) {
$this->error = lang('Unknown error.');
}

View File

@@ -1,2 +1,2 @@
<?php
$VERSION = "4.7.8";
$VERSION = "4.7.6";

View File

@@ -234,7 +234,7 @@ $translations = array(
'Sort' => 'Ταξινόμηση',
'descending' => 'Φθίνουσα',
'Limit' => 'Όριο',
'Limit rows' => 'Περιορισμός σειρών',
'Limit rows' => 'Περιοριμός σειρών',
'Text length' => 'Μήκος κειμένου',
'Action' => 'Ενέργεια',
'Full table scan' => 'Πλήρης σάρωση πινάκων',

View File

@@ -333,18 +333,4 @@ $translations = array(
'Type has been dropped.' => 'Tyyppi poistettiin.',
'Type has been created.' => 'Tyyppi luotiin.',
'Alter type' => 'Muuta tyyppiä',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Kiitos, kun käytät Admineriä, voit <a href="https://www.adminer.org/en/donation/">tehdä lahjoituksen tästä</a>.',
'Drop %s?' => 'Poistetaanko %s?',
'overwrite' => 'kirjoittaen päälle',
'DB' => 'TK',
'ATTACH queries are not supported.' => 'ATTACH-komennolla tehtyjä kyselyjä ei tueta.',
'Warnings' => 'Varoitukset',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer ei tue pääsyä tietokantaan ilman salasanaa, katso tarkemmin <a href="https://www.adminer.org/en/password/"%s>täältä</a>.',
'The action will be performed after successful login with the same credentials.' => 'Toiminto suoritetaan sen jälkeen, kun on onnistuttu kirjautumaan samoilla käyttäjätunnuksilla uudestaan.',
'Connecting to privileged ports is not allowed.' => 'Yhteydet etuoikeutettuihin portteihin eivät ole sallittuja.',
'There is a space in the input password which might be the cause.' => 'Syynä voi olla syötetyssä salasanassa oleva välilyönti.',
'Unknown error.' => 'Tuntematon virhe.',
'Database does not support password.' => 'Tietokanta ei tue salasanaa.',
'Disable %s or enable %s or %s extensions.' => 'Poista käytöstä %s tai ota käyttöön laajennus %s tai %s.',
);

View File

@@ -1,10 +1,3 @@
Adminer 4.7.8 (released 2020-12-06):
Support PHP 8
Disallow connecting to privileged ports (bug #769)
Adminer 4.7.7 (released 2020-05-11):
Fix open redirect if Adminer is accessible at //adminer.php%2F@
Adminer 4.7.6 (released 2020-01-31):
Speed up alter table form (regression from 4.4.0)
Fix clicking on non-input fields in alter table (regression from 4.6.2)

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env php
<?php
error_reporting(6133); // errors
error_reporting(6135); // errors and warnings
include dirname(__FILE__) . "/adminer/include/version.inc.php";
include dirname(__FILE__) . "/externals/JsShrink/jsShrink.php";
@@ -233,7 +233,7 @@ function php_shrink($input) {
$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 = '';
$output = '';
$in_echo = false;
@@ -315,14 +315,6 @@ function compile_file($match) {
return '"' . add_quo_slashes($file) . '"';
}
if (!function_exists("each")) {
function each(&$arr) {
$key = key($arr);
next($arr);
return $key === null ? false : array($key, $arr[$key]);
}
}
function min_version() {
return true;
}

View File

@@ -29,7 +29,7 @@ class AdminerLoginIp {
}
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
foreach ($this->forwarded_for as $forwarded_for) {
if (strncasecmp(preg_replace('~.*, *~', '', $_SERVER["HTTP_X_FORWARDED_FOR"]), $forwarded_for, strlen($forwarded_for)) == 0) {
if (strncasecmp(preg_replace('~.*, *~', '', $_SERVER["HTTP_X_FORWARDED_FOR"]), $forwarded_for, strlen($forwarded_for))) {
return true;
}
}