1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-30 17:50:00 +02:00

Compare commits

..

69 Commits

Author SHA1 Message Date
Peter Knut
e6fdf2b400 Release 4.9.1 2024-09-09 10:30:14 +02:00
Peter Knut
b542b6613c PostgreSQL: Fix undefined properties on PHP 8
Thanks to FrancoisCapon (https://github.com/vrana/adminer/pull/429)
2024-09-08 23:22:44 +02:00
Peter Knut
374b8ed6a6 PostgreSQL: Fix documentation link for SERIAL type
Thanks to leggiero (https://github.com/vrana/adminer/pull/432)
2024-09-08 23:01:47 +02:00
Michal Paulovic
58cca3f951 MySQL: Add unix_timestamp to functions 2024-09-08 23:01:46 +02:00
caltong
5eecb8e6a3 PostgreSQL: Make data length calculation more accurate 2024-09-08 22:28:06 +02:00
Thomas Daniels
0d0936550c PostgreSQL: Show only accessible databases 2024-09-08 01:02:49 +02:00
Peter Knut
c4ed9500a1 Add support for translations in plugins 2024-09-07 22:54:04 +02:00
Peter Knut
0863766970 Replace deprecated <acronym> with <abbr> 2024-09-07 22:53:18 +02:00
Peter Knut
146a24efad AdminerLoginOtp: Autocomplete hints for OTP input field, code refactoring
Tanks to SGCBB (https://github.com/vrana/adminer/pull/488)
2024-09-07 22:53:08 +02:00
Sneda8
00b9fbda08 PHP 8.3 error suppression
PHP 8.3 has shortened the array access on null error message to "Trying to access array offset on null". This commit changes the regular expression used to circumvent errors.
2024-09-06 00:33:53 +02:00
Peter Knut
8ea329538f Improved displaying of long table names in menu 2024-09-03 00:34:00 +02:00
Peter Knut
a3428cc7ff Fix compiling jush external files 2024-09-02 23:18:44 +02:00
Peter Knut
2a01969c96 Add .editorconfig file
Thanks to cweiske (https://github.com/adminerevo/adminerevo/pull/163).
2024-08-26 00:56:10 +02:00
Peter Knut
9b8d14c3ee Refactor and fix the plugin AdminerEditForeign
Thanks to Amunak (https://github.com/adminerevo/adminerevo/pull/86).
2024-08-25 23:48:02 +02:00
Peter Knut
2ce88d9bdc Fix field selection in Elasticsearch
Thanks to cweiske: https://github.com/adminerevo/adminerevo/pull/159
2024-08-25 22:14:50 +02:00
Peter Knut
593c8e5bcc Bump version to 4.9.1-dev 2024-08-21 00:07:57 +02:00
Peter Knut
a134193afa Release 4.9 2024-08-21 00:07:57 +02:00
Peter Knut
8a60243459 Add script for exporting compiled adminer variants 2024-08-21 00:07:55 +02:00
Peter Knut
b94636f8a7 Properly set PHP required version 2024-08-20 23:58:16 +02:00
Peter Knut
47ccfa2a2e Avoid showing version on login page (and css/js version)
Thanks to MisterDuval (https://github.com/adminerevo/adminerevo/pull/180)
2024-08-20 23:58:16 +02:00
Adrian Jones
949b39b191 Fix uninitialized string offset
This can happen if you include an unpaired single or double quote, eg: SELECT * FROM table_name WHERE field_name = 'test
2024-08-20 23:58:16 +02:00
Denitz
09a946cb99 Skip dump of generated columns 2024-08-20 23:58:16 +02:00
Peter Knut
13258de188 Fix several bugs and security issues in AdminerFileUpload plugin 2024-08-20 23:58:16 +02:00
Peter Knut
5fe25fca67 Improve readability of the code for the query block 2024-08-20 23:58:16 +02:00
Roy Orbitson
a693e75e32 No-verify plugin breaks others
Does not need to block other plugins from using the head() method.
2024-08-20 23:58:16 +02:00
Peter Knut
de7dd4b64f Improve URL and email detection 2024-08-20 23:58:16 +02:00
Peter Knut
8a70474651 Add PHP extensions to Composer suggestions 2024-08-20 23:58:16 +02:00
Peter Knut
43a0305a23 Fix server URL validation for Oracle connections
Every driver can validate URL host and path by its own rules. Path is forbidden by default, HTTP-based drivers allow only '/' as path and Oracle driver validates path according to the EasyConnect URL format.
2024-08-20 23:58:16 +02:00
Peter Knut
bff6f8ca93 Fix linking external dependencies 2024-03-18 00:35:07 +01:00
Peter Knut
f38c0a1f13 Set saving to file as a default export option 2024-03-17 21:12:35 +01:00
Peter Knut
835c10674b Merge branch 'elastic' 2024-03-17 16:47:53 +01:00
Peter Knut
fc5a46549e Update changes.txt 2024-03-17 16:39:20 +01:00
Peter Knut
898dc9e25e Move Elastic drivers to plugins, driver for Elastic 7+ is the default 2024-03-17 16:39:20 +01:00
Peter Knut
32160b48ae Modify tables hierarchy for Elasticsearch 7
- Properly display list of databases, indexes, aliases and fields.
- Fix search and delete queries.
2024-03-17 16:39:20 +01:00
Peter Knut
6beb07a181 New Elasticsearch 7 plugin as a copy of the old one 2024-03-17 13:53:58 +01:00
Peter Knut
ee42077e54 Improve code readability by using of empty lines 2024-03-17 13:52:59 +01:00
Peter Knut
c3e2e6c58f Compatibility with Elasticsearch 7.14
- Removed empty body from requests.
- Fix deleting records.
2024-03-17 13:52:59 +01:00
Peter Knut
49effeff09 Fix global search in all tables 2024-03-17 13:10:18 +01:00
Peter Knut
857cbf03f2 Fix version condition for deprecated mapping types
Mapping types are still supported in version 6, but only one mapping type can be created.
In version 7, mapping types are deprecated and there is only one system '_doc' mapping type.
See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html
2024-03-17 13:10:18 +01:00
Peter Knut
e8c9164a77 Fix searching if "anywhere" field is selected
- Allow to search only in fields with index.
2024-03-17 13:10:18 +01:00
Peter Knut
01fe709b7a Replace deprecated "filtered" query with "bool" query
- Allow to choose "must", "should", "must_not" condition.
- Add system "_id" column to the field list. So it can be used in search condition.
2024-03-17 13:10:18 +01:00
Peter Knut
90addc5e78 Update changes.txt 2024-03-17 13:10:03 +01:00
Peter Knut
b71a456514 Fix undefined $sql variable 2024-03-17 12:38:57 +01:00
Peter Knut
4d7642a624 Merge branch 'field-privileges' 2024-03-16 23:00:11 +01:00
Peter Knut
9f8dadbb40 Add support for "order" field privilege
In Elasticsearch, text fields are not sortable.
2024-03-16 22:55:10 +01:00
Peter Knut
9968851f1e Add support for "where" field privilege
In Elasticsearch, only indexed fields are searchable.
2024-03-16 22:55:10 +01:00
Peter Knut
a5780e58af Move dependencies from submodules to Composer 2024-03-16 22:45:42 +01:00
Peter Knut
e8b40e3b9d Update hydra and pepa-lintha-dark themes 2024-03-16 22:45:42 +01:00
Peter Knut
35afd4f88c Merge branch 'login-fixes' 2024-03-16 19:15:09 +01:00
Peter Knut
38e4b51256 Update changes.txt 2024-03-16 19:14:17 +01:00
Peter Knut
55a7d3864f Change 'Invalid credentials.' message 2024-03-16 18:02:31 +01:00
Peter Knut
e69583a800 Validate server connection in SimpleDB driver 2024-03-16 18:02:31 +01:00
Peter Knut
338c81e2a3 Validate server connection in Elasticsearch and ClickHouse drivers 2024-03-16 18:02:31 +01:00
Peter Knut
9eb4d00564 Disable redirections in HTTP based drivers 2024-03-16 18:02:31 +01:00
Peter Knut
1c5947de50 Validate server input
- Allow only scheme, host and port in the server field.
- Use proper default host and port in Elasticsearch and ClickHouse driver.
2024-03-16 18:02:31 +01:00
Peter Knut
5cfd48bb68 Bump version to 4.9-dev 2024-03-16 13:23:33 +01:00
Peter Knut
20a0e4e113 Release 4.8.2 2024-03-16 13:12:36 +01:00
Peter Knut
bf80612b0d Make jush and JsShring submodules available 2024-03-16 01:03:39 +01:00
Lucas Sandery
8e848bfde4 Allow responsive styles on larger devices
and fix a media query.

Signed-off-by: Lucas Sandery <lucas-sandery@users.noreply.github.com>
(cherry picked from commit 4b0b011b93f9b684e5ab81f493f239f478fc3f2b)
2024-03-16 00:44:56 +01:00
Peter Knut
38f390ae5e Declare minimal PHP version in composer.json 2024-03-16 00:13:46 +01:00
Peter Knut
367a1b979e Merge branch 'translations' 2024-03-15 23:51:56 +01:00
Peter Knut
5dddfbdf12 Fix and complete Slovak translation 2024-03-15 23:47:20 +01:00
Lukáš Rajchl
2928b7beb8 Update Czech translation
(cherry picked from commit 7338eadd7c)
2024-03-15 23:31:07 +01:00
Anastasia
a940f85206 Update Russian translation
(cherry picked from commit 33fcfbc13b)
2024-03-15 23:29:20 +01:00
Gerry Demaret
834380aae9 Update Dutch translation
(cherry picked from commit 6024d73ae6)
2024-03-15 23:25:13 +01:00
Lionel Laffineur
3e94299256 Update French and Italian translations
(cherry picked from commit 496ab9a262)
2024-03-15 23:21:20 +01:00
Peter Knut
e99ed80ad8 Update language files 2024-03-15 23:12:06 +01:00
Hossain Ahmed Saiman
61b84cecd8 Bangla language corrections
Some informal words has been replaced with formal words. Some incorrect words has been corrected.

(cherry picked from commit a4ebae8706)

(cherry picked from commit 965598b640)
2024-03-15 23:10:27 +01:00
@krysits.COM
acf168a6da Add Latvian language translation
(cherry picked from commit fad4ce785b)
2024-03-15 23:04:00 +01:00
200 changed files with 8366 additions and 6666 deletions

View File

@@ -7,7 +7,7 @@ end_of_line = lf
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
[*.{php,css,js,xml}] [*.{php,css,js}]
indent_style = tab indent_style = tab
[*.json] [*.json]

6
.gitattributes vendored
View File

@@ -1,6 +0,0 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.gitmodules export-ignore
/.travis.yml export-ignore
/tests export-ignore

3
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,2 @@
github: vrana
patreon: jakubvrana patreon: jakubvrana
custom: ["https://www.paypal.com/donate/?item_name=Donation+to+Adminer&business=jakub%40vrana.cz"] custom: ["https://sourceforge.net/p/adminer/donate/"]

67
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '20 16 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

2
.gitignore vendored
View File

@@ -2,3 +2,5 @@
/adminer*.php /adminer*.php
/editor*.php /editor*.php
/vendor/ /vendor/
/composer.lock
/temp

12
.gitmodules vendored
View File

@@ -1,6 +1,6 @@
[submodule "jush"] [submodule "designs/hydra"]
path = externals/jush path = designs/hydra
url = https://github.com/vrana/jush url = https://github.com/Niyko/Hydra-Dark-Theme-for-Adminer
[submodule "JsShrink"] [submodule "designs/pepa-linha-dark"]
path = externals/JsShrink path = designs/pepa-linha-dark
url = https://github.com/vrana/JsShrink url = https://github.com/pepa-linha/Adminer-Design-Dark/

View File

@@ -6,8 +6,4 @@ php:
- 7.3 - 7.3
- 7.4 - 7.4
- 8.0 - 8.0
- 8.1
- 8.2
- 8.3
- 8.4
script: git diff --name-only $TRAVIS_COMMIT_RANGE | grep '\.php$' | xargs -n1 -P8 php -l | grep -v 'No syntax errors'; test $? -eq 1 script: git diff --name-only $TRAVIS_COMMIT_RANGE | grep '\.php$' | xargs -n1 -P8 php -l | grep -v 'No syntax errors'; test $? -eq 1

View File

@@ -1 +0,0 @@
Apache License 2.0 or GPL 2

View File

@@ -6,6 +6,6 @@ I support only the last published version and the last development version (last
## Reporting a Vulnerability ## Reporting a Vulnerability
To report a vulnerability, add a new draft security advisory at https://github.com/vrana/adminer/security/advisories/new. To report a vulnerability, create a private bug at https://sourceforge.net/p/adminer/bugs-and-features/new/?private=1.
I handle security issues with top priority. If you don't hear from me in a week then please ping the bug. Once I accept the bug, the fix should be available and new version released within days. I will mark the bug as public after releasing a new version or declining the bug. I handle security issues with top priority. If you don't hear from me in a week then please ping the bug. Once I accept the bug, the fix should be available and new version released within days. I will mark the bug as public after releasing a new version or declining the bug.

View File

@@ -1,7 +1,5 @@
<?php <?php
namespace Adminer; $PROCEDURE = ($_GET["name"] ? $_GET["name"] : $_GET["call"]);
$PROCEDURE = ($_GET["name"] ?: $_GET["call"]);
page_header(lang('Call') . ": " . h($PROCEDURE), $error); page_header(lang('Call') . ": " . h($PROCEDURE), $error);
$routine = routine($_GET["call"], (isset($_GET["callf"]) ? "FUNCTION" : "PROCEDURE")); $routine = routine($_GET["call"], (isset($_GET["callf"]) ? "FUNCTION" : "PROCEDURE"));
@@ -30,21 +28,21 @@ if (!$error && $_POST) {
} }
$call[] = (isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val); $call[] = (isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val);
} }
$query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . table($PROCEDURE) . "(" . implode(", ", $call) . ")"; $query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . table($PROCEDURE) . "(" . implode(", ", $call) . ")";
$start = microtime(true); $start = microtime(true);
$result = $connection->multi_query($query); $result = $connection->multi_query($query);
$affected = $connection->affected_rows; // getting warnings overwrites this $affected = $connection->affected_rows; // getting warnigns overwrites this
echo $adminer->selectQuery($query, $start, !$result); echo $adminer->selectQuery($query, $start, !$result);
if (!$result) { if (!$result) {
echo "<p class='error'>" . error() . "\n"; echo "<p class='error'>" . error() . "\n";
} else { } else {
$connection2 = connect($adminer->credentials()); $connection2 = connect();
if (is_object($connection2)) { if (is_object($connection2)) {
$connection2->select_db(DB); $connection2->select_db(DB);
} }
do { do {
$result = $connection->store_result(); $result = $connection->store_result();
if (is_object($result)) { if (is_object($result)) {
@@ -55,7 +53,7 @@ if (!$error && $_POST) {
; ;
} }
} while ($connection->next_result()); } while ($connection->next_result());
if ($out) { if ($out) {
select($connection->query("SELECT " . implode(", ", $out))); select($connection->query("SELECT " . implode(", ", $out)));
} }
@@ -66,7 +64,7 @@ if (!$error && $_POST) {
<form action="" method="post"> <form action="" method="post">
<?php <?php
if ($in) { if ($in) {
echo "<table class='layout'>\n"; echo "<table cellspacing='0' class='layout'>\n";
foreach ($in as $key) { foreach ($in as $key) {
$field = $routine["fields"][$key]; $field = $routine["fields"][$key];
$name = $field["field"]; $name = $field["field"];
@@ -90,25 +88,3 @@ if ($in) {
<input type="submit" value="<?php echo lang('Call'); ?>"> <input type="submit" value="<?php echo lang('Call'); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</form> </form>
<pre>
<?php
function pre_tr($s) {
return preg_replace('~^~m', '<tr>', preg_replace('~\|~', '<td>', preg_replace('~\|$~m', "", rtrim($s))));
}
$table = '(\+--[-+]+\+\n)';
$row = '(\| .* \|\n)';
echo preg_replace_callback(
"~^$table?$row$table?($row*)$table?~m",
function ($match) {
$first_row = pre_tr($match[2]);
return "<table>\n" . ($match[1] ? "<thead>$first_row</thead>\n" : $first_row) . pre_tr($match[4]) . "\n</table>";
},
preg_replace(
'~(\n( -|mysql)&gt; )(.+)~',
"\\1<code class='jush-sql'>\\3</code>",
preg_replace('~(.+)\n---+\n~', "<b>\\1</b>\n", h($routine['comment']))
)
);
?>
</pre>

View File

@@ -1,51 +0,0 @@
<?php
namespace Adminer;
$TABLE = $_GET["check"];
$name = $_GET["name"];
$row = $_POST;
if ($row && !$error) {
if (JUSH == "sqlite") {
$result = recreate_table($TABLE, $TABLE, array(), array(), array(), 0, array(), $name, ($row["drop"] ? "" : $row["clause"]));
} else {
$result = ($name == "" || queries("ALTER TABLE " . table($TABLE) . " DROP CONSTRAINT " . idf_escape($name)));
if (!$row["drop"]) {
$result = queries("ALTER TABLE " . table($TABLE) . " ADD" . ($row["name"] != "" ? " CONSTRAINT " . idf_escape($row["name"]) : "") . " CHECK ($row[clause])"); //! SQL injection
}
}
queries_redirect(
ME . "table=" . urlencode($TABLE),
($row["drop"] ? lang('Check has been dropped.') : ($name != "" ? lang('Check has been altered.') : lang('Check has been created.'))),
$result
);
}
page_header(($name != "" ? lang('Alter check') . ": " . h($name) : lang('Create check')), $error, array("table" => $TABLE));
if (!$row) {
$checks = $driver->checkConstraints($TABLE);
$row = array("name" => $name, "clause" => $checks[$name]);
}
?>
<form action="" method="post">
<p><?php
if (JUSH != "sqlite") {
echo lang('Name') . ': <input name="name" value="' . h($row["name"]) . '" data-maxlength="64" autocapitalize="off"> ';
}
echo doc_link(array(
'sql' => "create-table-check-constraints.html",
'mariadb' => "constraint/",
'pgsql' => "ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS",
'mssql' => "relational-databases/tables/create-check-constraints",
'sqlite' => "lang_createtable.html#check_constraints",
), "?");
?>
<p><?php textarea("clause", $row["clause"]); ?>
<p><input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($name != "") { ?>
<input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $name)); ?>
<?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$TABLE = $_GET["create"]; $TABLE = $_GET["create"];
$partition_by = array(); $partition_by = array();
foreach (array('HASH', 'LINEAR HASH', 'KEY', 'LINEAR KEY', 'RANGE', 'LIST') as $key) { foreach (array('HASH', 'LINEAR HASH', 'KEY', 'LINEAR KEY', 'RANGE', 'LIST') as $key) {
@@ -48,19 +46,22 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
$foreign_key = $foreign_keys[$field["type"]]; $foreign_key = $foreign_keys[$field["type"]];
$type_field = ($foreign_key !== null ? $referencable_primary[$foreign_key] : $field); //! can collide with user defined type $type_field = ($foreign_key !== null ? $referencable_primary[$foreign_key] : $field); //! can collide with user defined type
if ($field["field"] != "") { if ($field["field"] != "") {
if (!$field["generated"]) { if (!$field["has_default"]) {
$field["default"] = null; $field["default"] = null;
} }
if ($key == $row["auto_increment_col"]) {
$field["auto_increment"] = true;
}
$process_field = process_field($field, $type_field); $process_field = process_field($field, $type_field);
$all_fields[] = array($field["orig"], $process_field, $after); $all_fields[] = array($field["orig"], $process_field, $after);
if (!$orig_field || $process_field !== process_field($orig_field, $orig_field)) { if (!$orig_field || $process_field != process_field($orig_field, $orig_field)) {
$fields[] = array($field["orig"], $process_field, $after); $fields[] = array($field["orig"], $process_field, $after);
if ($field["orig"] != "" || $after) { if ($field["orig"] != "" || $after) {
$use_all_fields = true; $use_all_fields = true;
} }
} }
if ($foreign_key !== null) { if ($foreign_key !== null) {
$foreign[idf_escape($field["field"])] = ($TABLE != "" && JUSH != "sqlite" ? "ADD" : " ") . format_foreign_key(array( $foreign[idf_escape($field["field"])] = ($TABLE != "" && $jush != "sqlite" ? "ADD" : " ") . format_foreign_key(array(
'table' => $foreign_keys[$field["type"]], 'table' => $foreign_keys[$field["type"]],
'source' => array($field["field"]), 'source' => array($field["field"]),
'target' => array($type_field["field"]), 'target' => array($type_field["field"]),
@@ -81,39 +82,20 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
} }
$partitioning = ""; $partitioning = "";
if (support("partitioning")) { if ($partition_by[$row["partition_by"]]) {
if (isset($partition_by[$row["partition_by"]])) { $partitions = array();
$params = array_filter($row, function ($key) { if ($row["partition_by"] == 'RANGE' || $row["partition_by"] == 'LIST') {
return preg_match('~^partition~', $key); foreach (array_filter($row["partition_names"]) as $key => $val) {
}, ARRAY_FILTER_USE_KEY); $value = $row["partition_values"][$key];
$partitions[] = "\n PARTITION " . idf_escape($val) . " VALUES " . ($row["partition_by"] == 'RANGE' ? "LESS THAN" : "IN") . ($value != "" ? " ($value)" : " MAXVALUE"); //! SQL injection
foreach ($params["partition_names"] as $key => $name) {
if ($name == "") {
unset($params["partition_names"][$key]);
unset($params["partition_values"][$key]);
}
} }
if ($params != get_partitions_info($TABLE)) {
$partitions = array();
if ($params["partition_by"] == 'RANGE' || $params["partition_by"] == 'LIST') {
foreach ($params["partition_names"] as $key => $name) {
$value = $params["partition_values"][$key];
$partitions[] = "\n PARTITION " . idf_escape($name) . " VALUES " . ($params["partition_by"] == 'RANGE' ? "LESS THAN" : "IN") . ($value != "" ? " ($value)" : " MAXVALUE"); //! SQL injection
}
}
// $params["partition"] can be expression, not only column
$partitioning .= "\nPARTITION BY $params[partition_by]($params[partition])";
if ($partitions) {
$partitioning .= " (" . implode(",", $partitions) . "\n)";
} elseif ($params["partitions"]) {
$partitioning .= " PARTITIONS " . (+$params["partitions"]);
}
}
} elseif (preg_match("~partitioned~", $table_status["Create_options"])) {
$partitioning .= "\nREMOVE PARTITIONING";
} }
$partitioning .= "\nPARTITION BY $row[partition_by]($row[partition])" . ($partitions // $row["partition"] can be expression, not only column
? " (" . implode(",", $partitions) . "\n)"
: ($row["partitions"] ? " PARTITIONS " . (+$row["partitions"]) : "")
);
} elseif (support("partitioning") && preg_match("~partitioned~", $table_status["Create_options"])) {
$partitioning .= "\nREMOVE PARTITIONING";
} }
$message = lang('Table has been altered.'); $message = lang('Table has been altered.');
@@ -126,7 +108,7 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
queries_redirect(ME . (support("table") ? "table=" : "select=") . urlencode($name), $message, alter_table( queries_redirect(ME . (support("table") ? "table=" : "select=") . urlencode($name), $message, alter_table(
$TABLE, $TABLE,
$name, $name,
(JUSH == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields), ($jush == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields),
$foreign, $foreign,
($row["Comment"] != $table_status["Comment"] ? $row["Comment"] : null), ($row["Comment"] != $table_status["Comment"] ? $row["Comment"] : null),
($row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : ""), ($row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : ""),
@@ -140,7 +122,6 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
page_header(($TABLE != "" ? lang('Alter table') : lang('Create table')), $error, array("table" => $TABLE), h($TABLE)); page_header(($TABLE != "" ? lang('Alter table') : lang('Create table')), $error, array("table" => $TABLE), h($TABLE));
if (!$_POST) { if (!$_POST) {
$types = $driver->types();
$row = array( $row = array(
"Engine" => $_COOKIE["adminer_engine"], "Engine" => $_COOKIE["adminer_engine"],
"fields" => array(array("field" => "", "type" => (isset($types["int"]) ? "int" : (isset($types["integer"]) ? "integer" : "")), "on_update" => "")), "fields" => array(array("field" => "", "type" => (isset($types["int"]) ? "int" : (isset($types["integer"]) ? "integer" : "")), "on_update" => "")),
@@ -155,14 +136,18 @@ if (!$_POST) {
$row["Auto_increment"] = ""; $row["Auto_increment"] = "";
} }
foreach ($orig_fields as $field) { foreach ($orig_fields as $field) {
$field["generated"] = $field["generated"] ?: (isset($field["default"]) ? "DEFAULT" : ""); $field["has_default"] = isset($field["default"]);
$row["fields"][] = $field; $row["fields"][] = $field;
} }
if (support("partitioning")) { if (support("partitioning")) {
$row += get_partitions_info($TABLE); $from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($TABLE);
$row["partition_names"][] = ""; $result = $connection->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
$row["partition_values"][] = ""; list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row();
$partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
$partitions[""] = "";
$row["partition_names"] = array_keys($partitions);
$row["partition_values"] = array_values($partitions);
} }
} }
} }
@@ -181,61 +166,60 @@ foreach ($engines as $engine) {
<form action="" method="post" id="form"> <form action="" method="post" id="form">
<p> <p>
<?php if (support("columns") || $TABLE == "") { ?> <?php if (support("columns") || $TABLE == "") { ?>
<?php echo lang('Table name'); ?>: <input name="name"<?php echo ($TABLE == "" && !$_POST ? " autofocus" : ""); ?> data-maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off"> <?php echo lang('Table name'); ?>: <input name="name" data-maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
<?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . on_help("getTarget(event).value", 1) . script("qsl('select').onchange = helpClose;") : ""); ?> <?php if ($TABLE == "" && !$_POST) { echo script("focus(qs('#form')['name']);"); } ?>
<?php echo ($collations && !preg_match("~sqlite|mssql~", JUSH) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?> <?php echo ($engines ? "<select name='Engine'>" . optionlist(array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . "</select>" . on_help("getTarget(event).value", 1) . script("qsl('select').onchange = helpClose;") : ""); ?>
<?php echo ($collations && !preg_match("~sqlite|mssql~", $jush) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php } ?> <?php } ?>
<?php if (support("columns")) { ?> <?php if (support("columns")) { ?>
<div class="scrollable"> <div class="scrollable">
<table id="edit-fields" class="nowrap"> <table cellspacing="0" id="edit-fields" class="nowrap">
<?php <?php
edit_fields($row["fields"], $collations, "TABLE", $foreign_keys); edit_fields($row["fields"], $collations, "TABLE", $foreign_keys);
?> ?>
</table> </table>
<?php echo script("editFields();"); ?> <?php echo script("editFields();"); ?>
</div> </div>
<p> <p>
<?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" class="size" value="<?php echo h($row["Auto_increment"]); ?>"> <?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
<?php echo checkbox("defaults", 1, ($_POST ? $_POST["defaults"] : adminer_setting("defaults")), lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?> <?php echo checkbox("defaults", 1, ($_POST ? $_POST["defaults"] : adminer_setting("defaults")), lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?>
<?php <?php
$comments = ($_POST ? $_POST["comments"] : adminer_setting("comments")); $comments = ($_POST ? $_POST["comments"] : adminer_setting("comments"));
echo (support("comment") echo (support("comment")
? checkbox("comments", 1, $comments, lang('Comment'), "editingCommentsClick(this, true);", "jsonly") ? checkbox("comments", 1, $comments, lang('Comment'), "editingCommentsClick(this, true);", "jsonly")
. ' ' . (preg_match('~\n~', $row["Comment"]) . ' ' . (preg_match('~\n~', $row["Comment"])
? "<textarea name='Comment' rows='2' cols='20'" . ($comments ? "" : " class='hidden'") . ">" . h($row["Comment"]) . "</textarea>" ? "<textarea name='Comment' rows='2' cols='20'" . ($comments ? "" : " class='hidden'") . ">" . h($row["Comment"]) . "</textarea>"
: '<input name="Comment" value="' . h($row["Comment"]) . '" data-maxlength="' . (min_version(5.5) ? 2048 : 60) . '"' . ($comments ? "" : " class='hidden'") . '>' : '<input name="Comment" value="' . h($row["Comment"]) . '" data-maxlength="' . (min_version(5.5) ? 2048 : 60) . '"' . ($comments ? "" : " class='hidden'") . '>'
) )
: '') : '')
; ;
?> ?>
<p> <p>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php } ?> <?php } ?>
<?php if ($TABLE != "") { ?> <?php if ($TABLE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $TABLE)); ?><?php } ?>
<input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $TABLE)); ?>
<?php } ?>
<?php <?php
if (support("partitioning")) { if (support("partitioning")) {
$partition_table = preg_match('~RANGE|LIST~', $row["partition_by"]); $partition_table = preg_match('~RANGE|LIST~', $row["partition_by"]);
print_fieldset("partition", lang('Partition by'), $row["partition_by"]); print_fieldset("partition", lang('Partition by'), $row["partition_by"]);
?> ?>
<p> <p>
<?php echo html_select("partition_by", array("" => "") + $partition_by, $row["partition_by"]) . on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')", 1) . script("qsl('select').onchange = partitionByChange;"); ?> <?php echo "<select name='partition_by'>" . optionlist(array("" => "") + $partition_by, $row["partition_by"]) . "</select>" . on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')", 1) . script("qsl('select').onchange = partitionByChange;"); ?>
(<input name="partition" value="<?php echo h($row["partition"]); ?>">) (<input name="partition" value="<?php echo h($row["partition"]); ?>">)
<?php echo lang('Partitions'); ?>: <input type="number" name="partitions" class="size<?php echo ($partition_table || !$row["partition_by"] ? " hidden" : ""); ?>" value="<?php echo h($row["partitions"]); ?>"> <?php echo lang('Partitions'); ?>: <input type="number" name="partitions" class="size<?php echo ($partition_table || !$row["partition_by"] ? " hidden" : ""); ?>" value="<?php echo h($row["partitions"]); ?>">
<table id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>> <table cellspacing="0" id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>>
<thead><tr><th><?php echo lang('Partition name'); ?><th><?php echo lang('Values'); ?></thead> <thead><tr><th><?php echo lang('Partition name'); ?><th><?php echo lang('Values'); ?></thead>
<?php <?php
foreach ($row["partition_names"] as $key => $val) { foreach ($row["partition_names"] as $key => $val) {
echo '<tr>'; echo '<tr>';
echo '<td><input name="partition_names[]" value="' . h($val) . '" autocapitalize="off">'; echo '<td><input name="partition_names[]" value="' . h($val) . '" autocapitalize="off">';
echo ($key == count($row["partition_names"]) - 1 ? script("qsl('input').oninput = partitionNameChange;") : ''); echo ($key == count($row["partition_names"]) - 1 ? script("qsl('input').oninput = partitionNameChange;") : '');
echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">'; echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">';
} }
?> ?>
</table> </table>
</div></fieldset> </div></fieldset>
<?php <?php

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$row = $_POST; $row = $_POST;
if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP changes add.x to add_x if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP changes add.x to add_x
@@ -46,7 +44,7 @@ if ($_POST) {
$name = $row["name"]; $name = $row["name"];
} elseif (DB != "") { } elseif (DB != "") {
$row["collation"] = db_collation(DB, $collations); $row["collation"] = db_collation(DB, $collations);
} elseif (JUSH == "sql") { } elseif ($jush == "sql") {
// propose database name with limited privileges // propose database name with limited privileges
foreach (get_vals("SHOW GRANTS") as $grant) { foreach (get_vals("SHOW GRANTS") as $grant) {
if (preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\.\*)?~', $grant, $match) && $match[1]) { if (preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\.\*)?~', $grant, $match) && $match[1]) {
@@ -61,13 +59,14 @@ if ($_POST) {
<p> <p>
<?php <?php
echo ($_POST["add_x"] || strpos($name, "\n") echo ($_POST["add_x"] || strpos($name, "\n")
? '<textarea autofocus name="name" rows="10" cols="40">' . h($name) . '</textarea><br>' ? '<textarea id="name" name="name" rows="10" cols="40">' . h($name) . '</textarea><br>'
: '<input name="name" autofocus value="' . h($name) . '" data-maxlength="64" autocapitalize="off">' : '<input name="name" id="name" value="' . h($name) . '" data-maxlength="64" autocapitalize="off">'
) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array( ) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array(
'sql' => "charset-charsets.html", 'sql' => "charset-charsets.html",
'mariadb' => "supported-character-sets-and-collations/", 'mariadb' => "supported-character-sets-and-collations/",
'mssql' => "relational-databases/system-functions/sys-fn-helpcollations-transact-sql", 'mssql' => "ms187963.aspx",
)) : ""); )) : "");
echo script("focus(qs('#name'));");
?> ?>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php <?php

View File

@@ -1,12 +1,10 @@
<?php <?php
namespace Adminer;
$tables_views = array_merge((array) $_POST["tables"], (array) $_POST["views"]); $tables_views = array_merge((array) $_POST["tables"], (array) $_POST["views"]);
if ($tables_views && !$error && !$_POST["search"]) { if ($tables_views && !$error && !$_POST["search"]) {
$result = true; $result = true;
$message = ""; $message = "";
if (JUSH == "sql" && $_POST["tables"] && count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"] || $_POST["copy"])) { if ($jush == "sql" && $_POST["tables"] && count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"] || $_POST["copy"])) {
queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once
} }
@@ -29,21 +27,15 @@ if ($tables_views && !$error && !$_POST["search"]) {
$result = drop_tables($_POST["tables"]); $result = drop_tables($_POST["tables"]);
} }
$message = lang('Tables have been dropped.'); $message = lang('Tables have been dropped.');
} elseif (JUSH == "sqlite" && $_POST["check"]) { } elseif ($jush != "sql") {
foreach ((array) $_POST["tables"] as $table) { $result = ($jush == "sqlite"
foreach (get_rows("PRAGMA integrity_check(" . q($table) . ")") as $row) {
$message .= "<b>" . h($table) . "</b>: " . h($row["integrity_check"]) . "<br>";
}
}
} elseif (JUSH != "sql") {
$result = (JUSH == "sqlite"
? queries("VACUUM") ? queries("VACUUM")
: apply_queries("VACUUM" . ($_POST["optimize"] ? "" : " ANALYZE"), $_POST["tables"]) : apply_queries("VACUUM" . ($_POST["optimize"] ? "" : " ANALYZE"), $_POST["tables"])
); );
$message = lang('Tables have been optimized.'); $message = lang('Tables have been optimized.');
} elseif (!$_POST["tables"]) { } elseif (!$_POST["tables"]) {
$message = lang('No tables.'); $message = lang('No tables.');
} elseif ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('Adminer\idf_escape', $_POST["tables"])))) { } elseif ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"])))) {
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
$message .= "<b>" . h($row["Table"]) . "</b>: " . h($row["Msg_text"]) . "<br>"; $message .= "<b>" . h($row["Table"]) . "</b>: " . h($row["Msg_text"]) . "<br>";
} }
@@ -74,7 +66,7 @@ if ($adminer->homepage()) {
} }
} }
echo "<div class='scrollable'>\n"; echo "<div class='scrollable'>\n";
echo "<table class='nowrap checkable odds'>\n"; echo "<table cellspacing='0' class='nowrap checkable'>\n";
echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"); echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");
echo '<thead><tr class="wrap">'; echo '<thead><tr class="wrap">';
echo '<td><input id="check-all" type="checkbox" class="jsonly">' . script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);", ""); echo '<td><input id="check-all" type="checkbox" class="jsonly">' . script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);", "");
@@ -93,23 +85,21 @@ if ($adminer->homepage()) {
foreach ($tables_list as $name => $type) { foreach ($tables_list as $name => $type) {
$view = ($type !== null && !preg_match('~table|sequence~i', $type)); $view = ($type !== null && !preg_match('~table|sequence~i', $type));
$id = h("Table-" . $name); $id = h("Table-" . $name);
echo '<tr><td>' . checkbox(($view ? "views[]" : "tables[]"), $name, in_array($name, $tables_views, true), "", "", "", $id); echo '<tr' . odd() . '><td>' . checkbox(($view ? "views[]" : "tables[]"), $name, in_array($name, $tables_views, true), "", "", "", $id);
echo '<th>' . (support("table") || support("indexes") ? "<a href='" . h(ME) . "table=" . urlencode($name) . "' title='" . lang('Show structure') . "' id='$id'>" . h($name) . '</a>' : h($name)); echo '<th>' . (support("table") || support("indexes") ? "<a href='" . h(ME) . "table=" . urlencode($name) . "' title='" . lang('Show structure') . "' id='$id'>" . h($name) . '</a>' : h($name));
if ($view) { if ($view) {
echo '<td colspan="6"><a href="' . h(ME) . "view=" . urlencode($name) . '" title="' . lang('Alter view') . '">' . (preg_match('~materialized~i', $type) ? lang('Materialized view') : lang('View')) . '</a>'; echo '<td colspan="6"><a href="' . h(ME) . "view=" . urlencode($name) . '" title="' . lang('Alter view') . '">' . (preg_match('~materialized~i', $type) ? lang('Materialized view') : lang('View')) . '</a>';
echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '" title="' . lang('Select data') . '">?</a>'; echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '" title="' . lang('Select data') . '">?</a>';
} else { } else {
foreach ( foreach (array(
array( "Engine" => array(),
"Engine" => array(), "Collation" => array(),
"Collation" => array(), "Data_length" => array("create", lang('Alter table')),
"Data_length" => array("create", lang('Alter table')), "Index_length" => array("indexes", lang('Alter indexes')),
"Index_length" => array("indexes", lang('Alter indexes')), "Data_free" => array("edit", lang('New item')),
"Data_free" => array("edit", lang('New item')), "Auto_increment" => array("auto_increment=1&create", lang('Alter table')),
"Auto_increment" => array("auto_increment=1&create", lang('Alter table')), "Rows" => array("select", lang('Select data')),
"Rows" => array("select", lang('Select data')), ) as $key => $link) {
) as $key => $link
) {
$id = " id='$key-" . h($name) . "'"; $id = " id='$key-" . h($name) . "'";
echo ($link ? "<td align='right'>" . (support("table") || $key == "Rows" || (support("indexes") && $key != "Data_length") echo ($link ? "<td align='right'>" . (support("table") || $key == "Rows" || (support("indexes") && $key != "Data_length")
? "<a href='" . h(ME . "$link[0]=") . urlencode($name) . "'$id title='$link[1]'>?</a>" ? "<a href='" . h(ME . "$link[0]=") . urlencode($name) . "'$id title='$link[1]'>?</a>"
@@ -119,35 +109,32 @@ if ($adminer->homepage()) {
$tables++; $tables++;
} }
echo (support("comment") ? "<td id='Comment-" . h($name) . "'>" : ""); echo (support("comment") ? "<td id='Comment-" . h($name) . "'>" : "");
echo "\n";
} }
echo "<tr><td><th>" . lang('%d in total', count($tables_list)); echo "<tr><td><th>" . lang('%d in total', count($tables_list));
echo "<td>" . h(JUSH == "sql" ? get_val("SELECT @@default_storage_engine") : ""); echo "<td>" . h($jush == "sql" ? $connection->result("SELECT @@default_storage_engine") : "");
echo "<td>" . h(db_collation(DB, collations())); echo "<td>" . h(db_collation(DB, collations()));
foreach (array("Data_length", "Index_length", "Data_free") as $key) { foreach (array("Data_length", "Index_length", "Data_free") as $key) {
echo "<td align='right' id='sum-$key'>"; echo "<td align='right' id='sum-$key'>";
} }
echo "\n";
echo "</table>\n"; echo "</table>\n";
echo "</div>\n"; echo "</div>\n";
if (!information_schema(DB)) { if (!information_schema(DB)) {
echo "<div class='footer'><div>\n"; echo "<div class='footer'><div>\n";
$vacuum = "<input type='submit' value='" . lang('Vacuum') . "'> " . on_help("'VACUUM'"); $vacuum = "<input type='submit' value='" . lang('Vacuum') . "'> " . on_help("'VACUUM'");
$optimize = "<input type='submit' name='optimize' value='" . lang('Optimize') . "'> " . on_help(JUSH == "sql" ? "'OPTIMIZE TABLE'" : "'VACUUM OPTIMIZE'"); $optimize = "<input type='submit' name='optimize' value='" . lang('Optimize') . "'> " . on_help($jush == "sql" ? "'OPTIMIZE TABLE'" : "'VACUUM OPTIMIZE'");
echo "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>" echo "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>"
. (JUSH == "sqlite" ? $vacuum . "<input type='submit' name='check' value='" . lang('Check') . "'> " . on_help("'PRAGMA integrity_check'") . ($jush == "sqlite" ? $vacuum
: (JUSH == "pgsql" ? $vacuum . $optimize : ($jush == "pgsql" ? $vacuum . $optimize
: (JUSH == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> " . on_help("'ANALYZE TABLE'") : ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> " . on_help("'ANALYZE TABLE'") . $optimize
. $optimize
. "<input type='submit' name='check' value='" . lang('Check') . "'> " . on_help("'CHECK TABLE'") . "<input type='submit' name='check' value='" . lang('Check') . "'> " . on_help("'CHECK TABLE'")
. "<input type='submit' name='repair' value='" . lang('Repair') . "'> " . on_help("'REPAIR TABLE'") . "<input type='submit' name='repair' value='" . lang('Repair') . "'> " . on_help("'REPAIR TABLE'")
: ""))) : "")))
. "<input type='submit' name='truncate' value='" . lang('Truncate') . "'> " . on_help(JUSH == "sqlite" ? "'DELETE'" : "'TRUNCATE" . (JUSH == "pgsql" ? "'" : " TABLE'")) . confirm() . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'> " . on_help($jush == "sqlite" ? "'DELETE'" : "'TRUNCATE" . ($jush == "pgsql" ? "'" : " TABLE'")) . confirm()
. "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . on_help("'DROP TABLE'") . confirm() . "\n"; . "<input type='submit' name='drop' value='" . lang('Drop') . "'>" . on_help("'DROP TABLE'") . confirm() . "\n";
$databases = (support("scheme") ? $adminer->schemas() : $adminer->databases()); $databases = (support("scheme") ? $adminer->schemas() : $adminer->databases());
if (count($databases) != 1 && JUSH != "sqlite") { if (count($databases) != 1 && $jush != "sqlite") {
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB)); $db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
echo "<p>" . lang('Move to other database') . ": "; echo "<p>" . lang('Move to other database') . ": ";
echo ($databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '" autocapitalize="off">'); echo ($databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '" autocapitalize="off">');
@@ -172,11 +159,12 @@ if ($adminer->homepage()) {
echo "<h3 id='routines'>" . lang('Routines') . "</h3>\n"; echo "<h3 id='routines'>" . lang('Routines') . "</h3>\n";
$routines = routines(); $routines = routines();
if ($routines) { if ($routines) {
echo "<table class='odds'>\n"; echo "<table cellspacing='0'>\n";
echo '<thead><tr><th>' . lang('Name') . '<td>' . lang('Type') . '<td>' . lang('Return type') . "<td></thead>\n"; echo '<thead><tr><th>' . lang('Name') . '<td>' . lang('Type') . '<td>' . lang('Return type') . "<td></thead>\n";
odd('');
foreach ($routines as $row) { foreach ($routines as $row) {
$name = ($row["SPECIFIC_NAME"] == $row["ROUTINE_NAME"] ? "" : "&name=" . urlencode($row["ROUTINE_NAME"])); // not computed on the pages to be able to print the header first $name = ($row["SPECIFIC_NAME"] == $row["ROUTINE_NAME"] ? "" : "&name=" . urlencode($row["ROUTINE_NAME"])); // not computed on the pages to be able to print the header first
echo '<tr>'; echo '<tr' . odd() . '>';
echo '<th><a href="' . h(ME . ($row["ROUTINE_TYPE"] != "PROCEDURE" ? 'callf=' : 'call=') . urlencode($row["SPECIFIC_NAME"]) . $name) . '">' . h($row["ROUTINE_NAME"]) . '</a>'; echo '<th><a href="' . h(ME . ($row["ROUTINE_TYPE"] != "PROCEDURE" ? 'callf=' : 'call=') . urlencode($row["SPECIFIC_NAME"]) . $name) . '">' . h($row["ROUTINE_NAME"]) . '</a>';
echo '<td>' . h($row["ROUTINE_TYPE"]); echo '<td>' . h($row["ROUTINE_TYPE"]);
echo '<td>' . h($row["DTD_IDENTIFIER"]); echo '<td>' . h($row["DTD_IDENTIFIER"]);
@@ -194,10 +182,11 @@ if ($adminer->homepage()) {
echo "<h3 id='sequences'>" . lang('Sequences') . "</h3>\n"; echo "<h3 id='sequences'>" . lang('Sequences') . "</h3>\n";
$sequences = get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name"); $sequences = get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name");
if ($sequences) { if ($sequences) {
echo "<table class='odds'>\n"; echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Name') . "</thead>\n"; echo "<thead><tr><th>" . lang('Name') . "</thead>\n";
odd('');
foreach ($sequences as $val) { foreach ($sequences as $val) {
echo "<tr><th><a href='" . h(ME) . "sequence=" . urlencode($val) . "'>" . h($val) . "</a>\n"; echo "<tr" . odd() . "><th><a href='" . h(ME) . "sequence=" . urlencode($val) . "'>" . h($val) . "</a>\n";
} }
echo "</table>\n"; echo "</table>\n";
} }
@@ -208,10 +197,11 @@ if ($adminer->homepage()) {
echo "<h3 id='user-types'>" . lang('User types') . "</h3>\n"; echo "<h3 id='user-types'>" . lang('User types') . "</h3>\n";
$user_types = types(); $user_types = types();
if ($user_types) { if ($user_types) {
echo "<table class='odds'>\n"; echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Name') . "</thead>\n"; echo "<thead><tr><th>" . lang('Name') . "</thead>\n";
odd('');
foreach ($user_types as $val) { foreach ($user_types as $val) {
echo "<tr><th><a href='" . h(ME) . "type=" . urlencode($val) . "'>" . h($val) . "</a>\n"; echo "<tr" . odd() . "><th><a href='" . h(ME) . "type=" . urlencode($val) . "'>" . h($val) . "</a>\n";
} }
echo "</table>\n"; echo "</table>\n";
} }
@@ -222,7 +212,7 @@ if ($adminer->homepage()) {
echo "<h3 id='events'>" . lang('Events') . "</h3>\n"; echo "<h3 id='events'>" . lang('Events') . "</h3>\n";
$rows = get_rows("SHOW EVENTS"); $rows = get_rows("SHOW EVENTS");
if ($rows) { if ($rows) {
echo "<table>\n"; echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Name') . "<td>" . lang('Schedule') . "<td>" . lang('Start') . "<td>" . lang('End') . "<td></thead>\n"; echo "<thead><tr><th>" . lang('Name') . "<td>" . lang('Schedule') . "<td>" . lang('Start') . "<td>" . lang('End') . "<td></thead>\n";
foreach ($rows as $row) { foreach ($rows as $row) {
echo "<tr>"; echo "<tr>";
@@ -232,7 +222,7 @@ if ($adminer->homepage()) {
echo '<td><a href="' . h(ME) . 'event=' . urlencode($row["Name"]) . '">' . lang('Alter') . '</a>'; echo '<td><a href="' . h(ME) . 'event=' . urlencode($row["Name"]) . '">' . lang('Alter') . '</a>';
} }
echo "</table>\n"; echo "</table>\n";
$event_scheduler = get_val("SELECT @@event_scheduler"); $event_scheduler = $connection->result("SELECT @@event_scheduler");
if ($event_scheduler && $event_scheduler != "ON") { if ($event_scheduler && $event_scheduler != "ON") {
echo "<p class='error'><code class='jush-sqlset'>event_scheduler</code>: " . h($event_scheduler) . "\n"; echo "<p class='error'><code class='jush-sqlset'>event_scheduler</code>: " . h($event_scheduler) . "\n";
} }

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$TABLE = $_GET["download"]; $TABLE = $_GET["download"];
$fields = fields($TABLE); $fields = fields($TABLE);
header("Content-Type: application/octet-stream"); header("Content-Type: application/octet-stream");

View File

@@ -1,32 +1,235 @@
<?php <?php
namespace Adminer;
$drivers["mongo"] = "MongoDB (alpha)"; $drivers["mongo"] = "MongoDB (alpha)";
if (isset($_GET["mongo"])) { if (isset($_GET["mongo"])) {
define('Adminer\DRIVER', "mongo"); define("DRIVER", "mongo");
if (class_exists('MongoDB\Driver\Manager')) { if (class_exists('MongoDB')) {
class Db { class Min_DB {
var $extension = "Mongo", $server_info = MongoClient::VERSION, $error, $last_id, $_link, $_db;
function connect($uri, $options) {
try {
$this->_link = new MongoClient($uri, $options);
if ($options["password"] != "") {
$options["password"] = "";
try {
new MongoClient($uri, $options);
$this->error = lang('Database does not support password.');
} catch (Exception $e) {
// this is what we want
}
}
} catch (Exception $e) {
$this->error = $e->getMessage();
}
}
function query($query) {
return false;
}
function select_db($database) {
try {
$this->_db = $this->_link->selectDB($database);
return true;
} catch (Exception $ex) {
$this->error = $ex->getMessage();
return false;
}
}
function quote($string) {
return $string;
}
}
class Min_Result {
var $num_rows, $_rows = array(), $_offset = 0, $_charset = array();
function __construct($result) {
foreach ($result as $item) {
$row = array();
foreach ($item as $key => $val) {
if (is_a($val, 'MongoBinData')) {
$this->_charset[$key] = 63;
}
$row[$key] =
(is_a($val, 'MongoId') ? "ObjectId(\"$val\")" :
(is_a($val, 'MongoDate') ? gmdate("Y-m-d H:i:s", $val->sec) . " GMT" :
(is_a($val, 'MongoBinData') ? $val->bin : //! allow downloading
(is_a($val, 'MongoRegex') ? "$val" :
(is_object($val) ? get_class($val) : // MongoMinKey, MongoMaxKey
$val
)))));
}
$this->_rows[] = $row;
foreach ($row as $key => $val) {
if (!isset($this->_rows[0][$key])) {
$this->_rows[0][$key] = null;
}
}
}
$this->num_rows = count($this->_rows);
}
function fetch_assoc() {
$row = current($this->_rows);
if (!$row) {
return $row;
}
$return = array();
foreach ($this->_rows[0] as $key => $val) {
$return[$key] = $row[$key];
}
next($this->_rows);
return $return;
}
function fetch_row() {
$return = $this->fetch_assoc();
if (!$return) {
return $return;
}
return array_values($return);
}
function fetch_field() {
$keys = array_keys($this->_rows[0]);
$name = $keys[$this->_offset++];
return (object) array(
'name' => $name,
'charsetnr' => $this->_charset[$name],
);
}
}
class Min_Driver extends Min_SQL {
public $primary = "_id";
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
$select = ($select == array("*")
? array()
: array_fill_keys($select, true)
);
$sort = array();
foreach ($order as $val) {
$val = preg_replace('~ DESC$~', '', $val, 1, $count);
$sort[$val] = ($count ? -1 : 1);
}
return new Min_Result($this->_conn->_db->selectCollection($table)
->find(array(), $select)
->sort($sort)
->limit($limit != "" ? +$limit : 0)
->skip($page * $limit)
);
}
function insert($table, $set) {
try {
$return = $this->_conn->_db->selectCollection($table)->insert($set);
$this->_conn->errno = $return['code'];
$this->_conn->error = $return['err'];
$this->_conn->last_id = $set['_id'];
return !$return['err'];
} catch (Exception $ex) {
$this->_conn->error = $ex->getMessage();
return false;
}
}
}
function get_databases($flush) {
global $connection;
$return = array();
$dbs = $connection->_link->listDBs();
foreach ($dbs['databases'] as $db) {
$return[] = $db['name'];
}
return $return;
}
function count_tables($databases) {
global $connection;
$return = array();
foreach ($databases as $db) {
$return[$db] = count($connection->_link->selectDB($db)->getCollectionNames(true));
}
return $return;
}
function tables_list() {
global $connection;
return array_fill_keys($connection->_db->getCollectionNames(true), 'table');
}
function drop_databases($databases) {
global $connection;
foreach ($databases as $db) {
$response = $connection->_link->selectDB($db)->drop();
if (!$response['ok']) {
return false;
}
}
return true;
}
function indexes($table, $connection2 = null) {
global $connection;
$return = array();
foreach ($connection->_db->selectCollection($table)->getIndexInfo() as $index) {
$descs = array();
foreach ($index["key"] as $column => $type) {
$descs[] = ($type == -1 ? '1' : null);
}
$return[$index["name"]] = array(
"type" => ($index["name"] == "_id_" ? "PRIMARY" : ($index["unique"] ? "UNIQUE" : "INDEX")),
"columns" => array_keys($index["key"]),
"lengths" => array(),
"descs" => $descs,
);
}
return $return;
}
function fields($table) {
return fields_from_edit();
}
function found_rows($table_status, $where) {
global $connection;
//! don't call count_rows()
return $connection->_db->selectCollection($_GET["select"])->count($where);
}
$operators = array("=");
} elseif (class_exists('MongoDB\Driver\Manager')) {
class Min_DB {
var $extension = "MongoDB", $server_info = MONGODB_VERSION, $affected_rows, $error, $last_id; var $extension = "MongoDB", $server_info = MONGODB_VERSION, $affected_rows, $error, $last_id;
/** @var MongoDB\Driver\Manager */ /** @var MongoDB\Driver\Manager */
var $_link; var $_link;
var $_db, $_db_name; var $_db, $_db_name;
function connect($uri, $options) { function connect($uri, $options) {
$this->_link = new \MongoDB\Driver\Manager($uri, $options); $class = 'MongoDB\Driver\Manager';
$this->executeCommand($options["db"], array('ping' => 1)); $this->_link = new $class($uri, $options);
$this->executeCommand('admin', array('ping' => 1));
} }
function executeCommand($db, $command) { function executeCommand($db, $command) {
$class = 'MongoDB\Driver\Command';
try { try {
return $this->_link->executeCommand($db, new \MongoDB\Driver\Command($command)); return $this->_link->executeCommand($db, new $class($command));
} catch (Exception $e) { } catch (Exception $e) {
$this->error = $e->getMessage(); $this->error = $e->getMessage();
return array(); return array();
} }
} }
function executeBulkWrite($namespace, $bulk, $counter) { function executeBulkWrite($namespace, $bulk, $counter) {
try { try {
$results = $this->_link->executeBulkWrite($namespace, $bulk); $results = $this->_link->executeBulkWrite($namespace, $bulk);
@@ -52,7 +255,7 @@ if (isset($_GET["mongo"])) {
} }
} }
class Result { class Min_Result {
var $num_rows, $_rows = array(), $_offset = 0, $_charset = array(); var $num_rows, $_rows = array(), $_offset = 0, $_charset = array();
function __construct($result) { function __construct($result) {
@@ -110,14 +313,93 @@ if (isset($_GET["mongo"])) {
'charsetnr' => $this->_charset[$name], 'charsetnr' => $this->_charset[$name],
); );
} }
} }
class Min_Driver extends Min_SQL {
public $primary = "_id";
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
global $connection;
$select = ($select == array("*")
? array()
: array_fill_keys($select, 1)
);
if (count($select) && !isset($select['_id'])) {
$select['_id'] = 0;
}
$where = where_to_query($where);
$sort = array();
foreach ($order as $val) {
$val = preg_replace('~ DESC$~', '', $val, 1, $count);
$sort[$val] = ($count ? -1 : 1);
}
if (isset($_GET['limit']) && is_numeric($_GET['limit']) && $_GET['limit'] > 0) {
$limit = $_GET['limit'];
}
$limit = min(200, max(1, (int) $limit));
$skip = $page * $limit;
$class = 'MongoDB\Driver\Query';
try {
return new Min_Result($connection->_link->executeQuery("$connection->_db_name.$table", new $class($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));
} catch (Exception $e) {
$connection->error = $e->getMessage();
return false;
}
}
function update($table, $set, $queryWhere, $limit = 0, $separator = "\n") {
global $connection;
$db = $connection->_db_name;
$where = sql_query_where_parser($queryWhere);
$class = 'MongoDB\Driver\BulkWrite';
$bulk = new $class(array());
if (isset($set['_id'])) {
unset($set['_id']);
}
$removeFields = array();
foreach ($set as $key => $value) {
if ($value == 'NULL') {
$removeFields[$key] = 1;
unset($set[$key]);
}
}
$update = array('$set' => $set);
if (count($removeFields)) {
$update['$unset'] = $removeFields;
}
$bulk->update($where, $update, array('upsert' => false));
return $connection->executeBulkWrite("$db.$table", $bulk, 'getModifiedCount');
}
function delete($table, $queryWhere, $limit = 0) {
global $connection;
$db = $connection->_db_name;
$where = sql_query_where_parser($queryWhere);
$class = 'MongoDB\Driver\BulkWrite';
$bulk = new $class(array());
$bulk->delete($where, array('limit' => $limit));
return $connection->executeBulkWrite("$db.$table", $bulk, 'getDeletedCount');
}
function insert($table, $set) {
global $connection;
$db = $connection->_db_name;
$class = 'MongoDB\Driver\BulkWrite';
$bulk = new $class(array());
if ($set['_id'] == '') {
unset($set['_id']);
}
$bulk->insert($set);
return $connection->executeBulkWrite("$db.$table", $bulk, 'getInsertedCount');
}
}
function get_databases($flush) { function get_databases($flush) {
global $connection; global $connection;
$return = array(); $return = array();
foreach ($connection->executeCommand($connection->_db_name, array('listDatabases' => 1)) as $dbs) { foreach ($connection->executeCommand('admin', array('listDatabases' => 1)) as $dbs) {
foreach ($dbs->databases as $db) { foreach ($dbs->databases as $db) {
$return[] = $db->name; $return[] = $db->name;
} }
@@ -200,11 +482,7 @@ if (isset($_GET["mongo"])) {
} }
function sql_query_where_parser($queryWhere) { function sql_query_where_parser($queryWhere) {
$queryWhere = preg_replace('~^\s*WHERE\s*~', "", $queryWhere); $queryWhere = preg_replace('~^\sWHERE \(?\(?(.+?)\)?\)?$~', '\1', $queryWhere);
while ($queryWhere[0] == "(") {
$queryWhere = preg_replace('~^\((.*)\)$~', "$1", $queryWhere);
}
$wheres = explode(' AND ', $queryWhere); $wheres = explode(' AND ', $queryWhere);
$wheresOr = explode(') OR (', $queryWhere); $wheresOr = explode(') OR (', $queryWhere);
$where = array(); $where = array();
@@ -237,8 +515,9 @@ if (isset($_GET["mongo"])) {
$val = (float) $val; $val = (float) $val;
$op = $match[1]; $op = $match[1];
} elseif (preg_match('~^\(date\)(.+)~', $op, $match)) { } elseif (preg_match('~^\(date\)(.+)~', $op, $match)) {
$dateTime = new \DateTime($val); $dateTime = new DateTime($val);
$val = new \MongoDB\BSON\UTCDatetime($dateTime->getTimestamp() * 1000); $class = 'MongoDB\BSON\UTCDatetime';
$val = new $class($dateTime->getTimestamp() * 1000);
$op = $match[1]; $op = $match[1];
} }
switch ($op) { switch ($op) {
@@ -276,17 +555,8 @@ if (isset($_GET["mongo"])) {
} }
return $data; return $data;
} }
}
$operators = array(
class Driver extends SqlDriver {
static $possibleDrivers = array("mongodb");
static $jush = "mongo";
var $editFunctions = array(array("json"));
var $operators = array(
"=", "=",
"!=", "!=",
">", ">",
@@ -307,79 +577,9 @@ if (isset($_GET["mongo"])) {
"(date)>=", "(date)>=",
"(date)<=", "(date)<=",
); );
public $primary = "_id";
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
$select = ($select == array("*")
? array()
: array_fill_keys($select, 1)
);
if (count($select) && !isset($select['_id'])) {
$select['_id'] = 0;
}
$where = where_to_query($where);
$sort = array();
foreach ($order as $val) {
$val = preg_replace('~ DESC$~', '', $val, 1, $count);
$sort[$val] = ($count ? -1 : 1);
}
if (isset($_GET['limit']) && is_numeric($_GET['limit']) && $_GET['limit'] > 0) {
$limit = $_GET['limit'];
}
$limit = min(200, max(1, (int) $limit));
$skip = $page * $limit;
try {
return new Result($this->_conn->_link->executeQuery($this->_conn->_db_name . ".$table", new \MongoDB\Driver\Query($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));
} catch (Exception $e) {
$this->_conn->error = $e->getMessage();
return false;
}
}
function update($table, $set, $queryWhere, $limit = 0, $separator = "\n") {
$db = $this->_conn->_db_name;
$where = sql_query_where_parser($queryWhere);
$bulk = new \MongoDB\Driver\BulkWrite(array());
if (isset($set['_id'])) {
unset($set['_id']);
}
$removeFields = array();
foreach ($set as $key => $value) {
if ($value == 'NULL') {
$removeFields[$key] = 1;
unset($set[$key]);
}
}
$update = array('$set' => $set);
if (count($removeFields)) {
$update['$unset'] = $removeFields;
}
$bulk->update($where, $update, array('upsert' => false));
return $this->_conn->executeBulkWrite("$db.$table", $bulk, 'getModifiedCount');
}
function delete($table, $queryWhere, $limit = 0) {
$db = $this->_conn->_db_name;
$where = sql_query_where_parser($queryWhere);
$bulk = new \MongoDB\Driver\BulkWrite(array());
$bulk->delete($where, array('limit' => $limit));
return $this->_conn->executeBulkWrite("$db.$table", $bulk, 'getDeletedCount');
}
function insert($table, $set) {
$db = $this->_conn->_db_name;
$bulk = new \MongoDB\Driver\BulkWrite(array());
if ($set['_id'] == '') {
unset($set['_id']);
}
$bulk->insert($set);
return $this->_conn->executeBulkWrite("$db.$table", $bulk, 'getInsertedCount');
}
} }
function table($idf) { function table($idf) {
return $idf; return $idf;
} }
@@ -423,15 +623,10 @@ if (isset($_GET["mongo"])) {
return $credentials[1]; return $credentials[1];
} }
function connect($credentials) { function connect() {
global $adminer; global $adminer;
$connection = new Db; $connection = new Min_DB;
list($server, $username, $password) = $credentials; list($server, $username, $password) = $adminer->credentials();
if ($server == "") {
$server = "localhost:27017";
}
$options = array(); $options = array();
if ($username . $password != "") { if ($username . $password != "") {
$options["username"] = $username; $options["username"] = $username;
@@ -537,4 +732,16 @@ if (isset($_GET["mongo"])) {
} }
return true; return true;
} }
function driver_config() {
global $operators;
return array(
'possible_drivers' => array("mongo", "mongodb"),
'jush' => "mongo",
'operators' => $operators,
'functions' => array(),
'grouping' => array(),
'edit_functions' => array(array("json")),
);
}
} }

View File

@@ -5,14 +5,12 @@
* @author Jakub Vrana * @author Jakub Vrana
*/ */
namespace Adminer; $drivers["mssql"] = "MS SQL (beta)";
$drivers["mssql"] = "MS SQL";
if (isset($_GET["mssql"])) { if (isset($_GET["mssql"])) {
define('Adminer\DRIVER', "mssql"); define("DRIVER", "mssql");
if (extension_loaded("sqlsrv")) { if (extension_loaded("sqlsrv")) {
class Db { class Min_DB {
var $extension = "sqlsrv", $_link, $_result, $server_info, $affected_rows, $errno, $error; var $extension = "sqlsrv", $_link, $_result, $server_info, $affected_rows, $errno, $error;
function _get_error() { function _get_error() {
@@ -26,15 +24,8 @@ if (isset($_GET["mssql"])) {
function connect($server, $username, $password) { function connect($server, $username, $password) {
global $adminer; global $adminer;
$connection_info = array("UID" => $username, "PWD" => $password, "CharacterSet" => "UTF-8");
$ssl = $adminer->connectSsl();
if (isset($ssl["Encrypt"])) {
$connection_info["Encrypt"] = $ssl["Encrypt"];
}
if (isset($ssl["TrustServerCertificate"])) {
$connection_info["TrustServerCertificate"] = $ssl["TrustServerCertificate"];
}
$db = $adminer->database(); $db = $adminer->database();
$connection_info = array("UID" => $username, "PWD" => $password, "CharacterSet" => "UTF-8");
if ($db != "") { if ($db != "") {
$connection_info["Database"] = $db; $connection_info["Database"] = $db;
} }
@@ -49,12 +40,11 @@ if (isset($_GET["mssql"])) {
} }
function quote($string) { function quote($string) {
$unicode = strlen($string) != strlen(utf8_decode($string)); return "'" . str_replace("'", "''", $string) . "'";
return ($unicode ? "N" : "") . "'" . str_replace("'", "''", $string) . "'";
} }
function select_db($database) { function select_db($database) {
return $this->query(use_sql($database)); return $this->query("USE " . idf_escape($database));
} }
function query($query, $unbuffered = false) { function query($query, $unbuffered = false) {
@@ -85,7 +75,7 @@ if (isset($_GET["mssql"])) {
return false; return false;
} }
if (sqlsrv_field_metadata($result)) { if (sqlsrv_field_metadata($result)) {
return new Result($result); return new Min_Result($result);
} }
$this->affected_rows = sqlsrv_rows_affected($result); $this->affected_rows = sqlsrv_rows_affected($result);
return true; return true;
@@ -105,7 +95,7 @@ if (isset($_GET["mssql"])) {
} }
} }
class Result { class Min_Result {
var $_result, $_offset = 0, $_fields, $num_rows; var $_result, $_offset = 0, $_fields, $num_rows;
function __construct($result) { function __construct($result) {
@@ -136,7 +126,7 @@ if (isset($_GET["mssql"])) {
$this->_fields = sqlsrv_field_metadata($this->_result); $this->_fields = sqlsrv_field_metadata($this->_result);
} }
$field = $this->_fields[$this->_offset++]; $field = $this->_fields[$this->_offset++];
$return = new \stdClass; $return = new stdClass;
$return->name = $field["Name"]; $return->name = $field["Name"];
$return->orgname = $field["Name"]; $return->orgname = $field["Name"];
$return->type = ($field["Type"] == 1 ? 254 : 0); $return->type = ($field["Type"] == 1 ? 254 : 0);
@@ -154,23 +144,105 @@ if (isset($_GET["mssql"])) {
} }
} }
} elseif (extension_loaded("pdo_sqlsrv")) { } elseif (extension_loaded("mssql")) {
class Db extends PdoDb { class Min_DB {
var $extension = "PDO_SQLSRV"; var $extension = "MSSQL", $_link, $_result, $server_info, $affected_rows, $error;
function connect($server, $username, $password) { function connect($server, $username, $password) {
$this->dsn("sqlsrv:Server=" . str_replace(":", ",", $server), $username, $password); $this->_link = @mssql_connect($server, $username, $password);
return true; if ($this->_link) {
$result = $this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')");
if ($result) {
$row = $result->fetch_row();
$this->server_info = $this->result("sp_server_info 2", 2) . " [$row[0]] $row[1]";
}
} else {
$this->error = mssql_get_last_message();
}
return (bool) $this->_link;
}
function quote($string) {
return "'" . str_replace("'", "''", $string) . "'";
} }
function select_db($database) { function select_db($database) {
// database selection is separated from the connection so dbname in DSN can't be used return mssql_select_db($database);
return $this->query(use_sql($database)); }
function query($query, $unbuffered = false) {
$result = @mssql_query($query, $this->_link); //! $unbuffered
$this->error = "";
if (!$result) {
$this->error = mssql_get_last_message();
return false;
}
if ($result === true) {
$this->affected_rows = mssql_rows_affected($this->_link);
return true;
}
return new Min_Result($result);
}
function multi_query($query) {
return $this->_result = $this->query($query);
}
function store_result() {
return $this->_result;
}
function next_result() {
return mssql_next_result($this->_result->_result);
}
function result($query, $field = 0) {
$result = $this->query($query);
if (!is_object($result)) {
return false;
}
return mssql_result($result->_result, 0, $field);
}
}
class Min_Result {
var $_result, $_offset = 0, $_fields, $num_rows;
function __construct($result) {
$this->_result = $result;
$this->num_rows = mssql_num_rows($result);
}
function fetch_assoc() {
return mssql_fetch_assoc($this->_result);
}
function fetch_row() {
return mssql_fetch_row($this->_result);
}
function num_rows() {
return mssql_num_rows($this->_result);
}
function fetch_field() {
$return = mssql_fetch_field($this->_result);
$return->orgtable = $return->table;
$return->orgname = $return->name;
return $return;
}
function seek($offset) {
mssql_data_seek($this->_result, $offset);
}
function __destruct() {
mssql_free_result($this->_result);
} }
} }
} elseif (extension_loaded("pdo_dblib")) { } elseif (extension_loaded("pdo_dblib")) {
class Db extends PdoDb { class Min_DB extends Min_PDO {
var $extension = "PDO_DBLIB"; var $extension = "PDO_DBLIB";
function connect($server, $username, $password) { function connect($server, $username, $password) {
@@ -179,95 +251,40 @@ if (isset($_GET["mssql"])) {
} }
function select_db($database) { function select_db($database) {
return $this->query(use_sql($database)); // database selection is separated from the connection so dbname in DSN can't be used
return $this->query("USE " . idf_escape($database));
} }
} }
} }
class Driver extends SqlDriver { class Min_Driver extends Min_SQL {
static $possibleDrivers = array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB");
static $jush = "mssql";
var $editFunctions = array(
array(
"date|time" => "getdate",
), array(
"int|decimal|real|float|money|datetime" => "+/-",
"char|text" => "+",
)
);
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL");
var $functions = array("len", "lower", "round", "upper");
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
var $onActions = "NO ACTION|CASCADE|SET NULL|SET DEFAULT";
var $generated = array("PERSISTED", "VIRTUAL");
function __construct($connection) {
parent::__construct($connection);
$this->types = array( //! use sys.types
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "int" => 10, "bigint" => 20, "bit" => 1, "decimal" => 0, "real" => 12, "float" => 53, "smallmoney" => 10, "money" => 20),
lang('Date and time') => array("date" => 10, "smalldatetime" => 19, "datetime" => 19, "datetime2" => 19, "time" => 8, "datetimeoffset" => 10),
lang('Strings') => array("char" => 8000, "varchar" => 8000, "text" => 2147483647, "nchar" => 4000, "nvarchar" => 4000, "ntext" => 1073741823),
lang('Binary') => array("binary" => 8000, "varbinary" => 8000, "image" => 2147483647),
);
}
function insertUpdate($table, $rows, $primary) { function insertUpdate($table, $rows, $primary) {
$fields = fields($table);
$update = array();
$where = array();
$set = reset($rows);
$columns = "c" . implode(", c", range(1, count($set)));
$c = 0;
$insert = array();
foreach ($set as $key => $val) {
$c++;
$name = idf_unescape($key);
if (!$fields[$name]["auto_increment"]) {
$insert[$key] = "c$c";
}
if (isset($primary[$name])) {
$where[] = "$key = c$c";
} else {
$update[] = "$key = c$c";
}
}
$values = array();
foreach ($rows as $set) { foreach ($rows as $set) {
$values[] = "(" . implode(", ", $set) . ")"; $update = array();
} $where = array();
if ($where) { foreach ($set as $key => $val) {
$identity = queries("SET IDENTITY_INSERT " . table($table) . " ON"); $update[] = "$key = $val";
$return = queries( if (isset($primary[idf_unescape($key)])) {
"MERGE " . table($table) . " USING (VALUES\n\t" . implode(",\n\t", $values) . "\n) AS source ($columns) ON " . implode(" AND ", $where) //! source, c1 - possible conflict $where[] = "$key = $val";
. ($update ? "\nWHEN MATCHED THEN UPDATE SET " . implode(", ", $update) : "") }
. "\nWHEN NOT MATCHED THEN INSERT (" . implode(", ", array_keys($identity ? $set : $insert)) . ") VALUES (" . ($identity ? $columns : implode(", ", $insert)) . ");" // ; is mandatory }
); //! can use only one query for all rows
if ($identity) { if (!queries("MERGE " . table($table) . " USING (VALUES(" . implode(", ", $set) . ")) AS source (c" . implode(", c", range(1, count($set))) . ") ON " . implode(" AND ", $where) //! source, c1 - possible conflict
queries("SET IDENTITY_INSERT " . table($table) . " OFF"); . " WHEN MATCHED THEN UPDATE SET " . implode(", ", $update)
. " WHEN NOT MATCHED THEN INSERT (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ");" // ; is mandatory
)) {
return false;
} }
} else {
$return = queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES\n" . implode(",\n", $values));
} }
return $return; return true;
} }
function begin() { function begin() {
return queries("BEGIN TRANSACTION"); return queries("BEGIN TRANSACTION");
} }
function tableHelp($name, $is_view = false) {
$links = array(
"sys" => "catalog-views/sys-",
"INFORMATION_SCHEMA" => "information-schema-views/",
);
$link = $links[get_schema()];
if ($link) {
return "relational-databases/system-$link" . preg_replace('~_~', '-', strtolower($name)) . "-transact-sql";
}
}
} }
@@ -280,11 +297,10 @@ if (isset($_GET["mssql"])) {
return ($_GET["ns"] != "" ? idf_escape($_GET["ns"]) . "." : "") . idf_escape($idf); return ($_GET["ns"] != "" ? idf_escape($_GET["ns"]) . "." : "") . idf_escape($idf);
} }
function connect($credentials) { function connect() {
$connection = new Db; global $adminer;
if ($credentials[0] == "") { $connection = new Min_DB;
$credentials[0] = "localhost:1433"; $credentials = $adminer->credentials();
}
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) { if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
return $connection; return $connection;
} }
@@ -304,7 +320,8 @@ if (isset($_GET["mssql"])) {
} }
function db_collation($db, $collations) { function db_collation($db, $collations) {
return get_val("SELECT collation_name FROM sys.databases WHERE name = " . q($db)); global $connection;
return $connection->result("SELECT collation_name FROM sys.databases WHERE name = " . q($db));
} }
function engines() { function engines() {
@@ -312,7 +329,8 @@ if (isset($_GET["mssql"])) {
} }
function logged_user() { function logged_user() {
return get_val("SELECT SUSER_NAME()"); global $connection;
return $connection->result("SELECT SUSER_NAME()");
} }
function tables_list() { function tables_list() {
@@ -324,18 +342,14 @@ if (isset($_GET["mssql"])) {
$return = array(); $return = array();
foreach ($databases as $db) { foreach ($databases as $db) {
$connection->select_db($db); $connection->select_db($db);
$return[$db] = get_val("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES"); $return[$db] = $connection->result("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES");
} }
return $return; return $return;
} }
function table_status($name = "") { function table_status($name = "") {
$return = array(); $return = array();
foreach ( foreach (get_rows("SELECT ao.name AS Name, ao.type_desc AS Engine, (SELECT value FROM fn_listextendedproperty(default, 'SCHEMA', schema_name(schema_id), 'TABLE', ao.name, null, null)) AS Comment FROM sys.all_objects AS ao WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) {
get_rows("SELECT ao.name AS Name, ao.type_desc AS Engine, (SELECT value FROM fn_listextendedproperty(default, 'SCHEMA', schema_name(schema_id), 'TABLE', ao.name, null, null)) AS Comment
FROM sys.all_objects AS ao
WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row
) {
if ($name != "") { if ($name != "") {
return $row; return $row;
} }
@@ -355,53 +369,41 @@ WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V')
function fields($table) { function fields($table) {
$comments = get_key_vals("SELECT objname, cast(value as varchar(max)) FROM fn_listextendedproperty('MS_DESCRIPTION', 'schema', " . q(get_schema()) . ", 'table', " . q($table) . ", 'column', NULL)"); $comments = get_key_vals("SELECT objname, cast(value as varchar(max)) FROM fn_listextendedproperty('MS_DESCRIPTION', 'schema', " . q(get_schema()) . ", 'table', " . q($table) . ", 'column', NULL)");
$return = array(); $return = array();
$table_id = get_val("SELECT object_id FROM sys.all_objects WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') AND name = " . q($table)); foreach (get_rows("SELECT c.max_length, c.precision, c.scale, c.name, c.is_nullable, c.is_identity, c.collation_name, t.name type, CAST(d.definition as text) [default]
foreach (
get_rows("SELECT c.max_length, c.precision, c.scale, c.name, c.is_nullable, c.is_identity, c.collation_name, t.name type, CAST(d.definition as text) [default], d.name default_constraint, i.is_primary_key
FROM sys.all_columns c FROM sys.all_columns c
JOIN sys.all_objects o ON c.object_id = o.object_id
JOIN sys.types t ON c.user_type_id = t.user_type_id JOIN sys.types t ON c.user_type_id = t.user_type_id
LEFT JOIN sys.default_constraints d ON c.default_object_id = d.object_id LEFT JOIN sys.default_constraints d ON c.default_object_id = d.parent_column_id
LEFT JOIN sys.index_columns ic ON c.object_id = ic.object_id AND c.column_id = ic.column_id WHERE o.schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND o.type IN ('S', 'U', 'V') AND o.name = " . q($table)
LEFT JOIN sys.indexes i ON ic.object_id = i.object_id AND ic.index_id = i.index_id ) as $row) {
WHERE c.object_id = " . q($table_id)) as $row
) {
$type = $row["type"]; $type = $row["type"];
$length = (preg_match("~char|binary~", $type) $length = (preg_match("~char|binary~", $type) ? $row["max_length"] : ($type == "decimal" ? "$row[precision],$row[scale]" : ""));
? $row["max_length"] / ($type[0] == 'n' ? 2 : 1)
: ($type == "decimal" ? "$row[precision],$row[scale]" : "")
);
$return[$row["name"]] = array( $return[$row["name"]] = array(
"field" => $row["name"], "field" => $row["name"],
"full_type" => $type . ($length ? "($length)" : ""), "full_type" => $type . ($length ? "($length)" : ""),
"type" => $type, "type" => $type,
"length" => $length, "length" => $length,
"default" => (preg_match("~^\('(.*)'\)$~", $row["default"], $match) ? str_replace("''", "'", $match[1]) : $row["default"]), "default" => $row["default"],
"default_constraint" => $row["default_constraint"],
"null" => $row["is_nullable"], "null" => $row["is_nullable"],
"auto_increment" => $row["is_identity"], "auto_increment" => $row["is_identity"],
"collation" => $row["collation_name"], "collation" => $row["collation_name"],
"privileges" => array("insert" => 1, "select" => 1, "update" => 1, "where" => 1, "order" => 1), "privileges" => array("insert" => 1, "select" => 1, "update" => 1, "where" => 1, "order" => 1),
"primary" => $row["is_primary_key"], "primary" => $row["is_identity"], //! or indexes.is_primary_key
"comment" => $comments[$row["name"]], "comment" => $comments[$row["name"]],
); );
} }
foreach (get_rows("SELECT * FROM sys.computed_columns WHERE object_id = " . q($table_id)) as $row) {
$return[$row["name"]]["generated"] = ($row["is_persisted"] ? "PERSISTED" : "VIRTUAL");
$return[$row["name"]]["default"] = $row["definition"];
}
return $return; return $return;
} }
function indexes($table, $connection2 = null) { function indexes($table, $connection2 = null) {
$return = array(); $return = array();
// sp_statistics doesn't return information about primary key // sp_statistics doesn't return information about primary key
foreach ( foreach (get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
FROM sys.indexes i FROM sys.indexes i
INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row WHERE OBJECT_NAME(i.object_id) = " . q($table)
) { , $connection2) as $row) {
$name = $row["name"]; $name = $row["name"];
$return[$name]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX")); $return[$name]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
$return[$name]["lengths"] = array(); $return[$name]["lengths"] = array();
@@ -412,7 +414,8 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
} }
function view($name) { function view($name) {
return array("select" => preg_replace('~^(?:[^[]|\[[^]]*])*\s+AS\s+~isU', '', get_val("SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = " . q($name)))); global $connection;
return array("select" => preg_replace('~^(?:[^[]|\[[^]]*])*\s+AS\s+~isU', '', $connection->result("SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = " . q($name))));
} }
function collations() { function collations() {
@@ -424,7 +427,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
} }
function information_schema($db) { function information_schema($db) {
return get_schema() == "INFORMATION_SCHEMA"; return false;
} }
function error() { function error() {
@@ -437,7 +440,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
} }
function drop_databases($databases) { function drop_databases($databases) {
return queries("DROP DATABASE " . implode(", ", array_map('Adminer\idf_escape', $databases))); return queries("DROP DATABASE " . implode(", ", array_map('idf_escape', $databases)));
} }
function rename_database($name, $collation) { function rename_database($name, $collation) {
@@ -455,7 +458,6 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) { function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
$alter = array(); $alter = array();
$comments = array(); $comments = array();
$orig_fields = fields($table);
foreach ($fields as $field) { foreach ($fields as $field) {
$column = idf_escape($field[0]); $column = idf_escape($field[0]);
$val = $field[1]; $val = $field[1];
@@ -465,28 +467,14 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
$val[1] = preg_replace("~( COLLATE )'(\\w+)'~", '\1\2', $val[1]); $val[1] = preg_replace("~( COLLATE )'(\\w+)'~", '\1\2', $val[1]);
$comments[$field[0]] = $val[5]; $comments[$field[0]] = $val[5];
unset($val[5]); unset($val[5]);
if (preg_match('~ AS ~', $val[3])) {
unset($val[1], $val[2]);
}
if ($field[0] == "") { if ($field[0] == "") {
$alter["ADD"][] = "\n " . implode("", $val) . ($table == "" ? substr($foreign[$val[0]], 16 + strlen($val[0])) : ""); // 16 - strlen(" FOREIGN KEY ()") $alter["ADD"][] = "\n " . implode("", $val) . ($table == "" ? substr($foreign[$val[0]], 16 + strlen($val[0])) : ""); // 16 - strlen(" FOREIGN KEY ()")
} else { } else {
$default = $val[3];
unset($val[3]); // default values are set separately
unset($val[6]); //! identity can't be removed unset($val[6]); //! identity can't be removed
if ($column != $val[0]) { if ($column != $val[0]) {
queries("EXEC sp_rename " . q(table($table) . ".$column") . ", " . q(idf_unescape($val[0])) . ", 'COLUMN'"); queries("EXEC sp_rename " . q(table($table) . ".$column") . ", " . q(idf_unescape($val[0])) . ", 'COLUMN'");
} }
$alter["ALTER COLUMN " . implode("", $val)][] = ""; $alter["ALTER COLUMN " . implode("", $val)][] = "";
$orig_field = $orig_fields[$field[0]];
if (default_value($orig_field) != $default) {
if ($orig_field["default"] !== null) {
$alter["DROP"][] = " " . idf_escape($orig_field["default_constraint"]);
}
if ($default) {
$alter["ADD"][] = "\n $default FOR $column";
}
}
} }
} }
} }
@@ -500,7 +488,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
$alter[""] = $foreign; $alter[""] = $foreign;
} }
foreach ($alter as $key => $val) { foreach ($alter as $key => $val) {
if (!queries("ALTER TABLE " . table($name) . " $key" . implode(",", $val))) { if (!queries("ALTER TABLE " . idf_escape($name) . " $key" . implode(",", $val))) {
return false; return false;
} }
} }
@@ -522,12 +510,10 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
} else { } else {
$index[] = idf_escape($val[1]) . " ON " . table($table); $index[] = idf_escape($val[1]) . " ON " . table($table);
} }
} elseif ( } elseif (!queries(($val[0] != "PRIMARY"
!queries(($val[0] != "PRIMARY" ? "CREATE $val[0] " . ($val[0] != "INDEX" ? "INDEX " : "") . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table)
? "CREATE $val[0] " . ($val[0] != "INDEX" ? "INDEX " : "") . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table) : "ALTER TABLE " . table($table) . " ADD PRIMARY KEY"
: "ALTER TABLE " . table($table) . " ADD PRIMARY KEY" ) . " (" . implode(", ", $val[2]) . ")")) {
) . " (" . implode(", ", $val[2]) . ")")
) {
return false; return false;
} }
} }
@@ -537,7 +523,8 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
} }
function last_id() { function last_id() {
return get_val("SELECT SCOPE_IDENTITY()"); // @@IDENTITY can return trigger INSERT global $connection;
return $connection->result("SELECT SCOPE_IDENTITY()"); // @@IDENTITY can return trigger INSERT
} }
function explain($connection, $query) { function explain($connection, $query) {
@@ -552,14 +539,10 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
function foreign_keys($table) { function foreign_keys($table) {
$return = array(); $return = array();
$on_actions = array("CASCADE", "NO ACTION", "SET NULL", "SET DEFAULT"); foreach (get_rows("EXEC sp_fkeys @fktable_name = " . q($table)) as $row) {
foreach (get_rows("EXEC sp_fkeys @fktable_name = " . q($table) . ", @fktable_owner = " . q(get_schema())) as $row) {
$foreign_key = &$return[$row["FK_NAME"]]; $foreign_key = &$return[$row["FK_NAME"]];
$foreign_key["db"] = $row["PKTABLE_QUALIFIER"]; $foreign_key["db"] = $row["PKTABLE_QUALIFIER"];
$foreign_key["ns"] = $row["PKTABLE_OWNER"];
$foreign_key["table"] = $row["PKTABLE_NAME"]; $foreign_key["table"] = $row["PKTABLE_NAME"];
$foreign_key["on_update"] = $on_actions[$row["UPDATE_RULE"]];
$foreign_key["on_delete"] = $on_actions[$row["DELETE_RULE"]];
$foreign_key["source"][] = $row["FKCOLUMN_NAME"]; $foreign_key["source"][] = $row["FKCOLUMN_NAME"];
$foreign_key["target"][] = $row["PKCOLUMN_NAME"]; $foreign_key["target"][] = $row["PKCOLUMN_NAME"];
} }
@@ -571,11 +554,11 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
} }
function drop_views($views) { function drop_views($views) {
return queries("DROP VIEW " . implode(", ", array_map('Adminer\table', $views))); return queries("DROP VIEW " . implode(", ", array_map('table', $views)));
} }
function drop_tables($tables) { function drop_tables($tables) {
return queries("DROP TABLE " . implode(", ", array_map('Adminer\table', $tables))); return queries("DROP TABLE " . implode(", ", array_map('table', $tables)));
} }
function move_tables($tables, $views, $target) { function move_tables($tables, $views, $target) {
@@ -586,8 +569,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
if ($name == "") { if ($name == "") {
return array(); return array();
} }
$rows = get_rows( $rows = get_rows("SELECT s.name [Trigger],
"SELECT s.name [Trigger],
CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(s.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(s.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event], CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(s.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(s.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing], CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing],
c.text c.text
@@ -604,14 +586,13 @@ WHERE s.xtype = 'TR' AND s.name = " . q($name)
function triggers($table) { function triggers($table) {
$return = array(); $return = array();
foreach ( foreach (get_rows("SELECT sys1.name,
get_rows("SELECT sys1.name,
CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event], CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing] CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing]
FROM sysobjects sys1 FROM sysobjects sys1
JOIN sysobjects sys2 ON sys1.parent_obj = sys2.id JOIN sysobjects sys2 ON sys1.parent_obj = sys2.id
WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
) { // triggers are not schema-scoped ) as $row) { // triggers are not schema-scoped
$return[$row["name"]] = array($row["Timing"], $row["Event"]); $return[$row["name"]] = array($row["Timing"], $row["Event"]);
} }
return $return; return $return;
@@ -630,70 +611,27 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
} }
function get_schema() { function get_schema() {
global $connection;
if ($_GET["ns"] != "") { if ($_GET["ns"] != "") {
return $_GET["ns"]; return $_GET["ns"];
} }
return get_val("SELECT SCHEMA_NAME()"); return $connection->result("SELECT SCHEMA_NAME()");
} }
function set_schema($schema) { function set_schema($schema) {
$_GET["ns"] = $schema;
return true; // ALTER USER is permanent return true; // ALTER USER is permanent
} }
function create_sql($table, $auto_increment, $style) {
global $driver;
if (is_view(table_status($table))) {
$view = view($table);
return "CREATE VIEW " . table($table) . " AS $view[select]";
}
$fields = array();
$primary = false;
foreach (fields($table) as $name => $field) {
$val = process_field($field, $field);
if ($val[6]) {
$primary = true;
}
$fields[] = implode("", $val);
}
foreach (indexes($table) as $name => $index) {
if (!$primary || $index["type"] != "PRIMARY") {
$columns = array();
foreach ($index["columns"] as $key => $val) {
$columns[] = idf_escape($val) . ($index["descs"][$key] ? " DESC" : "");
}
$name = idf_escape($name);
$fields[] = ($index["type"] == "INDEX" ? "INDEX $name" : "CONSTRAINT $name " . ($index["type"] == "UNIQUE" ? "UNIQUE" : "PRIMARY KEY")) . " (" . implode(", ", $columns) . ")";
}
}
foreach ($driver->checkConstraints($table) as $name => $check) {
$fields[] = "CONSTRAINT " . idf_escape($name) . " CHECK ($check)";
}
return "CREATE TABLE " . table($table) . " (\n\t" . implode(",\n\t", $fields) . "\n)";
}
function foreign_keys_sql($table) {
$fields = array();
foreach (foreign_keys($table) as $foreign) {
$fields[] = ltrim(format_foreign_key($foreign));
}
return ($fields ? "ALTER TABLE " . table($table) . " ADD\n\t" . implode(",\n\t", $fields) . ";\n\n" : "");
}
function truncate_sql($table) {
return "TRUNCATE TABLE " . table($table);
}
function use_sql($database) { function use_sql($database) {
return "USE " . idf_escape($database); return "USE " . idf_escape($database);
} }
function trigger_sql($table) { function show_variables() {
$return = ""; return array();
foreach (triggers($table) as $name => $trigger) { }
$return .= create_trigger(" ON " . table($table), trigger($name)) . ";";
} function show_status() {
return $return; return array();
} }
function convert_field($field) { function convert_field($field) {
@@ -704,6 +642,38 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
} }
function support($feature) { function support($feature) {
return preg_match('~^(check|comment|columns|database|drop_col|dump|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~', $feature); //! routine| return preg_match('~^(comment|columns|database|drop_col|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~', $feature); //! routine|
}
function driver_config() {
$types = array();
$structured_types = array();
foreach (array( //! use sys.types
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "int" => 10, "bigint" => 20, "bit" => 1, "decimal" => 0, "real" => 12, "float" => 53, "smallmoney" => 10, "money" => 20),
lang('Date and time') => array("date" => 10, "smalldatetime" => 19, "datetime" => 19, "datetime2" => 19, "time" => 8, "datetimeoffset" => 10),
lang('Strings') => array("char" => 8000, "varchar" => 8000, "text" => 2147483647, "nchar" => 4000, "nvarchar" => 4000, "ntext" => 1073741823),
lang('Binary') => array("binary" => 8000, "varbinary" => 8000, "image" => 2147483647),
) as $key => $val) {
$types += $val;
$structured_types[$key] = array_keys($val);
}
return array(
'possible_drivers' => array("SQLSRV", "MSSQL", "PDO_DBLIB"),
'jush' => "mssql",
'types' => $types,
'structured_types' => $structured_types,
'unsigned' => array(),
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"),
'functions' => array("len", "lower", "round", "upper"),
'grouping' => array("avg", "count", "count distinct", "max", "min", "sum"),
'edit_functions' => array(
array(
"date|time" => "getdate",
), array(
"int|decimal|real|float|money|datetime" => "+/-",
"char|text" => "+",
)
),
);
} }
} }

View File

@@ -1,13 +1,11 @@
<?php <?php
namespace Adminer;
$drivers = array("server" => "MySQL") + $drivers; $drivers = array("server" => "MySQL") + $drivers;
if (!defined('Adminer\DRIVER')) { if (!defined("DRIVER")) {
define('Adminer\DRIVER', "server"); // server - backwards compatibility define("DRIVER", "server"); // server - backwards compatibility
// MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable // MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable
if (extension_loaded("mysqli")) { if (extension_loaded("mysqli")) {
class Db extends \MySQLi { class Min_DB extends MySQLi {
var $extension = "MySQLi"; var $extension = "MySQLi";
function __construct() { function __construct() {
@@ -29,7 +27,7 @@ if (!defined('Adminer\DRIVER')) {
$database, $database,
(is_numeric($port) ? $port : ini_get("mysqli.default_port")), (is_numeric($port) ? $port : ini_get("mysqli.default_port")),
(!is_numeric($port) ? $port : $socket), (!is_numeric($port) ? $port : $socket),
($ssl ? ($ssl['verify'] !== false ? 2048 : 64) : 0) // 2048 - MYSQLI_CLIENT_SSL, 64 - MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT (not available before PHP 5.6.16) ($ssl ? 64 : 0) // 64 - MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT (not available before PHP 5.6.16)
); );
$this->options(MYSQLI_OPT_LOCAL_INFILE, false); $this->options(MYSQLI_OPT_LOCAL_INFILE, false);
return $return; return $return;
@@ -52,14 +50,14 @@ if (!defined('Adminer\DRIVER')) {
$row = $result->fetch_array(); $row = $result->fetch_array();
return $row[$field]; return $row[$field];
} }
function quote($string) { function quote($string) {
return "'" . $this->escape_string($string) . "'"; return "'" . $this->escape_string($string) . "'";
} }
} }
} elseif (extension_loaded("mysql") && !((ini_bool("sql.safe_mode") || ini_bool("mysql.allow_local_infile")) && extension_loaded("pdo_mysql"))) { } elseif (extension_loaded("mysql") && !((ini_bool("sql.safe_mode") || ini_bool("mysql.allow_local_infile")) && extension_loaded("pdo_mysql"))) {
class Db { class Min_DB {
var var
$extension = "MySQL", ///< @var string extension name $extension = "MySQL", ///< @var string extension name
$server_info, ///< @var string server version $server_info, ///< @var string server version
@@ -129,7 +127,7 @@ if (!defined('Adminer\DRIVER')) {
/** Send query /** Send query
* @param string * @param string
* @param bool * @param bool
* @return mixed bool or Result * @return mixed bool or Min_Result
*/ */
function query($query, $unbuffered = false) { function query($query, $unbuffered = false) {
$result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode $result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode
@@ -144,7 +142,7 @@ if (!defined('Adminer\DRIVER')) {
$this->info = mysql_info($this->_link); $this->info = mysql_info($this->_link);
return true; return true;
} }
return new Result($result); return new Min_Result($result);
} }
/** Send query with more resultsets /** Send query with more resultsets
@@ -156,7 +154,7 @@ if (!defined('Adminer\DRIVER')) {
} }
/** Get current resultset /** Get current resultset
* @return Result * @return Min_Result
*/ */
function store_result() { function store_result() {
return $this->_result; return $this->_result;
@@ -184,7 +182,7 @@ if (!defined('Adminer\DRIVER')) {
} }
} }
class Result { class Min_Result {
var var
$num_rows, ///< @var int number of rows in the result $num_rows, ///< @var int number of rows in the result
$_result, $_offset = 0 ///< @access private $_result, $_offset = 0 ///< @access private
@@ -231,25 +229,22 @@ if (!defined('Adminer\DRIVER')) {
} }
} elseif (extension_loaded("pdo_mysql")) { } elseif (extension_loaded("pdo_mysql")) {
class Db extends PdoDb { class Min_DB extends Min_PDO {
var $extension = "PDO_MySQL"; var $extension = "PDO_MySQL";
function connect($server, $username, $password) { function connect($server, $username, $password) {
global $adminer; global $adminer;
$options = array(\PDO::MYSQL_ATTR_LOCAL_INFILE => false); $options = array(PDO::MYSQL_ATTR_LOCAL_INFILE => false);
$ssl = $adminer->connectSsl(); $ssl = $adminer->connectSsl();
if ($ssl) { if ($ssl) {
if ($ssl['key']) { if (!empty($ssl['key'])) {
$options[\PDO::MYSQL_ATTR_SSL_KEY] = $ssl['key']; $options[PDO::MYSQL_ATTR_SSL_KEY] = $ssl['key'];
} }
if ($ssl['cert']) { if (!empty($ssl['cert'])) {
$options[\PDO::MYSQL_ATTR_SSL_CERT] = $ssl['cert']; $options[PDO::MYSQL_ATTR_SSL_CERT] = $ssl['cert'];
} }
if ($ssl['ca']) { if (!empty($ssl['ca'])) {
$options[\PDO::MYSQL_ATTR_SSL_CA] = $ssl['ca']; $options[PDO::MYSQL_ATTR_SSL_CA] = $ssl['ca'];
}
if (isset($ssl['verify'])) {
$options[\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = $ssl['verify'];
} }
} }
$this->dsn( $this->dsn(
@@ -271,7 +266,7 @@ if (!defined('Adminer\DRIVER')) {
} }
function query($query, $unbuffered = false) { function query($query, $unbuffered = false) {
$this->pdo->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, !$unbuffered); $this->pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, !$unbuffered);
return parent::query($query, $unbuffered); return parent::query($query, $unbuffered);
} }
} }
@@ -280,52 +275,7 @@ if (!defined('Adminer\DRIVER')) {
class Driver extends SqlDriver { class Min_Driver extends Min_SQL {
static $possibleDrivers = array("MySQLi", "MySQL", "PDO_MySQL");
static $jush = "sql"; ///< @var string JUSH identifier
var $unsigned = array("unsigned", "zerofill", "unsigned zerofill");
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL");
var $functions = array("char_length", "date", "from_unixtime", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper");
var $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
function __construct($connection) {
parent::__construct($connection);
$this->types = array(
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "mediumint" => 8, "int" => 10, "bigint" => 20, "decimal" => 66, "float" => 12, "double" => 21),
lang('Date and time') => array("date" => 10, "datetime" => 19, "timestamp" => 19, "time" => 10, "year" => 4),
lang('Strings') => array("char" => 255, "varchar" => 65535, "tinytext" => 255, "text" => 65535, "mediumtext" => 16777215, "longtext" => 4294967295),
lang('Lists') => array("enum" => 65535, "set" => 64),
lang('Binary') => array("bit" => 20, "binary" => 255, "varbinary" => 65535, "tinyblob" => 255, "blob" => 65535, "mediumblob" => 16777215, "longblob" => 4294967295),
lang('Geometry') => array("geometry" => 0, "point" => 0, "linestring" => 0, "polygon" => 0, "multipoint" => 0, "multilinestring" => 0, "multipolygon" => 0, "geometrycollection" => 0),
);
$this->editFunctions = array(
array(
"char" => "md5/sha1/password/encrypt/uuid",
"binary" => "md5/sha1",
"date|time" => "now",
), array(
number_type() => "+/-",
"date" => "+ interval/- interval",
"time" => "addtime/subtime",
"char|text" => "concat",
)
);
if (min_version('5.7.8', 10.2, $connection)) {
$this->types[lang('Strings')]["json"] = 4294967295;
}
if (min_version('', 10.7, $connection)) {
$this->types[lang('Strings')]["uuid"] = 128;
$this->editFunctions[0]['uuid'] = 'uuid';
}
if (min_version(9, '', $connection)) {
$this->types[lang('Numbers')]["vector"] = 16383;
$this->editFunctions[0]['vector'] = 'string_to_vector';
}
if (min_version(5.7, 10.2, $connection)) {
$this->generated = array("STORED", "VIRTUAL");
}
}
function insert($table, $set) { function insert($table, $set) {
return ($set ? parent::insert($table, $set) : queries("INSERT INTO " . table($table) . " ()\nVALUES ()")); return ($set ? parent::insert($table, $set) : queries("INSERT INTO " . table($table) . " ()\nVALUES ()"));
@@ -355,7 +305,7 @@ if (!defined('Adminer\DRIVER')) {
} }
return queries($prefix . implode(",\n", $values) . $suffix); return queries($prefix . implode(",\n", $values) . $suffix);
} }
function slowQuery($query, $timeout) { function slowQuery($query, $timeout) {
if (min_version('5.7.8', '10.1.2')) { if (min_version('5.7.8', '10.1.2')) {
if (preg_match('~MariaDB~', $this->_conn->server_info)) { if (preg_match('~MariaDB~', $this->_conn->server_info)) {
@@ -372,7 +322,7 @@ if (!defined('Adminer\DRIVER')) {
: $idf : $idf
); );
} }
function warnings() { function warnings() {
$result = $this->_conn->query("SHOW WARNINGS"); $result = $this->_conn->query("SHOW WARNINGS");
if ($result && $result->num_rows) { if ($result && $result->num_rows) {
@@ -382,24 +332,16 @@ if (!defined('Adminer\DRIVER')) {
} }
} }
function tableHelp($name, $is_view = false) { function tableHelp($name) {
$maria = preg_match('~MariaDB~', $this->_conn->server_info); $maria = preg_match('~MariaDB~', $this->_conn->server_info);
if (information_schema(DB)) { if (information_schema(DB)) {
return strtolower("information-schema-" . ($maria ? "$name-table/" : str_replace("_", "-", $name) . "-table.html")); return strtolower(($maria ? "information-schema-$name-table/" : str_replace("_", "-", $name) . "-table.html"));
} }
if (DB == "mysql") { if (DB == "mysql") {
return ($maria ? "mysql$name-table/" : "system-schema.html"); //! more precise link return ($maria ? "mysql$name-table/" : "system-database.html"); //! more precise link
} }
} }
function hasCStyleEscapes() {
static $c_style;
if ($c_style === null) {
$sql_mode = $this->_conn->result("SHOW VARIABLES LIKE 'sql_mode'", 1);
$c_style = (strpos($sql_mode, 'NO_BACKSLASH_ESCAPES') === false);
}
return $c_style;
}
} }
@@ -421,14 +363,19 @@ if (!defined('Adminer\DRIVER')) {
} }
/** Connect to the database /** Connect to the database
* @param array [$server, $username, $password] * @return mixed Min_DB or string for error
* @return mixed Db or string for error
*/ */
function connect($credentials) { function connect() {
$connection = new Db; global $adminer, $types, $structured_types;
$connection = new Min_DB;
$credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) { if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
$connection->set_charset(charset($connection)); // available in MySQLi since PHP 5.0.5 $connection->set_charset(charset($connection)); // available in MySQLi since PHP 5.0.5
$connection->query("SET sql_quote_show_create = 1, autocommit = 1"); $connection->query("SET sql_quote_show_create = 1, autocommit = 1");
if (min_version('5.7.8', 10.2, $connection)) {
$structured_types[lang('Strings')][] = "json";
$types["json"] = 4294967295;
}
return $connection; return $connection;
} }
$return = $connection->error; $return = $connection->error;
@@ -446,7 +393,10 @@ if (!defined('Adminer\DRIVER')) {
// SHOW DATABASES can take a very long time so it is cached // SHOW DATABASES can take a very long time so it is cached
$return = get_session("dbs"); $return = get_session("dbs");
if ($return === null) { if ($return === null) {
$query = "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME"; // SHOW DATABASES can be disabled by skip_show_database $query = (min_version(5)
? "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME"
: "SHOW DATABASES"
); // SHOW DATABASES can be disabled by skip_show_database
$return = ($flush ? slow_query($query) : get_vals($query)); $return = ($flush ? slow_query($query) : get_vals($query));
restart_session(); restart_session();
set_session("dbs", $return); set_session("dbs", $return);
@@ -484,8 +434,9 @@ if (!defined('Adminer\DRIVER')) {
* @return string * @return string
*/ */
function db_collation($db, $collations) { function db_collation($db, $collations) {
global $connection;
$return = null; $return = null;
$create = get_val("SHOW CREATE DATABASE " . idf_escape($db), 1); $create = $connection->result("SHOW CREATE DATABASE " . idf_escape($db), 1);
if (preg_match('~ COLLATE ([^ ]+)~', $create, $match)) { if (preg_match('~ COLLATE ([^ ]+)~', $create, $match)) {
$return = $match[1]; $return = $match[1];
} elseif (preg_match('~ CHARACTER SET ([^ ]+)~', $create, $match)) { } elseif (preg_match('~ CHARACTER SET ([^ ]+)~', $create, $match)) {
@@ -512,19 +463,23 @@ if (!defined('Adminer\DRIVER')) {
* @return string * @return string
*/ */
function logged_user() { function logged_user() {
return get_val("SELECT USER()"); global $connection;
return $connection->result("SELECT USER()");
} }
/** Get tables list /** Get tables list
* @return array [$name => $type] * @return array array($name => $type)
*/ */
function tables_list() { function tables_list() {
return get_key_vals("SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME"); return get_key_vals(min_version(5)
? "SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME"
: "SHOW TABLES"
);
} }
/** Count tables in all databases /** Count tables in all databases
* @param array * @param array
* @return array [$db => $tables] * @return array array($db => $tables)
*/ */
function count_tables($databases) { function count_tables($databases) {
$return = array(); $return = array();
@@ -537,17 +492,14 @@ if (!defined('Adminer\DRIVER')) {
/** Get table status /** Get table status
* @param string * @param string
* @param bool return only "Name", "Engine" and "Comment" fields * @param bool return only "Name", "Engine" and "Comment" fields
* @return array [$name => ["Name" => , "Engine" => , "Comment" => , "Oid" => , "Rows" => , "Collation" => , "Auto_increment" => , "Data_length" => , "Index_length" => , "Data_free" => ]] or only inner array with $name * @return array array($name => array("Name" => , "Engine" => , "Comment" => , "Oid" => , "Rows" => , "Collation" => , "Auto_increment" => , "Data_length" => , "Index_length" => , "Data_free" => )) or only inner array with $name
*/ */
function table_status($name = "", $fast = false) { function table_status($name = "", $fast = false) {
$return = array(); $return = array();
foreach ( foreach (get_rows($fast && min_version(5)
get_rows( ? "SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() " . ($name != "" ? "AND TABLE_NAME = " . q($name) : "ORDER BY Name")
$fast : "SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_\\")) : "")
? "SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() " . ($name != "" ? "AND TABLE_NAME = " . q($name) : "ORDER BY Name") ) as $row) {
: "SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_\\")) : "")
) as $row
) {
if ($row["Engine"] == "InnoDB") { if ($row["Engine"] == "InnoDB") {
// ignore internal comment, unnecessary since MySQL 5.1.21 // ignore internal comment, unnecessary since MySQL 5.1.21
$row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\1', $row["Comment"]); $row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\1', $row["Comment"]);
@@ -556,8 +508,6 @@ if (!defined('Adminer\DRIVER')) {
$row["Comment"] = ""; $row["Comment"] = "";
} }
if ($name != "") { if ($name != "") {
// MariaDB: Table name is returned as lowercase on macOS, so we fix it here.
$row["Name"] = $name;
return $row; return $row;
} }
$return[$row["Name"]] = $row; $return[$row["Name"]] = $row;
@@ -584,39 +534,28 @@ if (!defined('Adminer\DRIVER')) {
/** Get information about fields /** Get information about fields
* @param string * @param string
* @return array [$name => ["field" => , "full_type" => , "type" => , "length" => , "unsigned" => , "default" => , "null" => , "auto_increment" => , "on_update" => , "collation" => , "privileges" => , "comment" => , "primary" => , "generated" => ]] * @return array array($name => array("field" => , "full_type" => , "type" => , "length" => , "unsigned" => , "default" => , "null" => , "auto_increment" => , "on_update" => , "collation" => , "privileges" => , "comment" => , "primary" => ))
*/ */
function fields($table) { function fields($table) {
$return = array(); $return = array();
foreach (get_rows("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . q($table) . " ORDER BY ORDINAL_POSITION") as $row) { foreach (get_rows("SHOW FULL COLUMNS FROM " . table($table)) as $row) {
$field = $row["COLUMN_NAME"]; preg_match('~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~', $row["Type"], $match);
$default = $row["COLUMN_DEFAULT"]; $return[$row["Field"]] = array(
$type = $row["COLUMN_TYPE"]; "field" => $row["Field"],
$extra = $row["EXTRA"]; "full_type" => $row["Type"],
// https://mariadb.com/kb/en/library/show-columns/, https://github.com/vrana/adminer/pull/359#pullrequestreview-276677186
preg_match('~^(VIRTUAL|PERSISTENT|STORED)~', $extra, $generated);
preg_match('~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~', $type, $match);
$return[$field] = array(
"field" => $field,
"full_type" => $type,
"type" => $match[1], "type" => $match[1],
"length" => $match[2], "length" => $match[2],
"unsigned" => ltrim($match[3] . $match[4]), "unsigned" => ltrim($match[3] . $match[4]),
"default" => ($generated "default" => ($row["Default"] != "" || preg_match("~char|set~", $match[1]) ? (preg_match('~text~', $match[1]) ? stripslashes(preg_replace("~^'(.*)'\$~", '\1', $row["Default"])) : $row["Default"]) : null),
? $row["GENERATION_EXPRESSION"] "null" => ($row["Null"] == "YES"),
: ($default != "" || preg_match("~char|set~", $match[1]) "auto_increment" => ($row["Extra"] == "auto_increment"),
? (preg_match('~text~', $match[1]) ? stripslashes(preg_replace("~^'(.*)'\$~", '\1', $default)) : $default) "on_update" => (preg_match('~^on update (.+)~i', $row["Extra"], $match) ? $match[1] : ""), //! available since MySQL 5.1.23
: null "collation" => $row["Collation"],
) "privileges" => array_flip(preg_split('~, *~', $row["Privileges"])) + ["where" => 1, "order" => 1],
), "comment" => $row["Comment"],
"null" => ($row["IS_NULLABLE"] == "YES"), "primary" => ($row["Key"] == "PRI"),
"auto_increment" => ($extra == "auto_increment"), // https://mariadb.com/kb/en/library/show-columns/, https://github.com/vrana/adminer/pull/359#pullrequestreview-276677186
"on_update" => (preg_match('~\bon update (\w+)~i', $extra, $match) ? $match[1] : ""), //! available since MySQL 5.1.23 "generated" => preg_match('~^(VIRTUAL|PERSISTENT|STORED)~', $row["Extra"]),
"collation" => $row["COLLATION_NAME"],
"privileges" => array_flip(explode(",", "$row[PRIVILEGES],where,order")),
"comment" => $row["COLUMN_COMMENT"],
"primary" => ($row["COLUMN_KEY"] == "PRI"),
"generated" => ($generated[1] == "PERSISTENT" ? "STORED" : $generated[1]),
); );
} }
return $return; return $return;
@@ -624,8 +563,8 @@ if (!defined('Adminer\DRIVER')) {
/** Get table indexes /** Get table indexes
* @param string * @param string
* @param string Db to use * @param string Min_DB to use
* @return array [$key_name => ["type" => , "columns" => [], "lengths" => [], "descs" => []]] * @return array array($key_name => array("type" => , "columns" => array(), "lengths" => array(), "descs" => array()))
*/ */
function indexes($table, $connection2 = null) { function indexes($table, $connection2 = null) {
$return = array(); $return = array();
@@ -641,25 +580,25 @@ if (!defined('Adminer\DRIVER')) {
/** Get foreign keys in table /** Get foreign keys in table
* @param string * @param string
* @return array [$name => ["db" => , "ns" => , "table" => , "source" => [], "target" => [], "on_delete" => , "on_update" => ]] * @return array array($name => array("db" => , "ns" => , "table" => , "source" => array(), "target" => array(), "on_delete" => , "on_update" => ))
*/ */
function foreign_keys($table) { function foreign_keys($table) {
global $driver; global $connection, $on_actions;
static $pattern = '(?:`(?:[^`]|``)+`|"(?:[^"]|"")+")'; static $pattern = '(?:`(?:[^`]|``)+`|"(?:[^"]|"")+")';
$return = array(); $return = array();
$create_table = get_val("SHOW CREATE TABLE " . table($table), 1); $create_table = $connection->result("SHOW CREATE TABLE " . table($table), 1);
if ($create_table) { if ($create_table) {
preg_match_all("~CONSTRAINT ($pattern) FOREIGN KEY ?\\(((?:$pattern,? ?)+)\\) REFERENCES ($pattern)(?:\\.($pattern))? \\(((?:$pattern,? ?)+)\\)(?: ON DELETE ($driver->onActions))?(?: ON UPDATE ($driver->onActions))?~", $create_table, $matches, PREG_SET_ORDER); preg_match_all("~CONSTRAINT ($pattern) FOREIGN KEY ?\\(((?:$pattern,? ?)+)\\) REFERENCES ($pattern)(?:\\.($pattern))? \\(((?:$pattern,? ?)+)\\)(?: ON DELETE ($on_actions))?(?: ON UPDATE ($on_actions))?~", $create_table, $matches, PREG_SET_ORDER);
foreach ($matches as $match) { foreach ($matches as $match) {
preg_match_all("~$pattern~", $match[2], $source); preg_match_all("~$pattern~", $match[2], $source);
preg_match_all("~$pattern~", $match[5], $target); preg_match_all("~$pattern~", $match[5], $target);
$return[idf_unescape($match[1])] = array( $return[idf_unescape($match[1])] = array(
"db" => idf_unescape($match[4] != "" ? $match[3] : $match[4]), "db" => idf_unescape($match[4] != "" ? $match[3] : $match[4]),
"table" => idf_unescape($match[4] != "" ? $match[4] : $match[3]), "table" => idf_unescape($match[4] != "" ? $match[4] : $match[3]),
"source" => array_map('Adminer\idf_unescape', $source[0]), "source" => array_map('idf_unescape', $source[0]),
"target" => array_map('Adminer\idf_unescape', $target[0]), "target" => array_map('idf_unescape', $target[0]),
"on_delete" => ($match[6] ?: "RESTRICT"), "on_delete" => ($match[6] ? $match[6] : "RESTRICT"),
"on_update" => ($match[7] ?: "RESTRICT"), "on_update" => ($match[7] ? $match[7] : "RESTRICT"),
); );
} }
} }
@@ -668,10 +607,11 @@ if (!defined('Adminer\DRIVER')) {
/** Get view SELECT /** Get view SELECT
* @param string * @param string
* @return array ["select" => ] * @return array array("select" => )
*/ */
function view($name) { function view($name) {
return array("select" => preg_replace('~^(?:[^`]|`[^`]*`)*\s+AS\s+~isU', '', get_val("SHOW CREATE VIEW " . table($name), 1))); global $connection;
return array("select" => preg_replace('~^(?:[^`]|`[^`]*`)*\s+AS\s+~isU', '', $connection->result("SHOW CREATE VIEW " . table($name), 1)));
} }
/** Get sorted grouped list of collations /** Get sorted grouped list of collations
@@ -698,7 +638,7 @@ if (!defined('Adminer\DRIVER')) {
* @return bool * @return bool
*/ */
function information_schema($db) { function information_schema($db) {
return ($db == "information_schema") return (min_version(5) && $db == "information_schema")
|| (min_version(5.5) && $db == "performance_schema"); || (min_version(5.5) && $db == "performance_schema");
} }
@@ -724,7 +664,7 @@ if (!defined('Adminer\DRIVER')) {
* @return bool * @return bool
*/ */
function drop_databases($databases) { function drop_databases($databases) {
$return = apply_queries("DROP DATABASE", $databases, 'Adminer\idf_escape'); $return = apply_queries("DROP DATABASE", $databases, 'idf_escape');
restart_session(); restart_session();
set_session("dbs", null); set_session("dbs", null);
return $return; return $return;
@@ -776,7 +716,7 @@ if (!defined('Adminer\DRIVER')) {
/** Run commands to create or alter table /** Run commands to create or alter table
* @param string "" to create * @param string "" to create
* @param string new name * @param string new name
* @param array of [$orig, $process_field, $after] * @param array of array($orig, $process_field, $after)
* @param array of strings * @param array of strings
* @param string * @param string
* @param string * @param string
@@ -788,16 +728,10 @@ if (!defined('Adminer\DRIVER')) {
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) { function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
$alter = array(); $alter = array();
foreach ($fields as $field) { foreach ($fields as $field) {
if ($field[1]) { $alter[] = ($field[1]
$default = $field[1][3]; ? ($table != "" ? ($field[0] != "" ? "CHANGE " . idf_escape($field[0]) : "ADD") : " ") . " " . implode($field[1]) . ($table != "" ? $field[2] : "")
if (preg_match('~ GENERATED~', $default)) { : "DROP " . idf_escape($field[0])
$field[1][3] = $field[1][2]; );
$field[1][2] = $default;
}
$alter[] = ($table != "" ? ($field[0] != "" ? "CHANGE " . idf_escape($field[0]) : "ADD") : " ") . " " . implode($field[1]) . ($table != "" ? $field[2] : "");
} else {
$alter[] = "DROP " . idf_escape($field[0]);
}
} }
$alter = array_merge($alter, $foreign); $alter = array_merge($alter, $foreign);
$status = ($comment !== null ? " COMMENT=" . q($comment) : "") $status = ($comment !== null ? " COMMENT=" . q($comment) : "")
@@ -819,7 +753,7 @@ if (!defined('Adminer\DRIVER')) {
/** Run commands to alter indexes /** Run commands to alter indexes
* @param string escaped table name * @param string escaped table name
* @param array of ["index type", "name", ["column definition", ...]] or ["index type", "name", "DROP"] * @param array of array("index type", "name", array("column definition", ...)) or array("index type", "name", "DROP")
* @return bool * @return bool
*/ */
function alter_indexes($table, $alter) { function alter_indexes($table, $alter) {
@@ -845,7 +779,7 @@ if (!defined('Adminer\DRIVER')) {
* @return bool * @return bool
*/ */
function drop_views($views) { function drop_views($views) {
return queries("DROP VIEW " . implode(", ", array_map('Adminer\table', $views))); return queries("DROP VIEW " . implode(", ", array_map('table', $views)));
} }
/** Drop tables /** Drop tables
@@ -853,7 +787,7 @@ if (!defined('Adminer\DRIVER')) {
* @return bool * @return bool
*/ */
function drop_tables($tables) { function drop_tables($tables) {
return queries("DROP TABLE " . implode(", ", array_map('Adminer\table', $tables))); return queries("DROP TABLE " . implode(", ", array_map('table', $tables)));
} }
/** Move tables to other schema /** Move tables to other schema
@@ -896,8 +830,7 @@ if (!defined('Adminer\DRIVER')) {
queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'"); queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");
foreach ($tables as $table) { foreach ($tables as $table) {
$name = ($target == DB ? table("copy_$table") : idf_escape($target) . "." . table($table)); $name = ($target == DB ? table("copy_$table") : idf_escape($target) . "." . table($table));
if ( if (($_POST["overwrite"] && !queries("\nDROP TABLE IF EXISTS $name"))
($_POST["overwrite"] && !queries("\nDROP TABLE IF EXISTS $name"))
|| !queries("CREATE TABLE $name LIKE " . table($table)) || !queries("CREATE TABLE $name LIKE " . table($table))
|| !queries("INSERT INTO $name SELECT * FROM " . table($table)) || !queries("INSERT INTO $name SELECT * FROM " . table($table))
) { ) {
@@ -913,10 +846,8 @@ if (!defined('Adminer\DRIVER')) {
foreach ($views as $table) { foreach ($views as $table) {
$name = ($target == DB ? table("copy_$table") : idf_escape($target) . "." . table($table)); $name = ($target == DB ? table("copy_$table") : idf_escape($target) . "." . table($table));
$view = view($table); $view = view($table);
if ( if (($_POST["overwrite"] && !queries("DROP VIEW IF EXISTS $name"))
($_POST["overwrite"] && !queries("DROP VIEW IF EXISTS $name")) || !queries("CREATE VIEW $name AS $view[select]")) { //! USE to avoid db.table
|| !queries("CREATE VIEW $name AS $view[select]") //! USE to avoid db.table
) {
return false; return false;
} }
} }
@@ -925,7 +856,7 @@ if (!defined('Adminer\DRIVER')) {
/** Get information about trigger /** Get information about trigger
* @param string trigger name * @param string trigger name
* @return array ["Trigger" => , "Timing" => , "Event" => , "Of" => , "Type" => , "Statement" => ] * @return array array("Trigger" => , "Timing" => , "Event" => , "Of" => , "Type" => , "Statement" => )
*/ */
function trigger($name) { function trigger($name) {
if ($name == "") { if ($name == "") {
@@ -937,7 +868,7 @@ if (!defined('Adminer\DRIVER')) {
/** Get defined triggers /** Get defined triggers
* @param string * @param string
* @return array [$name => [$timing, $event]] * @return array array($name => array($timing, $event))
*/ */
function triggers($table) { function triggers($table) {
$return = array(); $return = array();
@@ -948,7 +879,7 @@ if (!defined('Adminer\DRIVER')) {
} }
/** Get trigger options /** Get trigger options
* @return array ["Timing" => [], "Event" => [], "Type" => []] * @return array ("Timing" => array(), "Event" => array(), "Type" => array())
*/ */
function trigger_options() { function trigger_options() {
return array( return array(
@@ -961,15 +892,15 @@ if (!defined('Adminer\DRIVER')) {
/** Get information about stored routine /** Get information about stored routine
* @param string * @param string
* @param string "FUNCTION" or "PROCEDURE" * @param string "FUNCTION" or "PROCEDURE"
* @return array ["fields" => ["field" => , "type" => , "length" => , "unsigned" => , "inout" => , "collation" => ], "returns" => , "definition" => , "language" => ] * @return array ("fields" => array("field" => , "type" => , "length" => , "unsigned" => , "inout" => , "collation" => ), "returns" => , "definition" => , "language" => )
*/ */
function routine($name, $type) { function routine($name, $type) {
global $driver; global $connection, $enum_length, $inout, $types;
$aliases = array("bool", "boolean", "integer", "double precision", "real", "dec", "numeric", "fixed", "national char", "national varchar"); $aliases = array("bool", "boolean", "integer", "double precision", "real", "dec", "numeric", "fixed", "national char", "national varchar");
$space = "(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)"; $space = "(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";
$type_pattern = "((" . implode("|", array_merge(array_keys($driver->types()), $aliases)) . ")\\b(?:\\s*\\(((?:[^'\")]|$driver->enumLength)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?"; $type_pattern = "((" . implode("|", array_merge(array_keys($types), $aliases)) . ")\\b(?:\\s*\\(((?:[^'\")]|$enum_length)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";
$pattern = "$space*(" . ($type == "FUNCTION" ? "" : $driver->inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern"; $pattern = "$space*(" . ($type == "FUNCTION" ? "" : $inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
$create = get_val("SHOW CREATE $type " . idf_escape($name), 2); $create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2);
preg_match("~\\(((?:$pattern\\s*,?)*)\\)\\s*" . ($type == "FUNCTION" ? "RETURNS\\s+$type_pattern\\s+" : "") . "(.*)~is", $create, $match); preg_match("~\\(((?:$pattern\\s*,?)*)\\)\\s*" . ($type == "FUNCTION" ? "RETURNS\\s+$type_pattern\\s+" : "") . "(.*)~is", $create, $match);
$fields = array(); $fields = array();
preg_match_all("~$pattern\\s*,?~is", $match[1], $matches, PREG_SET_ORDER); preg_match_all("~$pattern\\s*,?~is", $match[1], $matches, PREG_SET_ORDER);
@@ -977,7 +908,7 @@ if (!defined('Adminer\DRIVER')) {
$fields[] = array( $fields[] = array(
"field" => str_replace("``", "`", $param[2]) . $param[3], "field" => str_replace("``", "`", $param[2]) . $param[3],
"type" => strtolower($param[5]), "type" => strtolower($param[5]),
"length" => preg_replace_callback("~$driver->enumLength~s", 'Adminer\normalize_enum', $param[6]), "length" => preg_replace_callback("~$enum_length~s", 'normalize_enum', $param[6]),
"unsigned" => strtolower(preg_replace('~\s+~', ' ', trim("$param[8] $param[7]"))), "unsigned" => strtolower(preg_replace('~\s+~', ' ', trim("$param[8] $param[7]"))),
"null" => 1, "null" => 1,
"full_type" => $param[4], "full_type" => $param[4],
@@ -985,21 +916,22 @@ if (!defined('Adminer\DRIVER')) {
"collation" => strtolower($param[9]), "collation" => strtolower($param[9]),
); );
} }
if ($type != "FUNCTION") {
return array("fields" => $fields, "definition" => $match[11]);
}
return array( return array(
"fields" => $fields, "fields" => $fields,
"comment" => get_val("SELECT ROUTINE_COMMENT FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = DATABASE() AND ROUTINE_NAME = " . q($name)),
) + ($type != "FUNCTION" ? array("definition" => $match[11]) : array(
"returns" => array("type" => $match[12], "length" => $match[13], "unsigned" => $match[15], "collation" => $match[16]), "returns" => array("type" => $match[12], "length" => $match[13], "unsigned" => $match[15], "collation" => $match[16]),
"definition" => $match[17], "definition" => $match[17],
"language" => "SQL", // available in information_schema.ROUTINES.BODY_STYLE "language" => "SQL", // available in information_schema.ROUTINES.PARAMETER_STYLE
)); );
} }
/** Get list of routines /** Get list of routines
* @return array ["SPECIFIC_NAME" => , "ROUTINE_NAME" => , "ROUTINE_TYPE" => , "DTD_IDENTIFIER" => ] * @return array ("SPECIFIC_NAME" => , "ROUTINE_NAME" => , "ROUTINE_TYPE" => , "DTD_IDENTIFIER" => )
*/ */
function routines() { function routines() {
return get_rows("SELECT ROUTINE_NAME AS SPECIFIC_NAME, ROUTINE_NAME, ROUTINE_TYPE, DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = DATABASE()"); return get_rows("SELECT ROUTINE_NAME AS SPECIFIC_NAME, ROUTINE_NAME, ROUTINE_TYPE, DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q(DB));
} }
/** Get list of available routine languages /** Get list of available routine languages
@@ -1022,13 +954,14 @@ if (!defined('Adminer\DRIVER')) {
* @return string * @return string
*/ */
function last_id() { function last_id() {
return get_val("SELECT LAST_INSERT_ID()"); // mysql_insert_id() truncates bigint global $connection;
return $connection->result("SELECT LAST_INSERT_ID()"); // mysql_insert_id() truncates bigint
} }
/** Explain select /** Explain select
* @param Db * @param Min_DB
* @param string * @param string
* @return Result * @return Min_Result
*/ */
function explain($connection, $query) { function explain($connection, $query) {
return $connection->query("EXPLAIN " . (min_version(5.1) && !min_version(5.7) ? "PARTITIONS " : "") . $query); return $connection->query("EXPLAIN " . (min_version(5.1) && !min_version(5.7) ? "PARTITIONS " : "") . $query);
@@ -1043,40 +976,35 @@ if (!defined('Adminer\DRIVER')) {
return ($where || $table_status["Engine"] != "InnoDB" ? null : $table_status["Rows"]); return ($where || $table_status["Engine"] != "InnoDB" ? null : $table_status["Rows"]);
} }
/* Not used is MySQL but checked in compile.php:
/** Get user defined types /** Get user defined types
* @return array [$id => $name] * @return array
*/
function types() { function types() {
return array(); return array();
} }
/** Get values of user defined type
* @param int
* @return string
function type_values($id) {
return "";
}
/** Get existing schemas /** Get existing schemas
* @return array * @return array
*/
function schemas() { function schemas() {
return array(); return array();
} }
/** Get current schema /** Get current schema
* @return string * @return string
*/
function get_schema() { function get_schema() {
return ""; return "";
} }
/** Set current schema /** Set current schema
* @param string * @param string
* @param Db * @param Min_DB
* @return bool * @return bool
*/
function set_schema($schema, $connection2 = null) { function set_schema($schema, $connection2 = null) {
return true; return true;
} }
*/
/** Get SQL command to create table /** Get SQL command to create table
* @param string * @param string
@@ -1085,7 +1013,8 @@ if (!defined('Adminer\DRIVER')) {
* @return string * @return string
*/ */
function create_sql($table, $auto_increment, $style) { function create_sql($table, $auto_increment, $style) {
$return = get_val("SHOW CREATE TABLE " . table($table), 1); global $connection;
$return = $connection->result("SHOW CREATE TABLE " . table($table), 1);
if (!$auto_increment) { if (!$auto_increment) {
$return = preg_replace('~ AUTO_INCREMENT=\d+~', '', $return); //! skip comments $return = preg_replace('~ AUTO_INCREMENT=\d+~', '', $return); //! skip comments
} }
@@ -1121,21 +1050,21 @@ if (!defined('Adminer\DRIVER')) {
} }
/** Get server variables /** Get server variables
* @return array [$name => $value] * @return array ($name => $value)
*/ */
function show_variables() { function show_variables() {
return get_key_vals("SHOW VARIABLES"); return get_key_vals("SHOW VARIABLES");
} }
/** Get process list /** Get process list
* @return array [$row] * @return array ($row)
*/ */
function process_list() { function process_list() {
return get_rows("SHOW FULL PROCESSLIST"); return get_rows("SHOW FULL PROCESSLIST");
} }
/** Get status variables /** Get status variables
* @return array [$name => $value] * @return array ($name => $value)
*/ */
function show_status() { function show_status() {
return get_key_vals("SHOW STATUS"); return get_key_vals("SHOW STATUS");
@@ -1159,7 +1088,7 @@ if (!defined('Adminer\DRIVER')) {
/** Convert value in edit after applying functions back /** Convert value in edit after applying functions back
* @param array one element from fields() * @param array one element from fields()
* @param string SQL expression * @param string
* @return string * @return string
*/ */
function unconvert_field($field, $return) { function unconvert_field($field, $return) {
@@ -1167,7 +1096,7 @@ if (!defined('Adminer\DRIVER')) {
$return = "UNHEX($return)"; $return = "UNHEX($return)";
} }
if ($field["type"] == "bit") { if ($field["type"] == "bit") {
$return = "CONVERT(b$return, UNSIGNED)"; $return = "CONV($return, 2, 10) + 0";
} }
if (preg_match("~geometry|point|linestring|polygon~", $field["type"])) { if (preg_match("~geometry|point|linestring|polygon~", $field["type"])) {
$prefix = (min_version(8) ? "ST_" : ""); $prefix = (min_version(8) ? "ST_" : "");
@@ -1177,11 +1106,11 @@ if (!defined('Adminer\DRIVER')) {
} }
/** Check whether a feature is supported /** Check whether a feature is supported
* @param string "check", "comment", "copy", "database", "descidx", "drop_col", "dump", "event", "indexes", "kill", "materializedview", "partitioning", "privileges", "procedure", "processlist", "routine", "scheme", "sequence", "status", "table", "trigger", "type", "variables", "view", "view_trigger" * @param string "comment", "copy", "database", "descidx", "drop_col", "dump", "event", "indexes", "kill", "materializedview", "partitioning", "privileges", "procedure", "processlist", "routine", "scheme", "sequence", "status", "table", "trigger", "type", "variables", "view", "view_trigger"
* @return bool * @return bool
*/ */
function support($feature) { function support($feature) {
return !preg_match("~scheme|sequence|type|view_trigger|materializedview" . (min_version(8) ? "" : "|descidx" . (min_version(5.1) ? "" : "|event|partitioning")) . (min_version('8.0.16', '10.2.1') ? "" : "|check") . "~", $feature); return !preg_match("~scheme|sequence|type|view_trigger|materializedview" . (min_version(8) ? "" : "|descidx" . (min_version(5.1) ? "" : "|event|partitioning" . (min_version(5) ? "" : "|routine|trigger|view"))) . "~", $feature);
} }
/** Kill a process /** Kill a process
@@ -1195,7 +1124,7 @@ if (!defined('Adminer\DRIVER')) {
/** Return query to get connection ID /** Return query to get connection ID
* @return string * @return string
*/ */
function connection_id() { function connection_id(){
return "SELECT CONNECTION_ID()"; return "SELECT CONNECTION_ID()";
} }
@@ -1203,6 +1132,48 @@ if (!defined('Adminer\DRIVER')) {
* @return int * @return int
*/ */
function max_connections() { function max_connections() {
return get_val("SELECT @@max_connections"); global $connection;
return $connection->result("SELECT @@max_connections");
}
/** Get driver config
* @return array array('possible_drivers' => , 'jush' => , 'types' => , 'structured_types' => , 'unsigned' => , 'operators' => , 'functions' => , 'grouping' => , 'edit_functions' => )
*/
function driver_config() {
$types = array(); ///< @var array ($type => $maximum_unsigned_length, ...)
$structured_types = array(); ///< @var array ($description => array($type, ...), ...)
foreach (array(
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "mediumint" => 8, "int" => 10, "bigint" => 20, "decimal" => 66, "float" => 12, "double" => 21),
lang('Date and time') => array("date" => 10, "datetime" => 19, "timestamp" => 19, "time" => 10, "year" => 4),
lang('Strings') => array("char" => 255, "varchar" => 65535, "tinytext" => 255, "text" => 65535, "mediumtext" => 16777215, "longtext" => 4294967295),
lang('Lists') => array("enum" => 65535, "set" => 64),
lang('Binary') => array("bit" => 20, "binary" => 255, "varbinary" => 65535, "tinyblob" => 255, "blob" => 65535, "mediumblob" => 16777215, "longblob" => 4294967295),
lang('Geometry') => array("geometry" => 0, "point" => 0, "linestring" => 0, "polygon" => 0, "multipoint" => 0, "multilinestring" => 0, "multipolygon" => 0, "geometrycollection" => 0),
) as $key => $val) {
$types += $val;
$structured_types[$key] = array_keys($val);
}
return array(
'possible_drivers' => array("MySQLi", "MySQL", "PDO_MySQL"),
'jush' => "sql", ///< @var string JUSH identifier
'types' => $types,
'structured_types' => $structured_types,
'unsigned' => array("unsigned", "zerofill", "unsigned zerofill"), ///< @var array number variants
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL"), ///< @var array operators used in select
'functions' => array("char_length", "date", "from_unixtime", "unix_timestamp", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper"), ///< @var array functions used in select
'grouping' => array("avg", "count", "count distinct", "group_concat", "max", "min", "sum"), ///< @var array grouping functions used in select
'edit_functions' => array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only
array(
"char" => "md5/sha1/password/encrypt/uuid",
"binary" => "md5/sha1",
"date|time" => "now",
), array(
number_type() => "+/-",
"date" => "+ interval/- interval",
"time" => "addtime/subtime",
"char|text" => "concat",
)
),
);
} }
} }

View File

@@ -1,12 +1,10 @@
<?php <?php
namespace Adminer;
$drivers["oracle"] = "Oracle (beta)"; $drivers["oracle"] = "Oracle (beta)";
if (isset($_GET["oracle"])) { if (isset($_GET["oracle"])) {
define('Adminer\DRIVER', "oracle"); define("DRIVER", "oracle");
if (extension_loaded("oci8")) { if (extension_loaded("oci8")) {
class Db { class Min_DB {
var $extension = "oci8", $_link, $_result, $server_info, $affected_rows, $errno, $error; var $extension = "oci8", $_link, $_result, $server_info, $affected_rows, $errno, $error;
var $_current_db; var $_current_db;
@@ -52,7 +50,7 @@ if (isset($_GET["oracle"])) {
restore_error_handler(); restore_error_handler();
if ($return) { if ($return) {
if (oci_num_fields($result)) { if (oci_num_fields($result)) {
return new Result($result); return new Min_Result($result);
} }
$this->affected_rows = oci_num_rows($result); $this->affected_rows = oci_num_rows($result);
oci_free_statement($result); oci_free_statement($result);
@@ -72,16 +70,16 @@ if (isset($_GET["oracle"])) {
return false; return false;
} }
function result($query, $field = 0) { function result($query, $field = 1) {
$result = $this->query($query); $result = $this->query($query);
if (!is_object($result) || !oci_fetch($result->_result)) { if (!is_object($result) || !oci_fetch($result->_result)) {
return false; return false;
} }
return oci_result($result->_result, $field + 1); return oci_result($result->_result, $field);
} }
} }
class Result { class Min_Result {
var $_result, $_offset = 1, $num_rows; var $_result, $_offset = 1, $num_rows;
function __construct($result) { function __construct($result) {
@@ -107,7 +105,7 @@ if (isset($_GET["oracle"])) {
function fetch_field() { function fetch_field() {
$column = $this->_offset++; $column = $this->_offset++;
$return = new \stdClass; $return = new stdClass;
$return->name = oci_field_name($this->_result, $column); $return->name = oci_field_name($this->_result, $column);
$return->orgname = $return->name; $return->orgname = $return->name;
$return->type = oci_field_type($this->_result, $column); $return->type = oci_field_type($this->_result, $column);
@@ -121,7 +119,7 @@ if (isset($_GET["oracle"])) {
} }
} elseif (extension_loaded("pdo_oci")) { } elseif (extension_loaded("pdo_oci")) {
class Db extends PdoDb { class Min_DB extends Min_PDO {
var $extension = "PDO_OCI"; var $extension = "PDO_OCI";
var $_current_db; var $_current_db;
@@ -140,34 +138,7 @@ if (isset($_GET["oracle"])) {
class Driver extends SqlDriver { class Min_Driver extends Min_SQL {
static $possibleDrivers = array("OCI8", "PDO_OCI");
static $jush = "oracle";
var $editFunctions = array(
array( //! no parentheses
"date" => "current_date",
"timestamp" => "current_timestamp",
), array(
"number|float|double" => "+/-",
"date|timestamp" => "+ interval/- interval",
"char|clob" => "||",
)
);
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL");
var $functions = array("length", "lower", "round", "upper");
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
function __construct($connection) {
parent::__construct($connection);
$this->types = array(
lang('Numbers') => array("number" => 38, "binary_float" => 12, "binary_double" => 21),
lang('Date and time') => array("date" => 10, "timestamp" => 29, "interval year" => 12, "interval day" => 28), //! year(), day() to second()
lang('Strings') => array("char" => 2000, "varchar2" => 4000, "nchar" => 2000, "nvarchar2" => 4000, "clob" => 4294967295, "nclob" => 4294967295),
lang('Binary') => array("raw" => 2000, "long raw" => 2147483648, "blob" => 4294967295, "bfile" => 4294967296),
);
}
//! support empty $set in insert() //! support empty $set in insert()
@@ -186,22 +157,24 @@ if (isset($_GET["oracle"])) {
$where[] = "$key = $val"; $where[] = "$key = $val";
} }
} }
if ( if (!(($where && queries("UPDATE " . table($table) . " SET " . implode(", ", $update) . " WHERE " . implode(" AND ", $where)) && $connection->affected_rows)
!(($where && queries("UPDATE " . table($table) . " SET " . implode(", ", $update) . " WHERE " . implode(" AND ", $where)) && $connection->affected_rows) || queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")")
|| queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")")) )) {
) {
return false; return false;
} }
} }
return true; return true;
} }
function hasCStyleEscapes() {
return true;
}
} }
/**
* @param string $hostPath
* @return bool
*/
function is_server_host_valid($hostPath) {
// EasyConnect host+path format: host[/[service_name][:server_type][/instance_name]]
return (bool)preg_match('~^[^/]+(/([^/:]+)?(:[^/:]+)?(/[^/:]+)?)?$~', $hostPath);
}
function idf_escape($idf) { function idf_escape($idf) {
return '"' . str_replace('"', '""', $idf) . '"'; return '"' . str_replace('"', '""', $idf) . '"';
@@ -211,8 +184,10 @@ if (isset($_GET["oracle"])) {
return idf_escape($idf); return idf_escape($idf);
} }
function connect($credentials) { function connect() {
$connection = new Db; global $adminer;
$connection = new Min_DB;
$credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) { if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
return $connection; return $connection;
} }
@@ -220,13 +195,7 @@ if (isset($_GET["oracle"])) {
} }
function get_databases() { function get_databases() {
return get_vals( return get_vals("SELECT tablespace_name FROM user_tablespaces ORDER BY 1");
"SELECT DISTINCT tablespace_name FROM (
SELECT tablespace_name FROM user_tablespaces
UNION SELECT tablespace_name FROM all_tables WHERE tablespace_name IS NOT NULL
)
ORDER BY 1"
);
} }
function limit($query, $where, $limit, $offset = 0, $separator = " ") { function limit($query, $where, $limit, $offset = 0, $separator = " ") {
@@ -241,7 +210,8 @@ ORDER BY 1"
} }
function db_collation($db, $collations) { function db_collation($db, $collations) {
return get_val("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'"); //! respect $db global $connection;
return $connection->result("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'"); //! respect $db
} }
function engines() { function engines() {
@@ -249,12 +219,13 @@ ORDER BY 1"
} }
function logged_user() { function logged_user() {
return get_val("SELECT USER FROM DUAL"); global $connection;
return $connection->result("SELECT USER FROM DUAL");
} }
function get_current_db() { function get_current_db() {
global $connection; global $connection;
$db = $connection->_current_db ?: DB; $db = $connection->_current_db ? $connection->_current_db : DB;
unset($connection->_current_db); unset($connection->_current_db);
return $db; return $db;
} }
@@ -268,23 +239,23 @@ ORDER BY 1"
function views_table($columns) { function views_table($columns) {
$owner = where_owner(''); $owner = where_owner('');
return "(SELECT $columns FROM all_views WHERE " . ($owner ?: "rownum < 0") . ")"; return "(SELECT $columns FROM all_views WHERE " . ($owner ? $owner : "rownum < 0") . ")";
} }
function tables_list() { function tables_list() {
$view = views_table("view_name"); $view = views_table("view_name");
$owner = where_owner(" AND "); $owner = where_owner(" AND ");
return get_key_vals( return get_key_vals("SELECT table_name, 'table' FROM all_tables WHERE tablespace_name = " . q(DB) . "$owner
"SELECT table_name, 'table' FROM all_tables WHERE tablespace_name = " . q(DB) . "$owner
UNION SELECT view_name, 'view' FROM $view UNION SELECT view_name, 'view' FROM $view
ORDER BY 1" ORDER BY 1"
); //! views don't have schema ); //! views don't have schema
} }
function count_tables($databases) { function count_tables($databases) {
global $connection;
$return = array(); $return = array();
foreach ($databases as $db) { foreach ($databases as $db) {
$return[$db] = get_val("SELECT COUNT(*) FROM all_tables WHERE tablespace_name = " . q($db)); $return[$db] = $connection->result("SELECT COUNT(*) FROM all_tables WHERE tablespace_name = " . q($db));
} }
return $return; return $return;
} }
@@ -295,11 +266,10 @@ ORDER BY 1"
$db = get_current_db(); $db = get_current_db();
$view = views_table("view_name"); $view = views_table("view_name");
$owner = where_owner(" AND "); $owner = where_owner(" AND ");
foreach ( foreach (get_rows('SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = ' . q($db) . $owner . ($name != "" ? " AND table_name = $search" : "") . "
get_rows('SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = ' . q($db) . $owner . ($name != "" ? " AND table_name = $search" : "") . "
UNION SELECT view_name, 'view', 0, 0 FROM $view" . ($name != "" ? " WHERE view_name = $search" : "") . " UNION SELECT view_name, 'view', 0, 0 FROM $view" . ($name != "" ? " WHERE view_name = $search" : "") . "
ORDER BY 1") as $row ORDER BY 1"
) { ) as $row) {
if ($name != "") { if ($name != "") {
return $row; return $row;
} }
@@ -345,14 +315,12 @@ ORDER BY 1") as $row
function indexes($table, $connection2 = null) { function indexes($table, $connection2 = null) {
$return = array(); $return = array();
$owner = where_owner(" AND ", "aic.table_owner"); $owner = where_owner(" AND ", "aic.table_owner");
foreach ( foreach (get_rows("SELECT aic.*, ac.constraint_type, atc.data_default
get_rows("SELECT aic.*, ac.constraint_type, atc.data_default
FROM all_ind_columns aic FROM all_ind_columns aic
LEFT JOIN all_constraints ac ON aic.index_name = ac.constraint_name AND aic.table_name = ac.table_name AND aic.index_owner = ac.owner LEFT JOIN all_constraints ac ON aic.index_name = ac.constraint_name AND aic.table_name = ac.table_name AND aic.index_owner = ac.owner
LEFT JOIN all_tab_cols atc ON aic.column_name = atc.column_name AND aic.table_name = atc.table_name AND aic.index_owner = atc.owner LEFT JOIN all_tab_cols atc ON aic.column_name = atc.column_name AND aic.table_name = atc.table_name AND aic.index_owner = atc.owner
WHERE aic.table_name = " . q($table) . "$owner WHERE aic.table_name = " . q($table) . "$owner
ORDER BY ac.constraint_type, aic.column_position", $connection2) as $row ORDER BY ac.constraint_type, aic.column_position", $connection2) as $row) {
) {
$index_name = $row["INDEX_NAME"]; $index_name = $row["INDEX_NAME"];
$column_name = $row["DATA_DEFAULT"]; $column_name = $row["DATA_DEFAULT"];
$column_name = ($column_name ? trim($column_name, '"') : $row["COLUMN_NAME"]); // trim - possibly wrapped in quotes but never contains quotes inside $column_name = ($column_name ? trim($column_name, '"') : $row["COLUMN_NAME"]); // trim - possibly wrapped in quotes but never contains quotes inside
@@ -375,7 +343,7 @@ ORDER BY ac.constraint_type, aic.column_position", $connection2) as $row
} }
function information_schema($db) { function information_schema($db) {
return get_schema() == "INFORMATION_SCHEMA"; return false;
} }
function error() { function error() {
@@ -498,11 +466,12 @@ AND c_src.TABLE_NAME = " . q($table);
function schemas() { function schemas() {
$return = get_vals("SELECT DISTINCT owner FROM dba_segments WHERE owner IN (SELECT username FROM dba_users WHERE default_tablespace NOT IN ('SYSTEM','SYSAUX')) ORDER BY 1"); $return = get_vals("SELECT DISTINCT owner FROM dba_segments WHERE owner IN (SELECT username FROM dba_users WHERE default_tablespace NOT IN ('SYSTEM','SYSAUX')) ORDER BY 1");
return ($return ?: get_vals("SELECT DISTINCT owner FROM all_tables WHERE tablespace_name = " . q(DB) . " ORDER BY 1")); return ($return ? $return : get_vals("SELECT DISTINCT owner FROM all_tables WHERE tablespace_name = " . q(DB) . " ORDER BY 1"));
} }
function get_schema() { function get_schema() {
return get_val("SELECT sys_context('USERENV', 'SESSION_USER') FROM dual"); global $connection;
return $connection->result("SELECT sys_context('USERENV', 'SESSION_USER') FROM dual");
} }
function set_schema($scheme, $connection2 = null) { function set_schema($scheme, $connection2 = null) {
@@ -541,4 +510,38 @@ ORDER BY PROCESS
function support($feature) { function support($feature) {
return preg_match('~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view)$~', $feature); //! return preg_match('~^(columns|database|drop_col|indexes|descidx|processlist|scheme|sql|status|table|variables|view)$~', $feature); //!
} }
function driver_config() {
$types = array();
$structured_types = array();
foreach (array(
lang('Numbers') => array("number" => 38, "binary_float" => 12, "binary_double" => 21),
lang('Date and time') => array("date" => 10, "timestamp" => 29, "interval year" => 12, "interval day" => 28), //! year(), day() to second()
lang('Strings') => array("char" => 2000, "varchar2" => 4000, "nchar" => 2000, "nvarchar2" => 4000, "clob" => 4294967295, "nclob" => 4294967295),
lang('Binary') => array("raw" => 2000, "long raw" => 2147483648, "blob" => 4294967295, "bfile" => 4294967296),
) as $key => $val) {
$types += $val;
$structured_types[$key] = array_keys($val);
}
return array(
'possible_drivers' => array("OCI8", "PDO_OCI"),
'jush' => "oracle",
'types' => $types,
'structured_types' => $structured_types,
'unsigned' => array(),
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL"),
'functions' => array("length", "lower", "round", "upper"),
'grouping' => array("avg", "count", "count distinct", "max", "min", "sum"),
'edit_functions' => array(
array( //! no parentheses
"date" => "current_date",
"timestamp" => "current_timestamp",
), array(
"number|float|double" => "+/-",
"date|timestamp" => "+ interval/- interval",
"char|clob" => "||",
)
),
);
}
} }

View File

@@ -1,12 +1,10 @@
<?php <?php
namespace Adminer;
$drivers["pgsql"] = "PostgreSQL"; $drivers["pgsql"] = "PostgreSQL";
if (isset($_GET["pgsql"])) { if (isset($_GET["pgsql"])) {
define('Adminer\DRIVER', "pgsql"); define("DRIVER", "pgsql");
if (extension_loaded("pgsql")) { if (extension_loaded("pgsql")) {
class Db { class Min_DB {
var $extension = "PgSQL", $_link, $_result, $_string, $_database = true, $server_info, $affected_rows, $error, $timeout; var $extension = "PgSQL", $_link, $_result, $_string, $_database = true, $server_info, $affected_rows, $error, $timeout;
function _error($errno, $error) { function _error($errno, $error) {
@@ -22,10 +20,6 @@ if (isset($_GET["pgsql"])) {
$db = $adminer->database(); $db = $adminer->database();
set_error_handler(array($this, '_error')); set_error_handler(array($this, '_error'));
$this->_string = "host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' user='" . addcslashes($username, "'\\") . "' password='" . addcslashes($password, "'\\") . "'"; $this->_string = "host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' user='" . addcslashes($username, "'\\") . "' password='" . addcslashes($password, "'\\") . "'";
$ssl = $adminer->connectSsl();
if (isset($ssl["mode"])) {
$this->_string .= " sslmode='" . $ssl["mode"] . "'";
}
$this->_link = @pg_connect("$this->_string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'", PGSQL_CONNECT_FORCE_NEW); $this->_link = @pg_connect("$this->_string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'", PGSQL_CONNECT_FORCE_NEW);
if (!$this->_link && $db != "") { if (!$this->_link && $db != "") {
// try to connect directly with database for performance // try to connect directly with database for performance
@@ -42,7 +36,7 @@ if (isset($_GET["pgsql"])) {
} }
function quote($string) { function quote($string) {
return pg_escape_literal($this->_link, $string); return "'" . pg_escape_string($this->_link, $string) . "'";
} }
function value($val, $field) { function value($val, $field) {
@@ -79,7 +73,7 @@ if (isset($_GET["pgsql"])) {
$this->affected_rows = pg_affected_rows($result); $this->affected_rows = pg_affected_rows($result);
$return = true; $return = true;
} else { } else {
$return = new Result($result); $return = new Min_Result($result);
} }
if ($this->timeout) { if ($this->timeout) {
$this->timeout = 0; $this->timeout = 0;
@@ -114,7 +108,7 @@ if (isset($_GET["pgsql"])) {
} }
} }
class Result { class Min_Result {
var $_result, $_offset = 0, $num_rows; var $_result, $_offset = 0, $num_rows;
function __construct($result) { function __construct($result) {
@@ -132,7 +126,7 @@ if (isset($_GET["pgsql"])) {
function fetch_field() { function fetch_field() {
$column = $this->_offset++; $column = $this->_offset++;
$return = new \stdClass; $return = new stdClass;
if (function_exists('pg_field_table')) { if (function_exists('pg_field_table')) {
$return->orgtable = pg_field_table($this->_result, $column); $return->orgtable = pg_field_table($this->_result, $column);
} }
@@ -149,19 +143,14 @@ if (isset($_GET["pgsql"])) {
} }
} elseif (extension_loaded("pdo_pgsql")) { } elseif (extension_loaded("pdo_pgsql")) {
class Db extends PdoDb { class Min_DB extends Min_PDO {
var $extension = "PDO_PgSQL", $timeout; var $extension = "PDO_PgSQL", $timeout;
function connect($server, $username, $password) { function connect($server, $username, $password) {
global $adminer; global $adminer;
$db = $adminer->database(); $db = $adminer->database();
//! client_encoding is supported since 9.1, but we can't yet use min_version here $this->dsn("pgsql:host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' client_encoding=utf8 dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'", $username, $password); //! client_encoding is supported since 9.1 but we can't yet use min_version here
$dsn = "pgsql:host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' client_encoding=utf8 dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'"; //! connect without DB in case of an error
$ssl = $adminer->connectSsl();
if (isset($ssl["mode"])) {
$dsn .= " sslmode='" . $ssl["mode"] . "'";
}
$this->dsn($dsn, $username, $password);
return true; return true;
} }
@@ -195,53 +184,7 @@ if (isset($_GET["pgsql"])) {
class Driver extends SqlDriver { class Min_Driver extends Min_SQL {
static $possibleDrivers = array("PgSQL", "PDO_PgSQL");
static $jush = "pgsql";
var $operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid CSRF
var $functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper");
var $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
function __construct($connection) {
parent::__construct($connection);
$this->types = array( //! arrays
lang('Numbers') => array("smallint" => 5, "integer" => 10, "bigint" => 19, "boolean" => 1, "numeric" => 0, "real" => 7, "double precision" => 16, "money" => 20),
lang('Date and time') => array("date" => 13, "time" => 17, "timestamp" => 20, "timestamptz" => 21, "interval" => 0),
lang('Strings') => array("character" => 0, "character varying" => 0, "text" => 0, "tsquery" => 0, "tsvector" => 0, "uuid" => 0, "xml" => 0),
lang('Binary') => array("bit" => 0, "bit varying" => 0, "bytea" => 0),
lang('Network') => array("cidr" => 43, "inet" => 43, "macaddr" => 17, "macaddr8" => 23, "txid_snapshot" => 0),
lang('Geometry') => array("box" => 0, "circle" => 0, "line" => 0, "lseg" => 0, "path" => 0, "point" => 0, "polygon" => 0),
);
if (min_version(9.2, 0, $connection)) {
$this->types[lang('Strings')]["json"] = 4294967295;
if (min_version(9.4, 0, $connection)) {
$this->types[lang('Strings')]["jsonb"] = 4294967295;
}
}
$this->editFunctions = array(
array(
"char" => "md5",
"date|time" => "now",
), array(
number_type() => "+/-",
"date|time" => "+ interval/- interval", //! escape
"char|text" => "||",
)
);
if (min_version(12, 0, $connection)) {
$this->generated = array("STORED");
}
}
function enumLength($field) {
$enum = $this->types[lang('User types')][$field["type"]];
return ($enum ? type_values($enum) : "");
}
function setUserTypes($types) {
$this->types[lang('User types')] = array_flip($types);
}
function insertUpdate($table, $rows, $primary) { function insertUpdate($table, $rows, $primary) {
global $connection; global $connection;
@@ -254,10 +197,9 @@ if (isset($_GET["pgsql"])) {
$where[] = "$key = $val"; $where[] = "$key = $val";
} }
} }
if ( if (!(($where && queries("UPDATE " . table($table) . " SET " . implode(", ", $update) . " WHERE " . implode(" AND ", $where)) && $connection->affected_rows)
!(($where && queries("UPDATE " . table($table) . " SET " . implode(", ", $update) . " WHERE " . implode(" AND ", $where)) && $connection->affected_rows) || queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")")
|| queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")")) )) {
) {
return false; return false;
} }
} }
@@ -271,12 +213,12 @@ if (isset($_GET["pgsql"])) {
} }
function convertSearch($idf, $val, $field) { function convertSearch($idf, $val, $field) {
$textTypes = "char|text"; return (preg_match('~char|text'
if (strpos($val["op"], "LIKE") === false) { . (!preg_match('~LIKE~', $val["op"]) ? '|date|time(stamp)?|boolean|uuid|' . number_type() : '')
$textTypes .= "|date|time(stamp)?|boolean|uuid|inet|cidr|macaddr|" . number_type(); . '~', $field["type"])
} ? $idf
: "CAST($idf AS text)"
return (preg_match("~$textTypes~", $field["type"]) ? $idf : "CAST($idf AS text)"); );
} }
function quoteBinary($s) { function quoteBinary($s) {
@@ -287,10 +229,10 @@ if (isset($_GET["pgsql"])) {
return $this->_conn->warnings(); return $this->_conn->warnings();
} }
function tableHelp($name, $is_view = false) { function tableHelp($name) {
$links = array( $links = array(
"information_schema" => "infoschema", "information_schema" => "infoschema",
"pg_catalog" => ($is_view ? "view" : "catalog"), "pg_catalog" => "catalog",
); );
$link = $links[$_GET["ns"]]; $link = $links[$_GET["ns"]];
if ($link) { if ($link) {
@@ -298,17 +240,6 @@ if (isset($_GET["pgsql"])) {
} }
} }
function supportsIndex($table_status) {
return $table_status["Engine"] != "view";
}
function hasCStyleEscapes() {
static $c_style;
if ($c_style === null) {
$c_style = ($this->_conn->result("SHOW standard_conforming_strings") == "off");
}
return $c_style;
}
} }
@@ -321,11 +252,21 @@ if (isset($_GET["pgsql"])) {
return idf_escape($idf); return idf_escape($idf);
} }
function connect($credentials) { function connect() {
$connection = new Db; global $adminer, $types, $structured_types;
$connection = new Min_DB;
$credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) { if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
if (min_version(9, 0, $connection)) { if (min_version(9, 0, $connection)) {
$connection->query("SET application_name = 'Adminer'"); $connection->query("SET application_name = 'Adminer'");
if (min_version(9.2, 0, $connection)) {
$structured_types[lang('Strings')][] = "json";
$types["json"] = 4294967295;
if (min_version(9.4, 0, $connection)) {
$structured_types[lang('Strings')][] = "jsonb";
$types["jsonb"] = 4294967295;
}
}
} }
return $connection; return $connection;
} }
@@ -333,9 +274,9 @@ if (isset($_GET["pgsql"])) {
} }
function get_databases() { function get_databases() {
return get_vals("SELECT datname FROM pg_database return get_vals("SELECT d.datname FROM pg_database d JOIN pg_roles r ON d.datdba = r.oid
WHERE datallowconn = TRUE AND has_database_privilege(datname, 'CONNECT') WHERE d.datallowconn = TRUE AND has_database_privilege(d.datname, 'CONNECT') AND pg_has_role(r.rolname, 'USAGE')
ORDER BY datname"); ORDER BY d.datname");
} }
function limit($query, $where, $limit, $offset = 0, $separator = " ") { function limit($query, $where, $limit, $offset = 0, $separator = " ") {
@@ -350,7 +291,8 @@ ORDER BY datname");
} }
function db_collation($db, $collations) { function db_collation($db, $collations) {
return get_val("SELECT datcollate FROM pg_database WHERE datname = " . q($db)); global $connection;
return $connection->result("SELECT datcollate FROM pg_database WHERE datname = " . q($db));
} }
function engines() { function engines() {
@@ -358,12 +300,13 @@ ORDER BY datname");
} }
function logged_user() { function logged_user() {
return get_val("SELECT user"); global $connection;
return $connection->result("SELECT user");
} }
function tables_list() { function tables_list() {
$query = "SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema()"; $query = "SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema()";
if (support("materializedview")) { if (support('materializedview')) { // ' - support("materializedview") could be removed by compile.php
$query .= " $query .= "
UNION ALL UNION ALL
SELECT matviewname, 'MATERIALIZED VIEW' SELECT matviewname, 'MATERIALIZED VIEW'
@@ -376,38 +319,17 @@ ORDER BY 1";
} }
function count_tables($databases) { function count_tables($databases) {
global $connection; return array(); // would require reconnect
$return = array();
foreach ($databases as $db) {
if ($connection->select_db($db)) {
$return[$db] = count(tables_list());
}
}
return $return;
} }
function table_status($name = "") { function table_status($name = "") {
static $has_size;
if ($has_size === null) {
// https://github.com/cockroachdb/cockroach/issues/40391
$has_size = get_val("SELECT 'pg_table_size'::regproc");
}
$return = array(); $return = array();
foreach ( foreach (get_rows("SELECT c.relname AS \"Name\", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\", pg_table_size(c.oid) AS \"Data_length\", pg_indexes_size(c.oid) AS \"Index_length\", obj_description(c.oid, 'pg_class') AS \"Comment\", " . (min_version(12) ? "''" : "CASE WHEN c.relhasoids THEN 'oid' ELSE '' END") . " AS \"Oid\", c.reltuples as \"Rows\", n.nspname
get_rows("SELECT
c.relname AS \"Name\",
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\"" . ($has_size ? ",
pg_table_size(c.oid) AS \"Data_length\",
pg_indexes_size(c.oid) AS \"Index_length\"" : "") . ",
obj_description(c.oid, 'pg_class') AS \"Comment\",
" . (min_version(12) ? "''" : "CASE WHEN c.relhasoids THEN 'oid' ELSE '' END") . " AS \"Oid\",
c.reltuples as \"Rows\",
n.nspname
FROM pg_class c FROM pg_class c
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace) JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
WHERE relkind IN ('r', 'm', 'v', 'f', 'p') WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
" . ($name != "" ? "AND relname = " . q($name) : "ORDER BY relname")) as $row //! Index_length, Auto_increment " . ($name != "" ? "AND relname = " . q($name) : "ORDER BY relname")
) { ) as $row) { //! Index_length, Auto_increment
$return[$row["Name"]] = $row; $return[$row["Name"]] = $row;
} }
return ($name != "" ? $return[$name] : $return); return ($name != "" ? $return[$name] : $return);
@@ -427,8 +349,8 @@ WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
'timestamp without time zone' => 'timestamp', 'timestamp without time zone' => 'timestamp',
'timestamp with time zone' => 'timestamptz', 'timestamp with time zone' => 'timestamptz',
); );
foreach (
get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, pg_get_expr(d.adbin, d.adrelid) AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment" . (min_version(10) ? ", a.attidentity" . (min_version(12) ? ", a.attgenerated" : "") : "") . " foreach (get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, pg_get_expr(d.adbin, d.adrelid) AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment" . (min_version(10) ? ", a.attidentity" : "") . "
FROM pg_class c FROM pg_class c
JOIN pg_namespace n ON c.relnamespace = n.oid JOIN pg_namespace n ON c.relnamespace = n.oid
JOIN pg_attribute a ON c.oid = a.attrelid JOIN pg_attribute a ON c.oid = a.attrelid
@@ -437,8 +359,8 @@ WHERE c.relname = " . q($table) . "
AND n.nspname = current_schema() AND n.nspname = current_schema()
AND NOT a.attisdropped AND NOT a.attisdropped
AND a.attnum > 0 AND a.attnum > 0
ORDER BY a.attnum") as $row ORDER BY a.attnum"
) { ) as $row) {
//! collation, primary //! collation, primary
preg_match('~([^([]+)(\((.*)\))?([a-z ]+)?((\[[0-9]*])*)$~', $row["full_type"], $match); preg_match('~([^([]+)(\((.*)\))?([a-z ]+)?((\[[0-9]*])*)$~', $row["full_type"], $match);
list(, $type, $length, $row["length"], $addon, $array) = $match; list(, $type, $length, $row["length"], $addon, $array) = $match;
@@ -454,7 +376,6 @@ ORDER BY a.attnum") as $row
if (in_array($row['attidentity'], array('a', 'd'))) { if (in_array($row['attidentity'], array('a', 'd'))) {
$row['default'] = 'GENERATED ' . ($row['attidentity'] == 'd' ? 'BY DEFAULT' : 'ALWAYS') . ' AS IDENTITY'; $row['default'] = 'GENERATED ' . ($row['attidentity'] == 'd' ? 'BY DEFAULT' : 'ALWAYS') . ' AS IDENTITY';
} }
$row["generated"] = ($row["attgenerated"] == "s" ? "STORED" : "");
$row["null"] = !$row["attnotnull"]; $row["null"] = !$row["attnotnull"];
$row["auto_increment"] = $row['attidentity'] || preg_match('~^nextval\(~i', $row["default"]); $row["auto_increment"] = $row['attidentity'] || preg_match('~^nextval\(~i', $row["default"]);
$row["privileges"] = array("insert" => 1, "select" => 1, "update" => 1); $row["privileges"] = array("insert" => 1, "select" => 1, "update" => 1);
@@ -474,18 +395,16 @@ ORDER BY a.attnum") as $row
$return = array(); $return = array();
$table_oid = $connection2->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q($table)); $table_oid = $connection2->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q($table));
$columns = get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $table_oid AND attnum > 0", $connection2); $columns = get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $table_oid AND attnum > 0", $connection2);
foreach (get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption, (indpred IS NOT NULL)::int as indispartial FROM pg_index i, pg_class ci WHERE i.indrelid = $table_oid AND ci.oid = i.indexrelid ORDER BY indisprimary DESC, indisunique DESC", $connection2) as $row) { foreach (get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption, (indpred IS NOT NULL)::int as indispartial FROM pg_index i, pg_class ci WHERE i.indrelid = $table_oid AND ci.oid = i.indexrelid", $connection2) as $row) {
$relname = $row["relname"]; $relname = $row["relname"];
$return[$relname]["type"] = ($row["indispartial"] ? "INDEX" : ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX"))); $return[$relname]["type"] = ($row["indispartial"] ? "INDEX" : ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX")));
$return[$relname]["columns"] = array(); $return[$relname]["columns"] = array();
foreach (explode(" ", $row["indkey"]) as $indkey) {
$return[$relname]["columns"][] = $columns[$indkey];
}
$return[$relname]["descs"] = array(); $return[$relname]["descs"] = array();
if ($row["indkey"]) { foreach (explode(" ", $row["indoption"]) as $indoption) {
foreach (explode(" ", $row["indkey"]) as $indkey) { $return[$relname]["descs"][] = ($indoption & 1 ? '1' : null); // 1 - INDOPTION_DESC
$return[$relname]["columns"][] = $columns[$indkey];
}
foreach (explode(" ", $row["indoption"]) as $indoption) {
$return[$relname]["descs"][] = ($indoption & 1 ? '1' : null); // 1 - INDOPTION_DESC
}
} }
$return[$relname]["lengths"] = array(); $return[$relname]["lengths"] = array();
} }
@@ -493,32 +412,48 @@ ORDER BY a.attnum") as $row
} }
function foreign_keys($table) { function foreign_keys($table) {
global $driver; global $on_actions;
$return = array(); $return = array();
foreach ( foreach (get_rows("SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
get_rows("SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
FROM pg_constraint FROM pg_constraint
WHERE conrelid = (SELECT pc.oid FROM pg_class AS pc INNER JOIN pg_namespace AS pn ON (pn.oid = pc.relnamespace) WHERE pc.relname = " . q($table) . " AND pn.nspname = current_schema()) WHERE conrelid = (SELECT pc.oid FROM pg_class AS pc INNER JOIN pg_namespace AS pn ON (pn.oid = pc.relnamespace) WHERE pc.relname = " . q($table) . " AND pn.nspname = current_schema())
AND contype = 'f'::char AND contype = 'f'::char
ORDER BY conkey, conname") as $row ORDER BY conkey, conname") as $row) {
) {
if (preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA', $row['definition'], $match)) { if (preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA', $row['definition'], $match)) {
$row['source'] = array_map('Adminer\idf_unescape', array_map('trim', explode(',', $match[1]))); $row['source'] = array_map('idf_unescape', array_map('trim', explode(',', $match[1])));
if (preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~', $match[2], $match2)) { if (preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~', $match[2], $match2)) {
$row['ns'] = idf_unescape($match2[2]); $row['ns'] = idf_unescape($match2[2]);
$row['table'] = idf_unescape($match2[4]); $row['table'] = idf_unescape($match2[4]);
} }
$row['target'] = array_map('Adminer\idf_unescape', array_map('trim', explode(',', $match[3]))); $row['target'] = array_map('idf_unescape', array_map('trim', explode(',', $match[3])));
$row['on_delete'] = (preg_match("~ON DELETE ($driver->onActions)~", $match[4], $match2) ? $match2[1] : 'NO ACTION'); $row['on_delete'] = (preg_match("~ON DELETE ($on_actions)~", $match[4], $match2) ? $match2[1] : 'NO ACTION');
$row['on_update'] = (preg_match("~ON UPDATE ($driver->onActions)~", $match[4], $match2) ? $match2[1] : 'NO ACTION'); $row['on_update'] = (preg_match("~ON UPDATE ($on_actions)~", $match[4], $match2) ? $match2[1] : 'NO ACTION');
$return[$row['conname']] = $row; $return[$row['conname']] = $row;
} }
} }
return $return; return $return;
} }
function constraints($table) {
global $on_actions;
$return = array();
foreach (get_rows("SELECT conname, consrc
FROM pg_catalog.pg_constraint
INNER JOIN pg_catalog.pg_namespace ON pg_constraint.connamespace = pg_namespace.oid
INNER JOIN pg_catalog.pg_class ON pg_constraint.conrelid = pg_class.oid AND pg_constraint.connamespace = pg_class.relnamespace
WHERE pg_constraint.contype = 'c'
AND conrelid != 0 -- handle only CONSTRAINTs here, not TYPES
AND nspname = current_schema()
AND relname = " . q($table) . "
ORDER BY connamespace, conname") as $row) {
$return[$row['conname']] = $row['consrc'];
}
return $return;
}
function view($name) { function view($name) {
return array("select" => trim(get_val("SELECT pg_get_viewdef(" . get_val("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q($name)) . ")"))); global $connection;
return array("select" => trim($connection->result("SELECT pg_get_viewdef(" . $connection->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q($name)) . ")")));
} }
function collations() { function collations() {
@@ -527,7 +462,7 @@ ORDER BY conkey, conname") as $row
} }
function information_schema($db) { function information_schema($db) {
return get_schema() == "information_schema"; return ($db == "information_schema");
} }
function error() { function error() {
@@ -546,12 +481,11 @@ ORDER BY conkey, conname") as $row
function drop_databases($databases) { function drop_databases($databases) {
global $connection; global $connection;
$connection->close(); $connection->close();
return apply_queries("DROP DATABASE", $databases, 'Adminer\idf_escape'); return apply_queries("DROP DATABASE", $databases, 'idf_escape');
} }
function rename_database($name, $collation) { function rename_database($name, $collation) {
global $connection; //! current database cannot be renamed
$connection->close();
return queries("ALTER DATABASE " . idf_escape(DB) . " RENAME TO " . idf_escape($name)); return queries("ALTER DATABASE " . idf_escape(DB) . " RENAME TO " . idf_escape($name));
} }
@@ -565,7 +499,6 @@ ORDER BY conkey, conname") as $row
if ($table != "" && $table != $name) { if ($table != "" && $table != $name) {
$queries[] = "ALTER TABLE " . table($table) . " RENAME TO " . table($name); $queries[] = "ALTER TABLE " . table($table) . " RENAME TO " . table($name);
} }
$sequence = "";
foreach ($fields as $field) { foreach ($fields as $field) {
$column = idf_escape($field[0]); $column = idf_escape($field[0]);
$val = $field[1]; $val = $field[1];
@@ -587,15 +520,10 @@ ORDER BY conkey, conname") as $row
$queries[] = "ALTER TABLE " . table($name) . " RENAME $column TO $val[0]"; $queries[] = "ALTER TABLE " . table($name) . " RENAME $column TO $val[0]";
} }
$alter[] = "ALTER $column TYPE$val[1]"; $alter[] = "ALTER $column TYPE$val[1]";
$sequence_name = $table . "_" . idf_unescape($val[0]) . "_seq"; if (!$val[6]) {
$alter[] = "ALTER $column " . ($val[3] ? "SET" . preg_replace('~GENERATED ALWAYS(.*) STORED~', 'EXPRESSION\1', $val[3]) $alter[] = "ALTER $column " . ($val[3] ? "SET$val[3]" : "DROP DEFAULT");
: (isset($val[6]) ? "SET DEFAULT nextval(" . q($sequence_name) . ")" $alter[] = "ALTER $column " . ($val[2] == " NULL" ? "DROP NOT" : "SET") . $val[2];
: "DROP DEFAULT" //! change to DROP EXPRESSION with generated columns
));
if (isset($val[6])) {
$sequence = "CREATE SEQUENCE IF NOT EXISTS " . idf_escape($sequence_name) . " OWNED BY " . idf_escape($table) . ".$val[0]";
} }
$alter[] = "ALTER $column " . ($val[2] == " NULL" ? "DROP NOT" : "SET") . $val[2];
} }
if ($field[0] != "" || $val5 != "") { if ($field[0] != "" || $val5 != "") {
$queries[] = "COMMENT ON COLUMN " . table($name) . ".$val[0] IS " . ($val5 != "" ? substr($val5, 9) : "''"); $queries[] = "COMMENT ON COLUMN " . table($name) . ".$val[0] IS " . ($val5 != "" ? substr($val5, 9) : "''");
@@ -608,15 +536,12 @@ ORDER BY conkey, conname") as $row
} elseif ($alter) { } elseif ($alter) {
array_unshift($queries, "ALTER TABLE " . table($table) . "\n" . implode(",\n", $alter)); array_unshift($queries, "ALTER TABLE " . table($table) . "\n" . implode(",\n", $alter));
} }
if ($sequence) {
array_unshift($queries, $sequence);
}
if ($comment !== null) { if ($comment !== null) {
$queries[] = "COMMENT ON TABLE " . table($name) . " IS " . q($comment); $queries[] = "COMMENT ON TABLE " . table($name) . " IS " . q($comment);
} }
// if ($auto_increment != "") { if ($auto_increment != "") {
//! $queries[] = "SELECT setval(pg_get_serial_sequence(" . q($name) . ", ), $auto_increment)"; //! $queries[] = "SELECT setval(pg_get_serial_sequence(" . q($name) . ", ), $auto_increment)";
// } }
foreach ($queries as $query) { foreach ($queries as $query) {
if (!queries($query)) { if (!queries($query)) {
return false; return false;
@@ -657,7 +582,7 @@ ORDER BY conkey, conname") as $row
} }
function truncate_tables($tables) { function truncate_tables($tables) {
return queries("TRUNCATE " . implode(", ", array_map('Adminer\table', $tables))); return queries("TRUNCATE " . implode(", ", array_map('table', $tables)));
return true; return true;
} }
@@ -667,10 +592,10 @@ ORDER BY conkey, conname") as $row
function drop_tables($tables) { function drop_tables($tables) {
foreach ($tables as $table) { foreach ($tables as $table) {
$status = table_status($table); $status = table_status($table);
if (!queries("DROP " . strtoupper($status["Engine"]) . " " . table($table))) { if (!queries("DROP " . strtoupper($status["Engine"]) . " " . table($table))) {
return false; return false;
} }
} }
return true; return true;
} }
@@ -766,15 +691,19 @@ ORDER BY SPECIFIC_NAME');
} }
function found_rows($table_status, $where) { function found_rows($table_status, $where) {
if (preg_match("~ rows=([0-9]+)~", get_val("EXPLAIN SELECT * FROM " . idf_escape($table_status["Name"]) . ($where ? " WHERE " . implode(" AND ", $where) : "")), $regs)) { global $connection;
if (preg_match(
"~ rows=([0-9]+)~",
$connection->result("EXPLAIN SELECT * FROM " . idf_escape($table_status["Name"]) . ($where ? " WHERE " . implode(" AND ", $where) : "")),
$regs
)) {
return $regs[1]; return $regs[1];
} }
return false; return false;
} }
function types() { function types() {
return get_key_vals( return get_vals("SELECT typname
"SELECT oid, typname
FROM pg_type FROM pg_type
WHERE typnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) WHERE typnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())
AND typtype IN ('b','d','e') AND typtype IN ('b','d','e')
@@ -782,27 +711,27 @@ AND typelem = 0"
); );
} }
function type_values($id) {
// to get values from type string: unnest(enum_range(NULL::"$type"))
$enums = get_vals("SELECT enumlabel FROM pg_enum WHERE enumtypid = $id ORDER BY enumsortorder");
return ($enums ? "'" . implode("', '", array_map('addslashes', $enums)) . "'" : "");
}
function schemas() { function schemas() {
return get_vals("SELECT nspname FROM pg_namespace ORDER BY nspname"); return get_vals("SELECT nspname FROM pg_namespace ORDER BY nspname");
} }
function get_schema() { function get_schema() {
return get_val("SELECT current_schema()"); global $connection;
return $connection->result("SELECT current_schema()");
} }
function set_schema($schema, $connection2 = null) { function set_schema($schema, $connection2 = null) {
global $connection, $driver; global $connection, $types, $structured_types;
if (!$connection2) { if (!$connection2) {
$connection2 = $connection; $connection2 = $connection;
} }
$return = $connection2->query("SET search_path TO " . idf_escape($schema)); $return = $connection2->query("SET search_path TO " . idf_escape($schema));
$driver->setUserTypes(types()); //! get types from current_schemas('t') foreach (types() as $type) { //! get types from current_schemas('t')
if (!isset($types[$type])) {
$types[$type] = 0;
$structured_types[lang('User types')][] = $type;
}
}
return $return; return $return;
} }
@@ -824,7 +753,8 @@ AND typelem = 0"
} }
function create_sql($table, $auto_increment, $style) { function create_sql($table, $auto_increment, $style) {
global $driver; global $connection;
$return = '';
$return_parts = array(); $return_parts = array();
$sequences = array(); $sequences = array();
@@ -834,6 +764,9 @@ AND typelem = 0"
return rtrim("CREATE VIEW " . idf_escape($table) . " AS $view[select]", ";"); return rtrim("CREATE VIEW " . idf_escape($table) . " AS $view[select]", ";");
} }
$fields = fields($table); $fields = fields($table);
$indexes = indexes($table);
ksort($indexes);
$constraints = constraints($table);
if (!$status || empty($fields)) { if (!$status || empty($fields)) {
return false; return false;
@@ -842,7 +775,7 @@ AND typelem = 0"
$return = "CREATE TABLE " . idf_escape($status['nspname']) . "." . idf_escape($status['Name']) . " (\n "; $return = "CREATE TABLE " . idf_escape($status['nspname']) . "." . idf_escape($status['Name']) . " (\n ";
// fields' definitions // fields' definitions
foreach ($fields as $field) { foreach ($fields as $field_name => $field) {
$part = idf_escape($field['field']) . ' ' . $field['full_type'] $part = idf_escape($field['field']) . ' ' . $field['full_type']
. default_value($field) . default_value($field)
. ($field['attnotnull'] ? " NOT NULL" : ""); . ($field['attnotnull'] ? " NOT NULL" : "");
@@ -851,15 +784,12 @@ AND typelem = 0"
// sequences for fields // sequences for fields
if (preg_match('~nextval\(\'([^\']+)\'\)~', $field['default'], $matches)) { if (preg_match('~nextval\(\'([^\']+)\'\)~', $field['default'], $matches)) {
$sequence_name = $matches[1]; $sequence_name = $matches[1];
$sq = reset(get_rows((min_version(10) $sq = reset(get_rows(min_version(10)
? "SELECT *, cache_size AS cache_value FROM pg_sequences WHERE schemaname = current_schema() AND sequencename = " . q(idf_unescape($sequence_name)) ? "SELECT *, cache_size AS cache_value FROM pg_sequences WHERE schemaname = current_schema() AND sequencename = " . q($sequence_name)
: "SELECT * FROM $sequence_name" : "SELECT * FROM $sequence_name"
), null, "-- ")); ));
$sequences[] = ($style == "DROP+CREATE" ? "DROP SEQUENCE IF EXISTS $sequence_name;\n" : "") $sequences[] = ($style == "DROP+CREATE" ? "DROP SEQUENCE IF EXISTS $sequence_name;\n" : "")
. "CREATE SEQUENCE $sequence_name INCREMENT $sq[increment_by] MINVALUE $sq[min_value] MAXVALUE $sq[max_value]" . "CREATE SEQUENCE $sequence_name INCREMENT $sq[increment_by] MINVALUE $sq[min_value] MAXVALUE $sq[max_value]" . ($auto_increment && $sq['last_value'] ? " START $sq[last_value]" : "") . " CACHE $sq[cache_value];";
. ($auto_increment && $sq['last_value'] ? " START " . ($sq["last_value"] + 1) : "")
. " CACHE $sq[cache_value];"
;
} }
} }
@@ -868,21 +798,32 @@ AND typelem = 0"
$return = implode("\n\n", $sequences) . "\n\n$return"; $return = implode("\n\n", $sequences) . "\n\n$return";
} }
$primary = ""; // primary + unique keys
foreach (indexes($table) as $index_name => $index) { foreach ($indexes as $index_name => $index) {
if ($index['type'] == 'PRIMARY') { switch($index['type']) {
$primary = $index_name; case 'UNIQUE': $return_parts[] = "CONSTRAINT " . idf_escape($index_name) . " UNIQUE (" . implode(', ', array_map('idf_escape', $index['columns'])) . ")"; break;
$return_parts[] = "CONSTRAINT " . idf_escape($index_name) . " PRIMARY KEY (" . implode(', ', array_map('Adminer\idf_escape', $index['columns'])) . ")"; case 'PRIMARY': $return_parts[] = "CONSTRAINT " . idf_escape($index_name) . " PRIMARY KEY (" . implode(', ', array_map('idf_escape', $index['columns'])) . ")"; break;
} }
} }
foreach ($driver->checkConstraints($table) as $conname => $consrc) { foreach ($constraints as $conname => $consrc) {
$return_parts[] = "CONSTRAINT " . idf_escape($conname) . " CHECK $consrc"; $return_parts[] = "CONSTRAINT " . idf_escape($conname) . " CHECK $consrc";
} }
$return .= implode(",\n ", $return_parts) . "\n) WITH (oids = " . ($status['Oid'] ? 'true' : 'false') . ");"; $return .= implode(",\n ", $return_parts) . "\n) WITH (oids = " . ($status['Oid'] ? 'true' : 'false') . ");";
// comments for table & fields // "basic" indexes after table definition
foreach ($indexes as $index_name => $index) {
if ($index['type'] == 'INDEX') {
$columns = array();
foreach ($index['columns'] as $key => $val) {
$columns[] = idf_escape($val) . ($index['descs'][$key] ? " DESC" : "");
}
$return .= "\n\nCREATE INDEX " . idf_escape($index_name) . " ON " . idf_escape($status['nspname']) . "." . idf_escape($status['Name']) . " USING btree (" . implode(', ', $columns) . ");";
}
}
// coments for table & fields
if ($status['Comment']) { if ($status['Comment']) {
$return .= "\n\nCOMMENT ON TABLE " . idf_escape($status['nspname']) . "." . idf_escape($status['Name']) . " IS " . q($status['Comment']) . ";"; $return .= "\n\nCOMMENT ON TABLE " . idf_escape($status['nspname']) . "." . idf_escape($status['Name']) . " IS " . q($status['Comment']) . ";";
} }
@@ -893,10 +834,6 @@ AND typelem = 0"
} }
} }
foreach (get_rows("SELECT indexdef FROM pg_catalog.pg_indexes WHERE schemaname = current_schema() AND tablename = " . q($table) . ($primary ? " AND indexname != " . q($primary) : ""), null, "-- ") as $row) {
$return .= "\n\n$row[indexdef];";
}
return rtrim($return, ';'); return rtrim($return, ';');
} }
@@ -927,6 +864,9 @@ AND typelem = 0"
return get_rows("SELECT * FROM pg_stat_activity ORDER BY " . (min_version(9.2) ? "pid" : "procpid")); return get_rows("SELECT * FROM pg_stat_activity ORDER BY " . (min_version(9.2) ? "pid" : "procpid"));
} }
function show_status() {
}
function convert_field($field) { function convert_field($field) {
} }
@@ -935,18 +875,55 @@ AND typelem = 0"
} }
function support($feature) { function support($feature) {
return preg_match('~^(check|database|table|columns|sql|indexes|descidx|comment|view|' . (min_version(9.3) ? 'materializedview|' : '') . 'scheme|routine|processlist|sequence|trigger|type|variables|drop_col|kill|dump)$~', $feature); return preg_match('~^(database|table|columns|sql|indexes|descidx|comment|view|' . (min_version(9.3) ? 'materializedview|' : '') . 'scheme|routine|processlist|sequence|trigger|type|variables|drop_col|kill|dump)$~', $feature);
} }
function kill_process($val) { function kill_process($val) {
return queries("SELECT pg_terminate_backend(" . number($val) . ")"); return queries("SELECT pg_terminate_backend(" . number($val) . ")");
} }
function connection_id() { function connection_id(){
return "SELECT pg_backend_pid()"; return "SELECT pg_backend_pid()";
} }
function max_connections() { function max_connections() {
return get_val("SHOW max_connections"); global $connection;
return $connection->result("SHOW max_connections");
}
function driver_config() {
$types = array();
$structured_types = array();
foreach (array( //! arrays
lang('Numbers') => array("smallint" => 5, "integer" => 10, "bigint" => 19, "boolean" => 1, "numeric" => 0, "real" => 7, "double precision" => 16, "money" => 20),
lang('Date and time') => array("date" => 13, "time" => 17, "timestamp" => 20, "timestamptz" => 21, "interval" => 0),
lang('Strings') => array("character" => 0, "character varying" => 0, "text" => 0, "tsquery" => 0, "tsvector" => 0, "uuid" => 0, "xml" => 0),
lang('Binary') => array("bit" => 0, "bit varying" => 0, "bytea" => 0),
lang('Network') => array("cidr" => 43, "inet" => 43, "macaddr" => 17, "txid_snapshot" => 0),
lang('Geometry') => array("box" => 0, "circle" => 0, "line" => 0, "lseg" => 0, "path" => 0, "point" => 0, "polygon" => 0),
) as $key => $val) { //! can be retrieved from pg_type
$types += $val;
$structured_types[$key] = array_keys($val);
}
return array(
'possible_drivers' => array("PgSQL", "PDO_PgSQL"),
'jush' => "pgsql",
'types' => $types,
'structured_types' => $structured_types,
'unsigned' => array(),
'operators' => array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "ILIKE", "ILIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"), // no "SQL" to avoid CSRF
'functions' => array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper"),
'grouping' => array("avg", "count", "count distinct", "max", "min", "sum"),
'edit_functions' => array(
array(
"char" => "md5",
"date|time" => "now",
), array(
number_type() => "+/-",
"date|time" => "+ interval/- interval", //! escape
"char|text" => "||",
)
),
);
} }
} }

View File

@@ -1,103 +1,185 @@
<?php <?php
namespace Adminer; $drivers["sqlite"] = "SQLite 3";
$drivers["sqlite2"] = "SQLite 2";
$drivers["sqlite"] = "SQLite"; if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
define("DRIVER", (isset($_GET["sqlite"]) ? "sqlite" : "sqlite2"));
if (class_exists(isset($_GET["sqlite"]) ? "SQLite3" : "SQLiteDatabase")) {
if (isset($_GET["sqlite"])) {
if (isset($_GET["sqlite"])) { class Min_SQLite {
define('Adminer\DRIVER', "sqlite"); var $extension = "SQLite3", $server_info, $affected_rows, $errno, $error, $_link;
if (class_exists("SQLite3")) {
class SqliteDb { function __construct($filename) {
var $extension = "SQLite3", $server_info, $affected_rows, $errno, $error, $_link; $this->_link = new SQLite3($filename);
$version = $this->_link->version();
function __construct($filename) { $this->server_info = $version["versionString"];
$this->_link = new \SQLite3($filename);
$version = $this->_link->version();
$this->server_info = $version["versionString"];
}
function query($query) {
$result = @$this->_link->query($query);
$this->error = "";
if (!$result) {
$this->errno = $this->_link->lastErrorCode();
$this->error = $this->_link->lastErrorMsg();
return false;
} elseif ($result->numColumns()) {
return new Result($result);
} }
$this->affected_rows = $this->_link->changes();
return true;
}
function quote($string) { function query($query) {
return (is_utf8($string) $result = @$this->_link->query($query);
? "'" . $this->_link->escapeString($string) . "'" $this->error = "";
: "x'" . reset(unpack('H*', $string)) . "'" if (!$result) {
); $this->errno = $this->_link->lastErrorCode();
} $this->error = $this->_link->lastErrorMsg();
return false;
function store_result() { } elseif ($result->numColumns()) {
return $this->_result; return new Min_Result($result);
} }
$this->affected_rows = $this->_link->changes();
function result($query, $field = 0) { return true;
$result = $this->query($query);
if (!is_object($result)) {
return false;
} }
$row = $result->_result->fetchArray();
return $row ? $row[$field] : false;
}
}
class Result { function quote($string) {
var $_result, $_offset = 0, $num_rows; return (is_utf8($string)
? "'" . $this->_link->escapeString($string) . "'"
: "x'" . reset(unpack('H*', $string)) . "'"
);
}
function __construct($result) { function store_result() {
$this->_result = $result; return $this->_result;
}
function result($query, $field = 0) {
$result = $this->query($query);
if (!is_object($result)) {
return false;
}
$row = $result->_result->fetchArray();
return $row[$field];
}
} }
function fetch_assoc() { class Min_Result {
return $this->_result->fetchArray(SQLITE3_ASSOC); var $_result, $_offset = 0, $num_rows;
function __construct($result) {
$this->_result = $result;
}
function fetch_assoc() {
return $this->_result->fetchArray(SQLITE3_ASSOC);
}
function fetch_row() {
return $this->_result->fetchArray(SQLITE3_NUM);
}
function fetch_field() {
$column = $this->_offset++;
$type = $this->_result->columnType($column);
return (object) array(
"name" => $this->_result->columnName($column),
"type" => $type,
"charsetnr" => ($type == SQLITE3_BLOB ? 63 : 0), // 63 - binary
);
}
function __desctruct() {
return $this->_result->finalize();
}
} }
function fetch_row() { } else {
return $this->_result->fetchArray(SQLITE3_NUM);
class Min_SQLite {
var $extension = "SQLite", $server_info, $affected_rows, $error, $_link;
function __construct($filename) {
$this->server_info = sqlite_libversion();
$this->_link = new SQLiteDatabase($filename);
}
function query($query, $unbuffered = false) {
$method = ($unbuffered ? "unbufferedQuery" : "query");
$result = @$this->_link->$method($query, SQLITE_BOTH, $error);
$this->error = "";
if (!$result) {
$this->error = $error;
return false;
} elseif ($result === true) {
$this->affected_rows = $this->changes();
return true;
}
return new Min_Result($result);
}
function quote($string) {
return "'" . sqlite_escape_string($string) . "'";
}
function store_result() {
return $this->_result;
}
function result($query, $field = 0) {
$result = $this->query($query);
if (!is_object($result)) {
return false;
}
$row = $result->_result->fetch();
return $row[$field];
}
} }
function fetch_field() { class Min_Result {
$column = $this->_offset++; var $_result, $_offset = 0, $num_rows;
$type = $this->_result->columnType($column);
return (object) array( function __construct($result) {
"name" => $this->_result->columnName($column), $this->_result = $result;
"type" => $type, if (method_exists($result, 'numRows')) { // not available in unbuffered query
"charsetnr" => ($type == SQLITE3_BLOB ? 63 : 0), // 63 - binary $this->num_rows = $result->numRows();
); }
}
function fetch_assoc() {
$row = $this->_result->fetch(SQLITE_ASSOC);
if (!$row) {
return false;
}
$return = array();
foreach ($row as $key => $val) {
$return[idf_unescape($key)] = $val;
}
return $return;
}
function fetch_row() {
return $this->_result->fetch(SQLITE_NUM);
}
function fetch_field() {
$name = $this->_result->fieldName($this->_offset++);
$pattern = '(\[.*]|"(?:[^"]|"")*"|(.+))';
if (preg_match("~^($pattern\\.)?$pattern\$~", $name, $match)) {
$table = ($match[3] != "" ? $match[3] : idf_unescape($match[2]));
$name = ($match[5] != "" ? $match[5] : idf_unescape($match[4]));
}
return (object) array(
"name" => $name,
"orgname" => $name,
"orgtable" => $table,
);
}
} }
function __desctruct() {
return $this->_result->finalize();
}
} }
} elseif (extension_loaded("pdo_sqlite")) { } elseif (extension_loaded("pdo_sqlite")) {
class SqliteDb extends PdoDb { class Min_SQLite extends Min_PDO {
var $extension = "PDO_SQLite"; var $extension = "PDO_SQLite";
function __construct($filename) { function __construct($filename) {
$this->dsn(DRIVER . ":$filename", "", ""); $this->dsn(DRIVER . ":$filename", "", "");
} }
function select_db($db) {
return false;
}
} }
} }
if (class_exists('Adminer\SqliteDb')) { if (class_exists("Min_SQLite")) {
class Db extends SqliteDb { class Min_DB extends Min_SQLite {
function __construct() { function __construct() {
parent::__construct(":memory:"); parent::__construct(":memory:");
@@ -126,36 +208,7 @@ if (isset($_GET["sqlite"])) {
class Driver extends SqlDriver { class Min_Driver extends Min_SQL {
static $possibleDrivers = array("SQLite3", "PDO_SQLite");
static $jush = "sqlite";
protected $types = array(array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0));
var $editFunctions = array(
array(
// "text" => "date('now')/time('now')/datetime('now')",
), array(
"integer|real|numeric" => "+/-",
// "text" => "date/time/datetime",
"text" => "||",
)
);
var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); // REGEXP can be user defined function
var $functions = array("hex", "length", "lower", "round", "unixepoch", "upper");
var $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
function __construct($connection) {
parent::__construct($connection);
if (min_version(3.31, 0, $connection)) {
$this->generated = array("STORED", "VIRTUAL");
}
}
function structuredTypes() {
return array_keys($this->types[0]);
}
function insertUpdate($table, $rows, $primary) { function insertUpdate($table, $rows, $primary) {
$values = array(); $values = array();
@@ -165,7 +218,7 @@ if (isset($_GET["sqlite"])) {
return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys(reset($rows))) . ") VALUES\n" . implode(",\n", $values)); return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys(reset($rows))) . ") VALUES\n" . implode(",\n", $values));
} }
function tableHelp($name, $is_view = false) { function tableHelp($name) {
if ($name == "sqlite_sequence") { if ($name == "sqlite_sequence") {
return "fileformat2.html#seqtab"; return "fileformat2.html#seqtab";
} }
@@ -174,10 +227,6 @@ if (isset($_GET["sqlite"])) {
} }
} }
function checkConstraints($table) {
preg_match_all('~ CHECK *(\( *(((?>[^()]*[^() ])|(?1))*) *\))~', $this->_conn->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q($table)), $matches); //! could be inside a comment
return array_combine($matches[2], $matches[2]);
}
} }
@@ -190,12 +239,13 @@ if (isset($_GET["sqlite"])) {
return idf_escape($idf); return idf_escape($idf);
} }
function connect($credentials) { function connect() {
list(, , $password) = $credentials; global $adminer;
list(, , $password) = $adminer->credentials();
if ($password != "") { if ($password != "") {
return lang('Database does not support password.'); return lang('Database does not support password.');
} }
return new Db; return new Min_DB;
} }
function get_databases() { function get_databases() {
@@ -207,14 +257,16 @@ if (isset($_GET["sqlite"])) {
} }
function limit1($table, $query, $where, $separator = "\n") { function limit1($table, $query, $where, $separator = "\n") {
return (preg_match('~^INTO~', $query) || get_val("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')") global $connection;
return (preg_match('~^INTO~', $query) || $connection->result("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')")
? limit($query, $where, 1, 0, $separator) ? limit($query, $where, 1, 0, $separator)
: " $query WHERE rowid = (SELECT rowid FROM " . table($table) . $where . $separator . "LIMIT 1)" //! use primary key in tables with WITHOUT rowid : " $query WHERE rowid = (SELECT rowid FROM " . table($table) . $where . $separator . "LIMIT 1)" //! use primary key in tables with WITHOUT rowid
); );
} }
function db_collation($db, $collations) { function db_collation($db, $collations) {
return get_val("PRAGMA encoding"); // there is no database list so $db == DB global $connection;
return $connection->result("PRAGMA encoding"); // there is no database list so $db == DB
} }
function engines() { function engines() {
@@ -234,9 +286,10 @@ if (isset($_GET["sqlite"])) {
} }
function table_status($name = "") { function table_status($name = "") {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT name AS Name, type AS Engine, 'rowid' AS Oid, '' AS Auto_increment FROM sqlite_master WHERE type IN ('table', 'view') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) { foreach (get_rows("SELECT name AS Name, type AS Engine, 'rowid' AS Oid, '' AS Auto_increment FROM sqlite_master WHERE type IN ('table', 'view') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) {
$row["Rows"] = get_val("SELECT COUNT(*) FROM " . idf_escape($row["Name"])); $row["Rows"] = $connection->result("SELECT COUNT(*) FROM " . idf_escape($row["Name"]));
$return[$row["Name"]] = $row; $return[$row["Name"]] = $row;
} }
foreach (get_rows("SELECT * FROM sqlite_sequence", null, "") as $row) { foreach (get_rows("SELECT * FROM sqlite_sequence", null, "") as $row) {
@@ -250,13 +303,15 @@ if (isset($_GET["sqlite"])) {
} }
function fk_support($table_status) { function fk_support($table_status) {
return !get_val("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')"); global $connection;
return !$connection->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");
} }
function fields($table) { function fields($table) {
global $connection;
$return = array(); $return = array();
$primary = ""; $primary = "";
foreach (get_rows("PRAGMA table_" . (min_version(3.31) ? "x" : "") . "info(" . table($table) . ")") as $row) { foreach (get_rows("PRAGMA table_info(" . table($table) . ")") as $row) {
$name = $row["name"]; $name = $row["name"];
$type = strtolower($row["type"]); $type = strtolower($row["type"]);
$default = $row["dflt_value"]; $default = $row["dflt_value"];
@@ -264,7 +319,7 @@ if (isset($_GET["sqlite"])) {
"field" => $name, "field" => $name,
"type" => (preg_match('~int~i', $type) ? "integer" : (preg_match('~char|clob|text~i', $type) ? "text" : (preg_match('~blob~i', $type) ? "blob" : (preg_match('~real|floa|doub~i', $type) ? "real" : "numeric")))), "type" => (preg_match('~int~i', $type) ? "integer" : (preg_match('~char|clob|text~i', $type) ? "text" : (preg_match('~blob~i', $type) ? "blob" : (preg_match('~real|floa|doub~i', $type) ? "real" : "numeric")))),
"full_type" => $type, "full_type" => $type,
"default" => (preg_match("~^'(.*)'$~", $default, $match) ? str_replace("''", "'", $match[1]) : ($default == "NULL" ? null : $default)), "default" => (preg_match("~'(.*)'~", $default, $match) ? str_replace("''", "'", $match[1]) : ($default == "NULL" ? null : $default)),
"null" => !$row["notnull"], "null" => !$row["notnull"],
"privileges" => array("select" => 1, "insert" => 1, "update" => 1, "where" => 1, "order" => 1), "privileges" => array("select" => 1, "insert" => 1, "update" => 1, "where" => 1, "order" => 1),
"primary" => $row["pk"], "primary" => $row["pk"],
@@ -278,21 +333,14 @@ if (isset($_GET["sqlite"])) {
$primary = $name; $primary = $name;
} }
} }
$sql = get_val("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q($table)); $sql = $connection->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q($table));
$idf = '(("[^"]*+")+|[a-z0-9_]+)'; preg_match_all('~(("[^"]*+")+|[a-z0-9_]+)\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i', $sql, $matches, PREG_SET_ORDER);
preg_match_all('~' . $idf . '\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i', $sql, $matches, PREG_SET_ORDER);
foreach ($matches as $match) { foreach ($matches as $match) {
$name = str_replace('""', '"', preg_replace('~^"|"$~', '', $match[1])); $name = str_replace('""', '"', preg_replace('~^"|"$~', '', $match[1]));
if ($return[$name]) { if ($return[$name]) {
$return[$name]["collation"] = trim($match[3], "'"); $return[$name]["collation"] = trim($match[3], "'");
} }
} }
preg_match_all('~' . $idf . '\s.*GENERATED ALWAYS AS \((.+)\) (STORED|VIRTUAL)~i', $sql, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$name = str_replace('""', '"', preg_replace('~^"|"$~', '', $match[1]));
$return[$name]["default"] = $match[3];
$return[$name]["generated"] = strtoupper($match[4]);
}
return $return; return $return;
} }
@@ -347,6 +395,7 @@ if (isset($_GET["sqlite"])) {
$return = array(); $return = array();
foreach (get_rows("PRAGMA foreign_key_list(" . table($table) . ")") as $row) { foreach (get_rows("PRAGMA foreign_key_list(" . table($table) . ")") as $row) {
$foreign_key = &$return[$row["id"]]; $foreign_key = &$return[$row["id"]];
//! idf_unescape in SQLite2
if (!$foreign_key) { if (!$foreign_key) {
$foreign_key = $row; $foreign_key = $row;
} }
@@ -357,7 +406,8 @@ if (isset($_GET["sqlite"])) {
} }
function view($name) { function view($name) {
return array("select" => preg_replace('~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\s+~iU', '', get_val("SELECT sql FROM sqlite_master WHERE type = 'view' AND name = " . q($name)))); //! identifiers may be inside [] global $connection;
return array("select" => preg_replace('~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\s+~iU', '', $connection->result("SELECT sql FROM sqlite_master WHERE name = " . q($name)))); //! identifiers may be inside []
} }
function collations() { function collations() {
@@ -394,7 +444,7 @@ if (isset($_GET["sqlite"])) {
return false; return false;
} }
try { try {
$link = new SqliteDb($db); $link = new Min_SQLite($db);
} catch (Exception $ex) { } catch (Exception $ex) {
$connection->error = $ex->getMessage(); $connection->error = $ex->getMessage();
return false; return false;
@@ -428,7 +478,7 @@ if (isset($_GET["sqlite"])) {
} }
function auto_increment() { function auto_increment() {
return " PRIMARY KEY AUTOINCREMENT"; return " PRIMARY KEY" . (DRIVER == "sqlite" ? " AUTOINCREMENT" : "");
} }
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) { function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
@@ -473,20 +523,8 @@ if (isset($_GET["sqlite"])) {
return true; return true;
} }
/** Recreate table function recreate_table($table, $name, $fields, $originals, $foreign, $auto_increment, $indexes = array()) {
* @param string original name global $connection;
* @param string new name
* @param array [process_field()], empty to preserve
* @param array [$original => idf_escape($new_column)], empty to preserve
* @param string [format_foreign_key()], empty to preserve
* @param int set auto_increment to this value, 0 to preserve
* @param array [[$type, $name, $columns]], empty to preserve
* @param string CHECK constraint to drop
* @param string CHECK constraint to add
* @return bool
*/
function recreate_table($table, $name, $fields, $originals, $foreign, $auto_increment = 0, $indexes = array(), $drop_check = "", $add_check = "") {
global $driver;
if ($table != "") { if ($table != "") {
if (!$fields) { if (!$fields) {
foreach (fields($table) as $key => $field) { foreach (fields($table) as $key => $field) {
@@ -544,27 +582,16 @@ if (isset($_GET["sqlite"])) {
queries("BEGIN"); queries("BEGIN");
} }
foreach ($fields as $key => $field) { foreach ($fields as $key => $field) {
if (preg_match('~GENERATED~', $field[3])) {
unset($originals[array_search($field[0], $originals)]);
}
$fields[$key] = " " . implode($field); $fields[$key] = " " . implode($field);
} }
$fields = array_merge($fields, array_filter($foreign)); $fields = array_merge($fields, array_filter($foreign));
foreach ($driver->checkConstraints($table) as $check) {
if ($check != $drop_check) {
$fields[] = " CHECK ($check)";
}
}
if ($add_check) {
$fields[] = " CHECK ($add_check)";
}
$temp_name = ($table == $name ? "adminer_$name" : $name); $temp_name = ($table == $name ? "adminer_$name" : $name);
if (!queries("CREATE TABLE " . table($temp_name) . " (\n" . implode(",\n", $fields) . "\n)")) { if (!queries("CREATE TABLE " . table($temp_name) . " (\n" . implode(",\n", $fields) . "\n)")) {
// implicit ROLLBACK to not overwrite $connection->error // implicit ROLLBACK to not overwrite $connection->error
return false; return false;
} }
if ($table != "") { if ($table != "") {
if ($originals && !queries("INSERT INTO " . table($temp_name) . " (" . implode(", ", $originals) . ") SELECT " . implode(", ", array_map('Adminer\idf_escape', array_keys($originals))) . " FROM " . table($table))) { if ($originals && !queries("INSERT INTO " . table($temp_name) . " (" . implode(", ", $originals) . ") SELECT " . implode(", ", array_map('idf_escape', array_keys($originals))) . " FROM " . table($table))) {
return false; return false;
} }
$triggers = array(); $triggers = array();
@@ -572,9 +599,8 @@ if (isset($_GET["sqlite"])) {
$trigger = trigger($trigger_name); $trigger = trigger($trigger_name);
$triggers[] = "CREATE TRIGGER " . idf_escape($trigger_name) . " " . implode(" ", $timing_event) . " ON " . table($name) . "\n$trigger[Statement]"; $triggers[] = "CREATE TRIGGER " . idf_escape($trigger_name) . " " . implode(" ", $timing_event) . " ON " . table($name) . "\n$trigger[Statement]";
} }
$auto_increment = $auto_increment ? 0 : get_val("SELECT seq FROM sqlite_sequence WHERE name = " . q($table)); // if $auto_increment is set then it will be updated later $auto_increment = $auto_increment ? 0 : $connection->result("SELECT seq FROM sqlite_sequence WHERE name = " . q($table)); // if $auto_increment is set then it will be updated later
if ( if (!queries("DROP TABLE " . table($table)) // drop before creating indexes and triggers to allow using old names
!queries("DROP TABLE " . table($table)) // drop before creating indexes and triggers to allow using old names
|| ($table == $name && !queries("ALTER TABLE " . table($temp_name) . " RENAME TO " . table($name))) || ($table == $name && !queries("ALTER TABLE " . table($temp_name) . " RENAME TO " . table($name)))
|| !alter_indexes($name, $indexes) || !alter_indexes($name, $indexes)
) { ) {
@@ -608,11 +634,10 @@ if (isset($_GET["sqlite"])) {
} }
} }
foreach (array_reverse($alter) as $val) { foreach (array_reverse($alter) as $val) {
if ( if (!queries($val[2] == "DROP"
!queries($val[2] == "DROP"
? "DROP INDEX " . idf_escape($val[1]) ? "DROP INDEX " . idf_escape($val[1])
: index_sql($table, $val[0], $val[1], "(" . implode(", ", $val[2]) . ")")) : index_sql($table, $val[0], $val[1], "(" . implode(", ", $val[2]) . ")")
) { )) {
return false; return false;
} }
} }
@@ -636,6 +661,7 @@ if (isset($_GET["sqlite"])) {
} }
function trigger($name) { function trigger($name) {
global $connection;
if ($name == "") { if ($name == "") {
return array("Statement" => "BEGIN\n\t;\nEND"); return array("Statement" => "BEGIN\n\t;\nEND");
} }
@@ -643,7 +669,7 @@ if (isset($_GET["sqlite"])) {
$trigger_options = trigger_options(); $trigger_options = trigger_options();
preg_match( preg_match(
"~^CREATE\\s+TRIGGER\\s*$idf\\s*(" . implode("|", $trigger_options["Timing"]) . ")\\s+([a-z]+)(?:\\s+OF\\s+($idf))?\\s+ON\\s*$idf\\s*(?:FOR\\s+EACH\\s+ROW\\s)?(.*)~is", "~^CREATE\\s+TRIGGER\\s*$idf\\s*(" . implode("|", $trigger_options["Timing"]) . ")\\s+([a-z]+)(?:\\s+OF\\s+($idf))?\\s+ON\\s*$idf\\s*(?:FOR\\s+EACH\\s+ROW\\s)?(.*)~is",
get_val("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = " . q($name)), $connection->result("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = " . q($name)),
$match $match
); );
$of = $match[3]; $of = $match[3];
@@ -679,7 +705,8 @@ if (isset($_GET["sqlite"])) {
} }
function last_id() { function last_id() {
return get_val("SELECT LAST_INSERT_ROWID()"); global $connection;
return $connection->result("SELECT LAST_INSERT_ROWID()");
} }
function explain($connection, $query) { function explain($connection, $query) {
@@ -693,13 +720,26 @@ if (isset($_GET["sqlite"])) {
return array(); return array();
} }
function schemas() {
return array();
}
function get_schema() {
return "";
}
function set_schema($scheme) {
return true;
}
function create_sql($table, $auto_increment, $style) { function create_sql($table, $auto_increment, $style) {
$return = get_val("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = " . q($table)); global $connection;
$return = $connection->result("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = " . q($table));
foreach (indexes($table) as $name => $index) { foreach (indexes($table) as $name => $index) {
if ($name == '') { if ($name == '') {
continue; continue;
} }
$return .= ";\n\n" . index_sql($table, $index['type'], $name, "(" . implode(", ", array_map('Adminer\idf_escape', $index['columns'])) . ")"); $return .= ";\n\n" . index_sql($table, $index['type'], $name, "(" . implode(", ", array_map('idf_escape', $index['columns'])) . ")");
} }
return $return; return $return;
} }
@@ -716,14 +756,10 @@ if (isset($_GET["sqlite"])) {
} }
function show_variables() { function show_variables() {
global $connection;
$return = array(); $return = array();
foreach (get_rows("PRAGMA pragma_list") as $row) { foreach (array("auto_vacuum", "cache_size", "count_changes", "default_cache_size", "empty_result_callbacks", "encoding", "foreign_keys", "full_column_names", "fullfsync", "journal_mode", "journal_size_limit", "legacy_file_format", "locking_mode", "page_size", "max_page_count", "read_uncommitted", "recursive_triggers", "reverse_unordered_selects", "secure_delete", "short_column_names", "synchronous", "temp_store", "temp_store_directory", "schema_version", "integrity_check", "quick_check") as $key) {
$name = $row["name"]; $return[$key] = $connection->result("PRAGMA $key");
if ($name != "pragma_list" && $name != "compile_options") {
foreach (get_rows("PRAGMA $name") as $row) {
$return[$name] .= implode(", ", $row) . "\n";
}
}
} }
return $return; return $return;
} }
@@ -745,6 +781,29 @@ if (isset($_GET["sqlite"])) {
} }
function support($feature) { function support($feature) {
return preg_match('~^(check|columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~', $feature); return preg_match('~^(columns|database|drop_col|dump|indexes|descidx|move_col|sql|status|table|trigger|variables|view|view_trigger)$~', $feature);
}
function driver_config() {
$types = array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0);
return array(
'possible_drivers' => array((isset($_GET["sqlite"]) ? "SQLite3" : "SQLite"), "PDO_SQLite"),
'jush' => "sqlite",
'types' => $types,
'structured_types' => array_keys($types),
'unsigned' => array(),
'operators' => array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"), // REGEXP can be user defined function
'functions' => array("hex", "length", "lower", "round", "unixepoch", "upper"),
'grouping' => array("avg", "count", "count distinct", "group_concat", "max", "min", "sum"),
'edit_functions' => array(
array(
// "text" => "date('now')/time('now')/datetime('now')",
), array(
"integer|real|numeric" => "+/-",
// "text" => "date/time/datetime",
"text" => "||",
)
),
);
} }
} }

View File

@@ -1,24 +1,21 @@
<?php <?php
namespace Adminer;
$TABLE = $_GET["dump"]; $TABLE = $_GET["dump"];
if ($_POST && !$error) { if ($_POST && !$error) {
$cookie = ""; $cookie = "";
foreach (array("output", "format", "db_style", "types", "routines", "events", "table_style", "auto_increment", "triggers", "data_style") as $key) { foreach (array("output", "format", "db_style", "routines", "events", "table_style", "auto_increment", "triggers", "data_style") as $key) {
$cookie .= "&$key=" . urlencode($_POST[$key]); $cookie .= "&$key=" . urlencode($_POST[$key]);
} }
cookie("adminer_export", substr($cookie, 1)); cookie("adminer_export", substr($cookie, 1));
$tables = array_flip((array) $_POST["tables"]) + array_flip((array) $_POST["data"]); $tables = array_flip((array) $_POST["tables"]) + array_flip((array) $_POST["data"]);
$ext = dump_headers( $ext = dump_headers(
(count($tables) == 1 ? key($tables) : DB), (count($tables) == 1 ? key($tables) : DB),
(DB == "" || count($tables) > 1) (DB == "" || count($tables) > 1));
);
$is_sql = preg_match('~sql~', $_POST["format"]); $is_sql = preg_match('~sql~', $_POST["format"]);
if ($is_sql) { if ($is_sql) {
echo "-- Adminer $VERSION " . $drivers[DRIVER] . " " . str_replace("\n", " ", $connection->server_info) . " dump\n\n"; echo "-- Adminer $VERSION " . $drivers[DRIVER] . " " . str_replace("\n", " ", $connection->server_info) . " dump\n\n";
if (JUSH == "sql") { if ($jush == "sql") {
echo "SET NAMES utf8; echo "SET NAMES utf8;
SET time_zone = '+00:00'; SET time_zone = '+00:00';
SET foreign_key_checks = 0; SET foreign_key_checks = 0;
@@ -42,7 +39,7 @@ SET foreign_key_checks = 0;
foreach ((array) $databases as $db) { foreach ((array) $databases as $db) {
$adminer->dumpDatabase($db); $adminer->dumpDatabase($db);
if ($connection->select_db($db)) { if ($connection->select_db($db)) {
if ($is_sql && preg_match('~CREATE~', $style) && ($create = get_val("SHOW CREATE DATABASE " . idf_escape($db), 1))) { if ($is_sql && preg_match('~CREATE~', $style) && ($create = $connection->result("SHOW CREATE DATABASE " . idf_escape($db), 1))) {
set_utf8mb4($create); set_utf8mb4($create);
if ($style == "DROP+CREATE") { if ($style == "DROP+CREATE") {
echo "DROP DATABASE IF EXISTS " . idf_escape($db) . ";\n"; echo "DROP DATABASE IF EXISTS " . idf_escape($db) . ";\n";
@@ -55,37 +52,27 @@ SET foreign_key_checks = 0;
} }
$out = ""; $out = "";
if ($_POST["types"]) {
foreach (types() as $id => $type) {
$enums = type_values($id);
if ($enums) {
$out .= ($style != 'DROP+CREATE' ? "DROP TYPE IF EXISTS " . idf_escape($type) . ";;\n" : "") . "CREATE TYPE " . idf_escape($type) . " AS ENUM ($enums);\n\n";
} else {
//! https://github.com/postgres/postgres/blob/REL_17_4/src/bin/pg_dump/pg_dump.c#L10846
$out .= "-- Could not export type $type\n\n";
}
}
}
if ($_POST["routines"]) { if ($_POST["routines"]) {
foreach (routines() as $row) { foreach (array("FUNCTION", "PROCEDURE") as $routine) {
$name = $row["ROUTINE_NAME"]; foreach (get_rows("SHOW $routine STATUS WHERE Db = " . q($db), null, "-- ") as $row) {
$routine = $row["ROUTINE_TYPE"]; $create = remove_definer($connection->result("SHOW CREATE $routine " . idf_escape($row["Name"]), 2));
$create = create_routine($routine, array("name" => $name) + routine($row["SPECIFIC_NAME"], $routine)); set_utf8mb4($create);
set_utf8mb4($create); $out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") . "$create;;\n\n";
$out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($name) . ";;\n" : "") . "$create;\n\n"; }
} }
} }
if ($_POST["events"]) { if ($_POST["events"]) {
foreach (get_rows("SHOW EVENTS", null, "-- ") as $row) { foreach (get_rows("SHOW EVENTS", null, "-- ") as $row) {
$create = remove_definer(get_val("SHOW CREATE EVENT " . idf_escape($row["Name"]), 3)); $create = remove_definer($connection->result("SHOW CREATE EVENT " . idf_escape($row["Name"]), 3));
set_utf8mb4($create); set_utf8mb4($create);
$out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") . "$create;;\n\n"; $out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") . "$create;;\n\n";
} }
} }
echo ($out && JUSH == 'sql' ? "DELIMITER ;;\n\n$out" . "DELIMITER ;\n\n" : $out); if ($out) {
echo "DELIMITER ;;\n\n$out" . "DELIMITER ;\n\n";
}
} }
if ($_POST["table_style"] || $_POST["data_style"]) { if ($_POST["table_style"] || $_POST["data_style"]) {
@@ -120,7 +107,7 @@ SET foreign_key_checks = 0;
} }
// add FKs after creating tables (except in MySQL which uses SET FOREIGN_KEY_CHECKS=0) // add FKs after creating tables (except in MySQL which uses SET FOREIGN_KEY_CHECKS=0)
if (function_exists('Adminer\foreign_keys_sql')) { if (function_exists('foreign_keys_sql')) {
foreach (table_status('', true) as $name => $table_status) { foreach (table_status('', true) as $name => $table_status) {
$table = (DB == "" || in_array($name, (array) $_POST["tables"])); $table = (DB == "" || in_array($name, (array) $_POST["tables"]));
if ($table && !is_view($table_status)) { if ($table && !is_view($table_status)) {
@@ -141,7 +128,7 @@ SET foreign_key_checks = 0;
} }
if ($is_sql) { if ($is_sql) {
echo "-- " . gmdate("Y-m-d H:i:s e") . "\n"; echo "-- " . $connection->result("SELECT NOW()") . "\n";
} }
exit; exit;
} }
@@ -150,29 +137,26 @@ page_header(lang('Export'), $error, ($_GET["export"] != "" ? array("table" => $_
?> ?>
<form action="" method="post"> <form action="" method="post">
<table class="layout"> <table cellspacing="0" class="layout">
<?php <?php
$db_style = array('', 'USE', 'DROP+CREATE', 'CREATE'); $db_style = array('', 'USE', 'DROP+CREATE', 'CREATE');
$table_style = array('', 'DROP+CREATE', 'CREATE'); $table_style = array('', 'DROP+CREATE', 'CREATE');
$data_style = array('', 'TRUNCATE+INSERT', 'INSERT'); $data_style = array('', 'TRUNCATE+INSERT', 'INSERT');
if (JUSH == "sql") { //! use insertUpdate() in all drivers if ($jush == "sql") { //! use insertUpdate() in all drivers
$data_style[] = 'INSERT+UPDATE'; $data_style[] = 'INSERT+UPDATE';
} }
parse_str($_COOKIE["adminer_export"], $row); parse_str($_COOKIE["adminer_export"], $row);
if (!$row) { if (!$row) {
$row = array("output" => "text", "format" => "sql", "db_style" => (DB != "" ? "" : "CREATE"), "table_style" => "DROP+CREATE", "data_style" => "INSERT"); $row = array("output" => "file", "format" => "sql", "db_style" => (DB != "" ? "" : "CREATE"), "table_style" => "DROP+CREATE", "data_style" => "INSERT");
} }
if (!isset($row["events"])) { // backwards compatibility if (!isset($row["events"])) { // backwards compatibility
$row["routines"] = $row["events"] = ($_GET["dump"] == ""); $row["routines"] = $row["events"] = ($_GET["dump"] == "");
$row["triggers"] = $row["table_style"]; $row["triggers"] = $row["table_style"];
} }
echo "<tr><th>" . lang('Output') . "<td>" . html_select("output", $adminer->dumpOutput(), $row["output"], 0) . "\n"; // 0 - radio echo "<tr><th>" . lang('Format') . "<td>" . html_select("format", $adminer->dumpFormat(), $row["format"], false) . "\n"; // false = radio
echo "<tr><th>" . lang('Format') . "<td>" . html_select("format", $adminer->dumpFormat(), $row["format"], 0) . "\n"; // 0 - radio echo ($jush == "sqlite" ? "" : "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, $row["db_style"])
echo (JUSH == "sqlite" ? "" : "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, $row["db_style"])
. (support("type") ? checkbox("types", 1, $row["types"], lang('User types')) : "")
. (support("routine") ? checkbox("routines", 1, $row["routines"], lang('Routines')) : "") . (support("routine") ? checkbox("routines", 1, $row["routines"], lang('Routines')) : "")
. (support("event") ? checkbox("events", 1, $row["events"], lang('Events')) : "") . (support("event") ? checkbox("events", 1, $row["events"], lang('Events')) : "")
); );
@@ -183,12 +167,15 @@ echo "<tr><th>" . lang('Tables') . "<td>" . html_select('table_style', $table_st
; ;
echo "<tr><th>" . lang('Data') . "<td>" . html_select('data_style', $data_style, $row["data_style"]); echo "<tr><th>" . lang('Data') . "<td>" . html_select('data_style', $data_style, $row["data_style"]);
echo "<tr><th>" . lang('Output') . "<td>" . html_select("output", $adminer->dumpOutput(), $row["output"], false) . "\n"; // false = radio
?> ?>
</table> </table>
<p><input type="submit" value="<?php echo lang('Export'); ?>"> <p><input type="submit" value="<?php echo lang('Export'); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<table> <table cellspacing="0">
<?php <?php
echo script("qsl('table').onclick = dumpClick;"); echo script("qsl('table').onclick = dumpClick;");
$prefixes = array(); $prefixes = array();

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$TABLE = $_GET["edit"]; $TABLE = $_GET["edit"];
$fields = fields($TABLE); $fields = fields($TABLE);
$where = (isset($_GET["select"]) ? ($_POST["check"] && count($_POST["check"]) == 1 ? where_check($_POST["check"][0], $fields) : "") : where($_GET, $fields)); $where = (isset($_GET["select"]) ? ($_POST["check"] && count($_POST["check"]) == 1 ? where_check($_POST["check"][0], $fields) : "") : where($_GET, $fields));
@@ -72,7 +70,7 @@ if ($_POST["save"]) {
if ($_POST["clone"] && $field["auto_increment"]) { if ($_POST["clone"] && $field["auto_increment"]) {
$as = "''"; $as = "''";
} }
if (JUSH == "sql" && preg_match("~enum|set~", $field["type"])) { if ($jush == "sql" && preg_match("~enum|set~", $field["type"])) {
$as = "1*" . idf_escape($name); $as = "1*" . idf_escape($name);
} }
$select[] = ($as ? "$as AS " : "") . idf_escape($name); $select[] = ($as ? "$as AS " : "") . idf_escape($name);

View File

@@ -1,9 +1,13 @@
<?php <?php
// To create Adminer just for Elasticsearch, run `../compile.php elastic`.
function adminer_object() { function adminer_object() {
include_once "../plugins/plugin.php";
include_once "../plugins/login-password-less.php";
include_once "../plugins/drivers/elastic.php"; include_once "../plugins/drivers/elastic.php";
return new Adminer\Adminer; include_once "../plugins/drivers/elastic5.php";
return new AdminerPlugin([
// TODO: inline the result of password_hash() so that the password is not visible in source codes
new AdminerLoginPasswordLess(password_hash("YOUR_PASSWORD_HERE", PASSWORD_DEFAULT)),
]);
} }
include "./index.php"; include "./index.php";

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$EVENT = $_GET["event"]; $EVENT = $_GET["event"];
$intervals = array("YEAR", "QUARTER", "MONTH", "DAY", "HOUR", "MINUTE", "WEEK", "SECOND", "YEAR_MONTH", "DAY_HOUR", "DAY_MINUTE", "DAY_SECOND", "HOUR_MINUTE", "HOUR_SECOND", "MINUTE_SECOND"); $intervals = array("YEAR", "QUARTER", "MONTH", "DAY", "HOUR", "MINUTE", "WEEK", "SECOND", "YEAR_MONTH", "DAY_HOUR", "DAY_MINUTE", "DAY_SECOND", "HOUR_MINUTE", "HOUR_SECOND", "MINUTE_SECOND");
$statuses = array("ENABLED" => "ENABLE", "DISABLED" => "DISABLE", "SLAVESIDE_DISABLED" => "DISABLE ON SLAVE"); $statuses = array("ENABLED" => "ENABLE", "DISABLED" => "DISABLE", "SLAVESIDE_DISABLED" => "DISABLE ON SLAVE");
@@ -17,18 +15,14 @@ if ($_POST && !$error) {
: "AT " . q($row["STARTS"]) : "AT " . q($row["STARTS"])
) . " ON COMPLETION" . ($row["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE" ) . " ON COMPLETION" . ($row["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
; ;
queries_redirect( queries_redirect(substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')), queries(($EVENT != ""
substr(ME, 0, -1), ? "ALTER EVENT " . idf_escape($EVENT) . $schedule
($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')), . ($EVENT != $row["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($row["EVENT_NAME"]) : "")
queries( : "CREATE EVENT " . idf_escape($row["EVENT_NAME"]) . $schedule
($EVENT != "" ) . "\n" . $statuses[$row["STATUS"]] . " COMMENT " . q($row["EVENT_COMMENT"])
? "ALTER EVENT " . idf_escape($EVENT) . $schedule . ($EVENT != $row["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($row["EVENT_NAME"]) : "") . rtrim(" DO\n$row[EVENT_DEFINITION]", ";") . ";"
: "CREATE EVENT " . idf_escape($row["EVENT_NAME"]) . $schedule ));
) . "\n" . $statuses[$row["STATUS"]] . " COMMENT " . q($row["EVENT_COMMENT"])
. rtrim(" DO\n$row[EVENT_DEFINITION]", ";") . ";"
)
);
} }
} }
@@ -41,7 +35,7 @@ if (!$row && $EVENT != "") {
?> ?>
<form action="" method="post"> <form action="" method="post">
<table class="layout"> <table cellspacing="0" class="layout">
<tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" data-maxlength="64" autocapitalize="off"> <tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" data-maxlength="64" autocapitalize="off">
<tr><th title="datetime"><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>"> <tr><th title="datetime"><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>">
<tr><th title="datetime"><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>"> <tr><th title="datetime"><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>">
@@ -53,8 +47,6 @@ if (!$row && $EVENT != "") {
<p><?php textarea("EVENT_DEFINITION", $row["EVENT_DEFINITION"]); ?> <p><?php textarea("EVENT_DEFINITION", $row["EVENT_DEFINITION"]); ?>
<p> <p>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($EVENT != "") { ?> <?php if ($EVENT != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $EVENT)); ?><?php } ?>
<input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $EVENT)); ?>
<?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</form> </form>

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
// caching headers added in compile.php // caching headers added in compile.php
if ($_GET["file"] == "favicon.ico") { if ($_GET["file"] == "favicon.ico") {
@@ -8,40 +6,21 @@ if ($_GET["file"] == "favicon.ico") {
echo lzw_decompress(compile_file('../adminer/static/favicon.ico', 'lzw_compress')); echo lzw_decompress(compile_file('../adminer/static/favicon.ico', 'lzw_compress'));
} elseif ($_GET["file"] == "default.css") { } elseif ($_GET["file"] == "default.css") {
header("Content-Type: text/css; charset=utf-8"); header("Content-Type: text/css; charset=utf-8");
echo lzw_decompress(compile_file('../adminer/static/default.css;../externals/jush/jush.css', 'minify_css')); echo lzw_decompress(compile_file('../adminer/static/default.css;../vendor/vrana/jush/jush.css', 'minify_css'));
} elseif ($_GET["file"] == "functions.js") { } elseif ($_GET["file"] == "functions.js") {
header("Content-Type: text/javascript; charset=utf-8"); header("Content-Type: text/javascript; charset=utf-8");
echo lzw_decompress(compile_file('../adminer/static/functions.js;static/editing.js', 'minify_js')); echo lzw_decompress(compile_file('../adminer/static/functions.js;static/editing.js', 'minify_js'));
} elseif ($_GET["file"] == "jush.js") { } elseif ($_GET["file"] == "jush.js") {
header("Content-Type: text/javascript; charset=utf-8"); header("Content-Type: text/javascript; charset=utf-8");
echo lzw_decompress(compile_file('../externals/jush/modules/jush.js; echo lzw_decompress(compile_file('../vendor/vrana/jush/modules/jush.js;../vendor/vrana/jush/modules/jush-textarea.js;../vendor/vrana/jush/modules/jush-txt.js;../vendor/vrana/jush/modules/jush-js.js;../vendor/vrana/jush/modules/jush-sql.js;../vendor/vrana/jush/modules/jush-pgsql.js;../vendor/vrana/jush/modules/jush-sqlite.js;../vendor/vrana/jush/modules/jush-mssql.js;../vendor/vrana/jush/modules/jush-oracle.js;../vendor/vrana/jush/modules/jush-simpledb.js', 'minify_js'));
../externals/jush/modules/jush-textarea.js;
../externals/jush/modules/jush-txt.js;
../externals/jush/modules/jush-js.js;
../externals/jush/modules/jush-sql.js;
../externals/jush/modules/jush-pgsql.js;
../externals/jush/modules/jush-sqlite.js;
../externals/jush/modules/jush-mssql.js;
../externals/jush/modules/jush-oracle.js;
../externals/jush/modules/jush-simpledb.js', 'minify_js'));
} else { } else {
header("Content-Type: image/gif"); header("Content-Type: image/gif");
switch ($_GET["file"]) { switch ($_GET["file"]) {
case "plus.gif": case "plus.gif": echo compile_file('../adminer/static/plus.gif'); break;
echo compile_file('../adminer/static/plus.gif'); case "cross.gif": echo compile_file('../adminer/static/cross.gif'); break;
break; case "up.gif": echo compile_file('../adminer/static/up.gif'); break;
case "cross.gif": case "down.gif": echo compile_file('../adminer/static/down.gif'); break;
echo compile_file('../adminer/static/cross.gif'); case "arrow.gif": echo compile_file('../adminer/static/arrow.gif'); break;
break;
case "up.gif":
echo compile_file('../adminer/static/up.gif');
break;
case "down.gif":
echo compile_file('../adminer/static/down.gif');
break;
case "arrow.gif":
echo compile_file('../adminer/static/arrow.gif');
break;
} }
} }
exit; exit;

View File

@@ -1,11 +1,12 @@
<?php <?php
namespace Adminer;
$TABLE = $_GET["foreign"]; $TABLE = $_GET["foreign"];
$name = $_GET["name"]; $name = $_GET["name"];
$row = $_POST; $row = $_POST;
if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-js"]) { if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-js"]) {
$message = ($_POST["drop"] ? lang('Foreign key has been dropped.') : ($name != "" ? lang('Foreign key has been altered.') : lang('Foreign key has been created.')));
$location = ME . "table=" . urlencode($TABLE);
if (!$_POST["drop"]) { if (!$_POST["drop"]) {
$row["source"] = array_filter($row["source"], 'strlen'); $row["source"] = array_filter($row["source"], 'strlen');
ksort($row["source"]); // enforce input order ksort($row["source"]); // enforce input order
@@ -15,24 +16,19 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-
} }
$row["target"] = $target; $row["target"] = $target;
} }
if (JUSH == "sqlite") { if ($jush == "sqlite") {
$result = recreate_table($TABLE, $TABLE, array(), array(), array(" $name" => ($row["drop"] ? "" : " " . format_foreign_key($row)))); queries_redirect($location, $message, recreate_table($TABLE, $TABLE, array(), array(), array(" $name" => ($_POST["drop"] ? "" : " " . format_foreign_key($row)))));
} else { } else {
$alter = "ALTER TABLE " . table($TABLE); $alter = "ALTER TABLE " . table($TABLE);
$result = ($name == "" || queries("$alter DROP " . (JUSH == "sql" ? "FOREIGN KEY " : "CONSTRAINT ") . idf_escape($name))); $drop = "\nDROP " . ($jush == "sql" ? "FOREIGN KEY " : "CONSTRAINT ") . idf_escape($name);
if (!$row["drop"]) { if ($_POST["drop"]) {
$result = queries("$alter ADD" . format_foreign_key($row)); query_redirect($alter . $drop, $location, $message);
} else {
query_redirect($alter . ($name != "" ? "$drop," : "") . "\nADD" . format_foreign_key($row), $location, $message);
$error = lang('Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.') . "<br>$error"; //! no partitioning
} }
} }
queries_redirect(
ME . "table=" . urlencode($TABLE),
($row["drop"] ? lang('Foreign key has been dropped.') : ($name != "" ? lang('Foreign key has been altered.') : lang('Foreign key has been created.'))),
$result
);
if (!$row["drop"]) {
$error = "$error<br>" . lang('Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.'); //! no partitioning
}
} }
page_header(lang('Foreign key'), $error, array("table" => $TABLE), h($TABLE)); page_header(lang('Foreign key'), $error, array("table" => $TABLE), h($TABLE));
@@ -61,22 +57,15 @@ if ($row["db"] != "") {
$connection->select_db($row["db"]); $connection->select_db($row["db"]);
} }
if ($row["ns"] != "") { if ($row["ns"] != "") {
$orig_schema = get_schema();
set_schema($row["ns"]); set_schema($row["ns"]);
} }
$referencable = array_keys(array_filter(table_status('', true), 'Adminer\fk_support')); $referencable = array_keys(array_filter(table_status('', true), 'fk_support'));
$target = array_keys(fields(in_array($row["table"], $referencable) ? $row["table"] : reset($referencable))); $target = array_keys(fields(in_array($row["table"], $referencable) ? $row["table"] : reset($referencable)));
$onchange = "this.form['change-js'].value = '1'; this.form.submit();"; $onchange = "this.form['change-js'].value = '1'; this.form.submit();";
echo "<p>" . lang('Target table') . ": " . html_select("table", $referencable, $row["table"], $onchange) . "\n"; echo "<p>" . lang('Target table') . ": " . html_select("table", $referencable, $row["table"], $onchange) . "\n";
if (support("scheme")) { if ($jush == "pgsql") {
$schemas = array_filter($adminer->schemas(), function ($schema) { echo lang('Schema') . ": " . html_select("ns", $adminer->schemas(), $row["ns"] != "" ? $row["ns"] : $_GET["ns"], $onchange);
return !preg_match('~^information_schema$~i', $schema); } elseif ($jush != "sqlite") {
});
echo lang('Schema') . ": " . html_select("ns", $schemas, $row["ns"] != "" ? $row["ns"] : $_GET["ns"], $onchange);
if ($row["ns"] != "") {
set_schema($orig_schema);
}
} elseif (JUSH != "sqlite") {
$dbs = array(); $dbs = array();
foreach ($adminer->databases() as $db) { foreach ($adminer->databases() as $db) {
if (!information_schema($db)) { if (!information_schema($db)) {
@@ -88,7 +77,7 @@ if (support("scheme")) {
?> ?>
<input type="hidden" name="change-js" value=""> <input type="hidden" name="change-js" value="">
<noscript><p><input type="submit" name="change" value="<?php echo lang('Change'); ?>"></noscript> <noscript><p><input type="submit" name="change" value="<?php echo lang('Change'); ?>"></noscript>
<table> <table cellspacing="0">
<thead><tr><th id="label-source"><?php echo lang('Source'); ?><th id="label-target"><?php echo lang('Target'); ?></thead> <thead><tr><th id="label-source"><?php echo lang('Source'); ?><th id="label-target"><?php echo lang('Target'); ?></thead>
<?php <?php
$j = 0; $j = 0;
@@ -101,20 +90,18 @@ foreach ($row["source"] as $key => $val) {
?> ?>
</table> </table>
<p> <p>
<?php echo lang('ON DELETE'); ?>: <?php echo html_select("on_delete", array(-1 => "") + explode("|", $driver->onActions), $row["on_delete"]); ?> <?php echo lang('ON DELETE'); ?>: <?php echo html_select("on_delete", array(-1 => "") + explode("|", $on_actions), $row["on_delete"]); ?>
<?php echo lang('ON UPDATE'); ?>: <?php echo html_select("on_update", array(-1 => "") + explode("|", $driver->onActions), $row["on_update"]); ?> <?php echo lang('ON UPDATE'); ?>: <?php echo html_select("on_update", array(-1 => "") + explode("|", $on_actions), $row["on_update"]); ?>
<?php echo doc_link(array( <?php echo doc_link(array(
'sql' => "innodb-foreign-key-constraints.html", 'sql' => "innodb-foreign-key-constraints.html",
'mariadb' => "foreign-keys/", 'mariadb' => "foreign-keys/",
'pgsql' => "sql-createtable.html#SQL-CREATETABLE-REFERENCES", 'pgsql' => "sql-createtable.html#SQL-CREATETABLE-REFERENCES",
'mssql' => "t-sql/statements/create-table-transact-sql", 'mssql' => "ms174979.aspx",
'oracle' => "SQLRF01111", 'oracle' => "https://docs.oracle.com/cd/B19306_01/server.102/b14200/clauses002.htm#sthref2903",
)); ?> )); ?>
<p> <p>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript> <noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript>
<?php if ($name != "") { ?> <?php if ($name != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $name)); ?><?php } ?>
<input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $name)); ?>
<?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</form> </form>

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
// any method change in this file should be transferred to editor/include/adminer.inc.php and plugins/plugin.php // any method change in this file should be transferred to editor/include/adminer.inc.php and plugins/plugin.php
class Adminer { class Adminer {
@@ -15,14 +13,14 @@ class Adminer {
} }
/** Connection parameters /** Connection parameters
* @return array [$server, $username, $password] * @return array ($server, $username, $password)
*/ */
function credentials() { function credentials() {
return array(SERVER, $_GET["username"], get_password()); return array(SERVER, $_GET["username"], get_password());
} }
/** Get SSL connection options /** Get SSL connection options
* @return array ["key" => filename, "cert" => filename, "ca" => filename] or null * @return array array("key" => filename, "cert" => filename, "ca" => filename) or null
*/ */
function connectSsl() { function connectSsl() {
} }
@@ -41,7 +39,7 @@ class Adminer {
function bruteForceKey() { function bruteForceKey() {
return $_SERVER["REMOTE_ADDR"]; return $_SERVER["REMOTE_ADDR"];
} }
/** Get server name displayed in breadcrumbs /** Get server name displayed in breadcrumbs
* @param string * @param string
* @return string HTML code or null * @return string HTML code or null
@@ -98,7 +96,7 @@ class Adminer {
*/ */
function head() { function head() {
?> ?>
<link rel="stylesheet" type="text/css" href="../externals/jush/jush.css"> <link rel="stylesheet" type="text/css" href="../vendor/vrana/jush/jush.css">
<?php <?php
return true; return true;
} }
@@ -120,17 +118,17 @@ class Adminer {
*/ */
function loginForm() { function loginForm() {
global $drivers; global $drivers;
echo "<table class='layout'>\n"; echo "<table cellspacing='0' class='layout'>\n";
echo $this->loginFormField('driver', '<tr><th>' . lang('System') . '<td>', html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);")); echo $this->loginFormField('driver', '<tr><th>' . lang('System') . '<td>', html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);") . "\n");
echo $this->loginFormField('server', '<tr><th>' . lang('Server') . '<td>', '<input name="auth[server]" value="' . h(SERVER) . '" title="hostname[:port]" placeholder="localhost" autocapitalize="off">'); echo $this->loginFormField('server', '<tr><th>' . lang('Server') . '<td>', '<input name="auth[server]" value="' . h(SERVER) . '" title="hostname[:port]" placeholder="localhost" autocapitalize="off">' . "\n");
echo $this->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input name="auth[username]" id="username" autofocus value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("qs('#username').form['auth[driver]'].onchange();")); echo $this->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input name="auth[username]" id="username" value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("focus(qs('#username')); qs('#username').form['auth[driver]'].onchange();"));
echo $this->loginFormField('password', '<tr><th>' . lang('Password') . '<td>', '<input type="password" name="auth[password]" autocomplete="current-password">'); echo $this->loginFormField('password', '<tr><th>' . lang('Password') . '<td>', '<input type="password" name="auth[password]" autocomplete="current-password">' . "\n");
echo $this->loginFormField('db', '<tr><th>' . lang('Database') . '<td>', '<input name="auth[db]" value="' . h($_GET["db"]) . '" autocapitalize="off">'); echo $this->loginFormField('db', '<tr><th>' . lang('Database') . '<td>', '<input name="auth[db]" value="' . h($_GET["db"]) . '" autocapitalize="off">' . "\n");
echo "</table>\n"; echo "</table>\n";
echo "<p><input type='submit' value='" . lang('Login') . "'>\n"; echo "<p><input type='submit' value='" . lang('Login') . "'>\n";
echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n"; echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
} }
/** Get login form field /** Get login form field
* @param string * @param string
* @param string HTML * @param string HTML
@@ -138,7 +136,7 @@ class Adminer {
* @return string * @return string
*/ */
function loginFormField($name, $heading, $value) { function loginFormField($name, $heading, $value) {
return $heading . $value . "\n"; return $heading . $value;
} }
/** Authorize the user /** Authorize the user
@@ -176,16 +174,14 @@ class Adminer {
* @return null * @return null
*/ */
function selectLinks($tableStatus, $set = "") { function selectLinks($tableStatus, $set = "") {
global $driver; global $jush, $driver;
echo '<p class="links">'; echo '<p class="links">';
$links = array("select" => lang('Select data')); $links = array("select" => lang('Select data'));
if (support("table") || support("indexes")) { if (support("table") || support("indexes")) {
$links["table"] = lang('Show structure'); $links["table"] = lang('Show structure');
} }
$is_view = false;
if (support("table")) { if (support("table")) {
$is_view = is_view($tableStatus); if (is_view($tableStatus)) {
if ($is_view) {
$links["view"] = lang('Alter view'); $links["view"] = lang('Alter view');
} else { } else {
$links["create"] = lang('Alter table'); $links["create"] = lang('Alter table');
@@ -198,7 +194,7 @@ class Adminer {
foreach ($links as $key => $val) { foreach ($links as $key => $val) {
echo " <a href='" . h(ME) . "$key=" . urlencode($name) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>"; echo " <a href='" . h(ME) . "$key=" . urlencode($name) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
} }
echo doc_link(array(JUSH => $driver->tableHelp($name, $is_view)), "?"); echo doc_link(array($jush => $driver->tableHelp($name)), "?");
echo "\n"; echo "\n";
} }
@@ -234,25 +230,34 @@ class Adminer {
* @return string * @return string
*/ */
function selectQuery($query, $start, $failed = false) { function selectQuery($query, $start, $failed = false) {
global $driver; global $jush, $driver;
$return = "</p>\n"; // required for IE9 inline edit
$supportSql = support("sql");
$result = "<p>"
. "<code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> "
. "<span class='time'>(" . format_time($start) . ")</span>"
. ($supportSql ? " <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" : "");
if (!$failed && ($warnings = $driver->warnings())) { if (!$failed && ($warnings = $driver->warnings())) {
$id = "warnings"; $id = "warnings";
$return = ", <a href='#$id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$id');", "") $result = ($supportSql ? "," : "")
. "$return<div id='$id' class='hidden'>\n$warnings</div>\n" . " <a href='#$id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$id');", "")
; . "</p>\n"
. "<div id='$id' class='hidden'>\n$warnings</div>\n";
} else {
$result .= "</p>\n";
} }
return "<p><code class='jush-" . JUSH . "'>" . h(str_replace("\n", " ", $query)) . "</code> <span class='time'>(" . format_time($start) . ")</span>"
. (support("sql") ? " <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" : "") return $result;
. $return
;
} }
/** Query printed in SQL command before execution /** Query printed in SQL command before execution
* @param string query to be executed * @param string query to be executed
* @return string escaped query to be printed * @return string escaped query to be printed
*/ */
function sqlCommandQuery($query) { function sqlCommandQuery($query)
{
return shorten_utf8(trim($query), 1000); return shorten_utf8(trim($query), 1000);
} }
@@ -296,7 +301,7 @@ class Adminer {
if (preg_match('~json~', $field["type"])) { if (preg_match('~json~', $field["type"])) {
$return = "<code class='jush-js'>$return</code>"; $return = "<code class='jush-js'>$return</code>";
} }
return ($link ? "<a href='" . h($link) . "'" . (is_url($link) ? target_blank() : "") . ">$return</a>" : $return); return ($link ? "<a href='" . h($link) . "'" . (is_web_url($link) ? target_blank() : "") . ">$return</a>" : $return);
} }
/** Value conversion used in select and edit /** Value conversion used in select and edit
@@ -313,22 +318,15 @@ class Adminer {
* @return null * @return null
*/ */
function tableStructurePrint($fields) { function tableStructurePrint($fields) {
global $driver;
echo "<div class='scrollable'>\n"; echo "<div class='scrollable'>\n";
echo "<table class='nowrap odds'>\n"; echo "<table cellspacing='0' class='nowrap'>\n";
echo "<thead><tr><th>" . lang('Column') . "<td>" . lang('Type') . (support("comment") ? "<td>" . lang('Comment') : "") . "</thead>\n"; echo "<thead><tr><th>" . lang('Column') . "<td>" . lang('Type') . (support("comment") ? "<td>" . lang('Comment') : "") . "</thead>\n";
$structured_types = $driver->structuredTypes();
foreach ($fields as $field) { foreach ($fields as $field) {
echo "<tr><th>" . h($field["field"]); echo "<tr" . odd() . "><th>" . h($field["field"]);
$type = h($field["full_type"]); echo "<td><span title='" . h($field["collation"]) . "'>" . h($field["full_type"]) . "</span>";
echo "<td><span title='" . h($field["collation"]) . "'>"
. (in_array($type, (array) $structured_types[lang('User types')]) ? "<a href='" . h(ME . 'type=' . urlencode($type)) . "'>$type</a>" : $type)
. "</span>"
;
echo ($field["null"] ? " <i>NULL</i>" : ""); echo ($field["null"] ? " <i>NULL</i>" : "");
echo ($field["auto_increment"] ? " <i>" . lang('Auto Increment') . "</i>" : ""); echo ($field["auto_increment"] ? " <i>" . lang('Auto Increment') . "</i>" : "");
$default = h($field["default"]); echo (isset($field["default"]) ? " <span title='" . lang('Default value') . "'>[<b>" . h($field["default"]) . "</b>]</span>" : "");
echo (isset($field["default"]) ? " <span title='" . lang('Default value') . "'>[<b>" . ($field["generated"] ? "<code class='jush-" . JUSH . "'>$default</code>" : $default) . "</b>]</span>" : "");
echo (support("comment") ? "<td>" . h($field["comment"]) : ""); echo (support("comment") ? "<td>" . h($field["comment"]) : "");
echo "\n"; echo "\n";
} }
@@ -341,7 +339,7 @@ class Adminer {
* @return null * @return null
*/ */
function tableIndexesPrint($indexes) { function tableIndexesPrint($indexes) {
echo "<table>\n"; echo "<table cellspacing='0'>\n";
foreach ($indexes as $name => $index) { foreach ($indexes as $name => $index) {
ksort($index["columns"]); // enforce correct columns order ksort($index["columns"]); // enforce correct columns order
$print = array(); $print = array();
@@ -362,7 +360,7 @@ class Adminer {
* @return null * @return null
*/ */
function selectColumnsPrint($select, $columns) { function selectColumnsPrint($select, $columns) {
global $driver; global $functions, $grouping;
print_fieldset("select", lang('Select'), $select); print_fieldset("select", lang('Select'), $select);
$i = 0; $i = 0;
$select[""] = array(); $select[""] = array();
@@ -374,7 +372,8 @@ class Adminer {
$val["col"], $val["col"],
($key !== "" ? "selectFieldChange" : "selectAddRow") ($key !== "" ? "selectFieldChange" : "selectAddRow")
); );
echo "<div>" . ($driver->functions || $driver->grouping ? html_select("columns[$i][fun]", array(-1 => "") + array_filter(array(lang('Functions') => $driver->functions, lang('Aggregation') => $driver->grouping)), $val["fun"]) echo "<div>" . ($functions || $grouping ? "<select name='columns[$i][fun]'>"
. optionlist(array(-1 => "") + array_filter(array(lang('Functions') => $functions, lang('Aggregation') => $grouping)), $val["fun"]) . "</select>"
. on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'", 1) . on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'", 1)
. script("qsl('select').onchange = function () { helpClose();" . ($key !== "" ? "" : " qsl('select, input', this.parentNode).onchange();") . " };", "") . script("qsl('select').onchange = function () { helpClose();" . ($key !== "" ? "" : " qsl('select, input', this.parentNode).onchange();") . " };", "")
. "($column)" : $column) . "</div>\n"; . "($column)" : $column) . "</div>\n";
@@ -393,7 +392,7 @@ class Adminer {
print_fieldset("search", lang('Search'), $where); print_fieldset("search", lang('Search'), $where);
foreach ($indexes as $i => $index) { foreach ($indexes as $i => $index) {
if ($index["type"] == "FULLTEXT") { if ($index["type"] == "FULLTEXT") {
echo "<div>(<i>" . implode("</i>, <i>", array_map('Adminer\h', $index["columns"])) . "</i>) AGAINST"; echo "<div>(<i>" . implode("</i>, <i>", array_map('h', $index["columns"])) . "</i>) AGAINST";
echo " <input type='search' name='fulltext[$i]' value='" . h($_GET["fulltext"][$i]) . "'>"; echo " <input type='search' name='fulltext[$i]' value='" . h($_GET["fulltext"][$i]) . "'>";
echo script("qsl('input').oninput = selectFieldChange;", ""); echo script("qsl('input').oninput = selectFieldChange;", "");
echo checkbox("boolean[$i]", 1, isset($_GET["boolean"][$i]), "BOOL"); echo checkbox("boolean[$i]", 1, isset($_GET["boolean"][$i]), "BOOL");
@@ -489,7 +488,7 @@ class Adminer {
echo "</script>\n"; echo "</script>\n";
echo "</div></fieldset>\n"; echo "</div></fieldset>\n";
} }
/** Print command box in select /** Print command box in select
* @return bool whether to print default commands * @return bool whether to print default commands
*/ */
@@ -515,16 +514,16 @@ class Adminer {
/** Process columns box in select /** Process columns box in select
* @param array selectable columns * @param array selectable columns
* @param array * @param array
* @return array [[select_expressions], [group_expressions]] * @return array (array(select_expressions), array(group_expressions))
*/ */
function selectColumnsProcess($columns, $indexes) { function selectColumnsProcess($columns, $indexes) {
global $driver; global $functions, $grouping;
$select = array(); // select expressions, empty for * $select = array(); // select expressions, empty for *
$group = array(); // expressions without aggregation - will be used for GROUP BY if an aggregation function is used $group = array(); // expressions without aggregation - will be used for GROUP BY if an aggregation function is used
foreach ((array) $_GET["columns"] as $key => $val) { foreach ((array) $_GET["columns"] as $key => $val) {
if ($val["fun"] == "count" || ($val["col"] != "" && (!$val["fun"] || in_array($val["fun"], $driver->functions) || in_array($val["fun"], $driver->grouping)))) { if ($val["fun"] == "count" || ($val["col"] != "" && (!$val["fun"] || in_array($val["fun"], $functions) || in_array($val["fun"], $grouping)))) {
$select[$key] = apply_sql_function($val["fun"], ($val["col"] != "" ? idf_escape($val["col"]) : "*")); $select[$key] = apply_sql_function($val["fun"], ($val["col"] != "" ? idf_escape($val["col"]) : "*"));
if (!in_array($val["fun"], $driver->grouping)) { if (!in_array($val["fun"], $grouping)) {
$group[] = $select[$key]; $group[] = $select[$key];
} }
} }
@@ -542,7 +541,7 @@ class Adminer {
$return = array(); $return = array();
foreach ($indexes as $i => $index) { foreach ($indexes as $i => $index) {
if ($index["type"] == "FULLTEXT" && $_GET["fulltext"][$i] != "") { if ($index["type"] == "FULLTEXT" && $_GET["fulltext"][$i] != "") {
$return[] = "MATCH (" . implode(", ", array_map('Adminer\idf_escape', $index["columns"])) . ") AGAINST (" . q($_GET["fulltext"][$i]) . (isset($_GET["boolean"][$i]) ? " IN BOOLEAN MODE" : "") . ")"; $return[] = "MATCH (" . implode(", ", array_map('idf_escape', $index["columns"])) . ") AGAINST (" . q($_GET["fulltext"][$i]) . (isset($_GET["boolean"][$i]) ? " IN BOOLEAN MODE" : "") . ")";
} }
} }
foreach ((array) $_GET["where"] as $key => $val) { foreach ((array) $_GET["where"] as $key => $val) {
@@ -570,9 +569,8 @@ class Adminer {
// find anywhere // find anywhere
$cols = array(); $cols = array();
foreach ($fields as $name => $field) { foreach ($fields as $name => $field) {
if ( if (isset($field["privileges"]["where"])
isset($field["privileges"]["where"]) && (preg_match('~^[-\d.' . (preg_match('~IN$~', $val["op"]) ? ',' : '') . ']+$~', $val["val"]) || !preg_match('~' . number_type() . '|bit~', $field["type"]))
&& (preg_match('~^[-\d.' . (preg_match('~IN$~', $val["op"]) ? ',' : '') . ']+$~', $val["val"]) || !preg_match('~' . number_type() . '|bit~', $field["type"]))
&& (!preg_match("~[\x80-\xFF]~", $val["val"]) || preg_match('~char|text|enum|set~', $field["type"])) && (!preg_match("~[\x80-\xFF]~", $val["val"]) || preg_match('~char|text|enum|set~', $field["type"]))
&& (!preg_match('~date|timestamp~', $field["type"]) || preg_match('~^\d+-\d+-\d+~', $val["val"])) && (!preg_match('~date|timestamp~', $field["type"]) || preg_match('~^\d+-\d+-\d+~', $val["val"]))
) { ) {
@@ -646,7 +644,7 @@ class Adminer {
* @return string * @return string
*/ */
function messageQuery($query, $time, $failed = false) { function messageQuery($query, $time, $failed = false) {
global $driver; global $jush, $driver;
restart_session(); restart_session();
$history = &get_session("queries"); $history = &get_session("queries");
if (!$history[$_GET["db"]]) { if (!$history[$_GET["db"]]) {
@@ -663,7 +661,7 @@ class Adminer {
$return = "<a href='#$id' class='toggle'>" . lang('Warnings') . "</a>, $return<div id='$id' class='hidden'>\n$warnings</div>\n"; $return = "<a href='#$id' class='toggle'>" . lang('Warnings') . "</a>, $return<div id='$id' class='hidden'>\n$warnings</div>\n";
} }
return " <span class='time'>" . @date("H:i:s") . "</span>" // @ - time zone may be not set return " <span class='time'>" . @date("H:i:s") . "</span>" // @ - time zone may be not set
. " $return<div id='$sql_id' class='hidden'><pre><code class='jush-" . JUSH . "'>" . shorten_utf8($query, 1000) . "</code></pre>" . " $return<div id='$sql_id' class='hidden'><pre><code class='jush-$jush'>" . shorten_utf8($query, 1000) . "</code></pre>"
. ($time ? " <span class='time'>($time)</span>" : '') . ($time ? " <span class='time'>($time)</span>" : '')
. (support("sql") ? '<p><a href="' . h(str_replace("db=" . urlencode(DB), "db=" . urlencode($_GET["db"]), ME) . 'sql=&history=' . (count($history[$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a>' : '') . (support("sql") ? '<p><a href="' . h(str_replace("db=" . urlencode(DB), "db=" . urlencode($_GET["db"]), ME) . 'sql=&history=' . (count($history[$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a>' : '')
. '</div>' . '</div>'
@@ -685,10 +683,10 @@ class Adminer {
* @return array * @return array
*/ */
function editFunctions($field) { function editFunctions($field) {
global $driver; global $edit_functions;
$return = ($field["null"] ? "NULL/" : ""); $return = ($field["null"] ? "NULL/" : "");
$update = isset($_GET["select"]) || where($_GET); $update = isset($_GET["select"]) || where($_GET);
foreach ($driver->editFunctions as $key => $functions) { foreach ($edit_functions as $key => $functions) {
if (!$key || (!isset($_GET["call"]) && $update)) { // relative functions if (!$key || (!isset($_GET["call"]) && $update)) { // relative functions
foreach ($functions as $pattern => $val) { foreach ($functions as $pattern => $val) {
if (!$pattern || preg_match("~$pattern~", $field["type"])) { if (!$pattern || preg_match("~$pattern~", $field["type"])) {
@@ -717,7 +715,7 @@ class Adminer {
if ($field["type"] == "enum") { if ($field["type"] == "enum") {
return (isset($_GET["select"]) ? "<label><input type='radio'$attrs value='-1' checked><i>" . lang('original') . "</i></label> " : "") return (isset($_GET["select"]) ? "<label><input type='radio'$attrs value='-1' checked><i>" . lang('original') . "</i></label> " : "")
. ($field["null"] ? "<label><input type='radio'$attrs value=''" . ($value !== null || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "") . ($field["null"] ? "<label><input type='radio'$attrs value=''" . ($value !== null || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "")
. enum_input("radio", $attrs, $field, $value, $value === 0 ? 0 : null) // 0 - empty value . enum_input("radio", $attrs, $field, $value, 0) // 0 - empty
; ;
} }
return ""; return "";
@@ -765,10 +763,11 @@ class Adminer {
* @return array * @return array
*/ */
function dumpOutput() { function dumpOutput() {
$return = array('text' => lang('open'), 'file' => lang('save')); $return = array('file' => lang('save'), 'text' => lang('open'));
if (function_exists('gzencode')) { if (function_exists('gzencode')) {
$return['gz'] = 'gzip'; $return['gz'] = 'gzip';
} }
return $return; return $return;
} }
@@ -776,7 +775,7 @@ class Adminer {
* @return array empty to disable export * @return array empty to disable export
*/ */
function dumpFormat() { function dumpFormat() {
return (support("dump") ? array('sql' => 'SQL') : array()) + array('csv' => 'CSV,', 'csv;' => 'CSV;', 'tsv' => 'TSV'); return array('sql' => 'SQL', 'csv' => 'CSV,', 'csv;' => 'CSV;', 'tsv' => 'TSV');
} }
/** Export database structure /** Export database structure
@@ -828,32 +827,21 @@ class Adminer {
* @return null prints data * @return null prints data
*/ */
function dumpData($table, $style, $query) { function dumpData($table, $style, $query) {
global $connection; global $connection, $jush;
$max_packet = ($jush == "sqlite" ? 0 : 1048576); // default, minimum is 1024
if ($style) { if ($style) {
$max_packet = (JUSH == "sqlite" ? 0 : 1048576); // default, minimum is 1024
$fields = array();
$identity_insert = false;
if ($_POST["format"] == "sql") { if ($_POST["format"] == "sql") {
if ($style == "TRUNCATE+INSERT") { if ($style == "TRUNCATE+INSERT") {
echo truncate_sql($table) . ";\n"; echo truncate_sql($table) . ";\n";
} }
$fields = fields($table); $fields = fields($table);
if (JUSH == "mssql") {
foreach ($fields as $field) {
if ($field["auto_increment"]) {
echo "SET IDENTITY_INSERT " . table($table) . " ON;\n";
$identity_insert = true;
break;
}
}
}
} }
$result = $connection->query($query, 1); // 1 - MYSQLI_USE_RESULT //! enum and set as numbers $result = $connection->query($query, 1); // 1 - MYSQLI_USE_RESULT //! enum and set as numbers
if ($result) { if ($result) {
$insert = ""; $insert = "";
$buffer = ""; $buffer = "";
$keys = array(); $keys = array();
$generated = array(); $generatedKeys = array();
$suffix = ""; $suffix = "";
$fetch_function = ($table != '' ? 'fetch_assoc' : 'fetch_row'); $fetch_function = ($table != '' ? 'fetch_assoc' : 'fetch_row');
while ($row = $result->$fetch_function()) { while ($row = $result->$fetch_function()) {
@@ -861,10 +849,10 @@ class Adminer {
$values = array(); $values = array();
foreach ($row as $val) { foreach ($row as $val) {
$field = $result->fetch_field(); $field = $result->fetch_field();
if ($fields[$field->name]['generated']) { if (!empty($fields[$field->name]['generated'])) {
$generated[$field->name] = true; $generatedKeys[$field->name] = true;
continue; continue;
} }
$keys[] = $field->name; $keys[] = $field->name;
$key = idf_escape($field->name); $key = idf_escape($field->name);
$values[] = "$key = VALUES($key)"; $values[] = "$key = VALUES($key)";
@@ -879,13 +867,13 @@ class Adminer {
dump_csv($row); dump_csv($row);
} else { } else {
if (!$insert) { if (!$insert) {
$insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('Adminer\idf_escape', $keys)) . ") VALUES"; $insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('idf_escape', $keys)) . ") VALUES";
} }
foreach ($row as $key => $val) { foreach ($row as $key => $val) {
if ($generated[$key]) { if (isset($generatedKeys[$key])) {
unset($row[$key]); unset($row[$key]);
continue; continue;
} }
$field = $fields[$key]; $field = $fields[$key];
$row[$key] = ($val !== null $row[$key] = ($val !== null
? unconvert_field($field, preg_match(number_type(), $field["type"]) && !preg_match('~\[~', $field["full_type"]) && is_numeric($val) ? $val : q(($val === false ? 0 : $val))) ? unconvert_field($field, preg_match(number_type(), $field["type"]) && !preg_match('~\[~', $field["full_type"]) && is_numeric($val) ? $val : q(($val === false ? 0 : $val)))
@@ -909,9 +897,6 @@ class Adminer {
} elseif ($_POST["format"] == "sql") { } elseif ($_POST["format"] == "sql") {
echo "-- " . str_replace("\n", " ", $connection->error) . "\n"; echo "-- " . str_replace("\n", " ", $connection->error) . "\n";
} }
if ($identity_insert) {
echo "SET IDENTITY_INSERT " . table($table) . " OFF;\n";
}
} }
} }
@@ -965,17 +950,16 @@ class Adminer {
* @return null * @return null
*/ */
function navigation($missing) { function navigation($missing) {
global $VERSION, $drivers, $connection; global $VERSION, $jush, $drivers, $connection;
?> ?>
<h1> <h1>
<?php echo $this->name(); ?> <?php echo $this->name(); ?>
<span class="version"> <?php if ($missing != "auth"): ?>
<?php echo $VERSION; ?> <span class="version"><?php echo $VERSION; ?></span>
<a href="https://www.adminer.org/#download"<?php echo target_blank(); ?> id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a> <a href="https://www.adminer.org/#download"<?php echo target_blank(); ?> id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
</span> <?php endif; ?>
</h1> </h1>
<?php <?php
switch_lang();
if ($missing == "auth") { if ($missing == "auth") {
$output = ""; $output = "";
foreach ((array) $_SESSION["pwds"] as $vendor => $servers) { foreach ((array) $_SESSION["pwds"] as $vendor => $servers) {
@@ -999,12 +983,12 @@ class Adminer {
$connection->select_db(DB); $connection->select_db(DB);
$tables = table_status('', true); $tables = table_status('', true);
} }
echo script_src("../externals/jush/modules/jush.js"); echo script_src("../vendor/vrana/jush/modules/jush.js");
echo script_src("../externals/jush/modules/jush-textarea.js"); echo script_src("../vendor/vrana/jush/modules/jush-textarea.js");
echo script_src("../externals/jush/modules/jush-txt.js"); echo script_src("../vendor/vrana/jush/modules/jush-txt.js");
echo script_src("../externals/jush/modules/jush-js.js"); echo script_src("../vendor/vrana/jush/modules/jush-js.js");
if (support("sql")) { if (support("sql")) {
echo script_src("../externals/jush/modules/jush-" . JUSH . ".js"); echo script_src("../vendor/vrana/jush/modules/jush-$jush.js");
?> ?>
<script<?php echo nonce(); ?>> <script<?php echo nonce(); ?>>
<?php <?php
@@ -1013,9 +997,9 @@ class Adminer {
foreach ($tables as $table => $type) { foreach ($tables as $table => $type) {
$links[] = preg_quote($table, '/'); $links[] = preg_quote($table, '/');
} }
echo "var jushLinks = { " . JUSH . ": [ '" . js_escape(ME) . (support("table") ? "table=" : "select=") . "\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n"; echo "var jushLinks = { $jush: [ '" . js_escape(ME) . (support("table") ? "table=" : "select=") . "\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n";
foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) { foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
echo "jushLinks.$val = jushLinks." . JUSH . ";\n"; echo "jushLinks.$val = jushLinks.$jush;\n";
} }
} }
$server_info = $connection->server_info; $server_info = $connection->server_info;
@@ -1025,24 +1009,18 @@ bodyLoad('<?php echo (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '
<?php <?php
} }
$this->databasesPrint($missing); $this->databasesPrint($missing);
$actions = array();
if (DB == "" || !$missing) { if (DB == "" || !$missing) {
if (support("sql")) { echo "<p class='links'>" . (support("sql") ? "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"]) && !isset($_GET["import"])) . ">" . lang('SQL command') . "</a>\n<a href='" . h(ME) . "import='" . bold(isset($_GET["import"])) . ">" . lang('Import') . "</a>\n" : "") . "";
$actions[] = "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"]) && !isset($_GET["import"])) . ">" . lang('SQL command') . "</a>"; if (support("dump")) {
$actions[] = "<a href='" . h(ME) . "import='" . bold(isset($_GET["import"])) . ">" . lang('Import') . "</a>"; echo "<a href='" . h(ME) . "dump=" . urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]) . "' id='dump'" . bold(isset($_GET["dump"])) . ">" . lang('Export') . "</a>\n";
} }
$actions[] = "<a href='" . h(ME) . "dump=" . urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]) . "' id='dump'" . bold(isset($_GET["dump"])) . ">" . lang('Export') . "</a>";
} }
$in_db = $_GET["ns"] !== "" && !$missing && DB != ""; if ($_GET["ns"] !== "" && !$missing && DB != "") {
if ($in_db) { echo '<a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create table') . "</a>\n";
$actions[] = '<a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create table') . "</a>"; if (!$tables) {
} echo "<p class='message'>" . lang('No tables.') . "\n";
echo ($actions ? "<p class='links'>\n" . implode("\n", $actions) . "\n" : "");
if ($in_db) {
if ($tables) {
$this->tablesPrint($tables);
} else { } else {
echo "<p class='message'>" . lang('No tables.') . "</p>\n"; $this->tablesPrint($tables);
} }
} }
} }
@@ -1064,14 +1042,14 @@ bodyLoad('<?php echo (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '
<?php <?php
hidden_fields_get(); hidden_fields_get();
$db_events = script("mixin(qsl('select'), {onmousedown: dbMouseDown, onchange: dbChange});"); $db_events = script("mixin(qsl('select'), {onmousedown: dbMouseDown, onchange: dbChange});");
echo "<span title='" . lang('Database') . "'>" . lang('DB') . "</span>: " . ($databases echo "<span title='" . lang('database') . "'>" . lang('DB') . "</span>: " . ($databases
? html_select("db", array("" => "") + $databases, DB) . $db_events ? "<select name='db'>" . optionlist(array("" => "") + $databases, DB) . "</select>$db_events"
: "<input name='db' value='" . h(DB) . "' autocapitalize='off' size='19'>\n" : "<input name='db' value='" . h(DB) . "' autocapitalize='off'>\n"
); );
echo "<input type='submit' value='" . lang('Use') . "'" . ($databases ? " class='hidden'" : "") . ">\n"; echo "<input type='submit' value='" . lang('Use') . "'" . ($databases ? " class='hidden'" : "") . ">\n";
if (support("scheme")) { if (support("scheme")) {
if ($missing != "db" && DB != "" && $connection->select_db(DB)) { if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
echo "<br>" . lang('Schema') . ": " . html_select("ns", array("" => "") + $adminer->schemas(), $_GET["ns"]) . $db_events; echo "<br>" . lang('Schema') . ": <select name='ns'>" . optionlist(array("" => "") + $adminer->schemas(), $_GET["ns"]) . "</select>$db_events";
if ($_GET["ns"] != "") { if ($_GET["ns"] != "") {
set_schema($_GET["ns"]); set_schema($_GET["ns"]);
} }
@@ -1109,4 +1087,5 @@ bodyLoad('<?php echo (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '
} }
echo "</ul>\n"; echo "</ul>\n";
} }
} }

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$connection = ''; $connection = '';
$has_token = $_SESSION["token"]; $has_token = $_SESSION["token"];
@@ -17,6 +15,71 @@ if ($_COOKIE["adminer_permanent"]) {
} }
} }
function validate_server_input() {
if (SERVER == "") {
return;
}
$parts = parse_url(SERVER);
if (!$parts) {
auth_error(lang('Invalid server or credentials.'));
}
// Check proper URL parts.
if (isset($parts['user']) || isset($parts['pass']) || isset($parts['query']) || isset($parts['fragment'])) {
auth_error(lang('Invalid server or credentials.'));
}
// Allow only HTTP/S scheme.
if (isset($parts['scheme']) && !preg_match('~^(https?)$~i', $parts['scheme'])) {
auth_error(lang('Invalid server or credentials.'));
}
// Note that "localhost" and IP address without a scheme is parsed as a path.
$hostPath = (isset($parts['host']) ? $parts['host'] : '') . (isset($parts['path']) ? $parts['path'] : '');
// Validate host.
if (!is_server_host_valid($hostPath)) {
auth_error(lang('Invalid server or credentials.'));
}
// Check privileged ports.
if (isset($parts['port']) && ($parts['port'] < 1024 || $parts['port'] > 65535)) {
auth_error(lang('Connecting to privileged ports is not allowed.'));
}
}
if (!function_exists('is_server_host_valid')) {
/**
* @param string $hostPath
* @return bool
*/
function is_server_host_valid($hostPath)
{
return strpos($hostPath, '/') === false;
}
}
/**
* @param string $server
* @param string $username
* @param string $password
* @param string $defaultServer
* @param int|null $defaultPort
* @return string
*/
function build_http_url($server, $username, $password, $defaultServer, $defaultPort = null) {
if (!preg_match('~^(https?://)?([^:]*)(:\d+)?$~', rtrim($server, '/'), $matches)) {
$this->error = lang('Invalid server or credentials.');
return false;
}
return ($matches[1] ?: "http://") .
($username !== "" || $password !== "" ? "$username:$password@" : "") .
($matches[2] !== "" ? $matches[2] : $defaultServer) .
(isset($matches[3]) ? $matches[3] : ($defaultPort ? ":$defaultPort" : ""));
}
function add_invalid_login() { function add_invalid_login() {
global $adminer; global $adminer;
$fp = file_open_lock(get_temp_dir() . "/adminer.invalid"); $fp = file_open_lock(get_temp_dir() . "/adminer.invalid");
@@ -54,7 +117,7 @@ $auth = $_POST["auth"];
if ($auth) { if ($auth) {
session_regenerate_id(); // defense against session fixation session_regenerate_id(); // defense against session fixation
$vendor = $auth["driver"]; $vendor = $auth["driver"];
$server = $auth["server"]; $server = trim($auth["server"]);
$username = $auth["username"]; $username = $auth["username"];
$password = (string) $auth["password"]; $password = (string) $auth["password"];
$db = $auth["db"]; $db = $auth["db"];
@@ -66,8 +129,7 @@ if ($auth) {
$permanent[$key] = "$key:" . base64_encode($private ? encrypt_string($password, $private) : ""); $permanent[$key] = "$key:" . base64_encode($private ? encrypt_string($password, $private) : "");
cookie("adminer_permanent", implode(" ", $permanent)); cookie("adminer_permanent", implode(" ", $permanent));
} }
if ( if (count($_POST) == 1 // 1 - auth
count($_POST) == 1 // 1 - auth
|| DRIVER != $vendor || DRIVER != $vendor
|| SERVER != $server || SERVER != $server
|| $_GET["username"] !== $username // "0" == "00" || $_GET["username"] !== $username // "0" == "00"
@@ -133,7 +195,7 @@ function auth_error($error) {
$error = lang('Session support must be enabled.'); $error = lang('Session support must be enabled.');
} }
$params = session_get_cookie_params(); $params = session_get_cookie_params();
cookie("adminer_key", ($_COOKIE["adminer_key"] ?: rand_string()), $params["lifetime"]); cookie("adminer_key", ($_COOKIE["adminer_key"] ? $_COOKIE["adminer_key"] : rand_string()), $params["lifetime"]);
page_header(lang('Login'), $error, null); page_header(lang('Login'), $error, null);
echo "<form action='' method='post'>\n"; echo "<form action='' method='post'>\n";
echo "<div>"; echo "<div>";
@@ -147,10 +209,10 @@ function auth_error($error) {
exit; exit;
} }
if (isset($_GET["username"]) && !class_exists('Adminer\Db')) { if (isset($_GET["username"]) && !class_exists("Min_DB")) {
unset($_SESSION["pwds"][DRIVER]); unset($_SESSION["pwds"][DRIVER]);
unset_permanent(); unset_permanent();
page_header(lang('No extension'), lang('None of the supported PHP extensions (%s) are available.', implode(", ", Driver::$possibleDrivers)), false); page_header(lang('No extension'), lang('None of the supported PHP extensions (%s) are available.', implode(", ", $possible_drivers)), false);
page_footer("auth"); page_footer("auth");
exit; exit;
} }
@@ -158,23 +220,16 @@ if (isset($_GET["username"]) && !class_exists('Adminer\Db')) {
stop_session(true); stop_session(true);
if (isset($_GET["username"]) && is_string(get_password())) { if (isset($_GET["username"]) && is_string(get_password())) {
list($host, $port) = explode(":", SERVER, 2); validate_server_input();
if (preg_match('~^\s*([-+]?\d+)~', $port, $match) && ($match[1] < 1024 || $match[1] > 65535)) { // is_numeric('80#') would still connect to port 80
auth_error(lang('Connecting to privileged ports is not allowed.'));
}
check_invalid_login(); check_invalid_login();
$connection = connect($adminer->credentials());
if (is_object($connection)) { $connection = connect();
$driver = new Driver($connection); $driver = new Min_Driver($connection);
if ($adminer->operators === null) {
$adminer->operators = $driver->operators;
}
}
} }
$login = null; $login = null;
if (!is_object($connection) || ($login = $adminer->login($_GET["username"], get_password())) !== true) { if (!is_object($connection) || ($login = $adminer->login($_GET["username"], get_password())) !== true) {
$error = (is_string($connection) ? nl_br(h($connection)) : (is_string($login) ? $login : lang('Invalid credentials.'))); $error = (is_string($connection) ? h($connection) : (is_string($login) ? $login : lang('Invalid server or credentials.')));
auth_error($error . (preg_match('~^ | $~', get_password()) ? '<br>' . lang('There is a space in the input password which might be the cause.') : '')); auth_error($error . (preg_match('~^ | $~', get_password()) ? '<br>' . lang('There is a space in the input password which might be the cause.') : ''));
} }

View File

@@ -1,8 +1,11 @@
<?php <?php
namespace Adminer; function adminer_errors($errno, $errstr) {
return (bool)preg_match('~^(Trying to access array offset on( value of type)? null|Undefined array key)~', $errstr);
}
error_reporting(6135); // errors and warnings
set_error_handler('adminer_errors', E_WARNING);
include "../adminer/include/version.inc.php";
include "../adminer/include/errors.inc.php";
include "../adminer/include/coverage.inc.php"; include "../adminer/include/coverage.inc.php";
// disable filter.default // disable filter.default
@@ -35,7 +38,7 @@ if ($_GET["script"] == "version") {
exit; exit;
} }
global $adminer, $connection, $driver, $drivers, $error, $HTTPS, $LANG, $langs, $permanent, $has_token, $token, $translations, $VERSION; // allows including Adminer inside a function global $adminer, $connection, $driver, $drivers, $edit_functions, $enum_length, $error, $functions, $grouping, $HTTPS, $inout, $jush, $LANG, $langs, $on_actions, $permanent, $structured_types, $has_token, $token, $translations, $types, $unsigned, $VERSION; // allows including Adminer inside a function
if (!$_SERVER["REQUEST_URI"]) { // IIS 5 compatibility if (!$_SERVER["REQUEST_URI"]) { // IIS 5 compatibility
$_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"]; $_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"];
@@ -52,7 +55,11 @@ $HTTPS = ($_SERVER["HTTPS"] && strcasecmp($_SERVER["HTTPS"], "off")) || ini_bool
if (!defined("SID")) { if (!defined("SID")) {
session_cache_limiter(""); // to allow restarting session session_cache_limiter(""); // to allow restarting session
session_name("adminer_sid"); // use specific session name to get own namespace session_name("adminer_sid"); // use specific session name to get own namespace
session_set_cookie_params(0, preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"]), "", $HTTPS, true); // ini_set() may be disabled $params = array(0, preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"]), "", $HTTPS);
if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
$params[] = true; // HttpOnly
}
call_user_func_array('session_set_cookie_params', $params); // ini_set() may be disabled
session_start(); session_start();
} }
@@ -78,20 +85,34 @@ include "./include/adminer.inc.php";
$adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer); $adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer);
include "../adminer/drivers/mysql.inc.php"; // must be included as last driver include "../adminer/drivers/mysql.inc.php"; // must be included as last driver
define('Adminer\JUSH', Driver::$jush); $config = driver_config();
define('Adminer\SERVER', $_GET[DRIVER]); // read from pgsql=localhost $possible_drivers = $config['possible_drivers'];
define('Adminer\DB', $_GET["db"]); // for the sake of speed and size $jush = $config['jush'];
define( $types = $config['types'];
'Adminer\ME', $structured_types = $config['structured_types'];
preg_replace('~\?.*~', '', relative_uri()) . '?' $unsigned = $config['unsigned'];
. (sid() ? SID . '&' : '') $operators = $config['operators'];
. (SERVER !== null ? DRIVER . "=" . urlencode(SERVER) . '&' : '') $functions = $config['functions'];
. (isset($_GET["username"]) ? "username=" . urlencode($_GET["username"]) . '&' : '') $grouping = $config['grouping'];
. (DB != "" ? 'db=' . urlencode(DB) . '&' . (isset($_GET["ns"]) ? "ns=" . urlencode($_GET["ns"]) . "&" : "") : '') $edit_functions = $config['edit_functions'];
if ($adminer->operators === null) {
$adminer->operators = $operators;
}
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
define("DB", $_GET["db"]); // for the sake of speed and size
define("ME", preg_replace('~\?.*~', '', relative_uri()) . '?'
. (sid() ? SID . '&' : '')
. (SERVER !== null ? DRIVER . "=" . urlencode(SERVER) . '&' : '')
. (isset($_GET["username"]) ? "username=" . urlencode($_GET["username"]) . '&' : '')
. (DB != "" ? 'db=' . urlencode(DB) . '&' . (isset($_GET["ns"]) ? "ns=" . urlencode($_GET["ns"]) . "&" : "") : '')
); );
include "../adminer/include/version.inc.php";
include "../adminer/include/design.inc.php"; include "../adminer/include/design.inc.php";
include "../adminer/include/xxtea.inc.php"; include "../adminer/include/xxtea.inc.php";
include "../adminer/include/auth.inc.php"; include "../adminer/include/auth.inc.php";
include "./include/editing.inc.php"; include "./include/editing.inc.php";
include "./include/connect.inc.php"; include "./include/connect.inc.php";
$on_actions = "RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT"; ///< @var string used in foreign_keys()

View File

@@ -1,18 +1,6 @@
<?php <?php
namespace Adminer; function connect_error() {
global $adminer, $connection, $token, $error, $drivers;
if (isset($_GET["status"])) {
$_GET["variables"] = $_GET["status"];
}
if (isset($_GET["import"])) {
$_GET["sql"] = $_GET["import"];
}
if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"]) || $_GET["script"] == "connect" || $_GET["script"] == "kill")) {
if (DB != "" || $_GET["refresh"]) {
restart_session();
set_session("dbs", null);
}
if (DB != "") { if (DB != "") {
header("HTTP/1.1 404 Not Found"); header("HTTP/1.1 404 Not Found");
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true); page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
@@ -20,18 +8,16 @@ if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET
if ($_POST["db"] && !$error) { if ($_POST["db"] && !$error) {
queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"])); queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
} }
page_header(lang('Select database'), $error, false); page_header(lang('Select database'), $error, false);
echo "<p class='links'>\n"; echo "<p class='links'>\n";
foreach ( foreach (array(
array( 'database' => lang('Create database'),
'database' => lang('Create database'), 'privileges' => lang('Privileges'),
'privileges' => lang('Privileges'), 'processlist' => lang('Process list'),
'processlist' => lang('Process list'), 'variables' => lang('Variables'),
'variables' => lang('Variables'), 'status' => lang('Status'),
'status' => lang('Status'), ) as $key => $val) {
) as $key => $val
) {
if (support($key)) { if (support($key)) {
echo "<a href='" . h(ME) . "$key='>$val</a>\n"; echo "<a href='" . h(ME) . "$key='>$val</a>\n";
} }
@@ -43,23 +29,23 @@ if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET
$scheme = support("scheme"); $scheme = support("scheme");
$collations = collations(); $collations = collations();
echo "<form action='' method='post'>\n"; echo "<form action='' method='post'>\n";
echo "<table class='checkable odds'>\n"; echo "<table cellspacing='0' class='checkable'>\n";
echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"); echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");
echo "<thead><tr>" echo "<thead><tr>"
. (support("database") ? "<td>" : "") . (support("database") ? "<td>" : "")
. "<th>" . lang('Database') . (get_session("dbs") !== null ? " - <a href='" . h(ME) . "refresh=1'>" . lang('Refresh') . "</a>" : "") . "<th>" . lang('Database') . " - <a href='" . h(ME) . "refresh=1'>" . lang('Refresh') . "</a>"
. "<td>" . lang('Collation') . "<td>" . lang('Collation')
. "<td>" . lang('Tables') . "<td>" . lang('Tables')
. "<td>" . lang('Size') . " - <a href='" . h(ME) . "dbsize=1'>" . lang('Compute') . "</a>" . script("qsl('a').onclick = partial(ajaxSetHtml, '" . js_escape(ME) . "script=connect');", "") . "<td>" . lang('Size') . " - <a href='" . h(ME) . "dbsize=1'>" . lang('Compute') . "</a>" . script("qsl('a').onclick = partial(ajaxSetHtml, '" . js_escape(ME) . "script=connect');", "")
. "</thead>\n" . "</thead>\n"
; ;
$databases = ($_GET["dbsize"] ? count_tables($databases) : array_flip($databases)); $databases = ($_GET["dbsize"] ? count_tables($databases) : array_flip($databases));
foreach ($databases as $db => $tables) { foreach ($databases as $db => $tables) {
$root = h(ME) . "db=" . urlencode($db); $root = h(ME) . "db=" . urlencode($db);
$id = h("Db-" . $db); $id = h("Db-" . $db);
echo "<tr>" . (support("database") ? "<td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]), "", "", "", $id) : ""); echo "<tr" . odd() . ">" . (support("database") ? "<td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]), "", "", "", $id) : "");
echo "<th><a href='$root' id='$id'>" . h($db) . "</a>"; echo "<th><a href='$root' id='$id'>" . h($db) . "</a>";
$collation = h(db_collation($db, $collations)); $collation = h(db_collation($db, $collations));
echo "<td>" . (support("database") ? "<a href='$root" . ($scheme ? "&amp;ns=" : "") . "&amp;database=' title='" . lang('Alter database') . "'>$collation</a>" : $collation); echo "<td>" . (support("database") ? "<a href='$root" . ($scheme ? "&amp;ns=" : "") . "&amp;database=' title='" . lang('Alter database') . "'>$collation</a>" : $collation);
@@ -67,7 +53,7 @@ if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET
echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?"); echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?");
echo "\n"; echo "\n";
} }
echo "</table>\n"; echo "</table>\n";
echo (support("database") echo (support("database")
? "<div class='footer'><div>\n" ? "<div class='footer'><div>\n"
@@ -83,8 +69,23 @@ if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET
echo script("tableCheck();"); echo script("tableCheck();");
} }
} }
page_footer("db"); page_footer("db");
}
if (isset($_GET["status"])) {
$_GET["variables"] = $_GET["status"];
}
if (isset($_GET["import"])) {
$_GET["sql"] = $_GET["import"];
}
if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"]) || $_GET["script"] == "connect" || $_GET["script"] == "kill")) {
if (DB != "" || $_GET["refresh"]) {
restart_session();
set_session("dbs", null);
}
connect_error(); // separate function to catch SQLite error
exit; exit;
} }

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
// coverage is used in tests and removed in compilation // coverage is used in tests and removed in compilation
if (extension_loaded("xdebug") && file_exists(sys_get_temp_dir() . "/adminer_coverage.ser")) { if (extension_loaded("xdebug") && file_exists(sys_get_temp_dir() . "/adminer_coverage.ser")) {
function save_coverage() { function save_coverage() {
@@ -16,5 +14,5 @@ if (extension_loaded("xdebug") && file_exists(sys_get_temp_dir() . "/adminer_cov
} }
} }
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
register_shutdown_function('Adminer\save_coverage'); register_shutdown_function('save_coverage');
} }

View File

@@ -1,19 +1,13 @@
<?php <?php
namespace Adminer;
if (!ob_get_level()) {
ob_start(null, 4096);
}
/** Print HTML header /** Print HTML header
* @param string used in title, breadcrumb and heading, should be HTML escaped * @param string used in title, breadcrumb and heading, should be HTML escaped
* @param string * @param string
* @param mixed ["key" => "link", "key2" => ["link", "desc"]], null for nothing, false for driver only, true for driver and server * @param mixed array("key" => "link", "key2" => array("link", "desc")), null for nothing, false for driver only, true for driver and server
* @param string used after colon in title and heading, should be HTML escaped * @param string used after colon in title and heading, should be HTML escaped
* @return null * @return null
*/ */
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
global $LANG, $VERSION, $adminer, $drivers; global $LANG, $VERSION, $adminer, $drivers, $jush;
page_headers(); page_headers();
if (is_ajax() && $error) { if (is_ajax() && $error) {
page_messages($error); page_messages($error);
@@ -26,7 +20,6 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
<html lang="<?php echo $LANG; ?>" dir="<?php echo lang('ltr'); ?>"> <html lang="<?php echo $LANG; ?>" dir="<?php echo lang('ltr'); ?>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width">
<title><?php echo $title_page; ?></title> <title><?php echo $title_page; ?></title>
<link rel="stylesheet" type="text/css" href="../adminer/static/default.css"> <link rel="stylesheet" type="text/css" href="../adminer/static/default.css">
<?php echo script_src("../adminer/static/functions.js"); ?> <?php echo script_src("../adminer/static/functions.js"); ?>
@@ -68,32 +61,32 @@ var offlineMessage = '<?php echo js_escape(lang('You are offline.')); ?>';
var thousandsSeparator = '<?php echo js_escape(lang(',')); ?>'; var thousandsSeparator = '<?php echo js_escape(lang(',')); ?>';
</script> </script>
<div id="help" class="jush-<?php echo JUSH; ?> jsonly hidden"></div> <div id="help" class="jush-<?php echo $jush; ?> jsonly hidden"></div>
<?php echo script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});"); ?> <?php echo script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});"); ?>
<div id="content"> <div id="content">
<?php <?php
if ($breadcrumb !== null) { if ($breadcrumb !== null) {
$link = substr(preg_replace('~\b(username|db|ns)=[^&]*&~', '', ME), 0, -1); $link = substr(preg_replace('~\b(username|db|ns)=[^&]*&~', '', ME), 0, -1);
echo '<p id="breadcrumb"><a href="' . h($link ?: ".") . '">' . $drivers[DRIVER] . '</a> » '; echo '<p id="breadcrumb"><a href="' . h($link ? $link : ".") . '">' . $drivers[DRIVER] . '</a> &raquo; ';
$link = substr(preg_replace('~\b(db|ns)=[^&]*&~', '', ME), 0, -1); $link = substr(preg_replace('~\b(db|ns)=[^&]*&~', '', ME), 0, -1);
$server = $adminer->serverName(SERVER); $server = $adminer->serverName(SERVER);
$server = ($server != "" ? $server : lang('Server')); $server = ($server != "" ? $server : lang('Server'));
if ($breadcrumb === false) { if ($breadcrumb === false) {
echo "$server\n"; echo "$server\n";
} else { } else {
echo "<a href='" . h($link) . "' accesskey='1' title='Alt+Shift+1'>$server</a> » "; echo "<a href='" . h($link) . "' accesskey='1' title='Alt+Shift+1'>$server</a> &raquo; ";
if ($_GET["ns"] != "" || (DB != "" && is_array($breadcrumb))) { if ($_GET["ns"] != "" || (DB != "" && is_array($breadcrumb))) {
echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> » '; echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> &raquo; ';
} }
if (is_array($breadcrumb)) { if (is_array($breadcrumb)) {
if ($_GET["ns"] != "") { if ($_GET["ns"] != "") {
echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> » '; echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> &raquo; ';
} }
foreach ($breadcrumb as $key => $val) { foreach ($breadcrumb as $key => $val) {
$desc = (is_array($val) ? $val[1] : h($val)); $desc = (is_array($val) ? $val[1] : h($val));
if ($desc != "") { if ($desc != "") {
echo "<a href='" . h(ME . "$key=") . urlencode(is_array($val) ? $val[0] : $val) . "'>$desc</a> » "; echo "<a href='" . h(ME . "$key=") . urlencode(is_array($val) ? $val[0] : $val) . "'>$desc</a> &raquo; ";
} }
} }
} }
@@ -109,7 +102,7 @@ var thousandsSeparator = '<?php echo js_escape(lang(',')); ?>';
$databases = null; $databases = null;
} }
stop_session(); stop_session();
define('Adminer\PAGE_HEADER', 1); define("PAGE_HEADER", 1);
} }
/** Send HTTP headers /** Send HTTP headers
@@ -185,19 +178,18 @@ function page_footer($missing = "") {
?> ?>
</div> </div>
<div id="menu"> <?php switch_lang(); ?>
<?php $adminer->navigation($missing); ?>
</div>
<?php if ($missing != "auth") { ?> <?php if ($missing != "auth") { ?>
<form action="" method="post"> <form action="" method="post">
<p class="logout"> <p class="logout">
<span><?php echo h($_GET["username"]) . "\n"; ?></span>
<input type="submit" name="logout" value="<?php echo lang('Logout'); ?>" id="logout"> <input type="submit" name="logout" value="<?php echo lang('Logout'); ?>" id="logout">
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</p> </p>
</form> </form>
<?php } ?> <?php } ?>
<div id="menu">
<?php $adminer->navigation($missing); ?>
</div>
<?php <?php
echo script("setupSubmitHighlight(document);"); echo script("setupSubmitHighlight(document);");
} }

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$drivers = array(); $drivers = array();
/** Add a driver /** Add a driver
@@ -13,59 +11,16 @@ function add_driver($id, $name) {
$drivers[$id] = $name; $drivers[$id] = $name;
} }
/** Get driver name /*abstract*/ class Min_SQL {
* @param string
* @return string
*/
function get_driver($id) {
global $drivers;
return $drivers[$id];
}
abstract class SqlDriver {
static $possibleDrivers = array();
static $jush; ///< @var string JUSH identifier
var $_conn; var $_conn;
protected $types = array(); ///< @var array [$description => [$type => $maximum_unsigned_length, ...], ...]
var $editFunctions = array(); ///< @var array of ["$type|$type2" => "$function/$function2"] functions used in editing, [0] - edit and insert, [1] - edit only
var $unsigned = array(); ///< @var array number variants
var $operators = array(); ///< @var array operators used in select
var $functions = array(); ///< @var array functions used in select
var $grouping = array(); ///< @var array grouping functions used in select
var $onActions = "RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT"; ///< @var string used in foreign_keys()
var $inout = "IN|OUT|INOUT";
var $enumLength = "'(?:''|[^'\\\\]|\\\\.)*'";
var $generated = array();
/** Create object for performing database operations /** Create object for performing database operations
* @param Db * @param Min_DB
*/ */
function __construct($connection) { function __construct($connection) {
$this->_conn = $connection; $this->_conn = $connection;
} }
/** Get all types
* @return array [$type => $maximum_unsigned_length, ...]
*/
function types() {
return call_user_func_array('array_merge', array_values($this->types));
}
/** Get structured types
* @return array [$description => [$type, ...], ...]
*/
function structuredTypes() {
return array_map('array_keys', $this->types);
}
/** Get enum values
* @param array
* @return string or null
*/
function enumLength($field) {
}
/** Select data from table /** Select data from table
* @param string * @param string
* @param array result of $adminer->selectColumnsProcess()[0] * @param array result of $adminer->selectColumnsProcess()[0]
@@ -75,15 +30,15 @@ abstract class SqlDriver {
* @param int result of $adminer->selectLimitProcess() * @param int result of $adminer->selectLimitProcess()
* @param int index of page starting at zero * @param int index of page starting at zero
* @param bool whether to print the query * @param bool whether to print the query
* @return Result * @return Min_Result
*/ */
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) { function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
global $adminer; global $adminer, $jush;
$is_group = (count($group) < count($select)); $is_group = (count($group) < count($select));
$query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page); $query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page);
if (!$query) { if (!$query) {
$query = "SELECT" . limit( $query = "SELECT" . limit(
($_GET["page"] != "last" && $limit != "" && $group && $is_group && JUSH == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) . "\nFROM " . table($table), ($_GET["page"] != "last" && $limit != "" && $group && $is_group && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) . "\nFROM " . table($table),
($where ? "\nWHERE " . implode(" AND ", $where) : "") . ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : ""), ($where ? "\nWHERE " . implode(" AND ", $where) : "") . ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : ""),
($limit != "" ? +$limit : null), ($limit != "" ? +$limit : null),
($page ? $limit * $page : 0), ($page ? $limit * $page : 0),
@@ -97,7 +52,7 @@ abstract class SqlDriver {
} }
return $return; return $return;
} }
/** Delete data from table /** Delete data from table
* @param string * @param string
* @param string " WHERE ..." * @param string " WHERE ..."
@@ -108,7 +63,7 @@ abstract class SqlDriver {
$query = "FROM " . table($table); $query = "FROM " . table($table);
return queries("DELETE" . ($limit ? limit1($table, $query, $queryWhere) : " $query$queryWhere")); return queries("DELETE" . ($limit ? limit1($table, $query, $queryWhere) : " $query$queryWhere"));
} }
/** Update data in table /** Update data in table
* @param string * @param string
* @param array escaped columns in keys, quoted data in values * @param array escaped columns in keys, quoted data in values
@@ -125,7 +80,7 @@ abstract class SqlDriver {
$query = table($table) . " SET$separator" . implode(",$separator", $values); $query = table($table) . " SET$separator" . implode(",$separator", $values);
return queries("UPDATE" . ($limit ? limit1($table, $query, $queryWhere, $separator) : " $query$queryWhere")); return queries("UPDATE" . ($limit ? limit1($table, $query, $queryWhere, $separator) : " $query$queryWhere"));
} }
/** Insert data into table /** Insert data into table
* @param string * @param string
* @param array escaped columns in keys, quoted data in values * @param array escaped columns in keys, quoted data in values
@@ -137,38 +92,38 @@ abstract class SqlDriver {
: " DEFAULT VALUES" : " DEFAULT VALUES"
)); ));
} }
/** Insert or update data in table /** Insert or update data in table
* @param string * @param string
* @param array * @param array
* @param array of arrays with escaped columns in keys and quoted data in values * @param array of arrays with escaped columns in keys and quoted data in values
* @return bool * @return bool
*/ */
function insertUpdate($table, $rows, $primary) { /*abstract*/ function insertUpdate($table, $rows, $primary) {
return false; return false;
} }
/** Begin transaction /** Begin transaction
* @return bool * @return bool
*/ */
function begin() { function begin() {
return queries("BEGIN"); return queries("BEGIN");
} }
/** Commit transaction /** Commit transaction
* @return bool * @return bool
*/ */
function commit() { function commit() {
return queries("COMMIT"); return queries("COMMIT");
} }
/** Rollback transaction /** Rollback transaction
* @return bool * @return bool
*/ */
function rollback() { function rollback() {
return queries("ROLLBACK"); return queries("ROLLBACK");
} }
/** Return query with a timeout /** Return query with a timeout
* @param string * @param string
* @param int seconds * @param int seconds
@@ -176,10 +131,10 @@ abstract class SqlDriver {
*/ */
function slowQuery($query, $timeout) { function slowQuery($query, $timeout) {
} }
/** Convert column to be searchable /** Convert column to be searchable
* @param string escaped column name * @param string escaped column name
* @param array ["op" => , "val" => ] * @param array array("op" => , "val" => )
* @param array * @param array
* @return string * @return string
*/ */
@@ -188,9 +143,9 @@ abstract class SqlDriver {
} }
/** Convert operator so it can be used in search /** Convert operator so it can be used in search
* @param string $operator * @param string $operator
* @return string * @return string
*/ */
function convertOperator($operator) { function convertOperator($operator) {
return $operator; return $operator;
} }
@@ -214,48 +169,19 @@ abstract class SqlDriver {
function quoteBinary($s) { function quoteBinary($s) {
return q($s); return q($s);
} }
/** Get warnings about the last command /** Get warnings about the last command
* @return string HTML * @return string HTML
*/ */
function warnings() { function warnings() {
return ''; return '';
} }
/** Get help link for table /** Get help link for table
* @param string * @param string
* @param bool
* @return string relative URL or null * @return string relative URL or null
*/ */
function tableHelp($name, $is_view = false) { function tableHelp($name) {
}
/** Check if C-style escapes are supported
* @return bool
*/
function hasCStyleEscapes() {
return false;
}
/** Check whether table supports indexes
* @param array result of table_status()
* @return bool
*/
function supportsIndex($table_status) {
return !is_view($table_status);
}
/** Get defined check constraints
* @param string
* @return array [$name => $clause]
*/
function checkConstraints($table) {
// MariaDB contains CHECK_CONSTRAINTS.TABLE_NAME, MySQL and PostrgreSQL not
return get_key_vals("SELECT c.CONSTRAINT_NAME, CHECK_CLAUSE
FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS c
JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS t ON c.CONSTRAINT_SCHEMA = t.CONSTRAINT_SCHEMA AND c.CONSTRAINT_NAME = t.CONSTRAINT_NAME
WHERE c.CONSTRAINT_SCHEMA = " . q($_GET["ns"] != "" ? $_GET["ns"] : DB) . "
AND t.TABLE_NAME = " . q($table) . "
AND CHECK_CLAUSE NOT LIKE '% IS NOT NULL'"); // ignore default IS NOT NULL checks in PostrgreSQL
} }
} }

View File

@@ -1,34 +1,32 @@
<?php <?php
namespace Adminer;
// This file is not used in Adminer Editor.
/** Print select result /** Print select result
* @param Result * @param Min_Result
* @param Db connection to examine indexes * @param Min_DB connection to examine indexes
* @param array * @param array
* @param int * @param int
* @return array $orgtables * @return array $orgtables
*/ */
function select($result, $connection2 = null, $orgtables = array(), $limit = 0) { function select($result, $connection2 = null, $orgtables = array(), $limit = 0) {
global $jush;
$links = array(); // colno => orgtable - create links from these columns $links = array(); // colno => orgtable - create links from these columns
$indexes = array(); // orgtable => array(column => colno) - primary keys $indexes = array(); // orgtable => array(column => colno) - primary keys
$columns = array(); // orgtable => array(column => ) - not selected columns in primary key $columns = array(); // orgtable => array(column => ) - not selected columns in primary key
$blobs = array(); // colno => bool - display bytes for blobs $blobs = array(); // colno => bool - display bytes for blobs
$types = array(); // colno => type - display char in <code> $types = array(); // colno => type - display char in <code>
$return = array(); // table => orgtable - mapping to use in EXPLAIN $return = array(); // table => orgtable - mapping to use in EXPLAIN
odd(''); // reset odd for each result
for ($i=0; (!$limit || $i < $limit) && ($row = $result->fetch_row()); $i++) { for ($i=0; (!$limit || $i < $limit) && ($row = $result->fetch_row()); $i++) {
if (!$i) { if (!$i) {
echo "<div class='scrollable'>\n"; echo "<div class='scrollable'>\n";
echo "<table class='nowrap odds'>\n"; echo "<table cellspacing='0' class='nowrap'>\n";
echo "<thead><tr>"; echo "<thead><tr>";
for ($j=0; $j < count($row); $j++) { for ($j=0; $j < count($row); $j++) {
$field = $result->fetch_field(); $field = (array)$result->fetch_field();
$name = $field->name; $name = $field["name"];
$orgtable = $field->orgtable; $orgtable = $field["orgtable"];
$orgname = $field->orgname; $orgname = $field["orgname"];
$return[$field->table] = $orgtable; $return[$field["table"]] = $orgtable;
if ($orgtables && JUSH == "sql") { // MySQL EXPLAIN if ($orgtables && $jush == "sql") { // MySQL EXPLAIN
$links[$j] = ($name == "table" ? "table=" : ($name == "possible_keys" ? "indexes=" : null)); $links[$j] = ($name == "table" ? "table=" : ($name == "possible_keys" ? "indexes=" : null));
} elseif ($orgtable != "") { } elseif ($orgtable != "") {
if (!isset($indexes[$orgtable])) { if (!isset($indexes[$orgtable])) {
@@ -48,11 +46,11 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
$links[$j] = $orgtable; $links[$j] = $orgtable;
} }
} }
if ($field->charsetnr == 63) { // 63 - binary if ($field["charsetnr"] == 63) { // 63 - binary
$blobs[$j] = true; $blobs[$j] = true;
} }
$types[$j] = $field->type; $types[$j] = $field["type"];
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name) echo "<th" . ($orgtable != "" || $field["name"] != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name)
. ($orgtables ? doc_link(array( . ($orgtables ? doc_link(array(
'sql' => "explain-output.html#explain_" . strtolower($name), 'sql' => "explain-output.html#explain_" . strtolower($name),
'mariadb' => "explain/#the-columns-in-explain-select", 'mariadb' => "explain/#the-columns-in-explain-select",
@@ -61,11 +59,11 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
} }
echo "</thead>\n"; echo "</thead>\n";
} }
echo "<tr>"; echo "<tr" . odd() . ">";
foreach ($row as $key => $val) { foreach ($row as $key => $val) {
$link = ""; $link = "";
if (isset($links[$key]) && !$columns[$links[$key]]) { if (isset($links[$key]) && !$columns[$links[$key]]) {
if ($orgtables && JUSH == "sql") { // MySQL EXPLAIN if ($orgtables && $jush == "sql") { // MySQL EXPLAIN
$table = $row[array_search("table=", $links)]; $table = $row[array_search("table=", $links)];
$link = ME . $links[$key] . urlencode($orgtables[$table] != "" ? $orgtables[$table] : $table); $link = ME . $links[$key] . urlencode($orgtables[$table] != "" ? $orgtables[$table] : $table);
} else { } else {
@@ -74,7 +72,7 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
$link .= "&where" . urlencode("[" . bracket_escape($col) . "]") . "=" . urlencode($row[$j]); $link .= "&where" . urlencode("[" . bracket_escape($col) . "]") . "=" . urlencode($row[$j]);
} }
} }
} elseif (is_url($val)) { } elseif (is_web_url($val)) {
$link = $val; $link = $val;
} }
if ($val === null) { if ($val === null) {
@@ -88,7 +86,7 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
} }
} }
if ($link) { if ($link) {
$val = "<a href='" . h($link) . "'" . (is_url($link) ? target_blank() : '') . ">$val</a>"; $val = "<a href='" . h($link) . "'" . (is_web_url($link) ? target_blank() : '') . ">$val</a>";
} }
echo "<td>$val"; echo "<td>$val";
} }
@@ -99,7 +97,7 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
/** Get referencable tables with single column primary key except self /** Get referencable tables with single column primary key except self
* @param string * @param string
* @return array [$table_name => $field] * @return array ($table_name => $field)
*/ */
function referencable_primary($self) { function referencable_primary($self) {
$return = array(); // table_name => field $return = array(); // table_name => field
@@ -152,7 +150,8 @@ function set_adminer_settings($settings) {
* @return null * @return null
*/ */
function textarea($name, $value, $rows = 10, $cols = 80) { function textarea($name, $value, $rows = 10, $cols = 80) {
echo "<textarea name='" . h($name) . "' rows='$rows' cols='$cols' class='sqlarea jush-" . JUSH . "' spellcheck='false' wrap='off'>"; global $jush;
echo "<textarea name='" . h($name) . "' rows='$rows' cols='$cols' class='sqlarea jush-$jush' spellcheck='false' wrap='off'>";
if (is_array($value)) { if (is_array($value)) {
foreach ($value as $val) { // not implode() to save memory foreach ($value as $val) { // not implode() to save memory
echo h($val[0]) . "\n\n\n"; // $val == array($query, $time, $elapsed) echo h($val[0]) . "\n\n\n"; // $val == array($query, $time, $elapsed)
@@ -163,41 +162,6 @@ function textarea($name, $value, $rows = 10, $cols = 80) {
echo "</textarea>"; echo "</textarea>";
} }
/** Generate HTML <select> or <input> if $options are empty
* @param string
* @param array
* @param string
* @param string
* @param string
* @return string
*/
function select_input($attrs, $options, $value = "", $onchange = "", $placeholder = "") {
$tag = ($options ? "select" : "input");
return "<$tag$attrs" . ($options
? "><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
: " size='10' value='" . h($value) . "' placeholder='$placeholder'>"
) . ($onchange ? script("qsl('$tag').onchange = $onchange;", "") : ""); //! use oninput for input
}
/** Print one row in JSON object
* @param string or "" to close the object
* @param string
* @return null
*/
function json_row($key, $val = null) {
static $first = true;
if ($first) {
echo "{";
}
if ($key != "") {
echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
$first = false;
} else {
echo "\n}\n";
$first = true;
}
}
/** Print table columns for type edit /** Print table columns for type edit
* @param string * @param string
* @param array * @param array
@@ -207,46 +171,22 @@ function json_row($key, $val = null) {
* @return null * @return null
*/ */
function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_types = array()) { function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_types = array()) {
global $driver; global $structured_types, $types, $unsigned, $on_actions;
$type = $field["type"]; $type = $field["type"];
?><td><select name="<?php echo h($key); ?>[type]" class="type" aria-labelledby="label-type"><?php ?>
if ($type && !array_key_exists($type, $driver->types()) && !isset($foreign_keys[$type]) && !in_array($type, $extra_types)) { <td><select name="<?php echo h($key); ?>[type]" class="type" aria-labelledby="label-type"><?php
$extra_types[] = $type; if ($type && !isset($types[$type]) && !isset($foreign_keys[$type]) && !in_array($type, $extra_types)) {
} $extra_types[] = $type;
$structured_types = $driver->structuredTypes();
if ($foreign_keys) {
$structured_types[lang('Foreign keys')] = $foreign_keys;
}
echo optionlist(array_merge($extra_types, $structured_types), $type);
?></select><td><input
name="<?php echo h($key); ?>[length]"
value="<?php echo h($field["length"]); ?>"
size="3"
<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); //! type="number" with enabled JavaScript ?>
aria-labelledby="label-length"><td class="options"><?php
echo ($collations ? "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>' : '');
echo ($driver->unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match(number_type(), $type) ? "" : " class='hidden'") . '><option>' . optionlist($driver->unsigned, $field["unsigned"]) . '</select>' : '');
echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>'
. optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), (preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"]) ? "CURRENT_TIMESTAMP" : $field["on_update"]))
. '</select>' : ''
);
echo ($foreign_keys ? "<select name='" . h($key) . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $driver->onActions), $field["on_delete"]) . "</select> " : " "); // space for IE
} }
if ($foreign_keys) {
/** Get partition info $structured_types[lang('Foreign keys')] = $foreign_keys;
* @param string }
* @return array echo optionlist(array_merge($extra_types, $structured_types), $type);
*/ ?></select><td><input name="<?php echo h($key); ?>[length]" value="<?php echo h($field["length"]); ?>" size="3"<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); //! type="number" with enabled JavaScript ?> aria-labelledby="label-length"><td class="options"><?php
function get_partitions_info($table) { echo "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
global $connection; echo ($unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match(number_type(), $type) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($table); echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), (preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"]) ? "CURRENT_TIMESTAMP" : $field["on_update"])) . '</select>' : '');
$result = $connection->query("SELECT PARTITION_METHOD, PARTITION_EXPRESSION, PARTITION_ORDINAL_POSITION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1"); echo ($foreign_keys ? "<select name='" . h($key) . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
$return = array();
list($return["partition_by"], $return["partition"], $return["partitions"]) = $result->fetch_row();
$partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
$return["partition_names"] = array_keys($partitions);
$return["partition_values"] = array_values($partitions);
return $return;
} }
/** Filter length value including enums /** Filter length value including enums
@@ -254,8 +194,7 @@ function get_partitions_info($table) {
* @return string * @return string
*/ */
function process_length($length) { function process_length($length) {
global $driver; global $enum_length;
$enum_length = $driver->enumLength;
return (preg_match("~^\\s*\\(?\\s*$enum_length(?:\\s*,\\s*$enum_length)*+\\s*\\)?\\s*\$~", $length) && preg_match_all("~$enum_length~", $length, $matches) return (preg_match("~^\\s*\\(?\\s*$enum_length(?:\\s*,\\s*$enum_length)*+\\s*\\)?\\s*\$~", $length) && preg_match_all("~$enum_length~", $length, $matches)
? "(" . implode(",", $matches[0]) . ")" ? "(" . implode(",", $matches[0]) . ")"
: preg_replace('~^[0-9].*~', '(\0)', preg_replace('~[^-0-9,+()[\]]~', '', $length)) : preg_replace('~^[0-9].*~', '(\0)', preg_replace('~[^-0-9,+()[\]]~', '', $length))
@@ -268,24 +207,20 @@ function process_length($length) {
* @return string * @return string
*/ */
function process_type($field, $collate = "COLLATE") { function process_type($field, $collate = "COLLATE") {
global $driver; global $unsigned;
return " $field[type]" return " $field[type]"
. process_length($field["length"]) . process_length($field["length"])
. (preg_match(number_type(), $field["type"]) && in_array($field["unsigned"], $driver->unsigned) ? " $field[unsigned]" : "") . (preg_match(number_type(), $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
. (preg_match('~char|text|enum|set~', $field["type"]) && $field["collation"] ? " $collate " . (JUSH == "mssql" ? $field["collation"] : q($field["collation"])) : "") . (preg_match('~char|text|enum|set~', $field["type"]) && $field["collation"] ? " $collate " . q($field["collation"]) : "")
; ;
} }
/** Create SQL string from field /** Create SQL string from field
* @param array basic field information * @param array basic field information
* @param array information about field type * @param array information about field type
* @return array ["field", "type", "NULL", "DEFAULT", "ON UPDATE", "COMMENT", "AUTO_INCREMENT"] * @return array array("field", "type", "NULL", "DEFAULT", "ON UPDATE", "COMMENT", "AUTO_INCREMENT")
*/ */
function process_field($field, $type_field) { function process_field($field, $type_field) {
// MariaDB exports CURRENT_TIMESTAMP as a function.
if ($field["on_update"]) {
$field["on_update"] = str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", $field["on_update"]);
}
return array( return array(
idf_escape(trim($field["field"])), idf_escape(trim($field["field"])),
process_type($type_field), process_type($type_field),
@@ -302,16 +237,8 @@ function process_field($field, $type_field) {
* @return string * @return string
*/ */
function default_value($field) { function default_value($field) {
global $driver;
$default = $field["default"]; $default = $field["default"];
$generated = $field["generated"]; return ($default === null ? "" : " DEFAULT " . (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default) ? q($default) : $default));
return ($default === null ? "" : (in_array($generated, $driver->generated)
? (JUSH == "mssql" ? " AS ($default)" . ($generated == "VIRTUAL" ? "" : " $generated") . "" : " GENERATED ALWAYS AS ($default) $generated")
: " DEFAULT " . (!preg_match('~^GENERATED ~i', $default) && (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default))
? q($default)
: str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", (JUSH == "sqlite" ? "($default)" : $default))
)
));
} }
/** Get type class to use in CSS /** Get type class to use in CSS
@@ -319,14 +246,12 @@ function default_value($field) {
* @return string class='' * @return string class=''
*/ */
function type_class($type) { function type_class($type) {
foreach ( foreach (array(
array( 'char' => 'text',
'char' => 'text', 'date' => 'time|year',
'date' => 'time|year', 'binary' => 'blob',
'binary' => 'blob', 'enum' => 'set',
'enum' => 'set', ) as $key => $val) {
) as $key => $val
) {
if (preg_match("~$key|$val~", $type)) { if (preg_match("~$key|$val~", $type)) {
return " class='$key'"; return " class='$key'";
} }
@@ -341,13 +266,13 @@ function type_class($type) {
* @return null * @return null
*/ */
function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array()) { function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array()) {
global $driver; global $inout;
$fields = array_values($fields); $fields = array_values($fields);
$default_class = (($_POST ? $_POST["defaults"] : adminer_setting("defaults")) ? "" : " class='hidden'"); $default_class = (($_POST ? $_POST["defaults"] : adminer_setting("defaults")) ? "" : " class='hidden'");
$comment_class = (($_POST ? $_POST["comments"] : adminer_setting("comments")) ? "" : " class='hidden'"); $comment_class = (($_POST ? $_POST["comments"] : adminer_setting("comments")) ? "" : " class='hidden'");
?> ?>
<thead><tr> <thead><tr>
<?php echo ($type == "PROCEDURE" ? "<td>" : ""); ?> <?php if ($type == "PROCEDURE") { ?><td><?php } ?>
<th id="label-name"><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?> <th id="label-name"><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?>
<td id="label-type"><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;"></textarea><?php echo script("qs('#enum-edit').onblur = editingLengthBlur;"); ?> <td id="label-type"><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;"></textarea><?php echo script("qs('#enum-edit').onblur = editingLengthBlur;"); ?>
<td id="label-length"><?php echo lang('Length'); ?> <td id="label-length"><?php echo lang('Length'); ?>
@@ -359,7 +284,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
'mariadb' => "auto_increment/", 'mariadb' => "auto_increment/",
'sqlite' => "autoinc.html", 'sqlite' => "autoinc.html",
'pgsql' => "datatype-numeric.html#DATATYPE-SERIAL", 'pgsql' => "datatype-numeric.html#DATATYPE-SERIAL",
'mssql' => "t-sql/statements/create-table-transact-sql-identity-property", 'mssql' => "ms186775.aspx",
)); ?> )); ?>
<td id="label-default"<?php echo $default_class; ?>><?php echo lang('Default value'); ?> <td id="label-default"<?php echo $default_class; ?>><?php echo lang('Default value'); ?>
<?php echo (support("comment") ? "<td id='label-comment'$comment_class>" . lang('Comment') : ""); ?> <?php echo (support("comment") ? "<td id='label-comment'$comment_class>" . lang('Comment') : ""); ?>
@@ -375,22 +300,13 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
$display = (isset($_POST["add"][$i-1]) || (isset($field["field"]) && !$_POST["drop_col"][$i])) && (support("drop_col") || $orig == ""); $display = (isset($_POST["add"][$i-1]) || (isset($field["field"]) && !$_POST["drop_col"][$i])) && (support("drop_col") || $orig == "");
?> ?>
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>> <tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $driver->inout), $field["inout"]) : "") . "<th>"; ?> <?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
<?php if ($display) { ?> <th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php } ?>
<input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name">
<?php } ?>
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>"><?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?> <input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>"><?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
<?php <?php if ($type == "TABLE") { ?>
if ($type == "TABLE") {
?>
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?> <td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php echo ($field["auto_increment"] ? " checked" : ""); ?> aria-labelledby="label-ai"></label><td<?php echo $default_class; ?>><?php <td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> aria-labelledby="label-ai"></label><td<?php echo $default_class; ?>><?php
echo ($driver->generated echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "label-default"); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" aria-labelledby="label-default"><?php
? html_select("fields[$i][generated]", array_merge(array("", "DEFAULT"), $driver->generated), $field["generated"]) . " "
: checkbox("fields[$i][generated]", 1, $field["generated"], "", "", "", "label-default")
);
?>
<input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" aria-labelledby="label-default"><?php
echo (support("comment") ? "<td$comment_class><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' data-maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : ""); echo (support("comment") ? "<td$comment_class><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' data-maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : "");
} }
echo "<td>"; echo "<td>";
@@ -513,10 +429,11 @@ function drop_create($drop, $create, $drop_created, $test, $drop_test, $location
* @return string * @return string
*/ */
function create_trigger($on, $row) { function create_trigger($on, $row) {
global $jush;
$timing_event = " $row[Timing] $row[Event]" . (preg_match('~ OF~', $row["Event"]) ? " $row[Of]" : ""); // SQL injection $timing_event = " $row[Timing] $row[Event]" . (preg_match('~ OF~', $row["Event"]) ? " $row[Of]" : ""); // SQL injection
return "CREATE TRIGGER " return "CREATE TRIGGER "
. idf_escape($row["Trigger"]) . idf_escape($row["Trigger"])
. (JUSH == "mssql" ? $on . $timing_event : $timing_event . $on) . ($jush == "mssql" ? $on . $timing_event : $timing_event . $on)
. rtrim(" $row[Type]\n$row[Statement]", ";") . rtrim(" $row[Type]\n$row[Statement]", ";")
. ";" . ";"
; ;
@@ -528,22 +445,22 @@ function create_trigger($on, $row) {
* @return string * @return string
*/ */
function create_routine($routine, $row) { function create_routine($routine, $row) {
global $driver; global $inout, $jush;
$set = array(); $set = array();
$fields = (array) $row["fields"]; $fields = (array) $row["fields"];
ksort($fields); // enforce fields order ksort($fields); // enforce fields order
foreach ($fields as $field) { foreach ($fields as $field) {
if ($field["field"] != "") { if ($field["field"] != "") {
$set[] = (preg_match("~^($driver->inout)\$~", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET"); $set[] = (preg_match("~^($inout)\$~", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
} }
} }
$definition = rtrim($row["definition"], ";"); $definition = rtrim("\n$row[definition]", ";");
return "CREATE $routine " return "CREATE $routine "
. idf_escape(trim($row["name"])) . idf_escape(trim($row["name"]))
. " (" . implode(", ", $set) . ")" . " (" . implode(", ", $set) . ")"
. ($routine == "FUNCTION" ? " RETURNS" . process_type($row["returns"], "CHARACTER SET") : "") . (isset($_GET["function"]) ? " RETURNS" . process_type($row["returns"], "CHARACTER SET") : "")
. ($row["language"] ? " LANGUAGE $row[language]" : "") . ($row["language"] ? " LANGUAGE $row[language]" : "")
. (JUSH == "pgsql" ? " AS " . q($definition) : "\n$definition;") . ($jush == "pgsql" ? " AS " . q($definition) : "$definition;")
; ;
} }
@@ -556,20 +473,20 @@ function remove_definer($query) {
} }
/** Format foreign key to use in SQL query /** Format foreign key to use in SQL query
* @param array ["db" => string, "ns" => string, "table" => string, "source" => array, "target" => array, "on_delete" => one of $on_actions, "on_update" => one of $on_actions] * @param array ("db" => string, "ns" => string, "table" => string, "source" => array, "target" => array, "on_delete" => one of $on_actions, "on_update" => one of $on_actions)
* @return string * @return string
*/ */
function format_foreign_key($foreign_key) { function format_foreign_key($foreign_key) {
global $driver; global $on_actions;
$db = $foreign_key["db"]; $db = $foreign_key["db"];
$ns = $foreign_key["ns"]; $ns = $foreign_key["ns"];
return " FOREIGN KEY (" . implode(", ", array_map('Adminer\idf_escape', $foreign_key["source"])) . ") REFERENCES " return " FOREIGN KEY (" . implode(", ", array_map('idf_escape', $foreign_key["source"])) . ") REFERENCES "
. ($db != "" && $db != $_GET["db"] ? idf_escape($db) . "." : "") . ($db != "" && $db != $_GET["db"] ? idf_escape($db) . "." : "")
. ($ns != "" && $ns != $_GET["ns"] ? idf_escape($ns) . "." : "") . ($ns != "" && $ns != $_GET["ns"] ? idf_escape($ns) . "." : "")
. idf_escape($foreign_key["table"]) . table($foreign_key["table"])
. " (" . implode(", ", array_map('Adminer\idf_escape', $foreign_key["target"])) . ")" //! reuse $name - check in older MySQL versions . " (" . implode(", ", array_map('idf_escape', $foreign_key["target"])) . ")" //! reuse $name - check in older MySQL versions
. (preg_match("~^($driver->onActions)\$~", $foreign_key["on_delete"]) ? " ON DELETE $foreign_key[on_delete]" : "") . (preg_match("~^($on_actions)\$~", $foreign_key["on_delete"]) ? " ON DELETE $foreign_key[on_delete]" : "")
. (preg_match("~^($driver->onActions)\$~", $foreign_key["on_update"]) ? " ON UPDATE $foreign_key[on_update]" : "") . (preg_match("~^($on_actions)\$~", $foreign_key["on_update"]) ? " ON UPDATE $foreign_key[on_update]" : "")
; ;
} }
@@ -598,37 +515,34 @@ function tar_file($filename, $tmp_file) {
function ini_bytes($ini) { function ini_bytes($ini) {
$val = ini_get($ini); $val = ini_get($ini);
switch (strtolower(substr($val, -1))) { switch (strtolower(substr($val, -1))) {
case 'g': case 'g': $val *= 1024; // no break
$val = (int) $val * 1024; // no break case 'm': $val *= 1024; // no break
case 'm': case 'k': $val *= 1024;
$val = (int) $val * 1024; // no break
case 'k':
$val = (int) $val * 1024;
} }
return $val; return $val;
} }
/** Create link to database documentation /** Create link to database documentation
* @param array JUSH => $path * @param array $jush => $path
* @param string HTML code * @param string HTML code
* @return string HTML code * @return string HTML code
*/ */
function doc_link($paths, $text = "<sup>?</sup>") { function doc_link($paths, $text = "<sup>?</sup>") {
global $connection; global $jush, $connection;
$server_info = $connection->server_info; $server_info = $connection->server_info;
$version = preg_replace('~^(\d\.?\d).*~s', '\1', $server_info); // two most significant digits $version = preg_replace('~^(\d\.?\d).*~s', '\1', $server_info); // two most significant digits
$urls = array( $urls = array(
'sql' => "https://dev.mysql.com/doc/refman/$version/en/", 'sql' => "https://dev.mysql.com/doc/refman/$version/en/",
'sqlite' => "https://www.sqlite.org/", 'sqlite' => "https://www.sqlite.org/",
'pgsql' => "https://www.postgresql.org/docs/$version/", 'pgsql' => "https://www.postgresql.org/docs/$version/",
'mssql' => "https://learn.microsoft.com/en-us/sql/", 'mssql' => "https://msdn.microsoft.com/library/",
'oracle' => "https://www.oracle.com/pls/topic/lookup?ctx=db" . preg_replace('~^.* (\d+)\.(\d+)\.\d+\.\d+\.\d+.*~s', '\1\2', $server_info) . "&id=", 'oracle' => "https://www.oracle.com/pls/topic/lookup?ctx=db" . preg_replace('~^.* (\d+)\.(\d+)\.\d+\.\d+\.\d+.*~s', '\1\2', $server_info) . "&id=",
); );
if (preg_match('~MariaDB~', $server_info)) { if (preg_match('~MariaDB~', $server_info)) {
$urls['sql'] = "https://mariadb.com/kb/en/"; $urls['sql'] = "https://mariadb.com/kb/en/library/";
$paths['sql'] = (isset($paths['mariadb']) ? $paths['mariadb'] : str_replace(".html", "/", $paths['sql'])); $paths['sql'] = (isset($paths['mariadb']) ? $paths['mariadb'] : str_replace(".html", "/", $paths['sql']));
} }
return ($paths[JUSH] ? "<a href='" . h($urls[JUSH] . $paths[JUSH] . (JUSH == 'mssql' ? "?view=sql-server-ver$version" : "")) . "'" . target_blank() . ">$text</a>" : ""); return ($paths[$jush] ? "<a href='" . h($urls[$jush] . $paths[$jush]) . "'" . target_blank() . ">$text</a>" : "");
} }
/** Wrap gzencode() for usage in ob_start() /** Wrap gzencode() for usage in ob_start()
@@ -636,7 +550,7 @@ function doc_link($paths, $text = "<sup>?</sup>") {
* @return string * @return string
*/ */
function ob_gzencode($string) { function ob_gzencode($string) {
// ob_start() callback receives an optional parameter $phase but gzencode() accepts optional parameter $level // ob_start() callback recieves an optional parameter $phase but gzencode() accepts optional parameter $level
return gzencode($string); return gzencode($string);
} }

View File

@@ -1,7 +0,0 @@
<?php
namespace Adminer;
error_reporting(6135); // errors and warnings
set_error_handler(function ($errno, $errstr) {
return !!preg_match('~^(Trying to access array offset on( value of type)? null|Undefined (array key|property))~', $errstr);
}, E_WARNING);

View File

@@ -1,10 +1,6 @@
<?php <?php
namespace Adminer;
// This file is used both in Adminer and Adminer Editor.
/** Get database connection /** Get database connection
* @return Db * @return Min_DB
*/ */
function connection() { function connection() {
// can be used in customization, $connection is minified // can be used in customization, $connection is minified
@@ -98,7 +94,7 @@ function bracket_escape($idf, $back = false) {
/** Check if connection has at least the given version /** Check if connection has at least the given version
* @param string required version * @param string required version
* @param string required MariaDB version * @param string required MariaDB version
* @param Db defaults to $connection * @param Min_DB defaults to $connection
* @return bool * @return bool
*/ */
function min_version($version, $maria_db = "", $connection2 = null) { function min_version($version, $maria_db = "", $connection2 = null) {
@@ -111,11 +107,11 @@ function min_version($version, $maria_db = "", $connection2 = null) {
$server_info = $match[1]; $server_info = $match[1];
$version = $maria_db; $version = $maria_db;
} }
return $version && version_compare($server_info, $version) >= 0; return (version_compare($server_info, $version) >= 0);
} }
/** Get connection charset /** Get connection charset
* @param Db * @param Min_DB
* @return string * @return string
*/ */
function charset($connection) { function charset($connection) {
@@ -204,11 +200,7 @@ function optionlist($options, $selected = null, $use_keys = false) {
$opts = $v; $opts = $v;
} }
foreach ($opts as $key => $val) { foreach ($opts as $key => $val) {
$return .= '<option' $return .= '<option' . ($use_keys || is_string($key) ? ' value="' . h($key) . '"' : '') . (($use_keys || is_string($key) ? (string) $key : $val) === $selected ? ' selected' : '') . '>' . h($val);
. ($use_keys || is_string($key) ? ' value="' . h($key) . '"' : '')
. ($selected !== null && ($use_keys || is_string($key) ? (string) $key : $val) === $selected ? ' selected' : '')
. '>' . h($val)
;
} }
if (is_array($v)) { if (is_array($v)) {
$return .= '</optgroup>'; $return .= '</optgroup>';
@@ -221,7 +213,7 @@ function optionlist($options, $selected = null, $use_keys = false) {
* @param string * @param string
* @param array * @param array
* @param string * @param string
* @param string true for no onchange, false for radio * @param string|bool true for no onchange, false for radio
* @param string * @param string
* @return string * @return string
*/ */
@@ -240,6 +232,22 @@ function html_select($name, $options, $value = "", $onchange = true, $labelled_b
return $return; return $return;
} }
/** Generate HTML <select> or <input> if $options are empty
* @param string
* @param array
* @param string
* @param string
* @param string
* @return string
*/
function select_input($attrs, $options, $value = "", $onchange = "", $placeholder = "") {
$tag = ($options ? "select" : "input");
return "<$tag$attrs" . ($options
? "><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
: " size='10' value='" . h($value) . "' placeholder='$placeholder'>"
) . ($onchange ? script("qsl('$tag').onchange = $onchange;", "") : ""); //! use oninput for input
}
/** Get onclick confirmation /** Get onclick confirmation
* @param string * @param string
* @param string * @param string
@@ -272,6 +280,18 @@ function bold($bold, $class = "") {
return ($bold ? " class='active $class'" : ($class ? " class='$class'" : "")); return ($bold ? " class='active $class'" : ($class ? " class='$class'" : ""));
} }
/** Generate class for odd rows
* @param string return this for odd rows, empty to reset counter
* @return string
*/
function odd($return = ' class="odd"') {
static $i = 0;
if (!$return) { // reset counter
$i = -1;
}
return ($i++ % 2 ? $return : '');
}
/** Escape string for JavaScript apostrophes /** Escape string for JavaScript apostrophes
* @param string * @param string
* @return string * @return string
@@ -280,6 +300,25 @@ function js_escape($string) {
return addcslashes($string, "\r\n'\\/"); // slash for <script> return addcslashes($string, "\r\n'\\/"); // slash for <script>
} }
/** Print one row in JSON object
* @param string or "" to close the object
* @param string
* @return null
*/
function json_row($key, $val = null) {
static $first = true;
if ($first) {
echo "{";
}
if ($key != "") {
echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
$first = false;
} else {
echo "\n}\n";
$first = true;
}
}
/** Get INI boolean value /** Get INI boolean value
* @param string * @param string
* @return bool * @return bool
@@ -289,7 +328,7 @@ function ini_bool($ini) {
return (preg_match('~^(on|true|yes)$~i', $val) || (int) $val); // boolean values set by php_value are strings return (preg_match('~^(on|true|yes)$~i', $val) || (int) $val); // boolean values set by php_value are strings
} }
/** Check if SID is necessary /** Check if SID is neccessary
* @return bool * @return bool
*/ */
function sid() { function sid() {
@@ -337,16 +376,6 @@ function q($string) {
return $connection->quote($string); return $connection->quote($string);
} }
/** Get single value from database
* @param string
* @param int
* @return string or false if error
*/
function get_val($query, $field = 0) {
global $connection;
return $connection->result($query, $field);
}
/** Get list of values from database /** Get list of values from database
* @param string * @param string
* @param mixed * @param mixed
@@ -366,7 +395,7 @@ function get_vals($query, $column = 0) {
/** Get keys from first column and values from second /** Get keys from first column and values from second
* @param string * @param string
* @param Db * @param Min_DB
* @param bool * @param bool
* @return array * @return array
*/ */
@@ -391,7 +420,7 @@ function get_key_vals($query, $connection2 = null, $set_keys = true) {
/** Get all rows of result /** Get all rows of result
* @param string * @param string
* @param Db * @param Min_DB
* @param string * @param string
* @return array of associative arrays * @return array of associative arrays
*/ */
@@ -404,7 +433,7 @@ function get_rows($query, $connection2 = null, $error = "<p class='error'>") {
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
$return[] = $row; $return[] = $row;
} }
} elseif (!$result && !is_object($connection2) && $error && (defined('Adminer\PAGE_HEADER') || $error == "-- ")) { } elseif (!$result && !is_object($connection2) && $error && defined("PAGE_HEADER")) {
echo $error . error() . "\n"; echo $error . error() . "\n";
} }
return $return; return $return;
@@ -447,19 +476,18 @@ function escape_key($key) {
* @return string * @return string
*/ */
function where($where, $fields = array()) { function where($where, $fields = array()) {
global $connection; global $connection, $jush;
$return = array(); $return = array();
foreach ((array) $where["where"] as $key => $val) { foreach ((array) $where["where"] as $key => $val) {
$key = bracket_escape($key, 1); // 1 - back $key = bracket_escape($key, 1); // 1 - back
$column = escape_key($key); $column = escape_key($key);
$return[] = $column $return[] = $column
. (JUSH == "sql" && $fields[$key]["type"] == "json" ? " = CAST(" . q($val) . " AS JSON)" . ($jush == "sql" && is_numeric($val) && preg_match('~\.~', $val) ? " LIKE " . q($val) // LIKE because of floats but slow with ints
: (JUSH == "sql" && is_numeric($val) && preg_match('~\.~', $val) ? " LIKE " . q($val) // LIKE because of floats but slow with ints : ($jush == "mssql" ? " LIKE " . q(preg_replace('~[_%[]~', '[\0]', $val)) // LIKE because of text
: (JUSH == "mssql" ? " LIKE " . q(preg_replace('~[_%[]~', '[\0]', $val)) // LIKE because of text
: " = " . unconvert_field($fields[$key], q($val)) : " = " . unconvert_field($fields[$key], q($val))
))) ))
; //! enum and set ; //! enum and set
if (JUSH == "sql" && preg_match('~char|text~', $fields[$key]["type"]) && preg_match("~[^ -@]~", $val)) { // not just [a-z] to catch non-ASCII characters if ($jush == "sql" && preg_match('~char|text~', $fields[$key]["type"]) && preg_match("~[^ -@]~", $val)) { // not just [a-z] to catch non-ASCII characters
$return[] = "$column = " . q($val) . " COLLATE " . charset($connection) . "_bin"; $return[] = "$column = " . q($val) . " COLLATE " . charset($connection) . "_bin";
} }
} }
@@ -514,19 +542,17 @@ function convert_fields($columns, $fields, $select = array()) {
/** Set cookie valid on current path /** Set cookie valid on current path
* @param string * @param string
* @param string * @param string
* @param int number of seconds, 0 for session cookie, 2592000 - 30 days * @param int number of seconds, 0 for session cookie
* @return bool * @return bool
*/ */
function cookie($name, $value, $lifetime = 2592000) { function cookie($name, $value, $lifetime = 2592000) { // 2592000 - 30 days
global $HTTPS; global $HTTPS;
return header( return header("Set-Cookie: $name=" . urlencode($value)
"Set-Cookie: $name=" . urlencode($value) . ($lifetime ? "; expires=" . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT" : "")
. ($lifetime ? "; expires=" . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT" : "") . "; path=" . preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"])
. "; path=" . preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"]) . ($HTTPS ? "; secure" : "")
. ($HTTPS ? "; secure" : "") . "; HttpOnly; SameSite=lax",
. "; HttpOnly; SameSite=lax", false);
false
);
} }
/** Restart stopped session /** Restart stopped session
@@ -647,7 +673,7 @@ function query_redirect($query, $location, $message, $redirect = true, $execute
/** Execute and remember query /** Execute and remember query
* @param string or null to return remembered queries, end with ';' to use DELIMITER * @param string or null to return remembered queries, end with ';' to use DELIMITER
* @return Result or [$queries, $time] if $query = null * @return Min_Result or array($queries, $time) if $query = null
*/ */
function queries($query) { function queries($query) {
global $connection; global $connection;
@@ -670,7 +696,7 @@ function queries($query) {
* @param callback * @param callback
* @return bool * @return bool
*/ */
function apply_queries($query, $tables, $escape = 'Adminer\table') { function apply_queries($query, $tables, $escape = 'table') {
foreach ($tables as $table) { foreach ($tables as $table) {
if (!queries("$query " . $escape($table))) { if (!queries("$query " . $escape($table))) {
return false; return false;
@@ -745,8 +771,7 @@ function get_file($key, $decompress = false) {
} }
$name = $file["name"][$key]; $name = $file["name"][$key];
$tmp_name = $file["tmp_name"][$key]; $tmp_name = $file["tmp_name"][$key];
$content = file_get_contents( $content = file_get_contents($decompress && preg_match('~\.gz$~', $name)
$decompress && preg_match('~\.gz$~', $name)
? "compress.zlib://$tmp_name" ? "compress.zlib://$tmp_name"
: $tmp_name : $tmp_name
); //! may not be reachable because of open_basedir ); //! may not be reachable because of open_basedir
@@ -821,7 +846,7 @@ function format_number($val) {
*/ */
function friendly_url($val) { function friendly_url($val) {
// used for blobs and export // used for blobs and export
return preg_replace('~\W~i', '-', $val); return preg_replace('~[^a-z0-9_]~i', '-', $val);
} }
/** Print hidden fields /** Print hidden fields
@@ -861,12 +886,12 @@ function hidden_fields_get() {
*/ */
function table_status1($table, $fast = false) { function table_status1($table, $fast = false) {
$return = table_status($table, $fast); $return = table_status($table, $fast);
return ($return ?: array("Name" => $table)); return ($return ? $return : array("Name" => $table));
} }
/** Find out foreign keys for each column /** Find out foreign keys for each column
* @param string * @param string
* @return array [$col => []] * @return array array($col => array())
*/ */
function column_foreign_keys($table) { function column_foreign_keys($table) {
global $adminer; global $adminer;
@@ -894,7 +919,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) {
foreach ($matches[1] as $i => $val) { foreach ($matches[1] as $i => $val) {
$val = stripcslashes(str_replace("''", "'", $val)); $val = stripcslashes(str_replace("''", "'", $val));
$checked = (is_int($value) ? $value == $i+1 : (is_array($value) ? in_array($i+1, $value) : $value === $val)); $checked = (is_int($value) ? $value == $i+1 : (is_array($value) ? in_array($i+1, $value) : $value === $val));
$return .= " <label><input type='$type'$attrs value='" . (JUSH == "sql" ? $i+1 : h($val)) . "'" . ($checked ? ' checked' : '') . '>' . h($adminer->editVal($val, $field)) . '</label>'; $return .= " <label><input type='$type'$attrs value='" . ($i+1) . "'" . ($checked ? ' checked' : '') . '>' . h($adminer->editVal($val, $field)) . '</label>';
} }
return $return; return $return;
} }
@@ -906,7 +931,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) {
* @return null * @return null
*/ */
function input($field, $value, $function) { function input($field, $value, $function) {
global $driver, $adminer; global $types, $adminer, $jush;
$name = h(bracket_escape($field["field"])); $name = h(bracket_escape($field["field"]));
echo "<td class='function'>"; echo "<td class='function'>";
if (is_array($value) && !$function) { if (is_array($value) && !$function) {
@@ -917,24 +942,18 @@ function input($field, $value, $function) {
$value = call_user_func_array('json_encode', $args); //! requires PHP 5.2 $value = call_user_func_array('json_encode', $args); //! requires PHP 5.2
$function = "json"; $function = "json";
} }
$reset = (JUSH == "mssql" && $field["auto_increment"]); $reset = ($jush == "mssql" && $field["auto_increment"]);
if ($reset && !$_POST["save"]) { if ($reset && !$_POST["save"]) {
$function = null; $function = null;
} }
$functions = (isset($_GET["select"]) || $reset ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field); $functions = (isset($_GET["select"]) || $reset ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field);
$disabled = stripos($field["default"], "GENERATED ALWAYS AS ") === 0 ? " disabled=''" : ""; $attrs = " name='fields[$name]'";
$attrs = " name='fields[$name]'$disabled";
$enums = $driver->enumLength($field);
if ($enums) {
$field["type"] = "enum";
$field["length"] = $enums;
}
if ($field["type"] == "enum") { if ($field["type"] == "enum") {
echo h($functions[""]) . "<td>" . $adminer->editInput($_GET["edit"], $field, $attrs, $value); echo h($functions[""]) . "<td>" . $adminer->editInput($_GET["edit"], $field, $attrs, $value);
} else { } else {
$has_function = (in_array($function, $functions) || isset($functions[$function])); $has_function = (in_array($function, $functions) || isset($functions[$function]));
echo (count($functions) > 1 echo (count($functions) > 1
? "<select name='function[$name]'$disabled>" . optionlist($functions, $function === null || $has_function ? $function : "") . "</select>" ? "<select name='function[$name]'>" . optionlist($functions, $function === null || $has_function ? $function : "") . "</select>"
. on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1) . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1)
. script("qsl('select').onchange = functionChange;", "") . script("qsl('select').onchange = functionChange;", "")
: h(reset($functions)) : h(reset($functions))
@@ -943,8 +962,8 @@ function input($field, $value, $function) {
if ($input != "") { if ($input != "") {
echo $input; echo $input;
} elseif (preg_match('~bool~', $field["type"])) { } elseif (preg_match('~bool~', $field["type"])) {
echo "<input type='hidden'$attrs value='0'>" echo "<input type='hidden'$attrs value='0'>" .
. "<input type='checkbox'" . (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? " checked='checked'" : "") . "$attrs value='1'>"; "<input type='checkbox'" . (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? " checked='checked'" : "") . "$attrs value='1'>";
} elseif ($field["type"] == "set") { //! 64 bits } elseif ($field["type"] == "set") { //! 64 bits
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches); preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) { foreach ($matches[1] as $i => $val) {
@@ -955,7 +974,7 @@ function input($field, $value, $function) {
} elseif (preg_match('~blob|bytea|raw|file~', $field["type"]) && ini_bool("file_uploads")) { } elseif (preg_match('~blob|bytea|raw|file~', $field["type"]) && ini_bool("file_uploads")) {
echo "<input type='file' name='fields-$name'>"; echo "<input type='file' name='fields-$name'>";
} elseif (($text = preg_match('~text|lob|memo~i', $field["type"])) || preg_match("~\n~", $value)) { } elseif (($text = preg_match('~text|lob|memo~i', $field["type"])) || preg_match("~\n~", $value)) {
if ($text && JUSH != "sqlite") { if ($text && $jush != "sqlite") {
$attrs .= " cols='50' rows='12'"; $attrs .= " cols='50' rows='12'";
} else { } else {
$rows = min(12, substr_count($value, "\n") + 1); $rows = min(12, substr_count($value, "\n") + 1);
@@ -966,12 +985,8 @@ function input($field, $value, $function) {
echo "<textarea$attrs cols='50' rows='12' class='jush-js'>" . h($value) . '</textarea>'; echo "<textarea$attrs cols='50' rows='12' class='jush-js'>" . h($value) . '</textarea>';
} else { } else {
// int(3) is only a display hint // int(3) is only a display hint
$types = $driver->types(); $maxlength = (!preg_match('~int~', $field["type"]) && preg_match('~^(\d+)(,(\d+))?$~', $field["length"], $match) ? ((preg_match("~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 = (!preg_match('~int~', $field["type"]) && preg_match('~^(\d+)(,(\d+))?$~', $field["length"], $match) if ($jush == 'sql' && min_version(5.6) && preg_match('~time~', $field["type"])) {
? ((preg_match("~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)
);
if (JUSH == 'sql' && min_version(5.6) && preg_match('~time~', $field["type"])) {
$maxlength += 7; // microtime $maxlength += 7; // microtime
} }
// type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator // type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator
@@ -1003,23 +1018,16 @@ function input($field, $value, $function) {
*/ */
function process_input($field) { function process_input($field) {
global $adminer, $driver; global $adminer, $driver;
if (stripos($field["default"], "GENERATED ALWAYS AS ") === 0) {
return null;
}
$idf = bracket_escape($field["field"]); $idf = bracket_escape($field["field"]);
$function = $_POST["function"][$idf]; $function = $_POST["function"][$idf];
$value = $_POST["fields"][$idf]; $value = $_POST["fields"][$idf];
if ($field["type"] == "enum" || $driver->enumLength($field)) { if ($field["type"] == "enum") {
if ($value == -1) { if ($value == -1) {
return false; return false;
} }
if ($value == "") { if ($value == "") {
return "NULL"; return "NULL";
} }
}
if ($field["type"] == "enum") {
return +$value; return +$value;
} }
if ($field["auto_increment"] && $value == "") { if ($field["auto_increment"] && $value == "") {
@@ -1233,7 +1241,7 @@ function select_value($val, $link, $field, $text_length) {
. "<td>" . select_value($v, $link, $field, $text_length) . "<td>" . select_value($v, $link, $field, $text_length)
; ;
} }
return "<table>$return</table>"; return "<table cellspacing='0'>$return</table>";
} }
if (!$link) { if (!$link) {
$link = $adminer->selectLink($val, $field); $link = $adminer->selectLink($val, $field);
@@ -1242,7 +1250,7 @@ function select_value($val, $link, $field, $text_length) {
if (is_mail($val)) { if (is_mail($val)) {
$link = "mailto:$val"; $link = "mailto:$val";
} }
if (is_url($val)) { if (is_web_url($val)) {
$link = $val; // IE 11 and all modern browsers hide referrer $link = $val; // IE 11 and all modern browsers hide referrer
} }
} }
@@ -1263,20 +1271,32 @@ function select_value($val, $link, $field, $text_length) {
* @param string * @param string
* @return bool * @return bool
*/ */
function is_mail($email) { function is_mail($value) {
$atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]'; // characters of local-name return is_string($value) && filter_var($value, FILTER_VALIDATE_EMAIL);
$domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component
$pattern = "$atom+(\\.$atom+)*@($domain?\\.)+$domain";
return is_string($email) && preg_match("(^$pattern(,\\s*$pattern)*\$)i", $email);
} }
/** Check whether the string is URL address /** Check whether the string is web URL address
* @param string * @param string
* @return bool * @return bool
*/ */
function is_url($string) { function is_web_url($value) {
$domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component //! IDN if (!is_string($value) || !preg_match('~^https?://~i', $value)) {
return preg_match("~^(https?)://($domain?\\.)+$domain(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i", $string); //! restrict path, query and fragment characters return false;
}
$components = parse_url($value);
if (!$components) {
return false;
}
// Encode URL path. If path was encoded already, it will be encoded twice, but we are OK with that.
$encodedParts = array_map('urlencode', explode('/', $components['path']));
$url = str_replace($components['path'], implode('/', $encodedParts), $value);
parse_str($components['query'], $params);
$url = str_replace($components['query'], http_build_query($params), $url);
return (bool)filter_var($url, FILTER_VALIDATE_URL);
} }
/** Check if field should be shortened /** Check if field should be shortened
@@ -1295,8 +1315,9 @@ function is_shortable($field) {
* @return string * @return string
*/ */
function count_rows($table, $where, $is_group, $group) { function count_rows($table, $where, $is_group, $group) {
global $jush;
$query = " FROM " . table($table) . ($where ? " WHERE " . implode(" AND ", $where) : ""); $query = " FROM " . table($table) . ($where ? " WHERE " . implode(" AND ", $where) : "");
return ($is_group && (JUSH == "sql" || count($group) == 1) return ($is_group && ($jush == "sql" || count($group) == 1)
? "SELECT COUNT(DISTINCT " . implode(", ", $group) . ")$query" ? "SELECT COUNT(DISTINCT " . implode(", ", $group) . ")$query"
: "SELECT COUNT(*)" . ($is_group ? " FROM (SELECT 1$query GROUP BY " . implode(", ", $group) . ") x" : $query) : "SELECT COUNT(*)" . ($is_group ? " FROM (SELECT 1$query GROUP BY " . implode(", ", $group) . ") x" : $query)
); );
@@ -1311,8 +1332,7 @@ function slow_query($query) {
$db = $adminer->database(); $db = $adminer->database();
$timeout = $adminer->queryTimeout(); $timeout = $adminer->queryTimeout();
$slow_query = $driver->slowQuery($query, $timeout); $slow_query = $driver->slowQuery($query, $timeout);
$connection2 = null; if (!$slow_query && support("kill") && is_object($connection2 = connect()) && ($db == "" || $connection2->select_db($db))) {
if (!$slow_query && support("kill") && is_object($connection2 = connect($adminer->credentials())) && ($db == "" || $connection2->select_db($db))) {
$kill = $connection2->result(connection_id()); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL $kill = $connection2->result(connection_id()); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL
?> ?>
<script<?php echo nonce(); ?>> <script<?php echo nonce(); ?>>
@@ -1322,10 +1342,12 @@ var timeout = setTimeout(function () {
}, <?php echo 1000 * $timeout; ?>); }, <?php echo 1000 * $timeout; ?>);
</script> </script>
<?php <?php
} else {
$connection2 = null;
} }
ob_flush(); ob_flush();
flush(); flush();
$return = @get_key_vals(($slow_query ?: $query), $connection2, false); // @ - may be killed $return = @get_key_vals(($slow_query ? $slow_query : $query), $connection2, false); // @ - may be killed
if ($connection2) { if ($connection2) {
echo script("clearTimeout(timeout);"); echo script("clearTimeout(timeout);");
ob_flush(); ob_flush();
@@ -1405,7 +1427,7 @@ function on_help($command, $side = 0) {
* @return null * @return null
*/ */
function edit_form($table, $fields, $row, $update) { function edit_form($table, $fields, $row, $update) {
global $adminer, $token, $error; global $adminer, $jush, $token, $error;
$table_name = $adminer->tableName(table_status1($table, true)); $table_name = $adminer->tableName(table_status1($table, true));
page_header( page_header(
($update ? lang('Edit') : lang('Insert')), ($update ? lang('Edit') : lang('Insert')),
@@ -1416,16 +1438,15 @@ function edit_form($table, $fields, $row, $update) {
$adminer->editRowPrint($table, $fields, $row, $update); $adminer->editRowPrint($table, $fields, $row, $update);
if ($row === false) { if ($row === false) {
echo "<p class='error'>" . lang('No rows.') . "\n"; echo "<p class='error'>" . lang('No rows.') . "\n";
return;
} }
?> ?>
<form action="" method="post" enctype="multipart/form-data" id="form"> <form action="" method="post" enctype="multipart/form-data" id="form">
<?php <?php
$first = 0;
if (!$fields) { if (!$fields) {
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n"; echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
} else { } else {
echo "<table class='layout'>" . script("qsl('table').onkeydown = editingKeydown;"); echo "<table cellspacing='0' class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
foreach ($fields as $name => $field) { foreach ($fields as $name => $field) {
echo "<tr><th>" . $adminer->fieldName($field); echo "<tr><th>" . $adminer->fieldName($field);
$default = $_GET["set"][bracket_escape($name)]; $default = $_GET["set"][bracket_escape($name)];
@@ -1436,7 +1457,7 @@ function edit_form($table, $fields, $row, $update) {
} }
} }
$value = ($row !== null $value = ($row !== null
? ($row[$name] != "" && JUSH == "sql" && preg_match("~enum|set~", $field["type"]) ? ($row[$name] != "" && $jush == "sql" && preg_match("~enum|set~", $field["type"])
? (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) ? (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name])
: (is_bool($row[$name]) ? +$row[$name] : $row[$name]) : (is_bool($row[$name]) ? +$row[$name] : $row[$name])
) )
@@ -1462,13 +1483,6 @@ function edit_form($table, $fields, $row, $update) {
$value = ""; $value = "";
$function = "now"; $function = "now";
} }
if ($field["type"] == "uuid" && $value == "uuid()") {
$value = "";
$function = "uuid";
}
if ($field["auto_increment"] || $function == "now" || $function == "uuid") {
$first++;
}
input($field, $value, $function); input($field, $value, $function);
echo "\n"; echo "\n";
} }
@@ -1495,7 +1509,7 @@ function edit_form($table, $fields, $row, $update) {
} }
} }
echo ($update ? "<input type='submit' name='delete' value='" . lang('Delete') . "'>" . confirm() . "\n" echo ($update ? "<input type='submit' name='delete' value='" . lang('Delete') . "'>" . confirm() . "\n"
: ($_POST || !$fields ? "" : script("focus(qsa('td', qs('#form'))[2*$first+1].firstChild);")) : ($_POST || !$fields ? "" : script("focus(qsa('td', qs('#form'))[1].firstChild);"))
); );
if (isset($_GET["select"])) { if (isset($_GET["select"])) {
hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"])); hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"]));

View File

@@ -1,13 +1,11 @@
<?php <?php
namespace Adminer;
// not used in a single language version // not used in a single language version
$langs = array( $langs = array(
'en' => 'English', // Jakub Vrána - https://www.vrana.cz 'en' => 'English', // Jakub Vrána - https://www.vrana.cz
'ar' => 'العربية', // Y.M Amine - Algeria - nbr7@live.fr 'ar' => 'العربية', // Y.M Amine - Algeria - nbr7@live.fr
'bg' => 'Български', // Deyan Delchev 'bg' => 'Български', // Deyan Delchev
'bn' => 'বাংলা', // Dipak Kumar - dipak.ndc@gmail.com, Hossain Ahmed Saiman - hossain.ahmed@altscope.com 'bn' => 'বাংলা', // Dipak Kumar - dipak.ndc@gmail.com | Hossain Ahmed Saiman - hossain.ahmed@altscope.com
'bs' => 'Bosanski', // Emir Kurtovic 'bs' => 'Bosanski', // Emir Kurtovic
'ca' => 'Català', // Joan Llosas 'ca' => 'Català', // Joan Llosas
'cs' => 'Čeština', // Jakub Vrána - https://www.vrana.cz 'cs' => 'Čeština', // Jakub Vrána - https://www.vrana.cz
@@ -27,8 +25,8 @@ $langs = array(
'ja' => '日本語', // Hitoshi Ozawa - http://sourceforge.jp/projects/oss-ja-jpn/releases/ 'ja' => '日本語', // Hitoshi Ozawa - http://sourceforge.jp/projects/oss-ja-jpn/releases/
'ka' => 'ქართული', // Saba Khmaladze skhmaladze@uglt.org 'ka' => 'ქართული', // Saba Khmaladze skhmaladze@uglt.org
'ko' => '한국어', // dalli - skcha67@gmail.com 'ko' => '한국어', // dalli - skcha67@gmail.com
'lt' => 'Lietuvių', // Paulius Leščinskas - http://www.lescinskas.lt 'lv' => 'Latviešu', // Kristaps Lediņš - https://krysits.com
'lv' => 'Latviešu', // Kristaps Lediņš - https://krysits.com 'lt' => 'Lietuvių', // Paulius Leščinskas - http://www.lescinskas.lt
'ms' => 'Bahasa Melayu', // Pisyek 'ms' => 'Bahasa Melayu', // Pisyek
'nl' => 'Nederlands', // Maarten Balliauw - http://blog.maartenballiauw.be 'nl' => 'Nederlands', // Maarten Balliauw - http://blog.maartenballiauw.be
'no' => 'Norsk', // Iver Odin Kvello, mupublishing.com 'no' => 'Norsk', // Iver Odin Kvello, mupublishing.com
@@ -65,7 +63,7 @@ function get_lang() {
*/ */
function lang($idf, $number = null) { function lang($idf, $number = null) {
global $LANG, $translations; global $LANG, $translations;
$translation = ($translations[$idf] ?: $idf); $translation = ($translations[$idf] ? $translations[$idf] : $idf);
if (is_array($translation)) { if (is_array($translation)) {
$pos = ($number == 1 ? 0 $pos = ($number == 1 ? 0
: ($LANG == 'cs' || $LANG == 'sk' ? ($number && $number < 5 ? 1 : 2) // different forms for 1, 2-4, other : ($LANG == 'cs' || $LANG == 'sk' ? ($number && $number < 5 ? 1 : 2) // different forms for 1, 2-4, other
@@ -73,10 +71,9 @@ function lang($idf, $number = null) {
: ($LANG == 'pl' ? ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2) // different forms for 1, 2-4 except 12-14, other : ($LANG == 'pl' ? ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2) // different forms for 1, 2-4 except 12-14, other
: ($LANG == 'sl' ? ($number % 100 == 1 ? 0 : ($number % 100 == 2 ? 1 : ($number % 100 == 3 || $number % 100 == 4 ? 2 : 3))) // different forms for 1, 2, 3-4, other : ($LANG == 'sl' ? ($number % 100 == 1 ? 0 : ($number % 100 == 2 ? 1 : ($number % 100 == 3 || $number % 100 == 4 ? 2 : 3))) // different forms for 1, 2, 3-4, other
: ($LANG == 'lt' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1, 12-19, other : ($LANG == 'lt' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1, 12-19, other
: ($LANG == 'lv' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number ? 1 : 2)) // different forms for 1 except 11, other, 0
: ($LANG == 'bs' || $LANG == 'ru' || $LANG == 'sr' || $LANG == 'uk' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1 except 11, 2-4 except 12-14, other : ($LANG == 'bs' || $LANG == 'ru' || $LANG == 'sr' || $LANG == 'uk' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1 except 11, 2-4 except 12-14, other
: 1 // different forms for 1, other : 1 // different forms for 1, other
)))))))); // http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html ))))))); // http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
$translation = $translation[$pos]; $translation = $translation[$pos];
} }
$args = func_get_args(); $args = func_get_args();

View File

@@ -1,28 +1,34 @@
<?php <?php
namespace Adminer;
// PDO can be used in several database drivers // PDO can be used in several database drivers
if (extension_loaded('pdo')) { if (extension_loaded('pdo')) {
abstract class PdoDb { /*abstract*/ class Min_PDO {
var $_result, $server_info, $affected_rows, $errno, $error, $pdo; var $_result, $server_info, $affected_rows, $errno, $error, $pdo;
function __construct() {
global $adminer;
$pos = array_search("SQL", $adminer->operators);
if ($pos !== false) {
unset($adminer->operators[$pos]);
}
}
function dsn($dsn, $username, $password, $options = array()) { function dsn($dsn, $username, $password, $options = array()) {
$options[\PDO::ATTR_ERRMODE] = \PDO::ERRMODE_SILENT; $options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT;
$options[\PDO::ATTR_STATEMENT_CLASS] = array('Adminer\PdoDbStatement'); $options[PDO::ATTR_STATEMENT_CLASS] = array('Min_PDOStatement');
try { try {
$this->pdo = new \PDO($dsn, $username, $password, $options); $this->pdo = new PDO($dsn, $username, $password, $options);
} catch (Exception $ex) { } catch (Exception $ex) {
auth_error(h($ex->getMessage())); auth_error(h($ex->getMessage()));
} }
$this->server_info = @$this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION); $this->server_info = @$this->pdo->getAttribute(PDO::ATTR_SERVER_VERSION);
} }
abstract function select_db($database); /*abstract function select_db($database);*/
function quote($string) { function quote($string) {
return $this->pdo->quote($string); return $this->pdo->quote($string);
} }
function query($query, $unbuffered = false) { function query($query, $unbuffered = false) {
$result = $this->pdo->query($query); $result = $this->pdo->query($query);
$this->error = ""; $this->error = "";
@@ -36,11 +42,11 @@ if (extension_loaded('pdo')) {
$this->store_result($result); $this->store_result($result);
return $result; return $result;
} }
function multi_query($query) { function multi_query($query) {
return $this->_result = $this->query($query); return $this->_result = $this->query($query);
} }
function store_result($result = null) { function store_result($result = null) {
if (!$result) { if (!$result) {
$result = $this->_result; $result = $this->_result;
@@ -55,7 +61,7 @@ if (extension_loaded('pdo')) {
$this->affected_rows = $result->rowCount(); $this->affected_rows = $result->rowCount();
return true; return true;
} }
function next_result() { function next_result() {
if (!$this->_result) { if (!$this->_result) {
return false; return false;
@@ -63,7 +69,7 @@ if (extension_loaded('pdo')) {
$this->_result->_offset = 0; $this->_result->_offset = 0;
return @$this->_result->nextRowset(); // @ - PDO_PgSQL doesn't support it return @$this->_result->nextRowset(); // @ - PDO_PgSQL doesn't support it
} }
function result($query, $field = 0) { function result($query, $field = 0) {
$result = $this->query($query); $result = $this->query($query);
if (!$result) { if (!$result) {
@@ -73,18 +79,18 @@ if (extension_loaded('pdo')) {
return $row[$field]; return $row[$field];
} }
} }
class PdoDbStatement extends \PDOStatement { class Min_PDOStatement extends PDOStatement {
var $_offset = 0, $num_rows; var $_offset = 0, $num_rows;
function fetch_assoc() { function fetch_assoc() {
return $this->fetch(\PDO::FETCH_ASSOC); return $this->fetch(PDO::FETCH_ASSOC);
} }
function fetch_row() { function fetch_row() {
return $this->fetch(\PDO::FETCH_NUM); return $this->fetch(PDO::FETCH_NUM);
} }
function fetch_field() { function fetch_field() {
$row = (object) $this->getColumnMeta($this->_offset++); $row = (object) $this->getColumnMeta($this->_offset++);
$row->orgtable = $row->table; $row->orgtable = $row->table;
@@ -92,11 +98,5 @@ if (extension_loaded('pdo')) {
$row->charsetnr = (in_array("blob", (array) $row->flags) ? 63 : 0); $row->charsetnr = (in_array("blob", (array) $row->flags) ? 63 : 0);
return $row; return $row;
} }
function seek($offset) {
for ($i=0; $i < $offset; $i++) {
$this->fetch();
}
}
} }
} }

View File

@@ -1,22 +1,22 @@
<?php <?php
namespace Adminer;
class TmpFile { class TmpFile {
var $handler; var $handler;
var $size; var $size;
function __construct() { function __construct() {
$this->handler = tmpfile(); $this->handler = tmpfile();
} }
function write($contents) { function write($contents) {
$this->size += strlen($contents); $this->size += strlen($contents);
fwrite($this->handler, $contents); fwrite($this->handler, $contents);
} }
function send() { function send() {
fseek($this->handler, 0); fseek($this->handler, 0);
fpassthru($this->handler); fpassthru($this->handler);
fclose($this->handler); fclose($this->handler);
} }
} }

View File

@@ -1,4 +1,2 @@
<?php <?php
namespace Adminer; $VERSION = "4.9.1";
$VERSION = "5.0.2";

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
/** PHP implementation of XXTEA encryption algorithm /** PHP implementation of XXTEA encryption algorithm
* @author Ma Bingyao <andot@ujn.edu.cn> * @author Ma Bingyao <andot@ujn.edu.cn>
* @link http://www.coolcode.cn/?action=show&id=128 * @link http://www.coolcode.cn/?action=show&id=128

View File

@@ -7,11 +7,12 @@
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other) * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/ */
namespace Adminer;
include "./include/bootstrap.inc.php"; include "./include/bootstrap.inc.php";
include "./include/tmpfile.inc.php"; include "./include/tmpfile.inc.php";
$enum_length = "'(?:''|[^'\\\\]|\\\\.)*'";
$inout = "IN|OUT|INOUT";
if (isset($_GET["select"]) && ($_POST["edit"] || $_POST["clone"]) && !$_POST["save"]) { if (isset($_GET["select"]) && ($_POST["edit"] || $_POST["clone"]) && !$_POST["save"]) {
$_GET["edit"] = $_GET["select"]; $_GET["edit"] = $_GET["select"];
} }
@@ -58,8 +59,6 @@ if (isset($_GET["download"])) {
include "./sequence.inc.php"; include "./sequence.inc.php";
} elseif (isset($_GET["type"])) { } elseif (isset($_GET["type"])) {
include "./type.inc.php"; include "./type.inc.php";
} elseif (isset($_GET["check"])) {
include "./check.inc.php";
} elseif (isset($_GET["trigger"])) { } elseif (isset($_GET["trigger"])) {
include "./trigger.inc.php"; include "./trigger.inc.php";
} elseif (isset($_GET["user"])) { } elseif (isset($_GET["user"])) {

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$TABLE = $_GET["indexes"]; $TABLE = $_GET["indexes"];
$index_types = array("PRIMARY", "UNIQUE", "INDEX"); $index_types = array("PRIMARY", "UNIQUE", "INDEX");
$table_status = table_status($TABLE, true); $table_status = table_status($TABLE, true);
@@ -12,15 +10,13 @@ if (preg_match('~MyISAM|M?aria' . (min_version(5.7, '10.2.2') ? '|InnoDB' : '')
} }
$indexes = indexes($TABLE); $indexes = indexes($TABLE);
$primary = array(); $primary = array();
if (JUSH == "mongo") { // doesn't support primary key if ($jush == "mongo") { // doesn't support primary key
$primary = $indexes["_id_"]; $primary = $indexes["_id_"];
unset($index_types[0]); unset($index_types[0]);
unset($indexes["_id_"]); unset($indexes["_id_"]);
} }
$row = $_POST; $row = $_POST;
if ($row) {
set_adminer_settings(array("index_options" => $row["options"]));
}
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) { if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
$alter = array(); $alter = array();
foreach ($row["indexes"] as $index) { foreach ($row["indexes"] as $index) {
@@ -37,28 +33,27 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
$desc = $index["descs"][$key]; $desc = $index["descs"][$key];
$set[] = idf_escape($column) . ($length ? "(" . (+$length) . ")" : "") . ($desc ? " DESC" : ""); $set[] = idf_escape($column) . ($length ? "(" . (+$length) . ")" : "") . ($desc ? " DESC" : "");
$columns[] = $column; $columns[] = $column;
$lengths[] = ($length ?: null); $lengths[] = ($length ? $length : null);
$descs[] = $desc; $descs[] = $desc;
} }
} }
$existing = $indexes[$name];
if ($existing) {
ksort($existing["columns"]);
ksort($existing["lengths"]);
ksort($existing["descs"]);
if (
$index["type"] == $existing["type"]
&& array_values($existing["columns"]) === $columns
&& (!$existing["lengths"] || array_values($existing["lengths"]) === $lengths)
&& array_values($existing["descs"]) === $descs
) {
// skip existing index
unset($indexes[$name]);
continue;
}
}
if ($columns) { if ($columns) {
$existing = $indexes[$name];
if ($existing) {
ksort($existing["columns"]);
ksort($existing["lengths"]);
ksort($existing["descs"]);
if ($index["type"] == $existing["type"]
&& array_values($existing["columns"]) === $columns
&& (!$existing["lengths"] || array_values($existing["lengths"]) === $lengths)
&& array_values($existing["descs"]) === $descs
) {
// skip existing index
unset($indexes[$name]);
continue;
}
}
$alter[] = array($index["type"], $name, $set); $alter[] = array($index["type"], $name, $set);
} }
} }
@@ -96,21 +91,14 @@ if (!$row) {
$indexes[] = array("columns" => array(1 => "")); $indexes[] = array("columns" => array(1 => ""));
$row["indexes"] = $indexes; $row["indexes"] = $indexes;
} }
$lengths = (JUSH == "sql" || JUSH == "mssql");
$show_options = ($_POST ? $_POST["options"] : adminer_setting("index_options"));
?> ?>
<form action="" method="post"> <form action="" method="post">
<div class="scrollable"> <div class="scrollable">
<table class="nowrap"> <table cellspacing="0" class="nowrap">
<thead><tr> <thead><tr>
<th id="label-type"><?php echo lang('Index Type'); ?> <th id="label-type"><?php echo lang('Index Type'); ?>
<th><input type="submit" class="wayoff"><?php <th><input type="submit" class="wayoff"><?php echo lang('Column (length)'); ?>
echo lang('Column') . ($lengths ? "<span class='idxopts" . ($show_options ? "" : " hidden") . "'> (" . lang('length') . ")</span>" : "");
if ($lengths || support("descidx")) {
echo checkbox("options", 1, $show_options, lang('Options'), "indexOptionsShow(this.checked)", "jsonly") . "\n";
}
?>
<th id="label-name"><?php echo lang('Name'); ?> <th id="label-name"><?php echo lang('Name'); ?>
<th><noscript><?php echo "<input type='image' class='icon' name='add[0]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>"; ?></noscript> <th><noscript><?php echo "<input type='image' class='icon' name='add[0]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>"; ?></noscript>
</thead> </thead>
@@ -136,12 +124,11 @@ foreach ($row["indexes"] as $index) {
" name='indexes[$j][columns][$i]' title='" . lang('Column') . "'", " name='indexes[$j][columns][$i]' title='" . lang('Column') . "'",
($fields ? array_combine($fields, $fields) : $fields), ($fields ? array_combine($fields, $fields) : $fields),
$column, $column,
"partial(" . ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . ", '" . js_escape(JUSH == "sql" ? "" : $_GET["indexes"] . "_") . "')" "partial(" . ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . ", '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "')"
); );
echo "<span class='idxopts" . ($show_options ? "" : " hidden") . "'>"; echo ($jush == "sql" || $jush == "mssql" ? "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "' title='" . lang('Length') . "'>" : "");
echo ($lengths ? "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "' title='" . lang('Length') . "'>" : "");
echo (support("descidx") ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : ""); echo (support("descidx") ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : "");
echo "</span> </span>"; echo " </span>";
$i++; $i++;
} }

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'تسجيل الدخول', 'Login' => 'تسجيل الدخول',
'Logout successful.' => 'تم تسجيل الخروج بنجاح.', 'Logout successful.' => 'تم تسجيل الخروج بنجاح.',
'Invalid credentials.' => 'بيانات الدخول غير صالحة.', 'Invalid server or credentials.' => null,
'Server' => 'الخادم', 'Server' => 'الخادم',
'Username' => 'اسم المستخدم', 'Username' => 'اسم المستخدم',
'Password' => 'كلمة المرور', 'Password' => 'كلمة المرور',
@@ -32,6 +30,7 @@ $translations = array(
'Create database' => 'إنشاء قاعدة بيانات', 'Create database' => 'إنشاء قاعدة بيانات',
'SQL command' => 'استعلام SQL', 'SQL command' => 'استعلام SQL',
'Logout' => 'تسجيل الخروج', 'Logout' => 'تسجيل الخروج',
'database' => 'قاعدة بيانات',
'Use' => 'استعمال', 'Use' => 'استعمال',
'No tables.' => 'لا توجد جداول.', 'No tables.' => 'لا توجد جداول.',
'select' => 'تحديد', 'select' => 'تحديد',
@@ -77,7 +76,7 @@ $translations = array(
'Routine has been called, %d row(s) affected.' => 'تم استدعاء الروتين, عدد الأسطر المعدلة %d.', 'Routine has been called, %d row(s) affected.' => 'تم استدعاء الروتين, عدد الأسطر المعدلة %d.',
'Call' => 'استدعاء', 'Call' => 'استدعاء',
'No extension' => 'امتداد غير موجود', 'No extension' => 'امتداد غير موجود',
'None of the supported PHP extensions (%s) are available.' => 'إمتدادات php (%s) المدعومة غير موجودة.', 'None of the supported PHP extensions (%s) are available.' => 'إمتدادات php المدعومة غير موجودة.',
'Session support must be enabled.' => 'عليك تفعيل نظام الجلسات.', 'Session support must be enabled.' => 'عليك تفعيل نظام الجلسات.',
'Session expired, please login again.' => 'إنتهت الجلسة، من فضلك أعد تسجيل الدخول.', 'Session expired, please login again.' => 'إنتهت الجلسة، من فضلك أعد تسجيل الدخول.',
'Text length' => 'طول النص', 'Text length' => 'طول النص',
@@ -95,7 +94,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'نوع المؤشر', 'Index Type' => 'نوع المؤشر',
'length' => 'الطول', 'Column (length)' => 'العمود (الطول)',
'View has been dropped.' => 'تم مسح العرض.', 'View has been dropped.' => 'تم مسح العرض.',
'View has been altered.' => 'تم تعديل العرض.', 'View has been altered.' => 'تم تعديل العرض.',
'View has been created.' => 'تم إنشاء العرض.', 'View has been created.' => 'تم إنشاء العرض.',
@@ -171,8 +170,8 @@ $translations = array(
'Tables and views' => 'الجداول و العروض', 'Tables and views' => 'الجداول و العروض',
'Engine' => 'المحرك', 'Engine' => 'المحرك',
'Collation' => 'ترتيب', 'Collation' => 'ترتيب',
'Data Length' => 'طول المعطيات', 'Data Length' => 'طول المعطيات.',
'Index Length' => 'طول المؤشر', 'Index Length' => 'طول المؤشر.',
'Data Free' => 'المساحة الحرة', 'Data Free' => 'المساحة الحرة',
'Rows' => 'الأسطر', 'Rows' => 'الأسطر',
',' => ',', ',' => ',',
@@ -192,7 +191,7 @@ $translations = array(
'Partitions' => 'التقسيمات', 'Partitions' => 'التقسيمات',
'Partition name' => 'اسم التقسيم', 'Partition name' => 'اسم التقسيم',
'Values' => 'القيم', 'Values' => 'القيم',
'%d row(s) have been imported.' => 'تم استيراد %d سطرا.', '%d row(s) have been imported.' => 'تم استيراد %d سطرا',
'anywhere' => 'في اي مكان', 'anywhere' => 'في اي مكان',
'Import' => 'استيراد', 'Import' => 'استيراد',
'Stop on error' => 'أوقف في حالة حدوث خطأ', 'Stop on error' => 'أوقف في حالة حدوث خطأ',
@@ -251,8 +250,8 @@ $translations = array(
'Network' => 'شبكة', 'Network' => 'شبكة',
'Geometry' => 'هندسة', 'Geometry' => 'هندسة',
'File exists.' => 'الملف موجود.', 'File exists.' => 'الملف موجود.',
'Attachments' => 'ملفات مرفقة', 'Attachments' => 'ملفات مرفقة.',
'Item%s has been inserted.' => '%sتم إدراج العنصر.', 'Item%s has been inserted.' => 'تم إدراج العنصر.',
'now' => 'الآن', 'now' => 'الآن',
'%d query(s) executed OK.' => array('تم تنفيذ الاستعلام %d بنجاح.', 'تم تنفيذ الاستعلامات %d بنجاح.'), '%d query(s) executed OK.' => array('تم تنفيذ الاستعلام %d بنجاح.', 'تم تنفيذ الاستعلامات %d بنجاح.'),
'Show only errors' => 'إظهار الأخطاء فقط', 'Show only errors' => 'إظهار الأخطاء فقط',
@@ -265,4 +264,50 @@ $translations = array(
'Permanent link' => 'رابط دائم', 'Permanent link' => 'رابط دائم',
'Edit all' => 'تعديل الكل', 'Edit all' => 'تعديل الكل',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'Ctrl+click on a value to modify it.' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Система', 'System' => 'Система',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'Изход', 'Logout' => 'Изход',
'Logged as: %s' => 'Текущ потребител: %s', 'Logged as: %s' => 'Текущ потребител: %s',
'Logout successful.' => 'Излизането е успешно.', 'Logout successful.' => 'Излизането е успешно.',
'Invalid credentials.' => 'Невалидни потребителски данни.', 'Invalid server or credentials.' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array('Прекалено много неуспешни опити за вход, опитайте пак след %d минута.', 'Прекалено много неуспешни опити за вход, опитайте пак след %d минути.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Прекалено много неуспешни опити за вход, опитайте пак след %d минута.', 'Прекалено много неуспешни опити за вход, опитайте пак след %d минути.'),
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Главната парола вече е невалидна. <a href="https://www.adminer.org/en/extension/"%s>Изберете</a> %s метод, за да я направите постоянна.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Главната парола вече е невалидна. <a href="https://www.adminer.org/en/extension/"%s>Изберете</a> %s метод, за да я направите постоянна.',
'Language' => 'Език', 'Language' => 'Език',
@@ -80,6 +78,7 @@ $translations = array(
'Data' => 'Данни', 'Data' => 'Данни',
'Database' => 'База данни', 'Database' => 'База данни',
'database' => 'база данни',
'Use' => 'Избор', 'Use' => 'Избор',
'Select database' => 'Избор на база данни', 'Select database' => 'Избор на база данни',
'Invalid database.' => 'Невалидна база данни.', 'Invalid database.' => 'Невалидна база данни.',
@@ -194,7 +193,7 @@ $translations = array(
'Alter indexes' => 'Промяна на индекси', 'Alter indexes' => 'Промяна на индекси',
'Add next' => 'Добавяне на следващ', 'Add next' => 'Добавяне на следващ',
'Index Type' => 'Вид на индекса', 'Index Type' => 'Вид на индекса',
'length' => 'дължина', 'Column (length)' => 'Колона (дължина)',
'Foreign keys' => 'Препратки', 'Foreign keys' => 'Препратки',
'Foreign key' => 'Препратка', 'Foreign key' => 'Препратка',
@@ -334,4 +333,26 @@ $translations = array(
'Type has been dropped.' => 'Вида беше пермахнат.', 'Type has been dropped.' => 'Вида беше пермахнат.',
'Type has been created.' => 'Вида беше създаден.', 'Type has been created.' => 'Вида беше създаден.',
'Alter type' => 'Промяна на вид', 'Alter type' => 'Промяна на вид',
'Drop %s?' => null,
'overwrite' => null,
'DB' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Да',
'No' => 'Не',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'লগইন', 'Login' => 'লগইন',
'Logout successful.' => 'সফলভাবে লগআউট হয়েছে।', 'Logout successful.' => 'সফলভাবে লগআউট হয়েছে।',
'Invalid credentials.' => 'ভুল পাসওয়ার্ড।', 'Invalid server or credentials.' => null,
'Server' => 'সার্ভার', 'Server' => 'সার্ভার',
'Username' => 'ইউজারের নাম', 'Username' => 'ইউজারের নাম',
'Password' => 'পাসওয়ার্ড', 'Password' => 'পাসওয়ার্ড',
@@ -33,12 +31,13 @@ $translations = array(
'Create database' => 'ডাটাবেজ তৈরী করুন', 'Create database' => 'ডাটাবেজ তৈরী করুন',
'SQL command' => 'SQL-কমান্ড', 'SQL command' => 'SQL-কমান্ড',
'Logout' => 'লগআউট', 'Logout' => 'লগআউট',
'database' => 'ডাটাবেজ',
'Use' => 'ব্যবহার', 'Use' => 'ব্যবহার',
'No tables.' => 'কোন টেবিল নাই।', 'No tables.' => 'কোন টেবিল নাই।',
'select' => 'নির্বাচন', 'select' => 'নির্বাচন',
'Item has been deleted.' => 'বিষয়বস্তু মুছে ফেলা হয়েছে।', 'Item has been deleted.' => 'বিষয়বস্তু মুছে ফেলা হয়েছে।',
'Item has been updated.' => 'বিষয়বস্তু হালনাগাদ করা হয়েছে।', 'Item has been updated.' => 'বিষয়বস্তু হালনাগাদ করা হয়েছে।',
'Item%s has been inserted.' => 'বিষয়বস্তুসমূহ%s সংযোজন করা হয়েছে।', 'Item%s has been inserted.' => 'বিষয়বস্তুসমূহ সংযোজন করা হয়েছে।',
'Edit' => 'সম্পাদনা', 'Edit' => 'সম্পাদনা',
'Insert' => 'সংযোজন', 'Insert' => 'সংযোজন',
'Save and insert next' => 'সংরক্ষন ও পরবর্তী সংযোজন করুন', 'Save and insert next' => 'সংরক্ষন ও পরবর্তী সংযোজন করুন',
@@ -61,7 +60,7 @@ $translations = array(
'edit' => 'সম্পাদনা', 'edit' => 'সম্পাদনা',
'Page' => 'পৃষ্ঠা', 'Page' => 'পৃষ্ঠা',
'Query executed OK, %d row(s) affected.' => array('কোয়্যারী সম্পাদন হয়েছে, %d সারি প্রভাবিত হয়েছে।', 'কোয়্যারী সম্পাদন হয়েছে, %d সারি প্রভাবিত হয়েছে।'), 'Query executed OK, %d row(s) affected.' => array('কোয়্যারী সম্পাদন হয়েছে, %d সারি প্রভাবিত হয়েছে।', 'কোয়্যারী সম্পাদন হয়েছে, %d সারি প্রভাবিত হয়েছে।'),
'Error in query' => 'অনুসন্ধানে ভুল আছে', 'Error in query' => 'অনুসন্ধানে ভুল আছে',
'Execute' => 'সম্পাদন করো', 'Execute' => 'সম্পাদন করো',
'Table' => 'টেবিল', 'Table' => 'টেবিল',
'Foreign keys' => 'ফরেন কী', 'Foreign keys' => 'ফরেন কী',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'অন ডিলিট', 'ON DELETE' => 'অন ডিলিট',
'ON UPDATE' => 'অন আপডেট', 'ON UPDATE' => 'অন আপডেট',
'Index Type' => 'সূচী-ধরণ', 'Index Type' => 'সূচী-ধরণ',
'length' => 'দৈর্ঘ্য', 'Column (length)' => 'কলাম (দৈর্ঘ্য)',
'View has been dropped.' => 'ভিউ মুছে ফেলা হয়েছে।', 'View has been dropped.' => 'ভিউ মুছে ফেলা হয়েছে।',
'View has been altered.' => 'ভিউ পরিবর্তন করা হয়েছে।', 'View has been altered.' => 'ভিউ পরিবর্তন করা হয়েছে।',
'View has been created.' => 'ভিউ তৈরী করা হয়েছে।', 'View has been created.' => 'ভিউ তৈরী করা হয়েছে।',
@@ -139,7 +138,7 @@ $translations = array(
'Routine' => 'রুটিন', 'Routine' => 'রুটিন',
'Grant' => 'অনুমতি', 'Grant' => 'অনুমতি',
'Revoke' => 'প্রত্যাহার', 'Revoke' => 'প্রত্যাহার',
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'খুব বড় POST ডাটা। ডাটা সংক্ষিপ্ত করো অথবা %s কনফিগারেশন নির্দেশ বৃদ্ধি করো', 'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'খুব বড় POST ডাটা। ডাটা সংক্ষিপ্ত করো অথবা %s কনফিগারেশন নির্দেশ বৃদ্ধি করো',
'Logged as: %s' => '%s হিসাবে লগড', 'Logged as: %s' => '%s হিসাবে লগড',
'Move up' => 'উপরে স্থানান্তর', 'Move up' => 'উপরে স্থানান্তর',
'Move down' => 'নীচে স্থানান্তর', 'Move down' => 'নীচে স্থানান্তর',
@@ -175,7 +174,7 @@ $translations = array(
'Check' => 'পরীক্ষা', 'Check' => 'পরীক্ষা',
'Repair' => 'মেরামত', 'Repair' => 'মেরামত',
'Truncate' => 'ছাঁটাই', 'Truncate' => 'ছাঁটাই',
'Tables have been truncated.' => 'টেবিল ছাঁটাই করা হয়েছে', 'Tables have been truncated.' => 'টেবিল ছাঁটাই করা হয়েছে',
'Rows' => 'সারিসমূহ', 'Rows' => 'সারিসমূহ',
',' => ',', ',' => ',',
'0123456789' => '০১২৩৪৫৬৭৮৯', '0123456789' => '০১২৩৪৫৬৭৮৯',
@@ -186,7 +185,7 @@ $translations = array(
'Save and continue edit' => 'সংরক্ষণ করুন এবং সম্পাদনা চালিয়ে যান', 'Save and continue edit' => 'সংরক্ষণ করুন এবং সম্পাদনা চালিয়ে যান',
'original' => 'প্রকৃত', 'original' => 'প্রকৃত',
'Tables have been dropped.' => 'টেবিলসমূহ মুছে ফেলা হয়েছে।', 'Tables have been dropped.' => 'টেবিলসমূহ মুছে ফেলা হয়েছে।',
'%d item(s) have been affected.' => '%d টি বিষয়বস্তু প্রভাবিত হয়েছে', '%d item(s) have been affected.' => '%d টি বিষয়বস্তু প্রভাবিত হয়েছে',
'Whole result' => 'সম্পূর্ণ ফলাফল', 'Whole result' => 'সম্পূর্ণ ফলাফল',
'Clone' => 'ক্লোন', 'Clone' => 'ক্লোন',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'অনুমোদিত ফিল্ড এর সর্বাধিক সংখ্যা অতিক্রম করে গেছে। অনুগ্রহপূর্বক %s বৃদ্ধি করুন।', 'Maximum number of allowed fields exceeded. Please increase %s.' => 'অনুমোদিত ফিল্ড এর সর্বাধিক সংখ্যা অতিক্রম করে গেছে। অনুগ্রহপূর্বক %s বৃদ্ধি করুন।',
@@ -207,7 +206,7 @@ $translations = array(
'Relations' => 'সম্পর্ক', 'Relations' => 'সম্পর্ক',
'Run file' => 'ফাইল চালাও', 'Run file' => 'ফাইল চালাও',
'Clear' => 'সাফ করো', 'Clear' => 'সাফ করো',
'Maximum allowed file size is %sB.' => 'সর্বাধিক অনুমোদিত ফাইল সাইজ %sB', 'Maximum allowed file size is %sB.' => 'সর্বাধিক অনুমোদিত ফাইল সাইজ %sB.',
'Numbers' => 'সংখ্যা', 'Numbers' => 'সংখ্যা',
'Date and time' => 'তারিখ এবং সময়', 'Date and time' => 'তারিখ এবং সময়',
'Strings' => 'স্ট্রিং', 'Strings' => 'স্ট্রিং',
@@ -253,7 +252,7 @@ $translations = array(
'Geometry' => 'জ্যামিতি', 'Geometry' => 'জ্যামিতি',
'File exists.' => 'ফাইল রয়েছে।', 'File exists.' => 'ফাইল রয়েছে।',
'Attachments' => 'সংযুক্তিগুলো', 'Attachments' => 'সংযুক্তিগুলো',
'%d query(s) executed OK.' => array('SQL-অনুসন্ধান সফলভাবে সম্পন্ন হয়েছে', '%d SQL-অনুসন্ধানসমূহ সফলভাবে সম্পন্ন হয়েছে'), '%d query(s) executed OK.' => array('SQL-অনুসন্ধান সফলভাবে সম্পন্ন হয়েছে', '%d SQL-অনুসন্ধানসমূহ সফলভাবে সম্পন্ন হয়েছে'),
'Show only errors' => 'শুধুমাত্র ত্রুটিগুলো দেখান', 'Show only errors' => 'শুধুমাত্র ত্রুটিগুলো দেখান',
'Refresh' => 'রিফ্রেশ', 'Refresh' => 'রিফ্রেশ',
'Invalid schema.' => 'অবৈধ স্কিমা।', 'Invalid schema.' => 'অবৈধ স্কিমা।',
@@ -265,4 +264,50 @@ $translations = array(
'Permanent link' => 'স্থায়ী লিংক', 'Permanent link' => 'স্থায়ী লিংক',
'Edit all' => 'সবগুলো সম্পাদনা করুন', 'Edit all' => 'সবগুলো সম্পাদনা করুন',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'Ctrl+click on a value to modify it.' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem', 'System' => 'Sistem',
@@ -12,11 +10,11 @@ $translations = array(
'Logout' => 'Odjava', 'Logout' => 'Odjava',
'Logged as: %s' => 'Prijavi se kao: %s', 'Logged as: %s' => 'Prijavi se kao: %s',
'Logout successful.' => 'Uspešna odjava.', 'Logout successful.' => 'Uspešna odjava.',
'Invalid credentials.' => 'Nevažeće dozvole.', 'Invalid server or credentials.' => null,
'Language' => 'Jezik', 'Language' => 'Jezik',
'Invalid CSRF token. Send the form again.' => 'Nevažeći CSRF kod. Proslijedite ponovo formu.', 'Invalid CSRF token. Send the form again.' => 'Nevažeći CSRF kod. Proslijedite ponovo formu.',
'No extension' => 'Bez dodataka', 'No extension' => 'Bez dodataka',
'None of the supported PHP extensions (%s) are available.' => 'Nijedan od podržanih PHP dodataka (%s) nije dostupan.', 'None of the supported PHP extensions (%s) are available.' => 'Nijedan od podržanih PHP dodataka nije dostupan.',
'Session support must be enabled.' => 'Morate omogućiti podršku za sesije.', 'Session support must be enabled.' => 'Morate omogućiti podršku za sesije.',
'Session expired, please login again.' => 'Vaša sesija je istekla, prijavite se ponovo.', 'Session expired, please login again.' => 'Vaša sesija je istekla, prijavite se ponovo.',
'%s version: %s through PHP extension %s' => '%s verzija: %s pomoću PHP dodatka je %s', '%s version: %s through PHP extension %s' => '%s verzija: %s pomoću PHP dodatka je %s',
@@ -75,6 +73,7 @@ $translations = array(
'Data' => 'Podaci', 'Data' => 'Podaci',
'Database' => 'Baza podataka', 'Database' => 'Baza podataka',
'database' => 'baza podataka',
'Use' => 'Koristi', 'Use' => 'Koristi',
'Select database' => 'Izaberite bazu', 'Select database' => 'Izaberite bazu',
'Invalid database.' => 'Neispravna baza podataka.', 'Invalid database.' => 'Neispravna baza podataka.',
@@ -184,7 +183,7 @@ $translations = array(
'Alter indexes' => 'Ažuriraj indekse', 'Alter indexes' => 'Ažuriraj indekse',
'Add next' => 'Dodaj slijedeći', 'Add next' => 'Dodaj slijedeći',
'Index Type' => 'Tip indeksa', 'Index Type' => 'Tip indeksa',
'length' => 'dužina', 'Column (length)' => 'kolumna (dužina)',
'Foreign keys' => 'Strani ključevi', 'Foreign keys' => 'Strani ključevi',
'Foreign key' => 'Strani ključ', 'Foreign key' => 'Strani ključ',
@@ -319,4 +318,41 @@ $translations = array(
'Type has been dropped.' => 'Tip je izbrisan.', 'Type has been dropped.' => 'Tip je izbrisan.',
'Type has been created.' => 'tip je spašen.', 'Type has been created.' => 'tip je spašen.',
'Alter type' => 'Ažuriraj tip', 'Alter type' => 'Ažuriraj tip',
'Drop %s?' => null,
'Materialized view' => null,
'Vacuum' => null,
'overwrite' => null,
'DB' => null,
'File must be in UTF-8 encoding.' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Da',
'No' => 'Ne',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Inicia la sessió', 'Login' => 'Inicia la sessió',
'Logout successful.' => 'Desconnexió correcta.', 'Logout successful.' => 'Desconnexió correcta.',
'Invalid credentials.' => 'Credencials invàlides.', 'Invalid server or credentials.' => null,
'Server' => 'Servidor', 'Server' => 'Servidor',
'Username' => 'Nom d\'usuari', 'Username' => 'Nom d\'usuari',
'Password' => 'Contrasenya', 'Password' => 'Contrasenya',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Crea una base de dades', 'Create database' => 'Crea una base de dades',
'SQL command' => 'Ordre SQL', 'SQL command' => 'Ordre SQL',
'Logout' => 'Desconnecta', 'Logout' => 'Desconnecta',
'database' => 'base de dades',
'Use' => 'Utilitza', 'Use' => 'Utilitza',
'No tables.' => 'No hi ha cap taula.', 'No tables.' => 'No hi ha cap taula.',
'select' => 'registres', 'select' => 'registres',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'Tipus d\'índex', 'Index Type' => 'Tipus d\'índex',
'length' => 'longitud', 'Column (length)' => 'Columna (longitud)',
'View has been dropped.' => 'S\'ha suprimit la vista.', 'View has been dropped.' => 'S\'ha suprimit la vista.',
'View has been altered.' => 'S\'ha modificat la vista.', 'View has been altered.' => 'S\'ha modificat la vista.',
'View has been created.' => 'S\'ha creat la vista.', 'View has been created.' => 'S\'ha creat la vista.',
@@ -266,4 +265,49 @@ $translations = array(
'Permanent link' => 'Enllaç permanent', 'Permanent link' => 'Enllaç permanent',
'Edit all' => 'Edita-ho tot', 'Edit all' => 'Edita-ho tot',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Systém', 'System' => 'Systém',
@@ -13,7 +11,7 @@ $translations = array(
'Logged as: %s' => 'Přihlášen jako: %s', 'Logged as: %s' => 'Přihlášen jako: %s',
'Logout successful.' => 'Odhlášení proběhlo v pořádku.', 'Logout successful.' => 'Odhlášení proběhlo v pořádku.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Díky za použití Admineru, <a href="https://www.adminer.org/cs/donation/">přispějte</a> na vývoj.', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Díky za použití Admineru, <a href="https://www.adminer.org/cs/donation/">přispějte</a> na vývoj.',
'Invalid credentials.' => 'Neplatné přihlašovací údaje.', 'Invalid server or credentials.' => 'Neplatný server nebo přihlašovací údaje.',
'There is a space in the input password which might be the cause.' => 'Problém může být, že je v zadaném hesle mezera.', 'There is a space in the input password which might be the cause.' => 'Problém může být, že je v zadaném hesle mezera.',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer nepodporuje přístup k databázi bez hesla, <a href="https://www.adminer.org/cs/password/"%s>více informací</a>.', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer nepodporuje přístup k databázi bez hesla, <a href="https://www.adminer.org/cs/password/"%s>více informací</a>.',
'Database does not support password.' => 'Databáze nepodporuje heslo.', 'Database does not support password.' => 'Databáze nepodporuje heslo.',
@@ -90,6 +88,7 @@ $translations = array(
'Data' => 'Data', 'Data' => 'Data',
'Database' => 'Databáze', 'Database' => 'Databáze',
'database' => 'databáze',
'DB' => 'DB', 'DB' => 'DB',
'Use' => 'Vybrat', 'Use' => 'Vybrat',
'Select database' => 'Vybrat databázi', 'Select database' => 'Vybrat databázi',
@@ -207,7 +206,7 @@ $translations = array(
'Alter indexes' => 'Pozměnit indexy', 'Alter indexes' => 'Pozměnit indexy',
'Add next' => 'Přidat další', 'Add next' => 'Přidat další',
'Index Type' => 'Typ indexu', 'Index Type' => 'Typ indexu',
'length' => 'délka', 'Column (length)' => 'Sloupec (délka)',
'Foreign keys' => 'Cizí klíče', 'Foreign keys' => 'Cizí klíče',
'Foreign key' => 'Cizí klíč', 'Foreign key' => 'Cizí klíč',
@@ -257,8 +256,8 @@ $translations = array(
'%d row(s)' => array('%d řádek', '%d řádky', '%d řádků'), '%d row(s)' => array('%d řádek', '%d řádky', '%d řádků'),
'Page' => 'Stránka', 'Page' => 'Stránka',
'last' => 'poslední', 'last' => 'poslední',
'Load more data' => 'Načíst další data', 'Load more data' => 'Nahrát další data',
'Loading' => 'Načítá se', 'Loading' => 'Nahrává se',
'Whole result' => 'Celý výsledek', 'Whole result' => 'Celý výsledek',
'%d byte(s)' => array('%d bajt', '%d bajty', '%d bajtů'), '%d byte(s)' => array('%d bajt', '%d bajty', '%d bajtů'),
@@ -348,11 +347,12 @@ $translations = array(
'Type has been created.' => 'Typ byl vytvořen.', 'Type has been created.' => 'Typ byl vytvořen.',
'Alter type' => 'Pozměnit typ', 'Alter type' => 'Pozměnit typ',
// Table check constraints // Plugins
'Checks' => 'Kontroly', 'Columns' => 'Sloupce',
'Create check' => 'Vytvořit kontrolu', 'Nullable' => 'Povoleno null',
'Alter check' => 'Změnit kontrolu', 'Default' => 'Výchozí',
'Check has been created.' => 'Kontrola byla vytvořena.', 'Yes' => 'Ano',
'Check has been altered.' => 'Kontrola byla změněna.', 'No' => 'Ne',
'Check has been dropped.' => 'Kontrola byla odstraněna.', 'One Time Password' => 'Jednorázové heslo',
'Invalid OTP code.' => 'Neplatný kód OTP.',
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'System' => 'System', 'System' => 'System',
'Server' => 'Server', 'Server' => 'Server',
@@ -11,7 +9,7 @@ $translations = array(
'Logout' => 'Log ud', 'Logout' => 'Log ud',
'Logged as: %s' => 'Logget ind som: %s', 'Logged as: %s' => 'Logget ind som: %s',
'Logout successful.' => 'Log af vellykket.', 'Logout successful.' => 'Log af vellykket.',
'Invalid credentials.' => 'Ugyldige log ind oplysninger.', 'Invalid server or credentials.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Master-kodeordet er udløbet. <a href="https://www.adminer.org/en/extension/"%s>Implementer</a> en metode for %s for at gøre det permanent.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Master-kodeordet er udløbet. <a href="https://www.adminer.org/en/extension/"%s>Implementer</a> en metode for %s for at gøre det permanent.',
'Language' => 'Sprog', 'Language' => 'Sprog',
'Invalid CSRF token. Send the form again.' => 'Ugyldigt CSRF-token - Genindsend formen.', 'Invalid CSRF token. Send the form again.' => 'Ugyldigt CSRF-token - Genindsend formen.',
@@ -66,6 +64,7 @@ $translations = array(
'Format' => 'Format', 'Format' => 'Format',
'Data' => 'Data', 'Data' => 'Data',
'Database' => 'Database', 'Database' => 'Database',
'database' => 'database',
'Use' => 'Brug', 'Use' => 'Brug',
'Select database' => 'Vælg database', 'Select database' => 'Vælg database',
'Invalid database.' => 'Ugyldig database.', 'Invalid database.' => 'Ugyldig database.',
@@ -166,7 +165,7 @@ $translations = array(
'Alter indexes' => 'Ændre indekser', 'Alter indexes' => 'Ændre indekser',
'Add next' => 'Læg til næste', 'Add next' => 'Læg til næste',
'Index Type' => 'Indekstype', 'Index Type' => 'Indekstype',
'length' => 'længde', 'Column (length)' => 'Kolonne (længde)',
'Foreign keys' => 'Fremmednøgler', 'Foreign keys' => 'Fremmednøgler',
'Foreign key' => 'Fremmednøgle', 'Foreign key' => 'Fremmednøgle',
'Foreign key has been dropped.' => 'Fremmednøglen er slettet.', 'Foreign key has been dropped.' => 'Fremmednøglen er slettet.',
@@ -280,4 +279,35 @@ $translations = array(
'Type has been created.' => 'Typen er oprettet.', 'Type has been created.' => 'Typen er oprettet.',
'Alter type' => 'Ændre type', 'Alter type' => 'Ændre type',
'Saving' => 'Gemmer', 'Saving' => 'Gemmer',
'Drop %s?' => null,
'Materialized view' => null,
'overwrite' => null,
'DB' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Ja',
'No' => 'Nej',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,11 +1,9 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Login', 'Login' => 'Login',
'Logout successful.' => 'Abmeldung erfolgreich.', 'Logout successful.' => 'Abmeldung erfolgreich.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Danke, dass Sie Adminer genutzt haben. <a href="https://www.adminer.org/de/donation/">Spenden willkommen!</a>.', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Danke, dass Sie Adminer genutzt haben. <a href="https://www.adminer.org/de/donation/">Spenden willkommen!</a>',
'Invalid credentials.' => 'Ungültige Anmelde-Informationen.', 'Invalid server or credentials.' => 'Ungültige Server oder Anmelde-Informationen.',
'Server' => 'Server', 'Server' => 'Server',
'Username' => 'Benutzer', 'Username' => 'Benutzer',
'Password' => 'Passwort', 'Password' => 'Passwort',
@@ -34,7 +32,8 @@ $translations = array(
'Create database' => 'Datenbank erstellen', 'Create database' => 'Datenbank erstellen',
'SQL command' => 'SQL-Kommando', 'SQL command' => 'SQL-Kommando',
'Logout' => 'Abmelden', 'Logout' => 'Abmelden',
'Use' => 'Auswählen', 'database' => 'Datenbank',
'Use' => 'Benutzung',
'No tables.' => 'Keine Tabellen.', 'No tables.' => 'Keine Tabellen.',
'select' => 'zeigen', 'select' => 'zeigen',
'Item has been deleted.' => 'Datensatz wurde gelöscht.', 'Item has been deleted.' => 'Datensatz wurde gelöscht.',
@@ -98,7 +97,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'Index-Typ', 'Index Type' => 'Index-Typ',
'length' => 'Länge', 'Column (length)' => 'Spalte (Länge)',
'View has been dropped.' => 'View wurde entfernt.', 'View has been dropped.' => 'View wurde entfernt.',
'View has been altered.' => 'View wurde geändert.', 'View has been altered.' => 'View wurde geändert.',
'View has been created.' => 'View wurde erstellt.', 'View has been created.' => 'View wurde erstellt.',
@@ -281,25 +280,34 @@ $translations = array(
'If you did not send this request from Adminer then close this page.' => 'Wenn Sie diese Anfrage nicht von Adminer gesendet haben, schließen Sie diese Seite.', 'If you did not send this request from Adminer then close this page.' => 'Wenn Sie diese Anfrage nicht von Adminer gesendet haben, schließen Sie diese Seite.',
'You can upload a big SQL file via FTP and import it from server.' => 'Sie können eine große SQL-Datei per FTP hochladen und dann vom Server importieren.', 'You can upload a big SQL file via FTP and import it from server.' => 'Sie können eine große SQL-Datei per FTP hochladen und dann vom Server importieren.',
'You are offline.' => 'Sie sind offline.', 'You are offline.' => 'Sie sind offline.',
'You have no privileges to update this table.' => 'Sie haben keine Rechte, diese Tabelle zu aktualisieren.', 'You have no privileges to update this table.' => 'Sie haben keine Rechte, um diese Tabelle zu aktualisieren.',
'Saving' => 'Speichere', 'Saving' => 'Speichere',
'yes' => 'ja', 'yes' => 'ja',
'no' => 'nein', 'no' => 'nein',
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Das Master-Passwort ist abgelaufen. <a href="https://www.adminer.org/de/extension/"%s>Implementieren</a> Sie die %s Methode, um es permanent zu machen.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Das Master-Passwort ist abgelaufen. <a href="https://www.adminer.org/de/extension/"%s>Implementieren</a> Sie die %s Methode, um es permanent zu machen.',
'%d / ' => '%d / ', '%d / ' => '%d / ',
'Drop %s?' => '%s entfernen?',
'Materialized view' => 'Strukturierte Ansicht', 'Drop %s?' => null,
'Vacuum' => 'Vacuum', 'Materialized view' => null,
'overwrite' => 'überschreiben', 'Vacuum' => null,
'DB' => 'DB', 'overwrite' => null,
'ATTACH queries are not supported.' => 'ATTACH Abfragen werden nicht unterstützt.', 'DB' => null,
'Warnings' => 'Warnungen', 'ATTACH queries are not supported.' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer unterstützt den Zugriff auf eine Datenbank ohne Passwort nicht, <a href="https://www.adminer.org/en/password/"%s>mehr Informationen</a>.', 'Warnings' => null,
'Full table scan' => 'Vollständige Überprüfung der Tabelle', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'The action will be performed after successful login with the same credentials.' => 'Die Aktion wird nach erfolgreicher Anmeldung mit denselben Anmeldedaten ausgeführt.', 'Full table scan' => null,
'Connecting to privileged ports is not allowed.' => 'Die Verbindung zu privilegierten Ports ist nicht erlaubt.', 'The action will be performed after successful login with the same credentials.' => null,
'There is a space in the input password which might be the cause.' => 'Es gibt ein Leerzeichen im Eingabepasswort, das die Ursache sein könnte.', 'Connecting to privileged ports is not allowed.' => null,
'Unknown error.' => 'Unbekannter Fehler.', 'There is a space in the input password which might be the cause.' => null,
'Database does not support password.' => 'Die Datenbank unterstützt kein Passwort.', 'Unknown error.' => null,
'Disable %s or enable %s or %s extensions.' => 'Deaktivieren Sie %s oder aktivieren Sie die Erweiterungen %s oder %s.', 'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Ja',
'No' => 'Nein',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Σύστημα', 'System' => 'Σύστημα',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'Αποσύνδεση', 'Logout' => 'Αποσύνδεση',
'Logged as: %s' => 'Συνδεθήκατε ως %s', 'Logged as: %s' => 'Συνδεθήκατε ως %s',
'Logout successful.' => 'Αποσυνδεθήκατε με επιτυχία.', 'Logout successful.' => 'Αποσυνδεθήκατε με επιτυχία.',
'Invalid credentials.' => 'Εσφαλμένα Διαπιστευτήρια.', 'Invalid server or credentials.' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array('Επανειλημμένες ανεπιτυχείς προσπάθειες σύνδεσης, δοκιμάστε ξανά σε %s λεπτό.', 'Επανειλημμένες ανεπιτυχείς προσπάθειες σύνδεσης, δοκιμάστε ξανά σε %s λεπτά.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Επανειλημμένες ανεπιτυχείς προσπάθειες σύνδεσης, δοκιμάστε ξανά σε %s λεπτό.', 'Επανειλημμένες ανεπιτυχείς προσπάθειες σύνδεσης, δοκιμάστε ξανά σε %s λεπτά.'),
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Έληξε ο Κύριος Κωδικός. <a href="https://www.adminer.org/en/extension/"%s>Ενεργοποιήστε</a> τη μέθοδο %s για να τον κάνετε μόνιμο.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Έληξε ο Κύριος Κωδικός. <a href="https://www.adminer.org/en/extension/"%s>Ενεργοποιήστε</a> τη μέθοδο %s για να τον κάνετε μόνιμο.',
'Language' => 'Γλώσσα', 'Language' => 'Γλώσσα',
@@ -81,6 +79,7 @@ $translations = array(
'Data' => 'Δεδομένα', 'Data' => 'Δεδομένα',
'Database' => 'Β. Δεδομένων', 'Database' => 'Β. Δεδομένων',
'database' => 'β. δεδομένων',
'Use' => 'χρήση', 'Use' => 'χρήση',
'Select database' => 'Επιλέξτε Β.Δ.', 'Select database' => 'Επιλέξτε Β.Δ.',
'Invalid database.' => 'Λανθασμένη Β.Δ.', 'Invalid database.' => 'Λανθασμένη Β.Δ.',
@@ -195,7 +194,7 @@ $translations = array(
'Alter indexes' => 'Τροποποίηση δεικτών', 'Alter indexes' => 'Τροποποίηση δεικτών',
'Add next' => 'Προσθήκη επόμενου', 'Add next' => 'Προσθήκη επόμενου',
'Index Type' => 'Τύπος δείκτη', 'Index Type' => 'Τύπος δείκτη',
'length' => 'μήκος', 'Column (length)' => 'Στήλη (μήκος)',
'Foreign keys' => 'Εξαρτημένα κλειδιά', 'Foreign keys' => 'Εξαρτημένα κλειδιά',
'Foreign key' => 'Εξαρτημένο κλειδί', 'Foreign key' => 'Εξαρτημένο κλειδί',
@@ -334,4 +333,26 @@ $translations = array(
'Type has been dropped.' => 'Ο τύπος διαγράφηκε.', 'Type has been dropped.' => 'Ο τύπος διαγράφηκε.',
'Type has been created.' => 'Ο τύπος δημιουργήθηκε.', 'Type has been created.' => 'Ο τύπος δημιουργήθηκε.',
'Alter type' => 'Τροποποίηση τύπου', 'Alter type' => 'Τροποποίηση τύπου',
'Drop %s?' => null,
'overwrite' => null,
'DB' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Too many unsuccessful logins, try again in %d minute(s).' => array('Too many unsuccessful logins, try again in %d minute.', 'Too many unsuccessful logins, try again in %d minutes.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Too many unsuccessful logins, try again in %d minute.', 'Too many unsuccessful logins, try again in %d minutes.'),
'Query executed OK, %d row(s) affected.' => array('Query executed OK, %d row affected.', 'Query executed OK, %d rows affected.'), 'Query executed OK, %d row(s) affected.' => array('Query executed OK, %d row affected.', 'Query executed OK, %d rows affected.'),

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Login', 'Login' => 'Login',
'Logout successful.' => 'Sesión finalizada con éxito.', 'Logout successful.' => 'Sesión finalizada con éxito.',
'Invalid credentials.' => 'Usuario y/o clave de acceso incorrecta.', 'Invalid server or credentials.' => null,
'Server' => 'Servidor', 'Server' => 'Servidor',
'Username' => 'Usuario', 'Username' => 'Usuario',
'Password' => 'Contraseña', 'Password' => 'Contraseña',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Crear Base de datos', 'Create database' => 'Crear Base de datos',
'SQL command' => 'Comando SQL', 'SQL command' => 'Comando SQL',
'Logout' => 'Cerrar sesión', 'Logout' => 'Cerrar sesión',
'database' => 'base de datos',
'Use' => 'Usar', 'Use' => 'Usar',
'No tables.' => 'No existen tablas.', 'No tables.' => 'No existen tablas.',
'select' => 'registros', 'select' => 'registros',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'AL BORRAR', 'ON DELETE' => 'AL BORRAR',
'ON UPDATE' => 'AL ACTUALIZAR', 'ON UPDATE' => 'AL ACTUALIZAR',
'Index Type' => 'Tipo de índice', 'Index Type' => 'Tipo de índice',
'length' => 'longitud', 'Column (length)' => 'Columna (longitud)',
'View has been dropped.' => 'Vista eliminada.', 'View has been dropped.' => 'Vista eliminada.',
'View has been altered.' => 'Vista modificada.', 'View has been altered.' => 'Vista modificada.',
'View has been created.' => 'Vista creada.', 'View has been created.' => 'Vista creada.',
@@ -266,4 +265,49 @@ $translations = array(
'Permanent link' => 'Enlace permanente', 'Permanent link' => 'Enlace permanente',
'Edit all' => 'Editar todos', 'Edit all' => 'Editar todos',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Logi sisse', 'Login' => 'Logi sisse',
'Logout successful.' => 'Väljalogimine õnnestus.', 'Logout successful.' => 'Väljalogimine õnnestus.',
'Invalid credentials.' => 'Ebakorrektsed andmed.', 'Invalid server or credentials.' => null,
'Server' => 'Server', 'Server' => 'Server',
'Username' => 'Kasutajanimi', 'Username' => 'Kasutajanimi',
'Password' => 'Parool', 'Password' => 'Parool',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Loo uus andmebaas', 'Create database' => 'Loo uus andmebaas',
'SQL command' => 'SQL-Päring', 'SQL command' => 'SQL-Päring',
'Logout' => 'Logi välja', 'Logout' => 'Logi välja',
'database' => 'andmebaas',
'Use' => 'Kasuta', 'Use' => 'Kasuta',
'No tables.' => 'Tabeleid ei leitud.', 'No tables.' => 'Tabeleid ei leitud.',
'select' => 'kuva', 'select' => 'kuva',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'Indeksi tüüp', 'Index Type' => 'Indeksi tüüp',
'length' => 'pikkus', 'Column (length)' => 'Veerg (pikkus)',
'View has been dropped.' => 'Vaade (VIEW) on edukalt kustutatud.', 'View has been dropped.' => 'Vaade (VIEW) on edukalt kustutatud.',
'View has been altered.' => 'Vaade (VIEW) on edukalt muudetud.', 'View has been altered.' => 'Vaade (VIEW) on edukalt muudetud.',
'View has been created.' => 'Vaade (VIEW) on edukalt loodud.', 'View has been created.' => 'Vaade (VIEW) on edukalt loodud.',
@@ -266,4 +265,49 @@ $translations = array(
'Permanent link' => 'Püsilink', 'Permanent link' => 'Püsilink',
'Edit all' => 'Muuda kõiki', 'Edit all' => 'Muuda kõiki',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'سیستم', 'System' => 'سیستم',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'خروج', 'Logout' => 'خروج',
'Logged as: %s' => 'ورود به عنوان: %s', 'Logged as: %s' => 'ورود به عنوان: %s',
'Logout successful.' => 'با موفقیت خارج شدید.', 'Logout successful.' => 'با موفقیت خارج شدید.',
'Invalid credentials.' => 'اعتبار سنجی نامعتبر.', 'Invalid server or credentials.' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array('ورودهای ناموفق بیش از حد، %d دقیقه دیگر تلاش نمایید.', 'ورودهای ناموفق بیش از حد، %d دقیقه دیگر تلاش نمایید.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('ورودهای ناموفق بیش از حد، %d دقیقه دیگر تلاش نمایید.', 'ورودهای ناموفق بیش از حد، %d دقیقه دیگر تلاش نمایید.'),
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'رمز اصلی باطل شده است. روش %s را <a href="https://www.adminer.org/en/extension/"%s>پیاده سازی</a> کرده تا آن را دائمی سازید.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'رمز اصلی باطل شده است. روش %s را <a href="https://www.adminer.org/en/extension/"%s>پیاده سازی</a> کرده تا آن را دائمی سازید.',
'Language' => 'زبان', 'Language' => 'زبان',
@@ -79,6 +77,7 @@ $translations = array(
'Data' => 'داده', 'Data' => 'داده',
'Database' => 'پایگاه داده', 'Database' => 'پایگاه داده',
'database' => 'پایگاه داده',
'Use' => 'استفاده', 'Use' => 'استفاده',
'Select database' => 'انتخاب پایگاه داده', 'Select database' => 'انتخاب پایگاه داده',
'Invalid database.' => 'پایگاه داده نامعتبر.', 'Invalid database.' => 'پایگاه داده نامعتبر.',
@@ -146,7 +145,7 @@ $translations = array(
'Tables' => 'جدولها', 'Tables' => 'جدولها',
'Tables and views' => 'جدولها و نمایه ها', 'Tables and views' => 'جدولها و نمایه ها',
'Table' => 'جدول', 'Table' => 'جدول',
'No tables.' => 'جدولی وجود ندارد.', 'No tables.' => 'جدولی وجود ندارد',
'Alter table' => 'ویرایش جدول', 'Alter table' => 'ویرایش جدول',
'Create table' => 'ایجاد جدول', 'Create table' => 'ایجاد جدول',
'Table has been dropped.' => 'جدول حذف شد.', 'Table has been dropped.' => 'جدول حذف شد.',
@@ -193,7 +192,7 @@ $translations = array(
'Alter indexes' => 'ویرایش ایندکسها', 'Alter indexes' => 'ویرایش ایندکسها',
'Add next' => 'افرودن بعدی', 'Add next' => 'افرودن بعدی',
'Index Type' => 'نوع ایندکس', 'Index Type' => 'نوع ایندکس',
'length' => 'طول', 'Column (length)' => 'ستون (طول)',
'Foreign keys' => 'کلیدهای خارجی', 'Foreign keys' => 'کلیدهای خارجی',
'Foreign key' => 'کلید خارجی', 'Foreign key' => 'کلید خارجی',
@@ -238,7 +237,7 @@ $translations = array(
'Action' => 'عملیات', 'Action' => 'عملیات',
'Full table scan' => 'اسکن کامل جدول', 'Full table scan' => 'اسکن کامل جدول',
'Unable to select the table' => 'قادر به انتخاب جدول نیستید', 'Unable to select the table' => 'قادر به انتخاب جدول نیستید',
'No rows.' => 'سطری وجود ندارد.', 'No rows.' => 'سطری وجود ندارد',
'%d / ' => '%d / ', '%d / ' => '%d / ',
'%d row(s)' => array('%d سطر', '%d سطر'), '%d row(s)' => array('%d سطر', '%d سطر'),
'Page' => 'صفحه', 'Page' => 'صفحه',
@@ -332,4 +331,28 @@ $translations = array(
'Type has been dropped.' => 'نوع حذف شد.', 'Type has been dropped.' => 'نوع حذف شد.',
'Type has been created.' => 'نوع ایجاد شد.', 'Type has been created.' => 'نوع ایجاد شد.',
'Alter type' => 'ویرایش نوع', 'Alter type' => 'ویرایش نوع',
'Drop %s?' => null,
'overwrite' => null,
'DB' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Järjestelmä', 'System' => 'Järjestelmä',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'Kirjaudu ulos', 'Logout' => 'Kirjaudu ulos',
'Logged as: %s' => 'Olet kirjautunut käyttäjänä: %s', 'Logged as: %s' => 'Olet kirjautunut käyttäjänä: %s',
'Logout successful.' => 'Uloskirjautuminen onnistui.', 'Logout successful.' => 'Uloskirjautuminen onnistui.',
'Invalid credentials.' => 'Virheelliset kirjautumistiedot.', 'Invalid server or credentials.' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array('Liian monta epäonnistunutta sisäänkirjautumisyritystä, kokeile uudestaan %d minuutin kuluttua.', 'Liian monta epäonnistunutta sisäänkirjautumisyritystä, kokeile uudestaan %d minuutin kuluttua.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Liian monta epäonnistunutta sisäänkirjautumisyritystä, kokeile uudestaan %d minuutin kuluttua.', 'Liian monta epäonnistunutta sisäänkirjautumisyritystä, kokeile uudestaan %d minuutin kuluttua.'),
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Master-salasana ei ole enää voimassa. <a href="https://www.adminer.org/en/extension/"%s>Toteuta</a> %s-metodi sen tekemiseksi pysyväksi.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Master-salasana ei ole enää voimassa. <a href="https://www.adminer.org/en/extension/"%s>Toteuta</a> %s-metodi sen tekemiseksi pysyväksi.',
'Language' => 'Kieli', 'Language' => 'Kieli',
@@ -81,6 +79,7 @@ $translations = array(
'Data' => 'Data', 'Data' => 'Data',
'Database' => 'Tietokanta', 'Database' => 'Tietokanta',
'database' => 'tietokanta',
'Use' => 'Käytä', 'Use' => 'Käytä',
'Select database' => 'Valitse tietokanta', 'Select database' => 'Valitse tietokanta',
'Invalid database.' => 'Tietokanta ei kelpaa.', 'Invalid database.' => 'Tietokanta ei kelpaa.',
@@ -195,7 +194,7 @@ $translations = array(
'Alter indexes' => 'Muuta indeksejä', 'Alter indexes' => 'Muuta indeksejä',
'Add next' => 'Lisää seuraava', 'Add next' => 'Lisää seuraava',
'Index Type' => 'Indeksityyppi', 'Index Type' => 'Indeksityyppi',
'length' => 'pituus', 'Column (length)' => 'Sarake (pituus)',
'Foreign keys' => 'Vieraat avaimet', 'Foreign keys' => 'Vieraat avaimet',
'Foreign key' => 'Vieras avain', 'Foreign key' => 'Vieras avain',
@@ -348,4 +347,12 @@ $translations = array(
'Unknown error.' => 'Tuntematon virhe.', 'Unknown error.' => 'Tuntematon virhe.',
'Database does not support password.' => 'Tietokanta ei tue salasanaa.', 'Database does not support password.' => 'Tietokanta ei tue salasanaa.',
'Disable %s or enable %s or %s extensions.' => 'Poista käytöstä %s tai ota käyttöön laajennus %s tai %s.', 'Disable %s or enable %s or %s extensions.' => 'Poista käytöstä %s tai ota käyttöön laajennus %s tai %s.',
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Kyllä',
'No' => 'Ei',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Authentification', 'Login' => 'Authentification',
'Logout successful.' => 'Au revoir !', 'Logout successful.' => 'Au revoir !',
'Invalid credentials.' => 'Authentification échouée.', 'Invalid server or credentials.' => null,
'Server' => 'Serveur', 'Server' => 'Serveur',
'Username' => 'Utilisateur', 'Username' => 'Utilisateur',
'Password' => 'Mot de passe', 'Password' => 'Mot de passe',
@@ -32,6 +30,7 @@ $translations = array(
'Create database' => 'Créer une base de données', 'Create database' => 'Créer une base de données',
'SQL command' => 'Requête SQL', 'SQL command' => 'Requête SQL',
'Logout' => 'Déconnexion', 'Logout' => 'Déconnexion',
'database' => 'base de données',
'Use' => 'Utiliser', 'Use' => 'Utiliser',
'No tables.' => 'Aucune table.', 'No tables.' => 'Aucune table.',
'select' => 'select', 'select' => 'select',
@@ -95,7 +94,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'Type d\'index', 'Index Type' => 'Type d\'index',
'length' => 'longueur', 'Column (length)' => 'Colonne (longueur)',
'View has been dropped.' => 'La vue a été effacée.', 'View has been dropped.' => 'La vue a été effacée.',
'View has been altered.' => 'La vue a été modifiée.', 'View has been altered.' => 'La vue a été modifiée.',
'View has been created.' => 'La vue a été créée.', 'View has been created.' => 'La vue a été créée.',
@@ -289,16 +288,26 @@ $translations = array(
'Default value' => 'Valeur par défaut', 'Default value' => 'Valeur par défaut',
'If you did not send this request from Adminer then close this page.' => 'Si vous n\'avez pas envoyé cette requête depuis Adminer, alors fermez cette page.', 'If you did not send this request from Adminer then close this page.' => 'Si vous n\'avez pas envoyé cette requête depuis Adminer, alors fermez cette page.',
'You are offline.' => 'Vous êtes hors ligne.', 'You are offline.' => 'Vous êtes hors ligne.',
'Drop %s?' => 'Supprimer %s?', 'Drop %s?' => 'Supprimer %s?',
'overwrite' => 'écraser', 'overwrite' => 'écraser',
'DB' => 'BD', 'DB' => 'BD',
'ATTACH queries are not supported.' => 'Requêtes ATTACH ne sont pas supportées.', 'ATTACH queries are not supported.' => 'Requêtes ATTACH ne sont pas supportées.',
'Warnings' => 'Avertissements', 'Warnings' => 'Avertissements',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer ne supporte pas l\'accès aux bases de données sans mot de passe, <a href="https://www.adminer.org/en/password/"%s>plus d\'information</a>.', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer ne supporte pas l\'accès aux bases de données sans mot de passe, <a href="https://www.adminer.org/en/password/"%s>plus d\'information</a>.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'The action will be performed after successful login with the same credentials.' => 'Cette action sera exécutée après s\'être connecté avec les mêmes données de connexion.', 'The action will be performed after successful login with the same credentials.' => 'Cette action sera exécutée après s\'être connecté avec les mêmes données de connexion.',
'Connecting to privileged ports is not allowed.' => 'La connexion aux ports privilégiés n\'est pas autorisée.', 'Connecting to privileged ports is not allowed.' => 'La connexion aux ports privilégiés n\'est pas autorisée.',
'There is a space in the input password which might be the cause.' => 'Il y a un espace dans le mot de passe entré qui pourrait en être la cause.', 'There is a space in the input password which might be the cause.' => 'Il y a un espace dans le mot de passe entré qui pourrait en être la cause.',
'Unknown error.' => 'Erreur inconnue.', 'Unknown error.' => 'Erreur inconnue',
'Database does not support password.' => 'La base de données ne support pas les mots de passe.', 'Database does not support password.' => 'La base de données ne support pas les mots de passe',
'Disable %s or enable %s or %s extensions.' => 'Désactiver %s ou activer %s or %s extensions.', 'Disable %s or enable %s or %s extensions.' => 'Désactiver %s ou activer %s or %s extensions.',
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Oui',
'No' => 'Non',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Conectar', 'Login' => 'Conectar',
'Logout successful.' => 'Pechouse a sesión con éxito.', 'Logout successful.' => 'Pechouse a sesión con éxito.',
'Invalid credentials.' => 'Credenciais (usuario e/ou contrasinal) inválidos.', 'Invalid server or credentials.' => null,
'Server' => 'Servidor', 'Server' => 'Servidor',
'Username' => 'Usuario', 'Username' => 'Usuario',
'Password' => 'Contrasinal', 'Password' => 'Contrasinal',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Crear Base de datos', 'Create database' => 'Crear Base de datos',
'SQL command' => 'Comando SQL', 'SQL command' => 'Comando SQL',
'Logout' => 'Pechar sesión', 'Logout' => 'Pechar sesión',
'database' => 'base de datos',
'Use' => 'Usar', 'Use' => 'Usar',
'No tables.' => 'Nengunha táboa.', 'No tables.' => 'Nengunha táboa.',
'select' => 'selecciona', 'select' => 'selecciona',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'AO BORRAR (ON DELETE)', 'ON DELETE' => 'AO BORRAR (ON DELETE)',
'ON UPDATE' => 'AO ACTUALIZAR (ON UPDATE)', 'ON UPDATE' => 'AO ACTUALIZAR (ON UPDATE)',
'Index Type' => 'Tipo de índice', 'Index Type' => 'Tipo de índice',
'length' => 'lonxitude', 'Column (length)' => 'Columna (lonxitude)',
'View has been dropped.' => 'Eliminouse a vista.', 'View has been dropped.' => 'Eliminouse a vista.',
'View has been altered.' => 'Modificouse a vista.', 'View has been altered.' => 'Modificouse a vista.',
'View has been created.' => 'Creouse a vista.', 'View has been created.' => 'Creouse a vista.',
@@ -266,11 +265,11 @@ $translations = array(
'Permanent link' => 'Ligazón permanente', 'Permanent link' => 'Ligazón permanente',
'Edit all' => 'Editar todo', 'Edit all' => 'Editar todo',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Tables have been optimized.' => 'Optimizáronse as táboas.', 'Tables have been optimized.' => 'Optimizáronse as táboas',
'Materialized view' => 'Vista materializada', 'Materialized view' => 'Vista materializada',
'Vacuum' => 'Baleirar', 'Vacuum' => 'Baleirar',
'Selected' => 'Selección', 'Selected' => 'Selección',
'File must be in UTF-8 encoding.' => 'O ficheiro ten que estar codificado con UTF-8.', 'File must be in UTF-8 encoding.' => 'O ficheiro ten que estar codificado con UTF-8',
'Modify' => 'Modificar', 'Modify' => 'Modificar',
'Loading' => 'Cargando', 'Loading' => 'Cargando',
'Load more data' => 'Cargar máis datos', 'Load more data' => 'Cargar máis datos',
@@ -278,15 +277,37 @@ $translations = array(
'Limit rows' => 'Limitar filas', 'Limit rows' => 'Limitar filas',
'Default value' => 'Valor por defecto', 'Default value' => 'Valor por defecto',
'Full table scan' => 'Escaneo completo da táboa', 'Full table scan' => 'Escaneo completo da táboa',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Demasiados intentos de conexión, intentao de novo en %d minuto.', 'Demasiados intentos de conexión, intentao de novo en %d minutos.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Demasiados intentos de conexión, intentao de novo en %d minuto', 'Demasiados intentos de conexión, intentao de novo en %d minutos'),
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'O contrasinal principal caducou. <a href="https://www.adminer.org/en/extension/"%s>Implementa</a> o método %s para facelo permanente.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'O contrasinal principal caducou. <a href="https://www.adminer.org/en/extension/"%s>Implementa</a> o método %s para facelo permanente.',
'If you did not send this request from Adminer then close this page.' => 'Se non enviaches esta petición dende o Adminer entón pecha esta páxina.', 'If you did not send this request from Adminer then close this page.' => 'Se non enviaches esta petición dende o Adminer entón pecha esta páxina',
'You can upload a big SQL file via FTP and import it from server.' => 'Podes subir un ficheiro SQL de gran tamaño vía FTP e importalo dende o servidor.', 'You can upload a big SQL file via FTP and import it from server.' => 'Podes subir un ficheiro SQL de gran tamaño vía FTP e importalo dende o servidor',
'Size' => 'Tamaño', 'Size' => 'Tamaño',
'Compute' => 'Calcular', 'Compute' => 'Calcular',
'You are offline.' => 'Non tes conexión.', 'You are offline.' => 'Non tes conexión',
'You have no privileges to update this table.' => 'Non tes privilexios para actualizar esta táboa.', 'You have no privileges to update this table.' => 'Non tes privilexios para actualizar esta táboa',
'Saving' => 'Gardando', 'Saving' => 'Gardando',
'yes' => 'si', 'yes' => 'si',
'no' => 'non', 'no' => 'non',
'Drop %s?' => null,
'overwrite' => null,
'DB' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Si',
'No' => 'Non',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'התחברות', 'Login' => 'התחברות',
'Logout successful.' => 'ההתחברות הצליחה', 'Logout successful.' => 'ההתחברות הצליחה',
'Invalid credentials.' => 'פרטי התחברות שגויים', 'Invalid server or credentials.' => null,
'Server' => 'שרת', 'Server' => 'שרת',
'Username' => 'שם משתמש', 'Username' => 'שם משתמש',
'Password' => 'סיסמה', 'Password' => 'סיסמה',
@@ -32,6 +30,7 @@ $translations = array(
'Create database' => 'צור מסד נתונים', 'Create database' => 'צור מסד נתונים',
'SQL command' => 'שאילתת SQL', 'SQL command' => 'שאילתת SQL',
'Logout' => 'התנתק', 'Logout' => 'התנתק',
'database' => 'מסד נתונים',
'Use' => 'השתמש', 'Use' => 'השתמש',
'No tables.' => 'אין טבלאות', 'No tables.' => 'אין טבלאות',
'select' => 'בחר', 'select' => 'בחר',
@@ -95,7 +94,7 @@ $translations = array(
'ON DELETE' => 'בעת מחיקה', 'ON DELETE' => 'בעת מחיקה',
'ON UPDATE' => 'בעת עידכון', 'ON UPDATE' => 'בעת עידכון',
'Index Type' => 'סוג אינדקס', 'Index Type' => 'סוג אינדקס',
'length' => 'אורך', 'Column (length)' => 'עמודה (אורך)',
'View has been dropped.' => 'התצוגה הושלכה', 'View has been dropped.' => 'התצוגה הושלכה',
'View has been altered.' => 'התצוגה שונתה', 'View has been altered.' => 'התצוגה שונתה',
'View has been created.' => 'התצוגה נוצרה', 'View has been created.' => 'התצוגה נוצרה',
@@ -280,7 +279,7 @@ $translations = array(
'Default value' => 'ערך ברירת מחדל', 'Default value' => 'ערך ברירת מחדל',
'Full table scan' => 'סריקה טבלה מלאה', 'Full table scan' => 'סריקה טבלה מלאה',
'Too many unsuccessful logins, try again in %d minute(s).' => 'יותר מידי נסיונות כניסה נכשלו, אנא נסה עוד %d דקות', 'Too many unsuccessful logins, try again in %d minute(s).' => 'יותר מידי נסיונות כניסה נכשלו, אנא נסה עוד %d דקות',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'תודה שהשתמש ב-adminer אנא שקול <a href="https://www.adminer.org/en/donation/">לתרום</a>', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'תודה שהשתמש ב-adminer אנא שקול <a href="https://www.adminer.org/en/donation/">לתרום</a>.',
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'סיסמת המאסטר פגה <a href="https://www.adminer.org/en/extension/"%s>התקן תוסף</a> על מנת להפוך את זה לתמידי', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'סיסמת המאסטר פגה <a href="https://www.adminer.org/en/extension/"%s>התקן תוסף</a> על מנת להפוך את זה לתמידי',
'If you did not send this request from Adminer then close this page.' => 'אם לא אתה שלחת בקשה ל-Adminer הינך יכול לסגור חלון זה', 'If you did not send this request from Adminer then close this page.' => 'אם לא אתה שלחת בקשה ל-Adminer הינך יכול לסגור חלון זה',
'You can upload a big SQL file via FTP and import it from server.' => 'ניתן לעלות קבצים ב-FTP ואז למשוך אותם מהשרת', 'You can upload a big SQL file via FTP and import it from server.' => 'ניתן לעלות קבצים ב-FTP ואז למשוך אותם מהשרת',
@@ -291,4 +290,24 @@ $translations = array(
'Saving' => 'שומר', 'Saving' => 'שומר',
'yes' => 'כן', 'yes' => 'כן',
'no' => 'לא', 'no' => 'לא',
'Drop %s?' => null,
'overwrite' => null,
'DB' => null,
'Warnings' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Belépés', 'Login' => 'Belépés',
'Logout successful.' => 'Sikeres kilépés.', 'Logout successful.' => 'Sikeres kilépés.',
'Invalid credentials.' => 'Érvénytelen adatok.', 'Invalid server or credentials.' => null,
'Server' => 'Szerver', 'Server' => 'Szerver',
'Username' => 'Felhasználó', 'Username' => 'Felhasználó',
'Password' => 'Jelszó', 'Password' => 'Jelszó',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Adatbázis létrehozása', 'Create database' => 'Adatbázis létrehozása',
'SQL command' => 'SQL parancs', 'SQL command' => 'SQL parancs',
'Logout' => 'Kilépés', 'Logout' => 'Kilépés',
'database' => 'adatbázis',
'Use' => 'Használ', 'Use' => 'Használ',
'No tables.' => 'Nincs tábla.', 'No tables.' => 'Nincs tábla.',
'select' => 'kiválasztás', 'select' => 'kiválasztás',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'törléskor', 'ON DELETE' => 'törléskor',
'ON UPDATE' => 'frissítéskor', 'ON UPDATE' => 'frissítéskor',
'Index Type' => 'Index típusa', 'Index Type' => 'Index típusa',
'length' => 'méret', 'Column (length)' => 'Oszop (méret)',
'View has been dropped.' => 'A nézet eldobva.', 'View has been dropped.' => 'A nézet eldobva.',
'View has been altered.' => 'A nézet módosult.', 'View has been altered.' => 'A nézet módosult.',
'View has been created.' => 'A nézet létrejött.', 'View has been created.' => 'A nézet létrejött.',
@@ -265,4 +264,50 @@ $translations = array(
'Permanent link' => 'Hivatkozás', 'Permanent link' => 'Hivatkozás',
'Edit all' => 'Összes szerkesztése', 'Edit all' => 'Összes szerkesztése',
'HH:MM:SS' => 'óó:pp:mm', 'HH:MM:SS' => 'óó:pp:mm',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'Ctrl+click on a value to modify it.' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem', 'System' => 'Sistem',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'Keluar', 'Logout' => 'Keluar',
'Logged as: %s' => 'Masuk sebagai: %s', 'Logged as: %s' => 'Masuk sebagai: %s',
'Logout successful.' => 'Berhasil keluar.', 'Logout successful.' => 'Berhasil keluar.',
'Invalid credentials.' => 'Akses tidak sah.', 'Invalid server or credentials.' => null,
'Language' => 'Bahasa', 'Language' => 'Bahasa',
'Invalid CSRF token. Send the form again.' => 'Token CSRF tidak sah. Kirim ulang formulir.', 'Invalid CSRF token. Send the form again.' => 'Token CSRF tidak sah. Kirim ulang formulir.',
'No extension' => 'Ekstensi tidak ada', 'No extension' => 'Ekstensi tidak ada',
@@ -75,6 +73,7 @@ $translations = array(
'Data' => 'Data', 'Data' => 'Data',
'Database' => 'Basis data', 'Database' => 'Basis data',
'database' => 'basis data',
'Use' => 'Gunakan', 'Use' => 'Gunakan',
'Select database' => 'Pilih basis data', 'Select database' => 'Pilih basis data',
'Invalid database.' => 'Basis data tidak sah.', 'Invalid database.' => 'Basis data tidak sah.',
@@ -184,7 +183,7 @@ $translations = array(
'Alter indexes' => 'Ubah indeks', 'Alter indexes' => 'Ubah indeks',
'Add next' => 'Tambah setelahnya', 'Add next' => 'Tambah setelahnya',
'Index Type' => 'Jenis Indeks', 'Index Type' => 'Jenis Indeks',
'length' => 'panjang', 'Column (length)' => 'Kolom (panjang)',
'Foreign keys' => 'Kunci asing', 'Foreign keys' => 'Kunci asing',
'Foreign key' => 'Kunci asing', 'Foreign key' => 'Kunci asing',
@@ -314,4 +313,46 @@ $translations = array(
'Type has been dropped.' => 'Jenis berhasil dihapus.', 'Type has been dropped.' => 'Jenis berhasil dihapus.',
'Type has been created.' => 'Jenis berhasil dibuat.', 'Type has been created.' => 'Jenis berhasil dibuat.',
'Alter type' => 'Ubah jenis', 'Alter type' => 'Ubah jenis',
'Drop %s?' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'Ctrl+click on a value to modify it.' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Autenticazione', 'Login' => 'Autenticazione',
'Logout successful.' => 'Uscita effettuata con successo.', 'Logout successful.' => 'Uscita effettuata con successo.',
'Invalid credentials.' => 'Credenziali non valide.', 'Invalid server or credentials.' => 'Server o credenziali non valide.',
'Server' => 'Server', 'Server' => 'Server',
'Username' => 'Utente', 'Username' => 'Utente',
'Password' => 'Password', 'Password' => 'Password',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Crea database', 'Create database' => 'Crea database',
'SQL command' => 'Comando SQL', 'SQL command' => 'Comando SQL',
'Logout' => 'Esci', 'Logout' => 'Esci',
'database' => 'database',
'Use' => 'Usa', 'Use' => 'Usa',
'No tables.' => 'No tabelle.', 'No tables.' => 'No tabelle.',
'select' => 'seleziona', 'select' => 'seleziona',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'Tipo indice', 'Index Type' => 'Tipo indice',
'length' => 'lunghezza', 'Column (length)' => 'Colonna (lunghezza)',
'View has been dropped.' => 'Vista eliminata.', 'View has been dropped.' => 'Vista eliminata.',
'View has been altered.' => 'Vista modificata.', 'View has been altered.' => 'Vista modificata.',
'View has been created.' => 'Vista creata.', 'View has been created.' => 'Vista creata.',
@@ -266,8 +265,9 @@ $translations = array(
'Permanent link' => 'Link permanente', 'Permanent link' => 'Link permanente',
'Edit all' => 'Modifica tutto', 'Edit all' => 'Modifica tutto',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => 'Scartare %s?', 'Drop %s?' => 'Scartare %s?',
'Tables have been optimized.' => 'Le tabelle sono state ottimizzate.', 'Tables have been optimized.' => 'Le tabelle sono state ottimizzate',
'Materialized view' => 'Vista materializzata', 'Materialized view' => 'Vista materializzata',
'Vacuum' => 'Aspira', 'Vacuum' => 'Aspira',
'Selected' => 'Selezionato', 'Selected' => 'Selezionato',
@@ -279,12 +279,13 @@ $translations = array(
'Loading' => 'Caricamento', 'Loading' => 'Caricamento',
'ATTACH queries are not supported.' => 'ATTACH queries non sono supportate.', 'ATTACH queries are not supported.' => 'ATTACH queries non sono supportate.',
'Warnings' => 'Attenzione', 'Warnings' => 'Attenzione',
'%d / ' => '%d / ', '%d / ' => array('%d / '),
'Limit rows' => 'Limite righe', 'Limit rows' => 'Limite righe',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer non supporta accesso a databse senza password, <a href="https://www.adminer.org/it/password/"%s>piú informazioni</a>.', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer non supporta accesso a databse senza password, <a href="https://www.adminer.org/it/password/"%s>piú informazioni</a>.',
'Default value' => 'Valore predefinito', 'Default value' => 'Valore predefinito',
'Full table scan' => 'Analizza intera tabella', 'Full table scan' => 'Analizza intera tabella',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Troppi tentativi infruttuosi di login, si prega di riprovare in %d minuto.', 'Troppi tentativi infruttuosi di login, si prega di riprovare in %d minuti.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Troppi tentativi infruttuosi di login, si prega di riprovare in %d minuto.', 'Troppi tentativi infruttuosi di login, si prega di riprovare in %d minuti.'),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'La password principale é scaduta. <a href="https://www.adminer.org/it/extension/"%s>Implementare</a> %s come metodo per renderla permanente.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'La password principale é scaduta. <a href="https://www.adminer.org/it/extension/"%s>Implementare</a> %s come metodo per renderla permanente.',
'The action will be performed after successful login with the same credentials.' => 'La azione verrá eseguita dopo un login valido con le stesse credenziali.', 'The action will be performed after successful login with the same credentials.' => 'La azione verrá eseguita dopo un login valido con le stesse credenziali.',
'Connecting to privileged ports is not allowed.' => 'LA connessione a porte privilegiate non é permessa.', 'Connecting to privileged ports is not allowed.' => 'LA connessione a porte privilegiate non é permessa.',
@@ -296,9 +297,17 @@ $translations = array(
'You are offline.' => 'Sei disconnesso.', 'You are offline.' => 'Sei disconnesso.',
'You have no privileges to update this table.' => 'Non hai i privilegi per aggiornare questa tabella.', 'You have no privileges to update this table.' => 'Non hai i privilegi per aggiornare questa tabella.',
'Saving' => 'Salvataggio', 'Saving' => 'Salvataggio',
'Unknown error.' => 'Errore sconosciuto.', 'Unknown error.' => 'Errore sconosciuto',
'Database does not support password.' => 'Il database non supporta password.', 'Database does not support password.' => 'Il database non supporta password.',
'Disable %s or enable %s or %s extensions.' => 'Disabilita %s o abilita %s oppure %s estensioni.', 'Disable %s or enable %s or %s extensions.' => 'Disabilita %s o abilita %s oppure %s estensioni.',
'yes' => 'si', 'yes' => 'si',
'no' => 'no', 'no' => 'no',
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Si',
'No' => 'No',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'ログイン', 'Login' => 'ログイン',
'Logout successful.' => 'ログアウト', 'Logout successful.' => 'ログアウト',
'Invalid credentials.' => '不正なログイン', 'Invalid server or credentials.' => null,
'Server' => 'サーバ', 'Server' => 'サーバ',
'Username' => 'ユーザ名', 'Username' => 'ユーザ名',
'Password' => 'パスワード', 'Password' => 'パスワード',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'データベースを作成', 'Create database' => 'データベースを作成',
'SQL command' => 'SQLコマンド', 'SQL command' => 'SQLコマンド',
'Logout' => 'ログアウト', 'Logout' => 'ログアウト',
'database' => 'データベース',
'Use' => '使用', 'Use' => '使用',
'No tables.' => 'テーブルがありません。', 'No tables.' => 'テーブルがありません。',
'select' => '選択', 'select' => '選択',
@@ -96,7 +95,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => '索引の型', 'Index Type' => '索引の型',
'length' => '長さ', 'Column (length)' => '列(長さ',
'View has been dropped.' => 'ビューを削除しました', 'View has been dropped.' => 'ビューを削除しました',
'View has been altered.' => 'ビューを変更しました', 'View has been altered.' => 'ビューを変更しました',
'View has been created.' => 'ビューを作成しました', 'View has been created.' => 'ビューを作成しました',
@@ -275,4 +274,40 @@ $translations = array(
'yes' => 'はい', 'yes' => 'はい',
'no' => 'いいえ', 'no' => 'いいえ',
'Default value' => '既定値', 'Default value' => '既定値',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'overwrite' => null,
'DB' => null,
'Ctrl+click on a value to modify it.' => null,
'File must be in UTF-8 encoding.' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'შესვლა', 'Login' => 'შესვლა',
'Logout successful.' => 'გამოხვედით სისტემიდან.', 'Logout successful.' => 'გამოხვედით სისტემიდან.',
'Invalid credentials.' => 'არასწორი მომხმარებელი ან პაროლი.', 'Invalid server or credentials.' => null,
'Server' => 'სერვერი', 'Server' => 'სერვერი',
'Username' => 'მომხმარებელი', 'Username' => 'მომხმარებელი',
'Password' => 'პაროლი', 'Password' => 'პაროლი',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'ბაზის შექმნა', 'Create database' => 'ბაზის შექმნა',
'SQL command' => 'SQL-ბრძანება', 'SQL command' => 'SQL-ბრძანება',
'Logout' => 'გასვლა', 'Logout' => 'გასვლა',
'database' => 'ბაზა',
'Use' => 'არჩევა', 'Use' => 'არჩევა',
'No tables.' => 'ბაზაში ცხრილი არაა.', 'No tables.' => 'ბაზაში ცხრილი არაა.',
'select' => 'არჩევა', 'select' => 'არჩევა',
@@ -95,7 +94,7 @@ $translations = array(
'ON DELETE' => 'წაშლისას', 'ON DELETE' => 'წაშლისას',
'ON UPDATE' => 'განახლებისას', 'ON UPDATE' => 'განახლებისას',
'Index Type' => 'ინდექსის სახეობა', 'Index Type' => 'ინდექსის სახეობა',
'length' => 'სიგრძე', 'Column (length)' => 'ველი (სიგრძე)',
'View has been dropped.' => 'წარმოდგენა წაიშალა.', 'View has been dropped.' => 'წარმოდგენა წაიშალა.',
'View has been altered.' => 'წარმოდგენა შეიცვალა.', 'View has been altered.' => 'წარმოდგენა შეიცვალა.',
'View has been created.' => 'წარმოდგენა შეიქმნა.', 'View has been created.' => 'წარმოდგენა შეიქმნა.',
@@ -301,4 +300,14 @@ $translations = array(
'Unknown error.' => 'უცნობი შეცდომა.', 'Unknown error.' => 'უცნობი შეცდომა.',
'Database does not support password.' => 'ბაზაში არაა მხარდაჭერილი პაროლი.', 'Database does not support password.' => 'ბაზაში არაა მხარდაჭერილი პაროლი.',
'Disable %s or enable %s or %s extensions.' => 'გათიშეთ %s ან ჩართეთ %s ან %s გაფართოება.', 'Disable %s or enable %s or %s extensions.' => 'გათიშეთ %s ან ჩართეთ %s ან %s გაფართოება.',
'overwrite' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'$1-$3-$5' => '$1-$3-$5', '$1-$3-$5' => '$1-$3-$5',
'%.3f s' => '%.3f 초', '%.3f s' => '%.3f 초',
@@ -48,7 +46,7 @@ $translations = array(
'Clone' => '복제', 'Clone' => '복제',
'collation' => '정렬', 'collation' => '정렬',
'Collation' => '정렬', 'Collation' => '정렬',
'length' => '길이', 'Column (length)' => '열 (길이)',
'Column name' => '열 이름', 'Column name' => '열 이름',
'Column' => '열', 'Column' => '열',
'Comment' => '주석', 'Comment' => '주석',
@@ -73,6 +71,7 @@ $translations = array(
'Database has been dropped.' => '데이터베이스를 삭제했습니다.', 'Database has been dropped.' => '데이터베이스를 삭제했습니다.',
'Database has been renamed.' => '데이터베이스의 이름을 바꾸었습니다.', 'Database has been renamed.' => '데이터베이스의 이름을 바꾸었습니다.',
'Database schema' => '데이터베이스 구조', 'Database schema' => '데이터베이스 구조',
'database' => '데이터베이스',
'Database' => '데이터베이스', 'Database' => '데이터베이스',
'Databases have been dropped.' => '데이터베이스를 삭제했습니다.', 'Databases have been dropped.' => '데이터베이스를 삭제했습니다.',
'Date and time' => '시간', 'Date and time' => '시간',
@@ -122,7 +121,7 @@ $translations = array(
'Indexes have been altered.' => '색인을 변경했습니다.', 'Indexes have been altered.' => '색인을 변경했습니다.',
'Indexes' => '색인', 'Indexes' => '색인',
'Insert' => '삽입', 'Insert' => '삽입',
'Invalid credentials.' => '잘못된 로그인.', 'Invalid server or credentials.' => null,
'Invalid CSRF token. Send the form again.' => '잘못된 CSRF 토큰입니다. 다시 보내주십시오.', 'Invalid CSRF token. Send the form again.' => '잘못된 CSRF 토큰입니다. 다시 보내주십시오.',
'Invalid database.' => '잘못된 데이터베이스입니다.', 'Invalid database.' => '잘못된 데이터베이스입니다.',
'Invalid schema.' => '잘못된 스키마입니다.', 'Invalid schema.' => '잘못된 스키마입니다.',
@@ -143,7 +142,7 @@ $translations = array(
'Logout successful.' => '로그아웃을 성공했습니다.', 'Logout successful.' => '로그아웃을 성공했습니다.',
'Logout' => '로그아웃', 'Logout' => '로그아웃',
'ltr' => 'ltr', 'ltr' => 'ltr',
'Maximum allowed file size is %sB.' => '파일의 최대 크기 %sB.', 'Maximum allowed file size is %sB.' => '파일의 최대 크기 %sB',
'Maximum number of allowed fields exceeded. Please increase %s.' => '정의 가능한 최대 필드 수를 초과했습니다. %s(을)를 늘리십시오.', 'Maximum number of allowed fields exceeded. Please increase %s.' => '정의 가능한 최대 필드 수를 초과했습니다. %s(을)를 늘리십시오.',
'Modify' => '수정', 'Modify' => '수정',
'Move down' => '아래로', 'Move down' => '아래로',
@@ -154,7 +153,7 @@ $translations = array(
'Network' => '네트워크 형', 'Network' => '네트워크 형',
'New item' => '항목 만들기', 'New item' => '항목 만들기',
'No commands to execute.' => '실행할 수 있는 명령이 없습니다.', 'No commands to execute.' => '실행할 수 있는 명령이 없습니다.',
'No extension' => '확장이 없습니다', 'No extension' => '확장이 없습니다.',
'No rows.' => '행이 없습니다.', 'No rows.' => '행이 없습니다.',
'No tables.' => '테이블이 없습니다.', 'No tables.' => '테이블이 없습니다.',
'None of the supported PHP extensions (%s) are available.' => 'PHP 확장(%s)이 설치되어 있지 않습니다.', 'None of the supported PHP extensions (%s) are available.' => 'PHP 확장(%s)이 설치되어 있지 않습니다.',
@@ -206,8 +205,8 @@ $translations = array(
'Schema' => '스키마', 'Schema' => '스키마',
'Search data in tables' => '테이블 내 데이터 검색', 'Search data in tables' => '테이블 내 데이터 검색',
'Search' => '검색', 'Search' => '검색',
'Select data' => '데이터를 선택하십시오', 'Select data' => '데이터를 선택하십시오.',
'Select database' => '데이터베이스를 선택하십시오', 'Select database' => '데이터베이스를 선택하십시오.',
'Select' => '선택', 'Select' => '선택',
'select' => '선택', 'select' => '선택',
'Selected' => '선택됨', 'Selected' => '선택됨',
@@ -238,7 +237,7 @@ $translations = array(
'Table name' => '테이블 이름', 'Table name' => '테이블 이름',
'Table' => '테이블', 'Table' => '테이블',
'Tables and views' => '테이블과 뷰', 'Tables and views' => '테이블과 뷰',
'Tables have been copied.' => '테이블을 복사했습니다.', 'Tables have been copied.' => '테이블을 복사했습니다',
'Tables have been dropped.' => '테이블을 삭제했습니다.', 'Tables have been dropped.' => '테이블을 삭제했습니다.',
'Tables have been moved.' => '테이블을 옮겼습니다.', 'Tables have been moved.' => '테이블을 옮겼습니다.',
'Tables have been truncated.' => '테이블의 데이터 내용만 지웠습니다.', 'Tables have been truncated.' => '테이블의 데이터 내용만 지웠습니다.',
@@ -256,7 +255,7 @@ $translations = array(
'Type has been created.' => '유형을 추가했습니다.', 'Type has been created.' => '유형을 추가했습니다.',
'Type has been dropped.' => '유형을 삭제했습니다.', 'Type has been dropped.' => '유형을 삭제했습니다.',
'Type' => '형', 'Type' => '형',
'Unable to select the table' => '테이블을 선택할 수 없습니다', 'Unable to select the table' => '테이블을 선택할 수 없습니다.',
'Unable to upload a file.' => '파일을 업로드 할 수 없습니다.', 'Unable to upload a file.' => '파일을 업로드 할 수 없습니다.',
'Use edit link to modify this value.' => '이 값을 수정하려면 편집 링크를 사용하십시오.', 'Use edit link to modify this value.' => '이 값을 수정하려면 편집 링크를 사용하십시오.',
'Use' => '사용', 'Use' => '사용',
@@ -278,4 +277,37 @@ $translations = array(
'You are offline.' => '오프라인입니다.', 'You are offline.' => '오프라인입니다.',
'You can upload a big SQL file via FTP and import it from server.' => '큰 SQL 파일은 FTP를 통하여 업로드하여 서버에서 가져올 수 있습니다.', 'You can upload a big SQL file via FTP and import it from server.' => '큰 SQL 파일은 FTP를 통하여 업로드하여 서버에서 가져올 수 있습니다.',
'You have no privileges to update this table.' => '이 테이블을 업데이트할 권한이 없습니다.', 'You have no privileges to update this table.' => '이 테이블을 업데이트할 권한이 없습니다.',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'User types' => null,
'DB' => null,
'Ctrl+click on a value to modify it.' => null,
'File must be in UTF-8 encoding.' => null,
'ATTACH queries are not supported.' => null,
'%d / ' => array(),
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistema', 'System' => 'Sistema',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'Atsijungti', 'Logout' => 'Atsijungti',
'Logged as: %s' => 'Prisijungęs kaip: %s', 'Logged as: %s' => 'Prisijungęs kaip: %s',
'Logout successful.' => 'Jūs atsijungėte nuo sistemos.', 'Logout successful.' => 'Jūs atsijungėte nuo sistemos.',
'Invalid credentials.' => 'Neteisingi prisijungimo duomenys.', 'Invalid server or credentials.' => null,
'Language' => 'Kalba', 'Language' => 'Kalba',
'Invalid CSRF token. Send the form again.' => 'Neteisingas CSRF tokenas. Bandykite siųsti formos duomenis dar kartą.', 'Invalid CSRF token. Send the form again.' => 'Neteisingas CSRF tokenas. Bandykite siųsti formos duomenis dar kartą.',
'No extension' => 'Nėra plėtiio', 'No extension' => 'Nėra plėtiio',
@@ -75,6 +73,7 @@ $translations = array(
'Data' => 'Duomenys', 'Data' => 'Duomenys',
'Database' => 'Duomenų bazė', 'Database' => 'Duomenų bazė',
'database' => 'duomenų bazė',
'Use' => 'Naudoti', 'Use' => 'Naudoti',
'Select database' => 'Pasirinkti duomenų bazę', 'Select database' => 'Pasirinkti duomenų bazę',
'Invalid database.' => 'Neteisinga duomenų bazė.', 'Invalid database.' => 'Neteisinga duomenų bazė.',
@@ -183,7 +182,7 @@ $translations = array(
'Alter indexes' => 'Redaguoti indeksus', 'Alter indexes' => 'Redaguoti indeksus',
'Add next' => 'Pridėti kitą', 'Add next' => 'Pridėti kitą',
'Index Type' => 'Indekso tipas', 'Index Type' => 'Indekso tipas',
'length' => 'ilgis', 'Column (length)' => 'Stulpelis (ilgis)',
'Foreign keys' => 'Išoriniai raktai', 'Foreign keys' => 'Išoriniai raktai',
'Foreign key' => 'Išorinis raktas', 'Foreign key' => 'Išorinis raktas',
@@ -310,4 +309,50 @@ $translations = array(
'Type has been dropped.' => 'Tipas pašalintas.', 'Type has been dropped.' => 'Tipas pašalintas.',
'Type has been created.' => 'Tipas sukurtas.', 'Type has been created.' => 'Tipas sukurtas.',
'Alter type' => 'Keisti tipą', 'Alter type' => 'Keisti tipą',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'Ctrl+click on a value to modify it.' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Ieiet', 'Login' => 'Ieiet',
'Logout successful.' => 'Jūs veiksmīgi izgājāt no sistēmas.', 'Logout successful.' => 'Jūs veiksmīgi izgājāt no sistēmas.',
'Invalid credentials.' => 'Nepareizs lietotāja vārds vai parole.', 'Invalid server or credentials.' => null,
'Server' => 'Serveris', 'Server' => 'Serveris',
'Username' => 'Lietotājs', 'Username' => 'Lietotājs',
'Password' => 'Parole', 'Password' => 'Parole',
@@ -33,12 +31,13 @@ $translations = array(
'Create database' => 'Izveidot datubāzi', 'Create database' => 'Izveidot datubāzi',
'SQL command' => 'SQL pieprasījums', 'SQL command' => 'SQL pieprasījums',
'Logout' => 'Iziet', 'Logout' => 'Iziet',
'database' => 'datubāze',
'Use' => 'Lietot', 'Use' => 'Lietot',
'No tables.' => 'Datubāzē nav tabulu.', 'No tables.' => 'Datubāzē nav tabulu.',
'select' => 'izvēlēties', 'select' => 'izvēlēties',
'Item has been deleted.' => 'Ieraksts dzests.', 'Item has been deleted.' => 'Ieraksts dzests.',
'Item has been updated.' => 'Ieraksts atjaunots.', 'Item has been updated.' => 'Ieraksts atjaunots.',
'Item%s has been inserted.' => 'Ieraksti%s tika ievietoti.', 'Item%s has been inserted.' => 'Ieraksti tika ievietoti.',
'Edit' => 'Rediģēt', 'Edit' => 'Rediģēt',
'Insert' => 'Ievietot', 'Insert' => 'Ievietot',
'Save and insert next' => 'Saglabāt un ievietot nākamo', 'Save and insert next' => 'Saglabāt un ievietot nākamo',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'Pie dzēšanas', 'ON DELETE' => 'Pie dzēšanas',
'ON UPDATE' => 'Pie atjaunošanas', 'ON UPDATE' => 'Pie atjaunošanas',
'Index Type' => 'Indeksa tips', 'Index Type' => 'Indeksa tips',
'length' => 'garums', 'Column (length)' => 'Lauks (garums)',
'View has been dropped.' => 'Skats dzēsts.', 'View has been dropped.' => 'Skats dzēsts.',
'View has been altered.' => 'Skats izmainīts.', 'View has been altered.' => 'Skats izmainīts.',
'View has been created.' => 'Skats izveidots.', 'View has been created.' => 'Skats izveidots.',
@@ -286,10 +285,10 @@ $translations = array(
'Size' => 'Izmērs', 'Size' => 'Izmērs',
'Compute' => 'Izskaitļot', 'Compute' => 'Izskaitļot',
'You are offline.' => 'Jūs est bezsasaistē.', 'You are offline.' => 'Jūs est bezsasaistē.',
'You have no privileges to update this table.' => 'jums nav pieejas labot šo tabulu.', 'You have no privileges to update this table.' => 'Jums nav pieejas labot šo tabulu.',
'Saving' => 'Saglabāšana', 'Saving' => 'Saglabāšana',
'yes' => 'Jā', 'yes' => 'jā',
'no' => 'Nē', 'no' => 'nē',
'Drop %s?' => 'Dzēst %s?', 'Drop %s?' => 'Dzēst %s?',
'overwrite' => 'pārrakstīt', 'overwrite' => 'pārrakstīt',
'DB' => 'DB', 'DB' => 'DB',
@@ -301,4 +300,14 @@ $translations = array(
'There is a space in the input password which might be the cause.' => 'Parole satur atstarpi, kas varētu būt lieka.', 'There is a space in the input password which might be the cause.' => 'Parole satur atstarpi, kas varētu būt lieka.',
'Unknown error.' => 'Nezināma kļūda.', 'Unknown error.' => 'Nezināma kļūda.',
'Database does not support password.' => 'Datubāze neatbalsta paroli.', 'Database does not support password.' => 'Datubāze neatbalsta paroli.',
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Jā',
'No' => 'Nē',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem', 'System' => 'Sistem',
@@ -13,7 +11,7 @@ $translations = array(
'Logged as: %s' => 'Log masuk sebagai: %s', 'Logged as: %s' => 'Log masuk sebagai: %s',
'Logout successful.' => 'Log keluar berjaya.', 'Logout successful.' => 'Log keluar berjaya.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Terima kasih kerana menggunakan Adminer, pertimbangkan untuk <a href="https://www.adminer.org/en/donation/">menderma</a>.', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Terima kasih kerana menggunakan Adminer, pertimbangkan untuk <a href="https://www.adminer.org/en/donation/">menderma</a>.',
'Invalid credentials.' => 'Akses tidak sah.', 'Invalid server or credentials.' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => 'Terlalu banyak percubaan log masuk yang gagal, sila cuba lagi dalam masa %d minit.', 'Too many unsuccessful logins, try again in %d minute(s).' => 'Terlalu banyak percubaan log masuk yang gagal, sila cuba lagi dalam masa %d minit.',
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Kata laluan utama telah luput. <a href="https://www.adminer.org/en/extension/"%s>Gunakan</a> cara %s untuk mengekalkannya.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Kata laluan utama telah luput. <a href="https://www.adminer.org/en/extension/"%s>Gunakan</a> cara %s untuk mengekalkannya.',
'Language' => 'Bahasa', 'Language' => 'Bahasa',
@@ -84,6 +82,7 @@ $translations = array(
'Data' => 'Data', 'Data' => 'Data',
'Database' => 'Pangkalan data', 'Database' => 'Pangkalan data',
'database' => 'pangkalan data',
'Use' => 'Guna', 'Use' => 'Guna',
'Select database' => 'Pilih pangkalan data', 'Select database' => 'Pilih pangkalan data',
'Invalid database.' => 'Pangkalan data tidak sah.', 'Invalid database.' => 'Pangkalan data tidak sah.',
@@ -199,7 +198,7 @@ $translations = array(
'Alter indexes' => 'Ubah indeks', 'Alter indexes' => 'Ubah indeks',
'Add next' => 'Tambah yang seterusnya', 'Add next' => 'Tambah yang seterusnya',
'Index Type' => 'Jenis Indeks', 'Index Type' => 'Jenis Indeks',
'length' => 'kepanjangan', 'Column (length)' => 'Kolum (kepanjangan)',
'Foreign keys' => 'Kunci asing', 'Foreign keys' => 'Kunci asing',
'Foreign key' => 'Kunci asing', 'Foreign key' => 'Kunci asing',
@@ -338,4 +337,22 @@ $translations = array(
'Type has been dropped.' => 'Jenis telah dijatuhkan.', 'Type has been dropped.' => 'Jenis telah dijatuhkan.',
'Type has been created.' => 'Jenis telah dibuat.', 'Type has been created.' => 'Jenis telah dibuat.',
'Alter type' => 'Ubah jenis', 'Alter type' => 'Ubah jenis',
'overwrite' => null,
'DB' => null,
'Warnings' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'There is a space in the input password which might be the cause.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Ya',
'No' => 'Tidak',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Aanmelden', 'Login' => 'Aanmelden',
'Logout successful.' => 'Successvol afgemeld.', 'Logout successful.' => 'Successvol afgemeld.',
'Invalid credentials.' => 'Ongeldige gebruikersgegevens.', 'Invalid server or credentials.' => null,
'Server' => 'Server', 'Server' => 'Server',
'Username' => 'Gebruikersnaam', 'Username' => 'Gebruikersnaam',
'Password' => 'Wachtwoord', 'Password' => 'Wachtwoord',
@@ -34,6 +32,7 @@ $translations = array(
'Create database' => 'Database aanmaken', 'Create database' => 'Database aanmaken',
'SQL command' => 'SQL opdracht', 'SQL command' => 'SQL opdracht',
'Logout' => 'Afmelden', 'Logout' => 'Afmelden',
'database' => 'database',
'Use' => 'Gebruik', 'Use' => 'Gebruik',
'No tables.' => 'Geen tabellen.', 'No tables.' => 'Geen tabellen.',
'select' => 'kies', 'select' => 'kies',
@@ -98,7 +97,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'Index type', 'Index Type' => 'Index type',
'length' => 'lengte', 'Column (length)' => 'Kolom (lengte)',
'View has been dropped.' => 'View verwijderd.', 'View has been dropped.' => 'View verwijderd.',
'View has been altered.' => 'View aangepast.', 'View has been altered.' => 'View aangepast.',
'View has been created.' => 'View aangemaakt.', 'View has been created.' => 'View aangemaakt.',
@@ -254,7 +253,7 @@ $translations = array(
'Geometry' => 'Geometrie', 'Geometry' => 'Geometrie',
'File exists.' => 'Bestand bestaat reeds.', 'File exists.' => 'Bestand bestaat reeds.',
'Attachments' => 'Bijlagen', 'Attachments' => 'Bijlagen',
'%d query(s) executed OK.' => array('%d query succesvol uitgevoerd.', '%d querys succesvol uitgevoerd.'), '%d query(s) executed OK.' => array('%d query succesvol uitgevoerd.', '%d querys succesvol uitgevoerd'),
'Show only errors' => 'Enkel fouten tonen', 'Show only errors' => 'Enkel fouten tonen',
'Refresh' => 'Vernieuwen', 'Refresh' => 'Vernieuwen',
'Invalid schema.' => 'Ongeldig schema.', 'Invalid schema.' => 'Ongeldig schema.',
@@ -266,6 +265,7 @@ $translations = array(
'Permanent link' => 'Permanente link', 'Permanent link' => 'Permanente link',
'Edit all' => 'Alles bewerken', 'Edit all' => 'Alles bewerken',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => 'Verwijder %s?', 'Drop %s?' => 'Verwijder %s?',
'Tables have been optimized.' => 'Tabellen zijn geoptimaliseerd.', 'Tables have been optimized.' => 'Tabellen zijn geoptimaliseerd.',
'Materialized view' => 'Materialized view', 'Materialized view' => 'Materialized view',
@@ -277,7 +277,7 @@ $translations = array(
'Modify' => 'Aanpassen', 'Modify' => 'Aanpassen',
'Load more data' => 'Meer data inladen', 'Load more data' => 'Meer data inladen',
'Loading' => 'Aan het laden', 'Loading' => 'Aan het laden',
'ATTACH queries are not supported.' => 'ATTACH queries worden niet ondersteund.', 'ATTACH queries are not supported.' => 'ATTACH queries worden niet ondersteund',
'Warnings' => 'Waarschuwingen', 'Warnings' => 'Waarschuwingen',
'%d / ' => '%d / ', '%d / ' => '%d / ',
'Limit rows' => 'Rijen beperken', 'Limit rows' => 'Rijen beperken',
@@ -285,8 +285,9 @@ $translations = array(
'Default value' => 'Standaardwaarde', 'Default value' => 'Standaardwaarde',
'Full table scan' => 'Full table scan', 'Full table scan' => 'Full table scan',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Teveel foutieve aanmeldpogingen, probeer opnieuw binnen %d minuut.', 'Teveel foutieve aanmeldpogingen, probeer opnieuw binnen %d minuten.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Teveel foutieve aanmeldpogingen, probeer opnieuw binnen %d minuut.', 'Teveel foutieve aanmeldpogingen, probeer opnieuw binnen %d minuten.'),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Master wachtwoord verlopen. <a href="https://www.adminer.org/en/extension/"%s>Implementeer</a> de %s methode om het permanent te maken.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Master wachtwoord verlopen. <a href="https://www.adminer.org/en/extension/"%s>Implementeer</a> de %s methode om het permanent te maken.',
'The action will be performed after successful login with the same credentials.' => 'Deze actie zal uitgevoerd worden na het succesvol aanmelden met dezelfde gebruikersgegevens.', 'The action will be performed after successful login with the same credentials.' => 'Deze actie zal uitgevoerd worden na het succesvol aanmelden met dezelfde gebruikersgegevens',
'Connecting to privileged ports is not allowed.' => 'Verbindingen naar geprivilegieerde poorten is niet toegestaan.', 'Connecting to privileged ports is not allowed.' => 'Verbindingen naar geprivilegieerde poorten is niet toegestaan.',
'There is a space in the input password which might be the cause.' => 'Er staat een spatie in het wachtwoord, wat misschien de oorzaak is.', 'There is a space in the input password which might be the cause.' => 'Er staat een spatie in het wachtwoord, wat misschien de oorzaak is.',
'If you did not send this request from Adminer then close this page.' => 'Als u deze actie niet via Adminer hebt gedaan, gelieve deze pagina dan te sluiten.', 'If you did not send this request from Adminer then close this page.' => 'Als u deze actie niet via Adminer hebt gedaan, gelieve deze pagina dan te sluiten.',
@@ -296,9 +297,17 @@ $translations = array(
'You are offline.' => 'U bent offline.', 'You are offline.' => 'U bent offline.',
'You have no privileges to update this table.' => 'U bent niet gemachtigd om deze tabel aan te passen.', 'You have no privileges to update this table.' => 'U bent niet gemachtigd om deze tabel aan te passen.',
'Saving' => 'Opslaan', 'Saving' => 'Opslaan',
'Unknown error.' => 'Onbekende fout.', 'Unknown error.' => 'Onbekende fout',
'Database does not support password.' => 'Database ondersteunt het wachtwoord niet.', 'Database does not support password.' => 'Database ondersteunt het wachtwoord niet.',
'Disable %s or enable %s or %s extensions.' => 'Schakel %s uit or schakel extensies %s of %s in.', 'Disable %s or enable %s or %s extensions.' => 'Schakel %s uit or schakel extensies %s of %s in.',
'yes' => 'ja', 'yes' => 'ja',
'no' => 'neen', 'no' => 'neen',
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Ja',
'No' => 'Neen',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'System' => 'System', 'System' => 'System',
'Server' => 'Server', 'Server' => 'Server',
@@ -11,7 +9,7 @@ $translations = array(
'Logout' => 'Logg ut', 'Logout' => 'Logg ut',
'Logged as: %s' => 'Logget inn som: %s', 'Logged as: %s' => 'Logget inn som: %s',
'Logout successful.' => 'Utlogging vellykket.', 'Logout successful.' => 'Utlogging vellykket.',
'Invalid credentials.' => 'Ugylding innloggingsinformasjon.', 'Invalid server or credentials.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Master-passord er utløpt. <a href="https://www.adminer.org/en/extension/"%s>Implementer</a> en metode for %s for å gjøre det permanent.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Master-passord er utløpt. <a href="https://www.adminer.org/en/extension/"%s>Implementer</a> en metode for %s for å gjøre det permanent.',
'Language' => 'Språk', 'Language' => 'Språk',
'Invalid CSRF token. Send the form again.' => 'Ugylding CSRF-token - Send inn skjemaet igjen.', 'Invalid CSRF token. Send the form again.' => 'Ugylding CSRF-token - Send inn skjemaet igjen.',
@@ -66,6 +64,7 @@ $translations = array(
'Format' => 'Format', 'Format' => 'Format',
'Data' => 'Data', 'Data' => 'Data',
'Database' => 'Database', 'Database' => 'Database',
'database' => 'database',
'Use' => 'Bruk', 'Use' => 'Bruk',
'Select database' => 'Velg database', 'Select database' => 'Velg database',
'Invalid database.' => 'Ugyldig database.', 'Invalid database.' => 'Ugyldig database.',
@@ -166,7 +165,7 @@ $translations = array(
'Alter indexes' => 'Endre indekser', 'Alter indexes' => 'Endre indekser',
'Add next' => 'Legg til neste', 'Add next' => 'Legg til neste',
'Index Type' => 'Indekstype', 'Index Type' => 'Indekstype',
'length' => 'lengde', 'Column (length)' => 'Kolonne (lengde)',
'Foreign keys' => 'Fremmednøkler', 'Foreign keys' => 'Fremmednøkler',
'Foreign key' => 'Fremmednøkkel', 'Foreign key' => 'Fremmednøkkel',
'Foreign key has been dropped.' => 'Fremmednøkkelen er slettet.', 'Foreign key has been dropped.' => 'Fremmednøkkelen er slettet.',
@@ -280,4 +279,35 @@ $translations = array(
'Type has been created.' => 'Type er opprettet.', 'Type has been created.' => 'Type er opprettet.',
'Alter type' => 'Endre type', 'Alter type' => 'Endre type',
'Saving' => 'Lagrer', 'Saving' => 'Lagrer',
'Drop %s?' => null,
'Materialized view' => null,
'overwrite' => null,
'DB' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Ja',
'No' => 'Nei',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Rodzaj bazy', 'System' => 'Rodzaj bazy',
@@ -9,14 +7,11 @@ $translations = array(
'Password' => 'Hasło', 'Password' => 'Hasło',
'Permanent login' => 'Zapamiętaj sesję', 'Permanent login' => 'Zapamiętaj sesję',
'Login' => 'Zaloguj się', 'Login' => 'Zaloguj się',
'Logout' => 'Wyloguj się', 'Logout' => 'Wyloguj',
'Logged as: %s' => 'Zalogowany jako: %s', 'Logged as: %s' => 'Zalogowany jako: %s',
'Logout successful.' => 'Wylogowano pomyślnie.', 'Logout successful.' => 'Wylogowano pomyślnie.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Dziękujemy za używanie Adminera, rozważ <a href="https://www.adminer.org/pl/donation/">dotację</a>.', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Dziękujemy za używanie Adminera, rozważ proszę <a href="https://www.adminer.org/pl/donation/">dotację</a>.',
'Invalid credentials.' => 'Nieprawidłowe dane logowania.', 'Invalid server or credentials.' => 'Nieprawidłowy serwer lub dane logowania.',
'There is a space in the input password which might be the cause.' => 'W haśle wejściowym znajduje się spacja, która może być przyczyną.',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer nie obsługuje dostępu do bazy danych bez hasła, <a href="https://www.adminer.org/pl/password/"%s>więcej informacji</a>.',
'Database does not support password.' => 'Baza danych nie obsługuje hasła.',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Za dużo nieudanych prób logowania, spróbuj ponownie za %d minutę.', 'Za dużo nieudanych prób logowania, spróbuj ponownie za %d minuty.', 'Za dużo nieudanych prób logowania, spróbuj ponownie za %d minut.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Za dużo nieudanych prób logowania, spróbuj ponownie za %d minutę.', 'Za dużo nieudanych prób logowania, spróbuj ponownie za %d minuty.', 'Za dużo nieudanych prób logowania, spróbuj ponownie za %d minut.'),
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Ważność hasła głównego wygasła. <a href="https://www.adminer.org/pl/extension/"%s>Zaimplementuj</a> własną metodę %s, aby ustawić je na stałe.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Ważność hasła głównego wygasła. <a href="https://www.adminer.org/pl/extension/"%s>Zaimplementuj</a> własną metodę %s, aby ustawić je na stałe.',
'Language' => 'Język', 'Language' => 'Język',
@@ -25,10 +20,8 @@ $translations = array(
'No extension' => 'Brak rozszerzenia', 'No extension' => 'Brak rozszerzenia',
'None of the supported PHP extensions (%s) are available.' => 'Żadne z rozszerzeń PHP umożliwiających połączenie się z bazą danych (%s) nie jest dostępne.', 'None of the supported PHP extensions (%s) are available.' => 'Żadne z rozszerzeń PHP umożliwiających połączenie się z bazą danych (%s) nie jest dostępne.',
'Connecting to privileged ports is not allowed.' => 'Łączenie do portów uprzywilejowanych jest niedozwolone.', 'Connecting to privileged ports is not allowed.' => 'Łączenie do portów uprzywilejowanych jest niedozwolone.',
'Disable %s or enable %s or %s extensions.' => 'Wyłącz %s lub włącz rozszerzenia %s lub %s.',
'Session support must be enabled.' => 'Wymagana jest obsługa sesji w PHP.', 'Session support must be enabled.' => 'Wymagana jest obsługa sesji w PHP.',
'Session expired, please login again.' => 'Sesja wygasła, zaloguj się ponownie.', 'Session expired, please login again.' => 'Sesja wygasła, zaloguj się ponownie.',
'The action will be performed after successful login with the same credentials.' => 'Czynność zostanie wykonana po pomyślnym zalogowaniu przy użyciu tych samych danych logowania.',
'%s version: %s through PHP extension %s' => 'Wersja %s: %s za pomocą %s', '%s version: %s through PHP extension %s' => 'Wersja %s: %s za pomocą %s',
'Refresh' => 'Odśwież', 'Refresh' => 'Odśwież',
@@ -58,8 +51,6 @@ $translations = array(
'Query executed OK, %d row(s) affected.' => array('Zapytanie wykonane pomyślnie, zmieniono %d rekord.', 'Zapytanie wykonane pomyślnie, zmieniono %d rekordy.', 'Zapytanie wykonane pomyślnie, zmieniono %d rekordów.'), 'Query executed OK, %d row(s) affected.' => array('Zapytanie wykonane pomyślnie, zmieniono %d rekord.', 'Zapytanie wykonane pomyślnie, zmieniono %d rekordy.', 'Zapytanie wykonane pomyślnie, zmieniono %d rekordów.'),
'No commands to execute.' => 'Nic do wykonania.', 'No commands to execute.' => 'Nic do wykonania.',
'Error in query' => 'Błąd w zapytaniu', 'Error in query' => 'Błąd w zapytaniu',
'Unknown error.' => 'Nieznany błąd.',
'Warnings' => 'Ostrzeżenia',
'ATTACH queries are not supported.' => 'Zapytania ATTACH są niewspierane.', 'ATTACH queries are not supported.' => 'Zapytania ATTACH są niewspierane.',
'Execute' => 'Wykonaj', 'Execute' => 'Wykonaj',
'Stop on error' => 'Zatrzymaj w przypadku błędu', 'Stop on error' => 'Zatrzymaj w przypadku błędu',
@@ -82,7 +73,7 @@ $translations = array(
'You can upload a big SQL file via FTP and import it from server.' => 'Większe pliki SQL możesz wgrać na serwer poprzez FTP przed zaimportowaniem.', 'You can upload a big SQL file via FTP and import it from server.' => 'Większe pliki SQL możesz wgrać na serwer poprzez FTP przed zaimportowaniem.',
'You are offline.' => 'Jesteś offline.', 'You are offline.' => 'Jesteś offline.',
'Export' => 'Eksportuj', 'Export' => 'Eksport',
'Output' => 'Rezultat', 'Output' => 'Rezultat',
'open' => 'otwórz', 'open' => 'otwórz',
'save' => 'zapisz', 'save' => 'zapisz',
@@ -90,7 +81,7 @@ $translations = array(
'Data' => 'Dane', 'Data' => 'Dane',
'Database' => 'Baza danych', 'Database' => 'Baza danych',
'DB' => 'BD', 'database' => 'baza danych',
'Use' => 'Wybierz', 'Use' => 'Wybierz',
'Select database' => 'Wybierz bazę danych', 'Select database' => 'Wybierz bazę danych',
'Invalid database.' => 'Nie znaleziono bazy danych.', 'Invalid database.' => 'Nie znaleziono bazy danych.',
@@ -128,7 +119,6 @@ $translations = array(
'Tables have been moved.' => 'Tabele zostały przeniesione.', 'Tables have been moved.' => 'Tabele zostały przeniesione.',
'Copy' => 'Kopiuj', 'Copy' => 'Kopiuj',
'Tables have been copied.' => 'Tabele zostały skopiowane.', 'Tables have been copied.' => 'Tabele zostały skopiowane.',
'overwrite' => 'nadpisz',
'Routines' => 'Procedury i funkcje', 'Routines' => 'Procedury i funkcje',
'Routine has been called, %d row(s) affected.' => array('Procedura została uruchomiona, zmieniono %d rekord.', 'Procedura została uruchomiona, zmieniono %d rekordy.', 'Procedura została uruchomiona, zmieniono %d rekordów.'), 'Routine has been called, %d row(s) affected.' => array('Procedura została uruchomiona, zmieniono %d rekord.', 'Procedura została uruchomiona, zmieniono %d rekordy.', 'Procedura została uruchomiona, zmieniono %d rekordów.'),
@@ -174,15 +164,15 @@ $translations = array(
'Column name' => 'Nazwa kolumny', 'Column name' => 'Nazwa kolumny',
'Type' => 'Typ', 'Type' => 'Typ',
'Length' => 'Długość', 'Length' => 'Długość',
'Auto Increment' => 'Automatyczny przyrost', 'Auto Increment' => 'Auto Increment',
'Options' => 'Opcje', 'Options' => 'Opcje',
'Comment' => 'Komentarz', 'Comment' => 'Komentarz',
'Default value' => 'Wartość domyślna', 'Default value' => 'Wartość domyślna',
'Default values' => 'Wartości domyślne', 'Default values' => 'Wartości domyślne',
'Drop' => 'Usuń', 'Drop' => 'Usuń',
'Drop %s?' => 'Usunąć %s?', 'Drop %s?' => 'Usunąć %s?',
'Are you sure?' => 'Czy na pewno?', 'Are you sure?' => 'Czy jesteś pewien?',
'Size' => 'Rozmiar', 'Size' => 'Wielkość',
'Compute' => 'Oblicz', 'Compute' => 'Oblicz',
'Move up' => 'Przesuń w górę', 'Move up' => 'Przesuń w górę',
'Move down' => 'Przesuń w dół', 'Move down' => 'Przesuń w dół',
@@ -207,7 +197,7 @@ $translations = array(
'Alter indexes' => 'Zmień indeksy', 'Alter indexes' => 'Zmień indeksy',
'Add next' => 'Dodaj następny', 'Add next' => 'Dodaj następny',
'Index Type' => 'Typ indeksu', 'Index Type' => 'Typ indeksu',
'length' => 'długość', 'Column (length)' => 'Kolumna (długość)',
'Foreign keys' => 'Klucze obce', 'Foreign keys' => 'Klucze obce',
'Foreign key' => 'Klucz obcy', 'Foreign key' => 'Klucz obcy',
@@ -262,14 +252,14 @@ $translations = array(
'Whole result' => 'Wybierz wszystkie', 'Whole result' => 'Wybierz wszystkie',
'%d byte(s)' => array('%d bajt', '%d bajty', '%d bajtów'), '%d byte(s)' => array('%d bajt', '%d bajty', '%d bajtów'),
'Import' => 'Importuj', 'Import' => 'Import',
'%d row(s) have been imported.' => array('%d rekord został zaimportowany.', '%d rekordy zostały zaimportowane.', '%d rekordów zostało zaimportowanych.'), '%d row(s) have been imported.' => array('%d rekord został zaimportowany.', '%d rekordy zostały zaimportowane.', '%d rekordów zostało zaimportowanych.'),
'File must be in UTF-8 encoding.' => 'Kodowanie pliku musi być ustawione na UTF-8.', 'File must be in UTF-8 encoding.' => 'Kodowanie pliku musi być ustawione na UTF-8.',
// in-place editing in select // in-place editing in select
'Modify' => 'Zmień', 'Modify' => 'Zmień',
'Ctrl+click on a value to modify it.' => 'Ctrl+kliknij wartość, aby ją edytować.', 'Ctrl+click on a value to modify it.' => 'Ctrl+kliknij wartość, aby ją edytować.',
'Use edit link to modify this value.' => 'Użyj linku edycji, aby zmienić tę wartość.', 'Use edit link to modify this value.' => 'Użyj linku edycji aby zmienić tę wartość.',
// %s can contain auto-increment value // %s can contain auto-increment value
'Item%s has been inserted.' => 'Rekord%s został dodany.', 'Item%s has been inserted.' => 'Rekord%s został dodany.',
@@ -290,7 +280,7 @@ $translations = array(
'Selected' => 'Zaznaczone', 'Selected' => 'Zaznaczone',
'Clone' => 'Duplikuj', 'Clone' => 'Duplikuj',
'Delete' => 'Usuń', 'Delete' => 'Usuń',
'You have no privileges to update this table.' => 'Brak uprawnień do edycji tej tabeli.', 'You have no privileges to update this table.' => 'Brak uprawnień do edycji tej tabeli',
'E-mail' => 'E-mail', 'E-mail' => 'E-mail',
'From' => 'Nadawca', 'From' => 'Nadawca',
@@ -348,11 +338,21 @@ $translations = array(
'Type has been created.' => 'Typ został utworzony.', 'Type has been created.' => 'Typ został utworzony.',
'Alter type' => 'Zmień typ', 'Alter type' => 'Zmień typ',
// Table check constraints 'overwrite' => null,
'Checks' => 'Kontrole', 'DB' => null,
'Create check' => 'Utwórz kontrolę', 'Warnings' => null,
'Alter check' => 'Zmień kontrolę', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Check has been created.' => 'Kontrola została utworzona.', 'The action will be performed after successful login with the same credentials.' => null,
'Check has been altered.' => 'Kontrola została zmieniona.', 'There is a space in the input password which might be the cause.' => null,
'Check has been dropped.' => 'Kontrola została usunięta.', 'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Tak',
'No' => 'Nie',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Entrar', 'Login' => 'Entrar',
'Logout successful.' => 'Saída bem sucedida.', 'Logout successful.' => 'Saída bem sucedida.',
'Invalid credentials.' => 'Identificação inválida.', 'Invalid server or credentials.' => null,
'Server' => 'Servidor', 'Server' => 'Servidor',
'Username' => 'Usuário', 'Username' => 'Usuário',
'Password' => 'Senha', 'Password' => 'Senha',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Criar Base de dados', 'Create database' => 'Criar Base de dados',
'SQL command' => 'Comando SQL', 'SQL command' => 'Comando SQL',
'Logout' => 'Sair', 'Logout' => 'Sair',
'database' => 'base de dados',
'Use' => 'Usar', 'Use' => 'Usar',
'No tables.' => 'Não existem tabelas.', 'No tables.' => 'Não existem tabelas.',
'select' => 'selecionar', 'select' => 'selecionar',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'Tipo de índice', 'Index Type' => 'Tipo de índice',
'length' => 'tamanho', 'Column (length)' => 'Coluna (tamanho)',
'View has been dropped.' => 'A Visão foi apagada.', 'View has been dropped.' => 'A Visão foi apagada.',
'View has been altered.' => 'A Visão foi alterada.', 'View has been altered.' => 'A Visão foi alterada.',
'View has been created.' => 'A Visão foi criada.', 'View has been created.' => 'A Visão foi criada.',
@@ -261,4 +260,54 @@ $translations = array(
'Please use one of the extensions %s.' => 'Por favor use uma das extensões %s.', 'Please use one of the extensions %s.' => 'Por favor use uma das extensões %s.',
'now' => 'agora', 'now' => 'agora',
'ltr' => 'ltr', 'ltr' => 'ltr',
'Drop %s?' => null,
'Tables have been copied.' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'Copy' => null,
'overwrite' => null,
'DB' => null,
'Permanent link' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Edit all' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'HH:MM:SS' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Entrar', 'Login' => 'Entrar',
'Logout successful.' => 'Sessão terminada com sucesso.', 'Logout successful.' => 'Sessão terminada com sucesso.',
'Invalid credentials.' => 'Identificação inválida.', 'Invalid server or credentials.' => null,
'Server' => 'Servidor', 'Server' => 'Servidor',
'Username' => 'Nome de utilizador', 'Username' => 'Nome de utilizador',
'Password' => 'Senha', 'Password' => 'Senha',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Criar Base de dados', 'Create database' => 'Criar Base de dados',
'SQL command' => 'Comando SQL', 'SQL command' => 'Comando SQL',
'Logout' => 'Terminar sessão', 'Logout' => 'Terminar sessão',
'database' => 'base de dados',
'Use' => 'Usar', 'Use' => 'Usar',
'No tables.' => 'Não existem tabelas.', 'No tables.' => 'Não existem tabelas.',
'select' => 'registos', 'select' => 'registos',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'Tipo de índice', 'Index Type' => 'Tipo de índice',
'length' => 'tamanho', 'Column (length)' => 'coluna (tamanho)',
'View has been dropped.' => 'Vista eliminada.', 'View has been dropped.' => 'Vista eliminada.',
'View has been altered.' => 'Vista modificada.', 'View has been altered.' => 'Vista modificada.',
'View has been created.' => 'Vista criada.', 'View has been created.' => 'Vista criada.',
@@ -261,4 +260,54 @@ $translations = array(
'Please use one of the extensions %s.' => 'Por favor use uma das extensões %s.', 'Please use one of the extensions %s.' => 'Por favor use uma das extensões %s.',
'now' => 'agora', 'now' => 'agora',
'ltr' => 'ltr', 'ltr' => 'ltr',
'Drop %s?' => null,
'Tables have been copied.' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'Copy' => null,
'overwrite' => null,
'DB' => null,
'Permanent link' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Edit all' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'HH:MM:SS' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Intră', 'Login' => 'Intră',
'Logout successful.' => 'Ați ieșit cu succes.', 'Logout successful.' => 'Ați ieșit cu succes.',
'Invalid credentials.' => 'Numele de utilizator sau parola este greșită.', 'Invalid server or credentials.' => null,
'Server' => 'Server', 'Server' => 'Server',
'Username' => 'Nume de utilizator', 'Username' => 'Nume de utilizator',
'Password' => 'Parola', 'Password' => 'Parola',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Crează baza de date', 'Create database' => 'Crează baza de date',
'SQL command' => 'SQL query', 'SQL command' => 'SQL query',
'Logout' => 'Ieșire', 'Logout' => 'Ieșire',
'database' => 'baza de date',
'Use' => 'Alege', 'Use' => 'Alege',
'No tables.' => 'În baza de date nu sunt tabele.', 'No tables.' => 'În baza de date nu sunt tabele.',
'select' => 'selectează', 'select' => 'selectează',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'La ștergere', 'ON DELETE' => 'La ștergere',
'ON UPDATE' => 'La modificare', 'ON UPDATE' => 'La modificare',
'Index Type' => 'Tipul indexului', 'Index Type' => 'Tipul indexului',
'length' => 'lungimea', 'Column (length)' => 'Coloană (lungimea)',
'View has been dropped.' => 'Reprezentarea a fost ștearsă.', 'View has been dropped.' => 'Reprezentarea a fost ștearsă.',
'View has been altered.' => 'Reprezentarea a fost modificată.', 'View has been altered.' => 'Reprezentarea a fost modificată.',
'View has been created.' => 'Reprezentarea a fost creată.', 'View has been created.' => 'Reprezentarea a fost creată.',
@@ -261,9 +260,54 @@ $translations = array(
'Please use one of the extensions %s.' => 'Folosiți una din următoarele extensii %s.', 'Please use one of the extensions %s.' => 'Folosiți una din următoarele extensii %s.',
'now' => 'acum', 'now' => 'acum',
'ltr' => 'ltr', 'ltr' => 'ltr',
'Tables have been copied.' => 'Tabelele au fost copiate.', 'Tables have been copied.' => 'Tabelele au fost copiate',
'Copy' => 'Copiază', 'Copy' => 'Copiază',
'Permanent link' => 'Adresă permanentă', 'Permanent link' => 'Adresă permanentă',
'Edit all' => 'Editează tot', 'Edit all' => 'Editează tot',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Войти', 'Login' => 'Войти',
'Logout successful.' => 'Вы успешно покинули систему.', 'Logout successful.' => 'Вы успешно покинули систему.',
'Invalid credentials.' => 'Неправильное имя пользователя или пароль.', 'Invalid server or credentials.' => null,
'Server' => 'Сервер', 'Server' => 'Сервер',
'Username' => 'Имя пользователя', 'Username' => 'Имя пользователя',
'Password' => 'Пароль', 'Password' => 'Пароль',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'Создать базу данных', 'Create database' => 'Создать базу данных',
'SQL command' => 'SQL-запрос', 'SQL command' => 'SQL-запрос',
'Logout' => 'Выйти', 'Logout' => 'Выйти',
'database' => 'база данных',
'Use' => 'Выбрать', 'Use' => 'Выбрать',
'No tables.' => 'В базе данных нет таблиц.', 'No tables.' => 'В базе данных нет таблиц.',
'select' => 'выбрать', 'select' => 'выбрать',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'При стирании', 'ON DELETE' => 'При стирании',
'ON UPDATE' => 'При обновлении', 'ON UPDATE' => 'При обновлении',
'Index Type' => 'Тип индекса', 'Index Type' => 'Тип индекса',
'length' => 'длина', 'Column (length)' => 'Поле (длина)',
'View has been dropped.' => 'Представление было удалено.', 'View has been dropped.' => 'Представление было удалено.',
'View has been altered.' => 'Представление было изменено.', 'View has been altered.' => 'Представление было изменено.',
'View has been created.' => 'Представление было создано.', 'View has been created.' => 'Представление было создано.',
@@ -288,8 +287,8 @@ $translations = array(
'You are offline.' => 'Вы не выполнили вход.', 'You are offline.' => 'Вы не выполнили вход.',
'You have no privileges to update this table.' => 'У вас нет прав на обновление этой таблицы.', 'You have no privileges to update this table.' => 'У вас нет прав на обновление этой таблицы.',
'Saving' => 'Сохранение', 'Saving' => 'Сохранение',
'yes' => 'Да', 'yes' => 'да',
'no' => 'Нет', 'no' => 'нет',
'Drop %s?' => 'Удалить %s?', 'Drop %s?' => 'Удалить %s?',
'overwrite' => 'перезаписать', 'overwrite' => 'перезаписать',
'DB' => 'DB', 'DB' => 'DB',
@@ -301,5 +300,14 @@ $translations = array(
'There is a space in the input password which might be the cause.' => 'В введеном пароле есть пробел, это может быть причиною.', 'There is a space in the input password which might be the cause.' => 'В введеном пароле есть пробел, это может быть причиною.',
'Unknown error.' => 'Неизвестная ошибка.', 'Unknown error.' => 'Неизвестная ошибка.',
'Database does not support password.' => 'База данных не поддерживает пароль.', 'Database does not support password.' => 'База данных не поддерживает пароль.',
'Disable %s or enable %s or %s extensions.' => 'Отключите %s или включите расширения %s или %s.', 'Disable %s or enable %s or %s extensions.' => 'Отключите %s или включите расширения %s или %s.',
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Да',
'No' => 'Нет',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'Prihlásiť sa', 'Login' => 'Prihlásiť sa',
'Logout successful.' => 'Odhlásenie prebehlo v poriadku.', 'Logout successful.' => 'Odhlásenie prebehlo v poriadku.',
'Invalid credentials.' => 'Neplatné prihlasovacie údaje.', 'Invalid server or credentials.' => 'Neplatný server alebo prihlasovacie údaje.',
'Server' => 'Server', 'Server' => 'Server',
'Username' => 'Používateľ', 'Username' => 'Používateľ',
'Password' => 'Heslo', 'Password' => 'Heslo',
@@ -34,6 +32,7 @@ $translations = array(
'Create database' => 'Vytvoriť databázu', 'Create database' => 'Vytvoriť databázu',
'SQL command' => 'SQL príkaz', 'SQL command' => 'SQL príkaz',
'Logout' => 'Odhlásiť', 'Logout' => 'Odhlásiť',
'database' => 'databáza',
'Use' => 'Vybrať', 'Use' => 'Vybrať',
'No tables.' => 'Žiadne tabuľky.', 'No tables.' => 'Žiadne tabuľky.',
'select' => 'vypísať', 'select' => 'vypísať',
@@ -98,7 +97,7 @@ $translations = array(
'ON DELETE' => 'Pri zmazaní', 'ON DELETE' => 'Pri zmazaní',
'ON UPDATE' => 'Pri aktualizácii', 'ON UPDATE' => 'Pri aktualizácii',
'Index Type' => 'Typ indexu', 'Index Type' => 'Typ indexu',
'length' => 'dĺžka', 'Column (length)' => 'Stĺpec (dĺžka)',
'View has been dropped.' => 'Pohľad bol odstránený.', 'View has been dropped.' => 'Pohľad bol odstránený.',
'View has been altered.' => 'Pohľad bol zmenený.', 'View has been altered.' => 'Pohľad bol zmenený.',
'View has been created.' => 'Pohľad bol vytvorený.', 'View has been created.' => 'Pohľad bol vytvorený.',
@@ -275,8 +274,8 @@ $translations = array(
'DB' => 'DB', 'DB' => 'DB',
'File must be in UTF-8 encoding.' => 'Súbor musí byť v kódovaní UTF-8.', 'File must be in UTF-8 encoding.' => 'Súbor musí byť v kódovaní UTF-8.',
'Modify' => 'Zmeniť', 'Modify' => 'Zmeniť',
'Load more data' => 'Načítať ďalšie dáta', 'Load more data' => 'Nahráť ďalšie dáta',
'Loading' => 'Načítava sa', 'Loading' => 'Nahráva sa',
'ATTACH queries are not supported.' => 'Dotazy ATTACH nie sú podporované.', 'ATTACH queries are not supported.' => 'Dotazy ATTACH nie sú podporované.',
'Warnings' => 'Varovania', 'Warnings' => 'Varovania',
'%d / ' => '%d / ', '%d / ' => '%d / ',
@@ -289,7 +288,7 @@ $translations = array(
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Platnosť hlavného hesla vypršala. <a href="https://www.adminer.org/cs/extension/"%s>Implementujte</a> metodu %s, aby platilo natrvalo.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Platnosť hlavného hesla vypršala. <a href="https://www.adminer.org/cs/extension/"%s>Implementujte</a> metodu %s, aby platilo natrvalo.',
'The action will be performed after successful login with the same credentials.' => 'Akcia sa vykoná po úspešnom prihlásení s rovnakými prihlasovacími údajmi.', 'The action will be performed after successful login with the same credentials.' => 'Akcia sa vykoná po úspešnom prihlásení s rovnakými prihlasovacími údajmi.',
'Connecting to privileged ports is not allowed.' => 'Pripojenie k privilegovaným portom nie je povolené.', 'Connecting to privileged ports is not allowed.' => 'Pripojenie k privilegovaným portom nie je povolené.',
'There is a space in the input password which might be the cause.' => 'V zadanom hesle je medzera, ktorá môže byť príčinou.', 'There is a space in the input password which might be the cause.' => 'V zadanom hesle je medzera, ktorá môže byť príčinou.',
'If you did not send this request from Adminer then close this page.' => 'Pokiaľ ste tento požiadavok neodoslali z Adminera, zatvorte túto stránku.', 'If you did not send this request from Adminer then close this page.' => 'Pokiaľ ste tento požiadavok neodoslali z Adminera, zatvorte túto stránku.',
'You can upload a big SQL file via FTP and import it from server.' => 'Veľký SQL soubor môžete nahrať pomocou FTP a importovať ho zo servera.', 'You can upload a big SQL file via FTP and import it from server.' => 'Veľký SQL soubor môžete nahrať pomocou FTP a importovať ho zo servera.',
'Size' => 'Veľkosť', 'Size' => 'Veľkosť',
@@ -302,4 +301,11 @@ $translations = array(
'Disable %s or enable %s or %s extensions.' => 'Zakážte %s alebo povoľte rozšírenie %s alebo %s.', 'Disable %s or enable %s or %s extensions.' => 'Zakážte %s alebo povoľte rozšírenie %s alebo %s.',
'yes' => 'áno', 'yes' => 'áno',
'no' => 'nie', 'no' => 'nie',
'Yes' => 'Áno',
'No' => 'Nie',
'Columns' => 'Stĺpce',
'Nullable' => 'Povolené null',
'Default' => 'Predvolené',
'One Time Password' => 'Jednorázové heslo',
'Invalid OTP code.' => 'Neplatný kód OTP.',
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem', 'System' => 'Sistem',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'Odjavi se', 'Logout' => 'Odjavi se',
'Logged as: %s' => 'Prijavljen kot: %s', 'Logged as: %s' => 'Prijavljen kot: %s',
'Logout successful.' => 'Prijava uspešna.', 'Logout successful.' => 'Prijava uspešna.',
'Invalid credentials.' => 'Neveljavne pravice.', 'Invalid server or credentials.' => 'Neveljaven strežnik ali pravice.',
'Language' => 'Jezik', 'Language' => 'Jezik',
'Invalid CSRF token. Send the form again.' => 'Neveljaven token CSRF. Pošljite formular še enkrat.', 'Invalid CSRF token. Send the form again.' => 'Neveljaven token CSRF. Pošljite formular še enkrat.',
'No extension' => 'Brez dodatkov', 'No extension' => 'Brez dodatkov',
@@ -74,6 +72,7 @@ $translations = array(
'Data' => 'Podatki', 'Data' => 'Podatki',
'Database' => 'Baza', 'Database' => 'Baza',
'database' => 'baza',
'Use' => 'Uporabi', 'Use' => 'Uporabi',
'Select database' => 'Izberi bazo', 'Select database' => 'Izberi bazo',
'Invalid database.' => 'Neveljavna baza.', 'Invalid database.' => 'Neveljavna baza.',
@@ -179,7 +178,7 @@ $translations = array(
'Alter indexes' => 'Spremeni indekse', 'Alter indexes' => 'Spremeni indekse',
'Add next' => 'Dodaj naslednjega', 'Add next' => 'Dodaj naslednjega',
'Index Type' => 'Tip indeksa', 'Index Type' => 'Tip indeksa',
'length' => 'dolžina', 'Column (length)' => 'Stolpec (dolžina)',
'Foreign keys' => 'Tuji ključi', 'Foreign keys' => 'Tuji ključi',
'Foreign key' => 'Tuj ključ', 'Foreign key' => 'Tuj ključ',
@@ -305,4 +304,52 @@ $translations = array(
'Type has been dropped.' => 'Tip je zavržen.', 'Type has been dropped.' => 'Tip je zavržen.',
'Type has been created.' => 'Tip je ustvarjen.', 'Type has been created.' => 'Tip je ustvarjen.',
'Alter type' => 'Spremeni tip', 'Alter type' => 'Spremeni tip',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'Permanent link' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Edit all' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'HH:MM:SS' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Систем', 'System' => 'Систем',
@@ -12,11 +10,11 @@ $translations = array(
'Logout' => 'Одјава', 'Logout' => 'Одјава',
'Logged as: %s' => 'Пријави се као: %s', 'Logged as: %s' => 'Пријави се као: %s',
'Logout successful.' => 'Успешна одјава.', 'Logout successful.' => 'Успешна одјава.',
'Invalid credentials.' => 'Неважеће дозволе.', 'Invalid server or credentials.' => null,
'Language' => 'Језик', 'Language' => 'Језик',
'Invalid CSRF token. Send the form again.' => 'Неважећи CSRF код. Проследите поново форму.', 'Invalid CSRF token. Send the form again.' => 'Неважећи CSRF код. Проследите поново форму.',
'No extension' => 'Без додатака', 'No extension' => 'Без додатака',
'None of the supported PHP extensions (%s) are available.' => 'Ниједан од подржаних PHP додатака (%s) није доступан.', 'None of the supported PHP extensions (%s) are available.' => 'Ниједан од подржаних PHP додатака није доступан.',
'Session support must be enabled.' => 'Морате омогућити подршку за сесије.', 'Session support must be enabled.' => 'Морате омогућити подршку за сесије.',
'Session expired, please login again.' => 'Ваша сесија је истекла, пријавите се поново.', 'Session expired, please login again.' => 'Ваша сесија је истекла, пријавите се поново.',
'%s version: %s through PHP extension %s' => '%s верзија: %s помоћу PHP додатка је %s', '%s version: %s through PHP extension %s' => '%s верзија: %s помоћу PHP додатка је %s',
@@ -75,6 +73,7 @@ $translations = array(
'Data' => 'Податци', 'Data' => 'Податци',
'Database' => 'База података', 'Database' => 'База података',
'database' => 'база података',
'Use' => 'Користи', 'Use' => 'Користи',
'Select database' => 'Изаберите базу', 'Select database' => 'Изаберите базу',
'Invalid database.' => 'Неисправна база података.', 'Invalid database.' => 'Неисправна база података.',
@@ -184,7 +183,7 @@ $translations = array(
'Alter indexes' => 'Уреди индексе', 'Alter indexes' => 'Уреди индексе',
'Add next' => 'Додај следећи', 'Add next' => 'Додај следећи',
'Index Type' => 'Тип индекса', 'Index Type' => 'Тип индекса',
'length' => 'дужина', 'Column (length)' => 'Колона (дужина)',
'Foreign keys' => 'Страни кључеви', 'Foreign keys' => 'Страни кључеви',
'Foreign key' => 'Страни кључ', 'Foreign key' => 'Страни кључ',
@@ -317,4 +316,43 @@ $translations = array(
'Type has been dropped.' => 'Тип је избрисан.', 'Type has been dropped.' => 'Тип је избрисан.',
'Type has been created.' => 'тип је креиран.', 'Type has been created.' => 'тип је креиран.',
'Alter type' => 'Уреди тип', 'Alter type' => 'Уреди тип',
'Drop %s?' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Да',
'No' => 'Не',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'System', 'System' => 'System',
@@ -13,7 +11,7 @@ $translations = array(
'Logged as: %s' => 'Inloggad som: %s', 'Logged as: %s' => 'Inloggad som: %s',
'Logout successful.' => 'Du är nu utloggad.', 'Logout successful.' => 'Du är nu utloggad.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Tack för att du använder Adminer, vänligen fundera över att <a href="https://www.adminer.org/en/donation/">donera</a>.', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Tack för att du använder Adminer, vänligen fundera över att <a href="https://www.adminer.org/en/donation/">donera</a>.',
'Invalid credentials.' => 'Ogiltiga inloggningsuppgifter.', 'Invalid server or credentials.' => null,
'There is a space in the input password which might be the cause.' => 'Det finns ett mellanslag i lösenordet, vilket kan vara anledningen.', 'There is a space in the input password which might be the cause.' => 'Det finns ett mellanslag i lösenordet, vilket kan vara anledningen.',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer tillåter inte att ansluta till en databas utan lösenord. <a href="https://www.adminer.org/en/password/"%s>Mer information</a>.', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer tillåter inte att ansluta till en databas utan lösenord. <a href="https://www.adminer.org/en/password/"%s>Mer information</a>.',
'Database does not support password.' => 'Databasen stödjer inte lösenord.', 'Database does not support password.' => 'Databasen stödjer inte lösenord.',
@@ -91,6 +89,7 @@ $translations = array(
'Data' => 'Data', 'Data' => 'Data',
'Database' => 'Databas', 'Database' => 'Databas',
'database' => 'databas',
'DB' => 'DB', 'DB' => 'DB',
'Use' => 'Använd', 'Use' => 'Använd',
'Select database' => 'Välj databas', 'Select database' => 'Välj databas',
@@ -208,7 +207,7 @@ $translations = array(
'Alter indexes' => 'Ändra index', 'Alter indexes' => 'Ändra index',
'Add next' => 'Lägg till nästa', 'Add next' => 'Lägg till nästa',
'Index Type' => 'Indextyp', 'Index Type' => 'Indextyp',
'length' => 'längd', 'Column (length)' => 'Kolumn (längd)',
'Foreign keys' => 'Främmande nycklar', 'Foreign keys' => 'Främmande nycklar',
'Foreign key' => 'Främmande nyckel', 'Foreign key' => 'Främmande nyckel',
@@ -347,4 +346,12 @@ $translations = array(
'Type has been dropped.' => 'Typ har, typ, tagits bort.', 'Type has been dropped.' => 'Typ har, typ, tagits bort.',
'Type has been created.' => 'Typ har skapats.', 'Type has been created.' => 'Typ har skapats.',
'Alter type' => 'Ändra typ', 'Alter type' => 'Ändra typ',
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Ja',
'No' => 'Nej',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'நுழை', 'Login' => 'நுழை',
'Logout successful.' => 'வெற்றிக‌ர‌மாய் வெளியேறியாயிற்று.', 'Logout successful.' => 'வெற்றிக‌ர‌மாய் வெளியேறியாயிற்று.',
'Invalid credentials.' => 'ச‌ரியான‌ விப‌ர‌ங்க‌ள் இல்லை.', 'Invalid server or credentials.' => null,
'Server' => 'வ‌ழ‌ங்கி (Server)', 'Server' => 'வ‌ழ‌ங்கி (Server)',
'Username' => 'ப‌ய‌னாள‌ர் (User)', 'Username' => 'ப‌ய‌னாள‌ர் (User)',
'Password' => 'க‌ட‌வுச்சொல்', 'Password' => 'க‌ட‌வுச்சொல்',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'த‌க‌வ‌ல்த‌ள‌த்தை உருவாக்கு', 'Create database' => 'த‌க‌வ‌ல்த‌ள‌த்தை உருவாக்கு',
'SQL command' => 'SQL க‌ட்ட‌ளை', 'SQL command' => 'SQL க‌ட்ட‌ளை',
'Logout' => 'வெளியேறு', 'Logout' => 'வெளியேறு',
'database' => 'த‌க‌வ‌ல்த‌ள‌ம்',
'Use' => 'உப‌யோகி', 'Use' => 'உப‌யோகி',
'No tables.' => 'அட்ட‌வ‌ணை இல்லை.', 'No tables.' => 'அட்ட‌வ‌ணை இல்லை.',
'select' => 'தேர்வு செய்', 'select' => 'தேர்வு செய்',
@@ -95,7 +94,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'அக‌வ‌ரிசை வ‌கை (Index Type)', 'Index Type' => 'அக‌வ‌ரிசை வ‌கை (Index Type)',
'length' => 'நீள‌ம்', 'Column (length)' => 'நெடுவ‌ரிசை (நீள‌ம்)',
'View has been dropped.' => 'தோற்ற‌ம் நீக்க‌ப்ப‌ட்ட‌து.', 'View has been dropped.' => 'தோற்ற‌ம் நீக்க‌ப்ப‌ட்ட‌து.',
'View has been altered.' => 'தோற்றம் மாற்றப்ப‌ட்ட‌து.', 'View has been altered.' => 'தோற்றம் மாற்றப்ப‌ட்ட‌து.',
'View has been created.' => 'தோற்ற‌ம் உருவாக்க‌ப்ப‌ட்ட‌து.', 'View has been created.' => 'தோற்ற‌ம் உருவாக்க‌ப்ப‌ட்ட‌து.',
@@ -229,7 +228,7 @@ $translations = array(
'Create sequence' => 'வ‌ரிசைமுறையை உருவாக்கு', 'Create sequence' => 'வ‌ரிசைமுறையை உருவாக்கு',
'User types' => 'ப‌ய‌னாள‌ர் வ‌கைக‌ள்', 'User types' => 'ப‌ய‌னாள‌ர் வ‌கைக‌ள்',
'Create type' => 'வ‌கையை உருவாக்கு', 'Create type' => 'வ‌கையை உருவாக்கு',
'Item%s has been inserted.' => 'உருப்ப‌டி (Item%s) சேர்க்க‌ப்ப‌ட்ட‌து.', 'Item%s has been inserted.' => 'உருப்ப‌டி (Item) சேர்க்க‌ப்ப‌ட்ட‌து.',
'Schema has been dropped.' => 'அமைப்புமுறை நீக்க‌ப்ப‌ட்ட‌து.', 'Schema has been dropped.' => 'அமைப்புமுறை நீக்க‌ப்ப‌ட்ட‌து.',
'Schema has been created.' => 'அமைப்புமுறை உருவாக்க‌ப்ப‌ட்ட‌து.', 'Schema has been created.' => 'அமைப்புமுறை உருவாக்க‌ப்ப‌ட்ட‌து.',
'Schema has been altered.' => 'அமைப்புமுறை மாற்ற‌ப்ப‌ட்ட‌து.', 'Schema has been altered.' => 'அமைப்புமுறை மாற்ற‌ப்ப‌ட்ட‌து.',
@@ -265,4 +264,50 @@ $translations = array(
'Permanent link' => 'நிரந்தர இணைப்பு', 'Permanent link' => 'நிரந்தர இணைப்பு',
'Edit all' => 'அனைத்தையும் தொகு', 'Edit all' => 'அனைத்தையும் தொகு',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'Ctrl+click on a value to modify it.' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,10 +1,8 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
'Login' => 'เข้าสู่ระบบ', 'Login' => 'เข้าสู่ระบบ',
'Logout successful.' => 'ออกจากระบบเรียบร้อยแล้ว.', 'Logout successful.' => 'ออกจากระบบเรียบร้อยแล้ว.',
'Invalid credentials.' => 'ข้อมูลไม่ถูกต้อง.', 'Invalid server or credentials.' => null,
'Server' => 'เซอเวอร์', 'Server' => 'เซอเวอร์',
'Username' => 'ชื่อผู้ใช้งาน', 'Username' => 'ชื่อผู้ใช้งาน',
'Password' => 'รหัสผ่าน', 'Password' => 'รหัสผ่าน',
@@ -33,6 +31,7 @@ $translations = array(
'Create database' => 'สร้างฐานข้อมูล', 'Create database' => 'สร้างฐานข้อมูล',
'SQL command' => 'คำสั่ง SQL', 'SQL command' => 'คำสั่ง SQL',
'Logout' => 'ออกจากระบบ', 'Logout' => 'ออกจากระบบ',
'database' => 'ฐานข้อมูล',
'Use' => 'ใช้งาน', 'Use' => 'ใช้งาน',
'No tables.' => 'ไม่พบตาราง.', 'No tables.' => 'ไม่พบตาราง.',
'select' => 'เลือก', 'select' => 'เลือก',
@@ -97,7 +96,7 @@ $translations = array(
'ON DELETE' => 'ON DELETE', 'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE', 'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'ชนิดของดัชนี', 'Index Type' => 'ชนิดของดัชนี',
'length' => 'ความยาว', 'Column (length)' => 'คอลัมน์ (ความยาว)',
'View has been dropped.' => 'วิวถูกลบแล้ว.', 'View has been dropped.' => 'วิวถูกลบแล้ว.',
'View has been altered.' => 'วิวถูกเปลี่ยนแปลงแล้ว.', 'View has been altered.' => 'วิวถูกเปลี่ยนแปลงแล้ว.',
'View has been created.' => 'วิวถูกสร้างแล้ว.', 'View has been created.' => 'วิวถูกสร้างแล้ว.',
@@ -266,4 +265,49 @@ $translations = array(
'Permanent link' => 'ลิงค์ถาวร', 'Permanent link' => 'ลิงค์ถาวร',
'Edit all' => 'แก้ไขทั้งหมด', 'Edit all' => 'แก้ไขทั้งหมด',
'HH:MM:SS' => 'HH:MM:SS', 'HH:MM:SS' => 'HH:MM:SS',
'Drop %s?' => null,
'Tables have been optimized.' => null,
'Materialized view' => null,
'Vacuum' => null,
'Selected' => null,
'overwrite' => null,
'DB' => null,
'File must be in UTF-8 encoding.' => null,
'Modify' => null,
'Load more data' => null,
'Loading' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Full table scan' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array(),
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You can upload a big SQL file via FTP and import it from server.' => null,
'Size' => null,
'Compute' => null,
'You are offline.' => null,
'You have no privileges to update this table.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'yes' => null,
'no' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem', 'System' => 'Sistem',
@@ -13,7 +11,7 @@ $translations = array(
'Logged as: %s' => '%s olarak giriş yapıldı.', 'Logged as: %s' => '%s olarak giriş yapıldı.',
'Logout successful.' => 'Oturum başarıyla sonlandı.', 'Logout successful.' => 'Oturum başarıyla sonlandı.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Adminer kullandığınız için teşekkür ederiz <a href="https://www.adminer.org/en/donation/">bağış yapmayı düşünün</a>.', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Adminer kullandığınız için teşekkür ederiz <a href="https://www.adminer.org/en/donation/">bağış yapmayı düşünün</a>.',
'Invalid credentials.' => 'Geçersiz kimlik bilgileri.', 'Invalid server or credentials.' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => array('Çok fazla oturum açma denemesi yapıldı.', '%d Dakika sonra tekrar deneyiniz.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Çok fazla oturum açma denemesi yapıldı.', '%d Dakika sonra tekrar deneyiniz.'),
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Ana şifrenin süresi doldu. Kalıcı olması için <a href="https://www.adminer.org/en/extension/"%s>%s medodunu</a> kullanın.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Ana şifrenin süresi doldu. Kalıcı olması için <a href="https://www.adminer.org/en/extension/"%s>%s medodunu</a> kullanın.',
'Language' => 'Dil', 'Language' => 'Dil',
@@ -58,7 +56,7 @@ $translations = array(
'ATTACH queries are not supported.' => 'ATTACH sorguları desteklenmiyor.', 'ATTACH queries are not supported.' => 'ATTACH sorguları desteklenmiyor.',
'Execute' => 'Çalıştır', 'Execute' => 'Çalıştır',
'Stop on error' => 'Hata oluşursa dur', 'Stop on error' => 'Hata oluşursa dur',
'Show only errors' => 'Sadece hataları göster', 'Show only errors' => 'Sadece hataları göster.',
// sprintf() format for time of the command // sprintf() format for time of the command
'%.3f s' => '%.3f s', '%.3f s' => '%.3f s',
'History' => 'Geçmiş', 'History' => 'Geçmiş',
@@ -86,6 +84,7 @@ $translations = array(
'Data' => 'Veri', 'Data' => 'Veri',
'Database' => 'Veri Tabanı', 'Database' => 'Veri Tabanı',
'database' => 'veri tabanı',
'DB' => 'DB', 'DB' => 'DB',
'Use' => 'Kullan', 'Use' => 'Kullan',
'Select database' => 'Veri tabanı seç', 'Select database' => 'Veri tabanı seç',
@@ -202,7 +201,7 @@ $translations = array(
'Alter indexes' => 'İndeksleri değiştir', 'Alter indexes' => 'İndeksleri değiştir',
'Add next' => 'Bundan sonra ekle', 'Add next' => 'Bundan sonra ekle',
'Index Type' => 'İndex Türü', 'Index Type' => 'İndex Türü',
'length' => 'uzunluğu', 'Column (length)' => 'Kolon (uzunluğu)',
'Foreign keys' => 'Dış anahtarlar', 'Foreign keys' => 'Dış anahtarlar',
'Foreign key' => 'Dış anahtar', 'Foreign key' => 'Dış anahtar',
@@ -225,7 +224,7 @@ $translations = array(
'Trigger has been dropped.' => 'Tetik silindi.', 'Trigger has been dropped.' => 'Tetik silindi.',
'Trigger has been altered.' => 'Tetik değiştirildi.', 'Trigger has been altered.' => 'Tetik değiştirildi.',
'Trigger has been created.' => 'Tetik oluşturuldu.', 'Trigger has been created.' => 'Tetik oluşturuldu.',
'Alter trigger' => 'Tetiği değiştir', 'Alter trigger' => 'Tetiği değiştir.',
'Create trigger' => 'Tetik oluştur', 'Create trigger' => 'Tetik oluştur',
'Time' => 'Zaman', 'Time' => 'Zaman',
'Event' => 'Olay', 'Event' => 'Olay',
@@ -341,4 +340,19 @@ $translations = array(
'Type has been dropped.' => 'Tür silindi.', 'Type has been dropped.' => 'Tür silindi.',
'Type has been created.' => 'Tür oluşturuldu.', 'Type has been created.' => 'Tür oluşturuldu.',
'Alter type' => 'Türü değiştir', 'Alter type' => 'Türü değiştir',
'overwrite' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'There is a space in the input password which might be the cause.' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Evet',
'No' => 'Hayır',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Система Бази Даних', 'System' => 'Система Бази Даних',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'Вийти', 'Logout' => 'Вийти',
'Logged as: %s' => 'Ви увійшли як: %s', 'Logged as: %s' => 'Ви увійшли як: %s',
'Logout successful.' => 'Ви вдало вийшли з системи.', 'Logout successful.' => 'Ви вдало вийшли з системи.',
'Invalid credentials.' => 'Неправильні дані входу.', 'Invalid server or credentials.' => null,
'Language' => 'Мова', 'Language' => 'Мова',
'Invalid CSRF token. Send the form again.' => 'Недійсний CSRF токен. Надішліть форму ще раз.', 'Invalid CSRF token. Send the form again.' => 'Недійсний CSRF токен. Надішліть форму ще раз.',
'No extension' => 'Нема розширень', 'No extension' => 'Нема розширень',
@@ -75,6 +73,7 @@ $translations = array(
'Data' => 'Дані', 'Data' => 'Дані',
'Database' => 'База даних', 'Database' => 'База даних',
'database' => 'база даних',
'Use' => 'Обрати', 'Use' => 'Обрати',
'Select database' => 'Обрати базу даних', 'Select database' => 'Обрати базу даних',
'Invalid database.' => 'Погана база даних.', 'Invalid database.' => 'Погана база даних.',
@@ -184,7 +183,7 @@ $translations = array(
'Alter indexes' => 'Змінити індексування', 'Alter indexes' => 'Змінити індексування',
'Add next' => 'Додати ще', 'Add next' => 'Додати ще',
'Index Type' => 'Тип індексу', 'Index Type' => 'Тип індексу',
'length' => 'довжина', 'Column (length)' => 'Стовпець (довжина)',
'Foreign keys' => 'Зовнішні ключі', 'Foreign keys' => 'Зовнішні ключі',
'Foreign key' => 'Зовнішній ключ', 'Foreign key' => 'Зовнішній ключ',
@@ -344,4 +343,16 @@ $translations = array(
'Saving' => 'Збереження', 'Saving' => 'Збереження',
'Unknown error.' => 'Невідома помилка.', 'Unknown error.' => 'Невідома помилка.',
'Database does not support password.' => 'База даних не підтримує пароль.', 'Database does not support password.' => 'База даних не підтримує пароль.',
'Vacuum' => null,
'%d / ' => array(),
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Так',
'No' => 'Ні',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Hệ thống', 'System' => 'Hệ thống',
@@ -12,7 +10,7 @@ $translations = array(
'Logout' => 'Thoát', 'Logout' => 'Thoát',
'Logged as: %s' => 'Vào dưới tên: %s', 'Logged as: %s' => 'Vào dưới tên: %s',
'Logout successful.' => 'Đã thoát xong.', 'Logout successful.' => 'Đã thoát xong.',
'Invalid credentials.' => 'Tài khoản sai.', 'Invalid server or credentials.' => null,
'Too many unsuccessful logins, try again in %d minute(s).' => 'Bạn gõ sai tài khoản quá nhiều lần, hãy thử lại sau %d phút nữa.', 'Too many unsuccessful logins, try again in %d minute(s).' => 'Bạn gõ sai tài khoản quá nhiều lần, hãy thử lại sau %d phút nữa.',
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Mật khẩu đã hết hạn. <a href="https://www.adminer.org/en/extension/"%s>Thử cách làm</a> để giữ cố định.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Mật khẩu đã hết hạn. <a href="https://www.adminer.org/en/extension/"%s>Thử cách làm</a> để giữ cố định.',
'Language' => 'Ngôn ngữ', 'Language' => 'Ngôn ngữ',
@@ -61,7 +59,7 @@ $translations = array(
'File upload' => 'Tải tệp lên', 'File upload' => 'Tải tệp lên',
'From server' => 'Dùng tệp trên máy chủ', 'From server' => 'Dùng tệp trên máy chủ',
'Webserver file %s' => 'Tệp trên máy chủ %s', 'Webserver file %s' => 'Tệp trên máy chủ',
'Run file' => 'Chạy tệp', 'Run file' => 'Chạy tệp',
'File does not exist.' => 'Tệp không tồn tại.', 'File does not exist.' => 'Tệp không tồn tại.',
'File uploads are disabled.' => 'Chức năng tải tệp lên đã bị cấm.', 'File uploads are disabled.' => 'Chức năng tải tệp lên đã bị cấm.',
@@ -78,6 +76,7 @@ $translations = array(
'Data' => 'Dữ liệu', 'Data' => 'Dữ liệu',
'Database' => 'Cơ sở dữ liệu', 'Database' => 'Cơ sở dữ liệu',
'database' => 'cơ sở dữ liệu',
'Use' => 'Sử dụng', 'Use' => 'Sử dụng',
'Select database' => 'Chọn CSDL', 'Select database' => 'Chọn CSDL',
'Invalid database.' => 'CSDL sai.', 'Invalid database.' => 'CSDL sai.',
@@ -189,7 +188,7 @@ $translations = array(
'Alter indexes' => 'Sửa chỉ mục', 'Alter indexes' => 'Sửa chỉ mục',
'Add next' => 'Thêm tiếp', 'Add next' => 'Thêm tiếp',
'Index Type' => 'Loại chỉ mục', 'Index Type' => 'Loại chỉ mục',
'length' => 'độ dài', 'Column (length)' => 'Cột (độ dài)',
'Foreign keys' => 'Các khoá ngoại', 'Foreign keys' => 'Các khoá ngoại',
'Foreign key' => 'Khoá ngoại', 'Foreign key' => 'Khoá ngoại',
@@ -326,4 +325,33 @@ $translations = array(
'Type has been dropped.' => 'Đã xoá kiểu.', 'Type has been dropped.' => 'Đã xoá kiểu.',
'Type has been created.' => 'Đã tạo kiểu.', 'Type has been created.' => 'Đã tạo kiểu.',
'Alter type' => 'Sửa kiểu dữ liệu', 'Alter type' => 'Sửa kiểu dữ liệu',
'Drop %s?' => null,
'Materialized view' => null,
'overwrite' => null,
'DB' => null,
'ATTACH queries are not supported.' => null,
'Warnings' => null,
'%d / ' => array(),
'Limit rows' => null,
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => null,
'Default value' => null,
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => null,
'The action will be performed after successful login with the same credentials.' => null,
'Connecting to privileged ports is not allowed.' => null,
'There is a space in the input password which might be the cause.' => null,
'If you did not send this request from Adminer then close this page.' => null,
'You are offline.' => null,
'Saving' => null,
'Unknown error.' => null,
'Database does not support password.' => null,
'Disable %s or enable %s or %s extensions.' => null,
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => 'Có',
'No' => 'Không',
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => 'Xx', 'System' => 'Xx',
@@ -13,17 +11,16 @@ $translations = array(
'Logged as: %s' => 'Xx: %s', 'Logged as: %s' => 'Xx: %s',
'Logout successful.' => 'Xx.', 'Logout successful.' => 'Xx.',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Xx <a href="https://www.adminer.org/en/donation/">xx</a>.', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => 'Xx <a href="https://www.adminer.org/en/donation/">xx</a>.',
'Invalid credentials.' => 'Xx.', 'Invalid server or credentials.' => 'Xx.',
'There is a space in the input password which might be the cause.' => 'Xx.', 'There is a space in the input password which might be the cause.' => 'Xx.',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Xx, <a href="https://www.adminer.org/en/password/"%s>xx</a>.', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Xx, <a href="https://www.adminer.org/en/password/"%s>xx</a>.',
'Database does not support password.' => 'Xx.', 'Database does not support password.' => 'Xx.',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Xx %d.', 'Xx %d.'), 'Too many unsuccessful logins, try again in %d minute(s).' => array('Xx %d.', 'Xx %d.'),
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => 'Xx. <a href="https://www.adminer.org/en/extension/"%s>Xx</a> %s xx.', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => '<a href="https://www.adminer.org/en/extension/"%s>Xx</a> %s xx.',
'Language' => 'Xx', 'Language' => 'Xx',
'Invalid CSRF token. Send the form again.' => 'Xx.', 'Invalid CSRF token. Send the form again.' => 'Xx.',
'If you did not send this request from Adminer then close this page.' => 'Xx.', 'If you did not send this request from Adminer then close this page.' => 'Xx.',
'No extension' => 'Xx', 'No extension' => 'Xx',
// %s contains the list of the extensions, e.g. 'mysqli, PDO_MySQL'
'None of the supported PHP extensions (%s) are available.' => 'Xx (%s).', 'None of the supported PHP extensions (%s) are available.' => 'Xx (%s).',
'Connecting to privileged ports is not allowed.' => 'Xx.', 'Connecting to privileged ports is not allowed.' => 'Xx.',
'Disable %s or enable %s or %s extensions.' => 'Xx %s xx %s xx %s xx.', 'Disable %s or enable %s or %s extensions.' => 'Xx %s xx %s xx %s xx.',
@@ -34,7 +31,7 @@ $translations = array(
'Refresh' => 'Xx', 'Refresh' => 'Xx',
// text direction - 'ltr' or 'rtl' // text direction - 'ltr' or 'rtl'
'ltr' => 'ltr', 'ltr' => 'xx',
'Privileges' => 'Xx', 'Privileges' => 'Xx',
'Create user' => 'Xx', 'Create user' => 'Xx',
@@ -92,6 +89,7 @@ $translations = array(
'Data' => 'Xx', 'Data' => 'Xx',
'Database' => 'Xx', 'Database' => 'Xx',
'database' => 'xx',
'DB' => 'XX', 'DB' => 'XX',
'Use' => 'Xx', 'Use' => 'Xx',
'Select database' => 'Xx', 'Select database' => 'Xx',
@@ -209,7 +207,7 @@ $translations = array(
'Alter indexes' => 'Xx', 'Alter indexes' => 'Xx',
'Add next' => 'Xx', 'Add next' => 'Xx',
'Index Type' => 'Xx', 'Index Type' => 'Xx',
'length' => 'xx', 'Column (length)' => 'Xx',
'Foreign keys' => 'Xx', 'Foreign keys' => 'Xx',
'Foreign key' => 'Xx', 'Foreign key' => 'Xx',
@@ -255,7 +253,6 @@ $translations = array(
'Full table scan' => 'Xx', 'Full table scan' => 'Xx',
'Unable to select the table' => 'Xx', 'Unable to select the table' => 'Xx',
'No rows.' => 'Xx.', 'No rows.' => 'Xx.',
// used in SQL query limit and it is followed by another number, e.g. '10 / 50 rows' meaning 10 of 50 rows
'%d / ' => '%d / ', '%d / ' => '%d / ',
'%d row(s)' => array('%d xx', '%d xx'), '%d row(s)' => array('%d xx', '%d xx'),
'Page' => 'Xx', 'Page' => 'Xx',
@@ -274,7 +271,7 @@ $translations = array(
'Ctrl+click on a value to modify it.' => 'Xx.', 'Ctrl+click on a value to modify it.' => 'Xx.',
'Use edit link to modify this value.' => 'Xx.', 'Use edit link to modify this value.' => 'Xx.',
// %s can contain auto-increment value, e.g. ' 123' // %s can contain auto-increment value
'Item%s has been inserted.' => 'Xx%s.', 'Item%s has been inserted.' => 'Xx%s.',
'Item has been deleted.' => 'Xx.', 'Item has been deleted.' => 'Xx.',
'Item has been updated.' => 'Xx.', 'Item has been updated.' => 'Xx.',
@@ -350,11 +347,12 @@ $translations = array(
'Type has been created.' => 'Xx.', 'Type has been created.' => 'Xx.',
'Alter type' => 'Xx', 'Alter type' => 'Xx',
// Table check constraints // Plugins
'Checks' => 'Xx', 'Columns' => 'Xx',
'Create check' => 'Xx', 'Nullable' => 'Xx',
'Alter check' => 'Xx', 'Default' => 'Xx',
'Check has been created.' => 'Xx.', 'Yes' => 'Xx',
'Check has been altered.' => 'Xx.', 'No' => 'Xx',
'Check has been dropped.' => 'Xx.', 'One Time Password' => 'Xx',
'Invalid OTP code.' => 'Xx.',
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => '資料庫系統', 'System' => '資料庫系統',
@@ -12,10 +10,10 @@ $translations = array(
'Logout' => '登出', 'Logout' => '登出',
'Logged as: %s' => '登錄為: %s', 'Logged as: %s' => '登錄為: %s',
'Logout successful.' => '成功登出。', 'Logout successful.' => '成功登出。',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => '感謝使用Adminer請考慮為我們<a href="https://www.adminer.org/en/donation/">捐款(英文網頁)</a>', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => '感謝使用Adminer請考慮為我們<a href="https://www.adminer.org/en/donation/">捐款(英文網頁)</a>.',
'Invalid credentials.' => '無效的憑證。', 'Invalid server or credentials.' => null,
'There is a space in the input password which might be the cause.' => '您輸入的密碼中有一個空格,這可能是導致問題的原因。', 'There is a space in the input password which might be the cause.' => '您輸入的密碼中有一個空格,這可能是導致問題的原因。',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer預設不支援訪問沒有密碼的資料庫<a href="https://www.adminer.org/en/password/"%s>詳情見這裡</a>', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer預設不支援訪問沒有密碼的資料庫<a href="https://www.adminer.org/en/password/"%s>詳情見這裡</a>.',
'Database does not support password.' => '資料庫不支援密碼。', 'Database does not support password.' => '資料庫不支援密碼。',
'Too many unsuccessful logins, try again in %d minute(s).' => '登錄失敗次數過多,請 %d 分鐘後重試。', 'Too many unsuccessful logins, try again in %d minute(s).' => '登錄失敗次數過多,請 %d 分鐘後重試。',
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => '主密碼已過期。<a href="https://www.adminer.org/en/extension/"%s>請擴展</a> %s 方法讓它永久化。', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => '主密碼已過期。<a href="https://www.adminer.org/en/extension/"%s>請擴展</a> %s 方法讓它永久化。',
@@ -47,7 +45,7 @@ $translations = array(
'Revoke' => '廢除', 'Revoke' => '廢除',
'Process list' => '處理程序列表', 'Process list' => '處理程序列表',
'%d process(es) have been killed.' => '%d 個 Process(es) 被終止', '%d process(es) have been killed.' => '%d 個 Process(es) 被終止',
'Kill' => '終止', 'Kill' => '終止',
'Variables' => '變數', 'Variables' => '變數',
@@ -74,10 +72,10 @@ $translations = array(
'From server' => '從伺服器', 'From server' => '從伺服器',
'Webserver file %s' => '網頁伺服器檔案 %s', 'Webserver file %s' => '網頁伺服器檔案 %s',
'Run file' => '執行檔案', 'Run file' => '執行檔案',
'File does not exist.' => '檔案不存在', 'File does not exist.' => '檔案不存在',
'File uploads are disabled.' => '檔案上傳已經被停用。', 'File uploads are disabled.' => '檔案上傳已經被停用。',
'Unable to upload a file.' => '無法上傳檔案。', 'Unable to upload a file.' => '無法上傳檔案。',
'Maximum allowed file size is %sB.' => '允許的檔案上限大小為 %sB', 'Maximum allowed file size is %sB.' => '允許的檔案上限大小為 %sB',
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'POST 資料太大。減少資料或者增加 %s 的設定值。', 'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'POST 資料太大。減少資料或者增加 %s 的設定值。',
'You can upload a big SQL file via FTP and import it from server.' => '您可以通過FTP上傳大型SQL檔並從伺服器導入。', 'You can upload a big SQL file via FTP and import it from server.' => '您可以通過FTP上傳大型SQL檔並從伺服器導入。',
'You are offline.' => '您離線了。', 'You are offline.' => '您離線了。',
@@ -91,6 +89,7 @@ $translations = array(
'Data' => '資料', 'Data' => '資料',
'Database' => '資料庫', 'Database' => '資料庫',
'database' => '資料庫',
'DB' => '資料庫', 'DB' => '資料庫',
'Use' => '使用', 'Use' => '使用',
'Select database' => '選擇資料庫', 'Select database' => '選擇資料庫',
@@ -128,11 +127,11 @@ $translations = array(
'Move' => '轉移', 'Move' => '轉移',
'Tables have been moved.' => '已轉移資料表。', 'Tables have been moved.' => '已轉移資料表。',
'Copy' => '複製', 'Copy' => '複製',
'Tables have been copied.' => '資料表已經複製', 'Tables have been copied.' => '資料表已經複製',
'overwrite' => '覆蓋', 'overwrite' => '覆蓋',
'Routines' => '程序', 'Routines' => '程序',
'Routine has been called, %d row(s) affected.' => '程序已被執行,%d 行被影響', 'Routine has been called, %d row(s) affected.' => '程序已被執行,%d 行被影響',
'Call' => '呼叫', 'Call' => '呼叫',
'Parameter name' => '參數名稱', 'Parameter name' => '參數名稱',
'Create procedure' => '建立預存程序', 'Create procedure' => '建立預存程序',
@@ -208,7 +207,7 @@ $translations = array(
'Alter indexes' => '修改索引', 'Alter indexes' => '修改索引',
'Add next' => '新增下一筆', 'Add next' => '新增下一筆',
'Index Type' => '索引類型', 'Index Type' => '索引類型',
'length' => '長度', 'Column (length)' => '欄位(長度',
'Foreign keys' => '外來鍵', 'Foreign keys' => '外來鍵',
'Foreign key' => '外來鍵', 'Foreign key' => '外來鍵',
@@ -274,7 +273,7 @@ $translations = array(
// %s can contain auto-increment value // %s can contain auto-increment value
'Item%s has been inserted.' => '已新增項目 %s。', 'Item%s has been inserted.' => '已新增項目 %s。',
'Item has been deleted.' => '該項目已被刪除', 'Item has been deleted.' => '該項目已被刪除',
'Item has been updated.' => '已更新項目。', 'Item has been updated.' => '已更新項目。',
'%d item(s) have been affected.' => '%d 個項目受到影響。', '%d item(s) have been affected.' => '%d 個項目受到影響。',
'New item' => '新增項目', 'New item' => '新增項目',
@@ -347,4 +346,13 @@ $translations = array(
'Type has been dropped.' => '已刪除類型。', 'Type has been dropped.' => '已刪除類型。',
'Type has been created.' => '已建立類型。', 'Type has been created.' => '已建立類型。',
'Alter type' => '修改類型', 'Alter type' => '修改類型',
// Plugins
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$translations = array( $translations = array(
// label for database system selection (MySQL, SQLite, ...) // label for database system selection (MySQL, SQLite, ...)
'System' => '系统', 'System' => '系统',
@@ -12,10 +10,10 @@ $translations = array(
'Logout' => '登出', 'Logout' => '登出',
'Logged as: %s' => '登录用户:%s', 'Logged as: %s' => '登录用户:%s',
'Logout successful.' => '成功登出。', 'Logout successful.' => '成功登出。',
'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => '感谢使用Adminer请考虑为我们<a href="https://www.adminer.org/en/donation/">捐款(英文页面)</a>', 'Thanks for using Adminer, consider <a href="https://www.adminer.org/en/donation/">donating</a>.' => '感谢使用Adminer请考虑为我们<a href="https://www.adminer.org/en/donation/">捐款(英文页面)</a>.',
'Invalid credentials.' => '无效凭据。', 'Invalid server or credentials.' => null,
'There is a space in the input password which might be the cause.' => '您输入的密码中有一个空格,这可能是导致问题的原因。', 'There is a space in the input password which might be the cause.' => '您输入的密码中有一个空格,这可能是导致问题的原因。',
'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer默认不支持访问没有密码的数据库<a href="https://www.adminer.org/en/password/"%s>详情见这里</a>', 'Adminer does not support accessing a database without a password, <a href="https://www.adminer.org/en/password/"%s>more information</a>.' => 'Adminer默认不支持访问没有密码的数据库<a href="https://www.adminer.org/en/password/"%s>详情见这里</a>.',
'Database does not support password.' => '数据库不支持密码。', 'Database does not support password.' => '数据库不支持密码。',
'Too many unsuccessful logins, try again in %d minute(s).' => '登录失败次数过多,请 %d 分钟后重试。', 'Too many unsuccessful logins, try again in %d minute(s).' => '登录失败次数过多,请 %d 分钟后重试。',
'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => '主密码已过期。<a href="https://www.adminer.org/en/extension/"%s>请扩展</a> %s 方法让它永久化。', 'Master password expired. <a href="https://www.adminer.org/en/extension/"%s>Implement</a> %s method to make it permanent.' => '主密码已过期。<a href="https://www.adminer.org/en/extension/"%s>请扩展</a> %s 方法让它永久化。',
@@ -47,7 +45,7 @@ $translations = array(
'Revoke' => '废除', 'Revoke' => '废除',
'Process list' => '进程列表', 'Process list' => '进程列表',
'%d process(es) have been killed.' => '%d 个进程被终止', '%d process(es) have been killed.' => '%d 个进程被终止',
'Kill' => '终止', 'Kill' => '终止',
'Variables' => '变量', 'Variables' => '变量',
@@ -91,6 +89,7 @@ $translations = array(
'Data' => '数据', 'Data' => '数据',
'Database' => '数据库', 'Database' => '数据库',
'database' => '数据库',
'DB' => '数据库', 'DB' => '数据库',
'Use' => '使用', 'Use' => '使用',
'Select database' => '选择数据库', 'Select database' => '选择数据库',
@@ -208,7 +207,7 @@ $translations = array(
'Alter indexes' => '修改索引', 'Alter indexes' => '修改索引',
'Add next' => '下一行插入', 'Add next' => '下一行插入',
'Index Type' => '索引类型', 'Index Type' => '索引类型',
// 'Column (length)' => '列(长度)', 'Column (length)' => '列(长度)',
'Foreign keys' => '外键', 'Foreign keys' => '外键',
'Foreign key' => '外键', 'Foreign key' => '外键',
@@ -347,4 +346,12 @@ $translations = array(
'Type has been dropped.' => '已删除类型。', 'Type has been dropped.' => '已删除类型。',
'Type has been created.' => '已创建类型。', 'Type has been created.' => '已创建类型。',
'Alter type' => '修改类型', 'Alter type' => '修改类型',
'Columns' => null,
'Nullable' => null,
'Default' => null,
'Yes' => null,
'No' => null,
'One Time Password' => null,
'Invalid OTP code.' => null,
); );

View File

@@ -2,15 +2,15 @@
function adminer_object() { function adminer_object() {
// required to run any plugin // required to run any plugin
include_once "../plugins/plugin.php"; include_once "../plugins/plugin.php";
// autoloader // autoloader
foreach (glob("../plugins/*.php") as $filename) { foreach (glob("../plugins/*.php") as $filename) {
include_once $filename; include_once $filename;
} }
// enable extra drivers just by including them // enable extra drivers just by including them
//~ include "../plugins/drivers/simpledb.php"; //~ include "../plugins/drivers/simpledb.php";
$plugins = array( $plugins = array(
// specify enabled plugins here // specify enabled plugins here
new AdminerDatabaseHide(array('information_schema')), new AdminerDatabaseHide(array('information_schema')),
@@ -20,7 +20,9 @@ function adminer_object() {
new AdminerDumpXml, new AdminerDumpXml,
new AdminerDumpAlter, new AdminerDumpAlter,
//~ new AdminerSqlLog("past-" . rtrim(`git describe --tags --abbrev=0`) . ".sql"), //~ new AdminerSqlLog("past-" . rtrim(`git describe --tags --abbrev=0`) . ".sql"),
//~ new AdminerEditCalendar(script_src("../externals/jquery-ui/jquery-1.4.4.js") . script_src("../externals/jquery-ui/ui/jquery.ui.core.js") . script_src("../externals/jquery-ui/ui/jquery.ui.widget.js") . script_src("../externals/jquery-ui/ui/jquery.ui.datepicker.js") . script_src("../externals/jquery-ui/ui/jquery.ui.mouse.js") . script_src("../externals/jquery-ui/ui/jquery.ui.slider.js") . script_src("../externals/jquery-timepicker/jquery-ui-timepicker-addon.js") . "<link rel='stylesheet' href='../externals/jquery-ui/themes/base/jquery.ui.all.css'>\n<style>\n.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }\n.ui-timepicker-div dl { text-align: left; }\n.ui-timepicker-div dl dt { height: 25px; }\n.ui-timepicker-div dl dd { margin: -25px 0 10px 65px; }\n.ui-timepicker-div td { font-size: 90%; }\n</style>\n", "../externals/jquery-ui/ui/i18n/jquery.ui.datepicker-%s.js"),
//~ new AdminerTinymce("../externals/tinymce/jscripts/tiny_mce/tiny_mce_dev.js"), //~ new AdminerTinymce("../externals/tinymce/jscripts/tiny_mce/tiny_mce_dev.js"),
//~ new AdminerWymeditor(array("../externals/wymeditor/src/jquery/jquery.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.explorer.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.mozilla.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.opera.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.safari.js")),
new AdminerFileUpload(""), new AdminerFileUpload(""),
new AdminerJsonColumn, new AdminerJsonColumn,
new AdminerSlugify, new AdminerSlugify,
@@ -30,13 +32,13 @@ function adminer_object() {
new AdminerTablesFilter, new AdminerTablesFilter,
new AdminerEditForeign, new AdminerEditForeign,
); );
/* It is possible to combine customization and plugins: /* It is possible to combine customization and plugins:
class AdminerCustomization extends AdminerPlugin { class AdminerCustomization extends AdminerPlugin {
} }
return new AdminerCustomization($plugins); return new AdminerCustomization($plugins);
*/ */
return new AdminerPlugin($plugins); return new AdminerPlugin($plugins);
} }

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
page_header(lang('Privileges')); page_header(lang('Privileges'));
echo '<p class="links"><a href="' . h(ME) . 'user=">' . lang('Create user') . "</a>"; echo '<p class="links"><a href="' . h(ME) . 'user=">' . lang('Create user') . "</a>";
@@ -16,15 +14,15 @@ echo "<form action=''><p>\n";
hidden_fields_get(); hidden_fields_get();
echo "<input type='hidden' name='db' value='" . h(DB) . "'>\n"; echo "<input type='hidden' name='db' value='" . h(DB) . "'>\n";
echo ($grant ? "" : "<input type='hidden' name='grant' value=''>\n"); echo ($grant ? "" : "<input type='hidden' name='grant' value=''>\n");
echo "<table class='odds'>\n"; echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Username') . "<th>" . lang('Server') . "<th></thead>\n"; echo "<thead><tr><th>" . lang('Username') . "<th>" . lang('Server') . "<th></thead>\n";
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo '<tr><td>' . h($row["User"]) . "<td>" . h($row["Host"]) . '<td><a href="' . h(ME . 'user=' . urlencode($row["User"]) . '&host=' . urlencode($row["Host"])) . '">' . lang('Edit') . "</a>\n"; echo '<tr' . odd() . '><td>' . h($row["User"]) . "<td>" . h($row["Host"]) . '<td><a href="' . h(ME . 'user=' . urlencode($row["User"]) . '&host=' . urlencode($row["Host"])) . '">' . lang('Edit') . "</a>\n";
} }
if (!$grant || DB != "") { if (!$grant || DB != "") {
echo "<tr><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value='" . lang('Edit') . "'>\n"; echo "<tr" . odd() . "><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value='" . lang('Edit') . "'>\n";
} }
echo "</table>\n"; echo "</table>\n";

View File

@@ -1,7 +1,5 @@
<?php <?php
namespace Adminer; $PROCEDURE = ($_GET["name"] ? $_GET["name"] : $_GET["procedure"]);
$PROCEDURE = ($_GET["name"] ?: $_GET["procedure"]);
$routine = (isset($_GET["function"]) ? "FUNCTION" : "PROCEDURE"); $routine = (isset($_GET["function"]) ? "FUNCTION" : "PROCEDURE");
$row = $_POST; $row = $_POST;
$row["fields"] = (array) $row["fields"]; $row["fields"] = (array) $row["fields"];
@@ -41,12 +39,12 @@ $routine_languages = routine_languages();
<?php echo ($routine_languages ? lang('Language') . ": " . html_select("language", $routine_languages, $row["language"]) . "\n" : ""); ?> <?php echo ($routine_languages ? lang('Language') . ": " . html_select("language", $routine_languages, $row["language"]) . "\n" : ""); ?>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<div class="scrollable"> <div class="scrollable">
<table class="nowrap"> <table cellspacing="0" class="nowrap">
<?php <?php
edit_fields($row["fields"], $collations, $routine); edit_fields($row["fields"], $collations, $routine);
if (isset($_GET["function"])) { if (isset($_GET["function"])) {
echo "<tr><td>" . lang('Return type'); echo "<tr><td>" . lang('Return type');
edit_type("returns", $row["returns"], $collations, array(), (JUSH == "pgsql" ? array("void", "trigger") : array())); edit_type("returns", $row["returns"], $collations, array(), ($jush == "pgsql" ? array("void", "trigger") : array()));
} }
?> ?>
</table> </table>
@@ -55,8 +53,6 @@ if (isset($_GET["function"])) {
<p><?php textarea("definition", $row["definition"]); ?> <p><?php textarea("definition", $row["definition"]); ?>
<p> <p>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($PROCEDURE != "") { ?> <?php if ($PROCEDURE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $PROCEDURE)); ?><?php } ?>
<input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"><?php echo confirm(lang('Drop %s?', $PROCEDURE)); ?>
<?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</form> </form>

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
if (support("kill")) { if (support("kill")) {
if ($_POST && !$error) { if ($_POST && !$error) {
$killed = 0; $killed = 0;
@@ -18,12 +16,13 @@ page_header(lang('Process list'), $error);
<form action="" method="post"> <form action="" method="post">
<div class="scrollable"> <div class="scrollable">
<table class="nowrap checkable odds"> <table cellspacing="0" class="nowrap checkable">
<?php <?php
echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"); echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");
// HTML valid because there is always at least one process // HTML valid because there is always at least one process
$i = -1; $i = -1;
foreach (process_list() as $i => $row) { foreach (process_list() as $i => $row) {
if (!$i) { if (!$i) {
echo "<thead><tr lang='en'>" . (support("kill") ? "<th>" : ""); echo "<thead><tr lang='en'>" . (support("kill") ? "<th>" : "");
foreach ($row as $key => $val) { foreach ($row as $key => $val) {
@@ -35,13 +34,13 @@ foreach (process_list() as $i => $row) {
} }
echo "</thead>\n"; echo "</thead>\n";
} }
echo "<tr>" . (support("kill") ? "<td>" . checkbox("kill[]", $row[JUSH == "sql" ? "Id" : "pid"], 0) : ""); echo "<tr" . odd() . ">" . (support("kill") ? "<td>" . checkbox("kill[]", $row[$jush == "sql" ? "Id" : "pid"], 0) : "");
foreach ($row as $key => $val) { foreach ($row as $key => $val) {
echo "<td>" . ( echo "<td>" . (
(JUSH == "sql" && $key == "Info" && preg_match("~Query|Killed~", $row["Command"]) && $val != "") || ($jush == "sql" && $key == "Info" && preg_match("~Query|Killed~", $row["Command"]) && $val != "") ||
(JUSH == "pgsql" && $key == "current_query" && $val != "<IDLE>") || ($jush == "pgsql" && $key == "current_query" && $val != "<IDLE>") ||
(JUSH == "oracle" && $key == "sql_text" && $val != "") ($jush == "oracle" && $key == "sql_text" && $val != "")
? "<code class='jush-" . JUSH . "'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Clone') . '</a>' ? "<code class='jush-$jush'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Clone') . '</a>'
: h($val) : h($val)
); );
} }

View File

@@ -1,11 +1,9 @@
<?php <?php
namespace Adminer;
page_header(lang('Database schema'), "", array(), h(DB . ($_GET["ns"] ? ".$_GET[ns]" : ""))); page_header(lang('Database schema'), "", array(), h(DB . ($_GET["ns"] ? ".$_GET[ns]" : "")));
$table_pos = array(); $table_pos = array();
$table_pos_js = array(); $table_pos_js = array();
$SCHEMA = ($_GET["schema"] ?: $_COOKIE["adminer_schema-" . str_replace(".", "_", DB)]); // $_COOKIE["adminer_schema"] was used before 3.2.0 //! ':' in table name $SCHEMA = ($_GET["schema"] ? $_GET["schema"] : $_COOKIE["adminer_schema-" . str_replace(".", "_", DB)]); // $_COOKIE["adminer_schema"] was used before 3.2.0 //! ':' in table name
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', $SCHEMA, $matches, PREG_SET_ORDER); preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', $SCHEMA, $matches, PREG_SET_ORDER);
foreach ($matches as $i => $match) { foreach ($matches as $i => $match) {
$table_pos[$match[1]] = array($match[2], $match[3]); $table_pos[$match[1]] = array($match[2], $match[3]);
@@ -28,7 +26,7 @@ foreach (table_status('', true) as $table => $table_status) {
$field["pos"] = $pos; $field["pos"] = $pos;
$schema[$table]["fields"][$name] = $field; $schema[$table]["fields"][$name] = $field;
} }
$schema[$table]["pos"] = ($table_pos[$table] ?: array($top, 0)); $schema[$table]["pos"] = ($table_pos[$table] ? $table_pos[$table] : array($top, 0));
foreach ($adminer->foreignKeys($table) as $val) { foreach ($adminer->foreignKeys($table) as $val) {
if (!$val["db"]) { if (!$val["db"]) {
$left = $base_left; $left = $base_left;
@@ -63,12 +61,12 @@ foreach ($schema as $name => $table) {
echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;'>"; echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;'>";
echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><b>' . h($name) . "</b></a>"; echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><b>' . h($name) . "</b></a>";
echo script("qsl('div').onmousedown = schemaMousedown;"); echo script("qsl('div').onmousedown = schemaMousedown;");
foreach ($table["fields"] as $field) { foreach ($table["fields"] as $field) {
$val = '<span' . type_class($field["type"]) . ' title="' . h($field["full_type"] . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>'; $val = '<span' . type_class($field["type"]) . ' title="' . h($field["full_type"] . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>';
echo "<br>" . ($field["primary"] ? "<i>$val</i>" : $val); echo "<br>" . ($field["primary"] ? "<i>$val</i>" : $val);
} }
foreach ((array) $table["references"] as $target_name => $refs) { foreach ((array) $table["references"] as $target_name => $refs) {
foreach ($refs as $left => $ref) { foreach ($refs as $left => $ref) {
$left1 = $left - $table_pos[$name][1]; $left1 = $left - $table_pos[$name][1];
@@ -78,20 +76,17 @@ foreach ($schema as $name => $table) {
} }
} }
} }
foreach ((array) $referenced[$name] as $target_name => $refs) { foreach ((array) $referenced[$name] as $target_name => $refs) {
foreach ($refs as $left => $columns) { foreach ($refs as $left => $columns) {
$left1 = $left - $table_pos[$name][1]; $left1 = $left - $table_pos[$name][1];
$i = 0; $i = 0;
foreach ($columns as $target) { foreach ($columns as $target) {
echo "\n<div class='references' title='" . h($target_name) . "' id='refd$left-" . ($i++) . "' style='left: $left1" . "em; top: " . $table["fields"][$target]["pos"] . "em; height: 1.25em; background: url(../adminer/static/arrow.gif) no-repeat right center;'>" echo "\n<div class='references' title='" . h($target_name) . "' id='refd$left-" . ($i++) . "' style='left: $left1" . "em; top: " . $table["fields"][$target]["pos"] . "em; height: 1.25em; background: url(../adminer/static/arrow.gif) no-repeat right center;'><div style='height: .5em; border-bottom: 1px solid Gray; width: " . (-$left1) . "em;'></div></div>";
. "<div style='height: .5em; border-bottom: 1px solid Gray; width: " . (-$left1) . "em;'></div>"
. "</div>"
;
} }
} }
} }
echo "\n</div>\n"; echo "\n</div>\n";
} }

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$row = $_POST; $row = $_POST;
if ($_POST && !$error) { if ($_POST && !$error) {
@@ -28,7 +26,8 @@ if (!$row) {
?> ?>
<form action="" method="post"> <form action="" method="post">
<p><input name="name" autofocus value="<?php echo h($row["name"]); ?>" autocapitalize="off"> <p><input name="name" id="name" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
<?php echo script("focus(qs('#name'));"); ?>
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php <?php
if ($_GET["ns"] != "") { if ($_GET["ns"] != "") {

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
header("Content-Type: text/javascript; charset=utf-8"); header("Content-Type: text/javascript; charset=utf-8");
if ($_GET["script"] == "db") { if ($_GET["script"] == "db") {
@@ -14,12 +12,10 @@ if ($_GET["script"] == "db") {
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) { foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
if ($table_status[$key] != "") { if ($table_status[$key] != "") {
$val = format_number($table_status[$key]); $val = format_number($table_status[$key]);
if ($val >= 0) { json_row("$key-$name", ($key == "Rows" && $val && $table_status["Engine"] == ($jush == "pgsql" ? "table" : "InnoDB")
json_row("$key-$name", ($key == "Rows" && $val && $table_status["Engine"] == (JUSH == "pgsql" ? "table" : "InnoDB") ? "~ $val"
? "~ $val" : $val
: $val ));
));
}
if (isset($sums[$key])) { if (isset($sums[$key])) {
// ignore innodb_file_per_table because it is not active for tables created before it was enabled // ignore innodb_file_per_table because it is not active for tables created before it was enabled
$sums[$key] += ($table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0); $sums[$key] += ($table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0);

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$TABLE = $_GET["select"]; $TABLE = $_GET["select"];
$table_status = table_status1($TABLE); $table_status = table_status1($TABLE);
$indexes = indexes($TABLE); $indexes = indexes($TABLE);
@@ -16,25 +14,22 @@ $order_columns = array(); // searchable columns
$text_length = null; $text_length = null;
foreach ($fields as $key => $field) { foreach ($fields as $key => $field) {
$name = $adminer->fieldName($field); $name = $adminer->fieldName($field);
$name_plain = html_entity_decode(strip_tags($name), ENT_QUOTES);
if (isset($field["privileges"]["select"]) && $name != "") { if (isset($field["privileges"]["select"]) && $name != "") {
$columns[$key] = $name_plain; $columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES);
if (is_shortable($field)) { if (is_shortable($field)) {
$text_length = $adminer->selectLengthProcess(); $text_length = $adminer->selectLengthProcess();
} }
} }
if (isset($field["privileges"]["where"]) && $name != "") { if (isset($field["privileges"]["where"]) && $name != "") {
$search_columns[$key] = $name_plain; $search_columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES);
} }
if (isset($field["privileges"]["order"]) && $name != "") { if (isset($field["privileges"]["order"]) && $name != "") {
$order_columns[$key] = $name_plain; $order_columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES);
} }
$rights += $field["privileges"]; $rights += $field["privileges"];
} }
list($select, $group) = $adminer->selectColumnsProcess($columns, $indexes); list($select, $group) = $adminer->selectColumnsProcess($columns, $indexes);
$select = array_unique($select);
$group = array_unique($group);
$is_group = count($group) < count($select); $is_group = count($group) < count($select);
$where = $adminer->selectSearchProcess($fields, $indexes); $where = $adminer->selectSearchProcess($fields, $indexes);
$order = $adminer->selectOrderProcess($fields, $indexes); $order = $adminer->selectOrderProcess($fields, $indexes);
@@ -44,7 +39,7 @@ if ($_GET["val"] && is_ajax()) {
header("Content-Type: text/plain; charset=utf-8"); header("Content-Type: text/plain; charset=utf-8");
foreach ($_GET["val"] as $unique_idf => $row) { foreach ($_GET["val"] as $unique_idf => $row) {
$as = convert_field($fields[key($row)]); $as = convert_field($fields[key($row)]);
$select = array($as ?: idf_escape(key($row))); $select = array($as ? $as : idf_escape(key($row)));
$where[] = where_check($unique_idf, $fields); $where[] = where_check($unique_idf, $fields);
$return = $driver->select($TABLE, $select, $where, $select); $return = $driver->select($TABLE, $select, $where, $select);
if ($return) { if ($return) {
@@ -90,8 +85,9 @@ if ($_POST && !$error) {
. convert_fields($columns, $fields, $select) . convert_fields($columns, $fields, $select)
. "\nFROM " . table($TABLE); . "\nFROM " . table($TABLE);
$group_by = ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : ""); $group_by = ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
$query = "SELECT $from$where_check$group_by"; if (!is_array($_POST["check"]) || $primary) {
if (is_array($_POST["check"]) && !$primary) { $query = "SELECT $from$where_check$group_by";
} else {
$union = array(); $union = array();
foreach ($_POST["check"] as $val) { foreach ($_POST["check"] as $val) {
// where is not unique so OR can't be used // where is not unique so OR can't be used
@@ -109,7 +105,7 @@ if ($_POST && !$error) {
$affected = 0; $affected = 0;
$set = array(); $set = array();
if (!$_POST["delete"]) { if (!$_POST["delete"]) {
foreach ($_POST["fields"] as $name => $val) { foreach ($columns as $name => $val) { //! should check also for edit or insert privileges
$val = process_input($fields[$name]); $val = process_input($fields[$name]);
if ($val !== null && ($_POST["clone"] || $val !== false)) { if ($val !== null && ($_POST["clone"] || $val !== false)) {
$set[idf_escape($name)] = ($val !== false ? $val : idf_escape($name)); $set[idf_escape($name)] = ($val !== false ? $val : idf_escape($name));
@@ -156,8 +152,7 @@ if ($_POST && !$error) {
} }
queries_redirect(remove_from_uri($_POST["all"] && $_POST["delete"] ? "page" : ""), $message, $result); queries_redirect(remove_from_uri($_POST["all"] && $_POST["delete"] ? "page" : ""), $message, $result);
if (!$_POST["delete"]) { if (!$_POST["delete"]) {
$post_fields = (array) $_POST["fields"]; edit_form($TABLE, $fields, (array) $_POST["fields"], !$_POST["clone"]);
edit_form($TABLE, array_intersect_key($fields, $post_fields), $post_fields, !$_POST["clone"]);
page_footer(); page_footer();
exit; exit;
} }
@@ -211,14 +206,14 @@ if ($_POST && !$error) {
} else { } else {
$set = array(); $set = array();
foreach ($matches2[1] as $i => $col) { foreach ($matches2[1] as $i => $col) {
$set[idf_escape($cols[$i])] = ($col == "" && $fields[$cols[$i]]["null"] ? "NULL" : q(preg_match('~^".*"$~s', $col) ? str_replace('""', '"', substr($col, 1, -1)) : $col)); $set[idf_escape($cols[$i])] = ($col == "" && $fields[$cols[$i]]["null"] ? "NULL" : q(str_replace('""', '"', preg_replace('~^"|"$~', '', $col))));
} }
$rows[] = $set; $rows[] = $set;
} }
} }
$result = (!$rows || $driver->insertUpdate($TABLE, $rows, $primary)); $result = (!$rows || $driver->insertUpdate($TABLE, $rows, $primary));
if ($result) { if ($result) {
$driver->commit(); $result = $driver->commit();
} }
queries_redirect(remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result); queries_redirect(remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result);
$driver->rollback(); // after queries_redirect() to not overwrite error $driver->rollback(); // after queries_redirect() to not overwrite error
@@ -237,17 +232,14 @@ if (is_ajax()) {
$set = null; $set = null;
if (isset($rights["insert"]) || !support("table")) { if (isset($rights["insert"]) || !support("table")) {
$params = array(); $set = "";
foreach ((array) $_GET["where"] as $val) { foreach ((array) $_GET["where"] as $val) {
if ( if ($foreign_keys[$val["col"]] && count($foreign_keys[$val["col"]]) == 1 && ($val["op"] == "="
isset($foreign_keys[$val["col"]]) && count($foreign_keys[$val["col"]]) == 1 || (!$val["op"] && !preg_match('~[_%]~', $val["val"])) // LIKE in Editor
&& ($val["op"] == "=" || (!$val["op"] && (is_array($val["val"]) || !preg_match('~[_%]~', $val["val"])))) // LIKE in Editor )) {
) { $set .= "&set" . urlencode("[" . bracket_escape($val["col"]) . "]") . "=" . urlencode($val["val"]);
$params["set" . "[" . bracket_escape($val["col"]) . "]"] = $val["val"];
} }
} }
$set = $params ? "&" . http_build_query($params) : "";
} }
$adminer->selectLinks($table_status, $set); $adminer->selectLinks($table_status, $set);
@@ -270,7 +262,7 @@ if (!$columns && support("table")) {
$page = $_GET["page"]; $page = $_GET["page"];
if ($page == "last") { if ($page == "last") {
$found_rows = get_val(count_rows($TABLE, $where, $is_group, $group)); $found_rows = $connection->result(count_rows($TABLE, $where, $is_group, $group));
$page = floor(max(0, $found_rows - 1) / $limit); $page = floor(max(0, $found_rows - 1) / $limit);
} }
@@ -302,22 +294,22 @@ if (!$columns && support("table")) {
if (!$result) { if (!$result) {
echo "<p class='error'>" . error() . "\n"; echo "<p class='error'>" . error() . "\n";
} else { } else {
if (JUSH == "mssql" && $page) { if ($jush == "mssql" && $page) {
$result->seek($limit * $page); $result->seek($limit * $page);
} }
$email_fields = array(); $email_fields = array();
echo "<form action='' method='post' enctype='multipart/form-data'>\n"; echo "<form action='' method='post' enctype='multipart/form-data'>\n";
$rows = array(); $rows = array();
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
if ($page && JUSH == "oracle") { if ($page && $jush == "oracle") {
unset($row["RNUM"]); unset($row["RNUM"]);
} }
$rows[] = $row; $rows[] = $row;
} }
// use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest) // use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest)
if ($_GET["page"] != "last" && $limit != "" && $group && $is_group && JUSH == "sql") { if ($_GET["page"] != "last" && $limit != "" && $group && $is_group && $jush == "sql") {
$found_rows = get_val(" SELECT FOUND_ROWS()"); // space to allow mysql.trace_mode $found_rows = $connection->result(" SELECT FOUND_ROWS()"); // space to allow mysql.trace_mode
} }
if (!$rows) { if (!$rows) {
@@ -326,7 +318,7 @@ if (!$columns && support("table")) {
$backward_keys = $adminer->backwardKeys($TABLE, $table_name); $backward_keys = $adminer->backwardKeys($TABLE, $table_name);
echo "<div class='scrollable'>"; echo "<div class='scrollable'>";
echo "<table id='table' class='nowrap checkable odds'>"; echo "<table id='table' cellspacing='0' class='nowrap checkable'>";
echo script("mixin(qs('#table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true), onkeydown: editingKeydown});"); echo script("mixin(qs('#table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true), onkeydown: editingKeydown});");
echo "<thead><tr>" . (!$group && $select echo "<thead><tr>" . (!$group && $select
? "" ? ""
@@ -340,7 +332,7 @@ if (!$columns && support("table")) {
if (!isset($unselected[$key])) { if (!isset($unselected[$key])) {
$val = $_GET["columns"][key($select)]; $val = $_GET["columns"][key($select)];
$field = $fields[$select ? ($val ? $val["col"] : current($select)) : $key]; $field = $fields[$select ? ($val ? $val["col"] : current($select)) : $key];
$name = ($field ? $adminer->fieldName($field, $rank) : ($val["fun"] ? "*" : h($key))); $name = ($field ? $adminer->fieldName($field, $rank) : ($val["fun"] ? "*" : $key));
if ($name != "") { if ($name != "") {
$rank++; $rank++;
$names[$key] = $name; $names[$key] = $name;
@@ -349,8 +341,13 @@ if (!$columns && support("table")) {
$desc = "&desc%5B0%5D=1"; $desc = "&desc%5B0%5D=1";
$sortable = isset($field["privileges"]["order"]); $sortable = isset($field["privileges"]["order"]);
echo "<th id='th[" . h(bracket_escape($key)) . "]'>" . script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});", ""); echo "<th id='th[" . h(bracket_escape($key)) . "]'>" . script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});", "");
$fun = apply_sql_function($val["fun"], $name); //! columns looking like functions if ($sortable) {
echo ($sortable ? '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || (!$order && $is_group && $group[0] == $column) ? $desc : '')) . '">' . "$fun</a>" : $fun); // $order[0] == $key - COUNT(*) echo '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || (!$order && $is_group && $group[0] == $column) ? $desc : '')) . '">'; // $order[0] == $key - COUNT(*)
}
echo apply_sql_function($val["fun"], $name); //! columns looking like functions
if ($sortable) {
echo "</a>";
}
echo "<span class='column hidden'>"; echo "<span class='column hidden'>";
if ($sortable) { if ($sortable) {
echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>"; echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>";
@@ -378,6 +375,9 @@ if (!$columns && support("table")) {
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n"; echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
if (is_ajax()) { if (is_ajax()) {
if ($limit % 2 == 1 && $page % 2 == 1) {
odd();
}
ob_end_clean(); ob_end_clean();
} }
@@ -393,14 +393,14 @@ if (!$columns && support("table")) {
} }
$unique_idf = ""; $unique_idf = "";
foreach ($unique_array as $key => $val) { foreach ($unique_array as $key => $val) {
if ((JUSH == "sql" || JUSH == "pgsql") && preg_match('~char|text|enum|set~', $fields[$key]["type"]) && strlen($val) > 64) { if (($jush == "sql" || $jush == "pgsql") && preg_match('~char|text|enum|set~', $fields[$key]["type"]) && strlen($val) > 64) {
$key = (strpos($key, '(') ? $key : idf_escape($key)); //! columns looking like functions $key = (strpos($key, '(') ? $key : idf_escape($key)); //! columns looking like functions
$key = "MD5(" . (JUSH != 'sql' || preg_match("~^utf8~", $fields[$key]["collation"]) ? $key : "CONVERT($key USING " . charset($connection) . ")") . ")"; $key = "MD5(" . ($jush != 'sql' || preg_match("~^utf8~", $fields[$key]["collation"]) ? $key : "CONVERT($key USING " . charset($connection) . ")") . ")";
$val = md5($val); $val = md5($val);
} }
$unique_idf .= "&" . ($val !== null ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val === false ? "f" : $val) : "null%5B%5D=" . urlencode($key)); $unique_idf .= "&" . ($val !== null ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val === false ? "f" : $val) : "null%5B%5D=" . urlencode($key));
} }
echo "<tr>" . (!$group && $select ? "" : "<td>" echo "<tr" . odd() . ">" . (!$group && $select ? "" : "<td>"
. checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"])) . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]))
. ($is_group || information_schema(DB) ? "" : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "' class='edit'>" . lang('edit') . "</a>") . ($is_group || information_schema(DB) ? "" : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "' class='edit'>" . lang('edit') . "</a>")
); );
@@ -446,11 +446,11 @@ if (!$columns && support("table")) {
$link .= where_link($i++, $k, $v); $link .= where_link($i++, $k, $v);
} }
} }
$val = select_value($val, $link, $field, $text_length); $val = select_value($val, $link, $field, $text_length);
$id = h("val[$unique_idf][" . bracket_escape($key) . "]"); $id = h("val[$unique_idf][" . bracket_escape($key) . "]");
$value = $_POST["val"][$unique_idf][bracket_escape($key)]; $value = $_POST["val"][$unique_idf][bracket_escape($key)];
$editable = !is_array($row[$key]) && is_utf8($val) && $rows[$n][$key] == $row[$key] && !$functions[$key] && !$field["generated"]; $editable = !is_array($row[$key]) && is_utf8($val) && $rows[$n][$key] == $row[$key] && !$functions[$key];
$text = preg_match('~text|lob~', $field["type"]); $text = preg_match('~text|lob~', $field["type"]);
echo "<td id='$id'"; echo "<td id='$id'";
if (($_GET["modify"] && $editable) || $value !== null) { if (($_GET["modify"] && $editable) || $value !== null) {
@@ -460,7 +460,7 @@ if (!$columns && support("table")) {
$long = strpos($val, "<i>…</i>"); $long = strpos($val, "<i>…</i>");
echo " data-text='" . ($long ? 2 : ($text ? 1 : 0)) . "'" echo " data-text='" . ($long ? 2 : ($text ? 1 : 0)) . "'"
. ($editable ? "" : " data-warning='" . h(lang('Use edit link to modify this value.')) . "'") . ($editable ? "" : " data-warning='" . h(lang('Use edit link to modify this value.')) . "'")
. ">$val" . ">$val</td>"
; ;
} }
} }
@@ -486,7 +486,7 @@ if (!$columns && support("table")) {
if ($_GET["page"] != "last") { if ($_GET["page"] != "last") {
if ($limit == "" || (count($rows) < $limit && ($rows || !$page))) { if ($limit == "" || (count($rows) < $limit && ($rows || !$page))) {
$found_rows = ($page ? $page * $limit : 0) + count($rows); $found_rows = ($page ? $page * $limit : 0) + count($rows);
} elseif (JUSH != "sql" || !$is_group) { } elseif ($jush != "sql" || !$is_group) {
$found_rows = ($is_group ? false : found_rows($table_status, $where)); $found_rows = ($is_group ? false : found_rows($table_status, $where));
if ($found_rows < max(1e4, 2 * ($page + 1) * $limit)) { if ($found_rows < max(1e4, 2 * ($page + 1) * $limit)) {
// slow with big tables // slow with big tables
@@ -507,7 +507,7 @@ if (!$columns && support("table")) {
echo "\n"; echo "\n";
} }
} }
echo "<div class='footer'><div>\n"; echo "<div class='footer'><div>\n";
if ($rows || $page) { if ($rows || $page) {
if ($pagination) { if ($pagination) {
@@ -517,7 +517,7 @@ if (!$columns && support("table")) {
: floor(($found_rows - 1) / $limit) : floor(($found_rows - 1) / $limit)
); );
echo "<fieldset>"; echo "<fieldset>";
if (JUSH != "simpledb") { if ($jush != "simpledb") {
echo "<legend><a href='" . h(remove_from_uri("page")) . "'>" . lang('Page') . "</a></legend>"; echo "<legend><a href='" . h(remove_from_uri("page")) . "'>" . lang('Page') . "</a></legend>";
echo script("qsl('a').onclick = function () { pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "')); return false; };"); echo script("qsl('a').onclick = function () { pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "')); return false; };");
echo pagination(0, $page) . ($page > 5 ? "" : ""); echo pagination(0, $page) . ($page > 5 ? "" : "");
@@ -539,12 +539,11 @@ if (!$columns && support("table")) {
} }
echo "</fieldset>\n"; echo "</fieldset>\n";
} }
echo "<fieldset>"; echo "<fieldset>";
echo "<legend>" . lang('Whole result') . "</legend>"; echo "<legend>" . lang('Whole result') . "</legend>";
$display_rows = ($exact_count ? "" : "~ ") . $found_rows; $display_rows = ($exact_count ? "" : "~ ") . $found_rows;
$onclick = "var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$display_rows' : checked); selectCount('selected2', this.checked || !checked ? '$display_rows' : checked);"; echo checkbox("all", 1, 0, ($found_rows !== false ? ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) : ""), "var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$display_rows' : checked); selectCount('selected2', this.checked || !checked ? '$display_rows' : checked);") . "\n";
echo checkbox("all", 1, 0, ($found_rows !== false ? ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) : ""), $onclick) . "\n";
echo "</fieldset>\n"; echo "</fieldset>\n";
if ($adminer->selectCommandPrint()) { if ($adminer->selectCommandPrint()) {
@@ -569,9 +568,9 @@ if (!$columns && support("table")) {
} }
if ($format) { if ($format) {
print_fieldset("export", lang('Export') . " <span id='selected2'></span>"); print_fieldset("export", lang('Export') . " <span id='selected2'></span>");
$output = $adminer->dumpOutput();
echo ($output ? html_select("output", $output, $adminer_import["output"]) . " " : "");
echo html_select("format", $format, $adminer_import["format"]); echo html_select("format", $format, $adminer_import["format"]);
$output = $adminer->dumpOutput();
echo ($output ? " " . html_select("output", $output, $adminer_import["output"]) : "");
echo " <input type='submit' name='export' value='" . lang('Export') . "'>\n"; echo " <input type='submit' name='export' value='" . lang('Export') . "'>\n";
echo "</div></fieldset>\n"; echo "</div></fieldset>\n";
} }
@@ -585,9 +584,9 @@ if (!$columns && support("table")) {
echo "<div>"; echo "<div>";
echo "<a href='#import'>" . lang('Import') . "</a>"; echo "<a href='#import'>" . lang('Import') . "</a>";
echo script("qsl('a').onclick = partial(toggle, 'import');", ""); echo script("qsl('a').onclick = partial(toggle, 'import');", "");
echo "<span id='import'" . ($_POST["import"] ? "" : " class='hidden'") . ">: "; echo "<span id='import' class='hidden'>: ";
echo "<input type='file' name='csv_file'> "; echo "<input type='file' name='csv_file'> ";
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_import["format"], 1); // 1 - select echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_import["format"]);
echo " <input type='submit' name='import' value='" . lang('Import') . "'>"; echo " <input type='submit' name='import' value='" . lang('Import') . "'>";
echo "</span>"; echo "</span>";
echo "</div>"; echo "</div>";

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
$SEQUENCE = $_GET["sequence"]; $SEQUENCE = $_GET["sequence"];
$row = $_POST; $row = $_POST;

View File

@@ -1,6 +1,4 @@
<?php <?php
namespace Adminer;
if (!$error && $_POST["export"]) { if (!$error && $_POST["export"]) {
dump_headers("sql"); dump_headers("sql");
$adminer->dumpTable("", ""); $adminer->dumpTable("", "");
@@ -34,8 +32,8 @@ if (!$error && $_POST) {
} }
if (is_string($query)) { // get_file() returns error as number, fread() as false if (is_string($query)) { // get_file() returns error as number, fread() as false
if (function_exists('memory_get_usage') && ($memory_limit = ini_bytes("memory_limit")) != "-1") { if (function_exists('memory_get_usage')) {
@ini_set("memory_limit", max($memory_limit, 2 * strlen($query) + memory_get_usage() + 8e6)); // @ - may be disabled, 2 - substr and trim, 8e6 - other variables @ini_set("memory_limit", max(ini_bytes("memory_limit"), 2 * strlen($query) + memory_get_usage() + 8e6)); // @ - may be disabled, 2 - substr and trim, 8e6 - other variables
} }
if ($query != "" && strlen($query) < 1e6) { // don't add big queries if ($query != "" && strlen($query) < 1e6) { // don't add big queries
@@ -52,7 +50,7 @@ if (!$error && $_POST) {
$delimiter = ";"; $delimiter = ";";
$offset = 0; $offset = 0;
$empty = true; $empty = true;
$connection2 = connect($adminer->credentials()); // connection for exploring indexes and EXPLAIN (to not replace FOUND_ROWS()) //! PDO - silent error $connection2 = connect(); // connection for exploring indexes and EXPLAIN (to not replace FOUND_ROWS()) //! PDO - silent error
if (is_object($connection2) && DB != "") { if (is_object($connection2) && DB != "") {
$connection2->select_db(DB); $connection2->select_db(DB);
if ($_GET["ns"] != "") { if ($_GET["ns"] != "") {
@@ -61,7 +59,7 @@ if (!$error && $_POST) {
} }
$commands = 0; $commands = 0;
$errors = array(); $errors = array();
$parse = '[\'"' . (JUSH == "sql" ? '`#' : (JUSH == "sqlite" ? '`[' : (JUSH == "mssql" ? '[' : ''))) . ']|/\*|-- |$' . (JUSH == "pgsql" ? '|\$[^$]*\$' : ''); $parse = '[\'"' . ($jush == "sql" ? '`#' : ($jush == "sqlite" ? '`[' : ($jush == "mssql" ? '[' : ''))) . ']|/\*|-- |$' . ($jush == "pgsql" ? '|\$[^$]*\$' : '');
$total_start = microtime(true); $total_start = microtime(true);
parse_str($_COOKIE["adminer_export"], $adminer_export); parse_str($_COOKIE["adminer_export"], $adminer_export);
$dump_format = $adminer->dumpFormat(); $dump_format = $adminer->dumpFormat();
@@ -83,21 +81,13 @@ if (!$error && $_POST) {
$offset = $pos + strlen($found); $offset = $pos + strlen($found);
if ($found && rtrim($found) != $delimiter) { // find matching quote or comment end if ($found && rtrim($found) != $delimiter) { // find matching quote or comment end
$c_style_escapes = $driver->hasCStyleEscapes() || (JUSH == "pgsql" && ($pos > 0 && strtolower($query[$pos - 1]) == "e")); while (preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' : (preg_match('~^-- |^#~', $found) ? "\n" : preg_quote($found) . "|\\\\."))) . '|$)s', $query, $match, PREG_OFFSET_CAPTURE, $offset)) { //! respect sql_mode NO_BACKSLASH_ESCAPES
$pattern = ($found == '/*' ? '\*/'
: ($found == '[' ? ']'
: (preg_match('~^-- |^#~', $found) ? "\n"
: preg_quote($found) . ($c_style_escapes ? "|\\\\." : "")
)));
while (preg_match("($pattern|\$)s", $query, $match, PREG_OFFSET_CAPTURE, $offset)) {
$s = $match[0][0]; $s = $match[0][0];
if (!$s && $fp && !feof($fp)) { if (!$s && $fp && !feof($fp)) {
$query .= fread($fp, 1e5); $query .= fread($fp, 1e5);
} else { } else {
$offset = $match[0][1] + strlen($s); $offset = $match[0][1] + strlen($s);
if (!$s || $s[0] != "\\") { if (!isset($s[0]) || $s[0] != "\\") {
break; break;
} }
} }
@@ -107,8 +97,8 @@ if (!$error && $_POST) {
$empty = false; $empty = false;
$q = substr($query, 0, $pos); $q = substr($query, 0, $pos);
$commands++; $commands++;
$print = "<pre id='sql-$commands'><code class='jush-" . JUSH . "'>" . $adminer->sqlCommandQuery($q) . "</code></pre>\n"; $print = "<pre id='sql-$commands'><code class='jush-$jush'>" . $adminer->sqlCommandQuery($q) . "</code></pre>\n";
if (JUSH == "sqlite" && preg_match("~^$space*+ATTACH\\b~i", $q, $match)) { if ($jush == "sqlite" && preg_match("~^$space*+ATTACH\\b~i", $q, $match)) {
// PHP doesn't support setting SQLITE_LIMIT_ATTACHED // PHP doesn't support setting SQLITE_LIMIT_ATTACHED
echo $print; echo $print;
echo "<p class='error'>" . lang('ATTACH queries are not supported.') . "\n"; echo "<p class='error'>" . lang('ATTACH queries are not supported.') . "\n";
@@ -143,7 +133,7 @@ if (!$error && $_POST) {
$time = " <span class='time'>(" . format_time($start) . ")</span>" $time = " <span class='time'>(" . format_time($start) . ")</span>"
. (strlen($q) < 1000 ? " <a href='" . h(ME) . "sql=" . urlencode(trim($q)) . "'>" . lang('Edit') . "</a>" : "") // 1000 - maximum length of encoded URL in IE is 2083 characters . (strlen($q) < 1000 ? " <a href='" . h(ME) . "sql=" . urlencode(trim($q)) . "'>" . lang('Edit') . "</a>" : "") // 1000 - maximum length of encoded URL in IE is 2083 characters
; ;
$affected = $connection->affected_rows; // getting warnings overwrites this $affected = $connection->affected_rows; // getting warnigns overwrites this
$warnings = ($_POST["only_errors"] ? "" : $driver->warnings()); $warnings = ($_POST["only_errors"] ? "" : $driver->warnings());
$warnings_id = "warnings-$commands"; $warnings_id = "warnings-$commands";
if ($warnings) { if ($warnings) {
@@ -184,7 +174,7 @@ if (!$error && $_POST) {
} }
echo ($warnings ? "<div id='$warnings_id' class='hidden'>\n$warnings</div>\n" : ""); echo ($warnings ? "<div id='$warnings_id' class='hidden'>\n$warnings</div>\n" : "");
if ($explain) { if ($explain) {
echo "<div id='$explain_id' class='hidden explain'>\n"; echo "<div id='$explain_id' class='hidden'>\n";
select($explain, $connection2, $orgtables); select($explain, $connection2, $orgtables);
echo "</div>\n"; echo "</div>\n";
} }
@@ -235,7 +225,7 @@ if (!isset($_GET["import"])) {
echo script(($_POST ? "" : "qs('textarea').focus();\n") . "qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '" . js_escape(remove_from_uri("sql|limit|error_stops|only_errors|history")) . "');"); echo script(($_POST ? "" : "qs('textarea').focus();\n") . "qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '" . js_escape(remove_from_uri("sql|limit|error_stops|only_errors|history")) . "');");
echo "<p>$execute\n"; echo "<p>$execute\n";
echo lang('Limit rows') . ": <input type='number' name='limit' class='size' value='" . h($_POST ? $_POST["limit"] : $_GET["limit"]) . "'>\n"; echo lang('Limit rows') . ": <input type='number' name='limit' class='size' value='" . h($_POST ? $_POST["limit"] : $_GET["limit"]) . "'>\n";
} else { } else {
echo "<fieldset><legend>" . lang('File upload') . "</legend><div>"; echo "<fieldset><legend>" . lang('File upload') . "</legend><div>";
$gz = (extension_loaded("zlib") ? "[.gz]" : ""); $gz = (extension_loaded("zlib") ? "[.gz]" : "");
@@ -265,7 +255,7 @@ if (!isset($_GET["import"]) && $history) {
list($q, $time, $elapsed) = $val; list($q, $time, $elapsed) = $val;
echo '<a href="' . h(ME . "sql=&history=$key") . '">' . lang('Edit') . "</a>" echo '<a href="' . h(ME . "sql=&history=$key") . '">' . lang('Edit') . "</a>"
. " <span class='time' title='" . @date('Y-m-d', $time) . "'>" . @date("H:i:s", $time) . "</span>" // @ - time zone may be not set . " <span class='time' title='" . @date('Y-m-d', $time) . "'>" . @date("H:i:s", $time) . "</span>" // @ - time zone may be not set
. " <code class='jush-" . JUSH . "'>" . shorten_utf8(ltrim(str_replace("\n", " ", str_replace("\r", "", preg_replace('~^(#|-- ).*~m', '', $q)))), 80, "</code>") . " <code class='jush-$jush'>" . shorten_utf8(ltrim(str_replace("\n", " ", str_replace("\r", "", preg_replace('~^(#|-- ).*~m', '', $q)))), 80, "</code>")
. ($elapsed ? " <span class='time'>($elapsed)</span>" : "") . ($elapsed ? " <span class='time'>($elapsed)</span>" : "")
. "<br>\n" . "<br>\n"
; ;

View File

@@ -1,5 +1,5 @@
/** @author Ondrej Valka, http://valka.info */ /** @author Ondrej Valka, http://valka.info */
body { color: #000; background: #fff; font: 90%/1.25 Verdana, Arial, Helvetica, sans-serif; margin: 0; min-width: fit-content; } body { color: #000; background: #fff; font: 90%/1.25 Verdana, Arial, Helvetica, sans-serif; margin: 0; width: -moz-fit-content; width: fit-content; }
a { color: blue; text-decoration: none; } a { color: blue; text-decoration: none; }
a:visited { color: navy; } a:visited { color: navy; }
a:link:hover, a:visited:hover { color: red; text-decoration: underline; } a:link:hover, a:visited:hover { color: red; text-decoration: underline; }
@@ -22,18 +22,14 @@ td img { max-width: 200px; max-height: 200px; }
code { background: #eee; } code { background: #eee; }
tbody tr:hover td, tbody tr:hover th { background: #eee; } tbody tr:hover td, tbody tr:hover th { background: #eee; }
pre { margin: 1em 0 0; } pre { margin: 1em 0 0; }
td pre { margin: 0; }
pre, textarea { font: 100%/1.25 monospace; } pre, textarea { font: 100%/1.25 monospace; }
pre.jush { background: #fff; }
input, textarea { box-sizing: border-box; }
input, select { vertical-align: middle; } input, select { vertical-align: middle; }
input[type="radio"] { vertical-align: text-bottom; }
input.default { box-shadow: 1px 1px 1px #777; } input.default { box-shadow: 1px 1px 1px #777; }
input.required { box-shadow: 1px 1px 1px red; } input.required { box-shadow: 1px 1px 1px red; }
input.maxlength { box-shadow: 1px 1px 1px red; } input.maxlength { box-shadow: 1px 1px 1px red; }
input.wayoff { left: -1000px; position: absolute; } input.wayoff { left: -1000px; position: absolute; }
.block { display: block; } .block { display: block; }
.version { color: #777; font-size: 62%; } .version { color: #777; font-size: 67%; }
.js .hidden, .nojs .jsonly { display: none; } .js .hidden, .nojs .jsonly { display: none; }
.js .column { position: absolute; background: #ddf; padding: .27em 1ex .3em 0; margin-top: -.27em; } .js .column { position: absolute; background: #ddf; padding: .27em 1ex .3em 0; margin-top: -.27em; }
.nowrap td, .nowrap th, td.nowrap, p.nowrap { white-space: pre; } .nowrap td, .nowrap th, td.nowrap, p.nowrap { white-space: pre; }
@@ -47,7 +43,7 @@ input.wayoff { left: -1000px; position: absolute; }
.date { color: #7F007F; } .date { color: #7F007F; }
.enum { color: #007F7F; } .enum { color: #007F7F; }
.binary { color: red; } .binary { color: red; }
.odds tbody tr:nth-child(2n) td { background: #F5F5F5; } .odd td { background: #F5F5F5; }
.js .checkable .checked td, .js .checkable .checked th { background: #ddf; } .js .checkable .checked td, .js .checkable .checked th { background: #ddf; }
.time { color: silver; font-size: 70%; } .time { color: silver; font-size: 70%; }
.function { text-align: right; } .function { text-align: right; }
@@ -58,10 +54,9 @@ input.wayoff { left: -1000px; position: absolute; }
.view { font-style: italic; } .view { font-style: italic; }
.active { font-weight: bold; } .active { font-weight: bold; }
.sqlarea { width: 98%; } .sqlarea { width: 98%; }
.explain table { white-space: pre; }
.icon { width: 18px; height: 18px; background-color: navy; } .icon { width: 18px; height: 18px; background-color: navy; }
.icon:hover { background-color: red; } .icon:hover { background-color: red; }
.size { width: 7ex; } .size { width: 6ex; }
.help { cursor: help; } .help { cursor: help; }
.footer { position: sticky; bottom: 0; margin-right: -20px; border-top: 20px solid rgba(255, 255, 255, .7); border-image: linear-gradient(rgba(255, 255, 255, .2), #fff) 100% 0; } .footer { position: sticky; bottom: 0; margin-right: -20px; border-top: 20px solid rgba(255, 255, 255, .7); border-image: linear-gradient(rgba(255, 255, 255, .2), #fff) 100% 0; }
.footer > div { background: #fff; padding: 0 0 .5em; } .footer > div { background: #fff; padding: 0 0 .5em; }
@@ -70,18 +65,18 @@ input.wayoff { left: -1000px; position: absolute; }
.logout { margin-top: .5em; position: absolute; top: 0; right: 0; } .logout { margin-top: .5em; position: absolute; top: 0; right: 0; }
.loadmore { margin-left: 1ex; } .loadmore { margin-left: 1ex; }
/* .edit used in designs */ /* .edit used in designs */
#menu { position: absolute; margin: 10px 0 0; top: 2em; left: 0; width: 19em; } #menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; }
#menu p, #logins, #tables { padding: .8em 1em; margin: 0; border-bottom: 1px solid #ccc; } #menu p, #logins, #tables { padding: .8em 1em; margin: 0; border-bottom: 1px solid #ccc; }
#logins li, #tables li { list-style: none; } #logins li, #tables li { list-style: none; }
#dbs { overflow: hidden; } #dbs { overflow: hidden; }
#logins, #tables { white-space: nowrap; overflow: hidden; } #logins, #tables { white-space: nowrap; overflow: hidden; }
#logins a, #tables a, #tables span { background: #fff; } #logins a, #tables a, #tables span { background: #fff; }
#content { margin: 2em 0 0 21em; padding: 10px 20px 20px 0; } #content { margin: 2em 0 0 21em; padding: 10px 20px 20px 0; }
#lang { position: absolute; top: -2.6em; left: 0; padding: .3em 1em; } #lang { position: absolute; top: 0; left: 0; line-height: 1.8em; padding: .3em 1em; }
#breadcrumb { white-space: nowrap; position: absolute; top: 0; left: 21em; background: #eee; height: 2em; line-height: 1.8em; padding: 0 1em; margin: 0 0 0 -18px; } #breadcrumb { white-space: nowrap; position: absolute; top: 0; left: 21em; background: #eee; height: 2em; line-height: 1.8em; padding: 0 1em; margin: 0 0 0 -18px; }
#h1 { color: #777; text-decoration: none; font-style: italic; } #h1 { color: #777; text-decoration: none; font-style: italic; }
#version { color: red; } #version { font-size: 67%; color: red; }
#schema { margin-left: 60px; position: relative; user-select: none; -webkit-user-select: none; } #schema { margin-left: 60px; position: relative; -moz-user-select: none; -webkit-user-select: none; }
#schema .table { border: 1px solid silver; padding: 0 2px; cursor: move; position: absolute; } #schema .table { border: 1px solid silver; padding: 0 2px; cursor: move; position: absolute; }
#schema .references { position: absolute; } #schema .references { position: absolute; }
#help { position: absolute; border: 1px solid #999; background: #eee; padding: 5px; font-family: monospace; z-index: 1; } #help { position: absolute; border: 1px solid #999; background: #eee; padding: 5px; font-family: monospace; z-index: 1; }
@@ -94,14 +89,12 @@ input.wayoff { left: -1000px; position: absolute; }
.rtl .pages { left: auto; right: 21em; } .rtl .pages { left: auto; right: 21em; }
.rtl input.wayoff { left: auto; right: -1000px; } .rtl input.wayoff { left: auto; right: -1000px; }
.rtl #lang, .rtl #menu { left: auto; right: 0; } .rtl #lang, .rtl #menu { left: auto; right: 0; }
.rtl pre, .rtl code { direction: ltr; }
@media all and (max-width: 880px) { @media all and (max-width: 880px) {
.pages { left: auto; } .pages { left: auto; }
.logout { position: static; padding: 0 1em 1em; }
#menu { position: static; width: auto; } #menu { position: static; width: auto; }
#content { margin-left: 10px; } #content { margin-left: 10px; }
#lang { position: static; } #lang { position: static; border-top: 1px solid #999; }
#breadcrumb { left: auto; } #breadcrumb { left: auto; }
.rtl .pages { right: auto; } .rtl .pages { right: auto; }
.rtl #content { margin-right: 10px; } .rtl #content { margin-right: 10px; }

Some files were not shown because too many files have changed in this diff Show More