| | |
| | | global $app, $conf; |
| | | |
| | | if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) { |
| | | // Getting Domains of the user |
| | | $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0"; |
| | | // Getting Clients of the user |
| | | if($_SESSION["s"]["user"]["typ"] == 'admin') { |
| | | $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0"; |
| | | } else { |
| | | $client_group_id = $_SESSION["s"]["user"]["default_group"]; |
| | | $sql = "SELECT client.client_id, limit_web_domain, default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"; |
| | | } |
| | | $clients = $app->db->queryAllRecords($sql); |
| | | $client_select = ''; |
| | | if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>"; |
| | |
| | | unset($policys); |
| | | unset($policy_select); |
| | | unset($tmp_user); |
| | | |
| | | if($this->id > 0) { |
| | | //* we are editing a existing record |
| | | $app->tpl->setVar("edit_disabled", 'disabled="disabled"'); |
| | | } else { |
| | | $app->tpl->setVar("edit_disabled", ''); |
| | | } |
| | | |
| | | parent::onShowEnd(); |
| | | } |
| | |
| | | $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".mysql_real_escape_string($this->dataRecord["domain"])."'"); |
| | | if($tmp_user["id"] > 0) { |
| | | // There is already a record that we will update |
| | | $app->db->datalogUpdate('spamfilter_users', "SET policy_id = $ploicy_id", 'id', $tmp_user["id"]); |
| | | $app->db->datalogUpdate('spamfilter_users', "policy_id = $ploicy_id", 'id', $tmp_user["id"]); |
| | | } else { |
| | | $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$this->id); |
| | | // We create a new record |
| | | $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) |
| | | VALUES (".$_SESSION["s"]["user"]["userid"].", ".$tmp_domain["sys_groupid"].", 'riud', 'riud', '', ".$this->dataRecord["server_id"].", 5, ".$policy_id.", '@".mysql_real_escape_string($this->dataRecord["domain"])."', '@".mysql_real_escape_string($this->dataRecord["domain"])."', 'Y')" |
| | | VALUES (".$_SESSION["s"]["user"]["userid"].", ".$tmp_domain["sys_groupid"].", 'riud', 'riud', '', ".$this->dataRecord["server_id"].", 5, ".$policy_id.", '@".mysql_real_escape_string($this->dataRecord["domain"])."', '@".mysql_real_escape_string($this->dataRecord["domain"])."', 'Y')"; |
| | | $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); |
| | | unset($tmp_domain); |
| | | } |
| | |
| | | if($policy_id > 0) { |
| | | if($tmp_user["id"] > 0) { |
| | | // There is already a record that we will update |
| | | $app->db->datalogUpdate('spamfilter_users', "SET policy_id = $ploicy_id", 'id', $tmp_user["id"]); |
| | | $app->db->datalogUpdate('spamfilter_users', "policy_id = $ploicy_id", 'id', $tmp_user["id"]); |
| | | } else { |
| | | $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$this->id); |
| | | // We create a new record |
| | | $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) |
| | | VALUES (".$_SESSION["s"]["user"]["userid"].", ".$tmp_domain["sys_groupid"].", 'riud', 'riud', '', ".$this->dataRecord["server_id"].", 5, ".$policy_id.", '@".mysql_real_escape_string($this->dataRecord["domain"])."', '@".mysql_real_escape_string($this->dataRecord["domain"])."', 'Y')" |
| | | VALUES (".$_SESSION["s"]["user"]["userid"].", ".$tmp_domain["sys_groupid"].", 'riud', 'riud', '', ".$this->dataRecord["server_id"].", 5, ".$policy_id.", '@".mysql_real_escape_string($this->dataRecord["domain"])."', '@".mysql_real_escape_string($this->dataRecord["domain"])."', 'Y')"; |
| | | $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); |
| | | unset($tmp_domain); |
| | | } |