Skip to content
Browse files

Create confirm function

  • Loading branch information...
1 parent b50a0fc commit a93bc19108c3b8eed4199309d0fcd5210f2fc46e @vrana committed Oct 18, 2010
View
2 adminer/create.inc.php
@@ -164,7 +164,7 @@
<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"]);
View
2 adminer/database.inc.php
@@ -65,7 +65,7 @@
<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";
}
View
2 adminer/db.inc.php
@@ -73,7 +73,7 @@
}
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));
View
2 adminer/edit.inc.php
@@ -104,7 +104,7 @@
}
}
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>
View
2 adminer/event.inc.php
@@ -49,5 +49,5 @@
<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>
View
2 adminer/foreign.inc.php
@@ -73,6 +73,6 @@
<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>
View
1 adminer/include/bootstrap.inc.php
@@ -78,4 +78,3 @@
}
$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
2 adminer/include/connect.inc.php
@@ -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";
}
}
View
8 adminer/include/functions.inc.php
@@ -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
View
2 adminer/procedure.inc.php
@@ -54,5 +54,5 @@
<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>
View
2 adminer/scheme.inc.php
@@ -29,7 +29,7 @@
<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>
View
2 adminer/select.inc.php
@@ -383,7 +383,7 @@
<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
}
View
2 adminer/sequence.inc.php
@@ -28,7 +28,7 @@
<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>
View
2 adminer/trigger.inc.php
@@ -40,5 +40,5 @@
<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>
View
2 adminer/type.inc.php
@@ -23,7 +23,7 @@
<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"]);
View
2 adminer/user.inc.php
@@ -164,5 +164,5 @@
<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>

0 comments on commit a93bc19

Please sign in to comment.
Something went wrong with that request. Please try again.