Browse files

Save bytes

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1179 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent ddb0a34 commit 4b3d569a6e1756d21130334f5300df8f26ad57b1 jakubvrana committed Oct 7, 2009
Showing with 5 additions and 5 deletions.
  1. +1 −1 adminer/call.inc.php
  2. +1 −1 adminer/create.inc.php
  3. +2 −2 adminer/edit.inc.php
  4. +1 −1 adminer/include/functions.inc.php
View
2 adminer/call.inc.php
@@ -55,7 +55,7 @@
$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
View
2 adminer/create.inc.php
@@ -101,7 +101,7 @@
$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"];
}
}
View
4 adminer/edit.inc.php
@@ -51,7 +51,7 @@
$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 @@
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)) {
View
2 adminer/include/functions.inc.php
@@ -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

0 comments on commit 4b3d569

Please sign in to comment.