From 920f4208ba78b9e76d061442504da2ff8d278ee0 Mon Sep 17 00:00:00 2001
From: SJ
Date: Tue, 23 Jul 2013 22:44:34 +0200
Subject: [PATCH] saas enhancements
---
util/db-mysql.sql | 4 +-
util/db-upgrade-0.1.23-vs-0.1.24.sql | 4 +-
webui/config.php | 4 +-
webui/controller/audit/helper.php | 3 +-
webui/controller/customer/list.php | 109 +++
webui/controller/customer/remove.php | 79 ++
webui/controller/ldap/list.php | 32 +-
webui/controller/message/journal.php | 2 +-
webui/images/.nofile | 0
webui/index.php | 2 +-
webui/language/de/messages.php | 847 +++++++++---------
webui/language/en/messages.php | 9 +
webui/language/hu/messages.iso-8859-2.php | 9 +
webui/language/hu/messages.php | 9 +
webui/language/pt/messages.php | 10 +
webui/model/domain/domain.php | 15 +
webui/model/saas/customer.php | 81 ++
webui/model/saas/ldap.php | 24 +-
webui/model/user/auth.php | 14 +-
.../default/templates/common/layout-audit.tpl | 2 +-
.../default/templates/common/layout-email.tpl | 2 +-
.../templates/common/layout-search.tpl | 2 +-
.../theme/default/templates/common/layout.tpl | 2 +-
.../theme/default/templates/common/menu.tpl | 3 +-
.../theme/default/templates/customer/list.tpl | 104 +++
.../default/templates/customer/remove.tpl | 11 +
.../theme/default/templates/ldap/list.tpl | 42 +-
.../default/templates/message/headers.tpl | 2 +-
.../default/templates/message/journal.tpl | 2 +-
.../default/templates/message/restore.tpl | 2 +-
.../theme/default/templates/message/view.tpl | 2 +-
31 files changed, 970 insertions(+), 463 deletions(-)
create mode 100644 webui/controller/customer/list.php
create mode 100644 webui/controller/customer/remove.php
create mode 100644 webui/images/.nofile
create mode 100644 webui/view/theme/default/templates/customer/list.tpl
create mode 100644 webui/view/theme/default/templates/customer/remove.tpl
diff --git a/util/db-mysql.sql b/util/db-mysql.sql
index 13eeb395..012591eb 100644
--- a/util/db-mysql.sql
+++ b/util/db-mysql.sql
@@ -354,11 +354,13 @@ create table if not exists `ldap` (
`ldap_host` varchar(255) not null,
`ldap_base_dn` varchar(255) not null,
`ldap_bind_dn` varchar(255) not null,
- `ldap_bind_pw` varchar(255) not null
+ `ldap_bind_pw` varchar(255) not null,
+ `ldap_auditor_member_dn` varchar(255) default null
) Engine=InnoDB;
create table if not exists `customer_settings` (
+ `id` int not null auto_increment primary key,
`domain` varchar(255) not null unique,
`branding_text` varchar(255) default null,
`branding_url` varchar(255) default null,
diff --git a/util/db-upgrade-0.1.23-vs-0.1.24.sql b/util/db-upgrade-0.1.23-vs-0.1.24.sql
index bcc9230f..955f8384 100644
--- a/util/db-upgrade-0.1.23-vs-0.1.24.sql
+++ b/util/db-upgrade-0.1.23-vs-0.1.24.sql
@@ -11,10 +11,12 @@ create table if not exists `ldap` (
`ldap_host` varchar(255) not null,
`ldap_base_dn` varchar(255) not null,
`ldap_bind_dn` varchar(255) not null,
- `ldap_bind_pw` varchar(255) not null
+ `ldap_bind_pw` varchar(255) not null,
+ `ldap_auditor_member_dn` varchar(255) default null
) Engine=InnoDB;
create table if not exists `customer_settings` (
+ `id` int not null auto_increment primary key,
`domain` varchar(255) not null unique,
`branding_text` varchar(255) default null,
`branding_url` varchar(255) default null,
diff --git a/webui/config.php b/webui/config.php
index dd45cfdb..4c995aea 100644
--- a/webui/config.php
+++ b/webui/config.php
@@ -341,6 +341,7 @@ define('ACTION_REMOVE_MESSAGE', 13);
define('ACTION_UNAUTHORIZED_REMOVE_MESSAGE', 14);
define('ACTION_DOWNLOAD_ATTACHMENT', 15);
define('ACTION_UNAUTHORIZED_DOWNLOAD_ATTACHMENT', 16);
+define('ACTION_VIEW_JOURNAL', 17);
$actions = array(
'unknown' => 1,
@@ -353,7 +354,8 @@ $actions = array(
'download' => 9,
'search' => 10,
'save_search' => 11,
- 'download_attachment' => 15
+ 'download_attachment' => 15,
+ 'journal' => 17
);
diff --git a/webui/controller/audit/helper.php b/webui/controller/audit/helper.php
index 786c38dc..20cd43ef 100644
--- a/webui/controller/audit/helper.php
+++ b/webui/controller/audit/helper.php
@@ -63,6 +63,7 @@ class ControllerAuditHelper extends Controller {
$this->data['actions'][ACTION_UNAUTHORIZED_REMOVE_MESSAGE] = $this->data['text_unauthorized_remove_message'];
$this->data['actions'][ACTION_DOWNLOAD_ATTACHMENT] = $this->data['text_download_attachment2'];
$this->data['actions'][ACTION_UNAUTHORIZED_DOWNLOAD_ATTACHMENT] = $this->data['text_unauthorized_download_attachment'];
+ $this->data['actions'][ACTION_VIEW_JOURNAL] = $this->data['text_view_journal'];
@@ -98,7 +99,7 @@ class ControllerAuditHelper extends Controller {
while(list($k, $v) = each($b)) {
if($v == '') { continue; }
- if(preg_match("/(login|loginfailed|logout|view|download|search|restore)$/", $v) && isset($actions[$v])) { $this->a['action'] .= '*' . $actions[$v]; }
+ if(preg_match("/(login|loginfailed|logout|view|download|search|restore|journal)$/", $v) && isset($actions[$v])) { $this->a['action'] .= '*' . $actions[$v]; }
if(preg_match("/\@/", $v)) { $this->a['user'] .= '*' . $v; }
if(preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $v)) { $this->a['ipaddr'] .= '*' . $v; }
if(preg_match("/^\d{1,}$/", $v)) { $this->a['ref'] .= '*' . $v; }
diff --git a/webui/controller/customer/list.php b/webui/controller/customer/list.php
new file mode 100644
index 00000000..cec7916b
--- /dev/null
+++ b/webui/controller/customer/list.php
@@ -0,0 +1,109 @@
+id = "content";
+ $this->template = "customer/list.tpl";
+ $this->layout = "common/layout";
+
+
+ $request = Registry::get('request');
+ $db = Registry::get('db');
+
+ $this->load->model('saas/customer');
+ $this->load->model('domain/domain');
+
+ $this->document->title = $this->data['text_customers'];
+
+
+ $this->data['username'] = Registry::get('username');
+
+
+ $this->data['page'] = 0;
+ $this->data['page_len'] = get_page_length();
+
+ $this->data['total'] = 0;
+
+ $this->data['entries'] = array();
+
+ $this->data['id'] = -1;
+
+ if(isset($this->request->get['id'])) { $this->data['id'] = $this->request->get['id']; }
+
+ /* check if we are admin */
+
+ if(Registry::get('admin_user') == 1) {
+
+ if($this->request->server['REQUEST_METHOD'] == 'POST') {
+ if($this->validate() == true) {
+
+ if(isset($this->request->post['id'])) {
+ if($this->model_saas_customer->update($this->request->post) == 1) {
+ $this->data['x'] = $this->data['text_successfully_modified'];
+ } else {
+ $this->template = "common/error.tpl";
+ $this->data['errorstring'] = $this->data['text_failed_to_modify'];
+ }
+ }
+ else {
+ if($this->model_saas_customer->add($this->request->post) == 1) {
+ $this->data['x'] = $this->data['text_successfully_added'];
+ } else {
+ $this->template = "common/error.tpl";
+ $this->data['errorstring'] = $this->data['text_failed_to_add'];
+ }
+ }
+ }
+ else {
+ $this->template = "common/error.tpl";
+ $this->data['errorstring'] = array_pop($this->error);
+ }
+ }
+
+ $this->data['domains'] = $this->model_domain_domain->get_mapped_domains();
+
+ if(isset($this->request->get['id'])) {
+ $this->data['a'] = $this->model_saas_customer->get($this->request->get['id']);
+ }
+ else {
+ $this->data['entries'] = $this->model_saas_customer->get();
+ }
+
+ }
+ else {
+ $this->template = "common/error.tpl";
+ $this->data['errorstring'] = $this->data['text_you_are_not_admin'];
+ }
+
+
+ $this->render();
+ }
+
+
+ private function validate() {
+
+ if(!isset($this->request->post['domain']) || strlen($this->request->post['domain']) < 1) {
+ $this->error['domain'] = $this->data['text_invalid_data'];
+ }
+
+ if(!isset($this->request->post['branding_text']) || strlen($this->request->post['branding_text']) < 1) {
+ $this->error['branding_text'] = $this->data['text_invalid_data'];
+ }
+
+ if (!$this->error) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+
+
+}
+
+?>
diff --git a/webui/controller/customer/remove.php b/webui/controller/customer/remove.php
new file mode 100644
index 00000000..ca28870c
--- /dev/null
+++ b/webui/controller/customer/remove.php
@@ -0,0 +1,79 @@
+id = "content";
+ $this->template = "customer/remove.tpl";
+ $this->layout = "common/layout";
+
+
+ $request = Registry::get('request');
+ $db = Registry::get('db');
+
+ $this->load->model('saas/customer');
+
+ $this->document->title = $this->data['text_customers'];
+
+
+ $this->data['username'] = Registry::get('username');
+
+ $this->data['id'] = $this->request->get['id'];
+ $this->data['domain'] = $this->request->get['domain'];
+ $this->data['confirmed'] = (int)$this->request->get['confirmed'];
+
+
+ if($this->validate() == true) {
+
+ if($this->data['confirmed'] == 1) {
+ $ret = $this->model_saas_customer->delete($this->data['id'], $this->data['domain']);
+ if($ret == 1){
+ $this->data['x'] = $this->data['text_successfully_removed'];
+ }
+ else {
+ $this->data['x'] = $this->data['text_failed_to_remove'];
+ }
+ }
+ }
+ else {
+ $this->template = "common/error.tpl";
+ $this->data['errorstring'] = array_pop($this->error);
+ }
+
+
+
+ $this->render();
+ }
+
+
+ private function validate() {
+
+ if(Registry::get('admin_user') == 0) {
+ $this->error['admin'] = $this->data['text_you_are_not_admin'];
+ }
+
+ if(!isset($this->request->get['domain']) || strlen($this->request->get['domain']) < 1) {
+ $this->error['domain'] = $this->data['text_invalid_data'];
+ }
+
+ if(!isset($this->request->get['id']) || !is_numeric($this->request->get['id'])) {
+ $this->error['id'] = $this->data['text_invalid_data'];
+ }
+
+ if (!$this->error) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+
+}
+
+?>
diff --git a/webui/controller/ldap/list.php b/webui/controller/ldap/list.php
index f7eb282d..b0eee06d 100644
--- a/webui/controller/ldap/list.php
+++ b/webui/controller/ldap/list.php
@@ -29,6 +29,11 @@ class ControllerLdapList extends Controller {
$this->data['entries'] = array();
+ $this->data['id'] = -1;
+
+ $this->data['ldap_types'] = Registry::get('ldap_types');
+
+ if(isset($this->request->get['id'])) { $this->data['id'] = $this->request->get['id']; }
/* check if we are admin */
@@ -37,11 +42,21 @@ class ControllerLdapList extends Controller {
if($this->request->server['REQUEST_METHOD'] == 'POST') {
if($this->validate() == true) {
- if($this->model_saas_ldap->add($this->request->post) == 1) {
- $this->data['x'] = $this->data['text_successfully_added'];
- } else {
- $this->template = "common/error.tpl";
- $this->data['errorstring'] = $this->data['text_failed_to_add'];
+ if(isset($this->request->post['id'])) {
+ if($this->model_saas_ldap->update($this->request->post) == 1) {
+ $this->data['x'] = $this->data['text_successfully_modified'];
+ } else {
+ $this->template = "common/error.tpl";
+ $this->data['errorstring'] = $this->data['text_failed_to_modify'];
+ }
+ }
+ else {
+ if($this->model_saas_ldap->add($this->request->post) == 1) {
+ $this->data['x'] = $this->data['text_successfully_added'];
+ } else {
+ $this->template = "common/error.tpl";
+ $this->data['errorstring'] = $this->data['text_failed_to_add'];
+ }
}
}
else {
@@ -50,7 +65,12 @@ class ControllerLdapList extends Controller {
}
}
- $this->data['entries'] = $this->model_saas_ldap->get();
+ if(isset($this->request->get['id'])) {
+ $this->data['a'] = $this->model_saas_ldap->get($this->request->get['id']);
+ }
+ else {
+ $this->data['entries'] = $this->model_saas_ldap->get();
+ }
}
else {
diff --git a/webui/controller/message/journal.php b/webui/controller/message/journal.php
index c26ca0fd..e59422a3 100644
--- a/webui/controller/message/journal.php
+++ b/webui/controller/message/journal.php
@@ -31,7 +31,7 @@ class ControllerMessageJournal extends Controller {
die("no permission for " . $this->data['id']);
}
- AUDIT(ACTION_VIEW_HEADER, '', '', $this->data['id'], '');
+ AUDIT(ACTION_VIEW_JOURNAL, '', '', $this->data['id'], '');
if(Registry::get('auditor_user') == 1) { $this->data['rcpt'] = $this->model_search_search->get_message_addresses_in_my_domain($this->data['id']); }
diff --git a/webui/images/.nofile b/webui/images/.nofile
new file mode 100644
index 00000000..e69de29b
diff --git a/webui/index.php b/webui/index.php
index 74cfffa3..a7b41a67 100644
--- a/webui/index.php
+++ b/webui/index.php
@@ -60,7 +60,7 @@ Registry::set('counters', $counters);
Registry::set('langs', $langs);
Registry::set('themes', $themes);
Registry::set('letters', $letters);
-
+Registry::set('ldap_types', array("AD", "iredmail", "lotus", "zimbra"));
Registry::set('health_smtp_servers', $health_smtp_servers);
Registry::set('partitions_to_monitor', $partitions_to_monitor);
diff --git a/webui/language/de/messages.php b/webui/language/de/messages.php
index b1bb9bf4..5f05a524 100644
--- a/webui/language/de/messages.php
+++ b/webui/language/de/messages.php
@@ -1,419 +1,428 @@
-
+
diff --git a/webui/language/en/messages.php b/webui/language/en/messages.php
index 352eae22..9e20ab01 100644
--- a/webui/language/en/messages.php
+++ b/webui/language/en/messages.php
@@ -30,6 +30,9 @@ $_['text_audit'] = "Audit";
$_['text_back'] = "Back";
$_['text_body'] = "Body";
+$_['text_branding_logo'] = "Branding logo";
+$_['text_branding_text'] = "Branding text";
+$_['text_branding_url'] = "Branding URL";
$_['text_bulk_edit_selected_uids'] = "Bulk edit selected uids";
$_['text_bulk_restore_selected_emails'] = "Bulk restore selected emails";
$_['text_bulk_update_selected_uids'] = "Bulk update selected uids";
@@ -38,6 +41,7 @@ $_['text_cancel'] = "Cancel";
$_['text_change_user_settings'] = "change user settings";
$_['text_clienthost'] = "Client host";
$_['text_close'] = "Close";
+$_['text_colour'] = "Colour";
$_['text_compressed'] = "compressed";
$_['text_confirm_to_reset_counters'] = "Confirm to reset counters";
$_['text_connection_failed'] = "Connection failed";
@@ -49,6 +53,7 @@ $_['text_copied'] = "Copied";
$_['text_counters'] = "Counters";
$_['text_cpu_load'] = "CPU load";
$_['text_cpu_usage'] = "CPU usage";
+$_['text_customers'] = "Customers";
$_['text_daily_quarantine_report'] = "Daily quarantine report";
$_['text_daily_quarantine_report_status'] = "Daily quarantine report status";
@@ -84,6 +89,7 @@ $_['text_download_message'] = "Download message (EML)";
$_['text_download_message2'] = "download message";
$_['text_edit'] = "Edit";
+$_['text_edit_entry'] = "Edit entry";
$_['text_edit_group'] = "Edit group";
$_['text_edit_user'] = "Edit user";
$_['text_edit_or_view'] = "Edit/view";
@@ -163,6 +169,7 @@ $_['text_last'] = "Last";
$_['text_last_update'] = "Last update";
$_['text_latest_emails'] = "Latest emails";
$_['text_ldap'] = "LDAP";
+$_['text_ldap_auditor_member_dn'] = "Auditor member DN";
$_['text_ldap_base_dn'] = "LDAP base DN";
$_['text_ldap_bind_dn'] = "LDAP bind DN";
$_['text_ldap_bind_pw'] = "LDAP bind password";
@@ -304,6 +311,7 @@ $_['text_successfully_modified'] = "Successfully modified";
$_['text_successfully_removed'] = "Successfully removed";
$_['text_successfully_trained'] = "Successfully trained";
$_['text_successfully_updated'] = "Successfully modified";
+$_['text_support_link'] = "Support link";
$_['text_swap_usage'] = "Swap usage";
$_['text_tag_selected_messages'] = "Tag selected messages";
@@ -346,6 +354,7 @@ $_['text_users_quarantine'] = "User's quarantine";
$_['text_view_formatted_email'] = "View formatted email";
$_['text_view_header'] = "view header";
$_['text_view_headers'] = "View headers";
+$_['text_view_journal'] = "journal";
$_['text_view_journal_envelope'] = "View envelope";
$_['text_view_message'] = "View message";
$_['text_view_message2'] = "view message";
diff --git a/webui/language/hu/messages.iso-8859-2.php b/webui/language/hu/messages.iso-8859-2.php
index 7b50f2c5..e0590a57 100644
--- a/webui/language/hu/messages.iso-8859-2.php
+++ b/webui/language/hu/messages.iso-8859-2.php
@@ -29,6 +29,9 @@ $_['text_attachment_type'] = "Mell
$_['text_audit'] = "Audit";
$_['text_back'] = "Vissza";
+$_['text_branding_logo'] = "Brand logo";
+$_['text_branding_text'] = "Brand szveg";
+$_['text_branding_url'] = "Brand URL";
$_['text_body'] = "Szveg";
$_['text_bulk_edit_selected_uids'] = "Kivlasztott azonostk szerkesztse";
$_['text_bulk_restore_selected_emails'] = "Kivlasztott levelek visszalltsa";
@@ -38,6 +41,7 @@ $_['text_cancel'] = "M
$_['text_change_user_settings'] = "belltsok mentse";
$_['text_clienthost'] = "Kliens gp";
$_['text_close'] = "Bezr";
+$_['text_colour'] = "Szn";
$_['text_compressed'] = "tmrtett";
$_['text_confirm_to_reset_counters'] = "Szmllk nullzsnak megerstse";
$_['text_connection_failed'] = "Sikertelen kapcsolat";
@@ -49,6 +53,7 @@ $_['text_copied'] = "
$_['text_counters'] = "Szmllk";
$_['text_cpu_load'] = "CPU terhels";
$_['text_cpu_usage'] = "CPU hasznlat";
+$_['text_customers'] = "gyfelek";
$_['text_daily_quarantine_report'] = "Napi karantn riport";
$_['text_daily_quarantine_report_status'] = "Napi karantn rtests";
@@ -84,6 +89,7 @@ $_['text_download_message'] = "Lev
$_['text_download_message2'] = "levl letltse";
$_['text_edit'] = "Szerkeszt";
+$_['text_edit_entry'] = "Bejegyzs szerkesztse";
$_['text_edit_group'] = "Csoport szerkesztse";
$_['text_edit_user'] = "Felhasznl szerkesztse";
$_['text_edit_or_view'] = "Szerkeszt/Megnz";
@@ -164,6 +170,7 @@ $_['text_last'] = "Utols
$_['text_latest_emails'] = "Legfrissebb emailek";
$_['text_last_update'] = "Utols frissts";
$_['text_ldap'] = "LDAP";
+$_['text_ldap_auditor_member_dn'] = "Auditor DN";
$_['text_ldap_base_dn'] = "LDAP alaprtelmezett DN";
$_['text_ldap_bind_dn'] = "LDAP csatlakozsi DN";
$_['text_ldap_bind_pw'] = "LDAP csatlakozsi jelsz";
@@ -305,6 +312,7 @@ $_['text_successfully_modified'] = "Sikeresen m
$_['text_successfully_removed'] = "Sikeresen eltvoltva";
$_['text_successfully_trained'] = "Sikeresen tantva";
$_['text_successfully_updated'] = "Sikeresen mdostva";
+$_['text_support_link'] = "Tmogats link";
$_['text_swap_usage'] = "Swap hasznlat";
$_['text_tag_selected_messages'] = "Kijellt zenetek cmkzse";
@@ -347,6 +355,7 @@ $_['text_users_quarantine'] = "Felhaszn
$_['text_view_formatted_email'] = "Formzott levl megtekintse";
$_['text_view_header'] = "fejlc megtekintse";
$_['text_view_headers'] = "Levl fejlce";
+$_['text_view_journal'] = "journal";
$_['text_view_journal_envelope'] = "Journal envelope";
$_['text_view_message'] = "Levl megtekintse";
$_['text_view_message2'] = "levl megtekintse";
diff --git a/webui/language/hu/messages.php b/webui/language/hu/messages.php
index e53d9a02..0afb8516 100644
--- a/webui/language/hu/messages.php
+++ b/webui/language/hu/messages.php
@@ -29,6 +29,9 @@ $_['text_attachment_type'] = "Melléklet típus";
$_['text_audit'] = "Audit";
$_['text_back'] = "Vissza";
+$_['text_branding_logo'] = "Brand logo";
+$_['text_branding_text'] = "Brand szöveg";
+$_['text_branding_url'] = "Brand URL";
$_['text_body'] = "Szöveg";
$_['text_bulk_edit_selected_uids'] = "Kiválasztott azonosítók szerkesztése";
$_['text_bulk_restore_selected_emails'] = "Kiválasztott levelek visszaállítása";
@@ -38,6 +41,7 @@ $_['text_cancel'] = "Mégse";
$_['text_change_user_settings'] = "beállítások mentése";
$_['text_clienthost'] = "Kliens gép";
$_['text_close'] = "Bezár";
+$_['text_colour'] = "Szín";
$_['text_compressed'] = "tömörített";
$_['text_confirm_to_reset_counters'] = "Számlálók nullázásának megerősítése";
$_['text_connection_failed'] = "Sikertelen kapcsolat";
@@ -49,6 +53,7 @@ $_['text_copied'] = "Átmásolva";
$_['text_counters'] = "Számlálók";
$_['text_cpu_load'] = "CPU terhelés";
$_['text_cpu_usage'] = "CPU használat";
+$_['text_customers'] = "Ügyfelek";
$_['text_daily_quarantine_report'] = "Napi karantén riport";
$_['text_daily_quarantine_report_status'] = "Napi karantén értesítés";
@@ -84,6 +89,7 @@ $_['text_download_message'] = "Levél letöltése (EML)";
$_['text_download_message2'] = "levél letöltése";
$_['text_edit'] = "Szerkeszt";
+$_['text_edit_entry'] = "Bejegyzés szerkesztése";
$_['text_edit_group'] = "Csoport szerkesztése";
$_['text_edit_user'] = "Felhasználó szerkesztése";
$_['text_edit_or_view'] = "Szerkeszt/Megnéz";
@@ -164,6 +170,7 @@ $_['text_last'] = "Utolsó";
$_['text_latest_emails'] = "Legfrissebb emailek";
$_['text_last_update'] = "Utolsó frissítés";
$_['text_ldap'] = "LDAP";
+$_['text_ldap_auditor_member_dn'] = "Auditor DN";
$_['text_ldap_base_dn'] = "LDAP alapértelmezett DN";
$_['text_ldap_bind_dn'] = "LDAP csatlakozási DN";
$_['text_ldap_bind_pw'] = "LDAP csatlakozási jelszó";
@@ -305,6 +312,7 @@ $_['text_successfully_modified'] = "Sikeresen módosítva";
$_['text_successfully_removed'] = "Sikeresen eltávolítva";
$_['text_successfully_trained'] = "Sikeresen tanítva";
$_['text_successfully_updated'] = "Sikeresen módosítva";
+$_['text_support_link'] = "Támogatás link";
$_['text_swap_usage'] = "Swap használat";
$_['text_tag_selected_messages'] = "Kijelölt üzenetek címkézése";
@@ -347,6 +355,7 @@ $_['text_users_quarantine'] = "Felhasználók karanténja";
$_['text_view_formatted_email'] = "Formázott levél megtekintése";
$_['text_view_header'] = "fejléc megtekintése";
$_['text_view_headers'] = "Levél fejléce";
+$_['text_view_journal'] = "journal";
$_['text_view_journal_envelope'] = "Journal envelope";
$_['text_view_message'] = "Levél megtekintése";
$_['text_view_message2'] = "levél megtekintése";
diff --git a/webui/language/pt/messages.php b/webui/language/pt/messages.php
index 8d0b5868..2f390b67 100644
--- a/webui/language/pt/messages.php
+++ b/webui/language/pt/messages.php
@@ -28,6 +28,9 @@ $_['text_attachment_type'] = "Tipo de anexo";
$_['text_audit'] = "Auditoria";
$_['text_back'] = "Voltar";
+$_['text_branding_logo'] = "Branding logo";
+$_['text_branding_text'] = "Branding text";
+$_['text_branding_url'] = "Branding URL";
$_['text_body'] = "Mensagem";
$_['text_bulk_edit_selected_uids'] = "Seleção de UIDs";
$_['text_bulk_restore_selected_emails'] = "Reenviar emails selecionados";
@@ -37,6 +40,7 @@ $_['text_cancel'] = "Cancelar";
$_['text_change_user_settings'] = "alterar configuração de usuário";
$_['text_clienthost'] = "Client host";
$_['text_close'] = "Fechar";
+$_['text_colour'] = "Colour";
$_['text_compressed'] = "comprimido";
$_['text_confirm_to_reset_counters'] = "Confirme para resetar os contadores";
$_['text_contact_support'] = "Contact support";
@@ -46,6 +50,7 @@ $_['text_copied'] = "Copiado";
$_['text_counters'] = "Contadores:";
$_['text_cpu_load'] = "CPU, carga de";
$_['text_cpu_usage'] = "CPU, uso de";
+$_['text_customers'] = "Customers";
$_['text_daily_quarantine_report'] = "Relatório diário de quarentena";
$_['text_daily_quarantine_report_status'] = "Status do relatório diário de quarentena";
@@ -81,6 +86,7 @@ $_['text_download_message'] = "Download mensagem (EML)";
$_['text_download_message2'] = "download mensagem";
$_['text_edit'] = "Editar";
+$_['text_edit_entry'] = "Editar entry";
$_['text_edit_group'] = "Editar grupo";
$_['text_edit_user'] = "Editar usuário";
$_['text_edit_or_view'] = "Editar / Visualizar";
@@ -154,10 +160,12 @@ $_['text_invalid_policy_setting'] = "Configuração de política inválida";
$_['text_invalid_uid'] = "UID invalido";
$_['text_invalid_username'] = "Nome de usuário inválido";
$_['text_ipaddr'] = "Endereço IP";
+
$_['text_language'] = "Idioma";
$_['text_last'] = "Último";
$_['text_last_update'] = "Última atualização";
$_['text_latest_emails'] = "Emails mais recentes";
+$_['text_ldap_auditor_member_dn'] = "Auditor member DN";
$_['text_ldap_basedn'] = "LDAP base DN";
$_['text_ldap_binddn'] = "LDAP bind DN";
$_['text_ldap_bindpw'] = "LDAP bind password";
@@ -299,6 +307,7 @@ $_['text_successfully_modified'] = "Alterado com sucesso";
$_['text_successfully_removed'] = "Removido com sucesso";
$_['text_successfully_trained'] = "Treinado com sucesso";
$_['text_successfully_updated'] = "Atualizado com sucesso";
+$_['text_support_link'] = "Support link";
$_['text_swap_usage'] = "Swap, uso de:";
$_['text_tag_selected_messages'] = "Marcar(Tag) resultados de pesquisa";
@@ -340,6 +349,7 @@ $_['text_users_quarantine'] = "Quarentena de usuário";
$_['text_view_formatted_email'] = "Visualizar email formatado";
$_['text_view_header'] = "Visualizar cabeçalho";
$_['text_view_headers'] = "Visualizar cabeçalho";
+$_['text_view_journal'] = "envelope";
$_['text_view_journal_envelope'] = "Visualizar envelope";
$_['text_view_message'] = "Visualizar mensagem";
$_['text_view_message2'] = "visualizar mensagem";
diff --git a/webui/model/domain/domain.php b/webui/model/domain/domain.php
index 43bd4220..89735b2f 100644
--- a/webui/model/domain/domain.php
+++ b/webui/model/domain/domain.php
@@ -26,6 +26,21 @@ class ModelDomainDomain extends Model {
}
+ public function get_mapped_domains() {
+ $data = array();
+
+ $query = $this->db->query("SELECT DISTINCT mapped FROM " . TABLE_DOMAIN . " ORDER BY mapped ASC");
+
+ if(isset($query->rows)) {
+ foreach($query->rows as $q) {
+ array_push($data, $q['mapped']);
+ }
+ }
+
+ return $data;
+ }
+
+
public function get_domains_by_string($s = '', $page = 0, $page_len = PAGE_LEN) {
$from = (int)$page * (int)$page_len;
diff --git a/webui/model/saas/customer.php b/webui/model/saas/customer.php
index 55f019c2..65219d4c 100644
--- a/webui/model/saas/customer.php
+++ b/webui/model/saas/customer.php
@@ -3,6 +3,76 @@
class ModelSaasCustomer extends Model
{
+ public function get($id = -1) {
+
+ if($id > 0) {
+ $query = $this->db->query("SELECT * FROM " . TABLE_CUSTOMER_SETTINGS . " WHERE id=?", array($id));
+ if($query->num_rows > 0) { return $query->row; }
+ }
+
+ $query = $this->db->query("SELECT * FROM " . TABLE_CUSTOMER_SETTINGS . " ORDER BY domain ASC");
+
+ if($query->num_rows > 0) { return $query->rows; }
+
+ return array();
+ }
+
+
+ public function delete($id = 0, $description = '') {
+ if($id == 0) { return 0; }
+
+ $query = $this->db->query("DELETE FROM " . TABLE_CUSTOMER_SETTINGS . " WHERE id=?", array($id));
+
+ $rc = $this->db->countAffected();
+
+ LOGGER("remove ldap entry: #$id, $description (rc=$rc)");
+
+ return $rc;
+ }
+
+
+ public function add($arr = array()) {
+ $branding_logo = '';
+
+ if(!isset($arr['domain']) || !isset($arr['branding_text'])) { return 0; }
+
+ if(isset($_FILES['branding_logo']['name'])) {
+ $branding_logo = $_FILES['branding_logo']['name'];
+ move_uploaded_file($_FILES['branding_logo']['tmp_name'], DIR_BASE . "/images/" . $_FILES['branding_logo']['name']);
+ }
+
+ $query = $this->db->query("INSERT INTO " . TABLE_CUSTOMER_SETTINGS . " (domain, branding_text, branding_url, branding_logo, support_link, colour) VALUES (?,?,?,?,?,?)", array($arr['domain'], $arr['branding_text'], $arr['branding_url'], $branding_logo, $arr['support_link'], $arr['colour']));
+
+ $rc = $this->db->countAffected();
+
+ LOGGER("add ldap entry: " . $arr['domain'] . " / " . $arr['branding_text'] . " / " . $arr['branding_url'] . " / " . $arr['support_link'] . " (rc=$rc)");
+
+ if($rc == 1){ return 1; }
+
+ return 0;
+ }
+
+
+ public function update($arr = array()) {
+ $branding_logo = '';
+
+ if(!isset($arr['id']) || !isset($arr['domain']) || !isset($arr['branding_text'])) { return 0; }
+
+ if(isset($_FILES['branding_logo']['name'])) {
+ $branding_logo = $_FILES['branding_logo']['name'];
+ move_uploaded_file($_FILES['branding_logo']['tmp_name'], DIR_BASE . "/images/" . $_FILES['branding_logo']['name']);
+
+ $query = $this->db->query("UPDATE " . TABLE_CUSTOMER_SETTINGS . " SET domain=?, branding_text=?, branding_url=?, branding_logo=?, support_link=?, colour=? WHERE id=?", array($arr['domain'], $arr['branding_text'], $arr['branding_url'], $branding_logo, $arr['support_link'], $arr['colour'], $arr['id']));
+ }
+ else {
+ $query = $this->db->query("UPDATE " . TABLE_CUSTOMER_SETTINGS . " SET domain=?, branding_text=?, branding_url=?, support_link=?, colour=? WHERE id=?", array($arr['domain'], $arr['branding_text'], $arr['branding_url'], $arr['support_link'], $arr['colour'], $arr['id']));
+ }
+
+
+ return $this->db->countAffected();
+ }
+
+
public function get_customer_settings_by_email() {
$data = array(
'branding_text' => BRANDING_TEXT,
@@ -17,6 +87,13 @@ class ModelSaasCustomer extends Model
list ($user, $domain) = explode("@", $_SESSION['email']);
+ if(MEMCACHED_ENABLED) {
+ $cache_key = sha1("customer_settings:" . $domain);
+ $memcache = Registry::get('memcache');
+ $m = $memcache->get($cache_key);
+ if(isset($m['data'])) { return unserialize($m['data']); }
+ }
+
$query = $this->db->query("SELECT * FROM " . TABLE_CUSTOMER_SETTINGS . " WHERE domain=(SELECT mapped FROM " . TABLE_DOMAIN . " WHERE domain=?)", array($domain));
if($query->num_rows > 0) {
@@ -27,6 +104,10 @@ class ModelSaasCustomer extends Model
if($query->row['colour']) { $data['colour'] = $query->row['colour']; }
}
+ if(MEMCACHED_ENABLED && $cache_key) {
+ $memcache->add($cache_key, array('data' => serialize($data)), 0, MEMCACHED_TTL);
+ }
+
return $data;
}
diff --git a/webui/model/saas/ldap.php b/webui/model/saas/ldap.php
index 264757a3..ecdd36ac 100644
--- a/webui/model/saas/ldap.php
+++ b/webui/model/saas/ldap.php
@@ -3,9 +3,14 @@
class ModelSaasLdap extends Model
{
- public function get() {
+ public function get($id = -1) {
- $query = $this->db->query("SELECT id, description, ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn FROM " . TABLE_LDAP . " ORDER BY description ASC");
+ if($id >= 0) {
+ $query = $this->db->query("SELECT id, description, ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_bind_pw, ldap_auditor_member_dn FROM " . TABLE_LDAP . " WHERE id=?", array($id));
+ if($query->num_rows > 0) { return $query->row; }
+ }
+
+ $query = $this->db->query("SELECT id, description, ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_auditor_member_dn FROM " . TABLE_LDAP . " ORDER BY description ASC");
if($query->num_rows > 0) { return $query->rows; }
@@ -29,7 +34,7 @@ class ModelSaasLdap extends Model
public function add($arr = array()) {
if(!isset($arr['description']) || !isset($arr['ldap_host'])) { return 0; }
- $query = $this->db->query("INSERT INTO " . TABLE_LDAP . " (description, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_bind_pw, ldap_type) VALUES (?,?,?,?,?,?)", array($arr['description'], $arr['ldap_host'], $arr['ldap_base_dn'], $arr['ldap_bind_dn'], $arr['ldap_bind_pw'], $arr['ldap_type']));
+ $query = $this->db->query("INSERT INTO " . TABLE_LDAP . " (description, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_bind_pw, ldap_type, ldap_auditor_member_dn) VALUES (?,?,?,?,?,?,?)", array($arr['description'], $arr['ldap_host'], $arr['ldap_base_dn'], $arr['ldap_bind_dn'], $arr['ldap_bind_pw'], $arr['ldap_type'], $arr['ldap_auditor_member_dn']));
$rc = $this->db->countAffected();
@@ -41,6 +46,15 @@ class ModelSaasLdap extends Model
}
+ public function update($arr = array()) {
+ if(!isset($arr['id']) || !isset($arr['description']) || !isset($arr['ldap_host'])) { return 0; }
+
+ $query = $this->db->query("UPDATE " . TABLE_LDAP . " SET description=?, ldap_host=?, ldap_base_dn=?, ldap_bind_dn=?, ldap_bind_pw=?, ldap_type=?, ldap_auditor_member_dn=? WHERE id=?", array($arr['description'], $arr['ldap_host'], $arr['ldap_base_dn'], $arr['ldap_bind_dn'], $arr['ldap_bind_pw'], $arr['ldap_type'], $arr['ldap_auditor_member_dn'], $arr['id']));
+
+ return $this->db->countAffected();
+ }
+
+
public function get_ldap_params_by_email($email = '') {
$domain = '';
@@ -48,9 +62,9 @@ class ModelSaasLdap extends Model
list($l,$d) = explode("@", $email);
- $query = $this->db->query("SELECT ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_bind_pw from " . TABLE_DOMAIN . " as d, " . TABLE_LDAP . " as l where d.ldap_id=l.id and d.domain=?", array($d));
+ $query = $this->db->query("SELECT ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_bind_pw, ldap_auditor_member_dn FROM " . TABLE_DOMAIN . " as d, " . TABLE_LDAP . " as l where d.ldap_id=l.id and d.domain=?", array($d));
- if($query->num_rows > 0) { return array($query->row['ldap_type'], $query->row['ldap_host'], $query->row['ldap_base_dn'], $query->row['ldap_bind_dn'], $query->row['ldap_bind_pw']); }
+ if($query->num_rows > 0) { return array($query->row['ldap_type'], $query->row['ldap_host'], $query->row['ldap_base_dn'], $query->row['ldap_bind_dn'], $query->row['ldap_bind_pw'], $query->row['ldap_auditor_member_dn']); }
return array();
}
diff --git a/webui/model/user/auth.php b/webui/model/user/auth.php
index e9e0514c..58408541 100644
--- a/webui/model/user/auth.php
+++ b/webui/model/user/auth.php
@@ -67,16 +67,18 @@ class ModelUserAuth extends Model {
$ldap_base_dn = LDAP_BASE_DN;
$ldap_helper_dn = LDAP_HELPER_DN;
$ldap_helper_password = LDAP_HELPER_PASSWORD;
+ $ldap_auditor_member_dn = LDAP_AUDITOR_MEMBER_DN;
if(ENABLE_SAAS == 1) {
$a = $this->model_saas_ldap->get_ldap_params_by_email($username);
- if(count($a) >= 5) {
+ if(count($a) >= 6) {
$ldap_type = $a[0];
$ldap_host = $a[1];
$ldap_base_dn = $a[2];
$ldap_helper_dn = $a[3];
$ldap_helper_password = $a[4];
+ $ldap_auditor_member_dn = $a[5];
}
}
@@ -101,7 +103,7 @@ class ModelUserAuth extends Model {
$query = $ldap->query($ldap_base_dn, "(|(&(objectClass=$ldap_account_objectclass)($ldap_mail_attr=$username))(&(objectClass=$ldap_distributionlist_objectclass)($ldap_distributionlist_attr=$username)" . ")(&(objectClass=$ldap_distributionlist_objectclass)($ldap_distributionlist_attr=" . stripslashes($a['dn']) . ")))", array("mail", "mailalternateaddress", "proxyaddresses", "zimbraMailForwardingAddress", "member", "memberOfGroup"));
- $is_auditor = $this->check_ldap_membership($query->rows);
+ $is_auditor = $this->check_ldap_membership($ldap_auditor_member_dn, $query->rows);
$emails = $this->get_email_array_from_ldap_attr($query->rows);
@@ -124,8 +126,8 @@ class ModelUserAuth extends Model {
}
- private function check_ldap_membership($e = array()) {
- if(LDAP_AUDITOR_MEMBER_DN == '') { return 0; }
+ private function check_ldap_membership($ldap_auditor_member_dn = '', $e = array()) {
+ if($ldap_auditor_member_dn == '') { return 0; }
foreach($e as $a) {
foreach (array("memberof") as $memberattr) {
@@ -133,13 +135,13 @@ class ModelUserAuth extends Model {
if(isset($a[$memberattr]['count'])) {
for($i = 0; $i < $a[$memberattr]['count']; $i++) {
- if($a[$memberattr][$i] == LDAP_AUDITOR_MEMBER_DN) {
+ if($a[$memberattr][$i] == $ldap_auditor_member_dn) {
return 1;
}
}
}
else {
- if($a[$memberattr] == LDAP_AUDITOR_MEMBER_DN) {
+ if($a[$memberattr] == $ldap_auditor_member_dn) {
return 1;
}
}
diff --git a/webui/view/theme/default/templates/common/layout-audit.tpl b/webui/view/theme/default/templates/common/layout-audit.tpl
index a4816a93..eacf4e0f 100644
--- a/webui/view/theme/default/templates/common/layout-audit.tpl
+++ b/webui/view/theme/default/templates/common/layout-audit.tpl
@@ -2,7 +2,7 @@
- | |
+ |
diff --git a/webui/view/theme/default/templates/common/layout-email.tpl b/webui/view/theme/default/templates/common/layout-email.tpl
index 387cfbbe..0daac933 100644
--- a/webui/view/theme/default/templates/common/layout-email.tpl
+++ b/webui/view/theme/default/templates/common/layout-email.tpl
@@ -2,7 +2,7 @@
- | |
+ |
diff --git a/webui/view/theme/default/templates/common/layout-search.tpl b/webui/view/theme/default/templates/common/layout-search.tpl
index f5f4076a..b50e2eee 100644
--- a/webui/view/theme/default/templates/common/layout-search.tpl
+++ b/webui/view/theme/default/templates/common/layout-search.tpl
@@ -2,7 +2,7 @@
- | |
+ |
diff --git a/webui/view/theme/default/templates/common/layout.tpl b/webui/view/theme/default/templates/common/layout.tpl
index a91eef05..d2f85154 100644
--- a/webui/view/theme/default/templates/common/layout.tpl
+++ b/webui/view/theme/default/templates/common/layout.tpl
@@ -2,7 +2,7 @@
- | |
+ |
diff --git a/webui/view/theme/default/templates/common/menu.tpl b/webui/view/theme/default/templates/common/menu.tpl
index 90835d83..66ff9d7d 100644
--- a/webui/view/theme/default/templates/common/menu.tpl
+++ b/webui/view/theme/default/templates/common/menu.tpl
@@ -10,7 +10,7 @@
-->
-
+
@@ -37,6 +37,7 @@
+
diff --git a/webui/view/theme/default/templates/customer/list.tpl b/webui/view/theme/default/templates/customer/list.tpl
new file mode 100644
index 00000000..d48d4111
--- /dev/null
+++ b/webui/view/theme/default/templates/customer/list.tpl
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/webui/view/theme/default/templates/customer/remove.tpl b/webui/view/theme/default/templates/customer/remove.tpl
new file mode 100644
index 00000000..e8f8c6e3
--- /dev/null
+++ b/webui/view/theme/default/templates/customer/remove.tpl
@@ -0,0 +1,11 @@
+
+
+
+
+
+.
+
+
+
+
+
diff --git a/webui/view/theme/default/templates/ldap/list.tpl b/webui/view/theme/default/templates/ldap/list.tpl
index 19477c90..72cca0fa 100644
--- a/webui/view/theme/default/templates/ldap/list.tpl
+++ b/webui/view/theme/default/templates/ldap/list.tpl
@@ -1,4 +1,4 @@
-
+
@@ -6,55 +6,66 @@
+
+
@@ -68,6 +79,8 @@
|
|
|
+
|
+
|
|
@@ -78,11 +91,13 @@
|
|
|
+
|
+
|
|
-
+
@@ -90,5 +105,8 @@
+
+
+
diff --git a/webui/view/theme/default/templates/message/headers.tpl b/webui/view/theme/default/templates/message/headers.tpl
index b48d2c95..dd78f137 100644
--- a/webui/view/theme/default/templates/message/headers.tpl
+++ b/webui/view/theme/default/templates/message/headers.tpl
@@ -19,7 +19,7 @@
|
-
+
|
diff --git a/webui/view/theme/default/templates/message/journal.tpl b/webui/view/theme/default/templates/message/journal.tpl
index e25f871f..9c4984db 100644
--- a/webui/view/theme/default/templates/message/journal.tpl
+++ b/webui/view/theme/default/templates/message/journal.tpl
@@ -19,7 +19,7 @@
|
-
+
diff --git a/webui/view/theme/default/templates/message/restore.tpl b/webui/view/theme/default/templates/message/restore.tpl
index 0b9830d2..f37ad4f3 100644
--- a/webui/view/theme/default/templates/message/restore.tpl
+++ b/webui/view/theme/default/templates/message/restore.tpl
@@ -1,7 +1,7 @@
diff --git a/webui/view/theme/default/templates/message/view.tpl b/webui/view/theme/default/templates/message/view.tpl
index 6d285b10..28cd0ba1 100644
--- a/webui/view/theme/default/templates/message/view.tpl
+++ b/webui/view/theme/default/templates/message/view.tpl
@@ -21,7 +21,7 @@
- |
+ |