Skip to content

Commit

Permalink
v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
coax committed Jun 12, 2017
1 parent 7d03768 commit 1bd15bf
Show file tree
Hide file tree
Showing 13 changed files with 173 additions and 158 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ Common issues: https://www.hmailserver.com/documentation/latest/?page=ts_setup_p

Changelog
-----
Version 1.2 (2017-06-12)
- [fix] multiple typos and small fixes
- [fix] dropdowns in rule criteria actions
- [fix] distribution lists checkboxes
- [new] distribution list add/edit/delete members
- [fix] maxlength added to account input fields

Version 1.1 (2017-03-12)
- [new] country name and flag in auto-ban info
- [tweak] navigation UI improvements
Expand Down
2 changes: 1 addition & 1 deletion hMailAdmin/background_distributionlist_recipient_save.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$obRecipient = $obList->Recipients->ItemByDBID($recipientid);
$obRecipient->Delete();

header("Location: index.php?page=distributionlist_recipients&domainid=$domainid&distributionlistid=$distributionlistid");
header("Location: index.php?page=distributionlist&domainid=$domainid&action=edit&distributionlistid=$distributionlistid");
exit();
}

Expand Down
84 changes: 59 additions & 25 deletions hMailAdmin/hm_distributionlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
if (!defined('IN_WEBADMIN'))
exit();

$domainid = hmailGetVar("domainid",null);
$distributionlistid = hmailGetVar("distributionlistid",0);
$action = hmailGetVar("action","");

$error_message = hmailGetVar("error_message","");
$domainid = hmailGetVar("domainid", null);
$distributionlistid = hmailGetVar("distributionlistid", 0);
$action = hmailGetVar("action", "");
$error_message = hmailGetVar("error_message", "");

if (hmailGetAdminLevel() == 0)
hmailHackingAttemp();
Expand All @@ -15,32 +14,26 @@
hmailHackingAttemp(); // Domain admin but not for this domain.

$obDomain = $obBaseApp->Domains->ItemByDBID($domainid);

$listaddress="";
$listactive=0;
$listrequiresmtpauth=0;

$listaddress = "";
$listactive = 0;
$Mode = 0;
$listrequiresmtpauth = 0;

if ($action == "edit")
{
if ($action == "edit") {
$obList = $obDomain->DistributionLists->ItemByDBID($distributionlistid);

$listaddress = $obList->Address;
$listaddress = substr($listaddress, 0, strpos($listaddress, "@"));
$listactive = $obList->Active;
$listrequiresmtpauth = $obList->RequireSMTPAuth;
$Mode = $obList->Mode;
$RequireSenderAddress = $obList->RequireSenderAddress;

$listaddress = substr($listaddress, 0, strpos($listaddress, "@"));
$listrequiresmtpauth = $obList->RequireSMTPAuth;
} else {
$RequireSenderAddress = "";
}

$domainname = $obDomain->Name;

$listactivechecked = hmailCheckedIf1($listactive);
$listrequiresmtpauthchecked = hmailCheckedIf1($listrequiresmtpauth);
$listactivechecked = hmailCheckedIf1($listactive); //fixme, not working
$listrequiresmtpauthchecked = hmailCheckedIf1($listrequiresmtpauth); //fixme, not working
?>
<div class="box medium">
<h2><?php EchoTranslation("Distribution list") ?></h2>
Expand All @@ -58,24 +51,65 @@
PrintHidden("domainid", $domainid);
?>
<p><?php EchoTranslation("Address") ?></p>
<input type="text" name="listaddress" value="<?php echo PreprocessOutput($listaddress)?>" size="30" checkallownull="false" checkmessage="<?php EchoTranslation("Address")?>" class="req medium"> @<?php echo $domainname?>
<input type="text" name="listaddress" value="<?php echo PreprocessOutput($listaddress) ?>" size="30" checkallownull="false" checkmessage="<?php EchoTranslation("Address") ?>" class="req medium"> @<?php echo $domainname ?>
<?php
PrintCheckboxRow("listactivechecked", "Enabled", $listactivechecked);
PrintCheckboxRow("listactive", "Enabled", $listactivechecked);
?>
<h3><a href="#"><?php EchoTranslation("Security")?></a></h3>
<div class="hidden">
<p><?php EchoTranslation("Mode")?></p>
<select name="Mode">
<option value="0" <?php if ($Mode == 0) echo "selected";?> ><?php EchoTranslation("Public - Anyone can send to the list")?></option>
<option value="1" <?php if ($Mode == 1) echo "selected";?> ><?php EchoTranslation("Membership - Only members can send to the list")?></option>
<option value="2" <?php if ($Mode == 2) echo "selected";?> ><?php EchoTranslation("Announcements - Only allow messages from the following address:")?></option>
<option value="0"<?php if ($Mode == 0) echo " selected";?>><?php EchoTranslation("Public - Anyone can send to the list") ?></option>
<option value="1"<?php if ($Mode == 1) echo " selected";?>><?php EchoTranslation("Membership - Only members can send to the list") ?></option>
<option value="2"<?php if ($Mode == 2) echo " selected";?>><?php EchoTranslation("Announcements - Only allow messages from the following address:") ?></option>
</select>
<?php
PrintPropertyEditRow("RequireSenderAddress", "Address", $RequireSenderAddress, 30);
PrintCheckboxRow("listrequiresmtpauth", "Require SMTP Authentication", $listrequiresmtpauth);
PrintCheckboxRow("listrequiresmtpauth", "Require SMTP Authentication", $listrequiresmtpauthchecked);
?>
</div>
<?php
if ($action=='edit') {
?>
<h3><a href="#"><?php EchoTranslation("Members") ?></a></h3>
<div class="hidden">
<table>
<thead>
<tr>
<th><?php EchoTranslation("Name") ?></th>
<th style="width:32px;">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$obDomain = $obBaseApp->Domains->ItemByDBID($domainid);
$obList = $obDomain->DistributionLists->ItemByDBID($distributionlistid);
$obRecipients = $obList->Recipients;
$Count = $obRecipients->Count();
$str_delete = $obLanguage->String("Remove");

for ($i = 0; $i < $Count; $i++) {
$obRecipient = $obRecipients->Item($i);
$recipientaddress = $obRecipient->RecipientAddress;
$recipientid = $obRecipient->ID;
$recipientaddress = PreprocessOutput($recipientaddress);

echo ' <tr>
<td><a href="?page=distributionlist_recipient&action=edit&domainid=' . $domainid . '&distributionlistid=' . $distributionlistid . '&recipientid=' . $recipientid . '">' . $recipientaddress . '</a></td>
<td><a href="#" onclick="return Confirm(\'Confirm delete <b>' . $recipientaddress . '</b>:\',\'Yes\',\'?page=background_distributionlist_recipient_save&csrftoken=' . $csrftoken . '&action=delete&domainid=' . $domainid . '&distributionlistid=' . $distributionlistid . '&recipientid=' . $recipientid . '\');" class="delete">Delete</a></td>
</tr>' . PHP_EOL;
}
?>
</tbody>
</table>
<div class="buttons center"><a href="?page=distributionlist_recipient&action=add&domainid=<?php echo $domainid?>&distributionlistid=<?php echo $distributionlistid?>" class="button"><?php EchoTranslation("Add") ?></a></div>
</div>
<?php
} else {
?>
<div class="warning">You must save distribution list before you can edit members.</div>
<?php
}
PrintSaveButton();
?>
</form>
Expand Down
9 changes: 4 additions & 5 deletions hMailAdmin/hm_distributionlist_recipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
$recipientaddress = "";

if ($action == "edit") {
$obDomain = $obBaseApp->Domains->ItemByDBID($domainid);
$obList = $obDomain->DistributionLists->ItemByDBID($distributionlistid);
$obRecipient = $obList->Recipients->ItemByDBID($recipientid);

$recipientaddress = $obRecipient->RecipientAddress;
$obDomain = $obBaseApp->Domains->ItemByDBID($domainid);
$obList = $obDomain->DistributionLists->ItemByDBID($distributionlistid);
$obRecipient = $obList->Recipients->ItemByDBID($recipientid);
$recipientaddress = $obRecipient->RecipientAddress;
}
?>
<div class="box">
Expand Down
48 changes: 0 additions & 48 deletions hMailAdmin/hm_distributionlist_recipients.php

This file was deleted.

60 changes: 30 additions & 30 deletions hMailAdmin/hm_rule_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,43 +81,43 @@ function hideAllPanels() {
?>
<select name="Type" id="Type" onchange="togglePanel()" onkeyup="togglePanel(this)">
<?php
$eRADeleteEmailSelected = $Type == eRADeleteEmail ? "selected" : "";
$eRAForwardEmailSelected = $Type == eRAForwardEmail ? "selected" : "";
$eRAReplySelected = $Type == eRAReply ? "selected" : "";
$eRAMoveToImapFolderSelected = $Type == eRAMoveToImapFolder ? "selected" : "";
$eRARunScriptFunctionSelected = $Type == eRARunScriptFunction ? "selected" : "";
$eRAStopRuleProcessingSelected = $Type == eRAStopRuleProcessing ? "selected" : "";
$eRASetHeaderValueSelected = $Type == eRASetHeaderValue ? "selected" : "";
$eRASendUsingRouteSelected = $Type == eRASendUsingRoute ? "selected" : "";
$eRACreateCopy = $Type == eRACreateCopy ? "selected" : "";
$eRABindToAddress = $Type == eRABindToAddress ? "selected" : "";
$eRADeleteEmailSelected = $Type == eRADeleteEmail ? " selected" : "";
$eRAForwardEmailSelected = $Type == eRAForwardEmail ? " selected" : "";
$eRAReplySelected = $Type == eRAReply ? " selected" : "";
$eRAMoveToImapFolderSelected = $Type == eRAMoveToImapFolder ? " selected" : "";
$eRARunScriptFunctionSelected = $Type == eRARunScriptFunction ? " selected" : "";
$eRAStopRuleProcessingSelected = $Type == eRAStopRuleProcessing ? " selected" : "";
$eRASetHeaderValueSelected = $Type == eRASetHeaderValue ? " selected" : "";
$eRASendUsingRouteSelected = $Type == eRASendUsingRoute ? " selected" : "";
$eRACreateCopy = $Type == eRACreateCopy ? " selected" : "";
$eRABindToAddress = $Type == eRABindToAddress ? " selected" : "";

echo "<option value= " . eRADeleteEmail . " $eRADeleteEmailSelected>" . GetRuleActionString(eRADeleteEmail) . "</option>";
echo "<option value= " . eRAForwardEmail . " $eRAForwardEmailSelected>" . GetRuleActionString(eRAForwardEmail) . "</option>";
echo "<option value= " . eRAReply . " $eRAReplySelected>" . GetRuleActionString(eRAReply) . "</option>";
echo "<option value= " . eRAMoveToImapFolder . " $eRAMoveToImapFolderSelected>" . GetRuleActionString(eRAMoveToImapFolder) . "</option>";
echo "<option value= " . eRASetHeaderValue . " $eRASetHeaderValueSelected>" . GetRuleActionString(eRASetHeaderValue) . "</option>";
echo "<option value= " . eRAStopRuleProcessing . " $eRAStopRuleProcessingSelected>" . GetRuleActionString(eRAStopRuleProcessing) . "</option>";
echo ' <option value=' . eRADeleteEmail . $eRADeleteEmailSelected . '>' . GetRuleActionString(eRADeleteEmail) . '</option>
<option value=' . eRAForwardEmail . $eRAForwardEmailSelected . '>' . GetRuleActionString(eRAForwardEmail) . '</option>
<option value=' . eRAReply . $eRAReplySelected . '>' . GetRuleActionString(eRAReply) . '</option>
<option value=' . eRAMoveToImapFolder . $eRAMoveToImapFolderSelected . '>' . GetRuleActionString(eRAMoveToImapFolder) . '</option>
<option value=' . eRASetHeaderValue . $eRASetHeaderValueSelected . '>' . GetRuleActionString(eRASetHeaderValue) . '</option>
<option value=' . eRAStopRuleProcessing . $eRAStopRuleProcessingSelected . '>' . GetRuleActionString(eRAStopRuleProcessing) . '</option>' . PHP_EOL;

$disabled = hmailGetAdminLevel() == ADMIN_SERVER ? "": "disabled=\"disabled\"";
echo "<option $disabled value= " . eRARunScriptFunction . " $eRARunScriptFunctionSelected>" . GetRuleActionString(eRARunScriptFunction) . "</option>";
echo "<option $disabled value= " . eRACreateCopy . " $eRACreateCopy>" . GetRuleActionString(eRACreateCopy) . "</option>";
$disabled = hmailGetAdminLevel() == ADMIN_SERVER ? "": " disabled=\"disabled\"";
echo ' <option' . $disabled . ' value=' . eRARunScriptFunction . $eRARunScriptFunctionSelected . '>' . GetRuleActionString(eRARunScriptFunction) . '</option>
<option' . $disabled . ' value=' . eRACreateCopy . $eRACreateCopy . '>' . GetRuleActionString(eRACreateCopy) . '</option>' . PHP_EOL;

// The following actions makes no sense in account-level rules.
if ($accountid == 0) {
echo "<option $disabled value= " . eRASendUsingRoute . " $eRASendUsingRouteSelected>" . GetRuleActionString(eRASendUsingRoute) . "</option>";
echo "<option $disabled value= " . eRABindToAddress . " $eRABindToAddress>" . GetRuleActionString(eRABindToAddress) . "</option>";
echo ' <option' . $disabled . ' value=' . eRASendUsingRoute . $eRASendUsingRouteSelected . '>' . GetRuleActionString(eRASendUsingRoute) . '</option>
<option' . $disabled . ' value=' . eRABindToAddress . $eRABindToAddress . '>' . GetRuleActionString(eRABindToAddress) . '</option>' . PHP_EOL;
}
?>
</select>
<div id="panel-<?php echo eRADeleteEmail?>" name="panel-1" style="display: none">
<div id="panel-<?php echo eRADeleteEmail?>" name="panel-1" style="display:none;">
<!-- empty panel -->
</div>
<div id="panel-<?php echo eRAForwardEmail?>" style="display: none">
<div id="panel-<?php echo eRAForwardEmail?>" style="display:none;">
<p><?php EchoTranslation("To")?></p>
<input type="text" name="To" value="<?php echo PreprocessOutput($To)?>">
</div>
<div id="panel-<?php echo eRAReply?>" style="display: none">
<div id="panel-<?php echo eRAReply?>" style="display:none;">
<p><?php EchoTranslation("From (Name)")?><br/></p>
<input type="text" name="FromName" value="<?php echo PreprocessOutput($FromName)?>">
<p><?php EchoTranslation("From (Address)")?><br/></p>
Expand All @@ -127,28 +127,28 @@ function hideAllPanels() {
<p><?php EchoTranslation("Body")?></p>
<textarea name="Body" cols="30" rows="5"><?php echo PreprocessOutput($Body)?></textarea>
</div>
<div id="panel-<?php echo eRAMoveToImapFolder?>" style="display: none">
<div id="panel-<?php echo eRAMoveToImapFolder?>" style="display:none;">
<p><?php EchoTranslation("IMAP folder")?></p>
<input type="text" name="IMAPFolder" value="<?php echo PreprocessOutput($IMAPFolder)?>">
</div>
<div id="panel-<?php echo eRARunScriptFunction?>" style="display: none">
<div id="panel-<?php echo eRARunScriptFunction?>" style="display:none;">
<p><?php EchoTranslation("Script function")?></p>
<input type="text" name="ScriptFunction" value="<?php echo PreprocessOutput($ScriptFunction)?>">
</div>
<div id="panel-<?php echo eRAStopRuleProcessing?>" style="display: none">
<div id="panel-<?php echo eRAStopRuleProcessing?>" style="display:none;">
<!-- empty panel -->
</div>
<div id="panel-<?php echo eRABindToAddress?>" style="display: none">
<div id="panel-<?php echo eRABindToAddress?>" style="display:none;">
<p><?php EchoTranslation("IP address")?></p>
<input type="text" name="BindToAddress" value="<?php echo PreprocessOutput($Value)?>">
</div>
<div id="panel-<?php echo eRASetHeaderValue?>" style="display: none">
<div id="panel-<?php echo eRASetHeaderValue?>" style="display:none;">
<p><?php EchoTranslation("Header name")?></p>
<input type="text" name="HeaderName" value="<?php echo PreprocessOutput($HeaderName)?>">
<p><?php EchoTranslation("Value")?><br/></p>
<input type="text" name="Value" value="<?php echo PreprocessOutput($Value)?>">
</div>
<div id="panel-<?php echo eRASendUsingRoute?>" style="display: none">
<div id="panel-<?php echo eRASendUsingRoute?>" style="display:none;">
<p><?php EchoTranslation("Route")?></p>
<select name="RouteID">
<?php
Expand Down
Loading

0 comments on commit 1bd15bf

Please sign in to comment.