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

Merge branch 'master' into ajax

This commit is contained in:
Jakub Vrana
2010-10-19 01:45:48 +02:00
20 changed files with 30 additions and 22 deletions

View File

@@ -164,7 +164,7 @@ document.write('<label><input type="checkbox" onclick="columnShow(this.checked,
<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'); ?>">
<?php if (strlen($_GET["create"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?> <?php if (strlen($_GET["create"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<?php <?php
if (support("partitioning")) { if (support("partitioning")) {
$partition_table = ereg('RANGE|LIST', $row["partition_by"]); $partition_table = ereg('RANGE|LIST', $row["partition_by"]);

View File

@@ -65,7 +65,7 @@ echo ($_POST["add_x"] || strpos($name, "\n")
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php <?php
if (DB != "") { if (DB != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'$confirm>\n"; echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
} elseif (!$_POST["add_x"] && $_GET["db"] == "") { } elseif (!$_POST["add_x"] && $_GET["db"] == "") {
echo "<input type='image' name='add' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>\n"; echo "<input type='image' name='add' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>\n";
} }

View File

@@ -73,7 +73,7 @@ if ($_GET["ns"] !== "") {
} }
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') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)") . ">\n";
$databases = (support("scheme") ? schemas() : get_databases()); $databases = (support("scheme") ? schemas() : get_databases());
if (count($databases) != 1 && $jush != "sqlite") { if (count($databases) != 1 && $jush != "sqlite") {
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB)); $db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));

View File

@@ -49,5 +49,5 @@ if ($_POST) {
<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'); ?>">
<?php if ($EVENT != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?> <?php if ($EVENT != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
</form> </form>

View File

@@ -73,6 +73,6 @@ foreach ($row["source"] as $key => $val) {
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript> <noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript>
<?php } ?> <?php } ?>
<?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 } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</form> </form>

View File

@@ -43,6 +43,7 @@ if (function_exists("set_magic_quotes_runtime")) {
set_magic_quotes_runtime(false); set_magic_quotes_runtime(false);
} }
@set_time_limit(0); // @ - can be disabled @set_time_limit(0); // @ - can be disabled
@ini_set("zend.ze1_compatibility_mode", false); // @ - deprecated
include "../adminer/include/lang.inc.php"; include "../adminer/include/lang.inc.php";
include "../adminer/lang/$LANG.inc.php"; include "../adminer/lang/$LANG.inc.php";
@@ -77,4 +78,3 @@ if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !
} }
$on_actions = array("RESTRICT", "CASCADE", "SET NULL", "NO ACTION"); ///< @var array used in foreign_keys() $on_actions = array("RESTRICT", "CASCADE", "SET NULL", "NO ACTION"); ///< @var array used in foreign_keys()
$confirm = " onclick=\"return confirm('" . lang('Are you sure?') . "');\""; ///< @var string

View File

@@ -39,7 +39,7 @@ function connect_error() {
echo "\n"; echo "\n";
} }
echo "</table>\n"; echo "</table>\n";
echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /db/) + ')');\">\n"; echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)") . ">\n";
echo "</form>\n"; echo "</form>\n";
} }
} }

View File

@@ -135,6 +135,14 @@ function html_select($name, $options, $value = "", $onchange = true) {
return $return; return $return;
} }
/** Get onclick confirmation
* @param string JavaScript expression
* @return string
*/
function confirm($count = "") {
return " onclick=\"return confirm('" . lang('Are you sure?') . ($count ? " (' + $count + ')" : "") . "');\"";
}
/** Get INI boolean value /** Get INI boolean value
* @param string * @param string
* @return bool * @return bool

View File

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

View File

@@ -54,5 +54,5 @@ if (isset($_GET["function"])) {
<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 } ?>
<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

@@ -29,7 +29,7 @@ if ($_POST) {
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php <?php
if ($_GET["ns"] != "") { if ($_GET["ns"] != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'$confirm>\n"; echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
} }
?> ?>
</form> </form>

View File

@@ -217,7 +217,7 @@ if (!$columns) {
$page = $_GET["page"]; $page = $_GET["page"];
if ($page == "last") { if ($page == "last") {
$found_rows = $connection->result("SELECT COUNT(*) FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : "")); $found_rows = $connection->result("SELECT COUNT(*) FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""));
$page = floor(($found_rows - 1) / $limit); $page = floor(max(0, $found_rows - 1) / $limit);
} }
$query = "SELECT" . limit((intval($limit) && $group && count($group) < count($select) && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from, ($where ? "\nWHERE " . implode(" AND ", $where) : "") . $group_by, ($limit != "" ? intval($limit) : null), ($page ? $limit * $page : 0), "\n"); $query = "SELECT" . limit((intval($limit) && $group && count($group) < count($select) && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from, ($where ? "\nWHERE " . implode(" AND ", $where) : "") . $group_by, ($limit != "" ? intval($limit) : null), ($page ? $limit * $page : 0), "\n");

View File

@@ -28,7 +28,7 @@ if ($_POST) {
<input type="submit" value="<?php echo lang('Save'); ?>"> <input type="submit" value="<?php echo lang('Save'); ?>">
<?php <?php
if ($SEQUENCE != "") { if ($SEQUENCE != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'$confirm>\n"; echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
} }
?> ?>
</form> </form>

View File

@@ -277,6 +277,7 @@ function partitionNameChange(el) {
* @param HTMLSelectElement * @param HTMLSelectElement
*/ */
function foreignAddRow(field) { function foreignAddRow(field) {
field.onchange = function () { };
var row = field.parentNode.parentNode.cloneNode(true); var row = field.parentNode.parentNode.cloneNode(true);
var selects = row.getElementsByTagName('select'); var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) { for (var i=0; i < selects.length; i++) {
@@ -284,7 +285,6 @@ function foreignAddRow(field) {
selects[i].selectedIndex = 0; selects[i].selectedIndex = 0;
} }
field.parentNode.parentNode.parentNode.appendChild(row); field.parentNode.parentNode.parentNode.appendChild(row);
field.onchange = function () { };
} }
@@ -293,6 +293,7 @@ function foreignAddRow(field) {
* @param HTMLSelectElement * @param HTMLSelectElement
*/ */
function indexesAddRow(field) { function indexesAddRow(field) {
field.onchange = function () { };
var row = field.parentNode.parentNode.cloneNode(true); var row = field.parentNode.parentNode.cloneNode(true);
var spans = row.getElementsByTagName('span'); var spans = row.getElementsByTagName('span');
for (var i=0; i < spans.length - 1; i++) { for (var i=0; i < spans.length - 1; i++) {
@@ -307,13 +308,13 @@ function indexesAddRow(field) {
input.name = input.name.replace(/indexes\[[0-9]+/, '$&1'); input.name = input.name.replace(/indexes\[[0-9]+/, '$&1');
input.value = ''; input.value = '';
field.parentNode.parentNode.parentNode.appendChild(row); field.parentNode.parentNode.parentNode.appendChild(row);
field.onchange = function () { };
} }
/** Add column for index /** Add column for index
* @param HTMLSelectElement * @param HTMLSelectElement
*/ */
function indexesAddColumn(field) { function indexesAddColumn(field) {
field.onchange = function () { };
var column = field.parentNode.cloneNode(true); var column = field.parentNode.cloneNode(true);
var select = column.getElementsByTagName('select')[0]; var select = column.getElementsByTagName('select')[0];
select.name = select.name.replace(/\]\[[0-9]+/, '$&1'); select.name = select.name.replace(/\]\[[0-9]+/, '$&1');
@@ -322,7 +323,6 @@ function indexesAddColumn(field) {
input.name = input.name.replace(/\]\[[0-9]+/, '$&1'); input.name = input.name.replace(/\]\[[0-9]+/, '$&1');
input.value = ''; input.value = '';
field.parentNode.parentNode.appendChild(column); field.parentNode.parentNode.appendChild(column);
field.onchange = function () { };
} }

View File

@@ -113,6 +113,7 @@ function setHtml(id, html) {
* @param HTMLSelectElement * @param HTMLSelectElement
*/ */
function selectAddRow(field) { function selectAddRow(field) {
field.onchange = function () { };
var row = field.parentNode.cloneNode(true); var row = field.parentNode.cloneNode(true);
var selects = row.getElementsByTagName('select'); var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) { for (var i=0; i < selects.length; i++) {
@@ -126,7 +127,6 @@ function selectAddRow(field) {
inputs[0].className = ''; inputs[0].className = '';
} }
field.parentNode.parentNode.appendChild(row); field.parentNode.parentNode.appendChild(row);
field.onchange = function () { };
} }
@@ -257,6 +257,7 @@ function ajaxForm(form, data) {
* @param number display textarea instead of input, 2 - load long text * @param number display textarea instead of input, 2 - load long text
*/ */
function selectDblClick(td, event, text) { function selectDblClick(td, event, text) {
td.ondblclick = function () { };
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.alt ? td.firstChild.alt : td.firstChild.data));
var input = document.createElement(text ? 'textarea' : 'input'); var input = document.createElement(text ? 'textarea' : 'input');
@@ -297,5 +298,4 @@ function selectDblClick(td, event, text) {
range.moveStart('character', pos); range.moveStart('character', pos);
range.select(); range.select();
} }
td.ondblclick = function () { };
} }

View File

@@ -40,5 +40,5 @@ if ($_POST) {
<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 } ?>
<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

@@ -23,7 +23,7 @@ if ($_POST) {
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<?php <?php
if ($TYPE != "") { if ($TYPE != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'$confirm>\n"; echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
} else { } else {
echo "<input name='name' value='" . h($row['name']) . "'>\n"; echo "<input name='name' value='" . h($row['name']) . "'>\n";
textarea("as", $row["as"]); textarea("as", $row["as"]);

View File

@@ -164,5 +164,5 @@ echo "</table>\n";
<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'); ?>">
<?php if (isset($_GET["host"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?> <?php if (isset($_GET["host"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
</form> </form>

View File

@@ -1,4 +1,4 @@
Adminer 3.0.1-dev: Adminer 3.0.1 (released 2010-10-18):
Send the form by Ctrl+Enter in all textareas Send the form by Ctrl+Enter in all textareas
Disable creating SQLite databases with extension other than db, sdb, sqlite Disable creating SQLite databases with extension other than db, sdb, sqlite
Ability to use Adminer in a frame through customization Ability to use Adminer in a frame through customization

View File

@@ -274,7 +274,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
echo lang('Subject') . ": <input name='email_subject' value='" . h($_POST["email_subject"]) . "'>\n"; echo lang('Subject') . ": <input name='email_subject' value='" . h($_POST["email_subject"]) . "'>\n";
echo "<p><textarea name='email_message' rows='15' cols='75' onkeydown='return textareaKeydown(this, event, false, this.form.email);'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n"; echo "<p><textarea name='email_message' rows='15' cols='75' onkeydown='return textareaKeydown(this, event, false, this.form.email);'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n";
echo html_select("email_addition", $columns, $_POST["email_addition"]) . "<input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript echo html_select("email_addition", $columns, $_POST["email_addition"]) . "<input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript
echo "<p>" . lang('Attachments') . ": <input type='file' name='email_files[]' onchange=\"var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el); this.onchange = function () { };\">"; echo "<p>" . lang('Attachments') . ": <input type='file' name='email_files[]' onchange=\"this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el);\">";
echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields)); echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
echo "<input type='submit' name='email' value='" . lang('Send') . "' onclick=\"return this.form['delete'].onclick();\">\n"; echo "<input type='submit' name='email' value='" . lang('Send') . "' onclick=\"return this.form['delete'].onclick();\">\n";
echo "</div></fieldset>\n"; echo "</div></fieldset>\n";