]> git.joonet.de Git - adminer.git/commitdiff
Create confirm function
authorJakub Vrana <jakub@vrana.cz>
Mon, 18 Oct 2010 21:57:39 +0000 (23:57 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 18 Oct 2010 21:57:39 +0000 (23:57 +0200)
16 files changed:
adminer/create.inc.php
adminer/database.inc.php
adminer/db.inc.php
adminer/edit.inc.php
adminer/event.inc.php
adminer/foreign.inc.php
adminer/include/bootstrap.inc.php
adminer/include/connect.inc.php
adminer/include/functions.inc.php
adminer/procedure.inc.php
adminer/scheme.inc.php
adminer/select.inc.php
adminer/sequence.inc.php
adminer/trigger.inc.php
adminer/type.inc.php
adminer/user.inc.php

index f7a23ea1f720a21e919d7e7f919b18566e7356e5..fcce1e2845c08027e65adbbcba884cc1e117f459 100644 (file)
@@ -164,7 +164,7 @@ document.write('<label><input type="checkbox" onclick="columnShow(this.checked,
 <p>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <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
 if (support("partitioning")) {
        $partition_table = ereg('RANGE|LIST', $row["partition_by"]);
index 87f31dd735211b3a8bc51f652c41727d990b14e3..83e7ffb32e448d663a229c9e6dde791d5144ef5e 100644 (file)
@@ -65,7 +65,7 @@ echo ($_POST["add_x"] || strpos($name, "\n")
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
 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"] == "") {
        echo "<input type='image' name='add' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>\n";
 }
index b433c49fff63b31a5179039dc6d0d640f8a52cf7..56bc19f444dd3f61bcf804e057a657e267b4d3f8 100644 (file)
@@ -73,7 +73,7 @@ if ($_GET["ns"] !== "") {
                }
                echo "</table>\n";
                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());
                        if (count($databases) != 1 && $jush != "sqlite") {
                                $db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
index 5a7c73e777330b271961fa78ecf650406f776e99..298725ed73df635ee98d16f2bfc0d8897115389a 100644 (file)
@@ -104,7 +104,7 @@ if ($fields) {
        }
 }
 if ($update) {
-       echo "<input type='submit' name='delete' value='" . lang('Delete') . "'$confirm>\n";
+       echo "<input type='submit' name='delete' value='" . lang('Delete') . "'" . confirm() . ">\n";
 }
 ?>
 </form>
index fe17ef5ded2f12bccae1012391b51d7749f76c61..62eaf7adbf78ecc3438e291de9ee73ceb2fc1927 100644 (file)
@@ -49,5 +49,5 @@ if ($_POST) {
 <p>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <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>
index 5b1f813cc16bbdd4f10ed86b804931f032d8b401..801586ef89e88cf4a3814181ca295ec263e920b6 100644 (file)
@@ -73,6 +73,6 @@ foreach ($row["source"] as $key => $val) {
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript>
 <?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; ?>">
 </form>
index e50b79f108977e29c88e3d8e811191d524fe28df..fc3ae784d0207b7b80378dcbabbe1b731b95762f 100644 (file)
@@ -78,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()
-$confirm = " onclick=\"return confirm('" . lang('Are you sure?') . "');\""; ///< @var string
index 1f58a6eff18649aad6141ba4851daf048fcccd7f..63a40ae731b24f7e0cfac3f2f1fc9069aeda896c 100644 (file)
@@ -39,7 +39,7 @@ function connect_error() {
                                echo "\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";
                }
        }
index 88e51ad27138f799d702fde0310da038e788ccce..9450ef085672b53b2d7cbcd161c3f51f73553c5b 100644 (file)
@@ -135,6 +135,14 @@ function html_select($name, $options, $value = "", $onchange = true) {
        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
 * @param string
 * @return bool
index e9f5b3e3621805341eee968c2dc95e428a4a69bf..1fab8605837cccbbe9d2b1309f6442a5dd2e627e 100644 (file)
@@ -54,5 +54,5 @@ if (isset($_GET["function"])) {
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
 <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>
index 0bdd3f03e523db34ba59fbaaf6c951650505e458..980bca42d3068cbab6c0c9b986f83987e84014bd 100644 (file)
@@ -29,7 +29,7 @@ if ($_POST) {
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
 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>
index 80aec73ed016a1abcf2face47bec9660c1b5f038..9edc14ccf6f128898935bea533569887e5a44e1e 100644 (file)
@@ -383,7 +383,7 @@ if (!$columns) {
 <input type="submit" value="<?php echo lang('Save'); ?>" title="<?php echo lang('Double click on a value to modify it.'); ?>">
 <input type="submit" name="edit" value="<?php echo lang('Edit'); ?>">
 <input type="submit" name="clone" value="<?php echo lang('Clone'); ?>">
-<input type="submit" name="delete" value="<?php echo lang('Delete'); ?>" onclick="return confirm('<?php echo lang('Are you sure?'); ?> (' + (this.form['all'].checked ? <?php echo $found_rows; ?> : formChecked(this, /check/)) + ')');">
+<input type="submit" name="delete" value="<?php echo lang('Delete'); ?>"<?php echo confirm("(this.form['all'].checked ? $found_rows : formChecked(this, /check/))"); ?>>
 </div></fieldset>
 <?php
                        }
index 97b6f227cca37e8971800d9ab6991d7c0645138c..502eabffd2e587c0e81ce0659692c726605e250b 100644 (file)
@@ -28,7 +28,7 @@ if ($_POST) {
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
 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>
index 1f45a1be1e2bce2041d40f374e5bec3e8399630f..d07607b3719516b4d7fc554d4e218cf0ce289912 100644 (file)
@@ -40,5 +40,5 @@ if ($_POST) {
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
 <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>
index f8b2ba13aa5ae2d2edb571a5e7f878e839e343d3..4f30550d8568de169454aa28b59617d2bd317080 100644 (file)
@@ -23,7 +23,7 @@ if ($_POST) {
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <?php
 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 {
        echo "<input name='name' value='" . h($row['name']) . "'>\n";
        textarea("as", $row["as"]);
index b79a99a4705201fe45d58b7b0e4f78b1b827912a..677e6736985f829623368286d65fa3e661856e90 100644 (file)
@@ -164,5 +164,5 @@ echo "</table>\n";
 <p>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <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>