From db7fe71e685827e80031b99a078e263e95de423b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Sat, 12 Aug 2006 00:04:12 +0000 Subject: [PATCH] experimental feature: a harsh mass-redirection script that can be used to temporarly turn off (by redirecting them) a user's subdomains (all of them) temporarly, because a SQL dump is showed to allow the admin to restore the previous state. experimental, because the SQL dump should probably be hidden from the admin and that this whole thing should probably be called something else than "deactivate" and might be better somewhere else than in adm_list.php. harsh, because there could be other ways to deal with evil users. this is the best solution I have found for accounts that are victims of spambots. --- .gitattributes | 1 + bureau/admin/adm_deactivate.php | 104 ++++++++++++++++++++++++++++++++ bureau/admin/adm_list.php | 5 +- 3 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 bureau/admin/adm_deactivate.php diff --git a/.gitattributes b/.gitattributes index f76a3e87..33f4dfc9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,6 +12,7 @@ aide/sommaire.sgml -text aide/stats.sgml -text aide/test.sgml -text bureau/admin/adm_add.php -text +bureau/admin/adm_deactivate.php -text bureau/admin/adm_defquotas.php -text bureau/admin/adm_del.php -text bureau/admin/adm_doadd.php -text diff --git a/bureau/admin/adm_deactivate.php b/bureau/admin/adm_deactivate.php new file mode 100644 index 00000000..f03ef9e3 --- /dev/null +++ b/bureau/admin/adm_deactivate.php @@ -0,0 +1,104 @@ +enabled || !$admin->checkcreator($uid)) { + __("This page is restricted to authorized staff"); + exit(); +} + +if (!$r=$admin->get($uid)) { + __("User does not exist"); + exit(); +} + +if (! ($confirmed = ($_GET['submit'] == _("Confirm")) ) ) { + print '

' . _('WARNING: experimental feature, use at your own risk') . '

'; + __("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."); + + ?> +
+ + + " /> +
" . _("Domains of user: ") . $r["login"] . ""; +} else { + if (!$_GET['redirect']) { + __("Missing redirect url."); + exit(); + } else { + $redirect = $_GET['redirect']; + } +} + +# this string will contain an SQL request that will be printed at the end of the process and that can be used to reload the old domain configuration +$backup = ""; + +# 1. list the domains of the user +# 1.1 list the domains +global $cuid; +$old_cuid = $cuid; +$cuid = $uid; +$domains = $dom->enum_domains(); + +if ($confirmed) { + print "
";
+  printf(_("-- Redirecting all domains and subdomains of the user %s to %s\n"), $r['login'], $redirect);
+}
+
+reset($domains);
+# 1.2 foreach domain, list the subdomains
+foreach ($domains as $key => $domain) {
+  if (!$confirmed) print '

' . $domain . '

'; +} + +# 3. wrap up (?) +if ($confirmed) { + 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"; + print $backup; + print "
"; +} +$cuid = $old_cuid; diff --git a/bureau/admin/adm_list.php b/bureau/admin/adm_list.php index 652b69f3..e2064198 100644 --- a/bureau/admin/adm_list.php +++ b/bureau/admin/adm_list.php @@ -73,7 +73,7 @@ if (!is_array($r)) { if ($mem->user["admlist"]==0) { // Normal (large) mode ?> - + + "; + echo ""; } ?>
 ("._("Email address").")"; ?>
 ("._("Email address").")"; ?>
"> ">"> "; @@ -104,7 +105,7 @@ while (list($key,$val)=each($r))