Alternc  latest
Alternc logiel libre pour l'hébergement
mail_del.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Form to confirm the deletion of an email account
22  * delete it when confirmed.
23  *
24  * @copyright AlternC-Team 2000-2017 https://alternc.com/
25  */
26 
27 require_once("../class/config.php");
28 
29 $fields = array (
30  "d" => array ("post", "array", ""),
31  "domain_id" => array ("post", "integer", ""),
32  "confirm" => array("post", "string", "n"),
33 );
35 
36 if (!is_array($d)) {
37  $d[]=$d;
38 }
39 
40 reset($d);
41 
42 include_once ("head.php");
43 
44 if ($confirm=="y") {
45  while (list($key,$val)=each($d)) {
46  // Validate that this email is owned by me...
47  if (!($email = $mail->is_it_my_mail($val))) {
48  continue;
49  }
50 
51  if ($mail->delete($val)) {
52  if ($db->f("islocal")) {
53  $msg->raise("INFO", "mail", _("The email %s has been marked for deletion"), $email);
54  } else {
55  $msg->raise("INFO", "mail", _("The email %s has been successfully deleted"), $email);
56  }
57  }
58  }
59  include("mail_list.php");
60  exit();
61 }
62 
63 ?>
64 <h3><?php __("Deleting mail accounts"); ?> : </h3>
65 <hr id="topbar"/>
66 <br />
67 <p><?php __("Please confirm the deletion of the following mail accounts:"); ?></p>
68 <form method="post" action="mail_del.php" id="main">
69  <?php csrf_get(); ?>
70 <p>
71 <input type="hidden" name="confirm" value="y" />
72 <input type="hidden" name="domain_id" value="<?php ehe($domain_id); ?>" />
73 
74 <ul>
75 <?php
76 while (list($key,$val)=each($d)) {
77  $m=$mail->get_details($val);
78  echo "<input type=\"hidden\" name=\"d[]\" value=\"".ehe($val,false)."\" />";
79  echo "<li><b>".$m["address"]."@".$m["domain"]."</b></li>";
80 }
81 ?>
82 </ul>
83 </p>
84 <p>
85 <input type="submit" class="inb" name="submit" value="<?php __("Confirm the deletion"); ?>" /> &nbsp; <input type="button" name="cancel" id="cancel" onclick="window.history.go(-1);" class="inb" value="<?php __("Don't delete anything and go back to the email list"); ?>"/>
86 </p>
87 
88 <p class="warningmsg">
89 <?php __("Warning: Deleting an email address will destroy all the messages it contains! You will <b>NOT</b> be able to get it back!"); ?>
90 </p>
91 
92 </form>
93 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
global $db
Definition: bootstrap.php:26
$msg
Definition: bootstrap.php:75
$d
__($str)
Definition: functions.php:404
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
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 ...
Definition: functions.php:1159
$fields
Form to confirm the deletion of an email account delete it when confirmed.
Definition: mail_del.php:29
$val
Definition: tempovars.php:15
if(empty($_POST['key'])||empty($_POST['val'])) $key
Definition: tempovars.php:14