]> git.joonet.de Git - adminer.git/commitdiff
Date localization
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 27 Jul 2009 16:32:56 +0000 (16:32 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 27 Jul 2009 16:32:56 +0000 (16:32 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@917 7c3ca157-0c34-0410-bff1-cbf682f78f5c

17 files changed:
adminer/call.inc.php
adminer/edit.inc.php
adminer/include/adminer.inc.php
adminer/include/functions.inc.php
adminer/lang/cs.inc.php
adminer/lang/de.inc.php
adminer/lang/es.inc.php
adminer/lang/et.inc.php
adminer/lang/fr.inc.php
adminer/lang/it.inc.php
adminer/lang/nl.inc.php
adminer/lang/ru.inc.php
adminer/lang/sk.inc.php
adminer/lang/zh.inc.php
adminer/select.inc.php
editor/include/adminer.inc.php
editor/include/editing.inc.php

index 509f9f978544a758eadb82e7313581c48d0b7c9a..e0c17d03068bc1dd71767af0a85cb72d665b8913 100644 (file)
@@ -17,7 +17,7 @@ if (!$error && $_POST) {
        $call = array();
        foreach ($routine["fields"] as $key => $field) {
                if (in_array($key, $in)) {
-                       $val = process_input($key, $field);
+                       $val = process_input($field);
                        if ($val === false) {
                                $val = "''";
                        }
index c91dcbc6402e61b57f129a114f74045f99844596..a5ab4ede740e095b006a45c56eec3d23c5d951a2 100644 (file)
@@ -11,7 +11,7 @@ if ($_POST && !$error && !isset($_GET["select"])) {
        $location = ($_POST["insert"] ? $_SERVER["REQUEST_URI"] : $SELF . (isset($_GET["default"]) ? "table=" : "select=") . urlencode($_GET["edit"])); // "insert" to continue edit or insert
        $set = array();
        foreach ($fields as $name => $field) {
-               $val = process_input($name, $field);
+               $val = process_input($field);
                if (!isset($_GET["default"])) {
                        if ($val !== false || !$update) {
                                $set[] = "\n" . idf_escape($name) . " = " . ($val !== false ? $val : "''");
@@ -74,6 +74,9 @@ if ($fields) {
                        ? (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$name])
                        : ($_POST["clone"] && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : $field["default"]))
                );
+               if (!$_POST["save"] && is_string($value)) {
+                       $value = $adminer->editVal($value, $field);
+               }
                $function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($where && $field["on_update"] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : (isset($value) ? '' : 'NULL'))));
                input($field, $value, $function);
                if (isset($_GET["default"]) && $field["type"] == "timestamp") {
index 2bdbcfe41c06d47230438824e14fce2432388c49..63067301bb3d3096c8830fa615ed2c204d37d70d 100644 (file)
@@ -110,7 +110,7 @@ class Adminer {
        }
        
        /** Value printed in select table
-       * @param string escaped value to print
+       * @param string HTML-escaped value to print
        * @param string link to foreign key
        * @param array single field returned from fields()
        * @return string
@@ -123,6 +123,15 @@ class Adminer {
                return ($link ? "<a href=\"$link\">$return</a>" : $return);
        }
        
+       /** Value conversion used in select and edit
+       * @param string
+       * @param array single field returned from fields()
+       * @return 
+       */
+       function editVal($val, $field) {
+               return $val;
+       }
+       
        /** Print columns box in select
        * @param array result of selectColumnsProcess()
        * @param array selectable columns
@@ -263,7 +272,7 @@ class Adminer {
                                        $return[] = "MATCH (" . idf_escape($val["col"]) . ") AGAINST (" . $dbh->quote($val["val"]) . " IN BOOLEAN MODE)";
                                } else {
                                        $in = process_length($val["val"]);
-                                       $cond = " $val[op]" . (ereg('NULL$', $val["op"]) ? "" : (ereg('IN$', $val["op"]) ? " (" . (strlen($in) ? $in : "NULL") . ")" : " " . $dbh->quote($val["val"])));
+                                       $cond = " $val[op]" . (ereg('NULL$', $val["op"]) ? "" : (ereg('IN$', $val["op"]) ? " (" . (strlen($in) ? $in : "NULL") . ")" : " " . $this->processInput($fields[$val["col"]], $val["val"])));
                                        if (strlen($val["col"])) {
                                                $return[] = idf_escape($val["col"]) . $cond;
                                        } else {
@@ -379,15 +388,14 @@ class Adminer {
        }
        
        /** Process sent input
-       * @param string field name
        * @param array single field from fields()
+       * @param string
+       * @param string
        * @return string expression to use in a query
        */
-       function processInput($name, $field) {
+       function processInput($field, $value, $function = "") {
                global $dbh;
-               $idf = bracket_escape($name);
-               $function = $_POST["function"][$idf];
-               $value = $_POST["fields"][$idf];
+               $name = $field["field"];
                $return = $dbh->quote($value);
                if (ereg('^(now|uuid)$', $function)) {
                        $return = "$function()";
index 674f4ce550741f3d64306dbf8f8a58d26a47ae39..7f10023120e607ea1279b83c82e916848614b104 100644 (file)
@@ -318,7 +318,7 @@ function input($field, $value, $function) {
                } elseif (strpos($field["type"], "text") !== false) {
                        echo '<textarea name="fields[' . $name . ']" cols="50" rows="12"' . $onchange . '>' . htmlspecialchars($value) . '</textarea>';
                } elseif (ereg('binary|blob', $field["type"])) {
-                       echo (ini_get("file_uploads") ? '<input type="file" name="' . $name . '"' . $onchange . '>' : lang('File uploads are disabled.') . ' ');
+                       echo (ini_get("file_uploads") ? '<input type="file" name="' . $name . '"' . $onchange . '>' : lang('File uploads are disabled.'));
                } else {
                        // int(3) is only a display hint
                        $maxlength = (!ereg('int', $field["type"]) && preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? ($match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
@@ -327,9 +327,9 @@ function input($field, $value, $function) {
        }
 }
 
-function process_input($name, $field) {
+function process_input($field) {
        global $dbh, $adminer;
-       $idf = bracket_escape($name);
+       $idf = bracket_escape($field["field"]);
        $function = $_POST["function"][$idf];
        $value = $_POST["fields"][$idf];
        if ($field["type"] == "enum" ? $value == -1 : $function == "orig") {
@@ -347,7 +347,7 @@ function process_input($name, $field) {
                }
                return "_binary" . $dbh->quote($file);
        } else {
-               return $adminer->processInput($name, $field);
+               return $adminer->processInput($field, $value, $function);
        }
 }
 
index cdce3fc310d6dd76903c1c0aa2ae60e4fb8c6259..1779aac6ff7f132254e6943c91c9c0a05106eeac 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Byl překročen maximální povolený počet polí. Zvyšte prosím %s a %s.',
        '(anywhere)' => '(kdekoliv)',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$6.$4.$1',
        'History' => 'Historie',
        'Variables' => 'Proměnné',
        'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exists.' => 'Zdrojové a cílové sloupce musí mít stejný datový typ, nad cílovými sloupci musí být definován index a odkazovaná data musí existovat.',
index dd5b68604f478a25cb926067b7627049e9d196b3..cb7362560c262e9b44160fb5dabd8651864a8fc3 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Stop on error' => 'Bei Fehler anhaltan',
        'Select table' => 'Tabelle auswählen',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$6.$4.$1',
        'History' => 'History',
        'Variables' => 'Variablen',
        'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exists.' => 'Spalten des Ursprungs und des Zieles müssen vom gleichen Datentyp sein, es muss unter den Zielspalten ein Index existieren und die referenzierten Daten müssen existieren.',
index c70b7d530e092965b051d54cc1a451abdf1e33f5..0430d11d100f9627b25b6b658c5c68aaab1db84b 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Stop on error' => 'Parar en caso de error',
        'Select table' => 'Seleccionar tabla',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$5/$3/$1',
        'History' => 'History',
        'Variables' => 'Variables',
        'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exists.' => 'Las columnas de origen y destino deben ser del mismo tipo, debe existir un índice entre las columnas del destino y el registro referenciado debe existir.',
index ee4614c097e303b18cf9558bf53edb1a295067de..ece4162575811c716fa80db6bf7aed2da90ba322 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Stop on error' => 'Peatuda vea esinemisel',
        'Select table' => 'Vali tabel',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$6.$4.$1',
        'History' => 'Ajalugu',
        'Variables' => 'Muutujad',
        'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exists.' => 'Lähte- ja sihtveerud peavad eksisteerima ja omama sama andmetüüpi, sihtveergudel peab olema määratud indeks ning viidatud andmed peavad eksisteerima.',
index bbb99ffcaeee5eec7c77d77bf02562fe54614c50..f81738d00ac16a5c0cca4d563ec16a7f296338bb 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Stop on error' => 'Arrêt sur erreur',
        'Select table' => 'Selectionner la table',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$5/$3/$1',
        'History' => 'Historique',
        'Variables' => 'Variables',
        'Source and target columns must have the same data type and there must be an index on the target columns.' => 'Les colonnes selectionnées et les colonnes de destination doivent être du même type et il doit y avoir un index sur les colonnes de destination.',
index 78eb93e385b1feba3eec8dab33c5435798e85252..661450081f3bc501a9f11155ee4aa55939bbab74 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Stop on error' => 'Stop su errore',
        'Select table' => 'Scegli tabella',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$5/$3/$1',
        'History' => 'Storico',
        'Variables' => 'Variabili',
        'Source and target columns must have the same data type and there must be an index on the target columns.' => 'Le colonne sorgente e destinazione devono essere dello stesso tipo e ci deve essere un indice sulla colonna di destinazione.',
index 1c200ab6853e28d08a5c0b54634a3efc2da135a0..31d759bc573b3e95aed5c75cf330b78ad52a7222 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Stop on error' => 'Stoppen bij fout',
        'Select table' => 'Selecteer tabel',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$5-$3-$1',
        'History' => 'Geschiedenis',
        'Variables' => 'Variabelen',
        'Source and target columns must have the same data type and there must be an index on the target columns.' => 'Bron- en doelkolommen moeten van hetzelfde data type zijn en er moet een index bestaan op de gekozen kolommen.',
index d9fa52b0c2ded69fedf17468b7f9f9f8c37f1155..e515e9a77577c68e14750c61efad847b869dc283 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Достигнуто максимальное значение количества доступных полей. Увеличьте %s и %s.',
        '(anywhere)' => '(в любом месте)',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$5.$3.$1',
        'History' => 'История',
        'Variables' => 'Переменные',
        'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exists.' => 'Колонки должны иметь одинаковые типы данных, в результирующей колонке должен быть индекс, данные для импорта должны существовать.',
index 470c31d1ae043cf6e1a586e13a56b717808af171..7d14d54f3455225b98cafee777f7b00ae5a24a15 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Bol prekročený maximálny počet povolených polí. Zvýšte prosím %s a %s.',
        '(anywhere)' => '(kdekoľvek)',
        '%.3f s' => '%.3f s',
+       '$1-$3-$5' => '$6.$4.$1',
        'History' => 'História',
        'Variables' => 'Premenné',
        'Source and target columns must have the same data type and there must be an index on the target columns.' => 'Zdrojové a cieľové stĺpce musia mať rovnaký dátový typ a nad cieľovými stĺpcami musí byť definovaný index.',
index 913930de735924b12bb1c5a3eb288154cbde908a..d4f24410b4435b0d325b8904998c7151da7544b3 100644 (file)
@@ -211,6 +211,7 @@ $translations = array(
        'Stop on error' => '出错时停止',
        'Select table' => '选择表',
        '%.3f s' => '%.3f 秒',
+       '$1-$3-$5' => '$1.$3.$5',
        'History' => '历史',
        'Variables' => '变量',
        'Source and target columns must have the same data type and there must be an index on the target columns.' => '源列和目标列必须具有相同的数据类型并且在目标列的必须是一个索引',
index b0c05e2536f36c72cc946760e0d69f718d1772e9..7aa5eea7ca829396b6f7fec1e2de39a64dd96502 100644 (file)
@@ -67,7 +67,7 @@ if ($_POST && !$error) {
                        if (!$_POST["delete"]) {
                                $set = array();
                                foreach ($columns as $name => $val) { //! should check also for edit or insert privileges
-                                       $val = process_input($name, $fields[$name]);
+                                       $val = process_input($fields[$name]);
                                        if ($_POST["clone"]) {
                                                $set[] = ($val !== false ? $val : idf_escape($name));
                                        } elseif ($val !== false) {
@@ -201,6 +201,7 @@ if (!$columns) {
                                                        $email_fields[$key] = (is_email($val) ? $names[$key] : ""); //! filled e-mails may be contained on other pages
                                                }
                                                $link = "";
+                                               $val = $adminer->editVal($val, $fields[$key]);
                                                if (!isset($val)) {
                                                        $val = "<i>NULL</i>";
                                                } else {
index 0af26e18b3eeca8afa90ae75e6475df6739d81a3..20df161ceb2ff51e97b04885cd7c1c6b3034bab7 100644 (file)
@@ -118,6 +118,13 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
                return ($link ? "<a href=\"$link\">$return</a>" : $return);
        }
        
+       function editVal($val, $field) {
+               if (ereg('date|timestamp', $field["type"])) {
+                       return preg_replace('~^([0-9]{2}([0-9]+))-(0?([0-9]+))-(0?([0-9]+))~', lang('$1-$3-$5'), $val);
+               }
+               return $val;
+       }
+       
        function selectColumnsPrint($select, $columns) {
                //! allow grouping functions by indexes
        }
@@ -177,11 +184,11 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
        }
        
        function selectSearchProcess($indexes, $fields) {
-               global $dbh;
                $return = array();
                foreach ((array) $_GET["where"] as $val) {
                        if (strlen("$val[col]$val[val]")) {
-                               $cond = " = " . $dbh->quote($val["val"]);
+                               $value = $this->processInput($fields[$val["col"]], $val["val"]);
+                               $cond = ($value == "NULL" ? " IS $value" : " = $value");
                                if (strlen($val["col"])) {
                                        $return[] = idf_escape($val["col"]) . $cond;
                                } else {
@@ -285,16 +292,9 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
                return $return;
        }
        
-       /** Process sent input
-       * @param string field name
-       * @param array single field from fields()
-       * @return string expression to use in a query
-       */
-       function processInput($name, $field) {
+       function processInput($field, $value, $function = "") {
                global $dbh;
-               $idf = bracket_escape($name);
-               $value = $_POST["fields"][$idf];
-               $return = $dbh->quote($value);
+               $return = $dbh->quote(ereg('date|timestamp', $field["type"]) ? preg_replace_callback('(' . preg_replace('~(\\\\\\$([0-9]))~', '(?P<p\\2>[0-9]+)', preg_quote(lang('$1-$3-$5'))) . ')', 'conversion_date', $value) : $value);
                if (!ereg('varchar|text', $field["type"]) && !strlen($value)) {
                        $return = "NULL";
                } elseif (ereg('date|time', $field["type"]) && $value == "CURRENT_TIMESTAMP") {
index b3d9bbc7f3711e882119cd6b3af051245d859d04..3c905a4d193a0e05af7610a338f9427a989919b9 100644 (file)
@@ -1 +1,4 @@
 <?php
+function conversion_date($match) {
+       return ($match["p1"] ? $match["p1"] : ($match["p2"] < 70 ? 20 : 19) . $match["p2"]) . "-$match[p3]$match[p4]-$match[p5]$match[p6]";
+}