added delete webpage
This commit is contained in:
parent
ad3c31fb96
commit
6f7fe19046
|
@ -21,6 +21,12 @@ function switch_disabled(name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.observe("dom:loaded", function() {
|
document.observe("dom:loaded", function() {
|
||||||
|
if (document.getElementById('vhost-delete-db') != null) {
|
||||||
|
document.getElementById('vhost-delete-db').onclick = function() {
|
||||||
|
console.log("clicked box");
|
||||||
|
switch_disabled('vhost-dbname');
|
||||||
|
}
|
||||||
|
}
|
||||||
document.getElementById('password_random').onclick = function() {
|
document.getElementById('password_random').onclick = function() {
|
||||||
switch_disabled('password');
|
switch_disabled('password');
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,10 @@ if (!array_key_exists('auth', $_SESSION) || $_SESSION['auth']!=1) {
|
||||||
|
|
||||||
include_once EVOADMIN_BASE . '../inc/webadmin-edit.php';
|
include_once EVOADMIN_BASE . '../inc/webadmin-edit.php';
|
||||||
|
|
||||||
|
} elseif (preg_match('#^/webadmin/(.*)/delete/$#', $uri, $params)) {
|
||||||
|
|
||||||
|
include_once EVOADMIN_BASE . '../inc/webadmin-delete.php';
|
||||||
|
|
||||||
} elseif (preg_match('#^/webadmin/suppr/(.*)/?$#', $uri, $params)) {
|
} elseif (preg_match('#^/webadmin/suppr/(.*)/?$#', $uri, $params)) {
|
||||||
|
|
||||||
include_once EVOADMIN_BASE . '../inc/webadmin-suppr.php';
|
include_once EVOADMIN_BASE . '../inc/webadmin-suppr.php';
|
||||||
|
|
72
inc/webadmin-delete.php
Normal file
72
inc/webadmin-delete.php
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apache VirtualHost Management Page
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009 Evolix - Tous droits reserves
|
||||||
|
*
|
||||||
|
* vim: expandtab softtabstop=4 tabstop=4 shiftwidth=4 showtabline=2
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @author Thomas Martin <tmartin@evolix.fr>
|
||||||
|
* @author Sebastien Palma <spalma@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once EVOADMIN_BASE . '../lib/bdd.php';
|
||||||
|
require_once EVOADMIN_BASE . '../lib/domain.php';
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';
|
||||||
|
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
|
||||||
|
|
||||||
|
if (isset($_POST['delete-vhost'])) {
|
||||||
|
$domain = $params[1];
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
// Errors handling
|
||||||
|
if (empty($_POST['vhost-name'])) {
|
||||||
|
print "<p>Veuillez entrer le nom du compte web à supprimer.</p>";
|
||||||
|
printf ('<p><a href="%s">Retour</a></p>', $_SERVER['REDIRECT_URL']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST['vhost-name'] !== $domain) {
|
||||||
|
print "Le nom de compte ne correspond pas.";
|
||||||
|
printf ('<p><a href="%s">Retour</a></p>', $_SERVER['REDIRECT_URL']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['vhost-delete-db']) && empty($_POST['vhost-dbname'])) {
|
||||||
|
print "Veuillez spécifier un nom de base de données.";
|
||||||
|
printf ('<p><a href="%s">Retour</a></p>', $_SERVER['REDIRECT_URL']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shell arguments
|
||||||
|
if (!empty($_POST['vhost-dbname']))
|
||||||
|
$exec_cmd = "web-add.sh del -y " . $domain . " " . $_POST['vhost-dbname'];
|
||||||
|
else
|
||||||
|
$exec_cmd = "web-add.sh del -y " . $domain;
|
||||||
|
|
||||||
|
// Execute script
|
||||||
|
sudoexec($exec_cmd, $exec_output, $exec_return);
|
||||||
|
|
||||||
|
// Deal with response code
|
||||||
|
if ($exec_return == 0)
|
||||||
|
print "<p>Compte supprimé.</p>";
|
||||||
|
else
|
||||||
|
print "<p>La suppression a échouée. Veuillez contacter votre administrateur.</p>";
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
include_once EVOADMIN_BASE . '../tpl/webadmin-delete.tpl.php';
|
||||||
|
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
36
tpl/webadmin-delete.tpl.php
Normal file
36
tpl/webadmin-delete.tpl.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edition d'un domaine
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009 Evolix - Tous droits reserves
|
||||||
|
*
|
||||||
|
* vim: expandtab softtabstop=4 tabstop=4 shiftwidth=4 showtabline=2
|
||||||
|
*
|
||||||
|
* @author Thomas Martin <tmartin@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h2>Suppression du compte web</h2>
|
||||||
|
|
||||||
|
<form name="form-delete-vhost" id="form-add" action="" method="POST">
|
||||||
|
<fieldset>
|
||||||
|
<p>
|
||||||
|
<label for="vhost-name">Nom du compte :</label>
|
||||||
|
<input type="text" name="vhost-name">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="vhost-delete-db">Supprimer la base de données ? :</label>
|
||||||
|
<input id="vhost-delete-db" name="vhost-delete-db" checked="checked" value="1" type="checkbox">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="vhost-dbname">Nom de la base de données :</label>
|
||||||
|
<input type="text" name="vhost-dbname" id="vhost-dbname">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="submit" name="delete-vhost" value="Supprimer">
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
Loading…
Reference in a new issue