From 348aef798afc67d45e60022b40a2a5becac8ebc4 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Wed, 23 Nov 2005 18:33:07 -0500 Subject: [PATCH] added mail_box --- interface/web/sites/templates/mail_box_list.htm | 27 +++ interface/lib/classes/tform.inc.php | 25 ++- interface/web/sites/lib/module.conf.php | 2 interface/web/sites/form/mail_box.tform.php | 43 +++++ interface/web/sites/lib/lang/en_mail_box.lng | 13 + interface/sql/ispconfig3db.sql | 49 +++++ interface/web/sites/list/mail_box.list.php | 69 ++++++++ interface/web/sites/lib/lang/en_mail_box_list.lng | 12 + interface/web/sites/mail_box_list.php | 26 +++ interface/lib/classes/tform_actions.inc.php | 3 interface/web/sites/templates/mail_box_autoresponder_edit.htm | 21 ++ interface/web/sites/templates/mail_box_mailbox_edit.htm | 24 +++ interface/web/themes/default/style.css | 2 interface/web/sites/mail_box_del.php | 54 ++++++ interface/web/sites/mail_box_edit.php | 104 +++++++++++++ 15 files changed, 455 insertions(+), 19 deletions(-) diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php index 5fb6444..a58200c 100644 --- a/interface/lib/classes/tform.inc.php +++ b/interface/lib/classes/tform.inc.php @@ -101,7 +101,7 @@ * der Variablen mit Regex * @var errorMessage */ - var $errorMessage; + var $errorMessage = ''; var $dateformat = "d.m.Y"; var $formDef; @@ -456,7 +456,7 @@ function encode($record,$tab) { if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab)."); - $this->errorMessage = ''; + //$this->errorMessage = ''; if(is_array($record)) { foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) { @@ -556,14 +556,12 @@ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n"; } break; - /* case 'ISEMAIL': - if(!preg_match("", $field_value)) { + if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,4}$/i", $field_value)) { $errmsg = $validator['errmsg']; $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n"; } break; - */ case 'ISINT': $tmpval = intval($field_value); if($tmpval === 0 and !empty($field_value)) { @@ -631,14 +629,22 @@ if($action == "INSERT") { if($field['formtype'] == 'PASSWORD') { $sql_insert_key .= "`$key`, "; - $sql_insert_val .= "md5('".$record[$key]."'), "; + if($field['encryption'] == 'CRYPT') { + $sql_insert_val .= "'".crypt($record[$key])."', "; + } else { + $sql_insert_val .= "md5('".$record[$key]."'), "; + } } else { $sql_insert_key .= "`$key`, "; $sql_insert_val .= "'".$record[$key]."', "; } } else { if($field['formtype'] == 'PASSWORD') { - $sql_update .= "`$key` = md5('".$record[$key]."'), "; + if($field['encryption'] == 'CRYPT') { + $sql_update .= "`$key` = '".crypt($record[$key])."', "; + } else { + $sql_update .= "`$key` = md5('".$record[$key]."'), "; + } } else { $sql_update .= "`$key` = '".$record[$key]."', "; } @@ -835,9 +841,12 @@ } else { $result = false; if($this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm,$this->formDef["auth_preset"]["perm_user"])) $result = true; - if($this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true; + if($this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true; if(@stristr($perm,$this->formDef["auth_preset"]["perm_other"])) $result = true; + // if preset == 0, everyone can insert a record of this type + if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0) $result = true; + return $result; } diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php index a13a8fe..5eb8ad6 100644 --- a/interface/lib/classes/tform_actions.inc.php +++ b/interface/lib/classes/tform_actions.inc.php @@ -71,6 +71,7 @@ $this->id = intval($_REQUEST["id"]); if(count($_POST) > 1) { + $this->dataRecord = $_POST; $this->onSubmit(); } else { $this->onShow(); @@ -83,8 +84,6 @@ function onSubmit() { global $app, $conf; - - $this->dataRecord = $_POST; // Calling the action functions if($this->id > 0) { diff --git a/interface/sql/ispconfig3db.sql b/interface/sql/ispconfig3db.sql index 590243f..08a880d 100644 --- a/interface/sql/ispconfig3db.sql +++ b/interface/sql/ispconfig3db.sql @@ -3,9 +3,9 @@ # http://www.phpmyadmin.net/ (download page) # # Host: localhost -# Erstellungszeit: 23. November 2005 um 18:15 -# Server Version: 4.0.22 -# PHP-Version: 5.0.2 +# Erstellungszeit: 24. November 2005 um 00:31 +# Server Version: 4.0.23 +# PHP-Version: 5.0.3 # Datenbank: `ispconfig3` # -------------------------------------------------------- @@ -13,6 +13,7 @@ # Tabellenstruktur f�r Tabelle `mail_blacklist` # +DROP TABLE IF EXISTS mail_blacklist; CREATE TABLE mail_blacklist ( blacklist_id int(11) NOT NULL auto_increment, server_id int(11) NOT NULL default '0', @@ -31,6 +32,7 @@ # Tabellenstruktur f�r Tabelle `mail_box` # +DROP TABLE IF EXISTS mail_box; CREATE TABLE mail_box ( mailbox_id int(11) NOT NULL auto_increment, sys_userid int(11) NOT NULL default '0', @@ -49,7 +51,7 @@ quota varchar(255) NOT NULL default '', cc varchar(50) NOT NULL default '', forward varchar(50) NOT NULL default '', - autoresponder enum('yes','no') NOT NULL default 'no', + autoresponder enum('0','1') NOT NULL default '0', autoresponder_text tinytext NOT NULL, active enum('0','1') NOT NULL default '1', antivirus enum('yes','no') NOT NULL default 'no', @@ -63,12 +65,14 @@ # Daten f�r Tabelle `mail_box` # +INSERT INTO mail_box VALUES (1, 1, 0, 'riud', 'riud', '', 1, 'till@test.de', '$1$ye3.TQ1.$v/RvqbuU.Gh7UrLlA6HqX/', '', '', 0, 0, '', '', '', '', '0', '', '1', 'no', 'no', 'no'); # -------------------------------------------------------- # # Tabellenstruktur f�r Tabelle `mail_domain` # +DROP TABLE IF EXISTS mail_domain; CREATE TABLE mail_domain ( domain_id int(11) NOT NULL auto_increment, sys_userid int(11) NOT NULL default '0', @@ -98,6 +102,7 @@ # Tabellenstruktur f�r Tabelle `mail_domain_catchall` # +DROP TABLE IF EXISTS mail_domain_catchall; CREATE TABLE mail_domain_catchall ( virtual_default_id int(11) NOT NULL auto_increment, server_id int(11) NOT NULL default '0', @@ -117,6 +122,7 @@ # Tabellenstruktur f�r Tabelle `mail_greylist` # +DROP TABLE IF EXISTS mail_greylist; CREATE TABLE mail_greylist ( greylist_id int(11) NOT NULL auto_increment, relay_ip varchar(64) default NULL, @@ -138,6 +144,7 @@ # Tabellenstruktur f�r Tabelle `mail_mailman_domain` # +DROP TABLE IF EXISTS mail_mailman_domain; CREATE TABLE mail_mailman_domain ( mailman_id int(11) NOT NULL auto_increment, server_id int(11) NOT NULL default '0', @@ -159,6 +166,7 @@ # Tabellenstruktur f�r Tabelle `mail_redirect` # +DROP TABLE IF EXISTS mail_redirect; CREATE TABLE mail_redirect ( email_id int(11) NOT NULL auto_increment, sys_userid int(11) NOT NULL default '0', @@ -185,6 +193,7 @@ # Tabellenstruktur f�r Tabelle `mail_whitelist` # +DROP TABLE IF EXISTS mail_whitelist; CREATE TABLE mail_whitelist ( whitelist_id int(11) NOT NULL auto_increment, server_id int(11) NOT NULL default '0', @@ -203,6 +212,7 @@ # Tabellenstruktur f�r Tabelle `reseller` # +DROP TABLE IF EXISTS reseller; CREATE TABLE reseller ( reseller_id bigint(20) NOT NULL auto_increment, sys_userid int(11) NOT NULL default '0', @@ -247,6 +257,7 @@ # Tabellenstruktur f�r Tabelle `server` # +DROP TABLE IF EXISTS server; CREATE TABLE server ( server_id bigint(20) NOT NULL auto_increment, sys_userid int(11) NOT NULL default '0', @@ -277,6 +288,7 @@ # Tabellenstruktur f�r Tabelle `sys_datalog` # +DROP TABLE IF EXISTS sys_datalog; CREATE TABLE sys_datalog ( datalog_id bigint(20) NOT NULL auto_increment, dbtable varchar(255) NOT NULL default '', @@ -295,12 +307,38 @@ INSERT INTO sys_datalog VALUES (1, 'mail_domain', 'domain_id:0', 'i', 1132758298, 'admin', 'a:5:{s:9:"server_id";a:2:{s:3:"old";N;s:3:"new";i:1;}s:6:"domain";a:2:{s:3:"old";N;s:3:"new";s:7:"test.de";}s:11:"destination";a:2:{s:3:"old";N;s:3:"new";s:8:"hallo.de";}s:4:"type";a:2:{s:3:"old";N;s:3:"new";s:5:"alias";}s:6:"active";a:2:{s:3:"old";N;s:3:"new";i:1;}}'); INSERT INTO sys_datalog VALUES (2, 'mail_domain', 'domain_id:2', 'u', 1132759303, 'admin', 'a:1:{s:6:"domain";a:2:{s:3:"old";s:7:"test.de";s:3:"new";s:8:"test2.de";}}'); INSERT INTO sys_datalog VALUES (3, 'mail_domain', 'domain_id:2', 'u', 1132759328, 'admin', 'a:1:{s:11:"destination";a:2:{s:3:"old";s:8:"hallo.de";s:3:"new";s:7:"test.de";}}'); +INSERT INTO sys_datalog VALUES (4, 'mail_box', 'mailbox_id:0', 'i', 1132775402, 'admin', 'a:3:{s:5:"email";a:2:{s:3:"old";N;s:3:"new";s:12:"till@test.de";}s:8:"cryptpwd";a:2:{s:3:"old";N;s:3:"new";s:5:"hallo";}s:6:"active";a:2:{s:3:"old";N;s:3:"new";i:1;}}'); +INSERT INTO sys_datalog VALUES (5, 'mail_box', 'mailbox_id:1', 'u', 1132775575, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (6, 'mail_box', 'mailbox_id:1', 'u', 1132775587, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (7, 'mail_box', 'mailbox_id:1', 'u', 1132775898, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (8, 'mail_box', 'mailbox_id:1', 'u', 1132775901, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (9, 'mail_box', 'mailbox_id:1', 'u', 1132777011, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (10, 'mail_box', 'mailbox_id:1', 'u', 1132777757, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (11, 'mail_box', 'mailbox_id:1', 'u', 1132777760, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (12, 'mail_box', 'mailbox_id:1', 'u', 1132777764, 'admin', 'a:2:{s:5:"email";a:2:{s:3:"old";s:12:"till@test.de";s:3:"new";s:13:"till2@test.de";}s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (13, 'mail_box', 'mailbox_id:1', 'u', 1132777768, 'admin', 'a:2:{s:5:"email";a:2:{s:3:"old";s:13:"till2@test.de";s:3:"new";s:12:"till@test.de";}s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (14, 'mail_box', 'mailbox_id:1', 'u', 1132778380, 'admin', 'a:2:{s:9:"server_id";a:2:{s:3:"old";s:1:"0";s:3:"new";i:1;}s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (15, 'mail_box', 'mailbox_id:1', 'u', 1132784990, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (16, 'mail_box', 'mailbox_id:0', 'i', 1132785424, 'admin', 'a:3:{s:9:"server_id";a:2:{s:3:"old";N;s:3:"new";i:1;}s:5:"email";a:2:{s:3:"old";N;s:3:"new";s:8:"@test.de";}s:6:"active";a:2:{s:3:"old";N;s:3:"new";i:1;}}'); +INSERT INTO sys_datalog VALUES (17, 'mail_box', 'mailbox_id:1', 'u', 1132786068, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (18, 'mail_box', 'mailbox_id:1', 'u', 1132786083, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (19, 'mail_box', 'mailbox_id:1', 'u', 1132786772, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (20, 'mail_box', 'mailbox_id:1', 'u', 1132786777, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:32:"598d4c200461b81522a3328565c25f7c";s:3:"new";s:4:"test";}}'); +INSERT INTO sys_datalog VALUES (21, 'mail_box', 'mailbox_id:1', 'u', 1132786796, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:0:"";s:3:"new";s:4:"test";}}'); +INSERT INTO sys_datalog VALUES (22, 'mail_box', 'mailbox_id:1', 'u', 1132786860, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:0:"";s:3:"new";s:4:"test";}}'); +INSERT INTO sys_datalog VALUES (23, 'mail_box', 'mailbox_id:1', 'u', 1132787252, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:0:"";s:3:"new";s:4:"test";}}'); +INSERT INTO sys_datalog VALUES (24, 'mail_box', 'mailbox_id:1', 'u', 1132787548, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:34:"$1$ye3.TQ1.$v/RvqbuU.Gh7UrLlA6HqX/";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (25, 'mail_box', 'mailbox_id:1', 'u', 1132787761, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:34:"$1$ye3.TQ1.$v/RvqbuU.Gh7UrLlA6HqX/";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (26, 'mail_box', 'mailbox_id:0', 'i', 1132787775, 'admin', 'a:3:{s:9:"server_id";a:2:{s:3:"old";N;s:3:"new";i:1;}s:5:"email";a:2:{s:3:"old";N;s:3:"new";s:12:"test@test.de";}s:6:"active";a:2:{s:3:"old";N;s:3:"new";i:1;}}'); +INSERT INTO sys_datalog VALUES (27, 'mail_box', 'mailbox_id:1', 'u', 1132788121, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:34:"$1$ye3.TQ1.$v/RvqbuU.Gh7UrLlA6HqX/";s:3:"new";s:0:"";}}'); +INSERT INTO sys_datalog VALUES (28, 'mail_box', 'mailbox_id:1', 'u', 1132788482, 'admin', 'a:1:{s:8:"cryptpwd";a:2:{s:3:"old";s:34:"$1$ye3.TQ1.$v/RvqbuU.Gh7UrLlA6HqX/";s:3:"new";s:0:"";}}'); # -------------------------------------------------------- # # Tabellenstruktur f�r Tabelle `sys_dbsync` # +DROP TABLE IF EXISTS sys_dbsync; CREATE TABLE sys_dbsync ( id bigint(20) NOT NULL auto_increment, jobname varchar(255) NOT NULL default '', @@ -329,6 +367,7 @@ # Tabellenstruktur f�r Tabelle `sys_filesync` # +DROP TABLE IF EXISTS sys_filesync; CREATE TABLE sys_filesync ( id bigint(20) NOT NULL auto_increment, jobname varchar(255) NOT NULL default '', @@ -353,6 +392,7 @@ # Tabellenstruktur f�r Tabelle `sys_group` # +DROP TABLE IF EXISTS sys_group; CREATE TABLE sys_group ( groupid int(11) NOT NULL auto_increment, name varchar(255) NOT NULL default '', @@ -372,6 +412,7 @@ # Tabellenstruktur f�r Tabelle `sys_user` # +DROP TABLE IF EXISTS sys_user; CREATE TABLE sys_user ( userid int(11) NOT NULL auto_increment, sys_userid int(11) NOT NULL default '0', diff --git a/interface/web/sites/form/mail_box.tform.php b/interface/web/sites/form/mail_box.tform.php index 5f2c940..68c28a2 100644 --- a/interface/web/sites/form/mail_box.tform.php +++ b/interface/web/sites/form/mail_box.tform.php @@ -53,16 +53,24 @@ $form["tabs"]['mailbox'] = array ( 'title' => "Mailbox", 'width' => 100, - 'template' => "templates/mail_box_edit.htm", + 'template' => "templates/mail_box_mailbox_edit.htm", 'fields' => array ( ################################## # Begin Datatable fields ################################## + 'server_id' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), 'email' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'email_error_empty'), + 'validators' => array ( 0 => array ( 'type' => 'ISEMAIL', + 'errmsg'=> 'email_error_isemail'), 1 => array ( 'type' => 'UNIQUE', 'errmsg'=> 'email_error_unique'), ), @@ -74,6 +82,7 @@ 'cryptpwd' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'PASSWORD', + 'encryption'=> 'CRYPT', 'default' => '', 'value' => '', 'width' => '30', @@ -91,5 +100,33 @@ ) ); +$form["tabs"]['autoresponder'] = array ( + 'title' => "Autoresponder", + 'width' => 100, + 'template' => "templates/mail_box_autoresponder_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'autoresponder_text' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'cols' => '30', + 'rows' => '15' + ), + 'autoresponder' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'CHECKBOX', + 'default' => '1', + 'value' => '1' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + ?> \ No newline at end of file diff --git a/interface/web/sites/lib/lang/en_mail_box.lng b/interface/web/sites/lib/lang/en_mail_box.lng new file mode 100644 index 0000000..ff001ff --- /dev/null +++ b/interface/web/sites/lib/lang/en_mail_box.lng @@ -0,0 +1,13 @@ +<?php +$wb["email_txt"] = 'Email'; +$wb["cryptpwd_txt"] = 'Password'; +$wb["active_txt"] = 'Active'; +$wb["btn_save_txt"] = 'Save'; +$wb["btn_cancel_txt"] = 'Cancel'; +$wb["email_error_isemail"] = 'Emailaddress is empty.'; +$wb["email_error_unique"] = 'Duplicate Emailaddress.'; +$wb["autoresponder_text_txt"] = 'Text'; +$wb["autoresponder_txt"] = 'Autoresponder'; +$wb["no_domain_perm"] = "You have no permission for this domain."; +$wb["error_no_pwd"] = "Password is empty."; +?> \ No newline at end of file diff --git a/interface/web/sites/lib/lang/en_mail_box_list.lng b/interface/web/sites/lib/lang/en_mail_box_list.lng new file mode 100644 index 0000000..f0ecd36 --- /dev/null +++ b/interface/web/sites/lib/lang/en_mail_box_list.lng @@ -0,0 +1,12 @@ +<?php +$wb["list_head_txt"] = 'Mailbox'; +$wb["email_txt"] = 'Email'; +$wb["autoresponder_txt"] = 'Autoresponder'; +$wb["page_txt"] = 'Page'; +$wb["page_of_txt"] = 'of'; +$wb["page_next_txt"] = 'Next'; +$wb["page_back_txt"] = 'Back'; +$wb["delete_txt"] = 'Delete'; +$wb["filter_txt"] = 'Filter'; +$wb["add_new_record_txt"] = 'Add new Mailbox'; +?> \ No newline at end of file diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php index b307229..5a06587 100644 --- a/interface/web/sites/lib/module.conf.php +++ b/interface/web/sites/lib/module.conf.php @@ -36,7 +36,7 @@ array ( 'title' => 'Email Mailbox', 'target' => 'content', - 'link' => '', + 'link' => 'sites/mail_box_list.php', ), 4 => array ( diff --git a/interface/web/sites/list/mail_box.list.php b/interface/web/sites/list/mail_box.list.php new file mode 100644 index 0000000..d15d321 --- /dev/null +++ b/interface/web/sites/list/mail_box.list.php @@ -0,0 +1,69 @@ +<?php + +/* + Datatypes: + - INTEGER + - DOUBLE + - CURRENCY + - VARCHAR + - TEXT + - DATE +*/ + + + +// Name of the list +$liste["name"] = "mail_box"; + +// Database table +$liste["table"] = "mail_box"; + +// Index index field of the database table +$liste["table_idx"] = "mailbox_id"; + +// Search Field Prefix +$liste["search_prefix"] = "search_"; + +// Records per page +$liste["records_per_page"] = 15; + +// Script File of the list +$liste["file"] = "mail_box_list.php"; + +// Script file of the edit form +$liste["edit_file"] = "mail_box_edit.php"; + +// Script File of the delete script +$liste["delete_file"] = "mail_box_del.php"; + +// Paging Template +$liste["paging_tpl"] = "templates/paging.tpl.htm"; + +// Enable auth +$liste["auth"] = "yes"; + + +/***************************************************** +* Suchfelder +*****************************************************/ + +$liste["item"][] = array( 'field' => "email", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "autoresponder", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + + +?> \ No newline at end of file diff --git a/interface/web/sites/mail_box_del.php b/interface/web/sites/mail_box_del.php new file mode 100644 index 0000000..9c50e11 --- /dev/null +++ b/interface/web/sites/mail_box_del.php @@ -0,0 +1,54 @@ +<?php + +/* +Copyright (c) 2005, Till Brehm, projektfarm Gmbh +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/mail_box.list.php"; +$tform_def_file = "form/mail_box.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +// Checke Berechtigungen f�r Modul +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +$app->uses("tform_actions"); +$app->tform_actions->onDelete(); + +?> \ No newline at end of file diff --git a/interface/web/sites/mail_box_edit.php b/interface/web/sites/mail_box_edit.php new file mode 100644 index 0000000..715964f --- /dev/null +++ b/interface/web/sites/mail_box_edit.php @@ -0,0 +1,104 @@ +<?php +/* +Copyright (c) 2005, Till Brehm, projektfarm Gmbh +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +/****************************************** +* Begin Form configuration +******************************************/ + +$tform_def_file = "form/mail_box.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +// Checking module permissions +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onShowEnd() { + global $app, $conf; + + $email = $this->dataRecord["email"]; + $email_parts = explode("@",$email); + $app->tpl->setVar("email_local_part",$email_parts[0]); + + // Getting Domains of the user + $sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r'); + $domains = $app->db->queryAllRecords($sql); + $domain_select = ''; + foreach( $domains as $domain) { + $selected = ($domain["domain"] == $email_parts[1])?'SELECTED':''; + $domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n"; + } + $app->tpl->setVar("email_domain",$domain_select); + + parent::onShowEnd(); + } + + function onSubmit() { + global $app, $conf; + + // Check if Domain belongs to user + $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r')); + if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"]; + + // if its an insert, check for password + if($this->id == 0 and $_POST["cryptpwd"] == '') { + $app->tform->errorMessage .= $app->tform->wordbook["error_no_pwd"]."<br>"; + } + + // compose the email field + $this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"]; + // Set the server id of the mailbox = server ID of mail domain. + $this->dataRecord["server_id"] = $domain["server_id"]; + + unset($this->dataRecord["email_local_part"]); + unset($this->dataRecord["email_domain"]); + + parent::onSubmit(); + } + +} + +$page = new page_action; +$page->onLoad(); + +?> \ No newline at end of file diff --git a/interface/web/sites/mail_box_list.php b/interface/web/sites/mail_box_list.php new file mode 100644 index 0000000..ae55a7a --- /dev/null +++ b/interface/web/sites/mail_box_list.php @@ -0,0 +1,26 @@ +<?php +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/mail_box.list.php"; + +/****************************************** +* End Form configuration +******************************************/ + +// Checking module permissions +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +$app->uses('listform_actions'); + +$app->listform_actions->onLoad(); + + +?> \ No newline at end of file diff --git a/interface/web/sites/templates/mail_box_autoresponder_edit.htm b/interface/web/sites/templates/mail_box_autoresponder_edit.htm new file mode 100644 index 0000000..9769d04 --- /dev/null +++ b/interface/web/sites/templates/mail_box_autoresponder_edit.htm @@ -0,0 +1,21 @@ +<table width="500" border="0" cellspacing="0" cellpadding="2"> + <tr> + <td width="126" class="frmText11">{tmpl_var name='autoresponder_txt'}:</td> + <td width="366" class="frmText11">{tmpl_var name='autoresponder'}</td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='autoresponder_text_txt'}:</td> + <td width="366" class="frmText11"><textarea name='autoresponder_text' cols='30' rows='15'>{tmpl_var name='autoresponder_text'}</textarea></td> + </tr> + <tr> + <td class="frmText11"> </td> + <td class="frmText11"> </td> + </tr> + <tr> + <td> </td> + <td><input name="btn_save" type="submit" class="button" value="{tmpl_var name='btn_save_txt'}"> + <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="self.location.href='mail_box_list.php';"> + </td> + </tr> +</table> +<input type="hidden" name="id" value="{tmpl_var name='id'}"> \ No newline at end of file diff --git a/interface/web/sites/templates/mail_box_list.htm b/interface/web/sites/templates/mail_box_list.htm new file mode 100644 index 0000000..36987ec --- /dev/null +++ b/interface/web/sites/templates/mail_box_list.htm @@ -0,0 +1,27 @@ +<form name="myform" action="mail_box_list.php" method="POST"> +<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br /> +<input type="button" value="{tmpl_var name="add_new_record_txt"}" onClick="location.href='mail_box_edit.php'" /><br /><br /> +<table width="100%" border="0" cellspacing="0" cellpadding="4"> + <tr> + <td class="tblHead"><tmpl_var name="email_txt"></td> + <td class="tblHead"><tmpl_var name="autoresponder_txt"></td> + <td class="tblHead"> </td> + </tr> + <tr> + <td class="frmText11"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_autoresponder" value="{tmpl_var name='search_autoresponder'}" class="text" /></td> + <td class="frmText11" align="right"><input name="Filter" type="submit" id="Filter" value="{tmpl_var name="filter_txt"}"></td> + </tr> + <tmpl_loop name="records"> + <tr bgcolor="{tmpl_var name="bgcolor"}"> + <td class="frmText11"><a href="mail_box_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="email"}</a></td> + <td class="frmText11"><a href="mail_box_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="autoresponder"}</a></td> + <td class="frmText11" align="right">[<a href="javascript: del_record('mail_box_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td> + </tr> + </tmpl_loop> + + <tr> + <td colspan="3" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td> + </tr> +</table> +</form> \ No newline at end of file diff --git a/interface/web/sites/templates/mail_box_mailbox_edit.htm b/interface/web/sites/templates/mail_box_mailbox_edit.htm new file mode 100644 index 0000000..1466e17 --- /dev/null +++ b/interface/web/sites/templates/mail_box_mailbox_edit.htm @@ -0,0 +1,24 @@ +<table width="500" border="0" cellspacing="0" cellpadding="2"> + <tr> + <td width="126" class="frmText11">{tmpl_var name='email_txt'}:</td> + <td width="366" class="frmText11"><input name="email_local_part" type="text" class="text" value="{tmpl_var name='email_local_part'}" size="10" maxlength="50"> @ <select name="email_domain">{tmpl_var name="email_domain"}</select></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='cryptpwd_txt'}:</td> + <td width="366" class="frmText11"><input name="cryptpwd" type="password" class="text" value="{tmpl_var name='cryptpwd'}" size="25" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='active_txt'}:</td> + <td width="366" class="frmText11">{tmpl_var name='active'}</td> + </tr> <tr> + <td class="frmText11"> </td> + <td class="frmText11"> </td> + </tr> + <tr> + <td> </td> + <td><input name="btn_save" type="submit" class="button" value="{tmpl_var name='btn_save_txt'}"> + <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="self.location.href='mail_box_list.php';"> + </td> + </tr> +</table> +<input type="hidden" name="id" value="{tmpl_var name='id'}"> \ No newline at end of file diff --git a/interface/web/themes/default/style.css b/interface/web/themes/default/style.css index b8fd5af..f7e8c93 100644 --- a/interface/web/themes/default/style.css +++ b/interface/web/themes/default/style.css @@ -152,7 +152,7 @@ .frmTextHead { font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; - font-size: 14px; + font-size: 20px; color: #496FA8; text-decoration: none; -- Gitblit v1.9.1