Work without session.use_cookies (bug #3138640)
This commit is contained in:
parent
0449351a60
commit
f30fd121c1
|
@ -59,7 +59,7 @@ include "../adminer/drivers/mysql.inc.php"; // must be included as last driver
|
||||||
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
|
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
|
||||||
define("DB", $_GET["db"]); // for the sake of speed and size
|
define("DB", $_GET["db"]); // for the sake of speed and size
|
||||||
define("ME", preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) . '?'
|
define("ME", preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) . '?'
|
||||||
. (SID && !$_COOKIE ? SID . '&' : '') // !$_COOKIE - don't pass SID with permanent login
|
. (sid() ? SID . '&' : '')
|
||||||
. (SERVER !== null ? DRIVER . "=" . urlencode(SERVER) . '&' : '')
|
. (SERVER !== null ? DRIVER . "=" . urlencode(SERVER) . '&' : '')
|
||||||
. (isset($_GET["username"]) ? "username=" . urlencode($_GET["username"]) . '&' : '')
|
. (isset($_GET["username"]) ? "username=" . urlencode($_GET["username"]) . '&' : '')
|
||||||
. (DB != "" ? 'db=' . urlencode(DB) . '&' . (isset($_GET["ns"]) ? "ns=" . urlencode($_GET["ns"]) . "&" : "") : '')
|
. (DB != "" ? 'db=' . urlencode(DB) . '&' . (isset($_GET["ns"]) ? "ns=" . urlencode($_GET["ns"]) . "&" : "") : '')
|
||||||
|
|
|
@ -161,6 +161,17 @@ function ini_bool($ini) {
|
||||||
return (eregi('^(on|true|yes)$', $val) || (int) $val); // boolean values set by php_value are strings
|
return (eregi('^(on|true|yes)$', $val) || (int) $val); // boolean values set by php_value are strings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check if SID is neccessary
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function sid() {
|
||||||
|
return (SID && !($_COOKIE && ini_bool("session.use_cookies"))); // $_COOKIE - don't pass SID with permanent login
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Shortcut for $connection->quote($string)
|
||||||
|
* @param string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function q($string) {
|
function q($string) {
|
||||||
global $connection;
|
global $connection;
|
||||||
return $connection->quote($string);
|
return $connection->quote($string);
|
||||||
|
@ -345,7 +356,7 @@ function auth_url($driver, $server, $username) {
|
||||||
global $drivers;
|
global $drivers;
|
||||||
preg_match('~([^?]*)\\??(.*)~', remove_from_uri(implode("|", array_keys($drivers)) . "|username|" . session_name()), $match);
|
preg_match('~([^?]*)\\??(.*)~', remove_from_uri(implode("|", array_keys($drivers)) . "|username|" . session_name()), $match);
|
||||||
return "$match[1]?"
|
return "$match[1]?"
|
||||||
. (SID && !$_COOKIE ? SID . "&" : "")
|
. (sid() ? SID . "&" : "")
|
||||||
. ($driver != "server" || $server != "" ? urlencode($driver) . "=" . urlencode($server) . "&" : "")
|
. ($driver != "server" || $server != "" ? urlencode($driver) . "=" . urlencode($server) . "&" : "")
|
||||||
. "username=" . urlencode($username)
|
. "username=" . urlencode($username)
|
||||||
. ($match[2] ? "&$match[2]" : "")
|
. ($match[2] ? "&$match[2]" : "")
|
||||||
|
@ -570,7 +581,7 @@ function hidden_fields($process, $ignore = array()) {
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function hidden_fields_get() {
|
function hidden_fields_get() {
|
||||||
echo (SID && !$_COOKIE ? '<input type="hidden" name="' . session_name() . '" value="' . h(session_id()) . '">' : '');
|
echo (sid() ? '<input type="hidden" name="' . session_name() . '" value="' . h(session_id()) . '">' : '');
|
||||||
echo (SERVER !== null ? '<input type="hidden" name="' . DRIVER . '" value="' . h(SERVER) . '">' : "");
|
echo (SERVER !== null ? '<input type="hidden" name="' . DRIVER . '" value="' . h(SERVER) . '">' : "");
|
||||||
echo '<input type="hidden" name="username" value="' . h($_GET["username"]) . '">';
|
echo '<input type="hidden" name="username" value="' . h($_GET["username"]) . '">';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue