Commit 348aef79 authored by tbrehm's avatar tbrehm
Browse files

added mail_box

parent 0ff9abf4
......@@ -101,7 +101,7 @@ class tform {
* der Variablen mit Regex
* @var errorMessage
*/
var $errorMessage;
var $errorMessage = '';
var $dateformat = "d.m.Y";
var $formDef;
......@@ -456,7 +456,7 @@ class tform {
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 @@ class tform {
$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 @@ class tform {
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 @@ class tform {
} 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;
}
......
......@@ -71,6 +71,7 @@ class tform_actions {
$this->id = intval($_REQUEST["id"]);
if(count($_POST) > 1) {
$this->dataRecord = $_POST;
$this->onSubmit();
} else {
$this->onShow();
......@@ -84,8 +85,6 @@ class tform_actions {
function onSubmit() {
global $app, $conf;
$this->dataRecord = $_POST;
// Calling the action functions
if($this->id > 0) {
$this->onUpdate();
......
......@@ -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 fr 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 @@ CREATE TABLE mail_blacklist (
# Tabellenstruktur fr 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 @@ CREATE TABLE mail_box (
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 @@ CREATE TABLE mail_box (
# Daten fr 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 fr 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 @@ INSERT INTO mail_domain VALUES (2, 1, 0, 'riud', 'riud', '', 1, 'test2.de', 'ali
# Tabellenstruktur fr 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 @@ CREATE TABLE mail_domain_catchall (
# Tabellenstruktur fr 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 @@ CREATE TABLE mail_greylist (
# Tabellenstruktur fr 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 @@ CREATE TABLE mail_mailman_domain (
# Tabellenstruktur fr 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 @@ CREATE TABLE mail_redirect (
# Tabellenstruktur fr 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 @@ CREATE TABLE mail_whitelist (
# Tabellenstruktur fr 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 @@ CREATE TABLE reseller (
# Tabellenstruktur fr 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 @@ INSERT INTO server VALUES (1, 1, 1, 'riud', 'riud', '', 'Server 1', 1, 0, 0, 0,
# Tabellenstruktur fr 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 @@ CREATE TABLE sys_datalog (
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 fr 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 @@ CREATE TABLE sys_dbsync (
# Tabellenstruktur fr 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 @@ CREATE TABLE sys_filesync (
# Tabellenstruktur fr 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 @@ INSERT INTO sys_group VALUES (2, 'user', 'Users Group');
# Tabellenstruktur fr 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',
......
......@@ -53,16 +53,24 @@ $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d =
$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 @@ $form["tabs"]['mailbox'] = array (
'cryptpwd' => array (
'datatype' => 'VARCHAR',
'formtype' => 'PASSWORD',
'encryption'=> 'CRYPT',
'default' => '',
'value' => '',
'width' => '30',
......@@ -91,5 +100,33 @@ $form["tabs"]['mailbox'] = array (
)
);
$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
<?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
<?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
......@@ -36,7 +36,7 @@ $module = array (
array (
'title' => 'Email Mailbox',
'target' => 'content',
'link' => '',
'link' => 'sites/mail_box_list.php',
),
4 =>
array (
......
<?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
<?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
<?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