]> git.joonet.de Git - adminer.git/commitdiff
Big numbers without E
authorJakub Vrana <jakub@vrana.cz>
Fri, 22 Oct 2010 22:02:24 +0000 (00:02 +0200)
committerJakub Vrana <jakub@vrana.cz>
Fri, 22 Oct 2010 22:02:24 +0000 (00:02 +0200)
adminer/create.inc.php
adminer/drivers/mssql.inc.php
adminer/drivers/mysql.inc.php
adminer/include/adminer.inc.php
adminer/include/bootstrap.inc.php
adminer/include/functions.inc.php
adminer/processlist.inc.php
adminer/static/editing.js
adminer/static/functions.js
editor/include/adminer.inc.php

index 92091dd52dba7de38149880a57c12ba89f3c68ba..e1128e6ff6f1f368d346800c18aa107f6eb059d5 100644 (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
                ));
        }
index de3114bd73f1f9642a84316ec7df68ffe80d3b71..11f15b549939d9d62d19c48d494a843626f20e02 100644 (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) {
index 406dc4a51bd514f45fc4415d9740b7b98d536f50..cc0fd66ed40d1f21a132d34c0c80d7644b6945ef 100644 (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;
        }
index 2b15cfd3d4f992ef251aea27fbd436e79b7d94e1..7068088c2fe4bea9cede486a4ea236940997ff1f 100644 (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)) {
index fc3ae784d0207b7b80378dcbabbe1b731b95762f..003c91643b3a7bb06c767368ceeeffa61e8a5ba8 100644 (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";
index 1331e5f34feadc2e9666c1964ca7ff1f46851a0b..7fe46c448e4b3b197f0dfb80c608a0a89bbdc88d 100644 (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>)
index 7f773d344e0b9207a4cfd603e8fe6707c297e334..c37d105b04e5ebe686962013fdeebc55bb001a21 100644 (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++;
                }
        }
index a346424868ff28908dc8db4572feb9f4cc718381..c22442773d6d70b7e9600ac46fb09f7d02b70cc9 100644 (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) {
index f8478a0074fc86ab4b6b47a4b7950de21e9eeb4f..fa0c7b4fa6e3266d9b69bac2af19409cf3a3d157 100644 (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 = '';
        }
index 501fb935db97fbb57018db55db9b1c75c95f22a0..099d74ed6f7aff04a7fe94baafcd268484f6f631 100644 (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);