]> git.joonet.de Git - adminer.git/commitdiff
Save bytes
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 7 Oct 2009 15:55:47 +0000 (15:55 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 7 Oct 2009 15:55:47 +0000 (15:55 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1179 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/call.inc.php
adminer/create.inc.php
adminer/edit.inc.php
adminer/include/functions.inc.php

index 77464ffa9d66e85fc141f1dbf0c6b8dcae5d8e69..f9871d53527c50524b0f6c39f69c6c71c0ad2756 100644 (file)
@@ -55,7 +55,7 @@ if ($in) {
                $field = $routine["fields"][$key];
                echo "<tr><th>" . h($field["field"]);
                $value = $_POST["fields"][$key];
-               if (strlen($value) && ($field["type"] == "enum" || $field["type"] == "set")) {
+               if (strlen($value) && ereg("enum|set", $field["type"])) {
                        $value = intval($value);
                }
                input($field, $value, (string) $_POST["function"][$name]); // param name can be empty
index 15da283fce91f0bb31854e2fe3a9321f39a5c0d3..abd9efc8cd1ad744db87df7e45dca81373adfa53 100644 (file)
@@ -101,7 +101,7 @@ page_header((strlen($TABLE) ? lang('Alter table') : lang('Create table')), $erro
 $engines = array();
 $result = $connection->query("SHOW ENGINES");
 while ($row = $result->fetch_assoc()) {
-       if ($row["Support"] == "YES" || $row["Support"] == "DEFAULT") {
+       if (ereg("YES|DEFAULT", $row["Support"])) {
                $engines[] = $row["Engine"];
        }
 }
index 23d39986803cba193ae6c5dd12322aa95acfa304..6aa40876221bbf8c6c0331bb9a2b68083edad3a3 100644 (file)
@@ -51,7 +51,7 @@ if ($_POST["save"]) {
        $select = array();
        foreach ($fields as $name => $field) {
                if (isset($field["privileges"]["select"])) {
-                       $select[] = ($_POST["clone"] && $field["auto_increment"] ? "'' AS " : ($field["type"] == "enum" || $field["type"] == "set" ? "1*" . idf_escape($name) . " AS " : "")) . idf_escape($name);
+                       $select[] = ($_POST["clone"] && $field["auto_increment"] ? "'' AS " : (ereg("enum|set", $field["type"]) ? "1*" . idf_escape($name) . " AS " : "")) . idf_escape($name);
                }
        }
        $row = array();
@@ -71,7 +71,7 @@ if ($fields) {
                echo "<tr><th>" . $adminer->fieldName($field);
                $default = $_GET["set"][bracket_escape($name)];
                $value = (isset($row)
-                       ? (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$name])
+                       ? (strlen($row[$name]) && ereg("enum|set", $field["type"]) ? intval($row[$name]) : $row[$name])
                        : ($_POST["clone"] && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : (isset($default) ? $default : $field["default"])))
                );
                if (!$_POST["save"] && is_string($value)) {
index 2b3fc3d14e6e779b6efe304a08b9401618a7e22e..1814c2771d521e6c4387c7c38f5c744b41e6223e 100644 (file)
@@ -138,7 +138,7 @@ function get_vals($query, $column = 0) {
 */
 function unique_idf($row, $indexes) {
        foreach ($indexes as $index) {
-               if ($index["type"] == "PRIMARY" || $index["type"] == "UNIQUE") {
+               if (ereg("PRIMARY|UNIQUE", $index["type"])) {
                        $return = array();
                        foreach ($index["columns"] as $key) {
                                if (!isset($row[$key])) { // NULL is ambiguous