27 require_once(
"../class/config.php");
29 include_once(
"head.php");
31 if (!$admin->enabled) {
32 $msg->raise(
"ERROR",
"admin", _(
"This page is restricted to authorized staff"));
33 echo
$msg->msg_html_all();
37 "uid" => array (
"request",
"integer",
""),
38 "submit" => array (
"post",
"string",
""),
39 "redirect" => array (
"post",
"string",
""),
44 $msg->raise(
"ERROR",
"admin", _(
"Account not found"));
45 echo
$msg->msg_html_all();
46 include_once(
"foot.php");
50 if (!$admin->checkcreator(
$uid)) {
51 $msg->raise(
"ERROR",
"admin", _(
"This page is restricted to authorized staff"));
52 echo
$msg->msg_html_all();
53 include_once(
"foot.php");
57 if (!
$r=$admin->get(
$uid)) {
58 $msg->raise(
"ERROR",
"admin", _(
"User does not exist"));
59 echo
$msg->msg_html_all();
60 include_once(
"foot.php");
68 print '<h2>' . _(
'WARNING: experimental feature, use at your own risk') .
'</h2>';
69 __(
"The following domains will be deactivated and redirected to the URL entered in the following box. A backup of the domain configuration will be displayed as a serie of SQL request that you can run to restore the current configuration if you want. Click confirm if you are sure you want to deactivate all this user's domains.");
72 <form action=
"<?php echo $_SERVER['PHP_SELF'];?>" method=
"POST">
74 <input type=
"hidden" name=
"uid" value=
"<?php ehe($uid); ?>" />
75 <?php
__(
"Redirection URL:") ?> <input type=
"text" name=
"redirect" class=
"int" value=
"http://example.com/" />
76 <input type=
"submit" name=
"submit" class=
"inb" value=
"<?php __("Confirm
")?>" />
77 <input type=
"button" class=
"inb" name=
"cancel" value=
"<?php __("Cancel
"); ?>" onclick=
"document.location='adm_list.php'"/>
80 print "<h3>" . _(
"Domains of user: ") .
$r[
"login"] .
"</h3>";
82 if (empty($redirect)) {
83 $msg->raise(
"ERROR",
"admin", _(
"Missing redirect url."));
84 echo
$msg->msg_html_all();
85 include_once(
"foot.php");
93 # 1. list the domains of the user
94 # 1.1 list the domains
102 printf(_(
"-- Redirecting all domains and subdomains of the user %s to %s\n"),
$r[
'login'], $redirect);
106 # 1.2 foreach domain, list the subdomains
112 # 2. for each subdomain
113 if (is_array(
$r[
'sub'])) {
114 foreach (
$r[
'sub'] as $k =>
$sub) {
116 $type =
$sub[
'type'];
117 $dest =
$sub[
'dest'];
119 # if it's a real website
120 if ($type ==
$dom->type_local) {
126 print "$domain -> $dest</li>";
129 # 2.1 keep a copy of where it was, in an SQL request
130 $backup .=
"UPDATE `sub_domaines` SET `type`='$type', valeur='$dest',web_action='UPDATE' WHERE `domaine`='$domain' AND sub='$sub';\n";
132 # 2.2 change the subdomain to redirect to http:
135 print "-- error in $sub.$domain: ";
136 echo
$msg->msg_html(
"ERROR");
148 print "-- The following is a serie of SQL request you can run, as root, to revert the user's domains to their previous state.\n";
154 include_once(
"foot.php");
if(! $uid) if(! $admin->checkcreator($uid)) if(! $r=$admin->get($uid)) $confirmed
if(! $admin->enabled) $fields
Page used by administrators to deactivate an account and redirect its domains.
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
if(empty($_POST['key'])||empty($_POST['val'])) $key