Commit 70009c11 authored by Benjamin Sonntag's avatar Benjamin Sonntag
Browse files

mail_edit almost ready...

parent 90afce21
......@@ -253,6 +253,7 @@ bureau/admin/mail_del.php -text
bureau/admin/mail_doadd.php -text
bureau/admin/mail_doedit.php -text
bureau/admin/mail_edit.inc.php -text
bureau/admin/mail_edit.php -text
bureau/admin/mail_list.php -text
bureau/admin/mail_localbox_doedit.php -text
bureau/admin/mail_localbox_edit.inc.php -text
......
......@@ -45,20 +45,12 @@ if ($confirm=="y") {
while (list($key,$val)=each($d)) {
$mail->delete($val);
$error.=$err->errstr()."<br />";
/*
$error.=$err->errstr()."<br />"; //sprintf(_("The email address <b>%s</b> does not exist!")."<br />",$val);
} else {
$error.=sprintf(_("The email address <b>%s</b> has been deleted!")."<br />",$val);
}
*/
}
include("mail_list.php");
exit();
}
?>
</head>
<body>
<h3><?php __("Deleting mail accounts"); ?> : </h3>
<hr id="topbar"/>
<br />
......@@ -88,5 +80,3 @@ while (list($key,$val)=each($d)) {
</form>
<?php include_once("foot.php"); ?>
</body>
</html>
......@@ -26,20 +26,14 @@ require_once("../class/config.php");
$fields = array (
"mail_arg" => array ("request", "string", ""),
"domain_id" => array ("request", "integer", ""),
"domain" => array ("request", "string", ""),
);
getFields($fields);
$res= array();
//FIXME seems good but maybe can be done in a more fashion way.
$res=$mail->create($domain_id,$mail_arg,$domain);
//once the mail created redirection to mail_properties.php, with the mail_id as parameters ( + domain_id )
if($res["mail_id"]== null){
header ("Location: /mail_list.php?domain=$domain&domain_id=$domain_id");
}else{
$test= 'mail_properties.php?mail_id='.$res["mail_id"]."&domain_id=$domain_id";
header("Location: /$test");
if (!($res=$mail->create($domain_id,$mail_arg))) {
$error=$err->errstr();
include("mail_list.php");
} else {
$_REQUEST["mail_id"]=$res;
include("mail_edit.php");
}
?>
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.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
----------------------------------------------------------------------
Purpose of file: Edit a mailbox.
----------------------------------------------------------------------
*/
require_once("../class/config.php");
include_once("head.php");
$fields = array (
"mail_id" => array ("request", "integer", ""),
);
getFields($fields);
if (!$res=$mail->get_details($mail_id)) {
$error=$err->errstr();
include("main.php");
exit();
} else {
foreach($res as $key=>$val) $$key=$val;
?>
<h3><?php printf(_("Editing the email %s"),$res["address"]."@".$res["domain"]); ?></h3>
<hr id="topbar"/>
<br />
<form action="mail_doedit.php" method="post" name="main" id="main">
<input type="hidden" name="mail_id" value="<?php echo $mail_id; ?>" />
<table class="tedit">
<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 } ?>
</td>
<td>
<p>
<input type="radio" name="islocal" id="islocal0" class="inc" value="0"<?php cbox($islocal==0); ?> onclick="popoff()" /><label for="islocal0"><?php __("No"); ?></label>
<input type="radio" name="islocal" id="islocal1" class="inc" value="1"<?php cbox($islocal==1); ?> onclick="popon();" /><label for="islocal1"><?php __("Yes"); ?></label>
</p>
<div id="poptbl">
<table class="tedit" >
<tr><td><label for="pass"><?php __("Enter a POP/IMAP password"); ?></label></td><td><input type="password" class="int" name="pass" id="pass" value="" size="20" maxlength="32" /></td></tr>
<tr><td><label for="passconf"><?php __("Confirm password"); ?></label></td><td><input type="password" class="int" name="passconf" id="passconf" value="" size="20" maxlength="32" /></td></tr>
<tr><td><label for="quota"><?php __("Maximum allowed size of this Mailbox"); ?></label></td><td><input type="text" class="int intleft" style="text-align: right" name="quota" id="quota" value="<?php ehe($quota); ?>" size="7" maxlength="6" /><span class="int intright"><?php __("MB"); ?></span></td></tr>
</table>
</div>
</td></tr>
<?php if ($islocal) { ?>
<tr id="turnoff"><td colspan="2" class="error"><?php __("WARNING: turning POP/IMAP off will DELETE the stored messages in this email address."); ?></td></tr>
<?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
$html=$hooks->invoke("mail_edit_html",array($mail_id,$type));
foreach($html as $h) echo $h;
?>
<tr class="trbtn"><td colspan="2">
<input type="submit" class="inb" name="submit" value="<?php __("Change this email address"); ?>" />
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="window.history.go(-1);"/>
</td></tr>
</table>
</form>
<?php
}
?>
<script type="text/javascript">
$(document).ready(function() {
$('#email').focus();
<?php if (!$islocal) { ?>
popoff();
<?php } ?>
$('#turnoff').hide();
$('#pass').attr('autocomplete','off');
$('#passconf').attr('autocomplete','off');
});
function popoff() {
$('#turnoff').show();
$('#poptbl').addClass('grey');
$('#pass').attr("disabled", "disabled");
$('#quota').attr("disabled", "disabled");
$('#passconf').attr("disabled", "disabled");
}
function popon() {
$('#turnoff').hide();
$('#poptbl').removeClass('grey');
$('#pass').removeAttr("disabled");
$('#quota').removeAttr("disabled");
$('#passconf').removeAttr("disabled");
}
</script>
<?php include_once("foot.php"); ?>
......@@ -131,7 +131,7 @@ while (list($key,$val)=each($mails_list)){
<?php if ($val["type"]) { ?>
<td colspan="2"><?php echo $val["typedata"]; ?></td>
<?php } else { ?>
<td class="<?php echo $grey; ?>"><?php if ($val["islocal"]) echo format_size($val["used"])."/".format_size($val["quota"]); else __("No"); ?></td>
<td class="<?php echo $grey; ?>"><?php if ($val["islocal"]) echo format_size($val["used"])."/".format_size($val["quotabytes"]); else __("No"); ?></td>
<td class="<?php echo $grey; ?>"><?php echo $val["recipients"]; /* TODO : if >60chars, use "..." + js close/open */ ?></td>
<?php } ?>
<td class="<?php echo $grey; ?>"><?php if ($val["islocal"]) {
......
......@@ -156,7 +156,6 @@ hr {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
padding: 2px;
color: black;
}
.intleft {
border-right: 0px;
......@@ -425,7 +424,7 @@ span#emaildom {
}
.tedit td, .tedit th {
border: 1px solid #aaa;
padding: 6px;
padding: 6px 10px;
margin: 0;
}
......@@ -461,6 +460,6 @@ input#dir, input#sub_local {
padding-top: 6px;
}
.grey {
.grey, .grey td {
color: #999;
}
\ No newline at end of file
}
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
......@@ -118,7 +122,7 @@ class m_mail {
$db->next_record();
$this->total=$db->f("total");
$db->query("SELECT a.id, a.address, a.password, a.`enabled`, a.mail_action, d.domaine AS domain, m.quota*1024*1024 AS quota, m.bytes AS used, NOT ISNULL(m.id) AS islocal, a.type, r.recipients, m.lastlogin
$db->query("SELECT a.id, a.address, a.password, a.`enabled`, a.mail_action, d.domaine AS domain, m.quota, m.quota*1024*1024 AS quotabytes, m.bytes AS used, NOT ISNULL(m.id) AS islocal, a.type, r.recipients, m.lastlogin
FROM (address a LEFT JOIN mailbox m ON m.address_id=a.id) LEFT JOIN recipient r ON r.address_id=a.id, domaines d
WHERE $where AND d.id=a.domain_id
LIMIT $offset,$count;");
......@@ -209,8 +213,8 @@ class m_mail {
$mail_id=intval($mail_id);
// We fetch all the informations for that email: these will fill the hastable :
$db->query("SELECT a.address, a.password, a.`enabled`, d.domaine AS domain, m.quota, m.bytes/1024/1024 AS used, NOT ISNULL(m.id) AS islocal, a.type
FROM address a LEFT JOIN mailbox m ON m.address_id=a.id, domaines d WHERE a.id=$mail_id AND d.id=a.domain_id;");
$db->query("SELECT a.address, a.password, a.`enabled`, d.domaine AS domain, m.quota, m.quota*1024*1024 AS quotabytes, m.bytes AS used, NOT ISNULL(m.id) AS islocal, a.type, r.recipients, m.lastlogin
FROM (address a LEFT JOIN mailbox m ON m.address_id=a.id) LEFT JOIN recipient r ON r.address_id=a.id, domaines d WHERE a.id=$mail_id AND d.id=a.domain_id;");
if (! $db->next_record()) return false;
$details=$db->Record;
// if necessary, fill the typedata with data from hooks ...
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment