diff --git a/adminer/call.inc.php b/adminer/call.inc.php index 5c1ba945..0407474b 100644 --- a/adminer/call.inc.php +++ b/adminer/call.inc.php @@ -58,7 +58,7 @@ if ($in) { echo "" . $adminer->fieldName($field); $value = $_POST["fields"][$name]; if ($value != "" && ereg("enum|set", $field["type"])) { - $value = intval($value); + $value = +$value; } input($field, $value, (string) $_POST["function"][$name]); // param name can be empty echo "\n"; diff --git a/adminer/create.inc.php b/adminer/create.inc.php index fcce1e28..92091dd5 100644 --- a/adminer/create.inc.php +++ b/adminer/create.inc.php @@ -65,7 +65,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] } $partitioning .= "\nPARTITION BY $_POST[partition_by]($_POST[partition])" . ($partitions // $_POST["partition"] can be expression, not only column ? " (" . implode(",", $partitions) . "\n)" - : ($_POST["partitions"] ? " PARTITIONS " . intval($_POST["partitions"]) : "") + : ($_POST["partitions"] ? " PARTITIONS " . (+$_POST["partitions"]) : "") ); } elseif ($TABLE != "" && support("partitioning")) { $partitioning .= "\nREMOVE PARTITIONING"; diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php index 298725ed..653d3f4d 100644 --- a/adminer/edit.inc.php +++ b/adminer/edit.inc.php @@ -72,7 +72,7 @@ if ($fields) { echo "" . $adminer->fieldName($field); $default = $_GET["set"][bracket_escape($name)]; $value = (isset($row) - ? ($row[$name] != "" && ereg("enum|set", $field["type"]) ? intval($row[$name]) : $row[$name]) + ? ($row[$name] != "" && ereg("enum|set", $field["type"]) ? +$row[$name] : $row[$name]) : (!$update && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : (isset($default) ? $default : $field["default"]))) ); if (!$_POST["save"] && is_string($value)) { diff --git a/adminer/foreign.inc.php b/adminer/foreign.inc.php index 801586ef..f6e84f9d 100644 --- a/adminer/foreign.inc.php +++ b/adminer/foreign.inc.php @@ -60,8 +60,8 @@ foreach (table_status() as $name => $table_status) { $j = 0; foreach ($row["source"] as $key => $val) { echo ""; - echo "" . html_select("source[" . intval($key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow(this);" : 1)); - echo "" . html_select("target[" . intval($key) . "]", $target, $row["target"][$key]); + echo "" . html_select("source[" . (+$key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow(this);" : 1)); + echo "" . html_select("target[" . (+$key) . "]", $target, $row["target"][$key]); $j++; } ?> diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index ff9ef98a..1331e5f3 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -640,7 +640,7 @@ function process_input($field) { if ($value == "") { return "NULL"; } - return intval($value); + return +$value; } if ($field["auto_increment"] && $value == "") { return null; diff --git a/adminer/indexes.inc.php b/adminer/indexes.inc.php index afb91270..090d86af 100644 --- a/adminer/indexes.inc.php +++ b/adminer/indexes.inc.php @@ -21,7 +21,7 @@ if ($_POST && !$error && !$_POST["add"]) { foreach ($index["columns"] as $key => $column) { if ($column != "") { $length = $index["lengths"][$key]; - $set[] = idf_escape($column) . ($length ? "(" . intval($length) . ")" : ""); + $set[] = idf_escape($column) . ($length ? "(" . (+$length) . ")" : ""); $columns[] = $column; $lengths[] = ($length ? $length : null); } diff --git a/adminer/select.inc.php b/adminer/select.inc.php index 9edc14cc..e0ae7875 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -212,7 +212,7 @@ if (!$columns) { $page = floor(max(0, $found_rows - 1) / $limit); } - $query = "SELECT" . limit((intval($limit) && $group && count($group) < count($select) && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from, ($where ? "\nWHERE " . implode(" AND ", $where) : "") . $group_by, ($limit != "" ? intval($limit) : null), ($page ? $limit * $page : 0), "\n"); + $query = "SELECT" . limit((+$limit && $group && count($group) < count($select) && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from, ($where ? "\nWHERE " . implode(" AND ", $where) : "") . $group_by, ($limit != "" ? +$limit : null), ($page ? $limit * $page : 0), "\n"); echo $adminer->selectQuery($query); $result = $connection->query($query); @@ -230,7 +230,7 @@ if (!$columns) { } // use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest) if ($_GET["page"] != "last") { - $found_rows = (intval($limit) && $group && count($group) < count($select) + $found_rows = (+$limit && $group && count($group) < count($select) ? ($jush == "sql" ? $connection->result(" SELECT FOUND_ROWS()") : $connection->result("SELECT COUNT(*) FROM ($query) x")) // space to allow mysql.trace_mode : count($rows) ); @@ -292,7 +292,7 @@ if (!$columns) { if ($val == "") { $val = " "; } elseif ($text_length != "" && ereg('text|blob', $field["type"]) && is_utf8($val)) { - $val = shorten_utf8($val, max(0, intval($text_length))); // usage of LEFT() would reduce traffic but complicate query - expected average speedup: .001 s VS .01 s on local network + $val = shorten_utf8($val, max(0, +$text_length)); // usage of LEFT() would reduce traffic but complicate query - expected average speedup: .001 s VS .01 s on local network } else { $val = h($val); } @@ -354,7 +354,7 @@ if (!$columns) { if ($rows || $page) { $exact_count = true; - if ($_GET["page"] != "last" && intval($limit) && count($group) >= count($select) && ($found_rows >= $limit || $page)) { + if ($_GET["page"] != "last" && +$limit && count($group) >= count($select) && ($found_rows >= $limit || $page)) { $found_rows = $table_status["Rows"]; if (!isset($found_rows) || $where || 2 * $page * $limit > $found_rows || ($table_status["Engine"] == "InnoDB" && $found_rows < 1e4)) { // slow with big tables @@ -366,7 +366,7 @@ if (!$columns) { } } echo "

"; - if (intval($limit) && $found_rows > $limit) { + if (+$limit && $found_rows > $limit) { // display first, previous 4, next 4 and last page $max_page = floor(($found_rows - 1) / $limit); echo '" . lang('Page') . ":" . pagination(0, $page) . ($page > 5 ? " ..." : "");