mail_list.php 12.3 KB
Newer Older
1
2
3
4
<?php
/*
 ----------------------------------------------------------------------
 AlternC - Web Hosting System
5
6
 Copyright (C) 2000-2012 by the AlternC Development Team.
 https://alternc.org/
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 ----------------------------------------------------------------------
 LICENSE

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License (GPL)
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 To read the license please visit http://www.gnu.org/copyleft/gpl.html
 ----------------------------------------------------------------------
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
31
		 "mail_arg"    => array ("request", "integer", ""), // from mail_add.php in case of error
		 "domain_id"    => array ("request", "integer", ""), 
32
		 "show_systemmails"    => array ("request", "integer", ""), 
33
34
35
36
		 "search"    => array ("request", "string", ""),
		 "offset"    => array ("request", "integer", 0),
		 "count"    => array ("request", "integer", 50),
		 );
37

38
39
$champs=getFields($fields);

40
$counts=array("10" => "10", "20" => "20", "30" => "30", "50" => "50", "100" => "100", "200" => "200", "500" => "500", "1000" => "1000");
41

42
43
44
45
if(!$domain_id ) {
  include("main.php");
  exit();
}
46

47
48
$fatal=false;

49
if ($domain=$dom->get_domain_byid($domain_id)) {
50
  if(!($mails_list = $mail->enum_domain_mails($domain_id,$search,$offset,$count,$show_systemmails))) {
51
52
53
54
    $error=$err->errstr();
  }
} else {
  $error=$err->errstr();
55
  $fatal=true;
56
57
}

58
59
60
if ($fatal) {
  echo "<div class=\"error\">$error</div>";
} else {
61

62
63
64
?>
<table><tr>
<?php
65
// Mail creation form
66
if ($quota->cancreate("mail")) {
67
?>
68
<td>
69
<h3><?php __("Create a new mail account");?></h3>
70
	<form method="post" action="mail_doadd.php" id="main" name="mail_create">
71
		<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>
72
		<input type="hidden" name="domain_id"  value="<?php echo $domain_id;?>" />
73
		<input type="submit" name="submit" class="inb" value="<?php __("Create this email address"); ?>"  onClick="return false_if_empty('mail_arg', '<?php echo addslashes(_("Can't have empty mail."));?>');" />
74
75
76
<?php }?>
<span class="inb"><a href="mail_manage_catchall.php?domain_id=<?php echo $domain_id?>"><?php __("Manage Catch-all for this domain");?></a></span> 
<?php if ($quota->cancreate("mail")) { ?>
77
	</form>
78
</td>
79
<?php 
80
}
81
82
83
84
85
86
?>
<td valign=bottom>
</td>
</tr>
</table>
<?php
87
88
89
90
91
if (empty($mails_list)) {
  echo "<p><i>";
  __("No mails for this domain.");
  echo "</i></p>";
} else {
92
  ?>
93
<br />
94
<hr id="topbar"/>
95
<h3><?php printf(_("Email addresses of the domain %s"),$domain); ?> : </h3>
96

97
<?php
Alan Garcia's avatar
Menage    
Alan Garcia committed
98
if (isset($error) && !empty($error)) {
99
100
101
  	echo "<p class=\"error\">$error</p>";
}
?>
102
103

<table class="searchtable"><tr><td>
104
<form method="get" name="formlist1" id="formlist1" action="mail_list.php">
105
106
<input type="hidden" name="domain_id" value="<?php echo $domain_id; ?>" />
<input type="hidden" name="offset" value="0" />
107
<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" />
108
</td><td>
109
<?php pager($offset,$count,$mail->total,"mail_list.php?domain_id=".$domain_id."&amp;count=".$count."&amp;search=".urlencode($search)."&amp;offset=%%offset%%"); ?>
110
111
</td>
<td style="text-align:center">
112
  <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>
113
114
115
</td>
</form>
<td style="text-align:right">
116
<form method="get" name="formlist2" id="formlist2" action="mail_list.php">
117
118
119
120
121
122
123
 <input type="hidden" name="domain_id" value="<?php echo $domain_id; ?>" />
 <input type="hidden" name="offset" value="0" />
 <?php __("Items per page:"); ?> <select name="count" class="inl" onchange="submit()"><?php eoption($counts,$count); ?></select>
</form>
</td></tr></table>

<form method="post" action="mail_del.php">
124
 <input type="hidden" name="domain_id" value="<?php echo $domain_id; ?>" />
125
<table class="tlist">
126
<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>
127
<?php
128

129
$col=1; $i=0;
130
131
//listing of every mail of the current domain.
while (list($key,$val)=each($mails_list)){
132
  $col=3-$col; $grey="";
133
	?>
134
	<tr class="lst<?php echo $col; ?>">
135
136
137
138
	   <?php if ($val["mail_action"]=="DELETING") { $grey="grey"; ?>
	  <td colspan="3"><?php __("Deleting..."); ?></td>
	  <?php } else if ($val["mail_action"]=="DELETE") { $grey="grey"; ?>
	  <td></td>
139
	  <td><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></td>
140
141
142
143
	  <td><img src="images/check_no.png" alt="<?php __("Disabled"); ?>" /></td>	  
	  <?php } else if (!$val["type"]) { ?>
          <td align="center">
	    <input class="inc" type="checkbox" id="del_<?php echo $i; ?>" name="d[]" value="<?php ehe($val["id"]); ?>" />
144
	</td>
145
	<td class="<?php echo $grey; ?>">
146
	  <div class="ina"><a href="mail_edit.php?mail_id=<?php echo $val["id"] ?>"><img src="images/edit.png" alt="<?php __("Edit"); ?>" /><?php __("Edit"); ?></a></div></td>
147
	<td class="<?php echo $grey; ?>"><?php if ($val["enabled"] ) { ?>
148
149
150
151
152
			<img src="images/check_ok.png" alt="<?php __("Enabled"); ?>" />
		<?php } else { ?>
			<img src="images/check_no.png" alt="<?php __("Disabled"); ?>" />
		<?php } // if enabled ?>
	</td>
153
154
155
	<?php } else { ?>
	<td colspan="3"></td>
	<?php } ?>
156
	<td  class="<?php echo $grey; ?>" style="text-align:right"><?php echo $val["address"]."@".$domain ?></td>
157
	<?php if ($val["type"]) { ?>
158
	<td colspan="3"><?php echo $val["typedata"]; ?></td>
159
	<?php } else { ?>
Benjamin Sonntag's avatar
Benjamin Sonntag committed
160
	<td class="<?php echo $grey; ?>"><?php if ($val["islocal"]) echo format_size($val["used"])."/".format_size($val["quotabytes"]); else __("No"); ?></td>
161
	<td class="<?php echo $grey; ?>"><?php echo $val["recipients"]; /* TODO : if >60chars, use "..." + js close/open */ ?></td>
162
  <td class="<?php echo $grey; ?>"><?php if ($val["islocal"]) { 
163
164
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"]);
} ?></td>
165
	<?php } ?>
166
167
	</tr>
	<?php
168
   $i++;
169
170
}
?>
171

172
</table>
173
174
175
  <p><input type="submit" class="inb" name="submit" value="<?php __("Delete the checked email addresses"); ?>" /></p>
</form>

176
<?php
177
    } } // end if no mail for this domain
178
179
?>
<hr/>
180

181
182
183
<h3><?php __("Mails configuration informations");?></h3>

<?php __("Here are some configuration informations you'll need to configure your mail application.");?>
184
185
<br/>
<br/>
186

187
188
189
190
191
192
193
194
195
196
197
<table width=100% class="tedit">
<tr>
<th width=50%>
  <b><?php __("Outgoing mail (SMTP)"); ?></b> 
</th>
<th width=50%>
  <b><?php __("Incoming mails"); ?></b>
</th>
</tr>
<tr>
  <td valign=top>
198
199
200
    <ul>
      <li><b><a href="javascript:;" onClick="$('#cfg-submission').toggle();"><?php __("Submission");?></a></b>
        <ul id='cfg-submission'>
201
          <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_submission); ?></li>
202
203
204
205
206
207
208
209
210
          <li><b><?php __("Username: ");?></b> <?php __("The mail address you want to access <i>(example : myuser@example.tld)</i>");?></li>
          <li><b><?php __("Port: ");?></b> 587</li>
          <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
          <li><b><?php __("Authentication method: ");?></b><?php __("Normal password")?></li>
          <li><b><?php __("Connection security:");?></b> STARTTLS</li>
        </ul>
      </li>
      <li><b><a href="javascript:;" onClick="$('#cfg-smtp').toggle();"><?php __("SMTP");?></a></b>
        <ul id='cfg-smtp'>
211
          <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_smtp); ?></li>
212
213
          <li><b><?php __("Username: ");?></b> <?php __("The mail address you want to access <i>(example : myuser@example.tld)</i>");?></li>
          <li><b><?php __("Port: ");?></b> 25</li>
214
215
216
          <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
          <li><b><?php __("Authentication method: ");?></b><?php __("Normal Password")?></li>
          <li><b><?php __("Connection security:");?></b> STARTTLS</li>
217
218
219
220
        </ul>
      </li>
       <li><b><a href="javascript:;" onClick="$('#cfg-smtps').toggle();"><?php __("SMTPS");?></a></b>
        <ul id='cfg-smtps'>
221
          <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_smtps); ?></li>
222
223
          <li><b><?php __("Username: ");?></b> <?php __("The mail address you want to access <i>(example : myuser@example.tld)</i>");?></li>
          <li><b><?php __("Port: ");?></b> 465</li>
224
225
226
          <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
          <li><b><?php __("Authentication method: ");?></b><?php __("Normal Password")?></li>
          <li><b><?php __("Connection security:");?></b> SSL</li>
227
228
229
        </ul>
      </li>
    </ul>
230
231
  </td>
  <td valign=top>
232
233
234
    <ul>
      <li><b><a href="javascript:;" onClick="$('#cfg-imap').toggle();"><?php __("IMAP");?></a></b>
        <ul id='cfg-imap'>
235
          <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_imap); ?></li>
236
237
238
          <li><b><?php __("Port: ");?></b> 143</li>
          <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
          <li><b><?php __("Authentication method: ");?></b><?php __("Normal password")?></li>
239
          <li><b><?php __("Connection security:");?></b> STARTTLS</li>
240
241
242
243
244
        </ul>
      </li>

      <li><b><a href="javascript:;" onClick="$('#cfg-imaps').toggle();"><?php __("IMAPS");?></a></b>
        <ul id='cfg-imaps'>
245
          <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_imaps); ?></li>
246
247
248
          <li><b><?php __("Port: ");?></b> 993</li>
          <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
          <li><b><?php __("Authentication method: ")?></b><?php __("Normal password")?></li>
249
          <li><b><?php __("Connection security:");?></b> SSL</li>
250
251
252
253
254
        </ul>
      </li>

      <li><b><a href="javascript:;" onClick="$('#cfg-pop3').toggle();"><?php __("POP3");?></a></b>
        <ul id='cfg-pop3'>
255
          <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_pop3); ?></li>
256
257
258
          <li><b><?php __("Port: ");?></b> 110</li>
          <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
          <li><b><?php __("Authentication method: ");?></b><?php __("Normal password")?></li>
259
          <li><b><?php __("Connection security:");?></b> STARTTLS</li>
260
261
262
263
264
        </ul>
      </li>

      <li><b><a href="javascript:;" onClick="$('#cfg-pop3s').toggle();"><?php __("POP3S");?></a></b>
        <ul id='cfg-pop3s'>
265
          <li><b><?php __("Server name: ");?></b> <?php __($mail->srv_pop3s); ?></li>
266
267
268
          <li><b><?php __("Port: ");?></b> 995</li>
          <li><b><?php __("Authentication: ");?></b><?php __("Yes")?></li>
          <li><b><?php __("Authentication method: ");?></b><?php __("Normal password")?></li>
269
          <li><b><?php __("Connection security:");?></b> SSL</li>
270
271
272
        </ul>
      </li>
    </ul>
273
274
275
  </td>
</tr>
</table>
276
277
278
279
280
281
282
283
284
285
286
287
288

<script type="text/javascript">
  $('#cfg-submission').toggle();
  $('#cfg-smtp').toggle();
  $('#cfg-smtps').toggle();
  $('#cfg-imap').toggle();
  $('#cfg-imaps').toggle();
  $('#cfg-pop3').toggle();
  $('#cfg-pop3s').toggle();
</script>


<?php include_once("foot.php"); ?>