enabled) { __("This page is restricted to authorized staff"); exit; } $fields = array ( "uid" => array ("request", "integer", ""), "submit" => array ("post", "string", ""), "redirect" => array ("post", "string", ""), ); getFields($fields); if (!$uid) { __("Account not found"); include_once("foot.php"); exit(); } if (!$admin->checkcreator($uid)) { __("This page is restricted to authorized staff"); include_once("foot.php"); exit(); } if (!$r=$admin->get($uid)) { __("User does not exist"); include_once("foot.php"); exit(); } $confirmed = ($submit == _("Confirm"))?true:false; if (! ($confirmed ) ) { 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."); ?>
" /> " onclick="document.location='adm_list.php'"/>
" . _("Domains of user: ") . $r["login"] . ""; } else { if (empty($redirect)) { __("Missing redirect url."); include_once("foot.php"); exit(); } } # 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 . '

'; } $mail_dom = $mail->enum_domains(); if ($confirmed) { print "
";
  printf(_("-- disabling all the mail passwords\n"));
}
if (!$confirmed) print "\n
  • mailboxes
      \n"; reset($mail_dom); # 1.3 foreach mail domain, we list the email hashes foreach ($mail_dom as $key => $domain) { if (!$confirmed) print '' . $domain['domaine'] . '
        '; $mails = $mail->enum_domain_mails($domain['id']); foreach ($mails as $key => $add) { if ($add['islocal']) { if (!$confirmed) print '
      • ' . $add['address'] . '@' . $domain['domaine']; $pass = $add['password']; $id = $add['id']; $backup .= $b = "update address set password='$pass' where id=$id;\n"; if (!$confirmed) print "
      • \n"; if ($confirmed) { $db->query("update `address` set password='!$pass' where id=$id;\n"); } } } if (!$confirmed) print "
      "; } if (!$confirmed) print "
  • \n"; # 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; include_once("foot.php"); ?>