2006-04-26 12:28:53 +00:00
< ? php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
2012-08-23 18:46:47 +00:00
Copyright ( C ) 2000 - 2012 by the AlternC Development Team .
https :// alternc . org /
2006-04-26 12:28:53 +00:00
----------------------------------------------------------------------
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
----------------------------------------------------------------------
2012-08-23 18:46:47 +00:00
Purpose of file : listing of mail accounts for one domain .
2006-04-26 12:28:53 +00:00
----------------------------------------------------------------------
*/
2012-04-06 10:10:36 +00:00
2006-04-26 12:28:53 +00:00
require_once ( " ../class/config.php " );
2009-09-08 05:29:38 +00:00
include_once ( " head.php " );
2006-04-26 12:28:53 +00:00
2009-09-08 05:29:38 +00:00
$fields = array (
2012-08-24 14:48:05 +00:00
" mail_arg " => array ( " request " , " integer " , " " ), // from mail_add.php in case of error
" domain_id " => array ( " request " , " integer " , " " ),
2012-10-18 15:32:04 +00:00
" show_systemmails " => array ( " request " , " integer " , " " ),
2012-08-23 18:46:47 +00:00
" search " => array ( " request " , " string " , " " ),
" offset " => array ( " request " , " integer " , 0 ),
" count " => array ( " request " , " integer " , 50 ),
);
2009-09-08 05:29:38 +00:00
2012-04-06 10:10:36 +00:00
$champs = getFields ( $fields );
2012-08-23 18:46:47 +00:00
$counts = array ( " 10 " => " 10 " , " 20 " => " 20 " , " 30 " => " 30 " , " 50 " => " 50 " , " 100 " => " 100 " , " 200 " => " 200 " , " 500 " => " 500 " , " 1000 " => " 1000 " );
2006-04-26 12:28:53 +00:00
2012-08-23 18:46:47 +00:00
if ( ! $domain_id ) {
include ( " main.php " );
exit ();
}
2012-04-06 10:10:36 +00:00
2012-08-25 14:24:24 +00:00
$fatal = false ;
2012-08-23 18:46:47 +00:00
if ( $domain = $dom -> get_domain_byid ( $domain_id )) {
2012-11-09 13:56:48 +00:00
if ( ! ( $mails_list = $mail -> enum_domain_mails ( $domain_id , $search , $offset , $count , $show_systemmails )) && $search ) {
2012-08-23 18:46:47 +00:00
$error = $err -> errstr ();
}
2012-11-09 13:56:48 +00:00
$allmails_list = $mail -> enum_domain_mails ( $domain_id , $search , $offset , $count , 'true' );
2012-08-23 18:46:47 +00:00
} else {
$error = $err -> errstr ();
2012-08-25 14:24:24 +00:00
$fatal = true ;
2006-04-26 12:28:53 +00:00
}
2012-08-25 14:24:24 +00:00
if ( $fatal ) {
echo " <div class= \" error \" > $error </div> " ;
} else {
2006-04-26 12:28:53 +00:00
2013-02-04 08:16:29 +00:00
if ( ! empty ( $error )) { echo " <p class='error'> $error </p> " ; }
2012-10-20 13:16:14 +00:00
?>
2013-02-04 08:16:29 +00:00
2012-10-20 13:16:14 +00:00
< table >< tr >
< ? php
2012-08-23 18:46:47 +00:00
// Mail creation form
2012-08-25 14:29:21 +00:00
if ( $quota -> cancreate ( " mail " )) {
2012-08-23 18:46:47 +00:00
?>
2012-10-20 13:16:14 +00:00
< td >
2012-04-06 10:10:36 +00:00
< h3 >< ? php __ ( " Create a new mail account " ); ?> </h3>
2012-08-23 18:46:47 +00:00
< form method = " post " action = " mail_doadd.php " id = " main " name = " mail_create " >
2012-08-24 14:48:05 +00:00
< 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>
2012-04-06 10:10:36 +00:00
< input type = " hidden " name = " domain_id " value = " <?php echo $domain_id ;?> " />
2013-04-25 16:06:50 +00:00
< 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."));?>' ); " />
2012-10-20 13:16:14 +00:00
< ? php } ?>
2013-04-25 16:06:50 +00:00
< span class = " inb configure " >< a href = " mail_manage_catchall.php?domain_id=<?php echo $domain_id ?> " >< ? php __ ( " Manage Catch-all for this domain " ); ?> </a></span>
2012-10-20 13:16:14 +00:00
< ? php if ( $quota -> cancreate ( " mail " )) { ?>
2012-04-06 10:10:36 +00:00
</ form >
2012-10-20 13:16:14 +00:00
</ td >
2012-04-06 10:10:36 +00:00
< ? php
2006-04-26 12:28:53 +00:00
}
2012-10-20 13:16:14 +00:00
?>
2013-04-19 07:18:25 +00:00
< td valign = 'bottom' >
2012-10-20 13:16:14 +00:00
</ td >
</ tr >
</ table >
2012-11-09 13:56:48 +00:00
< br />
< hr id = " topbar " />
< h3 >< ? php printf ( _ ( " Email addresses of the domain %s " ), $domain ); ?> : </h3>
2012-10-20 13:16:14 +00:00
< ? php
2012-11-09 13:56:48 +00:00
if ( empty ( $allmails_list ) && empty ( $search )) {
2012-10-15 13:03:03 +00:00
echo " <p><i> " ;
__ ( " No mails for this domain. " );
2012-11-09 13:56:48 +00:00
echo " </i></p><br/> " ;
2012-10-15 13:03:03 +00:00
} else {
2006-04-26 12:28:53 +00:00
2012-08-25 13:11:48 +00:00
?>
2012-08-23 18:46:47 +00:00
< table class = " searchtable " >< tr >< td >
2012-08-24 14:48:05 +00:00
< form method = " get " name = " formlist1 " id = " formlist1 " action = " mail_list.php " >
2012-08-23 18:46:47 +00:00
< input type = " hidden " name = " domain_id " value = " <?php echo $domain_id ; ?> " />
< input type = " hidden " name = " offset " value = " 0 " />
2012-08-24 14:48:05 +00:00
< 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 " />
2012-08-23 18:46:47 +00:00
</ td >< td >
2012-08-24 14:06:58 +00:00
< ? php pager ( $offset , $count , $mail -> total , " mail_list.php?domain_id= " . $domain_id . " &count= " . $count . " &search= " . urlencode ( $search ) . " &offset=%%offset%% " ); ?>
2012-10-18 15:32:04 +00:00
</ td >
< td style = " text-align:center " >
2013-04-19 07:18:25 +00:00
< 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>
2012-10-18 15:32:04 +00:00
</ td >
</ form >
< td style = " text-align:right " >
2012-08-24 14:48:05 +00:00
< form method = " get " name = " formlist2 " id = " formlist2 " action = " mail_list.php " >
2012-08-23 18:46:47 +00:00
< 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 " >
2012-08-24 13:37:56 +00:00
< input type = " hidden " name = " domain_id " value = " <?php echo $domain_id ; ?> " />
2012-04-06 10:10:36 +00:00
< table class = " tlist " >
2012-08-23 18:46:47 +00:00
< 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>
2006-04-26 12:28:53 +00:00
< ? php
2012-04-06 10:10:36 +00:00
2012-08-23 18:46:47 +00:00
$col = 1 ; $i = 0 ;
2012-04-06 10:10:36 +00:00
//listing of every mail of the current domain.
2012-11-09 13:56:48 +00:00
if ( ! empty ( $mails_list )) {
while ( list ( $key , $val ) = each ( $mails_list )) {
2012-08-24 13:37:56 +00:00
$col = 3 - $col ; $grey = " " ;
2012-04-06 10:10:36 +00:00
?>
2012-08-23 18:46:47 +00:00
< tr class = " lst<?php echo $col ; ?> " >
2013-02-01 08:54:59 +00:00
< ? php if ( $val [ " mail_action " ] == " DELETING " ) { $grey = " grey " ; ?>
< td colspan = " 3 " >< ? php __ ( " Deleting... " ); ?> </td>
2012-08-24 13:37:56 +00:00
< ? php } else if ( $val [ " mail_action " ] == " DELETE " ) { $grey = " grey " ; ?>
2013-02-01 08:54:59 +00:00
< td ></ td >
< td >
< ? php if ( $val [ 'type' ] == '' ) { ?>
< div class = " ina " >< a href = " mail_undelete.php?search=<?php ehe( $search ); ?>&offset=<?php ehe( $offset ); ?>&count=<?php ehe( $count ); ?>&domain_id=<?php ehe( $domain_id ); ?>&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>
< ? php } // if val[type] ?>
</ td >
< td >< img src = " images/check_no.png " alt = " <?php __( " Disabled " ); ?> " /></ td >
2012-08-24 13:37:56 +00:00
< ? 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"] ); ?> " />
2012-08-23 18:46:47 +00:00
</ td >
2012-08-24 13:37:56 +00:00
< td class = " <?php echo $grey ; ?> " >
2013-04-25 12:39:24 +00:00
< div class = " ina edit " >< a href = " mail_edit.php?mail_id=<?php echo $val["id"] ?> " >< ? php __ ( " Edit " ); ?> </a></div></td>
2012-08-24 13:37:56 +00:00
< td class = " <?php echo $grey ; ?> " >< ? php if ( $val [ " enabled " ] ) { ?>
2012-04-06 10:10:36 +00:00
< img src = " images/check_ok.png " alt = " <?php __( " Enabled " ); ?> " />
< ? php } else { ?>
< img src = " images/check_no.png " alt = " <?php __( " Disabled " ); ?> " />
< ? php } // if enabled ?>
</ td >
2012-08-23 18:46:47 +00:00
< ? php } else { ?>
< td colspan = " 3 " ></ td >
< ? php } ?>
2012-08-24 13:37:56 +00:00
< td class = " <?php echo $grey ; ?> " style = " text-align:right " >< ? php echo $val [ " address " ] . " @ " . $domain ?> </td>
2012-08-23 18:46:47 +00:00
< ? php if ( $val [ " type " ]) { ?>
2012-10-18 15:32:04 +00:00
< td colspan = " 3 " >< ? php echo $val [ " typedata " ]; ?> </td>
2012-08-23 18:46:47 +00:00
< ? php } else { ?>
2013-02-28 17:17:21 +00:00
< td class = " <?php echo $grey ; ?> " >< ? php if ( $val [ " islocal " ]) echo format_size ( $val [ " used " ]) . ( ( $val [ " quotabytes " ] == 0 ) ? '' : " / " . format_size ( $val [ " quotabytes " ])) ; else __ ( " No " ); ?> </td>
2012-08-24 13:37:56 +00:00
< td class = " <?php echo $grey ; ?> " >< ? php echo $val [ " recipients " ]; /* TODO : if >60chars, use "..." + js close/open */ ?> </td>
2012-10-18 15:32:04 +00:00
< td class = " <?php echo $grey ; ?> " >< ? php if ( $val [ " islocal " ]) {
2012-08-23 18:46:47 +00:00
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>
2012-10-18 15:32:04 +00:00
< ? php } ?>
2012-04-06 10:10:36 +00:00
</ tr >
< ? php
2012-08-23 18:46:47 +00:00
$i ++ ;
2012-11-09 13:56:48 +00:00
}
2006-04-26 12:28:53 +00:00
}
?>
2012-04-06 10:10:36 +00:00
2006-04-26 12:28:53 +00:00
</ table >
2013-04-25 16:06:50 +00:00
< p >< input type = " submit " class = " inb delete " name = " submit " value = " <?php __( " Delete the checked email addresses " ); ?> " /></ p >
2012-08-23 18:46:47 +00:00
</ form >
2012-08-25 14:24:24 +00:00
< ? php
2012-08-25 14:29:21 +00:00
} } // end if no mail for this domain
2012-10-15 13:03:03 +00:00
?>
< hr />
2012-10-20 13:16:14 +00:00
2012-10-15 13:03:03 +00:00
< h3 >< ? php __ ( " Mails configuration informations " ); ?> </h3>
< ? php __ ( " Here are some configuration informations you'll need to configure your mail application. " ); ?>
2012-10-26 16:02:00 +00:00
< br />
< br />
2012-10-15 13:03:03 +00:00
2013-04-19 07:18:25 +00:00
< table width = '100%' class = " tedit " >
2012-10-26 16:02:00 +00:00
< tr >
2013-04-19 07:18:25 +00:00
< th width = '50%' >
2012-10-26 16:02:00 +00:00
< b >< ? php __ ( " Outgoing mail (SMTP) " ); ?> </b>
</ th >
2013-04-19 07:18:25 +00:00
< th width = '50%' >
2012-10-26 16:02:00 +00:00
< b >< ? php __ ( " Incoming mails " ); ?> </b>
</ th >
</ tr >
< tr >
2013-04-19 07:18:25 +00:00
< td valign = 'top' >
2012-11-19 09:32:55 +00:00
< ? php __ ( " Which protocol would you use? " ); ?>
2012-10-15 13:03:03 +00:00
< ul >
< li >< b >< a href = " javascript:; " onClick = " $ ('#cfg-submission').toggle(); " >< ? php __ ( " Submission " ); ?> </a></b>
< ul id = 'cfg-submission' >
2012-10-18 09:22:52 +00:00
< li >< b >< ? php __ ( " Server name: " ); ?> </b> <?php __($mail->srv_submission); ?></li>
2012-10-15 13:03:03 +00:00
< 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' >
2012-10-18 09:22:52 +00:00
< li >< b >< ? php __ ( " Server name: " ); ?> </b> <?php __($mail->srv_smtp); ?></li>
2012-10-15 13:03:03 +00:00
< 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>
2012-10-31 15:10:30 +00:00
< 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>
2012-10-15 13:03:03 +00:00
</ ul >
</ li >
< li >< b >< a href = " javascript:; " onClick = " $ ('#cfg-smtps').toggle(); " >< ? php __ ( " SMTPS " ); ?> </a></b>
< ul id = 'cfg-smtps' >
2012-10-18 09:22:52 +00:00
< li >< b >< ? php __ ( " Server name: " ); ?> </b> <?php __($mail->srv_smtps); ?></li>
2012-10-15 13:03:03 +00:00
< 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>
2012-10-31 15:10:30 +00:00
< 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>
2012-10-15 13:03:03 +00:00
</ ul >
</ li >
</ ul >
2012-10-26 16:02:00 +00:00
</ td >
2013-04-19 07:18:25 +00:00
< td valign = 'top' >
2012-11-19 09:32:55 +00:00
< ? php __ ( " Which protocol would you use? " ); ?>
2012-10-15 13:03:03 +00:00
< ul >
< li >< b >< a href = " javascript:; " onClick = " $ ('#cfg-imap').toggle(); " >< ? php __ ( " IMAP " ); ?> </a></b>
< ul id = 'cfg-imap' >
2012-10-18 09:22:52 +00:00
< li >< b >< ? php __ ( " Server name: " ); ?> </b> <?php __($mail->srv_imap); ?></li>
2012-10-15 13:03:03 +00:00
< 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>
2012-10-31 15:10:30 +00:00
< li >< b >< ? php __ ( " Connection security: " ); ?> </b> STARTTLS</li>
2012-10-15 13:03:03 +00:00
</ ul >
</ li >
< li >< b >< a href = " javascript:; " onClick = " $ ('#cfg-imaps').toggle(); " >< ? php __ ( " IMAPS " ); ?> </a></b>
< ul id = 'cfg-imaps' >
2012-10-18 09:22:52 +00:00
< li >< b >< ? php __ ( " Server name: " ); ?> </b> <?php __($mail->srv_imaps); ?></li>
2012-10-15 13:03:03 +00:00
< 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>
2012-10-31 15:10:30 +00:00
< li >< b >< ? php __ ( " Connection security: " ); ?> </b> SSL</li>
2012-10-15 13:03:03 +00:00
</ ul >
</ li >
< li >< b >< a href = " javascript:; " onClick = " $ ('#cfg-pop3').toggle(); " >< ? php __ ( " POP3 " ); ?> </a></b>
< ul id = 'cfg-pop3' >
2012-10-18 09:22:52 +00:00
< li >< b >< ? php __ ( " Server name: " ); ?> </b> <?php __($mail->srv_pop3); ?></li>
2012-10-15 13:03:03 +00:00
< 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>
2012-10-31 15:10:30 +00:00
< li >< b >< ? php __ ( " Connection security: " ); ?> </b> STARTTLS</li>
2012-10-15 13:03:03 +00:00
</ ul >
</ li >
< li >< b >< a href = " javascript:; " onClick = " $ ('#cfg-pop3s').toggle(); " >< ? php __ ( " POP3S " ); ?> </a></b>
< ul id = 'cfg-pop3s' >
2012-10-18 09:22:52 +00:00
< li >< b >< ? php __ ( " Server name: " ); ?> </b> <?php __($mail->srv_pop3s); ?></li>
2012-10-15 13:03:03 +00:00
< 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>
2012-10-31 15:10:30 +00:00
< li >< b >< ? php __ ( " Connection security: " ); ?> </b> SSL</li>
2012-10-15 13:03:03 +00:00
</ ul >
</ li >
</ ul >
2012-10-26 16:02:00 +00:00
</ td >
</ tr >
</ table >
2012-10-15 13:03:03 +00:00
< 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 " ); ?>