Diff of /adminer/include/adminer.inc.php [40ad84] .. [6591d4] Maximize Restore

  Switch to unified view

a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php
...
...
115
        if (is_view($tableStatus)) {
115
        if (is_view($tableStatus)) {
116
            $links["view"] = lang('Alter view');
116
            $links["view"] = lang('Alter view');
117
        } else {
117
        } else {
118
            $links["create"] = lang('Alter table');
118
            $links["create"] = lang('Alter table');
119
        }
119
        }
120
      if (isset($set)) {
120
      if ($set !== null) {
121
            $links["edit"] = lang('New item');
121
            $links["edit"] = lang('New item');
122
        }
122
        }
123
        foreach ($links as $key => $val) {
123
        foreach ($links as $key => $val) {
124
            echo " <a href='" . h(ME) . "$key=" . urlencode($tableStatus["Name"]) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
124
            echo " <a href='" . h(ME) . "$key=" . urlencode($tableStatus["Name"]) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
125
        }
125
        }
...
...
286
    /** Print text length box in select
286
    /** Print text length box in select
287
    * @param string result of selectLengthProcess()
287
    * @param string result of selectLengthProcess()
288
    * @return null
288
    * @return null
289
    */
289
    */
290
    function selectLengthPrint($text_length) {
290
    function selectLengthPrint($text_length) {
291
      if (isset($text_length)) {
291
      if ($text_length !== null) {
292
            echo "<fieldset><legend>" . lang('Text length') . "</legend><div>";
292
            echo "<fieldset><legend>" . lang('Text length') . "</legend><div>";
293
            echo '<input name="text_length" size="3" value="' . h($text_length) . '">';
293
            echo '<input name="text_length" size="3" value="' . h($text_length) . '">';
294
            echo "</div></fieldset>\n";
294
            echo "</div></fieldset>\n";
295
        }
295
        }
296
    }
296
    }
...
...
475
    * @return string custom input field or empty string for default
475
    * @return string custom input field or empty string for default
476
    */
476
    */
477
    function editInput($table, $field, $attrs, $value) {
477
    function editInput($table, $field, $attrs, $value) {
478
        if ($field["type"] == "enum") {
478
        if ($field["type"] == "enum") {
479
            return (isset($_GET["select"]) ? "<label><input type='radio'$attrs value='-1' checked><i>" . lang('original') . "</i></label> " : "")
479
            return (isset($_GET["select"]) ? "<label><input type='radio'$attrs value='-1' checked><i>" . lang('original') . "</i></label> " : "")
480
                . ($field["null"] ? "<label><input type='radio'$attrs value=''" . (isset($value) || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "")
480
                . ($field["null"] ? "<label><input type='radio'$attrs value=''" . ($value !== null || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "")
481
                . enum_input("radio", $attrs, $field, $value, 0) // 0 - empty
481
                . enum_input("radio", $attrs, $field, $value, 0) // 0 - empty
482
            ;
482
            ;
483
        }
483
        }
484
        return "";
484
        return "";
485
    }
485
    }
...
...
575
    DECLARE add_columns text DEFAULT '";
575
    DECLARE add_columns text DEFAULT '";
576
                $fields = array();
576
                $fields = array();
577
                $after = "";
577
                $after = "";
578
                foreach (get_rows($query) as $row) {
578
                foreach (get_rows($query) as $row) {
579
                    $default = $row["COLUMN_DEFAULT"];
579
                    $default = $row["COLUMN_DEFAULT"];
580
                    $row["default"] = (isset($default) ? q($default) : "NULL");
580
                    $row["default"] = ($default !== null ? q($default) : "NULL");
581
                    $row["after"] = q($after); //! rgt AFTER lft, lft AFTER id doesn't work
581
                    $row["after"] = q($after); //! rgt AFTER lft, lft AFTER id doesn't work
582
                    $row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"])
582
                    $row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"])
583
                        . " $row[COLUMN_TYPE]"
583
                        . " $row[COLUMN_TYPE]"
584
                        . ($row["COLLATION_NAME"] ? " COLLATE $row[COLLATION_NAME]" : "")
584
                        . ($row["COLLATION_NAME"] ? " COLLATE $row[COLLATION_NAME]" : "")
585
                        . (isset($default) ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "")
585
                        . ($default !== null ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "")
586
                        . ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL")
586
                        . ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL")
587
                        . ($row["EXTRA"] ? " $row[EXTRA]" : "")
587
                        . ($row["EXTRA"] ? " $row[EXTRA]" : "")
588
                        . ($row["COLUMN_COMMENT"] ? " COMMENT " . q($row["COLUMN_COMMENT"]) : "")
588
                        . ($row["COLUMN_COMMENT"] ? " COMMENT " . q($row["COLUMN_COMMENT"]) : "")
589
                        . ($after ? " AFTER " . idf_escape($after) : " FIRST")
589
                        . ($after ? " AFTER " . idf_escape($after) : " FIRST")
590
                    );
590
                    );
...
...
665
                    } else {
665
                    } else {
666
                        if (!$insert) {
666
                        if (!$insert) {
667
                            $insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('idf_escape', array_keys($row))) . ") VALUES";
667
                            $insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('idf_escape', array_keys($row))) . ") VALUES";
668
                        }
668
                        }
669
                        foreach ($row as $key => $val) {
669
                        foreach ($row as $key => $val) {
670
                            $row[$key] = (isset($val) ? (ereg('int|float|double|decimal|bit', $fields[$key]["type"]) ? $val : q($val)) : "NULL"); //! columns looking like functions
670
                            $row[$key] = ($val !== null ? (ereg('int|float|double|decimal|bit', $fields[$key]["type"]) ? $val : q($val)) : "NULL"); //! columns looking like functions
671
                        }
671
                        }
672
                        $s = implode(",\t", $row);
672
                        $s = implode(",\t", $row);
673
                        if ($style == "INSERT+UPDATE") {
673
                        if ($style == "INSERT+UPDATE") {
674
                            $set = array();
674
                            $set = array();
675
                            foreach ($row as $key => $val) {
675
                            foreach ($row as $key => $val) {
...
...
748
        if ($missing == "auth") {
748
        if ($missing == "auth") {
749
            $first = true;
749
            $first = true;
750
            foreach ((array) $_SESSION["pwds"] as $driver => $servers) {
750
            foreach ((array) $_SESSION["pwds"] as $driver => $servers) {
751
                foreach ($servers as $server => $usernames) {
751
                foreach ($servers as $server => $usernames) {
752
                    foreach ($usernames as $username => $password) {
752
                    foreach ($usernames as $username => $password) {
753
                      if (isset($password)) {
753
                      if ($password !== null) {
754
                            if ($first) {
754
                            if ($first) {
755
                                echo "<p onclick='eventStop(event);'>\n";
755
                                echo "<p onclick='eventStop(event);'>\n";
756
                                $first = false;
756
                                $first = false;
757
                            }
757
                            }
758
                            echo "<a href='" . h(auth_url($driver, $server, $username)) . "'>($drivers[$driver]) " . h($username . ($server != "" ? "@$server" : "")) . "</a><br>\n";
758
                            echo "<a href='" . h(auth_url($driver, $server, $username)) . "'>($drivers[$driver]) " . h($username . ($server != "" ? "@$server" : "")) . "</a><br>\n";
...
...
831
    }
831
    }
832
    
832
    
833
}
833
}
834
834
835
$adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer);
835
$adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer);
836
if (!isset($adminer->operators)) {
836
if ($adminer->operators === null) {
837
    $adminer->operators = $operators;
837
    $adminer->operators = $operators;
838
}
838
}