\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;
}
diff --git a/adminer/include/auth.inc.php b/adminer/include/auth.inc.php
index b0a7034c..4b1fd0f7 100644
--- a/adminer/include/auth.inc.php
+++ b/adminer/include/auth.inc.php
@@ -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;
}
diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php
index 1eb52000..63a4c51d 100644
--- a/adminer/include/design.inc.php
+++ b/adminer/include/design.inc.php
@@ -41,7 +41,7 @@ document.body.className = document.body.className.replace(/ nojs/, ' js');
' . $drivers[DRIVER] . ' » ';
$link = substr(preg_replace('~(db|ns)=[^&]*&~', '', ME), 0, -1);
diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php
index f245266a..25c8fef4 100644
--- a/adminer/include/editing.inc.php
+++ b/adminer/include/editing.inc.php
@@ -55,7 +55,7 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
}
echo "
";
foreach ($row as $key => $val) {
- if (!isset($val)) {
+ if ($val === null) {
$val = "NULL";
} elseif ($blobs[$key] && !is_utf8($val)) {
$val = "" . lang('%d byte(s)', strlen($val)) . ""; //! link to download
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index 17fb05bc..1f27ced6 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -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) ? "" : "");
+ $return = ($empty !== null ? "" : "");
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))) . '';
+ echo (count($functions) > 1 ? html_select("function[$name]", $functions, $function === null || in_array($function, $functions) || isset($functions[$function]) ? $function : "", "functionChange(this);") : nbsp(reset($functions))) . ' | ';
$input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
if ($input != "") {
echo $input;
diff --git a/adminer/include/lang.inc.php b/adminer/include/lang.inc.php
index 96a6fbe6..3a28f28b 100644
--- a/adminer/include/lang.inc.php
+++ b/adminer/include/lang.inc.php
@@ -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() {
diff --git a/adminer/select.inc.php b/adminer/select.inc.php
index 3a5a3e41..8ecb7380 100644
--- a/adminer/select.inc.php
+++ b/adminer/select.inc.php
@@ -286,7 +286,7 @@ if (!$columns) {
$unique_array = unique_array($rows[$n], $indexes);
$unique_idf = "";
foreach ($unique_array as $key => $val) {
- $unique_idf .= "&" . (isset($val) ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key));
+ $unique_idf .= "&" . ($val !== null ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key));
}
echo " |
" . (!$group && $select ? "" : "" . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . (count($group) < count($select) || information_schema(DB) ? "" : " " . lang('edit') . ""));
foreach ($row as $key => $val) {
@@ -351,11 +351,11 @@ if (!$columns) {
}
$id = h("val[$unique_idf][" . bracket_escape($key) . "]");
$value = $_POST["val"][$unique_idf][bracket_escape($key)];
- $h_value = h(isset($value) ? $value : $row[$key]);
+ $h_value = h($value !== null ? $value : $row[$key]);
$long = strpos($val, "...");
$editable = is_utf8($val) && $rows[$n][$key] == $row[$key] && !$functions[$key];
$text = ereg('text|lob', $field["type"]);
- echo (($_GET["modify"] && $editable) || isset($value)
+ echo (($_GET["modify"] && $editable) || $value !== null
? " | " . ($text ? "" : "")
: " | " . $adminer->selectVal($val, $link, $field)
);
diff --git a/compile.php b/compile.php
index f7f62dc4..b32cd7d1 100644
--- a/compile.php
+++ b/compile.php
@@ -26,7 +26,7 @@ function remove_lang($match) {
function lang_ids($match) {
global $lang_ids;
$lang_id = &$lang_ids[stripslashes($match[1])];
- if (!isset($lang_id)) {
+ if ($lang_id === null) {
$lang_id = count($lang_ids) - 1;
}
return ($_SESSION["lang"] ? $match[0] : "lang($lang_id$match[2]");
@@ -68,7 +68,7 @@ function put_file_lang($match) {
include dirname(__FILE__) . "/adminer/lang/$lang.inc.php"; // assign $translations
$translation_ids = array_flip($lang_ids); // default translation
foreach ($translations as $key => $val) {
- if (isset($val)) {
+ if ($val !== null) {
$translation_ids[$lang_ids[$key]] = $val;
}
}
diff --git a/coverage.php b/coverage.php
index 8dc4421a..f10fc7fa 100644
--- a/coverage.php
+++ b/coverage.php
@@ -33,7 +33,7 @@ if (!extension_loaded("xdebug")) {
$filename = $_GET["coverage"];
$coverage = (file_exists($coverage_filename) ? unserialize(file_get_contents($coverage_filename)) : array());
$file = explode(" ", highlight_file($filename, true));
- unset($prev_color);
+ $prev_color = null;
$s = "";
for ($l=0; $l <= count($file); $l++) {
$line = $file[$l];
@@ -43,10 +43,10 @@ if (!extension_loaded("xdebug")) {
case -2: $color = "Silver"; break; // dead code
case null: $color = ""; break; // not executable
}
- if (!isset($prev_color)) {
+ if ($prev_color === null) {
$prev_color = $color;
}
- if ($prev_color != $color || !isset($line)) {
+ if ($prev_color != $color || $line === null) {
echo "$s";
$open_tags = xhtml_open_tags($s);
foreach (array_reverse($open_tags) as $tag) {
diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php
index 1830851e..fdfbdf16 100644
--- a/editor/include/adminer.inc.php
+++ b/editor/include/adminer.inc.php
@@ -68,7 +68,7 @@ document.getElementById('username').focus();
function selectLinks($tableStatus, $set = "") {
$TABLE = $tableStatus["Name"];
- if (isset($set)) {
+ if ($set !== null) {
echo ' ' . lang('New item') . "\n";
}
echo ">>\n";
@@ -181,7 +181,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
}
function editVal($val, $field) {
- if (ereg('date|timestamp', $field["type"]) && isset($val)) {
+ if (ereg('date|timestamp', $field["type"]) && $val !== null) {
return preg_replace('~^(\\d{2}(\\d+))-(0?(\\d+))-(0?(\\d+))~', lang('$1-$3-$5'), $val);
}
return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val);
@@ -434,7 +434,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
;
}
$options = $this->_foreignKeyOptions($table, $field["field"], $value);
- if (isset($options)) {
+ if ($options !== null) {
return (is_array($options)
? ""
: " "
@@ -526,7 +526,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
if ($missing == "auth") {
$first = true;
foreach ((array) $_SESSION["pwds"]["server"][""] as $username => $password) {
- if (isset($password)) {
+ if ($password !== null) {
if ($first) {
echo " \n";
$first = false;
@@ -580,11 +580,11 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
global $connection;
if (list($target, $id, $name) = $this->_foreignColumn(column_foreign_keys($table), $column)) {
$return = &$this->_values[$target];
- if (!isset($return)) {
+ if ($return === null) {
$table_status = table_status($target);
$return = ($table_status["Rows"] > 1000 ? "" : array("" => "") + get_key_vals("SELECT $id, $name FROM " . table($target) . " ORDER BY 2"));
}
- if (!$return && isset($value)) {
+ if (!$return && $value !== null) {
return $connection->result("SELECT $name FROM " . table($target) . " WHERE $id = " . q($value));
}
return $return;
diff --git a/plugins/edit-foreign.php b/plugins/edit-foreign.php
index fa488eb3..6601510c 100644
--- a/plugins/edit-foreign.php
+++ b/plugins/edit-foreign.php
@@ -11,7 +11,7 @@ class AdminerEditForeign {
static $foreignTables = array();
static $values = array();
$foreignKeys = &$foreignTables[$table];
- if (!isset($foreignKeys)) {
+ if ($foreignKeys === null) {
$foreignKeys = column_foreign_keys($table);
}
foreach ((array) $foreignKeys[$field["field"]] as $foreignKey) {
diff --git a/plugins/enum-option.php b/plugins/enum-option.php
index 280ae5f1..e1867c2f 100644
--- a/plugins/enum-option.php
+++ b/plugins/enum-option.php
@@ -16,7 +16,7 @@ class AdminerEnumOption {
}
if ($field["null"]) {
$options[""][""] = "NULL";
- if (!isset($value) && !isset($_GET["select"])) {
+ if ($value === null && !isset($_GET["select"])) {
$selected = "";
}
}
diff --git a/plugins/file-upload.php b/plugins/file-upload.php
index b07cf2bf..148a3495 100644
--- a/plugins/file-upload.php
+++ b/plugins/file-upload.php
@@ -17,7 +17,7 @@ class AdminerFileUpload {
*/
function AdminerFileUpload($uploadPath = "../static/data/", $displayPath = null, $extensions = "[a-zA-Z0-9]+") {
$this->uploadPath = $uploadPath;
- $this->displayPath = (isset($displayPath) ? $displayPath : $uploadPath);
+ $this->displayPath = ($displayPath !== null ? $displayPath : $uploadPath);
$this->extensions = $extensions;
}
diff --git a/plugins/plugin.php b/plugins/plugin.php
index a1736e94..31f8e63a 100644
--- a/plugins/plugin.php
+++ b/plugins/plugin.php
@@ -20,7 +20,7 @@ class AdminerPlugin extends Adminer {
* @param array object instances or null to register all classes starting by 'Adminer'
*/
function AdminerPlugin($plugins) {
- if (!isset($plugins)) {
+ if ($plugins === null) {
$plugins = array();
foreach (get_declared_classes() as $class) {
if (preg_match('~^Adminer.~i', $class) && strcasecmp($this->_findRootClass($class), 'Adminer')) { // can use interface since PHP 5
@@ -54,7 +54,7 @@ class AdminerPlugin extends Adminer {
case 4: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3]); break;
default: trigger_error('Too many parameters.', E_USER_WARNING);
}
- if (isset($return)) {
+ if ($return !== null) {
return $return;
}
}
diff --git a/plugins/slugify.php b/plugins/slugify.php
index 32946864..893c3089 100644
--- a/plugins/slugify.php
+++ b/plugins/slugify.php
@@ -21,7 +21,7 @@ class AdminerSlugify {
function editInput($table, $field, $attrs, $value) {
static $slugify;
if (!$_GET["select"] && !$_GET["where"]) {
- if (!isset($slugify)) {
+ if ($slugify === null) {
$slugify = array();
$prev = null;
foreach (fields($table) as $name => $val) {
@@ -32,7 +32,7 @@ class AdminerSlugify {
}
}
$slug = $slugify[$field["field"]];
- if (isset($slug)) {
+ if ($slug !== null) {
return "";
}
}
diff --git a/plugins/translation.php b/plugins/translation.php
index 59e5554a..9514bc0f 100644
--- a/plugins/translation.php
+++ b/plugins/translation.php
@@ -19,17 +19,17 @@ class AdminerTranslation {
function _translate($idf) {
static $translations, $lang;
- if (!isset($lang)) {
+ if ($lang === null) {
$lang = get_lang();
}
if ($idf == "" || $lang == "en") {
return $idf;
}
- if (!isset($translations)) {
+ if ($translations === null) {
$translations = get_key_vals("SELECT idf, translation FROM translation WHERE language_id = " . q($lang));
}
$return = &$translations[$idf];
- if (!isset($return)) {
+ if ($return === null) {
$return = $idf;
$connection = connection();
$connection->query("INSERT INTO translation (language_id, idf, translation) VALUES (" . q($lang) . ", " . q($idf) . ", " . q($idf) . ")");
|