1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 23:57:29 +02:00

Remove eventStop() used by AJAXification in past

This commit is contained in:
Jakub Vrana
2012-05-14 02:16:10 -07:00
parent 2db14e4bc2
commit f498219f29
9 changed files with 16 additions and 18 deletions

View File

@@ -100,14 +100,14 @@ if ($adminer->homepage()) {
echo "<p>" . (ereg('^(sql|sqlite|pgsql)$', $jush) echo "<p>" . (ereg('^(sql|sqlite|pgsql)$', $jush)
? ($jush != "sqlite" ? "<input type='submit' value='" . lang('Analyze') . "'> " : "") ? ($jush != "sqlite" ? "<input type='submit' value='" . lang('Analyze') . "'> " : "")
. "<input type='submit' name='optimize' value='" . lang('Optimize') . "'> " : "" . "<input type='submit' name='optimize' value='" . lang('Optimize') . "'> " : ""
) . ($jush == "sql" ? "<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/)", 1) . ">\n"; // 1 - eventStop ) . ($jush == "sql" ? "<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() : $adminer->databases()); $databases = (support("scheme") ? schemas() : $adminer->databases());
if (count($databases) != 1 && $jush != "sqlite") { if (count($databases) != 1 && $jush != "sqlite") {
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB)); $db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
echo "<p>" . lang('Move to other database') . ": "; echo "<p>" . lang('Move to other database') . ": ";
echo ($databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '">'); echo ($databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '">');
echo " <input type='submit' name='move' value='" . lang('Move') . "' onclick='eventStop(event);'>"; echo " <input type='submit' name='move' value='" . lang('Move') . "'>";
echo (support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "' onclick='eventStop(event);'>" : ""); echo (support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "'>" : "");
echo "\n"; echo "\n";
} }
echo "<input type='hidden' name='token' value='$token'>\n"; echo "<input type='hidden' name='token' value='$token'>\n";

View File

@@ -753,7 +753,7 @@ DROP PROCEDURE adminer_alter;
foreach ($usernames as $username => $password) { foreach ($usernames as $username => $password) {
if ($password !== null) { if ($password !== null) {
if ($first) { if ($first) {
echo "<p onclick='eventStop(event);'>\n"; echo "<p>\n";
$first = false; $first = false;
} }
echo "<a href='" . h(auth_url($driver, $server, $username)) . "'>($drivers[$driver]) " . h($username . ($server != "" ? "@$server" : "")) . "</a><br>\n"; echo "<a href='" . h(auth_url($driver, $server, $username)) . "'>($drivers[$driver]) " . h($username . ($server != "" ? "@$server" : "")) . "</a><br>\n";
@@ -774,7 +774,7 @@ DROP PROCEDURE adminer_alter;
} }
} }
?> ?>
<input type="submit" name="logout" value="<?php echo lang('Logout'); ?>" onclick="eventStop(event);"> <input type="submit" name="logout" value="<?php echo lang('Logout'); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</p> </p>
</form> </form>
@@ -782,7 +782,7 @@ DROP PROCEDURE adminer_alter;
<p> <p>
<?php hidden_fields_get(); ?> <?php hidden_fields_get(); ?>
<?php echo ($databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">'); ?> <?php echo ($databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">'); ?>
<input type="submit" value="<?php echo lang('Use'); ?>"<?php echo ($databases ? " class='hidden'" : ""); ?> onclick="eventStop(event);"> <input type="submit" value="<?php echo lang('Use'); ?>"<?php echo ($databases ? " class='hidden'" : ""); ?>>
<?php <?php
if ($missing != "db" && DB != "" && $connection->select_db(DB)) { if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
if (support("scheme")) { if (support("scheme")) {

View File

@@ -76,7 +76,7 @@ function auth_error($exception = null) {
} }
} }
page_header(lang('Login'), $error, null); page_header(lang('Login'), $error, null);
echo "<form action='' method='post' onclick='eventStop(event);'>\n"; echo "<form action='' method='post'>\n";
$adminer->loginForm(); $adminer->loginForm();
echo "<div>"; echo "<div>";
hidden_fields($_POST, array("auth")); // expired session hidden_fields($_POST, array("auth")); // expired session

View File

@@ -43,9 +43,9 @@ function connect_error() {
} }
echo "</table>\n"; echo "</table>\n";
echo "<script type='text/javascript'>tableCheck();</script>\n"; echo "<script type='text/javascript'>tableCheck();</script>\n";
echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)", 1) . ">\n"; // 1 - eventStop echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)") . ">\n";
echo "<input type='hidden' name='token' value='$token'>\n"; echo "<input type='hidden' name='token' value='$token'>\n";
echo "<a href='" . h(ME) . "refresh=1' onclick='eventStop(event);'>" . lang('Refresh') . "</a>\n"; echo "<a href='" . h(ME) . "refresh=1'>" . lang('Refresh') . "</a>\n";
echo "</form>\n"; echo "</form>\n";
} }
} }

View File

@@ -149,11 +149,10 @@ function html_select($name, $options, $value = "", $onchange = true) {
/** Get onclick confirmation /** Get onclick confirmation
* @param string JavaScript expression * @param string JavaScript expression
* @param bool stop event propagation
* @return string * @return string
*/ */
function confirm($count = "", $stop = false) { function confirm($count = "") {
return " onclick=\"" . ($stop ? "eventStop(event); " : "") . "return confirm('" . lang('Are you sure?') . ($count ? " (' + $count + ')" : "") . "');\""; return " onclick=\"return confirm('" . lang('Are you sure?') . ($count ? " (' + $count + ')" : "") . "');\"";
} }
/** Print header for hidden fieldset (close by </div></fieldset>) /** Print header for hidden fieldset (close by </div></fieldset>)

View File

@@ -413,7 +413,7 @@ if (!$columns) {
$output = $adminer->dumpOutput(); $output = $adminer->dumpOutput();
echo ($output ? html_select("output", $output, $adminer_import["output"]) . " " : ""); echo ($output ? html_select("output", $output, $adminer_import["output"]) . " " : "");
echo html_select("format", $format, $adminer_import["format"]); echo html_select("format", $format, $adminer_import["format"]);
echo " <input type='submit' name='export' value='" . lang('Export') . "' onclick='eventStop(event);'>\n"; echo " <input type='submit' name='export' value='" . lang('Export') . "'>\n";
echo "</div></fieldset>\n"; echo "</div></fieldset>\n";
} }
} }

View File

@@ -124,7 +124,7 @@ if (!$error && $_POST) {
. html_select("output", $adminer->dumpOutput(), $adminer_export["output"]) . " " . html_select("output", $adminer->dumpOutput(), $adminer_export["output"]) . " "
. html_select("format", $dump_format, $adminer_export["format"]) . html_select("format", $dump_format, $adminer_export["format"])
. "<input type='hidden' name='query' value='" . h($q) . "'>" . "<input type='hidden' name='query' value='" . h($q) . "'>"
. " <input type='submit' name='export' value='" . lang('Export') . "' onclick='eventStop(event);'><input type='hidden' name='token' value='$token'></span>\n" . " <input type='submit' name='export' value='" . lang('Export') . "'><input type='hidden' name='token' value='$token'></span>\n"
; ;
if ($connection2 && preg_match("~^($space|\\()*SELECT\\b~isU", $q) && ($explain = explain($connection2, $q))) { if ($connection2 && preg_match("~^($space|\\()*SELECT\\b~isU", $q) && ($explain = explain($connection2, $q))) {
$id = "explain-$commands"; $id = "explain-$commands";

View File

@@ -291,7 +291,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
echo "<div onkeydown=\"eventStop(event); return bodyKeydown(event, 'email');\">\n"; echo "<div onkeydown=\"eventStop(event); return bodyKeydown(event, 'email');\">\n";
echo "<p>" . lang('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n"; echo "<p>" . lang('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
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'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea>\n"; //! Ctrl+Enter for this.form.email echo "<p><textarea name='email_message' rows='15' cols='75'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea>\n";
echo "<p onkeydown=\"eventStop(event); return bodyKeydown(event, 'email_append');\">" . html_select("email_addition", $columns, $_POST["email_addition"]) . "<input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript echo "<p onkeydown=\"eventStop(event); return bodyKeydown(event, 'email_append');\">" . 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=\"this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el);\">"; 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));
@@ -528,7 +528,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
foreach ((array) $_SESSION["pwds"]["server"][""] as $username => $password) { foreach ((array) $_SESSION["pwds"]["server"][""] as $username => $password) {
if ($password !== null) { if ($password !== null) {
if ($first) { if ($first) {
echo "<p onclick='eventStop(event);'>\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)) . "'>" . ($username != "" ? h($username) : "<i>" . lang('empty') . "</i>") . "</a><br>\n";
@@ -538,7 +538,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
?> ?>
<form action="" method="post"> <form action="" method="post">
<p class="logout"> <p class="logout">
<input type="submit" name="logout" value="<?php echo lang('Logout'); ?>" onclick="eventStop(event);"> <input type="submit" name="logout" value="<?php echo lang('Logout'); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</p> </p>
</form> </form>

View File

@@ -9,7 +9,6 @@ function whisperClick(event, field) {
field.value = el.firstChild.data; field.value = el.firstChild.data;
field.previousSibling.value = decodeURIComponent(el.href.replace(/.*=/, '')); field.previousSibling.value = decodeURIComponent(el.href.replace(/.*=/, ''));
field.nextSibling.style.display = 'none'; field.nextSibling.style.display = 'none';
eventStop(event);
return false; return false;
} }
} }