2012-08-24 16:25:04 +00:00
< ? php
/*
----------------------------------------------------------------------
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
----------------------------------------------------------------------
*/
2017-10-11 09:58:04 +00:00
/**
* Form to edit a mailbox parameters .
*
* @ copyright AlternC - Team 2000 - 2017 https :// alternc . com /
*/
2012-08-24 16:25:04 +00:00
require_once ( " ../class/config.php " );
include_once ( " head.php " );
$fields = array (
2016-05-26 16:32:17 +00:00
" mail_id " => array ( " request " , " integer " , " " ),
2016-05-23 13:03:13 +00:00
" pass " => array ( " post " , " string " , " " ),
" passconf " => array ( " post " , " string " , " " ),
" quotamb " => array ( " post " , " integer " , 0 ),
" enabled " => array ( " post " , " boolean " , true ),
" islocal " => array ( " post " , " boolean " , true ),
" recipients " => array ( " post " , " string " , " " ),
2012-08-24 16:25:04 +00:00
);
getFields ( $fields );
if ( ! $res = $mail -> get_details ( $mail_id )) {
2017-08-15 14:11:57 +00:00
include ( " mail_list.php " );
2012-08-24 16:25:04 +00:00
exit ();
} else {
2012-08-24 18:21:00 +00:00
foreach ( $res as $key => $val ) $$key = $val ;
$quotamb = $quota ;
if ( $islocal && $mailbox_action == " DELETE " ) $islocal = false ;
if ( isset ( $isedit ) && $isedit ) getFields ( $fields ); // we came from a POST, so let's get the request again ...
2012-08-24 16:25:04 +00:00
?>
< h3 >< ? php printf ( _ ( " Editing the email %s " ), $res [ " address " ] . " @ " . $res [ " domain " ]); ?> </h3>
< hr id = " topbar " />
< br />
2012-08-24 18:21:00 +00:00
< ? php
2017-08-15 14:11:57 +00:00
$c = $admin -> listPasswordPolicies ();
$passwd_classcount = $c [ 'pop' ][ 'classcount' ];
echo $msg -> msg_html_all ();
2012-08-24 18:21:00 +00:00
?>
2016-01-14 15:24:00 +00:00
< form action = " mail_doedit.php " method = " post " name = " main " id = " main " autocomplete = " off " >
2016-05-20 12:21:47 +00:00
< ? php csrf_get (); ?>
2016-01-14 15:24:00 +00:00
<!-- honeypot fields -->
< input type = " text " style = " display: none " id = " fakeUsername " name = " fakeUsername " value = " " />
< input type = " password " style = " display: none " id = " fakePassword " name = " fakePassword " value = " " />
2016-05-22 18:14:26 +00:00
< input type = " hidden " name = " mail_id " value = " <?php ehe( $mail_id ); ?> " />
2017-08-15 14:11:57 +00:00
< input type = " hidden " name = " new_account " value = " <?php echo isset( $new_account )? $new_account :false;?> " />
2012-08-24 16:25:04 +00:00
< table class = " tedit " >
2012-08-24 18:21:00 +00:00
< tr >< th colspan = " 2 " >< b >< ? php __ ( " Is this email enabled? " ); ?> </b></th></tr>
< 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 />
</ td >
< td >
< p >
< input type = " radio " name = " enabled " id = " enabled0 " class = " inc " value = " 0 " < ? php cbox ( $enabled == 0 ); ?> /><label for="enabled0"><?php __("No (email disabled)"); ?></label>
< input type = " radio " name = " enabled " id = " enabled1 " class = " inc " value = " 1 " < ? php cbox ( $enabled == 1 ); ?> /><label for="enabled1"><?php __("Yes (email enabled)"); ?></label>
</ p >
</ td ></ tr >
2012-08-24 16:25:04 +00:00
< tr >< th colspan = " 2 " >< b >< ? php __ ( " Is it a POP/IMAP account? " ); ?> </b></th></tr>
< 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 />
< p >& nbsp ; </ p >
< ? php if ( $islocal ) { ?>
< p >< ? php printf ( _ ( 'This mailbox is currently using %1$s / %2$s' ), format_size ( $used ), format_size ( $quotabytes )); ?> </p>
< ? php } ?>
2012-08-24 18:21:00 +00:00
< ? php if ( $mailbox_action == " DELETE " ) { ?>
2013-10-18 09:12:41 +00:00
< p class = " alert alert-warning " >< ? php __ ( " This mailbox is pending deletion. You can recover its mails by setting it to 'Yes' NOW! " ); ?> </p>
2012-08-24 18:21:00 +00:00
< ? php } ?>
2012-08-24 16:25:04 +00:00
</ td >
< td >
< p >
2017-08-15 14:11:57 +00:00
< input type = " radio " name = " islocal " id = " islocal0 " class = " inc " value = " 0 " < ? php ! isset ( $new_account ) ? cbox ( $islocal == 0 ) : " " ; ?> onclick="popoff()" /><label for="islocal0"><?php __("No"); ?></label>
< input type = " radio " name = " islocal " id = " islocal1 " class = " inc " value = " 1 " < ? php ! isset ( $new_account ) ? cbox ( $islocal == 1 ) : cbox ( $islocal == 0 ); ?> onclick="popon();" /><label for="islocal1"><?php __("Yes"); ?></label>
2012-08-24 16:25:04 +00:00
</ p >
< div id = " poptbl " >
< table class = " tedit " >
2013-04-19 11:28:47 +00:00
< 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>
2017-08-15 14:11:57 +00:00
< tr id = 'mail_edit_pass1' >< td >< label for = " pass " >< ? php __ ( " Enter a POP/IMAP password " ); ?> </label></td><td><input type="password" class="int" autocomplete="off" name="pass" id="pass" value="" size="20" maxlength="32" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#pass","#passconf",$passwd_classcount); ?></td></tr>
2016-01-14 15:24:00 +00:00
< tr id = 'mail_edit_pass2' >< td >< label for = " passconf " >< ? php __ ( " Confirm password " ); ?> </label></td><td><input type="password" class="int" autocomplete="off" name="passconf" id="passconf" value="" size="20" maxlength="32" /></td></tr>
2012-08-24 18:21:00 +00:00
< 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>
2012-08-24 16:25:04 +00:00
</ table >
</ div >
</ td ></ tr >
< ? php if ( $islocal ) { ?>
2017-08-15 14:11:57 +00:00
< tr id = " turnoff " style = " display: none; " >< td colspan = " 2 " class = " alert alert-warning " >< ? php __ ( " WARNING: turning POP/IMAP off will DELETE the stored messages in this email address. " ); ?> </td></tr>
2012-08-24 16:25:04 +00:00
< ? php } ?>
< tr >< th colspan = " 2 " >< b >< ? php __ ( " Is it a redirection to other email addresses? " ); ?> </b></th></tr>
< 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>
< ? php
2012-08-25 14:04:38 +00:00
$html = $hooks -> invoke ( " hook_mail_edit_html " , array ( $mail_id , $type ));
2012-08-24 16:25:04 +00:00
foreach ( $html as $h ) echo $h ;
?>
< tr class = " trbtn " >< td colspan = " 2 " >
2013-10-18 13:31:39 +00:00
< input type = " submit " class = " inb ok " name = " submit " value = " <?php __( " Change this email address " ); ?> " />
< input type = " button " class = " inb cancel " name = " cancel " value = " <?php __( " Cancel " ); ?> " onclick = " window.history.go(-1); " />
2012-08-24 16:25:04 +00:00
</ td ></ tr >
</ table >
</ form >
< ? php
}
?>
< script type = " text/javascript " >
2016-01-14 15:24:00 +00:00
2012-08-24 16:25:04 +00:00
function popoff () {
$ ( '#turnoff' ) . show ();
$ ( '#poptbl' ) . addClass ( 'grey' );
$ ( '#pass' ) . attr ( " disabled " , " disabled " );
2012-08-24 18:21:00 +00:00
$ ( '#quotamb' ) . attr ( " disabled " , " disabled " );
2012-08-24 16:25:04 +00:00
$ ( '#passconf' ) . attr ( " disabled " , " disabled " );
}
function popon () {
$ ( '#turnoff' ) . hide ();
$ ( '#poptbl' ) . removeClass ( 'grey' );
$ ( '#pass' ) . removeAttr ( " disabled " );
2012-08-24 18:21:00 +00:00
$ ( '#quotamb' ) . removeAttr ( " disabled " );
2012-08-24 16:25:04 +00:00
$ ( '#passconf' ) . removeAttr ( " disabled " );
}
2013-01-24 14:59:13 +00:00
function mail_edit_pass () {
$ ( '#mail_edit_pass' ) . toggle ();
$ ( '#mail_edit_pass1' ) . toggle ();
$ ( '#mail_edit_pass2' ) . toggle ();
}
2012-08-24 16:25:04 +00:00
</ script >
2013-01-24 14:59:13 +00:00
< ? php
if ( isset ( $res ) && ! empty ( $res [ 'password' ]) ) {
echo '<script type="text/javascript">mail_edit_pass();</script>' ;
} // if $islocal
include_once ( " foot.php " );
?>