Commit 83b0d0f0 authored by tbrehm's avatar tbrehm
Browse files

Added mail domains

parent 336a577f
......@@ -50,6 +50,11 @@ class listform_actions {
// Load list definition
$app->listform->loadListDef($list_def_file);
if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm')) {
$app->uses('listform_tpl_generator');
$app->listform_tpl_generator->buildHTML($app->listform->listDef);
}
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setInclude('content_tpl','templates/'.$app->listform->listDef["name"].'_list.htm');
......
......@@ -218,6 +218,7 @@ class tform {
// Getting the records
$tmp_records = $app->db->queryAllRecords($querystring);
if($app->db->errorMessage != '') die($app->db->errorMessage);
if(is_array($tmp_records)) {
$key_field = $field["datasource"]["keyfield"];
$value_field = $field["datasource"]["valuefield"];
......@@ -240,6 +241,8 @@ class tform {
}
}
return $values;
}
......@@ -354,6 +357,12 @@ class tform {
} else {
// Action: NEW
foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
// If Datasource is set, get the data from there
if(is_array($field['datasource'])) {
$field["value"] = $this->getDatasourceData($field, $record);
}
switch ($field['formtype']) {
case 'SELECT':
if(is_array($field['value'])) {
......
......@@ -105,6 +105,7 @@ class tform_actions {
$sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'UPDATE',$this->id,$ext_where);
if($app->tform->errorMessage == '') {
$app->db->query($sql);
if($app->db->errorMessage != '') die($app->db->errorMessage);
// Call plugin
foreach($this->plugins as $plugin) {
......@@ -133,6 +134,7 @@ class tform_actions {
$sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'INSERT',$this->id,$ext_where);
if($app->tform->errorMessage == '') {
$app->db->query($sql);
if($app->db->errorMessage != '') die($app->db->errorMessage);
$this->id = $app->db->insertID();
// Call plugin
......
ALTER TABLE `mail_domain` ADD `sys_userid` INT NOT NULL AFTER `domain_id` ,
ADD `sys_groupid` INT NOT NULL AFTER `sys_userid` ,
ADD `sys_perm_user` VARCHAR( 5 ) NOT NULL AFTER `sys_groupid` ,
ADD `sys_perm_group` VARCHAR( 5 ) NOT NULL AFTER `sys_perm_user` ,
ADD `sys_perm_other` VARCHAR( 5 ) NOT NULL AFTER `sys_perm_group` ;
\ No newline at end of file
......@@ -3,7 +3,7 @@
# http://www.phpmyadmin.net/ (download page)
#
# Host: localhost
# Erstellungszeit: 01. November 2005 um 23:57
# Erstellungszeit: 09. November 2005 um 23:22
# Server Version: 4.0.23
# PHP-Version: 5.0.3
# Datenbank: `ispconfig3`
......@@ -35,10 +35,17 @@ CREATE TABLE mail_blacklist (
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',
sys_groupid int(11) NOT NULL default '0',
sys_perm_user varchar(5) NOT NULL default '',
sys_perm_group varchar(5) NOT NULL default '',
sys_perm_other varchar(5) NOT NULL default '',
server_id int(11) NOT NULL default '0',
domain varchar(255) NOT NULL default '',
type enum('local','relay','manual_relay') NOT NULL default 'local',
type enum('local','relay','manual_relay','alias') NOT NULL default 'local',
relay_host varchar(255) NOT NULL default '',
destination varchar(255) NOT NULL default '',
active tinyint(4) NOT NULL default '1',
PRIMARY KEY (domain_id),
KEY server_id (server_id,domain,type)
) TYPE=MyISAM;
......@@ -47,6 +54,7 @@ CREATE TABLE mail_domain (
# Daten fr Tabelle `mail_domain`
#
INSERT INTO mail_domain VALUES (1, 1, 0, 'riud', 'riud', '', 1, 'test.de', 'local', '', '', 1);
# --------------------------------------------------------
#
......@@ -399,5 +407,5 @@ CREATE TABLE sys_user (
# Daten fr Tabelle `sys_user`
#
INSERT INTO sys_user VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin,clients,designer,resellers,sites', 'admin', 'default', 'admin', 1, '', 'Administrator', '', '', '', '', '', '', '', '', '', 'en', '1,2', 0);
INSERT INTO sys_user VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin,designer,sites', 'admin', 'default', 'admin', 1, '', 'Administrator', '', '', '', '', '', '', '', '', '', 'en', '1,2', 0);
<?php
$wb["list_head_txt"] = 'Server';
$wb["server_name_txt"] = 'Name';
$wb["mail_server_txt"] = 'Mail';
$wb["web_server_txt"] = 'Web';
$wb["dns_server_txt"] = 'DNS';
$wb["file_server_txt"] = 'File';
$wb["mysql_server_txt"] = 'MySQL';
$wb["postgresql_server_txt"] = 'PostgreSQL';
$wb["firebird_server_txt"] = 'Firebird';
$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';
?>
\ No newline at end of file
......@@ -16,7 +16,7 @@ $items[] = array( 'title' => "Edit user",
'link' => 'admin/users_list.php');
$module["nav"][] = array( 'title' => 'Users',
$module["nav"][] = array( 'title' => 'CP Users',
'open' => 1,
'items' => $items);
......
<?php
/*
Datatypes:
- INTEGER
- DOUBLE
- CURRENCY
- VARCHAR
- TEXT
- DATE
*/
// Name of the list
$liste["name"] = "server";
// Database table
$liste["table"] = "server";
// Index index field of the database table
$liste["table_idx"] = "server_id";
// Search Field Prefix
$liste["search_prefix"] = "search_";
// Records per page
$liste["records_per_page"] = 15;
// Script File of the list
$liste["file"] = "server_list.php";
// Script file of the edit form
$liste["edit_file"] = "server_edit.php";
// Script File of the delete script
$liste["delete_file"] = "server_del.php";
// Paging Template
$liste["paging_tpl"] = "templates/paging.tpl.htm";
// Enable authe
$liste["auth"] = "yes";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array( 'field' => "server_name",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "mail_server",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "web_server",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "dns_server",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "file_server",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "mysql_server",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "postgresql_server",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "firebird_server",
'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/server.list.php";
$tform_def_file = "form/server.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.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/server.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
<form name="myform" action="server_list.php" method="POST">
<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td class="tblHead"><tmpl_var name="server_name_txt"></td>
<td class="tblHead"><tmpl_var name="mail_server_txt"></td>
<td class="tblHead"><tmpl_var name="web_server_txt"></td>
<td class="tblHead"><tmpl_var name="dns_server_txt"></td>
<td class="tblHead"><tmpl_var name="file_server_txt"></td>
<td class="tblHead"><tmpl_var name="mysql_server_txt"></td>
<td class="tblHead"><tmpl_var name="postgresql_server_txt"></td>
<td class="tblHead"><tmpl_var name="firebird_server_txt"></td>
<td class="tblHead">&nbsp;</td>
</tr>
<tr>
<td class="frmText11"><input type="text" name="search_server_name" value="{tmpl_var name='search_server_name'}" class="text" /></td>
<td class="frmText11"><input type="text" name="search_mail_server" value="{tmpl_var name='search_mail_server'}" class="text" size="2" /></td>
<td class="frmText11"><input type="text" name="search_web_server" value="{tmpl_var name='search_web_server'}" class="text" size="2" /></td>
<td class="frmText11"><input type="text" name="search_dns_server" value="{tmpl_var name='search_dns_server'}" class="text" size="2" /></td>
<td class="frmText11"><input type="text" name="search_file_server" value="{tmpl_var name='search_file_server'}" class="text" size="2" /></td>
<td class="frmText11"><input type="text" name="search_mysql_server" value="{tmpl_var name='search_mysql_server'}" class="text" size="2" /></td>
<td class="frmText11"><input type="text" name="search_postgresql_server" value="{tmpl_var name='search_postgresql_server'}" class="text" size="2" /></td>
<td class="frmText11"><input type="text" name="search_firebird_server" value="{tmpl_var name='search_firebird_server'}" class="text" size="2" /></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="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_name"}</a></td>
<td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="mail_server"}</a></td>
<td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="web_server"}</a></td>
<td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="dns_server"}</a></td>
<td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="file_server"}</a></td>
<td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="mysql_server"}</a></td>
<td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="postgresql_server"}</a></td>
<td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="firebird_server"}</a></td>
<td class="frmText11" align="right">[<a href="javascript: del_record('server_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="9" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
</tr>
</table>
</form>
\ No newline at end of file
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "Mail Domain";
$form["description"] = "";
$form["name"] = "mail_domain";
$form["action"] = "mail_domain_edit.php";
$form["db_table"] = "mail_domain";
$form["db_table_idx"] = "domain_id";
$form["db_history"] = "yes";
$form["tab_default"] = "domain";
$form["list_default"] = "mail_domain_list.php";
$form["auth"] = 'no';
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['domain'] = array (
'title' => "Domain",
'width' => 100,
'template' => "templates/mail_domain_edit.htm",
'fields' => array (
##################################
# Begin Datatable fields
##################################
'server_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'datasource' => array ( 'type' => 'SQL',
'querystring' => 'SELECT server_id,server_name FROM server WHERE 1 ORDER BY server_name',
'keyfield'=> 'server_id',
'valuefield'=> 'server_name'
),
'value' => ''
),
'domain' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'domain_error_empty'),
1 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'domain_error_unique'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'type' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
'value' => array('local' => 'local','relay'=>'relay','manual_relay'=>'manual Relay')
),
'active' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'default' => '1',
'value' => '1'
),
##################################
# ENDE Datatable fields
##################################
)
);
?>
\ No newline at end of file
<?php
$wb["server_id_txt"] = 'Server';
$wb["domain_txt"] = 'Domain';
$wb["type_txt"] = 'Type';
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
?>
\ No newline at end of file
<?php
$wb["list_head_txt"] = 'Email Domains';
$wb["server_id_txt"] = 'Server';
$wb["domain_txt"] = 'Domain';
$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';
?>
\ No newline at end of file
......@@ -6,6 +6,66 @@ $module = array (
'navframe_page' => '',
'startpage' => 'sites/index.php',
'tab_width' => '',
'nav' => NULL,
'nav' =>
array (
0 =>
array (
'title' => 'Email Accounts',
'open' => 1,
'items' =>
array (
0 =>
array (
'title' => 'Domain',
'target' => 'content',
'link' => 'sites/mail_domain_list.php',
),
1 =>
array (
'title' => 'Domain Alias',
'target' => 'content',
'link' => '',
),
2 =>
array (
'title' => 'Email Mailbox',
'target' => 'content',
'link' => '',
),
3 =>
array (
'title' => 'Email Forward',
'target' => 'content',
'link' => '',
),
4 =>
array (
'title' => 'Domain Catchall',
'target' => 'content',
'link' => '',
),
),
),
1 =>
array (
'title' => 'Email Filter',
'open' => 1,
'items' =>
array (
0 =>
array (
'title' => 'Email Whitelist',
'target' => 'content'