Alternc  3.2
Alternc logiel libre pour l'h├ębergement
 All Data Structures Namespaces Files Functions Variables Pages
mail_list.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: listing of mail accounts for one domain.
23  ----------------------------------------------------------------------
24 */
25 
26 require_once("../class/config.php");
27 include_once("head.php");
28 
29 $fields = array (
30  "mail_arg" => array ("request", "integer", ""), // from mail_add.php in case of error
31  "domain_id" => array ("request", "integer", ""),
32  "show_systemmails" => array ("request", "integer", ""),
33  "search" => array ("request", "string", ""),
34  "offset" => array ("request", "integer", 0),
35  "count" => array ("request", "integer", 50),
36  );
37 
39 
40 $counts=array("10" => "10", "20" => "20", "30" => "30", "50" => "50", "100" => "100", "200" => "200", "500" => "500", "1000" => "1000");
41 
42 if(!$domain_id ) {
43  include("main.php");
44  exit();
45 }
46 
47 $fatal=false;
48 
49 if ($domain=$dom->get_domain_byid($domain_id)) {
50  if(!($mails_list = $mail->enum_domain_mails($domain_id,$search,$offset,$count,$show_systemmails)) && $search) {
51  $error=$err->errstr();
52  }
53  $allmails_list = $mail->enum_domain_mails($domain_id,$search,$offset,$count,'true');
54 } else {
55  $error=$err->errstr();
56  $fatal=true;
57 }
58 
59 if ($fatal) {
60  echo "<div class=\"alert alert-danger\">$error</div>";
61 } else {
62 
63  if (!empty($error)) { echo "<p class='alert alert-danger'>$error</p>"; }
64 ?>
65 
66 <table>
67  <tr>
68  <td colspan=2>
69 <?php if ($quota->cancreate("mail")) {
70  echo '<h3>'._("Create a new mail account")."</h3>";
71 } else {
72  echo '<h3>'._("Manage Catch-all")."</h3>";
73 } ?>
74  </td>
75  </tr>
76  <tr>
77  <td>
78 <?php if ($quota->cancreate("mail")) { ?>
79  <form method="post" action="mail_doadd.php" id="main" name="mail_create">
80  <input type="text" class="int intleft" style="text-align: right" name="mail_arg" value="<?php ehe($mail_arg); ?>" size="32" id="mail_arg" maxlength="255" /><span id="emaildom" class="int intright"><?php echo "@".$domain; ?></span>
81  <input type="hidden" name="domain_id" value="<?php echo $domain_id;?>" />
82  <input type="submit" name="submit" class="inb add" value="<?php __("Create this email address"); ?>" onClick="return false_if_empty('mail_arg', '<?php echo addslashes(_("Can't have empty mail."));?>');" />
83  </form>
84 <?php } // $quota->cancreate("mail") ?>
85  </td>
86  <td>
87  <span class="inb configure" valign='bottom'><a href="mail_manage_catchall.php?domain_id=<?php echo $domain_id?>"><?php __("Manage Catch-all for this domain");?></a></span>
88  </td>
89  </tr>
90 </table>
91 
92 <br />
93 <hr id="topbar"/>
94 <h3><?php printf(_("Email addresses of the domain %s"),$domain); ?> : </h3>
95 <?php
96 if (empty($allmails_list) && empty($search)) {
97  echo "<p><i>";
98  __("No mails for this domain.");
99  echo "</i></p><br/>";
100 } else {
101 
102 ?>
103 
104 <table class="searchtable"><tr><td>
105 <form method="get" name="formlist1" id="formlist1" action="mail_list.php">
106 <input type="hidden" name="domain_id" value="<?php echo $domain_id; ?>" />
107 <input type="hidden" name="offset" value="0" />
108 <span class="int intleft"><img alt="<?php __("Search"); ?>" title="<?php __("Search"); ?>" src="/images/search.png" style="vertical-align: middle"/> </span><input type="text" name="search" value="<?php ehe($search); ?>" size="20" maxlength="64" class="int intright" />
109 </td><td>
110 <?php pager($offset,$count,$mail->total,"mail_list.php?domain_id=".$domain_id."&amp;count=".$count."&amp;search=".urlencode($search)."&amp;offset=%%offset%%"); ?>
111 </td>
112 <td style="text-align:center">
113  <input type="checkbox" id="show_systemmails" name="show_systemmails" <?php if($show_systemmails) {echo "checked";}?> value="1"onclick="document.getElementById('formlist1').submit();" /><label for="show_systemmails" ><?php __("Show system emails");?></label>
114 </td>
115 </form>
116 <td style="text-align:right">
117 <form method="get" name="formlist2" id="formlist2" action="mail_list.php">
118  <input type="hidden" name="domain_id" value="<?php echo $domain_id; ?>" />
119  <input type="hidden" name="offset" value="0" />
120  <?php __("Items per page:"); ?> <select name="count" class="inl" onchange="submit()"><?php eoption($counts,$count); ?></select>
121 </form>
122 </td></tr></table>
123 
124 <form method="post" action="mail_del.php">
125  <input type="hidden" name="domain_id" value="<?php echo $domain_id; ?>" />
126 <table class="tlist">
127 <tr><th></th><th></th><th><?php __("Enabled");?></th><th style="text-align:right"><?php __("Address"); ?></th><th><?php __("Pop/Imap"); ?></th><th><?php __("Other recipients"); ?></th><th><?php __("Last login time"); ?></th></tr>
128 <?php
129 
130 $i=0;
131 //listing of every mail of the current domain.
132 if(!empty($mails_list)) {
133  while (list($key,$val)=each($mails_list)) {
134  $grey="";
135  ?>
136  <tr class="lst">
137  <?php if ($val["mail_action"]=="DELETING") { $grey="grey"; ?>
138  <td colspan="3"><?php __("Deleting..."); ?></td>
139  <?php } else if ($val["mail_action"]=="DELETE") { $grey="grey"; ?>
140  <td></td>
141  <td>
142  <?php if ($val['type'] =='') { ?>
143  <div class="ina"><a href="mail_undelete.php?search=<?php ehe($search); ?>&amp;offset=<?php ehe($offset); ?>&amp;count=<?php ehe($count); ?>&amp;domain_id=<?php ehe($domain_id); ?>&amp;mail_id=<?php echo $val["id"] ?>" title="<?php __("This email will be deleted soon. You may still be able to undelete it by clicking here"); ?>"><img src="images/undelete.png" alt="<?php __("Undelete"); ?>" /><?php __("Undelete"); ?></a></div>
144  <?php } // if val[type] ?>
145  </td>
146  <td><img src="images/check_no.png" alt="<?php __("Disabled"); ?>" /></td>
147  <?php } else if (!$val["type"]) { ?>
148  <td align="center">
149  <input class="inc" type="checkbox" id="del_<?php echo $i; ?>" name="d[]" value="<?php ehe($val["id"]); ?>" />
150  </td>
151  <td class="<?php echo $grey; ?>">
152  <div class="ina edit"><a href="mail_edit.php?mail_id=<?php echo $val["id"] ?>"><?php __("Edit"); ?></a></div></td>
153  <td class="<?php echo $grey; ?>"><?php if ($val["enabled"] ) { ?>
154  <img src="images/check_ok.png" alt="<?php __("Enabled"); ?>" />
155  <?php } else { ?>
156  <img src="images/check_no.png" alt="<?php __("Disabled"); ?>" />
157  <?php } // if enabled ?>
158  </td>
159  <?php } else { ?>
160  <td colspan="3"></td>
161  <?php } ?>
162  <td class="<?php echo $grey; ?>" style="text-align:right"><?php echo $val["address"]."@".$domain ?></td>
163  <?php if ($val["type"]) { ?>
164  <td colspan="3"><?php echo $val["typedata"]; ?></td>
165  <?php } else { ?>
166  <td class="<?php echo $grey; ?>"><?php if ($val["islocal"]) echo format_size($val["used"]).( ($val["quotabytes"]==0)?'':"/".format_size($val["quotabytes"])) ; else __("No"); ?></td>
167  <td class="<?php echo $grey; ?>"><?php echo $val["recipients"]; /* TODO : if >60chars, use "..." + js close/open */ ?></td>
168  <td class="<?php echo $grey; ?>"><?php if ($val["islocal"]) {
169 if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"],11,5); else if (substr($val["lastlogin"],0,10)=="0000-00-00") __("Never"); else echo format_date(_('%3$d-%2$d-%1$d'),$val["lastlogin"]);
170 } ?></td>
171  <?php } ?>
172  </tr>
173  <?php
174  $i++;
175  }
176 }
177 ?>
178 
179 </table>
180  <p><input type="submit" class="inb delete" name="submit" value="<?php __("Delete the checked email addresses"); ?>" /></p>
181 </form>
182 
183 <?php
184  } } // end if no mail for this domain
185 ?>
186 <hr/>
187 
188 <h3><?php __("Mails configuration information");?></h3>
189 
190 <?php __("Here are some configuration information you will need to configure your mail application.");?>
191 <br/>
192 <br/>
193 
194 <div id="tabs-mailhelp">
195 
196 <ul>
197  <li class="help"><a href="#tabs-mailhelp-out"><?php __("Outgoing mail (SMTP)"); ?></a></li>
198  <li class="help"><a href="#tabs-mailhelp-in"><?php __("Incoming mail"); ?></a></li>
199 </ul>
200 
201 <div id="tabs-mailhelp-out">
202 
203  <?php __("Which protocol shall you use?"); ?>
204  <div id="accordion-mailout">
205  <h4><?php __("Submission");?></h4>
206  <div>
207  <ul>
208  <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_submission); ?></li>
209  <li><b><?php __("Username: ");?></b> <?php __("The mail address you want to access <i>(example : myuser@example.tld)</i>");?></li>
210  <li><b><?php __("Port: ");?></b> 587</li>
211  <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
212  <li><b><?php __("Authentication method: ");?></b><?php __("Normal password")?></li>
213  <li><b><?php __("Connection security:");?></b> STARTTLS</li>
214  </ul>
215  </div>
216  <h4><?php __("SMTP");?></h4>
217  <div>
218  <ul>
219  <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_smtp); ?></li>
220  <li><b><?php __("Username: ");?></b> <?php __("The mail address you want to access <i>(example : myuser@example.tld)</i>");?></li>
221  <li><b><?php __("Port: ");?></b> 25</li>
222  <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
223  <li><b><?php __("Authentication method: ");?></b><?php __("Normal Password")?></li>
224  <li><b><?php __("Connection security:");?></b> STARTTLS</li>
225  </ul>
226  </div>
227  <h4><?php __("SMTPS");?></h4>
228  <div>
229  <ul>
230  <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_smtps); ?></li>
231  <li><b><?php __("Username: ");?></b> <?php __("The mail address you want to access <i>(example : myuser@example.tld)</i>");?></li>
232  <li><b><?php __("Port: ");?></b> 465</li>
233  <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
234  <li><b><?php __("Authentication method: ");?></b><?php __("Normal Password")?></li>
235  <li><b><?php __("Connection security:");?></b> SSL</li>
236  </ul>
237  </div>
238  </div><!-- accordion-mailout -->
239 
240 </div><!-- tabs-mailhelp-out -->
241 
242 <div id="tabs-mailhelp-in">
243 
244  <?php __("Which protocol shall you use?"); ?>
245  <div id="accordion-mailin">
246  <h4><?php __("IMAP");?></h4>
247  <div>
248  <ul>
249  <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_imap); ?></li>
250  <li><b><?php __("Port: ");?></b> 143</li>
251  <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
252  <li><b><?php __("Authentication method: ");?></b><?php __("Normal password")?></li>
253  <li><b><?php __("Connection security:");?></b> STARTTLS</li>
254  </ul>
255  </div>
256 
257  <h4><?php __("IMAPS");?></h4>
258  <div>
259  <ul>
260  <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_imaps); ?></li>
261  <li><b><?php __("Port: ");?></b> 993</li>
262  <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
263  <li><b><?php __("Authentication method: ")?></b><?php __("Normal password")?></li>
264  <li><b><?php __("Connection security:");?></b> SSL</li>
265  </ul>
266  </div>
267 
268  <h4><?php __("POP3");?></h4>
269  <div>
270  <ul>
271  <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_pop3); ?></li>
272  <li><b><?php __("Port: ");?></b> 110</li>
273  <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
274  <li><b><?php __("Authentication method: ");?></b><?php __("Normal password")?></li>
275  <li><b><?php __("Connection security:");?></b> STARTTLS</li>
276  </ul>
277  </div>
278 
279  <h4><?php __("POP3S");?></h4>
280  <div>
281  <ul>
282  <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_pop3s); ?></li>
283  <li><b><?php __("Port: ");?></b> 995</li>
284  <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
285  <li><b><?php __("Authentication method: ");?></b><?php __("Normal password")?></li>
286  <li><b><?php __("Connection security:");?></b> SSL</li>
287  </ul>
288  </div>
289  </div>
290 </div><!-- tabs-mailhelp-in -->
291 </div><!-- tabs-mailhelp -->
292 
293 
294 <script type="text/javascript">
295 
296  $(function() {
297  $( "#accordion-mailout" ).accordion({
298  collapsible: true, active: false, header: "h4", heightStyle: "content"
299  });
300  });
301 
302  $(function() {
303  $( "#accordion-mailin" ).accordion({
304  collapsible: true, active: false, header: "h4", heightStyle: "content"
305  });
306  });
307 
308 
309 $(function() {$( "#tabs-mailhelp" ).tabs();});
310 
311 </script>
312 
313 
314 <?php include_once("foot.php"); ?>