mirror of
https://github.com/vrana/adminer.git
synced 2025-08-16 03:24:01 +02:00
Replace isset($var) by $var !== null
This commit is contained in:
@@ -117,7 +117,7 @@ username.form['driver'].onchange();
|
||||
} else {
|
||||
$links["create"] = lang('Alter table');
|
||||
}
|
||||
if (isset($set)) {
|
||||
if ($set !== null) {
|
||||
$links["edit"] = lang('New item');
|
||||
}
|
||||
foreach ($links as $key => $val) {
|
||||
@@ -288,7 +288,7 @@ username.form['driver'].onchange();
|
||||
* @return null
|
||||
*/
|
||||
function selectLengthPrint($text_length) {
|
||||
if (isset($text_length)) {
|
||||
if ($text_length !== null) {
|
||||
echo "<fieldset><legend>" . lang('Text length') . "</legend><div>";
|
||||
echo '<input name="text_length" size="3" value="' . h($text_length) . '">';
|
||||
echo "</div></fieldset>\n";
|
||||
@@ -477,7 +477,7 @@ username.form['driver'].onchange();
|
||||
function editInput($table, $field, $attrs, $value) {
|
||||
if ($field["type"] == "enum") {
|
||||
return (isset($_GET["select"]) ? "<label><input type='radio'$attrs value='-1' checked><i>" . lang('original') . "</i></label> " : "")
|
||||
. ($field["null"] ? "<label><input type='radio'$attrs value=''" . (isset($value) || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "")
|
||||
. ($field["null"] ? "<label><input type='radio'$attrs value=''" . ($value !== null || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "")
|
||||
. enum_input("radio", $attrs, $field, $value, 0) // 0 - empty
|
||||
;
|
||||
}
|
||||
@@ -577,12 +577,12 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
|
||||
$after = "";
|
||||
foreach (get_rows($query) as $row) {
|
||||
$default = $row["COLUMN_DEFAULT"];
|
||||
$row["default"] = (isset($default) ? q($default) : "NULL");
|
||||
$row["default"] = ($default !== null ? q($default) : "NULL");
|
||||
$row["after"] = q($after); //! rgt AFTER lft, lft AFTER id doesn't work
|
||||
$row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"])
|
||||
. " $row[COLUMN_TYPE]"
|
||||
. ($row["COLLATION_NAME"] ? " COLLATE $row[COLLATION_NAME]" : "")
|
||||
. (isset($default) ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "")
|
||||
. ($default !== null ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "")
|
||||
. ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL")
|
||||
. ($row["EXTRA"] ? " $row[EXTRA]" : "")
|
||||
. ($row["COLUMN_COMMENT"] ? " COMMENT " . q($row["COLUMN_COMMENT"]) : "")
|
||||
@@ -667,7 +667,7 @@ DROP PROCEDURE adminer_alter;
|
||||
$insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('idf_escape', array_keys($row))) . ") VALUES";
|
||||
}
|
||||
foreach ($row as $key => $val) {
|
||||
$row[$key] = (isset($val) ? (ereg('int|float|double|decimal|bit', $fields[$key]["type"]) ? $val : q($val)) : "NULL"); //! columns looking like functions
|
||||
$row[$key] = ($val !== null ? (ereg('int|float|double|decimal|bit', $fields[$key]["type"]) ? $val : q($val)) : "NULL"); //! columns looking like functions
|
||||
}
|
||||
$s = implode(",\t", $row);
|
||||
if ($style == "INSERT+UPDATE") {
|
||||
@@ -750,7 +750,7 @@ DROP PROCEDURE adminer_alter;
|
||||
foreach ((array) $_SESSION["pwds"] as $driver => $servers) {
|
||||
foreach ($servers as $server => $usernames) {
|
||||
foreach ($usernames as $username => $password) {
|
||||
if (isset($password)) {
|
||||
if ($password !== null) {
|
||||
if ($first) {
|
||||
echo "<p onclick='eventStop(event);'>\n";
|
||||
$first = false;
|
||||
@@ -833,6 +833,6 @@ DROP PROCEDURE adminer_alter;
|
||||
}
|
||||
|
||||
$adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer);
|
||||
if (!isset($adminer->operators)) {
|
||||
if ($adminer->operators === null) {
|
||||
$adminer->operators = $operators;
|
||||
}
|
||||
|
@@ -67,7 +67,7 @@ function auth_error($exception = null) {
|
||||
$error = lang('Session expired, please login again.');
|
||||
} else {
|
||||
$password = &get_session("pwds");
|
||||
if (isset($password)) {
|
||||
if ($password !== null) {
|
||||
$error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.')));
|
||||
$password = null;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ document.body.className = document.body.className.replace(/ nojs/, ' js');
|
||||
|
||||
<div id="content">
|
||||
<?php
|
||||
if (isset($breadcrumb)) {
|
||||
if ($breadcrumb !== null) {
|
||||
$link = substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1);
|
||||
echo '<p id="breadcrumb"><a href="' . h($link ? $link : ".") . '">' . $drivers[DRIVER] . '</a> » ';
|
||||
$link = substr(preg_replace('~(db|ns)=[^&]*&~', '', ME), 0, -1);
|
||||
|
@@ -55,7 +55,7 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
|
||||
}
|
||||
echo "<tr" . odd() . ">";
|
||||
foreach ($row as $key => $val) {
|
||||
if (!isset($val)) {
|
||||
if ($val === null) {
|
||||
$val = "<i>NULL</i>";
|
||||
} elseif ($blobs[$key] && !is_utf8($val)) {
|
||||
$val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
|
||||
|
@@ -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;
|
||||
|
@@ -60,7 +60,7 @@ function lang($idf, $number = null) {
|
||||
}
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
return vsprintf((isset($translation) ? $translation : $idf), $args);
|
||||
return vsprintf(($translation !== null ? $translation : $idf), $args);
|
||||
}
|
||||
|
||||
function switch_lang() {
|
||||
|
Reference in New Issue
Block a user