Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow bigger numbers under 32 bits

  • Loading branch information...
commit 04eccbad625d32ece862e5388c14212cf5ea6eb5 1 parent 28f21aa
Jakub Vrána authored
2  adminer/call.inc.php
View
@@ -58,7 +58,7 @@
echo "<tr><th>" . $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";
2  adminer/create.inc.php
View
@@ -65,7 +65,7 @@
}
$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";
2  adminer/edit.inc.php
View
@@ -72,7 +72,7 @@
echo "<tr><th>" . $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)) {
4 adminer/foreign.inc.php
View
@@ -60,8 +60,8 @@
$j = 0;
foreach ($row["source"] as $key => $val) {
echo "<tr>";
- echo "<td>" . html_select("source[" . intval($key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow(this);" : 1));
- echo "<td>" . html_select("target[" . intval($key) . "]", $target, $row["target"][$key]);
+ echo "<td>" . html_select("source[" . (+$key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow(this);" : 1));
+ echo "<td>" . html_select("target[" . (+$key) . "]", $target, $row["target"][$key]);
$j++;
}
?>
2  adminer/include/functions.inc.php
View
@@ -640,7 +640,7 @@ function process_input($field) {
if ($value == "") {
return "NULL";
}
- return intval($value);
+ return +$value;
}
if ($field["auto_increment"] && $value == "") {
return null;
2  adminer/indexes.inc.php
View
@@ -21,7 +21,7 @@
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);
}
10 adminer/select.inc.php
View
@@ -212,7 +212,7 @@
$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 @@
}
// 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 ($val == "") {
$val = "&nbsp;";
} 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 ($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 @@
}
}
echo "<p class='pages'>";
- 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 '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"var page = +prompt('" . lang('Page') . "', '" . ($page + 1) . "'); if (!isNaN(page) &amp;&amp; page) location.href = this.href + (page != 1 ? '&amp;page=' + (page - 1) : ''); return false;\">" . lang('Page') . "</a>:" . pagination(0, $page) . ($page > 5 ? " ..." : "");
Please sign in to comment.
Something went wrong with that request. Please try again.