mail_list.php 3.55 KB
Newer Older
1
2
<?php
/*
3
 $Id: mail_list.php, author: squidly
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 ----------------------------------------------------------------------
 AlternC - Web Hosting System
 Copyright (C) 2002 by the AlternC Development Team.
 http://alternc.org/
 ----------------------------------------------------------------------
 Based on:
 Valentin Lacambre's web hosting softwares: http://altern.org/
 ----------------------------------------------------------------------
 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
 ----------------------------------------------------------------------
26
 Purpose of file: listing of mail accounts 
27
28
 ----------------------------------------------------------------------
*/
29

30
require_once("../class/config.php");
31
include_once("head.php");
32

33
34
$fields = array (
	"domain"    => array ("request", "string", ""),
35
	"domain_id"    => array ("request", "integer", ""),
36
37
);

38
39
40
$champs=getFields($fields);

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

46
47
48
49
$domain_id=$champs["domain_id"];

if(!$mails_list = $mail->enum_domain_mails($domain_id)){
	$error=$err->errstr();
50
}
51
?>
52
53

<?php
54
55
if (isset($error)) {
  	echo "<p class=\"error\">$error</p>";
56
57
}

58
59
60
//Mail creation.
if ($quota->cancreate("mail")) { ?>
<h3><?php __("Create a new mail account");?></h3>
61
	<form method="post" action="mail_doadd.php" id="main" name="mail_create" onsubmit="return is_valid_mail(document.getElementById('mail_arg').value+"@"+document.getElementById('domain') )">
62
63
		<input type="text" class="int" name="mail_arg" value="" size="20" id="mail_arg" maxlength="32" /><span id="emaildom" class="int" > <?php echo "@".$domain; ?></span>
		<input type="hidden" name="domain_id"  value="<?php echo $domain_id;?>" />
64
65
		<input type="hidden" name="domain" id="domain"  value="<?php echo $domain;?>" />
		<input type="hidden" name="arg" id="arg"  value="<?php echo $domain;?>" />
66
67
68
		<input type="submit" name="submit" class="inb" value="<?php __("Create"); ?>" />
	</form>
<?php 
69
70
}

71
72
73
if (empty($mails_list)){ // If there is no mail for this domain 
	__("No mail for this domain");
} else {
74
75
?>

76
<h3><?php printf(_("Email addresses of the domain %s"),$domain); ?> : </h3>
77

78
79
<table class="tlist">
<tr><th><?php __("Active");?></th><th align=center><?php __("Address"); ?></th><th><?php __("State"); ?></th></tr>
80
<?php
81

82
$col=1;
83
84
//listing of every mail of the current domain.
while (list($key,$val)=each($mails_list)){
85
	$col=3-$col;
86
87
88
89
90
91
92
93
94
95
96
97
	?>
	<tr class="lst_clic<?php echo $col; ?>" onclick="javascript:window.location.href='mail_properties.php?mail_id=<?php echo $val["id"]; ?>'">
	<td><?php if ($val["enabled"] ) { ?>
			<img src="images/check_ok.png" alt="<?php __("Enabled"); ?>" />
		<?php } else { ?>
			<img src="images/check_no.png" alt="<?php __("Disabled"); ?>" />
		<?php } // if enabled ?>
	</td>
	<td align=right><?php echo $val["address"]."@".$domain ?></td>
	<td><div class="ina"><a href="mail_properties.php?mail_id=<?php echo $val["id"] ?>"><img src="images/edit.png" alt="<?php __("Edit"); ?>" /><?php __("Edit"); ?></a></div></td>
	</tr>
	<?php
98
}
99
} // end if no mail for this domain
100
?>
101

102
</table>
103
<?php include_once("foot.php"); ?>