]> git.joonet.de Git - adminer.git/commitdiff
Replace isset($var) by $var !== null
authorJakub Vrana <jakub@vrana.cz>
Mon, 14 May 2012 06:54:07 +0000 (23:54 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 14 May 2012 08:11:08 +0000 (01:11 -0700)
24 files changed:
adminer/create.inc.php
adminer/db.inc.php
adminer/drivers/mssql.inc.php
adminer/drivers/mysql.inc.php
adminer/drivers/oracle.inc.php
adminer/drivers/pgsql.inc.php
adminer/drivers/sqlite.inc.php
adminer/edit.inc.php
adminer/include/adminer.inc.php
adminer/include/auth.inc.php
adminer/include/design.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/include/lang.inc.php
adminer/select.inc.php
compile.php
coverage.php
editor/include/adminer.inc.php
plugins/edit-foreign.php
plugins/enum-option.php
plugins/file-upload.php
plugins/plugin.php
plugins/slugify.php
plugins/translation.php

index b81033cf5260047ca133eaba33d5ae42096808da..e5bdc4d975f8442deef710c744aacbae6f36abd6 100644 (file)
@@ -29,7 +29,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
                $after = "FIRST";
                foreach ($_POST["fields"] as $key => $field) {
                        $foreign_key = $foreign_keys[$field["type"]];
-                       $type_field = (isset($foreign_key) ? $referencable_primary[$foreign_key] : $field); //! can collide with user defined type
+                       $type_field = ($foreign_key !== null ? $referencable_primary[$foreign_key] : $field); //! can collide with user defined type
                        if ($field["field"] != "") {
                                if (!$field["has_default"]) {
                                        $field["default"] = null;
@@ -46,7 +46,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
                                if ($process_field != process_field($orig_field, $orig_field)) {
                                        $fields[] = array($field["orig"], $process_field, $after);
                                }
-                               if (isset($foreign_key)) {
+                               if ($foreign_key !== null) {
                                        $foreign[idf_escape($field["field"])] = ($TABLE != "" ? "ADD" : " ") . " FOREIGN KEY (" . idf_escape($field["field"]) . ") REFERENCES " . table($foreign_keys[$field["type"]]) . " (" . idf_escape($type_field["field"]) . ")" . (ereg("^($on_actions)\$", $field["on_delete"]) ? " ON DELETE $field[on_delete]" : "");
                                }
                                $after = "AFTER " . idf_escape($field["field"]);
index 77f8d3380b34c899a2360d455698b816f074fe15..d452054d3ab152cb09785eda5a9f324233fdd9d1 100644 (file)
@@ -67,7 +67,7 @@ if ($adminer->homepage()) {
                        echo (support("comment") ? '<td>' . lang('Comment') : '');
                        echo "</thead>\n";
                        foreach ($tables_list as $name => $type) {
-                               $view = (isset($type) && !eregi("table", $type));
+                               $view = ($type !== null && !eregi("table", $type));
                                echo '<tr' . odd() . '><td>' . checkbox(($view ? "views[]" : "tables[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');");
                                echo '<th><a href="' . h(ME) . 'table=' . urlencode($name) . '" title="' . lang('Show structure') . '">' . h($name) . '</a>';
                                if ($view) {
index 707c896b7e478a83a890ec01eee42127463a7bf3..3c024e1cba7c6e42e13b29315aa48693bf543d46 100644 (file)
@@ -252,7 +252,7 @@ if (isset($_GET["mssql"])) {
        }
 
        function limit($query, $where, $limit, $offset = 0, $separator = " ") {
-               return (isset($limit) ? " TOP (" . ($limit + $offset) . ")" : "") . " $query$where"; // seek later
+               return ($limit !== null ? " TOP (" . ($limit + $offset) . ")" : "") . " $query$where"; // seek later
        }
 
        function limit1($query, $where) {
index 6274c997b98224a25878aaa0fc82254bcc17977f..eb9eeeacd45e9739dc98cd796d2380f2fd4ab6ef 100644 (file)
@@ -268,7 +268,7 @@ if (!defined("DRIVER")) {
                global $connection;
                // SHOW DATABASES can take a very long time so it is cached
                $return = &get_session("dbs");
-               if (!isset($return)) {
+               if ($return === null) {
                        if ($flush) {
                                restart_session();
                                ob_flush();
@@ -288,7 +288,7 @@ if (!defined("DRIVER")) {
        * @return string
        */
        function limit($query, $where, $limit, $offset = 0, $separator = " ") {
-               return " $query$where" . (isset($limit) ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
+               return " $query$where" . ($limit !== null ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
        }
 
        /** Formulate SQL modification query with limit 1
index 2727428c2040435320653cebad2f211951f9d4c7..48163b16d8082b8d09064faa35519e1a91fc611d 100644 (file)
@@ -154,7 +154,7 @@ if (isset($_GET["oracle"])) {
 
        function limit($query, $where, $limit, $offset = 0, $separator = " ") {
                return ($offset ? " * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $query$where) t WHERE rownum <= " . ($limit + $offset) . ") WHERE rnum > $offset"
-                       : (isset($limit) ? " * FROM (SELECT $query$where) WHERE rownum <= " . ($limit + $offset)
+                       : ($limit !== null ? " * FROM (SELECT $query$where) WHERE rownum <= " . ($limit + $offset)
                        : " $query$where"
                ));
        }
index 13b42d4b5b1c8d03e468e25738233c376048eab3..7ae0e049819a6f4d4cfb6a609c0ccec96b8077e6 100644 (file)
@@ -174,7 +174,7 @@ if (isset($_GET["pgsql"])) {
        }
        
        function limit($query, $where, $limit, $offset = 0, $separator = " ") {
-               return " $query$where" . (isset($limit) ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
+               return " $query$where" . ($limit !== null ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
        }
 
        function limit1($query, $where) {
index 85d1347ad34a49a67934dd9b40f87e403b6d1fd5..3ad2fc730194a2a94726da148e792c6f6c445364 100644 (file)
@@ -218,7 +218,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
        }
 
        function limit($query, $where, $limit, $offset = 0, $separator = " ") {
-               return " $query$where" . (isset($limit) ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
+               return " $query$where" . ($limit !== null ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
        }
 
        function limit1($query, $where) {
index a82f85329cb281d4900dde197dd70e9bba006415..e2bd7ae7ea89f738fd50d645f0d12c3aeec85605 100644 (file)
@@ -75,14 +75,14 @@ if ($fields) {
        foreach ($fields as $name => $field) {
                echo "<tr><th>" . $adminer->fieldName($field);
                $default = $_GET["set"][bracket_escape($name)];
-               $value = (isset($row)
+               $value = ($row !== null
                        ? ($row[$name] != "" && ereg("enum|set", $field["type"]) ? (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) : $row[$name])
-                       : (!$update && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : (isset($default) ? $default : $field["default"])))
+                       : (!$update && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : ($default !== null ? $default : $field["default"])))
                );
                if (!$_POST["save"] && is_string($value)) {
                        $value = $adminer->editVal($value, $field);
                }
-               $function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($update && $field["on_update"] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : (isset($value) ? '' : 'NULL'))));
+               $function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($update && $field["on_update"] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL'))));
                if ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") {
                        $value = "";
                        $function = "now";
index dd8ff195ae2bd7337af77d9f1cca48270601f8a8..75c71c4a159ca37dc652b59aaa8d9b4005a80ab7 100644 (file)
@@ -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;
 }
index b0a7034c86ff5c17ee1626ee3ac20a69dbca4846..4b1fd0f734ebf2134cf26238ed8dfd6a10fb606b 100644 (file)
@@ -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;
                        }
index 1eb5200002a26d24c7319f356625662909e727d0..63a4c51d0f2cd4151989411cf2b2a07fba0b98b1 100644 (file)
@@ -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> &raquo; ';
                $link = substr(preg_replace('~(db|ns)=[^&]*&~', '', ME), 0, -1);
index f245266a725113003b156a148b07eb330462c37b..25c8fef4cb43eb354895f7905ba9339220939433 100644 (file)
@@ -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
index 17fb05bc1ed447923e55b1eda4e03cfb8182ba49..1f27ced639c076babad5d52e1f739e4a7e853ac7 100644 (file)
@@ -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;
index 96a6fbe6cd8dcbfcd61a0eb5671587227609223f..3a28f28ba820f61c9fb6e1bca2af923222650cb2 100644 (file)
@@ -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() {
index 3a5a3e41a3b28bf5b43e4e160af215f74e2e3ad0..8ecb73803c7d78c8fc8e8460a28edefe80be55c2 100644 (file)
@@ -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 "<tr" . odd() . ">" . (!$group && $select ? "" : "<td>" . 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) ? "" : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'>" . lang('edit') . "</a>"));
                                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, "<i>...</i>");
                                                $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
                                                        ? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
                                                        : "<td id='$id' ondblclick=\"" . ($editable ? "selectDblClick(this, event" . ($long ? ", 2" : ($text ? ", 1" : "")) . ")" : "alert('" . h(lang('Use edit link to modify this value.')) . "')") . ";\">" . $adminer->selectVal($val, $link, $field)
                                                );
index f7f62dc4019bb8401db497f5ef1817f93717c8f1..b32cd7d1c76494c18744e92decb915ee73abe079 100644 (file)
@@ -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;
                        }
                }
index 8dc4421a1ddf9788f1e89e1b3c8c014cdc875eb2..f10fc7fab548fc6e7cd7afd23ca285499ee09aff 100644 (file)
@@ -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("<br />", 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 "<div" . ($prev_color ? " style='background-color: $prev_color;'" : "") . ">$s";
                        $open_tags = xhtml_open_tags($s);
                        foreach (array_reverse($open_tags) as $tag) {
index 1830851eeab7712ec2c963e18f5b160c42b94b7b..fdfbdf169f9e8dba9cec07fe17c5f383fcb94025 100644 (file)
@@ -68,7 +68,7 @@ document.getElementById('username').focus();
        
        function selectLinks($tableStatus, $set = "") {
                $TABLE = $tableStatus["Name"];
-               if (isset($set)) {
+               if ($set !== null) {
                        echo '<p class="tabs"><a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . "</a>\n";
                }
                echo "<a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Last page') . "'>&gt;&gt;</a>\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)
                                ? "<select$attrs>" . optionlist($options, $value, true) . "</select>"
                                :  "<input value='" . h($value) . "'$attrs class='hidden'><input value='" . h($options) . "' class='jsonly' onkeyup=\"whisper('" . h(ME . "script=complete&source=" . urlencode($table) . "&field=" . urlencode($field["field"])) . "&value=', this);\"><div onclick='return whisperClick(event, this.previousSibling);'></div>"
@@ -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 "<p onclick='eventStop(event);'>\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;
index fa488eb3544f8edfef6af0912f689fb46d442663..6601510c4b5244e8b8954d61ebf6e86f094eb602 100644 (file)
@@ -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) {
index 280ae5f1e44f34ce9c1b6560cde6b638a6d33acf..e1867c2f3fe33e05a391e02fde6622feff1de341 100644 (file)
@@ -16,7 +16,7 @@ class AdminerEnumOption {
                        }
                        if ($field["null"]) {
                                $options[""][""] = "NULL";
-                               if (!isset($value) && !isset($_GET["select"])) {
+                               if ($value === null && !isset($_GET["select"])) {
                                        $selected = "";
                                }
                        }
index b07cf2bf446decbbdcd1de44f932b66d0c34863b..148a3495185d7b4dde9e8bbd1db27c6add2860a5 100644 (file)
@@ -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;
        }
        
index a1736e9451eb7e2271106c11b8892bfc3ed5a79c..31f8e63a8a0e043d178f924d25be276a96d24fa3 100644 (file)
@@ -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;
                                }
                        }
index 329468643dad9491e21becdea1a14f2732454295..893c30899e047b5ead56732d64062a2acfe8a190 100644 (file)
@@ -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 "<input value='" . h($value) . "' maxlength='$field[length]' size='40'$attrs onchange=\"var find = '$this->from'; var repl = '$this->to'; this.form['fields[$slug]'].value = this.value.toLowerCase().replace(new RegExp('[' + find + ']', 'g'), function (str) { return repl[find.indexOf(str)]; }).replace(/[^a-z0-9_]+/g, '-').replace(/^-|-\$/g, '').substr(0, $field[length]);\">";
                        }
                }
index 59e5554a87d5b05de54f005577c5153d6427dbcf..9514bc0f28e44229c45600074a790c0d04233fa9 100644 (file)
@@ -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) . ")");