diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index f9ad1ecdce63bac613c99b4165b638b831cb8aff..81810b9cfc3bfd591dc339231d910c8db9e09b6a 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -760,7 +760,7 @@ class tform {
} else {
if($primary_id != 0) {
$sql_update = substr($sql_update,0,-2);
- $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+ $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->getAuthSQL('u')." AND ".$this->formDef['db_table_idx']." = ".$primary_id;
if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
} else {
$app->error("Primary ID fehlt!");
@@ -796,20 +796,21 @@ class tform {
// definiere Tabs
foreach( $this->formDef["tabs"] as $key => $tab) {
- $tab['name'] = $key;
+ $tab['name'] = $key;
if($tab['name'] == $active_tab) {
- // Wenn Modul gesetzt, dann setzte template pfad relativ zu modul.
- if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
+ // Wenn Modul gesetzt, dann setzte template pfad relativ zu modul.
+ if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
- // überprüfe, ob das Template existiert, wenn nicht
- // dann generiere das Template
- if(!is_file($tab["template"])) {
- $app->uses('tform_tpl_generator');
- $app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
- }
+ // überprüfe, ob das Template existiert, wenn nicht
+ // dann generiere das Template
+
+ if(!is_file($tab["template"])) {
+ $app->uses('tform_tpl_generator');
+ $app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
+ }
- $app->tpl->setInclude('content_tpl',$tab["template"]);
+ $app->tpl->setInclude('content_tpl',$tab["template"]);
$tab["active"] = 1;
$_SESSION["s"]["form"]["tab"] = $tab['name'];
} else {
diff --git a/interface/web/admin/form/server_ip.tform.php b/interface/web/admin/form/server_ip.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..b54a3f1b03d55dd9cdf74b00b30da159d9da47d4
--- /dev/null
+++ b/interface/web/admin/form/server_ip.tform.php
@@ -0,0 +1,128 @@
+ 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"]['server_ip'] = array (
+ 'title' => "IP Address",
+ 'width' => 80,
+ 'template' => "templates/server_ip_edit.htm",
+ 'fields' => array (
+ ##################################
+ # Beginn Datenbankfelder
+ ##################################
+ 'server_id' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+ 'keyfield'=> 'server_id',
+ 'valuefield'=> 'server_name'
+ ),
+ 'value' => ''
+ ),
+ 'ip_address' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'ip_error_empty'),
+ 1 => array ( 'type' => 'UNIQUE',
+ 'errmsg'=> 'ip_error_unique'),
+ 2 => array ( 'type' => 'REGEX',
+ 'regex' => '/^[0-9\.]{7,15}$/',
+ 'errmsg'=> 'ip_err'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'separator' => '',
+ 'width' => '15',
+ 'maxlength' => '15',
+ 'rows' => '',
+ 'cols' => ''
+ ),
+ 'virtualhost' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
+ ),
+ ##################################
+ # ENDE Datenbankfelder
+ ##################################
+ )
+);
+?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/lang/en_server_ip.lng b/interface/web/admin/lib/lang/en_server_ip.lng
new file mode 100644
index 0000000000000000000000000000000000000000..c14566e3cd4c5f1ae1566b923be14a05b6404b35
--- /dev/null
+++ b/interface/web/admin/lib/lang/en_server_ip.lng
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/interface/web/admin/lib/lang/en_server_ip_list.lng b/interface/web/admin/lib/lang/en_server_ip_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..be99ce86af1e03d06a48fe40da1bb5f5c4565673
--- /dev/null
+++ b/interface/web/admin/lib/lang/en_server_ip_list.lng
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php
index b4962b7c2fe5b15e0a8ef4a108043c80a90fad79..0471b785e4a351db5618b8e3ccf036e4b63caf4f 100644
--- a/interface/web/admin/lib/module.conf.php
+++ b/interface/web/admin/lib/module.conf.php
@@ -49,7 +49,15 @@ $items[] = array( 'title' => "Edit server",
'target' => 'content',
'link' => 'admin/server_list.php');
-
+$items[] = array( 'title' => "Add Server IP",
+ 'target' => 'content',
+ 'link' => 'admin/server_ip_edit.php');
+
+$items[] = array( 'title' => "Edit Server IP",
+ 'target' => 'content',
+ 'link' => 'admin/server_ip_list.php');
+
+
$module["nav"][] = array( 'title' => 'Servers',
'open' => 1,
'items' => $items);
diff --git a/interface/web/admin/list/server_ip.list.php b/interface/web/admin/list/server_ip.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..e8a1148870e4fa970bbfec7d11335a59d265e1a4
--- /dev/null
+++ b/interface/web/admin/list/server_ip.list.php
@@ -0,0 +1,73 @@
+ "server_id",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "SELECT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+ 'keyfield'=> 'server_id',
+ 'valuefield'=> 'server_name'
+ ),
+ 'width' => "",
+ 'value' => "");
+
+$liste["item"][] = array( 'field' => "ip_address",
+ 'datatype' => "VARCHAR",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
+ 'width' => "");
+
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/admin/server_ip_del.php b/interface/web/admin/server_ip_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..532e970051aa3ff9c6fa0398c6ba3164e84fd915
--- /dev/null
+++ b/interface/web/admin/server_ip_del.php
@@ -0,0 +1,54 @@
+uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/admin/server_ip_edit.php b/interface/web/admin/server_ip_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..48d42c05ec5ebd8a1dc864b64a8889ab741bd530
--- /dev/null
+++ b/interface/web/admin/server_ip_edit.php
@@ -0,0 +1,56 @@
+uses('tpl,tform,tform_actions');
+
+// let tform_actions handle the page
+$app->tform_actions->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/admin/server_ip_list.php b/interface/web/admin/server_ip_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..f70195344c7a162492eb2ac596387de439720876
--- /dev/null
+++ b/interface/web/admin/server_ip_list.php
@@ -0,0 +1,54 @@
+uses('listform_actions');
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/admin/templates/server_ip_edit.htm b/interface/web/admin/templates/server_ip_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..6e8ce774a7083fd9861adf03c39de2aeb9f7fafd
--- /dev/null
+++ b/interface/web/admin/templates/server_ip_edit.htm
@@ -0,0 +1,29 @@
+
+
+
{tmpl_var name='server_id_txt'}:
+
+
+
+
+
+
{tmpl_var name='ip_address_txt'}:
+
+
+
+
{tmpl_var name='virtualhost_txt'}:
+
{tmpl_var name='virtualhost'}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/admin/templates/server_ip_list.htm b/interface/web/admin/templates/server_ip_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..d6ab661b104665df308c734515b57f909c1b505f
--- /dev/null
+++ b/interface/web/admin/templates/server_ip_list.htm
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/ftp_user_edit.htm b/interface/web/sites/templates/ftp_user_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..3d3bd98d729d86fea1b9faaa235c3fffe5c5e89f
--- /dev/null
+++ b/interface/web/sites/templates/ftp_user_edit.htm
@@ -0,0 +1,44 @@
+
+
+
{tmpl_var name='server_id_txt'}:
+
+
+
+
+
+
{tmpl_var name='parent_domain_id_txt'}:
+
+
+
+
+
+
{tmpl_var name='username_txt'}:
+
+
+
+
{tmpl_var name='password_txt'}:
+
+
+
+
{tmpl_var name='quota_size_txt'}:
+
+
+
+
{tmpl_var name='active_txt'}:
+
{tmpl_var name='active'}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/ftp_user_list.htm b/interface/web/sites/templates/ftp_user_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..59b89f63c1a1b89996700d5a59b37e2d6abb026e
--- /dev/null
+++ b/interface/web/sites/templates/ftp_user_list.htm
@@ -0,0 +1,31 @@
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_aliasdomain_edit.htm b/interface/web/sites/templates/web_aliasdomain_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..215153c6b9778dc5bbbedeb57123dcd02d07c6e9
--- /dev/null
+++ b/interface/web/sites/templates/web_aliasdomain_edit.htm
@@ -0,0 +1,40 @@
+
+
+
{tmpl_var name='domain_txt'}:
+
+
+
+
{tmpl_var name='parent_domain_id_txt'}:
+
+
+
+
+
+
{tmpl_var name='redirect_type_txt'}:
+
+
+
+
+
+
{tmpl_var name='redirect_path_txt'}:
+
+
+
+
{tmpl_var name='active_txt'}:
+
{tmpl_var name='active'}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_aliasdomain_list.htm b/interface/web/sites/templates/web_aliasdomain_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..bc632bb184d3ead740dcc750c1c37b7c0bc31a58
--- /dev/null
+++ b/interface/web/sites/templates/web_aliasdomain_list.htm
@@ -0,0 +1,31 @@
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_domain_advanced.htm b/interface/web/sites/templates/web_domain_advanced.htm
new file mode 100644
index 0000000000000000000000000000000000000000..51e65268debedd18e4d1459e15ba291184076d49
--- /dev/null
+++ b/interface/web/sites/templates/web_domain_advanced.htm
@@ -0,0 +1,24 @@
+
+
+
{tmpl_var name='document_root_txt'}:
+
+
+
+
{tmpl_var name='system_user_txt'}:
+
+
+
+
{tmpl_var name='system_group_txt'}:
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_domain_edit.htm b/interface/web/sites/templates/web_domain_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..6310bd8689919a8817dc8cd86b51a4410fd28f33
--- /dev/null
+++ b/interface/web/sites/templates/web_domain_edit.htm
@@ -0,0 +1,100 @@
+
+
+
+
{tmpl_var name='server_id_txt'}:
+
+
+
+
+
+
{tmpl_var name='client_txt'}:
+
+
+
+
+
+
+
{tmpl_var name='ip_address_txt'}:
+
+
+
+
+
+
{tmpl_var name='domain_txt'}:
+
+
+
+
+
{tmpl_var name='hd_quota_txt'}:
+
MB
+
+
+
{tmpl_var name='traffic_quota_txt'}:
+
MB
+
+
+
{tmpl_var name='cgi_txt'}:
+
{tmpl_var name='cgi'}
+
+
+
{tmpl_var name='ssi_txt'}:
+
{tmpl_var name='ssi'}
+
+
+
{tmpl_var name='suexec_txt'}:
+
{tmpl_var name='suexec'}
+
+
+
{tmpl_var name='php_txt'}:
+
+
+
+
+
+
{tmpl_var name='active_txt'}:
+
{tmpl_var name='active'}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_domain_list.htm b/interface/web/sites/templates/web_domain_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..ed77d8fb312ad6c8f4290a79948412f1f3b2ee3b
--- /dev/null
+++ b/interface/web/sites/templates/web_domain_list.htm
@@ -0,0 +1,28 @@
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_domain_redirect.htm b/interface/web/sites/templates/web_domain_redirect.htm
new file mode 100644
index 0000000000000000000000000000000000000000..97000edea89bc3e618dc3855ae2d710826ae6d8e
--- /dev/null
+++ b/interface/web/sites/templates/web_domain_redirect.htm
@@ -0,0 +1,24 @@
+
+
+
{tmpl_var name='redirect_type_txt'}:
+
+
+
+
+
+
{tmpl_var name='redirect_path_txt'}:
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_subdomain_edit.htm b/interface/web/sites/templates/web_subdomain_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..794183e641eefdb91256fbaf7c0c6724d5748043
--- /dev/null
+++ b/interface/web/sites/templates/web_subdomain_edit.htm
@@ -0,0 +1,36 @@
+
+
+
{tmpl_var name='domain_txt'}:
+
+ .
+
+
+
+
{tmpl_var name='redirect_type_txt'}:
+
+
+
+
+
+
{tmpl_var name='redirect_path_txt'}:
+
+
+
+
{tmpl_var name='active_txt'}:
+
{tmpl_var name='active'}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_subdomain_list.htm b/interface/web/sites/templates/web_subdomain_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..02033c34aa830915f29b2db647df3b04338f1dba
--- /dev/null
+++ b/interface/web/sites/templates/web_subdomain_list.htm
@@ -0,0 +1,31 @@
+
\ No newline at end of file
diff --git a/interface/web/sites/web_aliasdomain_del.php b/interface/web/sites/web_aliasdomain_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..c4a600d92cc06a8154c5f398c13d2b55828a6a1a
--- /dev/null
+++ b/interface/web/sites/web_aliasdomain_del.php
@@ -0,0 +1,54 @@
+uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..e7cef105329f1ee87706e8def7733285bf9dcab6
--- /dev/null
+++ b/interface/web/sites/web_aliasdomain_edit.php
@@ -0,0 +1,91 @@
+uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ /*
+ function onShowEnd() {
+ global $app, $conf;
+
+ // Get the record of the parent domain
+ $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+
+ $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
+ $app->tpl->setVar("domain",$this->dataRecord["domain"]);
+
+ parent::onShowEnd();
+
+ }
+ */
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Get the record of the parent domain
+ $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+
+ // Set a few fixed values
+ $this->dataRecord["type"] = 'alias';
+ $this->dataRecord["server_id"] = $parent_domain["server_id"];
+ //$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+
+
+ parent::onSubmit();
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/web_aliasdomain_list.php b/interface/web/sites/web_aliasdomain_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..1cf1b6605e27022fd6daef3774758fa0c142abe9
--- /dev/null
+++ b/interface/web/sites/web_aliasdomain_list.php
@@ -0,0 +1,58 @@
+uses('listform_actions');
+
+// Limit the results to alias domains
+$app->listform_actions->SQLExtWhere = "type = 'alias'";
+
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/web_domain_del.php b/interface/web/sites/web_domain_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..27c64e662b29d4a02624fd573c9a4fce5eb5cea4
--- /dev/null
+++ b/interface/web/sites/web_domain_del.php
@@ -0,0 +1,54 @@
+uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..e912002cc55538eb764917678faa3c6874342521
--- /dev/null
+++ b/interface/web/sites/web_domain_edit.php
@@ -0,0 +1,234 @@
+uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
+
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ // Set the webserver to the default server of the client
+ $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
+ $app->tpl->setVar("server_id","");
+ unset($tmp);
+
+ // Fill the IP select field with the IP addresses that are allowed for this client
+
+ } else {
+
+ // The user is admin, so we fill in all IP addresses of the server
+ if($this->id > 0) {
+ $server_id = $this->dataRecord["server_id"];
+ } else {
+ // Get the first server ID
+ $tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
+ $server_id = $tmp['server_id'];
+ }
+
+ $sql = "SELECT ip_address FROM server_ip WHERE server_id = $server_id";
+ $ips = $app->db->queryAllRecords($sql);
+ $ip_select = "";
+ //$ip_select = "";
+ if(is_array($ips)) {
+ foreach( $ips as $ip) {
+ $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
+ $ip_select .= "\r\n";
+ }
+ }
+ $app->tpl->setVar("ip_address",$ip_select);
+ unset($tmp);
+ unset($ips);
+
+ // Fill the client select field
+ $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0";
+ $clients = $app->db->queryAllRecords($sql);
+ $client_select = "";
+ if(is_array($clients)) {
+ foreach( $clients as $client) {
+ $selected = ($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
+ $client_select .= "\r\n";
+ }
+ }
+ $app->tpl->setVar("client_group_id",$client_select);
+
+
+ }
+
+ parent::onShowEnd();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Set a few fixed values
+ $this->dataRecord["parent_domain_id"] = 0;
+ $this->dataRecord["type"] = 'vhost';
+ $this->dataRecord["vhost_type"] = 'name';
+
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
+ // Get the limits of the client
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ // When the record is updated
+ if($this->id > 0) {
+ // restore the server ID if the user is not admin and record is edited
+ $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".intval($this->id));
+ $this->dataRecord["server_id"] = $tmp["server_id"];
+ unset($tmp);
+ // When the record is inserted
+ } else {
+ // set the server ID to the default mailserver of the client
+ $this->dataRecord["server_id"] = $client["default_webserver"];
+
+ /*
+ // Check if the user may add another mail_domain
+ if($client["limit_maildomain"] >= 0) {
+ $tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE sys_groupid = $client_group_id");
+ if($tmp["number"] >= $client["limit_maildomain"]) {
+ $app->error($app->tform->wordbook["limit_webdomain_txt"]);
+ }
+ }
+ */
+ }
+
+ // Clients may not set the client_group_id, so we unset them if user is not a admin
+ unset($this->dataRecord["client_group_id"]);
+ }
+
+
+ parent::onSubmit();
+ }
+
+ function onAfterInsert() {
+ global $app, $conf;
+
+ // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
+ // also make sure that the user can not delete domain created by a admin
+ if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
+ $client_group_id = intval($this->dataRecord["client_group_id"]);
+ $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
+ }
+
+ // Get configuration for the web system
+ $app->uses("getconf");
+ $web_config = $app->getconf->get_server_config(intval($this->dataRecord["server_id"]),'web');
+ $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
+
+ // get the ID of the client
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ $client_id = intval($client["client_id"]);
+ } else {
+ $client_id = intval($this->dataRecord["client_group_id"]);
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($this->dataRecord["client_group_id"]));
+ $client_id = intval($client["client_id"]);
+ }
+
+ // Set the values for document_root, system_user and system_group
+ $system_user = 'web'.$this->id;
+ $system_group = 'client'.$client_id;
+ $document_root = str_replace("[client_id]",$client_id,$document_root);
+
+ $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+ }
+
+ function onAfterUpdate() {
+ global $app, $conf;
+
+ // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
+ // also make sure that the user can not delete domain created by a admin
+ if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
+ $client_group_id = intval($this->dataRecord["client_group_id"]);
+ $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
+ }
+
+ // Get configuration for the web system
+ $app->uses("getconf");
+ $web_config = $app->getconf->get_server_config(intval($this->dataRecord["server_id"]),'web');
+ $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
+
+ // get the ID of the client
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ $client_id = intval($client["client_id"]);
+ } else {
+ $client_id = intval($this->dataRecord["client_group_id"]);
+ $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($this->dataRecord["client_group_id"]));
+ $client_id = intval($client["client_id"]);
+ }
+
+ // Set the values for document_root, system_user and system_group
+ $system_user = 'web'.$this->id;
+ $system_group = 'client'.$client_id;
+ $document_root = str_replace("[client_id]",$client_id,$document_root);
+
+ $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root' WHERE domain_id = ".$this->id;
+ $app->db->query($sql);
+
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/web_domain_list.php b/interface/web/sites/web_domain_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..edc7e7febf6c0b109a5e61e38ee6066eb2cb4927
--- /dev/null
+++ b/interface/web/sites/web_domain_list.php
@@ -0,0 +1,58 @@
+uses('listform_actions');
+
+// Limit the results to alias domains
+// $app->listform_actions->SQLExtWhere = "type = 'local'";
+
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/web_subdomain_del.php b/interface/web/sites/web_subdomain_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..6c00c95da889461cf8ac062db2e917b33cdd76d9
--- /dev/null
+++ b/interface/web/sites/web_subdomain_del.php
@@ -0,0 +1,54 @@
+uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..e2aaca9e21798ae41eb31735ed711633d1940d08
--- /dev/null
+++ b/interface/web/sites/web_subdomain_edit.php
@@ -0,0 +1,89 @@
+uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ // Get the record of the parent domain
+ $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+
+ $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
+ $app->tpl->setVar("domain",$this->dataRecord["domain"]);
+
+ parent::onShowEnd();
+
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Get the record of the parent domain
+ $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
+
+ // Set a few fixed values
+ $this->dataRecord["type"] = 'subdomain';
+ $this->dataRecord["server_id"] = $parent_domain["server_id"];
+ $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+
+
+ parent::onSubmit();
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/web_subdomain_list.php b/interface/web/sites/web_subdomain_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..e104ace5c2bc38401162d8a8732904d81d72ec37
--- /dev/null
+++ b/interface/web/sites/web_subdomain_list.php
@@ -0,0 +1,58 @@
+uses('listform_actions');
+
+// Limit the results to alias domains
+$app->listform_actions->SQLExtWhere = "type = 'subdomain'";
+
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/server/conf/apache.conf.master b/server/conf/apache.conf.master
new file mode 100644
index 0000000000000000000000000000000000000000..16f3875596eccda6b2f67e9ecb3078477284df41
--- /dev/null
+++ b/server/conf/apache.conf.master
@@ -0,0 +1,2 @@
+
+NameVirtualHost *:80
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
new file mode 100644
index 0000000000000000000000000000000000000000..ca4aa341435446490d04554cb7655aa857490798
--- /dev/null
+++ b/server/conf/vhost.conf.master
@@ -0,0 +1,25 @@
+NameVirtualHost *:80
+
+:80>
+ DocumentRoot
+ ServerName
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/server/mods-enabled/web_module.inc.php b/server/mods-enabled/web_module.inc.php
new file mode 100644
index 0000000000000000000000000000000000000000..a32b8b5e40c8dfa4eea22691717a6045034a753f
--- /dev/null
+++ b/server/mods-enabled/web_module.inc.php
@@ -0,0 +1,86 @@
+plugins->announceEvents($this->module_name,$this->actions_available);
+
+ /*
+ As we want to get notified of any changes on several database tables,
+ we register for them.
+
+ The following function registers the function "functionname"
+ to be executed when a record for the table "dbtable" is
+ processed in the sys_datalog. "classname" is the name of the
+ class that contains the function functionname.
+ */
+
+ $app->modules->registerTableHook('web_domain','mail_module','process');
+
+ }
+
+ /*
+ This function is called when a change in one of the registered tables is detected.
+ The function then raises the events for the plugins.
+ */
+
+ function process($tablename,$action,$data) {
+ global $app;
+
+ switch ($tablename) {
+ case 'web_domain':
+ if($action == 'i') $app->plugins->raiseEvent('web_domain_insert',$data);
+ if($action == 'u') $app->plugins->raiseEvent('web_domain_update',$data);
+ if($action == 'd') $app->plugins->raiseEvent('web_domain_delete',$data);
+ break;
+ } // end switch
+ } // end function
+
+} // end class
+
+?>
\ No newline at end of file
diff --git a/server/plugins-enabled/apache2_plugin.inc.php b/server/plugins-enabled/apache2_plugin.inc.php
new file mode 100644
index 0000000000000000000000000000000000000000..a96d317a45e104b87dfd8ef9b9052e86490bab27
--- /dev/null
+++ b/server/plugins-enabled/apache2_plugin.inc.php
@@ -0,0 +1,83 @@
+plugin_name;
+
+
+
+ /*
+ This function is called when the plugin is loaded
+ */
+
+ function onLoad() {
+ global $app;
+
+ /*
+ Register for the events
+ */
+
+ $app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
+ $app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
+ $app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
+
+ }
+
+ function insert($event_name,$data) {
+ global $app, $conf;
+
+
+
+
+ }
+
+
+ function update($event_name,$data) {
+ global $app, $conf;
+
+ // load the server configuration options
+ $app->uses("getconf");
+ $web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
+
+
+ }
+
+ function delete($event_name,$data) {
+ global $app, $conf;
+
+
+ }
+
+
+} // end class
+
+?>
\ No newline at end of file