From 51e609c4619e366856941e47fb22e3d2f7b8349f Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 08:22:36 +0200 Subject: [PATCH 01/19] Disable creating SQLite databases with extension other than db, sdb, sqlite --- adminer/drivers/sqlite.inc.php | 19 ++++++++++++++++++- changes.txt | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/adminer/drivers/sqlite.inc.php b/adminer/drivers/sqlite.inc.php index 89ce2f15..5418ac6c 100644 --- a/adminer/drivers/sqlite.inc.php +++ b/adminer/drivers/sqlite.inc.php @@ -344,13 +344,27 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) { function exact_value($val) { return q($val); } - + + function check_sqlite_name($name) { + // avoid creating PHP files on unsecured servers + global $connection; + $extensions = "db|sdb|sqlite"; + if (!preg_match("~^[^\\0]*\\.($extensions)\$~", $name)) { + $connection->error = lang('Please use one of the extensions %s.', str_replace("|", ", ", $extensions)); + return false; + } + return true; + } + function create_database($db, $collation) { global $connection; if (file_exists($db)) { $connection->error = lang('File exists.'); return false; } + if (!check_sqlite_name($db)) { + return false; + } $link = new Min_SQLite($db); //! exception handler $link->query('PRAGMA encoding = "UTF-8"'); $link->query('CREATE TABLE adminer (i)'); // otherwise creates empty file @@ -372,6 +386,9 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) { function rename_database($name, $collation) { global $connection; + if (!check_sqlite_name($name)) { + return false; + } $connection->Min_SQLite(":memory:"); $connection->error = lang('File exists.'); return @rename(DB, $name); diff --git a/changes.txt b/changes.txt index 716b9d2e..094eda14 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ Adminer 3.0.1-dev: Send the form by Ctrl+Enter in all textareas +Disable creating SQLite databases with extension other than db, sdb, sqlite Catalan translation Adminer 3.0.0 (released 2010-10-15): From abe5e7b0a7215bd91932e76f6c17f44994bfed40 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 16:00:29 +0200 Subject: [PATCH 02/19] Minimal inline edit input width --- adminer/static/functions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adminer/static/functions.js b/adminer/static/functions.js index ca4332a5..1581cfbd 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -164,7 +164,7 @@ function selectDblClick(td, event, text) { var input = document.createElement(text ? 'textarea' : 'input'); input.name = td.id; input.value = (value == '\u00A0' || td.getElementsByTagName('i').length ? '' : value); //   or i - NULL - input.style.width = (td.clientWidth - 14) + 'px'; // 14 = 2 * (td.border + td.padding + input.border) + input.style.width = Math.max(td.clientWidth - 14, 20) + 'px'; // 14 = 2 * (td.border + td.padding + input.border) if (text) { var rows = 1; value.replace(/\n/g, function () { From 210802d1c466eee0219addef44f71c573b3eb2db Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 16:07:09 +0200 Subject: [PATCH 03/19] Change message to "increase Text length" --- adminer/lang/ca.inc.php | 2 +- adminer/lang/cs.inc.php | 2 +- adminer/lang/de.inc.php | 2 +- adminer/lang/es.inc.php | 2 +- adminer/lang/et.inc.php | 2 +- adminer/lang/fr.inc.php | 2 +- adminer/lang/hu.inc.php | 2 +- adminer/lang/it.inc.php | 2 +- adminer/lang/ja.inc.php | 2 +- adminer/lang/nl.inc.php | 2 +- adminer/lang/ru.inc.php | 2 +- adminer/lang/sk.inc.php | 2 +- adminer/lang/ta.inc.php | 2 +- adminer/lang/zh-tw.inc.php | 2 +- adminer/lang/zh.inc.php | 2 +- adminer/select.inc.php | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/adminer/lang/ca.inc.php b/adminer/lang/ca.inc.php index f64c9680..dbdb312b 100644 --- a/adminer/lang/ca.inc.php +++ b/adminer/lang/ca.inc.php @@ -235,7 +235,7 @@ $translations = array( 'Databases have been dropped.' => 'S\'han suprimit les bases de dades.', 'File exists.' => 'El fitxer ja existeix.', 'Double click on a value to modify it.' => 'Fes un doble clic a un valor per modificar-lo.', - 'Increase text length to modify this value.' => 'Incrementa la longitud del text per modificar aquest valor.', + 'Increase Text length to modify this value.' => 'Incrementa la Longitud del text per modificar aquest valor.', 'Use edit link to modify this value.' => 'Utilitza l\'enllaç d\'edició per modificar aquest valor.', 'Alter schema' => 'Modifica l\'esquema', 'Create schema' => 'Crea un esquema', diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index 6ab97b0a..98b3e823 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -235,7 +235,7 @@ $translations = array( 'Databases have been dropped.' => 'Databáze byly odstraněny.', 'File exists.' => 'Soubor existuje.', 'Double click on a value to modify it.' => 'Dvojklikněte na políčko, které chcete změnit.', - 'Increase text length to modify this value.' => 'Ke změně této hodnoty zvyšte délku textů.', + 'Increase Text length to modify this value.' => 'Ke změně této hodnoty zvyšte Délku textů.', 'Use edit link to modify this value.' => 'Ke změně této hodnoty použijte odkaz upravit.', 'Alter schema' => 'Pozměnit schéma', 'Create schema' => 'Vytvořit schéma', diff --git a/adminer/lang/de.inc.php b/adminer/lang/de.inc.php index 00647c80..df431c8f 100644 --- a/adminer/lang/de.inc.php +++ b/adminer/lang/de.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been dropped.' => 'Typ gelöscht.', 'Type has been created.' => 'Typ erstellt.', 'Double click on a value to modify it.' => 'Doppelklick zum Bearbeiten des Wertes.', - 'Increase text length to modify this value.' => 'Vergrössern Sie die Textlänge um den Wert ändern zu können.', + 'Increase Text length to modify this value.' => 'Vergrössern Sie die Textlänge um den Wert ändern zu können.', 'Use edit link to modify this value.' => 'Benutzen Sie den Link zum editieren dieses Wertes.', 'last' => 'letzte', 'From server' => 'Auf Server', diff --git a/adminer/lang/es.inc.php b/adminer/lang/es.inc.php index 896f0deb..6c2a3f62 100644 --- a/adminer/lang/es.inc.php +++ b/adminer/lang/es.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been dropped.' => 'Tipo eliminado.', 'Type has been created.' => 'Tipo creado.', 'Double click on a value to modify it.' => 'Doble-clic sobre el valor para editarlo.', - 'Increase text length to modify this value.' => 'Aumente el tamaño del campo de texto para modificar este valor.', + 'Increase Text length to modify this value.' => 'Aumente el tamaño del campo de texto para modificar este valor.', 'Use edit link to modify this value.' => 'Utilice el enlace de modificar para realizar los cambios.', 'last' => 'último', 'From server' => 'Desde servidor', diff --git a/adminer/lang/et.inc.php b/adminer/lang/et.inc.php index fe7110f9..7b79eaa8 100644 --- a/adminer/lang/et.inc.php +++ b/adminer/lang/et.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been dropped.' => 'Tüüp on edukalt kustutatud.', 'Type has been created.' => 'Tüüp on edukalt loodud.', 'Double click on a value to modify it.' => 'Väärtuse muutmiseks topelt-kliki sellel.', - 'Increase text length to modify this value.' => 'Väärtuse muutmiseks suurenda tekstiveeru pikkust.', + 'Increase Text length to modify this value.' => 'Väärtuse muutmiseks suurenda Tekstiveeru pikkust.', 'Use edit link to modify this value.' => 'Väärtuse muutmiseks kasuta muutmislinki.', 'last' => 'viimane', 'From server' => 'Serverist', diff --git a/adminer/lang/fr.inc.php b/adminer/lang/fr.inc.php index 302eb1f6..672f60c9 100644 --- a/adminer/lang/fr.inc.php +++ b/adminer/lang/fr.inc.php @@ -245,7 +245,7 @@ $translations = array( 'Type has been dropped.' => 'Le type a été supprimé.', 'Type has been created.' => 'Le type a été créé.', 'Double click on a value to modify it.' => 'Double-cliquez sur une valeur pour la modifier.', - 'Increase text length to modify this value.' => 'Augmentez la longueur de texte affiché pour modifier cette valeur.', + 'Increase Text length to modify this value.' => 'Augmentez la Longueur de texte affiché pour modifier cette valeur.', 'Use edit link to modify this value.' => 'Utilisez le lien "modifier" pour modifier cette valeur.', 'last' => 'dernière', 'From server' => 'Depuis le serveur', diff --git a/adminer/lang/hu.inc.php b/adminer/lang/hu.inc.php index b553a1c9..ed44e2e9 100644 --- a/adminer/lang/hu.inc.php +++ b/adminer/lang/hu.inc.php @@ -235,7 +235,7 @@ $translations = array( 'Databases have been dropped.' => 'Adatbázis eldobva.', 'File exists.' => 'A fájl létezik.', 'Double click on a value to modify it.' => 'Kattints kétszer az értékre a szerkesztéshez.', - 'Increase text length to modify this value.' => 'Növeld a szöveg hosszát, hogy módosítani tudd ezt az értéket.', + 'Increase Text length to modify this value.' => 'Növeld a Szöveg hosszát, hogy módosítani tudd ezt az értéket.', 'Use edit link to modify this value.' => 'Használd a szerkesztés hivatkozást ezen érték módosításához.', 'Alter schema' => 'Séma módosítása', 'Create schema' => 'Séma létrehozása', diff --git a/adminer/lang/it.inc.php b/adminer/lang/it.inc.php index f3a4422b..df8287e2 100644 --- a/adminer/lang/it.inc.php +++ b/adminer/lang/it.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been dropped.' => 'Tipo definito dall\'utente eliminato.', 'Type has been created.' => 'Tipo definito dall\'utente creato.', 'Double click on a value to modify it.' => 'Fai doppio click su un valore per modificarlo.', - 'Increase text length to modify this value.' => 'Aumenta la lunghezza del testo per modificare questo valore.', + 'Increase Text length to modify this value.' => 'Aumenta la Lunghezza del testo per modificare questo valore.', 'Use edit link to modify this value.' => 'Usa il link modifica per modificare questo valore.', 'last' => 'ultima', 'From server' => 'Dal server', diff --git a/adminer/lang/ja.inc.php b/adminer/lang/ja.inc.php index acddf229..c93532ac 100644 --- a/adminer/lang/ja.inc.php +++ b/adminer/lang/ja.inc.php @@ -247,7 +247,7 @@ $translations = array( 'Type has been dropped.' => 'ユーザー定義型を削除しました', 'Type has been created.' => 'ユーザー定義型を追加しました', 'Double click on a value to modify it.' => 'ダブルクリックして編集', - 'Increase text length to modify this value.' => '編集枠を広げる', + 'Increase Text length to modify this value.' => '編集枠を広げる', 'Use edit link to modify this value.' => 'リンクを編集する', 'last' => '最終', 'From server' => 'サーバーから実行', diff --git a/adminer/lang/nl.inc.php b/adminer/lang/nl.inc.php index 16cd8245..c5864edc 100644 --- a/adminer/lang/nl.inc.php +++ b/adminer/lang/nl.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been dropped.' => 'Type verwijderd.', 'Type has been created.' => 'Type aangemaakt.', 'Double click on a value to modify it.' => 'Dubbelklik op een waarde om deze te bewerken.', - 'Increase text length to modify this value.' => 'Verhoog de lengte om deze waarde te bewerken.', + 'Increase Text length to modify this value.' => 'Verhoog de lengte om deze waarde te bewerken.', 'Use edit link to modify this value.' => 'Gebruik de link "bewerk" om deze waarde te wijzigen.', 'last' => 'laatste', 'From server' => 'Van server', diff --git a/adminer/lang/ru.inc.php b/adminer/lang/ru.inc.php index f2ce6ea2..a253c88b 100644 --- a/adminer/lang/ru.inc.php +++ b/adminer/lang/ru.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been dropped.' => 'Тип удален.', 'Type has been created.' => 'Создан новый тип.', 'Double click on a value to modify it.' => 'Кликни два раза по значению, чтобы его изменить.', - 'Increase text length to modify this value.' => 'Увеличь длину текста, чтобы изменить это значение.', + 'Increase Text length to modify this value.' => 'Увеличь Длину текста, чтобы изменить это значение.', 'Use edit link to modify this value.' => 'Изменить это значение можно с помощью ссылки «изменить».', 'last' => 'последняя', 'From server' => 'С сервера', diff --git a/adminer/lang/sk.inc.php b/adminer/lang/sk.inc.php index 2005b330..611f367b 100644 --- a/adminer/lang/sk.inc.php +++ b/adminer/lang/sk.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been created.' => 'Typ bol vytvorený.', 'Alter type' => 'Pozmeniť typ', 'Double click on a value to modify it.' => 'Dvojkliknite na políčko, ktoré chcete zmeniť.', - 'Increase text length to modify this value.' => 'Pre zmenu tejto hodnoty zvýšte dĺžku textov.', + 'Increase Text length to modify this value.' => 'Pre zmenu tejto hodnoty zvýšte Dĺžku textov.', 'Use edit link to modify this value.' => 'Pre zmenu tejto hodnoty použite odkaz upraviť.', 'last' => 'posledný', 'From server' => 'Zo serveru', diff --git a/adminer/lang/ta.inc.php b/adminer/lang/ta.inc.php index b31e23d7..d716700d 100644 --- a/adminer/lang/ta.inc.php +++ b/adminer/lang/ta.inc.php @@ -236,7 +236,7 @@ $translations = array( 'Schema has been created.' => 'அமைப்புமுறை உருவாக்க‌ப்ப‌ட்ட‌து.', 'Schema has been altered.' => 'அமைப்புமுறை மாற்ற‌ப்ப‌ட்ட‌து.', 'Double click on a value to modify it.' => 'ம‌திப்பினை மாற்ற அத‌ன் மீது இருமுறை சொடுக்க‌வும் (Double click).', - 'Increase text length to modify this value.' => 'இந்த‌ ம‌திப்பினை மாற்ற, டெக்ஸ்ட் நீள‌த்தினை அதிக‌ரிக்க‌வும்.', + 'Increase Text length to modify this value.' => 'இந்த‌ ம‌திப்பினை மாற்ற, டெக்ஸ்ட் நீள‌த்தினை அதிக‌ரிக்க‌வும்.', 'Use edit link to modify this value.' => 'இந்த‌ ம‌திப்பினை மாற்ற‌, தொகுப்பு இணைப்பினை உப‌யோகிக்க‌வும்.', 'last' => 'க‌டைசி', 'Sequence has been dropped.' => 'வ‌ரிசைமுறை நீக்க‌ப்ப‌ட்ட‌து.', diff --git a/adminer/lang/zh-tw.inc.php b/adminer/lang/zh-tw.inc.php index 759f7d87..1930a7e2 100644 --- a/adminer/lang/zh-tw.inc.php +++ b/adminer/lang/zh-tw.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been dropped.' => '已刪除類型。', 'Type has been created.' => '已建立類型。', 'Double click on a value to modify it.' => '雙擊以進行修改。', - 'Increase text length to modify this value.' => '增加字串長度來修改。', + 'Increase Text length to modify this value.' => '增加字串長度來修改。', 'Use edit link to modify this value.' => '使用編輯連結來修改。', 'last' => '最後一頁', 'From server' => '從伺服器', diff --git a/adminer/lang/zh.inc.php b/adminer/lang/zh.inc.php index b1f034d0..14045991 100644 --- a/adminer/lang/zh.inc.php +++ b/adminer/lang/zh.inc.php @@ -246,7 +246,7 @@ $translations = array( 'Type has been dropped.' => '已丢弃类型。', 'Type has been created.' => '已创建类型。', 'Double click on a value to modify it.' => '在值上双击类修改它。', - 'Increase text length to modify this value.' => '增加文本长度以修改该值。', + 'Increase Text length to modify this value.' => '增加文本长度以修改该值。', 'Use edit link to modify this value.' => '使用编辑链接来修改该值。', 'last' => '最后', 'From server' => '来自服务器', diff --git a/adminer/select.inc.php b/adminer/select.inc.php index 0c174503..c541d837 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -340,7 +340,7 @@ if (!$columns) { $text = ereg('text|lob', $field["type"]); echo (($_GET["modify"] && $editable) || isset($value) ? "" . ($text ? "" : "") - : "" . $adminer->selectVal($val, $link, $field) + : "" . $adminer->selectVal($val, $link, $field) ); } } From 53d7f0306df88538933d49b9bf6d70c04318fab7 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 16:37:22 +0200 Subject: [PATCH 04/19] Save NULL for empty string in inline-edit --- adminer/select.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adminer/select.inc.php b/adminer/select.inc.php index c541d837..191701a6 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -126,7 +126,7 @@ if ($_POST && !$error) { $set = array(); foreach ($row as $key => $val) { $key = bracket_escape($key, 1); // 1 - back - $set[] = idf_escape($key) . " = " . $adminer->processInput($fields[$key], $val); + $set[] = idf_escape($key) . " = " . (ereg('varchar|text', $fields[$key]["type"]) || $val != "" ? $adminer->processInput($fields[$key], $val) : "NULL"); } $result = queries("UPDATE" . limit1(table($TABLE) . " SET " . implode(", ", $set), " WHERE " . where_check($unique_idf) . ($where ? " AND " . implode(" AND ", $where) : ""))); // can change row on a different page without unique key if (!$result) { From 44ae8c876606f78fff292b9b95b01490c0cc2639 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 18:45:05 +0200 Subject: [PATCH 05/19] Check collation --- adminer/database.inc.php | 2 +- adminer/drivers/mssql.inc.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adminer/database.inc.php b/adminer/database.inc.php index eb9f6ac3..94615289 100644 --- a/adminer/database.inc.php +++ b/adminer/database.inc.php @@ -28,7 +28,7 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c if (!$_POST["collation"]) { redirect(substr(ME, 0, -1)); } - query_redirect("ALTER DATABASE " . idf_escape($_POST["name"]) . " COLLATE $_POST[collation]", substr(ME, 0, -1), lang('Database has been altered.')); //! SQL injection - quotes are not allowed in MS SQL 2005 + query_redirect("ALTER DATABASE " . idf_escape($_POST["name"]) . (eregi('^[a-z0-9_]+$', $_POST["collation"]) ? " COLLATE $_POST[collation]" : ""), substr(ME, 0, -1), lang('Database has been altered.')); //! SQL injection - quotes are not allowed in MS SQL 2005 } } diff --git a/adminer/drivers/mssql.inc.php b/adminer/drivers/mssql.inc.php index 5d850a36..de3114bd 100644 --- a/adminer/drivers/mssql.inc.php +++ b/adminer/drivers/mssql.inc.php @@ -383,7 +383,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table) } function create_database($db, $collation) { - return queries("CREATE DATABASE " . idf_escape($db) . ($collation ? " COLLATE $collation" : "")); + return queries("CREATE DATABASE " . idf_escape($db) . (eregi('^[a-z0-9_]+$', $collation) ? " COLLATE $collation" : "")); } function drop_databases($databases) { @@ -391,7 +391,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table) } function rename_database($name, $collation) { - if ($collation) { + if (eregi('^[a-z0-9_]+$', $collation)) { queries("ALTER DATABASE " . idf_escape(DB) . " COLLATE $collation"); } queries("ALTER DATABASE " . idf_escape(DB) . " MODIFY NAME = " . idf_escape($name)); From 6ab272b72c3f9beeaa7a4f657c3f57b5f42aa0aa Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 21:12:37 +0200 Subject: [PATCH 06/19] Allow comments in translations --- adminer/lang/cs.inc.php | 32 +++++++++++++++++++++++++++++++- lang.php | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index 98b3e823..d1144269 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -25,6 +25,7 @@ $translations = array( 'Save' => 'Uložit', 'Drop' => 'Odstranit', 'Database has been dropped.' => 'Databáze byla odstraněna.', + 'Databases have been dropped.' => 'Databáze byly odstraněny.', 'Database has been created.' => 'Databáze byla vytvořena.', 'Database has been renamed.' => 'Databáze byla přejmenována.', 'Database has been altered.' => 'Databáze byla změněna.', @@ -40,7 +41,10 @@ $translations = array( 'Create new table' => 'Vytvořit novou tabulku', 'Item has been deleted.' => 'Položka byla smazána.', 'Item has been updated.' => 'Položka byla aktualizována.', + + // %s can contain auto-increment value 'Item%s has been inserted.' => 'Položka%s byla vložena.', + 'Edit' => 'Upravit', 'Insert' => 'Vložit', 'Save and insert next' => 'Uložit a vložit další', @@ -227,16 +231,30 @@ $translations = array( 'File does not exist.' => 'Soubor neexistuje.', 'Permanent login' => 'Trvalé přihlášení', '%d in total' => '%d celkem', + + // label for e-mail attachments in Adminer Editor 'Attachments' => 'Přílohy', + + // label for database system selection (MySQL, SQLite, ...) 'System' => 'Systém', + + // link to last page if exact number is unknown 'last' => 'poslední', + + // new data type categories 'Network' => 'Síť', 'Geometry' => 'Geometrie', - 'Databases have been dropped.' => 'Databáze byly odstraněny.', + + // general SQLite error in create, drop or rename database 'File exists.' => 'Soubor existuje.', + 'Please use one of the extensions %s.' => 'Prosím použijte jednu z koncovek %s.', + + // selects now support in-place editing 'Double click on a value to modify it.' => 'Dvojklikněte na políčko, které chcete změnit.', 'Increase Text length to modify this value.' => 'Ke změně této hodnoty zvyšte Délku textů.', 'Use edit link to modify this value.' => 'Ke změně této hodnoty použijte odkaz upravit.', + + // PostgreSQL and MS SQL schema support 'Alter schema' => 'Pozměnit schéma', 'Create schema' => 'Vytvořit schéma', 'Schema has been dropped.' => 'Schéma bylo odstraněno.', @@ -244,19 +262,31 @@ $translations = array( 'Schema has been altered.' => 'Schéma bylo změněno.', 'schema' => 'schéma', 'Schema' => 'Schéma', + + // PostgreSQL sequences support 'Sequences' => 'Sekvence', 'Create sequence' => 'Vytvořit sekvenci', 'Sequence has been dropped.' => 'Sekvence byla odstraněna.', 'Sequence has been created.' => 'Sekvence byla vytvořena.', 'Sequence has been altered.' => 'Sekvence byla změněna.', 'Alter sequence' => 'Pozměnit sekvenci', + + // PostgreSQL user types support 'User types' => 'Uživatelské typy', 'Create type' => 'Vytvořit typ', 'Type has been dropped.' => 'Typ byl odstraněn.', 'Type has been created.' => 'Typ byl vytvořen.', 'Alter type' => 'Pozměnit typ', + + // label for search in whole database 'Search data in tables' => 'Vyhledat data v tabulkách', + + // label for box with "Run webserver file adminer.sql" 'From server' => 'Ze serveru', + + // label for value '' in enum data type 'empty' => 'prázdné', + + // function translation used in Editor 'now' => 'teď', ); diff --git a/lang.php b/lang.php index e2b0ff85..a2f2bb5d 100644 --- a/lang.php +++ b/lang.php @@ -28,7 +28,7 @@ foreach (glob(dirname(__FILE__) . "/adminer/lang/" . ($_SESSION["lang"] ? $_SESS $messages = $messages_all; $file = file_get_contents($filename); $file = str_replace("\r", "", $file); - preg_match_all("~^(\\s*)(?:// )?(('(?:[^\\\\']+|\\\\.)*') => .*[^,\n]),?~m", $file, $matches, PREG_SET_ORDER); + preg_match_all("~^(\\s*(?:// [^'].*\\s+)?)(?:// )?(('(?:[^\\\\']+|\\\\.)*') => .*[^,\n]),?~m", $file, $matches, PREG_SET_ORDER); $s = ""; foreach ($matches as $match) { if (isset($messages[$match[3]])) { From b835ce4ef401e28dd88a772a3930152ab3e8b42a Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 21:39:34 +0200 Subject: [PATCH 07/19] Use template1 database as default (bug #3088192) --- adminer/drivers/pgsql.inc.php | 6 +++--- changes.txt | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 6398aa45..2cc9a0a3 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -22,11 +22,11 @@ if (isset($_GET["pgsql"])) { function connect($server, $username, $password) { set_error_handler(array($this, '_error')); $this->_string = "host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' user='" . addcslashes($username, "'\\") . "' password='" . addcslashes($password, "'\\") . "'"; - $this->_link = @pg_connect($this->_string . (DB != "" ? " dbname='" . addcslashes(DB, "'\\") . "'" : ""), PGSQL_CONNECT_FORCE_NEW); + $this->_link = @pg_connect($this->_string . (DB != "" ? " dbname='" . addcslashes(DB, "'\\") . "'" : " dbname='template1'"), PGSQL_CONNECT_FORCE_NEW); if (!$this->_link && DB != "") { // try to connect directly with database for performance $this->_database = false; - $this->_link = @pg_connect($this->_string, PGSQL_CONNECT_FORCE_NEW); + $this->_link = @pg_connect("$this->_string dbname='template1'", PGSQL_CONNECT_FORCE_NEW); } restore_error_handler(); if ($this->_link) { @@ -53,7 +53,7 @@ if (isset($_GET["pgsql"])) { } function close() { - $this->_link = @pg_connect($this->_string); + $this->_link = @pg_connect("$this->_string dbname='template1'"); } function query($query, $unbuffered = false) { diff --git a/changes.txt b/changes.txt index 094eda14..ac845ee9 100644 --- a/changes.txt +++ b/changes.txt @@ -2,6 +2,8 @@ Adminer 3.0.1-dev: Send the form by Ctrl+Enter in all textareas Disable creating SQLite databases with extension other than db, sdb, sqlite Catalan translation +MS SQL 2005 compatibility +PostgreSQL: connect if the eponymous database does not exist Adminer 3.0.0 (released 2010-10-15): Drivers for MS SQL, SQLite, PostgreSQL, Oracle From 1cd506ee1edc1c47b65a1e5a2bc78dcb445f0ca1 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 21:58:02 +0200 Subject: [PATCH 08/19] Comments --- adminer/database.inc.php | 2 +- readme.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/adminer/database.inc.php b/adminer/database.inc.php index 94615289..87f31dd7 100644 --- a/adminer/database.inc.php +++ b/adminer/database.inc.php @@ -28,7 +28,7 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c if (!$_POST["collation"]) { redirect(substr(ME, 0, -1)); } - query_redirect("ALTER DATABASE " . idf_escape($_POST["name"]) . (eregi('^[a-z0-9_]+$', $_POST["collation"]) ? " COLLATE $_POST[collation]" : ""), substr(ME, 0, -1), lang('Database has been altered.')); //! SQL injection - quotes are not allowed in MS SQL 2005 + query_redirect("ALTER DATABASE " . idf_escape($_POST["name"]) . (eregi('^[a-z0-9_]+$', $_POST["collation"]) ? " COLLATE $_POST[collation]" : ""), substr(ME, 0, -1), lang('Database has been altered.')); } } diff --git a/readme.txt b/readme.txt index ad3301a4..02f0c70a 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ Adminer - Database management in single PHP file -Adminer Editor - Database editor in single PHP file +Adminer Editor - Data manipulation for end-users http://www.adminer.org/ Supports: MySQL, PostgreSQL, SQLite, MS SQL, Oracle @@ -8,6 +8,7 @@ Apache License, Version 2.0 adminer/index.php - Run development version of Adminer editor/index.php - Run development version of Adminer Editor +editor/example.php - Example customization compile.php [driver] [lang] - Create a single file version lang.php [lang] - Update translations tests/selenium.html - Selenium test suite From 9db425940987b2a45af9feecefa9419d81685320 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 22:13:32 +0200 Subject: [PATCH 09/19] Introduce Adminer::headers method --- adminer/include/adminer.inc.php | 7 +++++++ adminer/include/design.inc.php | 2 +- changes.txt | 1 + editor/include/adminer.inc.php | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index d9692133..a9253eae 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -32,6 +32,13 @@ class Adminer { return DB; } + /** Headers to send before HTML output + * @return null + */ + function headers() { + header("X-Frame-Options: deny"); // ClickJacking protection in IE8, Safari 4, Chrome 2, Firefox NoScript plugin + } + /** Print login form * @return null */ diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php index 621ec5bc..445a7b24 100644 --- a/adminer/include/design.inc.php +++ b/adminer/include/design.inc.php @@ -9,7 +9,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { global $LANG, $HTTPS, $adminer, $connection, $drivers; header("Content-Type: text/html; charset=utf-8"); - header("X-Frame-Options: deny"); // ClickJacking protection in IE8, Safari 4, Chrome 2, Firefox NoScript plugin + $adminer->headers(); $title_all = $title . ($title2 != "" ? ": " . h($title2) : ""); $protocol = ($HTTPS ? "https" : "http"); ?> diff --git a/changes.txt b/changes.txt index ac845ee9..87894e2b 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,7 @@ Adminer 3.0.1-dev: Send the form by Ctrl+Enter in all textareas Disable creating SQLite databases with extension other than db, sdb, sqlite +Ability to use Adminer in a frame through customization Catalan translation MS SQL 2005 compatibility PostgreSQL: connect if the eponymous database does not exist diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index e7c74760..8014e74c 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -26,6 +26,10 @@ class Adminer { ); } + function headers() { + header("X-Frame-Options: deny"); + } + function loginForm() { ?> From 0782a7b2c11d8b04757e301195e711fdfb4b2c82 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 22:37:06 +0200 Subject: [PATCH 10/19] Save '' instead of NULL for empty char (some drivers don't have varchar) --- adminer/select.inc.php | 2 +- editor/include/adminer.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adminer/select.inc.php b/adminer/select.inc.php index 191701a6..21e8ef48 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -126,7 +126,7 @@ if ($_POST && !$error) { $set = array(); foreach ($row as $key => $val) { $key = bracket_escape($key, 1); // 1 - back - $set[] = idf_escape($key) . " = " . (ereg('varchar|text', $fields[$key]["type"]) || $val != "" ? $adminer->processInput($fields[$key], $val) : "NULL"); + $set[] = idf_escape($key) . " = " . (ereg('char|text', $fields[$key]["type"]) || $val != "" ? $adminer->processInput($fields[$key], $val) : "NULL"); } $result = queries("UPDATE" . limit1(table($TABLE) . " SET " . implode(", ", $set), " WHERE " . where_check($unique_idf) . ($where ? " AND " . implode(" AND ", $where) : ""))); // can change row on a different page without unique key if (!$result) { diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 8014e74c..7e80c937 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -415,7 +415,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5 $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); - if (!ereg('varchar|text', $field["type"]) && $field["full_type"] != "tinyint(1)" && $value == "") { + if (!ereg('char|text', $field["type"]) && $field["full_type"] != "tinyint(1)" && $value == "") { $return = "NULL"; } elseif (ereg('^(md5|sha1)$', $function)) { $return = "$function($return)"; From 031a82a4ad595bb0fb1bcaab8cf35126e4db51a4 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 00:33:18 +0200 Subject: [PATCH 11/19] Remove duplicate statement --- adminer/include/connect.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/adminer/include/connect.inc.php b/adminer/include/connect.inc.php index 242f1a89..231e2f7c 100644 --- a/adminer/include/connect.inc.php +++ b/adminer/include/connect.inc.php @@ -6,7 +6,6 @@ function connect_error() { page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true); } else { if ($_POST["db"] && !$error) { - set_session("dbs", null); queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"])); } From 6f5c1981a0f5ef58c9161babe66537007f03cb69 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 01:20:02 +0200 Subject: [PATCH 12/19] CSRF protection of included JavaScript --- adminer/db.inc.php | 2 +- adminer/include/connect.inc.php | 2 +- adminer/script.inc.php | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/adminer/db.inc.php b/adminer/db.inc.php index 20944c96..453e0c25 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -155,6 +155,6 @@ if ($_GET["ns"] !== "") { } page_footer(); - echo "\n"; + echo "\n"; exit; // page_footer() already called } diff --git a/adminer/include/connect.inc.php b/adminer/include/connect.inc.php index 231e2f7c..a222dd73 100644 --- a/adminer/include/connect.inc.php +++ b/adminer/include/connect.inc.php @@ -43,7 +43,7 @@ function connect_error() { } } page_footer("db"); - echo "\n"; + echo "\n"; } if (isset($_GET["status"])) { diff --git a/adminer/script.inc.php b/adminer/script.inc.php index 3d872b46..81d663e9 100644 --- a/adminer/script.inc.php +++ b/adminer/script.inc.php @@ -1,5 +1,8 @@ 0, "Index_length" => 0, "Data_free" => 0); From ad9edea30b8dfa2f33cbcef636ff89220dec301a Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 01:23:10 +0200 Subject: [PATCH 13/19] Typo (bug #3089347) --- adminer/lang/ru.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adminer/lang/ru.inc.php b/adminer/lang/ru.inc.php index a253c88b..b7d0ef5c 100644 --- a/adminer/lang/ru.inc.php +++ b/adminer/lang/ru.inc.php @@ -147,7 +147,7 @@ $translations = array( 'Move down' => 'Переместить вниз', 'Functions' => 'Функции', 'Aggregation' => 'Агрегация', - 'Export' => 'Експорт', + 'Export' => 'Экспорт', 'Output' => 'Выходные данные', 'open' => 'открыть', 'save' => 'сохранить', From 16b5be1e8d424bd78b47fcc04d5aec70e79d0f73 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 01:48:27 +0200 Subject: [PATCH 14/19] Don't download tables count without databases list --- adminer/include/connect.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adminer/include/connect.inc.php b/adminer/include/connect.inc.php index a222dd73..840b11e8 100644 --- a/adminer/include/connect.inc.php +++ b/adminer/include/connect.inc.php @@ -43,7 +43,9 @@ function connect_error() { } } page_footer("db"); - echo "\n"; + if ($databases) { + echo "\n"; + } } if (isset($_GET["status"])) { From 8d565e63aba4f7c9c1e7952dd049fee336ef9c35 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 01:53:31 +0200 Subject: [PATCH 15/19] Respect scheme support --- adminer/include/connect.inc.php | 3 ++- todo.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/adminer/include/connect.inc.php b/adminer/include/connect.inc.php index 840b11e8..64cd6254 100644 --- a/adminer/include/connect.inc.php +++ b/adminer/include/connect.inc.php @@ -25,6 +25,7 @@ function connect_error() { echo "

" . lang('Logged as: %s', "" . h(logged_user()) . "") . "\n"; $databases = get_databases(); if ($databases) { + $scheme = support("scheme"); $collations = collations(); echo "
\n"; echo "

\n"; @@ -33,7 +34,7 @@ function connect_error() { $root = h(ME) . "db=" . urlencode($db); echo "
" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])); echo "" . h($db) . ""; - echo "" . nbsp(db_collation($db, $collations)) . ""; + echo "" . nbsp(db_collation($db, $collations)) . ""; echo "?"; echo "\n"; } diff --git a/todo.txt b/todo.txt index 1e772430..611ed1b4 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,6 @@ Transactions in export Create view and routine options -Variables editation, especially timezone +Variables editation, especially timezone (or set by PHP date.timezone) Highlight SQL textarea, then display query inside textarea in select - may use external CodeMirror Blob download and image display in edit form (important for Editor with hidden fields in select) Add title to Logout, edit (in select) and select (in menu) in style "hever" @@ -34,6 +34,7 @@ Delimiter in export and SQL command Backward keys in Editor PostgreSQL: +Display number of schemas in databases overview Users - SELECT * FROM pg_user ORDER BY COUNT(*) Export - http://www.postgresql.org/docs/8.4/static/functions-info.html From ea258302b44182104de91eebd57d9a1aafffbc14 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 02:06:41 +0200 Subject: [PATCH 16/19] Fullstops --- adminer/lang/ca.inc.php | 14 +++++++------- adminer/lang/cs.inc.php | 2 +- adminer/lang/hu.inc.php | 10 +++++----- adminer/lang/it.inc.php | 2 +- adminer/lang/sk.inc.php | 6 +++--- adminer/lang/ta.inc.php | 14 +++++++------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/adminer/lang/ca.inc.php b/adminer/lang/ca.inc.php index dbdb312b..6ba91fd4 100644 --- a/adminer/lang/ca.inc.php +++ b/adminer/lang/ca.inc.php @@ -62,7 +62,7 @@ $translations = array( 'Action' => 'Acció', 'edit' => 'edita', 'Page' => 'Plana', - 'Query executed OK, %d row(s) affected.' => array('Consulta executada correctament, %d fila modificada', 'Consulta executada correctament, %d files modificades'), + 'Query executed OK, %d row(s) affected.' => array('Consulta executada correctament, %d fila modificada.', 'Consulta executada correctament, %d files modificades.'), 'Error in query' => 'Error en la consulta', 'Execute' => 'Executa', 'Table' => 'Taula', @@ -78,14 +78,14 @@ $translations = array( 'Unable to upload a file.' => 'Impossible adjuntar el fitxer.', 'File upload' => 'Adjunta un fitxer', 'File uploads are disabled.' => 'L\'ddjunció de fitxers està desactivada.', - 'Routine has been called, %d row(s) affected.' => array('S\'ha cridat la rutina, %d fila modificada', 'S\'ha cridat la rutina, %d files modificades'), + 'Routine has been called, %d row(s) affected.' => array('S\'ha cridat la rutina, %d fila modificada.', 'S\'ha cridat la rutina, %d files modificades.'), 'Call' => 'Crida', 'No extension' => 'Cap extensió', 'None of the supported PHP extensions (%s) are available.' => 'No hi ha cap de les extensions PHP soporatades (%s) disponible.', 'Session support must be enabled.' => 'Cal que estigui permès l\'us de sessions.', 'Session expired, please login again.' => 'La sessió ha expirat, torna a iniciar-ne una.', 'Text length' => 'Longitud del text', - 'Foreign key has been dropped.' => 'S\'ha suprimit la clau forana', + 'Foreign key has been dropped.' => 'S\'ha suprimit la clau forana.', 'Foreign key has been altered.' => 'S\'ha modificat la clau forana.', 'Foreign key has been created.' => 'S\'ha creat la clau forana.', 'Foreign key' => 'Clau forana', @@ -120,9 +120,9 @@ $translations = array( 'Alter procedure' => 'Modifica el procediment', 'Return type' => 'Tipus retornat', 'Add trigger' => 'Afegeix un activador', - 'Trigger has been dropped.' => 'S\'ha suprimit l\'activador', - 'Trigger has been altered.' => 'S\'ha modificat l\'activador', - 'Trigger has been created.' => 'S\'ha creat l\'activador', + 'Trigger has been dropped.' => 'S\'ha suprimit l\'activador.', + 'Trigger has been altered.' => 'S\'ha modificat l\'activador.', + 'Trigger has been created.' => 'S\'ha creat l\'activador.', 'Alter trigger' => 'Modifica l\'activador', 'Create trigger' => 'Crea un activador', 'Time' => 'Temps', @@ -180,7 +180,7 @@ $translations = array( 'Tables have been truncated.' => 'S\'han escapçat les taules.', 'Rows' => 'Files', ',' => ',', - 'Tables have been moved.' => 'S\'han desplaçat les taules', + 'Tables have been moved.' => 'S\'han desplaçat les taules.', 'Move to other database' => 'Desplaça a una altra base de dades', 'Move' => 'Desplaça', 'Engine' => 'Motor', diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index d1144269..538de920 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -184,7 +184,7 @@ $translations = array( 'Tables have been truncated.' => 'Tabulky byly vyprázdněny.', 'Rows' => 'Řádků', ',' => ' ', - 'Tables have been moved.' => 'Tabulky byly přesunuty', + 'Tables have been moved.' => 'Tabulky byly přesunuty.', 'Move to other database' => 'Přesunout do jiné databáze', 'Move' => 'Přesunout', 'Engine' => 'Úložiště', diff --git a/adminer/lang/hu.inc.php b/adminer/lang/hu.inc.php index ed44e2e9..88291d2b 100644 --- a/adminer/lang/hu.inc.php +++ b/adminer/lang/hu.inc.php @@ -69,7 +69,7 @@ $translations = array( 'Foreign keys' => 'Idegen kulcs', 'Triggers' => 'Trigger', 'View' => 'Nézet', - 'Unable to select the table' => 'Nem tudom kiválasztani a táblát.', + 'Unable to select the table' => 'Nem tudom kiválasztani a táblát', 'Invalid CSRF token. Send the form again.' => 'Érvénytelen CSRF azonosító. Küldd újra az űrlapot.', 'Comment' => 'Megjegyzés', 'Default values' => 'Alapértelmezett értékek', @@ -113,7 +113,7 @@ $translations = array( 'Database schema' => 'Adatbázis séma', 'Create procedure' => 'Eljárás létrehozása', 'Create function' => 'Funkció létrehozása', - 'Routine has been dropped.' => 'A rutin eldobva,', + 'Routine has been dropped.' => 'A rutin eldobva.', 'Routine has been altered.' => 'A rutin módosult.', 'Routine has been created.' => 'A rutin létrejött.', 'Alter function' => 'Funkció módosítása', @@ -180,7 +180,7 @@ $translations = array( 'Tables have been truncated.' => 'A tábla felszabadítva.', 'Rows' => 'Oszlop', ',' => ' ', - 'Tables have been moved.' => 'Táblák áthelyezve', + 'Tables have been moved.' => 'Táblák áthelyezve.', 'Move to other database' => 'Áthelyezés másik adatbázisba', 'Move' => 'Áthelyez', 'Engine' => 'Motor', @@ -194,13 +194,13 @@ $translations = array( 'Partitions' => 'Particiók', 'Partition name' => 'Partició neve', 'Values' => 'Értékek', - '%d row(s) have been imported.' => array('%d sor importálva.', '%d sor importálva', '%d sor importálva'), + '%d row(s) have been imported.' => array('%d sor importálva.', '%d sor importálva.', '%d sor importálva.'), 'CSV Import' => 'CSV importálása', 'Import' => 'Importálás', 'Show structure' => 'Struktúra', 'Select data' => 'Tartalom', 'Stop on error' => 'Hiba esetén megáll', - 'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'A maximális mezőszámot elérted. Növeld meg ezeket: %s, %s', + 'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'A maximális mezőszámot elérted. Növeld meg ezeket: %s, %s.', 'anywhere' => 'bárhol', '%.3f s' => '%.3f másodperc', '$1-$3-$5' => '$6.$4.$1', diff --git a/adminer/lang/it.inc.php b/adminer/lang/it.inc.php index df8287e2..900f1544 100644 --- a/adminer/lang/it.inc.php +++ b/adminer/lang/it.inc.php @@ -187,7 +187,7 @@ $translations = array( 'Truncate' => 'Svuota', 'Move to other database' => 'Sposta in altro database', 'Move' => 'Sposta', - '%d item(s) have been affected.' => array('Il risultato consiste in %d elemento', 'Il risultato consiste in %d elementi'), + '%d item(s) have been affected.' => array('Il risultato consiste in %d elemento.', 'Il risultato consiste in %d elementi.'), 'whole result' => 'intero risultato', 'Clone' => 'Clona', 'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Troppi campi. Per favore aumentare %s e %s.', diff --git a/adminer/lang/sk.inc.php b/adminer/lang/sk.inc.php index 611f367b..33f5cc34 100644 --- a/adminer/lang/sk.inc.php +++ b/adminer/lang/sk.inc.php @@ -170,9 +170,9 @@ $translations = array( 'On completion preserve' => 'Po dokončení zachovat', 'Save and continue edit' => 'Uložiť a pokračovať v úpravách', 'original' => 'originál', - 'Tables have been truncated.' => 'Tabuľka bola vyprázdnená', - 'Tables have been moved.' => 'Tabuľka bola presunutá', - 'Tables have been dropped.' => 'Tabuľka bola odstránená', + 'Tables have been truncated.' => 'Tabuľka bola vyprázdnená.', + 'Tables have been moved.' => 'Tabuľka bola presunutá.', + 'Tables have been dropped.' => 'Tabuľka bola odstránená.', 'Tables and views' => 'Tabuľky a pohľady', 'Engine' => 'Typ', 'Collation' => 'Porovnávanie', diff --git a/adminer/lang/ta.inc.php b/adminer/lang/ta.inc.php index d716700d..53409554 100644 --- a/adminer/lang/ta.inc.php +++ b/adminer/lang/ta.inc.php @@ -2,14 +2,14 @@ $translations = array( 'Login' => 'நுழை', 'Logout successful.' => 'வெற்றிக‌ர‌மாய் வெளியேறியாயிற்று.', - 'Invalid credentials.' => 'ச‌ரியான‌ விப‌ர‌ங்க‌ள் இல்லை', + 'Invalid credentials.' => 'ச‌ரியான‌ விப‌ர‌ங்க‌ள் இல்லை.', 'Server' => 'வ‌ழ‌ங்கி (Server)', 'Username' => 'ப‌ய‌னாள‌ர் (User)', 'Password' => 'க‌ட‌வுச்சொல்', 'Select database' => 'த‌க‌வ‌ல்த‌ள‌த்தை தேர்வு செய்', 'Invalid database.' => 'த‌க‌வ‌ல்த‌ள‌ம் ச‌ரியானதல்ல‌.', 'Create new database' => 'புதிய‌ த‌க‌வ‌ல்த‌ள‌த்தை உருவாக்கு', - 'Table has been dropped.' => 'அட்ட‌வ‌ணை நீக்க‌ப்ப‌ட்ட‌து', + 'Table has been dropped.' => 'அட்ட‌வ‌ணை நீக்க‌ப்ப‌ட்ட‌து.', 'Table has been altered.' => 'அட்ட‌வணை மாற்ற‌ப்ப‌ட்ட‌து.', 'Table has been created.' => 'அட்ட‌வ‌ணை உருவாக்க‌ப்ப‌ட்ட‌து.', 'Alter table' => 'அட்ட‌வ‌ணையை மாற்று', @@ -62,13 +62,13 @@ $translations = array( 'edit' => 'தொகு', 'Page' => 'ப‌க்க‌ம்', 'Query executed OK, %d row(s) affected.' => array('வின‌வ‌ல் செய‌ல்ப‌டுத்த‌ப்ப‌ட்ட‌து, %d வ‌ரிசை மாற்ற‌ப்ப‌ட்ட‌து.', 'வின‌வ‌ல் செய‌ல்ப‌டுத்த‌ப்ப‌ட்ட‌து, %d வ‌ரிசைக‌ள் மாற்றப்ப‌ட்ட‌ன‌.'), - 'Error in query' => 'வின‌வ‌லில் த‌வ‌றுள்ள‌து.', + 'Error in query' => 'வின‌வ‌லில் த‌வ‌றுள்ள‌து', 'Execute' => 'செய‌ல்ப‌டுத்து', 'Table' => 'அட்ட‌வ‌ணை', 'Foreign keys' => 'வேற்று விசைக‌ள்', 'Triggers' => 'தூண்டுத‌ல்க‌ள்', 'View' => 'தோற்றம்', - 'Unable to select the table' => 'அட்ட‌வ‌ணையை தேர்வு செய்ய‌ முடிய‌வில்லை.', + 'Unable to select the table' => 'அட்ட‌வ‌ணையை தேர்வு செய்ய‌ முடிய‌வில்லை', 'Invalid CSRF token. Send the form again.' => 'CSRF டோக்க‌ன் செல்லாது. ப‌டிவ‌த்தை மீண்டும் அனுப்ப‌வும்.', 'Comment' => 'குறிப்பு', 'Default values' => 'உள்ளிருக்கும் (Default) ம‌திப்புக‌ள் ', @@ -121,8 +121,8 @@ $translations = array( 'Trigger has been dropped.' => 'தூண்டு விசை நீக்க‌ப்ப‌ட்ட‌து.', 'Trigger has been altered.' => 'தூண்டு விசை மாற்ற‌ப்ப‌ட்ட‌து.', 'Trigger has been created.' => 'தூண்டு விசை உருவாக்க‌ப்ப‌ட்ட‌து.', - 'Alter trigger' => 'தூண்டு விசையை மாற்று.', - 'Create trigger' => 'தூண்டு விசையை உருவாக்கு.', + 'Alter trigger' => 'தூண்டு விசையை மாற்று', + 'Create trigger' => 'தூண்டு விசையை உருவாக்கு', 'Time' => 'நேர‌ம்', 'Event' => 'நிக‌ழ்ச்சி', '%d row(s)' => array('%d வ‌ரிசை', '%d வ‌ரிசைக‌ள்'), @@ -257,6 +257,6 @@ $translations = array( 'Network' => 'நெட்வொர்க்', 'Geometry' => 'வ‌டிவ‌விய‌ல் (Geometry)', 'File exists.' => 'கோப்பு உள்ள‌து.', - 'Attachments' => 'இணைப்புக‌ள்.', + 'Attachments' => 'இணைப்புக‌ள்', 'now' => 'இப்பொழுது', ); From 09327efdaf0a735f4132bfad0da1943c098cf562 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 02:15:13 +0200 Subject: [PATCH 17/19] Don't download script with no tables --- adminer/db.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/adminer/db.inc.php b/adminer/db.inc.php index 453e0c25..b433c49f 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -154,7 +154,9 @@ if ($_GET["ns"] !== "") { echo '

' . lang('Create event') . "\n"; } - page_footer(); - echo "\n"; - exit; // page_footer() already called + if ($tables_list) { + page_footer(); + echo "\n"; + exit; // page_footer() already called + } } From d49903b21dfd6a43da812cd9a3bf301057414f5e Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 02:15:58 +0200 Subject: [PATCH 18/19] Report invalid schema --- adminer/include/adminer.inc.php | 4 ++-- adminer/include/connect.inc.php | 11 +++++++++-- adminer/include/design.inc.php | 2 +- adminer/lang/cs.inc.php | 1 + editor/include/adminer.inc.php | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index a9253eae..fd5956d7 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -491,7 +491,7 @@ document.getElementById('username').focus(); } /** Prints navigation after Adminer title - * @param string can be "auth" if there is no database connection or "db" if there is no database selected + * @param string can be "auth" if there is no database connection, "db" if there is no database selected, "ns" with invalid schema * @return null */ function navigation($missing) { @@ -544,7 +544,7 @@ document.getElementById('username').focus(); set_schema($_GET["ns"]); } } - if ($_GET["ns"] !== "") { + if ($_GET["ns"] !== "" && $missing != "ns") { $tables = tables_list(); if (!$tables) { echo "

" . lang('No tables.') . "\n"; diff --git a/adminer/include/connect.inc.php b/adminer/include/connect.inc.php index 64cd6254..1f58a6ef 100644 --- a/adminer/include/connect.inc.php +++ b/adminer/include/connect.inc.php @@ -60,6 +60,13 @@ if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET exit; } -if (support("scheme") && DB != "" && $_GET["ns"] !== "" && (!isset($_GET["ns"]) || !set_schema($_GET["ns"]))) { - redirect(preg_replace('~ns=[^&]*&~', '', ME) . "ns=" . get_schema()); +if (support("scheme") && DB != "" && $_GET["ns"] !== "") { + if (!isset($_GET["ns"])) { + redirect(preg_replace('~ns=[^&]*&~', '', ME) . "ns=" . get_schema()); + } + if (!set_schema($_GET["ns"])) { + page_header(lang('Schema') . ": " . h($_GET["ns"]), lang('Invalid schema.'), true); + page_footer("ns"); + exit; + } } diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php index 445a7b24..81b40d11 100644 --- a/adminer/include/design.inc.php +++ b/adminer/include/design.inc.php @@ -73,7 +73,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { } /** Print HTML footer -* @param string auth|db +* @param string "auth", "db", "ns" * @return null */ function page_footer($missing = "") { diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index 538de920..4c91e62a 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -262,6 +262,7 @@ $translations = array( 'Schema has been altered.' => 'Schéma bylo změněno.', 'schema' => 'schéma', 'Schema' => 'Schéma', + 'Invalid schema.' => 'Nesprávné schéma.', // PostgreSQL sequences support 'Sequences' => 'Sekvence', diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 7e80c937..ac99cc5b 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -463,7 +463,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5

" . lang('No tables.') . "\n"; From f7d458788033eb98621964c0bfaf50e4680bd519 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 18 Oct 2010 07:38:23 +0200 Subject: [PATCH 19/19] Hide SQL command link in case of an error --- adminer/include/adminer.inc.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index fd5956d7..c0c0a011 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -523,10 +523,14 @@ document.getElementById('username').focus(); ?>

- - -"> - +" . bold(lang('SQL command'), isset($_GET["sql"])) . "\n"; + if (support("dump")) { + echo "" . bold(lang('Dump'), isset($_GET["dump"])) . "\n"; + } +} +?>

@@ -544,7 +548,7 @@ document.getElementById('username').focus(); set_schema($_GET["ns"]); } } - if ($_GET["ns"] !== "" && $missing != "ns") { + if ($_GET["ns"] !== "" && !$missing) { $tables = tables_list(); if (!$tables) { echo "

" . lang('No tables.') . "\n";