mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
Replace isset($var) by $var !== null
This commit is contained in:
@@ -206,7 +206,7 @@ function json_row($key, $val = null) {
|
||||
echo "{";
|
||||
}
|
||||
if ($key != "") {
|
||||
echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\"\\") . '": ' . (isset($val) ? '"' . addcslashes($val, "\r\n\"\\") . '"' : 'undefined');
|
||||
echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\"\\") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\") . '"' : 'undefined');
|
||||
$first = false;
|
||||
} else {
|
||||
echo "\n}\n";
|
||||
@@ -228,7 +228,7 @@ function ini_bool($ini) {
|
||||
*/
|
||||
function sid() {
|
||||
static $return;
|
||||
if (!isset($return)) { // restart_session() defines SID
|
||||
if ($return === null) { // restart_session() defines SID
|
||||
$return = (SID && !($_COOKIE && ini_bool("session.use_cookies"))); // $_COOKIE - don't pass SID with permanent login
|
||||
}
|
||||
return $return;
|
||||
@@ -364,7 +364,7 @@ function where_check($val) {
|
||||
* @return string
|
||||
*/
|
||||
function where_link($i, $column, $value, $operator = "=") {
|
||||
return "&where%5B$i%5D%5Bcol%5D=" . urlencode($column) . "&where%5B$i%5D%5Bop%5D=" . urlencode((isset($value) ? $operator : "IS NULL")) . "&where%5B$i%5D%5Bval%5D=" . urlencode($value);
|
||||
return "&where%5B$i%5D%5Bcol%5D=" . urlencode($column) . "&where%5B$i%5D%5Bop%5D=" . urlencode(($value !== null ? $operator : "IS NULL")) . "&where%5B$i%5D%5Bval%5D=" . urlencode($value);
|
||||
}
|
||||
|
||||
/** Set cookie valid for 1 month
|
||||
@@ -444,11 +444,11 @@ function is_ajax() {
|
||||
* @return null
|
||||
*/
|
||||
function redirect($location, $message = null) {
|
||||
if (isset($message)) {
|
||||
if ($message !== null) {
|
||||
restart_session();
|
||||
$_SESSION["messages"][preg_replace('~^[^?]*~', '', (isset($location) ? $location : $_SERVER["REQUEST_URI"]))][] = $message;
|
||||
$_SESSION["messages"][preg_replace('~^[^?]*~', '', ($location !== null ? $location : $_SERVER["REQUEST_URI"]))][] = $message;
|
||||
}
|
||||
if (isset($location)) {
|
||||
if ($location !== null) {
|
||||
if ($location == "") {
|
||||
$location = ".";
|
||||
}
|
||||
@@ -492,7 +492,7 @@ function query_redirect($query, $location, $message, $redirect = true, $execute
|
||||
function queries($query = null) {
|
||||
global $connection;
|
||||
static $queries = array();
|
||||
if (!isset($query)) {
|
||||
if ($query === null) {
|
||||
// return executed queries without parameter
|
||||
return implode(";\n", $queries);
|
||||
}
|
||||
@@ -668,7 +668,7 @@ function column_foreign_keys($table) {
|
||||
function enum_input($type, $attrs, $field, $value, $empty = null) {
|
||||
global $adminer;
|
||||
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
||||
$return = (isset($empty) ? "<label><input type='$type'$attrs value='$empty'" . ((is_array($value) ? in_array($empty, $value) : $value === 0) ? " checked" : "") . "><i>" . lang('empty') . "</i></label>" : "");
|
||||
$return = ($empty !== null ? "<label><input type='$type'$attrs value='$empty'" . ((is_array($value) ? in_array($empty, $value) : $value === 0) ? " checked" : "") . "><i>" . lang('empty') . "</i></label>" : "");
|
||||
foreach ($matches[1] as $i => $val) {
|
||||
$val = stripcslashes(str_replace("''", "'", $val));
|
||||
$checked = (is_int($value) ? $value == $i+1 : (is_array($value) ? in_array($i+1, $value) : $value === $val));
|
||||
@@ -705,7 +705,7 @@ function input($field, $value, $function) {
|
||||
}
|
||||
$onchange = ($first ? " onchange=\"var f = this.form['function[" . h(js_escape(bracket_escape($field["field"]))) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
|
||||
$attrs .= $onchange;
|
||||
echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) || isset($functions[$function]) ? $function : "", "functionChange(this);") : nbsp(reset($functions))) . '<td>';
|
||||
echo (count($functions) > 1 ? html_select("function[$name]", $functions, $function === null || in_array($function, $functions) || isset($functions[$function]) ? $function : "", "functionChange(this);") : nbsp(reset($functions))) . '<td>';
|
||||
$input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
|
||||
if ($input != "") {
|
||||
echo $input;
|
||||
|
Reference in New Issue
Block a user