From 9100936bfe5c1aadd167f9179a2af01882c59c1d Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 04 Jun 2008 13:35:17 -0400
Subject: [PATCH] - Modified pages to use a global module aurhentification function - Changed shell of website linux user to /bin/false

---
 interface/web/dns/dns_mx_edit.php                |    7 
 interface/web/mail/mail_domain_catchall_list.php |    7 
 interface/web/sites/web_aliasdomain_edit.php     |    7 
 interface/web/mail/mail_spamfilter_del.php       |    7 
 interface/web/mail/spamfilter_users_edit.php     |    7 
 interface/web/sites/shell_user_del.php           |    7 
 interface/web/mail/mail_forward_del.php          |  103 +-
 interface/web/mail/mail_user_edit.php            |    7 
 interface/web/admin/language_list.php            |    7 
 interface/web/help/support_message_del.php       |    7 
 interface/web/dns/dns_soa_del.php                |    7 
 interface/web/dns/dns_alias_edit.php             |    7 
 interface/web/mail/mail_forward_edit.php         |    7 
 interface/web/mail/spamfilter_blacklist_edit.php |    7 
 interface/web/admin/users_list.php               |    7 
 interface/web/sites/web_aliasdomain_list.php     |    7 
 interface/web/mail/mail_transport_del.php        |    7 
 interface/web/dns/dns_a_edit.php                 |    7 
 interface/web/admin/server_ip_del.php            |    7 
 interface/web/dns/dns_rr_del.php                 |    7 
 interface/web/designer/module_list.php           |    7 
 interface/web/designer/form_list.php             |    7 
 interface/web/mail/spamfilter_users_list.php     |    7 
 interface/web/mail/mail_blacklist_edit.php       |    7 
 interface/web/mail/mail_spamfilter_edit.php      |    7 
 interface/web/mail/mail_whitelist_del.php        |  103 +-
 interface/web/mail/mail_forward_list.php         |   53 
 interface/web/mail/mail_alias_list.php           |   53 
 interface/web/admin/groups_del.php               |    7 
 interface/web/designer/form_show.php             |  239 +++---
 interface/web/mail/mail_domain_list.php          |    7 
 interface/web/admin/language_add.php             |    7 
 interface/web/designer/module_edit.php           |    7 
 interface/web/mail/mail_domain_catchall_del.php  |  103 +-
 interface/web/mail/spamfilter_blacklist_del.php  |    7 
 interface/web/designer/module_nav_flip.php       |    7 
 interface/web/mail/mail_spamfilter_list.php      |    7 
 interface/web/admin/language_edit.php            |    7 
 interface/web/mail/mail_alias_del.php            |  103 +-
 interface/web/client/client_list.php             |    7 
 interface/web/designer/module_nav_edit.php       |    5 
 interface/web/mail/mail_whitelist_edit.php       |    7 
 interface/web/dns/dns_ptr_edit.php               |    7 
 interface/web/sites/web_subdomain_del.php        |    7 
 interface/web/dns/dns_soa_edit.php               |    7 
 interface/web/mail/spamfilter_config_edit.php    |    7 
 interface/web/mail/mail_blacklist_list.php       |    7 
 interface/web/admin/language_export.php          |    7 
 interface/web/admin/server_del.php               |  103 +-
 interface/web/sites/web_domain_edit.php          |    7 
 interface/web/sites/ajax_get_ip.php              |    7 
 interface/web/admin/server_list.php              |  103 +-
 interface/web/mail/mail_alias_edit.php           |    7 
 interface/web/mail/mail_blacklist_del.php        |  103 +-
 interface/web/designer/module_nav_item_edit.php  |    7 
 interface/web/sites/ftp_user_del.php             |    7 
 interface/web/designer/form_edit.php             |  305 +++----
 interface/web/sites/web_aliasdomain_del.php      |    7 
 interface/web/mail/mail_domain_catchall_edit.php |    7 
 interface/web/mail/mail_content_filter_edit.php  |    7 
 interface/web/mail/mail_domain_del.php           |    7 
 interface/web/mail/spamfilter_config_del.php     |    7 
 interface/web/mail/mail_content_filter_del.php   |    7 
 interface/web/mail/mail_user_stats.php           |    7 
 interface/web/help/support_message_edit.php      |    7 
 interface/web/dns/dns_srv_edit.php               |    7 
 interface/web/sites/shell_user_list.php          |    7 
 interface/web/mail/mail_get_del.php              |    7 
 server/plugins-available/apache2_plugin.inc.php  |    2 
 interface/web/admin/server_ip_list.php           |    7 
 interface/web/admin/dbsync_list.php              |    7 
 interface/web/client/client_del.php              |    7 
 interface/web/mail/spamfilter_policy_edit.php    |    7 
 interface/web/mail/mail_content_filter_list.php  |    7 
 interface/web/dns/dns_txt_edit.php               |    7 
 interface/web/sites/ftp_user_edit.php            |    7 
 interface/web/admin/language_import.php          |    7 
 interface/web/help/support_message_list.php      |    7 
 interface/web/mail/mail_get_list.php             |    7 
 interface/web/mail/mail_transport_edit.php       |    7 
 interface/web/dns/dns_rp_edit.php                |    7 
 interface/web/admin/groups_edit.php              |    7 
 interface/web/designer/module_show.php           |    7 
 interface/web/designer/module_nav_item_flip.php  |    7 
 interface/lib/classes/auth.inc.php               |   10 
 interface/web/monitor/system.php                 |    7 
 interface/web/monitor/logview.php                |    7 
 interface/web/sites/web_subdomain_edit.php       |    7 
 interface/web/admin/dbsync_del.php               |    6 
 interface/web/mail/mail_user_del.php             |    7 
 interface/web/admin/server_edit.php              |  107 +-
 interface/web/mail/spamfilter_whitelist_list.php |    7 
 interface/web/admin/filesync_list.php            |    7 
 interface/web/admin/users_del.php                |    7 
 interface/web/dns/dns_a_list.php                 |    7 
 interface/web/mail/mail_transport_list.php       |    7 
 interface/web/admin/dbsync_edit.php              |    7 
 interface/web/admin/server_ip_edit.php           |    7 
 interface/web/dns/dns_soa_list.php               |    7 
 interface/web/dns/dns_ns_edit.php                |    7 
 interface/web/mail/spamfilter_config_list.php    |    7 
 interface/web/client/client_edit.php             |    7 
 interface/web/sites/web_subdomain_list.php       |    7 
 interface/web/sites/web_domain_list.php          |    7 
 interface/web/sites/shell_user_edit.php          |    7 
 interface/web/mail/spamfilter_policy_del.php     |    7 
 interface/web/dns/dns_hinfo_edit.php             |    7 
 interface/web/admin/filesync_del.php             |    7 
 interface/web/mail/mail_user_list.php            |    7 
 interface/web/mail/spamfilter_users_del.php      |    7 
 interface/web/dns/dns_cname_edit.php             |    7 
 interface/web/sites/ftp_user_list.php            |    7 
 interface/web/admin/filesync_edit.php            |    7 
 interface/web/mail/mail_domain_edit.php          |    7 
 interface/web/admin/users_edit.php               |    7 
 interface/web/designer/module_nav_item_del.php   |    7 
 interface/web/mail/spamfilter_blacklist_list.php |    7 
 interface/web/mail/spamfilter_whitelist_edit.php |    7 
 interface/web/mail/mail_whitelist_list.php       |    7 
 interface/web/mail/mail_get_edit.php             |    7 
 interface/web/mail/spamfilter_whitelist_del.php  |    7 
 interface/web/admin/groups_list.php              |    7 
 interface/web/mail/spamfilter_policy_list.php    |    7 
 interface/web/designer/module_nav_del.php        |    7 
 interface/web/sites/web_domain_del.php           |    7 
 125 files changed, 952 insertions(+), 1,312 deletions(-)

diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php
index d3ed6e9..ef9b4fc 100644
--- a/interface/lib/classes/auth.inc.php
+++ b/interface/lib/classes/auth.inc.php
@@ -90,6 +90,16 @@
 			return false;
 		}
 	}
+	
+	public function check_module_permissions($module) {
+		// Check if the current user has the permissions to access this module
+		if(!stristr($_SESSION["s"]["user"]["modules"],$module)) {
+			header("Location: ../index.php");
+			exit;
+		}
+	}
+	
+	
 }
 
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/dbsync_del.php b/interface/web/admin/dbsync_del.php
index c1860b3..bcbe62a 100644
--- a/interface/web/admin/dbsync_del.php
+++ b/interface/web/admin/dbsync_del.php
@@ -39,11 +39,7 @@
 * End Form configuration
 ******************************************/
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+$app->auth->check_module_permissions('admin');
 
 include_once($list_def_file);
 
diff --git a/interface/web/admin/dbsync_edit.php b/interface/web/admin/dbsync_edit.php
index 2c0b859..fe3a56f 100644
--- a/interface/web/admin/dbsync_edit.php
+++ b/interface/web/admin/dbsync_edit.php
@@ -39,11 +39,8 @@
 * End Form configuration
 ******************************************/
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 // Lade Template
 $app->uses('tpl,tform');
diff --git a/interface/web/admin/dbsync_list.php b/interface/web/admin/dbsync_list.php
index 6370e38..05b5fdf 100644
--- a/interface/web/admin/dbsync_list.php
+++ b/interface/web/admin/dbsync_list.php
@@ -39,11 +39,8 @@
 * End Form configuration
 ******************************************/
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 $app->uses('tpl,listform');
 
diff --git a/interface/web/admin/filesync_del.php b/interface/web/admin/filesync_del.php
index 0b3da22..33cb3e6 100644
--- a/interface/web/admin/filesync_del.php
+++ b/interface/web/admin/filesync_del.php
@@ -39,11 +39,8 @@
 * End Form configuration
 ******************************************/
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 include_once($list_def_file);
 
diff --git a/interface/web/admin/filesync_edit.php b/interface/web/admin/filesync_edit.php
index c113072..bf7b648 100644
--- a/interface/web/admin/filesync_edit.php
+++ b/interface/web/admin/filesync_edit.php
@@ -39,11 +39,8 @@
 * End Form configuration
 ******************************************/
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 // Lade Template
 $app->uses('tpl,tform');
diff --git a/interface/web/admin/filesync_list.php b/interface/web/admin/filesync_list.php
index 87f4685..30a473c 100644
--- a/interface/web/admin/filesync_list.php
+++ b/interface/web/admin/filesync_list.php
@@ -39,11 +39,8 @@
 * End Form configuration
 ******************************************/
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 $app->uses('tpl,listform');
 
diff --git a/interface/web/admin/groups_del.php b/interface/web/admin/groups_del.php
index 49588c2..3303154 100644
--- a/interface/web/admin/groups_del.php
+++ b/interface/web/admin/groups_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/admin/groups_edit.php b/interface/web/admin/groups_edit.php
index d649f40..d2acf2b 100644
--- a/interface/web/admin/groups_edit.php
+++ b/interface/web/admin/groups_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/admin/groups_list.php b/interface/web/admin/groups_list.php
index 3545f04..f75f5de 100644
--- a/interface/web/admin/groups_list.php
+++ b/interface/web/admin/groups_list.php
@@ -41,11 +41,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 $app->uses('listform_actions');
 $app->listform_actions->onLoad();
diff --git a/interface/web/admin/language_add.php b/interface/web/admin/language_add.php
index 5d1d34c..dc03f86 100644
--- a/interface/web/admin/language_add.php
+++ b/interface/web/admin/language_add.php
@@ -30,11 +30,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking permissions for the module
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 //* This is only allowed for administrators
 if(!$app->auth->is_admin()) die('only allowed for administrators.');
diff --git a/interface/web/admin/language_edit.php b/interface/web/admin/language_edit.php
index f2b7be5..6edfb0d 100644
--- a/interface/web/admin/language_edit.php
+++ b/interface/web/admin/language_edit.php
@@ -30,11 +30,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking permissions for the module
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 //* This is only allowed for administrators
 if(!$app->auth->is_admin()) die('only allowed for administrators.');
diff --git a/interface/web/admin/language_export.php b/interface/web/admin/language_export.php
index c2c6343..d252073 100644
--- a/interface/web/admin/language_export.php
+++ b/interface/web/admin/language_export.php
@@ -30,11 +30,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking permissions for the module
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 //* This is only allowed for administrators
 if(!$app->auth->is_admin()) die('only allowed for administrators.');
diff --git a/interface/web/admin/language_import.php b/interface/web/admin/language_import.php
index 130fbc1..09f11e7 100644
--- a/interface/web/admin/language_import.php
+++ b/interface/web/admin/language_import.php
@@ -30,11 +30,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking permissions for the module
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 //* This is only allowed for administrators
 if(!$app->auth->is_admin()) die('only allowed for administrators.');
diff --git a/interface/web/admin/language_list.php b/interface/web/admin/language_list.php
index 47368c5..cbfa619 100644
--- a/interface/web/admin/language_list.php
+++ b/interface/web/admin/language_list.php
@@ -30,11 +30,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking permissions for the module
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 //* This is only allowed for administrators
 if(!$app->auth->is_admin()) die('only allowed for administrators.');
diff --git a/interface/web/admin/server_del.php b/interface/web/admin/server_del.php
index b0ae30d..78a0785 100644
--- a/interface/web/admin/server_del.php
+++ b/interface/web/admin/server_del.php
@@ -1,54 +1,51 @@
-<?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();
-
+<?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');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/server_edit.php b/interface/web/admin/server_edit.php
index d02dc22..ea8dd89 100644
--- a/interface/web/admin/server_edit.php
+++ b/interface/web/admin/server_edit.php
@@ -1,56 +1,53 @@
-<?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/server.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');
-
-// let tform_actions handle the page
-$app->tform_actions->onLoad();
-
+<?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/server.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
+
+// Loading classes
+$app->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_del.php b/interface/web/admin/server_ip_del.php
index 532e970..1229958 100644
--- a/interface/web/admin/server_ip_del.php
+++ b/interface/web/admin/server_ip_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'admin')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/admin/server_ip_edit.php b/interface/web/admin/server_ip_edit.php
index 48d42c0..8b6160b 100644
--- a/interface/web/admin/server_ip_edit.php
+++ b/interface/web/admin/server_ip_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'admin')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/admin/server_ip_list.php b/interface/web/admin/server_ip_list.php
index f701953..a6bd3b8 100644
--- a/interface/web/admin/server_ip_list.php
+++ b/interface/web/admin/server_ip_list.php
@@ -41,11 +41,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'admin')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 $app->uses('listform_actions');
 $app->listform_actions->onLoad();
diff --git a/interface/web/admin/server_list.php b/interface/web/admin/server_list.php
index bfae877..985dac6 100644
--- a/interface/web/admin/server_list.php
+++ b/interface/web/admin/server_list.php
@@ -1,54 +1,51 @@
-<?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();
-
-
+<?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
+******************************************/
+
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
+
+$app->uses('listform_actions');
+$app->listform_actions->onLoad();
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/users_del.php b/interface/web/admin/users_del.php
index cd3b279..b4f3e72 100644
--- a/interface/web/admin/users_del.php
+++ b/interface/web/admin/users_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/admin/users_edit.php b/interface/web/admin/users_edit.php
index 8dab858..16e6f0a 100644
--- a/interface/web/admin/users_edit.php
+++ b/interface/web/admin/users_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/admin/users_list.php b/interface/web/admin/users_list.php
index 105922d..b113e40 100644
--- a/interface/web/admin/users_list.php
+++ b/interface/web/admin/users_list.php
@@ -41,11 +41,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
 
 $app->uses('listform_actions');
 $app->listform_actions->onLoad();
diff --git a/interface/web/client/client_del.php b/interface/web/client/client_del.php
index 38bcd67..3a04f46 100644
--- a/interface/web/client/client_del.php
+++ b/interface/web/client/client_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('client');
 
 $app->uses('tpl,tform');
 $app->load('tform_actions');
diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index 4852047..11b20a7 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('client');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/client/client_list.php b/interface/web/client/client_list.php
index 6f5a06f..044c502 100644
--- a/interface/web/client/client_list.php
+++ b/interface/web/client/client_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('client');
 
 $app->uses('listform_actions');
 $app->listform_actions->onLoad();
diff --git a/interface/web/designer/form_edit.php b/interface/web/designer/form_edit.php
index 703eb0b..4ea74c2 100644
--- a/interface/web/designer/form_edit.php
+++ b/interface/web/designer/form_edit.php
@@ -1,155 +1,152 @@
-<?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');
-
-if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
-
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
-
-// Lade Template
-$app->uses('tpl');
-$app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/form_edit.htm');
-
-// Importing variables
-$module_name = $_REQUEST["module_name"];
-$form_name = $_REQUEST["form_name"];
-
-// Checking imported variables
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$form_name)) die("form_name contains invalid chars.");
-
-$id = $form_name;
-
-if(count($_POST) > 1) {
-	// Bestimme aktion
-	if($id != '') {
-		$action = 'UPDATE';
-	} else {
-		$action = 'INSERT';
-	}
-
-	
-	if($error == '') {
-		
-		$filename = "../".$module_name."/form/".$form_name.".tform.php";
-		$form_new = $_POST["form"];
-		
-		if(@is_file($filename)) {
-			include_once($filename);
-			$tabs = $form["tabs"];
-			unset($form["tabs"]);
-			$form_new["tabs"] = $tabs;
-		}
-		
-		$file_content = "<?php\r\n".'$form = '.var_export($form_new,true)."\r\n?>";
-		
-		die($file_content);
-		
-		// writing module.conf
-		if (!$handle = fopen($filename, 'w')) { 
-			print "Cannot open file ($filename)"; 
-			exit; 
-		} 
-
-		if (!fwrite($handle, $file_content)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
-		} 
-    
-		fclose($handle);
-		
-		// zu Liste springen
-    	header("Location: form_list.php");
-        exit;
-			
-	} else {
-		$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
-		$app->tpl->setVar($_POST);
-	}
-}
-
-if($id != '') {
-// Datensatz besteht bereits
-	// bestehenden Datensatz anzeigen
-	if($error == '') {
-		// es liegt ein Fehler vor
-		include_once("../".$module_name."/form/".$form_name.".tform.php");
-		//$tabs = $form["tabs"];
-		unset($form["tabs"]);
-		$record = $form;
-		$record["form_name"] = $form_name;
-		$record["module_name"] = $module_name;
-		$record["auth_preset_userid"] = $form["auth_preset"]["userid"];
-		$record["auth_preset_groupid"] = $form["auth_preset"]["groupid"];
-		$record["auth_preset_perm_user"] = $form["auth_preset"]["perm_user"];
-		$record["auth_preset_perm_group"] = $form["auth_preset"]["perm_group"];
-		$record["auth_preset_perm_other"] = $form["auth_preset"]["perm_other"];
-	} else {
-		// ein Fehler
-		$record = $_POST;
-		//$navi = $_POST["nav"];
-		unset($_POST["tabs"]);
-	}
-	$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
-} else {
-// neuer datensatz
-	if($error == '') {
-		// es liegt kein Fehler vor
-		// Pewsets
-		$record["template"] = "module.tpl.htm";
-	} else {
-		// ein Fehler
-		$record = $_POST;
-		unset($_POST["tabs"]);
-		
-	}
-	$record["readonly"] = '';
-}
-
-$record["id"] = $form_name;
-
-$app->tpl->setVar($record);
-
-include_once("lib/lang/".$_SESSION["s"]["language"]."_form_edit.lng");
-$app->tpl->setVar($wb);
-
-// Defaultwerte setzen
-$app->tpl_defaults();
-
-// Template parsen
-$app->tpl->pparse();
-
+<?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');
+
+if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
+
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
+
+// Lade Template
+$app->uses('tpl');
+$app->tpl->newTemplate("form.tpl.htm");
+$app->tpl->setInclude('content_tpl','templates/form_edit.htm');
+
+// Importing variables
+$module_name = $_REQUEST["module_name"];
+$form_name = $_REQUEST["form_name"];
+
+// Checking imported variables
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$form_name)) die("form_name contains invalid chars.");
+
+$id = $form_name;
+
+if(count($_POST) > 1) {
+	// Bestimme aktion
+	if($id != '') {
+		$action = 'UPDATE';
+	} else {
+		$action = 'INSERT';
+	}
+
+	
+	if($error == '') {
+		
+		$filename = "../".$module_name."/form/".$form_name.".tform.php";
+		$form_new = $_POST["form"];
+		
+		if(@is_file($filename)) {
+			include_once($filename);
+			$tabs = $form["tabs"];
+			unset($form["tabs"]);
+			$form_new["tabs"] = $tabs;
+		}
+		
+		$file_content = "<?php\r\n".'$form = '.var_export($form_new,true)."\r\n?>";
+		
+		die($file_content);
+		
+		// writing module.conf
+		if (!$handle = fopen($filename, 'w')) { 
+			print "Cannot open file ($filename)"; 
+			exit; 
+		} 
+
+		if (!fwrite($handle, $file_content)) { 
+			print "Cannot write to file ($filename)"; 
+			exit; 
+		} 
+    
+		fclose($handle);
+		
+		// zu Liste springen
+    	header("Location: form_list.php");
+        exit;
+			
+	} else {
+		$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
+		$app->tpl->setVar($_POST);
+	}
+}
+
+if($id != '') {
+// Datensatz besteht bereits
+	// bestehenden Datensatz anzeigen
+	if($error == '') {
+		// es liegt ein Fehler vor
+		include_once("../".$module_name."/form/".$form_name.".tform.php");
+		//$tabs = $form["tabs"];
+		unset($form["tabs"]);
+		$record = $form;
+		$record["form_name"] = $form_name;
+		$record["module_name"] = $module_name;
+		$record["auth_preset_userid"] = $form["auth_preset"]["userid"];
+		$record["auth_preset_groupid"] = $form["auth_preset"]["groupid"];
+		$record["auth_preset_perm_user"] = $form["auth_preset"]["perm_user"];
+		$record["auth_preset_perm_group"] = $form["auth_preset"]["perm_group"];
+		$record["auth_preset_perm_other"] = $form["auth_preset"]["perm_other"];
+	} else {
+		// ein Fehler
+		$record = $_POST;
+		//$navi = $_POST["nav"];
+		unset($_POST["tabs"]);
+	}
+	$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
+} else {
+// neuer datensatz
+	if($error == '') {
+		// es liegt kein Fehler vor
+		// Pewsets
+		$record["template"] = "module.tpl.htm";
+	} else {
+		// ein Fehler
+		$record = $_POST;
+		unset($_POST["tabs"]);
+		
+	}
+	$record["readonly"] = '';
+}
+
+$record["id"] = $form_name;
+
+$app->tpl->setVar($record);
+
+include_once("lib/lang/".$_SESSION["s"]["language"]."_form_edit.lng");
+$app->tpl->setVar($wb);
+
+// Defaultwerte setzen
+$app->tpl_defaults();
+
+// Template parsen
+$app->tpl->pparse();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/designer/form_list.php b/interface/web/designer/form_list.php
index 5103216..249b5e8 100644
--- a/interface/web/designer/form_list.php
+++ b/interface/web/designer/form_list.php
@@ -30,11 +30,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking permissions for the module
-if(!stristr($_SESSION['s']['user']['modules'],$_SESSION['s']['module']['name'])) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 $app->uses('tpl');
 
diff --git a/interface/web/designer/form_show.php b/interface/web/designer/form_show.php
index 3b9e7e1..77bb080 100644
--- a/interface/web/designer/form_show.php
+++ b/interface/web/designer/form_show.php
@@ -1,122 +1,119 @@
-<?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');
-
-// Checking permissions for the module
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
-
-if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
-
-$app->uses('tpl');
-
-$app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/form_show.htm');
-
-
-// TODO: Check ID for malicius chars
-$module_name = $_REQUEST["module_name"];
-$form_name = $_REQUEST["form_name"];
-
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$form_name)) die("form_name contains invalid chars.");
-
-include_once("../".$module_name."/form/".$form_name.".tform.php");
-$tabs = $form["tabs"];
-unset($form["tabs"]);
-$record = $form;
-$record["form_name"] = $form_name;
-$record["module_name"] = $module_name;
-
-// loading language file 
-$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_form_show.lng";
-include($lng_file);
-$app->tpl->setVar($wb);
-
-// baue Tabs navi
-$content = "";
-$n1 = 0;
-$n2 = 0;
-if(is_array($tabs)) {
-foreach($tabs as $tab_id => $tab) {
-	$content .= "<tr>
-    <td colspan='2' class='frmText11'>
-	  <table width='100%'>
-	  	<tr>
-		  <td class='tblHead'>$tab[title]</td>
-		  <td class='tblHead' width='220' align='right'>
-		  <input type=\"button\" name=\"bt1$n2\" value=\"$wb[edit_txt]\" onClick=\"location.href='form_tab_edit.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id'\" class=\"button\" />
-		  <input type=\"button\" name=\"bt2$n2\" value=\"$wb[delete_txt]\" onClick=\"del_menu('form_tab_del.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id');\" class=\"button\" />
-		  <input type=\"button\" name=\"bt3$n2\" value=\"$wb[new_txt]\" onClick=\"location.href='form_tab_item_edit.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id'\" class=\"button\" />
-		  <input type=\"button\" name=\"bt4$n2\" value=\"$wb[up_txt]\" onClick=\"location.href='form_tab_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&dir=up'\" class=\"button\" />
-		  <input type=\"button\" name=\"bt5$n2\" value=\"$wb[down_txt]\" onClick=\"location.href='form_tab_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&dir=down'\" class=\"button\" />
-		  </td>
-		</tr>";
-	//$content .= "<tr><td bgcolor='#EEEEEE' class='frmText11'>Bereich:</td><td class='frmText11' bgcolor='#EEEEEE'><input name=\"module[nav][$n1][title]\" type=\"text\" class=\"text\" value=\"$section[title]\" size=\"30\" maxlength=\"255\"><input name=\"module[nav][$n1][open]\" type=\"hidden\" value=\"$section[open]\"></td></tr>\r\n";
-	foreach($tab["fields"] as $field_id => $field) {
-		//$content .= "<tr><td class='frmText11'>Titel:</td><td class='frmText11'><input name=\"module[nav][$n1][items][$n2][title]\" type=\"text\" class=\"text\" value=\"$item[title]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
-		//$content .= "<tr><td class='frmText11'>Ziel:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][target]\" type=\"text\" class=\"text\" value=\"$item[target]\" size=\"10\" maxlength=\"255\"></td></tr>\r\n";
-		//$content .= "<tr><td class='frmText11'>Link:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][link]\" type=\"text\" class=\"text\" value=\"$item[link]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
-		$content .= "<tr>
-		  <td class='frmText11'>$field_id</td>
-		  <td class='frmText11' width='220' align='right'>
-		  <input type=\"button\" name=\"bt6$n2\" value=\"$wb[edit_txt]\" onClick=\"location.href='form_field_edit.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id'\" class=\"button\" />
-		  <input type=\"button\" name=\"bt7$n2\" value=\"$wb[delete_txt]\" onClick=\"del_menuitem('form_field_del.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id');\" class=\"button\" />
-		  <input type=\"button\" name=\"bt8$n2\" value=\"$wb[up_txt]\" onClick=\"location.href='form_field_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id&dir=up'\" class=\"button\" />
-		  <input type=\"button\" name=\"bt9$n2\" value=\"$wb[down_txt]\" onClick=\"location.href='form_field_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id&dir=down'\" class=\"button\" />
-		  </td>
-		</tr>";
-		$n2++;
-	}
-	$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
-	  </table>
-	</td>
-  </tr>";
-	$n1++;
-}
-}
-
-$record["nav"] = $content;
-
-
-$app->tpl->setVar($record);
-
-
-$app->tpl->setLoop('records',$modules_list);
-
-$app->tpl_defaults();
-$app->tpl->pparse();
-
-
-
+<?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');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
+
+if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
+
+$app->uses('tpl');
+
+$app->tpl->newTemplate("form.tpl.htm");
+$app->tpl->setInclude('content_tpl','templates/form_show.htm');
+
+
+// TODO: Check ID for malicius chars
+$module_name = $_REQUEST["module_name"];
+$form_name = $_REQUEST["form_name"];
+
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$form_name)) die("form_name contains invalid chars.");
+
+include_once("../".$module_name."/form/".$form_name.".tform.php");
+$tabs = $form["tabs"];
+unset($form["tabs"]);
+$record = $form;
+$record["form_name"] = $form_name;
+$record["module_name"] = $module_name;
+
+// loading language file 
+$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_form_show.lng";
+include($lng_file);
+$app->tpl->setVar($wb);
+
+// baue Tabs navi
+$content = "";
+$n1 = 0;
+$n2 = 0;
+if(is_array($tabs)) {
+foreach($tabs as $tab_id => $tab) {
+	$content .= "<tr>
+    <td colspan='2' class='frmText11'>
+	  <table width='100%'>
+	  	<tr>
+		  <td class='tblHead'>$tab[title]</td>
+		  <td class='tblHead' width='220' align='right'>
+		  <input type=\"button\" name=\"bt1$n2\" value=\"$wb[edit_txt]\" onClick=\"location.href='form_tab_edit.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id'\" class=\"button\" />
+		  <input type=\"button\" name=\"bt2$n2\" value=\"$wb[delete_txt]\" onClick=\"del_menu('form_tab_del.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id');\" class=\"button\" />
+		  <input type=\"button\" name=\"bt3$n2\" value=\"$wb[new_txt]\" onClick=\"location.href='form_tab_item_edit.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id'\" class=\"button\" />
+		  <input type=\"button\" name=\"bt4$n2\" value=\"$wb[up_txt]\" onClick=\"location.href='form_tab_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&dir=up'\" class=\"button\" />
+		  <input type=\"button\" name=\"bt5$n2\" value=\"$wb[down_txt]\" onClick=\"location.href='form_tab_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&dir=down'\" class=\"button\" />
+		  </td>
+		</tr>";
+	//$content .= "<tr><td bgcolor='#EEEEEE' class='frmText11'>Bereich:</td><td class='frmText11' bgcolor='#EEEEEE'><input name=\"module[nav][$n1][title]\" type=\"text\" class=\"text\" value=\"$section[title]\" size=\"30\" maxlength=\"255\"><input name=\"module[nav][$n1][open]\" type=\"hidden\" value=\"$section[open]\"></td></tr>\r\n";
+	foreach($tab["fields"] as $field_id => $field) {
+		//$content .= "<tr><td class='frmText11'>Titel:</td><td class='frmText11'><input name=\"module[nav][$n1][items][$n2][title]\" type=\"text\" class=\"text\" value=\"$item[title]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
+		//$content .= "<tr><td class='frmText11'>Ziel:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][target]\" type=\"text\" class=\"text\" value=\"$item[target]\" size=\"10\" maxlength=\"255\"></td></tr>\r\n";
+		//$content .= "<tr><td class='frmText11'>Link:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][link]\" type=\"text\" class=\"text\" value=\"$item[link]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
+		$content .= "<tr>
+		  <td class='frmText11'>$field_id</td>
+		  <td class='frmText11' width='220' align='right'>
+		  <input type=\"button\" name=\"bt6$n2\" value=\"$wb[edit_txt]\" onClick=\"location.href='form_field_edit.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id'\" class=\"button\" />
+		  <input type=\"button\" name=\"bt7$n2\" value=\"$wb[delete_txt]\" onClick=\"del_menuitem('form_field_del.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id');\" class=\"button\" />
+		  <input type=\"button\" name=\"bt8$n2\" value=\"$wb[up_txt]\" onClick=\"location.href='form_field_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id&dir=up'\" class=\"button\" />
+		  <input type=\"button\" name=\"bt9$n2\" value=\"$wb[down_txt]\" onClick=\"location.href='form_field_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id&dir=down'\" class=\"button\" />
+		  </td>
+		</tr>";
+		$n2++;
+	}
+	$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
+	  </table>
+	</td>
+  </tr>";
+	$n1++;
+}
+}
+
+$record["nav"] = $content;
+
+
+$app->tpl->setVar($record);
+
+
+$app->tpl->setLoop('records',$modules_list);
+
+$app->tpl_defaults();
+$app->tpl->pparse();
+
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/designer/module_edit.php b/interface/web/designer/module_edit.php
index f1a9ad7..9a8df30 100644
--- a/interface/web/designer/module_edit.php
+++ b/interface/web/designer/module_edit.php
@@ -32,11 +32,8 @@
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 // Lade Template
 $app->uses('tpl');
diff --git a/interface/web/designer/module_list.php b/interface/web/designer/module_list.php
index 6150997..92aa4f0 100644
--- a/interface/web/designer/module_list.php
+++ b/interface/web/designer/module_list.php
@@ -30,11 +30,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-//* Check permissions for the module
-if(!stristr($_SESSION['s']['user']['modules'],$_SESSION['s']['module']['name'])) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 $app->uses('tpl');
 
diff --git a/interface/web/designer/module_nav_del.php b/interface/web/designer/module_nav_del.php
index f0a6b56..18c5bf4 100644
--- a/interface/web/designer/module_nav_del.php
+++ b/interface/web/designer/module_nav_del.php
@@ -32,11 +32,8 @@
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 // Lade Template
 $app->uses('tpl');
diff --git a/interface/web/designer/module_nav_edit.php b/interface/web/designer/module_nav_edit.php
index 27fbb78..73c010e 100644
--- a/interface/web/designer/module_nav_edit.php
+++ b/interface/web/designer/module_nav_edit.php
@@ -36,10 +36,7 @@
 }
 
 //* Check permissions for module
-if(!stristr($_SESSION['s']['user']['modules'],$_SESSION['s']['module']['name'])) {
-	header('Location: ../index.php');
-	exit;
-}
+$app->auth->check_module_permissions('designer');
 
 //* Load template
 $app->uses('tpl');
diff --git a/interface/web/designer/module_nav_flip.php b/interface/web/designer/module_nav_flip.php
index 2218402..f3fc164 100644
--- a/interface/web/designer/module_nav_flip.php
+++ b/interface/web/designer/module_nav_flip.php
@@ -32,11 +32,8 @@
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 // Lade Template
 $app->uses('tpl');
diff --git a/interface/web/designer/module_nav_item_del.php b/interface/web/designer/module_nav_item_del.php
index aa537a1..cd458cd 100644
--- a/interface/web/designer/module_nav_item_del.php
+++ b/interface/web/designer/module_nav_item_del.php
@@ -32,11 +32,8 @@
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 // Lade Template
 $app->uses('tpl');
diff --git a/interface/web/designer/module_nav_item_edit.php b/interface/web/designer/module_nav_item_edit.php
index 44b1768..5948aba 100644
--- a/interface/web/designer/module_nav_item_edit.php
+++ b/interface/web/designer/module_nav_item_edit.php
@@ -32,11 +32,8 @@
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 // Lade Template
 $app->uses('tpl');
diff --git a/interface/web/designer/module_nav_item_flip.php b/interface/web/designer/module_nav_item_flip.php
index d21f491..2ec0566 100644
--- a/interface/web/designer/module_nav_item_flip.php
+++ b/interface/web/designer/module_nav_item_flip.php
@@ -32,11 +32,8 @@
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 // Lade Template
 $app->uses('tpl');
diff --git a/interface/web/designer/module_show.php b/interface/web/designer/module_show.php
index 8ad9435..4454878 100644
--- a/interface/web/designer/module_show.php
+++ b/interface/web/designer/module_show.php
@@ -30,11 +30,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking permissions for the module
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('designer');
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
diff --git a/interface/web/dns/dns_a_edit.php b/interface/web/dns/dns_a_edit.php
index c5a24d1..5fcb400 100644
--- a/interface/web/dns/dns_a_edit.php
+++ b/interface/web/dns/dns_a_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_a_list.php b/interface/web/dns/dns_a_list.php
index 6899b3a..c01aec6 100644
--- a/interface/web/dns/dns_a_list.php
+++ b/interface/web/dns/dns_a_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 $app->uses('listform_actions');
 $app->listform_actions->SQLExtWhere = "type = 'A'";
diff --git a/interface/web/dns/dns_alias_edit.php b/interface/web/dns/dns_alias_edit.php
index f359fec..e952f56 100644
--- a/interface/web/dns/dns_alias_edit.php
+++ b/interface/web/dns/dns_alias_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_cname_edit.php b/interface/web/dns/dns_cname_edit.php
index 8ad00dc..5123d10 100644
--- a/interface/web/dns/dns_cname_edit.php
+++ b/interface/web/dns/dns_cname_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_hinfo_edit.php b/interface/web/dns/dns_hinfo_edit.php
index fd9341e..950d74e 100644
--- a/interface/web/dns/dns_hinfo_edit.php
+++ b/interface/web/dns/dns_hinfo_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_mx_edit.php b/interface/web/dns/dns_mx_edit.php
index 90544da..112a4da 100644
--- a/interface/web/dns/dns_mx_edit.php
+++ b/interface/web/dns/dns_mx_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_ns_edit.php b/interface/web/dns/dns_ns_edit.php
index 6e77708..74ce119 100644
--- a/interface/web/dns/dns_ns_edit.php
+++ b/interface/web/dns/dns_ns_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_ptr_edit.php b/interface/web/dns/dns_ptr_edit.php
index 4335648..3828aa0 100644
--- a/interface/web/dns/dns_ptr_edit.php
+++ b/interface/web/dns/dns_ptr_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_rp_edit.php b/interface/web/dns/dns_rp_edit.php
index e8cb684..ef70c1e 100644
--- a/interface/web/dns/dns_rp_edit.php
+++ b/interface/web/dns/dns_rp_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_rr_del.php b/interface/web/dns/dns_rr_del.php
index d996c91..e0088d2 100644
--- a/interface/web/dns/dns_rr_del.php
+++ b/interface/web/dns/dns_rr_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/dns/dns_soa_del.php b/interface/web/dns/dns_soa_del.php
index 5cbb77f..de223fa 100644
--- a/interface/web/dns/dns_soa_del.php
+++ b/interface/web/dns/dns_soa_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/dns/dns_soa_edit.php b/interface/web/dns/dns_soa_edit.php
index 0526e5e..6c10b06 100644
--- a/interface/web/dns/dns_soa_edit.php
+++ b/interface/web/dns/dns_soa_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_soa_list.php b/interface/web/dns/dns_soa_list.php
index 3f608a4..0f46782 100644
--- a/interface/web/dns/dns_soa_list.php
+++ b/interface/web/dns/dns_soa_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 $app->uses('listform_actions');
 // $app->listform_actions->SQLExtWhere = "access = 'REJECT'";
diff --git a/interface/web/dns/dns_srv_edit.php b/interface/web/dns/dns_srv_edit.php
index f6d362f..7417766 100644
--- a/interface/web/dns/dns_srv_edit.php
+++ b/interface/web/dns/dns_srv_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/dns/dns_txt_edit.php b/interface/web/dns/dns_txt_edit.php
index ab923eb..1fda14c 100644
--- a/interface/web/dns/dns_txt_edit.php
+++ b/interface/web/dns/dns_txt_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'dns')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('dns');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/help/support_message_del.php b/interface/web/help/support_message_del.php
index 721197c..63c23a0 100644
--- a/interface/web/help/support_message_del.php
+++ b/interface/web/help/support_message_del.php
@@ -38,11 +38,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Check module permissions
-if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('help');
 
 //* Load the form
 $app->uses('tform_actions');
diff --git a/interface/web/help/support_message_edit.php b/interface/web/help/support_message_edit.php
index a36b5db..bef1e9b 100644
--- a/interface/web/help/support_message_edit.php
+++ b/interface/web/help/support_message_edit.php
@@ -7,11 +7,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-//* Checking module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('help');
 
 //* Loading the templating and form classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/help/support_message_list.php b/interface/web/help/support_message_list.php
index ce990e4..a4d9fdc 100644
--- a/interface/web/help/support_message_list.php
+++ b/interface/web/help/support_message_list.php
@@ -5,11 +5,8 @@
 //* Path to the list definition file
 $list_def_file = "list/support_message.list.php";
 
-//* Check the module permissions
-if(!stristr($_SESSION['s']['user']["modules"], 'help')) {
-	header('Location: ../index.php');
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('help');
 
 //* Loading the class
 $app->uses('listform_actions');
diff --git a/interface/web/mail/mail_alias_del.php b/interface/web/mail/mail_alias_del.php
index 03b95ca..6457f6d 100644
--- a/interface/web/mail/mail_alias_del.php
+++ b/interface/web/mail/mail_alias_del.php
@@ -1,54 +1,51 @@
-<?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_alias.list.php";
-$tform_def_file = "form/mail_alias.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();
-
+<?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_alias.list.php";
+$tform_def_file = "form/mail_alias.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_alias_edit.php b/interface/web/mail/mail_alias_edit.php
index 3344feb..9ef53c6 100644
--- a/interface/web/mail/mail_alias_edit.php
+++ b/interface/web/mail/mail_alias_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_alias_list.php b/interface/web/mail/mail_alias_list.php
index d1fce3b..1ee6ad6 100644
--- a/interface/web/mail/mail_alias_list.php
+++ b/interface/web/mail/mail_alias_list.php
@@ -1,29 +1,26 @@
-<?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
-
-/******************************************
-* Begin Form configuration
-******************************************/
-
-$list_def_file = "list/mail_alias.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');
-
-// Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'alias'";
-
-$app->listform_actions->onLoad();
-
-
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_alias.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
+
+$app->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/mail/mail_blacklist_del.php b/interface/web/mail/mail_blacklist_del.php
index 5a453db..52308e6 100644
--- a/interface/web/mail/mail_blacklist_del.php
+++ b/interface/web/mail/mail_blacklist_del.php
@@ -1,54 +1,51 @@
-<?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_blacklist.list.php";
-$tform_def_file = "form/mail_blacklist.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();
-
+<?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_blacklist.list.php";
+$tform_def_file = "form/mail_blacklist.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_blacklist_edit.php b/interface/web/mail/mail_blacklist_edit.php
index 31dded5..1e8629b 100644
--- a/interface/web/mail/mail_blacklist_edit.php
+++ b/interface/web/mail/mail_blacklist_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_blacklist_list.php b/interface/web/mail/mail_blacklist_list.php
index d6b2700..000afd1 100644
--- a/interface/web/mail/mail_blacklist_list.php
+++ b/interface/web/mail/mail_blacklist_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 $app->listform_actions->SQLExtWhere = "access = 'REJECT'";
diff --git a/interface/web/mail/mail_content_filter_del.php b/interface/web/mail/mail_content_filter_del.php
index 7cede6c..1cf9246 100644
--- a/interface/web/mail/mail_content_filter_del.php
+++ b/interface/web/mail/mail_content_filter_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/mail_content_filter_edit.php b/interface/web/mail/mail_content_filter_edit.php
index d02bc5d..2913e8d 100644
--- a/interface/web/mail/mail_content_filter_edit.php
+++ b/interface/web/mail/mail_content_filter_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('These Filters are only for Admins.');
 
diff --git a/interface/web/mail/mail_content_filter_list.php b/interface/web/mail/mail_content_filter_list.php
index 59ddb1e..c2eb5e1 100644
--- a/interface/web/mail/mail_content_filter_list.php
+++ b/interface/web/mail/mail_content_filter_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/mail/mail_domain_catchall_del.php b/interface/web/mail/mail_domain_catchall_del.php
index 83024d8..7eb21c7 100644
--- a/interface/web/mail/mail_domain_catchall_del.php
+++ b/interface/web/mail/mail_domain_catchall_del.php
@@ -1,54 +1,51 @@
-<?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_domain_catchall.list.php";
-$tform_def_file = "form/mail_domain_catchall.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();
-
+<?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_domain_catchall.list.php";
+$tform_def_file = "form/mail_domain_catchall.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_catchall_edit.php b/interface/web/mail/mail_domain_catchall_edit.php
index 5cded1a..f6c27fc 100644
--- a/interface/web/mail/mail_domain_catchall_edit.php
+++ b/interface/web/mail/mail_domain_catchall_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_domain_catchall_list.php b/interface/web/mail/mail_domain_catchall_list.php
index 412bb43..e07495f 100644
--- a/interface/web/mail/mail_domain_catchall_list.php
+++ b/interface/web/mail/mail_domain_catchall_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/mail/mail_domain_del.php b/interface/web/mail/mail_domain_del.php
index c2c32ad..f9fbc09 100644
--- a/interface/web/mail/mail_domain_del.php
+++ b/interface/web/mail/mail_domain_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index a96e2a3..a9377c6 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_domain_list.php b/interface/web/mail/mail_domain_list.php
index ee8d88c..5bdfb69 100644
--- a/interface/web/mail/mail_domain_list.php
+++ b/interface/web/mail/mail_domain_list.php
@@ -13,11 +13,8 @@
 ******************************************/
 
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/mail/mail_forward_del.php b/interface/web/mail/mail_forward_del.php
index e9b179b..716a780 100644
--- a/interface/web/mail/mail_forward_del.php
+++ b/interface/web/mail/mail_forward_del.php
@@ -1,54 +1,51 @@
-<?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_forward.list.php";
-$tform_def_file = "form/mail_forward.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();
-
+<?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_forward.list.php";
+$tform_def_file = "form/mail_forward.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_forward_edit.php b/interface/web/mail/mail_forward_edit.php
index 9a7b2e9..a8cfd03 100644
--- a/interface/web/mail/mail_forward_edit.php
+++ b/interface/web/mail/mail_forward_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_forward_list.php b/interface/web/mail/mail_forward_list.php
index 77330c4..40c8244 100644
--- a/interface/web/mail/mail_forward_list.php
+++ b/interface/web/mail/mail_forward_list.php
@@ -1,29 +1,26 @@
-<?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
-
-/******************************************
-* Begin Form configuration
-******************************************/
-
-$list_def_file = "list/mail_forward.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');
-
-// Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'forward'";
-
-$app->listform_actions->onLoad();
-
-
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_forward.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
+
+$app->uses('listform_actions');
+
+// Limit the results to alias domains
+$app->listform_actions->SQLExtWhere = "type = 'forward'";
+
+$app->listform_actions->onLoad();
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_get_del.php b/interface/web/mail/mail_get_del.php
index b8eae9a..5a528a8 100644
--- a/interface/web/mail/mail_get_del.php
+++ b/interface/web/mail/mail_get_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/mail_get_edit.php b/interface/web/mail/mail_get_edit.php
index 1da6735..de97422 100644
--- a/interface/web/mail/mail_get_edit.php
+++ b/interface/web/mail/mail_get_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_get_list.php b/interface/web/mail/mail_get_list.php
index 55300d3..f485058 100644
--- a/interface/web/mail/mail_get_list.php
+++ b/interface/web/mail/mail_get_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/mail/mail_spamfilter_del.php b/interface/web/mail/mail_spamfilter_del.php
index a6985ef..6d922b5 100644
--- a/interface/web/mail/mail_spamfilter_del.php
+++ b/interface/web/mail/mail_spamfilter_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/mail_spamfilter_edit.php b/interface/web/mail/mail_spamfilter_edit.php
index 2c3766a..5009f49 100644
--- a/interface/web/mail/mail_spamfilter_edit.php
+++ b/interface/web/mail/mail_spamfilter_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_spamfilter_list.php b/interface/web/mail/mail_spamfilter_list.php
index e510589..8979a46 100644
--- a/interface/web/mail/mail_spamfilter_list.php
+++ b/interface/web/mail/mail_spamfilter_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/mail/mail_transport_del.php b/interface/web/mail/mail_transport_del.php
index fd0fcee..1c2ec67 100644
--- a/interface/web/mail/mail_transport_del.php
+++ b/interface/web/mail/mail_transport_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/mail_transport_edit.php b/interface/web/mail/mail_transport_edit.php
index 6ee7f05..8075a1d 100644
--- a/interface/web/mail/mail_transport_edit.php
+++ b/interface/web/mail/mail_transport_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 
 // Loading classes
diff --git a/interface/web/mail/mail_transport_list.php b/interface/web/mail/mail_transport_list.php
index aa43090..9d87728 100644
--- a/interface/web/mail/mail_transport_list.php
+++ b/interface/web/mail/mail_transport_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/mail/mail_user_del.php b/interface/web/mail/mail_user_del.php
index af6e6db..26215cf 100644
--- a/interface/web/mail/mail_user_del.php
+++ b/interface/web/mail/mail_user_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index 9d08bd7..2c666b0 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_user_list.php b/interface/web/mail/mail_user_list.php
index c2b7bcc..7e728af 100644
--- a/interface/web/mail/mail_user_list.php
+++ b/interface/web/mail/mail_user_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/mail/mail_user_stats.php b/interface/web/mail/mail_user_stats.php
index ad431e9..f7858aa 100644
--- a/interface/web/mail/mail_user_stats.php
+++ b/interface/web/mail/mail_user_stats.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->load('listform_actions');
 
diff --git a/interface/web/mail/mail_whitelist_del.php b/interface/web/mail/mail_whitelist_del.php
index 47c0189..bb083e6 100644
--- a/interface/web/mail/mail_whitelist_del.php
+++ b/interface/web/mail/mail_whitelist_del.php
@@ -1,54 +1,51 @@
-<?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_whitelist.list.php";
-$tform_def_file = "form/mail_whitelist.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();
-
+<?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_whitelist.list.php";
+$tform_def_file = "form/mail_whitelist.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_whitelist_edit.php b/interface/web/mail/mail_whitelist_edit.php
index 32518e8..2a6134e 100644
--- a/interface/web/mail/mail_whitelist_edit.php
+++ b/interface/web/mail/mail_whitelist_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/mail_whitelist_list.php b/interface/web/mail/mail_whitelist_list.php
index 6844333..6a5358e 100644
--- a/interface/web/mail/mail_whitelist_list.php
+++ b/interface/web/mail/mail_whitelist_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 $app->listform_actions->SQLExtWhere = "access = 'OK'";
diff --git a/interface/web/mail/spamfilter_blacklist_del.php b/interface/web/mail/spamfilter_blacklist_del.php
index 5c87c2c..479d6fd 100644
--- a/interface/web/mail/spamfilter_blacklist_del.php
+++ b/interface/web/mail/spamfilter_blacklist_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/spamfilter_blacklist_edit.php b/interface/web/mail/spamfilter_blacklist_edit.php
index 729c23e..f33f964 100644
--- a/interface/web/mail/spamfilter_blacklist_edit.php
+++ b/interface/web/mail/spamfilter_blacklist_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/spamfilter_blacklist_list.php b/interface/web/mail/spamfilter_blacklist_list.php
index 2b8b322..c2cc411 100644
--- a/interface/web/mail/spamfilter_blacklist_list.php
+++ b/interface/web/mail/spamfilter_blacklist_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 $app->listform_actions->SQLExtWhere = "wb = 'B'";
diff --git a/interface/web/mail/spamfilter_config_del.php b/interface/web/mail/spamfilter_config_del.php
index 8ca69b1..8da9f45 100644
--- a/interface/web/mail/spamfilter_config_del.php
+++ b/interface/web/mail/spamfilter_config_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/spamfilter_config_edit.php b/interface/web/mail/spamfilter_config_edit.php
index 480e249..ad9d2b5 100644
--- a/interface/web/mail/spamfilter_config_edit.php
+++ b/interface/web/mail/spamfilter_config_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/spamfilter_config_list.php b/interface/web/mail/spamfilter_config_list.php
index 4457171..b61472b 100644
--- a/interface/web/mail/spamfilter_config_list.php
+++ b/interface/web/mail/spamfilter_config_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 //$app->listform_actions->SQLExtWhere = "wb = 'W'";
diff --git a/interface/web/mail/spamfilter_policy_del.php b/interface/web/mail/spamfilter_policy_del.php
index 46c69ed..12b6a19 100644
--- a/interface/web/mail/spamfilter_policy_del.php
+++ b/interface/web/mail/spamfilter_policy_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/spamfilter_policy_edit.php b/interface/web/mail/spamfilter_policy_edit.php
index d5d52d5..03b569b 100644
--- a/interface/web/mail/spamfilter_policy_edit.php
+++ b/interface/web/mail/spamfilter_policy_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/spamfilter_policy_list.php b/interface/web/mail/spamfilter_policy_list.php
index 539f8a1..504a2bd 100644
--- a/interface/web/mail/spamfilter_policy_list.php
+++ b/interface/web/mail/spamfilter_policy_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 //$app->listform_actions->SQLExtWhere = "wb = 'W'";
diff --git a/interface/web/mail/spamfilter_users_del.php b/interface/web/mail/spamfilter_users_del.php
index 059376e..83418c8 100644
--- a/interface/web/mail/spamfilter_users_del.php
+++ b/interface/web/mail/spamfilter_users_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/spamfilter_users_edit.php b/interface/web/mail/spamfilter_users_edit.php
index 77050b5..503ff44 100644
--- a/interface/web/mail/spamfilter_users_edit.php
+++ b/interface/web/mail/spamfilter_users_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/spamfilter_users_list.php b/interface/web/mail/spamfilter_users_list.php
index cc33aae..af17f13 100644
--- a/interface/web/mail/spamfilter_users_list.php
+++ b/interface/web/mail/spamfilter_users_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 //$app->listform_actions->SQLExtWhere = "wb = 'W'";
diff --git a/interface/web/mail/spamfilter_whitelist_del.php b/interface/web/mail/spamfilter_whitelist_del.php
index 19803db..2f27d02 100644
--- a/interface/web/mail/spamfilter_whitelist_del.php
+++ b/interface/web/mail/spamfilter_whitelist_del.php
@@ -42,11 +42,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/mail/spamfilter_whitelist_edit.php b/interface/web/mail/spamfilter_whitelist_edit.php
index 3630986..44d10ed 100644
--- a/interface/web/mail/spamfilter_whitelist_edit.php
+++ b/interface/web/mail/spamfilter_whitelist_edit.php
@@ -41,11 +41,8 @@
 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;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/mail/spamfilter_whitelist_list.php b/interface/web/mail/spamfilter_whitelist_list.php
index 2ca0064..12c622a 100644
--- a/interface/web/mail/spamfilter_whitelist_list.php
+++ b/interface/web/mail/spamfilter_whitelist_list.php
@@ -12,11 +12,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
 $app->listform_actions->SQLExtWhere = "wb = 'W'";
diff --git a/interface/web/monitor/logview.php b/interface/web/monitor/logview.php
index 2630e11..84387ef 100644
--- a/interface/web/monitor/logview.php
+++ b/interface/web/monitor/logview.php
@@ -31,11 +31,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'monitor')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('monitor');
 
 // Loading the template
 $app->uses('tpl');
diff --git a/interface/web/monitor/system.php b/interface/web/monitor/system.php
index 8286e2c..430a351 100644
--- a/interface/web/monitor/system.php
+++ b/interface/web/monitor/system.php
@@ -31,11 +31,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'monitor')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('monitor');
 
 $mod = $_GET["mod"];
 $output = '';
diff --git a/interface/web/sites/ajax_get_ip.php b/interface/web/sites/ajax_get_ip.php
index 57e5b77..7c11bcb 100644
--- a/interface/web/sites/ajax_get_ip.php
+++ b/interface/web/sites/ajax_get_ip.php
@@ -31,11 +31,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $server_id = intval($_GET["server_id"]);
 
diff --git a/interface/web/sites/ftp_user_del.php b/interface/web/sites/ftp_user_del.php
index e9b536f..7663f40 100644
--- a/interface/web/sites/ftp_user_del.php
+++ b/interface/web/sites/ftp_user_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php
index 61f549c..ecfeb4a 100644
--- a/interface/web/sites/ftp_user_edit.php
+++ b/interface/web/sites/ftp_user_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/sites/ftp_user_list.php b/interface/web/sites/ftp_user_list.php
index 516739f..f16f5f2 100644
--- a/interface/web/sites/ftp_user_list.php
+++ b/interface/web/sites/ftp_user_list.php
@@ -41,11 +41,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/sites/shell_user_del.php b/interface/web/sites/shell_user_del.php
index c834408..c6c0cdd 100644
--- a/interface/web/sites/shell_user_del.php
+++ b/interface/web/sites/shell_user_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php
index a6d45a4..633ef46 100644
--- a/interface/web/sites/shell_user_edit.php
+++ b/interface/web/sites/shell_user_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/sites/shell_user_list.php b/interface/web/sites/shell_user_list.php
index 3909b84..a9c95fd 100644
--- a/interface/web/sites/shell_user_list.php
+++ b/interface/web/sites/shell_user_list.php
@@ -41,11 +41,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/sites/web_aliasdomain_del.php b/interface/web/sites/web_aliasdomain_del.php
index c4a600d..bb39736 100644
--- a/interface/web/sites/web_aliasdomain_del.php
+++ b/interface/web/sites/web_aliasdomain_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php
index 2aefe52..b9f6e2e 100644
--- a/interface/web/sites/web_aliasdomain_edit.php
+++ b/interface/web/sites/web_aliasdomain_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/sites/web_aliasdomain_list.php b/interface/web/sites/web_aliasdomain_list.php
index 1cf1b66..9417bb3 100644
--- a/interface/web/sites/web_aliasdomain_list.php
+++ b/interface/web/sites/web_aliasdomain_list.php
@@ -41,11 +41,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/sites/web_domain_del.php b/interface/web/sites/web_domain_del.php
index 27c64e6..46dd2b9 100644
--- a/interface/web/sites/web_domain_del.php
+++ b/interface/web/sites/web_domain_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index 5c571c2..2670de7 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/sites/web_domain_list.php b/interface/web/sites/web_domain_list.php
index 03a3cb2..3520c28 100644
--- a/interface/web/sites/web_domain_list.php
+++ b/interface/web/sites/web_domain_list.php
@@ -41,11 +41,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses('listform_actions');
 
diff --git a/interface/web/sites/web_subdomain_del.php b/interface/web/sites/web_subdomain_del.php
index 6c00c95..be43b38 100644
--- a/interface/web/sites/web_subdomain_del.php
+++ b/interface/web/sites/web_subdomain_del.php
@@ -42,11 +42,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checke Berechtigungen f�r Modul
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php
index 91a84d1..49001a3 100644
--- a/interface/web/sites/web_subdomain_edit.php
+++ b/interface/web/sites/web_subdomain_edit.php
@@ -41,11 +41,8 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 // Loading classes
 $app->uses('tpl,tform,tform_actions');
diff --git a/interface/web/sites/web_subdomain_list.php b/interface/web/sites/web_subdomain_list.php
index e104ace..78855ca 100644
--- a/interface/web/sites/web_subdomain_list.php
+++ b/interface/web/sites/web_subdomain_list.php
@@ -41,11 +41,8 @@
 * End Form configuration
 ******************************************/
 
-// Checking module permissions
-if(!stristr($_SESSION["s"]["user"]["modules"],'sites')) {
-	header("Location: ../index.php");
-	exit;
-}
+//* Check permissions for module
+$app->auth->check_module_permissions('sites');
 
 $app->uses('listform_actions');
 
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index c0b04a4..d084d7b 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -292,7 +292,7 @@
 		
 		$username = escapeshellcmd($data["new"]["system_user"]);
 		if($data["new"]["system_user"] != '' && !$app->system->is_user($data["new"]["system_user"])) {
-			exec("useradd -d ".escapeshellcmd($data["new"]["document_root"])." -g $groupname $username");
+			exec("useradd -d ".escapeshellcmd($data["new"]["document_root"])." -g $groupname $username -s /bin/false");
 			$app->log("Adding the user: $username",LOGLEVEL_DEBUG);
 		}
 		

--
Gitblit v1.9.1