Skip to content

Commit

Permalink
v0.9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
coax committed Jan 18, 2017
1 parent aed1b88 commit c26b9c2
Show file tree
Hide file tree
Showing 36 changed files with 640 additions and 690 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Roadmap for 2017
- better log parser
- buy community license for [Imperavi Grafs](https://imperavi.com/grafs/) (hence the donation link below)

Donate
-----
Don't worry, hMailServer PHPWebAdmin redesign project will stay free - but I do need your support in order to continue to develop it! Thank you :)

[![PayPal donate button](https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png)](https://www.paypal.me/MatijaMatecic/)

How to use
-----
1\. Place "WebAdmin" folder next to your "PHPWebAdmin" installation and make changes to config-dist.php accordingly, then rename to config.php
Expand All @@ -30,6 +36,16 @@ How to use

Changelog
-----
Version 0.9.4 beta (18.01.2017)
- [fix] error in hm_status.php
- [fix] server start/stop button
- [tweak] CSS/HTML optimizations
- [tweak] all words are now translatable (EchoTranslation)
- [new] new chart on dashboard (shows sessions activity line graph in time)
- [new] move rules up/down with arrows
- [new] redesign of single account (non-admin) interface
- [new] documentation link (on each page) points directly to online documentation reference

Version 0.9.3 beta (04.01.2017)
- [fix] SSL certificates typo
- [fix] number validation
Expand Down Expand Up @@ -82,12 +98,6 @@ There's an official thread on [hMailServer forums](https://www.hmailserver.com/f

If you want to help me with this project, simply fork it and let me know ;)

Donate
-----
Don't worry, hMailServer PHPWebAdmin redesign project will stay free - but I do need your support in order to continue to develop it! Thank you :)

[![PayPal donate button](https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png)](https://www.paypal.me/MatijaMatecic/)

Copyright?
-----
Author: [Matija Matečić](http://www.matecic.com)
Expand Down
290 changes: 144 additions & 146 deletions WebAdmin/background_rule_save.php
Original file line number Diff line number Diff line change
@@ -1,150 +1,148 @@
<?php
if (!defined('IN_WEBADMIN'))
exit();

if (!defined('IN_WEBADMIN'))
exit();

$action = hmailGetVar("action","");
$domainid = hmailGetVar("domainid", 0);
$accountid = hmailGetVar("accountid", 0);
$ruleid = hmailGetVar("ruleid", 0);
$criteriaid = hmailGetVar("criteriaid", 0);
$actionid = hmailGetVar("actionid", 0);
$savetype = hmailGetVar("savetype", 0);

if (!GetHasRuleAccess($domainid, $accountid))
hmailHackingAttemp();

include "include/rule_strings.php";

$rule_link = "index.php?page=rule&action=edit&domainid=$domainid&accountid=$accountid&ruleid=$ruleid";

if ($action == "add" && $savetype == "rule")
{
if ($domainid == 0)
$rule = $obBaseApp->Rules->Add();
else
$rule = $obBaseApp->Domains->ItemByDBID($domainid)->Accounts->ItemByDBID($accountid)->Rules->Add();
}
else
{
if ($domainid == 0)
$rule = $obBaseApp->Rules->ItemByDBID($ruleid);
else
$rule = $obBaseApp->Domains->ItemByDBID($domainid)->Accounts->ItemByDBID($accountid)->Rules->ItemByDBID($ruleid);
}


if ($action == "delete")
{

if ($savetype == "criteria")
$rule->Criterias->ItemByDBID($criteriaid)->Delete();
else if ($savetype == "action")
$rule->Actions->ItemByDBID($actionid)->Delete();
else if ($savetype == "rule")
$rule->Delete();

if ($savetype == "criteria" || $savetype == "action")
header("Location: $rule_link");
else
{
if ($domainid == 0)
header("Location: index.php?page=rules");
else
header("Location: index.php?page=account&action=edit&accountid=$accountid&domainid=$domainid");
}

die;
}

if ($savetype == "criteria")
{

if ($action == "edit")
$criteria = $rule->Criterias->ItemByDBID($criteriaid);
else if ($action == "add")
{
$criteria = $rule->Criterias->Add();
}

$criteria->UsePredefined = hmailGetVar("UsePredefined", 0);
$criteria->PredefinedField = hmailGetVar("PredefinedField", 0);
$criteria->MatchType = hmailGetVar("MatchType", 0);
$criteria->MatchValue = hmailGetVar("MatchValue", 0);
$criteria->HeaderField = hmailGetVar("HeaderField", 0);

$criteria->Save();

$rule->Save();

header("Location: $rule_link");
die;
}
else if ($savetype == "action")
{

if ($action == "edit")
$actionObj = $rule->Actions->ItemByDBID($actionid);
else if ($action == "add")
$actionObj = $rule->Actions->Add();

$type = hmailGetVar("Type", 0);

if (hmailGetAdminLevel() != ADMIN_SERVER)
{
if ($type != eRADeleteEmail &&
$type != eRAForwardEmail &&
$type != eRAReply &&
$type != eRAMoveToImapFolder &&
$type != eRAStopRuleProcessing &&
$type != eRASetHeaderValue)
{
hmailHackingAttemp();
}
}

$actionObj->To = hmailGetVar("To", "");
$actionObj->IMAPFolder = hmailGetVar("IMAPFolder", "");
$actionObj->ScriptFunction = hmailGetVar("ScriptFunction", "");
$actionObj->FromName = hmailGetVar("FromName", "");
$actionObj->FromAddress = hmailGetVar("FromAddress", "");
$actionObj->Subject = hmailGetVar("Subject", "");
$actionObj->Body = hmailGetVar("Body", "");
$actionObj->HeaderName = hmailGetVar("HeaderName", "");

switch ($type)
{
case eRASetHeaderValue:
$actionObj->Value = hmailGetVar("Value", "");
break;
$action = hmailGetVar("action", "");
$domainid = hmailGetVar("domainid", 0);
$accountid = hmailGetVar("accountid", 0);
$ruleid = hmailGetVar("ruleid", 0);
$criteriaid = hmailGetVar("criteriaid", 0);
$actionid = hmailGetVar("actionid", 0);
$savetype = hmailGetVar("savetype", 0);

if (!GetHasRuleAccess($domainid, $accountid))
hmailHackingAttemp();

include "include/rule_strings.php";

$rule_link = "index.php?page=rule&action=edit&domainid=$domainid&accountid=$accountid&ruleid=$ruleid";

if ($action == "add" && $savetype == "rule") {
if ($domainid == 0)
$rule = $obBaseApp->Rules->Add();
else
$rule = $obBaseApp->Domains->ItemByDBID($domainid)->Accounts->ItemByDBID($accountid)->Rules->Add();
} else {
if ($domainid == 0)
$rule = $obBaseApp->Rules->ItemByDBID($ruleid);
else
$rule = $obBaseApp->Domains->ItemByDBID($domainid)->Accounts->ItemByDBID($accountid)->Rules->ItemByDBID($ruleid);
}

// added ability to move rules up/down
if ($action == "move") {
if ($savetype == "ruleup")
$rule->MoveUp();
else if ($savetype == "ruledown")
$rule->MoveDown();
else if ($savetype == "actionup")
$rule->Actions->ItemByDBID($actionid)->MoveUp();
else if ($savetype == "actiondown")
$rule->Actions->ItemByDBID($actionid)->MoveDown();

if ($savetype == "actionup" || $savetype == "actiondown")
header("Location: $rule_link");
else {
if ($domainid == 0)
header("Location: index.php?page=rules");
else
header("Location: index.php?page=account&action=edit&accountid=$accountid&domainid=$domainid");
}
die;
}

if ($action == "delete") {
if ($savetype == "criteria")
$rule->Criterias->ItemByDBID($criteriaid)->Delete();
else if ($savetype == "action")
$rule->Actions->ItemByDBID($actionid)->Delete();
else if ($savetype == "rule")
$rule->Delete();

if ($savetype == "criteria" || $savetype == "action")
header("Location: $rule_link");
else {
if ($domainid == 0)
header("Location: index.php?page=rules");
else
header("Location: index.php?page=account&action=edit&accountid=$accountid&domainid=$domainid");
}

die;
}

if ($savetype == "criteria") {
if ($action == "edit")
$criteria = $rule->Criterias->ItemByDBID($criteriaid);
else if ($action == "add") {
$criteria = $rule->Criterias->Add();
}

$criteria->UsePredefined = hmailGetVar("UsePredefined", 0);
$criteria->PredefinedField = hmailGetVar("PredefinedField", 0);
$criteria->MatchType = hmailGetVar("MatchType", 0);
$criteria->MatchValue = hmailGetVar("MatchValue", 0);
$criteria->HeaderField = hmailGetVar("HeaderField", 0);

$criteria->Save();

$rule->Save();

header("Location: $rule_link");

die;
} else if ($savetype == "action") {
if ($action == "edit")
$actionObj = $rule->Actions->ItemByDBID($actionid);
else if ($action == "add")
$actionObj = $rule->Actions->Add();

$type = hmailGetVar("Type", 0);

if (hmailGetAdminLevel() != ADMIN_SERVER) {
if ($type != eRADeleteEmail && $type != eRAForwardEmail && $type != eRAReply && $type != eRAMoveToImapFolder && $type != eRAStopRuleProcessing && $type != eRASetHeaderValue) {
hmailHackingAttemp();
}
}

$actionObj->To = hmailGetVar("To", "");
$actionObj->IMAPFolder = hmailGetVar("IMAPFolder", "");
$actionObj->ScriptFunction = hmailGetVar("ScriptFunction", "");
$actionObj->FromName = hmailGetVar("FromName", "");
$actionObj->FromAddress = hmailGetVar("FromAddress", "");
$actionObj->Subject = hmailGetVar("Subject", "");
$actionObj->Body = hmailGetVar("Body", "");
$actionObj->HeaderName = hmailGetVar("HeaderName", "");

switch ($type) {
case eRASetHeaderValue:
$actionObj->Value = hmailGetVar("Value", "");
break;
case eRABindToAddress:
$actionObj->Value = hmailGetVar("BindToAddress", "");
break;
}

$actionObj->Type = $type;

$actionObj->Save();

$rule->Save();

header("Location: $rule_link");
die;
}
else if ($savetype == "rule")
{
$rule->Name = hmailGetVar("Name", "");
$rule->Active = hmailGetVar("Active", "") == "1";
$rule->UseAND = hmailGetVar("UseAND", "") == "1";
$rule->Save();

$ruleid = $rule->ID;

// can't re-use rule_link since the rule id might be new (if add)
header("Location: index.php?page=rule&action=edit&domainid=$domainid&accountid=$accountid&ruleid=$ruleid");
die;
}


?>
$actionObj->Value = hmailGetVar("BindToAddress", "");
break;
}

$actionObj->Type = $type;

$actionObj->Save();

$rule->Save();

header("Location: $rule_link");

die;
} else if ($savetype == "rule") {
$rule->Name = hmailGetVar("Name", "");
$rule->Active = hmailGetVar("Active", "") == "1";
$rule->UseAND = hmailGetVar("UseAND", "") == "1";
$rule->Save();

$ruleid = $rule->ID;

// can't re-use rule_link since the rule id might be new (if add)
header("Location: index.php?page=rule&action=edit&domainid=$domainid&accountid=$accountid&ruleid=$ruleid");

die;
}
?>
Loading

0 comments on commit c26b9c2

Please sign in to comment.