Skip to content

Commit dd0fc92

Browse files
committed
Added Domain Alias in email Module.
1 parent 22e3a39 commit dd0fc92

File tree

9 files changed

+374
-3
lines changed

9 files changed

+374
-3
lines changed

interface/lib/classes/listform_actions.inc.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class listform_actions {
4040
var $id;
4141
var $idx_key;
4242
var $DataRowColor;
43+
var $SQLExtWhere = '';
4344

4445
function onLoad() {
4546
global $app, $conf, $list_def_file;
@@ -98,9 +99,9 @@ function getQueryString() {
9899
// Generate the search sql
99100
if($app->listform->listDef["auth"] != 'no') {
100101
if($_SESSION["s"]["user"]["typ"] == "admin") {
101-
$sql_where = "";
102+
$sql_where = $this->SQLExtWhere;
102103
} else {
103-
$sql_where = $app->tform->getAuthSQL('r')." and";
104+
$sql_where = $this->SQLExtWhere ." ". $app->tform->getAuthSQL('r')." and";
104105
}
105106
}
106107

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?php
2+
3+
/*
4+
Form Definition
5+
6+
Tabledefinition
7+
8+
Datatypes:
9+
- INTEGER (Forces the input to Int)
10+
- DOUBLE
11+
- CURRENCY (Formats the values to currency notation)
12+
- VARCHAR (no format check, maxlength: 255)
13+
- TEXT (no format check)
14+
- DATE (Dateformat, automatic conversion to timestamps)
15+
16+
Formtype:
17+
- TEXT (Textfield)
18+
- TEXTAREA (Textarea)
19+
- PASSWORD (Password textfield, input is not shown when edited)
20+
- SELECT (Select option field)
21+
- RADIO
22+
- CHECKBOX
23+
- CHECKBOXARRAY
24+
- FILE
25+
26+
VALUE:
27+
- Wert oder Array
28+
29+
Hint:
30+
The ID field of the database table is not part of the datafield definition.
31+
The ID field must be always auto incement (int or bigint).
32+
33+
34+
*/
35+
36+
$form["title"] = "Mail DomainAlias";
37+
$form["description"] = "";
38+
$form["name"] = "mail_domain_alias";
39+
$form["action"] = "mail_domain_alias_edit.php";
40+
$form["db_table"] = "mail_domain";
41+
$form["db_table_idx"] = "domain_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "domain";
44+
$form["list_default"] = "mail_domain_alias_list.php";
45+
$form["auth"] = 'no';
46+
47+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
48+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
49+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
50+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
51+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
52+
53+
$form["tabs"]['domain'] = array (
54+
'title' => "Domain",
55+
'width' => 100,
56+
'template' => "templates/mail_domain_alias_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'server_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'SELECT',
64+
'default' => '',
65+
'datasource' => array ( 'type' => 'SQL',
66+
'querystring' => 'SELECT server_id,server_name FROM server WHERE 1 ORDER BY server_name',
67+
'keyfield'=> 'server_id',
68+
'valuefield'=> 'server_name'
69+
),
70+
'value' => ''
71+
),
72+
'domain' => array (
73+
'datatype' => 'VARCHAR',
74+
'formtype' => 'TEXT',
75+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
76+
'errmsg'=> 'domain_error_empty'),
77+
1 => array ( 'type' => 'UNIQUE',
78+
'errmsg'=> 'domain_error_unique'),
79+
),
80+
'default' => '',
81+
'value' => '',
82+
'width' => '30',
83+
'maxlength' => '255'
84+
),
85+
'destination' => array (
86+
'datatype' => 'VARCHAR',
87+
'formtype' => 'TEXT',
88+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
89+
'errmsg'=> 'destination_error_empty'),
90+
1 => array ( 'type' => 'UNIQUE',
91+
'errmsg'=> 'destination_error_unique'),
92+
),
93+
'default' => '',
94+
'value' => '',
95+
'width' => '30',
96+
'maxlength' => '255'
97+
),
98+
'type' => array (
99+
'datatype' => 'VARCHAR',
100+
'formtype' => 'SELECT',
101+
'default' => '',
102+
'value' => array('alias' => 'alias','local' => 'local','relay'=>'relay','manual_relay'=>'manual Relay')
103+
),
104+
'active' => array (
105+
'datatype' => 'INTEGER',
106+
'formtype' => 'CHECKBOX',
107+
'default' => '1',
108+
'value' => '1'
109+
),
110+
##################################
111+
# ENDE Datatable fields
112+
##################################
113+
)
114+
);
115+
116+
117+
?>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
$wb["list_head_txt"] = 'mail_domain_alias';
3+
$wb["server_id_txt"] = 'server_id';
4+
$wb["domain_txt"] = 'domain';
5+
$wb["destination_txt"] = 'destination';
6+
$wb["page_txt"] = 'Page';
7+
$wb["page_of_txt"] = 'of';
8+
$wb["page_next_txt"] = 'Next';
9+
$wb["page_back_txt"] = 'Back';
10+
$wb["delete_txt"] = 'Delete';
11+
$wb["filter_txt"] = 'Filter';
12+
?>

interface/web/sites/lib/module.conf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
array (
2525
'title' => 'Domain Alias',
2626
'target' => 'content',
27-
'link' => '',
27+
'link' => 'sites/mail_domain_alias_list.php',
2828
),
2929
2 =>
3030
array (
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
3+
/*
4+
Datatypes:
5+
- INTEGER
6+
- DOUBLE
7+
- CURRENCY
8+
- VARCHAR
9+
- TEXT
10+
- DATE
11+
*/
12+
13+
14+
15+
// Name of the list
16+
$liste["name"] = "mail_domain_alias";
17+
18+
// Database table
19+
$liste["table"] = "mail_domain";
20+
21+
// Index index field of the database table
22+
$liste["table_idx"] = "domain_id";
23+
24+
// Search Field Prefix
25+
$liste["search_prefix"] = "search_";
26+
27+
// Records per page
28+
$liste["records_per_page"] = 15;
29+
30+
// Script File of the list
31+
$liste["file"] = "mail_domain_alias_list.php";
32+
33+
// Script file of the edit form
34+
$liste["edit_file"] = "mail_domain_alias_edit.php";
35+
36+
// Script File of the delete script
37+
$liste["delete_file"] = "mail_domain_alias_del.php";
38+
39+
// Paging Template
40+
$liste["paging_tpl"] = "templates/paging.tpl.htm";
41+
42+
// Enable auth
43+
$liste["auth"] = "yes";
44+
45+
46+
/*****************************************************
47+
* Suchfelder
48+
*****************************************************/
49+
50+
$liste["item"][] = array( 'field' => "server_id",
51+
'datatype' => "VARCHAR",
52+
'formtype' => "TEXT",
53+
'op' => "like",
54+
'prefix' => "%",
55+
'suffix' => "%",
56+
'width' => "",
57+
'value' => "");
58+
59+
$liste["item"][] = array( 'field' => "domain",
60+
'datatype' => "VARCHAR",
61+
'formtype' => "TEXT",
62+
'op' => "like",
63+
'prefix' => "%",
64+
'suffix' => "%",
65+
'width' => "",
66+
'value' => "");
67+
68+
$liste["item"][] = array( 'field' => "destination",
69+
'datatype' => "VARCHAR",
70+
'formtype' => "TEXT",
71+
'op' => "like",
72+
'prefix' => "%",
73+
'suffix' => "%",
74+
'width' => "",
75+
'value' => "");
76+
77+
?>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
* Neither the name of ISPConfig nor the names of its contributors
16+
may be used to endorse or promote products derived from this software without
17+
specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
/******************************************
32+
* Begin Form configuration
33+
******************************************/
34+
35+
$list_def_file = "list/mail_domain_alias.list.php";
36+
$tform_def_file = "form/mail_domain_alias.tform.php";
37+
38+
/******************************************
39+
* End Form configuration
40+
******************************************/
41+
42+
require_once('../../lib/config.inc.php');
43+
require_once('../../lib/app.inc.php');
44+
45+
// Checke Berechtigungen für Modul
46+
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
47+
header("Location: ../index.php");
48+
exit;
49+
}
50+
51+
$app->uses("tform_actions");
52+
$app->tform_actions->onDelete();
53+
54+
?>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/*
3+
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification,
7+
are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
* Neither the name of ISPConfig nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
31+
/******************************************
32+
* Begin Form configuration
33+
******************************************/
34+
35+
$tform_def_file = "form/mail_domain_alias.tform.php";
36+
37+
/******************************************
38+
* End Form configuration
39+
******************************************/
40+
41+
require_once('../../lib/config.inc.php');
42+
require_once('../../lib/app.inc.php');
43+
44+
// Checking module permissions
45+
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
46+
header("Location: ../index.php");
47+
exit;
48+
}
49+
50+
// Loading classes
51+
$app->uses('tpl,tform,tform_actions');
52+
53+
// let tform_actions handle the page
54+
$app->tform_actions->onLoad();
55+
56+
?>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
require_once('../../lib/config.inc.php');
3+
require_once('../../lib/app.inc.php');
4+
5+
/******************************************
6+
* Begin Form configuration
7+
******************************************/
8+
9+
$list_def_file = "list/mail_domain_alias.list.php";
10+
11+
/******************************************
12+
* End Form configuration
13+
******************************************/
14+
15+
// Checking module permissions
16+
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
17+
header("Location: ../index.php");
18+
exit;
19+
}
20+
21+
$app->uses('listform_actions');
22+
$app->listform_actions->onLoad();
23+
24+
25+
?>

0 commit comments

Comments
 (0)