mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 16:17:48 +02:00
Create confirm function
This commit is contained in:
@@ -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"]);
|
||||
|
@@ -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";
|
||||
}
|
||||
|
@@ -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));
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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
|
||||
|
@@ -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";
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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"]);
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user