Compare commits

..

2 Commits

Author SHA1 Message Date
Jakub Vrana
7341756579 Show commands in navigation 2010-05-20 22:25:39 +02:00
Jakub Vrana
946eb154f6 ON DELETE action for foreign keys in Create table 2010-05-20 22:06:34 +02:00
65 changed files with 848 additions and 2007 deletions

View File

@@ -25,26 +25,27 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
$orig_field = reset($orig_fields); $orig_field = reset($orig_fields);
$after = "FIRST"; $after = "FIRST";
foreach ($_POST["fields"] as $key => $field) { foreach ($_POST["fields"] as $key => $field) {
$foreign_key = $foreign_keys[$field["type"]]; $type_field = (isset($types[$field["type"]]) ? $field : $referencable_primary[$foreign_keys[$field["type"]]]);
$type_field = (isset($foreign_key) ? $referencable_primary[$foreign_key] : $field); //! can collide with user defined type
if ($field["field"] != "") { if ($field["field"] != "") {
if (!$field["has_default"]) { if ($type_field) {
$field["default"] = null; if (!$field["has_default"]) {
} $field["default"] = null;
$default = eregi_replace(" *on update CURRENT_TIMESTAMP", "", $field["default"]); }
if ($default != $field["default"]) { // preg_replace $count is available since PHP 5.1.0 $default = eregi_replace(" *on update CURRENT_TIMESTAMP", "", $field["default"]);
$field["on_update"] = "CURRENT_TIMESTAMP"; if ($default != $field["default"]) { // preg_replace $count is available since PHP 5.1.0
$field["default"] = $default; $field["on_update"] = "CURRENT_TIMESTAMP";
} $field["default"] = $default;
if ($key == $_POST["auto_increment_col"]) { }
$field["auto_increment"] = true; if ($key == $_POST["auto_increment_col"]) {
} $field["auto_increment"] = true;
$process_field = process_field($field, $type_field); }
if ($process_field != process_field($orig_field, $orig_field)) { $process_field = process_field($field, $type_field);
$fields[] = array($field["orig"], $process_field, $after); if ($process_field != process_field($orig_field, $orig_field)) {
} $fields[] = array($field["orig"], $process_field, $after);
if (isset($foreign_key)) { }
$foreign[] = ($TABLE != "" ? "ADD" : " ") . " FOREIGN KEY (" . idf_escape($field["field"]) . ") REFERENCES " . idf_escape($foreign_keys[$field["type"]]) . " (" . idf_escape($type_field["field"]) . ")" . (in_array($field["on_delete"], $on_actions) ? " ON DELETE $field[on_delete]" : ""); if (!isset($types[$field["type"]])) {
$foreign[] = ($TABLE != "" ? "ADD " : " ") . "FOREIGN KEY (" . idf_escape($field["field"]) . ") REFERENCES " . idf_escape($foreign_keys[$field["type"]]) . " (" . idf_escape($type_field["field"]) . ")" . (in_array($field["on_delete"], $on_actions) ? " ON DELETE $field[on_delete]" : "");
}
} }
$after = "AFTER " . idf_escape($field["field"]); $after = "AFTER " . idf_escape($field["field"]);
} elseif ($field["orig"] != "") { } elseif ($field["orig"] != "") {
@@ -83,7 +84,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
$_POST["Comment"], $_POST["Comment"],
($_POST["Engine"] && $_POST["Engine"] != $orig_status["Engine"] ? $_POST["Engine"] : ""), ($_POST["Engine"] && $_POST["Engine"] != $orig_status["Engine"] ? $_POST["Engine"] : ""),
($_POST["Collation"] && $_POST["Collation"] != $orig_status["Collation"] ? $_POST["Collation"] : ""), ($_POST["Collation"] && $_POST["Collation"] != $orig_status["Collation"] ? $_POST["Collation"] : ""),
($_POST["Auto_increment"] != "" ? preg_replace('~\\D+~', '', $_POST["Auto_increment"]) : ""), ($_POST["Auto_increment"] != "" ? preg_replace('~[^0-9]+~', '', $_POST["Auto_increment"]) : ""),
$partitioning $partitioning
)); ));
} }
@@ -117,12 +118,13 @@ if ($_POST) {
$row["fields"][] = $field; $row["fields"][] = $field;
} }
if (support("partitioning")) { if (support("partitioning")) {
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($TABLE); $from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . $connection->quote(DB) . " AND TABLE_NAME = " . $connection->quote($TABLE);
$result = $connection->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION LIMIT 1"); $result = $connection->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION LIMIT 1");
list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row(); list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row();
$row["partition_names"] = array(); $row["partition_names"] = array();
$row["partition_values"] = array(); $row["partition_values"] = array();
foreach (get_rows("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION") as $row1) { $result = $connection->query("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
while ($row1 = $result->fetch_assoc()) {
$row["partition_names"][] = $row1["PARTITION_NAME"]; $row["partition_names"][] = $row1["PARTITION_NAME"];
$row["partition_values"][] = $row1["PARTITION_DESCRIPTION"]; $row["partition_values"][] = $row1["PARTITION_DESCRIPTION"];
} }
@@ -150,7 +152,7 @@ foreach ($engines as $engine) {
<p> <p>
<?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>"> <?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>">
<?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) : ""); ?> <?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) : ""); ?>
<?php echo ($collations && !ereg("sqlite|mssql", $jush) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?> <?php echo ($collations ? 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'); ?>">
<table cellspacing="0" id="edit-fields" class="nowrap"> <table cellspacing="0" id="edit-fields" class="nowrap">
<?php $comments = edit_fields($row["fields"], $collations, "TABLE", $suhosin, $foreign_keys, $row["Comment"] != ""); ?> <?php $comments = edit_fields($row["fields"], $collations, "TABLE", $suhosin, $foreign_keys, $row["Comment"] != ""); ?>
@@ -160,7 +162,7 @@ foreach ($engines as $engine) {
<script type="text/javascript"> <script type="text/javascript">
document.write('<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?><\/label>'); document.write('<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?><\/label>');
</script> </script>
<?php echo (support("comment") ? checkbox("", "", $comments, lang('Comment'), "columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();") . ' <input id="Comment" name="Comment" value="' . h($row["Comment"]) . '" maxlength="60"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?> <?php echo (support("comment") ? checkbox("", "", $comments, lang('Comment'), "columnShow(this.checked, 6); toggle('Comment');") . ' <input id="Comment" name="Comment" value="' . h($row["Comment"]) . '" maxlength="60"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?>
<p> <p>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
@@ -185,7 +187,5 @@ foreach ($row["partition_names"] as $key => $val) {
?> ?>
</table> </table>
</div></fieldset> </div></fieldset>
<?php <?php } ?>
}
?>
</form> </form>

View File

@@ -10,11 +10,11 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
$_GET["db"] = $_POST["name"]; $_GET["db"] = $_POST["name"];
queries_redirect(preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'), rename_database($_POST["name"], $_POST["collation"])); queries_redirect(preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'), rename_database($_POST["name"], $_POST["collation"]));
} else { } else {
$databases = explode("\n", str_replace("\r", "", $_POST["name"])); $dbs = explode("\n", str_replace("\r", "", $_POST["name"]));
$success = true; $success = true;
$last = ""; $last = "";
foreach ($databases as $db) { foreach ($dbs as $db) {
if (count($databases) == 1 || $db != "") { // ignore empty lines but always try to create single database if (count($dbs) == 1 || $db != "") { // ignore empty lines but always try to create single database
if (!create_database($db, $_POST["collation"])) { if (!create_database($db, $_POST["collation"])) {
$success = false; $success = false;
} }
@@ -28,7 +28,7 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
if (!$_POST["collation"]) { if (!$_POST["collation"]) {
redirect(substr(ME, 0, -1)); redirect(substr(ME, 0, -1));
} }
query_redirect("ALTER DATABASE " . idf_escape($_POST["name"]) . " COLLATE " . q($_POST["collation"]), substr(ME, 0, -1), lang('Database has been altered.')); query_redirect("ALTER DATABASE " . idf_escape($_POST["name"]) . " COLLATE " . $connection->quote($_POST["collation"]), substr(ME, 0, -1), lang('Database has been altered.'));
} }
} }

View File

@@ -33,11 +33,11 @@ if ($tables_views && !$error && !$_POST["search"]) {
page_header(($_GET["ns"] == "" ? lang('Database') . ": " . h(DB) : lang('Schema') . ": " . h($_GET["ns"])), $error, true); page_header(($_GET["ns"] == "" ? lang('Database') . ": " . h(DB) : lang('Schema') . ": " . h($_GET["ns"])), $error, true);
echo '<p>' . ($_GET["ns"] == "" ? '<a href="' . h(ME) . 'database=">' . lang('Alter database') . "</a>\n" : ""); echo '<p>' . ($_GET["ns"] == "" ? '<a href="' . h(ME) . 'database=">' . lang('Alter database') . "</a>\n" : "");
if (support("scheme")) { echo (support("scheme") ? "<a href='" . h(ME) . "scheme='>" . ($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema')) . "</a>\n" : "");
echo "<a href='" . h(ME) . "scheme='>" . ($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema')) . "</a>\n";
}
if ($_GET["ns"] !== "") { if ($_GET["ns"] !== "") {
echo '<a href="' . h(ME) . 'schema=">' . lang('Database schema') . "</a>\n"; echo '<a href="' . h(ME) . 'schema=">' . lang('Database schema') . "</a>\n";
$sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
echo "<h3>" . lang('Tables and views') . "</h3>\n"; echo "<h3>" . lang('Tables and views') . "</h3>\n";
$tables_list = tables_list(); $tables_list = tables_list();
if (!$tables_list) { if (!$tables_list) {
@@ -46,6 +46,8 @@ if ($_GET["ns"] !== "") {
echo "<form action='' method='post'>\n"; echo "<form action='' method='post'>\n";
echo "<p>" . lang('Search data in tables') . ": <input name='query' value='" . h($_POST["query"]) . "'> <input type='submit' name='search' value='" . lang('Search') . "'>\n"; echo "<p>" . lang('Search data in tables') . ": <input name='query' value='" . h($_POST["query"]) . "'> <input type='submit' name='search' value='" . lang('Search') . "'>\n";
if ($_POST["search"] && $_POST["query"] != "") { if ($_POST["search"] && $_POST["query"] != "") {
$_GET["where"][0]["op"] = "LIKE %%";
$_GET["where"][0]["val"] = $_POST["query"];
search_tables(); search_tables();
} }
echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n"; echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
@@ -66,18 +68,18 @@ if ($_GET["ns"] !== "") {
echo (support("comment") ? "<td id='Comment-" . h($name) . "'>&nbsp;" : ""); echo (support("comment") ? "<td id='Comment-" . h($name) . "'>&nbsp;" : "");
} }
echo "<tr><td>&nbsp;<th>" . lang('%d in total', count($tables_list)); echo "<tr><td>&nbsp;<th>" . lang('%d in total', count($tables_list));
echo "<td>" . nbsp($connection->result("SELECT @@storage_engine")); echo "<td>" . $connection->result("SELECT @@storage_engine");
echo "<td>" . nbsp(db_collation(DB, collations())); echo "<td>" . db_collation(DB, collations());
foreach (array("Data_length", "Index_length", "Data_free") as $key) { foreach ($sums as $key => $val) {
echo "<td align='right' id='sum-$key'>&nbsp;"; echo "<td align='right' id='sum-$key'>&nbsp;";
} }
echo "</table>\n"; echo "</table>\n";
if (!information_schema(DB)) { if (!information_schema(DB)) {
echo "<p><input type='hidden' name='token' value='$token'>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables/) + ')');\"> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables|views/) + ')');\">\n"; echo "<p><input type='hidden' name='token' value='$token'>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables/) + ')');\"> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables|views/) + ')');\">\n";
$databases = (support("scheme") ? schemas() : get_databases()); $dbs = (support("scheme") ? schemas() : get_databases());
if (count($databases) != 1 && $jush != "sqlite") { if (count($dbs) != 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') . ($databases ? ": " . html_select("target", $databases, $db) : ': <input name="target" value="' . h($db) . '">') . " <input type='submit' name='move' value='" . lang('Move') . "'>\n"; echo "<p>" . lang('Move to other database') . ($dbs ? ": " . html_select("target", $dbs, $db) : ': <input name="target" value="' . h($db) . '">') . " <input type='submit' name='move' value='" . lang('Move') . "'>\n";
} }
} }
echo "</form>\n"; echo "</form>\n";
@@ -122,28 +124,13 @@ if ($_GET["ns"] !== "") {
echo "<p><a href='" . h(ME) . "sequence='>" . lang('Create sequence') . "</a>\n"; echo "<p><a href='" . h(ME) . "sequence='>" . lang('Create sequence') . "</a>\n";
} }
if (support("type")) {
echo "<h3>" . lang('User types') . "</h3>\n";
$types = types();
if ($types) {
echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Name') . "</thead>\n";
odd('');
foreach ($types as $val) {
echo "<tr" . odd() . "><th><a href='" . h(ME) . "type=" . urlencode($val) . "'>" . h($val) . "</a>\n";
}
echo "</table>\n";
}
echo "<p><a href='" . h(ME) . "type='>" . lang('Create type') . "</a>\n";
}
if (support("event")) { if (support("event")) {
echo "<h3>" . lang('Events') . "</h3>\n"; echo "<h3>" . lang('Events') . "</h3>\n";
$rows = get_rows("SHOW EVENTS"); $result = $connection->query("SHOW EVENTS");
if ($rows) { if ($result && $result->num_rows) {
echo "<table cellspacing='0'>\n"; echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Name') . "<td>" . lang('Schedule') . "<td>" . lang('Start') . "<td>" . lang('End') . "</thead>\n"; echo "<thead><tr><th>" . lang('Name') . "<td>" . lang('Schedule') . "<td>" . lang('Start') . "<td>" . lang('End') . "</thead>\n";
foreach ($rows as $row) { while ($row = $result->fetch_assoc()) {
echo "<tr>"; echo "<tr>";
echo '<th><a href="' . h(ME) . 'event=' . urlencode($row["Name"]) . '">' . h($row["Name"]) . "</a>"; echo '<th><a href="' . h(ME) . 'event=' . urlencode($row["Name"]) . '">' . h($row["Name"]) . "</a>";
echo "<td>" . ($row["Execute at"] ? lang('At given time') . "<td>" . $row["Execute at"] : lang('Every') . " " . $row["Interval value"] . " " . $row["Interval field"] . "<td>$row[Starts]"); echo "<td>" . ($row["Execute at"] ? lang('At given time') . "<td>" . $row["Execute at"] : lang('Every') . " " . $row["Interval value"] . " " . $row["Interval field"] . "<td>$row[Starts]");
@@ -155,6 +142,33 @@ if ($_GET["ns"] !== "") {
} }
page_footer(); page_footer();
echo "<script type='text/javascript' src='" . h(ME) . "script=db'></script>\n"; $table_status = table_status();
if ($table_status) {
echo "<script type='text/javascript'>\n";
foreach ($table_status as $row) {
$id = addcslashes($row["Name"], "\\'/");
echo "setHtml('Comment-$id', '" . nbsp($row["Comment"]) . "');\n";
if (!eregi("view", $row["Engine"])) {
foreach (array("Engine", "Collation") as $key) {
echo "setHtml('$key-$id', '" . nbsp($row[$key]) . "');\n";
}
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
if ($row[$key] != "") {
$val = number_format($row[$key], 0, '.', lang(','));
echo "setHtml('$key-$id', '" . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "');\n";
if (isset($sums[$key])) {
$sums[$key] += ($row["Engine"] != "InnoDB" || $key != "Data_free" ? $row[$key] : 0);
}
} elseif (array_key_exists($key, $row)) {
echo "setHtml('$key-$id');\n";
}
}
}
}
foreach ($sums as $key => $val) {
echo "setHtml('sum-$key', '" . number_format($val, 0, '.', lang(',')) . "');\n";
}
echo "</script>\n";
}
exit; // page_footer() already called exit; // page_footer() already called
} }

View File

@@ -92,7 +92,7 @@ if (isset($_GET["mssql"])) {
function Min_Result($result) { function Min_Result($result) {
$this->_result = $result; $this->_result = $result;
// $this->num_rows = sqlsrv_num_rows($result); // available only in scrollable results $this->num_rows = sqlsrv_has_rows($result); //! sqlsrv_num_rows($result)
} }
function _convert($row) { function _convert($row) {
@@ -145,7 +145,7 @@ if (isset($_GET["mssql"])) {
if ($this->_link) { if ($this->_link) {
$result = $this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')"); $result = $this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')");
$row = $result->fetch_row(); $row = $result->fetch_row();
$this->server_info = $this->result("sp_server_info 2", 2) . " [$row[0]] $row[1]"; $this->server_info = $this->result("sp_server_info 2", 2)." [$row[0]] $row[1]";
} else { } else {
$this->error = mssql_get_last_message(); $this->error = mssql_get_last_message();
} }
@@ -264,7 +264,7 @@ if (isset($_GET["mssql"])) {
function db_collation($db, $collations) { function db_collation($db, $collations) {
global $connection; global $connection;
return $connection->result("SELECT collation_name FROM sys.databases WHERE name = " . q($db)); return $connection->result("SELECT collation_name FROM sys.databases WHERE name = " . $connection->quote($db));
} }
function engines() { function engines() {
@@ -277,7 +277,8 @@ if (isset($_GET["mssql"])) {
} }
function tables_list() { function tables_list() {
return get_key_vals("SELECT name, type_desc FROM sys.all_objects WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') ORDER BY name"); global $connection;
return get_key_vals("SELECT name, type_desc FROM sys.all_objects WHERE schema_id = SCHEMA_ID(" . $connection->quote(get_schema()) . ") AND type IN ('S', 'U', 'V') ORDER BY name");
} }
function count_tables($databases) { function count_tables($databases) {
@@ -291,8 +292,10 @@ if (isset($_GET["mssql"])) {
} }
function table_status($name = "") { function table_status($name = "") {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT name AS Name, type_desc AS Engine FROM sys.all_objects WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V')" . ($name != "" ? " AND name = " . q($name) : "")) as $row) { $result = $connection->query("SELECT name AS Name, type_desc AS Engine FROM sys.all_objects WHERE schema_id = SCHEMA_ID(" . $connection->quote(get_schema()) . ") AND type IN ('S', 'U', 'V')" . ($name != "" ? " AND name = " . $connection->quote($name) : ""));
while ($row = $result->fetch_assoc()) {
if ($name != "") { if ($name != "") {
return $row; return $row;
} }
@@ -301,29 +304,26 @@ if (isset($_GET["mssql"])) {
return $return; return $return;
} }
function is_view($table_status) {
return $table_status["Engine"] == "VIEW";
}
function fk_support($table_status) { function fk_support($table_status) {
return true; return true;
} }
function fields($table, $hidden = false) { function fields($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT c.*, t.name type, d.definition [default] $result = $connection->query("SELECT c.*, t.name type, d.definition [default]
FROM sys.all_columns c FROM sys.all_columns c
JOIN sys.all_objects o ON c.object_id = o.object_id 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.parent_column_id LEFT JOIN sys.default_constraints d ON c.default_object_id = d.parent_column_id
WHERE o.schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND o.type IN ('S', 'U', 'V') AND o.name = " . q($table) WHERE o.schema_id = SCHEMA_ID(" . $connection->quote(get_schema()) . ") AND o.type IN ('S', 'U', 'V') AND o.name = " . $connection->quote($table)
) as $row) { );
$type = $row["type"]; while ($row = $result->fetch_assoc()) {
$length = (ereg("char|binary", $type) ? $row["max_length"] : ($type == "decimal" ? "$row[precision],$row[scale]" : "")); $length = $row["max_length"]; //! precision, scale
$return[$row["name"]] = array( $return[$row["name"]] = array(
"field" => $row["name"], "field" => $row["name"],
"full_type" => $type . ($length ? "($length)" : ""), "full_type" => $row["type"] . ($length ? "($length)" : ""),
"type" => $type, "type" => $row["type"],
"length" => $length, "length" => $length,
"default" => $row["default"], "default" => $row["default"],
"null" => $row["is_nullable"], "null" => $row["is_nullable"],
@@ -343,24 +343,22 @@ WHERE o.schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND o.type IN ('S', 'U',
} }
$return = array(); $return = array();
// sp_statistics doesn't return information about primary key // sp_statistics doesn't return information about primary key
foreach (get_rows("SELECT indexes.name, key_ordinal, is_unique, is_primary_key, columns.name AS column_name $result = $connection2->query("SELECT indexes.name, key_ordinal, is_unique, is_primary_key, columns.name AS column_name
FROM sys.indexes FROM sys.indexes
INNER JOIN sys.index_columns ON indexes.object_id = index_columns.object_id AND indexes.index_id = index_columns.index_id INNER JOIN sys.index_columns ON indexes.object_id = index_columns.object_id AND indexes.index_id = index_columns.index_id
INNER JOIN sys.columns ON index_columns.object_id = columns.object_id AND index_columns.column_id = columns.column_id INNER JOIN sys.columns ON index_columns.object_id = columns.object_id AND index_columns.column_id = columns.column_id
WHERE OBJECT_NAME(indexes.object_id) = " . q($table) WHERE OBJECT_NAME(indexes.object_id) = " . $connection2->quote($table)
, $connection2) as $row) { );
$return[$row["name"]]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX")); if ($result) {
$return[$row["name"]]["lengths"] = array(); while ($row = $result->fetch_assoc()) {
$return[$row["name"]]["columns"][$row["key_ordinal"]] = $row["column_name"]; $return[$row["name"]]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
$return[$row["name"]]["lengths"] = array();
$return[$row["name"]]["columns"][$row["key_ordinal"]] = $row["column_name"];
}
} }
return $return; return $return;
} }
function view($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() {
$return = array(); $return = array();
foreach (get_vals("SELECT name FROM fn_helpcollations()") as $collation) { foreach (get_vals("SELECT name FROM fn_helpcollations()") as $collation) {
@@ -379,7 +377,8 @@ WHERE OBJECT_NAME(indexes.object_id) = " . q($table)
} }
function exact_value($val) { function exact_value($val) {
return q($val); global $connection;
return $connection->quote($val);
} }
function create_database($db, $collation) { function create_database($db, $collation) {
@@ -399,63 +398,7 @@ WHERE OBJECT_NAME(indexes.object_id) = " . q($table)
} }
function auto_increment() { function auto_increment() {
return " IDENTITY" . ($_POST["Auto_increment"] != "" ? "(" . preg_replace('~\\D+~', '', $_POST["Auto_increment"]) . ",1)" : ""); return " IDENTITY";
}
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
$alter = array();
foreach ($fields as $field) {
$column = idf_escape($field[0]);
$val = $field[1];
if (!$val) {
$alter["DROP"][] = " COLUMN $field[0]";
} else {
$val[1] = preg_replace("~( COLLATE )'(\\w+)'~", "\\1\\2", $val[1]);
if ($field[0] == "") {
$alter["ADD"][] = "\n " . implode("", $val);
} else {
unset($val[6]); //! identity can't be removed
if ($column != $val[0]) {
queries("EXEC sp_rename " . q(table($table) . ".$column") . ", " . q(idf_unescape($val[0])) . ", 'COLUMN'");
}
$alter["ALTER COLUMN " . implode("", $val)][] = "";
}
}
}
if ($table == "") {
return queries("CREATE TABLE " . table($name) . " (" . implode(",", (array) $alter["ADD"]) . "\n)");
}
if ($table != $name) {
queries("EXEC sp_rename " . q(table($table)) . ", " . q($name));
}
foreach ($alter as $key => $val) {
if (!queries("ALTER TABLE " . idf_escape($name) . " $key" . implode(",", $val))) {
return false;
}
}
return true;
}
function alter_indexes($table, $alter) {
$index = array();
$drop = array();
foreach ($alter as $val) {
if ($val[2]) {
if ($val[0] == "PRIMARY") { //! sometimes used also for UNIQUE
$drop[] = $val[1];
} else {
$index[] = "$val[1] ON " . table($table);
}
} elseif (!queries(($val[0] != "PRIMARY"
? "CREATE" . ($val[0] != "INDEX" ? " UNIQUE" : "") . " INDEX " . idf_escape(uniqid($table . "_")) . " ON " . table($table)
: "ALTER TABLE " . table($table) . " ADD PRIMARY KEY"
) . " $val[1]")) {
return false;
}
}
return (!$index || queries("DROP INDEX " . implode(", ", $index)))
&& (!$drop || queries("ALTER TABLE " . table($table) . " DROP " . implode(", ", $drop)))
;
} }
function begin() { function begin() {
@@ -466,22 +409,6 @@ WHERE OBJECT_NAME(indexes.object_id) = " . q($table)
return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES")); return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
} }
function insert_update($table, $set, $primary) {
$update = array();
$where = array();
foreach ($set as $key => $val) {
$update[] = "$key = $val";
if (isset($primary[idf_unescape($key)])) {
$where[] = "$key = $val";
}
}
// can use only one query for all rows with different API
return 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
. " WHEN MATCHED THEN UPDATE SET " . implode(", ", $update)
. " WHEN NOT MATCHED THEN INSERT (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ");" // ; is mandatory
);
}
function last_id() { function last_id() {
global $connection; global $connection;
return $connection->result("SELECT SCOPE_IDENTITY()"); // @@IDENTITY can return trigger INSERT return $connection->result("SELECT SCOPE_IDENTITY()"); // @@IDENTITY can return trigger INSERT
@@ -495,8 +422,10 @@ WHERE OBJECT_NAME(indexes.object_id) = " . q($table)
} }
function foreign_keys($table) { function foreign_keys($table) {
global $connection;
$result = $connection->query("EXEC sp_fkeys @fktable_name = " . $connection->quote($table));
$return = array(); $return = array();
foreach (get_rows("EXEC sp_fkeys @fktable_name = " . q($table)) as $row) { while ($row = $result->fetch_assoc()) {
$foreign_key = &$return[$row["FK_NAME"]]; $foreign_key = &$return[$row["FK_NAME"]];
$foreign_key["table"] = $row["PKTABLE_NAME"]; $foreign_key["table"] = $row["PKTABLE_NAME"];
$foreign_key["source"][] = $row["FKCOLUMN_NAME"]; $foreign_key["source"][] = $row["FKCOLUMN_NAME"];
@@ -522,30 +451,31 @@ WHERE OBJECT_NAME(indexes.object_id) = " . q($table)
} }
function trigger($name) { function trigger($name) {
$rows = get_rows("SELECT s.name [Trigger], global $connection;
$result = $connection->query("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
FROM sysobjects s FROM sysobjects s
JOIN syscomments c ON s.id = c.id JOIN syscomments c ON s.id = c.id
WHERE s.xtype = 'TR' AND s.name = " . q($name) WHERE s.xtype = 'TR' AND s.name = " . $connection->quote($name)
); // triggers are not schema-scoped ); // triggers are not schema-scoped
$return = reset($rows); $row = $result->fetch_assoc();
if ($return) { $row["Statement"] = preg_replace('~^.+\\s+AS\\s+~isU', '', $row["text"]); //! identifiers, comments
$return["Statement"] = preg_replace('~^.+\\s+AS\\s+~isU', '', $return["text"]); //! identifiers, comments return $row;
}
return $return;
} }
function triggers($table) { function triggers($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT sys1.name, $result = $connection->query("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) WHERE sys1.xtype = 'TR' AND sys2.name = " . $connection->quote($table)
) as $row) { // triggers are not schema-scoped ); // triggers are not schema-scoped
while ($row = $result->fetch_assoc()) {
$return[$row["name"]] = array($row["Timing"], $row["Event"]); $return[$row["name"]] = array($row["Timing"], $row["Event"]);
} }
return $return; return $return;
@@ -587,7 +517,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
} }
function support($feature) { function support($feature) {
return ereg('^(scheme|trigger|view|drop_col)$', $feature); //! routine| return ereg('^(scheme|trigger|drop_col)$', $feature); //! view|routine|
} }
$jush = "mssql"; $jush = "mssql";

View File

@@ -18,9 +18,8 @@ if (!defined("DRIVER")) {
} }
function connect($server, $username, $password) { function connect($server, $username, $password) {
mysqli_report(MYSQLI_REPORT_OFF); // stays between requests, not required since PHP 5.3.4
list($host, $port) = explode(":", $server, 2); // part after : is used for port or socket list($host, $port) = explode(":", $server, 2); // part after : is used for port or socket
$return = @$this->real_connect( return @$this->real_connect(
($server != "" ? $host : ini_get("mysqli.default_host")), ($server != "" ? $host : ini_get("mysqli.default_host")),
("$server$username" != "" ? $username : ini_get("mysqli.default_user")), ("$server$username" != "" ? $username : ini_get("mysqli.default_user")),
("$server$username$password" != "" ? $password : ini_get("mysqli.default_pw")), ("$server$username$password" != "" ? $password : ini_get("mysqli.default_pw")),
@@ -28,14 +27,6 @@ if (!defined("DRIVER")) {
(is_numeric($port) ? $port : ini_get("mysqli.default_port")), (is_numeric($port) ? $port : ini_get("mysqli.default_port")),
(!is_numeric($port) ? $port : null) (!is_numeric($port) ? $port : null)
); );
if ($return) {
if (method_exists($this, 'set_charset')) {
$this->set_charset("utf8");
} else {
$this->query("SET NAMES utf8");
}
}
return $return;
} }
function result($query, $field = 0) { function result($query, $field = 0) {
@@ -78,11 +69,6 @@ if (!defined("DRIVER")) {
); );
if ($this->_link) { if ($this->_link) {
$this->server_info = mysql_get_server_info($this->_link); $this->server_info = mysql_get_server_info($this->_link);
if (function_exists('mysql_set_charset')) {
mysql_set_charset("utf8", $this->_link);
} else {
$this->query("SET NAMES utf8");
}
} else { } else {
$this->error = mysql_error(); $this->error = mysql_error();
} }
@@ -213,7 +199,6 @@ if (!defined("DRIVER")) {
function connect($server, $username, $password) { function connect($server, $username, $password) {
$this->dsn("mysql:host=" . str_replace(":", ";unix_socket=", preg_replace('~:([0-9])~', ';port=\\1', $server)), $username, $password); $this->dsn("mysql:host=" . str_replace(":", ";unix_socket=", preg_replace('~:([0-9])~', ';port=\\1', $server)), $username, $password);
$this->query("SET NAMES utf8"); // charset in DSN is ignored
return true; return true;
} }
@@ -255,6 +240,7 @@ if (!defined("DRIVER")) {
$credentials = $adminer->credentials(); $credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) { if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
$connection->query("SET SQL_QUOTE_SHOW_CREATE=1"); $connection->query("SET SQL_QUOTE_SHOW_CREATE=1");
$connection->query("SET NAMES utf8");
return $connection; return $connection;
} }
return $connection->error; return $connection->error;
@@ -266,7 +252,7 @@ if (!defined("DRIVER")) {
*/ */
function get_databases($flush = true) { function get_databases($flush = true) {
// 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("databases");
if (!isset($return)) { if (!isset($return)) {
if ($flush) { if ($flush) {
restart_session(); restart_session();
@@ -320,8 +306,10 @@ if (!defined("DRIVER")) {
* @return array * @return array
*/ */
function engines() { function engines() {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SHOW ENGINES") as $row) { $result = $connection->query("SHOW ENGINES");
while ($row = $result->fetch_assoc()) {
if (ereg("YES|DEFAULT", $row["Support"])) { if (ereg("YES|DEFAULT", $row["Support"])) {
$return[] = $row["Engine"]; $return[] = $row["Engine"];
} }
@@ -362,13 +350,16 @@ if (!defined("DRIVER")) {
* @return array * @return array
*/ */
function table_status($name = "") { function table_status($name = "") {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_")) : "")) as $row) { $result = $connection->query("SHOW TABLE STATUS" . ($name != "" ? " LIKE " . $connection->quote(addcslashes($name, "%_")) : ""));
while ($row = $result->fetch_assoc()) {
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"]);
} }
if (!isset($row["Rows"])) { if (!isset($row["Rows"])) {
$row["Engine"] = "VIEW";
$row["Comment"] = ""; $row["Comment"] = "";
} }
if ($name != "") { if ($name != "") {
@@ -379,14 +370,6 @@ if (!defined("DRIVER")) {
return $return; return $return;
} }
/** Find out whether the identifier is view
* @param array
* @return bool
*/
function is_view($table_status) {
return !isset($table_status["Rows"]);
}
/** Check if table supports foreign keys /** Check if table supports foreign keys
* @param array result of table_status * @param array result of table_status
* @return bool * @return bool
@@ -397,28 +380,31 @@ if (!defined("DRIVER")) {
/** Get information about fields /** Get information about fields
* @param string * @param string
* @param bool display hidden table columns
* @return array array($name => array("field" => , "full_type" => , "type" => , "length" => , "unsigned" => , "default" => , "null" => , "auto_increment" => , "on_update" => , "collation" => , "privileges" => , "comment" => , "primary" => )) * @return array array($name => array("field" => , "full_type" => , "type" => , "length" => , "unsigned" => , "default" => , "null" => , "auto_increment" => , "on_update" => , "collation" => , "privileges" => , "comment" => , "primary" => ))
*/ */
function fields($table, $hidden = false) { function fields($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SHOW FULL COLUMNS FROM " . table($table)) as $row) { $result = $connection->query("SHOW FULL COLUMNS FROM " . table($table));
preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~', $row["Type"], $match); if ($result) {
$return[$row["Field"]] = array( while ($row = $result->fetch_assoc()) {
"field" => $row["Field"], preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~', $row["Type"], $match);
"full_type" => $row["Type"], $return[$row["Field"]] = array(
"type" => $match[1], "field" => $row["Field"],
"length" => $match[2], "full_type" => $row["Type"],
"unsigned" => ltrim($match[3] . $match[4]), "type" => $match[1],
"default" => ($row["Default"] != "" || ereg("char", $match[1]) ? $row["Default"] : null), "length" => $match[2],
"null" => ($row["Null"] == "YES"), "unsigned" => ltrim($match[3] . $match[4]),
"auto_increment" => ($row["Extra"] == "auto_increment"), "default" => ($row["Default"] != "" || ereg("char", $match[1]) ? $row["Default"] : null),
"on_update" => (eregi('^on update (.+)', $row["Extra"], $match) ? $match[1] : ""), //! available since MySQL 5.1.23 "null" => ($row["Null"] == "YES"),
"collation" => $row["Collation"], "auto_increment" => ($row["Extra"] == "auto_increment"),
"privileges" => array_flip(explode(",", $row["Privileges"])), "on_update" => (eregi('^on update (.+)', $row["Extra"], $match) ? $match[1] : ""), //! available since MySQL 5.1.23
"comment" => $row["Comment"], "collation" => $row["Collation"],
"primary" => ($row["Key"] == "PRI"), "privileges" => array_flip(explode(",", $row["Privileges"])),
); "comment" => $row["Comment"],
"primary" => ($row["Key"] == "PRI"),
);
}
} }
return $return; return $return;
} }
@@ -434,10 +420,13 @@ if (!defined("DRIVER")) {
$connection2 = $connection; $connection2 = $connection;
} }
$return = array(); $return = array();
foreach (get_rows("SHOW INDEX FROM " . table($table), $connection2) as $row) { $result = $connection2->query("SHOW INDEX FROM " . table($table));
$return[$row["Key_name"]]["type"] = ($row["Key_name"] == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? "INDEX" : "UNIQUE"))); if ($result) {
$return[$row["Key_name"]]["columns"][] = $row["Column_name"]; while ($row = $result->fetch_assoc()) {
$return[$row["Key_name"]]["lengths"][] = $row["Sub_part"]; $return[$row["Key_name"]]["type"] = ($row["Key_name"] == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? "INDEX" : "UNIQUE")));
$return[$row["Key_name"]]["columns"][] = $row["Column_name"];
$return[$row["Key_name"]]["lengths"][] = $row["Sub_part"];
}
} }
return $return; return $return;
} }
@@ -482,8 +471,10 @@ if (!defined("DRIVER")) {
* @return array * @return array
*/ */
function collations() { function collations() {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SHOW COLLATION") as $row) { $result = $connection->query("SHOW COLLATION");
while ($row = $result->fetch_assoc()) {
$return[$row["Charset"]][] = $row["Collation"]; $return[$row["Charset"]][] = $row["Collation"];
} }
ksort($return); ksort($return);
@@ -515,7 +506,8 @@ if (!defined("DRIVER")) {
* @return string * @return string
*/ */
function exact_value($val) { function exact_value($val) {
return q($val) . " COLLATE utf8_bin"; global $connection;
return $connection->quote($val) . " COLLATE utf8_bin";
} }
/** Create database /** Create database
@@ -523,8 +515,9 @@ if (!defined("DRIVER")) {
* @return string * @return string
*/ */
function create_database($db, $collation) { function create_database($db, $collation) {
set_session("dbs", null); global $connection;
return queries("CREATE DATABASE " . idf_escape($db) . ($collation ? " COLLATE " . q($collation) : "")); set_session("databases", null);
return queries("CREATE DATABASE " . idf_escape($db) . ($collation ? " COLLATE " . $connection->quote($collation) : ""));
} }
/** Drop databases /** Drop databases
@@ -532,8 +525,8 @@ if (!defined("DRIVER")) {
* @return bool * @return bool
*/ */
function drop_databases($databases) { function drop_databases($databases) {
set_session("dbs", null); set_session("databases", null);
return apply_queries("DROP DATABASE", $databases, 'idf_escape'); return apply_queries("DROP DATABASE", $db, 'idf_escape');
} }
/** Rename database from DB /** Rename database from DB
@@ -542,18 +535,23 @@ if (!defined("DRIVER")) {
* @return bool * @return bool
*/ */
function rename_database($name, $collation) { function rename_database($name, $collation) {
global $connection;
$return = false;
if (create_database($name, $collation)) { if (create_database($name, $collation)) {
//! move triggers //! move triggers
$rename = array(); $return = true; // table list may by empty
foreach (tables_list() as $table => $type) { foreach (tables_list() as $table) {
$rename[] = table($table) . " TO " . idf_escape($name) . "." . table($table); if (!queries("RENAME TABLE " . table($table) . " TO " . idf_escape($name) . "." . table($table))) {
$return = false;
break;
}
} }
if (!$rename || queries("RENAME TABLE " . implode(", ", $rename))) { if ($return) {
queries("DROP DATABASE " . idf_escape(DB)); queries("DROP DATABASE " . idf_escape(DB));
return true; //! saved to history of removed database
} }
} }
return false; return $return;
} }
/** Generate modifier for auto increment column /** Generate modifier for auto increment column
@@ -589,6 +587,7 @@ if (!defined("DRIVER")) {
* @return bool * @return bool
*/ */
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) {
global $connection;
$alter = array(); $alter = array();
foreach ($fields as $field) { foreach ($fields as $field) {
$alter[] = ($field[1] $alter[] = ($field[1]
@@ -597,9 +596,9 @@ if (!defined("DRIVER")) {
); );
} }
$alter = array_merge($alter, $foreign); $alter = array_merge($alter, $foreign);
$status = "COMMENT=" . q($comment) $status = "COMMENT=" . $connection->quote($comment)
. ($engine ? " ENGINE=" . q($engine) : "") . ($engine ? " ENGINE=" . $connection->quote($engine) : "")
. ($collation ? " COLLATE " . q($collation) : "") . ($collation ? " COLLATE " . $connection->quote($collation) : "")
. ($auto_increment != "" ? " AUTO_INCREMENT=$auto_increment" : "") . ($auto_increment != "" ? " AUTO_INCREMENT=$auto_increment" : "")
. $partitioning . $partitioning
; ;
@@ -668,8 +667,9 @@ if (!defined("DRIVER")) {
* @return array array("Trigger" => , "Timing" => , "Event" => , "Statement" => ) * @return array array("Trigger" => , "Timing" => , "Event" => , "Statement" => )
*/ */
function trigger($name) { function trigger($name) {
$rows = get_rows("SHOW TRIGGERS WHERE `Trigger` = " . q($name)); global $connection;
return reset($rows); $result = $connection->query("SHOW TRIGGERS WHERE `Trigger` = " . $connection->quote($name));
return $result->fetch_assoc();
} }
/** Get defined triggers /** Get defined triggers
@@ -677,8 +677,10 @@ if (!defined("DRIVER")) {
* @return array array($name => array($timing, $event)) * @return array array($name => array($timing, $event))
*/ */
function triggers($table) { function triggers($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_"))) as $row) { $result = $connection->query("SHOW TRIGGERS LIKE " . $connection->quote(addcslashes($table, "%_")));
while ($row = $result->fetch_assoc()) {
$return[$row["Trigger"]] = array($row["Timing"], $row["Event"]); $return[$row["Trigger"]] = array($row["Timing"], $row["Event"]);
} }
return $return; return $return;
@@ -702,8 +704,8 @@ if (!defined("DRIVER")) {
*/ */
function routine($name, $type) { function routine($name, $type) {
global $connection, $enum_length, $inout, $types; global $connection, $enum_length, $inout, $types;
$aliases = array("bool", "boolean", "integer", "double precision", "real", "dec", "numeric", "fixed", "national char", "national varchar"); $aliases = array("bit" => "tinyint", "bool" => "tinyint", "boolean" => "tinyint", "integer" => "int", "double precision" => "float", "real" => "float", "dec" => "decimal", "numeric" => "decimal", "fixed" => "decimal", "national char" => "char", "national varchar" => "varchar");
$type_pattern = "((" . implode("|", array_merge(array_keys($types), $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?"; $type_pattern = "((" . implode("|", array_keys($types + $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";
$pattern = "\\s*(" . ($type == "FUNCTION" ? "" : implode("|", $inout)) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern"; $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : implode("|", $inout)) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
$create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2); $create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2);
preg_match("~\\(((?:$pattern\\s*,?)*)\\)" . ($type == "FUNCTION" ? "\\s*RETURNS\\s+$type_pattern" : "") . "\\s*(.*)~is", $create, $match); preg_match("~\\(((?:$pattern\\s*,?)*)\\)" . ($type == "FUNCTION" ? "\\s*RETURNS\\s+$type_pattern" : "") . "\\s*(.*)~is", $create, $match);
@@ -711,9 +713,10 @@ if (!defined("DRIVER")) {
preg_match_all("~$pattern\\s*,?~is", $match[1], $matches, PREG_SET_ORDER); preg_match_all("~$pattern\\s*,?~is", $match[1], $matches, PREG_SET_ORDER);
foreach ($matches as $param) { foreach ($matches as $param) {
$name = str_replace("``", "`", $param[2]) . $param[3]; $name = str_replace("``", "`", $param[2]) . $param[3];
$data_type = strtolower($param[5]);
$fields[] = array( $fields[] = array(
"field" => $name, "field" => $name,
"type" => strtolower($param[5]), "type" => (isset($aliases[$data_type]) ? $aliases[$data_type] : $data_type),
"length" => preg_replace_callback("~$enum_length~s", '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]"))),
"full_type" => $param[4], "full_type" => $param[4],
@@ -732,7 +735,13 @@ if (!defined("DRIVER")) {
} }
function routines() { function routines() {
return get_rows("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q(DB)); global $connection;
$return = array();
$result = $connection->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . $connection->quote(DB));
while ($row = $result->fetch_assoc()) {
$return[] = $row;
}
return $return;
} }
/** Begin transaction /** Begin transaction
@@ -751,20 +760,6 @@ if (!defined("DRIVER")) {
return queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")"); return queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")");
} }
/** Insert or update data in the table
* @param string
* @param array
* @param array columns in keys
* @return bool
*/
function insert_update($table, $set, $primary) {
foreach ($set as $key => $val) {
$set[$key] = "$key = $val";
}
$update = implode(", ", $set);
return queries("INSERT INTO " . table($table) . " SET $update ON DUPLICATE KEY UPDATE $update");
}
/** Get last auto increment ID /** Get last auto increment ID
* @return string * @return string
*/ */
@@ -782,13 +777,6 @@ if (!defined("DRIVER")) {
return $connection->query("EXPLAIN $query"); return $connection->query("EXPLAIN $query");
} }
/** Get user defined types
* @return array
*/
function types() {
return array();
}
/** Get existing schemas /** Get existing schemas
* @return array * @return array
*/ */
@@ -813,24 +801,11 @@ if (!defined("DRIVER")) {
/** Get SQL command to create table /** Get SQL command to create table
* @param string * @param string
* @param bool
* @return string * @return string
*/ */
function create_sql($table, $auto_increment) { function create_sql($table) {
global $connection; global $connection;
$return = $connection->result("SHOW CREATE TABLE " . table($table), 1); return $connection->result("SHOW CREATE TABLE " . table($table), 1);
if (!$auto_increment) {
$return = preg_replace('~ AUTO_INCREMENT=[0-9]+~', '', $return); //! skip comments
}
return $return;
}
/** Get SQL command to truncate table
* @param string
* @return string
*/
function truncate_sql($table) {
return "TRUNCATE " . table($table);
} }
/** Get SQL command to change database /** Get SQL command to change database
@@ -847,10 +822,14 @@ if (!defined("DRIVER")) {
* @return string * @return string
*/ */
function trigger_sql($table, $style) { function trigger_sql($table, $style) {
global $connection;
$result = $connection->query("SHOW TRIGGERS LIKE " . $connection->quote(addcslashes($table, "%_")));
$return = ""; $return = "";
foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_")), null, "-- ") as $row) { if ($result->num_rows) {
$return .= "\n" . ($style == 'CREATE+ALTER' ? "DROP TRIGGER IF EXISTS " . idf_escape($row["Trigger"]) . ";;\n" : "") while ($row = $result->fetch_assoc()) {
. "CREATE TRIGGER " . idf_escape($row["Trigger"]) . " $row[Timing] $row[Event] ON " . table($row["Table"]) . " FOR EACH ROW\n$row[Statement];;\n"; $return .= "\n" . ($style == 'CREATE+ALTER' ? "DROP TRIGGER IF EXISTS " . idf_escape($row["Trigger"]) . ";;\n" : "")
. "CREATE TRIGGER " . idf_escape($row["Trigger"]) . " $row[Timing] $row[Event] ON " . table($row["Table"]) . " FOR EACH ROW\n$row[Statement];;\n";
}
} }
return $return; return $return;
} }
@@ -875,7 +854,7 @@ if (!defined("DRIVER")) {
*/ */
function support($feature) { function support($feature) {
global $connection; global $connection;
return !ereg("scheme|sequence|type" . ($connection->server_info < 5.1 ? "|event|partitioning" . ($connection->server_info < 5 ? "|view|routine|trigger" : "") : ""), $feature); return !ereg("scheme|sequence" . ($connection->server_info < 5.1 ? "|event|partitioning" . ($connection->server_info < 5 ? "|view|routine|trigger" : "") : ""), $feature);
} }
$jush = "sql"; ///< @var string JUSH identifier $jush = "sql"; ///< @var string JUSH identifier
@@ -898,7 +877,6 @@ if (!defined("DRIVER")) {
$edit_functions = array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only $edit_functions = array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only
array( array(
"char" => "md5/sha1/password/encrypt/uuid", //! JavaScript for disabling maxlength "char" => "md5/sha1/password/encrypt/uuid", //! JavaScript for disabling maxlength
"binary" => "md5/sha1/hex",
"date|time" => "now", "date|time" => "now",
), array( ), array(
"int|float|double|decimal" => "+/-", "int|float|double|decimal" => "+/-",

View File

@@ -83,6 +83,7 @@ if (isset($_GET["oracle"])) {
function Min_Result($result) { function Min_Result($result) {
$this->_result = $result; $this->_result = $result;
$this->num_rows = -1; // all results unbuffered
} }
function _convert($row) { function _convert($row) {
@@ -175,9 +176,8 @@ if (isset($_GET["oracle"])) {
} }
function tables_list() { function tables_list() {
return get_key_vals("SELECT table_name, 'table' FROM all_tables WHERE tablespace_name = " . q(DB) . " global $connection;
UNION SELECT view_name, 'view' FROM user_views" return get_key_vals("SELECT table_name FROM all_tables WHERE tablespace_name = " . $connection->quote(DB)); //! views
); //! views don't have schema
} }
function count_tables($databases) { function count_tables($databases) {
@@ -185,11 +185,10 @@ UNION SELECT view_name, 'view' FROM user_views"
} }
function table_status($name = "") { function table_status($name = "") {
global $connection;
$return = array(); $return = array();
$search = q($name); $result = $connection->query('SELECT table_name "Name" FROM all_tables' . ($name != "" ? ' WHERE table_name = ' . $connection->quote($name) : ''));
foreach (get_rows('SELECT table_name "Name", \'table\' "Engine" FROM all_tables WHERE tablespace_name = ' . q(DB) . ($name != "" ? " AND table_name = $search" : "") . " while ($row = $result->fetch_assoc()) {
UNION SELECT view_name, 'view' FROM user_views" . ($name != "" ? " WHERE view_name = $search" : "")
) as $row) {
if ($name != "") { if ($name != "") {
return $row; return $row;
} }
@@ -198,35 +197,35 @@ UNION SELECT view_name, 'view' FROM user_views" . ($name != "" ? " WHERE view_na
return $return; return $return;
} }
function is_view($table_status) {
return $table_status["Engine"] == "view";
}
function fk_support($table_status) { function fk_support($table_status) {
return true; return true;
} }
function fields($table, $hidden = false) { function fields($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT * FROM all_tab_columns WHERE table_name = " . q($table) . " ORDER BY column_id") as $row) { $result = $connection->query("SELECT * FROM all_tab_columns WHERE table_name = " . $connection->quote($table) . " ORDER BY column_id");
$type = $row["DATA_TYPE"]; if ($result) {
$length = "$row[DATA_PRECISION],$row[DATA_SCALE]"; while ($row = $result->fetch_assoc()) {
if ($length == ",") { $type = $row["DATA_TYPE"];
$length = $row["DATA_LENGTH"]; $length = "$row[DATA_PRECISION],$row[DATA_SCALE]";
} //! int if ($length == ",") {
$return[$row["COLUMN_NAME"]] = array( $length = $row["DATA_LENGTH"];
"field" => $row["COLUMN_NAME"], } //! int
"full_type" => $type . ($length ? "($length)" : ""), $return[$row["COLUMN_NAME"]] = array(
"type" => strtolower($type), "field" => $row["COLUMN_NAME"],
"length" => $length, "full_type" => $type . ($length ? "($length)" : ""),
"default" => $row["DATA_DEFAULT"], "type" => strtolower($type),
"null" => ($row["NULLABLE"] == "Y"), "length" => $length,
//! "auto_increment" => false, "default" => $row["DATA_DEFAULT"],
//! "collation" => $row["CHARACTER_SET_NAME"], "null" => ($row["NULLABLE"] == "Y"),
"privileges" => array("insert" => 1, "select" => 1, "update" => 1), //! "auto_increment" => false,
//! "comment" => $row["Comment"], //! "collation" => $row["CHARACTER_SET_NAME"],
//! "primary" => ($row["Key"] == "PRI"), "privileges" => array("insert" => 1, "select" => 1, "update" => 1),
); //! "comment" => $row["Comment"],
//! "primary" => ($row["Key"] == "PRI"),
);
}
} }
return $return; return $return;
} }
@@ -235,11 +234,6 @@ UNION SELECT view_name, 'view' FROM user_views" . ($name != "" ? " WHERE view_na
return array(); //! return array(); //!
} }
function view($name) {
$rows = get_rows('SELECT text "select" FROM user_views WHERE view_name = ' . q($name));
return reset($rows);
}
function collations() { function collations() {
return array(); //! return array(); //!
} }
@@ -254,12 +248,12 @@ UNION SELECT view_name, 'view' FROM user_views" . ($name != "" ? " WHERE view_na
} }
function exact_value($val) { function exact_value($val) {
return q($val); global $connection;
return $connection->quote($val);
} }
function explain($connection, $query) { function explain($connection, $query) {
$connection->query("EXPLAIN PLAN FOR $query"); //!
return $connection->query("SELECT * FROM plan_table");
} }
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) {
@@ -324,17 +318,8 @@ UNION SELECT view_name, 'view' FROM user_views" . ($name != "" ? " WHERE view_na
return true; return true;
} }
function show_variables() {
return get_key_vals('SELECT name, display_value FROM v$parameter');
}
function show_status() {
$rows = get_rows('SELECT * FROM v$instance');
return reset($rows);
}
function support($feature) { function support($feature) {
return ereg("view|drop_col|variables|status", $feature); //! return ereg("drop_col", $feature); //!
} }
$jush = "oracle"; $jush = "oracle";

View File

@@ -45,7 +45,7 @@ if (isset($_GET["pgsql"])) {
if ($database == DB) { if ($database == DB) {
return $this->_database; return $this->_database;
} }
$return = @pg_connect("$this->_string dbname='" . addcslashes($database, "'\\") . "'", PGSQL_CONNECT_FORCE_NEW); $return = @pg_connect($this->_connection . " dbname='" . addcslashes($database, "'\\") . "'", PGSQL_CONNECT_FORCE_NEW);
if ($return) { if ($return) {
$this->_link = $return; $this->_link = $return;
} }
@@ -190,6 +190,7 @@ if (isset($_GET["pgsql"])) {
} }
function tables_list() { function tables_list() {
global $connection;
return get_key_vals("SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema() ORDER BY table_name"); return get_key_vals("SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema() ORDER BY table_name");
} }
@@ -198,47 +199,46 @@ if (isset($_GET["pgsql"])) {
} }
function table_status($name = "") { function table_status($name = "") {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN '' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\" $result = $connection->query("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN '' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", pg_catalog.obj_description(oid, 'pg_class') AS \"Comment\"
FROM pg_class FROM pg_catalog.pg_class
WHERE relkind IN ('r','v') WHERE relkind IN ('r','v')
AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())" AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())"
. ($name != "" ? " AND relname = " . q($name) : "") . ($name != "" ? " AND relname = " . $connection->quote($name) : "")
) as $row) { //! Index_length, Auto_increment ); //! Index_length, Auto_increment
while ($row = $result->fetch_assoc()) {
$return[$row["Name"]] = $row; $return[$row["Name"]] = $row;
} }
return ($name != "" ? $return[$name] : $return); return ($name != "" ? $return[$name] : $return);
} }
function is_view($table_status) {
return $table_status["Engine"] == "view";
}
function fk_support($table_status) { function fk_support($table_status) {
return true; return true;
} }
function fields($table, $hidden = false) { function fields($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull, col_description(c.oid, a.attnum) AS comment $table_oid = $connection->result("SELECT oid FROM pg_class WHERE relname = " . $connection->quote($table));
FROM pg_class c $result = $connection->query("SELECT *, col_description($table_oid, ordinal_position) AS comment FROM information_schema.columns WHERE table_name = " . $connection->quote($table) . " ORDER BY ordinal_position");
JOIN pg_namespace n ON c.relnamespace = n.oid if ($result) {
JOIN pg_attribute a ON c.oid = a.attrelid while ($row = $result->fetch_assoc()) {
LEFT JOIN pg_attrdef d ON c.oid = d.adrelid AND a.attnum = d.adnum $length = $row["character_maximum_length"];
WHERE c.relname = " . q($table) . " $return[$row["column_name"]] = array(
AND n.nspname = current_schema() "field" => $row["column_name"],
AND NOT a.attisdropped "full_type" => $row["data_type"] . ($length ? "($length)" : ""),
" . ($hidden ? "" : "AND a.attnum > 0") . " "type" => $row["data_type"],
ORDER BY a.attnum < 0, a.attnum" "length" => $length,
) as $row) { "default" => $row["column_default"],
//! collation, primary "null" => ($row["is_nullable"] == "YES"),
ereg('(.*)(\\((.*)\\))?', $row["full_type"], $match); "auto_increment" => eregi("^nextval\\(", $row["column_default"]),
list(, $row["type"], , $row["length"]) = $match; "collation" => $row["collation_name"],
$row["full_type"] = $row["type"] . ($row["length"] ? "($row[length])" : ""); "privileges" => array("insert" => 1, "select" => 1, "update" => 1), //! is_updatable
$row["null"] = ($row["attnotnull"] == "f"); "primary" => false, //!
$row["auto_increment"] = eregi("^nextval\\(", $row["default"]); "comment" => $row["comment"],
$row["privileges"] = array("insert" => 1, "select" => 1, "update" => 1); );
$return[$row["field"]] = $row; }
} }
return $return; return $return;
} }
@@ -249,9 +249,10 @@ ORDER BY a.attnum < 0, a.attnum"
$connection2 = $connection; $connection2 = $connection;
} }
$return = array(); $return = array();
$table_oid = $connection2->result("SELECT oid FROM pg_class WHERE relname = " . q($table)); $table_oid = $connection2->result("SELECT oid FROM pg_class WHERE relname = " . $connection2->quote($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, indisprimary, indkey FROM pg_index i, pg_class ci WHERE i.indrelid = $table_oid AND ci.oid = i.indexrelid", $connection2) as $row) { $result = $connection2->query("SELECT relname, indisunique, indisprimary, indkey FROM pg_index i, pg_class ci WHERE i.indrelid = $table_oid AND ci.oid = i.indexrelid");
while ($row = $result->fetch_assoc()) {
$return[$row["relname"]]["type"] = ($row["indisprimary"] == "t" ? "PRIMARY" : ($row["indisunique"] == "t" ? "UNIQUE" : "INDEX")); $return[$row["relname"]]["type"] = ($row["indisprimary"] == "t" ? "PRIMARY" : ($row["indisunique"] == "t" ? "UNIQUE" : "INDEX"));
$return[$row["relname"]]["columns"] = array(); $return[$row["relname"]]["columns"] = array();
foreach (explode(" ", $row["indkey"]) as $indkey) { foreach (explode(" ", $row["indkey"]) as $indkey) {
@@ -263,14 +264,15 @@ ORDER BY a.attnum < 0, a.attnum"
} }
function foreign_keys($table) { function foreign_keys($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT tc.constraint_name, kcu.column_name, rc.update_rule AS on_update, rc.delete_rule AS on_delete, ccu.table_name AS table, ccu.column_name AS ref $result = $connection->query("SELECT tc.constraint_name, kcu.column_name, rc.update_rule AS on_update, rc.delete_rule AS on_delete, ccu.table_name AS table, ccu.column_name AS ref
FROM information_schema.table_constraints tc FROM information_schema.table_constraints tc
LEFT JOIN information_schema.key_column_usage kcu USING (constraint_catalog, constraint_schema, constraint_name) LEFT JOIN information_schema.key_column_usage kcu USING (constraint_catalog, constraint_schema, constraint_name)
LEFT JOIN information_schema.referential_constraints rc USING (constraint_catalog, constraint_schema, constraint_name) LEFT JOIN information_schema.referential_constraints rc USING (constraint_catalog, constraint_schema, constraint_name)
LEFT JOIN information_schema.constraint_column_usage ccu ON rc.unique_constraint_catalog = ccu.constraint_catalog AND rc.unique_constraint_schema = ccu.constraint_schema AND rc.unique_constraint_name = ccu.constraint_name LEFT JOIN information_schema.constraint_column_usage ccu ON rc.unique_constraint_catalog = ccu.constraint_catalog AND rc.unique_constraint_schema = ccu.constraint_schema AND rc.unique_constraint_name = ccu.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . q($table) //! there can be more unique_constraint_name WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . $connection->quote($table)); //! there can be more unique_constraint_name
) as $row) { while ($row = $result->fetch_assoc()) {
$foreign_key = &$return[$row["constraint_name"]]; $foreign_key = &$return[$row["constraint_name"]];
if (!$foreign_key) { if (!$foreign_key) {
$foreign_key = $row; $foreign_key = $row;
@@ -283,7 +285,7 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . q($table) //! t
function view($name) { function view($name) {
global $connection; global $connection;
return array("select" => $connection->result("SELECT pg_get_viewdef(" . q($name) . ")")); return array("select" => $connection->result("SELECT pg_get_viewdef(" . $connection->quote($name) . ")"));
} }
function collations() { function collations() {
@@ -305,7 +307,8 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . q($table) //! t
} }
function exact_value($val) { function exact_value($val) {
return q($val); global $connection;
return $connection->quote($val);
} }
function create_database($db, $collation) { function create_database($db, $collation) {
@@ -328,6 +331,7 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . q($table) //! t
} }
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) {
global $connection;
$alter = array(); $alter = array();
$queries = array(); $queries = array();
foreach ($fields as $field) { foreach ($fields as $field) {
@@ -368,10 +372,10 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . q($table) //! t
$queries[] = "ALTER TABLE " . table($table) . " RENAME TO " . table($name); $queries[] = "ALTER TABLE " . table($table) . " RENAME TO " . table($name);
} }
if ($table != "" || $comment != "") { if ($table != "" || $comment != "") {
$queries[] = "COMMENT ON TABLE " . table($name) . " IS " . q($comment); $queries[] = "COMMENT ON TABLE " . table($name) . " IS " . $connection->quote($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(" . $connection->quote($name) . ", ), $auto_increment)";
} }
foreach ($queries as $query) { foreach ($queries as $query) {
if (!queries($query)) { if (!queries($query)) {
@@ -426,13 +430,16 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . q($table) //! t
} }
function trigger($name) { function trigger($name) {
$rows = get_rows('SELECT trigger_name AS "Trigger", condition_timing AS "Timing", event_manipulation AS "Event", \'FOR EACH \' || action_orientation AS "Type", action_statement AS "Statement" FROM information_schema.triggers WHERE event_object_table = ' . q($_GET["trigger"]) . ' AND trigger_name = ' . q($name)); global $connection;
return reset($rows); $result = $connection->query('SELECT trigger_name AS "Trigger", condition_timing AS "Timing", event_manipulation AS "Event", \'FOR EACH \' || action_orientation AS "Type", action_statement AS "Statement" FROM information_schema.triggers WHERE event_object_table = ' . $connection->quote($_GET["trigger"]) . ' AND trigger_name = ' . $connection->quote($name));
return $result->fetch_assoc();
} }
function triggers($table) { function triggers($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT * FROM information_schema.triggers WHERE event_object_table = " . q($table)) as $row) { $result = $connection->query("SELECT * FROM information_schema.triggers WHERE event_object_table = " . $connection->quote($table));
while ($row = $result->fetch_assoc()) {
$return[$row["trigger_name"]] = array($row["condition_timing"], $row["event_manipulation"]); $return[$row["trigger_name"]] = array($row["condition_timing"], $row["event_manipulation"]);
} }
return $return; return $return;
@@ -453,21 +460,6 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . q($table) //! t
return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES")); return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
} }
function insert_update($table, $set, $primary) {
global $connection;
$update = array();
$where = array();
foreach ($set as $key => $val) {
$update[] = "$key = $val";
if (isset($primary[idf_unescape($key)])) {
$where[] = "$key = $val";
}
}
return ($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) . ")")
;
}
function last_id() { function last_id() {
return 0; // there can be several sequences return 0; // there can be several sequences
} }
@@ -476,15 +468,6 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . q($table) //! t
return $connection->query("EXPLAIN $query"); return $connection->query("EXPLAIN $query");
} }
function types() {
return get_vals("SELECT typname
FROM pg_type
WHERE typnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())
AND typtype IN ('b','d','e')
AND typelem = 0"
);
}
function schemas() { function schemas() {
return get_vals("SELECT nspname FROM pg_namespace"); return get_vals("SELECT nspname FROM pg_namespace");
} }
@@ -495,15 +478,8 @@ AND typelem = 0"
} }
function set_schema($schema) { function set_schema($schema) {
global $connection, $types, $structured_types; global $connection;
$return = $connection->query("SET search_path TO " . idf_escape($schema)); return $connection->query("SET search_path TO " . idf_escape($schema));
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;
} }
function use_sql($database) { function use_sql($database) {
@@ -514,11 +490,8 @@ AND typelem = 0"
return get_key_vals("SHOW ALL"); return get_key_vals("SHOW ALL");
} }
function show_status() {
}
function support($feature) { function support($feature) {
return ereg('^(comment|view|scheme|sequence|trigger|type|variables|drop_col)$', $feature); //! routine| return ereg('^(comment|view|scheme|sequence|trigger|variables|drop_col)$', $feature); //! routine|
} }
$jush = "pgsql"; $jush = "pgsql";
@@ -531,7 +504,7 @@ AND typelem = 0"
lang('Binary') => array("bit" => 0, "bit varying" => 0, "bytea" => 0), lang('Binary') => array("bit" => 0, "bit varying" => 0, "bytea" => 0),
lang('Network') => array("cidr" => 43, "inet" => 43, "macaddr" => 17, "txid_snapshot" => 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), 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 ) as $key => $val) {
$types += $val; $types += $val;
$structured_types[$key] = array_keys($val); $structured_types[$key] = array_keys($val);
} }

View File

@@ -39,10 +39,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return "'" . sqlite_escape_string($string) . "'"; return "'" . sqlite_escape_string($string) . "'";
} }
function store_result() {
return $this->_result;
}
function result($query, $field = 0) { function result($query, $field = 0) {
$result = $this->query($query); $result = $this->query($query);
if (!is_object($result)) { if (!is_object($result)) {
@@ -122,10 +118,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return "'" . $this->_link->escapeString($string) . "'"; return "'" . $this->_link->escapeString($string) . "'";
} }
function store_result() {
return $this->_result;
}
function result($query, $field = 0) { function result($query, $field = 0) {
$result = $this->query($query); $result = $this->query($query);
if (!is_object($result)) { if (!is_object($result)) {
@@ -141,6 +133,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
function Min_Result($result) { function Min_Result($result) {
$this->_result = $result; $this->_result = $result;
$this->num_rows = 1; //!
} }
function fetch_assoc() { function fetch_assoc() {
@@ -197,6 +190,10 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return $this->_result = $this->query($query); return $this->_result = $this->query($query);
} }
function store_result() {
return $this->_result;
}
function next_result() { function next_result() {
return false; return false;
} }
@@ -241,7 +238,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
function tables_list() { function tables_list() {
return get_key_vals("SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') ORDER BY (name = 'sqlite_sequence'), name", 1); return get_key_vals("SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view')", 1);
} }
function count_tables($databases) { function count_tables($databases) {
@@ -249,46 +246,52 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
function table_status($name = "") { function table_status($name = "") {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT name AS Name, type AS Engine FROM sqlite_master WHERE type IN ('table', 'view')" . ($name != "" ? " AND name = " . q($name) : "")) as $row) { $result = $connection->query("SELECT name AS Name, type AS Engine FROM sqlite_master WHERE type IN ('table', 'view')" . ($name != "" ? " AND name = " . $connection->quote($name) : ""));
while ($row = $result->fetch_assoc()) {
$row["Auto_increment"] = ""; $row["Auto_increment"] = "";
$return[$row["Name"]] = $row; $return[$row["Name"]] = $row;
} }
foreach (get_rows("SELECT * FROM sqlite_sequence", null, "") as $row) { $result = $connection->query("SELECT * FROM sqlite_sequence");
$return[$row["name"]]["Auto_increment"] = $row["seq"]; if ($result) {
while ($row = $result->fetch_assoc()) {
$return[$row["name"]]["Auto_increment"] = $row["seq"];
}
} }
return ($name != "" ? $return[$name] : $return); return ($name != "" ? $return[$name] : $return);
} }
function is_view($table_status) {
return $table_status["Engine"] == "view";
}
function fk_support($table_status) { function fk_support($table_status) {
global $connection; global $connection;
return !$connection->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')"); return !$connection->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");
} }
function fields($table, $hidden = false) { function fields($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("PRAGMA table_info(" . table($table) . ")") as $row) { $result = $connection->query("PRAGMA table_info(" . table($table) . ")");
$type = strtolower($row["type"]); if (is_object($result)) {
$default = $row["dflt_value"]; while ($row = $result->fetch_assoc()) {
$return[$row["name"]] = array( $type = strtolower($row["type"]);
"field" => $row["name"], $return[$row["name"]] = array(
"type" => (eregi("int", $type) ? "integer" : (eregi("char|clob|text", $type) ? "text" : (eregi("blob", $type) ? "blob" : (eregi("real|floa|doub", $type) ? "real" : "numeric")))), "field" => $row["name"],
"full_type" => $type, "type" => (eregi("int", $type) ? "integer" : (eregi("char|clob|text", $type) ? "text" : (eregi("blob", $type) ? "blob" : (eregi("real|floa|doub", $type) ? "real" : "numeric")))),
"default" => (ereg("'(.*)'", $default, $match) ? str_replace("''", "'", $match[1]) : ($default == "NULL" ? null : $default)), "full_type" => $type,
"null" => !$row["notnull"], "default" => $row["dflt_value"],
"auto_increment" => eregi('^integer$', $type) && $row["pk"], //! possible false positive "null" => !$row["notnull"],
"privileges" => array("select" => 1, "insert" => 1, "update" => 1), "auto_increment" => eregi('^integer$', $type) && $row["pk"], //! possible false positive
"primary" => $row["pk"], "collation" => null, //!
); "privileges" => array("select" => 1, "insert" => 1, "update" => 1),
"primary" => $row["pk"],
);
}
} }
return $return; return $return;
} }
function indexes($table, $connection2 = null) { function indexes($table, $connection2 = null) {
global $connection;
$return = array(); $return = array();
$primary = array(); $primary = array();
foreach (fields($table) as $field) { foreach (fields($table) as $field) {
@@ -299,33 +302,41 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
if ($primary) { if ($primary) {
$return[""] = array("type" => "PRIMARY", "columns" => $primary, "lengths" => array()); $return[""] = array("type" => "PRIMARY", "columns" => $primary, "lengths" => array());
} }
foreach (get_rows("PRAGMA index_list(" . table($table) . ")") as $row) { $result = $connection->query("PRAGMA index_list(" . table($table) . ")");
$return[$row["name"]]["type"] = ($row["unique"] ? "UNIQUE" : "INDEX"); if (is_object($result)) {
$return[$row["name"]]["lengths"] = array(); while ($row = $result->fetch_assoc()) {
foreach (get_rows("PRAGMA index_info(" . idf_escape($row["name"]) . ")") as $row1) { $return[$row["name"]]["type"] = ($row["unique"] ? "UNIQUE" : "INDEX");
$return[$row["name"]]["columns"][] = $row1["name"]; $return[$row["name"]]["lengths"] = array();
$result1 = $connection->query("PRAGMA index_info(" . idf_escape($row["name"]) . ")");
while ($row1 = $result1->fetch_assoc()) {
$return[$row["name"]]["columns"][] = $row1["name"];
}
} }
} }
return $return; return $return;
} }
function foreign_keys($table) { function foreign_keys($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("PRAGMA foreign_key_list(" . table($table) . ")") as $row) { $result = $connection->query("PRAGMA foreign_key_list(" . table($table) . ")");
$foreign_key = &$return[$row["id"]]; if (is_object($result)) {
//! idf_unescape in SQLite2 while ($row = $result->fetch_assoc()) {
if (!$foreign_key) { $foreign_key = &$return[$row["id"]];
$foreign_key = $row; //! idf_unescape in SQLite2
if (!$foreign_key) {
$foreign_key = $row;
}
$foreign_key["source"][] = $row["from"];
$foreign_key["target"][] = $row["to"];
} }
$foreign_key["source"][] = $row["from"];
$foreign_key["target"][] = $row["to"];
} }
return $return; return $return;
} }
function view($name) { function view($name) {
global $connection; 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 [] return array("select" => preg_replace('~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\\s+~iU', '', $connection->result("SELECT sql FROM sqlite_master WHERE name = " . $connection->quote($name)))); //! identifiers may be inside []
} }
function collations() { function collations() {
@@ -342,7 +353,8 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
function exact_value($val) { function exact_value($val) {
return q($val); global $connection;
return $connection->quote($val);
} }
function create_database($db, $collation) { function create_database($db, $collation) {
@@ -382,6 +394,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
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) {
global $connection;
$alter = array(); $alter = array();
foreach ($fields as $field) { foreach ($fields as $field) {
if ($field[1]) { if ($field[1]) {
@@ -402,14 +415,14 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return false; return false;
} }
if ($auto_increment) { if ($auto_increment) {
queries("UPDATE sqlite_sequence SET seq = $auto_increment WHERE name = " . q($name)); // ignores error queries("UPDATE sqlite_sequence SET seq = $auto_increment WHERE name = " . $connection->quote($name)); // ignores error
} }
return true; return true;
} }
function alter_indexes($table, $alter) { function alter_indexes($table, $alter) {
foreach ($alter as $val) { foreach ($alter as $val) {
if (!queries(($val[2] ? "DROP INDEX" : "CREATE" . ($val[0] != "INDEX" ? " UNIQUE" : "") . " INDEX " . idf_escape(uniqid($table . "_")) . " ON " . table($table)) . " $val[1]")) { if (!queries(($val[2] ? "DROP INDEX" : "CREATE" . ($val[0] != "INDEX" ? " UNIQUE" : "") . " INDEX " . idf_escape(uniqid($table . "_")) . " ON " . table($table)) . " $val[1]")) { //! primary key must be created in CREATE TABLE
return false; return false;
} }
} }
@@ -434,13 +447,15 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
function trigger($name) { function trigger($name) {
global $connection; global $connection;
preg_match('~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*([a-z]+)\\s+([a-z]+)\\s+ON\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*(?:FOR\\s*EACH\\s*ROW\\s)?(.*)~is', $connection->result("SELECT sql FROM sqlite_master WHERE name = " . q($name)), $match); preg_match('~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*([a-z]+)\\s+([a-z]+)\\s+ON\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*(?:FOR\\s*EACH\\s*ROW\\s)?(.*)~is', $connection->result("SELECT sql FROM sqlite_master WHERE name = " . $connection->quote($name)), $match);
return array("Timing" => strtoupper($match[1]), "Event" => strtoupper($match[2]), "Trigger" => $name, "Statement" => $match[3]); return array("Timing" => strtoupper($match[1]), "Event" => strtoupper($match[2]), "Trigger" => $name, "Statement" => $match[3]);
} }
function triggers($table) { function triggers($table) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q($table)) as $row) { $result = $connection->query("SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . $connection->quote($table));
while ($row = $result->fetch_assoc()) {
preg_match('~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*([a-z]+)\\s*([a-z]+)~i', $row["sql"], $match); preg_match('~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*([a-z]+)\\s*([a-z]+)~i', $row["sql"], $match);
$return[$row["name"]] = array($match[1], $match[2]); $return[$row["name"]] = array($match[1], $match[2]);
} }
@@ -470,10 +485,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES")); return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
} }
function insert_update($table, $set, $primary) {
return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")");
}
function last_id() { function last_id() {
global $connection; global $connection;
return $connection->result("SELECT LAST_INSERT_ROWID()"); return $connection->result("SELECT LAST_INSERT_ROWID()");
@@ -483,10 +494,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return $connection->query("EXPLAIN $query"); return $connection->query("EXPLAIN $query");
} }
function types() {
return array();
}
function schemas() { function schemas() {
return array(); return array();
} }
@@ -499,20 +506,19 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return true; return true;
} }
function create_sql($table, $auto_increment) { function create_sql($table) {
global $connection; global $connection;
return $connection->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q($table)); return $connection->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . $connection->quote($table));
}
function truncate_sql($table) {
return "DELETE FROM " . table($table);
} }
function use_sql($database) { function use_sql($database) {
global $connection;
return "ATTACH " . $connection->quote($database) . " AS " . idf_escape($database);
} }
function trigger_sql($table, $style) { function trigger_sql($table, $style) {
return implode(get_vals("SELECT sql || ';;\n' FROM sqlite_master WHERE type = 'trigger' AND name = " . q($table))); global $connection;
return implode(get_vals("SELECT sql || ';;\n' FROM sqlite_master WHERE type = 'trigger' AND name = " . $connection->quote($table)));
} }
function show_variables() { function show_variables() {
@@ -534,7 +540,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
function support($feature) { function support($feature) {
return ereg('^(view|trigger|variables|status|dump)$', $feature); return ereg('^(view|trigger|variables|status)$', $feature);
} }
$jush = "sqlite"; $jush = "sqlite";

View File

@@ -13,7 +13,7 @@ if ($_POST) {
" . ($jush != "sql" ? "" : "SET NAMES utf8; " . ($jush != "sql" ? "" : "SET NAMES utf8;
SET foreign_key_checks = 0; SET foreign_key_checks = 0;
SET time_zone = " . q($connection->result("SELECT @@time_zone")) . "; SET time_zone = " . $connection->quote($connection->result("SELECT @@time_zone")) . ";
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
"); ");
@@ -45,16 +45,20 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
$out = ""; $out = "";
if ($_POST["routines"]) { if ($_POST["routines"]) {
foreach (array("FUNCTION", "PROCEDURE") as $routine) { foreach (array("FUNCTION", "PROCEDURE") as $routine) {
foreach (get_rows("SHOW $routine STATUS WHERE Db = " . q($db), null, "-- ") as $row) { $result = $connection->query("SHOW $routine STATUS WHERE Db = " . $connection->quote($db));
while ($row = $result->fetch_assoc()) {
$out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") $out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "")
. $connection->result("SHOW CREATE $routine " . idf_escape($row["Name"]), 2) . ";;\n\n"; . $connection->result("SHOW CREATE $routine " . idf_escape($row["Name"]), 2) . ";;\n\n";
} }
} }
} }
if ($_POST["events"]) { if ($_POST["events"]) {
foreach (get_rows("SHOW EVENTS", null, "-- ") as $row) { $result = $connection->query("SHOW EVENTS");
$out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") if ($result) {
. $connection->result("SHOW CREATE EVENT " . idf_escape($row["Name"]), 3) . ";;\n\n"; while ($row = $result->fetch_assoc()) {
$out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "")
. $connection->result("SHOW CREATE EVENT " . idf_escape($row["Name"]), 3) . ";;\n\n";
}
} }
} }
if ($out) { if ($out) {
@@ -68,7 +72,7 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
$table = (DB == "" || in_array($row["Name"], (array) $_POST["tables"])); $table = (DB == "" || in_array($row["Name"], (array) $_POST["tables"]));
$data = (DB == "" || in_array($row["Name"], (array) $_POST["data"])); $data = (DB == "" || in_array($row["Name"], (array) $_POST["data"]));
if ($table || $data) { if ($table || $data) {
if (!is_view($row)) { if (isset($row["Engine"])) {
if ($ext == "tar") { if ($ext == "tar") {
ob_start(); ob_start();
} }
@@ -115,10 +119,11 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
FETCH tables INTO _table_name, _engine, _table_collation, _table_comment; FETCH tables INTO _table_name, _engine, _table_collation, _table_comment;
IF NOT done THEN IF NOT done THEN
CASE _table_name"; CASE _table_name";
foreach (get_rows($query) as $row) { $result = $connection->query($query);
$comment = q($row["ENGINE"] == "InnoDB" ? preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["TABLE_COMMENT"]) : $row["TABLE_COMMENT"]); while ($row = $result->fetch_assoc()) {
$comment = $connection->quote($row["ENGINE"] == "InnoDB" ? preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["TABLE_COMMENT"]) : $row["TABLE_COMMENT"]);
echo " echo "
WHEN " . q($row["TABLE_NAME"]) . " THEN WHEN " . $connection->quote($row["TABLE_NAME"]) . " THEN
" . (isset($row["ENGINE"]) ? "IF _engine != '$row[ENGINE]' OR _table_collation != '$row[TABLE_COLLATION]' OR _table_comment != $comment THEN " . (isset($row["ENGINE"]) ? "IF _engine != '$row[ENGINE]' OR _table_collation != '$row[TABLE_COLLATION]' OR _table_comment != $comment THEN
ALTER TABLE " . idf_escape($row["TABLE_NAME"]) . " ENGINE=$row[ENGINE] COLLATE=$row[TABLE_COLLATION] COMMENT=$comment; ALTER TABLE " . idf_escape($row["TABLE_NAME"]) . " ENGINE=$row[ENGINE] COLLATE=$row[TABLE_COLLATION] COMMENT=$comment;
END IF" : "BEGIN END") . ";"; END IF" : "BEGIN END") . ";";
@@ -152,11 +157,10 @@ page_header(lang('Export'), "", ($_GET["export"] != "" ? array("table" => $_GET[
<?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', 'INSERT+UPDATE');
if ($jush == "sql") { if ($jush == "sql") {
$db_style[] = 'CREATE+ALTER'; $db_style[] = 'CREATE+ALTER';
$table_style[] = 'CREATE+ALTER'; $table_style[] = 'CREATE+ALTER';
$data_style[] = 'INSERT+UPDATE';
} }
parse_str($_COOKIE["adminer_export"], $row); parse_str($_COOKIE["adminer_export"], $row);
if (!$row) { if (!$row) {
@@ -165,12 +169,11 @@ if (!$row) {
$checked = ($_GET["dump"] == ""); $checked = ($_GET["dump"] == "");
echo "<tr><th>" . lang('Output') . "<td>" . $adminer->dumpOutput(0, $row["output"]) . "\n"; echo "<tr><th>" . lang('Output') . "<td>" . $adminer->dumpOutput(0, $row["output"]) . "\n";
echo "<tr><th>" . lang('Format') . "<td>" . $adminer->dumpFormat(0, $row["format"]) . "\n"; echo "<tr><th>" . lang('Format') . "<td>" . $adminer->dumpFormat(0, $row["format"]) . "\n";
echo ($jush == "sqlite" ? "" : "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, $row["db_style"]) echo "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, $row["db_style"])
. (support("routine") ? checkbox("routines", 1, $checked, lang('Routines')) : "") . (support("routine") ? checkbox("routines", 1, $checked, lang('Routines')) : "")
. (support("event") ? checkbox("events", 1, $checked, lang('Events')) : "") . (support("event") ? checkbox("events", 1, $checked, lang('Events')) : "")
); ;
echo "<tr><th>" . lang('Tables') . "<td>" . html_select('table_style', $table_style, $row["table_style"]) echo "<tr><th>" . lang('Tables') . "<td>" . html_select('table_style', $table_style, $row["table_style"])
. checkbox("auto_increment", 1, $row["table_style"], lang('Auto Increment'))
. (support("trigger") ? checkbox("triggers", 1, $row["table_style"], lang('Triggers')) : "") . (support("trigger") ? checkbox("triggers", 1, $row["table_style"], lang('Triggers')) : "")
; ;
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"]);
@@ -194,7 +197,7 @@ if (DB != "") {
$prefix = ereg_replace("_.*", "", $name); $prefix = ereg_replace("_.*", "", $name);
$checked = ($TABLE == "" || $TABLE == (substr($TABLE, -1) == "%" ? "$prefix%" : $name)); //! % may be part of table name $checked = ($TABLE == "" || $TABLE == (substr($TABLE, -1) == "%" ? "$prefix%" : $name)); //! % may be part of table name
$print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "formUncheck('check-tables');"); $print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "formUncheck('check-tables');");
if (is_view($row)) { if (eregi("view", $row["Engine"])) {
$views .= "$print\n"; $views .= "$print\n";
} else { } else {
echo "$print<td align='right'><label>" . ($row["Engine"] == "InnoDB" && $row["Rows"] ? "~ " : "") . $row["Rows"] . checkbox("data[]", $name, $checked, "", "formUncheck('check-data');") . "</label>\n"; echo "$print<td align='right'><label>" . ($row["Engine"] == "InnoDB" && $row["Rows"] ? "~ " : "") . $row["Rows"] . checkbox("data[]", $name, $checked, "", "formUncheck('check-data');") . "</label>\n";

View File

@@ -16,7 +16,7 @@ if ($_POST && !$error && !isset($_GET["select"])) {
$location = ME . "select=" . urlencode($TABLE); $location = ME . "select=" . urlencode($TABLE);
} }
if (isset($_POST["delete"])) { if (isset($_POST["delete"])) {
query_redirect("DELETE" . limit1("FROM " . table($TABLE), " WHERE $where"), $location, lang('Item has been deleted.')); query_redirect("DELETE" . limit1("FROM " . table($TABLE), $where), $location, lang('Item has been deleted.'));
} else { } else {
$set = array(); $set = array();
foreach ($fields as $name => $field) { foreach ($fields as $name => $field) {
@@ -58,8 +58,11 @@ if ($_POST["save"]) {
} }
$row = array(); $row = array();
if ($select) { if ($select) {
$rows = get_rows("SELECT" . limit(implode(", ", $select) . " FROM " . table($TABLE), " WHERE $where", (isset($_GET["select"]) ? 2 : 1))); $result = $connection->query("SELECT" . limit(implode(", ", $select) . " FROM " . table($TABLE), " WHERE $where", (isset($_GET["select"]) ? 2 : 1)));
$row = (isset($_GET["select"]) && count($rows) != 1 ? null : reset($rows)); $row = $result->fetch_assoc();
if (isset($_GET["select"]) && $result->fetch_assoc()) {
$row = null;
}
} }
} }
?> ?>
@@ -100,7 +103,7 @@ if (isset($_GET["select"])) {
if ($fields) { if ($fields) {
echo "<input type='submit' value='" . lang('Save') . "'>\n"; echo "<input type='submit' value='" . lang('Save') . "'>\n";
if (!isset($_GET["select"])) { if (!isset($_GET["select"])) {
echo '<input type="submit" name="insert" value="' . ($update ? lang('Save and continue edit') : lang('Save and insert next')) . "\">\n"; echo "<input type='submit' name='insert' value='" . ($update ? lang('Save and continue edit') : lang('Save and insert next')) . "'>\n";
} }
} }
if ($update) { if ($update) {

View File

@@ -8,17 +8,17 @@ if ($_POST && !$error) {
query_redirect("DROP EVENT " . idf_escape($EVENT), substr(ME, 0, -1), lang('Event has been dropped.')); query_redirect("DROP EVENT " . idf_escape($EVENT), substr(ME, 0, -1), lang('Event has been dropped.'));
} elseif (in_array($_POST["INTERVAL_FIELD"], $intervals) && isset($statuses[$_POST["STATUS"]])) { } elseif (in_array($_POST["INTERVAL_FIELD"], $intervals) && isset($statuses[$_POST["STATUS"]])) {
$schedule = "\nON SCHEDULE " . ($_POST["INTERVAL_VALUE"] $schedule = "\nON SCHEDULE " . ($_POST["INTERVAL_VALUE"]
? "EVERY " . q($_POST["INTERVAL_VALUE"]) . " $_POST[INTERVAL_FIELD]" ? "EVERY " . $connection->quote($_POST["INTERVAL_VALUE"]) . " $_POST[INTERVAL_FIELD]"
. ($_POST["STARTS"] ? " STARTS " . q($_POST["STARTS"]) : "") . ($_POST["STARTS"] ? " STARTS " . $connection->quote($_POST["STARTS"]) : "")
. ($_POST["ENDS"] ? " ENDS " . q($_POST["ENDS"]) : "") //! ALTER EVENT doesn't drop ENDS - MySQL bug #39173 . ($_POST["ENDS"] ? " ENDS " . $connection->quote($_POST["ENDS"]) : "") //! ALTER EVENT doesn't drop ENDS - MySQL bug #39173
: "AT " . q($_POST["STARTS"]) : "AT " . $connection->quote($_POST["STARTS"])
) . " ON COMPLETION" . ($_POST["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE" ) . " ON COMPLETION" . ($_POST["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
; ;
query_redirect(($EVENT != "" query_redirect(($EVENT != ""
? "ALTER EVENT " . idf_escape($EVENT) . $schedule ? "ALTER EVENT " . idf_escape($EVENT) . $schedule
. ($EVENT != $_POST["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($_POST["EVENT_NAME"]) : "") . ($EVENT != $_POST["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($_POST["EVENT_NAME"]) : "")
: "CREATE EVENT " . idf_escape($_POST["EVENT_NAME"]) . $schedule : "CREATE EVENT " . idf_escape($_POST["EVENT_NAME"]) . $schedule
) . "\n" . $statuses[$_POST["STATUS"]] . " COMMENT " . q($_POST["EVENT_COMMENT"]) ) . "\n" . $statuses[$_POST["STATUS"]] . " COMMENT " . $connection->quote($_POST["EVENT_COMMENT"])
. " DO\n$_POST[EVENT_DEFINITION]" . " DO\n$_POST[EVENT_DEFINITION]"
, substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.'))); , substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')));
} }
@@ -30,8 +30,8 @@ $row = array();
if ($_POST) { if ($_POST) {
$row = $_POST; $row = $_POST;
} elseif ($EVENT != "") { } elseif ($EVENT != "") {
$rows = get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = " . q(DB) . " AND EVENT_NAME = " . q($EVENT)); $result = $connection->query("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = " . $connection->quote(DB) . " AND EVENT_NAME = " . $connection->quote($EVENT));
$row = reset($rows); $row = $result->fetch_assoc();
} }
?> ?>

View File

@@ -1,14 +1,13 @@
<?php <?php
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 365*24*60*60) . " GMT"); header("Expires: " . gmdate("D, d M Y H:i:s", time() + 365*24*60*60) . " GMT");
if ($_GET["file"] == "favicon.ico") { if ($_GET["file"] == "favicon.ico") {
header("Content-Type: image/x-icon"); header("Content-Type: image/x-icon");
echo base64_decode("compile_file('../adminer/static/favicon.ico', 'base64_encode');"); echo base64_decode("compile_file('../adminer/static/favicon.ico', 'base64_encode');");
} elseif ($_GET["file"] == "default.css") { } elseif ($_GET["file"] == "default.css") {
header("Content-Type: text/css; charset=utf-8"); header("Content-Type: text/css");
?>compile_file('../adminer/static/default.css', 'minify_css');<?php ?>compile_file('../adminer/static/default.css', 'minify_css');<?php
} elseif ($_GET["file"] == "functions.js") { } elseif ($_GET["file"] == "functions.js") {
header("Content-Type: text/javascript; charset=utf-8"); header("Content-Type: text/javascript");
?>compile_file('../adminer/static/functions.js', 'JSMin::minify');compile_file('static/editing.js', 'JSMin::minify');<?php ?>compile_file('../adminer/static/functions.js', 'JSMin::minify');compile_file('static/editing.js', 'JSMin::minify');<?php
} else { } else {
header("Content-Type: image/gif"); header("Content-Type: image/gif");

View File

@@ -14,7 +14,7 @@ class Adminer {
* @return array ($server, $username, $password) * @return array ($server, $username, $password)
*/ */
function credentials() { function credentials() {
return array(SERVER, $_GET["username"], get_session("pwds")); return array(SERVER, $_GET["username"], get_session("passwords"));
} }
/** Get key used for permanent login /** Get key used for permanent login
@@ -36,10 +36,10 @@ class Adminer {
* @return null * @return null
*/ */
function loginForm() { function loginForm() {
global $drivers; global $drivers, $possible_drivers;
?> ?>
<table cellspacing="0"> <table cellspacing="0">
<tr><th><?php echo lang('System'); ?><td><?php echo html_select("driver", $drivers, DRIVER); ?> <tr><th><?php echo lang('System'); ?><td><?php echo (count($possible_drivers) > 3 ? html_select("driver", $drivers, DRIVER) : "<input type='hidden' name='driver' value='" . key($drivers) . "'>" . reset($drivers)); ?></tr>
<tr><th><?php echo lang('Server'); ?><td><input name="server" value="<?php echo h(SERVER); ?>"> <tr><th><?php echo lang('Server'); ?><td><input name="server" value="<?php echo h(SERVER); ?>">
<tr><th><?php echo lang('Username'); ?><td><input id="username" name="username" value="<?php echo h($_GET["username"]); ?>"> <tr><th><?php echo lang('Username'); ?><td><input id="username" name="username" value="<?php echo h($_GET["username"]); ?>">
<tr><th><?php echo lang('Password'); ?><td><input type="password" name="password"> <tr><th><?php echo lang('Password'); ?><td><input type="password" name="password">
@@ -86,7 +86,7 @@ document.getElementById('username').focus();
function selectLinks($tableStatus, $set = "") { function selectLinks($tableStatus, $set = "") {
echo '<p class="tabs">'; echo '<p class="tabs">';
$links = array("select" => lang('Select data'), "table" => lang('Show structure')); $links = array("select" => lang('Select data'), "table" => lang('Show structure'));
if (is_view($tableStatus)) { if (eregi("view", $tableStatus["Engine"])) {
$links["view"] = lang('Alter view'); $links["view"] = lang('Alter view');
} else { } else {
$links["create"] = lang('Alter table'); $links["create"] = lang('Alter table');
@@ -123,7 +123,7 @@ document.getElementById('username').focus();
*/ */
function selectQuery($query) { function selectQuery($query) {
global $jush; global $jush;
return "<p><a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Page') . ": " . lang('last') . "'>&gt;&gt;</a> <code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n"; return "<p><code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n";
} }
/** Description of a row in a table /** Description of a row in a table
@@ -150,9 +150,9 @@ document.getElementById('username').focus();
* @return string * @return string
*/ */
function selectVal($val, $link, $field) { function selectVal($val, $link, $field) {
$return = ($val != "<i>NULL</i>" && ereg("^char|binary", $field["type"]) ? "<code>$val</code>" : $val); $return = ($val != "<i>NULL</i>" && $field["type"] == "char" ? "<code>$val</code>" : $val);
if (ereg('blob|bytea|raw|file', $field["type"]) && !is_utf8($val)) { if (ereg('binary|blob|bytea', $field["type"]) && !is_utf8($val)) {
$return = lang('%d byte(s)', strlen(html_entity_decode($val, ENT_QUOTES))); $return = lang('%d byte(s)', strlen($val));
} }
return ($link ? "<a href='$link'>$return</a>" : $return); return ($link ? "<a href='$link'>$return</a>" : $return);
} }
@@ -163,7 +163,7 @@ document.getElementById('username').focus();
* @return string * @return string
*/ */
function editVal($val, $field) { function editVal($val, $field) {
return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val); return $val;
} }
/** Print columns box in select /** Print columns box in select
@@ -304,11 +304,11 @@ document.getElementById('username').focus();
* @return array expressions to join by AND * @return array expressions to join by AND
*/ */
function selectSearchProcess($fields, $indexes) { function selectSearchProcess($fields, $indexes) {
global $jush; global $connection;
$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('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 (" . $connection->quote($_GET["fulltext"][$i]) . (isset($_GET["boolean"][$i]) ? " IN BOOLEAN MODE" : "") . ")";
} }
} }
foreach ((array) $_GET["where"] as $val) { foreach ((array) $_GET["where"] as $val) {
@@ -330,7 +330,7 @@ document.getElementById('username').focus();
foreach ($fields as $name => $field) { foreach ($fields as $name => $field) {
if (is_numeric($val["val"]) || !ereg('int|float|double|decimal', $field["type"])) { if (is_numeric($val["val"]) || !ereg('int|float|double|decimal', $field["type"])) {
$name = idf_escape($name); $name = idf_escape($name);
$cols[] = ($jush == "sql" && ereg('char|text|enum|set', $field["type"]) && !ereg('^utf8', $field["collation"]) ? "CONVERT($name USING utf8)" : $name); $cols[] = (ereg('char|text|enum|set', $field["type"]) && !ereg('^utf8', $field["collation"]) ? "CONVERT($name USING utf8)" : $name);
} }
} }
$return[] = ($cols ? "(" . implode("$cond OR ", $cols) . "$cond)" : "0"); $return[] = ($cols ? "(" . implode("$cond OR ", $cols) . "$cond)" : "0");
@@ -386,7 +386,7 @@ document.getElementById('username').focus();
global $jush; global $jush;
restart_session(); restart_session();
$id = "sql-" . count($_SESSION["messages"]); $id = "sql-" . count($_SESSION["messages"]);
$history = &get_session("queries"); $history = &get_session("history");
$history[$_GET["db"]][] = (strlen($query) > 1e6 // not DB - reset in drop database $history[$_GET["db"]][] = (strlen($query) > 1e6 // not DB - reset in drop database
? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment ? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment
: $query : $query
@@ -422,8 +422,8 @@ document.getElementById('username').focus();
*/ */
function editInput($table, $field, $attrs, $value) { function editInput($table, $field, $attrs, $value) {
if ($field["type"] == "enum") { if ($field["type"] == "enum") {
return ($field["null"] ? "<label><input type='radio'$attrs value=''" . (isset($value) || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "") return ($field["null"] ? "<label><input type='radio'$attrs value=''" . (isset($value) || isset($_GET["select"]) ? "" : " checked") . "><em>NULL</em></label> " : "")
. "<label><input type='radio'$attrs value='0'" . ($value === 0 ? " checked" : "") . "><i>" . lang('empty') . "</i></label>" . "<input type='radio'$attrs value='0'" . ($value === 0 ? " checked" : "") . ">"
; ;
} }
return ""; return "";
@@ -436,8 +436,9 @@ document.getElementById('username').focus();
* @return string expression to use in a query * @return string expression to use in a query
*/ */
function processInput($field, $value, $function = "") { function processInput($field, $value, $function = "") {
global $connection;
$name = $field["field"]; $name = $field["field"];
$return = q($value); $return = $connection->quote($value);
if (ereg('^(now|getdate|uuid)$', $function)) { if (ereg('^(now|getdate|uuid)$', $function)) {
$return = "$function()"; $return = "$function()";
} elseif (ereg('^current_(date|timestamp)$', $function)) { } elseif (ereg('^current_(date|timestamp)$', $function)) {
@@ -448,12 +449,9 @@ document.getElementById('username').focus();
$return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return); $return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
} elseif (ereg('^(addtime|subtime|concat)$', $function)) { } elseif (ereg('^(addtime|subtime|concat)$', $function)) {
$return = "$function(" . idf_escape($name) . ", $return)"; $return = "$function(" . idf_escape($name) . ", $return)";
} elseif (ereg('^(md5|sha1|password|encrypt|hex)$', $function)) { } elseif (ereg('^(md5|sha1|password|encrypt)$', $function)) {
$return = "$function($return)"; $return = "$function($return)";
} }
if (ereg("binary", $field["type"])) {
$return = "unhex($return)";
}
return $return; return $return;
} }
@@ -498,7 +496,7 @@ document.getElementById('username').focus();
<?php <?php
if ($missing == "auth") { if ($missing == "auth") {
$first = true; $first = true;
foreach ((array) $_SESSION["pwds"] as $driver => $servers) { foreach ((array) $_SESSION["passwords"] as $driver => $servers) {
foreach ($servers as $server => $usernames) { foreach ($servers as $server => $usernames) {
foreach ($usernames as $username => $password) { foreach ($usernames as $username => $password) {
if (isset($password)) { if (isset($password)) {
@@ -517,9 +515,7 @@ document.getElementById('username').focus();
<form action="" method="post"> <form action="" method="post">
<p class="logout"> <p class="logout">
<a href="<?php echo h(ME); ?>sql="><?php echo bold(lang('SQL command'), isset($_GET["sql"])); ?></a> <a href="<?php echo h(ME); ?>sql="><?php echo bold(lang('SQL command'), isset($_GET["sql"])); ?></a>
<?php if (support("dump")) { ?>
<a href="<?php echo h(ME); ?>dump=<?php echo urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]); ?>"><?php echo bold(lang('Dump'), isset($_GET["dump"])); ?></a> <a href="<?php echo h(ME); ?>dump=<?php echo urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]); ?>"><?php echo bold(lang('Dump'), isset($_GET["dump"])); ?></a>
<?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" name="logout" value="<?php echo lang('Logout'); ?>"> <input type="submit" name="logout" value="<?php echo lang('Logout'); ?>">
</p> </p>
@@ -570,11 +566,18 @@ document.getElementById('username').focus();
* @return null * @return null
*/ */
function tablesPrint($tables) { function tablesPrint($tables) {
echo "<p id='tables'>\n"; echo "<ul id='tables'>\n";
$i = 1;
foreach ($tables as $table => $type) { foreach ($tables as $table => $type) {
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '">' . bold(lang('select'), $_GET["select"] == $table) . '</a> '; echo "<li onmouseover=\"toggle('table-$i');\" onmouseout=\"toggle('table-$i');\"><a href='" . h(ME) . "table=" . urlencode($table) . "'>" . bold($this->tableName(array("Name" => $table)), $_GET["table"] == $table) . "</a>"; //! Adminer::tableName may work with full table status
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '">' . bold($this->tableName(array("Name" => $table)), $_GET["table"] == $table) . "</a><br>\n"; //! Adminer::tableName may work with full table status echo "<span id='table-$i' class='hidden'>";
echo ' <a href="' . h(ME) . 'select=' . urlencode($table) . '">' . bold(lang('select'), $_GET["select"] == $table) . '</a>';
echo ' <a href="' . h(ME) . 'create=' . urlencode($table) . '">' . bold(lang('alter'), $_GET["create"] == $table) . '</a>';
echo ' <a href="' . h(ME) . 'edit=' . urlencode($table) . '">' . bold(lang('insert'), $_GET["edit"] == $table) . '</a>';
echo "</span>\n";
$i++;
} }
echo "</ul>\n";
} }
} }

View File

@@ -22,7 +22,7 @@ if ($_COOKIE["adminer_permanent"]) {
if (isset($_POST["server"])) { if (isset($_POST["server"])) {
session_regenerate_id(); // defense against session fixation session_regenerate_id(); // defense against session fixation
$_SESSION["pwds"][$_POST["driver"]][$_POST["server"]][$_POST["username"]] = $_POST["password"]; $_SESSION["passwords"][$_POST["driver"]][$_POST["server"]][$_POST["username"]] = $_POST["password"];
if ($_POST["permanent"]) { if ($_POST["permanent"]) {
$key = base64_encode($_POST["driver"]) . "-" . base64_encode($_POST["server"]) . "-" . base64_encode($_POST["username"]); $key = base64_encode($_POST["driver"]) . "-" . base64_encode($_POST["server"]) . "-" . base64_encode($_POST["username"]);
$private = $adminer->permanentLogin(); $private = $adminer->permanentLogin();
@@ -42,7 +42,7 @@ if (isset($_POST["server"])) {
page_footer("db"); page_footer("db");
exit; exit;
} else { } else {
foreach (array("pwds", "dbs", "queries") as $key) { foreach (array("passwords", "databases", "history") as $key) {
set_session($key, null); set_session($key, null);
} }
$key = base64_encode(DRIVER) . "-" . base64_encode(SERVER) . "-" . base64_encode($_GET["username"]); $key = base64_encode(DRIVER) . "-" . base64_encode(SERVER) . "-" . base64_encode($_GET["username"]);
@@ -52,13 +52,13 @@ if (isset($_POST["server"])) {
} }
redirect(substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1), lang('Logout successful.')); redirect(substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1), lang('Logout successful.'));
} }
} elseif ($permanent && !$_SESSION["pwds"]) { } elseif ($permanent && !$_SESSION["passwords"]) {
session_regenerate_id(); session_regenerate_id();
$private = $adminer->permanentLogin(); // try to decode even if not set $private = $adminer->permanentLogin(); // try to decode even if not set
foreach ($permanent as $key => $val) { foreach ($permanent as $key => $val) {
list(, $cipher) = explode(":", $val); list(, $cipher) = explode(":", $val);
list($driver, $server, $username) = array_map('base64_decode', explode("-", $key)); list($driver, $server, $username) = array_map('base64_decode', explode("-", $key));
$_SESSION["pwds"][$driver][$server][$username] = decrypt_string(base64_decode($cipher), $private); $_SESSION["passwords"][$driver][$server][$username] = decrypt_string($cipher, $private);
} }
} }
@@ -72,7 +72,7 @@ function auth_error($exception = null) {
if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$token) { if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$token) {
$error = lang('Session expired, please login again.'); $error = lang('Session expired, please login again.');
} else { } else {
$password = &get_session("pwds"); $password = &get_session("passwords");
if (isset($password)) { if (isset($password)) {
$error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.'))); $error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.')));
$password = null; $password = null;
@@ -92,7 +92,7 @@ function auth_error($exception = null) {
if (isset($_GET["username"]) && class_exists("Min_DB")) { // doesn't exists with passing wrong driver if (isset($_GET["username"]) && class_exists("Min_DB")) { // doesn't exists with passing wrong driver
$connection = connect(); $connection = connect();
} }
if (is_string($connection) || !$adminer->login($_GET["username"], get_session("pwds"))) { if (is_string($connection) || !$adminer->login($_GET["username"], get_session("passwords"))) {
auth_error(); auth_error();
exit; exit;
} }

View File

@@ -24,12 +24,11 @@ include "../adminer/include/functions.inc.php";
if (!isset($_SERVER["REQUEST_URI"])) { if (!isset($_SERVER["REQUEST_URI"])) {
$_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"] . ($_SERVER["QUERY_STRING"] != "" ? "?$_SERVER[QUERY_STRING]" : ""); // IIS 5 compatibility $_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"] . ($_SERVER["QUERY_STRING"] != "" ? "?$_SERVER[QUERY_STRING]" : ""); // IIS 5 compatibility
} }
$HTTPS = $_SERVER["HTTPS"] && strcasecmp($_SERVER["HTTPS"], "off");
@ini_set("session.use_trans_sid", false); // protect links in export, @ - may be disabled @ini_set("session.use_trans_sid", false); // protect links in export, @ - may be disabled
if (!defined("SID")) { if (!ini_bool("session.auto_start")) {
session_name("adminer_sid"); // use specific session name to get own namespace session_name("adminer_sid"); // use specific session name to get own namespace
$params = array(0, preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]), "", $HTTPS); $params = array(0, preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]), "", $_SERVER["HTTPS"] && strcasecmp($_SERVER["HTTPS"], "off"));
if (version_compare(PHP_VERSION, '5.2.0') >= 0) { if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
$params[] = true; // HttpOnly $params[] = true; // HttpOnly
} }
@@ -38,7 +37,21 @@ if (!defined("SID")) {
} }
// disable magic quotes to be able to use database escaping function // disable magic quotes to be able to use database escaping function
remove_slashes(array(&$_GET, &$_POST, &$_COOKIE)); if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = ($filter ? $v : stripslashes($v));
}
}
}
unset($process);
}
if (function_exists("set_magic_quotes_runtime")) { if (function_exists("set_magic_quotes_runtime")) {
set_magic_quotes_runtime(false); set_magic_quotes_runtime(false);
} }

View File

@@ -1,12 +1,12 @@
<?php <?php
function connect_error() { function connect_error() {
global $connection, $token, $error, $drivers; global $connection, $VERSION, $token, $error, $drivers;
$databases = array(); $databases = array();
if (DB != "") { if (DB != "") {
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true); page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
} else { } else {
if ($_POST["db"] && !$error) { if ($_POST["db"] && !$error) {
set_session("dbs", null); set_session("databases", null);
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"]));
} }
@@ -44,15 +44,19 @@ function connect_error() {
} }
} }
page_footer("db"); page_footer("db");
echo "<script type='text/javascript' src='" . h(ME) . "script=connect'></script>\n"; echo "<script type='text/javascript'>\n";
foreach (count_tables($databases) as $db => $val) {
echo "setHtml('tables-" . addcslashes($db, "\\'/") . "', '$val');\n";
}
echo "</script>\n";
} }
if (isset($_GET["status"])) { if (isset($_GET["status"])) {
$_GET["variables"] = $_GET["status"]; $_GET["variables"] = $_GET["status"];
} }
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")) { 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"]))) {
if (DB != "") { if (DB != "") {
set_session("dbs", null); set_session("databases", null);
} }
connect_error(); // separate function to catch SQLite error connect_error(); // separate function to catch SQLite error
exit; exit;

View File

@@ -7,11 +7,11 @@
* @return null * @return null
*/ */
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
global $LANG, $HTTPS, $adminer, $connection, $drivers; global $LANG, $VERSION, $adminer, $connection, $drivers;
header("Content-Type: text/html; charset=utf-8"); header("Content-Type: text/html; charset=utf-8");
header("X-Frame-Options: deny"); // ClickJacking protection in IE8, Safari 4, Chrome 2, Firefox NoScript plugin header("X-Frame-Options: deny"); // ClickJacking protection in IE8, Safari 4, Chrome 2, Firefox NoScript plugin
$title_all = $title . ($title2 != "" ? ": " . h($title2) : ""); $title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
$protocol = ($HTTPS ? "https" : "http"); $protocol = ($_SERVER["HTTPS"] && strcasecmp($_SERVER["HTTPS"], "off") ? "https" : "http");
?> ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="<?php echo $LANG; ?>"> <html lang="<?php echo $LANG; ?>">
@@ -63,7 +63,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
echo "<div class='message'>" . implode("</div>\n<div class='message'>", $_SESSION["messages"]) . "</div>\n"; echo "<div class='message'>" . implode("</div>\n<div class='message'>", $_SESSION["messages"]) . "</div>\n";
$_SESSION["messages"] = array(); $_SESSION["messages"] = array();
} }
$databases = &get_session("dbs"); $databases = &get_session("databases");
if (DB != "" && $databases && !in_array(DB, $databases, true)) { if (DB != "" && $databases && !in_array(DB, $databases, true)) {
$databases = null; $databases = null;
} }
@@ -86,4 +86,8 @@ function page_footer($missing = "") {
<?php $adminer->navigation($missing); ?> <?php $adminer->navigation($missing); ?>
</div> </div>
<?php <?php
// don't wait for code after footer
session_write_close();
ob_flush();
flush();
} }

View File

@@ -5,73 +5,77 @@
* @return null * @return null
*/ */
function select($result, $connection2 = null) { function select($result, $connection2 = null) {
$links = array(); // colno => orgtable - create links from these columns if (!$result->num_rows) {
$indexes = array(); // orgtable => array(column => colno) - primary keys echo "<p class='message'>" . lang('No rows.') . "\n";
$columns = array(); // orgtable => array(column => ) - not selected columns in primary key } else {
$blobs = array(); // colno => bool - display bytes for blobs echo "<table cellspacing='0' class='nowrap'>\n";
$types = array(); // colno => type - display char in <code> $links = array(); // colno => orgtable - create links from these columns
odd(''); // reset odd for each result $indexes = array(); // orgtable => array(column => colno) - primary keys
for ($i=0; $row = $result->fetch_row(); $i++) { $columns = array(); // orgtable => array(column => ) - not selected columns in primary key
if (!$i) { $blobs = array(); // colno => bool - display bytes for blobs
echo "<table cellspacing='0' class='nowrap'>\n"; $types = array(); // colno => type - display char in <code>
echo "<thead><tr>"; odd(''); // reset odd for each result
for ($j=0; $j < count($row); $j++) { for ($i=0; $row = $result->fetch_row(); $i++) {
$field = $result->fetch_field(); if (!$i) {
$orgtable = $field->orgtable; echo "<thead><tr>";
$orgname = $field->orgname; for ($j=0; $j < count($row); $j++) {
if ($orgtable != "") { $field = $result->fetch_field();
if (!isset($indexes[$orgtable])) { $orgtable = $field->orgtable;
// find primary key in each table $orgname = $field->orgname;
$indexes[$orgtable] = array(); if ($orgtable != "") {
foreach (indexes($orgtable, $connection2) as $index) { if (!isset($indexes[$orgtable])) {
if ($index["type"] == "PRIMARY") { // find primary key in each table
$indexes[$orgtable] = array_flip($index["columns"]); $indexes[$orgtable] = array();
break; foreach (indexes($orgtable, $connection2) as $index) {
if ($index["type"] == "PRIMARY") {
$indexes[$orgtable] = array_flip($index["columns"]);
break;
}
} }
$columns[$orgtable] = $indexes[$orgtable];
}
if (isset($columns[$orgtable][$orgname])) {
unset($columns[$orgtable][$orgname]);
$indexes[$orgtable][$orgname] = $j;
$links[$j] = $orgtable;
} }
$columns[$orgtable] = $indexes[$orgtable];
} }
if (isset($columns[$orgtable][$orgname])) { if ($field->charsetnr == 63) { // 63 - binary
unset($columns[$orgtable][$orgname]); $blobs[$j] = true;
$indexes[$orgtable][$orgname] = $j;
$links[$j] = $orgtable;
} }
$types[$j] = $field->type;
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($field->name);
} }
if ($field->charsetnr == 63) { // 63 - binary echo "</thead>\n";
$blobs[$j] = true;
}
$types[$j] = $field->type;
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($field->name);
} }
echo "</thead>\n"; echo "<tr" . odd() . ">";
} foreach ($row as $key => $val) {
echo "<tr" . odd() . ">"; if (!isset($val)) {
foreach ($row as $key => $val) { $val = "<i>NULL</i>";
if (!isset($val)) {
$val = "<i>NULL</i>";
} else {
if ($blobs[$key] && !is_utf8($val)) {
$val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
} elseif (!strlen($val)) { // strlen - SQLite can return int
$val = "&nbsp;"; // some content to print a border
} else { } else {
$val = h($val); if ($blobs[$key] && !is_utf8($val)) {
if ($types[$key] == 254) { // 254 - char $val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
$val = "<code>$val</code>"; } elseif (!strlen($val)) { // strlen - SQLite can return int
$val = "&nbsp;"; // some content to print a border
} else {
$val = h($val);
if ($types[$key] == 254) { // 254 - char
$val = "<code>$val</code>";
}
}
if (isset($links[$key]) && !$columns[$links[$key]]) {
$link = "edit=" . urlencode($links[$key]);
foreach ($indexes[$links[$key]] as $col => $j) {
$link .= "&where" . urlencode("[" . bracket_escape($col) . "]") . "=" . urlencode($row[$j]);
}
$val = "<a href='" . h(ME . $link) . "'>$val</a>";
} }
} }
if (isset($links[$key]) && !$columns[$links[$key]]) { echo "<td>$val";
$link = "edit=" . urlencode($links[$key]);
foreach ($indexes[$links[$key]] as $col => $j) {
$link .= "&where" . urlencode("[" . bracket_escape($col) . "]") . "=" . urlencode($row[$j]);
}
$val = "<a href='" . h(ME . $link) . "'>$val</a>";
}
} }
echo "<td>$val";
} }
echo "</table>\n";
} }
echo ($i ? "</table>" : "<p class='message'>" . lang('No rows.')) . "\n";
} }
/** Get referencable tables with single column primary key except self /** Get referencable tables with single column primary key except self
@@ -96,17 +100,6 @@ function referencable_primary($self) {
return $return; return $return;
} }
/** Print SQL <textarea> tag
* @param string
* @param int
* @param int
* @param string
* @return null
*/
function textarea($name, $value, $rows = 10, $cols = 80) {
echo "<textarea name='$name' rows='$rows' cols='$cols' style='width: 98%;' spellcheck='false' onkeydown='return textareaKeydown(this, event);'>" . h($value) . "</textarea>"; // spellcheck - not valid before HTML5
}
/** Print table columns for type edit /** Print table columns for type edit
* @param string * @param string
* @param array * @param array
@@ -115,9 +108,9 @@ function textarea($name, $value, $rows = 10, $cols = 80) {
* @return null * @return null
*/ */
function edit_type($key, $field, $collations, $foreign_keys = array()) { function edit_type($key, $field, $collations, $foreign_keys = array()) {
global $structured_types, $types, $unsigned, $on_actions; global $structured_types, $unsigned, $inout, $on_actions;
?> ?>
<td><select name="<?php echo $key; ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"><?php echo optionlist((!$field["type"] || isset($types[$field["type"]]) ? array() : array($field["type"])) + $structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select> <td><select name="<?php echo $key; ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select>
<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"><td><?php <td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"><td><?php
echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>'; echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : ''); echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
@@ -139,11 +132,11 @@ function process_length($length) {
* @return string * @return string
*/ */
function process_type($field, $collate = "COLLATE") { function process_type($field, $collate = "COLLATE") {
global $unsigned; global $connection, $unsigned;
return " $field[type]" return " $field[type]"
. ($field["length"] != "" ? "(" . process_length($field["length"]) . ")" : "") . ($field["length"] != "" && !ereg('^date|time$', $field["type"]) ? "(" . process_length($field["length"]) . ")" : "")
. (ereg('int|float|double|decimal', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "") . (ereg('int|float|double|decimal', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
. (ereg('char|text|enum|set', $field["type"]) && $field["collation"] ? " $collate " . q($field["collation"]) : "") . (ereg('char|text|enum|set', $field["type"]) && $field["collation"] ? " $collate " . $connection->quote($field["collation"]) : "")
; ;
} }
@@ -153,13 +146,14 @@ function process_type($field, $collate = "COLLATE") {
* @return array 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) {
global $connection;
return array( return array(
idf_escape($field["field"]), idf_escape($field["field"]),
process_type($type_field), process_type($type_field),
($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp ($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp
(isset($field["default"]) ? " DEFAULT " . ($field["type"] == "timestamp" && eregi("^CURRENT_TIMESTAMP$", $field["default"]) ? $field["default"] : q($field["default"])) : ""), (isset($field["default"]) ? " DEFAULT " . ($field["type"] == "timestamp" && eregi("^CURRENT_TIMESTAMP$", $field["default"]) ? $field["default"] : $connection->quote($field["default"])) : ""),
($field["on_update"] ? " ON UPDATE $field[on_update]" : ""), ($field["on_update"] ? " ON UPDATE $field[on_update]" : ""),
(support("comment") && $field["comment"] != "" ? " COMMENT " . q($field["comment"]) : ""), (support("comment") && $field["comment"] != "" ? " COMMENT " . $connection->quote($field["comment"]) : ""),
($field["auto_increment"] ? auto_increment() : null), ($field["auto_increment"] ? auto_increment() : null),
); );
} }
@@ -224,7 +218,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
<?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?> <?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
<?php if ($type == "TABLE") { ?> <?php if ($type == "TABLE") { ?>
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"]); ?> <td><?php echo checkbox("fields[$i][null]", 1, $field["null"]); ?>
<td><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }"> <td><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?>>
<td class="hidden"><?php echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onchange="this.previousSibling.checked = true;"> <td class="hidden"><?php echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onchange="this.previousSibling.checked = true;">
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='255'>" : ""); ?> <?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='255'>" : ""); ?>
<?php } ?> <?php } ?>

View File

@@ -10,26 +10,23 @@ function tar_file($filename, $contents) {
} }
function dump_table($table, $style, $is_view = false) { function dump_table($table, $style, $is_view = false) {
global $connection;
if ($_POST["format"] != "sql") { if ($_POST["format"] != "sql") {
echo "\xef\xbb\xbf"; // UTF-8 byte order mark echo "\xef\xbb\xbf"; // UTF-8 byte order mark
if ($style) { if ($style) {
dump_csv(array_keys(fields($table))); dump_csv(array_keys(fields($table)));
} }
} elseif ($style) { } elseif ($style) {
$create = create_sql($table, $_POST["auto_increment"]); $create = create_sql($table);
if ($create) { if ($create) {
if ($style == "DROP+CREATE") { if ($style == "DROP+CREATE") {
echo "DROP " . ($is_view ? "VIEW" : "TABLE") . " IF EXISTS " . table($table) . ";\n"; echo "DROP " . ($is_view ? "VIEW" : "TABLE") . " IF EXISTS " . idf_escape($table) . ";\n";
}
if ($is_view) {
// remove DEFINER with current user
$create = preg_replace('~^([A-Z =]+) DEFINER=`' . str_replace("@", "`@`", logged_user()) . '`~', '\\1', $create); //! proper escaping of user
} }
echo ($style != "CREATE+ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n"; echo ($style != "CREATE+ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n";
} }
if ($style == "CREATE+ALTER" && !$is_view) { if ($style == "CREATE+ALTER" && !$is_view) {
// create procedure which iterates over original columns and adds new and removes old // create procedure which iterates over original columns and adds new and removes old
$query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . q($table) . " ORDER BY ORDINAL_POSITION"; $query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . $connection->quote($table) . " ORDER BY ORDINAL_POSITION";
echo "DELIMITER ;; echo "DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _column_name, _collation_name, after varchar(64) DEFAULT ''; DECLARE _column_name, _collation_name, after varchar(64) DEFAULT '';
@@ -40,18 +37,19 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE done, set_after bool DEFAULT 0; DECLARE done, set_after bool DEFAULT 0;
DECLARE add_columns text DEFAULT '"; DECLARE add_columns text DEFAULT '";
$fields = array(); $fields = array();
$result = $connection->query($query);
$after = ""; $after = "";
foreach (get_rows($query) as $row) { while ($row = $result->fetch_assoc()) {
$default = $row["COLUMN_DEFAULT"]; $default = $row["COLUMN_DEFAULT"];
$row["default"] = (isset($default) ? q($default) : "NULL"); $row["default"] = (isset($default) ? $connection->quote($default) : "NULL");
$row["after"] = q($after); //! rgt AFTER lft, lft AFTER id doesn't work $row["after"] = $connection->quote($after); //! rgt AFTER lft, lft AFTER id doesn't work
$row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"]) $row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"])
. " $row[COLUMN_TYPE]" . " $row[COLUMN_TYPE]"
. ($row["COLLATION_NAME"] ? " COLLATE $row[COLLATION_NAME]" : "") . ($row["COLLATION_NAME"] ? " COLLATE $row[COLLATION_NAME]" : "")
. (isset($default) ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "") . (isset($default) ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "")
. ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL") . ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL")
. ($row["EXTRA"] ? " $row[EXTRA]" : "") . ($row["EXTRA"] ? " $row[EXTRA]" : "")
. ($row["COLUMN_COMMENT"] ? " COMMENT " . q($row["COLUMN_COMMENT"]) : "") . ($row["COLUMN_COMMENT"] ? " COMMENT " . $connection->quote($row["COLUMN_COMMENT"]) : "")
. ($after ? " AFTER " . idf_escape($after) : " FIRST") . ($after ? " AFTER " . idf_escape($after) : " FIRST")
); );
echo ", ADD $row[alter]"; echo ", ADD $row[alter]";
@@ -70,9 +68,9 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
CASE _column_name"; CASE _column_name";
foreach ($fields as $row) { foreach ($fields as $row) {
echo " echo "
WHEN " . q($row["COLUMN_NAME"]) . " THEN WHEN " . $connection->quote($row["COLUMN_NAME"]) . " THEN
SET add_columns = REPLACE(add_columns, ', ADD $row[alter]', ''); SET add_columns = REPLACE(add_columns, ', ADD $row[alter]', '');
IF NOT (_column_default <=> $row[default]) OR _is_nullable != '$row[IS_NULLABLE]' OR _collation_name != '$row[COLLATION_NAME]' OR _column_type != " . q($row["COLUMN_TYPE"]) . " OR _extra != '$row[EXTRA]' OR _column_comment != " . q($row["COLUMN_COMMENT"]) . " OR after != $row[after] THEN IF NOT (_column_default <=> $row[default]) OR _is_nullable != '$row[IS_NULLABLE]' OR _collation_name != '$row[COLLATION_NAME]' OR _column_type != " . $connection->quote($row["COLUMN_TYPE"]) . " OR _extra != '$row[EXTRA]' OR _column_comment != " . $connection->quote($row["COLUMN_COMMENT"]) . " OR after != $row[after] THEN
SET @alter_table = CONCAT(@alter_table, ', MODIFY $row[alter]'); SET @alter_table = CONCAT(@alter_table, ', MODIFY $row[alter]');
END IF;"; //! don't replace in comment END IF;"; //! don't replace in comment
} }
@@ -88,7 +86,7 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
UNTIL done END REPEAT; UNTIL done END REPEAT;
CLOSE columns; CLOSE columns;
IF @alter_table != '' OR add_columns != '' THEN IF @alter_table != '' OR add_columns != '' THEN
SET alter_command = CONCAT(alter_command, 'ALTER TABLE " . table($table) . "', SUBSTR(CONCAT(add_columns, @alter_table), 2), ';\\n'); SET alter_command = CONCAT(alter_command, 'ALTER TABLE " . idf_escape($table) . "', SUBSTR(CONCAT(add_columns, @alter_table), 2), ';\\n');
END IF; END IF;
END;; END;;
DELIMITER ; DELIMITER ;
@@ -106,10 +104,10 @@ function dump_data($table, $style, $select = "") {
$max_packet = ($jush == "sqlite" ? 0 : 1048576); // default, minimum is 1024 $max_packet = ($jush == "sqlite" ? 0 : 1048576); // default, minimum is 1024
if ($style) { if ($style) {
if ($_POST["format"] == "sql" && $style == "TRUNCATE+INSERT") { if ($_POST["format"] == "sql" && $style == "TRUNCATE+INSERT") {
echo truncate_sql($table) . ";\n"; echo "TRUNCATE " . idf_escape($table) . ";\n";
} }
$fields = fields($table); $fields = fields($table);
$result = $connection->query(($select ? $select : "SELECT * FROM " . table($table)), 1); // 1 - MYSQLI_USE_RESULT //! enum and set as numbers $result = $connection->query(($select ? $select : "SELECT * FROM " . idf_escape($table)), 1); // 1 - MYSQLI_USE_RESULT //! enum and set as numbers, microtime
if ($result) { if ($result) {
$insert = ""; $insert = "";
$buffer = ""; $buffer = "";
@@ -118,10 +116,10 @@ function dump_data($table, $style, $select = "") {
dump_csv($row); dump_csv($row);
} else { } else {
if (!$insert) { if (!$insert) {
$insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('idf_escape', array_keys($row))) . ") VALUES"; $insert = "INSERT INTO " . idf_escape($table) . " (" . implode(", ", array_map('idf_escape', array_keys($row))) . ") VALUES";
} }
foreach ($row as $key => $val) { foreach ($row as $key => $val) {
$row[$key] = (isset($val) ? (ereg('int|float|double|decimal', $fields[$key]["type"]) ? $val : q($val)) : "NULL"); //! columns looking like functions $row[$key] = (isset($val) ? (ereg('int|float|double|decimal', $fields[$key]["type"]) ? $val : $connection->quote($val)) : "NULL"); //! columns looking like functions
} }
$s = implode(",\t", $row); $s = implode(",\t", $row);
if ($style == "INSERT+UPDATE") { if ($style == "INSERT+UPDATE") {

View File

@@ -22,27 +22,8 @@ function idf_unescape($idf) {
* @return string * @return string
*/ */
function escape_string($val) { function escape_string($val) {
return substr(q($val), 1, -1); global $connection;
} return substr($connection->quote($val), 1, -1);
/** Disable magic_quotes_gpc
* @param array e.g. (&$_GET, &$_POST, &$_COOKIE)
* @return null modified in place
*/
function remove_slashes($process) {
if (get_magic_quotes_gpc()) {
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = ($filter ? $v : stripslashes($v));
}
}
}
}
} }
/** Escape or unescape string to use inside form [] /** Escape or unescape string to use inside form []
@@ -135,6 +116,21 @@ function html_select($name, $options, $value = "", $onchange = true) {
return $return; return $return;
} }
/** Print SQL <textarea> tag
* @param string
* @param int
* @param int
* @param string
* @return null
*/
function textarea($name, $value, $rows = 10, $cols = 80) {
echo "<textarea name='$name' rows='$rows' cols='$cols' style='width: 98%;' spellcheck='false'>" . h($value) . "</textarea>"; // spellcheck - not valid before HTML5
}
// other functions
/** Get INI boolean value /** Get INI boolean value
* @param string * @param string
* @return bool * @return bool
@@ -144,11 +140,6 @@ function ini_bool($ini) {
return (eregi('^(on|true|yes)$', $val) || (int) $val); // boolean values set by php_value are strings return (eregi('^(on|true|yes)$', $val) || (int) $val); // boolean values set by php_value are strings
} }
function q($string) {
global $connection;
return $connection->quote($string);
}
/** Get list of values from database /** Get list of values from database
* @param string * @param string
* @param mixed * @param mixed
@@ -184,27 +175,6 @@ function get_key_vals($query, $connection2 = null) {
return $return; return $return;
} }
/** Get all rows of result
* @param string
* @return array associative
*/
function get_rows($query, $connection2 = null, $error = "<p class='error'>") {
global $connection;
if (!is_object($connection2)) {
$connection2 = $connection;
}
$return = array();
$result = $connection2->query($query);
if (is_object($result)) { // can return true
while ($row = $result->fetch_assoc()) {
$return[] = $row;
}
} elseif (!$result && $error && (headers_sent() || ob_get_level())) {
echo $error . error() . "\n";
}
return $return;
}
/** Find unique identifier of a row /** Find unique identifier of a row
* @param array * @param array
* @param array result of indexes() * @param array result of indexes()
@@ -255,7 +225,6 @@ function where($where) {
*/ */
function where_check($val) { function where_check($val) {
parse_str($val, $check); parse_str($val, $check);
remove_slashes(array(&$check));
return where($check); return where($check);
} }
@@ -276,14 +245,13 @@ function where_link($i, $column, $value, $operator = "=") {
* @return bool * @return bool
*/ */
function cookie($name, $value) { function cookie($name, $value) {
global $HTTPS;
$params = array( $params = array(
$name, $name,
(ereg("\n", $value) ? "" : $value), // HTTP Response Splitting protection in PHP < 5.1.2 (ereg("\n", $value) ? "" : $value), // HTTP Response Splitting protection in PHP < 5.1.2
time() + 2592000, // 2592000 - 30 days time() + 2592000, // 2592000 - 30 days
preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]), preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]),
"", "",
$HTTPS $_SERVER["HTTPS"] && strcasecmp($_SERVER["HTTPS"], "off")
); );
if (version_compare(PHP_VERSION, '5.2.0') >= 0) { if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
$params[] = true; // HttpOnly $params[] = true; // HttpOnly
@@ -489,7 +457,7 @@ function shorten_utf8($string, $length = 80, $suffix = "") {
if (!preg_match("(^([\t\r\n -\x{FFFF}]{0,$length})($)?)u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions, (.|\n) is slow if (!preg_match("(^([\t\r\n -\x{FFFF}]{0,$length})($)?)u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions, (.|\n) is slow
preg_match("(^([\t\r\n -~]{0,$length})($)?)", $string, $match); preg_match("(^([\t\r\n -~]{0,$length})($)?)", $string, $match);
} }
return h($match[1]) . $suffix . (isset($match[2]) ? "" : "<i>...</i>"); return h($match[1]) . $suffix . (isset($match[2]) ? "" : "<em>...</em>");
} }
/** Generate friendly URL /** Generate friendly URL
@@ -548,12 +516,12 @@ function column_foreign_keys($table) {
* @param mixed int|string|array * @param mixed int|string|array
* @return null * @return null
*/ */
function enum_input($type, $attrs, $field, $value) { function enum_input($type, $name, $field, $value) {
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches); preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
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));
echo " <label><input type='$type'$attrs value='" . ($i+1) . "'" . ($checked ? ' checked' : '') . '>' . h($val) . '</label>'; echo " <label><input type='$type' name='$name' value='" . ($i+1) . "'" . ($checked ? ' checked' : '') . '>' . h($val) . '</label>';
} }
} }
@@ -568,11 +536,10 @@ function input($field, $value, $function) {
$name = h(bracket_escape($field["field"])); $name = h(bracket_escape($field["field"]));
echo "<td class='function'>"; echo "<td class='function'>";
$functions = (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field); $functions = (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field);
$attrs = " name='fields[$name]'";
if ($field["type"] == "enum") { if ($field["type"] == "enum") {
echo nbsp($functions[""]) . "<td>" . ($functions["orig"] ? "<label><input type='radio'$attrs value='-1' checked><i>$functions[orig]</i></label> " : ""); echo nbsp($functions[""]) . "<td>" . ($functions["orig"] ? "<label><input type='radio' name='fields[$name]' value='-1' checked><em>$functions[orig]</em></label> " : "");
echo $adminer->editInput($_GET["edit"], $field, $attrs, $value); echo $adminer->editInput($_GET["edit"], $field, " name='fields[$name]'", $value);
enum_input("radio", $attrs, $field, $value); enum_input("radio", "fields[$name]", $field, $value);
} else { } else {
$first = 0; $first = 0;
foreach ($functions as $key => $val) { foreach ($functions as $key => $val) {
@@ -582,8 +549,8 @@ function input($field, $value, $function) {
$first++; $first++;
} }
$onchange = ($first ? " onchange=\"var f = this.form['function[" . addcslashes($name, "\r\n'\\") . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : ""); $onchange = ($first ? " onchange=\"var f = this.form['function[" . addcslashes($name, "\r\n'\\") . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
$attrs .= $onchange; $attrs = " name='fields[$name]'$onchange";
echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) || isset($functions[$function]) ? $function : "") : nbsp(reset($functions))) . '<td>'; echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) ? $function : "") : nbsp(reset($functions))) . '<td>';
$input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table $input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
if ($input != "") { if ($input != "") {
echo $input; echo $input;
@@ -594,14 +561,14 @@ function input($field, $value, $function) {
$checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true)); $checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true));
echo " <label><input type='checkbox' name='fields[$name][$i]' value='" . (1 << $i) . "'" . ($checked ? ' checked' : '') . "$onchange>" . h($val) . '</label>'; echo " <label><input type='checkbox' name='fields[$name][$i]' value='" . (1 << $i) . "'" . ($checked ? ' checked' : '') . "$onchange>" . h($val) . '</label>';
} }
} elseif (ereg('blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) { } elseif (ereg('binary|blob|bytea', $field["type"]) && ini_bool("file_uploads")) {
echo "<input type='file' name='fields-$name'$onchange>"; echo "<input type='file' name='fields-$name'$onchange>";
} elseif (ereg('text|lob', $field["type"])) { } elseif (ereg('text|blob', $field["type"])) {
echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs>" . h($value) . '</textarea>'; // 1.2em - line-height echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs>" . h($value) . '</textarea>'; // 1.2em - line-height
} else { } else {
// int(3) is only a display hint // int(3) is only a display hint
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0)); $maxlength = (!ereg('int', $field["type"]) && preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? ($match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
echo "<input value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char|binary', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "$attrs>"; echo "<input value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char', $field["type"]) && $field["length"] > 20 ? " size='40'" : "") . "$attrs>";
} }
} }
} }
@@ -611,7 +578,7 @@ function input($field, $value, $function) {
* @return string * @return string
*/ */
function process_input($field) { function process_input($field) {
global $adminer; global $connection, $adminer;
$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];
@@ -636,12 +603,12 @@ function process_input($field) {
if ($field["type"] == "set") { if ($field["type"] == "set") {
return array_sum((array) $value); return array_sum((array) $value);
} }
if (ereg('blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) { if (ereg('binary|blob|bytea', $field["type"]) && ini_bool("file_uploads")) {
$file = get_file("fields-$idf"); $file = get_file("fields-$idf");
if (!is_string($file)) { if (!is_string($file)) {
return false; //! report errors return false; //! report errors
} }
return q($file); return $connection->quote($file);
} }
return $adminer->processInput($field, $value, $function); return $adminer->processInput($field, $value, $function);
} }
@@ -653,14 +620,12 @@ function process_input($field) {
*/ */
function search_tables() { function search_tables() {
global $adminer, $connection; global $adminer, $connection;
$_GET["where"][0]["op"] = "LIKE %%";
$_GET["where"][0]["val"] = $_POST["query"];
$found = false; $found = false;
foreach (table_status() as $table => $table_status) { foreach (table_status() as $table => $table_status) {
$name = $adminer->tableName($table_status); $name = $adminer->tableName($table_status);
if (isset($table_status["Engine"]) && $name != "" && (!$_POST["tables"] || in_array($table, $_POST["tables"]))) { if (isset($table_status["Engine"]) && $name != "" && (!$_POST["tables"] || in_array($table, $_POST["tables"]))) {
$result = $connection->query("SELECT" . limit("1 FROM " . table($table), " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())), 1)); $result = $connection->query("SELECT" . limit("1 FROM " . table($table), " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())), 1));
if ($result->fetch_row()) { if ($result->num_rows) {
if (!$found) { if (!$found) {
echo "<ul>\n"; echo "<ul>\n";
$found = true; $found = true;
@@ -738,11 +703,11 @@ function is_email($email) {
/** Check whether the string is URL address /** Check whether the string is URL address
* @param string * @param string
* @return string "http", "https" or "" * @return bool
*/ */
function is_url($string) { function is_url($string) {
$domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component //! IDN $domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component
return (preg_match("~^(https?)://($domain?\\.)+$domain(:[0-9]+)?(/.*)?(\\?.*)?(#.*)?\$~i", $string, $match) ? strtolower($match[1]) : ""); //! restrict path, query and fragment characters return preg_match("~^https?://($domain?\\.)+$domain(:[0-9]+)?(/.*)?(\\?.*)?(#.*)?\$~i", $string); //! restrict path, query and fragment characters
} }
/** Print header for hidden fieldset (close by </div></fieldset>) /** Print header for hidden fieldset (close by </div></fieldset>)

View File

@@ -8,22 +8,20 @@ $langs = array(
'nl' => 'Nederlands', // Maarten Balliauw - http://blog.maartenballiauw.be 'nl' => 'Nederlands', // Maarten Balliauw - http://blog.maartenballiauw.be
'es' => 'Español', // Klemens Häckel - http://clickdimension.wordpress.com 'es' => 'Español', // Klemens Häckel - http://clickdimension.wordpress.com
'de' => 'Deutsch', // Klemens Häckel - http://clickdimension.wordpress.com 'de' => 'Deutsch', // Klemens Häckel - http://clickdimension.wordpress.com
'fr' => 'Français', // Francis Gagné, Aurélien Royer 'fr' => 'Français', // Francis Gagné
'it' => 'Italiano', // Alessandro Fiorotto, Paolo Asperti 'it' => 'Italiano', // Alessandro Fiorotto, Paolo Asperti
'et' => 'Eesti', // Priit Kallas 'et' => 'Eesti', // Priit Kallas
'hu' => 'Magyar', // Borsos Szilárd (Borsosfi) - http://www.borsosfi.hu, info@borsosfi.hu
'ru' => 'Русский язык', // Maksim Izmaylov 'ru' => 'Русский язык', // Maksim Izmaylov
'zh' => '简体中文', // Mr. Lodar 'zh' => '简体中文', // Mr. Lodar
'zh-tw' => '繁體中文', // http://tzangms.com 'zh-tw' => '繁體中文', // http://tzangms.com
'ja' => '日本語', // Hitoshi Ozawa - http://sourceforge.jp/projects/oss-ja-jpn/releases/ 'ja' => '日本語', // Hitoshi Ozawa - http://sourceforge.jp/projects/oss-ja-jpn/releases/
'ta' => 'த‌மிழ்', // G. Sampath Kumar, Chennai, India, sampathkumar11@gmail.com
); );
function lang($idf, $number = null) { function lang($idf, $number = null) {
global $LANG, $translations; global $LANG, $translations;
$translation = $translations[$idf]; $translation = $translations[$idf];
if (is_array($translation) && $translation) { if (is_array($translation) && $translation) {
$pos = ($number == 1 || (!$number && $LANG == 'fr') ? 0 : ((!$number || $number >= 5) && ereg('cs|sk|ru', $LANG) ? 2 : 1)); // French treat zero as singular, Slavic languages use different form for 2, 3, 4 $pos = ($number == 1 ? 0 : ((!$number || $number >= 5) && ereg('cs|sk|ru', $LANG) ? 2 : 1)); // Slavic languages use different form for 2, 3, 4
$translation = $translation[$pos]; $translation = $translation[$pos];
} }
$args = func_get_args(); $args = func_get_args();

View File

@@ -1,7 +1,7 @@
<?php <?php
// 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 Min_PDO extends PDO { /*abstract */class Min_PDO extends PDO {
var $_result, $server_info, $affected_rows, $error; var $_result, $server_info, $affected_rows, $error;
function __construct() { function __construct() {

View File

@@ -1,2 +1,2 @@
<?php <?php
$VERSION = "3.0.0"; $VERSION = "3.0.0-dev";

View File

@@ -54,8 +54,6 @@ if (isset($_GET["download"])) {
include "./procedure.inc.php"; include "./procedure.inc.php";
} elseif (isset($_GET["sequence"])) { } elseif (isset($_GET["sequence"])) {
include "./sequence.inc.php"; include "./sequence.inc.php";
} elseif (isset($_GET["type"])) {
include "./type.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"])) {
@@ -66,8 +64,6 @@ if (isset($_GET["download"])) {
include "./select.inc.php"; include "./select.inc.php";
} elseif (isset($_GET["variables"])) { } elseif (isset($_GET["variables"])) {
include "./variables.inc.php"; include "./variables.inc.php";
} elseif (isset($_GET["script"])) {
include "./script.inc.php";
} else { } else {
include "./db.inc.php"; include "./db.inc.php";
} }

View File

@@ -6,10 +6,6 @@ if (ereg("MyISAM|Maria", $table_status["Engine"])) {
$index_types[] = "FULLTEXT"; $index_types[] = "FULLTEXT";
} }
$indexes = indexes($TABLE); $indexes = indexes($TABLE);
if ($jush == "sqlite") { // doesn't support primary key
unset($index_types[0]);
unset($indexes[""]);
}
if ($_POST && !$error && !$_POST["add"]) { if ($_POST && !$error && !$_POST["add"]) {
$alter = array(); $alter = array();
foreach ($_POST["indexes"] as $index) { foreach ($_POST["indexes"] as $index) {
@@ -76,19 +72,18 @@ if ($_POST) {
?> ?>
<form action="" method="post"> <form action="" method="post">
<table cellspacing="0" class="nowrap"> <table cellspacing="0">
<thead><tr><th><?php echo lang('Index Type'); ?><th><?php echo lang('Column (length)'); ?></thead> <thead><tr><th><?php echo lang('Index Type'); ?><th><?php echo lang('Column (length)'); ?></thead>
<?php <?php
$j = 1; $j = 0;
foreach ($row["indexes"] as $index) { foreach ($row["indexes"] as $index) {
echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow(this);" : 1)) . "<td>"; echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) - 1 ? "indexesAddRow(this);" : 1)) . "<td>\n";
ksort($index["columns"]); ksort($index["columns"]);
$i = 1; foreach ($index["columns"] as $i => $column) {
foreach ($index["columns"] as $column) {
echo "<span>" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn(this);" : 1)); echo "<span>" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn(this);" : 1));
echo "<input name='indexes[$j][lengths][$i]' size='2' value='" . h($index["lengths"][$i]) . "'> </span>"; //! hide for non-MySQL drivers, add ASC|DESC echo "<input name='indexes[$j][lengths][$i]' size='2' value='" . h($index["lengths"][$i]) . "'> </span>\n"; //! hide for non-MySQL drivers, add ASC|DESC
$i++;
} }
echo "\n";
$j++; $j++;
} }
?> ?>

View File

@@ -250,13 +250,5 @@ $translations = array(
'Sequence has been created.' => 'Sekvence byla vytvořena.', 'Sequence has been created.' => 'Sekvence byla vytvořena.',
'Sequence has been altered.' => 'Sekvence byla změněna.', 'Sequence has been altered.' => 'Sekvence byla změněna.',
'Alter sequence' => 'Pozměnit sekvenci', 'Alter sequence' => 'Pozměnit sekvenci',
'User types' => 'Uživatelské typy',
'Create type' => 'Vytvořit typ',
'Type has been dropped.' => 'Typ byl odstraněn.',
'Type has been created.' => 'Typ byl vytvořen.',
'Alter type' => 'Pozměnit typ',
'Search data in tables' => 'Vyhledat data v tabulkách', 'Search data in tables' => 'Vyhledat data v tabulkách',
'From server' => 'Ze serveru',
'empty' => 'prázdné',
'now' => 'teď',
); );

View File

@@ -40,7 +40,7 @@ $translations = array(
'Create new table' => 'Neue Tabelle', 'Create new table' => 'Neue Tabelle',
'Item has been deleted.' => 'Datensatz gelöscht.', 'Item has been deleted.' => 'Datensatz gelöscht.',
'Item has been updated.' => 'Datensatz geändert.', 'Item has been updated.' => 'Datensatz geändert.',
'Item%s has been inserted.' => 'Datensatz%s hinzugefügt.', 'Item has been inserted.' => 'Datensatz hinzugefügt.',
'Edit' => 'Ändern', 'Edit' => 'Ändern',
'Insert' => 'Hinzufügen', 'Insert' => 'Hinzufügen',
'Save and insert next' => 'Speichern und nächsten hinzufügen', 'Save and insert next' => 'Speichern und nächsten hinzufügen',
@@ -199,7 +199,7 @@ $translations = array(
'anywhere' => 'beliebig', 'anywhere' => 'beliebig',
'CSV Import' => 'Importiere CSV', 'CSV Import' => 'Importiere CSV',
'Import' => 'Importieren', 'Import' => 'Importieren',
'Stop on error' => 'Bei Fehler anhalten', 'Stop on error' => 'Bei Fehler anhaltan',
'%.3f s' => '%.3f s', '%.3f s' => '%.3f s',
'$1-$3-$5' => '$6.$4.$1', '$1-$3-$5' => '$6.$4.$1',
'[yyyy]-mm-dd' => 't.m.[jjjj]', '[yyyy]-mm-dd' => 't.m.[jjjj]',
@@ -225,37 +225,4 @@ $translations = array(
'File does not exist.' => 'Datei existiert nicht.', 'File does not exist.' => 'Datei existiert nicht.',
'%d in total' => '%d insgesamt', '%d in total' => '%d insgesamt',
'Permanent login' => 'Passwort speichern', 'Permanent login' => 'Passwort speichern',
'Databases have been dropped.' => 'Datenbanken entfernt.',
'Search data in tables' => 'Suche in Tabellen',
'schema' => 'Schema',
'Schema' => 'Schema',
'Alter schema' => 'Schema ändern',
'Create schema' => 'Neues Schema',
'Schema has been dropped.' => 'Schema wurde gelöscht.',
'Schema has been created.' => 'Neues Schema erstellt.',
'Schema has been altered.' => 'Schema geändert.',
'Sequences' => 'Sequenz',
'Create sequence' => 'Neue Sequenz',
'Alter sequence' => 'Sequenz ändern',
'Sequence has been dropped.' => 'Sequenz gelöscht.',
'Sequence has been created.' => 'Neue Sequenz erstellt.',
'Sequence has been altered.' => 'Sequenz geändert.',
'User types' => 'Benutzer-definierte Typen',
'Create type' => 'Typ erstellen',
'Alter type' => 'Typ ändern',
'Type has been dropped.' => 'Typ gelöscht.',
'Type has been created.' => 'Typ erstellt.',
'Double click on a value to modify it.' => 'Doppelklick zum Bearbeiten des Wertes.',
'Increase text length to modify this value.' => 'Vergrössern Sie die Textlänge um den Wert ändern zu können.',
'Use edit link to modify this value.' => 'Benutzen Sie den Link zum editieren dieses Wertes.',
'last' => 'letzte',
'From server' => 'Auf Server',
'System' => 'Datenbank System',
'Select data' => 'Daten auswählen',
'Show structure' => 'Struktur anzeigen',
'empty' => 'leer',
'Network' => 'Netzwerk',
'Geometry' => 'Geometrie',
'File exists.' => 'Datei existiert schon.',
'Attachments' => 'Anhänge',
); );

View File

@@ -2,25 +2,25 @@
$translations = array( $translations = array(
'Login' => 'Login', 'Login' => 'Login',
'Logout successful.' => 'Salida exitosa.', 'Logout successful.' => 'Salida exitosa.',
'Invalid credentials.' => 'Identificacion inválida.', 'Invalid credentials.' => 'Autenticación fallada.',
'Server' => 'Servidor', 'Server' => 'Servidor',
'Username' => 'Usuario', 'Username' => 'Usuario',
'Password' => 'Contraseña', 'Password' => 'Contraseña',
'Select database' => 'Seleccionar Base de datos', 'Select database' => 'Seleccionar Base de datos',
'Invalid database.' => 'Base de datos inválida.', 'Invalid database.' => 'Base de datos inválida.',
'Create new database' => 'Ingrese nueva base de datos', 'Create new database' => 'Nueva Base de datos',
'Table has been dropped.' => 'Tabla eliminada.', 'Table has been dropped.' => 'Tabla eliminada.',
'Table has been altered.' => 'Tabla modificada.', 'Table has been altered.' => 'Tabla modificada.',
'Table has been created.' => 'Tabla creada.', 'Table has been created.' => 'Tabla creada.',
'Alter table' => 'Modifique estructura', 'Alter table' => 'Modificar Estructura',
'Create table' => 'Cree tabla', 'Create table' => 'Crear tabla',
'Table name' => 'Nombre de la tabla', 'Table name' => 'Nombre de tabla',
'engine' => 'motor', 'engine' => 'motor',
'collation' => 'colación', 'collation' => 'colación',
'Column name' => 'Nombre de columna', 'Column name' => 'Nombre de columna',
'Type' => 'Tipo', 'Type' => 'Tipo',
'Length' => 'Longitud', 'Length' => 'Longitud',
'Auto Increment' => 'Incremento automático', 'Auto Increment' => 'Auto increment',
'Options' => 'Opciones', 'Options' => 'Opciones',
'Save' => 'Guardar', 'Save' => 'Guardar',
'Drop' => 'Eliminar', 'Drop' => 'Eliminar',
@@ -40,7 +40,7 @@ $translations = array(
'Create new table' => 'Nueva tabla', 'Create new table' => 'Nueva tabla',
'Item has been deleted.' => 'Registro eliminado.', 'Item has been deleted.' => 'Registro eliminado.',
'Item has been updated.' => 'Registro modificado.', 'Item has been updated.' => 'Registro modificado.',
'Item%s has been inserted.' => 'Registro%s insertado.', 'Item has been inserted.' => 'Registro insertado.',
'Edit' => 'Modificar', 'Edit' => 'Modificar',
'Insert' => 'Agregar', 'Insert' => 'Agregar',
'Save and insert next' => 'Guardar e insertar otro', 'Save and insert next' => 'Guardar e insertar otro',
@@ -69,13 +69,13 @@ $translations = array(
'Foreign keys' => 'Claves foráneas', 'Foreign keys' => 'Claves foráneas',
'Triggers' => 'Triggers', 'Triggers' => 'Triggers',
'View' => 'Vistas', 'View' => 'Vistas',
'Unable to select the table' => 'No es posible seleccionar la tabla', 'Unable to select the table' => 'No posible seleccionar la tabla',
'Invalid CSRF token. Send the form again.' => 'Token CSRF inválido. Vuelva a enviar los datos del formulario.', 'Invalid CSRF token. Send the form again.' => 'Token CSRF inválido. Vuelva a enviar los datos del formulario.',
'Comment' => 'Comentario', 'Comment' => 'Comentario',
'Default values' => 'Valores predeterminados', 'Default values' => 'Valores predeterminados',
'%d byte(s)' => array('%d byte', '%d bytes'), '%d byte(s)' => array('%d byte', '%d bytes'),
'No commands to execute.' => 'No hay comando para ejecutar.', 'No commands to execute.' => 'No hay comando para ejecutar.',
'Unable to upload a file.' => 'No es posible importar archivo.', 'Unable to upload a file.' => 'No posible importar archivo.',
'File upload' => 'Importar archivo', 'File upload' => 'Importar archivo',
'File uploads are disabled.' => 'Importación de archivos deshablilitado.', 'File uploads are disabled.' => 'Importación de archivos deshablilitado.',
'Routine has been called, %d row(s) affected.' => array('Consulta ejecutada, %d registro afectado.', 'Consulta ejecutada, %d registros afectados.'), 'Routine has been called, %d row(s) affected.' => array('Consulta ejecutada, %d registro afectado.', 'Consulta ejecutada, %d registros afectados.'),
@@ -83,13 +83,13 @@ $translations = array(
'No extension' => 'No hay extension', 'No extension' => 'No hay extension',
'None of the supported PHP extensions (%s) are available.' => 'Ninguna de las extensiones PHP soportadas (%s) está disponible.', 'None of the supported PHP extensions (%s) are available.' => 'Ninguna de las extensiones PHP soportadas (%s) está disponible.',
'Session support must be enabled.' => 'Deben estar habilitadas las sesiones.', 'Session support must be enabled.' => 'Deben estar habilitadas las sesiones.',
'Session expired, please login again.' => 'Sesión expirada, por favor ingrese su clave de nuevo.', 'Session expired, please login again.' => 'Sesión expirada, favor loguéese de nuevo.',
'Text length' => 'Longitud de texto', 'Text length' => 'Longitud de texto',
'Foreign key has been dropped.' => 'Clave externa eliminada.', 'Foreign key has been dropped.' => 'Clave foránea eliminada.',
'Foreign key has been altered.' => 'Clave externa modificada.', 'Foreign key has been altered.' => 'Clave foránea modificada.',
'Foreign key has been created.' => 'Clave externa creada.', 'Foreign key has been created.' => 'Clave foránea creada.',
'Foreign key' => 'Clave externa', 'Foreign key' => 'Clave foránea',
'Target table' => 'Tabla de destino', 'Target table' => 'Tabla destino',
'Change' => 'Modificar', 'Change' => 'Modificar',
'Source' => 'Origen', 'Source' => 'Origen',
'Target' => 'Destino', 'Target' => 'Destino',
@@ -109,7 +109,7 @@ $translations = array(
'Process list' => 'Lista de procesos', 'Process list' => 'Lista de procesos',
'%d process(es) have been killed.' => array('%d proceso detenido.', '%d procesos detenidos.'), '%d process(es) have been killed.' => array('%d proceso detenido.', '%d procesos detenidos.'),
'Kill' => 'Detener', 'Kill' => 'Detener',
'Parameter name' => 'Nombre de Parámetro', 'Parameter name' => 'Nombre de Parametro',
'Database schema' => 'Esquema de base de datos', 'Database schema' => 'Esquema de base de datos',
'Create procedure' => 'Crear procedimiento', 'Create procedure' => 'Crear procedimiento',
'Create function' => 'Crear función', 'Create function' => 'Crear función',
@@ -118,7 +118,7 @@ $translations = array(
'Routine has been created.' => 'Procedimiento creado.', 'Routine has been created.' => 'Procedimiento creado.',
'Alter function' => 'Modificar Función', 'Alter function' => 'Modificar Función',
'Alter procedure' => 'Modificar procedimiento', 'Alter procedure' => 'Modificar procedimiento',
'Return type' => 'Tipo de valor de regreso', 'Return type' => 'Tipo de valor retornado',
'Add trigger' => 'Agregar trigger', 'Add trigger' => 'Agregar trigger',
'Trigger has been dropped.' => 'Trigger eliminado.', 'Trigger has been dropped.' => 'Trigger eliminado.',
'Trigger has been altered.' => 'Trigger modificado.', 'Trigger has been altered.' => 'Trigger modificado.',
@@ -162,7 +162,7 @@ $translations = array(
'At given time' => 'A hora determinada', 'At given time' => 'A hora determinada',
'Every' => 'Cada', 'Every' => 'Cada',
'Events' => 'Eventos', 'Events' => 'Eventos',
'Schedule' => 'Agenda', 'Schedule' => 'Agendamiento',
'Start' => 'Inicio', 'Start' => 'Inicio',
'End' => 'Fin', 'End' => 'Fin',
'Status' => 'Estado', 'Status' => 'Estado',
@@ -190,7 +190,7 @@ $translations = array(
'%d item(s) have been affected.' => array('%d ítem afectado.', '%d itemes afectados.'), '%d item(s) have been affected.' => array('%d ítem afectado.', '%d itemes afectados.'),
'whole result' => 'resultado completo', 'whole result' => 'resultado completo',
'Clone' => 'Clonar', 'Clone' => 'Clonar',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Cantida máxima de campos permitidos excedidos. Por favor aumente %s y %s.', 'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Cantida máxima de campos permitidos excedidos. Favor aumente %s y %s.',
'Partition by' => 'Particionar por', 'Partition by' => 'Particionar por',
'Partitions' => 'Particiones', 'Partitions' => 'Particiones',
'Partition name' => 'Nombre de Partición', 'Partition name' => 'Nombre de Partición',
@@ -225,37 +225,4 @@ $translations = array(
'File does not exist.' => 'Archivo no existe.', 'File does not exist.' => 'Archivo no existe.',
'%d in total' => '%d en total', '%d in total' => '%d en total',
'Permanent login' => 'Guardar contraseña', 'Permanent login' => 'Guardar contraseña',
'Databases have been dropped.' => 'Bases de datos eliminadas.',
'Search data in tables' => 'Buscar datos en tablas',
'schema' => 'esquema',
'Schema' => 'Esquema',
'Alter schema' => 'Modificar esquema',
'Create schema' => 'Crear esquema',
'Schema has been dropped.' => 'Esquema eliminado.',
'Schema has been created.' => 'Esquema creado.',
'Schema has been altered.' => 'Esquema modificado.',
'Sequences' => 'Secuencias',
'Create sequence' => 'Crear secuencias',
'Alter sequence' => 'Modificar secuencia',
'Sequence has been dropped.' => 'Secuencia eliminada.',
'Sequence has been created.' => 'Secuencia creada.',
'Sequence has been altered.' => 'Secuencia modificada.',
'User types' => 'Tipos definido por el usuario',
'Create type' => 'Crear tipo',
'Alter type' => 'Modificar tipo',
'Type has been dropped.' => 'Tipo eliminado.',
'Type has been created.' => 'Tipo creado.',
'Double click on a value to modify it.' => 'Doble-clic sobre el valor para editarlo.',
'Increase text length to modify this value.' => 'Aumente el tamaño del campo de texto para modificar este valor.',
'Use edit link to modify this value.' => 'Utilice el enlace de modificar para realizar los cambios.',
'last' => 'último',
'From server' => 'Desde servidor',
'System' => 'Motor de base de datos',
'Select data' => 'Seleccionar datos',
'Show structure' => 'Mostrar estructura',
'empty' => 'ningúno',
'Network' => 'Red',
'Geometry' => 'Geometría',
'File exists.' => 'Archivo ya existe.',
'Attachments' => 'Adjuntos',
); );

View File

@@ -40,7 +40,7 @@ $translations = array(
'Create new table' => 'Loo uus tabel', 'Create new table' => 'Loo uus tabel',
'Item has been deleted.' => 'Kustutamine õnnestus.', 'Item has been deleted.' => 'Kustutamine õnnestus.',
'Item has been updated.' => 'Uuendamine õnnestus.', 'Item has been updated.' => 'Uuendamine õnnestus.',
'Item%s has been inserted.' => 'Kirje%s on edukalt lisatud.', 'Item has been inserted.' => 'Lisamine õnnestus.',
'Edit' => 'Muuda', 'Edit' => 'Muuda',
'Insert' => 'Sisesta', 'Insert' => 'Sisesta',
'Save and insert next' => 'Salvesta ja lisa järgmine', 'Save and insert next' => 'Salvesta ja lisa järgmine',
@@ -225,37 +225,4 @@ $translations = array(
'File does not exist.' => 'Faili ei leitud.', 'File does not exist.' => 'Faili ei leitud.',
'%d in total' => 'Kokku: %d', '%d in total' => 'Kokku: %d',
'Permanent login' => 'Jäta mind meelde', 'Permanent login' => 'Jäta mind meelde',
'Databases have been dropped.' => 'Andmebaasid on edukalt kustutatud.',
'Search data in tables' => 'Otsi kogu andmebaasist',
'schema' => 'struktuur',
'Schema' => 'Struktuur',
'Alter schema' => 'Muuda struktuuri',
'Create schema' => 'Loo struktuur',
'Schema has been dropped.' => 'Struktuur on edukalt kustutatud.',
'Schema has been created.' => 'Struktuur on edukalt loodud.',
'Schema has been altered.' => 'Struktuur on edukalt muudetud.',
'Sequences' => 'Jadad (sequences)',
'Create sequence' => 'Loo jada',
'Alter sequence' => 'Muuda jada',
'Sequence has been dropped.' => 'Jada on edukalt kustutatud.',
'Sequence has been created.' => 'Jada on edukalt loodud.',
'Sequence has been altered.' => 'Jada on edukalt muudetud.',
'User types' => 'Kasutajatüübid',
'Create type' => 'Loo tüüp',
'Alter type' => 'Muuda tüüpi',
'Type has been dropped.' => 'Tüüp on edukalt kustutatud.',
'Type has been created.' => 'Tüüp on edukalt loodud.',
'Double click on a value to modify it.' => 'Väärtuse muutmiseks topelt-kliki sellel.',
'Increase text length to modify this value.' => 'Väärtuse muutmiseks suurenda tekstiveeru pikkust.',
'Use edit link to modify this value.' => 'Väärtuse muutmiseks kasuta muutmislinki.',
'last' => 'viimane',
'From server' => 'Serverist',
'System' => 'Andmebaasimootor',
'Select data' => 'Vaata andmeid',
'Show structure' => 'Näita struktuuri',
'empty' => 'tühi',
'Network' => 'Võrk (network)',
'Geometry' => 'Geomeetria',
'File exists.' => 'Fail juba eksisteerib.',
'Attachments' => 'Manused',
); );

View File

@@ -1,32 +1,33 @@
<?php <?php
$translations = array( $translations = array(
'Login' => 'Authentification', 'Login' => 'Authentification',
'Logout successful.' => 'Au revoir!', 'Logout successful.' => 'Aurevoir!',
'Invalid credentials.' => 'Authentification échouée.', 'Invalid credentials.' => 'Authentification échouée.',
'Server' => 'Serveur', 'Server' => 'Serveur',
'Username' => 'Utilisateur', 'Username' => 'Utilisateur',
'Password' => 'Mot de passe', 'Password' => 'Mot de passe',
'Select database' => 'Sélectionner la base de données', 'Select database' => 'Selectionner la base de donnée',
'Invalid database.' => 'Base de données invalide.', 'Invalid database.' => 'Base de donnée invalide.',
'Create new database' => 'Créer une base de données', 'Create new database' => 'Créer une base de donnée',
'Table has been dropped.' => 'La table a été effacée.', 'Table has been dropped.' => 'Table effacée.',
'Table has been altered.' => 'La table a été modifiée.', 'Table has been altered.' => 'Table modifiée.',
'Table has been created.' => 'La table a été créée.', 'Table has been created.' => 'Table créée.',
'Alter table' => 'Modifier la table', 'Alter table' => 'Modifier la table',
'Create table' => 'Créer une table', 'Create table' => 'Créer une table',
'Table name' => 'Nom de la table', 'Table name' => 'Nom de la table',
'engine' => 'moteur', 'engine' => 'moteur',
'collation' => 'interclassement', 'collation' => 'collation',
'Column name' => 'Nom de la colonne', 'Column name' => 'Nom de la colonne',
'Type' => 'Type', 'Type' => 'Type',
'Length' => 'Longueur', 'Length' => 'Longeur',
'Auto Increment' => 'Auto increment', 'Auto Increment' => 'Auto increment',
'Options' => 'Options', 'Options' => 'Options',
'Save' => 'Sauvegarder', 'Save' => 'Sauvegarder',
'Drop' => 'Supprimer', 'Drop' => 'Effacer',
'Database has been created.' => 'La base de données a été créée.', 'Database has been dropped.' => 'Base de données effacée.',
'Database has been renamed.' => 'La base de données a été renommée.', 'Database has been created.' => 'Base de données créée.',
'Database has been altered.' => 'La base de données a été modifiée.', 'Database has been renamed.' => 'Base de données renommée.',
'Database has been altered.' => 'Base de données modifiée.',
'Alter database' => 'Modifier la base de données', 'Alter database' => 'Modifier la base de données',
'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',
@@ -34,11 +35,12 @@ $translations = array(
'Logout' => 'Déconnexion', 'Logout' => 'Déconnexion',
'database' => 'base de données', 'database' => 'base de données',
'Use' => 'Utiliser', 'Use' => 'Utiliser',
'No tables.' => 'Aucune table.', 'No tables.' => 'Aucunes tables.',
'select' => 'select', 'select' => 'select',
'Create new table' => 'Créer une nouvelle table', 'Create new table' => 'Créer une table',
'Item has been deleted.' => 'L\'élément a été supprimé.', 'Item has been deleted.' => 'Élément supprimé.',
'Item has been updated.' => 'L\'élément a été modifié.', 'Item has been updated.' => 'Élément modifié.',
'Item has been inserted.' => 'Élément inseré.',
'Edit' => 'Modifier', 'Edit' => 'Modifier',
'Insert' => 'Insérer', 'Insert' => 'Insérer',
'Save and insert next' => 'Sauvegarder et insérer le prochain', 'Save and insert next' => 'Sauvegarder et insérer le prochain',
@@ -49,22 +51,22 @@ $translations = array(
'Indexes' => 'Index', 'Indexes' => 'Index',
'Alter indexes' => 'Modifier les index', 'Alter indexes' => 'Modifier les index',
'Add next' => 'Ajouter le prochain', 'Add next' => 'Ajouter le prochain',
'Language' => 'Langue', 'Language' => 'Langues',
'Select' => 'Select', 'Select' => 'Select',
'New item' => 'Nouvel élément', 'New item' => 'Nouvel élément',
'Search' => 'Rechercher', 'Search' => 'Rechercher',
'Sort' => 'Trier', 'Sort' => 'Ordonner',
'descending' => 'décroissant', 'descending' => 'décroissant',
'Limit' => 'Limite', 'Limit' => 'Limit',
'No rows.' => 'Aucun résultat.', 'No rows.' => 'Aucun résultat.',
'Action' => 'Action', 'Action' => 'Action',
'edit' => 'modifier', 'edit' => 'modifier',
'Page' => 'Page', 'Page' => 'Page',
'Query executed OK, %d row(s) affected.' => array('Requête exécutée avec succès, %d ligne modifiée.', 'Requête exécutée avec succès, %d lignes modifiées.'), 'Query executed OK, %d row(s) affected.' => array('Requête exécutée, %d ligne affectée.', 'Requête exécutée, %d lignes affectées.'),
'Error in query' => 'Erreur dans la requête', 'Error in query' => 'Erreur dans la requête',
'Execute' => 'Exécuter', 'Execute' => 'Exécuter',
'Table' => 'Table', 'Table' => 'Table',
'Foreign keys' => 'Clés étrangères', 'Foreign keys' => 'Clé éxterne',
'Triggers' => 'Triggers', 'Triggers' => 'Triggers',
'View' => 'Vue', 'View' => 'Vue',
'Unable to select the table' => 'Impossible de sélectionner la table', 'Unable to select the table' => 'Impossible de sélectionner la table',
@@ -75,81 +77,81 @@ $translations = array(
'No commands to execute.' => 'Aucune commande à exécuter.', 'No commands to execute.' => 'Aucune commande à exécuter.',
'Unable to upload a file.' => 'Impossible d\'importer le fichier.', 'Unable to upload a file.' => 'Impossible d\'importer le fichier.',
'File upload' => 'Importer un fichier', 'File upload' => 'Importer un fichier',
'File uploads are disabled.' => 'L\'importation de fichier est désactivée.', 'File uploads are disabled.' => 'Importation de fichier désactivé.',
'Routine has been called, %d row(s) affected.' => array('La routine a été exécutée, %d ligne modifiée.', 'La routine a été exécutée, %d lignes modifiées.'), 'Routine has been called, %d row(s) affected.' => array('Routine exécutée, %d ligne modifiée.', 'Routine exécutée, %d lignes modifiées.'),
'Call' => 'Appeler', 'Call' => 'Appeler',
'No extension' => 'Extension introuvable', 'No extension' => 'Extension introuvable',
'None of the supported PHP extensions (%s) are available.' => 'Aucune des extensions PHP supportées (%s) n\'est disponible.', 'None of the supported PHP extensions (%s) are available.' => 'Aucune des extensions PHP supportées (%s) n\'est disponible.',
'Session support must be enabled.' => 'Veuillez activer les sessions.', 'Session support must be enabled.' => 'Veuillez activer les sessions.',
'Session expired, please login again.' => 'Session expirée, veuillez vous authentifier à nouveau.', 'Session expired, please login again.' => 'Session expirée, veuillez vous authentifier à nouveau.',
'Text length' => 'Longueur du texte', 'Text length' => 'Longueur du texte',
'Foreign key has been dropped.' => 'La clé étrangère a été effacée.', 'Foreign key has been dropped.' => 'Clé externe effacée.',
'Foreign key has been altered.' => 'La clé étrangère a été modifiée.', 'Foreign key has been altered.' => 'Clé externe modifiée.',
'Foreign key has been created.' => 'La clé étrangère a été créée.', 'Foreign key has been created.' => 'Clé externe créée.',
'Foreign key' => 'Clé étrangère', 'Foreign key' => 'Clé externe',
'Target table' => 'Table visée', 'Target table' => 'Table visée',
'Change' => 'Modifier', 'Change' => 'Modifier',
'Source' => 'Source', 'Source' => 'Source',
'Target' => 'Cible', 'Target' => 'Cible',
'Add column' => 'Ajouter une colonne', 'Add column' => 'Ajouter une colonne',
'Alter' => 'Modifier', 'Alter' => 'Modifier',
'Add foreign key' => 'Ajouter une clé étrangère', 'Add foreign key' => 'Ajouter une clé externe',
'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',
'Column (length)' => 'Colonne (longueur)', 'Column (length)' => 'Colonne (longueur)',
'View has been dropped.' => 'La vue a été effacée.', 'View has been dropped.' => 'Vue effacée.',
'View has been altered.' => 'La vue a été modifiée.', 'View has been altered.' => 'Vue modifiée.',
'View has been created.' => 'La vue a été créée.', 'View has been created.' => 'Vue créée.',
'Alter view' => 'Modifier une vue', 'Alter view' => 'Modifier une vue',
'Create view' => 'Créer une vue', 'Create view' => 'Créer une vue',
'Name' => 'Nom', 'Name' => 'Nom',
'Process list' => 'Liste des processus', 'Process list' => 'Liste de processus',
'%d process(es) have been killed.' => array('%d processus a été arrêté.', '%d processus ont été arrêtés.'), '%d process(es) have been killed.' => array('%d processus arrêté.', '%d processus arrêtés.'),
'Kill' => 'Arrêter', 'Kill' => 'Arrêter',
'Parameter name' => 'Nom du paramètre', 'Parameter name' => 'Nom du Paramêtre',
'Database schema' => 'Schéma de la base de données', 'Database schema' => 'Schéma de la base de données',
'Create procedure' => 'Créer une procédure', 'Create procedure' => 'Créer une procédure',
'Create function' => 'Créer une fonction', 'Create function' => 'Créer une fonction',
'Routine has been dropped.' => 'La routine a été supprimée.', 'Routine has been dropped.' => 'Procédure éliminée.',
'Routine has been altered.' => 'La routine a été modifiée.', 'Routine has been altered.' => 'Procédure modifiée.',
'Routine has been created.' => 'La routine a été créée.', 'Routine has been created.' => 'Procédure créée.',
'Alter function' => 'Modifier la fonction', 'Alter function' => 'Modifier la fonction',
'Alter procedure' => 'Modifier la procédure', 'Alter procedure' => 'Modifier la procédure',
'Return type' => 'Type de retour', 'Return type' => 'Type de retour',
'Add trigger' => 'Ajouter un trigger', 'Add trigger' => 'Ajouter un trigger',
'Trigger has been dropped.' => 'Le trigger a été supprimé.', 'Trigger has been dropped.' => 'Trigger éliminé.',
'Trigger has been altered.' => 'Le trigger a été modifié.', 'Trigger has been altered.' => 'Trigger modifié.',
'Trigger has been created.' => 'Le trigger a été créé.', 'Trigger has been created.' => 'Trigger créé.',
'Alter trigger' => 'Modifier un trigger', 'Alter trigger' => 'Modifier un trigger',
'Create trigger' => 'Ajouter un trigger', 'Create trigger' => 'Ajouter un trigger',
'Time' => 'Temps', 'Time' => 'Temps',
'Event' => 'Évènement', 'Event' => 'Évènement',
'%d row(s)' => array('%d ligne', '%d lignes'), '%d row(s)' => array('%d ligne', '%d lignes'),
'Remove' => 'Effacer', 'Remove' => 'Effacer',
'Are you sure?' => 'Êtes-vous certain ?', 'Are you sure?' => 'Êtes-vous certain?',
'Privileges' => 'Privilèges', 'Privileges' => 'Privilège',
'Create user' => 'Créer un utilisateur', 'Create user' => 'Créer un utilisateur',
'User has been dropped.' => 'L\'utilisateur a été effacé.', 'User has been dropped.' => 'Utilisateur éffacé.',
'User has been altered.' => 'L\'utilisateur a été modifié.', 'User has been altered.' => 'Utilisateur modifié.',
'User has been created.' => 'L\'utilisateur a été créé.', 'User has been created.' => 'Utilisateur créé.',
'Hashed' => 'Haché', 'Hashed' => 'Haché',
'Column' => 'Colonne', 'Column' => 'Colonne',
'Routine' => 'Routine', 'Routine' => 'Routine',
'Grant' => 'Grant', 'Grant' => 'Grant',
'Revoke' => 'Revoke', 'Revoke' => 'Revoke',
'%s version: %s through PHP extension %s' => 'Version de %s : %s via l\'extension PHP %s', '%s version: %s through PHP extension %s' => 'Version de %s: %s utilisant l\'extension %s',
'Logged as: %s' => 'Authentifié en tant que %s', 'Logged as: %s' => 'Authentifié en tant que %s',
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'Données POST trop grandes. Réduisez la taille des données ou augmentez la valeur de %s dans la configuration de PHP.', 'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'Donnée POST trop grande . Réduire la taille des données ou modifier le %s dans la configuration de PHP.',
'Move up' => 'Déplacer vers le haut', 'Move up' => 'Déplacer vers le haut',
'Move down' => 'Déplacer vers le bas', 'Move down' => 'Déplacer vers le bas',
'Export' => 'Exporter', 'Export' => 'Exporter',
'Tables' => 'Tables', 'Tables' => 'Tables',
'Data' => 'Données', 'Data' => 'Donnée',
'Output' => 'Sortie', 'Output' => 'Sortie',
'open' => 'ouvrir', 'open' => 'ouvrir',
'save' => 'sauvegarder', 'save' => 'sauvegarder',
'Format' => 'Format', 'Format' => 'Formatter',
'Functions' => 'Fonctions', 'Functions' => 'Fonctions',
'Aggregation' => 'Agrégation', 'Aggregation' => 'Agrégation',
'Event has been dropped.' => 'L\'évènement a été supprimé.', 'Event has been dropped.' => 'L\'évènement a été supprimé.',
@@ -160,9 +162,9 @@ $translations = array(
'Start' => 'Démarrer', 'Start' => 'Démarrer',
'End' => 'Terminer', 'End' => 'Terminer',
'Every' => 'Chaque', 'Every' => 'Chaque',
'Status' => 'Statut', 'Status' => 'Status',
'On completion preserve' => 'Conserver quand complété', 'On completion preserve' => 'Conserver quand complété',
'Events' => 'Évènements', 'Events' => 'Évènement',
'Schedule' => 'Horaire', 'Schedule' => 'Horaire',
'At given time' => 'À un moment précis', 'At given time' => 'À un moment précis',
'Save and continue edit' => 'Sauvegarder et continuer l\'édition', 'Save and continue edit' => 'Sauvegarder et continuer l\'édition',
@@ -172,42 +174,42 @@ $translations = array(
'Tables have been dropped.' => 'Les tables ont été effacées.', 'Tables have been dropped.' => 'Les tables ont été effacées.',
'Tables and views' => 'Tables et vues', 'Tables and views' => 'Tables et vues',
'Engine' => 'Moteur', 'Engine' => 'Moteur',
'Collation' => 'Interclassement', 'Collation' => 'Collation',
'Data Length' => 'Longueur des données', 'Data Length' => 'Longeur des données',
'Index Length' => 'Longueur de l\'index', 'Index Length' => 'Longeur de l\'index',
'Data Free' => 'Espace inutilisé', 'Data Free' => 'Vide',
'Rows' => 'Lignes', 'Rows' => 'Rangés',
',' => ',', ',' => ',',
'Analyze' => 'Analyser', 'Analyze' => 'Analyser',
'Optimize' => 'Optimiser', 'Optimize' => 'Opitimiser',
'Check' => 'Vérifier', 'Check' => 'Vérifier',
'Repair' => 'Réparer', 'Repair' => 'Réparer',
'Truncate' => 'Tronquer', 'Truncate' => 'Tronquer',
'Move to other database' => 'Déplacer vers une autre base de données', 'Move to other database' => 'Déplacer dans une autre base de données',
'Move' => 'Déplacer', 'Move' => 'Déplacer',
'%d item(s) have been affected.' => array('%d élément a été modifié.', '%d éléments ont été modifiés.'), '%d item(s) have been affected.' => array('%d élément ont été modifié.', '%d éléments ont été modifié.'),
'whole result' => 'résultat entier', 'whole result' => 'résultat entier',
'Clone' => 'Cloner', 'Clone' => 'Cloner',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Le nombre maximum de champs est dépassé. Veuillez augmenter %s et %s.', 'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Le nombre de champs maximum est dépassé. Veuillez augmenter %s et %s.',
'Partition by' => 'Partitionner par', 'Partition by' => 'Partitionné par',
'Partitions' => 'Partitions', 'Partitions' => 'Partitions',
'Partition name' => 'Nom de la partition', 'Partition name' => 'Nom de la partition',
'Values' => 'Valeurs', 'Values' => 'Valeurs',
'%d row(s) have been imported.' => array('%d ligne a été importée.','%d lignes ont été importées.'), '%d row(s) have been imported.' => array('%d ligne a été importé.','%d lignes ont été importé.'),
'anywhere' => 'n\'importe où', 'anywhere' => 'n\'importe où',
'CSV Import' => 'Importer CSV', 'CSV Import' => 'Importation CVS',
'Import' => 'Importer', 'Import' => 'Importer',
'Stop on error' => 'Arrêter en cas d\'erreur', 'Stop on error' => 'Arrêt sur erreur',
'%.3f s' => '%.3f s', '%.3f s' => '%.3f s',
'$1-$3-$5' => '$5/$3/$1', '$1-$3-$5' => '$5/$3/$1',
'[yyyy]-mm-dd' => 'jj/mm/[aaaa]', '[yyyy]-mm-dd' => 'jj/mm/[aaaa]',
'History' => 'Historique', 'History' => 'Historique',
'Variables' => 'Variables', 'Variables' => 'Variables',
'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.' => 'Les colonnes de source et de destination doivent être du même type, il doit y avoir un index sur les colonnes de destination et les données référencées doivent exister.', 'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.' => 'Les colonnes selectionnées et les colonnes de destination doivent être du même type, il doit y avoir un index sur les colonnes de destination et les données de référence doivent exister.',
'Relations' => 'Relations', 'Relations' => 'Relations',
'Run file' => 'Exécuter le fichier', 'Run file' => 'Executer le fichier',
'Clear' => 'Effacer', 'Clear' => 'Effacer',
'Maximum allowed file size is %sB.' => 'La taille maximale des fichiers est de %sB.', 'Maximum allowed file size is %sB.' => 'Taille maximale des fichiers est de %sB.',
'Numbers' => 'Nombres', 'Numbers' => 'Nombres',
'Date and time' => 'Date et heure', 'Date and time' => 'Date et heure',
'Strings' => 'Chaînes', 'Strings' => 'Chaînes',
@@ -219,44 +221,8 @@ $translations = array(
'Subject' => 'Sujet', 'Subject' => 'Sujet',
'Send' => 'Envoyer', 'Send' => 'Envoyer',
'%d e-mail(s) have been sent.' => array('%d message a été envoyé.', '%d messages ont été envoyés.'), '%d e-mail(s) have been sent.' => array('%d message a été envoyé.', '%d messages ont été envoyés.'),
'Webserver file %s' => 'Fichier %s du serveur Web', 'Webserver file %s' => '%s fichier du serveur Web',
'File does not exist.' => 'Le fichier est introuvable.', 'File does not exist.' => 'Le fichier est introuvable.',
'%d in total' => '%d au total', '%d in total' => '%d au total',
'Permanent login' => 'Authentification permanente', 'Permanent login' => 'Authentification permanente',
'Databases have been dropped.' => 'Les bases de données ont été supprimées.',
'Database has been dropped.' => 'La base de données a été supprimée.',
'Search data in tables' => 'Rechercher dans les tables',
'schema' => 'schéma',
'Schema' => 'Schéma',
'Alter schema' => 'Modifier le schéma',
'Create schema' => 'Créer un schéma',
'Schema has been dropped.' => 'Le schéma a été supprimé.',
'Schema has been created.' => 'Le schéma a été créé.',
'Schema has been altered.' => 'Le schéma a été modifié.',
'Sequences' => 'Séquences',
'Create sequence' => 'Créer une séquence',
'Alter sequence' => 'Modifier la séquence',
'Sequence has been dropped.' => 'La séquence a été supprimée.',
'Sequence has been created.' => 'La séquence a été créée.',
'Sequence has been altered.' => 'La séquence a été modifiée.',
'User types' => 'Types utilisateur',
'Create type' => 'Créer un type',
'Alter type' => 'Modifier le type',
'Type has been dropped.' => 'Le type a été supprimé.',
'Type has been created.' => 'Le type a été créé.',
'Double click on a value to modify it.' => 'Double-cliquez sur une valeur pour la modifier.',
'Increase text length to modify this value.' => 'Augmentez la longueur de texte affiché pour modifier cette valeur.',
'Use edit link to modify this value.' => 'Utilisez le lien "modifier" pour modifier cette valeur.',
'last' => 'dernière',
'From server' => 'Depuis le serveur',
'System' => 'Système',
'Select data' => 'Afficher les données',
'Show structure' => 'Afficher la structure',
'empty' => 'vide',
'Network' => 'Réseau',
'Geometry' => 'Géométrie',
'File exists.' => 'Le fichier existe.',
'Attachments' => 'Pièces jointes',
'Item%s has been inserted.' => 'L\'élément%s a été inséré.',
'now' => 'maintenant',
); );

View File

@@ -1,262 +0,0 @@
<?php
$translations = array(
'Login' => 'Belépés',
'Logout successful.' => 'Sikeres kilépés.',
'Invalid credentials.' => 'Érvénytelen adatok.',
'Server' => 'Szerver',
'Username' => 'Felhasználó',
'Password' => 'Jelszó',
'Select database' => 'Adatbázis kiválasztása',
'Invalid database.' => 'Érvénytelen adatbázis.',
'Create new database' => 'Új adatbázis',
'Table has been dropped.' => 'A tábla eldobva.',
'Table has been altered.' => 'A tábla módosult.',
'Table has been created.' => 'A tábla létrejött.',
'Alter table' => 'Tábla módosítása',
'Create table' => 'Tábla létrehozása',
'Table name' => 'Tábla név',
'engine' => 'motor',
'collation' => 'egybevetés',
'Column name' => 'Oszlop neve',
'Type' => 'Típus',
'Length' => 'Hossz',
'Auto Increment' => 'Automatikus növelés',
'Options' => 'Opciók',
'Save' => 'Mentés',
'Drop' => 'Eldob',
'Database has been dropped.' => 'Az adatbázis eldobva.',
'Database has been created.' => 'Az adatbázis létrejött.',
'Database has been renamed.' => 'Az adadtbázis átnevezve.',
'Database has been altered.' => 'Az adatbázis módosult.',
'Alter database' => 'Adatbázis módosítása',
'Create database' => 'Adatbázis létrehozása',
'SQL command' => 'SQL parancs',
'Dump' => 'Exportálás',
'Logout' => 'Kilépés',
'database' => 'adatbázis',
'Use' => 'Használ',
'No tables.' => 'Nincs tábla.',
'select' => 'kiválaszt',
'Create new table' => 'Új tábla',
'Item has been deleted.' => 'A tétel törölve.',
'Item has been updated.' => 'A tétel frissítve.',
'Item%s has been inserted.' => '%s tétel beszúrva.',
'Edit' => 'Szerkeszt',
'Insert' => 'Beszúr',
'Save and insert next' => 'Mentés és újat beszúr',
'Delete' => 'Törlés',
'Database' => 'Adatbázis',
'Routines' => 'Rutinok',
'Indexes have been altered.' => 'Az indexek megváltoztak.',
'Indexes' => 'Indexek',
'Alter indexes' => 'Index módosítása',
'Add next' => 'Következő hozzáadása',
'Language' => 'Nyelv',
'Select' => 'Kiválaszt',
'New item' => 'Új tétel',
'Search' => 'Keresés',
'Sort' => 'Sorba rendezés',
'descending' => 'csökkenő',
'Limit' => 'korlát',
'No rows.' => 'Nincs megjeleníthető eredmény.',
'Action' => 'Művelet',
'edit' => 'szerkeszt',
'Page' => 'oldal',
'Query executed OK, %d row(s) affected.' => array('Lekérdezés sikeresen végrehajtva, %d sor érintett.', 'Lekérdezés sikeresen végrehajtva, %d sor érintett.', 'Lekérdezés sikeresen végrehajtva, %d sor érintett.'),
'Error in query' => 'Hiba a lekérdezésben',
'Execute' => 'Végrehajt',
'Table' => 'Tábla',
'Foreign keys' => 'Idegen kulcs',
'Triggers' => 'Trigger',
'View' => 'Nézet',
'Unable to select the table' => 'Nem tudom kiválasztani a táblát.',
'Invalid CSRF token. Send the form again.' => 'Érvénytelen CSRF azonosító. Küldd újra az űrlapot.',
'Comment' => 'Megjegyzés',
'Default values' => 'Alapértelmezett értékek',
'%d byte(s)' => array('%d bájt', '%d bájt', '%d bájt'),
'No commands to execute.' => 'Nincs végrehajtható parancs.',
'Unable to upload a file.' => 'Nem tudom feltölteni a fájlt.',
'File upload' => 'Fájl feltöltése',
'File uploads are disabled.' => 'A fájl feltöltés le van tiltva.',
'Routine has been called, %d row(s) affected.' => array('Rutin meghívva, %d sor érintett.', 'Rutin meghívva, %d sor érintett.', 'Rutin meghívva, %d sor érintett.'),
'Call' => 'Meghív',
'No extension' => 'Nincs kiterjesztés',
'None of the supported PHP extensions (%s) are available.' => 'Nincs egy elérhető támogatott PHP kiterjesztés (%s) sem.',
'Session support must be enabled.' => 'A munkameneteknek (session) engedélyezve kell lennie.',
'Session expired, please login again.' => 'Munkamenet lejárt, jelentkezz be újra.',
'Text length' => 'Szöveg hossz',
'Foreign key has been dropped.' => 'Idegen kulcs eldobva.',
'Foreign key has been altered.' => 'Idegen kulcs módosult.',
'Foreign key has been created.' => 'Idegen kulcs létrejött.',
'Foreign key' => 'Idegen kulcs',
'Target table' => 'Cél tábla',
'Change' => 'Változtat',
'Source' => 'Forrás',
'Target' => 'Cél',
'Add column' => 'Oszlop hozzáadása',
'Alter' => 'Módosítás',
'Add foreign key' => 'Idegen kulcs hozzadása',
'ON DELETE' => 'törléskor',
'ON UPDATE' => 'frissítéskor',
'Index Type' => 'Index típusa',
'Column (length)' => 'Oszop (méret)',
'View has been dropped.' => 'A nézet eldobva.',
'View has been altered.' => 'A nézet módosult.',
'View has been created.' => 'A nézet létrejött.',
'Alter view' => 'Nézet módosítása',
'Create view' => 'Nézet létrehozása',
'Name' => 'Név',
'Process list' => 'Folyamatok',
'%d process(es) have been killed.' => array('%d folyamat leállítva.', '%d folyamat leállítva.', '%d folyamat leállítva.'),
'Kill' => 'Leállít',
'Parameter name' => 'Paraméter neve',
'Database schema' => 'Adatbázis séma',
'Create procedure' => 'Eljárás létrehozása',
'Create function' => 'Funkció létrehozása',
'Routine has been dropped.' => 'A rutin eldobva,',
'Routine has been altered.' => 'A rutin módosult.',
'Routine has been created.' => 'A rutin létrejött.',
'Alter function' => 'Funkció módosítása',
'Alter procedure' => 'Eljárás módosítása',
'Return type' => 'Visszatérési érték',
'Add trigger' => 'Trigger hozzáadása',
'Trigger has been dropped.' => 'A trigger eldobva.',
'Trigger has been altered.' => 'A trigger módosult.',
'Trigger has been created.' => 'A trigger létrejött.',
'Alter trigger' => 'Trigger módosítása',
'Create trigger' => 'Trigger létrehozása',
'Time' => 'Idő',
'Event' => 'Esemény',
'%s version: %s through PHP extension %s' => '%s verzió: %s, PHP: %s',
'%d row(s)' => array('%d sor', '%d sor', '%d sor'),
'Remove' => 'Eltávolítás',
'Are you sure?' => 'Biztos benne?',
'Privileges' => 'Privilégiumok',
'Create user' => 'Felhasználó hozzáadása',
'User has been dropped.' => 'A felhasználó eldobva.',
'User has been altered.' => 'A felhasználó módosult.',
'User has been created.' => 'A felhasználó létrejött.',
'Hashed' => 'Hashed',
'Column' => 'Oszlop',
'Routine' => 'Rutin',
'Grant' => 'Engedélyezés',
'Revoke' => 'Visszavonás',
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'Túl sok a POST adat! Csökkentsd az adat méretét, vagy növeld a %s beállítást.',
'Logged as: %s' => 'Belépve: %s',
'Move up' => 'Felfelé',
'Move down' => 'Lefelé',
'Functions' => 'Funkciók',
'Aggregation' => 'Aggregálás',
'Export' => 'Export',
'Output' => 'Kimenet',
'open' => 'megnyit',
'save' => 'ment',
'Format' => 'Formátum',
'Tables' => 'Táblák',
'Data' => 'Adat',
'Event has been dropped.' => 'Az esemény eldobva.',
'Event has been altered.' => 'Az esemény módosult.',
'Event has been created.' => 'Az esemény létrejött.',
'Alter event' => 'Esemény módosítása',
'Create event' => 'Esemény létrehozása',
'At given time' => 'Megadott időben',
'Every' => 'Minden',
'Events' => 'Esemény',
'Schedule' => 'Ütemzés',
'Start' => 'Kezd',
'End' => 'Vége',
'Status' => 'Állapot',
'On completion preserve' => 'Befejezéskor megőrzi',
'Tables and views' => 'Táblák és nézetek',
'Data Length' => 'Méret',
'Index Length' => 'Index hossz',
'Data Free' => 'Adat szabad',
'Collation' => 'Egybevetés',
'Analyze' => 'Elemzés',
'Optimize' => 'Optimalizál',
'Check' => 'Ellenőrzés',
'Repair' => 'Javít',
'Truncate' => 'Felszabadít',
'Tables have been truncated.' => 'A tábla felszabadítva.',
'Rows' => 'Oszlop',
',' => ' ',
'Tables have been moved.' => 'Táblák áthelyezve',
'Move to other database' => 'Áthelyezés másik adatbázisba',
'Move' => 'Áthelyez',
'Engine' => 'Motor',
'Save and continue edit' => 'Mentés és szerkesztés folytatása',
'original' => 'eredeti',
'%d item(s) have been affected.' => array('%d tétel érintett.', '%d tétel érintett.', '%d tétel érintett.'),
'whole result' => 'összes eredményt mutatása',
'Tables have been dropped.' => 'Táblák eldobva.',
'Clone' => 'Klónoz',
'Partition by' => 'Rozdělit podle',
'Partitions' => 'Particiók',
'Partition name' => 'Partició neve',
'Values' => 'Értékek',
'%d row(s) have been imported.' => array('%d sor importálva.', '%d sor importálva', '%d sor importálva'),
'CSV Import' => 'CSV importálása',
'Import' => 'Importálás',
'Show structure' => 'Struktúra',
'Select data' => 'Tartalom',
'Stop on error' => 'Hiba esetén megáll',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'A maximális mezőszámot elérted. Növeld meg ezeket: %s, %s',
'anywhere' => 'bárhol',
'%.3f s' => '%.3f másodperc',
'$1-$3-$5' => '$6.$4.$1',
'[yyyy]-mm-dd' => '[yyyy].mm.dd',
'History' => 'Történet',
'Variables' => 'Változók',
'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.' => 'A forrás és cél oszlopoknak azonos típusúak legyenek, a cél oszlopok indexeltek legyenek, és a hivatkozott adatnak léteznie kell.',
'E-mail' => 'E-mail',
'From' => 'Feladó',
'Subject' => 'Tárgy',
'Send' => 'Küldés',
'%d e-mail(s) have been sent.' => array('%d e-mail elküldve.', '%d e-mail elküldve.', '%d e-mail elküldve.'),
'Run file' => 'Fájl futtatása',
'Numbers' => 'Szám',
'Date and time' => 'Dátum és idő',
'Strings' => 'Szöveg',
'Binary' => 'Bináris',
'Lists' => 'Lista',
'Relations' => 'Reláció',
'Maximum allowed file size is %sB.' => 'A maximális fájlméret %s B.',
'Clear' => 'Törlés',
'Editor' => 'Szerkesztő',
'Webserver file %s' => 'Webszerver fájl %s',
'File does not exist.' => 'A fájl nem létezik.',
'Permanent login' => 'Emlékezz rám',
'%d in total' => 'összesen %d',
'Attachments' => 'Csatolmány',
'System' => 'Adatbázis',
'last' => 'utoljára',
'Network' => 'Hálózat',
'Geometry' => 'Geometria',
'Databases have been dropped.' => 'Adatbázis eldobva.',
'File exists.' => 'A fájl létezik.',
'Double click on a value to modify it.' => 'Kattints kétszer az értékre a szerkesztéshez.',
'Increase text length to modify this value.' => 'Növeld a szöveg hosszát, hogy módosítani tudd ezt az értéket.',
'Use edit link to modify this value.' => 'Használd a szerkesztés hivatkozást ezen érték módosításához.',
'Alter schema' => 'Séma módosítása',
'Create schema' => 'Séma létrehozása',
'Schema has been dropped.' => 'Séma eldobva.',
'Schema has been created.' => 'Séma létrejött.',
'Schema has been altered.' => 'Séma módosult.',
'schema' => 'schéma',
'Schema' => 'Schéma',
'Sequences' => 'Sorozatok',
'Create sequence' => 'Sorozat létrehozása',
'Sequence has been dropped.' => 'Sorozat eldobva.',
'Sequence has been created.' => 'Sorozat létrejött.',
'Sequence has been altered.' => 'Sorozat módosult.',
'Alter sequence' => 'Sorozat módosítása',
'User types' => 'Felhasználói típus',
'Create type' => 'Típus létrehozása',
'Type has been dropped.' => 'Típus eldobva.',
'Type has been created.' => 'Típus létrehozva.',
'Alter type' => 'Típus módosítása',
'Search data in tables' => 'Keresés a táblákban',
'From server' => 'Szerverről',
'empty' => 'üres',
'now' => 'most',
);

View File

@@ -40,7 +40,7 @@ $translations = array(
'Create new table' => 'Crea nuova tabella', 'Create new table' => 'Crea nuova tabella',
'Item has been deleted.' => 'Elemento eliminato.', 'Item has been deleted.' => 'Elemento eliminato.',
'Item has been updated.' => 'Elemento aggiornato.', 'Item has been updated.' => 'Elemento aggiornato.',
'Item%s has been inserted.' => 'Elemento%s inserito.', 'Item has been inserted.' => 'Elemento inserito.',
'Edit' => 'Modifica', 'Edit' => 'Modifica',
'Insert' => 'Inserisci', 'Insert' => 'Inserisci',
'Save and insert next' => 'Salva e inserisci un altro', 'Save and insert next' => 'Salva e inserisci un altro',
@@ -195,7 +195,7 @@ $translations = array(
'Partitions' => 'Partizioni', 'Partitions' => 'Partizioni',
'Partition name' => 'Nome partizione', 'Partition name' => 'Nome partizione',
'Values' => 'Valori', 'Values' => 'Valori',
'%d row(s) have been imported.' => array('%d riga importata.', '%d righe importate.'), '%d row(s) have been imported.' => array('%d riga importata.','%d righe importate.'),
'anywhere' => 'ovunque', 'anywhere' => 'ovunque',
'CSV Import' => 'Importa da CSV', 'CSV Import' => 'Importa da CSV',
'Import' => 'Importa', 'Import' => 'Importa',
@@ -220,42 +220,9 @@ $translations = array(
'From' => 'Da', 'From' => 'Da',
'Subject' => 'Oggetto', 'Subject' => 'Oggetto',
'Send' => 'Invia', 'Send' => 'Invia',
'%d e-mail(s) have been sent.' => array('%d e-mail inviata.', '%d e-mail inviate.'), '%d e-mail(s) have been sent.' => array('%d e-mail inviata.','%d e-mail inviate.'),
'Webserver file %s' => 'Webserver file %s', 'Webserver file %s' => 'Webserver file %s',
'File does not exist.' => 'Il file non esiste.', 'File does not exist.' => 'Il file non esiste.',
'%d in total' => '%d in totale', '%d in total' => '%d in totale',
'Permanent login' => 'Login permanente', 'Permanent login' => 'Login permanente',
'Databases have been dropped.' => 'Database eliminati.',
'Search data in tables' => 'Cerca nelle tabelle',
'schema' => 'schema',
'Schema' => 'Schema',
'Alter schema' => 'Modifica schema',
'Create schema' => 'Crea schema',
'Schema has been dropped.' => 'Schema eliminato.',
'Schema has been created.' => 'Schema creato.',
'Schema has been altered.' => 'Schema modificato.',
'Sequences' => 'Sequenza',
'Create sequence' => 'Crea sequenza',
'Alter sequence' => 'Modifica sequenza',
'Sequence has been dropped.' => 'Sequenza eliminata.',
'Sequence has been created.' => 'Sequenza creata.',
'Sequence has been altered.' => 'Sequenza modificata.',
'User types' => 'Tipi definiti dall\'utente',
'Create type' => 'Crea tipo definito dall\'utente',
'Alter type' => 'Modifica tipo definito dall\'utente',
'Type has been dropped.' => 'Tipo definito dall\'utente eliminato.',
'Type has been created.' => 'Tipo definito dall\'utente creato.',
'Double click on a value to modify it.' => 'Fai doppio click su un valore per modificarlo.',
'Increase text length to modify this value.' => 'Aumenta la lunghezza del testo per modificare questo valore.',
'Use edit link to modify this value.' => 'Usa il link modifica per modificare questo valore.',
'last' => 'ultima',
'From server' => 'Dal server',
'System' => 'Sistema',
'Select data' => 'Visualizza dati',
'Show structure' => 'Visualizza struttura',
'empty' => 'vuoto',
'Network' => 'Rete',
'Geometry' => 'Geometria',
'File exists.' => 'Il file esiste già.',
'Attachments' => 'Allegati',
); );

View File

@@ -35,11 +35,12 @@ $translations = array(
'Logout' => 'ログアウト', 'Logout' => 'ログアウト',
'database' => 'データベース', 'database' => 'データベース',
'Use' => '使用', 'Use' => '使用',
'No tables.' => 'テーブルがありません。', 'No tables.' => 'テーブルがありません没有表。',
'select' => '選択', 'select' => '選択',
'Create new table' => 'テーブルを作成', 'Create new table' => 'テーブルを作成',
'Item has been deleted.' => '項目を削除しました', 'Item has been deleted.' => '項目を削除しました',
'Item has been updated.' => '項目を更新しました', 'Item has been updated.' => '項目を更新しました',
'Item has been inserted.' => '項目を挿入しました',
'Edit' => '編集', 'Edit' => '編集',
'Insert' => '挿入', 'Insert' => '挿入',
'Save and insert next' => '保存/追加', 'Save and insert next' => '保存/追加',
@@ -72,6 +73,7 @@ $translations = array(
'Invalid CSRF token. Send the form again.' => '不正なCSRFトークン。再送信してください', 'Invalid CSRF token. Send the form again.' => '不正なCSRFトークン。再送信してください',
'Comment' => 'コメント', 'Comment' => 'コメント',
'Default values' => '規定値', 'Default values' => '規定値',
'Show column comments' => '列コメントを表示',
'%d byte(s)' => '%d バイト', '%d byte(s)' => '%d バイト',
'No commands to execute.' => '実行するコマンドがありません', 'No commands to execute.' => '実行するコマンドがありません',
'Unable to upload a file.' => 'ファイルをアップロードできません', 'Unable to upload a file.' => 'ファイルをアップロードできません',
@@ -109,7 +111,7 @@ $translations = array(
'%d process(es) have been killed.' => '%d プロセスを強制終了しました', '%d process(es) have been killed.' => '%d プロセスを強制終了しました',
'Kill' => '強制終了', 'Kill' => '強制終了',
'Parameter name' => '参数名', 'Parameter name' => '参数名',
'Database schema' => '構造', 'Database schema' => '数据?概要',
'Create procedure' => 'プロシージャの作成', 'Create procedure' => 'プロシージャの作成',
'Create function' => '関数の作成', 'Create function' => '関数の作成',
'Routine has been dropped.' => 'ルーチンを作成', 'Routine has been dropped.' => 'ルーチンを作成',
@@ -226,37 +228,4 @@ $translations = array(
'File does not exist.' => 'ファイルは存在しません', 'File does not exist.' => 'ファイルは存在しません',
'%d in total' => '合計 %d', '%d in total' => '合計 %d',
'Permanent login' => '永続的にログイン', 'Permanent login' => '永続的にログイン',
'Databases have been dropped.' => 'データベースを削除しました',
'Search data in tables' => 'データを検索する',
'schema' => 'スキーマ',
'Schema' => 'スキーマ',
'Alter schema' => 'スキーマ変更',
'Create schema' => 'スキーマ追加',
'Schema has been dropped.' => 'スキーマを削除しました',
'Schema has been created.' => 'スキーマを追加しました',
'Schema has been altered.' => 'スキーマを変更しました',
'Sequences' => 'シーケンス',
'Create sequence' => 'シーケンス作成',
'Alter sequence' => 'シーケンス変更',
'Sequence has been dropped.' => 'シーケンスを削除しました',
'Sequence has been created.' => 'シーケンスを追加しました',
'Sequence has been altered.' => 'シーケンスを変更しました',
'User types' => 'ユーザー定義型',
'Create type' => 'ユーザー定義型作成',
'Alter type' => 'ユーザー定義型変更',
'Type has been dropped.' => 'ユーザー定義型を削除しました',
'Type has been created.' => 'ユーザー定義型を追加しました',
'Double click on a value to modify it.' => 'ダブルクリックして編集',
'Increase text length to modify this value.' => '編集枠を広げる',
'Use edit link to modify this value.' => 'リンクを編集する',
'last' => '最終',
'From server' => 'サーバーから実行',
'System' => 'データベース種類',
'empty' => '空',
'Network' => 'ネットワーク型',
'Geometry' => 'ジオメトリ型',
'File exists.' => 'ファイルが既に存在します',
'Attachments' => '添付ファイル',
'Item%s has been inserted.' => '%s項目を挿入しました',
'now' => '現在の日時',
); );

View File

@@ -24,7 +24,6 @@ $translations = array(
'Options' => 'Opties', 'Options' => 'Opties',
'Save' => 'Opslaan', 'Save' => 'Opslaan',
'Drop' => 'Verwijderen', 'Drop' => 'Verwijderen',
'Databases have been dropped.' => 'Databases verwijderd.',
'Database has been dropped.' => 'Database verwijderd.', 'Database has been dropped.' => 'Database verwijderd.',
'Database has been created.' => 'Database aangemaakt.', 'Database has been created.' => 'Database aangemaakt.',
'Database has been renamed.' => 'Database hernoemd.', 'Database has been renamed.' => 'Database hernoemd.',
@@ -41,7 +40,7 @@ $translations = array(
'Create new table' => 'Nieuwe tabel', 'Create new table' => 'Nieuwe tabel',
'Item has been deleted.' => 'Item verwijderd.', 'Item has been deleted.' => 'Item verwijderd.',
'Item has been updated.' => 'Item aangepast.', 'Item has been updated.' => 'Item aangepast.',
'Item%s has been inserted.' => 'Item%s toegevoegd.', 'Item has been inserted.' => 'Item toegevoegd.',
'Edit' => 'Bewerk', 'Edit' => 'Bewerk',
'Insert' => 'Toevoegen', 'Insert' => 'Toevoegen',
'Save and insert next' => 'Opslaan, daarna toevoegen', 'Save and insert next' => 'Opslaan, daarna toevoegen',
@@ -226,36 +225,4 @@ $translations = array(
'File does not exist.' => 'Bestand niet gevonden.', 'File does not exist.' => 'Bestand niet gevonden.',
'%d in total' => '%d in totaal', '%d in total' => '%d in totaal',
'Permanent login' => 'Blijf aangemeld', 'Permanent login' => 'Blijf aangemeld',
'Search data in tables' => 'Zoeken in database',
'schema' => 'schema',
'Schema' => 'Schema',
'Alter schema' => 'Schema wijzigen',
'Create schema' => 'Schema maken',
'Schema has been dropped.' => 'Schema verwijderd.',
'Schema has been created.' => 'Schema aangemaakt.',
'Schema has been altered.' => 'Schema gewijzigd.',
'Sequences' => 'Sequences',
'Create sequence' => 'Sequence maken',
'Alter sequence' => 'Sequence wijzigen',
'Sequence has been dropped.' => 'Sequence verwijderd.',
'Sequence has been created.' => 'Sequence aangemaakt.',
'Sequence has been altered.' => 'Sequence gewijzigd.',
'User types' => 'Gebruikersgedefiniëerde types',
'Create type' => 'Type maken',
'Alter type' => 'Type wijzigen',
'Type has been dropped.' => 'Type verwijderd.',
'Type has been created.' => 'Type aangemaakt.',
'Double click on a value to modify it.' => 'Dubbelklik op een waarde om deze te bewerken.',
'Increase text length to modify this value.' => 'Verhoog de lengte om deze waarde te bewerken.',
'Use edit link to modify this value.' => 'Gebruik de link "bewerk" om deze waarde te wijzigen.',
'last' => 'laatste',
'From server' => 'Van server',
'System' => 'Databasesysteem',
'Select data' => 'Gegevens selecteren',
'Show structure' => 'Toon structuur',
'empty' => 'leeg',
'Network' => 'Netwerk',
'Geometry' => 'Geometrie',
'File exists.' => 'Bestand bestaat reeds.',
'Attachments' => 'Bijlagen',
); );

View File

@@ -40,7 +40,7 @@ $translations = array(
'Create new table' => 'Создать новую таблицу', 'Create new table' => 'Создать новую таблицу',
'Item has been deleted.' => 'Запись удалена.', 'Item has been deleted.' => 'Запись удалена.',
'Item has been updated.' => 'Запись обновлена.', 'Item has been updated.' => 'Запись обновлена.',
'Item%s has been inserted.' => 'Запись%s была вставлена.', 'Item has been inserted.' => 'Запись вставлена.',
'Edit' => 'Редактировать', 'Edit' => 'Редактировать',
'Insert' => 'Вставить', 'Insert' => 'Вставить',
'Save and insert next' => 'Сохранить и вставить еще', 'Save and insert next' => 'Сохранить и вставить еще',
@@ -225,37 +225,4 @@ $translations = array(
'File does not exist.' => 'Такого файла не существует.', 'File does not exist.' => 'Такого файла не существует.',
'%d in total' => 'Всего %d', '%d in total' => 'Всего %d',
'Permanent login' => 'Оставаться в системе', 'Permanent login' => 'Оставаться в системе',
'Databases have been dropped.' => 'Базы данных удалены.',
'Search data in tables' => 'Поиск в таблицах',
'schema' => 'схема',
'Schema' => 'Схема',
'Alter schema' => 'Изменить схему',
'Create schema' => 'Новая схема',
'Schema has been dropped.' => 'Схема удалена.',
'Schema has been created.' => 'Создана новая схема.',
'Schema has been altered.' => 'Схема изменена.',
'Sequences' => '«Последовательности»',
'Create sequence' => 'Создать «последовательность»',
'Alter sequence' => 'Изменить «последовательность»',
'Sequence has been dropped.' => '«Последовательность» удалена.',
'Sequence has been created.' => 'Создана новая «последовательность».',
'Sequence has been altered.' => '«Последовательность» изменена.',
'User types' => 'Типы пользователей',
'Create type' => 'Создать тип',
'Alter type' => 'Изменить тип',
'Type has been dropped.' => 'Тип удален.',
'Type has been created.' => 'Создан новый тип.',
'Double click on a value to modify it.' => 'Кликни два раза по значению, чтобы его изменить.',
'Increase text length to modify this value.' => 'Увеличь длину текста, чтобы изменить это значение.',
'Use edit link to modify this value.' => 'Изменить это значение можно с помощью ссылки «изменить».',
'last' => 'последняя',
'From server' => 'С сервера',
'System' => 'Движок',
'Select data' => 'Выбрать',
'Show structure' => 'Показать структуру',
'empty' => 'пусто',
'Network' => 'Сеть',
'Geometry' => 'Геометрия',
'File exists.' => 'Файл уже существует.',
'Attachments' => 'Прикрепленные файлы',
); );

View File

@@ -24,7 +24,6 @@ $translations = array(
'Options' => 'Voľby', 'Options' => 'Voľby',
'Save' => 'Uložiť', 'Save' => 'Uložiť',
'Drop' => 'Odstrániť', 'Drop' => 'Odstrániť',
'Databases have been dropped.' => 'Databázy boli odstránené.',
'Database has been dropped.' => 'Databáza bola odstránená.', 'Database has been dropped.' => 'Databáza bola odstránená.',
'Database has been created.' => 'Databáza bola vytvorená.', 'Database has been created.' => 'Databáza bola vytvorená.',
'Database has been renamed.' => 'Databáza bola premenovaná.', 'Database has been renamed.' => 'Databáza bola premenovaná.',
@@ -41,7 +40,7 @@ $translations = array(
'Create new table' => 'Vytvoriť novú tabuľku', 'Create new table' => 'Vytvoriť novú tabuľku',
'Item has been deleted.' => 'Položka bola vymazaná.', 'Item has been deleted.' => 'Položka bola vymazaná.',
'Item has been updated.' => 'Položka bola aktualizovaná.', 'Item has been updated.' => 'Položka bola aktualizovaná.',
'Item%s has been inserted.' => 'Položka%s bola vložená.', 'Item has been inserted.' => 'Položka bola vložená.',
'Edit' => 'Upraviť', 'Edit' => 'Upraviť',
'Insert' => 'Vložiť', 'Insert' => 'Vložiť',
'Save and insert next' => 'Uložiť a vložiť ďalší', 'Save and insert next' => 'Uložiť a vložiť ďalší',
@@ -226,36 +225,4 @@ $translations = array(
'File does not exist.' => 'Súbor neexistuje.', 'File does not exist.' => 'Súbor neexistuje.',
'Permanent login' => 'Trvalé prihlásenie', 'Permanent login' => 'Trvalé prihlásenie',
'%d in total' => '%d celkom', '%d in total' => '%d celkom',
'Search data in tables' => 'Vyhľadať dáta v tabuľkách',
'Alter schema' => 'Pozmeniť schému',
'Create schema' => 'Vytvoriť schému',
'Schema has been dropped.' => 'Schéma bola odstránená.',
'Schema has been created.' => 'Schéma bola vytvorená.',
'Schema has been altered.' => 'Schéma bola zmenená.',
'schema' => 'schéma',
'Schema' => 'Schéma',
'Sequences' => 'Sekvencia',
'Create sequence' => 'Vytvoriť sekvenciu',
'Sequence has been dropped.' => 'Sekvencia bola odstránená.',
'Sequence has been created.' => 'Sekvencia bola vytvorená.',
'Sequence has been altered.' => 'Sekvencia bola zmenená.',
'Alter sequence' => 'Pozmeniť sekvenciu',
'User types' => 'Užívateľské typy',
'Create type' => 'Vytvoriť typ',
'Type has been dropped.' => 'Typ bol odstránený.',
'Type has been created.' => 'Typ bol vytvorený.',
'Alter type' => 'Pozmeniť typ',
'Double click on a value to modify it.' => 'Dvojkliknite na políčko, ktoré chcete zmeniť.',
'Increase text length to modify this value.' => 'Pre zmenu tejto hodnoty zvýšte dĺžku textov.',
'Use edit link to modify this value.' => 'Pre zmenu tejto hodnoty použite odkaz upraviť.',
'last' => 'posledný',
'From server' => 'Zo serveru',
'System' => 'Systém',
'Show structure' => 'Zobraziť štruktúru',
'Select data' => 'Vypísať dáta',
'empty' => 'prázdne',
'Network' => 'Sieť',
'Geometry' => 'Geometria',
'File exists.' => 'Súbor existuje.',
'Attachments' => 'Prílohy',
); );

View File

@@ -1,262 +0,0 @@
<?php
$translations = array(
'Login' => 'நுழை',
'Logout successful.' => 'வெற்றிக‌ர‌மாய் வெளியேறியாயிற்று.',
'Invalid credentials.' => 'ச‌ரியான‌ விப‌ர‌ங்க‌ள் இல்லை',
'Server' => 'வ‌ழ‌ங்கி (Server)',
'Username' => 'ப‌ய‌னாள‌ர் (User)',
'Password' => 'க‌ட‌வுச்சொல்',
'Select database' => 'த‌க‌வ‌ல்த‌ள‌த்தை தேர்வு செய்',
'Invalid database.' => 'த‌க‌வ‌ல்த‌ள‌ம் ச‌ரியானதல்ல‌.',
'Create new database' => 'புதிய‌ த‌க‌வ‌ல்த‌ள‌த்தை உருவாக்கு',
'Table has been dropped.' => 'அட்ட‌வ‌ணை நீக்க‌ப்ப‌ட்ட‌து',
'Table has been altered.' => 'அட்ட‌வணை மாற்ற‌ப்ப‌ட்ட‌து.',
'Table has been created.' => 'அட்ட‌வ‌ணை உருவாக்க‌ப்ப‌ட்ட‌து.',
'Alter table' => 'அட்ட‌வ‌ணையை மாற்று',
'Create table' => 'அட்ட‌வ‌ணையை உருவாக்கு',
'Table name' => 'அட்ட‌வ‌ணைப் பெய‌ர்',
'engine' => 'எஞ்சின்',
'collation' => 'கொலேச‌ன்',
'Column name' => 'நெடுவ‌ரிசையின் பெய‌ர்',
'Type' => 'வ‌கை',
'Length' => 'நீளம்',
'Auto Increment' => 'ஏறுமான‌ம்',
'Options' => 'வேண்டிய‌வ‌ற்றை ',
'Save' => 'சேமி',
'Drop' => 'நீக்கு',
'Database has been dropped.' => 'த‌க‌வ‌ல்த‌ள‌ம் நீக்க‌ப்ப‌ட்ட‌து.',
'Database has been created.' => 'த‌க‌வ‌ல்த‌ள‌ம் உருவாக்க‌ப்ப‌ட்ட‌து.',
'Database has been renamed.' => 'த‌க‌வ‌ல்த‌ள‌ம் பெய‌ர் மாற்ற‌ப்ப‌ட்ட‌து.',
'Database has been altered.' => 'த‌க‌வ‌ல்த‌ள‌ம் மாற்ற‌ப்ப‌ட்ட‌து.',
'Alter database' => 'த‌க‌வ‌ல்த‌ள‌த்தை மாற்று',
'Create database' => 'த‌க‌வ‌ல்த‌ள‌த்தை உருவாக்கு',
'SQL command' => 'SQL க‌ட்ட‌ளை',
'Dump' => 'Dump',
'Logout' => 'வெளியேறு',
'database' => 'த‌க‌வ‌ல்த‌ள‌ம்',
'Use' => 'உப‌யோகி',
'No tables.' => 'அட்ட‌வ‌ணை இல்லை.',
'select' => 'தேர்வு செய்',
'Create new table' => 'புதிய‌ அட்ட‌வ‌ணையை உருவாக்கு',
'Item has been deleted.' => 'உருப்படி நீக்க‌ப்ப‌ட்ட‌து.',
'Item has been updated.' => 'உருப்ப‌டி புதுப்பிக்க‌ப்ப‌ட்ட‌து.',
'Edit' => 'தொகு',
'Insert' => 'புகுத்து',
'Save and insert next' => 'சேமித்த‌ப் பின் அடுத்த‌தை புகுத்து',
'Delete' => 'நீக்கு',
'Database' => 'த‌க‌வ‌ல்த‌ள‌ம்',
'Routines' => 'ரொட்டீன் ',
'Indexes have been altered.' => 'அக‌வ‌ரிசைக‌ள் (Indexes) மாற்ற‌ப்பட்ட‌து.',
'Indexes' => 'அக‌வ‌ரிசைக‌ள் (Index) ',
'Alter indexes' => 'அக‌வ‌ரிசையை (Index) மாற்று',
'Add next' => 'அடுத்த‌தை சேர்க்க‌வும்',
'Language' => 'மொழி',
'Select' => 'தேர்வு செய்',
'New item' => 'புதிய‌ உருப்ப‌டி',
'Search' => 'தேடு',
'Sort' => 'த‌ர‌ம் பிரி',
'descending' => 'இற‌ங்குமுக‌மான‌',
'Limit' => 'வ‌ர‌ம்பு',
'No rows.' => 'வ‌ரிசை இல்லை.',
'Action' => 'செய‌ல்',
'edit' => 'தொகு',
'Page' => 'ப‌க்க‌ம்',
'Query executed OK, %d row(s) affected.' => array('வின‌வ‌ல் செய‌ல்ப‌டுத்த‌ப்ப‌ட்ட‌து, %d வ‌ரிசை மாற்ற‌ப்ப‌ட்ட‌து.', 'வின‌வ‌ல் செய‌ல்ப‌டுத்த‌ப்ப‌ட்ட‌து, %d வ‌ரிசைக‌ள் மாற்றப்ப‌ட்ட‌ன‌.'),
'Error in query' => 'வின‌வ‌லில் த‌வ‌றுள்ள‌து.',
'Execute' => 'செய‌ல்ப‌டுத்து',
'Table' => 'அட்ட‌வ‌ணை',
'Foreign keys' => 'வேற்று விசைக‌ள்',
'Triggers' => 'தூண்டுத‌ல்க‌ள்',
'View' => 'தோற்றம்',
'Unable to select the table' => 'அட்ட‌வ‌ணையை தேர்வு செய்ய‌ முடிய‌வில்லை.',
'Invalid CSRF token. Send the form again.' => 'CSRF டோக்க‌ன் செல்லாது. ப‌டிவ‌த்தை மீண்டும் அனுப்ப‌வும்.',
'Comment' => 'குறிப்பு',
'Default values' => 'உள்ளிருக்கும் (Default) ம‌திப்புக‌ள் ',
'%d byte(s)' => array('%d பைட்', '%d பைட்டுக‌ள்'),
'No commands to execute.' => 'செய‌ல் ப‌டுத்த‌ எந்த‌ க‌ட்ட‌ளைக‌ளும் இல்லை.',
'Unable to upload a file.' => 'கோப்பை மேலேற்ற‌ம் (upload) செய்ய‌ இயல‌வில்லை.',
'File upload' => 'கோப்பை மேலேற்று (upload) ',
'File uploads are disabled.' => 'கோப்புக‌ள் மேலேற்றம் (upload)முட‌க்க‌ப்ப‌ட்டுள்ள‌ன‌.',
'Routine has been called, %d row(s) affected.' => array('ரொட்டீன்க‌ள் அழைக்க‌ப்பட்டுள்ள‌ன‌, %d வ‌ரிசை மாற்ற‌ம் அடைந்த‌து.', 'ரொட்டீன்க‌ள் அழைக்க‌ப்ப‌ட்டுள்ள‌ன‌, %d வ‌ரிசைக‌ள் மாற்றம் அடைந்துள்ள‌ன‌.'),
'Call' => 'அழை',
'None of the supported PHP extensions (%s) are available.' => 'PHP ஆத‌ர‌வு விரிவுக‌ள் (%s) இல்லை.',
'Session support must be enabled.' => 'செஷ‌ன் ஆத‌ர‌வு இய‌க்க‌ப்ப‌ட‌ வேண்டும்.',
'Session expired, please login again.' => 'செஷ‌ன் காலாவ‌தியாகி விட்ட‌து. மீண்டும் நுழைய‌வும்.',
'Text length' => 'உரை நீள‌ம்',
'Foreign key has been dropped.' => 'வேற்று விசை நீக்க‌ப்ப‌ட்ட‌து.',
'Foreign key has been altered.' => 'வேற்று விசை மாற்ற‌ப்ப‌ட்ட‌து.',
'Foreign key has been created.' => 'வேற்று விசை உருவாக்க‌ப்ப‌ட்ட‌து.',
'Foreign key' => 'வேற்று விசை',
'Target table' => 'அட்ட‌வ‌ணை இல‌க்கு',
'Change' => 'மாற்று',
'Source' => 'மூல‌ம்',
'Target' => 'இல‌க்கு',
'Add column' => 'நெடு வ‌ரிசையை சேர்க்க‌வும்',
'Alter' => 'மாற்று',
'Add foreign key' => 'வேற்று விசை சேர்க்க‌வும்',
'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE',
'Index Type' => 'அக‌வ‌ரிசை வ‌கை (Index Type)',
'Column (length)' => 'நெடுவ‌ரிசை (நீள‌ம்)',
'View has been dropped.' => 'தோற்ற‌ம் நீக்க‌ப்ப‌ட்ட‌து.',
'View has been altered.' => 'தோற்றம் மாற்றப்ப‌ட்ட‌து.',
'View has been created.' => 'தோற்ற‌ம் உருவாக்க‌ப்ப‌ட்ட‌து.',
'Alter view' => 'தோற்ற‌த்தை மாற்று',
'Create view' => 'தோற்றத்தை உருவாக்கு',
'Name' => 'பெய‌ர்',
'Process list' => 'வேலைக‌ளின் ப‌ட்டி',
'%d process(es) have been killed.' => array('%d வேலை வ‌லுவில் நிறுத்த‌ப‌ட்ட‌து.', '%d வேலைக‌ள் வ‌லுவில் நிறுத்த‌ப‌ட்ட‌ன‌.'),
'Kill' => 'வ‌லுவில் நிறுத்து',
'Parameter name' => 'அள‌புரு (Parameter) பெய‌ர்',
'Database schema' => 'த‌க‌வ‌ல்த‌ள‌ அமைப்பு முறைக‌ள்',
'Create procedure' => 'செய்முறையை உருவாக்கு',
'Create function' => 'Function உருவாக்கு',
'Routine has been dropped.' => 'ரொட்டீன் நீக்க‌ப்ப‌ட்ட‌து.',
'Routine has been altered.' => 'ரொட்டீன் மாற்ற‌ப்ப‌ட்டது.',
'Routine has been created.' => 'ரொட்டீன் உருவாக்க‌ப்ப‌ட்ட‌து.',
'Alter function' => 'Function மாற்று',
'Alter procedure' => 'செய‌ல்முறையை மாற்று',
'Return type' => 'திரும்பு வ‌கை',
'Add trigger' => 'தூண்டு விசையை சேர்',
'Trigger has been dropped.' => 'தூண்டு விசை நீக்க‌ப்ப‌ட்ட‌து.',
'Trigger has been altered.' => 'தூண்டு விசை மாற்ற‌ப்ப‌ட்ட‌து.',
'Trigger has been created.' => 'தூண்டு விசை உருவாக்க‌ப்ப‌ட்ட‌து.',
'Alter trigger' => 'தூண்டு விசையை மாற்று.',
'Create trigger' => 'தூண்டு விசையை உருவாக்கு.',
'Time' => 'நேர‌ம்',
'Event' => 'நிக‌ழ்ச்சி',
'%d row(s)' => array('%d வ‌ரிசை', '%d வ‌ரிசைக‌ள்'),
'Remove' => 'நீக்கு',
'Are you sure?' => 'நிச்ச‌ய‌மாக‌ ?',
'Privileges' => 'ச‌லுகைக‌ள் / சிற‌ப்புரிமைக‌ள்',
'Create user' => 'ப‌ய‌னாள‌ரை உருவாக்கு',
'User has been dropped.' => 'ப‌யனீட்டாள‌ர் நீக்க‌ப்ப‌ட்டார்.',
'User has been altered.' => 'ப‌யனீட்டாள‌ர் மாற்றப்ப‌ட்டார்.',
'User has been created.' => 'ப‌ய‌னீட்டாள‌ர் உருவாக்க‌ப்ப‌ட்ட‌து.',
'Hashed' => 'Hashed',
'Column' => 'நெடுவ‌ரிசை',
'Routine' => 'ரொட்டீன்',
'Grant' => 'அனும‌திய‌ளி',
'Revoke' => 'இர‌த்துச்செய்',
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'மிக‌ அதிக‌மான‌ POST த‌க‌வ‌ல். த‌க‌வ‌லை குறைக்க‌வும் அல்ல‌து %s வ‌டிவ‌மைப்பை (configuration directive) மாற்ற‌வும்.',
'Logged as: %s' => 'ப‌ய‌னாளர்: %s',
'Move up' => 'மேலே ந‌க‌ர்த்து',
'Move down' => 'கீழே நக‌ர்த்து',
'Functions' => 'Functions',
'Aggregation' => 'திர‌ள்வு (Aggregation)',
'Export' => 'ஏற்றும‌தி',
'Output' => 'வெளியீடு',
'open' => 'திற‌',
'save' => 'சேமி',
'Format' => 'ஃபார்ம‌ட் (Format)',
'Tables' => 'அட்ட‌வ‌ணை',
'Data' => 'த‌க‌வ‌ல்',
'Event has been dropped.' => 'நிக‌ழ்ச்சி (Event) நீக்க‌ப்ப‌ட்ட‌து.',
'Event has been altered.' => 'நிக‌ழ்ச்சி (Event) மாற்றப்ப‌ட்ட‌து.',
'Event has been created.' => 'நிக‌ழ்ச்சி (Event) உருவாக்க‌‌ப்ப‌ட்ட‌து.',
'Alter event' => 'நிக‌ழ்ச்சியை (Event) மாற்று',
'Create event' => 'நிக‌ழ்ச்சியை (Event) உருவாக்கு',
'At given time' => 'குறித்த‌ நேர‌த்தில்',
'Every' => 'ஒவ்வொரு',
'Events' => 'நிக‌ழ்ச்சிக‌ள்',
'Schedule' => 'கால‌ அட்ட‌வ‌ணை',
'Start' => 'தொட‌ங்கு',
'End' => 'முடி (வு)',
'Status' => 'நிக‌ழ்நிலை (Status)',
'On completion preserve' => 'முடிந்த‌தின் பின் பாதுகாக்க‌வும்',
'Tables and views' => 'அட்ட‌வ‌ணைக‌ளும் பார்வைக‌ளும்',
'Data Length' => 'த‌க‌வ‌ல் நீள‌ம்',
'Index Length' => 'Index நீள‌ம்',
'Data Free' => 'Data Free',
'Collation' => 'கொலேச‌ன்',
'Analyze' => 'நுணுகி ஆராய‌வும்',
'Optimize' => 'உக‌ப்பாக்கு (Optimize)',
'Check' => 'ப‌ரிசோதி',
'Repair' => 'ப‌ழுது பார்',
'Truncate' => 'குறை (Truncate)',
'Tables have been truncated.' => 'அட்ட‌வ‌ணை குறைக்க‌ப்ப‌ட்ட‌து (truncated).',
'Rows' => 'வ‌ரிசைக‌ள்',
',' => ',',
'Tables have been moved.' => 'அட்ட‌வ‌ணை ந‌க‌ர்த்த‌ப்ப‌ட்ட‌து.',
'Move to other database' => 'ம‌ற்ற‌ த‌க‌வ‌ல் தள‌த்திற்க்கு ந‌க‌ர்த்து',
'Move' => 'ந‌க‌ர்த்து',
'Engine' => 'எஞ்சின் (Engine)',
'Save and continue edit' => 'சேமித்த‌ பிற‌கு தொகுப்ப‌தை தொட‌ர‌வும்',
'original' => 'அச‌ல்',
'Tables have been dropped.' => 'அட்ட‌வ‌ணை நீக்க‌ப்ப‌ட்ட‌து.',
'%d item(s) have been affected.' => array('%d உருப்ப‌டி மாற்ற‌ம‌டைந்தது.', '%d உருப்ப‌டிக‌ள் மாற்ற‌ம‌டைந்த‌ன‌.'),
'whole result' => 'முழுமையான‌ முடிவு',
'Clone' => 'ந‌க‌லி (Clone)',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'அனும‌திக்க‌ப்ப‌ட்ட‌ அதிக‌ப‌ட்ச‌ கோப்புக‌ளின் எண்ணிக்கை மீற‌ப்ப‌ட்ட‌து. த‌ய‌வு செய்து %s ம‌ற்றும் %s யை அதிக‌ரிக்க‌வும்.',
'Partition by' => 'பிரித்த‌து',
'Partitions' => 'பிரிவுக‌ள்',
'Partition name' => 'பிரிவின் பெய‌ர்',
'Values' => 'ம‌திப்புக‌ள்',
'%d row(s) have been imported.' => array('%d வ‌ரிசை இற‌க்கும‌தி (Import) செய்ய‌ப்ப‌ட்ட‌து.', '%d வ‌ரிசைக‌ள் இற‌க்கும‌தி (Import) செய்ய‌ப்ப‌ட்டன‌.'),
'Show structure' => 'க‌ட்ட‌மைப்பை காண்பிக்க‌வும்',
'CSV Import' => 'இம்போர்ட் CSV',
'Import' => 'இற‌க்கும‌தி (Import)',
'Stop on error' => 'பிழை ஏற்ப‌டின் நிற்க‌',
'Select data' => 'த‌க‌வ‌லை தேர்வு செய்',
'%.3f s' => '%.3f s',
'$1-$3-$5' => '$5/$3/$1',
'[yyyy]-mm-dd' => 'dd/mm/[yyyy]',
'History' => 'வ‌ர‌லாறு',
'Variables' => 'மாறிலிக‌ள் (Variables)',
'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.' => 'இல‌க்கு நெடுவ‌ரிசையில் அக‌வ‌ரிசை (Index) ம‌ற்றும் குறிக்க‌ப்ப‌ட்ட‌ த‌க‌வல் (Referenced DATA) க‌ண்டிப்பாக‌ இருத்த‌ல் வேண்டும். மூல‌ நெடுவ‌ரிசை ம‌ற்றும் இலக்கு நெடுவ‌ரிசையின் த‌க‌வ‌ல் வ‌டிவ‌ம் (DATA TYPE) ஒன்றாக‌ இருக்க‌ வேண்டும்.',
'Relations' => 'உற‌வுக‌ள் (Relations)',
'Run file' => 'கோப்பினை இய‌க்க‌வும்',
'Clear' => 'துடை (Clear)',
'Maximum allowed file size is %sB.' => 'கோப்பின் அதிக‌ப‌ட்ச‌ அள‌வு %sB.',
'Numbers' => 'எண்க‌ள்',
'Date and time' => 'தேதி ம‌ற்றும் நேர‌ம்',
'Strings' => 'ச‌ர‌ம் (String)',
'Binary' => 'பைன‌ரி',
'Lists' => 'ப‌ட்டிய‌ல்',
'Editor' => 'தொகுப்பாளர்',
'E-mail' => 'மின்ன‌ஞ்ச‌ல்',
'From' => 'அனுப்புனர்',
'Subject' => 'பொருள்',
'Send' => 'அனுப்பு',
'%d e-mail(s) have been sent.' => array('%d மின்ன‌ஞ்ச‌ல் அனுப்ப‌ப‌ட்ட‌து.', '%d மின்ன‌ஞ்ச‌ல்க‌ள் அனுப்ப‌ப்ப‌ட்ட‌ன‌.'),
'Webserver file %s' => 'வெப் ச‌ர்வ‌ர் கோப்பு %s',
'File does not exist.' => 'கோப்பு இல்லை.',
'%d in total' => 'மொத்தம் %d ',
'Permanent login' => 'நிர‌ந்த‌ர‌மாக‌ நுழைய‌வும்',
'Schema' => 'அமைப்புமுறை',
'Alter schema' => 'அமைப்புமுறையை மாற்று',
'Create schema' => 'அமைப்புமுறையை உருவாக்கு',
'Search data in tables' => 'த‌க‌வ‌லை அட்ட‌வ‌ணையில் தேடு',
'Sequences' => 'வ‌ரிசைமுறை',
'Create sequence' => 'வ‌ரிசைமுறையை உருவாக்கு',
'User types' => 'ப‌ய‌னாள‌ர் வ‌கைக‌ள்',
'Create type' => 'வ‌கையை உருவாக்கு',
'Item%s has been inserted.' => 'உருப்ப‌டி (Item) சேர்க்க‌ப்ப‌ட்ட‌து.',
'Schema has been dropped.' => 'அமைப்புமுறை நீக்க‌ப்ப‌ட்ட‌து.',
'Schema has been created.' => 'அமைப்புமுறை உருவாக்க‌ப்ப‌ட்ட‌து.',
'Schema has been altered.' => 'அமைப்புமுறை மாற்ற‌ப்ப‌ட்ட‌து.',
'Double click on a value to modify it.' => 'ம‌திப்பினை மாற்ற அத‌ன் மீது இருமுறை சொடுக்க‌வும் (Double click).',
'Increase text length to modify this value.' => 'இந்த‌ ம‌திப்பினை மாற்ற, டெக்ஸ்ட் நீள‌த்தினை அதிக‌ரிக்க‌வும்.',
'Use edit link to modify this value.' => 'இந்த‌ ம‌திப்பினை மாற்ற‌, தொகுப்பு இணைப்பினை உப‌யோகிக்க‌வும்.',
'last' => 'க‌டைசி',
'Sequence has been dropped.' => 'வ‌ரிசைமுறை நீக்க‌ப்ப‌ட்ட‌து.',
'Sequence has been created.' => 'வ‌ரிசைமுறை உருவாக்க‌ப்ப‌ட்ட‌து.',
'Sequence has been altered.' => 'வ‌ரிசைமுறை மாற்ற‌ப்ப‌ட்ட‌து.',
'Alter sequence' => 'வ‌ரிசைமுறையை மாற்று',
'From server' => 'செர்வ‌ரில் இருந்து',
'Type has been dropped.' => 'வ‌கை (type) நீக்க‌ப்ப‌ட்ட‌து.',
'Type has been created.' => 'வ‌கை (type) உருவாக்க‌ப்ப‌ட்ட‌து.',
'Alter type' => 'வ‌கையினை (type) மாற்று',
'System' => 'சிஸ்ட‌ம் (System)',
'anywhere' => 'எங்காயினும்',
'empty' => 'வெறுமை (empty)',
'schema' => 'அமைப்புமுறை',
'No extension' => 'விரிவு (extensஇஒன்) இல்லை ',
'Databases have been dropped.' => 'த‌க‌வ‌ல் த‌ள‌ங்க‌ள் நீக்க‌ப்ப‌ட்டன‌.',
'%s version: %s through PHP extension %s' => '%s ப‌திப்பு: %s through PHP extension %s',
'Network' => 'நெட்வொர்க்',
'Geometry' => 'வ‌டிவ‌விய‌ல் (Geometry)',
'File exists.' => 'கோப்பு உள்ள‌து.',
'Attachments' => 'இணைப்புக‌ள்.',
'now' => 'இப்பொழுது',
);

View File

@@ -23,7 +23,7 @@ $translations = array(
'Options' => '選項', 'Options' => '選項',
'Save' => '儲存', 'Save' => '儲存',
'Drop' => '丟棄', 'Drop' => '丟棄',
'Database has been dropped.' => '資料庫已刪除。', 'Database has been dropped.' => '已丟棄資料庫。',
'Database has been created.' => '已建立資料庫。', 'Database has been created.' => '已建立資料庫。',
'Database has been renamed.' => '已重新命名資料庫。', 'Database has been renamed.' => '已重新命名資料庫。',
'Database has been altered.' => '已更改資料庫。', 'Database has been altered.' => '已更改資料庫。',
@@ -38,7 +38,7 @@ $translations = array(
'select' => '選擇', 'select' => '選擇',
'Create new table' => '建立新資料表', 'Create new table' => '建立新資料表',
'Item has been updated.' => '已更新項目。', 'Item has been updated.' => '已更新項目。',
'Item%s has been inserted.' => '已插入項目%s。', 'Item has been inserted.' => '已插入項目。',
'Edit' => '編輯', 'Edit' => '編輯',
'Insert' => '插入', 'Insert' => '插入',
'Save and insert next' => '儲存並插入下一個', 'Save and insert next' => '儲存並插入下一個',
@@ -225,37 +225,4 @@ $translations = array(
'%d in total' => '總共 %d 個', '%d in total' => '總共 %d 個',
'Permanent login' => '永久登入', 'Permanent login' => '永久登入',
'Table has been dropped.' => '已經刪除資料表。', 'Table has been dropped.' => '已經刪除資料表。',
'Databases have been dropped.' => '資料庫已刪除。',
'Search data in tables' => '在資料庫搜尋',
'schema' => '架構',
'Schema' => '架構',
'Alter schema' => '更改架構',
'Create schema' => '建立架構',
'Schema has been dropped.' => '已刪除架構。',
'Schema has been created.' => '已建立架構。',
'Schema has been altered.' => '已更改架構。',
'Sequences' => 'Sequences',
'Create sequence' => '建立 sequence',
'Alter sequence' => '更改 sequence',
'Sequence has been dropped.' => '已刪除 sequence。',
'Sequence has been created.' => '已建立 sequence。',
'Sequence has been altered.' => '已更改 sequence。',
'User types' => '使用者類型',
'Create type' => '建立類型',
'Alter type' => '更改類型',
'Type has been dropped.' => '已刪除類型。',
'Type has been created.' => '已建立類型。',
'Double click on a value to modify it.' => '雙擊以進行修改。',
'Increase text length to modify this value.' => '增加字串長度來修改。',
'Use edit link to modify this value.' => '使用編輯連結來修改。',
'last' => '最後一頁',
'From server' => '從伺服器',
'System' => '資料庫系統',
'Select data' => '選擇資料',
'Show structure' => '秀出結構',
'empty' => '空值',
'Network' => '網路',
'Geometry' => '幾何',
'File exists.' => '檔案已存在。',
'Attachments' => '附件',
); );

View File

@@ -40,7 +40,7 @@ $translations = array(
'Create new table' => '创建新表', 'Create new table' => '创建新表',
'Item has been deleted.' => '已删除项目。', 'Item has been deleted.' => '已删除项目。',
'Item has been updated.' => '已更新项目。', 'Item has been updated.' => '已更新项目。',
'Item%s has been inserted.' => '已插入项目%s。', 'Item has been inserted.' => '已插入项目。',
'Edit' => '编辑', 'Edit' => '编辑',
'Insert' => '插入', 'Insert' => '插入',
'Save and insert next' => '保存并插入下一个', 'Save and insert next' => '保存并插入下一个',
@@ -62,7 +62,7 @@ $translations = array(
'Action' => '动作', 'Action' => '动作',
'edit' => '编辑', 'edit' => '编辑',
'Page' => '页面', 'Page' => '页面',
'Query executed OK, %d row(s) affected.' => '执行查询OK%d 行受影响', 'Query executed OK, %d row(s) affected.' => '执行查询OK%d 行受影响',
'Error in query' => '查询出错', 'Error in query' => '查询出错',
'Execute' => '执行', 'Execute' => '执行',
'Table' => '表', 'Table' => '表',
@@ -78,7 +78,7 @@ $translations = array(
'Unable to upload a file.' => '不能上传文件。', 'Unable to upload a file.' => '不能上传文件。',
'File upload' => '文件上传', 'File upload' => '文件上传',
'File uploads are disabled.' => '文件上传被禁用。', 'File uploads are disabled.' => '文件上传被禁用。',
'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 扩展可用(%s。',
@@ -222,40 +222,7 @@ $translations = array(
'Send' => '发送', 'Send' => '发送',
'%d e-mail(s) have been sent.' => '%d 封邮件已发送。', '%d e-mail(s) have been sent.' => '%d 封邮件已发送。',
'Webserver file %s' => 'Web服务器文件 %s', 'Webserver file %s' => 'Web服务器文件 %s',
'File does not exist.' => '文件不存在', 'File does not exist.' => '文件不存在',
'%d in total' => '共计 %d', '%d in total' => '共计 %d',
'Permanent login' => '保持登录', 'Permanent login' => '保持登录',
'Databases have been dropped.' => '已丢弃数据库。',
'Search data in tables' => '在表中搜索数据',
'schema' => '模式',
'Schema' => '模式',
'Alter schema' => '更改模式',
'Create schema' => '创建模式',
'Schema has been dropped.' => '已丢弃模式。',
'Schema has been created.' => '已创建模式。',
'Schema has been altered.' => '已更改模式。',
'Sequences' => '序列',
'Create sequence' => '创建序列',
'Alter sequence' => '更改序列',
'Sequence has been dropped.' => '已丢弃序列。',
'Sequence has been created.' => '已创建序列。',
'Sequence has been altered.' => '已更改序列。',
'User types' => '用户类型',
'Create type' => '创建类型',
'Alter type' => '更改类型',
'Type has been dropped.' => '已丢弃类型。',
'Type has been created.' => '已创建类型。',
'Double click on a value to modify it.' => '在值上双击类修改它。',
'Increase text length to modify this value.' => '增加文本长度以修改该值。',
'Use edit link to modify this value.' => '使用编辑链接来修改该值。',
'last' => '最后',
'From server' => '来自服务器',
'System' => '系统',
'Select data' => '选择数据',
'Show structure' => '显示结构',
'empty' => '空',
'Network' => '网络',
'Geometry' => '几何图形',
'File exists.' => '文件已存在。',
'Attachments' => '附件',
); );

View File

@@ -39,7 +39,6 @@ if ($_POST) {
?> ?>
<form action="" method="post" id="form"> <form action="" method="post" id="form">
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
<table cellspacing="0" class="nowrap"> <table cellspacing="0" class="nowrap">
<?php <?php
edit_fields($row["fields"], $collations, $routine); edit_fields($row["fields"], $collations, $routine);
@@ -53,6 +52,7 @@ if (isset($_GET["function"])) {
<p> <p>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?> <?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
<?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($PROCEDURE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?> <?php if ($PROCEDURE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?>
</form> </form>

View File

@@ -13,9 +13,10 @@ page_header(lang('Process list'), $error);
?> ?>
<form action="" method="post"> <form action="" method="post">
<table cellspacing="0" onclick="tableClick(event);" class="nowrap"> <table cellspacing="0" onclick="tableClick(event);">
<?php <?php
foreach (get_rows("SHOW FULL PROCESSLIST") as $i => $row) { $result = $connection->query("SHOW PROCESSLIST");
for ($i=0; $row = $result->fetch_assoc(); $i++) {
if (!$i) { if (!$i) {
echo "<thead><tr lang='en'><th>&nbsp;<th>" . implode("<th>", array_keys($row)) . "</thead>\n"; echo "<thead><tr lang='en'><th>&nbsp;<th>" . implode("<th>", array_keys($row)) . "</thead>\n";
} }

View File

@@ -60,10 +60,10 @@ document.onmouseup = schemaMouseup;
<?php <?php
foreach ($schema as $name => $table) { foreach ($schema as $name => $table) {
echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schemaMousedown(this, event);'>"; echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schemaMousedown(this, event);'>";
echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><b>' . h($name) . "</b></a><br>\n"; echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><strong>' . h($name) . "</strong></a><br>\n";
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 ($field["primary"] ? "<i>$val</i>" : $val) . "<br>\n"; echo ($field["primary"] ? "<em>$val</em>" : $val) . "<br>\n";
} }
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) {

View File

@@ -1,35 +0,0 @@
<?php
header("Content-Type: text/javascript; charset=utf-8");
if ($_GET["script"] == "db") {
$sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
foreach (table_status() as $row) {
$id = addcslashes($row["Name"], "\\'/");
echo "setHtml('Comment-$id', '" . nbsp($row["Comment"]) . "');\n";
if (!is_view($row)) {
foreach (array("Engine", "Collation") as $key) {
echo "setHtml('$key-$id', '" . nbsp($row[$key]) . "');\n";
}
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
if ($row[$key] != "") {
$val = number_format($row[$key], 0, '.', lang(','));
echo "setHtml('$key-$id', '" . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "');\n";
if (isset($sums[$key])) {
$sums[$key] += ($row["Engine"] != "InnoDB" || $key != "Data_free" ? $row[$key] : 0);
}
} elseif (array_key_exists($key, $row)) {
echo "setHtml('$key-$id');\n";
}
}
}
}
foreach ($sums as $key => $val) {
echo "setHtml('sum-$key', '" . number_format($val, 0, '.', lang(',')) . "');\n";
}
} else { // connect
foreach (count_tables(get_databases()) as $db => $val) {
echo "setHtml('tables-" . addcslashes($db, "\\'/") . "', '$val');\n";
}
}
exit; // don't print footer

View File

@@ -2,7 +2,7 @@
$TABLE = $_GET["select"]; $TABLE = $_GET["select"];
$table_status = table_status($TABLE); $table_status = table_status($TABLE);
$indexes = indexes($TABLE); $indexes = indexes($TABLE);
$fields = fields($TABLE, 1); // 1 - hidden $fields = fields($TABLE);
$foreign_keys = column_foreign_keys($TABLE); $foreign_keys = column_foreign_keys($TABLE);
$rights = array(); // privilege => 0 $rights = array(); // privilege => 0
@@ -12,7 +12,7 @@ foreach ($fields as $key => $field) {
$name = $adminer->fieldName($field); $name = $adminer->fieldName($field);
if (isset($field["privileges"]["select"]) && $name != "") { if (isset($field["privileges"]["select"]) && $name != "") {
$columns[$key] = html_entity_decode(strip_tags($name)); $columns[$key] = html_entity_decode(strip_tags($name));
if (ereg('text|lob', $field["type"])) { if (ereg('text|blob', $field["type"])) {
$text_length = $adminer->selectLengthProcess(); $text_length = $adminer->selectLengthProcess();
} }
} }
@@ -28,18 +28,11 @@ $group_by = ($group && count($group) < count($select) ? "\nGROUP BY " . implode(
if ($_POST && !$error) { if ($_POST && !$error) {
$where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")"; $where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
$primary = $unselected = null; $primary = ($indexes["PRIMARY"] ? ($select ? array_flip($indexes["PRIMARY"]["columns"]) : array()) : null); // empty array means that all primary fields are selected
foreach ($indexes as $index) {
if ($index["type"] == "PRIMARY") {
$primary = array_flip($index["columns"]);
$unselected = ($select ? $primary : array());
break;
}
}
foreach ($select as $key => $val) { foreach ($select as $key => $val) {
$val = $_GET["columns"][$key]; $val = $_GET["columns"][$key];
if (!$val["fun"]) { if (!$val["fun"]) {
unset($unselected[$val["col"]]); unset($primary[$val["col"]]);
} }
} }
if ($_POST["export"]) { if ($_POST["export"]) {
@@ -55,7 +48,7 @@ if ($_POST && !$error) {
} }
dump_csv($row); dump_csv($row);
} }
if (!is_array($_POST["check"]) || $unselected === array()) { if (!is_array($_POST["check"]) || $primary === array()) {
$where2 = $where; $where2 = $where;
if (is_array($_POST["check"])) { if (is_array($_POST["check"])) {
$where2[] = "($where_check)"; $where2[] = "($where_check)";
@@ -100,7 +93,7 @@ if ($_POST && !$error) {
$command = "INSERT"; $command = "INSERT";
$query = "INTO $query"; $query = "INTO $query";
} }
if ($_POST["all"] || ($unselected === array() && $_POST["check"]) || count($group) < count($select)) { if ($_POST["all"] || ($primary === array() && $_POST["check"]) || count($group) < count($select)) {
$result = queries($command . " $query" . ($_POST["all"] ? ($where ? "\nWHERE " . implode(" AND ", $where) : "") : "\nWHERE $where_check")); $result = queries($command . " $query" . ($_POST["all"] ? ($where ? "\nWHERE " . implode(" AND ", $where) : "") : "\nWHERE $where_check"));
$affected = $connection->affected_rows; $affected = $connection->affected_rows;
} else { } else {
@@ -151,11 +144,12 @@ if ($_POST && !$error) {
$cols = $matches2[1]; $cols = $matches2[1];
$affected--; $affected--;
} else { } else {
$set = array(); $set = "";
foreach ($matches2[1] as $i => $col) { foreach ($matches2[1] as $i => $col) {
$set[idf_escape($cols[$i])] = ($col == "" && $fields[$cols[$i]]["null"] ? "NULL" : q(str_replace('""', '"', preg_replace('~^"|"$~', '', $col)))); $set .= ", " . idf_escape($cols[$i]) . " = " . ($col == "" && $fields[$cols[$i]]["null"] ? "NULL" : $connection->quote(str_replace('""', '"', preg_replace('~^"|"$~', '', $col))));
} }
$result = insert_update($TABLE, $set, $primary); $set = substr($set, 1);
$result = queries("INSERT INTO " . table($TABLE) . " SET$set ON DUPLICATE KEY UPDATE$set");
if (!$result) { if (!$result) {
break; break;
} }
@@ -165,7 +159,7 @@ if ($_POST && !$error) {
queries("COMMIT"); queries("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);
queries("ROLLBACK"); // after queries_redirect() to not overwrite error queries("ROLLBACK");
} else { } else {
$error = upload_error($file); $error = upload_error($file);
} }
@@ -242,7 +236,7 @@ if (!$columns) {
$backward_keys = $adminer->backwardKeys($TABLE, $table_name); $backward_keys = $adminer->backwardKeys($TABLE, $table_name);
echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n"; echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
echo "<thead><tr>" . (!$group && $select ? "" : "<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='" . h($_GET["modify"] ? remove_from_uri("modify") : $_SERVER["REQUEST_URI"] . "&modify=1") . "'>" . lang('edit') . "</a>"); echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='" . h($_GET["modify"] ? remove_from_uri("modify") : $_SERVER["REQUEST_URI"] . "&modify=1") . "'>" . lang('edit') . "</a>";
$names = array(); $names = array();
$functions = array(); $functions = array();
reset($select); reset($select);
@@ -274,7 +268,7 @@ if (!$columns) {
foreach ($unique_array as $key => $val) { foreach ($unique_array as $key => $val) {
$unique_idf .= "&" . (isset($val) ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key)); $unique_idf .= "&" . (isset($val) ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key));
} }
echo "<tr" . odd() . ">" . (!$group && $select ? "" : "<td>" . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . (count($group) < count($select) || information_schema(DB) ? "" : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'>" . lang('edit') . "</a>")); echo "<tr" . odd() . "><td>" . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . (count($select) != count($group) || information_schema(DB) ? '' : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'>" . lang('edit') . "</a>");
foreach ($row as $key => $val) { foreach ($row as $key => $val) {
if (isset($names[$key])) { if (isset($names[$key])) {
$field = $fields[$key]; $field = $fields[$key];
@@ -286,7 +280,7 @@ if (!$columns) {
if (!isset($val)) { if (!isset($val)) {
$val = "<i>NULL</i>"; $val = "<i>NULL</i>";
} else { } else {
if (ereg('blob|bytea|raw|file', $field["type"]) && $val != "") { if (ereg('binary|blob|bytea', $field["type"]) && $val != "") {
$link = h(ME . 'download=' . urlencode($TABLE) . '&field=' . urlencode($key) . $unique_idf); $link = h(ME . 'download=' . urlencode($TABLE) . '&field=' . urlencode($key) . $unique_idf);
} }
if ($val == "") { if ($val == "") {
@@ -321,26 +315,21 @@ if (!$columns) {
} }
} }
} }
if (!$link) { if (!$link && is_email($val)) {
if (is_email($val)) { $link = "mailto:$val";
$link = "mailto:$val"; }
} if (!$link && is_url($row[$key])) {
if ($protocol = is_url($row[$key])) { $link = "http://www.adminer.org/redirect/?url=" . urlencode($row[$key]); // intermediate page to hide Referer, may be changed to rel="noreferrer" in HTML5
$link = ($protocol == "http" && $HTTPS
? $row[$key] // HTTP links from HTTPS pages don't receive Referer automatically
: "$protocol://www.adminer.org/redirect/?url=" . urlencode($row[$key]) // intermediate page to hide Referer, may be changed to rel="noreferrer" in HTML5
);
}
} }
$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)];
$h_value = h(isset($value) ? $value : $row[$key]); $h_value = h(isset($value) ? $value : $row[$key]);
$long = strpos($val, "<i>...</i>"); $long = strpos($val, "<em>...</em>");
$editable = is_utf8($val) && !$long && $rows[$n][$key] == $row[$key] && !$functions[$key]; $editable = is_utf8($val) && !$long && $rows[$n][$key] == $row[$key] && !$functions[$key];
$text = ereg('text|lob', $field["type"]); $text = ereg('text|blob', $field["type"]);
echo (($_GET["modify"] && $editable) || isset($value) echo (($_GET["modify"] && $editable) || isset($value)
? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>") ? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
: "<td id='$id' ondblclick=\"" . ($editable ? "selectDblClick(this, event" . ($text ? ", 1" : "") . ")" : "alert('" . h($long ? lang('Increase text length to modify this value.') : lang('Use edit link to modify this value.')) . "')") . ";\">" . $adminer->selectVal($val, $link, $field) : "<td id='$id' ondblclick=\"" . ($editable ? "selectDblClick(this, event" . ($text ? ", 1" : "") . ")" : "alert('" . ($long ? lang('Increase text length to modify this value.') : lang('Use edit link to modify this value.')) . "')") . ";\">" . $adminer->selectVal($val, $link, $field)
); );
} }
} }
@@ -369,7 +358,7 @@ if (!$columns) {
if (intval($limit) && $found_rows > $limit) { if (intval($limit) && $found_rows > $limit) {
// display first, previous 4, next 4 and last page // display first, previous 4, next 4 and last page
$max_page = floor(($found_rows - 1) / $limit); $max_page = floor(($found_rows - 1) / $limit);
echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"var page = +prompt('" . lang('Page') . "', '" . ($page + 1) . "'); if (!isNaN(page) &amp;&amp; page) location.href = this.href + (page != 1 ? '&amp;page=' + (page - 1) : ''); return false;\">" . lang('Page') . "</a>:" . pagination(0, $page) . ($page > 5 ? " ..." : ""); echo lang('Page') . ":" . pagination(0, $page) . ($page > 5 ? " ..." : "");
for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) { for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
echo pagination($i, $page); echo pagination($i, $page);
} }
@@ -392,7 +381,7 @@ if (!$columns) {
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";
} }
print_fieldset("import", lang('CSV Import'), !$rows); print_fieldset("import", lang('CSV Import'), !$result->num_rows);
echo "<input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> "; echo "<input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> ";
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;"), $adminer_export["format"], 1); // 1 - select echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;"), $adminer_export["format"], 1); // 1 - select
echo " <input type='submit' name='import' value='" . lang('Import') . "'>\n"; echo " <input type='submit' name='import' value='" . lang('Import') . "'>\n";

View File

@@ -1,6 +1,6 @@
<?php <?php
restart_session(); restart_session();
$history_all = &get_session("queries"); $history_all = &get_session("history");
$history = &$history_all[DB]; $history = &$history_all[DB];
if (!$error && $_POST["clear"]) { if (!$error && $_POST["clear"]) {
$history = array(); $history = array();
@@ -18,7 +18,7 @@ if (!$error && $_POST) {
: "compress.bzip2://adminer.sql.bz2" : "compress.bzip2://adminer.sql.bz2"
)), "rb"); )), "rb");
$query = ($fp ? fread($fp, 1e6) : false); $query = ($fp ? fread($fp, 1e6) : false);
} elseif ($_FILES["sql_file"]["error"] != 4) { // 4 - UPLOAD_ERR_NO_FILE } elseif ($_POST["file"]) {
$query = get_file("sql_file", true); $query = get_file("sql_file", true);
} }
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
@@ -39,7 +39,7 @@ if (!$error && $_POST) {
if (is_object($connection2) && DB != "") { if (is_object($connection2) && DB != "") {
$connection2->select_db(DB); $connection2->select_db(DB);
} }
$commands = 0; $queries = 0;
$errors = ""; $errors = "";
while ($query != "") { while ($query != "") {
if (!$offset && preg_match('~^\\s*DELIMITER\\s+(.+)~i', $query, $match)) { if (!$offset && preg_match('~^\\s*DELIMITER\\s+(.+)~i', $query, $match)) {
@@ -58,15 +58,15 @@ if (!$error && $_POST) {
if (!$found || $found == $delimiter) { // end of a query if (!$found || $found == $delimiter) { // end of a query
$empty = false; $empty = false;
$q = substr($query, 0, $match[0][1]); $q = substr($query, 0, $match[0][1]);
$commands++; $queries++;
echo "<pre class='jush-$jush' id='sql-$commands'>" . shorten_utf8(trim($q), 1000) . "</pre>\n"; echo "<pre class='jush-$jush' id='sql-$queries'>" . shorten_utf8(trim($q), 1000) . "</pre>\n";
ob_flush(); ob_flush();
flush(); // can take a long time - show the running query flush(); // can take a long time - show the running query
$start = explode(" ", microtime()); // microtime(true) is available since PHP 5 $start = explode(" ", microtime()); // microtime(true) is available since PHP 5
//! don't allow changing of character_set_results, convert encoding of displayed query //! don't allow changing of character_set_results, convert encoding of displayed query
if (!$connection->multi_query($q)) { if (!$connection->multi_query($q)) {
echo "<p class='error'>" . lang('Error in query') . ": " . error() . "\n"; echo "<p class='error'>" . lang('Error in query') . ": " . error() . "\n";
$errors .= " <a href='#sql-$commands'>$commands</a>"; $errors .= " <a href='#sql-$queries'>$queries</a>";
if ($_POST["error_stops"]) { if ($_POST["error_stops"]) {
break; break;
} }
@@ -82,7 +82,7 @@ if (!$error && $_POST) {
select($result, $connection2); select($result, $connection2);
echo "<p>" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time; echo "<p>" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time;
if ($connection2 && preg_match("~^($space|\\()*SELECT\\b~isU", $q)) { if ($connection2 && preg_match("~^($space|\\()*SELECT\\b~isU", $q)) {
$id = "explain-$commands"; $id = "explain-$queries";
echo ", <a href='#$id' onclick=\"return !toggle('$id');\">EXPLAIN</a>\n"; echo ", <a href='#$id' onclick=\"return !toggle('$id');\">EXPLAIN</a>\n";
echo "<div id='$id' class='hidden'>\n"; echo "<div id='$id' class='hidden'>\n";
select(explain($connection2, $q)); select(explain($connection2, $q));
@@ -91,7 +91,7 @@ if (!$error && $_POST) {
} else { } else {
if (preg_match("~^$space*(CREATE|DROP|ALTER)$space+(DATABASE|SCHEMA)\\b~isU", $q)) { if (preg_match("~^$space*(CREATE|DROP|ALTER)$space+(DATABASE|SCHEMA)\\b~isU", $q)) {
restart_session(); restart_session();
set_session("dbs", null); // clear cache set_session("databases", null); // clear cache
session_write_close(); session_write_close();
} }
echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n"; echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n";
@@ -115,7 +115,7 @@ if (!$error && $_POST) {
} }
} }
} }
if ($errors && $commands > 1) { if ($errors && $queries > 1) {
echo "<p class='error'>" . lang('Error in query') . ": $errors\n"; echo "<p class='error'>" . lang('Error in query') . ": $errors\n";
} }
if ($empty) { if ($empty) {
@@ -137,17 +137,22 @@ if ($_POST) {
$q = $history[$_GET["history"]]; $q = $history[$_GET["history"]];
} }
textarea("query", $q, 20); textarea("query", $q, 20);
echo ($_POST ? "" : "<script type='text/javascript'>document.getElementsByTagName('textarea')[0].focus();</script>\n");
echo "<p>" . (ini_bool("file_uploads") ? lang('File upload') . ': <input type="file" name="sql_file">' : lang('File uploads are disabled.'));
?> ?>
<p> <p>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Execute'); ?>" title="Ctrl+Enter"> <input type="submit" value="<?php echo lang('Execute'); ?>">
<?php <?php echo checkbox("error_stops", 1, $_POST["error_stops"], lang('Stop on error')); ?>
echo checkbox("error_stops", 1, $_POST["error_stops"], lang('Stop on error'));
print_fieldset("webfile", lang('From server'), $_POST["webfile"]); <p>
<?php
if (!ini_bool("file_uploads")) {
echo lang('File uploads are disabled.');
} else { ?>
<?php echo lang('File upload'); ?>: <input type="file" name="sql_file">
<input type="submit" name="file" value="<?php echo lang('Run file'); ?>">
<?php } ?>
<p><?php
$compress = array(); $compress = array();
foreach (array("gz" => "zlib", "bz2" => "bz2") as $key => $val) { foreach (array("gz" => "zlib", "bz2" => "bz2") as $key => $val) {
if (extension_loaded($val)) { if (extension_loaded($val)) {
@@ -155,9 +160,9 @@ foreach (array("gz" => "zlib", "bz2" => "bz2") as $key => $val) {
} }
} }
echo lang('Webserver file %s', "<code>adminer.sql" . ($compress ? "[" . implode("|", $compress) . "]" : "") . "</code>"); echo lang('Webserver file %s', "<code>adminer.sql" . ($compress ? "[" . implode("|", $compress) . "]" : "") . "</code>");
echo ' <input type="submit" name="webfile" value="' . lang('Run file') . '">'; ?> <input type="submit" name="webfile" value="<?php echo lang('Run file'); ?>">
echo "</div></fieldset>\n";
<?php
if ($history) { if ($history) {
print_fieldset("history", lang('History'), $_GET["history"] != ""); print_fieldset("history", lang('History'), $_GET["history"] != "");
foreach ($history as $key => $val) { foreach ($history as $key => $val) {

View File

@@ -18,6 +18,7 @@ td img { max-width: 200px; max-height: 200px; }
code { background: #eee; } code { background: #eee; }
tr:hover td, tr:hover th { background: #ddf; } tr:hover td, tr:hover th { background: #ddf; }
pre { margin: 1em 0 0; } pre { margin: 1em 0 0; }
ul { margin: 1em 0 0; }
.version { color: #777; font-size: 67%; } .version { color: #777; font-size: 67%; }
.js .hidden { display: none; } .js .hidden { display: none; }
.nowrap td, .nowrap th, td.nowrap { white-space: pre; } .nowrap td, .nowrap th, td.nowrap { white-space: pre; }
@@ -38,6 +39,8 @@ pre { margin: 1em 0 0; }
.type { width: 15ex; width: auto\9; } .type { width: 15ex; width: auto\9; }
#menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; overflow: auto; overflow-y: hidden; white-space: nowrap; } #menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; overflow: auto; overflow-y: hidden; white-space: nowrap; }
#menu p { padding: .8em 1em; margin: 0; border-bottom: 1px solid #ccc; } #menu p { padding: .8em 1em; margin: 0; border-bottom: 1px solid #ccc; }
#tables { padding: 0 0 0 1em; }
#tables li { list-style-type: none; }
#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: 0; left: 0; line-height: 1.8em; 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; }

View File

@@ -407,27 +407,3 @@ function schemaMouseup(ev) {
cookie('adminer_schema=' + encodeURIComponent(s.substr(1)), 30, '; path="' + location.pathname + location.search + '"'); cookie('adminer_schema=' + encodeURIComponent(s.substr(1)), 30, '; path="' + location.pathname + location.search + '"');
} }
} }
/** Handle Tab and Ctrl+Enter in textarea
* @param HTMLTextAreaElement
* @param KeyboardEvent
* @return boolean
*/
function textareaKeydown(target, event) {
if (event.keyCode == 9 && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
// inspired by http://pallieter.org/Projects/insertTab/
if (target.setSelectionRange) {
var start = target.selectionStart;
target.value = target.value.substr(0, start) + '\t' + target.value.substr(target.selectionEnd);
target.setSelectionRange(start + 1, start + 1);
return false; //! still loses focus in Opera, can be solved by handling onblur
} else if (target.createTextRange) {
document.selection.createRange().text = '\t';
return false;
}
}
if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10) && !event.altKey && !event.metaKey) { // shiftKey allowed
target.form.submit();
}
return true;
}

View File

@@ -123,8 +123,6 @@ function selectAddRow(field) {
/** Display edit field /** Display edit field
* @param HTMLElement * @param HTMLElement
* @param MouseEvent * @param MouseEvent
@@ -132,7 +130,7 @@ function selectAddRow(field) {
*/ */
function selectDblClick(td, event, text) { function selectDblClick(td, event, text) {
var pos = event.rangeOffset; var pos = event.rangeOffset;
var value = (td.firstChild.firstChild ? td.firstChild.firstChild.data : (td.firstChild.alt ? td.firstChild.alt : td.firstChild.data)); var value = (td.firstChild.firstChild ? td.firstChild.firstChild.data : td.firstChild.data);
var input = document.createElement(text ? 'textarea' : 'input'); var input = document.createElement(text ? 'textarea' : 'input');
input.name = td.id; input.name = td.id;
input.value = (value == '\u00A0' || td.getElementsByTagName('i').length ? '' : value); // &nbsp; or i - NULL input.value = (value == '\u00A0' || td.getElementsByTagName('i').length ? '' : value); // &nbsp; or i - NULL

View File

@@ -6,12 +6,8 @@ if (!$fields) {
} }
$table_status = ($fields ? table_status($TABLE) : array()); $table_status = ($fields ? table_status($TABLE) : array());
page_header(($fields && is_view($table_status) ? lang('View') : lang('Table')) . ": " . h($TABLE), $error); page_header(($fields && $table_status["Engine"] == "VIEW" ? lang('View') : lang('Table')) . ": " . h($TABLE), $error);
$adminer->selectLinks($table_status); $adminer->selectLinks($table_status);
$comment = $table_status["Comment"];
if ($comment != "") {
echo "<p>" . lang('Comment') . ": " . h($comment) . "\n";
}
if ($fields) { if ($fields) {
echo "<table cellspacing='0'>\n"; echo "<table cellspacing='0'>\n";
@@ -24,7 +20,7 @@ if ($fields) {
} }
echo "</table>\n"; echo "</table>\n";
if (!is_view($table_status)) { if ($table_status["Engine"] != "VIEW") {
echo "<h3>" . lang('Indexes') . "</h3>\n"; echo "<h3>" . lang('Indexes') . "</h3>\n";
$indexes = indexes($TABLE); $indexes = indexes($TABLE);
if ($indexes) { if ($indexes) {
@@ -48,11 +44,11 @@ if ($fields) {
echo "<table cellspacing='0'>\n"; echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Source') . "<td>" . lang('Target') . "<td>" . lang('ON DELETE') . "<td>" . lang('ON UPDATE') . ($jush != "sqlite" ? "<td>&nbsp;" : "") . "</thead>\n"; echo "<thead><tr><th>" . lang('Source') . "<td>" . lang('Target') . "<td>" . lang('ON DELETE') . "<td>" . lang('ON UPDATE') . ($jush != "sqlite" ? "<td>&nbsp;" : "") . "</thead>\n";
foreach ($foreign_keys as $name => $foreign_key) { foreach ($foreign_keys as $name => $foreign_key) {
$link = ($foreign_key["db"] != "" ? "<b>" . h($foreign_key["db"]) . "</b>." : "") . h($foreign_key["table"]); $link = ($foreign_key["db"] != "" ? "<strong>" . h($foreign_key["db"]) . "</strong>." : "") . h($foreign_key["table"]);
echo "<tr>"; echo "<tr>";
echo "<th><i>" . implode("</i>, <i>", array_map('h', $foreign_key["source"])) . "</i>"; echo "<th><i>" . implode("</i>, <i>", array_map('h', $foreign_key["source"])) . "</i>";
echo "<td><a href='" . h($foreign_key["db"] != "" ? preg_replace('~db=[^&]*~', "db=" . urlencode($foreign_key["db"]), ME) : ME) . "table=" . urlencode($foreign_key["table"]) . "'>$link</a>"; echo "<td><a href='" . h($foreign_key["db"] != "" ? preg_replace('~db=[^&]*~', "db=" . urlencode($foreign_key["db"]), ME) : ME) . "table=" . urlencode($foreign_key["table"]) . "'>$link</a>";
echo "(<i>" . implode("</i>, <i>", array_map('h', $foreign_key["target"])) . "</i>)"; echo "(<em>" . implode("</em>, <em>", array_map('h', $foreign_key["target"])) . "</em>)";
echo "<td>$foreign_key[on_delete]\n"; echo "<td>$foreign_key[on_delete]\n";
echo "<td>$foreign_key[on_update]\n"; echo "<td>$foreign_key[on_update]\n";
if ($jush != "sqlite") { if ($jush != "sqlite") {

View File

@@ -34,11 +34,11 @@ if ($_POST) {
<tr><th><?php echo lang('Event'); ?><td><?php echo html_select("Event", $trigger_event, $row["Event"], "this.form['Timing'].onchange();"); ?> <tr><th><?php echo lang('Event'); ?><td><?php echo html_select("Event", $trigger_event, $row["Event"], "this.form['Timing'].onchange();"); ?>
<tr><th><?php echo lang('Type'); ?><td><?php echo html_select("Type", $trigger_options["Type"], $row["Type"]); ?> <tr><th><?php echo lang('Type'); ?><td><?php echo html_select("Type", $trigger_options["Type"], $row["Type"]); ?>
</table> </table>
<p><?php echo lang('Name'); ?>: <input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64">
<p><?php textarea("Statement", $row["Statement"]); ?> <p><?php textarea("Statement", $row["Statement"]); ?>
<p> <p>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?> <?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
<?php echo lang('Name'); ?>: <input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64">
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($_GET["name"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?> <?php if ($_GET["name"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?>
</form> </form>

View File

@@ -1,33 +0,0 @@
<?php
$TYPE = $_GET["type"];
if ($_POST && !$error) {
$link = substr(ME, 0, -1);
if ($_POST["drop"]) {
query_redirect("DROP TYPE " . idf_escape($TYPE), $link, lang('Type has been dropped.'));
} else {
query_redirect("CREATE TYPE " . idf_escape($_POST["name"]) . " $_POST[as]", $link, lang('Type has been created.'));
}
}
page_header($TYPE != "" ? lang('Alter type') . ": " . h($TYPE) : lang('Create type'), $error);
$row["as"] = "AS ";
if ($_POST) {
$row = $_POST;
}
?>
<form action="" method="post">
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<?php
if ($TYPE != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'$confirm>\n";
} else {
echo "<input name='name' value='" . h($row['name']) . "'>\n";
textarea("as", $row["as"]);
echo "<p><input type='submit' value='" . lang('Save') . "'>\n";
}
?>
</form>

View File

@@ -1,7 +1,8 @@
<?php <?php
$USER = $_GET["user"]; $USER = $_GET["user"];
$privileges = array("" => array("All privileges" => "")); $privileges = array("" => array("All privileges" => ""));
foreach (get_rows("SHOW PRIVILEGES") as $row) { $result = $connection->query("SHOW PRIVILEGES");
while ($row = $result->fetch_assoc()) {
foreach (explode(",", ($row["Privilege"] == "Grant option" ? "" : $row["Context"])) as $context) { foreach (explode(",", ($row["Privilege"] == "Grant option" ? "" : $row["Context"])) as $context) {
$privileges[$context][$row["Privilege"]] = $row["Comment"]; $privileges[$context][$row["Privilege"]] = $row["Comment"];
} }
@@ -26,7 +27,7 @@ if ($_POST) {
} }
$grants = array(); $grants = array();
$old_pass = ""; $old_pass = "";
if (isset($_GET["host"]) && ($result = $connection->query("SHOW GRANTS FOR " . q($USER) . "@" . q($_GET["host"])))) { //! use information_schema for MySQL 5 - column names in column privileges are not escaped if (isset($_GET["host"]) && ($result = $connection->query("SHOW GRANTS FOR " . $connection->quote($USER) . "@" . $connection->quote($_GET["host"])))) { //! use information_schema for MySQL 5 - column names in column privileges are not escaped
while ($row = $result->fetch_row()) { while ($row = $result->fetch_row()) {
if (preg_match('~GRANT (.*) ON (.*) TO ~', $row[0], $match) && preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~', $match[1], $matches, PREG_SET_ORDER)) { //! escape the part between ON and TO if (preg_match('~GRANT (.*) ON (.*) TO ~', $row[0], $match) && preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~', $match[1], $matches, PREG_SET_ORDER)) { //! escape the part between ON and TO
foreach ($matches as $val) { foreach ($matches as $val) {
@@ -45,9 +46,9 @@ if (isset($_GET["host"]) && ($result = $connection->query("SHOW GRANTS FOR " . q
} }
if ($_POST && !$error) { if ($_POST && !$error) {
$old_user = (isset($_GET["host"]) ? q($USER) . "@" . q($_GET["host"]) : "''"); $old_user = (isset($_GET["host"]) ? $connection->quote($USER) . "@" . $connection->quote($_GET["host"]) : "''");
$new_user = q($_POST["user"]) . "@" . q($_POST["host"]); // if $_GET["host"] is not set then $new_user is always different $new_user = $connection->quote($_POST["user"]) . "@" . $connection->quote($_POST["host"]); // if $_GET["host"] is not set then $new_user is always different
$pass = q($_POST["pass"]); $pass = $connection->quote($_POST["pass"]);
if ($_POST["drop"]) { if ($_POST["drop"]) {
query_redirect("DROP USER $old_user", ME . "privileges=", lang('User has been dropped.')); query_redirect("DROP USER $old_user", ME . "privileges=", lang('User has been dropped.'));
} else { } else {

View File

@@ -25,10 +25,10 @@ if ($_POST) {
?> ?>
<form action="" method="post"> <form action="" method="post">
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
<p><?php textarea("select", $row["select"]); ?> <p><?php textarea("select", $row["select"]); ?>
<p> <p>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<?php if ($dropped) { // old view was dropped but new wasn't created ?><input type="hidden" name="dropped" value="1"><?php } ?> <?php if ($dropped) { // old view was dropped but new wasn't created ?><input type="hidden" name="dropped" value="1"><?php } ?>
<?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
</form> </form>

View File

@@ -1,26 +1,17 @@
Adminer 3.0.0 (released 2010-10-15): Adminer 3.0.0-dev:
Drivers for MS SQL, SQLite, PostgreSQL, Oracle Drivers for MS SQL, SQLite, PostgreSQL, Oracle
Allow concurrent logins on the same server Allow concurrent logins on the same server
Allow permanent login without customization Allow permanent login without customization
In-place editation in select In-place editation in select
Foreign key options in Table creation
Treat binary type as hex
Show number of tables in server overview Show number of tables in server overview
Operator LIKE %% Operator LIKE %%
Remember export parameters in cookie Remember export parameters in cookie
Allow semicolon as CSV separator Allow semicolon as CSV separator
Schemas, sequences and types support (PostgreSQL)
Autofocus username in login form Autofocus username in login form
Allow to insert Tab in SQL textareas and send the form by Ctrl+Enter
Disable spellchecking in SQL textareas Disable spellchecking in SQL textareas
Display auto_increment value of inserted item Display auto_increment value of inserted item
Allow disabling auto_increment value export
Prefill auto_increment column name
Ability to jump to any page in select by JavaScript
Display comment in table overview
Link last page above data in select
Link table names in SQL queries Link table names in SQL queries
Hungarian, Japanese and Tamil translation Japanese translation
Defer table information in database overview to JavaScript (performance) Defer table information in database overview to JavaScript (performance)
Big tables optimizations (performance) Big tables optimizations (performance)

View File

@@ -207,7 +207,6 @@ foreach (glob(dirname(__FILE__) . "/adminer/drivers/" . ($driver ? $driver : "*"
} }
include dirname(__FILE__) . "/adminer/include/pdo.inc.php"; include dirname(__FILE__) . "/adminer/include/pdo.inc.php";
$features = array("view", "event", "privileges", "user", "processlist", "variables", "trigger", "scheme", "sequence", "dump");
foreach (array("adminer", "editor") as $project) { foreach (array("adminer", "editor") as $project) {
$lang_ids = array(); // global variable simplifies usage in a callback function $lang_ids = array(); // global variable simplifies usage in a callback function
$file = file_get_contents(dirname(__FILE__) . "/$project/index.php"); $file = file_get_contents(dirname(__FILE__) . "/$project/index.php");
@@ -215,7 +214,7 @@ foreach (array("adminer", "editor") as $project) {
$connection = (object) array("server_info" => 5.1); // MySQL support is version specific $connection = (object) array("server_info" => 5.1); // MySQL support is version specific
$_GET[$driver] = true; // to load the driver $_GET[$driver] = true; // to load the driver
include_once dirname(__FILE__) . "/adminer/drivers/$driver.inc.php"; include_once dirname(__FILE__) . "/adminer/drivers/$driver.inc.php";
foreach ($features as $feature) { foreach (array("view", "event", "privileges", "user", "processlist", "variables", "trigger", "scheme", "sequence") as $feature) {
if (!support($feature)) { if (!support($feature)) {
$file = str_replace("} elseif (isset(\$_GET[\"$feature\"])) {\n\tinclude \"./$feature.inc.php\";\n", "", $file); $file = str_replace("} elseif (isset(\$_GET[\"$feature\"])) {\n\tinclude \"./$feature.inc.php\";\n", "", $file);
} }
@@ -232,16 +231,6 @@ foreach (array("adminer", "editor") as $project) {
$file = preg_replace('(include "../adminer/drivers/(?!' . preg_quote($driver) . ').*\\s*)', '', $file); $file = preg_replace('(include "../adminer/drivers/(?!' . preg_quote($driver) . ').*\\s*)', '', $file);
} }
$file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file); // bootstrap.inc.php $file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file); // bootstrap.inc.php
if ($driver) {
foreach ($features as $feature) {
if (!support($feature)) {
$file = preg_replace("((\t*)" . preg_quote('if (support("' . $feature . '")') . ".*\n\\1\\})sU", '', $file);
}
}
if (count($drivers) == 1) {
$file = str_replace('<?php echo html_select("driver", $drivers, DRIVER); ?>', "<input type='hidden' name='driver' value='" . ($driver == "mysql" ? "server" : $driver) . "'>" . reset($drivers), $file);
}
}
$file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file); $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
$file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file); $file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file);
if ($_SESSION["lang"]) { if ($_SESSION["lang"]) {

View File

@@ -1,21 +1,14 @@
<?php <?php
page_header(lang('Server'), "", false); page_header(lang('Server'), "", false);
echo "<form action='' method='post'>\n"; ?>
echo "<p>" . lang('Search data in tables') . ": <input name='query' value='" . h($_POST["query"]) . "'> <input type='submit' value='" . lang('Search') . "'>\n"; <form action=""><p>
if ($_POST["query"] != "") { <?php echo lang('Search data in tables'); ?>:
<?php hidden_fields_get(); ?>
<input name="where[0][val]" value="<?php echo h($_GET["where"][0]["val"]); ?>">
<input type="submit" value="<?php echo lang('Search'); ?>" />
</form>
<?php
if ($_GET["where"][0]["val"] != "") {
search_tables(); search_tables();
} }
echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^tables\[/);"><th>' . lang('Table') . '<td>' . lang('Rows') . "</thead>\n";
foreach (table_status() as $table => $row) {
$name = $adminer->tableName($row);
if (isset($row["Engine"]) && $name != "") {
echo '<tr' . odd() . '><td>' . checkbox("tables[]", $table, in_array($table, (array) $_POST["tables"], true), "", "formUncheck('check-all');");
echo '<th><a href="' . h(ME) . 'select=' . urlencode($table) . '">' . h($name) . '</a>';
$val = number_format($row["Rows"], 0, '.', lang(','));
echo "<td align='right'><a href='" . h(ME . "edit=") . urlencode($table) . "'>" . ($row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "</a>";
}
}
echo "</table>\n";
echo "</form>\n";

View File

@@ -10,7 +10,7 @@ class Adminer {
//! driver, ns //! driver, ns
function credentials() { function credentials() {
return array(SERVER, $_GET["username"], get_session("pwds")); return array(); // default INI settings
} }
function permanentLogin() { function permanentLogin() {
@@ -19,10 +19,10 @@ class Adminer {
function database() { function database() {
global $connection; global $connection;
$databases = get_databases(false); $dbs = get_databases(false);
return (!$databases return (!$dbs
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list ? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database : $dbs[(information_schema($dbs[0]) ? 1 : 0)] // first available database
); );
} }
@@ -57,27 +57,30 @@ document.getElementById('username').focus();
if (isset($set)) { if (isset($set)) {
echo '<p class="tabs"><a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . "</a>\n"; echo '<p class="tabs"><a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . "</a>\n";
} }
echo "<a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Page') . ": " . lang('last') . "'>&gt;&gt;</a>\n";
} }
function backwardKeys($table, $tableName) { function backwardKeys($table, $tableName) {
global $connection;
$return = array(); $return = array();
foreach (get_rows("SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_COLUMN_NAME $result = $connection->query("SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_COLUMN_NAME
FROM information_schema.KEY_COLUMN_USAGE FROM information_schema.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA = " . q($this->database()) . " WHERE TABLE_SCHEMA = " . $connection->quote($this->database()) . "
AND REFERENCED_TABLE_SCHEMA = " . q($this->database()) . " AND REFERENCED_TABLE_SCHEMA = " . $connection->quote($this->database()) . "
AND REFERENCED_TABLE_NAME = " . q($table) . " AND REFERENCED_TABLE_NAME = " . $connection->quote($table) . "
ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5 ORDER BY ORDINAL_POSITION");
$return[$row["TABLE_NAME"]]["keys"][$row["CONSTRAINT_NAME"]][$row["COLUMN_NAME"]] = $row["REFERENCED_COLUMN_NAME"]; if ($result) { //! requires MySQL 5
} while ($row = $result->fetch_assoc()) {
foreach ($return as $key => $val) { $return[$row["TABLE_NAME"]]["keys"][$row["CONSTRAINT_NAME"]][$row["COLUMN_NAME"]] = $row["REFERENCED_COLUMN_NAME"];
$name = $this->tableName(table_status($key)); }
if ($name != "") { foreach ($return as $key => $val) {
$search = preg_quote($tableName); $name = $this->tableName(table_status($key));
$separator = "(:|\\s*-)?\\s+"; if ($name != "") {
$return[$key]["name"] = (preg_match("(^$search$separator(.+)|^(.+?)$separator$search\$)", $name, $match) ? $match[2] . $match[3] : $name); $search = preg_quote($tableName);
} else { $separator = "(:|\\s*-)?\\s+";
unset($return[$key]); $return[$key]["name"] = (preg_match("(^$search$separator(.+)|^(.+?)$separator$search\$)", $name, $match) ? $match[2] . $match[3] : $name);
} else {
unset($return[$key]);
}
} }
} }
return $return; return $return;
@@ -105,7 +108,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
} }
function selectQuery($query) { function selectQuery($query) {
return "<!--\n" . str_replace("--", "--><!-- ", $query) . "\n-->\n"; return "<!--\n" . str_replace("--", "--><!--", $query) . "\n-->\n";
} }
function rowDescription($table) { function rowDescription($table) {
@@ -152,7 +155,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
function selectVal($val, $link, $field) { function selectVal($val, $link, $field) {
$return = ($val == "<i>NULL</i>" ? "&nbsp;" : $val); $return = ($val == "<i>NULL</i>" ? "&nbsp;" : $val);
if (ereg('blob|bytea', $field["type"]) && !is_utf8($val)) { if (ereg('binary|blob|bytea', $field["type"]) && !is_utf8($val)) {
$return = lang('%d byte(s)', strlen($val)); $return = lang('%d byte(s)', strlen($val));
if (ereg("^(GIF|\xFF\xD8\xFF|\x89\x50\x4E\x47\x0D\x0A\x1A\x0A)", $val)) { // GIF|JPG|PNG, getimagetype() works with filename if (ereg("^(GIF|\xFF\xD8\xFF|\x89\x50\x4E\x47\x0D\x0A\x1A\x0A)", $val)) { // GIF|JPG|PNG, getimagetype() works with filename
$return = "<img src='$link' alt='$return'>"; $return = "<img src='$link' alt='$return'>";
@@ -176,7 +179,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
if (ereg('date|timestamp', $field["type"]) && isset($val)) { if (ereg('date|timestamp', $field["type"]) && isset($val)) {
return preg_replace('~^([0-9]{2}([0-9]+))-(0?([0-9]+))-(0?([0-9]+))~', lang('$1-$3-$5'), $val); return preg_replace('~^([0-9]{2}([0-9]+))-(0?([0-9]+))-(0?([0-9]+))~', lang('$1-$3-$5'), $val);
} }
return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val); return $val;
} }
function selectColumnsPrint($select, $columns) { function selectColumnsPrint($select, $columns) {
@@ -197,7 +200,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$key = $keys[$name]; $key = $keys[$name];
$i--; $i--;
echo "<div>" . h($desc) . "<input type='hidden' name='where[$i][col]' value='" . h($name) . "'>:"; echo "<div>" . h($desc) . "<input type='hidden' name='where[$i][col]' value='" . h($name) . "'>:";
enum_input("checkbox", " name='where[$i][val][]'", $field, (array) $where[$key]["val"]); //! impossible to search for NULL enum_input("checkbox", "where[$i][val][]", $field, (array) $where[$key]["val"]); //! impossible to search for NULL
echo "</div>\n"; echo "</div>\n";
unset($columns[$name]); unset($columns[$name]);
} }
@@ -213,7 +216,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
} }
$i = 0; $i = 0;
foreach ($where as $val) { foreach ($where as $val) {
if (($val["col"] == "" || $columns[$val["col"]]) && "$val[col]$val[val]" != "") { if ($columns[$val["col"]] && "$val[col]$val[val]" != "") {
echo "<div><select name='where[$i][col]'><option value=''>(" . lang('anywhere') . ")" . optionlist($columns, $val["col"], true) . "</select>"; echo "<div><select name='where[$i][col]'><option value=''>(" . lang('anywhere') . ")" . optionlist($columns, $val["col"], true) . "</select>";
echo html_select("where[$i][op]", array(-1 => "") + $this->operators, $val["op"]); echo html_select("where[$i][op]", array(-1 => "") + $this->operators, $val["op"]);
echo "<input name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n"; echo "<input name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
@@ -336,6 +339,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
} }
function selectEmailProcess($where, $foreignKeys) { function selectEmailProcess($where, $foreignKeys) {
global $connection;
if ($_POST["email_append"]) { if ($_POST["email_append"]) {
return true; return true;
} }
@@ -346,11 +350,15 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$subject = $_POST["email_subject"]; $subject = $_POST["email_subject"];
$message = $_POST["email_message"]; $message = $_POST["email_message"];
preg_match_all('~\\{\\$([a-z0-9_]+)\\}~i', "$subject.$message", $matches); // allows {$name} in subject or message preg_match_all('~\\{\\$([a-z0-9_]+)\\}~i', "$subject.$message", $matches); // allows {$name} in subject or message
$rows = get_rows("SELECT DISTINCT $field" . ($matches[1] ? ", " . implode(", ", array_map('idf_escape', array_unique($matches[1]))) : "") . " FROM " . idf_escape($_GET["select"]) $result = $connection->query("SELECT DISTINCT $field" . ($matches[1] ? ", " . implode(", ", array_map('idf_escape', array_unique($matches[1]))) : "") . " FROM " . idf_escape($_GET["select"])
. " WHERE $field IS NOT NULL AND $field != ''" . " WHERE $field IS NOT NULL AND $field != ''"
. ($where ? " AND " . implode(" AND ", $where) : "") . ($where ? " AND " . implode(" AND ", $where) : "")
. ($_POST["all"] ? "" : " AND ((" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . "))") . ($_POST["all"] ? "" : " AND ((" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . "))")
); );
$rows = array();
while ($row = $result->fetch_assoc()) {
$rows[] = $row;
}
$fields = fields($_GET["select"]); $fields = fields($_GET["select"]);
foreach ($this->rowDescriptions($rows, $foreignKeys) as $row) { foreach ($this->rowDescriptions($rows, $foreignKeys) as $row) {
$replace = array('{\\' => '{'); // allow literal {$name} $replace = array('{\\' => '{'); // allow literal {$name}
@@ -370,14 +378,14 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
} }
function messageQuery($query) { function messageQuery($query) {
return "<!--\n" . str_replace("--", "--><!-- ", $query) . "\n-->"; return "<!--\n" . str_replace("--", "--><!--", $query) . "\n-->";
} }
function editFunctions($field) { function editFunctions($field) {
$return = array("" => ($field["null"] || $field["auto_increment"] || $field["full_type"] == "tinyint(1)" ? "" : "*")); $return = array("" => ($field["null"] || $field["auto_increment"] || $field["full_type"] == "tinyint(1)" ? "" : "*"));
//! respect driver //! respect driver
if (ereg('date|time', $field["type"])) { if (ereg('date|time', $field["type"])) {
$return["now"] = lang('now'); $return[] = "now";
} }
if (eregi('_(md5|sha1)$', $field["field"], $match)) { if (eregi('_(md5|sha1)$', $field["field"], $match)) {
$return[] = strtolower($match[1]); $return[] = strtolower($match[1]);
@@ -403,6 +411,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
} }
function processInput($field, $value, $function = "") { function processInput($field, $value, $function = "") {
global $connection;
if ($function == "now") { if ($function == "now") {
return "$function()"; return "$function()";
} }
@@ -410,15 +419,12 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
if (ereg('date|timestamp', $field["type"]) && preg_match('(^' . str_replace('\\$1', '(?P<p1>[0-9]*)', preg_replace('~(\\\\\\$([2-6]))~', '(?P<p\\2>[0-9]{1,2})', preg_quote(lang('$1-$3-$5')))) . '(.*))', $value, $match)) { if (ereg('date|timestamp', $field["type"]) && preg_match('(^' . str_replace('\\$1', '(?P<p1>[0-9]*)', preg_replace('~(\\\\\\$([2-6]))~', '(?P<p\\2>[0-9]{1,2})', preg_quote(lang('$1-$3-$5')))) . '(.*))', $value, $match)) {
$return = ($match["p1"] != "" ? $match["p1"] : ($match["p2"] != "" ? ($match["p2"] < 70 ? 20 : 19) . $match["p2"] : gmdate("Y"))) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" . end($match); $return = ($match["p1"] != "" ? $match["p1"] : ($match["p2"] != "" ? ($match["p2"] < 70 ? 20 : 19) . $match["p2"] : gmdate("Y"))) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" . end($match);
} }
$return = q($return); $return = $connection->quote($return);
if (!ereg('varchar|text', $field["type"]) && $field["full_type"] != "tinyint(1)" && $value == "") { if (!ereg('varchar|text', $field["type"]) && $field["full_type"] != "tinyint(1)" && $value == "") {
$return = "NULL"; $return = "NULL";
} elseif (ereg('^(md5|sha1)$', $function)) { } elseif (ereg('^(md5|sha1)$', $function)) {
$return = "$function($return)"; $return = "$function($return)";
} }
if (ereg("binary", $field["type"])) {
$return = "unhex($return)";
}
return $return; return $return;
} }
@@ -441,13 +447,13 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
<?php <?php
if ($missing == "auth") { if ($missing == "auth") {
$first = true; $first = true;
foreach ((array) $_SESSION["pwds"]["server"][""] as $username => $password) { foreach ((array) $_SESSION["passwords"]["server"][""] as $username => $password) {
if (isset($password)) { if (isset($password)) {
if ($first) { if ($first) {
echo "<p>\n"; echo "<p>\n";
$first = false; $first = false;
} }
echo "<a href='" . h(auth_url("server", "", $username)) . "'>" . ($username != "" ? h($username) : "<i>" . lang('empty') . "</i>") . "</a><br>\n"; echo "<a href='" . h(auth_url("server", "", $username)) . "'>" . h($username) . "</a><br>\n";
} }
} }
} else { } else {
@@ -481,6 +487,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
} }
function _foreignKeyOptions($table, $column) { function _foreignKeyOptions($table, $column) {
global $connection;
$foreignKeys = column_foreign_keys($table); $foreignKeys = column_foreign_keys($table);
foreach ((array) $foreignKeys[$column] as $foreignKey) { foreach ((array) $foreignKeys[$column] as $foreignKey) {
if (count($foreignKey["source"]) == 1) { if (count($foreignKey["source"]) == 1) {

2
externals/jush vendored

View File

@@ -1,13 +0,0 @@
Adminer - Database management in single PHP file
Adminer Editor - Database editor in single PHP file
http://www.adminer.org/
Supports: MySQL, PostgreSQL, SQLite, MS SQL, Oracle
Requirements: PHP 4.3.2+ or PHP 5+
Apache License, Version 2.0
adminer/index.php - Run development version of Adminer
editor/index.php - Run development version of Adminer Editor
compile.php [driver] [lang] - Create a single file version
lang.php [lang] - Update translations
tests/selenium.html - Selenium test suite

View File

@@ -18,7 +18,7 @@
</tr> </tr>
<tr> <tr>
<td>verifyTextPresent</td> <td>verifyTextPresent</td>
<td>SHOW FULL PROCESSLIST</td> <td>SHOW PROCESSLIST</td>
<td></td> <td></td>
</tr> </tr>

View File

@@ -18,7 +18,7 @@
</tr> </tr>
<tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
<td>link=Edit</td> <td>//div[@id='content']/p[3]/a</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>

View File

@@ -23,12 +23,12 @@
</tr> </tr>
<tr> <tr>
<td>select</td> <td>select</td>
<td>indexes[2][type]</td> <td>indexes[1][type]</td>
<td>label=PRIMARY</td> <td>label=PRIMARY</td>
</tr> </tr>
<tr> <tr>
<td>select</td> <td>select</td>
<td>indexes[2][columns][1]</td> <td>indexes[1][columns][1]</td>
<td>label=name</td> <td>label=name</td>
</tr> </tr>
<tr> <tr>
@@ -43,7 +43,7 @@
</tr> </tr>
<tr> <tr>
<td>select</td> <td>select</td>
<td>indexes[2][type]</td> <td>indexes[1][type]</td>
<td>label=INDEX</td> <td>label=INDEX</td>
</tr> </tr>
<tr> <tr>

View File

@@ -1 +1 @@
java -jar "C:\Program Files\Selenium\selenium-server.jar" -htmlSuite "*iexplore" http://localhost/adminer/ "%CD%\selenium.html" results.html java -jar "C:\Program Files\Selenium\selenium-server.jar" -htmlSuite "*iexplore" http://localhost "%CD%\selenium.html" results.html

View File

@@ -1,34 +1,33 @@
Transactions in export Transactions in export
Create view and routine options Create view and routine options
Variables editation, especially timezone Variables editation, especially timezone
Highlight SQL textarea, then display query inside textarea in select - may use external CodeMirror Accept Tab in SQL textareas, Ctrl+Enter to send form
Highlight SQL textarea, then display query inside textarea in select - may use external CodePress
Blob download and image display in edit form (important for Editor with hidden fields in select) Blob download and image display in edit form (important for Editor with hidden fields in select)
Add title to Logout, edit (in select) and select (in menu) in style "hever" Add title to Logout, edit (in select) and select (in menu) in style "hever"
Shift-click in checkboxes to select range Shift-click in checkboxes to select range
Export by GET parameters Export by GET parameters
Only first part of big BZ2 export is readable, files are missing in TAR Only first part of big BZ2 export is readable
Auto-refresh processlist (thanks to Jan Garaj) Auto-refresh processlist (thanks to Jan Garaj)
Save schema layout to #hash in URL Show pagination above and under the table in select
Double click in select - Esc to abort editation
? Filter by value in row under <thead> in select ? Filter by value in row under <thead> in select
? Column and table names auto-completition in SQL textarea ? Column and table names auto-completition in SQL textarea
? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, aliasing of $connection->query, $connection->result and $connection->quote can save ~ 3 KB, JS packer can save 1 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB ? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, aliasing of $connection->query, $connection->result and $connection->quote can save ~ 3 KB, JS packer can save 1 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB
? Branch binary_compile: LZW compression of translations can save 30 KB, LZW compression of all texts can save 11 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB ? Branch binary_compile: LZW compression of translations can save 30 KB, LZW compression of all texts can save 11 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB
Editor: Editor:
Checkbox for boolean searches
JavaScript data validation - columns containing word email, url, ... JavaScript data validation - columns containing word email, url, ...
Joining tables - PRIMARY KEY (table, joining) Joining tables - PRIMARY KEY (table, joining)
Rank, Tree structure Rank, Tree structure
Add whisperer to fields with foreign key to big table Add whisperer to fields with foreign key to big table
JS calendar for date fields
MySQL: MySQL:
Saving of MySQL 5 BIT data type - don't use quote() Saving of MySQL 5 BIT data type - don't use quote()
? Geometry support ? Geometry support
SQLite: SQLite:
ASC and DESC instead of text length in index CSV import - ON DUPLICATE KEY UPDATE
Export - CREATE DATABASE
Delimiter in export and SQL command Delimiter in export and SQL command
Backward keys in Editor Backward keys in Editor
@@ -42,6 +41,7 @@ bool in Editor
MS SQL: MS SQL:
Non UTF-8 character sets Non UTF-8 character sets
Rename by sp_rename
Detection of table collation Detection of table collation
PDO driver with seek PDO driver with seek

6
version.js Normal file
View File

@@ -0,0 +1,6 @@
// downloaded from repository by verifyVersion() before Adminer 3.0.0
(function () { // cookie function is not defined in older versions
var date = new Date();
date.setDate(date.getDate() + 7); // valid for 7 days
document.cookie = 'adminer_version=2.3.2; expires=' + date; // last released version
})();