Big numbers without E

This commit is contained in:
Jakub Vrana 2010-10-23 00:02:24 +02:00
parent e9ae743578
commit 5002b89bd5
10 changed files with 20 additions and 19 deletions

View file

@ -83,7 +83,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
$_POST["Comment"],
($_POST["Engine"] && $_POST["Engine"] != $orig_status["Engine"] ? $_POST["Engine"] : ""),
($_POST["Collation"] && $_POST["Collation"] != $orig_status["Collation"] ? $_POST["Collation"] : ""),
($_POST["Auto_increment"] != "" ? preg_replace('~\\D+~', '', $_POST["Auto_increment"]) : ""),
($_POST["Auto_increment"] != "" ? +$_POST["Auto_increment"] : ""),
$partitioning
));
}

View file

@ -399,7 +399,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table)
}
function auto_increment() {
return " IDENTITY" . ($_POST["Auto_increment"] != "" ? "(" . preg_replace('~\\D+~', '', $_POST["Auto_increment"]) . ",1)" : "");
return " IDENTITY" . ($_POST["Auto_increment"] != "" ? "(" . (+$_POST["Auto_increment"]) . ",1)" : "");
}
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {

View file

@ -212,7 +212,7 @@ if (!defined("DRIVER")) {
var $extension = "PDO_MySQL";
function connect($server, $username, $password) {
$this->dsn("mysql:host=" . str_replace(":", ";unix_socket=", preg_replace('~:([0-9])~', ';port=\\1', $server)), $username, $password);
$this->dsn("mysql:host=" . str_replace(":", ";unix_socket=", preg_replace('~:(\\d)~', ';port=\\1', $server)), $username, $password);
$this->query("SET NAMES utf8"); // charset in DSN is ignored
return true;
}
@ -820,7 +820,7 @@ if (!defined("DRIVER")) {
global $connection;
$return = $connection->result("SHOW CREATE TABLE " . table($table), 1);
if (!$auto_increment) {
$return = preg_replace('~ AUTO_INCREMENT=[0-9]+~', '', $return); //! skip comments
$return = preg_replace('~ AUTO_INCREMENT=\\d+~', '', $return); //! skip comments
}
return $return;
}

View file

@ -453,7 +453,7 @@ document.getElementById('username').focus();
} elseif (ereg('^([+-]|\\|\\|)$', $function)) {
$return = idf_escape($name) . " $function $return";
} elseif (ereg('^[+-] interval$', $function)) {
$return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
$return = idf_escape($name) . " $function " . (preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
} elseif (ereg('^(addtime|subtime|concat)$', $function)) {
$return = "$function(" . idf_escape($name) . ", $return)";
} elseif (ereg('^(md5|sha1|password|encrypt|hex)$', $function)) {

View file

@ -39,11 +39,12 @@ if (!defined("SID")) {
// disable magic quotes to be able to use database escaping function
remove_slashes(array(&$_GET, &$_POST, &$_COOKIE));
if (function_exists("set_magic_quotes_runtime")) {
if (function_exists("set_magic_quotes_runtime")) { // removed in PHP 6
set_magic_quotes_runtime(false);
}
@set_time_limit(0); // @ - can be disabled
@ini_set("zend.ze1_compatibility_mode", false); // @ - deprecated
@ini_set("precision", 20); // @ - can be disabled
include "../adminer/include/lang.inc.php";
include "../adminer/lang/$LANG.inc.php";

View file

@ -618,7 +618,7 @@ function input($field, $value, $function) {
echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs onkeydown='return textareaKeydown(this, event);'>" . h($value) . '</textarea>'; // 1.2em - line-height
} else {
// int(3) is only a display hint
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
echo "<input value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char|binary', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "$attrs>";
}
}
@ -760,7 +760,7 @@ function is_mail($email) {
*/
function is_url($string) {
$domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component //! IDN
return (preg_match("~^(https?)://($domain?\\.)+$domain(:[0-9]+)?(/.*)?(\\?.*)?(#.*)?\$~i", $string, $match) ? strtolower($match[1]) : ""); //! restrict path, query and fragment characters
return (preg_match("~^(https?)://($domain?\\.)+$domain(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i", $string, $match) ? strtolower($match[1]) : ""); //! restrict path, query and fragment characters
}
/** Print header for hidden fieldset (close by </div></fieldset>)

View file

@ -2,7 +2,7 @@
if ($_POST && !$error) {
$killed = 0;
foreach ((array) $_POST["kill"] as $val) {
if (queries("KILL " . ereg_replace("[^0-9]+", "", $val))) {
if (queries("KILL " . (+$val))) {
$killed++;
}
}

View file

@ -139,7 +139,7 @@ function editingAddRow(button, allowed, focus) {
if (allowed && rowCount >= allowed) {
return false;
}
var match = /([0-9]+)(\.[0-9]+)?/.exec(button.name);
var match = /(\d+)(\.\d+)?/.exec(button.name);
var x = match[0] + (match[2] ? added.substr(match[2].length) : added) + '1';
var row = button.parentNode.parentNode;
var row2 = row.cloneNode(true);
@ -309,11 +309,11 @@ function indexesAddRow(field) {
}
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/indexes\[[0-9]+/, '$&1');
selects[i].name = selects[i].name.replace(/indexes\[\d+/, '$&1');
selects[i].selectedIndex = 0;
}
var input = row.getElementsByTagName('input')[0];
input.name = input.name.replace(/indexes\[[0-9]+/, '$&1');
input.name = input.name.replace(/indexes\[\d+/, '$&1');
input.value = '';
field.parentNode.parentNode.parentNode.appendChild(row);
}
@ -325,10 +325,10 @@ function indexesAddColumn(field) {
field.onchange = function () { };
var column = field.parentNode.cloneNode(true);
var select = column.getElementsByTagName('select')[0];
select.name = select.name.replace(/\]\[[0-9]+/, '$&1');
select.name = select.name.replace(/\]\[\d+/, '$&1');
select.selectedIndex = 0;
var input = column.getElementsByTagName('input')[0];
input.name = input.name.replace(/\]\[[0-9]+/, '$&1');
input.name = input.name.replace(/\]\[\d+/, '$&1');
input.value = '';
field.parentNode.parentNode.appendChild(column);
}
@ -374,7 +374,7 @@ function schemaMousemove(ev) {
isTop = (div2.offsetTop + ref[0] * em > divs[i].offsetTop + top * em);
}
if (!lineSet[id]) {
var line = document.getElementById(divs[i].id.replace(/^....(.+)-[0-9]+$/, 'refl$1'));
var line = document.getElementById(divs[i].id.replace(/^....(.+)-\d+$/, 'refl$1'));
var shift = ev.clientY - y - that.offsetTop;
line.style.left = (left + left1) + 'em';
if (isTop) {

View file

@ -109,12 +109,12 @@ function selectAddRow(field) {
var row = field.parentNode.cloneNode(true);
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/[a-z]\[[0-9]+/, '$&1');
selects[i].name = selects[i].name.replace(/[a-z]\[\d+/, '$&1');
selects[i].selectedIndex = 0;
}
var inputs = row.getElementsByTagName('input');
if (inputs.length) {
inputs[0].name = inputs[0].name.replace(/[a-z]\[[0-9]+/, '$&1');
inputs[0].name = inputs[0].name.replace(/[a-z]\[\d+/, '$&1');
inputs[0].value = '';
inputs[0].className = '';
}

View file

@ -179,7 +179,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
function editVal($val, $field) {
if (ereg('date|timestamp', $field["type"]) && isset($val)) {
return preg_replace('~^([0-9]{2}([0-9]+))-(0?([0-9]+))-(0?([0-9]+))~', lang('$1-$3-$5'), $val);
return preg_replace('~^(\\d{2}(\\d+))-(0?(\\d+))-(0?(\\d+))~', lang('$1-$3-$5'), $val);
}
return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val);
}
@ -412,7 +412,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
return "$function()";
}
$return = $value;
if (ereg('date|timestamp', $field["type"]) && preg_match('(^' . str_replace('\\$1', '(?P<p1>[0-9]*)', preg_replace('~(\\\\\\$([2-6]))~', '(?P<p\\2>[0-9]{1,2})', preg_quote(lang('$1-$3-$5')))) . '(.*))', $value, $match)) {
if (ereg('date|timestamp', $field["type"]) && preg_match('(^' . str_replace('\\$1', '(?P<p1>\\d*)', preg_replace('~(\\\\\\$([2-6]))~', '(?P<p\\2>\\d{1,2})', preg_quote(lang('$1-$3-$5')))) . '(.*))', $value, $match)) {
$return = ($match["p1"] != "" ? $match["p1"] : ($match["p2"] != "" ? ($match["p2"] < 70 ? 20 : 19) . $match["p2"] : gmdate("Y"))) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" . end($match);
}
$return = q($return);