Alternc  3.2
Alternc logiel libre pour l'h├ębergement
 All Data Structures Namespaces Files Functions Variables Pages
mail_edit.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  AlternC - Web Hosting System
5  Copyright (C) 2000-2012 by the AlternC Development Team.
6  https://alternc.org/
7  ----------------------------------------------------------------------
8  LICENSE
9 
10  This program is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License (GPL)
12  as published by the Free Software Foundation; either version 2
13  of the License, or (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  To read the license please visit http://www.gnu.org/copyleft/gpl.html
21  ----------------------------------------------------------------------
22  Purpose of file: Edit a mailbox.
23  ----------------------------------------------------------------------
24 */
25 require_once("../class/config.php");
26 include_once("head.php");
27 
28 $fields = array (
29  "mail_id" =>array ("request","integer",""),
30  "pass" => array ("request","string",""),
31  "passconf" => array("request","string",""),
32  "quotamb" => array("request","integer",0),
33  "enabled" => array("request","boolean",true),
34  "islocal" => array("request","boolean",true),
35  "recipients" => array("request","string",""),
36 );
38 
39 if (!$res=$mail->get_details($mail_id)) {
40  $error=$err->errstr();
41  include("main.php");
42  exit();
43 } else {
44 
45  foreach($res as $key=>$val) $$key=$val;
46  $quotamb=$quota;
47 
48  if ($islocal && $mailbox_action=="DELETE") $islocal=false;
49 
50  if (isset($isedit) && $isedit) getFields($fields); // we came from a POST, so let's get the request again ...
51 
52 ?>
53 <h3><?php printf(_("Editing the email %s"),$res["address"]."@".$res["domain"]); ?></h3>
54 <hr id="topbar"/>
55 <br />
56 
57 
58 <?php
59 if (isset($error)) {
60  echo "<p class=\"alert alert-danger\">$error</p>";
61 }
62 ?>
63 
64 <form action="mail_doedit.php" method="post" name="main" id="main">
65 <input type="hidden" name="mail_id" value="<?php echo $mail_id; ?>" />
66 <table class="tedit">
67  <tr><th colspan="2"><b><?php __("Is this email enabled?"); ?></b></th></tr>
68 
69  <tr><td style="width: 50%; text-align: justify"><?php __("You can enable or disable this email anytime. This will bounce any mail received on this address, but will not delete the stored email, or the redirections or password."); ?><br />
70 </td>
71  <td>
72  <p>
73  <input type="radio" name="enabled" id="enabled0" class="inc" value="0"<?php cbox($enabled==0); ?> /><label for="enabled0"><?php __("No (email disabled)"); ?></label>
74  <input type="radio" name="enabled" id="enabled1" class="inc" value="1"<?php cbox($enabled==1); ?> /><label for="enabled1"><?php __("Yes (email enabled)"); ?></label>
75  </p>
76  </td></tr>
77 
78  <tr><th colspan="2"><b><?php __("Is it a POP/IMAP account?"); ?></b></th></tr>
79  <tr><td style="width: 50%; text-align: justify"><?php __("POP/IMAP accounts are receiving emails in the server. To read those emails, you can use a Webmail, or a mail client such as Thunderbird. If you don't use POP/IMAP, you can configure your email to be a redirection to other existing emails. The maximum size is in megabytes, use 0 to make it infinite."); ?><br />
80 <p>&nbsp;</p>
81 <?php if ($islocal) { ?>
82 <p><?php printf(_('This mailbox is currently using %1$s / %2$s'),format_size($used),format_size($quotabytes)); ?></p>
83 <?php } ?>
84 <?php if ($mailbox_action=="DELETE") { ?>
85 <p class="alert alert-warning"><?php __("This mailbox is pending deletion. You can recover its mails by setting it to 'Yes' NOW!"); ?></p>
86 <?php } ?>
87 </td>
88  <td>
89  <p>
90  <input type="radio" name="islocal" id="islocal0" class="inc" value="0"<?php cbox($islocal==0); ?> onclick="popoff()" /><label for="islocal0"><?php __("No"); ?></label>
91  <input type="radio" name="islocal" id="islocal1" class="inc" value="1"<?php cbox($islocal==1); ?> onclick="popon();" /><label for="islocal1"><?php __("Yes"); ?></label>
92  </p>
93  <div id="poptbl">
94  <table class="tedit" >
95  <tr id='mail_edit_pass' style='display: none;'><td colspan='2'><a href='javascript:mail_edit_pass();'><?php __("Click here to edit the existing password");?></a></td></tr>
96  <tr id='mail_edit_pass1'><td><label for="pass"><?php __("Enter a POP/IMAP password"); ?></label></td><td><input type="password" class="int" name="pass" id="pass" value="" size="20" maxlength="32" autocomplete="off" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#pass","#passconf"); ?></td></tr>
97  <tr id='mail_edit_pass2'><td><label for="passconf"><?php __("Confirm password"); ?></label></td><td><input type="password" class="int" name="passconf" id="passconf" value="" size="20" maxlength="32" autocomplete="off" /></td></tr>
98  <tr><td><label for="quotamb"><?php __("Maximum allowed size of this Mailbox"); ?></label></td><td><input type="text" class="int intleft" style="text-align: right" name="quotamb" id="quotamb" value="<?php ehe($quotamb); ?>" size="7" maxlength="6" /><span class="int intright"><?php __("MB"); ?></span></td></tr>
99  </table>
100  </div>
101  </td></tr>
102  <?php if ($islocal) { ?>
103 <tr id="turnoff"><td colspan="2" class="alert alert-warning"><?php __("WARNING: turning POP/IMAP off will DELETE the stored messages in this email address."); ?></td></tr>
104 <?php } ?>
105  <tr><th colspan="2"><b><?php __("Is it a redirection to other email addresses?"); ?></b></th></tr>
106 
107  <tr><td style="width: 50%; text-align: justify"><label for="recipients"><?php __("If you want to send emails received on this address to other addresses, even outside this server, enter those recipients here."); ?></label></td><td>(<?php __("one recipient per line"); ?>)<br /><textarea class="int" cols="32" rows="5" name="recipients" id="recipients"><?php echo $recipients; ?></textarea></td></tr>
108 <?php
109 
110  $html=$hooks->invoke("hook_mail_edit_html",array($mail_id,$type));
111 foreach($html as $h) echo $h;
112 
113 ?>
114 <tr class="trbtn"><td colspan="2">
115  <input type="submit" class="inb ok" name="submit" value="<?php __("Change this email address"); ?>" />
116  <input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="window.history.go(-1);"/>
117 </td></tr>
118 </table>
119 </form>
120 
121 <?php
122 }
123 ?>
124 <script type="text/javascript">
125  $(document).ready(function() {
126  $('#email').focus();
127  <?php if (!$islocal) { ?>
128  popoff();
129  <?php } ?>
130  $('#turnoff').hide();
131  $('#pass').attr('autocomplete','off');
132  $('#passconf').attr('autocomplete','off');
133 });
134 function popoff() {
135  $('#turnoff').show();
136  $('#poptbl').addClass('grey');
137  $('#pass').attr("disabled", "disabled");
138  $('#quotamb').attr("disabled", "disabled");
139  $('#passconf').attr("disabled", "disabled");
140 }
141 function popon() {
142  $('#turnoff').hide();
143  $('#poptbl').removeClass('grey');
144  $('#pass').removeAttr("disabled");
145  $('#quotamb').removeAttr("disabled");
146  $('#passconf').removeAttr("disabled");
147 }
148 
149 function mail_edit_pass() {
150  $('#mail_edit_pass').toggle();
151  $('#mail_edit_pass1').toggle();
152  $('#mail_edit_pass2').toggle();
153 }
154 
155 </script>
156 <?php
157 if (isset($res) && !empty($res['password']) ) {
158  echo '<script type="text/javascript">mail_edit_pass();</script>';
159 } // if $islocal
160 
161 include_once("foot.php");
162 ?>