From 7fe908c50c8dbc5cc05f571dbe11d66141caacd4 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Nov 2013 09:01:22 -0500
Subject: [PATCH] Cleaning up code to match coding guidelines

---
 interface/web/mail/mail_aliasdomain_edit.php                   |   64 
 remoting_client/examples/dns_zone_set_status.php               |   20 
 interface/web/sites/cron_edit.php                              |  200 
 interface/web/monitor/lib/module.conf.php                      |  254 
 remoting_client/examples/sites_web_subdomain_get.php           |   20 
 interface/web/monitor/log_list.php                             |    6 
 interface/web/sites/list/aps_installedpackages.list.php        |   64 
 interface/web/sites/list/webdav_user.list.php                  |  106 
 server/mods-available/remoteaction_core_module.inc.php         |   40 
 interface/lib/classes/plugin_backuplist.inc.php                |  218 
 interface/lib/classes/listform_actions.inc.php                 |  251 
 interface/web/admin/list/users.list.php                        |   74 
 interface/web/tools/tpl_default.php                            |    6 
 remoting_client/examples/mail_alias_add.php                    |   32 
 remoting_client/examples/sites_shell_user_update.php           |   18 
 remoting_client/examples/sites_database_get.php                |   20 
 interface/web/dns/dns_rr_del.php                               |    9 
 remoting_client/examples/sites_web_aliasdomain_add.php         |  106 
 interface/web/admin/list/server_config.list.php                |   38 
 interface/web/mail/mail_aliasdomain_list.php                   |    6 
 interface/web/client/domain_new_client.php                     |    4 
 interface/web/help/index.php                                   |    2 
 server/server.php                                              |   38 
 interface/web/designer/form_show.php                           |   46 
 remoting_client/examples/sites_database_update.php             |   18 
 interface/web/dns/form/dns_soa.tform.php                       |  394 
 interface/web/client/reseller_list.php                         |    6 
 interface/web/client/domain_del.php                            |   15 
 remoting_client/examples/dns_hinfo_get.php                     |   20 
 install/dist/conf/centos52.conf.php                            |    4 
 interface/web/mailuser/form/mail_user_password.tform.php       |   46 
 interface/web/dns/form/dns_ptr.tform.php                       |  194 
 install/lib/install.lib.php                                    |  263 
 interface/lib/classes/validate_autoresponder.inc.php           |   27 
 interface/web/sites/web_subdomain_del.php                      |    6 
 interface/lib/plugins/vm_openvz_plugin.inc.php                 |  217 
 server/lib/classes/aps_installer.inc.php                       | 1179 
 interface/web/sites/webdav_user_list.php                       |    6 
 server/plugins-available/cron_jailkit_plugin.inc.php           |  390 
 server/scripts/ispconfig_update.php                            |   76 
 interface/web/tools/lib/menu.d/resync.menu.php                 |   18 
 remoting_client/examples/sites_cron_get.php                    |   20 
 helper_scripts/dns_export_to_bind_retrans_daily.php            |    8 
 remoting_client/examples/mail_whitelist_update.php             |   18 
 remoting_client/examples/openvz_ip_add.php                     |   30 
 install/dist/lib/opensuse110.lib.php                           |    2 
 interface/web/designer/module_nav_item_edit.php                |   82 
 interface/web/sites/ftp_user_del.php                           |    6 
 remoting_client/examples/sites_ftp_user_update.php             |   18 
 interface/web/sites/list/web_folder_user.list.php              |   86 
 interface/web/admin/firewall_edit.php                          |    7 
 remoting_client/examples/sites_web_domain_update.php           |   18 
 interface/web/mailuser/lib/module.conf.php                     |   58 
 interface/web/dashboard/lib/admin.conf.php                     |    2 
 interface/web/mail/spamfilter_config_del.php                   |    6 
 interface/web/sites/webdav_user_del.php                        |    6 
 interface/web/mail/mail_relay_recipient_del.php                |    6 
 remoting_client/examples/mail_forward_delete.php               |   16 
 interface/web/sites/webdav_user_edit.php                       |   25 
 remoting_client/examples/dns_zone_update.php                   |   18 
 interface/web/mail/form/spamfilter_whitelist.tform.php         |  134 
 interface/web/mail/form/mail_mailinglist.tform.php             |  166 
 interface/lib/classes/ispcmail.inc.php                         | 1383 
 remoting_client/examples/dns_rp_get.php                        |   20 
 interface/web/dns/list/dns_a.list.php                          |  176 
 server/plugins-available/webmail_symlink_plugin.inc.php        |   88 
 interface/web/admin/firewall_list.php                          |    6 
 interface/web/admin/server_php_del.php                         |    6 
 interface/web/sites/web_vhost_subdomain_edit.php               |  322 
 interface/web/dns/dns_txt_edit.php                             |   39 
 interface/web/dns/form/dns_aaaa.tform.php                      |  166 
 interface/lib/config.inc.php                                   |   54 
 interface/lib/classes/custom_datasource.inc.php                |   68 
 server/plugins-available/squid_plugin.inc.php                  |  132 
 remoting_client/examples/mail_whitelist_delete.php             |   16 
 interface/web/sites/database_edit.php                          |  236 
 remoting_client/examples/dns_ptr_get.php                       |   20 
 interface/web/mail/list/mail_spamfilter.list.php               |   80 
 interface/web/index.php                                        |   22 
 server/lib/classes/mod_mail_base.inc.php                       |   44 
 interface/web/sites/list/web_subdomain.list.php                |  118 
 interface/web/mail/list/mail_aliasdomain.list.php              |   82 
 interface/web/mail/spamfilter_users_del.php                    |    6 
 interface/web/dns/dns_cname_edit.php                           |   41 
 remoting_client/examples/dns_ns_add.php                        |   42 
 remoting_client/examples/dns_aaaa_add.php                      |   42 
 interface/web/dns/form/dns_hinfo.tform.php                     |  178 
 remoting_client/examples/dns_ns_delete.php                     |   16 
 server/plugins-available/cron_plugin.inc.php                   |  305 
 remoting_client/examples/dns_txt_delete.php                    |   16 
 interface/web/dns/dns_template_del.php                         |    6 
 remoting_client/examples/sites_database_user_add.php           |   28 
 remoting_client/examples/mail_mailinglist_add.php              |   32 
 install/dist/conf/opensuse112.conf.php                         |    4 
 interface/web/dns/dns_slave_del.php                            |   15 
 server/mods-available/web_module.inc.php                       |  260 
 interface/web/dns/dns_slave_list.php                           |    6 
 remoting_client/examples/domains_domain_delete.php             |   16 
 interface/web/mail/form/mail_relay_recipient.tform.php         |   98 
 interface/web/sites/aps_installedpackages_list.php             |  108 
 remoting_client/examples/sites_shell_user_delete.php           |   16 
 interface/web/mail/mail_forward_del.php                        |    6 
 remoting_client/examples/dns_a_add.php                         |   42 
 interface/web/sites/aps_install_package.php                    |  188 
 interface/web/login/lib/module.conf.php                        |   10 
 interface/lib/classes/validate_domain.inc.php                  |  249 
 remoting_client/examples/dns_mx_add.php                        |   42 
 remoting_client/examples/mail_user_filter_add.php              |   38 
 interface/web/mail/mail_forward_edit.php                       |   54 
 install/dist/conf/gentoo.conf.php                              |    8 
 interface/web/admin/iptables_list.php                          |    6 
 interface/lib/classes/tree.inc.php                             |  354 
 interface/web/dns/dns_a_edit.php                               |   42 
 interface/web/admin/server_ip_del.php                          |    6 
 interface/web/admin/tpl_default.php                            |   36 
 interface/web/help/faq_manage_questions_list.php               |    6 
 interface/web/mail/mail_spamfilter_edit.php                    |   52 
 interface/web/dns/dns_import.php                               |  406 
 interface/web/admin/form/system_config.tform.php               |  586 
 install/dist/lib/debian40.lib.php                              |    2 
 interface/web/mail/mail_forward_list.php                       |    6 
 interface/web/mail/mail_alias_list.php                         |    6 
 interface/web/tools/index.php                                  |    8 
 remoting_client/examples/domains_domain_add.php                |   24 
 remoting_client/examples/sites_cron_delete.php                 |   16 
 interface/web/admin/lib/module.conf.php                        |  196 
 interface/web/vm/list/openvz_ostemplate.list.php               |  112 
 remoting_client/examples/client_get_id.php                     |   20 
 interface/web/admin/language_add.php                           |   48 
 interface/web/admin/form/server.tform.php                      |  118 
 remoting_client/examples/dns_alias_get.php                     |   20 
 remoting_client/examples/sites_database_get_all_by_user.php    |   20 
 install/dist/conf/debian40.conf.php                            |    4 
 interface/web/dashboard/dashboard.php                          |   50 
 interface/lib/classes/validate_cron.inc.php                    |  304 
 interface/lib/classes/searchform_tpl_generator.inc.php         |   60 
 interface/web/vm/form/openvz_template.tform.php                |  680 
 interface/web/mail/form/mail_spamfilter.tform.php              |  162 
 interface/web/tools/import_plesk.php                           | 1777 
 interface/web/mail/mail_spamfilter_list.php                    |    6 
 interface/web/monitor/list/log.list.php                        |   98 
 remoting_client/examples/mail_domain_add.php                   |   28 
 interface/web/admin/list/firewall.list.php                     |   96 
 interface/web/dns/dns_ptr_edit.php                             |   39 
 interface/web/mail/form/spamfilter_config.tform.php            |  380 
 interface/web/client/client_circle_del.php                     |    4 
 interface/web/dashboard/lib/custom_menu.inc.php                |   42 
 interface/web/dns/form/dns_cname.tform.php                     |  194 
 interface/web/mail/list/mail_relay_recipient.list.php          |   80 
 remoting_client/examples/openvz_template_update.php            |   18 
 server/lib/classes/tpl_error.inc.php                           |  113 
 interface/lib/plugins/mail_user_filter_plugin.inc.php          |  114 
 interface/web/mail/form/spamfilter_policy.tform.php            |  500 
 remoting_client/examples/mail_spamfilter_whitelist_delete.php  |   16 
 interface/web/mail/mail_alias_edit.php                         |   64 
 interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php |   58 
 interface/lib/classes/plugin_listview.inc.php                  |  217 
 interface/lib/app.inc.php                                      |   48 
 interface/web/admin/directive_snippets_list.php                |    6 
 server/lib/classes/tpl_cache.inc.php                           |  287 
 interface/web/sites/database_del.php                           |   15 
 remoting_client/examples/sites_ftp_user_get.php                |   20 
 remoting_client/examples/openvz_vm_add.php                     |   70 
 remoting_client/examples/dns_alias_delete.php                  |   16 
 interface/web/mailuser/mail_user_spamfilter_edit.php           |   44 
 remoting_client/examples/dns_txt_get.php                       |   20 
 interface/web/admin/form/remote_user.tform.php                 |  126 
 interface/web/sites/shell_user_list.php                        |    6 
 remoting_client/examples/sites_web_domain_delete.php           |   16 
 remoting_client/examples/openvz_get_free_ip.php                |   18 
 interface/web/mail/list/mail_content_filter.list.php           |   96 
 interface/web/mailuser/mail_user_filter_list.php               |    8 
 remoting_client/examples/openvz_ostemplate_add.php             |   34 
 interface/web/client/client_del.php                            |  137 
 interface/web/sites/form/ftp_user.tform.php                    |  388 
 interface/web/dns/form/dns_rp.tform.php                        |  178 
 interface/web/mail/mail_content_filter_list.php                |    6 
 install/dist/conf/fedora9.conf.php                             |    4 
 interface/web/sites/list/web_domain.list.php                   |  132 
 interface/web/mail/mail_relay_recipient_edit.php               |    8 
 interface/web/dns/dns_slave_edit.php                           |  100 
 interface/web/admin/list/directive_snippets.list.php           |   70 
 interface/web/designer/module_show.php                         |   44 
 interface/web/mail/form/mail_user.tform.php                    |  436 
 interface/web/monitor/datalog_del.php                          |    6 
 interface/web/dns/dns_template_edit.php                        |    8 
 interface/web/monitor/list/datalog.list.php                    |   98 
 interface/web/tools/import_ispconfig.php                       |  134 
 interface/web/admin/remote_action_ispcupdate.php               |   26 
 interface/web/help/faq_edit.php                                |    6 
 interface/web/admin/form/users.tform.php                       |  348 
 interface/web/dns/dns_ns_edit.php                              |   39 
 interface/web/vm/openvz_ip_edit.php                            |    8 
 interface/web/dns/dns_hinfo_edit.php                           |   39 
 remoting_client/examples/dns_zone_add.php                      |   50 
 interface/web/client/form/client.tform.php                     | 1690 
 interface/web/mail/mail_domain_edit.php                        |   58 
 remoting_client/examples/client_get_by_username.php            |   20 
 interface/web/sites/list/web_sites_stats.list.php              |   44 
 interface/web/mailuser/form/mail_user_spamfilter.tform.php     |   44 
 interface/web/admin/iptables_del.php                           |    6 
 server/plugins-available/maildeliver_plugin.inc.php            |  192 
 remoting_client/examples/mail_mailinglist_update.php           |   18 
 interface/web/dns/list/dns_slave.list.php                      |  104 
 interface/web/mail/lib/remote.conf.php                         |    2 
 interface/web/mail/spamfilter_users_edit.php                   |   19 
 interface/web/sites/shell_user_del.php                         |    6 
 remoting_client/examples/mail_catchall_get.php                 |   20 
 interface/web/mailuser/mail_user_password_edit.php             |   20 
 interface/lib/classes/searchform.inc.php                       |  548 
 interface/web/help/support_message_del.php                     |    6 
 interface/web/monitor/log_del.php                              |    6 
 server/plugins-available/mysql_clientdb_plugin.inc.php         |  783 
 interface/web/sites/cron_del.php                               |   11 
 interface/web/monitor/show_munin.php                           |   14 
 interface/lib/classes/aps_base.inc.php                         |  120 
 interface/web/vm/openvz_ip_list.php                            |    6 
 interface/web/dashboard/dashlets/modules.php                   |   31 
 remoting_client/examples/mail_filter_add.php                   |   34 
 remoting_client/examples/mail_user_add.php                     |   68 
 remoting_client/examples/mail_domain_update.php                |   18 
 interface/web/mail/spamfilter_users_list.php                   |    6 
 interface/web/admin/form/groups.tform.php                      |   86 
 interface/web/mail/list/spamfilter_whitelist.list.php          |  122 
 interface/web/sites/list/database_user.list.php                |   66 
 remoting_client/examples/openvz_ostemplate_get.php             |   20 
 remoting_client/examples/mail_user_filter_delete.php           |   16 
 install/dist/conf/opensuse110.conf.php                         |    4 
 interface/web/designer/lib/module.conf.php                     |   86 
 remoting_client/examples/dns_rp_update.php                     |   18 
 interface/web/admin/remote_user_edit.php                       |   16 
 remoting_client/examples/openvz_vm_update.php                  |   18 
 interface/web/mail/mailinglist.php                             |   12 
 interface/web/mail/form/mail_domain.tform.php                  |  112 
 interface/web/mail/mail_domain_catchall_del.php                |    6 
 remoting_client/examples/mail_blacklist_delete.php             |   16 
 interface/web/mail/spamfilter_blacklist_del.php                |    6 
 interface/web/monitor/datalog_list.php                         |    8 
 interface/web/sites/database_phpmyadmin.php                    |   22 
 interface/web/mail/list/spamfilter_config.list.php             |   38 
 interface/web/mail/spamfilter_config_edit.php                  |   38 
 interface/web/content.php                                      |   26 
 interface/lib/classes/importer.inc.php                         |   69 
 interface/lib/classes/tpl_ini.inc.php                          |  111 
 remoting_client/examples/mail_policy_update.php                |   18 
 interface/web/admin/remote_user_list.php                       |   10 
 interface/web/sites/ajax_get_ip.php                            |   10 
 interface/web/client/client_template_edit.php                  |   17 
 server/lib/classes/getconf.inc.php                             |    9 
 remoting_client/examples/sites_web_subdomain_update.php        |   18 
 interface/web/help/faq_list.php                                |    8 
 interface/web/client/form/client_circle.tform.php              |  126 
 interface/web/sites/web_aliasdomain_del.php                    |    6 
 remoting_client/examples/dns_hinfo_update.php                  |   18 
 remoting_client/examples/mail_fetchmail_add.php                |   40 
 interface/web/mail/mail_content_filter_edit.php                |    7 
 remoting_client/examples/mail_domain_get.php                   |   20 
 interface/web/admin/form/software_repo.tform.php               |  142 
 interface/web/dns/form/dns_template.tform.php                  |   88 
 interface/lib/classes/tform_actions.inc.php                    | 1048 
 interface/web/admin/form/directive_snippets.tform.php          |   94 
 interface/web/vm/openvz_vm_del.php                             |    6 
 interface/web/mail/form/mail_alias.tform.php                   |  142 
 interface/web/js/scrigo.js.php                                 |   97 
 interface/web/mail/lib/admin.conf.php                          |    2 
 interface/web/mailuser/mail_user_autoresponder_edit.php        |   36 
 install/autoupdate.php                                         |   46 
 interface/web/client/domain_edit.php                           |   11 
 interface/web/help/form/faq_sections.tform.php                 |   56 
 interface/web/mail/form/mail_content_filter.tform.php          |  114 
 server/mods-available/mail_module.inc.php                      |  166 
 interface/lib/classes/simplepie.inc.php                        | 3191 
 interface/web/mail/list/mail_user.list.php                     |   92 
 interface/web/dashboard/dashlets/limits.php                    |  188 
 remoting_client/examples/mail_spamfilter_user_delete.php       |   16 
 interface/web/dns/dns_a_list.php                               |    6 
 remoting_client/examples/mail_spamfilter_user_add.php          |   34 
 interface/web/mail/form/mail_user_filter.tform.php             |  142 
 interface/web/admin/form/server_config.tform.php               |  182 
 interface/web/sites/database_user_del.php                      |   55 
 interface/web/designer/index.php                               |    1 
 interface/web/client/client_edit.php                           |  392 
 server/lib/classes/modules.inc.php                             |  152 
 remoting_client/examples/domains_get_all_by_user.php           |   20 
 interface/web/mail/form/spamfilter_blacklist.tform.php         |  120 
 server/cron_daily.php                                          |  970 
 interface/web/admin/list/server_php.list.php                   |   86 
 interface/web/tools/lib/module.conf.php                        |   38 
 interface/web/help/faq_sections_delete.php                     |    6 
 interface/web/mail/spamfilter_whitelist_edit.php               |   21 
 remoting_client/examples/mail_forward_add.php                  |   32 
 interface/lib/classes/validate_dns.inc.php                     |  472 
 interface/web/client/form/client_template.tform.php            |  954 
 install/uninstall.php                                          |    8 
 interface/web/mailuser/mail_user_filter_del.php                |    8 
 remoting_client/examples/mail_blacklist_get.php                |   20 
 server/plugins-available/pma_symlink_plugin.inc.php            |   88 
 server/mods-available/monitor_core_module.inc.php              |  448 
 server/plugins-available/apps_vhost_plugin.inc.php             |   88 
 remoting_client/examples/sites_web_domain_get.php              |   20 
 interface/web/dns/list/dns_template.list.php                   |   52 
 interface/web/mail/list/mail_blacklist.list.php                |   96 
 install/dist/lib/centos52.lib.php                              |   88 
 interface/web/admin/software_package_edit.php                  |    8 
 interface/web/mail/list/mail_whitelist.list.php                |   94 
 remoting_client/examples/mail_spamfilter_blacklist_add.php     |   34 
 helper_scripts/recreate_webalizer_stats.php                    |   44 
 interface/web/sites/aps_do_operation.php                       |  126 
 interface/web/admin/login_as.php                               |   16 
 interface/web/sites/list/web_folder.list.php                   |  112 
 remoting_client/examples/mail_spamfilter_whitelist_get.php     |   20 
 remoting_client/examples/dns_srv_add.php                       |   42 
 interface/web/mail/mail_whitelist_del.php                      |    6 
 remoting_client/examples/sites_database_delete.php             |   16 
 interface/web/admin/groups_del.php                             |    6 
 interface/web/monitor/show_monit.php                           |   14 
 interface/web/mail/list/mail_domain_catchall.list.php          |   82 
 interface/lib/classes/ini_parser.inc.php                       |    4 
 interface/web/remote/monitor.php                               |  140 
 remoting_client/examples/dns_rr_get_all_by_zone.php            |   20 
 remoting_client/examples/mail_transport_get.php                |   20 
 remoting_client/examples/mail_whitelist_add.php                |   32 
 interface/web/designer/module_nav_flip.php                     |   52 
 remoting_client/examples/dns_cname_add.php                     |   42 
 server/mods-available/database_module.inc.php                  |   78 
 interface/lib/classes/tpl.inc.php                              | 2246 
 interface/web/admin/list/remote_user.list.php                  |   49 
 interface/web/client/client_list.php                           |    6 
 interface/web/designer/module_nav_edit.php                     |   82 
 interface/web/help/lib/module.conf.php                         |   74 
 server/plugins-available/mail_plugin.inc.php                   |  206 
 interface/web/mail/mail_blacklist_list.php                     |    6 
 interface/web/admin/server_del.php                             |    6 
 interface/lib/classes/tform.inc.php                            | 2844 
 remoting_client/examples/mail_user_filter_update.php           |   18 
 interface/web/mailuser/list/mail_user_filter.list.php          |   38 
 interface/web/sites/list/cron.list.php                         |  174 
 interface/web/vm/list/openvz_template.list.php                 |   54 
 interface/web/mail/mail_relay_recipient_list.php               |    8 
 server/plugins-available/bind_dlz_plugin.inc.php               |  265 
 remoting_client/examples/mail_forward_update.php               |   18 
 interface/web/client/client_circle_list.php                    |    6 
 interface/web/mail/list/mail_user_stats.list.php               |   44 
 interface/web/sites/lib/module.conf.php                        |  232 
 interface/lib/classes/db_firebird.inc.php                      |  385 
 interface/web/login/index.php                                  |  150 
 interface/web/mail/mail_domain_del.php                         |   33 
 interface/web/mail/mail_content_filter_del.php                 |    6 
 interface/web/sites/list/web_vhost_subdomain.list.php          |  118 
 remoting_client/examples/dns_hinfo_delete.php                  |   16 
 interface/web/mailuser/mail_user_filter_edit.php               |   32 
 interface/web/tools/lib/menu.d/statistics.menu.php             |    2 
 server/lib/classes/tpl.inc.php                                 | 2506 
 interface/web/sites/form/web_domain.tform.php                  | 1078 
 remoting_client/examples/mail_domain_get_by_domain.php         |   20 
 interface/web/dns/form/dns_srv.tform.php                       |  192 
 interface/web/vm/lib/remote.conf.php                           |    2 
 server/mods-available/rescue_core_module.inc.php               |  122 
 interface/lib/classes/sites_database_plugin.inc.php            |   59 
 interface/web/admin/language_import.php                        |  182 
 interface/web/dns/dns_rp_edit.php                              |   39 
 remoting_client/examples/client_update.php                     |   20 
 interface/web/admin/directive_snippets_del.php                 |    6 
 interface/lib/classes/auth.inc.php                             |   66 
 remoting_client/examples/mail_policy_delete.php                |   16 
 interface/web/sites/web_subdomain_edit.php                     |  118 
 interface/web/mail/mail_user_del.php                           |   27 
 remoting_client/examples/dns_aaaa_update.php                   |   18 
 interface/lib/classes/functions.inc.php                        |  254 
 server/plugins-available/postfix_filter_plugin.inc.php         |  110 
 remoting_client/examples/client_get.php                        |   20 
 interface/web/vm/openvz_action.php                             |  134 
 interface/web/dns/dns_aaaa_edit.php                            |   40 
 interface/web/help/faq_sections_edit.php                       |    6 
 remoting_client/examples/openvz_template_add.php               |   98 
 remoting_client/examples/mail_spamfilter_blacklist_delete.php  |   16 
 interface/web/mail/spamfilter_config_list.php                  |    6 
 interface/web/dns/ajax_get_json.php                            |   76 
 interface/web/sites/web_domain_list.php                        |    8 
 interface/web/mail/mail_aliasdomain_del.php                    |    6 
 remoting_client/examples/mail_policy_add.php                   |  100 
 interface/web/admin/server_config_edit.php                     |   44 
 interface/web/client/domain_list.php                           |    6 
 interface/web/mail/list/mail_mailinglist.list.php              |   62 
 remoting_client/examples/client_delete_everything.php          |   16 
 interface/web/admin/form/server_php.tform.php                  |  118 
 interface/web/vm/form/openvz_ostemplate.tform.php              |  132 
 remoting_client/examples/mail_spamfilter_user_update.php       |   18 
 install/dist/lib/gentoo.lib.php                                |  611 
 interface/lib/classes/validate_client.inc.php                  |   72 
 interface/web/monitor/show_sys_state.php                       |  468 
 remoting_client/examples/dns_rp_delete.php                     |   16 
 interface/web/client/list/client_template.list.php             |   68 
 interface/web/sites/web_folder_edit.php                        |   16 
 interface/web/admin/form/firewall.tform.php                    |  114 
 interface/web/sites/cron_list.php                              |    6 
 server/plugins-available/getmail_plugin.inc.php                |  112 
 install/dist/lib/debian60.lib.php                              |   79 
 interface/web/admin/system_config_edit.php                     |  122 
 interface/web/vm/lib/admin.conf.php                            |    2 
 interface/web/dns/dns_mx_edit.php                              |   55 
 remoting_client/examples/dns_ptr_update.php                    |   18 
 server/plugins-available/openvz_plugin.inc.php                 |  136 
 interface/web/mail/mail_user_filter_edit.php                   |   92 
 interface/web/admin/list/groups.list.php                       |   46 
 interface/web/mail/form/mail_get.tform.php                     |  206 
 remoting_client/examples/client_get_sites_by_user.php          |   20 
 interface/web/admin/language_list.php                          |   58 
 interface/web/admin/software_update_list.php                   |   58 
 interface/web/dns/dns_soa_del.php                              |   15 
 server/lib/classes/aps_base.inc.php                            |  120 
 remoting_client/examples/openvz_ip_get.php                     |   20 
 interface/web/mail/spamfilter_blacklist_edit.php               |   21 
 remoting_client/examples/dns_hinfo_add.php                     |   42 
 remoting_client/examples/mail_domain_set_status.php            |   20 
 interface/web/mail/list/spamfilter_blacklist.list.php          |  122 
 interface/lib/classes/plugin_dbhistory.inc.php                 |   67 
 interface/web/admin/users_list.php                             |    6 
 interface/web/client/lib/module.conf.php                       |  100 
 interface/web/dns/form/dns_mx.tform.php                        |  210 
 interface/web/vm/openvz_ostemplate_edit.php                    |    8 
 interface/web/vm/form/openvz_vm.tform.php                      |  454 
 remoting_client/examples/sites_database_user_delete.php        |   16 
 server/plugins-available/powerdns_plugin.inc.php               |  310 
 interface/lib/plugins/sites_web_database_user_plugin.inc.php   |   60 
 interface/web/sites/aps_availablepackages_list.php             |    8 
 interface/web/tools/user_settings.php                          |   54 
 server/plugins-available/iptables_plugin.inc.php               |   68 
 remoting_client/examples/mail_transport_update.php             |   18 
 interface/web/dns/form/dns_ns.tform.php                        |  194 
 interface/web/tools/lib/menu.d/import.menu.php                 |   28 
 helper_scripts/mydns_to_powerdns_migration.php                 |   86 
 interface/web/admin/index.php                                  |   13 
 interface/web/admin/software_package_del.php                   |    8 
 interface/web/dns/form/dns_a.tform.php                         |  180 
 interface/web/admin/form/tpl_default.tform.php                 |   70 
 interface/web/mail/list/spamfilter_policy.list.php             |  102 
 interface/web/vm/openvz_vm_list.php                            |    6 
 server/plugins-available/software_update_plugin.inc.php        |  218 
 interface/web/mail/list/mail_alias.list.php                    |   82 
 remoting_client/examples/mail_alias_get.php                    |   20 
 interface/web/admin/language_edit.php                          |   24 
 interface/web/admin/list/server.list.php                       |  140 
 interface/web/client/client_message.php                        |   58 
 remoting_client/examples/dns_a_update.php                      |   18 
 remoting_client/examples/sites_web_subdomain_add.php           |  106 
 interface/web/admin/language_export.php                        |   52 
 interface/web/mail/list/mail_user_filter.list.php              |   38 
 server/plugins-available/shelluser_jailkit_plugin.inc.php      |  423 
 remoting_client/examples/sites_database_add.php                |   44 
 interface/web/dns/lib/remote.conf.php                          |    2 
 interface/web/vm/openvz_ostemplate_list.php                    |    6 
 remoting_client/examples/dns_mx_update.php                     |   18 
 interface/web/sites/web_folder_del.php                         |   15 
 remoting_client/examples/get_function_list.php                 |   20 
 interface/lib/classes/listform_tpl_generator.inc.php           |   90 
 server/plugins-available/apache2_plugin.inc.php                | 2140 
 interface/web/mail/mail_mailinglist_del.php                    |    6 
 interface/web/sites/aps_update_packagelist.php                 |   12 
 remoting_client/examples/dns_mx_delete.php                     |   16 
 interface/web/mail/webmailer.php                               |   12 
 interface/web/mail/spamfilter_policy_edit.php                  |   17 
 remoting_client/examples/client_templates_get_all.php          |   18 
 interface/lib/classes/session.inc.php                          |   92 
 remoting_client/examples/sites_web_aliasdomain_get.php         |   20 
 interface/lib/classes/form.inc.php                             |  551 
 remoting_client/examples/mail_filter_update.php                |   18 
 remoting_client/examples/openvz_vm_delete.php                  |   16 
 interface/web/sites/lib/remote.conf.php                        |    2 
 install/setrights.php                                          |   36 
 remoting_client/examples/openvz_ip_delete.php                  |   16 
 interface/lib/classes/tform_tpl_generator.inc.php              |  293 
 server/plugins-available/mailman_plugin.inc.php                |   82 
 server/lib/classes/ini_parser.inc.php                          |   10 
 server/plugins-available/postfix_server_plugin.inc.php         |   60 
 interface/lib/classes/searchform_actions.inc.php               |   99 
 interface/web/admin/server_ip_edit.php                         |    7 
 interface/web/tools/lib/interface.d/tpl_default.menu.php       |    4 
 install/dist/lib/centos53.lib.php                              |   88 
 remoting_client/examples/mail_domain_delete.php                |   16 
 interface/web/sites/web_subdomain_list.php                     |    6 
 remoting_client/examples/dns_a_get.php                         |   20 
 remoting_client/examples/dns_aaaa_get.php                      |   20 
 interface/web/vm/form/openvz_ip.tform.php                      |  116 
 remoting_client/examples/server_get.php                        |   20 
 server/plugins-available/maildrop_plugin.inc.php               |  240 
 remoting_client/examples/mail_spamfilter_blacklist_update.php  |   18 
 server/plugins-available/nginx_plugin.inc.php                  | 2094 
 interface/lib/classes/db_mysql.inc.php                         |  936 
 remoting_client/examples/sites_database_user_get.php           |   20 
 remoting_client/examples/soap-database-add.php                 |   55 
 install/dist/conf/centos53.conf.php                            |    4 
 interface/web/mail/list/mail_domain.list.php                   |  114 
 interface/web/vm/openvz_vm_edit.php                            |   58 
 interface/web/admin/users_edit.php                             |   34 
 interface/web/designer/module_nav_item_del.php                 |   52 
 remoting_client/examples/dns_ns_get.php                        |   20 
 interface/web/mail/form/mail_blacklist.tform.php               |  106 
 remoting_client/examples/client_change_password.php            |   20 
 server/plugins-available/shelluser_base_plugin.inc.php         |  176 
 remoting_client/examples/dns_ptr_add.php                       |   42 
 remoting_client/examples/dns_aaaa_delete.php                   |   16 
 interface/web/help/list/faq_sections_list.php                  |    2 
 interface/web/mail/form/spamfilter_users.tform.php             |  144 
 interface/web/vm/openvz_ostemplate_del.php                     |    6 
 interface/web/mail/mail_get_edit.php                           |   34 
 interface/web/mail/spamfilter_whitelist_del.php                |    6 
 interface/web/designer/module_nav_del.php                      |   50 
 interface/web/sites/list/aps_availablepackages.list.php        |   74 
 interface/web/mail/mail_domain_catchall_list.php               |    6 
 interface/web/admin/software_package_list.php                  |  120 
 interface/web/sites/web_aliasdomain_edit.php                   |   90 
 install/dist/conf/debian60.conf.php                            |    6 
 interface/web/mail/mail_user_filter_del.php                    |   18 
 interface/web/admin/server_config_list.php                     |    6 
 remoting_client/examples/mail_mailinglist_delete.php           |   16 
 interface/web/dns/dns_alias_edit.php                           |   39 
 remoting_client/examples/dns_ptr_delete.php                    |   16 
 interface/web/mail/user_quota_stats.php                        |   41 
 remoting_client/examples/sites_database_user_update.php        |   18 
 interface/web/mail/list/mail_forward.list.php                  |   82 
 remoting_client/examples/sites_web_subdomain_delete.php        |   16 
 remoting_client/examples/mail_blacklist_update.php             |   18 
 server/lib/classes/services.inc.php                            |   35 
 remoting_client/examples/dns_zone_get.php                      |   20 
 server/lib/classes/plugins.inc.php                             |   92 
 interface/web/mail/mail_blacklist_edit.php                     |   18 
 remoting_client/examples/mail_mailinglist_get.php              |   20 
 interface/web/sites/web_folder_list.php                        |    6 
 interface/web/sites/lib/admin.conf.php                         |    2 
 interface/web/admin/form/iptables.tform.php                    |  168 
 interface/web/client/form/reseller.tform.php                   | 1692 
 interface/web/vm/list/openvz_vm.list.php                       |  176 
 interface/web/mail/form/mail_whitelist.tform.php               |  106 
 interface/web/sites/web_folder_user_edit.php                   |   17 
 interface/web/nav.php                                          |   30 
 interface/web/sites/form/cron.tform.php                        |  270 
 remoting_client/examples/openvz_vm_get_by_client.php           |   20 
 remoting_client/examples/dns_rp_add.php                        |   42 
 interface/web/admin/software_package_install.php               |   78 
 interface/web/vm/openvz_template_list.php                      |    6 
 interface/web/tools/form/user_settings.tform.php               |  112 
 interface/web/mail/mail_alias_del.php                          |    6 
 remoting_client/examples/mail_catchall_delete.php              |   16 
 remoting_client/examples/mail_transport_delete.php             |   16 
 interface/web/client/client_circle_edit.php                    |    4 
 remoting_client/examples/sites_shell_user_add.php              |   48 
 interface/web/sites/aps_cron_apscrawler_if.php                 |    6 
 interface/web/help/list/faq_manage_questions_list.php          |   26 
 interface/web/monitor/show_log.php                             |  102 
 install/dist/lib/opensuse.lib.php                              |  910 
 remoting_client/examples/openvz_ostemplate_delete.php          |   16 
 interface/web/sites/web_domain_edit.php                        |  368 
 interface/web/admin/server_php_list.php                        |    6 
 remoting_client/examples/openvz_ip_update.php                  |   18 
 remoting_client/examples/domains_domain_get.php                |   20 
 interface/web/mailuser/form/mail_user_autoresponder.tform.php  |   86 
 interface/web/capp.php                                         |   40 
 interface/web/help/faq_sections_list.php                       |    6 
 interface/web/sites/form/web_subdomain.tform.php               |  202 
 server/plugins-available/firewall_plugin.inc.php               |  228 
 interface/web/mail/mail_domain_catchall_edit.php               |   52 
 interface/web/mailuser/mail_user_cc_edit.php                   |   32 
 interface/web/sites/web_folder_user_del.php                    |    6 
 install/dist/lib/fedora.lib.php                                |  868 
 interface/web/sites/form/database_user.tform.php               |  114 
 interface/web/vm/list/openvz_ip.list.php                       |  110 
 interface/lib/classes/plugin_base.inc.php                      |   26 
 interface/web/client/list/domain.list.php                      |   70 
 interface/web/mail/mail_user_stats.php                         |  103 
 remoting_client/examples/mail_alias_update.php                 |   18 
 interface/web/help/support_message_edit.php                    |   58 
 install/lib/installer_base.lib.php                             |  749 
 interface/web/mail/mail_get_del.php                            |    6 
 interface/lib/classes/cmstree.inc.php                          |   18 
 interface/lib/classes/remoting.inc.php                         | 3306 
 interface/web/admin/server_ip_list.php                         |    6 
 remoting_client/examples/client_delete.php                     |   16 
 server/plugins-available/bind_plugin.inc.php                   |  424 
 remoting_client/examples/mail_fetchmail_get.php                |   20 
 interface/web/tools/resync.php                                 |   40 
 server/mods-available/cron_module.inc.php                      |   56 
 remoting_client/examples/sites_ftp_user_add.php                |   54 
 interface/web/admin/server_edit.php                            |   22 
 interface/web/mail/spamfilter_whitelist_list.php               |    6 
 interface/web/dashboard/dashlets/mailquota.php                 |   43 
 remoting_client/examples/dns_txt_add.php                       |   42 
 remoting_client/examples/sites_cron_add.php                    |   46 
 interface/web/admin/users_del.php                              |    6 
 server/mods-available/vm_module.inc.php                        |   86 
 interface/web/client/client_template_list.php                  |    4 
 remoting_client/examples/dns_mx_get.php                        |   20 
 remoting_client/examples/mail_filter_delete.php                |   16 
 remoting_client/examples/server_get_serverid_by_ip.php         |   20 
 interface/web/help/form/support_message.tform.php              |  144 
 remoting_client/examples/dns_a_delete.php                      |   16 
 interface/web/sites/user_quota_stats.php                       |   43 
 interface/web/mail/form/mail_aliasdomain.tform.php             |  140 
 interface/web/client/list/client_circle.list.php               |   88 
 remoting_client/examples/openvz_vm_get.php                     |   20 
 server/mods-available/server_module.inc.php                    |  106 
 interface/lib/classes/validate_datetime.inc.php                |   78 
 interface/web/client/lib/admin.conf.php                        |    2 
 interface/lib/classes/validate_database.inc.php                |   72 
 remoting_client/examples/mail_user_filter_get.php              |   20 
 interface/lib/classes/getconf.inc.php                          |    7 
 interface/web/tools/interface_settings.php                     |  123 
 install/patches/upd_0001.php                                   |   16 
 interface/lib/classes/tpl_cache.inc.php                        |  287 
 interface/web/dns/form/dns_slave.tform.php                     |  156 
 interface/web/mail/mail_whitelist_list.php                     |    6 
 interface/web/mail/list/mail_get.list.php                      |  118 
 interface/web/vm/lib/module.conf.php                           |   52 
 remoting_client/examples/dns_zone_get_by_user.php              |   20 
 interface/web/keepalive.php                                    |    6 
 remoting_client/examples/sites_web_aliasdomain_delete.php      |   16 
 interface/web/dashboard/dashlets/quota.php                     |   55 
 interface/web/remote/index.php                                 |    6 
 interface/web/designer/lib/admin.conf.php                      |    2 
 interface/web/mail/spamfilter_policy_list.php                  |    6 
 interface/web/login/password_reset.php                         |   34 
 interface/web/mail/mail_user_edit.php                          |  144 
 remoting_client/examples/mail_user_get.php                     |   20 
 remoting_client/examples/dns_srv_update.php                    |   18 
 server/plugins-available/backup_plugin.inc.php                 |   78 
 server/mods-available/client_module.inc.php                    |   56 
 interface/web/admin/lib/remote.conf.php                        |    2 
 install/dist/lib/fedora9.lib.php                               |    2 
 interface/web/sites/form/web_folder.tform.php                  |  106 
 interface/web/designer/module_list.php                         |   34 
 remoting_client/examples/openvz_ostemplate_update.php          |   18 
 remoting_client/examples/openvz_vm_add_from_template.php       |   22 
 interface/lib/plugins/sites_web_domain_plugin.inc.php          |  124 
 interface/web/admin/remote_user_del.php                        |   11 
 interface/lib/classes/tools_sites.inc.php                      |  275 
 interface/web/mail/mail_domain_list.php                        |    6 
 interface/web/vm/openvz_template_del.php                       |    6 
 server/lib/classes/monitor_tools.inc.php                       |  519 
 interface/web/designer/module_edit.php                         |   92 
 remoting_client/examples/mail_catchall_add.php                 |   32 
 remoting_client/examples/mail_spamfilter_whitelist_update.php  |   18 
 install/lib/update.lib.php                                     |  108 
 interface/web/mailuser/lib/remote.conf.php                     |    2 
 server/plugins-available/nginx_reverseproxy_plugin.inc.php     |  214 
 server/lib/classes/openvz_tools.inc.php                        |    8 
 interface/lib/plugins/clients_template_plugin.inc.php          |   42 
 remoting_client/examples/dns_cname_delete.php                  |   16 
 remoting_client/examples/dns_txt_update.php                    |   18 
 interface/web/sites/form/database.tform.php                    |  210 
 interface/web/dns/dns_soa_edit.php                             |  116 
 server/lib/classes/system.inc.php                              | 2085 
 interface/web/client/list/client.list.php                      |  130 
 interface/web/admin/form/server_ip.tform.php                   |  150 
 interface/web/sites/form/web_vhost_subdomain.tform.php         | 1070 
 remoting_client/examples/mail_filter_get.php                   |   20 
 server/lib/app.inc.php                                         |  200 
 remoting_client/examples/sites_cron_update.php                 |   18 
 install/install.php                                            |  216 
 install/uninstall-fedora.php                                   |    8 
 server/plugins-available/aps_plugin.inc.php                    |  116 
 interface/web/admin/list/software_repo.list.php                |   70 
 remoting_client/examples/mail_alias_delete.php                 |   16 
 interface/web/mailuser/form/mail_user_filter.tform.php         |  134 
 remoting_client/examples/mail_spamfilter_user_get.php          |   20 
 remoting_client/examples/sites_shell_user_get.php              |   20 
 interface/web/admin/list/server_ip.list.php                    |  130 
 remoting_client/examples/mail_forward_get.php                  |   20 
 interface/web/dns/dns_srv_edit.php                             |    7 
 interface/web/vm/ajax_get_ip.php                               |   10 
 interface/web/admin/language_complete.php                      |   94 
 interface/web/dns/dns_wizard.php                               |  104 
 interface/web/sites/database_user_edit.php                     |  130 
 interface/web/admin/form/filesync.tform.php                    |  238 
 interface/web/admin/directive_snippets_edit.php                |    6 
 remoting_client/examples/mail_catchall_update.php              |   18 
 interface/web/mail/list/spamfilter_users.list.php              |  122 
 server/lib/classes/db_mysql.inc.php                            |  914 
 interface/web/admin/firewall_del.php                           |    6 
 interface/web/sites/list/ftp_user.list.php                     |  112 
 interface/web/mail/mail_transport_edit.php                     |   46 
 remoting_client/examples/mail_user_update.php                  |   18 
 interface/web/mail/list/mail_transport.list.php                |  118 
 interface/web/mail/mail_mailinglist_list.php                   |   22 
 interface/web/sites/form/web_aliasdomain.tform.php             |  228 
 remoting_client/examples/dns_alias_add.php                     |   42 
 interface/lib/classes/aps_crawler.inc.php                      |  992 
 interface/web/mail/form/mail_forward.tform.php                 |  130 
 interface/web/tools/form/interface_settings.tform.php          |  126 
 install/lib/mysql.lib.php                                      |  574 
 interface/lib/classes/validate_ftpuser.inc.php                 |  110 
 interface/web/admin/software_repo_edit.php                     |    8 
 remoting_client/examples/sites_web_domain_set_status.php       |   20 
 interface/web/login/logout.php                                 |   12 
 interface/web/dns/lib/admin.conf.php                           |    2 
 server/lib/classes/tpl_ini.inc.php                             |  117 
 interface/web/mail/list/user_quota_stats.list.php              |   70 
 interface/web/sites/shell_user_edit.php                        |   85 
 server/lib/classes/file.inc.php                                |  483 
 interface/web/sites/form/web_folder_user.tform.php             |  124 
 interface/web/sites/form/shell_user.tform.php                  |  278 
 interface/web/dashboard/ajax_get_json.php                      |  222 
 interface/lib/classes/tpl_error.inc.php                        |  113 
 interface/web/admin/software_repo_del.php                      |    6 
 interface/web/mail/mail_user_list.php                          |   32 
 interface/web/monitor/show_data.php                            |  178 
 interface/web/sites/ftp_user_list.php                          |   24 
 remoting_client/examples/mail_fetchmail_delete.php             |   16 
 interface/web/vm/openvz_ip_del.php                             |    6 
 interface/web/help/lib/admin.conf.php                          |    2 
 interface/web/admin/groups_list.php                            |    6 
 install/dist/lib/opensuse112.lib.php                           |    2 
 interface/web/sites/web_domain_del.php                         |   77 
 interface/web/mailuser/index.php                               |   20 
 interface/web/dns/lib/module.conf.php                          |   68 
 interface/web/dns/list/dns_soa.list.php                        |  128 
 interface/web/mail/mail_spamfilter_del.php                     |    6 
 interface/lib/classes/aps_guicontroller.inc.php                | 1404 
 interface/web/admin/remote_action_osupdate.php                 |   26 
 helper_scripts/dns_export_to_bind.php                          |  148 
 interface/web/client/list/reseller.list.php                    |  142 
 interface/lib/classes/validate_reseller.inc.php                |   16 
 remoting_client/examples/dns_srv_delete.php                    |   16 
 interface/lib/classes/remoting_lib.inc.php                     | 1668 
 remoting_client/examples/mail_transport_add.php                |   32 
 remoting_client/examples/dns_ns_update.php                     |   18 
 interface/web/client/reseller_del.php                          |   33 
 interface/web/sites/database_list.php                          |   22 
 interface/web/sites/web_aliasdomain_list.php                   |    6 
 interface/web/mail/mail_transport_del.php                      |    6 
 remoting_client/examples/mail_policy_get.php                   |   20 
 interface/web/designer/form_list.php                           |   44 
 interface/lib/classes/tools_monitor.inc.php                    |  612 
 remoting_client/examples/sites_web_aliasdomain_update.php      |   18 
 server/plugins-available/ftpuser_base_plugin.inc.php           |  146 
 interface/web/help/faq_delete.php                              |    6 
 interface/web/vm/openvz_template_edit.php                      |   20 
 interface/web/dns/form/dns_alias.tform.php                     |  198 
 interface/web/admin/form/software_package.tform.php            |   82 
 remoting_client/examples/mail_fetchmail_update.php             |   18 
 remoting_client/examples/mail_whitelist_get.php                |   20 
 interface/web/admin/server_config_del.php                      |    6 
 server/mods-available/dns_module.inc.php                       |  166 
 interface/web/tools/dns_import_tupa.php                        |   66 
 interface/lib/classes/plugin.inc.php                           |  120 
 interface/web/help/version.php                                 |    6 
 interface/web/mailuser/form/mail_user_cc.tform.php             |   68 
 interface/web/mail/mail_whitelist_edit.php                     |   18 
 remoting_client/examples/dns_srv_get.php                       |   20 
 remoting_client/examples/sites_web_domain_add.php              |  104 
 interface/web/sites/web_vhost_subdomain_del.php                |   23 
 remoting_client/examples/mail_spamfilter_whitelist_add.php     |   34 
 interface/web/sites/aps_packagedetails_show.php                |   46 
 interface/web/admin/list/iptables.list.php                     |  182 
 remoting_client/examples/mail_spamfilter_blacklist_get.php     |   20 
 interface/web/sites/form/webdav_user.tform.php                 |  152 
 interface/web/admin/iptables_edit.php                          |    8 
 interface/web/admin/server_list.php                            |    6 
 interface/web/mailuser/lib/admin.conf.php                      |    2 
 remoting_client/examples/dns_cname_get.php                     |   20 
 interface/web/mail/mail_blacklist_del.php                      |    6 
 remoting_client/examples/dns_alias_update.php                  |   18 
 interface/web/tools/form/tpl_default.tform.php                 |  166 
 interface/web/designer/form_edit.php                           |   70 
 remoting_client/examples/mail_user_delete.php                  |   16 
 interface/web/client/form/domain.tform.php                     |   84 
 interface/web/mail/mail_mailinglist_edit.php                   |   62 
 interface/web/mail/form/mail_transport.tform.php               |  116 
 interface/web/help/form/faq.tform.php                          |  114 
 remoting_client/examples/logout.php                            |   16 
 install/update.php                                             |  160 
 interface/web/monitor/lib/admin.conf.php                       |    2 
 remoting_client/examples/sites_ftp_user_delete.php             |   16 
 interface/web/admin/form/dbsync.tform.php                      |  330 
 interface/web/dns/dns_template_list.php                        |    6 
 remoting_client/examples/client_add.php                        |  144 
 interface/web/sites/database_user_list.php                     |   14 
 remoting_client/examples/openvz_template_get.php               |   20 
 interface/web/sites/list/web_aliasdomain.list.php              |  118 
 interface/web/mail/form/mail_domain_catchall.tform.php         |  142 
 server/plugins-available/network_settings_plugin.inc.php       |  204 
 interface/web/sites/ftp_user_edit.php                          |   81 
 interface/web/dashboard/lib/module.conf.php                    |   22 
 interface/web/help/support_message_list.php                    |    6 
 interface/web/mail/mail_get_list.php                           |    6 
 interface/web/admin/groups_edit.php                            |    6 
 interface/web/designer/module_nav_item_flip.php                |   54 
 interface/web/sites/list/database.list.php                     |  182 
 interface/web/sites/list/shell_user.list.php                   |  112 
 interface/web/sites/web_sites_stats.php                        |  141 
 remoting_client/examples/login.php                             |   18 
 interface/web/admin/server_php_edit.php                        |    7 
 interface/web/admin/software_repo_list.php                     |    6 
 interface/web/dns/form/dns_txt.tform.php                       |  174 
 interface/web/help/list/support_message.list.php               |   82 
 interface/web/sites/web_vhost_subdomain_list.php               |    6 
 interface/web/mail/mail_transport_list.php                     |    6 
 interface/web/sites/list/user_quota_stats.list.php             |   60 
 remoting_client/examples/mail_blacklist_add.php                |   32 
 remoting_client/examples/dns_cname_update.php                  |   18 
 interface/web/sites/web_folder_user_list.php                   |    6 
 interface/web/dns/dns_soa_list.php                             |    6 
 remoting_client/examples/openvz_template_delete.php            |   16 
 interface/web/mail/lib/module.conf.php                         |  232 
 interface/web/mail/spamfilter_policy_del.php                   |    6 
 interface/lib/classes/listform.inc.php                         |  826 
 interface/web/client/reseller_edit.php                         |  115 
 remoting_client/examples/dns_zone_delete.php                   |   16 
 interface/web/client/client_template_del.php                   |   17 
 interface/web/sites/ajax_get_json.php                          |  286 
 interface/web/help/list/faq_list.php                           |    2 
 interface/web/mail/spamfilter_blacklist_list.php               |    6 
 interface/lib/classes/client_templates.inc.php                 |  427 
 812 files changed, 50,988 insertions(+), 50,163 deletions(-)

diff --git a/helper_scripts/dns_export_to_bind.php b/helper_scripts/dns_export_to_bind.php
index ea5adf9..6a3f590 100644
--- a/helper_scripts/dns_export_to_bind.php
+++ b/helper_scripts/dns_export_to_bind.php
@@ -2,103 +2,103 @@
 $host="IP_ADDRESS";
 $user="USERNAME";
 $password="PASSWORD";
-mysql_connect($host,$user,$password) or die(mysql_error());
+mysql_connect($host, $user, $password) or die(mysql_error());
 mysql_select_db("dbispconfig");
 $result = "";
 $result = mysql_query("SELECT id,origin,ns,ttl,mbox,serial,refresh,retry,expire,minimum FROM dns_soa;");
 function hostname2ipfunktion($tmp1, $timeout = 1)
-        {
-                if ($tmp1 == 0)
-                {
-                $query = `nslookup -timeout=$timeout -retry=0 $tmp1`;
-                if(preg_match('/\nAddress: (.*)\n/', $query, $matches))
-                return trim($matches[1]);
-                return $tmp1;
-                }
-        }
+{
+	if ($tmp1 == 0)
+	{
+		$query = `nslookup -timeout=$timeout -retry=0 $tmp1`;
+		if(preg_match('/\nAddress: (.*)\n/', $query, $matches))
+			return trim($matches[1]);
+		return $tmp1;
+	}
+}
 
 $serialsearch=date("Ymd");
 $resultx12 = mysql_query("SELECT origin,serial FROM dns_soa WHERE serial LIKE '$serialsearch%' ORDER BY origin ASC;");
 while ($rowx12=mysql_fetch_array($resultx12)) {
-        $zone=substr($rowx12["origin"],0,-1);
-        $filename_x1="/var/cache/bind/".$zone;
-        if (file_exists($filename_x1)) {
-        $serialvergleich[$zone]=exec("grep \";Serial\" /var/cache/bind/$zone |cut -d\" \" -f1 | awk '{print $1}'");
- }
+	$zone=substr($rowx12["origin"], 0, -1);
+	$filename_x1="/var/cache/bind/".$zone;
+	if (file_exists($filename_x1)) {
+		$serialvergleich[$zone]=exec("grep \";Serial\" /var/cache/bind/$zone |cut -d\" \" -f1 | awk '{print $1}'");
+	}
 }
 
 while($row = mysql_fetch_array($result))
-        {
-### Hier ALLES Aktivieren bei Primary Nameserver TEIL 1 #################################################################################
-        $varx11=substr($row["origin"],0,-1);
-        $filename="/var/cache/bind/".$varx11;
-        if (file_exists($filename)) {
-        unlink("/var/cache/bind/$varx11");
-        }
-        $arr1[$x11]="zone \"$varx11\" in { type master; file \"$varx11\"; };\n";
-        $x11=$x11+1;
-        $result2 = mysql_query("select name,type,aux,data from dns_rr where zone=$row[id] and active='Y' ORDER BY name ASC;");
-        $arr3[0]="\$TTL ".$row['ttl']."\n@ IN SOA ".$row['ns']." ".$row['mbox']." (\n           ".$row['serial']." ;Serial\n"."         ".$row['refresh']." ;Refresh\n"."               ".$row['retry']." ;Retry\n"."           ".$row['expire']." ;Expire\n"."         ".$row['minimum']." ) ;Minimum\n\n";
+{
+	//## Hier ALLES Aktivieren bei Primary Nameserver TEIL 1 #################################################################################
+	$varx11=substr($row["origin"], 0, -1);
+	$filename="/var/cache/bind/".$varx11;
+	if (file_exists($filename)) {
+		unlink("/var/cache/bind/$varx11");
+	}
+	$arr1[$x11]="zone \"$varx11\" in { type master; file \"$varx11\"; };\n";
+	$x11=$x11+1;
+	$result2 = mysql_query("select name,type,aux,data from dns_rr where zone=$row[id] and active='Y' ORDER BY name ASC;");
+	$arr3[0]="\$TTL ".$row['ttl']."\n@ IN SOA ".$row['ns']." ".$row['mbox']." (\n           ".$row['serial']." ;Serial\n"."         ".$row['refresh']." ;Refresh\n"."               ".$row['retry']." ;Retry\n"."           ".$row['expire']." ;Expire\n"."         ".$row['minimum']." ) ;Minimum\n\n";
 
-                $xx1=1;
-                while($row2 = mysql_fetch_row($result2))
-                {
-                $arr2[$xx1]=$row2['0']." IN ".$row2['1']." ";
+	$xx1=1;
+	while($row2 = mysql_fetch_row($result2))
+	{
+		$arr2[$xx1]=$row2['0']." IN ".$row2['1']." ";
 
-                        if ($row2['2']>0)
-                        {
-                        $arr3[$xx1]=$arr2[$xx1].$row2['2']." ".$row2['3']."\n";
-                        }
-                        else
-                        {
-                        $arr3[$xx1]=$arr2[$xx1].$row2['3']."\n";
-                        }
-                $xx1=$xx1+1;
-                }
-        $f = fopen("/var/cache/bind/$varx11", "a+");
-        foreach($arr3 as $values) fputs($f, $values);
-        fclose($f);
-        $arr2=array();
-        $arr3=array();
-### ENDE Primärer Nameserver TEIL 2 #####################################################################################################
+		if ($row2['2']>0)
+		{
+			$arr3[$xx1]=$arr2[$xx1].$row2['2']." ".$row2['3']."\n";
+		}
+		else
+		{
+			$arr3[$xx1]=$arr2[$xx1].$row2['3']."\n";
+		}
+		$xx1=$xx1+1;
+	}
+	$f = fopen("/var/cache/bind/$varx11", "a+");
+	foreach($arr3 as $values) fputs($f, $values);
+	fclose($f);
+	$arr2=array();
+	$arr3=array();
+	//## ENDE Primärer Nameserver TEIL 2 #####################################################################################################
 
-### Hier ALLES Aktivieren bei Secondary Nameserver ######################################################################################
-#       $tmp1 = substr($row["ns"],0,-1);
-#       $tmp2 = substr($row["origin"],0,-1);
+	//## Hier ALLES Aktivieren bei Secondary Nameserver ######################################################################################
+	//       $tmp1 = substr($row["ns"],0,-1);
+	//       $tmp2 = substr($row["origin"],0,-1);
 
-#       if (!isset($dnscache[$tmp1])) $nsip = hostname2ipfunktion($tmp1) ;
-#       else $nsip=$dnscache[$tmp1] ;
+	//       if (!isset($dnscache[$tmp1])) $nsip = hostname2ipfunktion($tmp1) ;
+	//       else $nsip=$dnscache[$tmp1] ;
 
-#               if ($nsip == $tmp1) 
-#               {
-#               echo "$tmp2 $tmp1 Not a valid Nameserver";
-#               echo "\n";
-#               }
-#               else 
-#               {
-#               $dnscache[$tmp1]=$nsip;
-#               $arr1[$x11]="zone \"".$tmp2."\" in { type slave; file \"".$tmp2."\"; masters {".$nsip."; }; };\n";
-#               $x11=$x11+1;
-#               }
-### ENDE Secondary Nameserver ###########################################################################################################
-        }
+	//               if ($nsip == $tmp1)
+	//               {
+	//               echo "$tmp2 $tmp1 Not a valid Nameserver";
+	//               echo "\n";
+	//               }
+	//               else
+	//               {
+	//               $dnscache[$tmp1]=$nsip;
+	//               $arr1[$x11]="zone \"".$tmp2."\" in { type slave; file \"".$tmp2."\"; masters {".$nsip."; }; };\n";
+	//               $x11=$x11+1;
+	//               }
+	//## ENDE Secondary Nameserver ###########################################################################################################
+}
 
-unlink ("/etc/bind/named.conf.local");
+unlink("/etc/bind/named.conf.local");
 $fx = fopen("/etc/bind/named.conf.local", "a+");
 foreach($arr1 as $values) fputs($fx, $values);
 fclose($fx);
 system("rndc reconfig >/dev/null 2>&1");
 
-### ANFANG Primärer Namerserver TEIL 2 ##################################################################################################
+//## ANFANG Primärer Namerserver TEIL 2 ##################################################################################################
 $serialsearch=date("Ymd");
 $resultx13 = mysql_query("SELECT origin,serial FROM dns_soa WHERE serial LIKE '$serialsearch%' ORDER BY origin ASC;");
 while ($rowx13=mysql_fetch_array($resultx13)) {
-        $serial_ist=($rowx13["serial"]);
-        $zone=substr($rowx13["origin"],0,-1);
-#       echo "zone: ".$zone." ist: ".$serial_ist." vergleich: ".$serialvergleich[$zone]."\n";
-        if ($serialvergleich[$zone] != $serial_ist) {
-        $reload=system("rndc reload $zone >/dev/null 2>&1");
-        }
+	$serial_ist=($rowx13["serial"]);
+	$zone=substr($rowx13["origin"], 0, -1);
+	//       echo "zone: ".$zone." ist: ".$serial_ist." vergleich: ".$serialvergleich[$zone]."\n";
+	if ($serialvergleich[$zone] != $serial_ist) {
+		$reload=system("rndc reload $zone >/dev/null 2>&1");
+	}
 }
-### ENDE Primärer NamerserverTEIL 2 ######################################################################################################
-?>
\ No newline at end of file
+//## ENDE Primärer NamerserverTEIL 2 ######################################################################################################
+?>
diff --git a/helper_scripts/dns_export_to_bind_retrans_daily.php b/helper_scripts/dns_export_to_bind_retrans_daily.php
index 39faf14..a571367 100644
--- a/helper_scripts/dns_export_to_bind_retrans_daily.php
+++ b/helper_scripts/dns_export_to_bind_retrans_daily.php
@@ -2,13 +2,13 @@
 $host="IP_ADDRESS";
 $user="USERNAME";
 $password="PASSWORD";
-mysql_connect($host,$user,$password) or die(mysql_error());
+mysql_connect($host, $user, $password) or die(mysql_error());
 mysql_select_db("dbispconfig");
 $result = "";
 $result = mysql_query("SELECT origin FROM dns_soa ORDER BY origin ASC;");
 while($row = mysql_fetch_array($result))
 {
-        $zone=substr($row["origin"],0,-1);
-        system("rndc retransfer ".$zone);
+	$zone=substr($row["origin"], 0, -1);
+	system("rndc retransfer ".$zone);
 }
-?>
\ No newline at end of file
+?>
diff --git a/helper_scripts/mydns_to_powerdns_migration.php b/helper_scripts/mydns_to_powerdns_migration.php
index 9c6526b..ffe9e4a 100644
--- a/helper_scripts/mydns_to_powerdns_migration.php
+++ b/helper_scripts/mydns_to_powerdns_migration.php
@@ -2,15 +2,15 @@
 $host="localhost";
 $user="root";
 $password="MYSQL-ROOT-PASSWD";
-mysql_connect($host,$user,$password) or die(mysql_error());
+mysql_connect($host, $user, $password) or die(mysql_error());
 
 mysql_select_db("dbispconfig");
 $sql1 = mysql_query("SELECT id, substr(origin,1, LENGTH(origin)-1) AS origin, substr(ns,1, LENGTH(ns)-1) AS ns, substr(mbox,1, LENGTH(mbox)-1) AS mbox,ttl FROM dns_soa order by id asc;");
 mysql_select_db("powerdns");
 while($row1 = mysql_fetch_array($sql1))
 {
-mysql_query("INSERT INTO domains (id,name,type,ispconfig_id) values ('$row1[id]','$row1[origin]','NATIVE','$row1[id]');");
-mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row1[id]','$row1[origin]','$row1[ns] $row1[mbox] 0','$row1[id]','SOA','$row1[ttl]','0','1260446221');");
+	mysql_query("INSERT INTO domains (id,name,type,ispconfig_id) values ('$row1[id]','$row1[origin]','NATIVE','$row1[id]');");
+	mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row1[id]','$row1[origin]','$row1[ns] $row1[mbox] 0','$row1[id]','SOA','$row1[ttl]','0','1260446221');");
 }
 
 mysql_select_db("dbispconfig");
@@ -18,44 +18,44 @@
 mysql_select_db("powerdns");
 while($row2 = mysql_fetch_array($sql2))
 {
-if (strlen($row2['name']))
-{
-$file1=substr($row2['data'], -1);
-if ($file1==".")
-{
-$text = $row2['data'];
-$laenge = strlen($row2['data'])-1;
-$file2 = substr($text, 0,strlen($text)-1);
-}
-else
-{
-$file2=$row2['data'];
-}
-mysql_select_db("dbispconfig");
-$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
-$row3 = mysql_fetch_array($sql3);
-mysql_select_db("powerdns");
-mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row2[name].$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
-}
-else
-{
-$file1=substr($row2['data'], -1);
-if ($file1==".")
-{
-$text = $row2['data'];
-$laenge = strlen($row2['data'])-1;
-$file2 = substr($text, 0,strlen($text)-1);
-}
-else
-{
-$file2=$row2['data'];
-}
-mysql_select_db("dbispconfig");
-$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
-$row3 = mysql_fetch_array($sql3);
-mysql_select_db("powerdns");
-mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
-}
+	if (strlen($row2['name']))
+	{
+		$file1=substr($row2['data'], -1);
+		if ($file1==".")
+		{
+			$text = $row2['data'];
+			$laenge = strlen($row2['data'])-1;
+			$file2 = substr($text, 0, strlen($text)-1);
+		}
+		else
+		{
+			$file2=$row2['data'];
+		}
+		mysql_select_db("dbispconfig");
+		$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
+		$row3 = mysql_fetch_array($sql3);
+		mysql_select_db("powerdns");
+		mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row2[name].$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
+	}
+	else
+	{
+		$file1=substr($row2['data'], -1);
+		if ($file1==".")
+		{
+			$text = $row2['data'];
+			$laenge = strlen($row2['data'])-1;
+			$file2 = substr($text, 0, strlen($text)-1);
+		}
+		else
+		{
+			$file2=$row2['data'];
+		}
+		mysql_select_db("dbispconfig");
+		$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
+		$row3 = mysql_fetch_array($sql3);
+		mysql_select_db("powerdns");
+		mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
+	}
 }
 
 mysql_select_db("powerdns");
@@ -63,8 +63,8 @@
 
 while($row4 = mysql_fetch_array($sql4))
 {
-mysql_query("UPDATE records SET content = '$row4[content].$row4[name]' where id='$row4[id]';");
+	mysql_query("UPDATE records SET content = '$row4[content].$row4[name]' where id='$row4[id]';");
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/helper_scripts/recreate_webalizer_stats.php b/helper_scripts/recreate_webalizer_stats.php
index 2663bc2..fbaef38 100644
--- a/helper_scripts/recreate_webalizer_stats.php
+++ b/helper_scripts/recreate_webalizer_stats.php
@@ -1,39 +1,39 @@
 <?php
 
-#######################################################################################################
+//######################################################################################################
 // Re-Create webalizer statistics
-#######################################################################################################
+//######################################################################################################
 
 
 $sql = "SELECT domain_id, domain, document_root FROM web_domain WHERE server_id = ".$conf["server_id"];
 $records = $app->db->queryAllRecords($sql);
 foreach($records as $rec) {
-$domain = escapeshellcmd($rec["domain"]);
-$logdir = escapeshellcmd($rec["document_root"].'/log');
-$statsdir = escapeshellcmd($rec["document_root"].'/web/stats');
-$webalizer = '/usr/bin/webalizer';
+	$domain = escapeshellcmd($rec["domain"]);
+	$logdir = escapeshellcmd($rec["document_root"].'/log');
+	$statsdir = escapeshellcmd($rec["document_root"].'/web/stats');
+	$webalizer = '/usr/bin/webalizer';
 
-$webalizer_conf_main = '/etc/webalizer/webalizer.conf';
-$webalizer_conf = escapeshellcmd($rec["document_root"].'/log/webalizer.conf');
-exec("rm -rf $webalizer_conf");
-if(!@is_file($webalizer_conf)) {
-exec("cp $webalizer_conf_main $webalizer_conf");
+	$webalizer_conf_main = '/etc/webalizer/webalizer.conf';
+	$webalizer_conf = escapeshellcmd($rec["document_root"].'/log/webalizer.conf');
+	exec("rm -rf $webalizer_conf");
+	if(!@is_file($webalizer_conf)) {
+		exec("cp $webalizer_conf_main $webalizer_conf");
 
-setConfigVar($webalizer_conf, 'Incremental', 'yes');
-setConfigVar($webalizer_conf, 'IncrementalName', $logdir.'/webalizer.current');
-setConfigVar($webalizer_conf, 'HistoryName', $logdir.'/webalizer.hist');
-}
+		setConfigVar($webalizer_conf, 'Incremental', 'yes');
+		setConfigVar($webalizer_conf, 'IncrementalName', $logdir.'/webalizer.current');
+		setConfigVar($webalizer_conf, 'HistoryName', $logdir.'/webalizer.hist');
+	}
 
-if(!@is_dir($statsdir)) mkdir($statsdir);
+	if(!@is_dir($statsdir)) mkdir($statsdir);
 
 
-echo "Remove stats dir $statsdir ...\n";
-exec("rm -rf $statsdir/*");
+	echo "Remove stats dir $statsdir ...\n";
+	exec("rm -rf $statsdir/*");
 
-echo "Re-Create stats for $domain...\n";
-exec("for logfile in $logdir/*access*; do\n$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir ".'$logfile'."\ndone");
-echo "done.\n";
+	echo "Re-Create stats for $domain...\n";
+	exec("for logfile in $logdir/*access*; do\n$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir ".'$logfile'."\ndone");
+	echo "done.\n";
 }
 
 die("finished.\n");
-?>
\ No newline at end of file
+?>
diff --git a/install/autoupdate.php b/install/autoupdate.php
index d89aa75..f9d0e62 100644
--- a/install/autoupdate.php
+++ b/install/autoupdate.php
@@ -41,7 +41,7 @@
 if (!file_exists('autoupdate')) {
 
 	//** The banner on the command line
-	echo "\n\n".str_repeat('-',80)."\n";
+	echo "\n\n".str_repeat('-', 80)."\n";
 	echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -50,19 +50,19 @@
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-	echo "\n".str_repeat('-',80)."\n";
+	echo "\n".str_repeat('-', 80)."\n";
 	echo "\n\n>>This script is for internal use only! Please use update.php!  \n\n";
 	exit;
 }
 
 //** Include the library with the basic installer functions
-require_once('lib/install.lib.php');
+require_once 'lib/install.lib.php';
 
 //** Include the library with the basic updater functions
-require_once('lib/update.lib.php');
+require_once 'lib/update.lib.php';
 
 //** Include the base class of the installer class
-require_once('lib/installer_base.lib.php');
+require_once 'lib/installer_base.lib.php';
 
 //** Ensure that current working directory is install directory
 $cur_dir = getcwd();
@@ -75,16 +75,16 @@
 //** Get distribution identifier
 $dist = get_distname();
 
-include_once("/usr/local/ispconfig/server/lib/config.inc.php");
+include_once "/usr/local/ispconfig/server/lib/config.inc.php";
 $conf_old = $conf;
 unset($conf);
 
 if($dist['id'] == '') die('Linux distribution or version not recognized.');
 
 //** Include the distribution-specific installer class library and configuration
-if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
-include_once('dist/lib/'.$dist['id'].'.lib.php');
-include_once('dist/conf/'.$dist['id'].'.conf.php');
+if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
+include_once 'dist/lib/'.$dist['id'].'.lib.php';
+include_once 'dist/conf/'.$dist['id'].'.conf.php';
 
 //** Get hostname
 exec('hostname -f', $tmp_out);
@@ -124,22 +124,22 @@
 $inst->find_installed_apps();
 
 //** Initialize the MySQL server connection
-include_once('lib/mysql.lib.php');
+include_once 'lib/mysql.lib.php';
 
 //** Database update is a bit brute force and should be rebuild later ;)
 
 /*
  * Try to read the DB-admin settings
  */
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
-include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf");
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
+include_once "/usr/local/ispconfig/server/lib/mysql_clientdb.conf";
 $conf["mysql"]["admin_user"] = $clientdb_user;
 $conf["mysql"]["admin_password"] = $clientdb_password;
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
 
 //** There is a error if user for mysql admin_password if empty
 if( empty($conf["mysql"]["admin_password"]) ) {
@@ -147,7 +147,7 @@
 }
 
 //** Test mysql root connection
-if(!@mysql_connect($conf["mysql"]["host"],$conf["mysql"]["admin_user"],$conf["mysql"]["admin_password"])) {
+if(!@mysql_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) {
 	die("internal error - MYSQL-Root passord wrong");
 }
 
@@ -157,7 +157,7 @@
 checkDbHealth();
 
 /*
- *  Prepare the dump of the database 
+ *  Prepare the dump of the database
 */
 prepareDBDump();
 
@@ -196,7 +196,7 @@
 	//** Configure postfix
 	swriteln('Configuring Postfix');
 	$inst->configure_postfix('dont-create-certs');
-	
+
 	//** Configure mailman
 	swriteln('Configuring Mailman');
 	$inst->configure_mailman('update');
@@ -217,7 +217,7 @@
 		//** Configure PAM
 		swriteln('Configuring PAM');
 		$inst->configure_pam();
-		
+
 		//* Configure courier
 		swriteln('Configuring Courier');
 		$inst->configure_courier();
@@ -261,7 +261,7 @@
 		//** Configure Apache
 		swriteln('Configuring Apache');
 		$inst->configure_apache();
-       
+
 		//** Configure vlogger
 		swriteln('Configuring vlogger');
 		$inst->configure_vlogger();
@@ -270,7 +270,7 @@
 		swriteln('Configuring nginx');
 		$inst->configure_nginx();
 	}
-	
+
 	//** Configure apps vhost
 	swriteln('Configuring Apps vhost');
 	$inst->configure_apps_vhost();
diff --git a/install/dist/conf/centos52.conf.php b/install/dist/conf/centos52.conf.php
index 1221a74..12044d3 100644
--- a/install/dist/conf/centos52.conf.php
+++ b/install/dist/conf/centos52.conf.php
@@ -63,14 +63,14 @@
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/centos53.conf.php b/install/dist/conf/centos53.conf.php
index 1221a74..12044d3 100644
--- a/install/dist/conf/centos53.conf.php
+++ b/install/dist/conf/centos53.conf.php
@@ -63,14 +63,14 @@
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php
index 7bdd238..3e9fe35 100644
--- a/install/dist/conf/debian40.conf.php
+++ b/install/dist/conf/debian40.conf.php
@@ -65,14 +65,14 @@
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/debian60.conf.php b/install/dist/conf/debian60.conf.php
index 8eb3a2c..a381996 100644
--- a/install/dist/conf/debian60.conf.php
+++ b/install/dist/conf/debian60.conf.php
@@ -65,14 +65,14 @@
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
@@ -223,4 +223,4 @@
 $conf['cron']['wget'] = '/usr/bin/wget';
 
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/conf/fedora9.conf.php b/install/dist/conf/fedora9.conf.php
index c988d3f..80539a7 100644
--- a/install/dist/conf/fedora9.conf.php
+++ b/install/dist/conf/fedora9.conf.php
@@ -63,14 +63,14 @@
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/gentoo.conf.php b/install/dist/conf/gentoo.conf.php
index 2a0471a..2955cfa 100644
--- a/install/dist/conf/gentoo.conf.php
+++ b/install/dist/conf/gentoo.conf.php
@@ -63,14 +63,14 @@
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* SuPHP
 $conf['suphp']['config_file'] = '/etc/suphp.conf';
@@ -85,7 +85,7 @@
 $conf['apache']['config_file'] = $conf['apache']['config_dir'] .'/httpd.conf';
 $conf['apache']['ssl_dir'] = '/etc/ssl/apache2';
 $conf['apache']['vhost_conf_dir'] = $conf['apache']['config_dir'] . '/vhosts.d';
-$conf['apache']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_dir']; 
+$conf['apache']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_dir'];
 $conf['apache']['vhost_default'] = '00_default_vhost.conf';
 $conf['apache']['vhost_port'] = '8080';
 $conf['apache']['php_ini_path_apache'] = '/etc/php/apache2-php5/php.ini';
@@ -154,7 +154,7 @@
 //* SASL
 $conf['saslauthd']['installed'] = false; // will be detected automatically during installation
 $conf['saslauthd']['config_file'] = '/etc/conf.d/saslauthd';
-$conf['saslauthd']['config_dir'] = '/etc/sasl2'; 
+$conf['saslauthd']['config_dir'] = '/etc/sasl2';
 $conf['saslauthd']['init_script'] = 'saslauthd';
 
 //* Amavisd
diff --git a/install/dist/conf/opensuse110.conf.php b/install/dist/conf/opensuse110.conf.php
index fd8ef65..e389c3b 100644
--- a/install/dist/conf/opensuse110.conf.php
+++ b/install/dist/conf/opensuse110.conf.php
@@ -63,14 +63,14 @@
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/opensuse112.conf.php b/install/dist/conf/opensuse112.conf.php
index 96a37d6..fa05046 100644
--- a/install/dist/conf/opensuse112.conf.php
+++ b/install/dist/conf/opensuse112.conf.php
@@ -63,14 +63,14 @@
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/lib/centos52.lib.php b/install/dist/lib/centos52.lib.php
index a7e4f94..f4aa4df 100644
--- a/install/dist/lib/centos52.lib.php
+++ b/install/dist/lib/centos52.lib.php
@@ -58,26 +58,26 @@
 				}
 			}
 		}
-		
+
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
-        if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
-            copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
-        } else {
-            copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
-        }
-		chgrp($full_file_name,'mailman');
-		chmod($full_file_name,0750);
-		
+
+		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
+			copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+		} else {
+			copy('tpl/mailman-virtual_to_transport.sh', $full_file_name);
+		}
+		chgrp($full_file_name, 'mailman');
+		chmod($full_file_name, 0750);
+
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
-		
+
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
 
 		$virtual_domains = '';
@@ -87,13 +87,13 @@
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -109,55 +109,55 @@
 
 	public function configure_amavis() {
 		global $conf;
-		
+
 		// amavisd user config file
 		$configfile = 'fedora_amavisd_conf';
-		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
+		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_port}',$conf["mysql"]["port"],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		$content = str_replace('{hostname}',$conf['hostname'],$content);
-		$content = str_replace('/var/spool/amavisd/clamd.sock','/tmp/clamd.socket',$content);
-		wf($conf["amavis"]["config_dir"].'/amavisd.conf',$content);
-		
-		
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		$content = str_replace('{hostname}', $conf['hostname'], $content);
+		$content = str_replace('/var/spool/amavisd/clamd.sock', '/tmp/clamd.socket', $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+
+
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~2');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~');
+		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"127.0.0.1:10025")) {
+		if(!stristr($content, "127.0.0.1:10025")) {
 			unset($content);
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
-			af($conf["postfix"]["config_dir"].'/master.cf',$content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $content);
 		}
 		unset($content);
-		
-		removeLine('/etc/sysconfig/freshclam','FRESHCLAM_DELAY=disabled-warn   # REMOVE ME',1);
-		replaceLine('/etc/freshclam.conf','Example','# Example',1);
-		
-		
+
+		removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
+		replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
+
+
 	}
 
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/centos53.lib.php b/install/dist/lib/centos53.lib.php
index 91f1746..93083b5 100644
--- a/install/dist/lib/centos53.lib.php
+++ b/install/dist/lib/centos53.lib.php
@@ -58,26 +58,26 @@
 				}
 			}
 		}
-		
+
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
-        if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
-            copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
-        } else {
-            copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
-        }
-		chgrp($full_file_name,'mailman');
-		chmod($full_file_name,0750);
-		
+
+		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
+			copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+		} else {
+			copy('tpl/mailman-virtual_to_transport.sh', $full_file_name);
+		}
+		chgrp($full_file_name, 'mailman');
+		chmod($full_file_name, 0750);
+
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
-		
+
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
 
 		$virtual_domains = '';
@@ -87,13 +87,13 @@
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -109,56 +109,56 @@
 
 	public function configure_amavis() {
 		global $conf;
-		
+
 		// amavisd user config file
 		$configfile = 'fedora_amavisd_conf';
-		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
+		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_port}',$conf["mysql"]["port"],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		$content = str_replace('{hostname}',$conf['hostname'],$content);
-		$content = str_replace('/var/spool/amavisd/clamd.sock','/var/run/clamav/clamd.sock',$content);
-		wf($conf["amavis"]["config_dir"].'/amavisd.conf',$content);
-		
-		
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		$content = str_replace('{hostname}', $conf['hostname'], $content);
+		$content = str_replace('/var/spool/amavisd/clamd.sock', '/var/run/clamav/clamd.sock', $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+
+
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~2');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~');
+		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"127.0.0.1:10025")) {
+		if(!stristr($content, "127.0.0.1:10025")) {
 			unset($content);
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
-			af($conf["postfix"]["config_dir"].'/master.cf',$content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $content);
 		}
 		unset($content);
-		
-		removeLine('/etc/sysconfig/freshclam','FRESHCLAM_DELAY=disabled-warn   # REMOVE ME',1);
-		replaceLine('/etc/freshclam.conf','Example','# Example',1);
-		
-		
+
+		removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
+		replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
+
+
 	}
 
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/debian40.lib.php b/install/dist/lib/debian40.lib.php
index cf8e864..b13b98c 100644
--- a/install/dist/lib/debian40.lib.php
+++ b/install/dist/lib/debian40.lib.php
@@ -33,4 +33,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php
index e1be291..b3887cb 100644
--- a/install/dist/lib/debian60.lib.php
+++ b/install/dist/lib/debian60.lib.php
@@ -29,13 +29,13 @@
 */
 
 class installer extends installer_base {
-	
+
 	public function configure_dovecot()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['dovecot']['config_dir'];
-		
+
 		//* Configure master.cf and add a line for deliver
 		if(is_file($config_dir.'/master.cf')){
 			copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
@@ -45,14 +45,14 @@
 		}
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"dovecot/deliver")) {
+		if(!stristr($content, "dovecot/deliver")) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf["postfix"]["config_dir"].'/master.cf',$deliver_content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
-		
-		
+
+
 		//* Reconfigure postfix to use dovecot authentication
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
@@ -61,44 +61,44 @@
 			'smtpd_sasl_type = dovecot',
 			'smtpd_sasl_path = private/auth'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~3');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~3');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* copy dovecot.conf
 		$configfile = 'dovecot.conf';
 		if(is_file($config_dir.'/'.$configfile)){
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
 		}
-		
+
 		//* Get the dovecot version
-		exec('dovecot --version',$tmp);
-		$parts = explode('.',trim($tmp[0]));
+		exec('dovecot --version', $tmp);
+		$parts = explode('.', trim($tmp[0]));
 		$dovecot_version = $parts[0];
 		unset($tmp);
 		unset($parts);
-		
+
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master', $config_dir.'/'.$configfile);
-            } else {
-                copy('tpl/debian6_dovecot2.conf.master',$config_dir.'/'.$configfile);
-            }
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master', $config_dir.'/'.$configfile);
+			} else {
+				copy('tpl/debian6_dovecot2.conf.master', $config_dir.'/'.$configfile);
+			}
 		} else {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master', $config_dir.'/'.$configfile);
-            } else {
-                copy('tpl/debian6_dovecot.conf.master',$config_dir.'/'.$configfile);
-            }
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master', $config_dir.'/'.$configfile);
+			} else {
+				copy('tpl/debian6_dovecot.conf.master', $config_dir.'/'.$configfile);
+			}
 		}
-		
+
 		//* dovecot-sql.conf
 		$configfile = 'dovecot-sql.conf';
 		if(is_file($config_dir.'/'.$configfile)){
@@ -106,32 +106,33 @@
 			chmod($config_dir.'/'.$configfile.'~', 0400);
 		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot-sql.conf.master', 'tpl/debian6_dovecot-sql.conf.master');
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf($config_dir.'/'.$configfile, $content);
-		
+
 		chmod($config_dir.'/'.$configfile, 0600);
 		chown($config_dir.'/'.$configfile, 'root');
 		chgrp($config_dir.'/'.$configfile, 'root');
 
 	}
-	
+
 	public function configure_apache() {
 		global $conf;
-		
-		if(file_exists('/etc/apache2/mods-available/fcgid.conf')) replaceLine('/etc/apache2/mods-available/fcgid.conf','MaxRequestLen','MaxRequestLen 15728640',0,1);
-		
+
+		if(file_exists('/etc/apache2/mods-available/fcgid.conf')) replaceLine('/etc/apache2/mods-available/fcgid.conf', 'MaxRequestLen', 'MaxRequestLen 15728640', 0, 1);
+
 		parent::configure_apache();
 	}
 
-    public function configure_fail2ban() {
-	/*
+	public function configure_fail2ban() {
+		/*
         copy('tpl/dovecot-pop3imap.conf.master',"/etc/fail2ban/filter.d/dovecot-pop3imap.conf");
         copy('tpl/dovecot_fail2ban_jail.local.master','/etc/fail2ban/jail.local');
 	*/
-    }
+	}
+
 }
 
 ?>
diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php
index 99fd2af..2ec1cf0 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -58,7 +58,7 @@
 				}
 			}
 		}
-		
+
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
 
@@ -69,13 +69,13 @@
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -87,77 +87,77 @@
 		$content = str_replace('{virtual_domains}', $virtual_domains, $content);
 
 		wf($full_file_name, $content);
-		
+
 		//* Write virtual_to_transport.sh script
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
+
 		if(is_dir('/etc/mailman')) {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
-            } else {
-                copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
-            }
-			chgrp($full_file_name,'mailman');
-			chmod($full_file_name,0750);
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+			} else {
+				copy('tpl/mailman-virtual_to_transport.sh', $full_file_name);
+			}
+			chgrp($full_file_name, 'mailman');
+			chmod($full_file_name, 0750);
 		}
-		
+
 		//* Create aliasaes
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
-		
+
 	}
-	
+
 	function configure_postfix($options = '')
-    {
-        global $conf;
+	{
+		global $conf;
 		$cf = $conf['postfix'];
 		$config_dir = $cf['config_dir'];
-        
+
 		if(!is_dir($config_dir)){
-            $this->error("The postfix configuration directory '$config_dir' does not exist.");
-        }
-        
+			$this->error("The postfix configuration directory '$config_dir' does not exist.");
+		}
+
 		//* mysql-virtual_domains.cf
-        $this->process_postfix_config('mysql-virtual_domains.cf');
+		$this->process_postfix_config('mysql-virtual_domains.cf');
 
 		//* mysql-virtual_forwardings.cf
-        $this->process_postfix_config('mysql-virtual_forwardings.cf');
+		$this->process_postfix_config('mysql-virtual_forwardings.cf');
 
 		//* mysql-virtual_mailboxes.cf
-        $this->process_postfix_config('mysql-virtual_mailboxes.cf');
+		$this->process_postfix_config('mysql-virtual_mailboxes.cf');
 
 		//* mysql-virtual_email2email.cf
-        $this->process_postfix_config('mysql-virtual_email2email.cf');
+		$this->process_postfix_config('mysql-virtual_email2email.cf');
 
 		//* mysql-virtual_transports.cf
-        $this->process_postfix_config('mysql-virtual_transports.cf');
+		$this->process_postfix_config('mysql-virtual_transports.cf');
 
 		//* mysql-virtual_recipient.cf
-        $this->process_postfix_config('mysql-virtual_recipient.cf');
+		$this->process_postfix_config('mysql-virtual_recipient.cf');
 
 		//* mysql-virtual_sender.cf
-        $this->process_postfix_config('mysql-virtual_sender.cf');
+		$this->process_postfix_config('mysql-virtual_sender.cf');
 
 		//* mysql-virtual_client.cf
-        $this->process_postfix_config('mysql-virtual_client.cf');
-		
+		$this->process_postfix_config('mysql-virtual_client.cf');
+
 		//* mysql-virtual_relaydomains.cf
-        $this->process_postfix_config('mysql-virtual_relaydomains.cf');
-		
+		$this->process_postfix_config('mysql-virtual_relaydomains.cf');
+
 		//* mysql-virtual_relayrecipientmaps.cf
-        $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
+		$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
 
 		//* Changing mode and group of the new created config files.
 		caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-                 __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
-		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', 
-                __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
-		
+			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
+		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
+			__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
+
 		//* Creating virtual mail user and group
 		$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
 		if(!is_group($cf['vmail_groupname'])) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -173,7 +173,7 @@
 		//* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update
 		$rbl_list = '';
 		if (@isset($server_ini_array['mail']['realtime_blackhole_list']) && $server_ini_array['mail']['realtime_blackhole_list'] != '') {
-			$rbl_hosts = explode(",",str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
+			$rbl_hosts = explode(",", str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
 			foreach ($rbl_hosts as $key => $value) {
 				$rbl_list .= ", reject_rbl_client ". $value;
 			}
@@ -182,130 +182,130 @@
 		unset($server_ini_array);
 
 		//* These postconf commands will be executed on installation and update
-        $postconf_placeholders = array('{config_dir}' => $config_dir,
-                                       '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
-                                       '{vmail_userid}' => $cf['vmail_userid'],
-                                       '{vmail_groupid}' => $cf['vmail_groupid'],
-                                       '{rbl_list}' => $rbl_list);
-        
-        $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_postfix.conf.master', 'tpl/fedora_postfix.conf.master');
-        $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
-        $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
-        
+		$postconf_placeholders = array('{config_dir}' => $config_dir,
+			'{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
+			'{vmail_userid}' => $cf['vmail_userid'],
+			'{vmail_groupid}' => $cf['vmail_groupid'],
+			'{rbl_list}' => $rbl_list);
+
+		$postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_postfix.conf.master', 'tpl/fedora_postfix.conf.master');
+		$postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
+		$postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
+
 		//* These postconf commands will be executed on installation only
 		if($this->is_update == false) {
-			$postconf_commands = array_merge($postconf_commands,array(
-				'myhostname = '.$conf['hostname'],
-				'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
-				'mynetworks = 127.0.0.0/8 [::1]/128'
-			));
+			$postconf_commands = array_merge($postconf_commands, array(
+					'myhostname = '.$conf['hostname'],
+					'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
+					'mynetworks = 127.0.0.0/8 [::1]/128'
+				));
 		}
-		
+
 		//* Create the header and body check files
 		touch($config_dir.'/header_checks');
 		touch($config_dir.'/mime_header_checks');
 		touch($config_dir.'/nested_header_checks');
 		touch($config_dir.'/body_checks');
-		
+
 		//* Create the mailman files
 		if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data');
 		//if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases');
 		if(is_file('/var/lib/mailman/data/aliases')) unlink('/var/lib/mailman/data/aliases');
-		if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases','/var/lib/mailman/data/aliases');
+		if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases', '/var/lib/mailman/data/aliases');
 		exec('postalias /var/lib/mailman/data/aliases');
 		if(!is_file('/var/lib/mailman/data/virtual-mailman')) touch('/var/lib/mailman/data/virtual-mailman');
 		exec('postmap /var/lib/mailman/data/virtual-mailman');
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
-		
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
-		
+
 		//* Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
-		if(!stristr($options,'dont-create-certs')) {
+
+		if(!stristr($options, 'dont-create-certs')) {
 			//* Create the SSL certificate
 			$command = 'cd '.$config_dir.'; '
-                      .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
+				.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
 			exec($command);
-		
+
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop.
 		$command = 'chmod 755 /var/spool/authdaemon';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
-		
+
 		//* Changing maildrop lines in posfix master.cf
 		if(is_file($config_dir.'/master.cf')){
-            copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
-        }
+			copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
+		}
 		if(is_file($config_dir.'/master.cf~')){
-            exec('chmod 400 '.$config_dir.'/master.cf~');
-        }
+			exec('chmod 400 '.$config_dir.'/master.cf~');
+		}
 		$configfile = $config_dir.'/master.cf';
 		$content = rf($configfile);
 		// if postfix package is from fedora or centios main repo
-		$content = str_replace('#  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-					 
+		$content = str_replace('#  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
 		// If postfix package is from centos plus repo
-		$content = str_replace('#  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-					 
-		$content = str_replace('  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-		
-		
-		$content = str_replace('#maildrop  unix  -       n       n       -       -       pipe', 
-                   'maildrop  unix  -       n       n       -       -       pipe',
-                     $content);
-		
+		$content = str_replace('#  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
+		$content = str_replace('  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
+
+		$content = str_replace('#maildrop  unix  -       n       n       -       -       pipe',
+			'maildrop  unix  -       n       n       -       -       pipe',
+			$content);
+
 		wf($configfile, $content);
-		
+
 		//* Writing the Maildrop mailfilter file
 		$configfile = 'mailfilter';
 		if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)){
-            copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
-        }
+			copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
+		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content);
 		wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content);
-		
+
 		//* Create the directory for the custom mailfilters
 		$command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Chmod and chown the .mailfilter file
 		$command = 'chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = 'chmod -R 600 '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 	}
-	
+
 	public function configure_saslauthd() {
 		global $conf;
-		
+
 		$configfile = 'tpl/fedora_saslauthd_smtpd_conf.master';
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_saslauthd_smtpd_conf.master', $configfile);
-		wf('/usr/lib/sasl2/smtpd.conf',$content);
-		if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl/smtpd.conf',$content);
-		if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl2/smtpd.conf',$content);
-		
+		wf('/usr/lib/sasl2/smtpd.conf', $content);
+		if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl/smtpd.conf', $content);
+		if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl2/smtpd.conf', $content);
+
 	}
-	
+
 	public function configure_pam()
-    {
+	{
 		global $conf;
 		$pam = $conf['pam'];
 		//* configure pam for SMTP authentication agains the ispconfig database
@@ -323,68 +323,68 @@
 		if(is_file("$pam/smtp"))    exec("chmod o= $pam/smtp");
 		//exec("chmod 660 $pam/smtp");
 		//exec("chown root:root $pam/smtp");
-	
+
 	}
-	
+
 	public function configure_courier()
-    {
+	{
 		global $conf;
 		$config_dir = $conf['courier']['config_dir'];
 		//* authmysqlrc
 		$configfile = 'authmysqlrc';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
 		exec("chmod 400 $config_dir/$configfile~");
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf("$config_dir/$configfile", $content);
-		
+
 		exec("chmod 660 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
-		
+
 		//* authdaemonrc
 		$configfile = $conf['courier']['config_dir'].'/authdaemonrc';
 		if(is_file($configfile)){
-            copy($configfile, $configfile.'~');
-        }
+			copy($configfile, $configfile.'~');
+		}
 		if(is_file($configfile.'~')){
-            exec('chmod 400 '.$configfile.'~');
-        }
+			exec('chmod 400 '.$configfile.'~');
+		}
 		$content = rf($configfile);
 		$content = str_replace('authmodulelist=', 'authmodulelist="authmysql"', $content);
 		wf($configfile, $content);
 	}
-	
+
 	public function configure_dovecot()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['dovecot']['config_dir'];
-		
+
 		//* Use /etc/dovecot as config dir if exists
 		if(is_dir('/etc/dovecot')) $config_dir = '/etc/dovecot';
-		
+
 		//* Configure master.cf and add a line for deliver
 		if(is_file($config_dir.'/master.cf')){
-            copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
-        }
+			copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
+		}
 		if(is_file($config_dir.'/master.cf~')){
-            exec('chmod 400 '.$config_dir.'/master.cf~2');
-        }
+			exec('chmod 400 '.$config_dir.'/master.cf~2');
+		}
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"dovecot/deliver")) {
+		if(!stristr($content, "dovecot/deliver")) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf["postfix"]["config_dir"].'/master.cf',$deliver_content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
-		
-		
+
+
 		//* Reconfigure postfix to use dovecot authentication
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
@@ -394,119 +394,119 @@
 			'smtpd_sasl_path = private/auth',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~3');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~3');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* backup dovecot.conf
 		$configfile = 'dovecot.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
-		
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
+
 		//* Get the dovecot version
-		exec('dovecot --version',$tmp);
-		$parts = explode('.',trim($tmp[0]));
+		exec('dovecot --version', $tmp);
+		$parts = explode('.', trim($tmp[0]));
 		$dovecot_version = $parts[0];
 		unset($tmp);
 		unset($parts);
-		
+
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot2.conf.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot2.conf.master', $config_dir.'/'.$configfile);
-            } else {
-                copy('tpl/fedora_dovecot2.conf.master',$config_dir.'/'.$configfile);
-            }
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot2.conf.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot2.conf.master', $config_dir.'/'.$configfile);
+			} else {
+				copy('tpl/fedora_dovecot2.conf.master', $config_dir.'/'.$configfile);
+			}
 		} else {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot.conf.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot.conf.master', $config_dir.'/'.$configfile);
-            } else {
-                copy('tpl/fedora_dovecot.conf.master',$config_dir.'/'.$configfile);
-            }
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot.conf.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot.conf.master', $config_dir.'/'.$configfile);
+			} else {
+				copy('tpl/fedora_dovecot.conf.master', $config_dir.'/'.$configfile);
+			}
 		}
 
 		//* dovecot-sql.conf
 		$configfile = 'dovecot-sql.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
 			exec("chmod 400 $config_dir/$configfile~");
-        }
-		
+		}
+
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot-sql.conf.master', "tpl/fedora_dovecot-sql.conf.master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf("$config_dir/$configfile", $content);
-		
+
 		exec("chmod 600 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
 
 	}
-	
+
 	public function configure_amavis() {
 		global $conf;
-		
+
 		// amavisd user config file
 		$configfile = 'fedora_amavisd_conf';
-		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
+		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_port}',$conf["mysql"]["port"],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		$content = str_replace('{hostname}',$conf['hostname'],$content);
-		wf($conf["amavis"]["config_dir"].'/amavisd.conf',$content);
-		
-		
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		$content = str_replace('{hostname}', $conf['hostname'], $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+
+
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~2');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~');
+		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"127.0.0.1:10025")) {
+		if(!stristr($content, "127.0.0.1:10025")) {
 			unset($content);
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
-			af($conf["postfix"]["config_dir"].'/master.cf',$content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $content);
 		}
 		unset($content);
-		
-		removeLine('/etc/sysconfig/freshclam','FRESHCLAM_DELAY=disabled-warn   # REMOVE ME',1);
-		replaceLine('/etc/freshclam.conf','Example','# Example',1);
-		
+
+		removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
+		replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
+
 		// Add the clamav user to the vscan group
 		//exec('groupmod --add-user clamav vscan');
-		
-		
+
+
 	}
-	
+
 	public function configure_spamassassin()
-    {
+	{
 		global $conf;
-		
+
 		//* Enable spamasasssin on debian and ubuntu
 		/*
 		$configfile = '/etc/default/spamassassin';
@@ -518,40 +518,40 @@
 		wf($configfile, $content);
 		*/
 	}
-	
+
 	public function configure_getmail()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['getmail']['config_dir'];
-		
+
 		if(!is_dir($config_dir)) exec("mkdir -p ".escapeshellcmd($config_dir));
 
 		$command = "useradd -d $config_dir getmail";
 		if(!is_user('getmail')) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chown -R getmail $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chmod -R 700 $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-	
-	
+
+
 	public function configure_pureftpd()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['pureftpd']['config_dir'];
 
 		//* configure pam for SMTP authentication agains the ispconfig database
 		$configfile = 'pureftpd-mysql.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
 		if(is_file("$config_dir/$configfile~")){
-            exec("chmod 400 $config_dir/$configfile~");
-        }
+			exec("chmod 400 $config_dir/$configfile~");
+		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/pureftpd_mysql.conf.master', 'tpl/pureftpd_mysql.conf.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $content);
@@ -561,45 +561,45 @@
 		wf("$config_dir/$configfile", $content);
 		exec("chmod 600 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
-		
+
 		// copy our customized copy of pureftpd.conf to the pure-ftpd config directory
 		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_pureftpd_conf.master')) {
-            exec("cp " . $conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_pureftpd_conf.master ' . "$config_dir/pure-ftpd.conf");
-        }else {
-            exec("cp tpl/fedora_pureftpd_conf.master $config_dir/pure-ftpd.conf");
-        }
-		
+			exec("cp " . $conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_pureftpd_conf.master ' . "$config_dir/pure-ftpd.conf");
+		}else {
+			exec("cp tpl/fedora_pureftpd_conf.master $config_dir/pure-ftpd.conf");
+		}
+
 	}
-	
+
 	public function configure_mydns()
-    {
+	{
 		global $conf;
-		
+
 		// configure mydns
 		$configfile = 'mydns.conf';
-		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile)) copy($conf["mydns"]["config_dir"].'/'.$configfile,$conf["mydns"]["config_dir"].'/'.$configfile.'~');
+		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile)) copy($conf["mydns"]["config_dir"].'/'.$configfile, $conf["mydns"]["config_dir"].'/'.$configfile.'~');
 		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["mydns"]["config_dir"].'/'.$configfile.'~');
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf["mysql"]["host"],$content);
-		$content = str_replace('{server_id}',$conf["server_id"],$content);
-		wf($conf["mydns"]["config_dir"].'/'.$configfile,$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf["mysql"]["host"], $content);
+		$content = str_replace('{server_id}', $conf["server_id"], $content);
+		wf($conf["mydns"]["config_dir"].'/'.$configfile, $content);
 		exec('chmod 600 '.$conf["mydns"]["config_dir"].'/'.$configfile);
 		exec('chown root:root '.$conf["mydns"]["config_dir"].'/'.$configfile);
-	
+
 	}
-	
+
 	public function configure_bind() {
 		global $conf;
-		
+
 		// add the include line at the end of named.conf.
-		replaceLine('/etc/named.conf','include "/etc/named.conf.local";','include "/etc/named.conf.local";',0,1);
+		replaceLine('/etc/named.conf', 'include "/etc/named.conf.local";', 'include "/etc/named.conf.local";', 0, 1);
 
 		//* Check if the zonefile directory has a slash at the end
 		$content=$conf['bind']['bind_zonefiles_dir'];
-		if(substr($content,-1,1) != '/') {
+		if(substr($content, -1, 1) != '/') {
 			$content .= '/';
 		}
 
@@ -611,37 +611,37 @@
 		//* Chown the slave subdirectory to $conf['bind']['bind_user']
 		exec('chown '.$conf['bind']['bind_user'].':'.$conf['bind']['bind_group'].' '.$content);
 		exec('chmod 770 '.$content);
-		
+
 	}
-	
+
 	public function configure_apache()
-    {	
+	{
 		global $conf;
-		
+
 		if($conf['apache']['installed'] == false) return;
 		if(is_file('/etc/suphp.conf')) {
 			//replaceLine('/etc/suphp.conf','php=php:/usr/bin','x-httpd-suphp=php:/usr/bin/php-cgi',0);
-			replaceLine('/etc/suphp.conf','docroot=','docroot=/var/www',0);
-			replaceLine('/etc/suphp.conf','umask=0077','umask=0022',0);
+			replaceLine('/etc/suphp.conf', 'docroot=', 'docroot=/var/www', 0);
+			replaceLine('/etc/suphp.conf', 'umask=0077', 'umask=0022', 0);
 		}
-		
+
 		//* Create the logging directory for the vhost logfiles
 		exec('mkdir -p /var/log/ispconfig/httpd');
-		
+
 		// Sites enabled and avaulable dirs
 		exec('mkdir -p '.$conf['apache']['vhost_conf_enabled_dir']);
 		exec('mkdir -p '.$conf['apache']['vhost_conf_dir']);
-		
+
 		$content = rf('/etc/httpd/conf/httpd.conf');
-		if(!stristr($content,'Include /etc/httpd/conf/sites-enabled/')) {
-			af('/etc/httpd/conf/httpd.conf',"\nNameVirtualHost *:80\nNameVirtualHost *:443\nInclude /etc/httpd/conf/sites-enabled/\n\n");
+		if(!stristr($content, 'Include /etc/httpd/conf/sites-enabled/')) {
+			af('/etc/httpd/conf/httpd.conf', "\nNameVirtualHost *:80\nNameVirtualHost *:443\nInclude /etc/httpd/conf/sites-enabled/\n\n");
 		}
 		unset($content);
-		
+
 		//* Copy the ISPConfig configuration include
-        $vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
-        $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
-        
+		$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
+		$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
+
 		// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
 		$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
@@ -653,7 +653,7 @@
 				} else {
 					$ip_address = $rec['ip_address'];
 				}
-				$ports = explode(',',$rec['virtualhost_port']);
+				$ports = explode(',', $rec['virtualhost_port']);
 				if(is_array($ports)) {
 					foreach($ports as $port) {
 						$port = intval($port);
@@ -664,138 +664,138 @@
 				}
 			}
 		}
-		
+
 		$content .= "\n";
-		wf($vhost_conf_dir.'/ispconfig.conf',$content);
-		
+		wf($vhost_conf_dir.'/ispconfig.conf', $content);
+
 		if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) {
 			exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf");
 		}
-		
+
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			exec('mkdir /etc/webalizer');
 			exec('ln -s /etc/webalizer.conf /etc/webalizer/webalizer.conf');
 		}
-		
+
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
 		if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 	}
-	
+
 	public function configure_nginx(){
 		global $conf;
-		
+
 		if($conf['nginx']['installed'] == false) return;
 		//* Create the logging directory for the vhost logfiles
 		if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
-		
+
 		// Sites enabled and avaulable dirs
 		exec('mkdir -p '.$conf['nginx']['vhost_conf_enabled_dir']);
 		exec('mkdir -p '.$conf['nginx']['vhost_conf_dir']);
 
-		wf('/etc/nginx/conf.d/ispconfig_vhosts.conf',"include /etc/nginx/sites-enabled/*.vhost;");
+		wf('/etc/nginx/conf.d/ispconfig_vhosts.conf', "include /etc/nginx/sites-enabled/*.vhost;");
 
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			mkdir('/etc/webalizer');
-			symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
+			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
 
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		// Check the awsatst script
 		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
-		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
-		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
-		
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
+		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
+
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
 		if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-	
+
 	public function configure_firewall()
 	{
 		global $conf;
-		
+
 		$dist_init_scripts = $conf['init_scripts'];
-  		
+
 		if(is_dir("/etc/Bastille.backup")) caselog("rm -rf /etc/Bastille.backup", __FILE__, __LINE__);
 		if(is_dir("/etc/Bastille")) caselog("mv -f /etc/Bastille /etc/Bastille.backup", __FILE__, __LINE__);
-  		@mkdir("/etc/Bastille", octdec($directory_mode));
-  		if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__);
-  		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
-            caselog("cp -f " . $conf['ispconfig_install_dir']."/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
-        } else {
-            caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
-        }
-  		caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
-  		$content = rf("/etc/Bastille/bastille-firewall.cfg");
-  		$content = str_replace("{DNS_SERVERS}", "", $content);
+		@mkdir("/etc/Bastille", octdec($directory_mode));
+		if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__);
+		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
+			caselog("cp -f " . $conf['ispconfig_install_dir']."/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+		} else {
+			caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+		}
+		caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+		$content = rf("/etc/Bastille/bastille-firewall.cfg");
+		$content = str_replace("{DNS_SERVERS}", "", $content);
 
-  		$tcp_public_services = '';
-  		$udp_public_services = '';
-		
+		$tcp_public_services = '';
+		$udp_public_services = '';
+
 		$row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id']));
-		
-  		if(trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != ''){
-    		$tcp_public_services = trim(str_replace(',',' ',$row["tcp_port"]));
-    		$udp_public_services = trim(str_replace(',',' ',$row["udp_port"]));
-  		} else {
-    		$tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
-    		$udp_public_services = '53';
-  		}
+
+		if(trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != ''){
+			$tcp_public_services = trim(str_replace(',', ' ', $row["tcp_port"]));
+			$udp_public_services = trim(str_replace(',', ' ', $row["udp_port"]));
+		} else {
+			$tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
+			$udp_public_services = '53';
+		}
 		if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) {
 			$tcp_public_services .= ' '.intval($conf['apache']['vhost_port']);
 			if($row["tcp_port"] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ',".intval($conf['apache']['vhost_port'])."' WHERE server_id = ".intval($conf['server_id']));
 		}
-		
-  		$content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
-  		$content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
 
-  		wf("/etc/Bastille/bastille-firewall.cfg", $content);
+		$content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
+		$content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
 
-  		if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__);
-  		caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__);
+		wf("/etc/Bastille/bastille-firewall.cfg", $content);
 
-  		if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
-  		caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
+		if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__);
+		caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__);
 
-  		if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
-  		caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
-		
+		if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
+		caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
+
+		if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
+		caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
+
 		if(!@is_dir('/var/lock/subsys')) caselog("mkdir /var/lock/subsys", __FILE__, __LINE__);
 
-  		exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
-  		if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
-  		unset($ipchains_location);
-  		exec("which iptables &> /dev/null", $iptables_location, $ret_val);
-  		if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
-  		unset($iptables_location);
+		exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
+		if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
+		unset($ipchains_location);
+		exec("which iptables &> /dev/null", $iptables_location, $ret_val);
+		if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
+		unset($iptables_location);
 
 	}
-	
-	
+
+
 	public function install_ispconfig()
-    {
+	{
 		global $conf;
-		
+
 		$install_dir = $conf['ispconfig_install_dir'];
 
 		//* Create the ISPConfig installation directory
@@ -803,68 +803,68 @@
 			$command = "mkdir $install_dir";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Create a ISPConfig user and group
 		$command = 'groupadd ispconfig';
 		if(!is_group('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "useradd -g ispconfig -d $install_dir ispconfig";
 		if(!is_user('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig interface part
 		$command = "cp -rf ../interface $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig server part
 		$command = "cp -rf ../server $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Create a symlink, so ISPConfig is accessible via web
 		// Replaced by a separate vhost definition for port 8080
 		// $command = "ln -s $install_dir/interface/web/ /var/www/ispconfig";
 		// caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Create the config file for ISPConfig interface
 		$configfile = 'config.inc.php';
 		if(is_file($install_dir.'/interface/lib/'.$configfile)){
-            copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
-        }
+			copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
+		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
 		$content = str_replace('{timezone}', $conf['timezone'], $content);
 		$content = str_replace('{theme}', $conf['theme'], $content);
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
-		
+
 		wf("$install_dir/interface/lib/$configfile", $content);
-		
+
 		//* Create the config file for ISPConfig server
 		$configfile = 'config.inc.php';
 		if(is_file($install_dir.'/server/lib/'.$configfile)){
-            copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
-        }
+			copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
+		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
@@ -873,24 +873,24 @@
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
 
 		wf("$install_dir/server/lib/$configfile", $content);
-		
+
 		//* Create the config file for remote-actions (but only, if it does not exist, because
 		//  the value is a autoinc-value and so changed by the remoteaction_core_module
 		if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) {
 			$content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
 			wf($install_dir.'/server/lib/remote_action.inc.php', $content);
 		}
-		
-		
+
+
 		//* Enable the server modules and plugins.
 		// TODO: Implement a selector which modules and plugins shall be enabled.
 		$dir = $install_dir.'/server/mods-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/mods-available/'.$file);
-						$module_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/mods-available/'.$file;
+						$module_name = substr($file, 0, -8);
 						$tmp = new $module_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-enabled/'.$file);
@@ -904,16 +904,16 @@
 				closedir($dh);
 			}
 		}
-		
+
 		$dir = $install_dir.'/server/plugins-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
 					if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
 					if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/plugins-available/'.$file);
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/plugins-available/'.$file;
+						$plugin_name = substr($file, 0, -8);
 						$tmp = new $plugin_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file);
@@ -927,7 +927,7 @@
 				closedir($dh);
 			}
 		}
-		
+
 		// Update the server config
 		$mail_server_enabled = ($conf['services']['mail'])?1:0;
 		$web_server_enabled = ($conf['services']['web'])?1:0;
@@ -936,14 +936,14 @@
 		$db_server_enabled = ($conf['services']['db'])?1:0;
 		$vserver_server_enabled = ($conf['services']['vserver'])?1:0;
 		$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']);
-		
+
 		if($conf['mysql']['master_slave_setup'] == 'y') {
 			$this->dbmaster->query($sql);
 			$this->db->query($sql);
 		} else {
 			$this->db->query($sql);
 		}
-		
+
 		//* Chmod the files
 		$command = "chmod -R 750 $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -951,48 +951,48 @@
 		//* chown the files to the ispconfig user and group
 		$command = "chown -R ispconfig:ispconfig $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Make the global language file directory group writable
 		exec("chmod -R 770 $install_dir/interface/lib/lang");
-		
+
 		//* Make the temp directory for language file exports writable
 		exec("chmod -R 770 $install_dir/interface/web/temp");
-		
+
 		//* Make all interface language file directories group writable
 		$handle = @opendir($install_dir.'/interface/web');
-		while ($file = @readdir ($handle)) { 
-	   		if ($file != '.' && $file != '..') {
-	        	if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
+		while ($file = @readdir($handle)) {
+			if ($file != '.' && $file != '..') {
+				if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
 					$handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang');
-					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770);
-					while ($lang_file = @readdir ($handle2)) {
+					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770);
+					while ($lang_file = @readdir($handle2)) {
 						if ($lang_file != '.' && $lang_file != '..') {
-							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770);
+							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770);
 						}
 					}
 				}
 			}
 		}
-		
+
 		//* Make the APS directories group writable
 		exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
 		exec("chmod -R 770 $install_dir/server/aps_packages");
-		
+
 		//* make sure that the server config file (not the interface one) is only readable by the root user
 		chmod($install_dir.'/server/lib/config.inc.php', 0600);
 		chown($install_dir.'/server/lib/config.inc.php', 'root');
 		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
-		
+
 		//* Make sure thet the interface config file is readable by user ispconfig only
 		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
 		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
 		chgrp($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
-		
+
 		if(@is_file("$install_dir/server/lib/mysql_clientdb.conf")) {
 			exec("chmod 600 $install_dir/server/lib/mysql_clientdb.conf");
 			exec("chown root:root $install_dir/server/lib/mysql_clientdb.conf");
 		}
-		
+
 		// TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing
 		// and must be fixed as this will allow the apache user to read the ispconfig files.
 		// Later this must run as own apache server or via suexec!
@@ -1008,38 +1008,38 @@
 			$command = 'usermod -a -G ispconfig '.$conf['nginx']['user'];
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			//if(is_user('ispapps')){
-				// Allow the ispapps vhost access to /etc/squirrelmail
-				//$command = 'usermod -a -G '.$conf['apache']['group'].' ispapps';
-				//caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+			// Allow the ispapps vhost access to /etc/squirrelmail
+			//$command = 'usermod -a -G '.$conf['apache']['group'].' ispapps';
+			//caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			//}
 			if(is_group('ispapps')){
 				$command = 'usermod -a -G ispapps '.$conf['nginx']['user'];
 				caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
 		}
-		
+
 		//* Make the shell scripts executable
 		$command = "chmod +x $install_dir/server/scripts/*.sh";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		if($conf['apache']['installed'] == true && $this->install_ispconfig_interface == true){
 			//* Copy the ISPConfig vhost for the controlpanel
 			// TODO: These are missing! should they be "vhost_dist_*_dir" ?
 			$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
-        
-        
+
+
 			// Dont just copy over the virtualhost template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
 			$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
-		
+
 			// comment out the listen directive if port is 80 or 443
 			if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-		
+
 			if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_comment}', '', $content);
 			} else {
@@ -1050,39 +1050,39 @@
 			} else {
 				$content = str_replace('{ssl_bundle_comment}', '#', $content);
 			}
-		
+
 			wf("$vhost_conf_dir/ispconfig.vhost", $content);
-		
+
 			//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
 			//* and create the symlink
 			//if($this->is_update == false) {
-				if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
-				if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
-					exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
-				}
-			
-				/*
+			if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
+			if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
+				exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
+			}
+
+			/*
 				exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
 				exec('cp tpl/apache_ispconfig_fcgi_starter.master /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
 				exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
 				exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
 				exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
-			
+
 				replaceLine('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter','PHPRC=','PHPRC=/etc/',0,0);
 				*/
-				//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-					$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
-					$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
-					$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
-					if(!is_dir('/var/www/php-fcgi-scripts/ispconfig')) exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
-					wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
-					exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
-					if(!is_link('/var/www/ispconfig')) exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
-					exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
-				//}
+			//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
+			$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
+			$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
+			if(!is_dir('/var/www/php-fcgi-scripts/ispconfig')) exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
+			wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
+			exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
+			if(!is_link('/var/www/ispconfig')) exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
+			exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
+			//}
 			//}
 		}
-		
+
 		if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){
 			//* Copy the ISPConfig vhost for the controlpanel
 			$vhost_conf_dir = $conf['nginx']['vhost_conf_dir'];
@@ -1091,7 +1091,7 @@
 			// Dont just copy over the virtualhost template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master');
 			$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
-		
+
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_on}', ' on', $content);
 				$content = str_replace('{ssl_comment}', '', $content);
@@ -1101,19 +1101,19 @@
 				$content = str_replace('{ssl_comment}', '#', $content);
 				$content = str_replace('{fastcgi_ssl}', 'off', $content);
 			}
-			
+
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'ispconfig.sock';
-			
+
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 
 			wf($vhost_conf_dir.'/ispconfig.vhost', $content);
-			
+
 			unset($content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
@@ -1129,18 +1129,18 @@
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
-			
+
 			// create symlink from /usr/share/phpmyadmin to /usr/share/phpMyAdmin, if it is installed
-			if(!@file_exists('/usr/share/phpmyadmin') && @is_dir('/usr/share/phpMyAdmin')) symlink('/usr/share/phpMyAdmin/','/usr/share/phpmyadmin');
+			if(!@file_exists('/usr/share/phpmyadmin') && @is_dir('/usr/share/phpMyAdmin')) symlink('/usr/share/phpMyAdmin/', '/usr/share/phpmyadmin');
 		}
-		
+
 		// Make the Clamav log files readable by ISPConfig
 		//exec('chmod +r /var/log/clamav/clamav.log');
 		//exec('chmod +r /var/log/clamav/freshclam.log');
-		
+
 		//* Install the update script
 		if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
 		exec('chown root /usr/local/ispconfig/server/scripts/update_from_svn.sh');
@@ -1151,98 +1151,98 @@
 		exec('chmod 700 /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
 		if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_svn.sh');
 		if(!is_link('/usr/local/bin/ispconfig_update.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update.sh');
-		
+
 		// set the fast cgi starter script to executable
 		// exec('chmod 755 '.$install_dir.'/interface/bin/php-fcgi');
-		
+
 		//* Make the logs readable for the ispconfig user
 		if(@is_file('/var/log/maillog')) exec('chmod +r /var/log/maillog');
 		//if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn');
 		//if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err');
 		if(@is_file('/var/log/messages')) exec('chmod +r /var/log/messages');
-		
+
 		//To enable apache to read the directories
 		// exec('chmod a+rx /usr/local/ispconfig');
 		// exec('chmod -R 751 /usr/local/ispconfig/interface');
 		// exec('chmod a+rx /usr/local/ispconfig/interface/web');
-		
+
 		//* Create the ispconfig log directory
 		if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir']);
 		if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
-		
+
 		if(is_user('getmail')) {
 			exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
 			exec('chown getmail /usr/local/bin/run-getmail.sh');
 			exec('chmod 744 /usr/local/bin/run-getmail.sh');
 		}
-		
+
 		// Edit the file Edit the file /etc/sudoers and comment out the requiregetty line, otherwise the backup function will fail
-		replaceLine('/etc/sudoers','Defaults    requiretty','#Defaults    requiretty',0,0);
-		
+		replaceLine('/etc/sudoers', 'Defaults    requiretty', '#Defaults    requiretty', 0, 0);
+
 		if(is_dir($install_dir.'/interface/invoices')) {
 			exec('chmod -R 770 '.escapeshellarg($install_dir.'/interface/invoices'));
 			exec('chown -R ispconfig:ispconfig '.escapeshellarg($install_dir.'/interface/invoices'));
 		}
-		
+
 		//* Create the ispconfig auth log file and set uid/gid
 		if(!is_file($conf['ispconfig_log_dir'].'/auth.log')) {
 			touch($conf['ispconfig_log_dir'].'/auth.log');
 		}
 		exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log');
 		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
-		
+
 		//* Remove Domain module as its functions are available in the client module now
 		if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
-		
+
 	}
-	
+
 	public function configure_dbserver()
 	{
 		global $conf;
-		
+
 		//* If this server shall act as database server for client DB's, we configure this here
 		$install_dir = $conf['ispconfig_install_dir'];
-		
-		// Create a file with the database login details which 
+
+		// Create a file with the database login details which
 		// are used to create the client databases.
-		
+
 		if(!is_dir("$install_dir/server/lib")) {
 			$command = "mkdir $install_dir/server/lib";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', "tpl/mysql_clientdb.conf.master");
-		$content = str_replace('{hostname}',$conf['mysql']['host'],$content);
-		$content = str_replace('{username}',$conf['mysql']['admin_user'],$content);
-		$content = str_replace('{password}',$conf['mysql']['admin_password'], $content);
-		wf("$install_dir/server/lib/mysql_clientdb.conf",$content);
+		$content = str_replace('{hostname}', $conf['mysql']['host'], $content);
+		$content = str_replace('{username}', $conf['mysql']['admin_user'], $content);
+		$content = str_replace('{password}', $conf['mysql']['admin_password'], $content);
+		wf("$install_dir/server/lib/mysql_clientdb.conf", $content);
 		exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf");
 		exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf");
-		
+
 	}
-	
+
 	public function install_crontab()
-    {		
+	{
 		global $conf;
-		
+
 		//* Root Crontab
 		exec('crontab -u root -l > crontab.txt');
 		$existing_root_cron_jobs = file('crontab.txt');
-		
+
 		// remove existing ispconfig cronjobs, in case the syntax has changed
 		foreach($existing_root_cron_jobs as $key => $val) {
-			if(stristr($val,'/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
+			if(stristr($val, '/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
 		}
-		
+
 		$root_cron_jobs = array(
 			'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
 			'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
 		);
-		
+
 		if ($conf['nginx']['installed'] == true) {
 			$root_cron_jobs[] = "0 0 * * * /usr/local/ispconfig/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null";
 		}
-		
+
 		foreach($root_cron_jobs as $cron_job) {
 			if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
 				$existing_root_cron_jobs[] = $cron_job."\n";
@@ -1251,22 +1251,22 @@
 		file_put_contents('crontab.txt', $existing_root_cron_jobs);
 		exec('crontab -u root crontab.txt &> /dev/null');
 		unlink('crontab.txt');
-		
+
 		//* Getmail crontab
 		if(is_user('getmail')) {
-        	$cf = $conf['getmail'];
+			$cf = $conf['getmail'];
 			exec('crontab -u getmail -l > crontab.txt');
 			$existing_cron_jobs = file('crontab.txt');
-		
+
 			$cron_jobs = array(
-                '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
-            );
-		
+				'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
+			);
+
 			// remove existing ispconfig cronjobs, in case the syntax has changed
 			foreach($existing_cron_jobs as $key => $val) {
-				if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]);
+				if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]);
 			}
-		
+
 			foreach($cron_jobs as $cron_job) {
 				if(!in_array($cron_job."\n", $existing_cron_jobs)) {
 					$existing_cron_jobs[] = $cron_job."\n";
@@ -1276,7 +1276,7 @@
 			exec('crontab -u getmail crontab.txt &> /dev/null');
 			unlink('crontab.txt');
 		}
-		
+
 		exec('touch /var/log/ispconfig/cron.log');
 		exec('chmod 660 /var/log/ispconfig/cron.log');
 	}
diff --git a/install/dist/lib/fedora9.lib.php b/install/dist/lib/fedora9.lib.php
index da77b42..aeda9b9 100644
--- a/install/dist/lib/fedora9.lib.php
+++ b/install/dist/lib/fedora9.lib.php
@@ -33,4 +33,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index 8532088..f9b5a8b 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -28,47 +28,47 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-class installer extends installer_base 
+class installer extends installer_base
 {
 	public function configure_jailkit()
-    {
-        global $conf;
-		
+	{
+		global $conf;
+
 		if (is_dir($conf['jailkit']['config_dir']))
 		{
 			$jkinit_content = $this->get_template_file($conf['jailkit']['jk_init'], true); //* get contents
 			$this->write_config_file($conf['jailkit']['config_dir'] . '/' . $conf['jailkit']['jk_init'], $jkinit_content);
-			
+
 			$jkchroot_content = $this->get_template_file($conf['jailkit']['jk_chrootsh'], true); //* get contents
 			$this->write_config_file($conf['jailkit']['config_dir'] . '/' . $conf['jailkit']['jk_chrootsh'], $jkchroot_content);
 		}
-		
+
 		$command = 'chown root:root /var/www';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-    }
-	
+	}
+
 	public function configure_postfix($options = '')
-    {
-        global $conf;
-		
-        $cf = $conf['postfix'];
+	{
+		global $conf;
+
+		$cf = $conf['postfix'];
 		$config_dir = $cf['config_dir'];
-        
+
 		if(!is_dir($config_dir)){
-            $this->error("The postfix configuration directory '$config_dir' does not exist.");
-        }
-        
-        //* Install virtual mappings
-        foreach (glob('tpl/mysql-virtual_*.master') as $filename) {
-        	$this->process_postfix_config( basename($filename, '.master') );
-        }
-        
+			$this->error("The postfix configuration directory '$config_dir' does not exist.");
+		}
+
+		//* Install virtual mappings
+		foreach (glob('tpl/mysql-virtual_*.master') as $filename) {
+			$this->process_postfix_config( basename($filename, '.master') );
+		}
+
 		//* Changing mode and group of the new created config files.
 		caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-                 __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
-		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', 
-                __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
-		
+			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
+		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
+			__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
+
 		//* Creating virtual mail user and group
 		$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
 		if (!is_group($cf['vmail_groupname'])) {
@@ -77,198 +77,198 @@
 
 		$command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m';
 		if (!is_user($cf['vmail_username'])) {
-			caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");		
+			caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
 
 		//* These postconf commands will be executed on installation and update
-        $postconf_placeholders = array('{config_dir}' => $config_dir,
-                                       '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
-                                       '{vmail_userid}' => $cf['vmail_userid'],
-                                       '{vmail_groupid}' => $cf['vmail_groupid'],
-                                       '{rbl_list}' => $rbl_list);
-        
-        $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/gentoo_postfix.conf.master', 'tpl/gentoo_postfix.conf.master');
-        $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
-        $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
-		
+		$postconf_placeholders = array('{config_dir}' => $config_dir,
+			'{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
+			'{vmail_userid}' => $cf['vmail_userid'],
+			'{vmail_groupid}' => $cf['vmail_groupid'],
+			'{rbl_list}' => $rbl_list);
+
+		$postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/gentoo_postfix.conf.master', 'tpl/gentoo_postfix.conf.master');
+		$postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
+		$postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
+
 		//* These postconf commands will be executed on installation only
 		if($this->is_update == false) {
-			$postconf_commands = array_merge($postconf_commands,array(
-				'myhostname = '.$conf['hostname'],
-				'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
-				'mynetworks = 127.0.0.0/8 [::1]/128'
-			));
+			$postconf_commands = array_merge($postconf_commands, array(
+					'myhostname = '.$conf['hostname'],
+					'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
+					'mynetworks = 127.0.0.0/8 [::1]/128'
+				));
 		}
-		
+
 		//* Create the header and body check files
 		touch($config_dir.'/header_checks');
 		touch($config_dir.'/mime_header_checks');
 		touch($config_dir.'/nested_header_checks');
 		touch($config_dir.'/body_checks');
-		
-		
+
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
-		
+
 		//* Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//* Create the SSL certificate
-		if (!stristr($options,'dont-create-certs'))  
+		if (!stristr($options, 'dont-create-certs'))
 		{
 			$command = 'cd '.$config_dir.'; '
-                      .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
+				.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
 			exec($command);
-		
+
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//* We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop.
 		$command = 'chmod 755  /var/lib/courier/authdaemon/';
 		if (is_dir('/var/lib/courier/authdaemon')) {
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//* Changing maildrop lines in posfix master.cf
 		$configfile = $config_dir.'/master.cf';
 		$content = rf($configfile);
 
-        $content = preg_replace('/^#?maildrop/m', 'maildrop', $content);
-        $content = preg_replace('/^#?(\s+)flags=DRhu user=vmail argv=\/usr\/bin\/maildrop -d/m',
-        						'$1flags=DRhu user=vmail argv=/usr/bin/maildrop -d vmail \${extension} \${recipient} \${user} \${nexthop} \${sender}',
-        						$content);
-        						
+		$content = preg_replace('/^#?maildrop/m', 'maildrop', $content);
+		$content = preg_replace('/^#?(\s+)flags=DRhu user=vmail argv=\/usr\/bin\/maildrop -d/m',
+			'$1flags=DRhu user=vmail argv=/usr/bin/maildrop -d vmail \${extension} \${recipient} \${user} \${nexthop} \${sender}',
+			$content);
+
 		$this->write_config_file($configfile, $content);
-		
+
 		//* Writing the Maildrop mailfilter file
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailfilter.master', 'tpl/mailfilter.master');
 		$content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content);
-		
+
 		$this->write_config_file($cf['vmail_mailbox_base'].'/.mailfilter', $content);
-		
+
 		//* Create the directory for the custom mailfilters
-		if (!is_dir($cf['vmail_mailbox_base'].'/mailfilters')) 
+		if (!is_dir($cf['vmail_mailbox_base'].'/mailfilters'))
 		{
 			$command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Chmod and chown the .mailfilter file
 		$command = 'chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = 'chmod -R 600 '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 	}
-	
-	public function configure_saslauthd() 
+
+	public function configure_saslauthd()
 	{
 		global $conf;
-	
+
 		$content = $this->get_template_file('sasl_smtpd.conf', true, true); //* get contents & insert db cred
 		$this->write_config_file($conf['saslauthd']['config_dir'].'/smtpd.conf', $content);
-		
+
 		//* Edit the file saslauthd config file
 		$content = rf($conf['saslauthd']['config_file']);
 		$content = preg_replace('/(?<=\n)SASLAUTHD_OPTS="\$\{SASLAUTHD_OPTS\}[^"]+"/', 'SASLAUTHD_OPTS="${SASLAUTHD_OPTS} -a pam -r -c -s 128 -t 30 -n 5"', $content);
-		
+
 		$this->write_config_file($conf['saslauthd']['config_file'], $content);
 	}
-	
+
 	public function configure_courier()
-    {
-    	global $conf;
-    	
+	{
+		global $conf;
+
 		//* authmysqlrc
 		$content = $this->get_template_file('authmysqlrc', true, true); //* get contents & insert db cred
 		$this->write_config_file($conf['courier']['config_dir'].'/authmysqlrc', $content);
-		
+
 		//* authdaemonrc
 		$configfile = $conf['courier']['config_dir'].'/authdaemonrc';
 
 		$content = rf($configfile);
 		$content = preg_replace('/(?<=\n)authmodulelist="[^"]+"/', "authmodulelist=\"authmysql\"", $content);
 		$this->write_config_file($configfile, $content);
-		
+
 		//* create certificates
 		$command = 'mkimapdcert';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-			
+
 		$command = 'mkpop3dcert';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-    }
-    
-    public function configure_dovecot() 
-    {
-    	global $conf;
-    	
-    	$config_dir = $conf['dovecot']['config_dir'];
-    	
-    	$configfile = $conf['postfix']['config_dir'].'/master.cf';
-    	
-    	if(is_file($configfile)) {
+	}
+
+	public function configure_dovecot()
+	{
+		global $conf;
+
+		$config_dir = $conf['dovecot']['config_dir'];
+
+		$configfile = $conf['postfix']['config_dir'].'/master.cf';
+
+		if(is_file($configfile)) {
 			copy($configfile, $configfile.'~2');
 		}
 		if(is_file($configfile.'~2')) {
 			chmod($configfile.'~2', 0400);
 		}
-    	
-    	//* Configure master.cf and add a line for deliver
+
+		//* Configure master.cf and add a line for deliver
 		$content = rf($configfile);
-		
-    	if(!stristr($content,'dovecot/deliver')) {
+
+		if(!stristr($content, 'dovecot/deliver')) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf['postfix']['config_dir'].'/master.cf',$deliver_content);
+			af($conf['postfix']['config_dir'].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
 		unset($configfile);
-		
+
 		//* Reconfigure postfix to use dovecot authentication
 		$postconf_commands = array (
-				'dovecot_destination_recipient_limit = 1',
-				'virtual_transport = dovecot',
-				'smtpd_sasl_type = dovecot',
-				'smtpd_sasl_path = private/auth'
+			'dovecot_destination_recipient_limit = 1',
+			'virtual_transport = dovecot',
+			'smtpd_sasl_type = dovecot',
+			'smtpd_sasl_path = private/auth'
 		);
-		
+
 		//* Make a backup copy of the main.cf file
-		copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~3');
-		
-    	//* Executing the postconf commands
-		foreach($postconf_commands as $cmd) 
+		copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~3');
+
+		//* Executing the postconf commands
+		foreach($postconf_commands as $cmd)
 		{
 			$command = "postconf -e '$cmd'";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* copy dovecot.conf
 		$configfile = $config_dir.'/dovecot.conf';
 		$content = $this->get_template_file('dovecot.conf', true);
 		$this->write_config_file($configfile, $content);
-		
+
 		//* dovecot-sql.conf
 		$configfile = $config_dir.'/dovecot-sql.conf';
 		$content = $this->get_template_file('debian_dovecot-sql.conf', true, true);
 		$this->write_config_file($configfile, $content);
-    }
-	
+	}
+
 	public function configure_spamassassin()
-    {
+	{
 		return true;
-    }
-    
+	}
+
 	public function configure_getmail()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['getmail']['config_dir'];
-		
+
 		if (!is_dir($config_dir)) {
 			exec('mkdir -p '.escapeshellcmd($config_dir));
 		}
@@ -277,86 +277,86 @@
 		if (!is_user('getmail')) {
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		$command = "chown -R getmail $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chmod -R 700 $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Getmail will be run from cron. In order to have access to cron the getmail user needs to be part of the cron group.
 		$command = "gpasswd -a getmail " . $conf['cron']['group'];
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-    
-    public function configure_amavis() 
-    {
+
+	public function configure_amavis()
+	{
 		global $conf;
-		
+
 		//* Amavisd-new user config file
 		$conf_file = 'amavisd-ispconfig.conf';
 		$conf_path = dirname($conf['amavis']['config_file']) . '/' . $conf_file;
-		
+
 		$content = $this->get_template_file($conf_file, true, true); //* get contents & insert db cred
 		$this->write_config_file($conf_path, $content);
-		
+
 		//* Activate config directory in default file
 		$amavis_conf = rf($conf['amavis']['config_file']);
-		if (stripos($amavis_conf, $conf_path) === false) 
+		if (stripos($amavis_conf, $conf_path) === false)
 		{
 			$amavis_conf = preg_replace('/^(1;.*)$/m', "include_config_files('$conf_path');\n$1", $amavis_conf);
 			$this->write_config_file($conf['amavis']['config_file'], $amavis_conf);
 		}
-		
+
 		//* Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
-    	foreach($postconf_commands as $cmd) {
+
+		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Append the configuration for amavisd to the master.cf file
 		$content = rf($conf['postfix']['config_dir'].'/master.cf');
-		
-		if(!stristr($content,'127.0.0.1:10025')) //* Only add the content if we had not addded it before 
-		{ 
+
+		if(!stristr($content, '127.0.0.1:10025')) //* Only add the content if we had not addded it before
+			{
 			unset($content);
 			$content = $this->get_template_file('master_cf_amavis', true);
 			af($conf['postfix']['config_dir'].'/master.cf', $content);
 		}
 		unset($content);
-		
+
 		//* Add the clamav user to the amavis group
 		exec('usermod -a -G amavis clamav');
-    }
-    
-    public function configure_pureftpd()
-    {
+	}
+
+	public function configure_pureftpd()
+	{
 		global $conf;
-		
+
 		//* configure pure-ftpd for MySQL authentication against the ispconfig database
 		$content = $this->get_template_file('pureftpd_mysql.conf', true, true); //* get contents & insert db cred
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
-		
+
 		$this->write_config_file($conf['pureftpd']['mysql_config_file'], $content, 600, 'root', 'root');
-		
+
 		//* enable pure-ftpd and server settings
 		$content = rf($conf["pureftpd"]["config_file"]);
-		
+
 		$content = preg_replace('/#?IS_CONFIGURED="(?:yes|no)"/', 'IS_CONFIGURED="yes"', $content);
 		$content = str_replace('AUTH="-l unix"', 'AUTH="-l mysql:'.$conf['pureftpd']['mysql_config_file'].'"', $content);
-		
+
 		//* Logging defaults to syslog's ftp facility. Override this behaviour for better compatibility with debian/ubuntu
 		//* and specify the format.
 		$logdir = '/var/log/pure-ftpd';
 		if (!is_dir($logdir)) {
 			mkdir($logdir, 0755, true);
 		}
-		
+
 		/**
 		 * @link http://download.pureftpd.org/pub/pure-ftpd/doc/README
 		 * -b brokenclientscompatibility
@@ -364,45 +364,47 @@
 		 * -E noanonymous
 		 * -O altlog <format>:<log file>
 		 * -Z customerproof (Add safe guards against common customer mistakes ie. like chmod 0 on their own files)
-		 * -D displaydotfiles 
+		 * -D displaydotfiles
 		 * -H dontresolve
 		 */
+
+
 		$content = preg_replace('/MISC_OTHER="[^"]+"/', 'MISC_OTHER="-b -A -E -Z -D -H -O clf:'.$logdir.'/transfer.log"', $content);
-		
+
 		$this->write_config_file($conf['pureftpd']['config_file'], $content);
-    }
-    
-	public function configure_powerdns() 
+	}
+
+	public function configure_powerdns()
 	{
 		global $conf;
-		
+
 		//* Create the database
 		if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$conf['powerdns']['database'].' DEFAULT CHARACTER SET '.$conf['mysql']['charset'])) {
 			$this->error('Unable to create MySQL database: '.$conf['powerdns']['database'].'.');
 		}
-		
+
 		//* Create the ISPConfig database user in the local database
-        $query = 'GRANT ALL ON `'.$conf['powerdns']['database'].'` . * TO \''.$conf['mysql']['ispconfig_user'].'\'@\'localhost\';';
+		$query = 'GRANT ALL ON `'.$conf['powerdns']['database'].'` . * TO \''.$conf['mysql']['ispconfig_user'].'\'@\'localhost\';';
 		if(!$this->db->query($query)) {
 			$this->error('Unable to create user for powerdns database Error: '.$this->db->errorMessage);
 		}
-		
+
 		//* Reload database privelages
 		$this->db->query('FLUSH PRIVILEGES;');
-		
+
 		//* load the powerdns databse dump
 		if($conf['mysql']['admin_password'] == '') {
-			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", 
-                    __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
+			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
+				__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
 		} else {
-			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", 
-                     __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
+			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
+				__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
 		}
-		
+
 		//* Create the powerdns config file
 		$content = $this->get_template_file('pdns.local', true, true); //* get contents & insert db cred
 		$content = str_replace('{powerdns_database}', $conf['powerdns']['database'], $content);
-		
+
 		$this->write_config_file($conf["powerdns"]["config_dir"].'/'.$conf["powerdns"]["config_file"], $content, 600, 'root', 'root');
 
 		//* Create symlink to init script to start the correct config file
@@ -410,26 +412,26 @@
 			symlink($conf['init_scripts'].'/pdns', $conf['init_scripts'].'/'.$conf['powerdns']['init_script']);
 		}
 	}
-	
+
 	public function configure_bind() {
 		global $conf;
 
-	    //* Check if the zonefile directory has a slash at the end
-	    $content=$conf['bind']['bind_zonefiles_dir'];
-	    if(substr($content,-1,1) != '/') {
-    	    $content .= '/';
+		//* Check if the zonefile directory has a slash at the end
+		$content=$conf['bind']['bind_zonefiles_dir'];
+		if(substr($content, -1, 1) != '/') {
+			$content .= '/';
 		}
-		
+
 		//* New default format of named.conf uses views. Check which version the system is using and include our zones file.
 		$named_conf = rf($conf['bind']['named_conf_path']);
-		if (stripos($named_conf, 'include "'.$conf['bind']['named_conf_local_path'].'";') === false) 
+		if (stripos($named_conf, 'include "'.$conf['bind']['named_conf_local_path'].'";') === false)
 		{
 			preg_match_all("/(?<=\n)view \"(?:public|internal)\" in \{.*\n\};/Us", $named_conf, $views);
 			if (count($views[0]) == 2) {
 				foreach ($views[0] as $view) {
 					$named_conf = str_replace($view, substr($view, 0, -2)."include \"{$conf['bind']['named_conf_local_path']}\";\n};", $named_conf);
 				}
-				
+
 				wf($conf['bind']['named_conf_path'], $named_conf);
 			}
 			else {
@@ -437,48 +439,48 @@
 			}
 		}
 	}
-	
+
 	public function configure_apache()
-    {	
+	{
 		global $conf;
-		
+
 		if($conf['apache']['installed'] == false) return;
 		//* Create the logging directory for the vhost logfiles
 		if (!is_dir($conf['ispconfig_log_dir'].'/httpd')) {
 			mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
 		}
-		
-		if (is_file($conf['suphp']['config_file'])) 
+
+		if (is_file($conf['suphp']['config_file']))
 		{
 			$content = rf($conf['suphp']['config_file']);
-			
+
 			if (!preg_match('|^x-httpd-suphp=php:/usr/bin/php-cgi$|m', $content))
 			{
-				$content = preg_replace('/;Handler for php-scripts/',";Handler for php-scripts\nx-httpd-suphp=php:/usr/bin/php-cgi", $content);
-				$content = preg_replace('/;?umask=\d+/','umask=0022', $content);
+				$content = preg_replace('/;Handler for php-scripts/', ";Handler for php-scripts\nx-httpd-suphp=php:/usr/bin/php-cgi", $content);
+				$content = preg_replace('/;?umask=\d+/', 'umask=0022', $content);
 			}
-			
+
 			$this->write_config_file($conf['suphp']['config_file'], $content);
 		}
-		
+
 		//* Enable ISPConfig default vhost settings
 		$default_vhost_path = $conf['apache']['vhost_conf_dir'].'/'.$conf['apache']['vhost_default'];
-		if (is_file($default_vhost_path)) 
+		if (is_file($default_vhost_path))
 		{
 			$content = rf($default_vhost_path);
-			
+
 			$content = preg_replace('/^#?\s*NameVirtualHost.*$/m', 'NameVirtualHost *:80', $content);
 			$content = preg_replace('/<VirtualHost[^>]+>/', '<VirtualHost *:80>', $content);
-			
+
 			$this->write_config_file($default_vhost_path, $content);
 		}
-		
+
 		//* Generate default ssl certificates
 		if (!is_dir($conf['apache']['ssl_dir'])) {
 			mkdir($conf['apache']['ssl_dir']);
 		}
-		
-		if ($conf['services']['mail'] == true) 
+
+		if ($conf['services']['mail'] == true)
 		{
 			copy($conf['postfix']['config_dir']."/smtpd.key", $conf['apache']['ssl_dir']."/server.key");
 			copy($conf['postfix']['config_dir']."/smtpd.cert", $conf['apache']['ssl_dir']."/server.crt");
@@ -489,76 +491,76 @@
 				exec("openssl req -new -outform PEM -out {$conf['apache']['ssl_dir']}/server.crt -newkey rsa:2048 -nodes -keyout {$conf['apache']['ssl_dir']}/server.key -keyform PEM -days 365 -x509");
 			}
 		}
-		
-		
-		
+
+
+
 		//* Copy the ISPConfig configuration include
 		$content = $this->get_template_file('apache_ispconfig.conf', true);
-		
+
 		$records = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ".$conf["server_id"]." AND virtualhost = 'y'");
-		if(is_array($records) && count($records) > 0) 
+		if(is_array($records) && count($records) > 0)
 		{
 			foreach($records as $rec) {
 				$content .= "NameVirtualHost ".$rec["ip_address"].":80\n";
 				$content .= "NameVirtualHost ".$rec["ip_address"].":443\n";
 			}
 		}
-		
+
 		$this->write_config_file($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $content);
-		
+
 		//* Gentoo by default does not include .vhost files. Add include line to config file.
 		$content = rf($conf['apache']['config_file']);
 		if ( strpos($content, 'Include /etc/apache2/vhosts.d/*.vhost') === false ) {
-			$content = preg_replace('|(Include /etc/apache2/vhosts.d/\*.conf)|',"$1\nInclude /etc/apache2/vhosts.d/*.vhost", $content);
+			$content = preg_replace('|(Include /etc/apache2/vhosts.d/\*.conf)|', "$1\nInclude /etc/apache2/vhosts.d/*.vhost", $content);
 		}
-		
+
 		$this->write_config_file($conf['apache']['config_file'], $content);
-		
+
 		//* make sure that webalizer finds its config file when it is directly in /etc
-		if(is_file('/etc/webalizer.conf') && !is_dir('/etc/webalizer')) 
+		if(is_file('/etc/webalizer.conf') && !is_dir('/etc/webalizer'))
 		{
 			mkdir('/etc/webalizer', 0755);
 			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
-		
-    	if(is_file('/etc/webalizer/webalizer.conf')) //* Change webalizer mode to incremental 
-    	{
-    		replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+
+		if(is_file('/etc/webalizer/webalizer.conf')) //* Change webalizer mode to incremental
+			{
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		//* add a sshusers group
-		if (!is_group('sshusers')) 
+		if (!is_group('sshusers'))
 		{
 			$command = 'groupadd sshusers';
 			caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-    }
-    
-    public function configure_apps_vhost()
+	}
+
+	public function configure_apps_vhost()
 	{
 		global $conf;
-		
+
 		//* Create the ispconfig apps vhost user and group
 		if($conf['apache']['installed'] == true){
 			$apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']);
 			$apps_vhost_group = escapeshellcmd($conf['web']['apps_vhost_group']);
 			$install_dir = escapeshellcmd($conf['web']['website_basedir'].'/apps');
-		
+
 			$command = 'groupadd '.$apps_vhost_user;
 			if ( !is_group($apps_vhost_group) ) {
 				caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
-		
+
 			$command = "useradd -g '$apps_vhost_group' -d $install_dir $apps_vhost_group";
 			if ( !is_user($apps_vhost_user) ) {
 				caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
-		
+
 			$command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group;
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 			if(!@is_dir($install_dir)){
 				mkdir($install_dir, 0755, true);
 			} else {
@@ -566,41 +568,41 @@
 			}
 			chown($install_dir, $apps_vhost_user);
 			chgrp($install_dir, $apps_vhost_group);
-		
+
 			//* Copy the apps vhost file
 			$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
 			$apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '') ? '' : 'ServerName '.$conf['web']['apps_vhost_servername'];
-        
+
 			//* Dont just copy over the virtualhost template but add some custom settings
 			$content = $this->get_template_file('apache_apps.vhost', true);
-        
+
 			$content = str_replace('{apps_vhost_ip}', $conf['web']['apps_vhost_ip'], $content);
 			$content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content);
 			$content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content);
 			$content = str_replace('{website_basedir}', $conf['web']['website_basedir'], $content);
 			$content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content);
-		
+
 			//* comment out the listen directive if port is 80 or 443
 			if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-		
+
 			$this->write_config_file("$vhost_conf_dir/apps.vhost", $content);
-		
-			//if ( !is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter') ) 
+
+			//if ( !is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter') )
 			//{
-				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_apps_fcgi_starter.master', 'tpl/apache_apps_fcgi_starter.master');
-				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
-				$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
-				mkdir($conf['web']['website_basedir'].'/php-fcgi-scripts/apps', 0755, true);
-				//copy('tpl/apache_apps_fcgi_starter.master',$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
-				wf($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter', $content);
-				exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
-				exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps');
-			
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_apps_fcgi_starter.master', 'tpl/apache_apps_fcgi_starter.master');
+			$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
+			$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
+			mkdir($conf['web']['website_basedir'].'/php-fcgi-scripts/apps', 0755, true);
+			//copy('tpl/apache_apps_fcgi_starter.master',$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
+			wf($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter', $content);
+			exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
+			exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps');
+
 			//}
 		}
 		if($conf['nginx']['installed'] == true){
@@ -633,15 +635,15 @@
 
 			// Dont just copy over the virtualhost template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_apps.vhost.master', 'tpl/nginx_apps.vhost.master');
-			
+
 			if($conf['web']['apps_vhost_ip'] == '_default_'){
 				$apps_vhost_ip = '';
 			} else {
 				$apps_vhost_ip = $conf['web']['apps_vhost_ip'].':';
 			}
-			
+
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'apps.sock';
 			$cgi_socket = escapeshellcmd($conf['nginx']['cgi_socket']);
@@ -655,7 +657,7 @@
 			$content = str_replace('{cgi_socket}', $cgi_socket, $content);
 
 			wf($vhost_conf_dir.'/apps.vhost', $content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apps_php_fpm_pool.conf.master', 'tpl/apps_php_fpm_pool.conf.master');
@@ -670,84 +672,84 @@
 			//* and create the symlink
 			if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost');
 			if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) {
-				symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost');
+				symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
 			}
-			
+
 		}
 	}
-    
-    public function install_ispconfig()
-    {
+
+	public function install_ispconfig()
+	{
 		global $conf;
-		
+
 		$install_dir = $conf['ispconfig_install_dir'];
-		
-    	//* Create the ISPConfig installation directory
-		if(!is_dir($install_dir)) 
+
+		//* Create the ISPConfig installation directory
+		if(!is_dir($install_dir))
 		{
 			$command = "mkdir $install_dir";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Create a ISPConfig user and group
-		if (!is_group('ispconfig')) 
+		if (!is_group('ispconfig'))
 		{
 			$command = 'groupadd ispconfig';
 			caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
-		if (!is_user('ispconfig')) 
+
+		if (!is_user('ispconfig'))
 		{
 			$command = "useradd -g ispconfig -d $install_dir ispconfig";
 			caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* copy the ISPConfig interface part
 		$command = "cp -rf ../interface $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig server part
 		$command = "cp -rf ../server $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
-		
+
+
 		//* Create the config file for ISPConfig interface
 		$configfile = 'config.inc.php';
 		$content = $this->get_template_file($configfile, true, true); //* get contents & insert db cred
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
 		$content = str_replace('{timezone}', $conf['timezone'], $content);
 		$content = str_replace('{theme}', $conf['theme'], $content);
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
-		
+
 		$this->write_config_file("$install_dir/interface/lib/$configfile", $content);
-		
+
 		//* Create the config file for ISPConfig server
 		$this->write_config_file("$install_dir/server/lib/$configfile", $content);
-		
+
 		//* Create the config file for remote-actions (but only, if it does not exist, because
 		//  the value is a autoinc-value and so changed by the remoteaction_core_module
 		if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) {
 			$content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
 			wf($install_dir.'/server/lib/remote_action.inc.php', $content);
 		}
-		
-    	// Enable the server modules and plugins.
+
+		// Enable the server modules and plugins.
 		// TODO: Implement a selector which modules and plugins shall be enabled.
 		$dir = $install_dir.'/server/mods-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/mods-available/'.$file);
-						$module_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/mods-available/'.$file;
+						$module_name = substr($file, 0, -8);
 						$tmp = new $module_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) {
@@ -774,11 +776,11 @@
 				while (($file = readdir($dh)) !== false) {
 					if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
 					if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/plugins-available/'.$file);
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/plugins-available/'.$file;
+						$plugin_name = substr($file, 0, -8);
 						$tmp = new $plugin_name;
-						if(method_exists($tmp,'onInstall') && $tmp->onInstall()) {
+						if(method_exists($tmp, 'onInstall') && $tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) {
 								@symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file);
 							}
@@ -794,7 +796,7 @@
 				closedir($dh);
 			}
 		}
-		
+
 		//* Update the server config
 		$mail_server_enabled = ($conf['services']['mail'])?1:0;
 		$web_server_enabled = ($conf['services']['web'])?1:0;
@@ -802,16 +804,16 @@
 		$file_server_enabled = ($conf['services']['file'])?1:0;
 		$db_server_enabled = ($conf['services']['db'])?1:0;
 		$vserver_server_enabled = ($conf['services']['vserver'])?1:0;
-		
-    	$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']);
-		
+
+		$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']);
+
 		if($conf['mysql']['master_slave_setup'] == 'y') {
 			$this->dbmaster->query($sql);
 			$this->db->query($sql);
 		} else {
 			$this->db->query($sql);
 		}
-		
+
 		//* Chmod the files
 		$command = "chmod -R 750 $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -819,40 +821,40 @@
 		//* chown the files to the ispconfig user and group
 		$command = "chown -R ispconfig:ispconfig $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Make the global language file directory group writable
 		exec("chmod -R 770 $install_dir/interface/lib/lang");
-		
+
 		//* Make the temp directory for language file exports writable
 		if(is_dir($install_dir.'/interface/web/temp')) {
 			exec("chmod -R 770 $install_dir/interface/web/temp");
 		}
-		
-	    //* Make all interface language file directories group writable
+
+		//* Make all interface language file directories group writable
 		$handle = @opendir($install_dir.'/interface/web');
-		while ($file = @readdir ($handle)) { 
-	   		if ($file != '.' && $file != '..') {
-	        	if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
+		while ($file = @readdir($handle)) {
+			if ($file != '.' && $file != '..') {
+				if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
 					$handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang');
-					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770);
-					while ($lang_file = @readdir ($handle2)) {
+					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770);
+					while ($lang_file = @readdir($handle2)) {
 						if ($lang_file != '.' && $lang_file != '..') {
-							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770);
+							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770);
 						}
 					}
 				}
 			}
 		}
-		
+
 		//* Make the APS directories group writable
 		exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
 		exec("chmod -R 770 $install_dir/server/aps_packages");
-		
-	    //* make sure that the server config file (not the interface one) is only readable by the root user
+
+		//* make sure that the server config file (not the interface one) is only readable by the root user
 		chmod($install_dir.'/server/lib/config.inc.php', 0600);
 		chown($install_dir.'/server/lib/config.inc.php', 'root');
 		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
-		
+
 		//* Make sure thet the interface config file is readable by user ispconfig only
 		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
 		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
@@ -867,12 +869,12 @@
 			chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
 			chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
 		}
-		
+
 		if(is_dir($install_dir.'/interface/invoices')) {
 			exec('chmod -R 770 '.escapeshellarg($install_dir.'/interface/invoices'));
 			exec('chown -R ispconfig:ispconfig '.escapeshellarg($install_dir.'/interface/invoices'));
 		}
-		
+
 		// TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing
 		// and must be fixed as this will allow the apache user to read the ispconfig files.
 		// Later this must run as own apache server or via suexec!
@@ -892,23 +894,23 @@
 				caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
 		}
-		
+
 		//* Make the shell scripts executable
 		$command = "chmod +x $install_dir/server/scripts/*.sh";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		if($conf['apache']['installed'] == true && $this->install_ispconfig_interface == true){
 			//* Copy the ISPConfig vhost for the controlpanel
 			$content = $this->get_template_file("apache_ispconfig.vhost", true);
 			$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
-		
+
 			//* comment out the listen directive if port is 80 or 443
 			if ($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-		
+
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_comment}', '', $content);
 			} else {
@@ -919,10 +921,10 @@
 			} else {
 				$content = str_replace('{ssl_bundle_comment}', '#', $content);
 			}
-		
+
 			$vhost_path = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost';
 			$this->write_config_file($vhost_path, $content);
-		
+
 			if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
 				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
 				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
@@ -931,7 +933,7 @@
 				wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
 				exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
 				chmod('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', 0755);
-				@symlink($install_dir.'/interface/web','/var/www/ispconfig');
+				@symlink($install_dir.'/interface/web', '/var/www/ispconfig');
 				exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
 			}
 		}
@@ -944,7 +946,7 @@
 			// Dont just copy over the virtualhost template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master');
 			$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
-		
+
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_on}', ' on', $content);
 				$content = str_replace('{ssl_comment}', '', $content);
@@ -954,19 +956,19 @@
 				$content = str_replace('{ssl_comment}', '#', $content);
 				$content = str_replace('{fastcgi_ssl}', 'off', $content);
 			}
-			
+
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'ispconfig.sock';
-			
+
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 
 			wf($vhost_conf_dir.'/ispconfig.vhost', $content);
-			
+
 			unset($content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
@@ -982,31 +984,31 @@
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
 		}
-		
+
 		//* Install the update script
 		if (is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) {
 			unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
 		}
-		
+
 		chown($install_dir.'/server/scripts/update_from_svn.sh', 'root');
 		chmod($install_dir.'/server/scripts/update_from_svn.sh', 0700);
 		chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root');
 		chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
 		chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root');
 		chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700);
-		
+
 		if (!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) {
 			symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_svn.sh');
 		}
-		
+
 		if (!is_link('/usr/local/bin/ispconfig_update.sh')) {
 			symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update.sh');
 		}
-		
+
 		//* Make the logs readable for the ispconfig user
 		if (is_file('/var/log/maillog')) {
 			exec('chmod +r /var/log/maillog');
@@ -1020,7 +1022,7 @@
 		if (is_file('/var/log/clamav/freshclam.log')) {
 			exec('chmod +r /var/log/clamav/freshclam.log');
 		}
-		
+
 		//* Create the ispconfig log directory
 		if (!is_dir($conf['ispconfig_log_dir'])) {
 			mkdir($conf['ispconfig_log_dir']);
@@ -1028,25 +1030,26 @@
 		if (!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) {
 			touch($conf['ispconfig_log_dir'].'/ispconfig.log');
 		}
-		
+
 		//* Create the ispconfig auth log file and set uid/gid
 		if(!is_file($conf['ispconfig_log_dir'].'/auth.log')) {
 			touch($conf['ispconfig_log_dir'].'/auth.log');
 		}
 		exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log');
 		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
-		
+
 		rename($install_dir.'/server/scripts/run-getmail.sh', '/usr/local/bin/run-getmail.sh');
-		
+
 		if (is_user('getmail')) {
 			chown('/usr/local/bin/run-getmail.sh', 'getmail');
 		}
 		chmod('/usr/local/bin/run-getmail.sh', 0744);
-		
+
 		//* Remove Domain module as its functions are available in the client module now
 		if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
-		
-    }
+
+	}
+
 }
 
 ?>
diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php
index e087772..e104f4a 100644
--- a/install/dist/lib/opensuse.lib.php
+++ b/install/dist/lib/opensuse.lib.php
@@ -58,7 +58,7 @@
 				}
 			}
 		}
-		
+
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
 
@@ -69,13 +69,13 @@
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -87,78 +87,78 @@
 		$content = str_replace('{virtual_domains}', $virtual_domains, $content);
 
 		wf($full_file_name, $content);
-		
+
 		//* Write virtual_to_transport.sh script
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
+
 		if(is_dir('/etc/mailman')) {
 			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
-            } else {
-                copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
-            }
-			chgrp($full_file_name,'mailman');
-			chmod($full_file_name,0750);
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+			} else {
+				copy('tpl/mailman-virtual_to_transport.sh', $full_file_name);
+			}
+			chgrp($full_file_name, 'mailman');
+			chmod($full_file_name, 0750);
 		}
-		
+
 		//* Create aliasaes
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
 	}
-	
+
 	function configure_postfix($options = '')
-    {
-        global $conf;
+	{
+		global $conf;
 		$cf = $conf['postfix'];
 		$config_dir = $cf['config_dir'];
-        
+
 		if(!is_dir($config_dir)){
-            $this->error("The postfix configuration directory '$config_dir' does not exist.");
-        }
-        
+			$this->error("The postfix configuration directory '$config_dir' does not exist.");
+		}
+
 		//* mysql-virtual_domains.cf
-        $this->process_postfix_config('mysql-virtual_domains.cf');
+		$this->process_postfix_config('mysql-virtual_domains.cf');
 
 		//* mysql-virtual_forwardings.cf
-        $this->process_postfix_config('mysql-virtual_forwardings.cf');
+		$this->process_postfix_config('mysql-virtual_forwardings.cf');
 
 		//* mysql-virtual_mailboxes.cf
-        $this->process_postfix_config('mysql-virtual_mailboxes.cf');
+		$this->process_postfix_config('mysql-virtual_mailboxes.cf');
 
 		//* mysql-virtual_email2email.cf
-        $this->process_postfix_config('mysql-virtual_email2email.cf');
+		$this->process_postfix_config('mysql-virtual_email2email.cf');
 
 		//* mysql-virtual_transports.cf
-        $this->process_postfix_config('mysql-virtual_transports.cf');
+		$this->process_postfix_config('mysql-virtual_transports.cf');
 
 		//* mysql-virtual_recipient.cf
-        $this->process_postfix_config('mysql-virtual_recipient.cf');
+		$this->process_postfix_config('mysql-virtual_recipient.cf');
 
 		//* mysql-virtual_sender.cf
-        $this->process_postfix_config('mysql-virtual_sender.cf');
+		$this->process_postfix_config('mysql-virtual_sender.cf');
 
 		//* mysql-virtual_client.cf
-        $this->process_postfix_config('mysql-virtual_client.cf');
-		
+		$this->process_postfix_config('mysql-virtual_client.cf');
+
 		//* mysql-virtual_relaydomains.cf
-        $this->process_postfix_config('mysql-virtual_relaydomains.cf');
-		
+		$this->process_postfix_config('mysql-virtual_relaydomains.cf');
+
 		//* mysql-virtual_relayrecipientmaps.cf
-        $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
+		$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
 
 		//* Changing mode and group of the new created config files.
 		caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-                 __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
-		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', 
-                __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
-		
+			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
+		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
+			__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
+
 		if(!is_dir($cf['vmail_mailbox_base'])) mkdir($cf['vmail_mailbox_base']);
-		
+
 		//* Creating virtual mail user and group
 		if(is_group($cf['vmail_groupname'])) {
 			$command = 'groupmod -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
@@ -167,7 +167,7 @@
 			$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		if(is_user($cf['vmail_username'])) {
 			$command = 'usermod -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' -d '.$cf['vmail_mailbox_base'].' -s /bin/bash '.$cf['vmail_username'];
 			caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -175,9 +175,9 @@
 			$command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m';
 			caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		if($cf['vmail_mailbox_base'] != '' && strlen($cf['vmail_mailbox_base']) >= 10 && $this->is_update === false) exec('chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base']);
-		
+
 		//* These postconf commands will be executed on installation and update
 		$server_ini_rec = $this->db->queryOneRecord("SELECT config FROM server WHERE server_id = ".$conf['server_id']);
 		$server_ini_array = ini_to_array(stripslashes($server_ini_rec['config']));
@@ -186,40 +186,40 @@
 		//* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update
 		$rbl_list = '';
 		if (@isset($server_ini_array['mail']['realtime_blackhole_list']) && $server_ini_array['mail']['realtime_blackhole_list'] != '') {
-			$rbl_hosts = explode(",",str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
+			$rbl_hosts = explode(",", str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
 			foreach ($rbl_hosts as $key => $value) {
 				$rbl_list .= ", reject_rbl_client ". $value;
 			}
 		}
 		unset($rbl_hosts);
 		unset($server_ini_array);
-		
+
 		//* These postconf commands will be executed on installation and update
-        $postconf_placeholders = array('{config_dir}' => $config_dir,
-                                       '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
-                                       '{vmail_userid}' => $cf['vmail_userid'],
-                                       '{vmail_groupid}' => $cf['vmail_groupid'],
-                                       '{rbl_list}' => $rbl_list);
-        
-        $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_postfix.conf.master', 'tpl/opensuse_postfix.conf.master');
-        $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
-        $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
-		
+		$postconf_placeholders = array('{config_dir}' => $config_dir,
+			'{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
+			'{vmail_userid}' => $cf['vmail_userid'],
+			'{vmail_groupid}' => $cf['vmail_groupid'],
+			'{rbl_list}' => $rbl_list);
+
+		$postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_postfix.conf.master', 'tpl/opensuse_postfix.conf.master');
+		$postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
+		$postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
+
 		//* These postconf commands will be executed on installation only
 		if($this->is_update == false) {
-			$postconf_commands = array_merge($postconf_commands,array(
-				'myhostname = '.$conf['hostname'],
-				'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
-				'mynetworks = 127.0.0.0/8 [::1]/128'
-			));
+			$postconf_commands = array_merge($postconf_commands, array(
+					'myhostname = '.$conf['hostname'],
+					'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
+					'mynetworks = 127.0.0.0/8 [::1]/128'
+				));
 		}
-		
+
 		//* Create the header and body check files
 		touch($config_dir.'/header_checks');
 		touch($config_dir.'/mime_header_checks');
 		touch($config_dir.'/nested_header_checks');
 		touch($config_dir.'/body_checks');
-		
+
 		//* Create the mailman files
 		if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data');
 		if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases');
@@ -228,78 +228,78 @@
 		exec('postmap /var/lib/mailman/data/virtual-mailman');
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
-		
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
-		
+
 		//* Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
-		if(!stristr($options,'dont-create-certs')) {
+
+		if(!stristr($options, 'dont-create-certs')) {
 			//* Create the SSL certificate
 			$command = 'cd '.$config_dir.'; '
-                      .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
+				.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
 			exec($command);
-		
+
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop.
 		$command = 'chmod 755  /var/run/authdaemon.courier-imap';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
-		
+
 		//* Changing maildrop lines in posfix master.cf
 		if(is_file($config_dir.'/master.cf')){
-            copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
-        }
+			copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
+		}
 		if(is_file($config_dir.'/master.cf~')){
-            exec('chmod 400 '.$config_dir.'/master.cf~');
-        }
+			exec('chmod 400 '.$config_dir.'/master.cf~');
+		}
 		$configfile = $config_dir.'/master.cf';
 		$content = rf($configfile);
-		
-		$content = str_replace('  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-		
-		$content = str_replace('  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-		
+
+		$content = str_replace('  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
+		$content = str_replace('  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
 		// enable tlsmanager
-		$content = str_replace('#tlsmgr    unix  -       -       n       1000?   1       tlsmgr','tlsmgr    unix  -       -       n       1000?   1       tlsmgr',$content);
-		
+		$content = str_replace('#tlsmgr    unix  -       -       n       1000?   1       tlsmgr', 'tlsmgr    unix  -       -       n       1000?   1       tlsmgr', $content);
+
 		wf($configfile, $content);
-		
+
 		//* Writing the Maildrop mailfilter file
 		$configfile = 'mailfilter';
 		if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)){
-            copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
-        }
+			copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
+		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content);
 		wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content);
-		
+
 		//* Create the directory for the custom mailfilters
 		$command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Chmod and chown the .mailfilter file
 		$command = 'chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = 'chmod -R 600 '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 	}
-	
+
 	public function configure_saslauthd() {
 		global $conf;
-		
+
 		/*
 		$configfile = 'sasl_smtpd.conf';
 		if(is_file('/etc/sasl2/smtpd.conf')) copy('/etc/sasl2/smtpd.conf','/etc/sasl2/smtpd.conf~');
@@ -311,14 +311,14 @@
 		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
 		wf('/etc/sasl2/smtpd.conf',$content);
 		*/
-		
+
 		// TODO: Chmod and chown on the config file
-		
-		
+
+
 		/*
 		// Create the spool directory
 		exec('mkdir -p /var/spool/postfix/var/run/saslauthd');
-		
+
 		// Edit the file /etc/default/saslauthd
 		$configfile = $conf["saslauthd"]["config"];
 		if(is_file($configfile)) copy($configfile,$configfile.'~');
@@ -328,22 +328,22 @@
 		$content = str_replace('OPTIONS="-c"','OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"',$content);
 		wf($configfile,$content);
 		*/
-		
+
 		// Edit the file /etc/init.d/saslauthd
 		$configfile = $conf["init_scripts"].'/'.$conf["saslauthd"]["init_script"];
 		$content = rf($configfile);
-		$content = str_replace('/sbin/startproc $AUTHD_BIN -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1','/sbin/startproc $AUTHD_BIN -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1',$content);
-		$content = str_replace('/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1','/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1',$content);
-		
-		
-		if(is_file($configfile)) wf($configfile,$content);
-		
-		
-		
+		$content = str_replace('/sbin/startproc $AUTHD_BIN -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', '/sbin/startproc $AUTHD_BIN -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', $content);
+		$content = str_replace('/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', '/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', $content);
+
+
+		if(is_file($configfile)) wf($configfile, $content);
+
+
+
 	}
-	
+
 	public function configure_pam()
-    {
+	{
 		global $conf;
 		$pam = $conf['pam'];
 		//* configure pam for SMTP authentication agains the ispconfig database
@@ -361,65 +361,65 @@
 		if(is_file("$pam/smtp"))    exec("chmod o= $pam/smtp");
 		//exec("chmod 660 $pam/smtp");
 		//exec("chown root:root $pam/smtp");
-	
+
 	}
-	
+
 	public function configure_courier()
-    {
+	{
 		global $conf;
 		$config_dir = $conf['courier']['config_dir'];
 		//* authmysqlrc
 		$configfile = 'authmysqlrc';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
 		exec("chmod 400 $config_dir/$configfile~");
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf("$config_dir/$configfile", $content);
-		
+
 		exec("chmod 660 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
-		
+
 		//* authdaemonrc
 		$configfile = $conf['courier']['config_dir'].'/authdaemonrc';
 		if(is_file($configfile)){
-            copy($configfile, $configfile.'~');
-        }
+			copy($configfile, $configfile.'~');
+		}
 		if(is_file($configfile.'~')){
-            exec('chmod 400 '.$configfile.'~');
-        }
+			exec('chmod 400 '.$configfile.'~');
+		}
 		$content = rf($configfile);
 		$content = str_replace('authmodulelist=', 'authmodulelist="authmysql"', $content);
 		wf($configfile, $content);
 	}
-	
+
 	public function configure_dovecot()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['dovecot']['config_dir'];
-		
+
 		//* Configure master.cf and add a line for deliver
 		if(is_file($config_dir.'/master.cf')){
-            copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
-        }
+			copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
+		}
 		if(is_file($config_dir.'/master.cf~')){
-            exec('chmod 400 '.$config_dir.'/master.cf~2');
-        }
+			exec('chmod 400 '.$config_dir.'/master.cf~2');
+		}
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"dovecot/deliver")) {
+		if(!stristr($content, "dovecot/deliver")) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf["postfix"]["config_dir"].'/master.cf',$deliver_content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
-		
-		
+
+
 		//* Reconfigure postfix to use dovecot authentication
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
@@ -429,115 +429,115 @@
 			'smtpd_sasl_path = private/auth',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~3');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~3');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* backup dovecot.conf
 		$configfile = 'dovecot.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
-		
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
+
 		//* Get the dovecot version
-		exec('dovecot --version',$tmp);
-		$parts = explode('.',trim($tmp[0]));
+		exec('dovecot --version', $tmp);
+		$parts = explode('.', trim($tmp[0]));
 		$dovecot_version = $parts[0];
 		unset($tmp);
 		unset($parts);
-		
+
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot2.conf.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot2.conf.master', $config_dir.'/'.$configfile);
-            } else {
-                copy('tpl/opensuse_dovecot2.conf.master',$config_dir.'/'.$configfile);
-            }
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot2.conf.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot2.conf.master', $config_dir.'/'.$configfile);
+			} else {
+				copy('tpl/opensuse_dovecot2.conf.master', $config_dir.'/'.$configfile);
+			}
 		} else {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot.conf.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot.conf.master', $config_dir.'/'.$configfile);
-            } else {
-                copy('tpl/opensuse_dovecot.conf.master',$config_dir.'/'.$configfile);
-            }
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot.conf.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot.conf.master', $config_dir.'/'.$configfile);
+			} else {
+				copy('tpl/opensuse_dovecot.conf.master', $config_dir.'/'.$configfile);
+			}
 		}
-		
+
 		//* dovecot-sql.conf
 		$configfile = 'dovecot-sql.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
 			exec("chmod 400 $config_dir/$configfile~");
-        }
-		
+		}
+
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot-sql.conf.master', "tpl/opensuse_dovecot-sql.conf.master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf("$config_dir/$configfile", $content);
-		
+
 		exec("chmod 600 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
 
 	}
-	
+
 	public function configure_amavis() {
 		global $conf;
-		
+
 		// amavisd user config file
 		$configfile = 'opensuse_amavisd_conf';
-		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) @copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
+		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) @copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_port}',$conf["mysql"]["port"],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		wf($conf["amavis"]["config_dir"].'/amavisd.conf',$content);
-		
-		
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+
+
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~2');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~');
+		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"127.0.0.1:10025")) {
+		if(!stristr($content, "127.0.0.1:10025")) {
 			unset($content);
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
-			af($conf["postfix"]["config_dir"].'/master.cf',$content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $content);
 		}
 		unset($content);
-		
+
 		// Add the clamav user to the vscan group
 		exec('groupmod --add-user clamav vscan');
-		
-		
+
+
 	}
-	
+
 	public function configure_spamassassin()
-    {
+	{
 		global $conf;
-		
+
 		//* Enable spamasasssin on debian and ubuntu
 		/*
 		$configfile = '/etc/default/spamassassin';
@@ -549,40 +549,40 @@
 		wf($configfile, $content);
 		*/
 	}
-	
+
 	public function configure_getmail()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['getmail']['config_dir'];
-		
+
 		if(!is_dir($config_dir)) exec("mkdir -p ".escapeshellcmd($config_dir));
 
 		$command = "useradd -d $config_dir getmail";
 		if(!is_user('getmail')) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chown -R getmail $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chmod -R 700 $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-	
-	
+
+
 	public function configure_pureftpd()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['pureftpd']['config_dir'];
 
 		//* configure pam for SMTP authentication agains the ispconfig database
 		$configfile = 'db/mysql.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
 		if(is_file("$config_dir/$configfile~")){
-            exec("chmod 400 $config_dir/$configfile~");
-        }
+			exec("chmod 400 $config_dir/$configfile~");
+		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/pureftpd_mysql.conf.master', 'tpl/pureftpd_mysql.conf.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $content);
@@ -592,69 +592,69 @@
 		wf("$config_dir/$configfile", $content);
 		exec("chmod 600 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
-		
+
 		// copy our customized copy of pureftpd.conf to the pure-ftpd config directory
 		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_pureftpd_conf.master')) {
-            exec("cp " . $conf['ispconfig_install_dir']."/server/conf-custom/install/opensuse_pureftpd_conf.master $config_dir/pure-ftpd.conf");
-        } else {
-            exec("cp tpl/opensuse_pureftpd_conf.master $config_dir/pure-ftpd.conf");
-        }
-		
+			exec("cp " . $conf['ispconfig_install_dir']."/server/conf-custom/install/opensuse_pureftpd_conf.master $config_dir/pure-ftpd.conf");
+		} else {
+			exec("cp tpl/opensuse_pureftpd_conf.master $config_dir/pure-ftpd.conf");
+		}
+
 	}
-	
+
 	public function configure_mydns()
-    {
+	{
 		global $conf;
-		
+
 		// configure pam for SMTP authentication agains the ispconfig database
 		$configfile = 'mydns.conf';
-		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile)) copy($conf["mydns"]["config_dir"].'/'.$configfile,$conf["mydns"]["config_dir"].'/'.$configfile.'~');
+		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile)) copy($conf["mydns"]["config_dir"].'/'.$configfile, $conf["mydns"]["config_dir"].'/'.$configfile.'~');
 		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["mydns"]["config_dir"].'/'.$configfile.'~');
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf["mysql"]["host"],$content);
-		$content = str_replace('{server_id}',$conf["server_id"],$content);
-		wf($conf["mydns"]["config_dir"].'/'.$configfile,$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf["mysql"]["host"], $content);
+		$content = str_replace('{server_id}', $conf["server_id"], $content);
+		wf($conf["mydns"]["config_dir"].'/'.$configfile, $content);
 		exec('chmod 600 '.$conf["mydns"]["config_dir"].'/'.$configfile);
 		exec('chown root:root '.$conf["mydns"]["config_dir"].'/'.$configfile);
-	
+
 	}
-	
+
 	public function configure_apache()
-    {	
+	{
 		global $conf;
-		
+
 		if($conf['apache']['installed'] == false) return;
 		//* Create the logging directory for the vhost logfiles
 		exec('mkdir -p /var/log/ispconfig/httpd');
-		
+
 		//if(is_file('/etc/suphp.conf')) {
-		replaceLine('/etc/suphp.conf','php=php','x-httpd-suphp="php:/srv/www/cgi-bin/php5"',0,0);
-		replaceLine('/etc/suphp.conf','php="php','x-httpd-suphp="php:/srv/www/cgi-bin/php5"',0,0);
-		replaceLine('/etc/suphp.conf','docroot=','docroot=/srv/www',0,0);
-		replaceLine('/etc/suphp.conf','umask=0077','umask=0022',0);
+		replaceLine('/etc/suphp.conf', 'php=php', 'x-httpd-suphp="php:/srv/www/cgi-bin/php5"', 0, 0);
+		replaceLine('/etc/suphp.conf', 'php="php', 'x-httpd-suphp="php:/srv/www/cgi-bin/php5"', 0, 0);
+		replaceLine('/etc/suphp.conf', 'docroot=', 'docroot=/srv/www', 0, 0);
+		replaceLine('/etc/suphp.conf', 'umask=0077', 'umask=0022', 0);
 		//}
-		
+
 		if(!file_exists('/srv/www/cgi-bin/php5') && file_exists('/srv/www/cgi-bin/php')) {
-			symlink('/srv/www/cgi-bin/php','/srv/www/cgi-bin/php5');
+			symlink('/srv/www/cgi-bin/php', '/srv/www/cgi-bin/php5');
 		}
-		
+
 		// Sites enabled and available dirs
 		exec('mkdir -p '.$conf['apache']['vhost_conf_enabled_dir']);
 		exec('mkdir -p '.$conf['apache']['vhost_conf_dir']);
-		
+
 		$content = rf('/etc/apache2/httpd.conf');
-		if(!stristr($content,'Include /etc/apache2/sites-enabled/')) {
-			af('/etc/apache2/httpd.conf',"\n<Directory /srv/www>\n    Options FollowSymlinks\n</Directory>\n\nInclude /etc/apache2/sites-enabled/\n\n");
+		if(!stristr($content, 'Include /etc/apache2/sites-enabled/')) {
+			af('/etc/apache2/httpd.conf', "\n<Directory /srv/www>\n    Options FollowSymlinks\n</Directory>\n\nInclude /etc/apache2/sites-enabled/\n\n");
 		}
 		unset($content);
-		
+
 		//* Copy the ISPConfig configuration include
-        $vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
-        $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
-        
+		$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
+		$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
+
 		//copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
 		$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
@@ -666,7 +666,7 @@
 				} else {
 					$ip_address = $rec['ip_address'];
 				}
-				$ports = explode(',',$rec['virtualhost_port']);
+				$ports = explode(',', $rec['virtualhost_port']);
 				if(is_array($ports)) {
 					foreach($ports as $port) {
 						$port = intval($port);
@@ -677,37 +677,37 @@
 				}
 			}
 		}
-		
+
 		$content .= "\n";
-		wf($vhost_conf_dir.'/ispconfig.conf',$content);
-		
+		wf($vhost_conf_dir.'/ispconfig.conf', $content);
+
 		if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) {
 			exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf");
 		}
-		
+
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			exec('mkdir /etc/webalizer');
 			exec('ln -s /etc/webalizer.conf /etc/webalizer/webalizer.conf');
 		}
-		
+
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
 		if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		// create PHP-FPM pool dir
 		exec('mkdir -p '.$conf['nginx']['php_fpm_pool_dir']);
-		
+
 		$content = rf('/etc/php5/fpm/php-fpm.conf');
 		if(stripos($content, 'include=/etc/php5/fpm/pool.d/*.conf') === false){
-			af('/etc/php5/fpm/php-fpm.conf',"\ninclude=/etc/php5/fpm/pool.d/*.conf");
+			af('/etc/php5/fpm/php-fpm.conf', "\ninclude=/etc/php5/fpm/pool.d/*.conf");
 		}
 		unset($content);
 		if(!@is_file($conf['nginx']['php_fpm_ini_path'])){
@@ -719,34 +719,34 @@
 				exec('cp -f /etc/php5/apache2/php.ini '.$conf['nginx']['php_fpm_ini_path']);
 			}
 		}
-		
+
 	}
-	
+
 	public function configure_nginx(){
 		global $conf;
-		
+
 		if($conf['nginx']['installed'] == false) return;
 		//* Create the logging directory for the vhost logfiles
 		if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
-		
+
 		// Sites enabled and available dirs
 		exec('mkdir -p '.$conf['nginx']['vhost_conf_enabled_dir']);
 		exec('mkdir -p '.$conf['nginx']['vhost_conf_dir']);
-		
+
 		$content = rf('/etc/nginx/nginx.conf');
 		if(stripos($content, 'include /etc/nginx/sites-enabled/*.vhost;') === false){
 			$content = trim($content);
-			$content = substr($content,0,-1)."\n    include /etc/nginx/sites-enabled/*.vhost;\n}";
-			wf('/etc/nginx/nginx.conf',$content);
+			$content = substr($content, 0, -1)."\n    include /etc/nginx/sites-enabled/*.vhost;\n}";
+			wf('/etc/nginx/nginx.conf', $content);
 		}
 		unset($content);
-		
+
 		// create PHP-FPM pool dir
 		exec('mkdir -p '.$conf['nginx']['php_fpm_pool_dir']);
-		
+
 		$content = rf('/etc/php5/fpm/php-fpm.conf');
 		if(stripos($content, 'include=/etc/php5/fpm/pool.d/*.conf') === false){
-			af('/etc/php5/fpm/php-fpm.conf',"\ninclude=/etc/php5/fpm/pool.d/*.conf");
+			af('/etc/php5/fpm/php-fpm.conf', "\ninclude=/etc/php5/fpm/pool.d/*.conf");
 		}
 		unset($content);
 		if(!@is_file($conf['nginx']['php_fpm_ini_path'])){
@@ -762,95 +762,95 @@
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			mkdir('/etc/webalizer');
-			symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
+			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
 
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		// Check the awsatst script
 		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
-		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
-		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
-		
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
+		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
+
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
 		if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-	
+
 	public function configure_firewall()
 	{
 		global $conf;
-		
+
 		$dist_init_scripts = $conf['init_scripts'];
-  		
+
 		if(is_dir("/etc/Bastille.backup")) caselog("rm -rf /etc/Bastille.backup", __FILE__, __LINE__);
 		if(is_dir("/etc/Bastille")) caselog("mv -f /etc/Bastille /etc/Bastille.backup", __FILE__, __LINE__);
-  		@mkdir("/etc/Bastille", octdec($directory_mode));
-  		if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__);
-  		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
-            caselog("cp -f " . $conf['ispconfig_install_dir']."/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
-        } else {
-            caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
-        }
-  		caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
-  		$content = rf("/etc/Bastille/bastille-firewall.cfg");
-  		$content = str_replace("{DNS_SERVERS}", "", $content);
+		@mkdir("/etc/Bastille", octdec($directory_mode));
+		if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__);
+		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
+			caselog("cp -f " . $conf['ispconfig_install_dir']."/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+		} else {
+			caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+		}
+		caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+		$content = rf("/etc/Bastille/bastille-firewall.cfg");
+		$content = str_replace("{DNS_SERVERS}", "", $content);
 
-  		$tcp_public_services = '';
-  		$udp_public_services = '';
-		
+		$tcp_public_services = '';
+		$udp_public_services = '';
+
 		$row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id']));
-		
-  		if(trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != ''){
-    		$tcp_public_services = trim(str_replace(',',' ',$row["tcp_port"]));
-    		$udp_public_services = trim(str_replace(',',' ',$row["udp_port"]));
-  		} else {
-    		$tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
-    		$udp_public_services = '53';
-  		}
-		
+
+		if(trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != ''){
+			$tcp_public_services = trim(str_replace(',', ' ', $row["tcp_port"]));
+			$udp_public_services = trim(str_replace(',', ' ', $row["udp_port"]));
+		} else {
+			$tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
+			$udp_public_services = '53';
+		}
+
 		if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) {
 			$tcp_public_services .= ' '.intval($conf['apache']['vhost_port']);
 			if($row["tcp_port"] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ',".intval($conf['apache']['vhost_port'])."' WHERE server_id = ".intval($conf['server_id']));
 		}
 
-  		$content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
-  		$content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
-		
-  		wf("/etc/Bastille/bastille-firewall.cfg", $content);
+		$content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
+		$content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
 
-  		if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__);
-  		caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__);
+		wf("/etc/Bastille/bastille-firewall.cfg", $content);
 
-  		if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
-  		caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
+		if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__);
+		caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__);
 
-  		if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
-  		caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
-		
+		if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
+		caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
+
+		if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
+		caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
+
 		if(!@is_dir('/var/lock/subsys')) caselog("mkdir /var/lock/subsys", __FILE__, __LINE__);
 
-  		exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
-  		if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
-  		unset($ipchains_location);
-  		exec("which iptables &> /dev/null", $iptables_location, $ret_val);
-  		if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
-  		unset($iptables_location);
+		exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
+		if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
+		unset($ipchains_location);
+		exec("which iptables &> /dev/null", $iptables_location, $ret_val);
+		if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
+		unset($iptables_location);
 
 	}
 
 	public function install_ispconfig()
-    {
+	{
 		global $conf;
-		
+
 		$install_dir = $conf['ispconfig_install_dir'];
 
 		//* Create the ISPConfig installation directory
@@ -858,93 +858,93 @@
 			$command = "mkdir $install_dir";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Create a ISPConfig user and group
 		$command = 'groupadd ispconfig';
 		if(!is_group('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "useradd -g ispconfig -d $install_dir ispconfig";
 		if(!is_user('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig interface part
 		$command = "cp -rf ../interface $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig server part
 		$command = "cp -rf ../server $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Create a symlink, so ISPConfig is accessible via web
 		// Replaced by a separate vhost definition for port 8080
 		// $command = "ln -s $install_dir/interface/web/ /var/www/ispconfig";
 		// caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Create the config file for ISPConfig interface
 		$configfile = 'config.inc.php';
 		if(is_file($install_dir.'/interface/lib/'.$configfile)){
-            copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
-        }
-		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
-		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
-		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
-		
-		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
-		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
-		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
-		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
-		$content = str_replace('{server_id}', $conf['server_id'], $content);
-		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
-		$content = str_replace('{language}', $conf['language'], $content);
-		$content = str_replace('{timezone}', $conf['timezone'], $content);
-		$content = str_replace('{theme}', $conf['theme'], $content);
-		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
-		
-		wf("$install_dir/interface/lib/$configfile", $content);
-		
-		//* Create the config file for ISPConfig server
-		$configfile = 'config.inc.php';
-		if(is_file($install_dir.'/server/lib/'.$configfile)){
-            copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
-        }
+			copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
+		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
 		$content = str_replace('{timezone}', $conf['timezone'], $content);
 		$content = str_replace('{theme}', $conf['theme'], $content);
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
-		
+
+		wf("$install_dir/interface/lib/$configfile", $content);
+
+		//* Create the config file for ISPConfig server
+		$configfile = 'config.inc.php';
+		if(is_file($install_dir.'/server/lib/'.$configfile)){
+			copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
+		}
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
+
+		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
+		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
+		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
+		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
+
+		$content = str_replace('{server_id}', $conf['server_id'], $content);
+		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
+		$content = str_replace('{language}', $conf['language'], $content);
+		$content = str_replace('{timezone}', $conf['timezone'], $content);
+		$content = str_replace('{theme}', $conf['theme'], $content);
+		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
+
 		wf("$install_dir/server/lib/$configfile", $content);
-		
+
 		//* Create the config file for remote-actions (but only, if it does not exist, because
 		//  the value is a autoinc-value and so changed by the remoteaction_core_module
 		if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) {
 			$content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
 			wf($install_dir.'/server/lib/remote_action.inc.php', $content);
 		}
-		
+
 		//* Enable the server modules and plugins.
 		// TODO: Implement a selector which modules and plugins shall be enabled.
 		$dir = $install_dir.'/server/mods-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/mods-available/'.$file);
-						$module_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/mods-available/'.$file;
+						$module_name = substr($file, 0, -8);
 						$tmp = new $module_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-enabled/'.$file);
@@ -958,16 +958,16 @@
 				closedir($dh);
 			}
 		}
-		
+
 		$dir = $install_dir.'/server/plugins-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
 					if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
 					if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/plugins-available/'.$file);
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/plugins-available/'.$file;
+						$plugin_name = substr($file, 0, -8);
 						$tmp = new $plugin_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file);
@@ -981,7 +981,7 @@
 				closedir($dh);
 			}
 		}
-		
+
 		// Update the server config
 		$mail_server_enabled = ($conf['services']['mail'])?1:0;
 		$web_server_enabled = ($conf['services']['web'])?1:0;
@@ -990,14 +990,14 @@
 		$db_server_enabled = ($conf['services']['db'])?1:0;
 		$vserver_server_enabled = ($conf['services']['vserver'])?1:0;
 		$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']);
-		
+
 		if($conf['mysql']['master_slave_setup'] == 'y') {
 			$this->dbmaster->query($sql);
 			$this->db->query($sql);
 		} else {
 			$this->db->query($sql);
 		}
-		
+
 		//* Chmod the files
 		$command = "chmod -R 750 $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -1005,48 +1005,48 @@
 		//* chown the files to the ispconfig user and group
 		$command = "chown -R ispconfig:ispconfig $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Make the global language file directory group writable
 		exec("chmod -R 770 $install_dir/interface/lib/lang");
-		
+
 		//* Make the temp directory for language file exports writable
 		exec("chmod -R 770 $install_dir/interface/web/temp");
-		
+
 		//* Make all interface language file directories group writable
 		$handle = @opendir($install_dir.'/interface/web');
-		while ($file = @readdir ($handle)) { 
-	   		if ($file != '.' && $file != '..') {
-	        	if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
+		while ($file = @readdir($handle)) {
+			if ($file != '.' && $file != '..') {
+				if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
 					$handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang');
-					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770);
-					while ($lang_file = @readdir ($handle2)) {
+					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770);
+					while ($lang_file = @readdir($handle2)) {
 						if ($lang_file != '.' && $lang_file != '..') {
-							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770);
+							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770);
 						}
 					}
 				}
 			}
 		}
-		
+
 		//* Make the APS directories group writable
 		exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
 		exec("chmod -R 770 $install_dir/server/aps_packages");
-		
+
 		//* make sure that the server config file (not the interface one) is only readable by the root user
 		chmod($install_dir.'/server/lib/config.inc.php', 0600);
 		chown($install_dir.'/server/lib/config.inc.php', 'root');
 		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
-		
+
 		//* Make sure thet the interface config file is readable by user ispconfig only
 		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
 		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
 		chgrp($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
-		
+
 		if(@is_file("$install_dir/server/lib/mysql_clientdb.conf")) {
 			exec("chmod 600 $install_dir/server/lib/mysql_clientdb.conf");
 			exec("chown root:root $install_dir/server/lib/mysql_clientdb.conf");
 		}
-		
+
 		// TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing
 		// and must be fixed as this will allow the apache user to read the ispconfig files.
 		// Later this must run as own apache server or via suexec!
@@ -1066,31 +1066,31 @@
 				caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
 		}
-		
+
 		//* Make the shell scripts executable
 		$command = "chmod +x $install_dir/server/scripts/*.sh";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
-		
+
+
 		if($conf['apache']['installed'] == true && $this->install_ispconfig_interface == true){
 			//* Copy the ISPConfig vhost for the controlpanel
 			// TODO: These are missing! should they be "vhost_dist_*_dir" ?
 			$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
-        
-        
+
+
 			// Dont just copy over the virtualhost template but add some custom settings
-         
+
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
 			$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
-		
+
 			// comment out the listen directive if port is 80 or 443
 			if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-		
+
 			if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_comment}', '', $content);
 			} else {
@@ -1101,23 +1101,23 @@
 			} else {
 				$content = str_replace('{ssl_bundle_comment}', '#', $content);
 			}
-		
+
 			$content = str_replace('/var/www/', '/srv/www/', $content);
-		
+
 			wf("$vhost_conf_dir/ispconfig.vhost", $content);
-		
+
 			//if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
-				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
-				$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
-				exec('mkdir -p /srv/www/php-fcgi-scripts/ispconfig');
-				wf('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
-				exec('chmod +x /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
-				exec('ln -s /usr/local/ispconfig/interface/web /srv/www/ispconfig');
-				exec('chown -R ispconfig:ispconfig /srv/www/php-fcgi-scripts/ispconfig');
-			
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
+			$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
+			$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
+			exec('mkdir -p /srv/www/php-fcgi-scripts/ispconfig');
+			wf('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
+			exec('chmod +x /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
+			exec('ln -s /usr/local/ispconfig/interface/web /srv/www/ispconfig');
+			exec('chown -R ispconfig:ispconfig /srv/www/php-fcgi-scripts/ispconfig');
+
 			//}
-		
+
 			//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
 			//* and create the symlink
 			if($this->is_update == false) {
@@ -1125,11 +1125,11 @@
 				if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
 					exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
 				}
-			
+
 			}
-		
+
 			// Fix a setting in vhost master file for suse
-			replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master',"suPHP_UserGroup","        suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>",0);
+			replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master', "suPHP_UserGroup", "        suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>", 0);
 		}
 
 		if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){
@@ -1140,7 +1140,7 @@
 			// Dont just copy over the virtualhost template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master');
 			$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
-		
+
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_on}', ' on', $content);
 				$content = str_replace('{ssl_comment}', '', $content);
@@ -1150,19 +1150,19 @@
 				$content = str_replace('{ssl_comment}', '#', $content);
 				$content = str_replace('{fastcgi_ssl}', 'off', $content);
 			}
-			
+
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'ispconfig.sock';
-			
+
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 
 			wf($vhost_conf_dir.'/ispconfig.vhost', $content);
-			
+
 			unset($content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
@@ -1178,20 +1178,20 @@
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
-			
+
 			// create symlinks from /usr/share to phpMyAdmin and SquirrelMail, if they are installed
-			if(!@file_exists('/usr/share/phpmyadmin') && @is_dir('/srv/www/htdocs/phpMyAdmin')) symlink('/srv/www/htdocs/phpMyAdmin/','/usr/share/phpmyadmin');
-			if(!@file_exists('/usr/share/squirrelmail') && @is_dir('/srv/www/htdocs/squirrelmail')) symlink('/srv/www/htdocs/squirrelmail/','/usr/share/squirrelmail');
+			if(!@file_exists('/usr/share/phpmyadmin') && @is_dir('/srv/www/htdocs/phpMyAdmin')) symlink('/srv/www/htdocs/phpMyAdmin/', '/usr/share/phpmyadmin');
+			if(!@file_exists('/usr/share/squirrelmail') && @is_dir('/srv/www/htdocs/squirrelmail')) symlink('/srv/www/htdocs/squirrelmail/', '/usr/share/squirrelmail');
 		}
-		
-		
+
+
 		// Make the Clamav log files readable by ISPConfig
 		//exec('chmod +r /var/log/clamav/clamav.log');
 		//exec('chmod +r /var/log/clamav/freshclam.log');
-		
+
 		//* Install the update script
 		if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
 		exec('chown root /usr/local/ispconfig/server/scripts/update_from_svn.sh');
@@ -1202,96 +1202,96 @@
 		exec('chmod 700 /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
 		if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_svn.sh');
 		if(!is_link('/usr/local/bin/ispconfig_update.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update.sh');
-		
+
 		//set the fast cgi starter script to executable
 		//exec('chmod 755 '.$install_dir.'/interface/bin/php-fcgi');
-		
+
 		//* Make the logs readable for the ispconfig user
 		if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log');
 		if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn');
 		if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err');
 		if(@is_file('/var/log/messages')) exec('chmod +r /var/log/messages');
-		
+
 		//To enable apache to read the directories
 		exec('chmod a+rx /usr/local/ispconfig');
 		exec('chmod -R 751 /usr/local/ispconfig/interface');
 		exec('chmod a+rx /usr/local/ispconfig/interface/web');
-		
+
 		//* Create the ispconfig log directory
 		if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir']);
 		if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
-		
+
 		if(is_user('getmail')) {
 			exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
 			exec('chown getmail /usr/local/bin/run-getmail.sh');
 			exec('chmod 744 /usr/local/bin/run-getmail.sh');
 		}
-		
+
 		if(is_dir($install_dir.'/interface/invoices')) {
 			exec('chmod -R 770 '.escapeshellarg($install_dir.'/interface/invoices'));
 			exec('chown -R ispconfig:ispconfig '.escapeshellarg($install_dir.'/interface/invoices'));
 		}
-		
+
 		//* Create the ispconfig auth log file and set uid/gid
 		if(!is_file($conf['ispconfig_log_dir'].'/auth.log')) {
 			touch($conf['ispconfig_log_dir'].'/auth.log');
 		}
 		exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log');
 		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
-		
+
 		//* Remove Domain module as its functions are available in the client module now
 		if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
-		
-		
+
+
 	}
-	
+
 	public function configure_dbserver()
 	{
 		global $conf;
-		
+
 		//* If this server shall act as database server for client DB's, we configure this here
 		$install_dir = $conf['ispconfig_install_dir'];
-		
-		// Create a file with the database login details which 
+
+		// Create a file with the database login details which
 		// are used to create the client databases.
-		
+
 		if(!is_dir("$install_dir/server/lib")) {
 			$command = "mkdir $install_dir/server/lib";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', "tpl/mysql_clientdb.conf.master");
-		$content = str_replace('{hostname}',$conf['mysql']['host'],$content);
-		$content = str_replace('{username}',$conf['mysql']['admin_user'],$content);
-		$content = str_replace('{password}',$conf['mysql']['admin_password'], $content);
-		wf("$install_dir/server/lib/mysql_clientdb.conf",$content);
+		$content = str_replace('{hostname}', $conf['mysql']['host'], $content);
+		$content = str_replace('{username}', $conf['mysql']['admin_user'], $content);
+		$content = str_replace('{password}', $conf['mysql']['admin_password'], $content);
+		wf("$install_dir/server/lib/mysql_clientdb.conf", $content);
 		exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf");
 		exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf");
-		
+
 	}
-	
+
 	public function install_crontab()
-    {		
+	{
 		global $conf;
-		
+
 		//* Root Crontab
 		exec('crontab -u root -l > crontab.txt');
 		$existing_root_cron_jobs = file('crontab.txt');
-		
+
 		// remove existing ispconfig cronjobs, in case the syntax has changed
 		foreach($existing_root_cron_jobs as $key => $val) {
-			if(stristr($val,'/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
+			if(stristr($val, '/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
 		}
-		
+
 		$root_cron_jobs = array(
 			'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
 			'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
 		);
-		
+
 		if ($conf['nginx']['installed'] == true) {
 			$root_cron_jobs[] = "0 0 * * * /usr/local/ispconfig/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null";
 		}
-		
+
 		foreach($root_cron_jobs as $cron_job) {
 			if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
 				$existing_root_cron_jobs[] = $cron_job."\n";
@@ -1300,22 +1300,22 @@
 		file_put_contents('crontab.txt', $existing_root_cron_jobs);
 		exec('crontab -u root crontab.txt &> /dev/null');
 		unlink('crontab.txt');
-		
+
 		//* Getmail crontab
 		if(is_user('getmail')) {
-        	$cf = $conf['getmail'];
+			$cf = $conf['getmail'];
 			exec('crontab -u getmail -l > crontab.txt');
 			$existing_cron_jobs = file('crontab.txt');
-		
+
 			$cron_jobs = array(
-                '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
-            );
-		
+				'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
+			);
+
 			// remove existing ispconfig cronjobs, in case the syntax has changed
 			foreach($existing_cron_jobs as $key => $val) {
-				if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]);
+				if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]);
 			}
-		
+
 			foreach($cron_jobs as $cron_job) {
 				if(!in_array($cron_job."\n", $existing_cron_jobs)) {
 					$existing_cron_jobs[] = $cron_job."\n";
@@ -1325,7 +1325,7 @@
 			exec('crontab -u getmail crontab.txt &> /dev/null');
 			unlink('crontab.txt');
 		}
-		
+
 		exec('touch /var/log/ispconfig/cron.log');
 		exec('chmod 660 /var/log/ispconfig/cron.log');
 	}
diff --git a/install/dist/lib/opensuse110.lib.php b/install/dist/lib/opensuse110.lib.php
index da77b42..aeda9b9 100644
--- a/install/dist/lib/opensuse110.lib.php
+++ b/install/dist/lib/opensuse110.lib.php
@@ -33,4 +33,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/opensuse112.lib.php b/install/dist/lib/opensuse112.lib.php
index da77b42..aeda9b9 100644
--- a/install/dist/lib/opensuse112.lib.php
+++ b/install/dist/lib/opensuse112.lib.php
@@ -33,4 +33,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/install.php b/install/install.php
index be3e37d..e2d569e 100644
--- a/install/install.php
+++ b/install/install.php
@@ -37,7 +37,7 @@
 define('INSTALLER_RUN', true);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -46,14 +46,14 @@
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Initial configuration  \n\n";
 
 //** Include the library with the basic installer functions
-require_once('lib/install.lib.php');
+require_once 'lib/install.lib.php';
 
 //** Include the base class of the installer class
-require_once('lib/installer_base.lib.php');
+require_once 'lib/installer_base.lib.php';
 
 //** Ensure that current working directory is install directory
 $cur_dir = getcwd();
@@ -76,12 +76,12 @@
 if($dist['id'] == '') die('Linux distribution or version not recognized.');
 
 //** Include the distribution-specific installer class library and configuration
-if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
-include_once('dist/lib/'.$dist['id'].'.lib.php');
-include_once('dist/conf/'.$dist['id'].'.conf.php');
+if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
+include_once 'dist/lib/'.$dist['id'].'.lib.php';
+include_once 'dist/conf/'.$dist['id'].'.conf.php';
 
 //****************************************************************************************************
-//** Installer Interface 
+//** Installer Interface
 //****************************************************************************************************
 $inst = new installer();
 swriteln($inst->lng('    Following will be a few questions for primary configuration so be careful.'));
@@ -90,7 +90,7 @@
 
 //** Check log file is writable (probably not root or sudo)
 if(!is_writable(dirname(ISPC_LOG_FILE))){
-    die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n");
+	die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n");
 }
 
 if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) {
@@ -105,7 +105,7 @@
 $inst->find_installed_apps();
 
 //** Select the language and set default timezone
-$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en');
+$conf['language'] = $inst->simple_query('Select language', array('en', 'de'), 'en');
 $conf['timezone'] = get_system_timezone();
 
 //* Set default theme
@@ -113,7 +113,7 @@
 $conf['language_file_import_enabled'] = true;
 
 //** Select installation mode
-$install_mode = $inst->simple_query('Installation mode', array('standard','expert'), 'standard');
+$install_mode = $inst->simple_query('Installation mode', array('standard', 'expert'), 'standard');
 
 
 //** Get the hostname
@@ -133,13 +133,13 @@
 	$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']);
 	$tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database']);
 	$tmp_mysql_server_charset = $inst->free_query('MySQL charset', $conf['mysql']['charset']);
-	
+
 	if($install_mode == 'expert') {
 		swriteln("The next two questions are about the internal ISPConfig database user and password.\nIt is recommended to accept the defaults which are 'ispconfig' as username and a random password.\nIf you use a different password, use only numbers and chars for the password.\n");
 		$conf['mysql']['ispconfig_user'] = $inst->free_query('ISPConfig mysql database username', $conf['mysql']['ispconfig_user']);
 		$conf['mysql']['ispconfig_password'] = $inst->free_query('ISPConfig mysql database password', $conf['mysql']['ispconfig_password']);
 	}
-	
+
 	//* Initialize the MySQL server connection
 	if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
 		$conf['mysql']['host'] = $tmp_mysql_server_host;
@@ -155,44 +155,44 @@
 unset($finished);
 
 // Resolve the IP address of the MySQL hostname.
-$tmp = explode(':',$conf['mysql']['host']);
+$tmp = explode(':', $conf['mysql']['host']);
 if(!$conf['mysql']['ip'] = gethostbyname($tmp[0])) die('Unable to resolve hostname'.$tmp[0]);
 unset($tmp);
 
 
 //** Initializing database connection
-include_once('lib/mysql.lib.php');
+include_once 'lib/mysql.lib.php';
 $inst->db = new db();
 
 //** Begin with standard or expert installation
 if($install_mode == 'standard') {
-	
+
 	//* Create the MySQL database
 	$inst->configure_database();
-	
+
 	//* Configure Webserver - Apache or nginx
 	if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) {
-		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache','nginx'), 'apache');
+		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache');
 		if($http_server_to_use == 'apache'){
 			$conf['nginx']['installed'] = false;
 		} else {
 			$conf['apache']['installed'] = false;
 		}
 	}
-	
+
 	//* Insert the Server record into the database
 	$inst->add_database_server_record();
 
 	//* Configure Postfix
 	$inst->configure_postfix();
-	
+
 	//* Configure Mailman
 	$inst->configure_mailman('install');
-	
+
 	//* Configure jailkit
 	swriteln('Configuring Jailkit');
 	$inst->configure_jailkit();
-	
+
 	if($conf['dovecot']['installed'] == true) {
 		//* Configure Dovecot
 		swriteln('Configuring Dovecot');
@@ -205,7 +205,7 @@
 		//* Configure PAM
 		swriteln('Configuring PAM');
 		$inst->configure_pam();
-		
+
 		//* Configure Courier
 		swriteln('Configuring Courier');
 		$inst->configure_courier();
@@ -222,7 +222,7 @@
 	//* Configure Getmail
 	swriteln('Configuring Getmail');
 	$inst->configure_getmail();
-	
+
 	//* Configure Pureftpd
 	swriteln('Configuring Pureftpd');
 	$inst->configure_pureftpd();
@@ -238,39 +238,39 @@
 		swriteln('Configuring MyDNS');
 		$inst->configure_mydns();
 	}
-	
+
 	//* Configure Apache
 	if($conf['apache']['installed'] == true){
 		swriteln('Configuring Apache');
 		$inst->configure_apache();
 	}
-	
+
 	//* Configure nginx
 	if($conf['nginx']['installed'] == true){
 		swriteln('Configuring nginx');
 		$inst->configure_nginx();
 	}
-	
-    //** Configure Vlogger
-    swriteln('Configuring Vlogger');
-    $inst->configure_vlogger();
-	
+
+	//** Configure Vlogger
+	swriteln('Configuring Vlogger');
+	$inst->configure_vlogger();
+
 	//** Configure apps vhost
 	swriteln('Configuring Apps vhost');
 	$inst->configure_apps_vhost();
-    
+
 	//* Configure Firewall
 	//* Configure Bastille Firewall
 	$conf['services']['firewall'] = true;
 	swriteln('Configuring Bastille Firewall');
 	$inst->configure_firewall();
 
-    //* Configure Fail2ban
-    if($conf['fail2ban']['installed'] == true) {
-        swriteln('Configuring Fail2ban');
-        $inst->configure_fail2ban();
-    }
-	
+	//* Configure Fail2ban
+	if($conf['fail2ban']['installed'] == true) {
+		swriteln('Configuring Fail2ban');
+		$inst->configure_fail2ban();
+	}
+
 	/*
 	if($conf['squid']['installed'] == true) {
 		$conf['services']['proxy'] = true;
@@ -282,22 +282,22 @@
 		$inst->configure_nginx();
 	}
 	*/
-	
+
 	//* Configure ISPConfig
 	swriteln('Installing ISPConfig');
-	
+
 	//** Customize the port ISPConfig runs on
 	$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080');
 	if($conf['apache']['installed'] == true) $conf['apache']['vhost_port']  = $ispconfig_vhost_port;
 	if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port']  = $ispconfig_vhost_port;
 	unset($ispconfig_vhost_port);
 
-	if(strtolower($inst->simple_query('Do you want a secure (SSL) connection to the ISPConfig web interface',array('y','n'),'y')) == 'y') {
-	  $inst->make_ispconfig_ssl_cert();
+	if(strtolower($inst->simple_query('Do you want a secure (SSL) connection to the ISPConfig web interface', array('y', 'n'), 'y')) == 'y') {
+		$inst->make_ispconfig_ssl_cert();
 	}
 
 	$inst->install_ispconfig();
-	
+
 	//* Configure DBServer
 	swriteln('Configuring DBServer');
 	$inst->configure_dbserver();
@@ -305,7 +305,7 @@
 	//* Configure ISPConfig
 	swriteln('Installing ISPConfig crontab');
 	$inst->install_crontab();
-	
+
 	swriteln('Restarting services ...');
 	if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart'));
 	if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
@@ -331,11 +331,11 @@
 	if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null');
 	if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null');
 	if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null');
-	//if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script']))					system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
+	//if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script']))     system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
 	if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');
-	//if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['ufw']['init_script']))					system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
+	//if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['ufw']['init_script']))     system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
 } else {
-	
+
 	//* In expert mode, we select the services in the following steps, only db is always available
 	$conf['services']['mail'] = false;
 	$conf['services']['web'] = false;
@@ -343,23 +343,23 @@
 	$conf['services']['db'] = true;
 	$conf['services']['firewall'] = false;
 	$conf['services']['proxy'] = false;
-	
-	
+
+
 	//** Get Server ID
 	// $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1');
 	// Server ID is an autoInc value of the mysql database now
-	
-	if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup',array('y','n'),'n')) == 'y') {
+
+	if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup', array('y', 'n'), 'n')) == 'y') {
 		$conf['mysql']['master_slave_setup'] = 'y';
-		
+
 		//** Get MySQL root credentials
 		$finished = false;
 		do {
 			$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']);
 			$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']);
 			$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']);
-    		$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']);
-	
+			$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']);
+
 			//* Initialize the MySQL server connection
 			if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
 				$conf['mysql']['master_host'] = $tmp_mysql_server_host;
@@ -372,7 +372,7 @@
 			}
 		} while ($finished == false);
 		unset($finished);
-		
+
 		// initialize the connection to the master database
 		$inst->dbmaster = new db();
 		if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
@@ -380,39 +380,39 @@
 		$inst->dbmaster->dbName = $conf['mysql']["master_database"];
 		$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
 		$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
-		
+
 	} else {
 		// the master DB is the same then the slave DB
 		$inst->dbmaster = $inst->db;
 	}
-	
+
 	//* Create the mysql database
 	$inst->configure_database();
-	
+
 	//* Configure Webserver - Apache or nginx
 	if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) {
-		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache','nginx'), 'apache');
+		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache');
 		if($http_server_to_use == 'apache'){
 			$conf['nginx']['installed'] = false;
 		} else {
 			$conf['apache']['installed'] = false;
 		}
 	}
-		
+
 	//* Insert the Server record into the database
 	swriteln('Adding ISPConfig server record to database.');
 	swriteln('');
 	$inst->add_database_server_record();
 
-	
-	if(strtolower($inst->simple_query('Configure Mail', array('y','n') ,'y') ) == 'y') {
-		
+
+	if(strtolower($inst->simple_query('Configure Mail', array('y', 'n') , 'y') ) == 'y') {
+
 		$conf['services']['mail'] = true;
-		
+
 		//* Configure Postfix
 		swriteln('Configuring Postfix');
 		$inst->configure_postfix();
-		
+
 		//* Configure Mailman
 		swriteln('Configuring Mailman');
 		$inst->configure_mailman();
@@ -422,15 +422,15 @@
 			swriteln('Configuring Dovecot');
 			$inst->configure_dovecot();
 		} else {
-		
+
 			//* Configure saslauthd
 			swriteln('Configuring SASL');
 			$inst->configure_saslauthd();
-		
+
 			//* Configure PAM
 			swriteln('Configuring PAM');
 			$inst->configure_pam();
-			
+
 			//* Configure courier
 			swriteln('Configuring Courier');
 			$inst->configure_courier();
@@ -447,7 +447,7 @@
 		//* Configure Getmail
 		swriteln('Configuring Getmail');
 		$inst->configure_getmail();
-		
+
 		if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
 		if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart'));
 		if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart'));
@@ -462,22 +462,22 @@
 		if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart'));
 		if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &');
 	}
-	
+
 	//** Configure Jailkit
-	if(strtolower($inst->simple_query('Configure Jailkit', array('y','n'),'y') ) == 'y') {	
+	if(strtolower($inst->simple_query('Configure Jailkit', array('y', 'n'), 'y') ) == 'y') {
 		swriteln('Configuring Jailkit');
 		$inst->configure_jailkit();
 	}
-	
+
 	//** Configure Pureftpd
-	if(strtolower($inst->simple_query('Configure FTP Server', array('y','n'),'y') ) == 'y') {	
+	if(strtolower($inst->simple_query('Configure FTP Server', array('y', 'n'), 'y') ) == 'y') {
 		swriteln('Configuring Pureftpd');
 		$inst->configure_pureftpd();
 		if($conf['pureftpd']['installed'] == true && $conf['pureftpd']['init_script'] != '') system($inst->getinitcommand($conf['pureftpd']['init_script'], 'restart'));
 	}
-	
+
 	//** Configure DNS
-	if(strtolower($inst->simple_query('Configure DNS Server',array('y','n'),'y')) == 'y') {
+	if(strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y')) == 'y') {
 		$conf['services']['dns'] = true;
 		//* Configure DNS
 		if($conf['powerdns']['installed'] == true) {
@@ -493,12 +493,12 @@
 			$inst->configure_mydns();
 			if($conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null');
 		}
-		
+
 	}
-	
+
 	/*
 	//** Configure Squid
-	if(strtolower($inst->simple_query('Configure Proxy Server', array('y','n'),'y') ) == 'y') {	
+	if(strtolower($inst->simple_query('Configure Proxy Server', array('y','n'),'y') ) == 'y') {
 		if($conf['squid']['installed'] == true) {
 			$conf['services']['proxy'] = true;
 			swriteln('Configuring Squid');
@@ -512,50 +512,50 @@
 		}
 	}
 	*/
-	
+
 	//** Configure Apache
 	if($conf['apache']['installed'] == true){
 		swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure Apache Server' option.\n");
-		if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {	
+		if(strtolower($inst->simple_query('Configure Apache Server', array('y', 'n'), 'y')) == 'y') {
 			$conf['services']['web'] = true;
 			swriteln('Configuring Apache');
 			$inst->configure_apache();
-       
+
 			//** Configure Vlogger
 			swriteln('Configuring Vlogger');
 			$inst->configure_vlogger();
-	
+
 			//** Configure apps vhost
 			swriteln('Configuring Apps vhost');
 			$inst->configure_apps_vhost();
 		}
 	}
-	
+
 	//** Configure nginx
 	if($conf['nginx']['installed'] == true){
 		swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure nginx Server' option.\n");
-		if(strtolower($inst->simple_query('Configure nginx Server',array('y','n'),'y')) == 'y') {	
+		if(strtolower($inst->simple_query('Configure nginx Server', array('y', 'n'), 'y')) == 'y') {
 			$conf['services']['web'] = true;
 			swriteln('Configuring nginx');
 			$inst->configure_nginx();
-       
+
 			//** Configure Vlogger
 			//swriteln('Configuring Vlogger');
 			//$inst->configure_vlogger();
-	
+
 			//** Configure apps vhost
 			swriteln('Configuring Apps vhost');
 			$inst->configure_apps_vhost();
 		}
 	}
-	
+
 	//** Configure Firewall
-	if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') {	
+	if(strtolower($inst->simple_query('Configure Firewall Server', array('y', 'n'), 'y')) == 'y') {
 		//if($conf['bastille']['installed'] == true) {
-			//* Configure Bastille Firewall
-			$conf['services']['firewall'] = true;
-			swriteln('Configuring Bastille Firewall');
-			$inst->configure_firewall();
+		//* Configure Bastille Firewall
+		$conf['services']['firewall'] = true;
+		swriteln('Configuring Bastille Firewall');
+		$inst->configure_firewall();
 		/*} elseif($conf['ufw']['installed'] == true) {
 			//* Configure Ubuntu Firewall
 			$conf['services']['firewall'] = true;
@@ -564,18 +564,18 @@
 		}
 		*/
 	}
-	
+
 	//** Configure Firewall
-	/*if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') {	
+	/*if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') {
 		swriteln('Configuring Firewall');
 		$inst->configure_firewall();
 	}*/
-	
+
 	//** Configure ISPConfig :-)
 	$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
-	if(strtolower($inst->simple_query('Install ISPConfig Web Interface',array('y','n'),$install_ispconfig_interface_default)) == 'y') {
+	if(strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default)) == 'y') {
 		swriteln('Installing ISPConfig');
-		
+
 		//** We want to check if the server is a module or cgi based php enabled server
 		//** TODO: Don't always ask for this somehow ?
 		/*
@@ -595,23 +595,23 @@
 		if($conf['apache']['installed'] == true) $conf['apache']['vhost_port']  = $ispconfig_vhost_port;
 		if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port']  = $ispconfig_vhost_port;
 		unset($ispconfig_vhost_port);
-		
-		if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface',array('y','n'),'y')) == 'y') {
+
+		if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface', array('y', 'n'), 'y')) == 'y') {
 			$inst->make_ispconfig_ssl_cert();
 		}
-		
+
 		$inst->install_ispconfig_interface = true;
-			
+
 	} else {
 		$inst->install_ispconfig_interface = false;
 	}
-	
+
 	$inst->install_ispconfig();
-	
+
 	//* Configure DBServer
 	swriteln('Configuring DBServer');
 	$inst->configure_dbserver();
-		
+
 	//* Configure ISPConfig
 	swriteln('Installing ISPConfig crontab');
 	$inst->install_crontab();
@@ -621,13 +621,13 @@
 		if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload'));
 		if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload'));
 	}
-	
-	
-	
+
+
+
 } //* << $install_mode / 'Standard' or Genius
 
 
 echo "Installation completed.\n";
 
 
-?>
\ No newline at end of file
+?>
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 9c61759..30ba04e 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -79,66 +79,66 @@
 			$distname = 'Ubuntu';
 			$distid = 'debian40';
 			$distbaseid = 'debian';
-			$ver = explode(' ',$issue);
+			$ver = explode(' ', $issue);
 			$ver = array_filter($ver);
 			$ver = next($ver);
-			$mainver = explode('.',$ver);
+			$mainver = explode('.', $ver);
 			$mainver = array_filter($mainver);
 			$mainver = current($mainver).'.'.next($mainver);
 			switch ($mainver){
-				case "12.10":
-					$relname = "(Quantal Quetzal)";
+			case "12.10":
+				$relname = "(Quantal Quetzal)";
 				break;
-				case "12.04":
-					$relname = "(Precise Pangolin)";
+			case "12.04":
+				$relname = "(Precise Pangolin)";
 				break;
-				case "11.10":
-					$relname = "(Oneiric Ocelot)";
+			case "11.10":
+				$relname = "(Oneiric Ocelot)";
 				break;
-				case "11.14":
-					$relname = "(Natty Narwhal)";
+			case "11.14":
+				$relname = "(Natty Narwhal)";
 				break;
-				case "10.10":
-					$relname = "(Maverick Meerkat)";
+			case "10.10":
+				$relname = "(Maverick Meerkat)";
 				break;
-				case "10.04":
-					$relname = "(Lucid Lynx)";
+			case "10.04":
+				$relname = "(Lucid Lynx)";
 				break;
-				case "9.10":
-					$relname = "(Karmic Koala)";
+			case "9.10":
+				$relname = "(Karmic Koala)";
 				break;
-				case "9.04":
-					$relname = "(Jaunty Jackpole)";
+			case "9.04":
+				$relname = "(Jaunty Jackpole)";
 				break;
-				case "8.10":
+			case "8.10":
 				$relname = "(Intrepid Ibex)";
 				break;
-				case "8.04":
-					$relname = "(Hardy Heron)";
+			case "8.04":
+				$relname = "(Hardy Heron)";
 				break;
-				case "7.10":
-					$relname = "(Gutsy Gibbon)";
+			case "7.10":
+				$relname = "(Gutsy Gibbon)";
 				break;
-				case "7.04":
-					$relname = "(Feisty Fawn)";
+			case "7.04":
+				$relname = "(Feisty Fawn)";
 				break;
-				case "6.10":
-					$relname = "(Edgy Eft)";
+			case "6.10":
+				$relname = "(Edgy Eft)";
 				break;
-				case "6.06":
-					$relname = "(Dapper Drake)";
+			case "6.06":
+				$relname = "(Dapper Drake)";
 				break;
-				case "5.10":
-					$relname = "(Breezy Badger)";
+			case "5.10":
+				$relname = "(Breezy Badger)";
 				break;
-				case "5.04":
-					$relname = "(Hoary Hedgehog)";
+			case "5.04":
+				$relname = "(Hoary Hedgehog)";
 				break;
-				case "4.10":
-					$relname = "(Warty Warthog)";
+			case "4.10":
+				$relname = "(Warty Warthog)";
 				break;
-				default:
-					$relname = "UNKNOWN";
+			default:
+				$relname = "UNKNOWN";
 			}
 			$distver = $ver.$lts." ".$relname;
 			swriteln("Operating System: ".$distver."\n");
@@ -148,19 +148,19 @@
 			$distid = 'debian40';
 			$distbaseid = 'debian';
 			swriteln("Operating System: Debian 4.0 or compatible\n");
-		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'5.0')) {
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '5.0')) {
 			$distname = 'Debian';
 			$distver = 'Lenny';
 			$distid = 'debian40';
 			$distbaseid = 'debian';
 			swriteln("Operating System: Debian Lenny or compatible\n");
-		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') {
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') {
 			$distname = 'Debian';
 			$distver = 'Squeeze/Sid';
 			$distid = 'debian60';
 			$distbaseid = 'debian';
 			swriteln("Operating System: Debian 6.0 (Squeeze/Sid) or compatible\n");
-		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'7.0') || strstr(trim(file_get_contents('/etc/debian_version')),'7.1') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || strstr(trim(file_get_contents('/etc/debian_version')), '7.1') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
 			$distname = 'Debian';
 			$distver = 'Wheezy/Sid';
 			$distid = 'debian60';
@@ -177,19 +177,19 @@
 
 	//** OpenSuSE
 	elseif(file_exists('/etc/SuSE-release')) {
-		if(stristr(file_get_contents('/etc/SuSE-release'),'11.0')) {
+		if(stristr(file_get_contents('/etc/SuSE-release'), '11.0')) {
 			$distname = 'openSUSE';
 			$distver = '11.0';
 			$distid = 'opensuse110';
 			$distbaseid = 'opensuse';
 			swriteln("Operating System: openSUSE 11.0 or compatible\n");
-		} elseif(stristr(file_get_contents('/etc/SuSE-release'),'11.1')) {
+		} elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.1')) {
 			$distname = 'openSUSE';
 			$distver = '11.1';
 			$distid = 'opensuse110';
 			$distbaseid = 'opensuse';
 			swriteln("Operating System: openSUSE 11.1 or compatible\n");
-		} elseif(stristr(file_get_contents('/etc/SuSE-release'),'11.2')) {
+		} elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.2')) {
 			$distname = 'openSUSE';
 			$distver = '11.2';
 			$distid = 'opensuse112';
@@ -210,37 +210,37 @@
 
 		$content = file_get_contents('/etc/redhat-release');
 
-		if(stristr($content,'Fedora release 9 (Sulphur)')) {
+		if(stristr($content, 'Fedora release 9 (Sulphur)')) {
 			$distname = 'Fedora';
 			$distver = '9';
 			$distid = 'fedora9';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: Fedora 9 or compatible\n");
-		} elseif(stristr($content,'Fedora release 10 (Cambridge)')) {
+		} elseif(stristr($content, 'Fedora release 10 (Cambridge)')) {
 			$distname = 'Fedora';
 			$distver = '10';
 			$distid = 'fedora9';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: Fedora 10 or compatible\n");
-		} elseif(stristr($content,'Fedora release 10')) {
+		} elseif(stristr($content, 'Fedora release 10')) {
 			$distname = 'Fedora';
 			$distver = '11';
 			$distid = 'fedora9';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: Fedora 11 or compatible\n");
-		} elseif(stristr($content,'CentOS release 5.2 (Final)')) {
+		} elseif(stristr($content, 'CentOS release 5.2 (Final)')) {
 			$distname = 'CentOS';
 			$distver = '5.2';
 			$distid = 'centos52';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: CentOS 5.2 or compatible\n");
-		} elseif(stristr($content,'CentOS release 5.3 (Final)')) {
+		} elseif(stristr($content, 'CentOS release 5.3 (Final)')) {
 			$distname = 'CentOS';
 			$distver = '5.3';
 			$distid = 'centos53';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: CentOS 5.3 or compatible\n");
-		} elseif(stristr($content,'CentOS release 5')) {
+		} elseif(stristr($content, 'CentOS release 5')) {
 			$distname = 'CentOS';
 			$distver = 'Unknown';
 			$distid = 'centos53';
@@ -260,7 +260,7 @@
 
 		$content = file_get_contents('/etc/gentoo-release');
 
-				preg_match_all('/([0-9]{1,2})/', $content, $version);
+		preg_match_all('/([0-9]{1,2})/', $content, $version);
 		$distname = 'Gentoo';
 		$distver = $version[0][0].$version[0][1];
 		$distid = 'gentoo';
@@ -275,8 +275,8 @@
 }
 
 function sread() {
-		$input = fgets(STDIN);
-		return rtrim($input);
+	$input = fgets(STDIN);
+	return rtrim($input);
 }
 
 function swrite($text = '') {
@@ -288,7 +288,7 @@
 }
 
 function ilog($msg){
-		exec("echo `date` \"- [ISPConfig] - \"".$msg.' >> '.ISPC_LOG_FILE);
+	exec("echo `date` \"- [ISPConfig] - \"".$msg.' >> '.ISPC_LOG_FILE);
 }
 
 function error($msg){
@@ -297,7 +297,7 @@
 }
 
 function caselog($command, $file = '', $line = '', $success = '', $failure = ''){
-	exec($command,$arr,$ret_val);
+	exec($command, $arr, $ret_val);
 	$arr = NULL;
 	if(!empty($file) && !empty($line)){
 		$pre = $file.', Line '.$line.': ';
@@ -346,15 +346,15 @@
 }
 
 function rfsel($file, $file2) {
-    clearstatcache();
-    if(is_file($file)) return rf($file);
-    else return rf($file2);
+	clearstatcache();
+	if(is_file($file)) return rf($file);
+	else return rf($file2);
 }
 
 function rf($file){
 	clearstatcache();
 	if(is_file($file)) {
-		if(!$fp = fopen ($file, 'rb')){
+		if(!$fp = fopen($file, 'rb')){
 			ilog('WARNING: could not open file '.$file);
 		}
 		return filesize($file) > 0 ? fread($fp, filesize($file)) : '';
@@ -365,7 +365,7 @@
 
 function wf($file, $content){
 	mkdirs(dirname($file));
-	if(!$fp = fopen ($file, 'wb')){
+	if(!$fp = fopen($file, 'wb')){
 		ilog('WARNING: could not open file '.$file);
 	}
 	fwrite($fp, $content);
@@ -374,18 +374,18 @@
 
 function af($file, $content){
 	mkdirs(dirname($file));
-	if(!$fp = fopen ($file, 'ab')){
+	if(!$fp = fopen($file, 'ab')){
 		ilog('WARNING: could not open file '.$file);
 	}
-	fwrite($fp,$content);
+	fwrite($fp, $content);
 	fclose($fp);
 }
 
 function aftsl($file, $content){
-	if(!$fp = fopen ($file, 'ab')){
+	if(!$fp = fopen($file, 'ab')){
 		ilog('WARNING: could not open file '.$file);
 	}
-	fwrite($fp,$content);
+	fwrite($fp, $content);
 	fclose($fp);
 }
 
@@ -428,7 +428,7 @@
 			if(strstr($line, $comment)){
 				$pos = strpos($line, $comment);
 				if($pos != 0){
-					$new_lines[] = substr($line,0,$pos);
+					$new_lines[] = substr($line, 0, $pos);
 				}else{
 					$new_lines[] = '';
 				}
@@ -508,7 +508,7 @@
 	}
 	if(is_array($find)){
 		$ret_val = implode("\n", $find);
-		if(substr($ret_val,-1) != "\n") $ret_val .= "\n";
+		if(substr($ret_val, -1) != "\n") $ret_val .= "\n";
 		$find = NULL;
 		return $ret_val;
 	} else {
@@ -555,7 +555,7 @@
 	$ini = str_replace("\r\n", "\n", $ini);
 	$lines = explode("\n", $ini);
 	foreach($lines as $line) {
-				$line = trim($line);
+		$line = trim($line);
 		if($line != '') {
 			if(preg_match("/^\[([\w\d_]+)\]$/", $line, $matches)) {
 				$section = strtolower($matches[1]);
@@ -577,8 +577,8 @@
 		$content .= "[$section]\n";
 		foreach($data as $item => $value) {
 			if($item != ''){
-								$content .= "$item=$value\n";
-						}
+				$content .= "$item=$value\n";
+			}
 		}
 		$content .= "\n";
 	}
@@ -617,13 +617,13 @@
 	return false;
 }
 
-function replaceLine($filename,$search_pattern,$new_line,$strict = 0,$append = 1) {
+function replaceLine($filename, $search_pattern, $new_line, $strict = 0, $append = 1) {
 	if($lines = @file($filename)) {
 		$out = '';
 		$found = 0;
 		foreach($lines as $line) {
 			if($strict == 0) {
-				if(stristr($line,$search_pattern)) {
+				if(stristr($line, $search_pattern)) {
 					$out .= $new_line."\n";
 					$found = 1;
 				} else {
@@ -640,20 +640,20 @@
 		}
 		if($found == 0) {
 			//* add \n if the last line does not end with \n or \r
-			if(substr($out,-1) != "\n" && substr($out,-1) != "\r") $out .= "\n";
+			if(substr($out, -1) != "\n" && substr($out, -1) != "\r") $out .= "\n";
 			//* add the new line at the end of the file
 			if($append == 1) $out .= $new_line."\n";
 		}
-		file_put_contents($filename,$out);
+		file_put_contents($filename, $out);
 	}
 }
 
-function removeLine($filename,$search_pattern,$strict = 0) {
+function removeLine($filename, $search_pattern, $strict = 0) {
 	if($lines = @file($filename)) {
 		$out = '';
 		foreach($lines as $line) {
 			if($strict == 0) {
-				if(!stristr($line,$search_pattern)) {
+				if(!stristr($line, $search_pattern)) {
 					$out .= $line;
 				}
 			} else {
@@ -662,13 +662,13 @@
 				}
 			}
 		}
-		file_put_contents($filename,$out);
+		file_put_contents($filename, $out);
 	}
 }
 
 function is_installed($appname) {
-	exec('which '.escapeshellcmd($appname).' 2> /dev/null',$out,$returncode);
-	if(isset($out[0]) && stristr($out[0],$appname) && $returncode == 0) {
+	exec('which '.escapeshellcmd($appname).' 2> /dev/null', $out, $returncode);
+	if(isset($out[0]) && stristr($out[0], $appname) && $returncode == 0) {
 		return true;
 	} else {
 		return false;
@@ -683,12 +683,12 @@
  * 1 $current version is older then new version (update)
 
 */
-function compare_ispconfig_version($current,$new) {
+function compare_ispconfig_version($current, $new) {
 	if( $current == $new) {
 		return 0;
 	}
 
-	$p = explode('.',$current);
+	$p = explode('.', $current);
 	$tmp = '';
 	$tmp .= str_pad(intval($p[0]), 3, '0', STR_PAD_LEFT);
 	$tmp .= (isset($p[1]))?str_pad(intval($p[1]), 3, '0', STR_PAD_LEFT):'000';
@@ -696,7 +696,7 @@
 	$tmp .= (isset($p[3]))?str_pad(intval($p[3]), 3, '0', STR_PAD_LEFT):'000';
 	$current = $tmp;
 
-	$p = explode('.',$new);
+	$p = explode('.', $new);
 	$tmp = '';
 	$tmp .= str_pad(intval($p[0]), 3, '0', STR_PAD_LEFT);
 	$tmp .= (isset($p[1]))?str_pad(intval($p[1]), 3, '0', STR_PAD_LEFT):'000';
@@ -728,7 +728,7 @@
 
 	if(is_file($ispconfig_vhost_file)) {
 		$tmp = file_get_contents($ispconfig_vhost_file);
-		preg_match($regex,$tmp,$matches);
+		preg_match($regex, $tmp, $matches);
 		$port_number = @intval($matches[1]);
 		if($port_number > 0) {
 			return $port_number;
@@ -748,7 +748,7 @@
 
 	if(is_file($ispconfig_vhost_file)) {
 		$tmp = file_get_contents($ispconfig_vhost_file);
-		if(stristr($tmp,'SSLCertificateFile')) {
+		if(stristr($tmp, 'SSLCertificateFile')) {
 			return true;
 		} else {
 			return false;
@@ -756,60 +756,63 @@
 	}
 }
 
-/** 
-  Function to find the hash file for timezone detection
-  (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
-*/
+/**
+ Function to find the hash file for timezone detection
+ (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
+ */
+
+
 function find_hash_file($hash, $dir, $basedir = '') {
-    $res = opendir($dir);
-    if(!$res) return false;
-   
-    if(substr($basedir, -1) === '/') $basedir = substr($basedir, 0, strlen($basedir) - 1);
-    if(substr($dir, -1) === '/') $dir = substr($dir, 0, strlen($dir) - 1);
-    if($basedir === '') $basedir = $dir;
-   
-    while($cur = readdir($res)) {
-        if($cur == '.' || $cur == '..') continue;
-        $entry = $dir.'/'.$cur;
-        if(is_dir($entry)) {
-            $result = find_hash_file($hash, $entry, $basedir);
-            if($result !== false) return $result;
-        } elseif(md5_file($entry) === $hash) {
-            $entry = substr($entry, strlen($basedir) + 1);
-            if(substr($entry, 0, 7) === '/posix/') $entry = substr($entry, 7);
-            return $entry;
-        }
-    }
-    closedir($res);
-    return false;
+	$res = opendir($dir);
+	if(!$res) return false;
+
+	if(substr($basedir, -1) === '/') $basedir = substr($basedir, 0, strlen($basedir) - 1);
+	if(substr($dir, -1) === '/') $dir = substr($dir, 0, strlen($dir) - 1);
+	if($basedir === '') $basedir = $dir;
+
+	while($cur = readdir($res)) {
+		if($cur == '.' || $cur == '..') continue;
+		$entry = $dir.'/'.$cur;
+		if(is_dir($entry)) {
+			$result = find_hash_file($hash, $entry, $basedir);
+			if($result !== false) return $result;
+		} elseif(md5_file($entry) === $hash) {
+			$entry = substr($entry, strlen($basedir) + 1);
+			if(substr($entry, 0, 7) === '/posix/') $entry = substr($entry, 7);
+			return $entry;
+		}
+	}
+	closedir($res);
+	return false;
 }
 
-/** 
-  Function to get the timezone of the Linux system
-  (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
-*/
+
+/**
+ Function to get the timezone of the Linux system
+ (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
+ */
 function get_system_timezone() {
-    $timezone = false;
-    if(file_exists('/etc/timezone') && is_readable('/etc/timezone')) {
-        $timezone = trim(file_get_contents('/etc/timezone'));
-        if(file_exists('/usr/share/zoneinfo/' . $timezone) == false) $timezone = false;
-    }
-    
-    if(!$timezone && is_link('/etc/localtime')) {
-        $timezone = readlink('/etc/localtime');
-        $timezone = str_replace('/usr/share/zoneinfo/', '', $timezone);
-        if(substr($timezone, 0, 6) === 'posix/') $timezone = substr($timezone, 6);
-    } elseif(!$timezone) {
-        $hash = md5_file('/etc/localtime');
-        $timezone = find_hash_file($hash, '/usr/share/zoneinfo');
-    }
+	$timezone = false;
+	if(file_exists('/etc/timezone') && is_readable('/etc/timezone')) {
+		$timezone = trim(file_get_contents('/etc/timezone'));
+		if(file_exists('/usr/share/zoneinfo/' . $timezone) == false) $timezone = false;
+	}
 
-    if(!$timezone) {
-        exec('date +%Z', $tzinfo);
-        $timezone = $tzinfo[0];
-    }
+	if(!$timezone && is_link('/etc/localtime')) {
+		$timezone = readlink('/etc/localtime');
+		$timezone = str_replace('/usr/share/zoneinfo/', '', $timezone);
+		if(substr($timezone, 0, 6) === 'posix/') $timezone = substr($timezone, 6);
+	} elseif(!$timezone) {
+		$hash = md5_file('/etc/localtime');
+		$timezone = find_hash_file($hash, '/usr/share/zoneinfo');
+	}
 
-    return $timezone;
+	if(!$timezone) {
+		exec('date +%Z', $tzinfo);
+		$timezone = $tzinfo[0];
+	}
+
+	return $timezone;
 }
 
 
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index ba2e179..14d054a 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -53,7 +53,7 @@
 	}
 
 	public function warning($msg) {
-		echo('WARNING: '.$msg."\n");
+		echo 'WARNING: '.$msg."\n";
 	}
 
 	public function simple_query($query, $answers, $default) {
@@ -86,7 +86,7 @@
 		return $answer;
 	}
 
-	public function free_query($query,$default) {
+	public function free_query($query, $default) {
 		swrite($this->lng($query).' ['.$default.']: ');
 		$input = sread();
 
@@ -141,6 +141,8 @@
 	}
 
 	/** Create the database for ISPConfig */
+
+
 	public function configure_database() {
 		global $conf;
 
@@ -159,10 +161,10 @@
 		} else {
 			if($conf['mysql']['admin_password'] == '') {
 				caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
-						__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
+					__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
 			} else {
 				caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
-						__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
+					__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
 			}
 			$db_tables = $this->db->getTables();
 			if(count($db_tables) == 0) {
@@ -194,8 +196,8 @@
 
 		//* Create the ISPConfig database user in the local database
 		$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['database'].".* "
-				."TO '".$conf['mysql']['ispconfig_user']."'@'".$from_host."' "
-				."IDENTIFIED BY '".$conf['mysql']['ispconfig_password']."';";
+			."TO '".$conf['mysql']['ispconfig_user']."'@'".$from_host."' "
+			."IDENTIFIED BY '".$conf['mysql']['ispconfig_password']."';";
 		if(!$this->db->query($query)) {
 			$this->error('Unable to create database user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage);
 		}
@@ -360,140 +362,140 @@
 		}
 
 		if(count($hosts) > 0) {
-		foreach($hosts as $host => $value) {
-			/*
+			foreach($hosts as $host => $value) {
+				/*
 			 * If a pwd exists, this means, we have to add the new user (and his pwd).
 			 * if not, the user already exists and we do not need the pwd
 			 */
-			if ($value['pwd'] != ''){
-				$query = "CREATE USER '".$value['user']."'@'".$host."' IDENTIFIED BY '" . $value['pwd'] . "'";
+				if ($value['pwd'] != ''){
+					$query = "CREATE USER '".$value['user']."'@'".$host."' IDENTIFIED BY '" . $value['pwd'] . "'";
+					if ($verbose){
+						echo "\n\n" . $query ."\n";
+					}
+					$this->dbmaster->query($query); // ignore the error
+				}
+
+				/*
+			 *  Try to delete all rights of the user in case that it exists.
+			 *  In Case that it will not exist, do nothing (ignore the error!)
+			 */
+				$query = "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '".$value['user']."'@'".$host."' ";
 				if ($verbose){
 					echo "\n\n" . $query ."\n";
 				}
 				$this->dbmaster->query($query); // ignore the error
+
+				//* Create the ISPConfig database user in the remote database
+				$query = "GRANT SELECT ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, INSERT ON ".$value['db'].".`sys_log` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, UPDATE(`status`, `error`) ON ".$value['db'].".`sys_datalog` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`software_update_inst` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, UPDATE(`updated`) ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`, `ssl_key`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT ON ".$value['db'].".`sys_group` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, UPDATE (`action_state`, `response`) ON ".$value['db'].".`sys_remoteaction` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, INSERT , DELETE ON ".$value['db'].".`monitor_data` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`mail_traffic` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`web_traffic` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, UPDATE ON ".$value['db'].".`aps_instances` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
+				$query = "GRANT SELECT, INSERT, DELETE ON ".$value['db'].".`web_backup` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
+
 			}
 
 			/*
-			 *  Try to delete all rights of the user in case that it exists.
-			 *  In Case that it will not exist, do nothing (ignore the error!)
-			 */
-			$query = "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-					echo "\n\n" . $query ."\n";
-			}
-			$this->dbmaster->query($query); // ignore the error
-
-			//* Create the ISPConfig database user in the remote database
-			$query = "GRANT SELECT ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, INSERT ON ".$value['db'].".`sys_log` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, UPDATE(`status`, `error`) ON ".$value['db'].".`sys_datalog` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`software_update_inst` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, UPDATE(`updated`) ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`, `ssl_key`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT ON ".$value['db'].".`sys_group` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, UPDATE (`action_state`, `response`) ON ".$value['db'].".`sys_remoteaction` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, INSERT , DELETE ON ".$value['db'].".`monitor_data` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`mail_traffic` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`web_traffic` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-			$query = "GRANT SELECT, UPDATE ON ".$value['db'].".`aps_instances` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-			
-			$query = "GRANT SELECT, INSERT, DELETE ON ".$value['db'].".`web_backup` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-
-		}
-
-		/*
 		 * It is all done. Relod the rights...
 		 */
-		$this->dbmaster->query('FLUSH PRIVILEGES;');
+			$this->dbmaster->query('FLUSH PRIVILEGES;');
 		}
 
 	}
@@ -528,17 +530,17 @@
 		if (is_dir($config_dir)) {
 			if(is_file($config_dir.'/'.$jk_init)) copy($config_dir.'/'.$jk_init, $config_dir.'/'.$jk_init.'~');
 			if(is_file($config_dir.'/'.$jk_chrootsh.'.master')) copy($config_dir.'/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh.'~');
-            
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_init.'.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_init.'.master', $config_dir.'/'.$jk_init);
-            } else {
-                copy('tpl/'.$jk_init.'.master', $config_dir.'/'.$jk_init);
-            }
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_chrootsh.'.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh);
-            } else {
-                copy('tpl/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh);
-            }
+
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_init.'.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_init.'.master', $config_dir.'/'.$jk_init);
+			} else {
+				copy('tpl/'.$jk_init.'.master', $config_dir.'/'.$jk_init);
+			}
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_chrootsh.'.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh);
+			} else {
+				copy('tpl/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh);
+			}
 		}
 
 		//* help jailkit fo find its ini files
@@ -583,13 +585,13 @@
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -599,31 +601,31 @@
 		if(!isset($old_options['DEFAULT_SERVER_LANGUAGE'])) $old_options['DEFAULT_SERVER_LANGUAGE'] = '';
 		$content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content);
 		$content = str_replace('{virtual_domains}', $virtual_domains, $content);
-		
+
 		wf($full_file_name, $content);
-		
+
 		//* Write virtual_to_transport.sh script
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
+
 		if(is_dir('/etc/mailman')) {
 			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
-            } else {
-                copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
-            }
-			chgrp($full_file_name,'list');
-			chmod($full_file_name,0750);
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+			} else {
+				copy('tpl/mailman-virtual_to_transport.sh', $full_file_name);
+			}
+			chgrp($full_file_name, 'list');
+			chmod($full_file_name, 0750);
 		}
-		
+
 		//* Create aliasaes
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
-		
+
 	}
 
 	public function configure_postfix($options = '') {
@@ -667,9 +669,9 @@
 
 		//* Changing mode and group of the new created config files.
 		caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-				__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
+			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
 		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-				__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
+			__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
 
 		//* Creating virtual mail user and group
 		$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
@@ -686,31 +688,31 @@
 		//* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update
 		$rbl_list = '';
 		if (@isset($server_ini_array['mail']['realtime_blackhole_list']) && $server_ini_array['mail']['realtime_blackhole_list'] != '') {
-			$rbl_hosts = explode(",",str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
+			$rbl_hosts = explode(",", str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
 			foreach ($rbl_hosts as $key => $value) {
 				$rbl_list .= ", reject_rbl_client ". $value;
 			}
 		}
 		unset($rbl_hosts);
 		unset($server_ini_array);
-        
-        $postconf_placeholders = array('{config_dir}' => $config_dir,
-                                       '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
-                                       '{vmail_userid}' => $cf['vmail_userid'],
-                                       '{vmail_groupid}' => $cf['vmail_groupid'],
-                                       '{rbl_list}' => $rbl_list);
-        
-        $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_postfix.conf.master', 'tpl/debian_postfix.conf.master');
-        $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
-        $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
+
+		$postconf_placeholders = array('{config_dir}' => $config_dir,
+			'{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
+			'{vmail_userid}' => $cf['vmail_userid'],
+			'{vmail_groupid}' => $cf['vmail_groupid'],
+			'{rbl_list}' => $rbl_list);
+
+		$postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_postfix.conf.master', 'tpl/debian_postfix.conf.master');
+		$postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
+		$postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
 
 		//* These postconf commands will be executed on installation only
 		if($this->is_update == false) {
-			$postconf_commands = array_merge($postconf_commands,array(
-				'myhostname = '.$conf['hostname'],
-				'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
-				'mynetworks = 127.0.0.0/8 [::1]/128'
-			));
+			$postconf_commands = array_merge($postconf_commands, array(
+					'myhostname = '.$conf['hostname'],
+					'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
+					'mynetworks = 127.0.0.0/8 [::1]/128'
+				));
 		}
 
 		//* Create the header and body check files
@@ -737,10 +739,10 @@
 			caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
 
-		if(!stristr($options,'dont-create-certs')) {
+		if(!stristr($options, 'dont-create-certs')) {
 			//* Create the SSL certificate
 			$command = 'cd '.$config_dir.'; '
-					.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
+				.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
 			exec($command);
 
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
@@ -761,8 +763,8 @@
 		$configfile = $config_dir.'/master.cf';
 		$content = rf($configfile);
 		$content = str_replace('flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}',
-				'flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d '.$cf['vmail_username'].' ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-				$content);
+			'flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d '.$cf['vmail_username'].' ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
 		wf($configfile, $content);
 
 		//* Writing the Maildrop mailfilter file
@@ -793,8 +795,8 @@
 		global $conf;
 
 		//* Get saslsauthd version
-		exec('saslauthd -v 2>&1',$out);
-		$parts = explode(' ',$out[0]);
+		exec('saslauthd -v 2>&1', $out);
+		$parts = explode(' ', $out[0]);
 		$saslversion = $parts[1];
 		unset($parts);
 		unset($out);
@@ -807,14 +809,14 @@
 			$configfile = 'sasl_smtpd.conf';
 		}
 
-		if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf')) copy($conf['postfix']['config_dir'].'/sasl/smtpd.conf',$conf['postfix']['config_dir'].'/sasl/smtpd.conf~');
+		if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf')) copy($conf['postfix']['config_dir'].'/sasl/smtpd.conf', $conf['postfix']['config_dir'].'/sasl/smtpd.conf~');
 		if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf~')) chmod($conf['postfix']['config_dir'].'/sasl/smtpd.conf~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		wf($conf['postfix']['config_dir'].'/sasl/smtpd.conf',$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		wf($conf['postfix']['config_dir'].'/sasl/smtpd.conf', $content);
 
 		// TODO: Chmod and chown on the config file
 
@@ -824,21 +826,21 @@
 
 		// Edit the file /etc/default/saslauthd
 		$configfile = $conf['saslauthd']['config'];
-		if(is_file($configfile)) copy($configfile,$configfile.'~');
+		if(is_file($configfile)) copy($configfile, $configfile.'~');
 		if(is_file($configfile.'~')) chmod($configfile.'~', 0400);
 		$content = rf($configfile);
-		$content = str_replace('START=no','START=yes',$content);
+		$content = str_replace('START=no', 'START=yes', $content);
 		// Debian
-		$content = str_replace('OPTIONS="-c"','OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"',$content);
+		$content = str_replace('OPTIONS="-c"', 'OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"', $content);
 		// Ubuntu
-		$content = str_replace('OPTIONS="-c -m /var/run/saslauthd"','OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"',$content);
-		wf($configfile,$content);
+		$content = str_replace('OPTIONS="-c -m /var/run/saslauthd"', 'OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"', $content);
+		wf($configfile, $content);
 
 		// Edit the file /etc/init.d/saslauthd
 		$configfile = $conf['init_scripts'].'/'.$conf['saslauthd']['init_script'];
 		$content = rf($configfile);
-		$content = str_replace('PIDFILE=$RUN_DIR/saslauthd.pid','PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"',$content);
-		wf($configfile,$content);
+		$content = str_replace('PIDFILE=$RUN_DIR/saslauthd.pid', 'PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"', $content);
+		wf($configfile, $content);
 
 		// add the postfix user to the sasl group (at least necessary for Ubuntu 8.04 and most likely Debian Lenny as well.
 		exec('adduser postfix sasl');
@@ -878,10 +880,10 @@
 		}
 		chmod($config_dir.'/'.$configfile.'~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf($config_dir.'/'.$configfile, $content);
 
 		chmod($config_dir.'/'.$configfile, 0660);
@@ -915,9 +917,9 @@
 		}
 		$content = rf($conf['postfix']['config_dir'].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,'dovecot/deliver')) {
+		if(!stristr($content, 'dovecot/deliver')) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf['postfix']['config_dir'].'/master.cf',$deliver_content);
+			af($conf['postfix']['config_dir'].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
@@ -926,14 +928,14 @@
 		//* Reconfigure postfix to use dovecot authentication
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
-				'dovecot_destination_recipient_limit = 1',
-				'virtual_transport = dovecot',
-				'smtpd_sasl_type = dovecot',
-				'smtpd_sasl_path = private/auth'
+			'dovecot_destination_recipient_limit = 1',
+			'virtual_transport = dovecot',
+			'smtpd_sasl_type = dovecot',
+			'smtpd_sasl_path = private/auth'
 		);
 
 		// Make a backup copy of the main.cf file
-		copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~3');
+		copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~3');
 
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
@@ -948,25 +950,25 @@
 		}
 
 		//* Get the dovecot version
-		exec('dovecot --version',$tmp);
-		$parts = explode('.',trim($tmp[0]));
+		exec('dovecot --version', $tmp);
+		$parts = explode('.', trim($tmp[0]));
 		$dovecot_version = $parts[0];
 		unset($tmp);
 		unset($parts);
 
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot2.conf.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot2.conf.master', $config_dir.'/'.$configfile);
-            } else {
-                copy('tpl/debian_dovecot2.conf.master',$config_dir.'/'.$configfile);
-            }
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot2.conf.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot2.conf.master', $config_dir.'/'.$configfile);
+			} else {
+				copy('tpl/debian_dovecot2.conf.master', $config_dir.'/'.$configfile);
+			}
 		} else {
-            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot.conf.master')) {
-                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot.conf.master', $config_dir.'/'.$configfile);
-            } else {
-                copy('tpl/debian_dovecot.conf.master',$config_dir.'/'.$configfile);
-            }
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot.conf.master')) {
+				copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot.conf.master', $config_dir.'/'.$configfile);
+			} else {
+				copy('tpl/debian_dovecot.conf.master', $config_dir.'/'.$configfile);
+			}
 		}
 
 		//* dovecot-sql.conf
@@ -976,10 +978,10 @@
 		}
 		if(is_file($config_dir.'/'.$configfile.'~')) chmod($config_dir.'/'.$configfile.'~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot-sql.conf.master', 'tpl/debian_dovecot-sql.conf.master');
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf($config_dir.'/'.$configfile, $content);
 
 		chmod($config_dir.'/'.$configfile, 0600);
@@ -993,15 +995,15 @@
 
 		// amavisd user config file
 		$configfile = 'amavisd_user_config';
-		if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) copy($conf['amavis']['config_dir'].'/conf.d/50-user',$conf['amavis']['config_dir'].'/50-user~');
+		if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) copy($conf['amavis']['config_dir'].'/conf.d/50-user', $conf['amavis']['config_dir'].'/50-user~');
 		if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user~')) chmod($conf['amavis']['config_dir'].'/conf.d/50-user~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_port}',$conf['mysql']['port'],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		wf($conf['amavis']['config_dir'].'/conf.d/50-user',$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		wf($conf['amavis']['config_dir'].'/conf.d/50-user', $content);
 
 		// TODO: chmod and chown on the config file
 
@@ -1017,7 +1019,7 @@
 		}
 
 		// Make a backup copy of the main.cf file
-		copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~2');
+		copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~2');
 
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
@@ -1026,13 +1028,13 @@
 		}
 
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf',$conf['postfix']['config_dir'].'/master.cf~');
+		if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
 		$content = rf($conf['postfix']['config_dir'].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,'127.0.0.1:10025')) {
+		if(!stristr($content, '127.0.0.1:10025')) {
 			unset($content);
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
-			af($conf['postfix']['config_dir'].'/master.cf',$content);
+			af($conf['postfix']['config_dir'].'/master.cf', $content);
 		}
 		unset($content);
 
@@ -1103,12 +1105,12 @@
 		exec('echo "yes" > '.$config_dir.'/conf/DisplayDotFiles');
 
 		if(is_file('/etc/default/pure-ftpd-common')) {
-			replaceLine('/etc/default/pure-ftpd-common','STANDALONE_OR_INETD=inetd','STANDALONE_OR_INETD=standalone',1,0);
-			replaceLine('/etc/default/pure-ftpd-common','VIRTUALCHROOT=false','VIRTUALCHROOT=true',1,0);
+			replaceLine('/etc/default/pure-ftpd-common', 'STANDALONE_OR_INETD=inetd', 'STANDALONE_OR_INETD=standalone', 1, 0);
+			replaceLine('/etc/default/pure-ftpd-common', 'VIRTUALCHROOT=false', 'VIRTUALCHROOT=true', 1, 0);
 		}
 
 		if(is_file('/etc/inetd.conf')) {
-			replaceLine('/etc/inetd.conf','/usr/sbin/pure-ftpd-wrapper','#ftp     stream  tcp     nowait  root    /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper',0,0);
+			replaceLine('/etc/inetd.conf', '/usr/sbin/pure-ftpd-wrapper', '#ftp     stream  tcp     nowait  root    /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper', 0, 0);
 			exec($this->getinitcommand('openbsd-inetd', 'restart'));
 			//if(is_file($conf['init_scripts'].'/'.'openbsd-inetd')) exec($conf['init_scripts'].'/'.'openbsd-inetd restart');
 		}
@@ -1121,15 +1123,15 @@
 
 		// configure pam for SMTP authentication agains the ispconfig database
 		$configfile = 'mydns.conf';
-		if(is_file($conf['mydns']['config_dir'].'/'.$configfile)) copy($conf['mydns']['config_dir'].'/'.$configfile,$conf['mydns']['config_dir'].'/'.$configfile.'~');
+		if(is_file($conf['mydns']['config_dir'].'/'.$configfile)) copy($conf['mydns']['config_dir'].'/'.$configfile, $conf['mydns']['config_dir'].'/'.$configfile.'~');
 		if(is_file($conf['mydns']['config_dir'].'/'.$configfile.'~')) chmod($conf['mydns']['config_dir'].'/'.$configfile.'~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
-		$content = str_replace('{server_id}',$conf['server_id'],$content);
-		wf($conf['mydns']['config_dir'].'/'.$configfile,$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
+		$content = str_replace('{server_id}', $conf['server_id'], $content);
+		wf($conf['mydns']['config_dir'].'/'.$configfile, $content);
 		chmod($conf['mydns']['config_dir'].'/'.$configfile, 0600);
 		chown($conf['mydns']['config_dir'].'/'.$configfile, 'root');
 		chgrp($conf['mydns']['config_dir'].'/'.$configfile, 'root');
@@ -1156,22 +1158,22 @@
 		//* load the powerdns databse dump
 		if($conf['mysql']['admin_password'] == '') {
 			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
-					__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
+				__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
 		} else {
 			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
-					__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
+				__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
 		}
 
 		//* Create the powerdns config file
 		$configfile = 'pdns.local';
-		if(is_file($conf['powerdns']['config_dir'].'/'.$configfile)) copy($conf['powerdns']['config_dir'].'/'.$configfile,$conf['powerdns']['config_dir'].'/'.$configfile.'~');
+		if(is_file($conf['powerdns']['config_dir'].'/'.$configfile)) copy($conf['powerdns']['config_dir'].'/'.$configfile, $conf['powerdns']['config_dir'].'/'.$configfile.'~');
 		if(is_file($conf['powerdns']['config_dir'].'/'.$configfile.'~')) chmod($conf['powerdns']['config_dir'].'/'.$configfile.'~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
-		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-		$content = str_replace('{powerdns_database}',$conf['powerdns']['database'],$content);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
-		wf($conf['powerdns']['config_dir'].'/'.$configfile,$content);
+		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{powerdns_database}', $conf['powerdns']['database'], $content);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
+		wf($conf['powerdns']['config_dir'].'/'.$configfile, $content);
 		chmod($conf['powerdns']['config_dir'].'/'.$configfile, 0600);
 		chown($conf['powerdns']['config_dir'].'/'.$configfile, 'root');
 		chgrp($conf['powerdns']['config_dir'].'/'.$configfile, 'root');
@@ -1182,19 +1184,19 @@
 	public function configure_bind() {
 		global $conf;
 
-	    //* Check if the zonefile directory has a slash at the end
-	    $content=$conf['bind']['bind_zonefiles_dir'];
-	    if(substr($content,-1,1) != '/') {
-    	    $content .= '/';
+		//* Check if the zonefile directory has a slash at the end
+		$content=$conf['bind']['bind_zonefiles_dir'];
+		if(substr($content, -1, 1) != '/') {
+			$content .= '/';
 		}
 
 		//* Create the slave subdirectory
-	    $content .= 'slave';
-	    if(!@is_dir($content)) mkdir($content, 0770, true);
+		$content .= 'slave';
+		if(!@is_dir($content)) mkdir($content, 0770, true);
 
-	    //* Chown the slave subdirectory to $conf['bind']['bind_user']
-	    chown($content, $conf['bind']['bind_user']);
-	    chgrp($content, $conf['bind']['bind_group']);
+		//* Chown the slave subdirectory to $conf['bind']['bind_user']
+		chown($content, $conf['bind']['bind_user']);
+		chgrp($content, $conf['bind']['bind_group']);
 
 	}
 
@@ -1208,19 +1210,19 @@
 		if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
 
 		if(is_file('/etc/suphp/suphp.conf')) {
-			replaceLine('/etc/suphp/suphp.conf','php=php:/usr/bin','x-httpd-suphp="php:/usr/bin/php-cgi"',0);
+			replaceLine('/etc/suphp/suphp.conf', 'php=php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0);
 			//replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0);
-			replaceLine('/etc/suphp/suphp.conf','umask=0077','umask=0022',0);
+			replaceLine('/etc/suphp/suphp.conf', 'umask=0077', 'umask=0022', 0);
 		}
 
 		if(is_file('/etc/apache2/sites-enabled/000-default')) {
-			replaceLine('/etc/apache2/sites-available/000-default','NameVirtualHost *','NameVirtualHost *:80',1,0);
-			replaceLine('/etc/apache2/sites-available/000-default','<VirtualHost *>','<VirtualHost *:80>',1,0);
+			replaceLine('/etc/apache2/sites-available/000-default', 'NameVirtualHost *', 'NameVirtualHost *:80', 1, 0);
+			replaceLine('/etc/apache2/sites-available/000-default', '<VirtualHost *>', '<VirtualHost *:80>', 1, 0);
 		}
 
 		if(is_file('/etc/apache2/ports.conf')) {
 			// add a line "Listen 443" to ports conf if line does not exist
-			replaceLine('/etc/apache2/ports.conf','Listen 443','Listen 443',1);
+			replaceLine('/etc/apache2/ports.conf', 'Listen 443', 'Listen 443', 1);
 		}
 
 
@@ -1240,7 +1242,7 @@
 				} else {
 					$ip_address = $rec['ip_address'];
 				}
-				$ports = explode(',',$rec['virtualhost_port']);
+				$ports = explode(',', $rec['virtualhost_port']);
 				if(is_array($ports)) {
 					foreach($ports as $port) {
 						$port = intval($port);
@@ -1253,29 +1255,29 @@
 		}
 
 		$content .= "\n";
-		wf($vhost_conf_dir.'/ispconfig.conf',$content);
+		wf($vhost_conf_dir.'/ispconfig.conf', $content);
 
 		if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.conf')) {
-			symlink($vhost_conf_dir.'/ispconfig.conf',$vhost_conf_enabled_dir.'/000-ispconfig.conf');
+			symlink($vhost_conf_dir.'/ispconfig.conf', $vhost_conf_enabled_dir.'/000-ispconfig.conf');
 		}
 
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			mkdir('/etc/webalizer');
-			symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
+			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
 
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
 
 		// Check the awsatst script
 		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
-		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
-		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
+		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
 
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
@@ -1293,20 +1295,20 @@
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			mkdir('/etc/webalizer');
-			symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
+			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
 
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
 
 		// Check the awsatst script
 		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
-		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
-		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
+		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
 
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
@@ -1344,8 +1346,8 @@
 	}
 
 	public function configure_fail2ban() {
-        // To Do
-    }
+		// To Do
+	}
 
 	public function configure_squid()
 	{
@@ -1355,13 +1357,13 @@
 		$server_name = $row["server_name"];
 
 		$configfile = 'squid.conf';
-		if(is_file($conf["squid"]["config_dir"].'/'.$configfile)) copy($conf["squid"]["config_dir"].'/'.$configfile,$conf["squid"]["config_dir"].'/'.$configfile.'~');
+		if(is_file($conf["squid"]["config_dir"].'/'.$configfile)) copy($conf["squid"]["config_dir"].'/'.$configfile, $conf["squid"]["config_dir"].'/'.$configfile.'~');
 		if(is_file($conf["squid"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["squid"]["config_dir"].'/'.$configfile.'~');
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
-		$content = str_replace('{server_name}',$server_name,$content);
-		$content = str_replace('{ip_address}',$ip_address, $content);
-		$content = str_replace('{config_dir}',$conf['squid']['config_dir'], $content);
-		wf($conf["squid"]["config_dir"].'/'.$configfile,$content);
+		$content = str_replace('{server_name}', $server_name, $content);
+		$content = str_replace('{ip_address}', $ip_address, $content);
+		$content = str_replace('{config_dir}', $conf['squid']['config_dir'], $content);
+		wf($conf["squid"]["config_dir"].'/'.$configfile, $content);
 		exec('chmod 600 '.$conf["squid"]["config_dir"].'/'.$configfile);
 		exec('chown root:root '.$conf["squid"]["config_dir"].'/'.$configfile);
 	}
@@ -1388,10 +1390,10 @@
 		@mkdir('/etc/Bastille', 0700);
 		if(is_dir('/etc/Bastille.backup/firewall.d')) caselog('cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/', __FILE__, __LINE__);
 		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
-            caselog('cp -f ' . $conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
-        } else {
-            caselog('cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
-        }
+			caselog('cp -f ' . $conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
+		} else {
+			caselog('cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
+		}
 		caselog('chmod 644 /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
 		$content = rf('/etc/Bastille/bastille-firewall.cfg');
 		$content = str_replace('{DNS_SERVERS}', '', $content);
@@ -1402,8 +1404,8 @@
 		$row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id']));
 
 		if(trim($row['tcp_port']) != '' || trim($row['udp_port']) != '') {
-			$tcp_public_services = trim(str_replace(',',' ',$row['tcp_port']));
-			$udp_public_services = trim(str_replace(',',' ',$row['udp_port']));
+			$tcp_public_services = trim(str_replace(',', ' ', $row['tcp_port']));
+			$udp_public_services = trim(str_replace(',', ' ', $row['udp_port']));
 		} else {
 			$tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000';
 			$udp_public_services = '53';
@@ -1447,21 +1449,21 @@
 
 		//** Configure vlogger to use traffic logging to mysql (master) db
 		$configfile = 'vlogger-dbi.conf';
-		if(is_file($conf['vlogger']['config_dir'].'/'.$configfile)) copy($conf['vlogger']['config_dir'].'/'.$configfile,$conf['vlogger']['config_dir'].'/'.$configfile.'~');
+		if(is_file($conf['vlogger']['config_dir'].'/'.$configfile)) copy($conf['vlogger']['config_dir'].'/'.$configfile, $conf['vlogger']['config_dir'].'/'.$configfile.'~');
 		if(is_file($conf['vlogger']['config_dir'].'/'.$configfile.'~')) chmod($conf['vlogger']['config_dir'].'/'.$configfile.'~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		if($conf['mysql']['master_slave_setup'] == 'y') {
-			$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['master_ispconfig_user'],$content);
-			$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['master_ispconfig_password'], $content);
-			$content = str_replace('{mysql_server_database}',$conf['mysql']['master_database'],$content);
-			$content = str_replace('{mysql_server_ip}',$conf['mysql']['master_host'],$content);
+			$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
+			$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
+			$content = str_replace('{mysql_server_database}', $conf['mysql']['master_database'], $content);
+			$content = str_replace('{mysql_server_ip}', $conf['mysql']['master_host'], $content);
 		} else {
-			$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
-			$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
-			$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
-			$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
+			$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
+			$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
+			$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
+			$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
 		}
-		wf($conf['vlogger']['config_dir'].'/'.$configfile,$content);
+		wf($conf['vlogger']['config_dir'].'/'.$configfile, $content);
 		chmod($conf['vlogger']['config_dir'].'/'.$configfile, 0600);
 		chown($conf['vlogger']['config_dir'].'/'.$configfile, 'root');
 		chgrp($conf['vlogger']['config_dir'].'/'.$configfile, 'root');
@@ -1523,7 +1525,7 @@
 			//* and create the symlink
 			if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost');
 			if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) {
-				symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost');
+				symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
 			}
 
 			if(!is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter')) {
@@ -1536,7 +1538,7 @@
 				exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
 				exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps');
 
-			}			
+			}
 		}
 		if($conf['nginx']['installed'] == true){
 			$apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']);
@@ -1576,7 +1578,7 @@
 			}
 
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'apps.sock';
 			$cgi_socket = escapeshellcmd($conf['nginx']['cgi_socket']);
@@ -1588,7 +1590,7 @@
 			//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 			$content = str_replace('{cgi_socket}', $cgi_socket, $content);
-			
+
 			if(file_exists('/var/run/php5-fpm.sock')){
 				$use_tcp = '#';
 				$use_socket = '';
@@ -1615,7 +1617,7 @@
 			//* and create the symlink
 			if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost');
 			if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) {
-				symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost');
+				symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
 			}
 
 		}
@@ -1632,13 +1634,13 @@
 
 		if(!@is_dir($install_dir.'/interface/ssl')) mkdir($install_dir.'/interface/ssl', 0755, true);
 
-		$ssl_pw = substr(md5(mt_rand()),0,6);
+		$ssl_pw = substr(md5(mt_rand()), 0, 6);
 		exec("openssl genrsa -des3 -passout pass:$ssl_pw -out $ssl_key_file 4096");
 		exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -out $ssl_csr_file");
 		exec("openssl req -x509 -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -in $ssl_csr_file -out $ssl_crt_file -days 3650");
 		exec("openssl rsa -passin pass:$ssl_pw -in $ssl_key_file -out $ssl_key_file.insecure");
-		rename($ssl_key_file,$ssl_key_file.'.secure');
-		rename($ssl_key_file.'.insecure',$ssl_key_file);
+		rename($ssl_key_file, $ssl_key_file.'.secure');
+		rename($ssl_key_file.'.insecure', $ssl_key_file);
 
 	}
 
@@ -1680,7 +1682,7 @@
 		}
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
-		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
+		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 
@@ -1736,9 +1738,9 @@
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/mods-available/'.$file);
-						$module_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/mods-available/'.$file;
+						$module_name = substr($file, 0, -8);
 						$tmp = new $module_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) {
@@ -1765,11 +1767,11 @@
 				while (($file = readdir($dh)) !== false) {
 					if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
 					if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/plugins-available/'.$file);
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/plugins-available/'.$file;
+						$plugin_name = substr($file, 0, -8);
 						$tmp = new $plugin_name;
-						if(method_exists($tmp,'onInstall') && $tmp->onInstall()) {
+						if(method_exists($tmp, 'onInstall') && $tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) {
 								@symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file);
 								//@symlink($install_dir.'/server/plugins-available/'.$file, '../plugins-enabled/'.$file);
@@ -1824,14 +1826,14 @@
 
 		//* Make all interface language file directories group writable
 		$handle = @opendir($install_dir.'/interface/web');
-		while ($file = @readdir ($handle)) {
+		while ($file = @readdir($handle)) {
 			if ($file != '.' && $file != '..') {
 				if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
 					$handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang');
-					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770);
-					while ($lang_file = @readdir ($handle2)) {
+					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770);
+					while ($lang_file = @readdir($handle2)) {
 						if ($lang_file != '.' && $lang_file != '..') {
-							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770);
+							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770);
 						}
 					}
 				}
@@ -1846,7 +1848,7 @@
 		chmod($install_dir.'/server/lib/config.inc.php', 0600);
 		chown($install_dir.'/server/lib/config.inc.php', 'root');
 		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
-		
+
 		//* Make sure thet the interface config file is readable by user ispconfig only
 		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
 		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
@@ -1925,18 +1927,18 @@
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
 			//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
-				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
-				$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
-				@mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true);
-				wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
-				exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
-				@symlink($install_dir.'/interface/web','/var/www/ispconfig');
-				exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
+			$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
+			$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
+			@mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true);
+			wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
+			exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
+			@symlink($install_dir.'/interface/web', '/var/www/ispconfig');
+			exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
 			//}
 		}
 
@@ -1960,7 +1962,7 @@
 			}
 
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'ispconfig.sock';
 
@@ -1986,7 +1988,7 @@
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
 		}
@@ -1999,8 +2001,8 @@
 		chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
 		chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root');
 		chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700);
-		if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh','/usr/local/bin/ispconfig_update_from_svn.sh');
-		if(!is_link('/usr/local/bin/ispconfig_update.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh','/usr/local/bin/ispconfig_update.sh');
+		if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_svn.sh');
+		if(!is_link('/usr/local/bin/ispconfig_update.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update.sh');
 
 		//* Make the logs readable for the ispconfig user
 		if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log');
@@ -2024,7 +2026,7 @@
 		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
 
 		if(is_user('getmail')) {
-			rename($install_dir.'/server/scripts/run-getmail.sh','/usr/local/bin/run-getmail.sh');
+			rename($install_dir.'/server/scripts/run-getmail.sh', '/usr/local/bin/run-getmail.sh');
 			if(is_user('getmail')) chown('/usr/local/bin/run-getmail.sh', 'getmail');
 			chmod('/usr/local/bin/run-getmail.sh', 0744);
 		}
@@ -2052,11 +2054,11 @@
 			fclose($fh);
 			*/
 		}
-		
+
 		//* Remove Domain module as its functions are available in the client module now
 		if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
-	
-	
+
+
 	}
 
 	public function configure_dbserver() {
@@ -2074,10 +2076,10 @@
 		}
 
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', 'tpl/mysql_clientdb.conf.master');
-		$content = str_replace('{hostname}',$conf['mysql']['host'],$content);
-		$content = str_replace('{username}',$conf['mysql']['admin_user'],$content);
-		$content = str_replace('{password}',$conf['mysql']['admin_password'], $content);
-		wf($install_dir.'/server/lib/mysql_clientdb.conf',$content);
+		$content = str_replace('{hostname}', $conf['mysql']['host'], $content);
+		$content = str_replace('{username}', $conf['mysql']['admin_user'], $content);
+		$content = str_replace('{password}', $conf['mysql']['admin_password'], $content);
+		wf($install_dir.'/server/lib/mysql_clientdb.conf', $content);
 		chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600);
 		chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
 		chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
@@ -2095,12 +2097,12 @@
 
 		// remove existing ispconfig cronjobs, in case the syntax has changed
 		foreach($existing_root_cron_jobs as $key => $val) {
-			if(stristr($val,$install_dir)) unset($existing_root_cron_jobs[$key]);
+			if(stristr($val, $install_dir)) unset($existing_root_cron_jobs[$key]);
 		}
 
 		$root_cron_jobs = array(
-				"* * * * * ".$install_dir."/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done",
-				"30 00 * * * ".$install_dir."/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done"
+			"* * * * * ".$install_dir."/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done",
+			"30 00 * * * ".$install_dir."/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done"
 		);
 
 		if ($conf['nginx']['installed'] == true) {
@@ -2123,12 +2125,12 @@
 			$existing_cron_jobs = file('crontab.txt');
 
 			$cron_jobs = array(
-					'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
+				'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
 			);
 
 			// remove existing ispconfig cronjobs, in case the syntax has changed
 			foreach($existing_cron_jobs as $key => $val) {
-				if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]);
+				if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]);
 			}
 
 			foreach($cron_jobs as $cron_job) {
@@ -2145,7 +2147,7 @@
 		chmod($conf['ispconfig_log_dir'].'/cron.log', 0660);
 
 	}
-	
+
 	public function getinitcommand($servicename, $action, $init_script_directory = ''){
 		global $conf;
 		// systemd
@@ -2182,17 +2184,17 @@
 		global $conf, $dist;
 
 		$final_path = '';
-        $dist_template = $conf['ispconfig_install_dir'] . '/server/conf-custom/install/' . $tLocal . '.master';
-        if (file_exists($dist_template)) {
+		$dist_template = $conf['ispconfig_install_dir'] . '/server/conf-custom/install/' . $tLocal . '.master';
+		if (file_exists($dist_template)) {
 			$final_path = $dist_template;
 		} else {
-            $dist_template = 'dist/tpl/'.strtolower($dist['name'])."/$tLocal.master";
-            if (file_exists($dist_template)) {
-                $final_path = $dist_template;
-            } else {
-                $final_path = "tpl/$tLocal.master";
-            }
-        }
+			$dist_template = 'dist/tpl/'.strtolower($dist['name'])."/$tLocal.master";
+			if (file_exists($dist_template)) {
+				$final_path = $dist_template;
+			} else {
+				$final_path = "tpl/$tLocal.master";
+			}
+		}
 
 		if (!$tRf) {
 			return $final_path;
@@ -2230,21 +2232,21 @@
 		wf($tConf, $tContents); // write file
 
 		if (func_num_args() >= 4) // override rights and/or ownership
-		{
+			{
 			$args = func_get_args();
 			$output = array_slice($args, 2);
 
 			switch (sizeof($output)) {
-				case 3:
-					$umask = array_shift($output);
-					if (is_numeric($umask) && preg_match('/^0?[0-7]{3}$/', $umask)) {
-						$access = $umask;
-					}
-				case 2:
-					if (is_user($output[0]) && is_group($output[1])) {
-						list($user,$group) = $output;
-					}
-					break;
+			case 3:
+				$umask = array_shift($output);
+				if (is_numeric($umask) && preg_match('/^0?[0-7]{3}$/', $umask)) {
+					$access = $umask;
+				}
+			case 2:
+				if (is_user($output[0]) && is_group($output[1])) {
+					list($user, $group) = $output;
+				}
+				break;
 			}
 		}
 
@@ -2273,11 +2275,12 @@
 		$tContents = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $tContents);
 		$tContents = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $tContents);
 		$tContents = str_replace('{mysql_server_ip}', $conf["mysql"]["ip"], $tContents);
-		$tContents = str_replace('{mysql_server_host}',$conf['mysql']['host'], $tContents);
-		$tContents = str_replace('{mysql_server_port}',$conf["mysql"]["port"], $tContents);
+		$tContents = str_replace('{mysql_server_host}', $conf['mysql']['host'], $tContents);
+		$tContents = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $tContents);
 
 		return $tContents;
 	}
+
 }
 
 ?>
diff --git a/install/lib/mysql.lib.php b/install/lib/mysql.lib.php
index b7f1ae8..c5c2a83 100644
--- a/install/lib/mysql.lib.php
+++ b/install/lib/mysql.lib.php
@@ -30,25 +30,25 @@
 
 class db
 {
-	var $dbHost = "";		  // hostname of the MySQL server
-	var $dbName = "";		  // logical database name on that server
-	var $dbUser = "";		  // database authorized user
-	var $dbPass = "";		  // user's password
+	var $dbHost = "";    // hostname of the MySQL server
+	var $dbName = "";    // logical database name on that server
+	var $dbUser = "";    // database authorized user
+	var $dbPass = "";    // user's password
 	var $dbCharset = "";      // what charset comes and goes to mysql: utf8 / latin1
-	var $linkId = false;		  // last result of mysql_connect()
-	var $queryId = 0;		  // last result of mysql_query()
-	var $record	= array();	  // last record fetched
-    var $autoCommit = 1;      // Autocommit Transactions
-	var $currentRow;		  // current row number
-	var $errorNumber = 0;	  // last error number
-	var $errorMessage = "";	  // last error message
+	var $linkId = false;    // last result of mysql_connect()
+	var $queryId = 0;    // last result of mysql_query()
+	var $record = array();   // last record fetched
+	var $autoCommit = 1;      // Autocommit Transactions
+	var $currentRow;    // current row number
+	var $errorNumber = 0;   // last error number
+	var $errorMessage = "";   // last error message
 	var $errorLocation = "";  // last error location
 	var $show_error_messages = false;
 
 	// constructor
 	function db()
 	{
-		
+
 		global $conf;
 		$this->dbHost = $conf["mysql"]["host"];
 		//$this->dbName = $conf["mysql"]["database"];
@@ -66,7 +66,7 @@
 		$this->errorLocation = $location;
 		if($this->errorNumber && $this->show_error_messages)
 		{
-			echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
+			echo '<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage;
 			flush();
 		}
 	}
@@ -138,7 +138,7 @@
 	// returns the next record in an array
 	function nextRecord()
 	{
-        $this->record = mysqli_fetch_assoc($this->queryId);
+		$this->record = mysqli_fetch_assoc($this->queryId);
 		$this->updateError('DB::nextRecord()<br />mysqli_fetch_array');
 		if(!$this->record || !is_array($this->record))
 		{
@@ -153,37 +153,37 @@
 	{
 		return mysqli_num_rows($this->queryId);
 	}
-	
+
 	function affectedRows()
 	{
 		return mysqli_affected_rows($this->linkId);
 	}
-	
+
 	// returns mySQL insert id
 	function insertID()
 	{
 		return mysqli_insert_id($this->linkId);
 	}
-    
-    // Check der variablen
+
+	// Check der variablen
 	// deprecated, now use quote
-    function check($formfield)
-    {
-        return $this->quote($formfield);
-    }
-	
+	function check($formfield)
+	{
+		return $this->quote($formfield);
+	}
+
 	// Check der variablen
-    function quote($formfield)
-    {
-        return mysqli_real_escape_string($this->linkId, $formfield);
-    }
-	
+	function quote($formfield)
+	{
+		return mysqli_real_escape_string($this->linkId, $formfield);
+	}
+
 	// Check der variablen
-    function unquote($formfield)
-    {
-        return stripslashes($formfield);
-    }
-	
+	function unquote($formfield)
+	{
+		return stripslashes($formfield);
+	}
+
 	function toLower($record) {
 		if(is_array($record)) {
 			foreach($record as $key => $val) {
@@ -191,116 +191,64 @@
 				$out[$key] = $val;
 			}
 		}
-	return $out;
+		return $out;
 	}
-   
-   
-   function insert($tablename,$form,$debug = 0)
-   {
-     if(is_array($form)){
-       foreach($form as $key => $value) 
-	    {
-	    $sql_key .= "$key, ";
-        $sql_value .= "'".$this->check($value)."', ";
-  		 }
-   	$sql_key = substr($sql_key,0,strlen($sql_key) - 2);
-    $sql_value = substr($sql_value,0,strlen($sql_value) - 2);
-    
-   	$sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")";
-   
-  		 if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
-  		 $this->query($sql);
-  		 if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
-      }
-   }
-   
-   function update($tablename,$form,$bedingung,$debug = 0)
-   {
-   
-     if(is_array($form)){
-       foreach($form as $key => $value) 
-	    {
-	    $insql .= "$key = '".$this->check($value)."', ";
-  		 }
-   	        $insql = substr($insql,0,strlen($insql) - 2);
-   	        $sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung";
-  		 if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
-  		 $this->query($sql);
-  		 if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
-       }
-   }
-   
-   function closeConn() {
-   
-   }
-   
-   function freeResult() {
-   
-   
-   }
-   
-   function delete() {
-   
-   }
-   
-   function Transaction($action) {
-   //action = begin, commit oder rollback
-   
-   }
-   
-   /*
-   $columns = array(action =>   add | alter | drop
-                    name =>     Spaltenname
-                    name_new => neuer Spaltenname, nur bei 'alter' belegt
-                    type =>     42go-Meta-Type: int16, int32, int64, double, char, varchar, text, blob
-                    typeValue => Wert z.B. bei Varchar
-                    defaultValue =>  Default Wert
-                    notNull =>   true | false
-                    autoInc =>   true | false
-                    option =>   unique | primary | index)
-   
-   
-   */
-   
-   function createTable($table_name,$columns) {
-   $index = "";
-   $sql = "CREATE TABLE $table_name (";
-   foreach($columns as $col){
-        $sql .= $col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
-   
-        if($col["defaultValue"] != "") {
-			if($col["defaultValue"] == "NULL" or $col["defaultValue"] == "NOT NULL") {
-				$sql .= "DEFAULT ".$col["defaultValue"]." ";
-			} else {
-				$sql .= "DEFAULT '".$col["defaultValue"]."' ";
+
+
+	function insert($tablename, $form, $debug = 0)
+	{
+		if(is_array($form)){
+			foreach($form as $key => $value)
+			{
+				$sql_key .= "$key, ";
+				$sql_value .= "'".$this->check($value)."', ";
 			}
-			
-		} elseif($col["defaultValue"] != false) {
-			$sql .= "DEFAULT '' ";
+			$sql_key = substr($sql_key, 0, strlen($sql_key) - 2);
+			$sql_value = substr($sql_value, 0, strlen($sql_value) - 2);
+
+			$sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")";
+
+			if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
+			$this->query($sql);
+			if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
 		}
-		if($col["defaultValue"] != "NULL" && $col["defaultValue"] != "NOT NULL") {
-        	if($col["notNull"] == true) {
-            	$sql .= "NOT NULL ";
-        	} else {
-            	$sql .= "NULL ";
-        	}
+	}
+
+	function update($tablename, $form, $bedingung, $debug = 0)
+	{
+
+		if(is_array($form)){
+			foreach($form as $key => $value)
+			{
+				$insql .= "$key = '".$this->check($value)."', ";
+			}
+			$insql = substr($insql, 0, strlen($insql) - 2);
+			$sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung";
+			if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
+			$this->query($sql);
+			if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
 		}
-        if($col["autoInc"] == true) $sql .= "auto_increment ";
-        $sql.= ",";
-        // key Definitionen
-        if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
-        if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
-        if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
-   }
-   $sql .= $index;
-   $sql = substr($sql,0,-1);
-   $sql .= ")";
-   
-   $this->query($sql);
-   return true;
-   }
-   
-   /*
+	}
+
+	function closeConn() {
+
+	}
+
+	function freeResult() {
+
+
+	}
+
+	function delete() {
+
+	}
+
+	function Transaction($action) {
+		//action = begin, commit oder rollback
+
+	}
+
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -310,56 +258,108 @@
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   function alterTable($table_name,$columns) {
-   $index = "";
-   $sql = "ALTER TABLE $table_name ";
-   foreach($columns as $col){
-        if($col["action"] == 'add') {
-            $sql .= "ADD ".$col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
-        } elseif ($col["action"] == 'alter') {
-            $sql .= "CHANGE ".$col["name"]." ".$col["name_new"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
-        } elseif ($col["action"] == 'drop') {
-            $sql .= "DROP ".$col["name"]." ";
-        }
-        if($col["action"] != 'drop') {  
-        if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
-        if($col["notNull"] == true) {
-            $sql .= "NOT NULL ";
-        } else {
-            $sql .= "NULL ";
-        }
-        if($col["autoInc"] == true) $sql .= "auto_increment ";
-        $sql.= ",";
-        // key Definitionen
-        if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
-        if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
-        if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
-        }
-   }
-   $sql .= $index;
-   $sql = substr($sql,0,-1);
-   
-   //die($sql);
-   $this->query($sql);
-   return true;
-   }
-   
-   function dropTable($table_name) {
-   $this->check($table_name);
-   $sql = "DROP TABLE '". $table_name."'";
-   return $this->query($sql);
-   }
-   
-   // gibt Array mit Tabellennamen zur�ck
-   function getTables($database_name = '') {
-   	
+
+	function createTable($table_name, $columns) {
+		$index = "";
+		$sql = "CREATE TABLE $table_name (";
+		foreach($columns as $col){
+			$sql .= $col["name"]." ".$this->mapType($col["type"], $col["typeValue"])." ";
+
+			if($col["defaultValue"] != "") {
+				if($col["defaultValue"] == "NULL" or $col["defaultValue"] == "NOT NULL") {
+					$sql .= "DEFAULT ".$col["defaultValue"]." ";
+				} else {
+					$sql .= "DEFAULT '".$col["defaultValue"]."' ";
+				}
+
+			} elseif($col["defaultValue"] != false) {
+				$sql .= "DEFAULT '' ";
+			}
+			if($col["defaultValue"] != "NULL" && $col["defaultValue"] != "NOT NULL") {
+				if($col["notNull"] == true) {
+					$sql .= "NOT NULL ";
+				} else {
+					$sql .= "NULL ";
+				}
+			}
+			if($col["autoInc"] == true) $sql .= "auto_increment ";
+			$sql.= ",";
+			// key Definitionen
+			if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
+			if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
+			if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+		$sql .= ")";
+
+		$this->query($sql);
+		return true;
+	}
+
+	/*
+   $columns = array(action =>   add | alter | drop
+                    name =>     Spaltenname
+                    name_new => neuer Spaltenname, nur bei 'alter' belegt
+                    type =>     42go-Meta-Type: int16, int32, int64, double, char, varchar, text, blob
+                    typeValue => Wert z.B. bei Varchar
+                    defaultValue =>  Default Wert
+                    notNull =>   true | false
+                    autoInc =>   true | false
+                    option =>   unique | primary | index)
+
+
+   */
+	function alterTable($table_name, $columns) {
+		$index = "";
+		$sql = "ALTER TABLE $table_name ";
+		foreach($columns as $col){
+			if($col["action"] == 'add') {
+				$sql .= "ADD ".$col["name"]." ".$this->mapType($col["type"], $col["typeValue"])." ";
+			} elseif ($col["action"] == 'alter') {
+				$sql .= "CHANGE ".$col["name"]." ".$col["name_new"]." ".$this->mapType($col["type"], $col["typeValue"])." ";
+			} elseif ($col["action"] == 'drop') {
+				$sql .= "DROP ".$col["name"]." ";
+			}
+			if($col["action"] != 'drop') {
+				if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
+				if($col["notNull"] == true) {
+					$sql .= "NOT NULL ";
+				} else {
+					$sql .= "NULL ";
+				}
+				if($col["autoInc"] == true) $sql .= "auto_increment ";
+				$sql.= ",";
+				// key Definitionen
+				if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
+				if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
+				if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
+			}
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+
+		//die($sql);
+		$this->query($sql);
+		return true;
+	}
+
+	function dropTable($table_name) {
+		$this->check($table_name);
+		$sql = "DROP TABLE '". $table_name."'";
+		return $this->query($sql);
+	}
+
+	// gibt Array mit Tabellennamen zur�ck
+	function getTables($database_name = '') {
+
 		if($database_name == ''){
-            $database_name = $this->dbName;
-        }
-		
+			$database_name = $this->dbName;
+		}
+
 		$tables = $this->queryAllRecords("SHOW TABLES FROM `$database_name`");
 		$tb_names = array();
 		if(is_array($tables) && !empty($tables)){
@@ -367,7 +367,7 @@
 				$tb_names[$i] = $tables[$i]['Tables_in_'.$database_name];
 			}
 		}
-		
+
 		/*
         $result = mysqli_query("SHOW TABLES FROM `$database_name`");
         $tb_names = array();
@@ -375,11 +375,11 @@
             $tb_names[$i] = mysql_tablename($result, $i);
         }
 		*/
-        return $tb_names;       
-   }
-   
-   // gibt Feldinformationen zur Tabelle zur�ck
-   /*
+		return $tb_names;
+	}
+
+	// gibt Feldinformationen zur Tabelle zur�ck
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -389,101 +389,101 @@
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
-   */
-   
-   function tableInfo($table_name) {
-   
-   global $go_api,$go_info;
-   // Tabellenfelder einlesen
-    
-    if($rows = $go_api->db->queryAllRecords("SHOW FIELDS FROM ".$table_name)){
-    foreach($rows as $row) {
-        $name = $row[0];
-        $default = $row[4];
-        $key = $row[3];
-        $extra = $row[5];
-        $isnull = $row[2];
-        $type = $row[1];
-    
-        
-        $column = array();
-    
-        $column["name"] = $name;
-        //$column["type"] = $type;
-        $column["defaultValue"] = $default;
-        if(stristr($key,"PRI")) $column["option"] = "primary";
-        if(stristr($isnull,"YES")) {
-            $column["notNull"] = false;
-        } else {
-           $column["notNull"] = true; 
-        }
-        if($extra == 'auto_increment') $column["autoInc"] = true;
-        
-        
-        // Type in Metatype umsetzen
-        
-        if(stristr($type,"int(")) $metaType = 'int32';
-        if(stristr($type,"bigint")) $metaType = 'int64';
-        if(stristr($type,"char")) {
-            $metaType = 'char';
-            $tmp_typeValue = explode('(',$type);
-            $column["typeValue"] = substr($tmp_typeValue[1],0,-1);  
-        }
-        if(stristr($type,"varchar")) {
-            $metaType = 'varchar';
-            $tmp_typeValue = explode('(',$type);
-            $column["typeValue"] = substr($tmp_typeValue[1],0,-1);  
-        }
-        if(stristr($type,"text")) $metaType = 'text';
-        if(stristr($type,"double")) $metaType = 'double';
-        if(stristr($type,"blob")) $metaType = 'blob';
-        
-        
-        $column["type"] = $metaType;
-        
-    $columns[] = $column;
-    }
-        return $columns;
-    } else {
-        return false;
-    }
 
-   }
-   
-   function mapType($metaType,$typeValue) {
-   global $go_api;
-   $metaType = strtolower($metaType);
-   switch ($metaType) {
-   case 'int16':
-        return 'smallint';
-   break;
-   case 'int32':
-        return 'int';
-   break;
-   case 'int64':
-        return 'bigint';
-   break;
-   case 'double':
-        return 'double';
-   break;
-   case 'char':
-        return 'char';
-   break;
-   case 'varchar':
-        if($typeValue < 1) die("Datenbank Fehler: F�r diesen Datentyp ist eine L�ngenangabe notwendig.");
-        return 'varchar('.$typeValue.')';
-   break;
-   case 'text':
-        return 'text';
-   break;
-   case 'blob':
-        return 'blob';
-   break;
-   }
-   }
-	
+
+   */
+
+	function tableInfo($table_name) {
+
+		global $go_api, $go_info;
+		// Tabellenfelder einlesen
+
+		if($rows = $go_api->db->queryAllRecords("SHOW FIELDS FROM ".$table_name)){
+			foreach($rows as $row) {
+				$name = $row[0];
+				$default = $row[4];
+				$key = $row[3];
+				$extra = $row[5];
+				$isnull = $row[2];
+				$type = $row[1];
+
+
+				$column = array();
+
+				$column["name"] = $name;
+				//$column["type"] = $type;
+				$column["defaultValue"] = $default;
+				if(stristr($key, "PRI")) $column["option"] = "primary";
+				if(stristr($isnull, "YES")) {
+					$column["notNull"] = false;
+				} else {
+					$column["notNull"] = true;
+				}
+				if($extra == 'auto_increment') $column["autoInc"] = true;
+
+
+				// Type in Metatype umsetzen
+
+				if(stristr($type, "int(")) $metaType = 'int32';
+				if(stristr($type, "bigint")) $metaType = 'int64';
+				if(stristr($type, "char")) {
+					$metaType = 'char';
+					$tmp_typeValue = explode('(', $type);
+					$column["typeValue"] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, "varchar")) {
+					$metaType = 'varchar';
+					$tmp_typeValue = explode('(', $type);
+					$column["typeValue"] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, "text")) $metaType = 'text';
+				if(stristr($type, "double")) $metaType = 'double';
+				if(stristr($type, "blob")) $metaType = 'blob';
+
+
+				$column["type"] = $metaType;
+
+				$columns[] = $column;
+			}
+			return $columns;
+		} else {
+			return false;
+		}
+
+	}
+
+	function mapType($metaType, $typeValue) {
+		global $go_api;
+		$metaType = strtolower($metaType);
+		switch ($metaType) {
+		case 'int16':
+			return 'smallint';
+			break;
+		case 'int32':
+			return 'int';
+			break;
+		case 'int64':
+			return 'bigint';
+			break;
+		case 'double':
+			return 'double';
+			break;
+		case 'char':
+			return 'char';
+			break;
+		case 'varchar':
+			if($typeValue < 1) die("Datenbank Fehler: F�r diesen Datentyp ist eine L�ngenangabe notwendig.");
+			return 'varchar('.$typeValue.')';
+			break;
+		case 'text':
+			return 'text';
+			break;
+		case 'blob':
+			return 'blob';
+			break;
+		}
+	}
+
 }
 
 ?>
diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php
index b4e73ab..bc0453f 100644
--- a/install/lib/update.lib.php
+++ b/install/lib/update.lib.php
@@ -29,10 +29,12 @@
 
 //* Installer patch stub class
 class installer_patch_update {
-   protected function onBeforeSQL() {
-   }
-   protected function onAfterSQL() {
-   }
+	protected function onBeforeSQL() {
+	}
+
+	protected function onAfterSQL() {
+	}
+
 }
 
 //* DB dump function
@@ -70,25 +72,25 @@
 	} else {
 		$backup_db_name = '/root/ispconfig_db_backup_'.@date('Y-m-d_H-i').'.sql';
 	}
-	copy('existing_db.sql',$backup_db_name);
+	copy('existing_db.sql', $backup_db_name);
 	chmod($backup_db_name, 0700);
 	chown($backup_db_name, 'root');
 	chgrp($backup_db_name, 'root');
 
 	if ($conf['powerdns']['installed']) {
 		//** export the current PowerDNS database data
-        	if( !empty($conf["mysql"]["admin_password"]) ) {
-            		system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
-        	} else {
-            		system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
-        	}
+		if( !empty($conf["mysql"]["admin_password"]) ) {
+			system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
+		} else {
+			system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
+		}
 
 		// create a backup copy of the PowerDNS database in the root folder
 		$backup_db_name = '/root/ispconfig_powerdns_db_backup_'.@date('Y-m-d_h-i').'.sql';
-	        copy('existing_powerdns_db.sql',$backup_db_name);
+		copy('existing_powerdns_db.sql', $backup_db_name);
 		chmod($backup_db_name, 0700);
-	        chown($backup_db_name, 'root');
-	        chgrp($backup_db_name, 'root');
+		chown($backup_db_name, 'root');
+		chgrp($backup_db_name, 'root');
 	}
 }
 
@@ -115,7 +117,7 @@
 		sread();
 	}
 	else
-	  echo "OK\n";
+		echo "OK\n";
 }
 
 function updateDbAndIni() {
@@ -136,9 +138,9 @@
 	$conf['services']['vserver'] = ($tmp['vserver_server'] == 1)?true:false;
 	$conf['services']['proxy'] = (isset($tmp['proxy_server']) && $tmp['proxy_server'] == 1)?true:false;
 	$conf['services']['firewall'] = (isset($tmp['firewall_server']) && $tmp['firewall_server'] == 1)?true:false;
-	
+
 	$conf['postfix']['vmail_mailbox_base'] = $ini_array['mail']['homedir_path'];
-	
+
 	if(isset($ini_array['web']['server_type']) && $ini_array['web']['server_type'] != ''){
 		$conf['webserver']['server_type'] = $ini_array['web']['server_type'];
 		if($conf['webserver']['server_type'] == 'nginx'){
@@ -150,38 +152,38 @@
 		$conf['webserver']['server_type'] = 'apache';
 		$conf['nginx']['installed'] = false;
 	}
-	
+
 	//* Do incremental DB updates only on installed ISPConfig versions > 3.0.3
-	if(compare_ispconfig_version('3.0.3',ISPC_APP_VERSION) >= 0) {
-		
+	if(compare_ispconfig_version('3.0.3', ISPC_APP_VERSION) >= 0) {
+
 		swriteln($inst->lng('Starting incremental database update.'));
-		
-		//* get the version of the db schema from the server table 
+
+		//* get the version of the db schema from the server table
 		$found = true;
 		while($found == true) {
 			$next_db_version = intval($current_db_version + 1);
 			$sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
 			$php_patch_filename = realpath(dirname(__FILE__).'/../').'/patches/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.php';
-			
+
 			if(is_file($sql_patch_filename)) {
-				
+
 				//* Load php patch file and instantiate object
 				if(is_file($php_patch_filename)) {
 					$php_patch_class_name = 'upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT);
-					include_once($php_patch_filename);
+					include_once $php_patch_filename;
 					if(class_exists($php_patch_class_name)) {
 						$php_patch = new $php_patch_class_name;
 					} else {
 						swriteln($inst->lng('WARNING: PHP patch file').': '.$php_patch_filename.' '.$inst->lng('contains errors.'));
 					}
 				}
-				
+
 				//* Exec onBeforeSQL function
 				if(isset($php_patch) && is_object($php_patch)) {
 					$php_patch->onBeforeSQL();
 					swriteln($inst->lng('Executing PHP patch file').': '.$php_patch_filename);
 				}
-				
+
 				//* Load patch file into database
 				if( !empty($conf["mysql"]["admin_password"]) ) {
 					system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename);
@@ -189,32 +191,32 @@
 					system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename);
 				}
 				swriteln($inst->lng('Loading SQL patch file').': '.$sql_patch_filename);
-				
+
 				//* Exec onAfterSQL function
 				if(isset($php_patch) && is_object($php_patch)) {
 					$php_patch->onAfterSQL();
 				}
-				
+
 				$current_db_version = $next_db_version;
 				if(isset($php_patch)) unset($php_patch);
 			} else {
 				$found = false;
 			}
 		}
-		
+
 		//* update the database version in server table
 		$inst->db->query("UPDATE ".$conf["mysql"]["database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
 		if($inst->db->dbHost != $inst->dbmaster->dbHost) $inst->dbmaster->query("UPDATE ".$conf["mysql"]["master_database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
-		
-	
-	//* If ISPConfig Version < 3.0.3, we will do a full db update
+
+
+		//* If ISPConfig Version < 3.0.3, we will do a full db update
 	} else {
-		
+
 		swriteln($inst->lng('Starting full database update.'));
-		
+
 		//** Delete the old database
 		if( !$inst->db->query('DROP DATABASE IF EXISTS '.$conf['mysql']['database']) ) {
-		$inst->error('Unable to drop MySQL database: '.$conf['mysql']['database'].'.');
+			$inst->error('Unable to drop MySQL database: '.$conf['mysql']['database'].'.');
 		}
 
 		//** Create the mysql database
@@ -233,7 +235,7 @@
 		} else {
 			system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < existing_db.sql");
 		}
-		
+
 		//** Get the database version number based on the patchfile
 		$found = true;
 		while($found == true) {
@@ -245,29 +247,29 @@
 				$found = false;
 			}
 		}
-		
+
 		//* update the database version in server table
 		$inst->db->query("UPDATE ".$conf["mysql"]["database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
 		if($inst->db->dbHost != $inst->dbmaster->dbHost) $inst->dbmaster->query("UPDATE ".$conf["mysql"]["master_database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
 
 		if ($conf['powerdns']['installed']) {
-                                                 
+
 			swriteln($inst->lng('Starting full PowerDNS database update.'));
 
-            //** Delete the old PowerDNS database
-            if( !$inst->db->query('DROP DATABASE IF EXISTS '.$conf['powerdns']['database']) ) {
+			//** Delete the old PowerDNS database
+			if( !$inst->db->query('DROP DATABASE IF EXISTS '.$conf['powerdns']['database']) ) {
 				$inst->error('Unable to drop MySQL database: '.$conf['powerdns']['database'].'.');
-            }
+			}
 
-            //** Create the mysql database
-            $inst->configure_powerdns();
+			//** Create the mysql database
+			$inst->configure_powerdns();
 
-            //** load old data back into the PowerDNS database
-            if( !empty($conf["mysql"]["admin_password"]) ) {
-            	system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['powerdns']['database'])." < existing_powerdns_db.sql");
-            } else {
-            	system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['powerdns']['database'])." < existing_powerdns_db.sql");
-            }
+			//** load old data back into the PowerDNS database
+			if( !empty($conf["mysql"]["admin_password"]) ) {
+				system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['powerdns']['database'])." < existing_powerdns_db.sql");
+			} else {
+				system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['powerdns']['database'])." < existing_powerdns_db.sql");
+			}
 		}
 	}
 
@@ -277,7 +279,7 @@
 	$old_ini_array = ini_to_array(stripslashes($tmp_server_rec['config']));
 	unset($tmp_server_rec);
 	$tpl_ini_array = ini_to_array(rf('tpl/server.ini.master'));
-	
+
 	//* Update further distribution specific parameters for server config here
 	//* HINT: Every line added here has to be added in installer_base.lib.php too!!
 	$tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs'];
@@ -302,7 +304,7 @@
 	$tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir'];
 	$tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path'];
 	$tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path'];
-	
+
 	$tpl_ini_array['web']['nginx_vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir'];
 	$tpl_ini_array['web']['nginx_vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir'];
 	$tpl_ini_array['web']['nginx_user'] = $conf['nginx']['user'];
@@ -313,7 +315,7 @@
 	$tpl_ini_array['web']['php_fpm_pool_dir'] = $conf['nginx']['php_fpm_pool_dir'];
 	$tpl_ini_array['web']['php_fpm_start_port'] = $conf['nginx']['php_fpm_start_port'];
 	$tpl_ini_array['web']['php_fpm_socket_dir'] = $conf['nginx']['php_fpm_socket_dir'];
-		
+
 	if ($conf['nginx']['installed'] == true) {
 		$tpl_ini_array['web']['server_type'] = 'nginx';
 		$tpl_ini_array['global']['webserver'] = 'nginx';
@@ -331,7 +333,7 @@
 	$new_ini = array_to_ini($tpl_ini_array);
 	$sql = "UPDATE ".$conf["mysql"]["database"].".server SET config = '".mysql_real_escape_string($new_ini)."' WHERE server_id = ".$conf['server_id'];
 	$inst->db->query($sql);
-	
+
 	if($inst->db->dbHost != $inst->dbmaster->dbHost) {
 		$sql = "UPDATE ".$conf["mysql"]["master_database"].".server SET config = '".mysql_real_escape_string($new_ini)."' WHERE server_id = ".$conf['server_id'];
 		$inst->dbmaster->query($sql);
diff --git a/install/patches/upd_0001.php b/install/patches/upd_0001.php
index 93d6967..596bef5 100644
--- a/install/patches/upd_0001.php
+++ b/install/patches/upd_0001.php
@@ -1,6 +1,6 @@
 <?php
 
-if(!defined('INSTALLER_RUN')) die('Patch update file access violation.'); 
+if(!defined('INSTALLER_RUN')) die('Patch update file access violation.');
 
 /*
 	Example installer patch update class. the classname must match
@@ -10,12 +10,14 @@
 
 class upd_0001 extends installer_patch_update {
 
-   public function onBeforeSQL() {
-     // Do something
-   }
-   public function onAfterSQL() {
-     // Do something
-   }
+	public function onBeforeSQL() {
+		// Do something
+	}
+
+	public function onAfterSQL() {
+		// Do something
+	}
+
 }
 
 ?>
diff --git a/install/setrights.php b/install/setrights.php
index 1124136..275401a 100644
--- a/install/setrights.php
+++ b/install/setrights.php
@@ -34,7 +34,7 @@
 error_reporting(E_ALL|E_STRICT);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -43,17 +43,17 @@
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-	echo "\n".str_repeat('-',80)."\n";
-	echo "\n\n>>This script tries to repair the client rights  \n\n";
+echo "\n".str_repeat('-', 80)."\n";
+echo "\n\n>>This script tries to repair the client rights  \n\n";
 
 //** Include the library with the basic installer functions
-require_once('lib/install.lib.php');
+require_once 'lib/install.lib.php';
 
 //** Include the library with the basic updater functions
-require_once('lib/update.lib.php');
+require_once 'lib/update.lib.php';
 
 //** Include the base class of the installer class
-require_once('lib/installer_base.lib.php');
+require_once 'lib/installer_base.lib.php';
 
 //** Ensure that current working directory is install directory
 $cur_dir = getcwd();
@@ -62,16 +62,16 @@
 //** Get distribution identifier
 $dist = get_distname();
 
-include_once("/usr/local/ispconfig/server/lib/config.inc.php");
+include_once "/usr/local/ispconfig/server/lib/config.inc.php";
 $conf_old = $conf;
 unset($conf);
 
 if($dist['id'] == '') die('Linux distribution or version not recognized.');
 
 //** Include the distribution-specific installer class library and configuration
-if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
-include_once('dist/lib/'.$dist['id'].'.lib.php');
-include_once('dist/conf/'.$dist['id'].'.conf.php');
+if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
+include_once 'dist/lib/'.$dist['id'].'.lib.php';
+include_once 'dist/conf/'.$dist['id'].'.conf.php';
 
 //** Get hostname
 exec('hostname -f', $tmp_out);
@@ -87,15 +87,15 @@
 /*
  * Try to read the DB-admin settings
  */
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
-include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf");
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
+include_once "/usr/local/ispconfig/server/lib/mysql_clientdb.conf";
 $conf["mysql"]["admin_user"] = $clientdb_user;
 $conf["mysql"]["admin_password"] = $clientdb_password;
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
 
 //** There is a error if user for mysql admin_password if empty
 if( empty($conf["mysql"]["admin_password"]) ) {
@@ -105,7 +105,7 @@
 $inst = new installer();
 
 //** Initialize the MySQL server connection
-include_once('lib/mysql.lib.php');
+include_once 'lib/mysql.lib.php';
 
 //* initialize the database
 $inst->db = new db();
diff --git a/install/uninstall-fedora.php b/install/uninstall-fedora.php
index 4da4347..66eb300 100644
--- a/install/uninstall-fedora.php
+++ b/install/uninstall-fedora.php
@@ -35,7 +35,7 @@
 error_reporting(E_ALL|E_STRICT);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -44,11 +44,11 @@
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Uninstall  \n\n";
 
-require("/usr/local/ispconfig/server/lib/config.inc.php");
-require("/usr/local/ispconfig/server/lib/app.inc.php");
+require "/usr/local/ispconfig/server/lib/config.inc.php";
+require "/usr/local/ispconfig/server/lib/app.inc.php";
 
 // Delete the ISPConfig database
 // $app->db->query("DROP DATABASE '".$conf["db_database"]."'");
diff --git a/install/uninstall.php b/install/uninstall.php
index 415ecf4..96d98c7 100644
--- a/install/uninstall.php
+++ b/install/uninstall.php
@@ -35,7 +35,7 @@
 error_reporting(E_ALL|E_STRICT);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -44,11 +44,11 @@
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Uninstall  \n\n";
 
-require("/usr/local/ispconfig/server/lib/config.inc.php");
-require("/usr/local/ispconfig/server/lib/app.inc.php");
+require "/usr/local/ispconfig/server/lib/config.inc.php";
+require "/usr/local/ispconfig/server/lib/app.inc.php";
 
 // Delete the ISPConfig database
 // $app->db->query("DROP DATABASE '".$conf["db_database"]."'");
diff --git a/install/update.php b/install/update.php
index e5bcfb6..5cc2f42 100644
--- a/install/update.php
+++ b/install/update.php
@@ -37,7 +37,7 @@
 define('INSTALLER_RUN', true);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -46,17 +46,17 @@
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Update  \n\n";
 
 //** Include the library with the basic installer functions
-require_once('lib/install.lib.php');
+require_once 'lib/install.lib.php';
 
 //** Include the library with the basic updater functions
-require_once('lib/update.lib.php');
+require_once 'lib/update.lib.php';
 
 //** Include the base class of the installer class
-require_once('lib/installer_base.lib.php');
+require_once 'lib/installer_base.lib.php';
 
 //** Ensure that current working directory is install directory
 $cur_dir = getcwd();
@@ -74,16 +74,16 @@
 //** Get distribution identifier
 $dist = get_distname();
 
-include_once("/usr/local/ispconfig/server/lib/config.inc.php");
+include_once "/usr/local/ispconfig/server/lib/config.inc.php";
 $conf_old = $conf;
 unset($conf);
 
 if($dist['id'] == '') die('Linux distribution or version not recognized.');
 
 //** Include the distribution-specific installer class library and configuration
-if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
-include_once('dist/lib/'.$dist['id'].'.lib.php');
-include_once('dist/conf/'.$dist['id'].'.conf.php');
+if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
+include_once 'dist/lib/'.$dist['id'].'.lib.php';
+include_once 'dist/conf/'.$dist['id'].'.conf.php';
 
 //** Get hostname
 exec('hostname -f', $tmp_out);
@@ -128,52 +128,52 @@
 echo "This application will update ISPConfig 3 on your server.\n\n";
 
 //* Make a backup before we start the update
-$do_backup = $inst->simple_query('Shall the script create a ISPConfig backup in /var/backup/ now?', array('yes','no'),'yes');
+$do_backup = $inst->simple_query('Shall the script create a ISPConfig backup in /var/backup/ now?', array('yes', 'no'), 'yes');
 if($do_backup == 'yes') {
-	
+
 	//* Create the backup directory
 	$backup_path = '/var/backup/ispconfig_'.@date('Y-m-d_H-i');
 	$conf['backup_path'] = $backup_path;
 	exec("mkdir -p $backup_path");
 	exec("chown root:root $backup_path");
 	exec("chmod 700 $backup_path");
-	
+
 	//* Do the backup
 	swriteln('Creating backup of "/usr/local/ispconfig" directory...');
-	exec("tar pcfz $backup_path/ispconfig_software.tar.gz /usr/local/ispconfig 2> /dev/null",$out,$returnvar);
+	exec("tar pcfz $backup_path/ispconfig_software.tar.gz /usr/local/ispconfig 2> /dev/null", $out, $returnvar);
 	if($returnvar != 0) die("Backup failed. We stop here...\n");
-	
+
 	swriteln('Creating backup of "/etc" directory...');
-	exec("tar pcfz $backup_path/etc.tar.gz /etc 2> /dev/null",$out,$returnvar);
+	exec("tar pcfz $backup_path/etc.tar.gz /etc 2> /dev/null", $out, $returnvar);
 	if($returnvar != 0) die("Backup failed. We stop here...\n");
-	
+
 	exec("chown root:root $backup_path/*.tar.gz");
 	exec("chmod 700 $backup_path/*.tar.gz");
 }
 
 
 //** Initialize the MySQL server connection
-include_once('lib/mysql.lib.php');
+include_once 'lib/mysql.lib.php';
 
 //** Database update is a bit brute force and should be rebuild later ;)
 
 /*
  * Try to read the DB-admin settings
  */
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
-include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf");
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
+include_once "/usr/local/ispconfig/server/lib/mysql_clientdb.conf";
 $conf["mysql"]["admin_user"] = $clientdb_user;
 $conf["mysql"]["admin_password"] = $clientdb_password;
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
 
 //** Test mysql root connection
 $finished = false;
 do {
-	if(@mysql_connect($conf["mysql"]["host"],$conf["mysql"]["admin_user"],$conf["mysql"]["admin_password"])) {
+	if(@mysql_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) {
 		$finished = true;
 	} else {
 		swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
@@ -183,7 +183,7 @@
 unset($finished);
 
 /*
- *  Prepare the dump of the database 
+ *  Prepare the dump of the database
  */
 prepareDBDump();
 
@@ -192,34 +192,34 @@
 
 //* initialize the master DB, if we have a multiserver setup
 if($conf['mysql']['master_slave_setup'] == 'y') {
-		//** Get MySQL root credentials
-		$finished = false;
-		do {
-			$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']);
-			$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']);
-			$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']);
-    		$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']);
-	
-			//* Initialize the MySQL server connection
-			if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
-				$conf['mysql']['master_host'] = $tmp_mysql_server_host;
-				$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
-				$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
-				$conf['mysql']['master_database'] = $tmp_mysql_server_database;
-				$finished = true;
-			} else {
-				swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
-			}
-		} while ($finished == false);
-		unset($finished);
-		
-		// initialize the connection to the master database
-		$inst->dbmaster = new db();
-		if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
-		$inst->dbmaster->dbHost = $conf['mysql']["master_host"];
-		$inst->dbmaster->dbName = $conf['mysql']["master_database"];
-		$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
-		$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
+	//** Get MySQL root credentials
+	$finished = false;
+	do {
+		$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']);
+		$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']);
+		$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']);
+		$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']);
+
+		//* Initialize the MySQL server connection
+		if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
+			$conf['mysql']['master_host'] = $tmp_mysql_server_host;
+			$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
+			$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
+			$conf['mysql']['master_database'] = $tmp_mysql_server_database;
+			$finished = true;
+		} else {
+			swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
+		}
+	} while ($finished == false);
+	unset($finished);
+
+	// initialize the connection to the master database
+	$inst->dbmaster = new db();
+	if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
+	$inst->dbmaster->dbHost = $conf['mysql']["master_host"];
+	$inst->dbmaster->dbName = $conf['mysql']["master_database"];
+	$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
+	$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
 } else {
 	$inst->dbmaster = $inst->db;
 }
@@ -240,28 +240,28 @@
  * If this is done at server side, all clients are updated.
  */
 //if($conf_old['dbmaster_user'] != '' or $conf_old['dbmaster_host'] != '') {
-	//** Update master database rights
-	$reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes','no'),'no');
+//** Update master database rights
+$reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes', 'no'), 'no');
 
-	if($reconfigure_master_database_rights_answer == 'yes') {
-		$inst->grant_master_database_rights();
-	}
+if($reconfigure_master_database_rights_answer == 'yes') {
+	$inst->grant_master_database_rights();
+}
 //}
 
 //** Shall the services be reconfigured during update
-$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes','no'),'yes');
+$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes', 'no'), 'yes');
 
 if($reconfigure_services_answer == 'yes') {
-	
+
 	if($conf['services']['mail']) {
 		//** Configure postfix
 		swriteln('Configuring Postfix');
 		$inst->configure_postfix('dont-create-certs');
-		
+
 		//** Configure mailman
 		swriteln('Configuring Mailman');
 		$inst->configure_mailman('update');
-	
+
 		//* Configure Jailkit
 		swriteln('Configuring Jailkit');
 		$inst->configure_jailkit();
@@ -274,11 +274,11 @@
 			//** Configure saslauthd
 			swriteln('Configuring SASL');
 			$inst->configure_saslauthd();
-	
+
 			//** Configure PAM
 			swriteln('Configuring PAM');
 			$inst->configure_pam();
-		
+
 			//* Configure courier
 			swriteln('Configuring Courier');
 			$inst->configure_courier();
@@ -296,13 +296,13 @@
 		swriteln('Configuring Getmail');
 		$inst->configure_getmail();
 	}
-	
+
 	if($conf['services']['web'] && $conf['pureftpd']['installed'] == true) {
 		//** Configure Pureftpd
 		swriteln('Configuring Pureftpd');
 		$inst->configure_pureftpd();
 	}
-	
+
 	if($conf['services']['dns']) {
 		//* Configure DNS
 		if($conf['powerdns']['installed'] == true) {
@@ -316,13 +316,13 @@
 			$inst->configure_mydns();
 		}
 	}
-	
+
 	if($conf['services']['web']) {
 		if($conf['webserver']['server_type'] == 'apache'){
 			//** Configure Apache
 			swriteln('Configuring Apache');
 			$inst->configure_apache();
-        
+
 			//** Configure vlogger
 			swriteln('Configuring vlogger');
 			$inst->configure_vlogger();
@@ -331,7 +331,7 @@
 			swriteln('Configuring nginx');
 			$inst->configure_nginx();
 		}
-		
+
 		//** Configure apps vhost
 		swriteln('Configuring Apps vhost');
 		$inst->configure_apps_vhost();
@@ -342,7 +342,7 @@
 	swriteln('Configuring Database');
 	$inst->configure_dbserver();
 
-	
+
 	if($conf['services']['firewall']) {
 		if($conf['bastille']['installed'] == true) {
 			//* Configure Bastille Firewall
@@ -350,7 +350,7 @@
 			$inst->configure_firewall();
 		}
 	}
-	
+
 	/*
 	if($conf['squid']['installed'] == true) {
 		swriteln('Configuring Squid');
@@ -379,10 +379,10 @@
 	} else {
 		$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number);
 	}
-	
-	
+
+
 	// $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n';
-	if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate',array('yes','no'),'no')) == 'yes') {
+	if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate', array('yes', 'no'), 'no')) == 'yes') {
 		$inst->make_ispconfig_ssl_cert();
 	}
 }
@@ -390,7 +390,7 @@
 $inst->install_ispconfig();
 
 //** Configure Crontab
-$update_crontab_answer = $inst->simple_query('Reconfigure Crontab?', array('yes','no'),'yes');
+$update_crontab_answer = $inst->simple_query('Reconfigure Crontab?', array('yes', 'no'), 'yes');
 if($update_crontab_answer == 'yes') {
 	swriteln('Updating Crontab');
 	$inst->install_crontab();
@@ -429,14 +429,14 @@
 		if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null');
 		if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null');
 	}
-	
+
 	if($conf['services']['proxy']) {
-		// if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script']))					system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
+		// if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script']))     system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
 		if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');
 	}
-	
+
 	if($conf['services']['firewall']) {
-		//if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['ufw']['init_script']))					system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
+		//if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['ufw']['init_script']))     system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
 	}
 }
 
diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index e0b237b..e1929d3 100755
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -64,15 +64,15 @@
 
 		//* Start the session
 		if($this->_conf['start_session'] == true) {
-			
+
 			$this->uses('session');
-			session_set_save_handler(	array($this->session, 'open'),
-										array($this->session, 'close'),
-										array($this->session, 'read'),
-										array($this->session, 'write'),
-										array($this->session, 'destroy'),
-										array($this->session, 'gc'));
-			
+			session_set_save_handler( array($this->session, 'open'),
+				array($this->session, 'close'),
+				array($this->session, 'read'),
+				array($this->session, 'write'),
+				array($this->session, 'destroy'),
+				array($this->session, 'gc'));
+
 			session_start();
 
 			//* Initialize session variables
@@ -81,10 +81,10 @@
 			if(empty($_SESSION['s']['language'])) $_SESSION['s']['language'] = $conf['language'];
 		}
 
-        $this->uses('functions'); // we need this before all others!
+		$this->uses('functions'); // we need this before all others!
 		$this->uses('auth,plugin');
 	}
-	
+
 	public function __destruct() {
 		session_write_close();
 	}
@@ -96,7 +96,7 @@
 				$classname = trim($classname);
 				//* Class is not loaded so load it
 				if(!array_key_exists($classname, $this->_loaded_classes)) {
-					include_once(ISPC_CLASS_PATH."/$classname.inc.php");
+					include_once ISPC_CLASS_PATH."/$classname.inc.php";
 					$this->$classname = new $classname();
 					$this->_loaded_classes[$classname] = true;
 				}
@@ -109,12 +109,14 @@
 		if(is_array($fl)) {
 			foreach($fl as $file) {
 				$file = trim($file);
-				include_once(ISPC_CLASS_PATH."/$file.inc.php");
+				include_once ISPC_CLASS_PATH."/$file.inc.php";
 			}
 		}
 	}
 
 	/** Priority values are: 0 = DEBUG, 1 = WARNING,  2 = ERROR */
+
+
 	public function log($msg, $priority = 0) {
 		global $conf;
 		if($priority >= $this->_conf['log_priority']) {
@@ -196,12 +198,12 @@
 	//** Helper function to load the language files.
 	public function load_language_file($filename) {
 		$filename = ISPC_ROOT_PATH.'/'.$filename;
-		if(substr($filename,-4) != '.lng') $this->error('Language file has wrong extension.');
+		if(substr($filename, -4) != '.lng') $this->error('Language file has wrong extension.');
 		if(file_exists($filename)) {
-			@include($filename);
+			@include $filename;
 			if(is_array($wb)) {
 				if(is_array($this->_wb)) {
-					$this->_wb = array_merge($this->_wb,$wb);
+					$this->_wb = array_merge($this->_wb, $wb);
 				} else {
 					$this->_wb = $wb;
 				}
@@ -213,12 +215,12 @@
 		$this->tpl->setVar('app_title', $this->_conf['app_title']);
 		if(isset($_SESSION['s']['user'])) {
 			$this->tpl->setVar('app_version', $this->_conf['app_version']);
-            // get pending datalog changes
-            $datalog = $this->db->datalogStatus();
-            $this->tpl->setVar('datalog_changes_txt', $this->lng('datalog_changes_txt'));
-            $this->tpl->setVar('datalog_changes_end_txt', $this->lng('datalog_changes_end_txt'));
-            $this->tpl->setVar('datalog_changes_count', $datalog['count']);
-            $this->tpl->setLoop('datalog_changes', $datalog['entries']);
+			// get pending datalog changes
+			$datalog = $this->db->datalogStatus();
+			$this->tpl->setVar('datalog_changes_txt', $this->lng('datalog_changes_txt'));
+			$this->tpl->setVar('datalog_changes_end_txt', $this->lng('datalog_changes_end_txt'));
+			$this->tpl->setVar('datalog_changes_count', $datalog['count']);
+			$this->tpl->setLoop('datalog_changes', $datalog['entries']);
 		} else {
 			$this->tpl->setVar('app_version', '');
 		}
@@ -253,13 +255,13 @@
 			$this->tpl->setVar('cpuser', $_SESSION['s']['user']['username']);
 			$this->tpl->setVar('logout_txt', $this->lng('logout_txt'));
 			/* Show search field only for normal users, not mail users */
-			if(stristr($_SESSION['s']['user']['username'],'@')){
+			if(stristr($_SESSION['s']['user']['username'], '@')){
 				$this->tpl->setVar('usertype', 'mailuser');
 			} else {
 				$this->tpl->setVar('usertype', 'normaluser');
 			}
 		}
-		
+
 		/* Global Search */
 		$this->tpl->setVar('globalsearch_resultslimit_of_txt', $this->lng('globalsearch_resultslimit_of_txt'));
 		$this->tpl->setVar('globalsearch_resultslimit_results_txt', $this->lng('globalsearch_resultslimit_results_txt'));
diff --git a/interface/lib/classes/aps_base.inc.php b/interface/lib/classes/aps_base.inc.php
index 4c1512b..c4aaf52 100644
--- a/interface/lib/classes/aps_base.inc.php
+++ b/interface/lib/classes/aps_base.inc.php
@@ -43,61 +43,69 @@
 
 class ApsBase
 {
-    protected $log_prefix = '';
-    protected $fetch_url = '';
-    protected $aps_version = '';
-    protected $packages_dir = '';
-    protected $temp_pkg_dir = '';
-    protected $interface_pkg_dir = '';
-    protected $interface_mode = false; // server mode by default
+	protected $log_prefix = '';
+	protected $fetch_url = '';
+	protected $aps_version = '';
+	protected $packages_dir = '';
+	protected $temp_pkg_dir = '';
+	protected $interface_pkg_dir = '';
+	protected $interface_mode = false; // server mode by default
 
-    /**
-     * Constructor
-     *
-     * @param $app the application instance (db handle + log method)
-     * @param $interface_mode act in interface (true) or server mode (false)
-     * @param $log_prefix a prefix to set before all log entries
-     */
-    public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
-    {
-        $this->log_prefix = $log_prefix;
-        $this->interface_mode = $interface_mode;
-        $this->fetch_url = 'apscatalog.com';
-        $this->aps_version = '1';
-        $this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
-        $this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
-    }
-    
-    /**
-     * Converts a given value to it's native representation in 1024 units
-     * 
-     * @param $value the size to convert
-     * @return integer and string 
-     */
-    public function convertSize($value)
-    {
-        $unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
-        return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
-    }
-    
-    /**
-     * Determine a specific xpath from a given SimpleXMLElement handle. If the
-     * element is found, it's string representation is returned. If not,
-     * the return value will stay empty
-     *
-     * @param $xml_handle the SimpleXMLElement handle
-     * @param $query the XPath query
-     * @param $array define whether to return an array or a string
-     * @return $ret the return string
-     */
-    protected function getXPathValue($xml_handle, $query, $array = false)
-    {
-        $ret = '';
-        
-        $xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
-        if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
-        
-        return $ret;
-    }
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle + log method)
+	 * @param $interface_mode act in interface (true) or server mode (false)
+	 * @param $log_prefix a prefix to set before all log entries
+	 */
+
+
+	public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
+	{
+		$this->log_prefix = $log_prefix;
+		$this->interface_mode = $interface_mode;
+		$this->fetch_url = 'apscatalog.com';
+		$this->aps_version = '1';
+		$this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
+		$this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
+	}
+
+
+
+	/**
+	 * Converts a given value to it's native representation in 1024 units
+	 *
+	 * @param $value the size to convert
+	 * @return integer and string
+	 */
+	public function convertSize($value)
+	{
+		$unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
+		return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
+	}
+
+
+
+	/**
+	 * Determine a specific xpath from a given SimpleXMLElement handle. If the
+	 * element is found, it's string representation is returned. If not,
+	 * the return value will stay empty
+	 *
+	 * @param $xml_handle the SimpleXMLElement handle
+	 * @param $query the XPath query
+	 * @param $array define whether to return an array or a string
+	 * @return $ret the return string
+	 */
+	protected function getXPathValue($xml_handle, $query, $array = false)
+	{
+		$ret = '';
+
+		$xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
+		if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
+
+		return $ret;
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/lib/classes/aps_crawler.inc.php b/interface/lib/classes/aps_crawler.inc.php
index 2c6906e..8260f34 100644
--- a/interface/lib/classes/aps_crawler.inc.php
+++ b/interface/lib/classes/aps_crawler.inc.php
@@ -27,264 +27,277 @@
 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('aps_base.inc.php');
+require_once 'aps_base.inc.php';
 
 @set_time_limit(0);
 @ignore_user_abort(1);
 
 class ApsCrawler extends ApsBase
 {
-   
-   //public $app_download_url_list = array();
-   
-   /**
-    * Constructor
-    *
-    * @param $app the application instance (db handle + log method)
-    * @param $interface_mode act in interface (true) or server mode (false)
-    */
-    public function __construct($app, $interface_mode = false)
-    {
-        parent::__construct($app, 'APS crawler: ', $interface_mode);
-    }
-    
-    /**
-     * Before the cron is executed, make sure all necessary options are set
-     * and all functions (i.e. cURL) are available
-     */
-    private function checkRequirements()
-    {
-        global $app;
-        
-        try
-        {
-            // Check if allow_url_fopen is enabled
-            if(!@ini_get('allow_url_fopen')) throw new Exception('allow_url_fopen is not enabled');
-            // Check if the cURL module is available
-            if(!function_exists('curl_version')) throw new Exception('cURL is not available');
-            
-            // Check if used folders are writable
-            if($this->interface_mode)
-            {
-                if(!is_writable($this->interface_pkg_dir)) 
-                    throw new Exception('the folder '.basename($this->interface_pkg_dir).' is not writable');  
-            }   
-            else 
-            {
-                if(!is_writable($this->packages_dir)) 
-                    throw new Exception('the folder '.basename($this->packages_dir).' is not writable');
-            }
-            
-            return true;
-        }
-        catch(Exception $e)
-        {
-            $app->log($this->log_prefix.'Aborting execution because '.$e->getMessage(), LOGLEVEL_ERROR);
-            return false;
-        }
-    }
-    
-    /**
-     * Remove a directory recursively
-     * In case of error be silent
-     * 
-     * @param $dir the directory to remove
-     */
-    private function removeDirectory($dir)
-    {
-        if(is_dir($dir))
-        {
-            $files = scandir($dir);
-            foreach($files as $file)
-            {
-                if($file != '.' && $file != '..')
-                    if(filetype($dir.'/'.$file) == 'dir') $this->removeDirectory($dir.'/'.$file); 
-                    else @unlink($dir.'/'.$file);
-            }
-            reset($files);
-            @rmdir($dir);
-        }
-    }
 
-    
-    /**
-     * Fetch HTML data from one or more given URLs
-     * If a string is given, a string is returned, if an array of URLs should
-     * be fetched, the responses of the parallel queries are returned as array
-     *
-     * @param $input the string or array to fetch
-     * @return $ret a query response string or array
-     */
-    private function fetchPage($input)
-    {
-        $ret = array();
-        $url = array();
-        $conn = array();
+	//public $app_download_url_list = array();
 
-        // Make sure we are working with an array, further on
-        if(!is_array($input)) $url[] = $input;
-        else $url = $input;
-        
-        // Build the single cURL handles and add them to a multi handle
-        $mh = curl_multi_init();
-        for($i = 0; $i < count($url); $i++)
-        {
-            $conn[$i] = curl_init('http://'.$this->fetch_url.$url[$i]);
-            curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, true);
-            curl_multi_add_handle($mh, $conn[$i]);
-        }
-        
-        $active = 0;
-        do curl_multi_exec($mh, $active);
-        while($active > 0);
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle + log method)
+	 * @param $interface_mode act in interface (true) or server mode (false)
+	 */
 
-        // Get the response(s)
-        for($i = 0; $i < count($url); $i++)
-        {
-            $ret[$i] = curl_multi_getcontent($conn[$i]);
-            curl_multi_remove_handle($mh, $conn[$i]);
-            curl_close($conn[$i]);
-        }
-        curl_multi_close($mh);
-        
-        if(count($url) == 1) $ret = $ret[0];
-        
-        return $ret;
-    }
-    
-    /**
-     * Fetch binary data from a given array
-     * The data is retrieved in binary mode and 
-     * then directly written to an output file
-     *
-     * @param $input a specially structed array
-     * @see $this->startUpdate()
-     */
-    private function fetchFiles($input)
-    {
-        $fh = array();
-        $url = array();
-        $conn = array();
 
-        // Build the single cURL handles and add them to a multi handle
-        $mh = curl_multi_init();
-        
-        // Process each app 
-        for($i = 0; $i < count($input); $i++)
-        {
-            $conn[$i] = curl_init($input[$i]['url']);
-            $fh[$i] = fopen($input[$i]['localtarget'], 'wb'); 
-            
-            curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true);
-            curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]);
-            curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
-            curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
-            curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1); 
-            
-            curl_multi_add_handle($mh, $conn[$i]);
-        }
-        
-        $active = 0;
-        do curl_multi_exec($mh, $active);
-        while($active > 0);
+	public function __construct($app, $interface_mode = false)
+	{
+		parent::__construct($app, 'APS crawler: ', $interface_mode);
+	}
 
-        // Close the handles
-        for($i = 0; $i < count($input); $i++)
-        {
-            fclose($fh[$i]);
-            curl_multi_remove_handle($mh, $conn[$i]);
-            curl_close($conn[$i]);
-        }
-        curl_multi_close($mh);
-    }
-    
-    /**
-     * A method to build query URLs out of a list of vendors
-     *
-    */
-    private function formatVendorCallback($array_item)
-    {
-        $array_item = str_replace(' ', '%20', $array_item);
-        $array_item = str_replace('http://', '', $array_item);
-        $array_item = '/'.$this->aps_version.'.atom?vendor='.$array_item.'&pageSize=100';
-		return($array_item);
-    }
-    
-    /**
-     * The main method which performs the actual crawling
-     */    
-    public function startCrawler() 
-    {
-        global $app;
 
-        try
-        {
-            // Make sure the requirements are given so that this script can execute
-            $req_ret = $this->checkRequirements();
-            if(!$req_ret) return false;
-            
-            // Execute the open task and first fetch all vendors (APS catalog API 1.1, p. 12)
-            $app->log($this->log_prefix.'Fetching data from '.$this->fetch_url);
 
-            $vendor_page = $this->fetchPage('/all-app/'); //$vendor_page = $this->fetchPage('/'.$this->aps_version.'/');
-            preg_match_all("/\<a href=\"(.+)\/\" class=\"vendor\"/i", $vendor_page, $matches);
-            $vendors = array_map('urldecode', $matches[1]);
-            if(!$vendors) throw new Exception('Unable to fetch vendors. Aborting');
+	/**
+	 * Before the cron is executed, make sure all necessary options are set
+	 * and all functions (i.e. cURL) are available
+	 */
+	private function checkRequirements()
+	{
+		global $app;
 
-            // Format all vendors for further processing (i.e. typo3.org -> /1.atom?vendor=typo3.org&pageSize=100
-            //array_walk($vendors, array($this, 'formatVendorCallback'));
+		try
+		{
+			// Check if allow_url_fopen is enabled
+			if(!@ini_get('allow_url_fopen')) throw new Exception('allow_url_fopen is not enabled');
+			// Check if the cURL module is available
+			if(!function_exists('curl_version')) throw new Exception('cURL is not available');
+
+			// Check if used folders are writable
+			if($this->interface_mode)
+			{
+				if(!is_writable($this->interface_pkg_dir))
+					throw new Exception('the folder '.basename($this->interface_pkg_dir).' is not writable');
+			}
+			else
+			{
+				if(!is_writable($this->packages_dir))
+					throw new Exception('the folder '.basename($this->packages_dir).' is not writable');
+			}
+
+			return true;
+		}
+
+		catch(Exception $e)
+		{
+			$app->log($this->log_prefix.'Aborting execution because '.$e->getMessage(), LOGLEVEL_ERROR);
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Remove a directory recursively
+	 * In case of error be silent
+	 *
+	 * @param $dir the directory to remove
+	 */
+	private function removeDirectory($dir)
+	{
+		if(is_dir($dir))
+		{
+			$files = scandir($dir);
+			foreach($files as $file)
+			{
+				if($file != '.' && $file != '..')
+					if(filetype($dir.'/'.$file) == 'dir') $this->removeDirectory($dir.'/'.$file);
+					else @unlink($dir.'/'.$file);
+			}
+			reset($files);
+			@rmdir($dir);
+		}
+	}
+
+
+	/**
+	 * Fetch HTML data from one or more given URLs
+	 * If a string is given, a string is returned, if an array of URLs should
+	 * be fetched, the responses of the parallel queries are returned as array
+	 *
+	 * @param $input the string or array to fetch
+	 * @return $ret a query response string or array
+	 */
+	private function fetchPage($input)
+	{
+		$ret = array();
+		$url = array();
+		$conn = array();
+
+		// Make sure we are working with an array, further on
+		if(!is_array($input)) $url[] = $input;
+		else $url = $input;
+
+		// Build the single cURL handles and add them to a multi handle
+		$mh = curl_multi_init();
+		for($i = 0; $i < count($url); $i++)
+		{
+			$conn[$i] = curl_init('http://'.$this->fetch_url.$url[$i]);
+			curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, true);
+			curl_multi_add_handle($mh, $conn[$i]);
+		}
+
+		$active = 0;
+		do curl_multi_exec($mh, $active);
+		while($active > 0);
+
+		// Get the response(s)
+		for($i = 0; $i < count($url); $i++)
+		{
+			$ret[$i] = curl_multi_getcontent($conn[$i]);
+			curl_multi_remove_handle($mh, $conn[$i]);
+			curl_close($conn[$i]);
+		}
+		curl_multi_close($mh);
+
+		if(count($url) == 1) $ret = $ret[0];
+
+		return $ret;
+	}
+
+
+
+	/**
+	 * Fetch binary data from a given array
+	 * The data is retrieved in binary mode and
+	 * then directly written to an output file
+	 *
+	 * @param $input a specially structed array
+	 * @see $this->startUpdate()
+	 */
+	private function fetchFiles($input)
+	{
+		$fh = array();
+		$url = array();
+		$conn = array();
+
+		// Build the single cURL handles and add them to a multi handle
+		$mh = curl_multi_init();
+
+		// Process each app
+		for($i = 0; $i < count($input); $i++)
+		{
+			$conn[$i] = curl_init($input[$i]['url']);
+			$fh[$i] = fopen($input[$i]['localtarget'], 'wb');
+
+			curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true);
+			curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]);
+			curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
+			curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
+			curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1);
+
+			curl_multi_add_handle($mh, $conn[$i]);
+		}
+
+		$active = 0;
+		do curl_multi_exec($mh, $active);
+		while($active > 0);
+
+		// Close the handles
+		for($i = 0; $i < count($input); $i++)
+		{
+			fclose($fh[$i]);
+			curl_multi_remove_handle($mh, $conn[$i]);
+			curl_close($conn[$i]);
+		}
+		curl_multi_close($mh);
+	}
+
+
+
+	/**
+	 * A method to build query URLs out of a list of vendors
+	 *
+	 */
+	private function formatVendorCallback($array_item)
+	{
+		$array_item = str_replace(' ', '%20', $array_item);
+		$array_item = str_replace('http://', '', $array_item);
+		$array_item = '/'.$this->aps_version.'.atom?vendor='.$array_item.'&pageSize=100';
+		return $array_item;
+	}
+
+
+
+	/**
+	 * The main method which performs the actual crawling
+	 */
+	public function startCrawler()
+	{
+		global $app;
+
+		try
+		{
+			// Make sure the requirements are given so that this script can execute
+			$req_ret = $this->checkRequirements();
+			if(!$req_ret) return false;
+
+			// Execute the open task and first fetch all vendors (APS catalog API 1.1, p. 12)
+			$app->log($this->log_prefix.'Fetching data from '.$this->fetch_url);
+
+			$vendor_page = $this->fetchPage('/all-app/'); //$vendor_page = $this->fetchPage('/'.$this->aps_version.'/');
+			preg_match_all("/\<a href=\"(.+)\/\" class=\"vendor\"/i", $vendor_page, $matches);
+			$vendors = array_map('urldecode', $matches[1]);
+			if(!$vendors) throw new Exception('Unable to fetch vendors. Aborting');
+
+			// Format all vendors for further processing (i.e. typo3.org -> /1.atom?vendor=typo3.org&pageSize=100
+			//array_walk($vendors, array($this, 'formatVendorCallback'));
 			if(is_array($vendors)) {
 				foreach($vendors as $key => $array_item) {
 					$vendors[$key] = $this->formatVendorCallback($array_item);
 				}
 			}
-            
-            // Process all vendors in chunks of 50 entries
-            $vendor_chunks = array_chunk($vendors, 50);
-            //var_dump($vendor_chunks); 
 
-            // Get all known apps from the database and the highest known version
-            // Note: A dirty hack is used for numerical sorting of the VARCHAR field Version: +0 -> cast
-            // A longer but typesafe way would be: ORDER BY CAST(REPLACE(Version, '.', '') AS UNSIGNED) DESC
-            $existing_apps = $app->db->queryAllRecords("SELECT * FROM (
-                SELECT name AS Name, CONCAT(version, '-', CAST(`release` AS CHAR)) AS CurrentVersion 
+			// Process all vendors in chunks of 50 entries
+			$vendor_chunks = array_chunk($vendors, 50);
+			//var_dump($vendor_chunks);
+
+			// Get all known apps from the database and the highest known version
+			// Note: A dirty hack is used for numerical sorting of the VARCHAR field Version: +0 -> cast
+			// A longer but typesafe way would be: ORDER BY CAST(REPLACE(Version, '.', '') AS UNSIGNED) DESC
+			$existing_apps = $app->db->queryAllRecords("SELECT * FROM (
+                SELECT name AS Name, CONCAT(version, '-', CAST(`release` AS CHAR)) AS CurrentVersion
                 FROM aps_packages ORDER BY REPLACE(version, '.', '')+0 DESC, `release` DESC
                 ) as Versions GROUP BY name");
-            //var_dump($existing_apps); 
-            
-            // Used for statistics later
-            $apps_in_repo = 0; 
-            $apps_updated = 0;
-            $apps_downloaded = 0;
-            
-            $apps_to_dl = array();
-            
-            for($i = 0; $i < count($vendor_chunks); $i++)
-            {
-                // Fetch all apps for the current chunk of vendors
-                $apps = $this->fetchPage($vendor_chunks[$i]);
-                
-                for($j = 0; $j < count($apps); $j++)
-                {
-                    // Before parsing, make sure it's worth the work by checking if at least one app exists
-                    $apps_count = substr_count($apps[$j], '<opensearch:totalResults>0</opensearch:totalResults>');
-                    if($apps_count == 0) // obviously this vendor provides one or more apps
-                    {
-                        // Rename namespaces and register them 
-                        $xml = str_replace("xmlns=", "ns=", $apps[$j]);
-                        $sxe = new SimpleXMLElement($xml);
-                        $namespaces = $sxe->getDocNamespaces(true);
-                        foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
-                        
-                        // Fetching values of interest
-                        $app_name = parent::getXPathValue($sxe, 'entry[position()=1]/a:name');
-                        $app_version = parent::getXPathValue($sxe, 'entry[position()=1]/a:version');
-                        $app_release = parent::getXPathValue($sxe, 'entry[position()=1]/a:release');
-                        
-                        // Find out a (possibly) existing package version
-                        $ex_ver = '';
+			//var_dump($existing_apps);
+
+			// Used for statistics later
+			$apps_in_repo = 0;
+			$apps_updated = 0;
+			$apps_downloaded = 0;
+
+			$apps_to_dl = array();
+
+			for($i = 0; $i < count($vendor_chunks); $i++)
+			{
+				// Fetch all apps for the current chunk of vendors
+				$apps = $this->fetchPage($vendor_chunks[$i]);
+
+				for($j = 0; $j < count($apps); $j++)
+				{
+					// Before parsing, make sure it's worth the work by checking if at least one app exists
+					$apps_count = substr_count($apps[$j], '<opensearch:totalResults>0</opensearch:totalResults>');
+					if($apps_count == 0) // obviously this vendor provides one or more apps
+						{
+						// Rename namespaces and register them
+						$xml = str_replace("xmlns=", "ns=", $apps[$j]);
+						$sxe = new SimpleXMLElement($xml);
+						$namespaces = $sxe->getDocNamespaces(true);
+						foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+						// Fetching values of interest
+						$app_name = parent::getXPathValue($sxe, 'entry[position()=1]/a:name');
+						$app_version = parent::getXPathValue($sxe, 'entry[position()=1]/a:version');
+						$app_release = parent::getXPathValue($sxe, 'entry[position()=1]/a:release');
+
+						// Find out a (possibly) existing package version
+						$ex_ver = '';
 						/*
-                        array_walk($existing_apps, 
+                        array_walk($existing_apps,
                             create_function('$v, $k, $ex_ver', 'if($v["Name"] == "'.$app_name.'") $ex_ver = $v["CurrentVersion"];'), &$ex_ver);
                         */
 						if(is_array($existing_apps)) {
@@ -292,286 +305,292 @@
 								if($v["Name"] == $app_name) $ex_ver = $v["CurrentVersion"];
 							}
 						}
-						
-                        $new_ver = $app_version.'-'.$app_release;
-                        $local_intf_folder = $this->interface_pkg_dir.'/'.$app_name.'-'.$new_ver.'.app.zip/';
 
-                        // Proceed if a newer or at least equal version has been found with server mode or 
-                        // interface mode is activated and there are no valid APP-META.xml and PKG_URL existing yet
-                        if((!$this->interface_mode && version_compare($new_ver, $ex_ver) >= 0) || ($this->interface_mode && (!file_exists($local_intf_folder.'APP-META.xml') || filesize($local_intf_folder.'APP-META.xml') == 0 || !file_exists($local_intf_folder.'PKG_URL') || filesize($local_intf_folder.'PKG_URL') == 0))){
-                            // Check if we already have an old version of this app
-                            if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1) $apps_updated++; 
+						$new_ver = $app_version.'-'.$app_release;
+						$local_intf_folder = $this->interface_pkg_dir.'/'.$app_name.'-'.$new_ver.'.app.zip/';
 
-                            $app_dl = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@href");
-                            $app_filesize = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@length");
-                            $app_metafile = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='meta']/@href");
-							
+						// Proceed if a newer or at least equal version has been found with server mode or
+						// interface mode is activated and there are no valid APP-META.xml and PKG_URL existing yet
+						if((!$this->interface_mode && version_compare($new_ver, $ex_ver) >= 0) || ($this->interface_mode && (!file_exists($local_intf_folder.'APP-META.xml') || filesize($local_intf_folder.'APP-META.xml') == 0 || !file_exists($local_intf_folder.'PKG_URL') || filesize($local_intf_folder.'PKG_URL') == 0))){
+							// Check if we already have an old version of this app
+							if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1) $apps_updated++;
+
+							$app_dl = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@href");
+							$app_filesize = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@length");
+							$app_metafile = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='meta']/@href");
+
 							//$this->app_download_url_list[$app_name.'-'.$new_ver.'.app.zip'] = $app_dl;
-                            // Skip ASP.net packages because they can't be used at all
-                            $asp_handler = parent::getXPathValue($sxe, '//aspnet:handler');
-                            $asp_permissions = parent::getXPathValue($sxe, '//aspnet:permissions');
-                            $asp_version = parent::getXPathValue($sxe, '//aspnet:version');
-                            if(!empty($asp_handler) || !empty($asp_permissions) || !empty($asp_version)) continue;
+							// Skip ASP.net packages because they can't be used at all
+							$asp_handler = parent::getXPathValue($sxe, '//aspnet:handler');
+							$asp_permissions = parent::getXPathValue($sxe, '//aspnet:permissions');
+							$asp_version = parent::getXPathValue($sxe, '//aspnet:version');
+							if(!empty($asp_handler) || !empty($asp_permissions) || !empty($asp_version)) continue;
 
-                            // Interface mode (download only parts)
-                            if($this->interface_mode)
-                            {
-                                // Delete an obviously out-dated version from the system and DB
-                                if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1)
-                                {
-                                    $old_folder = $this->interface_pkg_dir.'/'.$app_name.'-'.$ex_ver.'.app.zip';
-                                    if(file_exists($old_folder)) $this->removeDirectory($old_folder);
-                                    
+							// Interface mode (download only parts)
+							if($this->interface_mode)
+							{
+								// Delete an obviously out-dated version from the system and DB
+								if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1)
+								{
+									$old_folder = $this->interface_pkg_dir.'/'.$app_name.'-'.$ex_ver.'.app.zip';
+									if(file_exists($old_folder)) $this->removeDirectory($old_folder);
+
 									/*
                                     $app->db->query("UPDATE aps_packages SET package_status = '".PACKAGE_OUTDATED."' WHERE name = '".
                                         $app->db->quote($app_name)."' AND CONCAT(version, '-', CAST(`release` AS CHAR)) = '".
                                         $app->db->quote($ex_ver)."';");
 									*/
 									$tmp = $app->db->queryOneRecord("SELECT id FROM aps_packages WHERE name = '".
-                                        $app->db->quote($app_name)."' AND CONCAT(version, '-', CAST(`release` AS CHAR)) = '".
-                                        $app->db->quote($ex_ver)."';");
+										$app->db->quote($app_name)."' AND CONCAT(version, '-', CAST(`release` AS CHAR)) = '".
+										$app->db->quote($ex_ver)."';");
 									$app->db->datalogUpdate('aps_packages', "package_status = ".PACKAGE_OUTDATED, 'id', $tmp['id']);
 									unset($tmp);
-                                }
-                                
-                                // Create the local folder if not yet existing
-                                if(!file_exists($local_intf_folder)) @mkdir($local_intf_folder, 0777, true);
-								
+								}
+
+								// Create the local folder if not yet existing
+								if(!file_exists($local_intf_folder)) @mkdir($local_intf_folder, 0777, true);
+
 								// Save the package URL in an extra file because it's not part of the APP-META.xml file
 								@file_put_contents($local_intf_folder.'PKG_URL', $app_dl);
-                                
-                                // Download the meta file
-                                $local_metafile = $local_intf_folder.'APP-META.xml';
-                                if(!file_exists($local_metafile) || filesize($local_metafile) == 0) 
-                                {
-                                    $apps_to_dl[] = array('name' => 'APP-META.xml', 
-                                                          'url' => $app_metafile, 
-                                                          'filesize' => 0, 
-                                                          'localtarget' => $local_metafile);
-                                    $apps_downloaded++;
-                                }
-                                
-                                // Download package license
-                                $license = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='eula']/@href");
-                                if($license != '')
-                                {
-                                    $local_license = $local_intf_folder.'LICENSE';
-                                    if(!file_exists($local_license) || filesize($local_license) == 0)
-                                    {
-                                        $apps_to_dl[] = array('name' => basename($license), 
-                                                              'url' => $license, 
-                                                              'filesize' => 0, 
-                                                              'localtarget' => $local_license);
-                                    }
-                                }
-                                
-                                // Download package icon
-                                $icon = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='icon']/@href");
-                                if($icon != '')
-                                {
-                                    $local_icon = $local_intf_folder.basename($icon);
-                                    if(!file_exists($local_icon) || filesize($local_icon) == 0)
-                                    {
-                                        $apps_to_dl[] = array('name' => basename($icon), 
-                                                              'url' => $icon, 
-                                                              'filesize' => 0, 
-                                                              'localtarget' => $local_icon);
-                                    }
-                                }
-                                
-                                // Download available screenshots
-                                $screenshots = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='screenshot']", true);
-                                if(!empty($screenshots))
-                                {
-                                    foreach($screenshots as $screen)
-                                    {
-                                        $local_screen = $local_intf_folder.basename($screen['href']);
-                                        if(!file_exists($local_screen) || filesize($local_screen) == 0)
-                                        {
-                                            $apps_to_dl[] = array('name' => basename($screen['href']), 
-                                                                  'url' => $screen['href'], 
-                                                                  'filesize' => 0, 
-                                                                  'localtarget' => $local_screen);
-                                        }
-                                    }
-                                }
-                            }
-                            else // Server mode (download whole ZIP archive)
-                            {
-                                // Delete an obviously out-dated version from the system
-                                if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1)
-                                {
-                                    $old_file = $this->packages_dir.'/'.$app_name.'-'.$ex_ver.'.app.zip';
-                                    if(file_exists($old_file)) $this->removeDirectory($old_file);
-                                }
-                                
-                                // Attention: $new_ver can also be == $ex_ver (according to version_compare >= 0)
-                                $local_zip = $this->packages_dir.'/'.$app_name.'-'.$new_ver.'.app.zip';
-                            
-                                // Before re-downloading a file, make sure it's not yet existing on HDD (due to DB inconsistency)
-                                if((file_exists($local_zip) && (filesize($local_zip) == $app_filesize)) === false)
-                                {
-                                    $apps_to_dl[] = array('name' => $app_name, 
-                                                          'url' => $app_dl, 
-                                                          'filesize' => $app_filesize, 
-                                                          'localtarget' => $local_zip);
-                                    $apps_downloaded++;
-                                }
-                            }
-                        }
-                        
-                        unset($sxe);
-                        $apps_in_repo++;
-                    }
-                }
-                //var_dump($apps);
-                
-                // For memory reasons, unset the current vendor and his apps
-                unset($apps);
-            }
-            
-            // Shuffle the download array (in order to compensate unexpected php aborts)
-            shuffle($apps_to_dl);
-            
-            // After collecting all provisioned apps, download them
-            $apps_to_dl_chunks = array_chunk($apps_to_dl, 10);
 
-            for($i = 0; $i < count($apps_to_dl_chunks); $i++)
-            {
-                $this->fetchFiles($apps_to_dl_chunks[$i]);
-                
-                // Check the integrity of all downloaded files
-                // but exclude cases where no filesize is available (i.e. screenshot or metafile download)
-                for($j = 0; $j < count($apps_to_dl_chunks[$i]); $j++)
-                {
-                    if($apps_to_dl_chunks[$i][$j]['filesize'] != 0 &&
-                       $apps_to_dl_chunks[$i][$j]['filesize'] != filesize($apps_to_dl_chunks[$i][$j]['localtarget']))
-                    {
-                            $app->log($this->log_prefix.' The filesize of the package "'.
-                                $apps_to_dl_chunks[$i][$j]['name'].'" is wrong. Download failure?', LOGLEVEL_WARN);
-                    }
-                }
-            }
-            
-            $app->log($this->log_prefix.'Processed '.$apps_in_repo.
-                ' apps from the repo. Downloaded '.$apps_updated.
-                ' updates, '.$apps_downloaded.' new apps');
-        }
-        catch(Exception $e)
-        {
-            $app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
-            return false;
-        }
-    }
-    
-    /**
-     * Read in all possible packages from the interface packages folder and 
-     * check if they are not ASP.net code (as this can't be processed).
-     * 
-     * Note: There's no need to check if the packages to register are newer
-     * than those in the database because this already happended in startCrawler()
-     */
-    public function parseFolderToDB()
-    {
-        global $app;
-        
-        try
-        {
-            // This method must be used in interface mode
-            if(!$this->interface_mode) return false; 
-            
-            $pkg_list = array();
-        
-            // Read in every package having a correct filename
-            $temp_handle = @dir($this->interface_pkg_dir);
-            if(!$temp_handle) throw new Exception('The temp directory is not accessible');
-            while($folder = $temp_handle->read()) 
-                if(substr($folder, -8) == '.app.zip') $pkg_list[] = $folder;
-            $temp_handle->close();
-            
-            // If no packages are available -> exception (because at this point there should exist packages)
-            if(empty($pkg_list)) throw new Exception('No packages to read in');
-            
-            // Get registered packages and mark non-existant packages with an error code to omit the install
-            $existing_packages = array();
-            $path_query = $app->db->queryAllRecords('SELECT path AS Path FROM aps_packages;');
-            foreach($path_query as $path) $existing_packages[] = $path['Path']; 
-            $diff = array_diff($existing_packages, $pkg_list);
-            foreach($diff as $todelete) {
-                /*$app->db->query("UPDATE aps_packages SET package_status = '".PACKAGE_ERROR_NOMETA."' 
+								// Download the meta file
+								$local_metafile = $local_intf_folder.'APP-META.xml';
+								if(!file_exists($local_metafile) || filesize($local_metafile) == 0)
+								{
+									$apps_to_dl[] = array('name' => 'APP-META.xml',
+										'url' => $app_metafile,
+										'filesize' => 0,
+										'localtarget' => $local_metafile);
+									$apps_downloaded++;
+								}
+
+								// Download package license
+								$license = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='eula']/@href");
+								if($license != '')
+								{
+									$local_license = $local_intf_folder.'LICENSE';
+									if(!file_exists($local_license) || filesize($local_license) == 0)
+									{
+										$apps_to_dl[] = array('name' => basename($license),
+											'url' => $license,
+											'filesize' => 0,
+											'localtarget' => $local_license);
+									}
+								}
+
+								// Download package icon
+								$icon = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='icon']/@href");
+								if($icon != '')
+								{
+									$local_icon = $local_intf_folder.basename($icon);
+									if(!file_exists($local_icon) || filesize($local_icon) == 0)
+									{
+										$apps_to_dl[] = array('name' => basename($icon),
+											'url' => $icon,
+											'filesize' => 0,
+											'localtarget' => $local_icon);
+									}
+								}
+
+								// Download available screenshots
+								$screenshots = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='screenshot']", true);
+								if(!empty($screenshots))
+								{
+									foreach($screenshots as $screen)
+									{
+										$local_screen = $local_intf_folder.basename($screen['href']);
+										if(!file_exists($local_screen) || filesize($local_screen) == 0)
+										{
+											$apps_to_dl[] = array('name' => basename($screen['href']),
+												'url' => $screen['href'],
+												'filesize' => 0,
+												'localtarget' => $local_screen);
+										}
+									}
+								}
+							}
+							else // Server mode (download whole ZIP archive)
+								{
+								// Delete an obviously out-dated version from the system
+								if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1)
+								{
+									$old_file = $this->packages_dir.'/'.$app_name.'-'.$ex_ver.'.app.zip';
+									if(file_exists($old_file)) $this->removeDirectory($old_file);
+								}
+
+								// Attention: $new_ver can also be == $ex_ver (according to version_compare >= 0)
+								$local_zip = $this->packages_dir.'/'.$app_name.'-'.$new_ver.'.app.zip';
+
+								// Before re-downloading a file, make sure it's not yet existing on HDD (due to DB inconsistency)
+								if((file_exists($local_zip) && (filesize($local_zip) == $app_filesize)) === false)
+								{
+									$apps_to_dl[] = array('name' => $app_name,
+										'url' => $app_dl,
+										'filesize' => $app_filesize,
+										'localtarget' => $local_zip);
+									$apps_downloaded++;
+								}
+							}
+						}
+
+						unset($sxe);
+						$apps_in_repo++;
+					}
+				}
+				//var_dump($apps);
+
+				// For memory reasons, unset the current vendor and his apps
+				unset($apps);
+			}
+
+			// Shuffle the download array (in order to compensate unexpected php aborts)
+			shuffle($apps_to_dl);
+
+			// After collecting all provisioned apps, download them
+			$apps_to_dl_chunks = array_chunk($apps_to_dl, 10);
+
+			for($i = 0; $i < count($apps_to_dl_chunks); $i++)
+			{
+				$this->fetchFiles($apps_to_dl_chunks[$i]);
+
+				// Check the integrity of all downloaded files
+				// but exclude cases where no filesize is available (i.e. screenshot or metafile download)
+				for($j = 0; $j < count($apps_to_dl_chunks[$i]); $j++)
+				{
+					if($apps_to_dl_chunks[$i][$j]['filesize'] != 0 &&
+						$apps_to_dl_chunks[$i][$j]['filesize'] != filesize($apps_to_dl_chunks[$i][$j]['localtarget']))
+					{
+						$app->log($this->log_prefix.' The filesize of the package "'.
+							$apps_to_dl_chunks[$i][$j]['name'].'" is wrong. Download failure?', LOGLEVEL_WARN);
+					}
+				}
+			}
+
+			$app->log($this->log_prefix.'Processed '.$apps_in_repo.
+				' apps from the repo. Downloaded '.$apps_updated.
+				' updates, '.$apps_downloaded.' new apps');
+		}
+
+		catch(Exception $e)
+		{
+			$app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Read in all possible packages from the interface packages folder and
+	 * check if they are not ASP.net code (as this can't be processed).
+	 *
+	 * Note: There's no need to check if the packages to register are newer
+	 * than those in the database because this already happended in startCrawler()
+	 */
+	public function parseFolderToDB()
+	{
+		global $app;
+
+		try
+		{
+			// This method must be used in interface mode
+			if(!$this->interface_mode) return false;
+
+			$pkg_list = array();
+
+			// Read in every package having a correct filename
+			$temp_handle = @dir($this->interface_pkg_dir);
+			if(!$temp_handle) throw new Exception('The temp directory is not accessible');
+			while($folder = $temp_handle->read())
+				if(substr($folder, -8) == '.app.zip') $pkg_list[] = $folder;
+				$temp_handle->close();
+
+			// If no packages are available -> exception (because at this point there should exist packages)
+			if(empty($pkg_list)) throw new Exception('No packages to read in');
+
+			// Get registered packages and mark non-existant packages with an error code to omit the install
+			$existing_packages = array();
+			$path_query = $app->db->queryAllRecords('SELECT path AS Path FROM aps_packages;');
+			foreach($path_query as $path) $existing_packages[] = $path['Path'];
+			$diff = array_diff($existing_packages, $pkg_list);
+			foreach($diff as $todelete) {
+				/*$app->db->query("UPDATE aps_packages SET package_status = '".PACKAGE_ERROR_NOMETA."'
                     WHERE path = '".$app->db->quote($todelete)."';");*/
 				$tmp = $app->db->queryOneRecord("SELECT id FROM aps_packages WHERE path = '".$app->db->quote($todelete)."';");
 				$app->db->datalogUpdate('aps_packages', "package_status = ".PACKAGE_ERROR_NOMETA, 'id', $tmp['id']);
 				unset($tmp);
 			}
-            
-            // Register all new packages
-            $new_packages = array_diff($pkg_list, $existing_packages);
-            foreach($new_packages as $pkg)
-            {
-                // Load in meta file if existing and register its namespaces
-                $metafile = $this->interface_pkg_dir.'/'.$pkg.'/APP-META.xml';
-                if(!file_exists($metafile)) 
-                {
-                    $app->log($this->log_prefix.'Cannot read metadata from '.$pkg, LOGLEVEL_ERROR);
-                    continue;
-                }
-        
-                $metadata = file_get_contents($metafile);
-                $metadata = str_replace("xmlns=", "ns=", $metadata);
-                $sxe = new SimpleXMLElement($metadata);
-                $namespaces = $sxe->getDocNamespaces(true);
-                foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
-                
-                // Insert the new package
-                $pkg_name = parent::getXPathValue($sxe, 'name');
-                $pkg_category = parent::getXPathValue($sxe, '//category');
-                $pkg_version = parent::getXPathValue($sxe, 'version');
-                $pkg_release = parent::getXPathValue($sxe, 'release');
+
+			// Register all new packages
+			$new_packages = array_diff($pkg_list, $existing_packages);
+			foreach($new_packages as $pkg)
+			{
+				// Load in meta file if existing and register its namespaces
+				$metafile = $this->interface_pkg_dir.'/'.$pkg.'/APP-META.xml';
+				if(!file_exists($metafile))
+				{
+					$app->log($this->log_prefix.'Cannot read metadata from '.$pkg, LOGLEVEL_ERROR);
+					continue;
+				}
+
+				$metadata = file_get_contents($metafile);
+				$metadata = str_replace("xmlns=", "ns=", $metadata);
+				$sxe = new SimpleXMLElement($metadata);
+				$namespaces = $sxe->getDocNamespaces(true);
+				foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+				// Insert the new package
+				$pkg_name = parent::getXPathValue($sxe, 'name');
+				$pkg_category = parent::getXPathValue($sxe, '//category');
+				$pkg_version = parent::getXPathValue($sxe, 'version');
+				$pkg_release = parent::getXPathValue($sxe, 'release');
 				//$pkg_url = $this->app_download_url_list[$pkg];
 				$pkg_url = @file_get_contents($this->interface_pkg_dir.'/'.$pkg.'/PKG_URL');
-                
+
 				/*
-                $app->db->query("INSERT INTO `aps_packages` 
-                    (`path`, `name`, `category`, `version`, `release`, `package_status`) VALUES 
+                $app->db->query("INSERT INTO `aps_packages`
+                    (`path`, `name`, `category`, `version`, `release`, `package_status`) VALUES
                     ('".$app->db->quote($pkg)."', '".$app->db->quote($pkg_name)."',
                     '".$app->db->quote($pkg_category)."', '".$app->db->quote($pkg_version)."',
                     ".$app->db->quote($pkg_release).", ".PACKAGE_ENABLED.");");
 				*/
 				// Insert only if data is complete
 				if($pkg != '' && $pkg_name != '' && $pkg_category != '' && $pkg_version != '' && $pkg_release != '' && $pkg_url){
-					$insert_data = "(`path`, `name`, `category`, `version`, `release`, `package_url`, `package_status`) VALUES 
+					$insert_data = "(`path`, `name`, `category`, `version`, `release`, `package_url`, `package_status`) VALUES
                     ('".$app->db->quote($pkg)."', '".$app->db->quote($pkg_name)."',
                     '".$app->db->quote($pkg_category)."', '".$app->db->quote($pkg_version)."',
                     ".$app->db->quote($pkg_release).", '".$app->db->quote($pkg_url)."', ".PACKAGE_ENABLED.");";
-				
+
 					$app->db->datalogInsert('aps_packages', $insert_data, 'id');
 				} else {
 					if(file_exists($this->interface_pkg_dir.'/'.$pkg)) $this->removeDirectory($this->interface_pkg_dir.'/'.$pkg);
 				}
-            }
-        }
-        catch(Exception $e)
-        {
-            $app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
+			}
+		}
+
+		catch(Exception $e)
+		{
+			$app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
 			$app->error($e->getMessage());
-            return false;
-        }
-    }
-	
+			return false;
+		}
+	}
+
+
+
 	/**
-     * Add missing package URLs to database
-     */
-    public function fixURLs()
-    {
-        global $app;
-        
-        try
-        {
-            // This method must be used in interface mode
-            if(!$this->interface_mode) return false; 
-            
-            $incomplete_pkgs = $app->db->queryAllRecords("SELECT * FROM aps_packages WHERE package_url = ''");
+	 * Add missing package URLs to database
+	 */
+	public function fixURLs()
+	{
+		global $app;
+
+		try
+		{
+			// This method must be used in interface mode
+			if(!$this->interface_mode) return false;
+
+			$incomplete_pkgs = $app->db->queryAllRecords("SELECT * FROM aps_packages WHERE package_url = ''");
 			if(is_array($incomplete_pkgs) && !empty($incomplete_pkgs)){
 				foreach($incomplete_pkgs as $incomplete_pkg){
 					$pkg_url = @file_get_contents($this->interface_pkg_dir.'/'.$incomplete_pkg['path'].'/PKG_URL');
@@ -580,13 +599,16 @@
 					}
 				}
 			}
-        }
-        catch(Exception $e)
-        {
-            $app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
+		}
+
+		catch(Exception $e)
+		{
+			$app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
 			$app->error($e->getMessage());
-            return false;
-        }
-    }
+			return false;
+		}
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/lib/classes/aps_guicontroller.inc.php b/interface/lib/classes/aps_guicontroller.inc.php
index 1e106a1..47f5bd2 100644
--- a/interface/lib/classes/aps_guicontroller.inc.php
+++ b/interface/lib/classes/aps_guicontroller.inc.php
@@ -27,199 +27,215 @@
 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('aps_base.inc.php');
+require_once 'aps_base.inc.php';
 
 class ApsGUIController extends ApsBase
 {
-    /**
-    * Constructor
-    *
-    * @param $app the application instance (db handle)
-    */
-    public function __construct($app)
-    {
-        parent::__construct($app);
-    }
-    
-    /**
-     * Reads in a package metadata file and registers it's namespaces
-     * 
-     * @param $filename the file to read
-     * @return $sxe a SimpleXMLElement handle
-     */
-    private function readInMetaFile($filename)
-    {
-        $metadata = file_get_contents($filename);
-        $metadata = str_replace("xmlns=", "ns=", $metadata);
-        $sxe = new SimpleXMLElement($metadata);
-        $namespaces = $sxe->getDocNamespaces(true);
-        foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
-        
-        return $sxe; 
-    }
-    
-    /**
-     * Applies a RegEx pattern onto a location path in order to secure it against 
-     * code injections and invalid input
-     * 
-     * @param $location_unfiltered the file path to secure
-     * @return $location
-     */
-    private function secureLocation($location_unfiltered)
-    {
-        // Filter invalid slashes from string
-        $location = preg_replace(array('#/+#', '#\.+#', '#\0+#', '#\\\\+#'), 
-                                 array('/', '', '', '/'), 
-                                 $location_unfiltered);
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle)
+	 */
 
-        // Remove a beginning or trailing slash
-        if(substr($location, -1) == '/') $location = substr($location, 0, strlen($location) - 1);
-        if(substr($location, 0, 1) == '/') $location = substr($location, 1);
-        
-        return $location;
-    }
-    
-    /**
-     * Gets the CustomerID (ClientID) which belongs to a specific domain
-     * 
-     * @param $domain the domain
-     * @return $customerid
-     */
-    private function getCustomerIDFromDomain($domain)
-    {
-        global $app;
-        $customerid = 0;
-        
-        $customerdata = $app->db->queryOneRecord("SELECT client_id FROM sys_group, web_domain
-            WHERE web_domain.sys_groupid = sys_group.groupid 
+
+	public function __construct($app)
+	{
+		parent::__construct($app);
+	}
+
+
+
+	/**
+	 * Reads in a package metadata file and registers it's namespaces
+	 *
+	 * @param $filename the file to read
+	 * @return $sxe a SimpleXMLElement handle
+	 */
+	private function readInMetaFile($filename)
+	{
+		$metadata = file_get_contents($filename);
+		$metadata = str_replace("xmlns=", "ns=", $metadata);
+		$sxe = new SimpleXMLElement($metadata);
+		$namespaces = $sxe->getDocNamespaces(true);
+		foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+		return $sxe;
+	}
+
+
+
+	/**
+	 * Applies a RegEx pattern onto a location path in order to secure it against
+	 * code injections and invalid input
+	 *
+	 * @param $location_unfiltered the file path to secure
+	 * @return $location
+	 */
+	private function secureLocation($location_unfiltered)
+	{
+		// Filter invalid slashes from string
+		$location = preg_replace(array('#/+#', '#\.+#', '#\0+#', '#\\\\+#'),
+			array('/', '', '', '/'),
+			$location_unfiltered);
+
+		// Remove a beginning or trailing slash
+		if(substr($location, -1) == '/') $location = substr($location, 0, strlen($location) - 1);
+		if(substr($location, 0, 1) == '/') $location = substr($location, 1);
+
+		return $location;
+	}
+
+
+
+	/**
+	 * Gets the CustomerID (ClientID) which belongs to a specific domain
+	 *
+	 * @param $domain the domain
+	 * @return $customerid
+	 */
+	private function getCustomerIDFromDomain($domain)
+	{
+		global $app;
+		$customerid = 0;
+
+		$customerdata = $app->db->queryOneRecord("SELECT client_id FROM sys_group, web_domain
+            WHERE web_domain.sys_groupid = sys_group.groupid
             AND web_domain.domain = '".$app->db->quote($domain)."';");
-        if(!empty($customerdata)) $customerid = $customerdata['client_id'];
-        
-        return $customerid;
-    }
-    
-    /**
-     * Returns the server_id for an already installed instance. Is actually 
-     * just a little helper method to avoid redundant code
-     * 
-     * @param $instanceid the instance to process
-     * @return $webserver_id the server_id
-     */
-    private function getInstanceDataForDatalog($instanceid)
-    {
-        global $app;
-        $webserver_id = '';
-        
-        $websrv = $app->db->queryOneRecord("SELECT server_id FROM web_domain 
-            WHERE domain = (SELECT value FROM aps_instances_settings 
+		if(!empty($customerdata)) $customerid = $customerdata['client_id'];
+
+		return $customerid;
+	}
+
+
+
+	/**
+	 * Returns the server_id for an already installed instance. Is actually
+	 * just a little helper method to avoid redundant code
+	 *
+	 * @param $instanceid the instance to process
+	 * @return $webserver_id the server_id
+	 */
+	private function getInstanceDataForDatalog($instanceid)
+	{
+		global $app;
+		$webserver_id = '';
+
+		$websrv = $app->db->queryOneRecord("SELECT server_id FROM web_domain
+            WHERE domain = (SELECT value FROM aps_instances_settings
                 WHERE name = 'main_domain' AND instance_id = ".$app->db->quote($instanceid).");");
 
-        // If $websrv is empty, an error has occured. Domain no longer existing? Settings table damaged?
-        // Anyhow, remove this instance record because it's not useful at all
-        if(empty($websrv)) 
-        {
-            $app->db->query("DELETE FROM aps_instances WHERE id = ".$app->db->quote($instanceid).";");
-            $app->db->query("DELETE FROM aps_instances_settings WHERE instance_id = ".$app->db->quote($instanceid).";");
-        }
-        else $webserver_id = $websrv['server_id'];
-        
-        return $webserver_id;
-    } 
-    
-    /**
-     * Finds out if there is a newer package version for 
-     * a given (possibly valid) package ID
-     * 
-     * @param $id the ID to check
-     * @return $newer_pkg_id the newer package ID
-     */ 
-    public function getNewestPackageID($id)
-    {
-        global $app;
-        
-        if(preg_match('/^[0-9]+$/', $id) != 1) return 0;
-        
-        $result = $app->db->queryOneRecord("SELECT id, name, 
-            CONCAT(version, '-', CAST(`release` AS CHAR)) AS current_version 
-            FROM aps_packages 
-            WHERE name = (SELECT name FROM aps_packages WHERE id = ".$app->db->quote($id).")  
-            ORDER BY REPLACE(version, '.', '')+0 DESC, `release` DESC");
-            
-        if(!empty($result) && ($id != $result['id'])) return $result['id'];
-        
-        return 0; 
-    }
+		// If $websrv is empty, an error has occured. Domain no longer existing? Settings table damaged?
+		// Anyhow, remove this instance record because it's not useful at all
+		if(empty($websrv))
+		{
+			$app->db->query("DELETE FROM aps_instances WHERE id = ".$app->db->quote($instanceid).";");
+			$app->db->query("DELETE FROM aps_instances_settings WHERE instance_id = ".$app->db->quote($instanceid).";");
+		}
+		else $webserver_id = $websrv['server_id'];
 
-    /**
-     * Validates a given package ID
-     *
-     * @param $id the ID to check
-     * @param $is_admin a flag to allow locked IDs too (for admin calls)
-     * @return boolean
-     */
-    public function isValidPackageID($id, $is_admin = false)
-    {
-        global $app;
-        
-         if(preg_match('/^[0-9]+$/', $id) != 1) return false;
-         
-         $sql_ext = (!$is_admin) ? 
-            'package_status = '.PACKAGE_ENABLED.' AND' :  
-            '(package_status = '.PACKAGE_ENABLED.' OR package_status = '.PACKAGE_LOCKED.') AND'; 
+		return $webserver_id;
+	}
 
-         $result = $app->db->queryOneRecord("SELECT id FROM aps_packages WHERE ".$sql_ext." id = ".$app->db->quote($id).";");
-         if(!$result) return false;
-         
-         return true;
-    }
-    
-    /**
-     * Validates a given instance ID
-     *
-     * @param $id the ID to check
-     * @param $client_id the calling client ID
-     * @param $is_admin a flag to ignore the client ID check for admins
-     * @return boolean
-     */
-    public function isValidInstanceID($id, $client_id, $is_admin = false)
-    {
-        global $app;
-        
-         if(preg_match('/^[0-9]+$/', $id) != 1) return false;
-         
-         // Only filter if not admin
-         $sql_ext = (!$is_admin) ? 'customer_id = '.$app->db->quote($client_id).' AND' : ''; 
 
-         $result = $app->db->queryOneRecord('SELECT id FROM aps_instances WHERE '.$sql_ext.' id = '.$app->db->quote($id).';');
-         if(!$result) return false;
-         
-         return true;
-    }    
-    
-    /**
-     * Creates a new database record for the package instance and
-     * an install task
-     * 
-     * @param $settings the settings to enter into the DB
-     * @param $packageid the PackageID
-     */
-    public function createPackageInstance($settings, $packageid)
-    {
+
+	/**
+	 * Finds out if there is a newer package version for
+	 * a given (possibly valid) package ID
+	 *
+	 * @param $id the ID to check
+	 * @return $newer_pkg_id the newer package ID
+	 */
+	public function getNewestPackageID($id)
+	{
 		global $app;
-		
+
+		if(preg_match('/^[0-9]+$/', $id) != 1) return 0;
+
+		$result = $app->db->queryOneRecord("SELECT id, name,
+            CONCAT(version, '-', CAST(`release` AS CHAR)) AS current_version
+            FROM aps_packages
+            WHERE name = (SELECT name FROM aps_packages WHERE id = ".$app->db->quote($id).")
+            ORDER BY REPLACE(version, '.', '')+0 DESC, `release` DESC");
+
+		if(!empty($result) && ($id != $result['id'])) return $result['id'];
+
+		return 0;
+	}
+
+	/**
+	 * Validates a given package ID
+	 *
+	 * @param $id the ID to check
+	 * @param $is_admin a flag to allow locked IDs too (for admin calls)
+	 * @return boolean
+	 */
+	public function isValidPackageID($id, $is_admin = false)
+	{
+		global $app;
+
+		if(preg_match('/^[0-9]+$/', $id) != 1) return false;
+
+		$sql_ext = (!$is_admin) ?
+			'package_status = '.PACKAGE_ENABLED.' AND' :
+			'(package_status = '.PACKAGE_ENABLED.' OR package_status = '.PACKAGE_LOCKED.') AND';
+
+		$result = $app->db->queryOneRecord("SELECT id FROM aps_packages WHERE ".$sql_ext." id = ".$app->db->quote($id).";");
+		if(!$result) return false;
+
+		return true;
+	}
+
+
+
+	/**
+	 * Validates a given instance ID
+	 *
+	 * @param $id the ID to check
+	 * @param $client_id the calling client ID
+	 * @param $is_admin a flag to ignore the client ID check for admins
+	 * @return boolean
+	 */
+	public function isValidInstanceID($id, $client_id, $is_admin = false)
+	{
+		global $app;
+
+		if(preg_match('/^[0-9]+$/', $id) != 1) return false;
+
+		// Only filter if not admin
+		$sql_ext = (!$is_admin) ? 'customer_id = '.$app->db->quote($client_id).' AND' : '';
+
+		$result = $app->db->queryOneRecord('SELECT id FROM aps_instances WHERE '.$sql_ext.' id = '.$app->db->quote($id).';');
+		if(!$result) return false;
+
+		return true;
+	}
+
+
+
+	/**
+	 * Creates a new database record for the package instance and
+	 * an install task
+	 *
+	 * @param $settings the settings to enter into the DB
+	 * @param $packageid the PackageID
+	 */
+	public function createPackageInstance($settings, $packageid)
+	{
+		global $app;
+
 		$app->uses('tools_sites');
-        
+
 		$webserver_id = 0;
-        $websrv = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '".$app->db->quote($settings['main_domain'])."';");
-        if(!empty($websrv)) $webserver_id = $websrv['server_id'];
-        $customerid = $this->getCustomerIDFromDomain($settings['main_domain']);
-        
-        if(empty($settings) || empty($webserver_id)) return false;
-		
+		$websrv = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '".$app->db->quote($settings['main_domain'])."';");
+		if(!empty($websrv)) $webserver_id = $websrv['server_id'];
+		$customerid = $this->getCustomerIDFromDomain($settings['main_domain']);
+
+		if(empty($settings) || empty($webserver_id)) return false;
+
 		//* Get server config of the web server
 		$app->uses("getconf");
-		$web_config = $app->getconf->get_server_config($app->functions->intval($websrv["server_id"]),'web');
-			
+		$web_config = $app->getconf->get_server_config($app->functions->intval($websrv["server_id"]), 'web');
+
 		//* Set PHP mode to php-fcgi and enable suexec in website on apache servers / set PHP mode to PHP-FPM on nginx servers
 		if($web_config['server_type'] == 'apache') {
 			if(($websrv['php'] != 'fast-cgi' || $websrv['suexec'] != 'y') && $websrv['php'] != 'php-fpm') {
@@ -231,59 +247,59 @@
 				$app->db->datalogUpdate('web_domain', "php = 'php-fpm'", 'domain_id', $websrv['domain_id']);
 			}
 		}
-		
-		
+
+
 		//* Create the MySQL database for the application
 		$pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($packageid).';');
 		$metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
 		$sxe = $this->readInMetaFile($metafile);
-		
+
 		$db_id = parent::getXPathValue($sxe, '//db:id');
 		if (!empty($db_id)) {
 			$global_config = $app->getconf->get_global_config('sites');
-			
+
 			$tmp = array();
 			$tmp['parent_domain_id'] = $websrv['domain_id'];
 			$tmp['sys_groupid'] = $websrv['sys_groupid'];
 			$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $tmp);
 			$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $tmp);
 			unset($tmp);
-			
-            // get information if the webserver is a db server, too
-            $web_server = $app->db->queryOneRecord("SELECT server_id,server_name,db_server FROM server WHERE server_id  = ".$websrv['server_id']);
-            if($web_server['db_server'] == 1) {
-                // create database on "localhost" (webserver)
+
+			// get information if the webserver is a db server, too
+			$web_server = $app->db->queryOneRecord("SELECT server_id,server_name,db_server FROM server WHERE server_id  = ".$websrv['server_id']);
+			if($web_server['db_server'] == 1) {
+				// create database on "localhost" (webserver)
 				$mysql_db_server_id = $websrv['server_id'];
 				$mysql_db_host = 'localhost';
 				$mysql_db_remote_access = 'n';
 				$mysql_db_remote_ips = '';
-            } else {
-                //* get the default database server of the client
-                $client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$websrv['sys_groupid']);
-                if(is_array($client) && $client['default_dbserver'] > 0 && $client['default_dbserver'] != $websrv['server_id']) {
-                    $mysql_db_server_id =  $client['default_dbserver'];
-                    $dbserver_config = $web_config = $app->getconf->get_server_config($app->functions->intval($mysql_db_server_id),'server');
-                    $mysql_db_host = $dbserver_config['ip_address'];
-                    $mysql_db_remote_access = 'y';
-                    $webserver_config = $app->getconf->get_server_config($app->functions->intval($websrv['server_id']),'server');
-                    $mysql_db_remote_ips = $webserver_config['ip_address'];
-                } else {
-                    /* I left this in place for a fallback that should NEVER! happen.
+			} else {
+				//* get the default database server of the client
+				$client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$websrv['sys_groupid']);
+				if(is_array($client) && $client['default_dbserver'] > 0 && $client['default_dbserver'] != $websrv['server_id']) {
+					$mysql_db_server_id =  $client['default_dbserver'];
+					$dbserver_config = $web_config = $app->getconf->get_server_config($app->functions->intval($mysql_db_server_id), 'server');
+					$mysql_db_host = $dbserver_config['ip_address'];
+					$mysql_db_remote_access = 'y';
+					$webserver_config = $app->getconf->get_server_config($app->functions->intval($websrv['server_id']), 'server');
+					$mysql_db_remote_ips = $webserver_config['ip_address'];
+				} else {
+					/* I left this in place for a fallback that should NEVER! happen.
                      * if we reach this point it means that there is NO default db server for the client
                      * AND the webserver has NO db service enabled.
                      * We have to abort the aps installation here... so I added a return false
                      * although this does not present any error message to the user.
                      */
-                    return false;
-                    
-                    /*$mysql_db_server_id = $websrv['server_id'];
+					return false;
+
+					/*$mysql_db_server_id = $websrv['server_id'];
                     $mysql_db_host = 'localhost';
                     $mysql_db_remote_access = 'n';
                     $mysql_db_remote_ips = '';*/
-                }
-            }
-			
-            //* Find a free db name for the app
+				}
+			}
+
+			//* Find a free db name for the app
 			for($n = 1; $n <= 1000; $n++) {
 				$mysql_db_name = ($dbname_prefix != '' ? $dbname_prefix.'aps'.$n : uniqid('aps'));
 				$tmp = $app->db->queryOneRecord("SELECT count(database_id) as number FROM web_database WHERE database_name = '".$app->db->quote($mysql_db_name)."'");
@@ -295,30 +311,30 @@
 				$tmp = $app->db->queryOneRecord("SELECT count(database_user_id) as number FROM web_database_user WHERE database_user = '".$app->db->quote($mysql_db_user)."'");
 				if($tmp['number'] == 0) break;
 			}
-			
+
 			$mysql_db_password = $settings['main_database_password'];
-			
+
 			//* Create the mysql database user
-			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `database_user`, `database_user_prefix`, `database_password`) 
+			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `database_user`, `database_user_prefix`, `database_password`)
 					  VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', 0, '$mysql_db_user', '".$app->db->quote($dbuser_prefix) . "', PASSWORD('$mysql_db_password'))";
 			$mysql_db_user_id = $app->db->datalogInsert('web_database_user', $insert_data, 'database_user_id');
-            
+
 			//* Create the mysql database
-			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `parent_domain_id`, `type`, `database_name`, `database_name_prefix`, `database_user_id`, `database_ro_user_id`, `database_charset`, `remote_access`, `remote_ips`, `backup_copies`, `active`, `backup_interval`) 
+			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `parent_domain_id`, `type`, `database_name`, `database_name_prefix`, `database_user_id`, `database_ro_user_id`, `database_charset`, `remote_access`, `remote_ips`, `backup_copies`, `active`, `backup_interval`)
 					  VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', $mysql_db_server_id, ".$websrv['domain_id'].", 'mysql', '$mysql_db_name', '" . $app->db->quote($dbname_prefix) . "', '$mysql_db_user_id', 0, '', '$mysql_db_remote_access', '$mysql_db_remote_ips', ".$websrv['backup_copies'].", 'y', '".$websrv['backup_interval']."')";
 			$app->db->datalogInsert('web_database', $insert_data, 'database_id');
-			
+
 			//* Add db details to package settings
 			$settings['main_database_host'] = $mysql_db_host;
 			$settings['main_database_name'] = $mysql_db_name;
 			$settings['main_database_login'] = $mysql_db_user;
-		
+
 		}
-		
+
 		//* Insert new package instance
 		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `customer_id`, `package_id`, `instance_status`) VALUES (".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', ".$app->db->quote($webserver_id).",".$app->db->quote($customerid).", ".$app->db->quote($packageid).", ".INSTANCE_PENDING.")";
 		$InstanceID = $app->db->datalogInsert('aps_instances', $insert_data, 'id');
-		
+
 		//* Insert all package settings
 		if(is_array($settings)) {
 			foreach($settings as $key => $value) {
@@ -326,520 +342,530 @@
 				$app->db->datalogInsert('aps_instances_settings', $insert_data, 'id');
 			}
 		}
-		
+
 		//* Set package status to install afetr we inserted the settings
 		$app->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_INSTALL, 'id', $InstanceID);
-    }
-    
-    /**
-     * Sets the status of an instance to "should be removed" and creates a 
-     * datalog entry to give the ISPConfig server a real removal advice 
-     * 
-     * @param $instanceid the instance to delete
-     */
-    public function deleteInstance($instanceid)
-    {
-        global $app;
+	}
+
+
+
+	/**
+	 * Sets the status of an instance to "should be removed" and creates a
+	 * datalog entry to give the ISPConfig server a real removal advice
+	 *
+	 * @param $instanceid the instance to delete
+	 */
+	public function deleteInstance($instanceid)
+	{
+		global $app;
 		/*
 		$app->db->query("UPDATE aps_instances SET instance_status = ".INSTANCE_REMOVE." WHERE id = ".$instanceid.";");
-        
+
         $webserver_id = $this->getInstanceDataForDatalog($instanceid);
         if($webserver_id == '') return;
-        
+
         // Create a sys_datalog entry for deletion
         $datalog = array('Instance_id' => $instanceid, 'server_id' => $webserver_id);
         $app->db->datalogSave('aps', 'DELETE', 'id', $instanceid, array(), $datalog);
 		*/
-		
+
 		$sql = "SELECT web_database.database_id as database_id, web_database.database_user_id as `database_user_id` FROM aps_instances_settings, web_database WHERE aps_instances_settings.value = web_database.database_name AND aps_instances_settings.name = 'main_database_name' AND aps_instances_settings.instance_id = ".$instanceid." LIMIT 0,1";
 		$tmp = $app->db->queryOneRecord($sql);
 		if($tmp['database_id'] > 0) $app->db->datalogDelete('web_database', 'database_id', $tmp['database_id']);
-		
-        $database_user = $tmp['database_user_id'];
-        $tmp = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . $app->functions->intval($database_user) . "' OR `database_ro_user_id` = '" . $app->functions->intval($database_user) . "'");
-        if($tmp['cnt'] < 1) $app->db->datalogDelete('web_database_user', 'database_user_id', $database_user);
-        
+
+		$database_user = $tmp['database_user_id'];
+		$tmp = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . $app->functions->intval($database_user) . "' OR `database_ro_user_id` = '" . $app->functions->intval($database_user) . "'");
+		if($tmp['cnt'] < 1) $app->db->datalogDelete('web_database_user', 'database_user_id', $database_user);
+
 		$app->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_REMOVE, 'id', $instanceid);
 
-    }
-    
-    /**
-     * Sets the status of an instance to "installation planned" and creates a 
-     * datalog entry to re-install the package. The existing package is simply overwritten. 
-     * 
-     * @param $instanceid the instance to delete
-     */
-    public function reinstallInstance($instanceid)
-    {
-        global $app;
-        
-        /*
+	}
+
+
+
+	/**
+	 * Sets the status of an instance to "installation planned" and creates a
+	 * datalog entry to re-install the package. The existing package is simply overwritten.
+	 *
+	 * @param $instanceid the instance to delete
+	 */
+	public function reinstallInstance($instanceid)
+	{
+		global $app;
+
+		/*
 		$app->db->query("UPDATE aps_instances SET instance_status = ".INSTANCE_INSTALL." WHERE id = ".$instanceid.";");
-        
+
         $webserver_id = $this->getInstanceDataForDatalog($instanceid);
         if($webserver_id == '') return;
-        
+
         // Create a sys_datalog entry for re-installation
         $datalog = array('instance_id' => $instanceid, 'server_id' => $webserver_id);
         $app->db->datalogSave('aps', 'INSERT', 'id', $instanceid, array(), $datalog);
 		*/
-		
+
 		$sql = "SELECT web_database.database_id as database_id FROM aps_instances_settings, web_database WHERE aps_instances_settings.value = web_database.database_name AND aps_instances_settings.value =  aps_instances_settings.name = 'main_database_name' AND aps_instances_settings.instance_id = ".$instanceid." LIMIT 0,1";
 		$tmp = $app->db->queryOneRecord($sql);
 		if($tmp['database_id'] > 0) $app->db->datalogDelete('web_database', 'database_id', $tmp['database_id']);
-		
+
 		$app->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_INSTALL, 'id', $instanceid);
-    }
+	}
 
-    /**
-     * Read the settings to be filled when installing
-     * 
-     * @param $id the internal ID of the package
-     * @return array
-     */
-    public function getPackageSettings($id)    
-    {
-        global $app;
-        
-        $pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($id).';');
-        
-        // Load in meta file if existing and register its namespaces
-        $metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
-        if(!file_exists($metafile)) 
-            return array('error' => 'The metafile for '.$settings['Name'].' couldn\'t be found');
-        
-        $sxe = $this->readInMetaFile($metafile);
-        
-        $groupsettings = parent::getXPathValue($sxe, '//settings/group/setting', true);
-        if(empty($groupsettings)) return array();
-        
-        $settings = array();
-        foreach($groupsettings as $setting)
-        {
-            $setting_id = strval($setting['id']);
-            
-            if($setting['type'] == 'string' || $setting['type'] == 'email' || $setting['type'] == 'integer'
-            || $setting['type'] == 'float' || $setting['type'] == 'domain-name')
-            {
-                $settings[] = array('SettingID' => $setting_id,
-                                    'SettingName' => $setting->name,
-                                    'SettingDescription' => $setting->description,
-                                    'SettingType' => $setting['type'],
-                                    'SettingInputType' => 'string',
-                                    'SettingDefaultValue' => strval($setting['default-value']),
-                                    'SettingRegex' => $setting['regex'],
-                                    'SettingMinLength' => $setting['min-length'],
-                                    'SettingMaxLength' => $setting['max-length']);
-            }
-            else if($setting['type'] == 'password')
-            {
-                $settings[] = array('SettingID' => $setting_id,
-                                    'SettingName' => $setting->name,
-                                    'SettingDescription' => $setting->description,
-                                    'SettingType' => 'password',
-                                    'SettingInputType' => 'password',
-                                    'SettingDefaultValue' => '',
-                                    'SettingRegex' => $setting['regex'],
-                                    'SettingMinLength' => $setting['min-length'],
-                                    'SettingMaxLength' => $setting['max-length']);
-            }
-            else if($setting['type'] == 'boolean')
-            {
-                $settings[] = array('SettingID' => $setting_id,
-                                    'SettingName' => $setting->name,
-                                    'SettingDescription' => $setting->description,
-                                    'SettingType' => 'boolean',
-                                    'SettingInputType' => 'checkbox',
-                                    'SettingDefaultValue' => strval($setting['default-value']));
-            }
-            else if($setting['type'] == 'enum')
-            {
-              $choices = array();
-              foreach($setting->choice as $choice)
-              {
-                $choices[] = array('EnumID' => strval($choice['id']),
-                                   'EnumName' => $choice->name);
-              }
-              $settings[] = array('SettingID' => $setting_id,
-                                  'SettingName' => $setting->name,
-                                  'SettingDescription' => $setting->description,
-                                  'SettingType' => 'enum',
-                                  'SettingInputType' => 'select',
-                                  'SettingDefaultValue' => strval($setting['default-value']),
-                                  'SettingChoices' => $choices);
-            }
-        }
+	/**
+	 * Read the settings to be filled when installing
+	 *
+	 * @param $id the internal ID of the package
+	 * @return array
+	 */
+	public function getPackageSettings($id)
+	{
+		global $app;
 
-        return $settings;
-    }
-    
-    /**
-     * Validates the user input according to the settings array and
-     * delivers errors if occurring
-     * 
-     * @param $input the user $_POST array
-     * @param $pkg_details the package details
-     * @param $settings the package settings array
-     * @return array in this structure:
-     *               array(2) {
-     *                  ["input"]=> ...
-     *                  ["errors"]=> ...
-     *               }
-     */
-    public function validateInstallerInput($postinput, $pkg_details, $domains, $settings = array())
-    {
-        global $app;
-        
-        $ret = array();
-        $input = array(); 
-        $error = array();
-        
-        // Main domain (obligatory)
-        if(isset($postinput['main_domain']))
-        {
-            if(!in_array($postinput['main_domain'], $domains)) $error[] = $app->lng('error_main_domain');
-            else $input['main_domain'] = $postinput['main_domain'];
-        }
-        else $error[] = $app->lng('error_main_domain'); 
-        
-        // Main location (not obligatory but must be supplied)
-        if(isset($postinput['main_location']))
-        {
-            $temp_errstr = '';
-            // It can be empty but if the user did write something, check it
-            $userinput = false;
-            if(strlen($postinput['main_location']) > 0) $userinput = true; 
-            
-            // Filter invalid input slashes (twice!)
-            $main_location = $this->secureLocation($postinput['main_location']);
-            $main_location = $this->secureLocation($main_location);
-            // Only allow digits, words, / and -
-            $main_location = preg_replace("/[^\d\w\/\-]/i", "", $main_location);
-            if($userinput && (strlen($main_location) == 0)) $temp_errstr = $app->lng('error_inv_main_location');
-            
-            // Find out document_root and make sure no apps are installed twice to one location
-            if(in_array($postinput['main_domain'], $domains))
-            {
-                $docroot = $app->db->queryOneRecord("SELECT document_root FROM web_domain 
+		$pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($id).';');
+
+		// Load in meta file if existing and register its namespaces
+		$metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
+		if(!file_exists($metafile))
+			return array('error' => 'The metafile for '.$settings['Name'].' couldn\'t be found');
+
+		$sxe = $this->readInMetaFile($metafile);
+
+		$groupsettings = parent::getXPathValue($sxe, '//settings/group/setting', true);
+		if(empty($groupsettings)) return array();
+
+		$settings = array();
+		foreach($groupsettings as $setting)
+		{
+			$setting_id = strval($setting['id']);
+
+			if($setting['type'] == 'string' || $setting['type'] == 'email' || $setting['type'] == 'integer'
+				|| $setting['type'] == 'float' || $setting['type'] == 'domain-name')
+			{
+				$settings[] = array('SettingID' => $setting_id,
+					'SettingName' => $setting->name,
+					'SettingDescription' => $setting->description,
+					'SettingType' => $setting['type'],
+					'SettingInputType' => 'string',
+					'SettingDefaultValue' => strval($setting['default-value']),
+					'SettingRegex' => $setting['regex'],
+					'SettingMinLength' => $setting['min-length'],
+					'SettingMaxLength' => $setting['max-length']);
+			}
+			else if($setting['type'] == 'password')
+				{
+					$settings[] = array('SettingID' => $setting_id,
+						'SettingName' => $setting->name,
+						'SettingDescription' => $setting->description,
+						'SettingType' => 'password',
+						'SettingInputType' => 'password',
+						'SettingDefaultValue' => '',
+						'SettingRegex' => $setting['regex'],
+						'SettingMinLength' => $setting['min-length'],
+						'SettingMaxLength' => $setting['max-length']);
+				}
+			else if($setting['type'] == 'boolean')
+				{
+					$settings[] = array('SettingID' => $setting_id,
+						'SettingName' => $setting->name,
+						'SettingDescription' => $setting->description,
+						'SettingType' => 'boolean',
+						'SettingInputType' => 'checkbox',
+						'SettingDefaultValue' => strval($setting['default-value']));
+				}
+			else if($setting['type'] == 'enum')
+				{
+					$choices = array();
+					foreach($setting->choice as $choice)
+					{
+						$choices[] = array('EnumID' => strval($choice['id']),
+							'EnumName' => $choice->name);
+					}
+					$settings[] = array('SettingID' => $setting_id,
+						'SettingName' => $setting->name,
+						'SettingDescription' => $setting->description,
+						'SettingType' => 'enum',
+						'SettingInputType' => 'select',
+						'SettingDefaultValue' => strval($setting['default-value']),
+						'SettingChoices' => $choices);
+				}
+		}
+
+		return $settings;
+	}
+
+
+
+	/**
+	 * Validates the user input according to the settings array and
+	 * delivers errors if occurring
+	 *
+	 * @param $input the user $_POST array
+	 * @param $pkg_details the package details
+	 * @param $settings the package settings array
+	 * @return array in this structure:
+	 *               array(2) {
+	 *                  ["input"]=> ...
+	 *                  ["errors"]=> ...
+	 *               }
+	 */
+	public function validateInstallerInput($postinput, $pkg_details, $domains, $settings = array())
+	{
+		global $app;
+
+		$ret = array();
+		$input = array();
+		$error = array();
+
+		// Main domain (obligatory)
+		if(isset($postinput['main_domain']))
+		{
+			if(!in_array($postinput['main_domain'], $domains)) $error[] = $app->lng('error_main_domain');
+			else $input['main_domain'] = $postinput['main_domain'];
+		}
+		else $error[] = $app->lng('error_main_domain');
+
+		// Main location (not obligatory but must be supplied)
+		if(isset($postinput['main_location']))
+		{
+			$temp_errstr = '';
+			// It can be empty but if the user did write something, check it
+			$userinput = false;
+			if(strlen($postinput['main_location']) > 0) $userinput = true;
+
+			// Filter invalid input slashes (twice!)
+			$main_location = $this->secureLocation($postinput['main_location']);
+			$main_location = $this->secureLocation($main_location);
+			// Only allow digits, words, / and -
+			$main_location = preg_replace("/[^\d\w\/\-]/i", "", $main_location);
+			if($userinput && (strlen($main_location) == 0)) $temp_errstr = $app->lng('error_inv_main_location');
+
+			// Find out document_root and make sure no apps are installed twice to one location
+			if(in_array($postinput['main_domain'], $domains))
+			{
+				$docroot = $app->db->queryOneRecord("SELECT document_root FROM web_domain
                     WHERE domain = '".$app->db->quote($postinput['main_domain'])."';");
-                $new_path = $docroot['document_root'];
-                if(substr($new_path, -1) != '/') $new_path .= '/';
-                $new_path .= $main_location;
-                
-                // Get the $customerid which belongs to the selected domain
-                $customerid = $this->getCustomerIDFromDomain($postinput['main_domain']);
-                
-                // First get all domains used for an install, then their loop them
-                // and get the corresponding document roots as well as the defined
-                // locations. If an existing doc_root + location matches with the
-                // new one -> error
-                $instance_domains = $app->db->queryAllRecords("SELECT instance_id, s.value AS domain 
-                    FROM aps_instances AS i, aps_instances_settings AS s 
-                    WHERE i.id = s.instance_id AND s.name = 'main_domain' 
+				$new_path = $docroot['document_root'];
+				if(substr($new_path, -1) != '/') $new_path .= '/';
+				$new_path .= $main_location;
+
+				// Get the $customerid which belongs to the selected domain
+				$customerid = $this->getCustomerIDFromDomain($postinput['main_domain']);
+
+				// First get all domains used for an install, then their loop them
+				// and get the corresponding document roots as well as the defined
+				// locations. If an existing doc_root + location matches with the
+				// new one -> error
+				$instance_domains = $app->db->queryAllRecords("SELECT instance_id, s.value AS domain
+                    FROM aps_instances AS i, aps_instances_settings AS s
+                    WHERE i.id = s.instance_id AND s.name = 'main_domain'
                         AND i.customer_id = '".$app->db->quote($customerid)."';");
-                for($i = 0; $i < count($instance_domains); $i++)
-                {
-                    $used_path = '';
-                    
-                    $doc_root = $app->db->queryOneRecord("SELECT document_root FROM web_domain 
+				for($i = 0; $i < count($instance_domains); $i++)
+				{
+					$used_path = '';
+
+					$doc_root = $app->db->queryOneRecord("SELECT document_root FROM web_domain
                         WHERE domain = '".$app->db->quote($instance_domains[$i]['domain'])."';");
 
-                    // Probably the domain settings were changed later, so make sure the doc_root
-                    // is not empty for further validation
-                    if(!empty($doc_root))
-                    {
-                        $used_path = $doc_root['document_root'];
-                        if(substr($used_path, -1) != '/') $used_path .= '/';
-                        
-                        $location_for_domain = $app->db->queryOneRecord("SELECT value 
-                            FROM aps_instances_settings WHERE name = 'main_location' 
+					// Probably the domain settings were changed later, so make sure the doc_root
+					// is not empty for further validation
+					if(!empty($doc_root))
+					{
+						$used_path = $doc_root['document_root'];
+						if(substr($used_path, -1) != '/') $used_path .= '/';
+
+						$location_for_domain = $app->db->queryOneRecord("SELECT value
+                            FROM aps_instances_settings WHERE name = 'main_location'
                             AND instance_id = '".$app->db->quote($instance_domains[$i]['instance_id'])."';");
-                        
-                        // The location might be empty but the DB return must not be false!
-                        if($location_for_domain) $used_path .= $location_for_domain['value'];  						
 
-                        if($new_path == $used_path)
-                        {
-                            $temp_errstr = $app->lng('error_used_location');
-                            break;
-                        }
-                    }
-                }
-            }
-            else $temp_errstr = $app->lng('error_main_domain');
-            
-            if($temp_errstr == '') $input['main_location'] = htmlspecialchars($main_location);
-            else $error[] = $temp_errstr;            
-        }
-        else $error[] = $app->lng('error_no_main_location');
-        
-        // License (the checkbox must be set)
-        if(isset($pkg_details['License need agree']) 
-        && $pkg_details['License need agree'] == 'true')
-        {
-            if(isset($postinput['license']) && $postinput['license'] == 'on') $input['license'] = 'true';
-            else $error[] = $app->lng('error_license_agreement');
-        } 
-        
-        // Database
-        if(isset($pkg_details['Requirements Database'])
-        && $pkg_details['Requirements Database'] != '')
-        {
-            if(isset($postinput['main_database_password']))
-            {
-                if($postinput['main_database_password'] == '') $error[] = $app->lng('error_no_database_pw');
-                else if(strlen($postinput['main_database_password']) > 8) 
-                    $input['main_database_password'] = htmlspecialchars($postinput['main_database_password']);
-                else $error[] = $app->lng('error_short_database_pw');
-            }
-            else $error[] = $app->lng('error_no_database_pw');
-        }
-        
-        // Validate the package settings 
-        foreach($settings as $setting)
-        {
-            $temp_errstr = '';
-            $setting_id = strval($setting['SettingID']); 
-            
-            // We assume that every setting must be set
-            if((isset($postinput[$setting_id]) && ($postinput[$setting_id] != ''))
-            || ($setting['SettingType'] == 'boolean'))
-            {
-                if($setting['SettingType'] == 'string' || $setting['SettingType'] == 'password')
-                {
-                    if($app->functions->intval($setting['SettingMinLength'], true) != 0 
-                    && strlen($postinput[$setting_id]) < $app->functions->intval($setting['SettingMinLength'], true))
-                        $temp_errstr = sprintf($app->lng('error_short_value_for'), $setting['setting_name']);
-                        
-                    if($app->functions->intval($setting['SettingMaxLength'], true) != 0 
-                    && strlen($postinput[$setting_id]) > $app->functions->intval($setting['SettingMaxLength'], true))
-                        $temp_errstr = sprintf($app->lng('error_long_value_for'), $setting['setting_name']);
+						// The location might be empty but the DB return must not be false!
+						if($location_for_domain) $used_path .= $location_for_domain['value'];
 
-                    if(isset($setting['SettingRegex'])
-                    && !preg_match("/".$setting['SettingRegex']."/", $postinput[$setting_id]))
-                        $temp_errstr = sprintf($app->lng('error_inv_value_for'), $setting['setting_name']);
-                }
-                else if($setting['SettingType'] == 'email')
-                {
-                    if(filter_var(strtolower($postinput[$setting_id]), FILTER_VALIDATE_EMAIL) === false)
-                        $temp_errstr = sprintf($app->lng('error_inv_email_for'), $setting['setting_name']);
-                }
-                else if($setting['SettingType'] == 'domain-name')
-                {
-                    if(!preg_match("^(http|https)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$", 
-                        $postinput[$setting_id]))
-                    $temp_errstr = sprintf($app->lng('error_inv_domain_for'), $setting['setting_name']);    
-                }
-                else if($setting['SettingType'] == 'integer')
-                {
-                    if(filter_var($postinput[$setting_id], FILTER_VALIDATE_INT) === false)
-                        $temp_errstr = sprintf($app->lng('error_inv_integer_for'), $setting['setting_name']);
-                }
-                else if($setting['SettingType'] == 'float')
-                {
-                    if(filter_var($postinput[$setting_id], FILTER_VALIDATE_FLOAT) === false)
-                        $temp_errstr = sprintf($app->lng('error_inv_float_for'), $setting['setting_name']);
-                }
-                else if($setting['SettingType'] == 'boolean')
-                {
-                    // If we have a boolean value set, it must be either true or false
-                    if(!isset($postinput[$setting_id])) $postinput[$setting_id] = 'false';
-                    else if(isset($postinput[$setting_id]) && $postinput[$setting_id] != 'true') 
-                        $postinput[$setting_id] = 'true';
-                }
-                else if($setting['SettingType'] == 'enum')
-                {
-                    $found = false;
-                    for($i = 0; $i < count($setting['SettingChoices']); $i++)
-                    {
-                        if($setting['SettingChoices'][$i]['EnumID'] == $postinput[$setting_id])
-                            $found = true;
-                    }
-                    if(!$found) $temp_errstr = sprintf($app->lng('error_inv_value_for'), $setting['SettingName']);
-                }
-                
-                if($temp_errstr == '') $input[$setting_id] = $postinput[$setting_id];
-                else $error[] = $temp_errstr;
-            }
-            else $error[] = sprintf($app->lng('error_no_value_for'), $setting['SettingName']);
-        }
-        
-        $ret['input'] = $input;
-        $ret['error'] = array_unique($error);
-        
-        return $ret;
-    }
-    
-    /**
-     * Read the metadata of a package and returns some content
-     * 
-     * @param $id the internal ID of the package
-     * @return array
-     */
-    public function getPackageDetails($id)
-    {
-        global $app;
-        
-        $pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($id).';');
-        
-        // Load in meta file if existing and register its namespaces
-        $metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
-        if(!file_exists($metafile)) 
-            return array('error' => 'The metafile for '.$pkg['name'].' couldn\'t be found');
-        
-        $metadata = file_get_contents($metafile);
-        $metadata = str_replace("xmlns=", "ns=", $metadata);
-        $sxe = new SimpleXMLElement($metadata);
-        $namespaces = $sxe->getDocNamespaces(true);
-        foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url); 
+						if($new_path == $used_path)
+						{
+							$temp_errstr = $app->lng('error_used_location');
+							break;
+						}
+					}
+				}
+			}
+			else $temp_errstr = $app->lng('error_main_domain');
 
-        $pkg['Summary'] = htmlspecialchars(parent::getXPathValue($sxe, '//summary'));
-        $pkg['Homepage'] = parent::getXPathValue($sxe, '//homepage');
-        $pkg['Description'] = nl2br(htmlspecialchars(trim(parent::getXPathValue($sxe, '//description'))));
-        $pkg['Config script'] = strtoupper(parent::getXPathValue($sxe, '//configuration-script-language'));
-        $installed_size = parent::getXPathValue($sxe, '//installed-size');
-        $pkg['Installed Size'] = (!empty($installed_size)) ? parent::convertSize((int)$installed_size) : '';        
-        
-        // License
-        $pkg['License need agree'] = parent::getXPathValue($sxe, '//license/@must-accept');
-        $pkg['License name'] = parent::getXPathValue($sxe, '//license/text/name'); // might be empty
-        $pkg['License type'] = 'file'; // default type
-        $pkg['License content'] = ''; // default license filename on local system
-        $license_url = parent::getXPathValue($sxe, '//license/text/url');
-        if(!empty($license_url)) 
-        {
-            $pkg['License type'] = 'url';
-            $pkg['License content'] = htmlspecialchars($license_url);
-        }
-        else
-        {
-            $lic = @file_get_contents($this->interface_pkg_dir.'/'.$pkg['path'].'/LICENSE');
-            $pkg['License content'] = htmlentities($lic, ENT_QUOTES, 'ISO-8859-1');
-        }  
-        
-        // Languages
-        $languages = parent::getXPathValue($sxe, '//languages/language', true);
-        $pkg['Languages'] = (is_array($languages)) ? implode(' ', $languages) : '';
-        
-        // Icon
-        $icon = parent::getXPathValue($sxe, '//icon/@path');
-        if(!empty($icon))
-        {
-            // Using parse_url() to filter malformed URLs
-            $path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
-                    basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$icon);
+			if($temp_errstr == '') $input['main_location'] = htmlspecialchars($main_location);
+			else $error[] = $temp_errstr;
+		}
+		else $error[] = $app->lng('error_no_main_location');
+
+		// License (the checkbox must be set)
+		if(isset($pkg_details['License need agree'])
+			&& $pkg_details['License need agree'] == 'true')
+		{
+			if(isset($postinput['license']) && $postinput['license'] == 'on') $input['license'] = 'true';
+			else $error[] = $app->lng('error_license_agreement');
+		}
+
+		// Database
+		if(isset($pkg_details['Requirements Database'])
+			&& $pkg_details['Requirements Database'] != '')
+		{
+			if(isset($postinput['main_database_password']))
+			{
+				if($postinput['main_database_password'] == '') $error[] = $app->lng('error_no_database_pw');
+				else if(strlen($postinput['main_database_password']) > 8)
+						$input['main_database_password'] = htmlspecialchars($postinput['main_database_password']);
+					else $error[] = $app->lng('error_short_database_pw');
+			}
+			else $error[] = $app->lng('error_no_database_pw');
+		}
+
+		// Validate the package settings
+		foreach($settings as $setting)
+		{
+			$temp_errstr = '';
+			$setting_id = strval($setting['SettingID']);
+
+			// We assume that every setting must be set
+			if((isset($postinput[$setting_id]) && ($postinput[$setting_id] != ''))
+				|| ($setting['SettingType'] == 'boolean'))
+			{
+				if($setting['SettingType'] == 'string' || $setting['SettingType'] == 'password')
+				{
+					if($app->functions->intval($setting['SettingMinLength'], true) != 0
+						&& strlen($postinput[$setting_id]) < $app->functions->intval($setting['SettingMinLength'], true))
+						$temp_errstr = sprintf($app->lng('error_short_value_for'), $setting['setting_name']);
+
+					if($app->functions->intval($setting['SettingMaxLength'], true) != 0
+						&& strlen($postinput[$setting_id]) > $app->functions->intval($setting['SettingMaxLength'], true))
+						$temp_errstr = sprintf($app->lng('error_long_value_for'), $setting['setting_name']);
+
+					if(isset($setting['SettingRegex'])
+						&& !preg_match("/".$setting['SettingRegex']."/", $postinput[$setting_id]))
+						$temp_errstr = sprintf($app->lng('error_inv_value_for'), $setting['setting_name']);
+				}
+				else if($setting['SettingType'] == 'email')
+					{
+						if(filter_var(strtolower($postinput[$setting_id]), FILTER_VALIDATE_EMAIL) === false)
+							$temp_errstr = sprintf($app->lng('error_inv_email_for'), $setting['setting_name']);
+					}
+				else if($setting['SettingType'] == 'domain-name')
+					{
+						if(!preg_match("^(http|https)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$",
+								$postinput[$setting_id]))
+							$temp_errstr = sprintf($app->lng('error_inv_domain_for'), $setting['setting_name']);
+					}
+				else if($setting['SettingType'] == 'integer')
+					{
+						if(filter_var($postinput[$setting_id], FILTER_VALIDATE_INT) === false)
+							$temp_errstr = sprintf($app->lng('error_inv_integer_for'), $setting['setting_name']);
+					}
+				else if($setting['SettingType'] == 'float')
+					{
+						if(filter_var($postinput[$setting_id], FILTER_VALIDATE_FLOAT) === false)
+							$temp_errstr = sprintf($app->lng('error_inv_float_for'), $setting['setting_name']);
+					}
+				else if($setting['SettingType'] == 'boolean')
+					{
+						// If we have a boolean value set, it must be either true or false
+						if(!isset($postinput[$setting_id])) $postinput[$setting_id] = 'false';
+						else if(isset($postinput[$setting_id]) && $postinput[$setting_id] != 'true')
+								$postinput[$setting_id] = 'true';
+					}
+				else if($setting['SettingType'] == 'enum')
+					{
+						$found = false;
+						for($i = 0; $i < count($setting['SettingChoices']); $i++)
+						{
+							if($setting['SettingChoices'][$i]['EnumID'] == $postinput[$setting_id])
+								$found = true;
+						}
+						if(!$found) $temp_errstr = sprintf($app->lng('error_inv_value_for'), $setting['SettingName']);
+					}
+
+				if($temp_errstr == '') $input[$setting_id] = $postinput[$setting_id];
+				else $error[] = $temp_errstr;
+			}
+			else $error[] = sprintf($app->lng('error_no_value_for'), $setting['SettingName']);
+		}
+
+		$ret['input'] = $input;
+		$ret['error'] = array_unique($error);
+
+		return $ret;
+	}
+
+
+
+	/**
+	 * Read the metadata of a package and returns some content
+	 *
+	 * @param $id the internal ID of the package
+	 * @return array
+	 */
+	public function getPackageDetails($id)
+	{
+		global $app;
+
+		$pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($id).';');
+
+		// Load in meta file if existing and register its namespaces
+		$metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
+		if(!file_exists($metafile))
+			return array('error' => 'The metafile for '.$pkg['name'].' couldn\'t be found');
+
+		$metadata = file_get_contents($metafile);
+		$metadata = str_replace("xmlns=", "ns=", $metadata);
+		$sxe = new SimpleXMLElement($metadata);
+		$namespaces = $sxe->getDocNamespaces(true);
+		foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+		$pkg['Summary'] = htmlspecialchars(parent::getXPathValue($sxe, '//summary'));
+		$pkg['Homepage'] = parent::getXPathValue($sxe, '//homepage');
+		$pkg['Description'] = nl2br(htmlspecialchars(trim(parent::getXPathValue($sxe, '//description'))));
+		$pkg['Config script'] = strtoupper(parent::getXPathValue($sxe, '//configuration-script-language'));
+		$installed_size = parent::getXPathValue($sxe, '//installed-size');
+		$pkg['Installed Size'] = (!empty($installed_size)) ? parent::convertSize((int)$installed_size) : '';
+
+		// License
+		$pkg['License need agree'] = parent::getXPathValue($sxe, '//license/@must-accept');
+		$pkg['License name'] = parent::getXPathValue($sxe, '//license/text/name'); // might be empty
+		$pkg['License type'] = 'file'; // default type
+		$pkg['License content'] = ''; // default license filename on local system
+		$license_url = parent::getXPathValue($sxe, '//license/text/url');
+		if(!empty($license_url))
+		{
+			$pkg['License type'] = 'url';
+			$pkg['License content'] = htmlspecialchars($license_url);
+		}
+		else
+		{
+			$lic = @file_get_contents($this->interface_pkg_dir.'/'.$pkg['path'].'/LICENSE');
+			$pkg['License content'] = htmlentities($lic, ENT_QUOTES, 'ISO-8859-1');
+		}
+
+		// Languages
+		$languages = parent::getXPathValue($sxe, '//languages/language', true);
+		$pkg['Languages'] = (is_array($languages)) ? implode(' ', $languages) : '';
+
+		// Icon
+		$icon = parent::getXPathValue($sxe, '//icon/@path');
+		if(!empty($icon))
+		{
+			// Using parse_url() to filter malformed URLs
+			$path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
+				basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$icon);
 			// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
 			$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
-            $pkg['Icon'] = $path;
-        }
-        else $pkg['Icon'] = '';
-        
-        // Screenshots
-        $screenshots = parent::getXPathValue($sxe, '//screenshot', true);
-        if(!empty($screenshots))
-        {
-            foreach($screenshots as $screen)
-            {
-                // Using parse_url() to filter malformed URLs
-                $path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
-                        basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$screen['path']);
-				// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path		
+			$pkg['Icon'] = $path;
+		}
+		else $pkg['Icon'] = '';
+
+		// Screenshots
+		$screenshots = parent::getXPathValue($sxe, '//screenshot', true);
+		if(!empty($screenshots))
+		{
+			foreach($screenshots as $screen)
+			{
+				// Using parse_url() to filter malformed URLs
+				$path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
+					basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$screen['path']);
+				// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
 				$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
 
-                $pkg['Screenshots'][] = array('ScreenPath' => $path,
-                                              'ScreenDescription' => htmlspecialchars(trim((string)$screen->description)));
-            }
-        }
-        else $pkg['Screenshots'] = ''; // if no screenshots are available, set the variable though
-                
-        // Changelog
-        $changelog = parent::getXPathValue($sxe, '//changelog/version', true);
-        if(!empty($changelog))
-        {
-            foreach($changelog as $change)
-            {
-                $entries = array(); 
-                foreach($change->entry as $entry) $entries[] = htmlspecialchars(trim((string)$entry)); 
+				$pkg['Screenshots'][] = array('ScreenPath' => $path,
+					'ScreenDescription' => htmlspecialchars(trim((string)$screen->description)));
+			}
+		}
+		else $pkg['Screenshots'] = ''; // if no screenshots are available, set the variable though
 
-                $pkg['Changelog'][] = array('ChangelogVersion' => (string)$change['version'], 
-                                            'ChangelogDescription' => implode('<br />', $entries));
-            }
-        }
-		
-        else $pkg['Changelog'] = '';
-        
-        // PHP extensions
-        $php_extensions = parent::getXPathValue($sxe, '//php:extension', true);
-        $php_ext = '';
-        if(!empty($php_extensions))
-        {
-            foreach($php_extensions as $extension)
-            {
-                if(strtolower($extension) == 'php') continue;
-                $php_ext .= $extension.' ';
-            }
-        }
-        $pkg['Requirements PHP extensions'] = trim($php_ext);
-        
-        // PHP bool options
-        $pkg['Requirements PHP settings'] = '';
-        $php_bool_options = array('allow-url-fopen', 'file-uploads', 'magic-quotes-gpc', 
-                                  'register-globals', 'safe-mode', 'short-open-tag');
-        foreach($php_bool_options as $option)
-        {
-            $value = parent::getXPathValue($sxe, '//php:'.$option);
-            if(!empty($value))
-            {
-                $option = str_replace('-', '_', $option);
-                $value = str_replace(array('false', 'true'), array('off', 'on'), $value);
-                $pkg['Requirements PHP settings'][] = array('PHPSettingName' => $option,
-                                                            'PHPSettingValue' => $value);
-            }
-        }
-        
-        // PHP integer value settings
-        $memory_limit = parent::getXPathValue($sxe, '//php:memory-limit');
-        if(!empty($memory_limit))
-            $pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'memory_limit',
-                                                        'PHPSettingValue' => parent::convertSize((int)$memory_limit));
+		// Changelog
+		$changelog = parent::getXPathValue($sxe, '//changelog/version', true);
+		if(!empty($changelog))
+		{
+			foreach($changelog as $change)
+			{
+				$entries = array();
+				foreach($change->entry as $entry) $entries[] = htmlspecialchars(trim((string)$entry));
 
-        $max_exec_time = parent::getXPathValue($sxe, '//php:max-execution-time');
-        if(!empty($max_exec_time))
-            $pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'max-execution-time',
-                                                        'PHPSettingValue' => $max_exec_time);
-        
-        $post_max_size = parent::getXPathValue($sxe, '//php:post-max-size');
-        if(!empty($post_max_size))
-            $pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'post_max_size',
-                                                        'PHPSettingValue' => parent::convertSize((int)$post_max_size));
-        
-        // Get supported PHP versions
-        $pkg['Requirements Supported PHP versions'] = '';
-        $php_min_version = parent::getXPathValue($sxe, '//php:version/@min');
-        $php_max_not_including = parent::getXPathValue($sxe, '//php:version/@max-not-including');
-        if(!empty($php_min_version) && !empty($php_max_not_including)) 
-            $pkg['Requirements Supported PHP versions'] = $php_min_version.' - '.$php_max_not_including;
-        else if(!empty($php_min_version)) 
-            $pkg['Requirements Supported PHP versions'] = '> '.$php_min_version;
-        else if(!empty($php_max_not_including))
-            $pkg['Requirements Supported PHP versions'] = '< '.$php_min_version;
-        
-        // Database
-        $db_id = parent::getXPathValue($sxe, '//db:id');
-        $db_server_type = parent::getXPathValue($sxe, '//db:server-type');
-        $db_min_version = parent::getXPathValue($sxe, '//db:server-min-version'); 
-        if(!empty($db_id))
-        {
-            $db_server_type = str_replace('postgresql', 'PostgreSQL', $db_server_type);
-            $db_server_type = str_replace('microsoft:sqlserver', 'MSSQL', $db_server_type);
-            $db_server_type = str_replace('mysql', 'MySQL', $db_server_type);
-            
-            $pkg['Requirements Database'] = $db_server_type;
-            if(!empty($db_min_version)) $pkg['Requirements Database'] .= ' > '.$db_min_version;
-        }
-        else $pkg['Requirements Database'] = '';
-        
-        return $pkg;
-    }
+				$pkg['Changelog'][] = array('ChangelogVersion' => (string)$change['version'],
+					'ChangelogDescription' => implode('<br />', $entries));
+			}
+		}
+
+		else $pkg['Changelog'] = '';
+
+		// PHP extensions
+		$php_extensions = parent::getXPathValue($sxe, '//php:extension', true);
+		$php_ext = '';
+		if(!empty($php_extensions))
+		{
+			foreach($php_extensions as $extension)
+			{
+				if(strtolower($extension) == 'php') continue;
+				$php_ext .= $extension.' ';
+			}
+		}
+		$pkg['Requirements PHP extensions'] = trim($php_ext);
+
+		// PHP bool options
+		$pkg['Requirements PHP settings'] = '';
+		$php_bool_options = array('allow-url-fopen', 'file-uploads', 'magic-quotes-gpc',
+			'register-globals', 'safe-mode', 'short-open-tag');
+		foreach($php_bool_options as $option)
+		{
+			$value = parent::getXPathValue($sxe, '//php:'.$option);
+			if(!empty($value))
+			{
+				$option = str_replace('-', '_', $option);
+				$value = str_replace(array('false', 'true'), array('off', 'on'), $value);
+				$pkg['Requirements PHP settings'][] = array('PHPSettingName' => $option,
+					'PHPSettingValue' => $value);
+			}
+		}
+
+		// PHP integer value settings
+		$memory_limit = parent::getXPathValue($sxe, '//php:memory-limit');
+		if(!empty($memory_limit))
+			$pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'memory_limit',
+				'PHPSettingValue' => parent::convertSize((int)$memory_limit));
+
+		$max_exec_time = parent::getXPathValue($sxe, '//php:max-execution-time');
+		if(!empty($max_exec_time))
+			$pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'max-execution-time',
+				'PHPSettingValue' => $max_exec_time);
+
+		$post_max_size = parent::getXPathValue($sxe, '//php:post-max-size');
+		if(!empty($post_max_size))
+			$pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'post_max_size',
+				'PHPSettingValue' => parent::convertSize((int)$post_max_size));
+
+		// Get supported PHP versions
+		$pkg['Requirements Supported PHP versions'] = '';
+		$php_min_version = parent::getXPathValue($sxe, '//php:version/@min');
+		$php_max_not_including = parent::getXPathValue($sxe, '//php:version/@max-not-including');
+		if(!empty($php_min_version) && !empty($php_max_not_including))
+			$pkg['Requirements Supported PHP versions'] = $php_min_version.' - '.$php_max_not_including;
+		else if(!empty($php_min_version))
+				$pkg['Requirements Supported PHP versions'] = '> '.$php_min_version;
+			else if(!empty($php_max_not_including))
+					$pkg['Requirements Supported PHP versions'] = '< '.$php_min_version;
+
+				// Database
+				$db_id = parent::getXPathValue($sxe, '//db:id');
+			$db_server_type = parent::getXPathValue($sxe, '//db:server-type');
+		$db_min_version = parent::getXPathValue($sxe, '//db:server-min-version');
+		if(!empty($db_id))
+		{
+			$db_server_type = str_replace('postgresql', 'PostgreSQL', $db_server_type);
+			$db_server_type = str_replace('microsoft:sqlserver', 'MSSQL', $db_server_type);
+			$db_server_type = str_replace('mysql', 'MySQL', $db_server_type);
+
+			$pkg['Requirements Database'] = $db_server_type;
+			if(!empty($db_min_version)) $pkg['Requirements Database'] .= ' > '.$db_min_version;
+		}
+		else $pkg['Requirements Database'] = '';
+
+		return $pkg;
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php
index 50d4950..96e30b4 100644
--- a/interface/lib/classes/auth.inc.php
+++ b/interface/lib/classes/auth.inc.php
@@ -35,18 +35,18 @@
 	{
 		return $_SESSION['s']['user']['userid'];
 	}
-	
+
 	public function is_admin() {
 		if($_SESSION['s']['user']['typ'] == 'admin') {
 			return true;
 		} else {
 			return false;
 		}
-	}	
-	
+	}
+
 	public function has_clients($userid) {
 		global $app, $conf;
-		
+
 		$userid = $app->functions->intval($userid);
 		$client = $app->db->queryOneRecord("SELECT client.limit_client FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id");
 		if($client['limit_client'] > 0) {
@@ -55,19 +55,19 @@
 			return false;
 		}
 	}
-	
+
 	//** This function adds a given group id to a given user.
-	public function add_group_to_user($userid,$groupid) {
+	public function add_group_to_user($userid, $groupid) {
 		global $app;
-		
+
 		$userid = $app->functions->intval($userid);
 		$groupid = $app->functions->intval($groupid);
-		
+
 		if($userid > 0 && $groupid > 0) {
 			$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $userid");
-			$groups = explode(',',$user['groups']);
-			if(!in_array($groupid,$groups)) $groups[] = $groupid;
-			$groups_string = implode(',',$groups);
+			$groups = explode(',', $user['groups']);
+			if(!in_array($groupid, $groups)) $groups[] = $groupid;
+			$groups_string = implode(',', $groups);
 			$sql = "UPDATE sys_user SET groups = '$groups_string' WHERE userid = $userid";
 			$app->db->query($sql);
 			return true;
@@ -80,33 +80,33 @@
 	public function get_client_limit($userid, $limitname)
 	{
 		global $app;
-		
+
 		// simple query cache
-		if($this->client_limits===null) 
+		if($this->client_limits===null)
 			$this->client_limits = $app->db->queryOneRecord("SELECT client.* FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id");
-		
+
 		// isn't client -> no limit
 		if(!$this->client_limits)
 			return -1;
-		
+
 		if(isset($this->client_limits['limit_'.$limitname])) {
 			return $this->client_limits['limit_'.$limitname];
-		}		
-	}	
-	
+		}
+	}
+
 	//** This function removes a given group id from a given user.
-	public function remove_group_from_user($userid,$groupid) {
+	public function remove_group_from_user($userid, $groupid) {
 		global $app;
-		
+
 		$userid = $app->functions->intval($userid);
 		$groupid = $app->functions->intval($groupid);
-		
+
 		if($userid > 0 && $groupid > 0) {
 			$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $userid");
-			$groups = explode(',',$user['groups']);
-			$key = array_search($groupid,$groups);
+			$groups = explode(',', $user['groups']);
+			$key = array_search($groupid, $groups);
 			unset($groups[$key]);
-			$groups_string = implode(',',$groups);
+			$groups_string = implode(',', $groups);
 			$sql = "UPDATE sys_user SET groups = '$groups_string' WHERE userid = $userid";
 			$app->db->query($sql);
 			return true;
@@ -114,35 +114,35 @@
 			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)) {
+		if(!stristr($_SESSION["s"]["user"]["modules"], $module)) {
 			// echo "LOGIN_REDIRECT:/index.php";
 			header("Location: /index.php");
 			exit;
 		}
 	}
-	
+
 	public function get_random_password($length = 8) {
 		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 		$password = '';
 		for ($n=0;$n<$length;$n++) {
-			$password.=$base64_alphabet[mt_rand(0,63)];
+			$password.=$base64_alphabet[mt_rand(0, 63)];
 		}
 		return $password;
 	}
-	
+
 	public function crypt_password($cleartext_password) {
 		$salt="$1$";
 		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 		for ($n=0;$n<8;$n++) {
-			$salt.=$base64_alphabet[mt_rand(0,63)];
+			$salt.=$base64_alphabet[mt_rand(0, 63)];
 		}
 		$salt.="$";
-		return crypt($cleartext_password,$salt);
+		return crypt($cleartext_password, $salt);
 	}
-		
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/client_templates.inc.php b/interface/lib/classes/client_templates.inc.php
index cdd9ea9..77f6af5 100644
--- a/interface/lib/classes/client_templates.inc.php
+++ b/interface/lib/classes/client_templates.inc.php
@@ -1,236 +1,239 @@
 <?php
 /**
  * client_templates
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG
  * @author (original tools.inc.php) Till Brehm, projektfarm Gmbh
  * @author (original tools.inc.php) Oliver Vogel www.muv.com
  */
- 
+
+
 class client_templates {
 
-    /** 
-     *  - check for old-style templates and change to new style
-     *  - update assigned templates
-     */
+
+	/**
+	 *  - check for old-style templates and change to new style
+	 *  - update assigned templates
+	 */
 	function update_client_templates($clientId, $templates = array()) {
-        global $app, $conf;
-        
-        if(!is_array($templates)) return false;
-        
-        $new_tpl = array();
-        $used_assigned = array();
-        $needed_types = array();
-        $old_style = true;
-        foreach($templates as $item) {
-            $item = trim($item);
-            if($item == '') continue;
-            
-            $tpl_id = 0;
-            $assigned_id = 0;
-            if(strpos($item, ':') === false) {
-                $tpl_id = $item;
-            } else {
-                $old_style = false; // has new-style assigns
-                list($assigned_id, $tpl_id) = explode(':', $item, 2);
-                if(substr($assigned_id, 0, 1) === 'n') $assigned_id = 0; // newly inserted items
-            }
-            if(array_key_exists($tpl_id, $needed_types) == false) $needed_types[$tpl_id] = 0;
-            $needed_types[$tpl_id]++;
-            
-            if($assigned_id > 0) {
-                $used_assigned[] = $assigned_id; // for comparison with database
-            } else {
-                $new_tpl[] = $tpl_id;
-            }
-        }
-        
-        if($old_style == true) {
-            // we have to take care of this in an other way
-            $in_db = $app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $clientId);
-            if(is_array($in_db) && count($in_db) > 0) {
-                foreach($in_db as $item) {
-                    if(array_key_exists($item['client_template_id'], $needed_types) == false) $needed_types[$item['client_template_id']] = 0;
-                    $needed_types[$item['client_template_id']]--;
-                }
-            }
-            
-            foreach($needed_types as $tpl_id => $count) {
-                if($count > 0) {
-                    // add new template to client (includes those from old-style without assigned_template_id)
-                    for($i = $count; $i > 0; $i--) {
-                        $app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (' . $clientId . ', ' . $tpl_id . ')');
-                    }
-                } elseif($count < 0) {
-                    // remove old ones
-                    for($i = $count; $i < 0; $i++) {
-                        $app->db->query('DELETE FROM `client_template_assigned` WHERE client_id = ' . $clientId . ' AND client_template_id = ' . $tpl_id . ' LIMIT 1');
-                    }
-                }
-            }
-        } else {
-            // we have to take care of this in an other way
-            $in_db = $app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $clientId);
-            if(is_array($in_db) && count($in_db) > 0) {
-                // check which templates were removed from this client
-                foreach($in_db as $item) {
-                    if(in_array($item['assigned_template_id'], $used_assigned) == false) {
-                        // delete this one
-                        $app->db->query('DELETE FROM `client_template_assigned` WHERE `assigned_template_id` = ' . $item['assigned_template_id']);
-                    }
-                }
-            }
-            
-            if(count($new_tpl) > 0) {
-                foreach($new_tpl as $item) {
-                    // add new template to client (includes those from old-style without assigned_template_id)
-                    $app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (' . $clientId . ', ' . $item . ')');
-                }
-            }
-        }
-        
-        unset($new_tpl);
-        unset($in_db);
-        unset($templates);
-        unset($used_assigned);
-        return true;
-    }
-    
-    function apply_client_templates($clientId) {
-        global $app;
-        
-        include('../client/form/client.tform.php');
-        
-        /*
+		global $app, $conf;
+
+		if(!is_array($templates)) return false;
+
+		$new_tpl = array();
+		$used_assigned = array();
+		$needed_types = array();
+		$old_style = true;
+		foreach($templates as $item) {
+			$item = trim($item);
+			if($item == '') continue;
+
+			$tpl_id = 0;
+			$assigned_id = 0;
+			if(strpos($item, ':') === false) {
+				$tpl_id = $item;
+			} else {
+				$old_style = false; // has new-style assigns
+				list($assigned_id, $tpl_id) = explode(':', $item, 2);
+				if(substr($assigned_id, 0, 1) === 'n') $assigned_id = 0; // newly inserted items
+			}
+			if(array_key_exists($tpl_id, $needed_types) == false) $needed_types[$tpl_id] = 0;
+			$needed_types[$tpl_id]++;
+
+			if($assigned_id > 0) {
+				$used_assigned[] = $assigned_id; // for comparison with database
+			} else {
+				$new_tpl[] = $tpl_id;
+			}
+		}
+
+		if($old_style == true) {
+			// we have to take care of this in an other way
+			$in_db = $app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $clientId);
+			if(is_array($in_db) && count($in_db) > 0) {
+				foreach($in_db as $item) {
+					if(array_key_exists($item['client_template_id'], $needed_types) == false) $needed_types[$item['client_template_id']] = 0;
+					$needed_types[$item['client_template_id']]--;
+				}
+			}
+
+			foreach($needed_types as $tpl_id => $count) {
+				if($count > 0) {
+					// add new template to client (includes those from old-style without assigned_template_id)
+					for($i = $count; $i > 0; $i--) {
+						$app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (' . $clientId . ', ' . $tpl_id . ')');
+					}
+				} elseif($count < 0) {
+					// remove old ones
+					for($i = $count; $i < 0; $i++) {
+						$app->db->query('DELETE FROM `client_template_assigned` WHERE client_id = ' . $clientId . ' AND client_template_id = ' . $tpl_id . ' LIMIT 1');
+					}
+				}
+			}
+		} else {
+			// we have to take care of this in an other way
+			$in_db = $app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $clientId);
+			if(is_array($in_db) && count($in_db) > 0) {
+				// check which templates were removed from this client
+				foreach($in_db as $item) {
+					if(in_array($item['assigned_template_id'], $used_assigned) == false) {
+						// delete this one
+						$app->db->query('DELETE FROM `client_template_assigned` WHERE `assigned_template_id` = ' . $item['assigned_template_id']);
+					}
+				}
+			}
+
+			if(count($new_tpl) > 0) {
+				foreach($new_tpl as $item) {
+					// add new template to client (includes those from old-style without assigned_template_id)
+					$app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (' . $clientId . ', ' . $item . ')');
+				}
+			}
+		}
+
+		unset($new_tpl);
+		unset($in_db);
+		unset($templates);
+		unset($used_assigned);
+		return true;
+	}
+
+	function apply_client_templates($clientId) {
+		global $app;
+
+		include '../client/form/client.tform.php';
+
+		/*
          * Get the master-template for the client
          */
-        $sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId);
-        $record = $app->db->queryOneRecord($sql);
-        $masterTemplateId = $record['template_master'];
-        
-        if($record['template_additional'] != '') {
-            // we have to call the update_client_templates function
-            $templates = explode('/', $record['template_additional']);
-            $this->update_client_templates($clientId, $templates);
-            $app->db->query('UPDATE `client` SET `template_additional` = \'\' WHERE `client_id` = ' . $app->functions->intval($clientId));
-        }
-        
-        /*
+		$sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId);
+		$record = $app->db->queryOneRecord($sql);
+		$masterTemplateId = $record['template_master'];
+
+		if($record['template_additional'] != '') {
+			// we have to call the update_client_templates function
+			$templates = explode('/', $record['template_additional']);
+			$this->update_client_templates($clientId, $templates);
+			$app->db->query('UPDATE `client` SET `template_additional` = \'\' WHERE `client_id` = ' . $app->functions->intval($clientId));
+		}
+
+		/*
          * if the master-Template is custom there is NO changing
          */
-        if ($masterTemplateId > 0){
-            $sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($masterTemplateId);
-            $limits = $app->db->queryOneRecord($sql);
-        } else {
-            // if there is no master template it makes NO SENSE adding sub templates.
-            // adding subtemplates are stored in client limits, so they would add up
-            // on every save action for the client -> too high limits!
-            return;
-        }
+		if ($masterTemplateId > 0){
+			$sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($masterTemplateId);
+			$limits = $app->db->queryOneRecord($sql);
+		} else {
+			// if there is no master template it makes NO SENSE adding sub templates.
+			// adding subtemplates are stored in client limits, so they would add up
+			// on every save action for the client -> too high limits!
+			return;
+		}
 
-        /*
+		/*
          * Process the additional tempaltes here (add them to the limits
          * if != -1)
          */
-        $addTpl = explode('/', $additionalTemplateStr);
-        $addTpls = $app->db->queryAllRecords('SELECT `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $app->functions->intval($clientId));
-        foreach ($addTpls as $addTpl){
-            $item = $addTpl['client_template_id'];
-            $sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($item);
-            $addLimits = $app->db->queryOneRecord($sql);
-            $app->log('Template processing subtemplate ' . $item . ' for client ' . $clientId, LOGLEVEL_DEBUG);
-            /* maybe the template is deleted in the meantime */
-            if (is_array($addLimits)){
-                foreach($addLimits as $k => $v){
-                    /* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */
-                    if (strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
-                        $app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG);
+		$addTpl = explode('/', $additionalTemplateStr);
+		$addTpls = $app->db->queryAllRecords('SELECT `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $app->functions->intval($clientId));
+		foreach ($addTpls as $addTpl){
+			$item = $addTpl['client_template_id'];
+			$sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($item);
+			$addLimits = $app->db->queryOneRecord($sql);
+			$app->log('Template processing subtemplate ' . $item . ' for client ' . $clientId, LOGLEVEL_DEBUG);
+			/* maybe the template is deleted in the meantime */
+			if (is_array($addLimits)){
+				foreach($addLimits as $k => $v){
+					/* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */
+					if (strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
+						$app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG);
 
-                        /* process the numerical limits */
-                        if (is_numeric($v)){
-                            /* switch for special cases */
-                            switch ($k){
-                            case 'limit_cron_frequency':
-                                if ($v < $limits[$k]) $limits[$k] = $v;
-                                /* silent adjustment of the minimum cron frequency to 1 minute */
-                                /* maybe this control test should be done via validator definition in tform.php file, but I don't know how */
-                                if ($limits[$k] < 1) $limits[$k] = 1;
-                            break;
+						/* process the numerical limits */
+						if (is_numeric($v)){
+							/* switch for special cases */
+							switch ($k){
+							case 'limit_cron_frequency':
+								if ($v < $limits[$k]) $limits[$k] = $v;
+								/* silent adjustment of the minimum cron frequency to 1 minute */
+								/* maybe this control test should be done via validator definition in tform.php file, but I don't know how */
+								if ($limits[$k] < 1) $limits[$k] = 1;
+								break;
 
-                            default:
-                                if ($limits[$k] > -1){
-                                    if ($v == -1){
-                                        $limits[$k] = -1;
-                                    }
-                                    else {
-                                        $limits[$k] += $v;
-                                    }
-                                }
-                            }
-                        }
-                        /* process the string limits (CHECKBOXARRAY, SELECT etc.) */
-                        elseif (is_string($v)){
-                            switch ($form["tabs"]["limits"]["fields"][$k]['formtype']){
-                            case 'CHECKBOXARRAY':
-                                if (!isset($limits[$k])){
-                                    $limits[$k] = array();
-                                }
+							default:
+								if ($limits[$k] > -1){
+									if ($v == -1){
+										$limits[$k] = -1;
+									}
+									else {
+										$limits[$k] += $v;
+									}
+								}
+							}
+						}
+						/* process the string limits (CHECKBOXARRAY, SELECT etc.) */
+						elseif (is_string($v)){
+							switch ($form["tabs"]["limits"]["fields"][$k]['formtype']){
+							case 'CHECKBOXARRAY':
+								if (!isset($limits[$k])){
+									$limits[$k] = array();
+								}
 
-                                $limits_values = $limits[$k];
-                                if (is_string($limits[$k])){
-                                    $limits_values = explode($form["tabs"]["limits"]["fields"][$k]["separator"],$limits[$k]);
-                                }
-                                $additional_values = explode($form["tabs"]["limits"]["fields"][$k]["separator"],$v);
-                                $app->log('Template processing key ' . $k . ' type CHECKBOXARRAY, lim / add: ' . implode(',', $limits_values) . ' / ' . implode(',', $additional_values) . ' for client ' . $clientId, LOGLEVEL_DEBUG);
-                                /* unification of limits_values (master template) and additional_values (additional template) */
-                                $limits_unified = array();
-                                foreach($form["tabs"]["limits"]["fields"][$k]["value"] as $key => $val){
-                                    if (in_array($key,$limits_values) || in_array($key,$additional_values)) $limits_unified[] = $key;
-                                }
-                                $limits[$k] = implode($form["tabs"]["limits"]["fields"][$k]["separator"],$limits_unified);
-                            break;
-                            case 'CHECKBOX':
-                                if($k == 'force_suexec') {
-                                    // 'n' is less limited than y
-                                    if (!isset($limits[$k])){
-                                        $limits[$k] = 'y';
-                                    }
-                                    if($limits[$k] == 'n' || $v == 'n') $limits[$k] = 'n';
-                                } else {
-                                    // 'y' is less limited than n
-                                    if (!isset($limits[$k])){
-                                        $limits[$k] = 'n';
-                                    }
-                                    if($limits[$k] == 'y' || $v == 'y') $limits[$k] = 'y';
-                                }
-                            break;
-                            case 'SELECT':
-                                $limit_values = array_keys($form["tabs"]["limits"]["fields"][$k]["value"]);
-                                /* choose the lower index of the two SELECT items */
-                                $limits[$k] = $limit_values[min(array_search($limits[$k], $limit_values), array_search($v, $limit_values))];
-                            break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
+								$limits_values = $limits[$k];
+								if (is_string($limits[$k])){
+									$limits_values = explode($form["tabs"]["limits"]["fields"][$k]["separator"], $limits[$k]);
+								}
+								$additional_values = explode($form["tabs"]["limits"]["fields"][$k]["separator"], $v);
+								$app->log('Template processing key ' . $k . ' type CHECKBOXARRAY, lim / add: ' . implode(',', $limits_values) . ' / ' . implode(',', $additional_values) . ' for client ' . $clientId, LOGLEVEL_DEBUG);
+								/* unification of limits_values (master template) and additional_values (additional template) */
+								$limits_unified = array();
+								foreach($form["tabs"]["limits"]["fields"][$k]["value"] as $key => $val){
+									if (in_array($key, $limits_values) || in_array($key, $additional_values)) $limits_unified[] = $key;
+								}
+								$limits[$k] = implode($form["tabs"]["limits"]["fields"][$k]["separator"], $limits_unified);
+								break;
+							case 'CHECKBOX':
+								if($k == 'force_suexec') {
+									// 'n' is less limited than y
+									if (!isset($limits[$k])){
+										$limits[$k] = 'y';
+									}
+									if($limits[$k] == 'n' || $v == 'n') $limits[$k] = 'n';
+								} else {
+									// 'y' is less limited than n
+									if (!isset($limits[$k])){
+										$limits[$k] = 'n';
+									}
+									if($limits[$k] == 'y' || $v == 'y') $limits[$k] = 'y';
+								}
+								break;
+							case 'SELECT':
+								$limit_values = array_keys($form["tabs"]["limits"]["fields"][$k]["value"]);
+								/* choose the lower index of the two SELECT items */
+								$limits[$k] = $limit_values[min(array_search($limits[$k], $limit_values), array_search($v, $limit_values))];
+								break;
+							}
+						}
+					}
+				}
+			}
+		}
 
-        /*
+		/*
          * Write all back to the database
          */
-        $update = '';
-        foreach($limits as $k => $v){
-            if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
-                if ($update != '') $update .= ', ';
-                $update .= '`' . $k . "`='" . $v . "'";
-            }
-        }
-        $app->log('Template processed for client ' . $clientId . ', update string: ' . $update, LOGLEVEL_DEBUG);
-        if($update != '') {
-            $sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . $app->functions->intval($clientId);
-            $app->db->query($sql);
-        }
-        unset($form);
-    }
-}
\ No newline at end of file
+		$update = '';
+		foreach($limits as $k => $v){
+			if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
+				if ($update != '') $update .= ', ';
+				$update .= '`' . $k . "`='" . $v . "'";
+			}
+		}
+		$app->log('Template processed for client ' . $clientId . ', update string: ' . $update, LOGLEVEL_DEBUG);
+		if($update != '') {
+			$sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . $app->functions->intval($clientId);
+			$app->db->query($sql);
+		}
+		unset($form);
+	}
+
+}
diff --git a/interface/lib/classes/cmstree.inc.php b/interface/lib/classes/cmstree.inc.php
index d83fb29..ead780e 100644
--- a/interface/lib/classes/cmstree.inc.php
+++ b/interface/lib/classes/cmstree.inc.php
@@ -48,13 +48,13 @@
     // - icon       :icon im node-tree, optional
     // - modul      :modul des Eintrages, noch nicht verwendet
     // - doc_id     :id des zugeh�rigen Dokumentes
-    
+
     public function node_list()
     {
         global $app;
-    
+
 	    $nodes = $app->db->queryAllRecords('SELECT * FROM media_cat order by sort, name');
-        
+
         $optionlist = array();
         $my0 = new nodetree();
 
@@ -74,11 +74,11 @@
                 $$ordner->childs[] = &$$id;
             }
         }
-       
-        $this->ptree($my0, 0, $optionlist);       
+
+        $this->ptree($my0, 0, $optionlist);
         return is_array($nodes) ?  $optionlist : false;
     }
-    
+
     private function ptree($myobj, $tiefe, &$optionlist){
      	global $_SESSION;
 		$tiefe += 1;
@@ -87,7 +87,7 @@
         if(is_array($myobj->childs) and ($_SESSION['s']['cat_open'][$id] == 1 or $tiefe <= 1)) {
         	foreach($myobj->childs as $val) {
 				// kategorie 		=> str_repeat('- &nbsp;',$tiefe) . $val->btext,
-				
+
 				// Ergebnisse Formatieren
 				/*
 				if($tiefe == 0) {
@@ -104,7 +104,7 @@
 				} else {
 					$kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='treenavi.php?kat=".$val->id."' class='navtext' onclick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder_closed.png' border='0'> ".$val->btext."</a></div>";
 				}
-				
+
 				$optionlist[] = array( 	media_cat 		=> $kategorie,
                                    		media_cat_id 	=> $val->id,
 										depth			=> $tiefe);
@@ -114,4 +114,4 @@
     }
 
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/custom_datasource.inc.php b/interface/lib/classes/custom_datasource.inc.php
index 44fee19..fda355c 100644
--- a/interface/lib/classes/custom_datasource.inc.php
+++ b/interface/lib/classes/custom_datasource.inc.php
@@ -29,7 +29,7 @@
 */
 
 class custom_datasource {
-	
+
 	function master_templates($field, $record) {
 		global $app, $conf;
 		$records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m'");
@@ -40,10 +40,10 @@
 		}
 		return $records_new;
 	}
-	
+
 	function dns_servers($field, $record) {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -62,10 +62,10 @@
 		}
 		return $records_new;
 	}
-	
+
 	function slave_dns_servers($field, $record) {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -84,10 +84,10 @@
 		}
 		return $records_new;
 	}
-	
+
 	function webdav_domains($field, $record) {
 		global $app, $conf;
-		
+
 		$servers = $app->db->queryAllRecords("SELECT * FROM server WHERE active = 1 AND mirror_server_id = 0");
 		$server_ids = array();
 		$app->uses('getconf');
@@ -100,7 +100,7 @@
 		if(count($server_ids) == 0) return array();
 		$server_ids = implode(',', $server_ids);
 		$records = $app->db->queryAllRecords("SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id IN (".$server_ids.") AND web_domain.server_id = server.server_id AND ".$app->tform->getAuthSQL('r', 'web_domain')." ORDER BY web_domain.domain");
-		
+
 		$records_new = array();
 		if(is_array($records)) {
 			foreach($records as $rec) {
@@ -110,40 +110,40 @@
 		}
 		return $records_new;
 	}
-	
-	
+
+
 	function client_servers($field, $record) {
 		global $app, $conf;
-		
+
 		$server_type = $field['name'];
-		
+
 		switch($server_type) {
-			case 'default_mailserver':
-				$field = 'mail_server';
+		case 'default_mailserver':
+			$field = 'mail_server';
 			break;
-			case 'default_webserver':
-				$field = 'web_server';
+		case 'default_webserver':
+			$field = 'web_server';
 			break;
-			case 'default_dnsserver':
-				$field = 'dns_server';
+		case 'default_dnsserver':
+			$field = 'dns_server';
 			break;
-			case 'default_slave_dnsserver':
-				$field = 'dns_server';
+		case 'default_slave_dnsserver':
+			$field = 'dns_server';
 			break;
-			case 'default_fileserver':
-				$field = 'file_server';
+		case 'default_fileserver':
+			$field = 'file_server';
 			break;
-			case 'default_dbserver':
-				$field = 'db_server';
+		case 'default_dbserver':
+			$field = 'db_server';
 			break;
-			case 'default_vserverserver':
-				$field = 'vserver_server';
+		case 'default_vserverserver':
+			$field = 'vserver_server';
 			break;
-			default:
-				$field = 'web_server';
+		default:
+			$field = 'web_server';
 			break;
 		}
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -154,14 +154,14 @@
 				$sql = "SELECT server_id,server_name FROM server WHERE server_id = ".$client['server_id'];
 			} else {
 				//* Not able to find the clients defaults, use this as fallback and add a warning message to the log
-				$app->log('Unable to find default server for client in custom_datasource.inc.php',1);
+				$app->log('Unable to find default server for client in custom_datasource.inc.php', 1);
 				$sql = "SELECT server_id,server_name FROM server WHERE $field = 1 ORDER BY server_name";
 			}
 		} else {
 			//* The logged in user is admin, so we show him all available servers of a specific type.
 			$sql = "SELECT server_id,server_name FROM server WHERE $field = 1 ORDER BY server_name";
 		}
-		
+
 		$records = $app->db->queryAllRecords($sql);
 		$records_new = array();
 		if(is_array($records)) {
@@ -172,9 +172,9 @@
 		}
 		return $records_new;
 	}
-	
-	
+
+
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/db_firebird.inc.php b/interface/lib/classes/db_firebird.inc.php
index 883e7ba..fda4ef8 100644
--- a/interface/lib/classes/db_firebird.inc.php
+++ b/interface/lib/classes/db_firebird.inc.php
@@ -29,17 +29,17 @@
 */
 
 class db {
-	var $dbHost = "";		// hostname of the MySQL server
-	var $dbName = "";		// logical database name on that server
-	var $dbUser = "";		// database authorized user
-	var $dbPass = "";		// user's password
-	var $linkId = 0;		// last result of mysql_connect()
-	var $queryId = 0;		// last result of mysql_query()
-	var $record	= array();	// last record fetched
-    var $autoCommit = 1;    // Autocommit Transactions
-	var $currentRow;		// current row number
-	var $errorNumber = 0;	// last error number
-	var $errorMessage = "";	// last error message
+	var $dbHost = "";  // hostname of the MySQL server
+	var $dbName = "";  // logical database name on that server
+	var $dbUser = "";  // database authorized user
+	var $dbPass = "";  // user's password
+	var $linkId = 0;  // last result of mysql_connect()
+	var $queryId = 0;  // last result of mysql_query()
+	var $record = array(); // last record fetched
+	var $autoCommit = 1;    // Autocommit Transactions
+	var $currentRow;  // current row number
+	var $errorNumber = 0; // last error number
+	var $errorMessage = ""; // last error message
 	var $errorLocation = "";// last error location
 	var $show_error_messages = false;
 	var $transID;
@@ -47,7 +47,7 @@
 	// constructor
 	function __construct()
 	{
-		
+
 		global $conf;
 		$this->dbHost = $conf["db_host"];
 		$this->dbName = $conf["db_database"];
@@ -55,9 +55,10 @@
 		$this->dbPass = $conf["db_password"];
 		$this->connect();
 	}
+
 	function __destruct() {
 		$this->closeConn();
-        }
+	}
 
 	// error handler
 	function updateError($location)
@@ -67,7 +68,7 @@
 		$this->errorLocation = $location;
 		if($this->errorNumber && $this->show_error_messages)
 		{
-			echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
+			echo '<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage;
 			flush();
 		}
 	}
@@ -76,7 +77,7 @@
 	{
 		if($this->linkId == 0)
 		{
-			$this->linkId = ibase_connect( $this->dbHost.":".$this->dbName , $this->dbUser, $this->dbPass,'ISO8859_1',0,3 );
+			$this->linkId = ibase_connect( $this->dbHost.":".$this->dbName , $this->dbUser, $this->dbPass, 'ISO8859_1', 0, 3 );
 			if(!$this->linkId)
 			{
 				$this->updateError('DB::connect()<br />ibase_pconnect');
@@ -91,16 +92,16 @@
 		if(!$this->connect()) {
 			return false;
 		}
-		
+
 		if($this->autoCommit == 1) {
 			//$transID = ibase_trans();
-			$this->queryId = @ibase_query($this->linkId,$queryString);
+			$this->queryId = @ibase_query($this->linkId, $queryString);
 			//ibase_commit();
 		} else {
-			$this->queryId = @ibase_query($this->linkId,$queryString);
+			$this->queryId = @ibase_query($this->linkId, $queryString);
 		}
-		
-		
+
+
 		$this->updateError('DB::query('.$queryString.')<br />ibase_query');
 		if(!$this->queryId) {
 			return false;
@@ -141,7 +142,7 @@
 	// returns the next record in an array
 	function nextRecord()
 	{
-        $this->record = ibase_fetch_assoc($this->queryId);
+		$this->record = ibase_fetch_assoc($this->queryId);
 		$this->updateError('DB::nextRecord()<br />ibase_fetch_assoc');
 		if(!$this->record || !is_array($this->record))
 		{
@@ -156,32 +157,32 @@
 	{
 		return false;
 	}
-	
+
 	// returns mySQL insert id
 	function insertID()
 	{
 		return false;
 	}
-    
-    // Check der variablen
+
+	// Check der variablen
 	// deprecated, now use quote
-    function check($formfield)
-    {
-        return $this->quote($formfield);
-    }
-	
+	function check($formfield)
+	{
+		return $this->quote($formfield);
+	}
+
 	// Check der variablen
-    function quote($formfield)
-    {
-        return str_replace("'","''",$formfield);
-    }
-	
+	function quote($formfield)
+	{
+		return str_replace("'", "''", $formfield);
+	}
+
 	// Check der variablen
-    function unquote($formfield)
-    {
-        return str_replace("''","'",$formfield);
-    }
-	
+	function unquote($formfield)
+	{
+		return str_replace("''", "'", $formfield);
+	}
+
 	function toLower($record) {
 		if(is_array($record)) {
 			foreach($record as $key => $val) {
@@ -189,76 +190,76 @@
 				$out[$key] = $val;
 			}
 		}
-	return $out;
+		return $out;
 	}
-   
-   
-   function insert($tablename,$form,$debug = 0)
-   {
-     if(is_array($form)){
-       foreach($form as $key => $value) 
-	    {
-	    $sql_key .= "$key, ";
-        $sql_value .= "'".$this->quote($value)."', ";
-  		 }
-   	$sql_key = substr($sql_key,0,strlen($sql_key) - 2);
-    $sql_value = substr($sql_value,0,strlen($sql_value) - 2);
-    
-   	$sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")";
-   
-  		 if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
-  		 $this->query($sql);
-  		 if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
-      }
-   }
-   
-   function update($tablename,$form,$bedingung,$debug = 0)
-   {
-   
-     if(is_array($form)){
-       foreach($form as $key => $value) 
-	    {
-	    $insql .= "$key = '".$this->quote($value)."', ";
-  		 }
-   	        $insql = substr($insql,0,strlen($insql) - 2);
-   	        $sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung";
-  		 if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
-  		 $this->query($sql);
-  		 if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
-       }
-   }
-   
-   function closeConn() {
-   	ibase_close($this->linkId);
-   }
-   
-   function freeResult() {
-   	//ibase_free_result();
-   }
-   
-   function delete() {
-   
-   }
-   
-   function trans($action,$transID = null) {
-   //action = begin, commit oder rollback
-   
-   		if($action == 'begin') {
-   			$this->transID = ibase_trans($this->linkId);
+
+
+	function insert($tablename, $form, $debug = 0)
+	{
+		if(is_array($form)){
+			foreach($form as $key => $value)
+			{
+				$sql_key .= "$key, ";
+				$sql_value .= "'".$this->quote($value)."', ";
+			}
+			$sql_key = substr($sql_key, 0, strlen($sql_key) - 2);
+			$sql_value = substr($sql_value, 0, strlen($sql_value) - 2);
+
+			$sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")";
+
+			if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
+			$this->query($sql);
+			if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
+		}
+	}
+
+	function update($tablename, $form, $bedingung, $debug = 0)
+	{
+
+		if(is_array($form)){
+			foreach($form as $key => $value)
+			{
+				$insql .= "$key = '".$this->quote($value)."', ";
+			}
+			$insql = substr($insql, 0, strlen($insql) - 2);
+			$sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung";
+			if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
+			$this->query($sql);
+			if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
+		}
+	}
+
+	function closeConn() {
+		ibase_close($this->linkId);
+	}
+
+	function freeResult() {
+		//ibase_free_result();
+	}
+
+	function delete() {
+
+	}
+
+	function trans($action, $transID = null) {
+		//action = begin, commit oder rollback
+
+		if($action == 'begin') {
+			$this->transID = ibase_trans($this->linkId);
 			return $this->transID;
-   		}
-		
+		}
+
 		if($action == 'commit' and !empty($this->transID)) {
-			ibase_commit($this->linkId,$this->transID);
+			ibase_commit($this->linkId, $this->transID);
 		}
-	
+
 		if($action == 'rollback') {
-			ibase_rollback($this->linkId,$this->transID);
+			ibase_rollback($this->linkId, $this->transID);
 		}
-		
-   }
-   
-   /*
+
+	}
+
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -268,38 +269,38 @@
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   
-   function createTable($table_name,$columns) {
-   $index = "";
-   $sql = "CREATE TABLE $table_name (";
-   foreach($columns as $col){
-        $sql .= $col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
-   
-        if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
-        if($col["notNull"] == true) {
-            $sql .= "NOT NULL ";
-        } else {
-            $sql .= "NULL ";
-        }
-        if($col["autoInc"] == true) $sql .= "auto_increment ";
-        $sql.= ",";
-        // key Definitionen
-        if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
-        if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
-        if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
-   }
-   $sql .= $index;
-   $sql = substr($sql,0,-1);
-   $sql .= ")";
-   
-   $this->query($sql);
-   return true;
-   }
-   
-   /*
+
+	function createTable($table_name, $columns) {
+		$index = "";
+		$sql = "CREATE TABLE $table_name (";
+		foreach($columns as $col){
+			$sql .= $col["name"]." ".$this->mapType($col["type"], $col["typeValue"])." ";
+
+			if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
+			if($col["notNull"] == true) {
+				$sql .= "NOT NULL ";
+			} else {
+				$sql .= "NULL ";
+			}
+			if($col["autoInc"] == true) $sql .= "auto_increment ";
+			$sql.= ",";
+			// key Definitionen
+			if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
+			if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
+			if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+		$sql .= ")";
+
+		$this->query($sql);
+		return true;
+	}
+
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -309,26 +310,26 @@
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   function alterTable($table_name,$columns) {
-   		return false;
-   }
-   
-   function dropTable($table_name) {
-   		$this->check($table_name);
-   		$sql = "DROP TABLE '". $table_name."'";
-  		return $this->query($sql);
-   }
-   
-   // gibt Array mit Tabellennamen zurück
-   function getTables($database_name) {
-        return false;       
-   }
-   
-   // gibt Feldinformationen zur Tabelle zurück
-   /*
+	function alterTable($table_name, $columns) {
+		return false;
+	}
+
+	function dropTable($table_name) {
+		$this->check($table_name);
+		$sql = "DROP TABLE '". $table_name."'";
+		return $this->query($sql);
+	}
+
+	// gibt Array mit Tabellennamen zurück
+	function getTables($database_name) {
+		return false;
+	}
+
+	// gibt Feldinformationen zur Tabelle zurück
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -338,46 +339,46 @@
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   
-   function tableInfo($table_name) {
-        return false;
-   }
-   
-   function mapType($metaType,$typeValue) {
-   global $go_api;
-   $metaType = strtolower($metaType);
-   switch ($metaType) {
-   case 'int16':
-        return 'smallint';
-   break;
-   case 'int32':
-        return 'int';
-   break;
-   case 'int64':
-        return 'bigint';
-   break;
-   case 'double':
-        return 'double';
-   break;
-   case 'char':
-        return 'char';
-   break;
-   case 'varchar':
-        if($typeValue < 1) $go_api->errorMessage("Datenbank Fehler: Für diesen Datentyp ist eine Längenangabe notwendig.");
-        return 'varchar('.$typeValue.')';
-   break;
-   case 'text':
-        return 'text';
-   break;
-   case 'blob':
-        return 'blob';
-   break;
-   }
-   }
-	
+
+	function tableInfo($table_name) {
+		return false;
+	}
+
+	function mapType($metaType, $typeValue) {
+		global $go_api;
+		$metaType = strtolower($metaType);
+		switch ($metaType) {
+		case 'int16':
+			return 'smallint';
+			break;
+		case 'int32':
+			return 'int';
+			break;
+		case 'int64':
+			return 'bigint';
+			break;
+		case 'double':
+			return 'double';
+			break;
+		case 'char':
+			return 'char';
+			break;
+		case 'varchar':
+			if($typeValue < 1) $go_api->errorMessage("Datenbank Fehler: Für diesen Datentyp ist eine Längenangabe notwendig.");
+			return 'varchar('.$typeValue.')';
+			break;
+		case 'text':
+			return 'text';
+			break;
+		case 'blob':
+			return 'blob';
+			break;
+		}
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 4672998..1636cab 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -29,64 +29,64 @@
 
 class db extends mysqli
 {
-  private $dbHost = '';		// hostname of the MySQL server
-  private $dbName = '';		// logical database name on that server
-  private $dbUser = '';		// database authorized user
-  private $dbPass = '';		// user's password
-  private $dbCharset = 'utf8';// Database charset
-  private $dbNewLink = false; // Return a new linkID when connect is called again
-  private $dbClientFlags = 0; // MySQL Client falgs
-  private $linkId = 0;		// last result of mysqli_connect()
-  private $queryId = 0;		// last result of mysqli_query()
-  private $record	= array();	// last record fetched
-  private $autoCommit = 1;    // Autocommit Transactions
-  private $currentRow;		// current row number
-  private $errorNumber = 0;	// last error number
-  public $errorMessage = '';	// last error message
-  private $errorLocation = '';// last error location
-  public $show_error_messages = false; // false in server, true in interface
-  private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
+	private $dbHost = '';  // hostname of the MySQL server
+	private $dbName = '';  // logical database name on that server
+	private $dbUser = '';  // database authorized user
+	private $dbPass = '';  // user's password
+	private $dbCharset = 'utf8';// Database charset
+	private $dbNewLink = false; // Return a new linkID when connect is called again
+	private $dbClientFlags = 0; // MySQL Client falgs
+	private $linkId = 0;  // last result of mysqli_connect()
+	private $queryId = 0;  // last result of mysqli_query()
+	private $record = array(); // last record fetched
+	private $autoCommit = 1;    // Autocommit Transactions
+	private $currentRow;  // current row number
+	private $errorNumber = 0; // last error number
+	public $errorMessage = ''; // last error message
+	private $errorLocation = '';// last error location
+	public $show_error_messages = false; // false in server, true in interface
+	private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
 
-  // constructor
-  public function __construct($prefix = '') {
-    global $conf;
-    if($prefix != '') $prefix .= '_';
-    $this->dbHost = $conf[$prefix.'db_host'];
-    $this->dbName = $conf[$prefix.'db_database'];
-    $this->dbUser = $conf[$prefix.'db_user'];
-    $this->dbPass = $conf[$prefix.'db_password'];
-    $this->dbCharset = $conf[$prefix.'db_charset'];
-    $this->dbNewLink = $conf[$prefix.'db_new_link'];
-    $this->dbClientFlags = $conf[$prefix.'db_client_flags'];
-    parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
-    $try = 0;
-    //while(!is_null($this->connect_error) && $try < 5) {
-	while(mysqli_connect_error() && $try < 5) {
-      if($try > 0) sleep(1);
-      
-      $try++;
-      $this->updateError('DB::__construct');
-      
-      parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
-    }
-    
-    //if(is_null($this->connect_error)) $this->isConnected = true;
-    //else return false;
-	if(!mysqli_connect_error()) $this->isConnected = true;
-    else return false;
-    
-    $this->setCharacterEncoding();
-  }
+	// constructor
+	public function __construct($prefix = '') {
+		global $conf;
+		if($prefix != '') $prefix .= '_';
+		$this->dbHost = $conf[$prefix.'db_host'];
+		$this->dbName = $conf[$prefix.'db_database'];
+		$this->dbUser = $conf[$prefix.'db_user'];
+		$this->dbPass = $conf[$prefix.'db_password'];
+		$this->dbCharset = $conf[$prefix.'db_charset'];
+		$this->dbNewLink = $conf[$prefix.'db_new_link'];
+		$this->dbClientFlags = $conf[$prefix.'db_client_flags'];
+		parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'], $conf[$prefix.'db_password'], $conf[$prefix.'db_database']);
+		$try = 0;
+		//while(!is_null($this->connect_error) && $try < 5) {
+		while(mysqli_connect_error() && $try < 5) {
+			if($try > 0) sleep(1);
 
-  public function __destruct() {
-    $this->close(); // helps avoid memory leaks, and persitent connections that don't go away.
-  }
+			$try++;
+			$this->updateError('DB::__construct');
 
-  // error handler
-  public function updateError($location) {
-    global $app, $conf;
+			parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'], $conf[$prefix.'db_password'], $conf[$prefix.'db_database']);
+		}
 
-	/*
+		//if(is_null($this->connect_error)) $this->isConnected = true;
+		//else return false;
+		if(!mysqli_connect_error()) $this->isConnected = true;
+		else return false;
+
+		$this->setCharacterEncoding();
+	}
+
+	public function __destruct() {
+		$this->close(); // helps avoid memory leaks, and persitent connections that don't go away.
+	}
+
+	// error handler
+	public function updateError($location) {
+		global $app, $conf;
+
+		/*
     if(!is_null($this->connect_error)) {
       $this->errorNumber = $this->connect_errno;
       $this->errorMessage = $this->connect_error;
@@ -95,183 +95,183 @@
       $this->errorMessage = $this->error;
     }
 	*/
-	if(mysqli_connect_error()) {
-      $this->errorNumber = mysqli_connect_errno();
-      $this->errorMessage = mysqli_connect_error();
-    } else {
-      $this->errorNumber = mysqli_errno($this);
-      $this->errorMessage = mysqli_error($this);
-    }
+		if(mysqli_connect_error()) {
+			$this->errorNumber = mysqli_connect_errno();
+			$this->errorMessage = mysqli_connect_error();
+		} else {
+			$this->errorNumber = mysqli_errno($this);
+			$this->errorMessage = mysqli_error($this);
+		}
 
 
-    $this->errorLocation = $location;
-    if($this->errorNumber) {
-      $error_msg = $this->errorLocation .' '. $this->errorMessage;
-      // This right here will allow us to use the same file for server & interface
-      if($this->show_error_messages && $conf['demo_mode'] === false) {
-		echo $error_msg;
-      } else if(is_object($app) && method_exists($app, 'log')) {
-		$app->log($error_msg, LOGLEVEL_WARN);
-      }
-    }
-  }
-  
-  private function setCharacterEncoding() {
-    if($this->isConnected == false) return false;
-    parent::query( 'SET NAMES '.$this->dbCharset); 
-    parent::query( "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'");
-  }
-
-  public function query($queryString) {
-    global $conf;
-	if($this->isConnected == false) return false;
-    $try = 0;
-    do {
-        $try++;
-        $ok = $this->ping();
-        if(!$ok) {
-            if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
-                if($try > 4) {
-                    $this->updateError('DB::query -> reconnect');
-                    return false;
-                } else {
-                    sleep(1);
-                }
-            } else {
-                $this->setCharacterEncoding();
-                $ok = true;
-            }
-        }
-    } while($ok == false);
-	$this->queryId = parent::query($queryString);
-    $this->updateError('DB::query('.$queryString.') -> mysqli_query');
-    if($this->errorNumber && $conf['demo_mode'] === false) debug_print_backtrace();
-    if(!$this->queryId) {
-      return false;
-    }
-    $this->currentRow = 0;
-    return $this->queryId;
-  }
-
-  // returns all records in an array
-  public function queryAllRecords($queryString) {
-    if(!$this->query($queryString))
-    {
-      return false;
-    }
-    $ret = array();
-    while($line = $this->nextRecord())
-    {
-      $ret[] = $line;
-    }
-    return $ret;
-  }
-
-  // returns one record in an array
-  public function queryOneRecord($queryString) {
-    if(!$this->query($queryString) || $this->numRows() == 0)
-    {
-      return false;
-    }
-    return $this->nextRecord();
-  }
-
-  // returns the next record in an array
-  public function nextRecord() {
-    $this->record = $this->queryId->fetch_assoc();
-    $this->updateError('DB::nextRecord()-> mysql_fetch_array');
-    if(!$this->record || !is_array($this->record))
-    {
-      return false;
-    }
-    $this->currentRow++;
-    return $this->record;
-  }
-
-  // returns number of rows returned by the last select query
-  public function numRows() {
-    return intval($this->queryId->num_rows);
-  }
-  
-  public function affectedRows() {
-	return intval($this->queryId->affected_rows);
-  }
-
-  // returns mySQL insert id
-  public function insertID() {
-    return $this->insert_id;
-  }
-
-
-  //* Function to quote strings
-  public function quote($formfield) {
-    return $this->escape_string($formfield);
-  }
-
-  //* Function to unquotae strings
-  public function unquote($formfield) {
-    return stripslashes($formfield);
-  }
-
-public function toLower($record) {
-    if(is_array($record)) {
-      foreach($record as $key => $val) {
-	$key = strtolower($key);
-	$out[$key] = $val;
-      }
-    }
-    return $out;
-  }
-
-  public function diffrec($record_old, $record_new) {
-    $diffrec_full = array();
-    $diff_num = 0;
-
-    if(is_array($record_old) && count($record_old) > 0) {
-      foreach($record_old as $key => $val) {
-	// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
-	if(@$record_new[$key] != $val) {
-	  // Record has changed
-	  $diffrec_full['old'][$key] = $val;
-	  $diffrec_full['new'][$key] = @$record_new[$key];
-	  $diff_num++;
-	} else {
-	  $diffrec_full['old'][$key] = $val;
-	  $diffrec_full['new'][$key] = $val;
+		$this->errorLocation = $location;
+		if($this->errorNumber) {
+			$error_msg = $this->errorLocation .' '. $this->errorMessage;
+			// This right here will allow us to use the same file for server & interface
+			if($this->show_error_messages && $conf['demo_mode'] === false) {
+				echo $error_msg;
+			} else if(is_object($app) && method_exists($app, 'log')) {
+					$app->log($error_msg, LOGLEVEL_WARN);
+				}
+		}
 	}
-      }
-      } elseif(is_array($record_new)) {
-	foreach($record_new as $key => $val) {
-	  if(isset($record_new[$key]) && @$record_old[$key] != $val) {
-	    // Record has changed
-	    $diffrec_full['new'][$key] = $val;
-	    $diffrec_full['old'][$key] = @$record_old[$key];
-	    $diff_num++;
-	  } else {
-	    $diffrec_full['new'][$key] = $val;
-	    $diffrec_full['old'][$key] = $val;
-	  }
+
+	private function setCharacterEncoding() {
+		if($this->isConnected == false) return false;
+		parent::query( 'SET NAMES '.$this->dbCharset);
+		parent::query( "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'");
 	}
-      }
 
-      return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
+	public function query($queryString) {
+		global $conf;
+		if($this->isConnected == false) return false;
+		$try = 0;
+		do {
+			$try++;
+			$ok = $this->ping();
+			if(!$ok) {
+				if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
+					if($try > 4) {
+						$this->updateError('DB::query -> reconnect');
+						return false;
+					} else {
+						sleep(1);
+					}
+				} else {
+					$this->setCharacterEncoding();
+					$ok = true;
+				}
+			}
+		} while($ok == false);
+		$this->queryId = parent::query($queryString);
+		$this->updateError('DB::query('.$queryString.') -> mysqli_query');
+		if($this->errorNumber && $conf['demo_mode'] === false) debug_print_backtrace();
+		if(!$this->queryId) {
+			return false;
+		}
+		$this->currentRow = 0;
+		return $this->queryId;
+	}
 
-    }
+	// returns all records in an array
+	public function queryAllRecords($queryString) {
+		if(!$this->query($queryString))
+		{
+			return false;
+		}
+		$ret = array();
+		while($line = $this->nextRecord())
+		{
+			$ret[] = $line;
+		}
+		return $ret;
+	}
 
-    //** Function to fill the datalog with a full differential record.
-    public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
-      global $app,$conf;
+	// returns one record in an array
+	public function queryOneRecord($queryString) {
+		if(!$this->query($queryString) || $this->numRows() == 0)
+		{
+			return false;
+		}
+		return $this->nextRecord();
+	}
 
-      // Insert backticks only for incomplete table names.
-      if(stristr($db_table,'.')) {
-	$escape = '';
-      } else {
-	$escape = '`';
-      }
+	// returns the next record in an array
+	public function nextRecord() {
+		$this->record = $this->queryId->fetch_assoc();
+		$this->updateError('DB::nextRecord()-> mysql_fetch_array');
+		if(!$this->record || !is_array($this->record))
+		{
+			return false;
+		}
+		$this->currentRow++;
+		return $this->record;
+	}
+
+	// returns number of rows returned by the last select query
+	public function numRows() {
+		return intval($this->queryId->num_rows);
+	}
+
+	public function affectedRows() {
+		return intval($this->queryId->affected_rows);
+	}
+
+	// returns mySQL insert id
+	public function insertID() {
+		return $this->insert_id;
+	}
+
+
+	//* Function to quote strings
+	public function quote($formfield) {
+		return $this->escape_string($formfield);
+	}
+
+	//* Function to unquotae strings
+	public function unquote($formfield) {
+		return stripslashes($formfield);
+	}
+
+	public function toLower($record) {
+		if(is_array($record)) {
+			foreach($record as $key => $val) {
+				$key = strtolower($key);
+				$out[$key] = $val;
+			}
+		}
+		return $out;
+	}
+
+	public function diffrec($record_old, $record_new) {
+		$diffrec_full = array();
+		$diff_num = 0;
+
+		if(is_array($record_old) && count($record_old) > 0) {
+			foreach($record_old as $key => $val) {
+				// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
+				if(@$record_new[$key] != $val) {
+					// Record has changed
+					$diffrec_full['old'][$key] = $val;
+					$diffrec_full['new'][$key] = @$record_new[$key];
+					$diff_num++;
+				} else {
+					$diffrec_full['old'][$key] = $val;
+					$diffrec_full['new'][$key] = $val;
+				}
+			}
+		} elseif(is_array($record_new)) {
+			foreach($record_new as $key => $val) {
+				if(isset($record_new[$key]) && @$record_old[$key] != $val) {
+					// Record has changed
+					$diffrec_full['new'][$key] = $val;
+					$diffrec_full['old'][$key] = @$record_old[$key];
+					$diff_num++;
+				} else {
+					$diffrec_full['new'][$key] = $val;
+					$diffrec_full['old'][$key] = $val;
+				}
+			}
+		}
+
+		return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
+
+	}
+
+	//** Function to fill the datalog with a full differential record.
+	public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
+		global $app, $conf;
+
+		// Insert backticks only for incomplete table names.
+		if(stristr($db_table, '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
 
 		if($force_update == true) {
 			//* We force a update even if no record has changed
-			$diffrec_full = array('new' => $record_new,'old' => $record_old);
+			$diffrec_full = array('new' => $record_new, 'old' => $record_old);
 			$diff_num = count($record_new);
 		} else {
 			//* get the difference record between old and new record
@@ -281,135 +281,135 @@
 			unset($tmp);
 		}
 
-      // Insert the server_id, if the record has a server_id
-      $server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
-      if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
+		// Insert the server_id, if the record has a server_id
+		$server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
+		if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
 
 
-      if($diff_num > 0) {
-	//print_r($diff_num);
-	//print_r($diffrec_full);
-	$diffstr = $app->db->quote(serialize($diffrec_full));
-	$username = $app->db->quote($_SESSION['s']['user']['username']);
-	$dbidx = $primary_field.':'.$primary_id;
+		if($diff_num > 0) {
+			//print_r($diff_num);
+			//print_r($diffrec_full);
+			$diffstr = $app->db->quote(serialize($diffrec_full));
+			$username = $app->db->quote($_SESSION['s']['user']['username']);
+			$dbidx = $primary_field.':'.$primary_id;
 
-	if($action == 'INSERT') $action = 'i';
-	if($action == 'UPDATE') $action = 'u';
-	if($action == 'DELETE') $action = 'd';
-	$sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
-	$app->db->query($sql);
-      }
+			if($action == 'INSERT') $action = 'i';
+			if($action == 'UPDATE') $action = 'u';
+			if($action == 'DELETE') $action = 'd';
+			$sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
+			$app->db->query($sql);
+		}
 
-      return true;
-    }
+		return true;
+	}
 
-    //** Inserts a record and saves the changes into the datalog
-    public function datalogInsert($tablename, $insert_data, $index_field) {
-      global $app;
-	  
-	  if(is_array($insert_data)) {
+	//** Inserts a record and saves the changes into the datalog
+	public function datalogInsert($tablename, $insert_data, $index_field) {
+		global $app;
+
+		if(is_array($insert_data)) {
 			$key_str = '';
 			$val_str = '';
 			foreach($insert_data as $key => $val) {
 				$key_str .= "`".$key ."`,";
 				$val_str .= "'".$this->quote($val)."',";
 			}
-			$key_str = substr($key_str,0,-1);
-			$val_str = substr($val_str,0,-1);
+			$key_str = substr($key_str, 0, -1);
+			$val_str = substr($val_str, 0, -1);
 			$insert_data_str = '('.$key_str.') VALUES ('.$val_str.')';
 		} else {
 			$insert_data_str = $insert_data;
 		}
 
-      $old_rec = array();
-      $this->query("INSERT INTO $tablename $insert_data_str");
-      $index_value = $this->insertID();
-      $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec);
+		$old_rec = array();
+		$this->query("INSERT INTO $tablename $insert_data_str");
+		$index_value = $this->insertID();
+		$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec);
 
-      return $index_value;
-    }
+		return $index_value;
+	}
 
-    //** Updates a record and saves the changes into the datalog
-    public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
+	//** Updates a record and saves the changes into the datalog
+	public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
 		global $app;
-      
-	  $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-	  
-	  if(is_array($update_data)) {
+
+		$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+
+		if(is_array($update_data)) {
 			$update_data_str = '';
 			foreach($update_data as $key => $val) {
 				$update_data_str .= "`".$key ."` = '".$this->quote($val)."',";
 			}
-			$update_data_str = substr($update_data_str,0,-1);
+			$update_data_str = substr($update_data_str, 0, -1);
 		} else {
 			$update_data_str = $update_data;
 		}
-		
-      $this->query("UPDATE $tablename SET $update_data_str WHERE $index_field = '$index_value'");
-      $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec, $force_update);
 
-      return true;
-    }
+		$this->query("UPDATE $tablename SET $update_data_str WHERE $index_field = '$index_value'");
+		$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec, $force_update);
 
-    //** Deletes a record and saves the changes into the datalog
-    public function datalogDelete($tablename, $index_field, $index_value) {
-      global $app;
+		return true;
+	}
 
-      $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->query("DELETE FROM $tablename WHERE $index_field = '$index_value'");
-      $new_rec = array();
-      $this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
+	//** Deletes a record and saves the changes into the datalog
+	public function datalogDelete($tablename, $index_field, $index_value) {
+		global $app;
 
-      return true;
-    }
-    
-    //* get the current datalog status for the specified login (or currently logged in user)
-    public function datalogStatus($login = '') {
-        global $app;
-        
-        $return = array('count' => 0, 'entries' => array());
-        if($_SESSION['s']['user']['typ'] == 'admin') return $return; // these information should not be displayed to admin users
-        
-        if($login == '' && isset($_SESSION['s']['user'])) {
-            $login = $_SESSION['s']['user']['username'];
-        }
-        
-        $result = $this->queryAllRecords("SELECT COUNT( * ) AS cnt, sys_datalog.action, sys_datalog.dbtable FROM sys_datalog, server WHERE server.server_id = sys_datalog.server_id AND sys_datalog.user = '" . $this->quote($login) . "' AND sys_datalog.datalog_id > server.updated GROUP BY sys_datalog.dbtable, sys_datalog.action");
-        foreach($result as $row) {
-            if(!$row['dbtable'] || in_array($row['dbtable'], array('aps_instances', 'aps_instances_settings', 'mail_access', 'mail_content_filter'))) continue; // ignore some entries, maybe more to come
-            $return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable']));
-            $return['count'] += $row['cnt'];
-        }
-        unset($result);
-        
-        return $return;
-    }
+		$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->query("DELETE FROM $tablename WHERE $index_field = '$index_value'");
+		$new_rec = array();
+		$this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
+
+		return true;
+	}
+
+	//* get the current datalog status for the specified login (or currently logged in user)
+	public function datalogStatus($login = '') {
+		global $app;
+
+		$return = array('count' => 0, 'entries' => array());
+		if($_SESSION['s']['user']['typ'] == 'admin') return $return; // these information should not be displayed to admin users
+
+		if($login == '' && isset($_SESSION['s']['user'])) {
+			$login = $_SESSION['s']['user']['username'];
+		}
+
+		$result = $this->queryAllRecords("SELECT COUNT( * ) AS cnt, sys_datalog.action, sys_datalog.dbtable FROM sys_datalog, server WHERE server.server_id = sys_datalog.server_id AND sys_datalog.user = '" . $this->quote($login) . "' AND sys_datalog.datalog_id > server.updated GROUP BY sys_datalog.dbtable, sys_datalog.action");
+		foreach($result as $row) {
+			if(!$row['dbtable'] || in_array($row['dbtable'], array('aps_instances', 'aps_instances_settings', 'mail_access', 'mail_content_filter'))) continue; // ignore some entries, maybe more to come
+			$return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable']));
+			$return['count'] += $row['cnt'];
+		}
+		unset($result);
+
+		return $return;
+	}
 
 
-    public function freeResult($query) 
-    {
-      if(is_object($query) && (get_class($query) == "mysqli_result")) {
-	$query->free();
-	return true;
-      } else {
-	return false;
-      }
-    }
+	public function freeResult($query)
+	{
+		if(is_object($query) && (get_class($query) == "mysqli_result")) {
+			$query->free();
+			return true;
+		} else {
+			return false;
+		}
+	}
 
-    /* TODO: Does anything use this? */
-    public function delete() {
+	/* TODO: Does anything use this? */
+	public function delete() {
 
-    }
+	}
 
-    /* TODO: Does anything use this? */
-    public function Transaction($action) {
-      //action = begin, commit oder rollback
+	/* TODO: Does anything use this? */
+	public function Transaction($action) {
+		//action = begin, commit oder rollback
 
-    }
+	}
 
-    /*
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -423,33 +423,33 @@
 
      */
 
-    public function createTable($table_name,$columns) {
-      $index = '';
-      $sql = "CREATE TABLE $table_name (";
-      foreach($columns as $col){
-	$sql .= $col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
+	public function createTable($table_name, $columns) {
+		$index = '';
+		$sql = "CREATE TABLE $table_name (";
+		foreach($columns as $col){
+			$sql .= $col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
 
-	if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
-	if($col['notNull'] == true) {
-	  $sql .= 'NOT NULL ';
-	} else {
-	  $sql .= 'NULL ';
+			if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
+			if($col['notNull'] == true) {
+				$sql .= 'NOT NULL ';
+			} else {
+				$sql .= 'NULL ';
+			}
+			if($col['autoInc'] == true) $sql .= 'auto_increment ';
+			$sql.= ',';
+			// key Definitionen
+			if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
+			if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
+			if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+		$sql .= ')';
+		$this->query($sql);
+		return true;
 	}
-	if($col['autoInc'] == true) $sql .= 'auto_increment ';
-	$sql.= ',';
-	// key Definitionen
-	if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
-	if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
-	if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
-      }
-      $sql .= $index;
-      $sql = substr($sql,0,-1);
-      $sql .= ')';
-      $this->query($sql);
-      return true;
-    }
 
-    /*
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -462,59 +462,59 @@
 
 
      */
-    public function alterTable($table_name,$columns) {
-      $index = '';
-      $sql = "ALTER TABLE $table_name ";
-      foreach($columns as $col){
-	if($col['action'] == 'add') {
-	  $sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-	} elseif ($col['action'] == 'alter') {
-	  $sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-	} elseif ($col['action'] == 'drop') {
-	  $sql .= 'DROP '.$col['name'].' ';
+	public function alterTable($table_name, $columns) {
+		$index = '';
+		$sql = "ALTER TABLE $table_name ";
+		foreach($columns as $col){
+			if($col['action'] == 'add') {
+				$sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+			} elseif ($col['action'] == 'alter') {
+				$sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+			} elseif ($col['action'] == 'drop') {
+				$sql .= 'DROP '.$col['name'].' ';
+			}
+			if($col['action'] != 'drop') {
+				if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
+				if($col['notNull'] == true) {
+					$sql .= 'NOT NULL ';
+				} else {
+					$sql .= 'NULL ';
+				}
+				if($col['autoInc'] == true) $sql .= 'auto_increment ';
+				$sql.= ',';
+				// Index definitions
+				if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
+				if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
+				if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+			}
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+
+		//die($sql);
+		$this->query($sql);
+		return true;
 	}
-	if($col['action'] != 'drop') {  
-	  if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
-	  if($col['notNull'] == true) {
-	    $sql .= 'NOT NULL ';
-	  } else {
-	    $sql .= 'NULL ';
-	  }
-	  if($col['autoInc'] == true) $sql .= 'auto_increment ';
-	  $sql.= ',';
-	  // Index definitions
-	  if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
-	  if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
-	  if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+
+	public function dropTable($table_name) {
+		$this->check($table_name);
+		$sql = "DROP TABLE '". $table_name."'";
+		return $this->query($sql);
 	}
-      }
-      $sql .= $index;
-      $sql = substr($sql,0,-1);
 
-      //die($sql);
-      $this->query($sql);
-      return true;
-    }
+	// gibt Array mit Tabellennamen zur�ck
+	public function getTables($database_name = '') {
+		if($this->isConnected == false) return false;
+		if($database_name == '') $database_name = $this->dbName;
+		$result = parent::query("SHOW TABLES FROM $database_name");
+		for ($i = 0; $i < $result->num_rows; $i++) {
+			$tb_names[$i] = (($result->data_seek( $i) && (($___mysqli_tmp = $result->fetch_row()) !== NULL)) ? array_shift($___mysqli_tmp) : false);
+		}
+		return $tb_names;
+	}
 
-    public function dropTable($table_name) {
-      $this->check($table_name);
-      $sql = "DROP TABLE '". $table_name."'";
-      return $this->query($sql);
-    }
-
-    // gibt Array mit Tabellennamen zur�ck
-    public function getTables($database_name = '') {
-      if($this->isConnected == false) return false;
-      if($database_name == '') $database_name = $this->dbName;
-      $result = parent::query("SHOW TABLES FROM $database_name");
-      for ($i = 0; $i < $result->num_rows; $i++) {
-	$tb_names[$i] = (($result->data_seek( $i) && (($___mysqli_tmp = $result->fetch_row()) !== NULL)) ? array_shift($___mysqli_tmp) : false);
-      }
-      return $tb_names;       
-    }
-
-    // gibt Feldinformationen zur Tabelle zur�ck
-    /*
+	// gibt Feldinformationen zur Tabelle zur�ck
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -528,14 +528,14 @@
 
      */
 
-    function tableInfo($table_name) {
+	function tableInfo($table_name) {
 
-      global $go_api,$go_info,$app;
-      // Tabellenfelder einlesen
+		global $go_api, $go_info, $app;
+		// Tabellenfelder einlesen
 
-      if($rows = $app->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
-	foreach($rows as $row) {
-	  /*
+		if($rows = $app->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
+			foreach($rows as $row) {
+				/*
 	  $name = $row[0];
 	  $default = $row[4];
 	  $key = $row[3];
@@ -543,61 +543,61 @@
 	  $isnull = $row[2];
 	  $type = $row[1];
 	  */
-	  
-	  $name = $row['Field'];
-	  $default = $row['Default'];
-	  $key = $row['Key'];
-	  $extra = $row['Extra'];
-	  $isnull = $row['Null'];
-	  $type = $row['Type'];
+
+				$name = $row['Field'];
+				$default = $row['Default'];
+				$key = $row['Key'];
+				$extra = $row['Extra'];
+				$isnull = $row['Null'];
+				$type = $row['Type'];
 
 
-	  $column = array();
+				$column = array();
 
-	  $column['name'] = $name;
-	  //$column['type'] = $type;
-	  $column['defaultValue'] = $default;
-	  if(stristr($key,'PRI')) $column['option'] = 'primary';
-	  if(stristr($isnull,'YES')) {
-	    $column['notNull'] = false;
-	  } else {
-	    $column['notNull'] = true; 
-	  }
-	  if($extra == 'auto_increment') $column['autoInc'] = true;
+				$column['name'] = $name;
+				//$column['type'] = $type;
+				$column['defaultValue'] = $default;
+				if(stristr($key, 'PRI')) $column['option'] = 'primary';
+				if(stristr($isnull, 'YES')) {
+					$column['notNull'] = false;
+				} else {
+					$column['notNull'] = true;
+				}
+				if($extra == 'auto_increment') $column['autoInc'] = true;
 
 
-	  // Type in Metatype umsetzen
+				// Type in Metatype umsetzen
 
-	  if(stristr($type,'int(')) $metaType = 'int32';
-	      if(stristr($type,'bigint')) $metaType = 'int64';
-	      if(stristr($type,'char')) {
-	      $metaType = 'char';
-	      $tmp_typeValue = explode('(',$type);
-	      $column['typeValue'] = substr($tmp_typeValue[1],0,-1);  
-	      }
-	      if(stristr($type,'varchar')) {
-	      $metaType = 'varchar';
-	      $tmp_typeValue = explode('(',$type);
-	      $column['typeValue'] = substr($tmp_typeValue[1],0,-1);  
-	      }
-	      if(stristr($type,'text')) $metaType = 'text';
-	      if(stristr($type,'double')) $metaType = 'double';
-	      if(stristr($type,'blob')) $metaType = 'blob';
+				if(stristr($type, 'int(')) $metaType = 'int32';
+				if(stristr($type, 'bigint')) $metaType = 'int64';
+				if(stristr($type, 'char')) {
+					$metaType = 'char';
+					$tmp_typeValue = explode('(', $type);
+					$column['typeValue'] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, 'varchar')) {
+					$metaType = 'varchar';
+					$tmp_typeValue = explode('(', $type);
+					$column['typeValue'] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, 'text')) $metaType = 'text';
+				if(stristr($type, 'double')) $metaType = 'double';
+				if(stristr($type, 'blob')) $metaType = 'blob';
 
 
-	      $column['type'] = $metaType;
+				$column['type'] = $metaType;
 
-	      $columns[] = $column;
-	      }
-	return $columns;
-      } else {
-	return false;
-      }
+				$columns[] = $column;
+			}
+			return $columns;
+		} else {
+			return false;
+		}
 
 
-      //$this->createTable('tester',$columns);
+		//$this->createTable('tester',$columns);
 
-      /*
+		/*
 	 $result = mysql_list_fields($go_info["server"]["db_name"],$table_name);
 	 $fields = mysql_num_fields ($result);
 	 $i = 0;
@@ -622,40 +622,40 @@
 
 
 
-    }
+	}
 
-    public function mapType($metaType,$typeValue) {
-      global $go_api;
-      $metaType = strtolower($metaType);
-      switch ($metaType) {
-	case 'int16':
-	  return 'smallint';
-	  break;
-	case 'int32':
-	  return 'int';
-	  break;
-	case 'int64':
-	  return 'bigint';
-	  break;
-	case 'double':
-	  return 'double';
-	  break;
-	case 'char':
-	  return 'char';
-	  break;
-	case 'varchar':
-	  if($typeValue < 1) die('Database failure: Lenght required for these data types.');
-	  return 'varchar('.$typeValue.')';
-	      break;
-	      case 'text':
-	      return 'text';
-	      break;
-	      case 'blob':
-	      return 'blob';
-	      break;
-	      }
-	      }
+	public function mapType($metaType, $typeValue) {
+		global $go_api;
+		$metaType = strtolower($metaType);
+		switch ($metaType) {
+		case 'int16':
+			return 'smallint';
+			break;
+		case 'int32':
+			return 'int';
+			break;
+		case 'int64':
+			return 'bigint';
+			break;
+		case 'double':
+			return 'double';
+			break;
+		case 'char':
+			return 'char';
+			break;
+		case 'varchar':
+			if($typeValue < 1) die('Database failure: Lenght required for these data types.');
+			return 'varchar('.$typeValue.')';
+			break;
+		case 'text':
+			return 'text';
+			break;
+		case 'blob':
+			return 'blob';
+			break;
+		}
+	}
 
-	      }
+}
 
-	      ?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/form.inc.php b/interface/lib/classes/form.inc.php
index 898cbe6..34c0b62 100644
--- a/interface/lib/classes/form.inc.php
+++ b/interface/lib/classes/form.inc.php
@@ -29,165 +29,192 @@
 */
 
 /**
-* Formularbehandlung
-*
-* Funktionen zur Umwandlung von Formulardaten
-* sowie zum vorbereiten von HTML und SQL
-* Ausgaben
-*
-*	Tabellendefinition
-*	
-*	Datentypen:
-*	- INTEGER (Wandelt Ausdrücke in Int um)
-*	- DOUBLE
-*	- CURRENCY (Formatiert Zahlen nach Währungsnotation)
-*	- VARCHAR (kein weiterer Format Check)
-*	- DATE (Datumsformat, Timestamp Umwandlung)
-*	
-*	Formtype:
-*	- TEXT (normales Textfeld)
-*	- PASSWORD (Feldinhalt wird nicht angezeigt)
-*	- SELECT (Gibt Werte als option Feld aus)
-*	- MULTIPLE (Select-Feld mit nehreren Werten)
-*	
-*	VALUE:
-*	- Wert oder Array
-*	
-*	SEPARATOR
-*	- Trennzeichen für multiple Felder
-*
-*	Hinweis:
-*	Das ID-Feld ist nicht bei den Table Values einzufügen.
-*
-* @package form
-* @author Till Brehm
-* @version 1.1
-*/
+ * Formularbehandlung
+ *
+ * Funktionen zur Umwandlung von Formulardaten
+ * sowie zum vorbereiten von HTML und SQL
+ * Ausgaben
+ *
+ * Tabellendefinition
+ *
+ * Datentypen:
+ * - INTEGER (Wandelt Ausdrücke in Int um)
+ * - DOUBLE
+ * - CURRENCY (Formatiert Zahlen nach Währungsnotation)
+ * - VARCHAR (kein weiterer Format Check)
+ * - DATE (Datumsformat, Timestamp Umwandlung)
+ *
+ * Formtype:
+ * - TEXT (normales Textfeld)
+ * - PASSWORD (Feldinhalt wird nicht angezeigt)
+ * - SELECT (Gibt Werte als option Feld aus)
+ * - MULTIPLE (Select-Feld mit nehreren Werten)
+ *
+ * VALUE:
+ * - Wert oder Array
+ *
+ * SEPARATOR
+ * - Trennzeichen für multiple Felder
+ *
+ * Hinweis:
+ * Das ID-Feld ist nicht bei den Table Values einzufügen.
+ *
+ * @package form
+ * @author Till Brehm
+ * @version 1.1
+ */
+
 
 class form {
-	
+
+
+
 	/**
-	* Definition der Tabelle (array)
-	* @var tableDef
-	*/
+	 * Definition der Tabelle (array)
+	 * @var tableDef
+	 */
 	var $tableDef;
-	
+
+
+
 	/**
-	* Private
-	* @var action
-	*/
+	 * Private
+	 * @var action
+	 */
 	var $action;
-	
+
+
+
 	/**
-	* Tabellenname (String)
-	* @var table_name
-	*/
+	 * Tabellenname (String)
+	 * @var table_name
+	 */
 	var $table_name;
-	
+
+
+
 	/**
-	* Debug Variable
-	* @var debug
-	*/
+	 * Debug Variable
+	 * @var debug
+	 */
 	var $debug = 0;
-	
+
+
+
 	/**
-	* name des primary Field der Tabelle (string)
-	* @var table_index
-	*/
+	 * name des primary Field der Tabelle (string)
+	 * @var table_index
+	 */
 	var $table_index;
-	
+
+
+
 	/**
-	* enthält die Fehlermeldung bei Überprüfung
-	* der Variablen mit Regex
-	* @var errorMessage
-	*/
+	 * enthält die Fehlermeldung bei Überprüfung
+	 * der Variablen mit Regex
+	 * @var errorMessage
+	 */
 	var $errorMessage;
-	
+
 	var $dateformat = "d.m.Y";
-    var $formDef;
-	
+	var $formDef;
+
+
+
+
+
 	/**
-	* Laden der Tabellendefinition
-	*
-	* @param file: Pfad zur Tabellendefinition
-	* @return true
-	*/
+	 * Laden der Tabellendefinition
+	 *
+	 * @param file: Pfad zur Tabellendefinition
+	 * @return true
+	 */
 	function loadTableDef($file) {
-		global $app,$conf;
-		
-		include_once($file);
+		global $app, $conf;
+
+		include_once $file;
 		$this->tableDef = $table;
 		$this->table_name = $table_name;
 		$this->table_index = $table_index;
 		return true;
 	}
-    
-    function loadFormDef($file) {
-		global $app,$conf;
-		
-		include_once($file);
+
+	function loadFormDef($file) {
+		global $app, $conf;
+
+		include_once $file;
 		$this->formDef = $form;
 		return true;
 	}
-	
-	
+
+
+
+
+
+
+
+
 	/**
-	* Konvertiert die Daten des übergebenen assoziativen
-	* Arrays in "menschenlesbare" Form.
-	* Datentyp Konvertierung, z.B. für Ausgabe in Listen.
-	*
-	* @param record
-	* @return record
-	*/
+	 * Konvertiert die Daten des übergebenen assoziativen
+	 * Arrays in "menschenlesbare" Form.
+	 * Datentyp Konvertierung, z.B. für Ausgabe in Listen.
+	 *
+	 * @param record
+	 * @return record
+	 */
 	function decode($record) {
-        global $app;
+		global $app;
 		if(is_array($record)) {
 			foreach($record as $key => $val) {
 				switch ($this->tableDef[$key]['datatype']) {
 				case 'VARCHAR':
 					$new_record[$key] = stripslashes($val);
-				break;
-				
+					break;
+
 				case 'DATE':
 					if($val > 0) {
-						$new_record[$key] = date($this->dateformat,$val);
+						$new_record[$key] = date($this->dateformat, $val);
 					}
-				break;
-				
+					break;
+
 				case 'INTEGER':
 					$new_record[$key] = $app->functions->intval($val);
-				break;
-				
+					break;
+
 				case 'DOUBLE':
 					$new_record[$key] = $val;
-				break;
-				
+					break;
+
 				case 'CURRENCY':
 					$new_record[$key] = number_format($val, 2, ',', '');
-				break;
-				
+					break;
+
 				default:
 					$new_record[$key] = stripslashes($val);
 				}
 			}
-			
+
 		}
-	return $new_record;
+		return $new_record;
 	}
-	
+
+
+
+
+
 	/**
-	* Record für Ausgabe in Formularen vorbereiten.
-	*
-	* @param record = Datensatz als Array
-	* @param action = NEW oder EDIT 
-	* @return record
-	*/
-	function getHTML($record,$action = 'NEW') {
-		
+	 * Record für Ausgabe in Formularen vorbereiten.
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = NEW oder EDIT
+	 * @return record
+	 */
+	function getHTML($record, $action = 'NEW') {
+
 		global $app;
-		
+
 		if(!is_array($this->tableDef)) $app->error("Keine Tabellendefinition vorhanden.");
-		
+
 		$new_record = array();
 		if($action == 'EDIT') {
 			$record = $this->decode($record);
@@ -203,32 +230,32 @@
 							}
 						}
 						$new_record[$key] = $out;
-					break;
+						break;
 					case 'MULTIPLE':
 						if(is_array($this->tableDef[$key]['value'])) {
-							
+
 							// aufsplitten ergebnisse
-							$vals = explode($this->tableDef[$key]['separator'],$val);
-							
+							$vals = explode($this->tableDef[$key]['separator'], $val);
+
 							// HTML schreiben
 							$out = '';
 							foreach($this->tableDef[$key]['value'] as $k => $v) {
-								
+
 								$selected = '';
 								foreach($vals as $tvl) {
 									if(trim($tvl) == trim($k)) $selected = ' SELECTED';
 								}
-								
+
 								$out .= "<option value='$k'$selected>$v</option>\r\n";
 							}
 						}
 						$new_record[$key] = $out;
-					break;
-					
+						break;
+
 					case 'PASSWORD':
 						$new_record[$key] = '';
-					break;
-					
+						break;
+
 					default:
 						$new_record[$key] = htmlspecialchars($val);
 					}
@@ -246,50 +273,54 @@
 						}
 					}
 					$new_record[$key] = $out;
-				break;
-				case 'MULTIPLE':
-						if(is_array($this->tableDef[$key]['value'])) {
-							
-							// aufsplitten ergebnisse
-							$vals = explode($this->tableDef[$key]['separator'],$val);
-							
-							// HTML schreiben
-							$out = '';
-							foreach($this->tableDef[$key]['value'] as $k => $v) {
-								
-								$out .= "<option value='$k'>$v</option>\r\n";
-							}
-						}
-						$new_record[$key] = $out;
 					break;
-				
+				case 'MULTIPLE':
+					if(is_array($this->tableDef[$key]['value'])) {
+
+						// aufsplitten ergebnisse
+						$vals = explode($this->tableDef[$key]['separator'], $val);
+
+						// HTML schreiben
+						$out = '';
+						foreach($this->tableDef[$key]['value'] as $k => $v) {
+
+							$out .= "<option value='$k'>$v</option>\r\n";
+						}
+					}
+					$new_record[$key] = $out;
+					break;
+
 				case 'PASSWORD':
 					$new_record[$key] = '';
-				break;
-				
+					break;
+
 				default:
 					$new_record[$key] = htmlspecialchars($this->tableDef[$key]['value']);
 				}
 			}
-		
+
 		}
-		
+
 		if($this->debug == 1) $this->dbg($new_record);
-		
+
 		return $new_record;
 	}
-	
+
+
+
+
+
 	/**
-	* Record in "maschinen lesbares" Format überführen
-	* und Werte gegen reguläre Ausdrücke prüfen.
-	*
-	* @param record = Datensatz als Array
-	* @return record
-	*/
+	 * Record in "maschinen lesbares" Format überführen
+	 * und Werte gegen reguläre Ausdrücke prüfen.
+	 *
+	 * @param record = Datensatz als Array
+	 * @return record
+	 */
 	function encode($record) {
 		global $app;
 		$this->errorMessage = '';
-		
+
 		if(is_array($record)) {
 			foreach($record as $key => $val) {
 				switch ($this->tableDef[$key]['datatype']) {
@@ -297,26 +328,26 @@
 					if(!is_array($val)) {
 						$new_record[$key] = $app->db->quote($val);
 					} else {
-						$new_record[$key] = implode($this->tableDef[$key]['separator'],$val);
+						$new_record[$key] = implode($this->tableDef[$key]['separator'], $val);
 					}
-				break;
+					break;
 				case 'DATE':
 					if($val > 0) {
-						list($tag,$monat,$jahr) = explode('.',$val);
-						$new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
+						list($tag, $monat, $jahr) = explode('.', $val);
+						$new_record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
 					}
-				break;
+					break;
 				case 'INTEGER':
 					$new_record[$key] = $app->functions->intval($val);
-				break;
+					break;
 				case 'DOUBLE':
 					$new_record[$key] = $app->db->quote($val);
-				break;
+					break;
 				case 'CURRENCY':
-					$new_record[$key] = str_replace(",",".",$val);
-				break;
+					$new_record[$key] = str_replace(",", ".", $val);
+					break;
 				}
-				
+
 				if($this->tableDef[$key]['regex'] != '') {
 					// Enable that "." matches also newlines
 					$this->tableDef[$key]['regex'] .= 's';
@@ -325,152 +356,160 @@
 					}
 				}
 			}
-			
+
 		}
 		return $new_record;
 	}
-	
+
+
+
+
+
 	/**
-	* SQL Statement für Record erzeugen.
-	*
-	* @param record = Datensatz als Array
-	* @param action = INSERT oder UPDATE
-	* @param primary_id
-	* @return record
-	*/
+	 * SQL Statement für Record erzeugen.
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = INSERT oder UPDATE
+	 * @param primary_id
+	 * @return record
+	 */
 	function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
-		
+
 		global $app;
-		
+
 		$record = $this->encode($record);
 		$sql_insert_key = '';
 		$sql_insert_val = '';
 		$sql_update = '';
-		
+
 		if(!is_array($this->tableDef)) $app->error("Keine Tabellendefinition vorhanden.");
-		
+
 		// gehe durch alle Felder des Records
 		if(is_array($record)) {
-        foreach($record as $key => $val) {
-			// Wenn es kein leeres Passwortfeld ist
-			if (!($this->tableDef[$key]['formtype'] == 'PASSWORD' and $val == '')) {
-				// gehe durch alle Felder der TableDef
-				foreach($this->tableDef as $tk => $tv) {
-					// Wenn Feld in TableDef enthalten ist
-					if($tk == $key) {
-						// Erzeuge Insert oder Update Quelltext
-						if($action == "INSERT") {
-							
-							if($this->tableDef[$key]['formtype'] == 'PASSWORD') {
-								$sql_insert_key .= "`$key`, ";
-								$sql_insert_val .= "md5('$val'), ";
-							//} elseif($this->tableDef[$key]['formtype'] == 'MULTIPLE') {
-							//	$val = implode($this->tableDef[$key]['separator'],$val);
-							//	$sql_insert_key .= "`$key`, ";
-							//	$sql_insert_val .= "'$val', ";
+			foreach($record as $key => $val) {
+				// Wenn es kein leeres Passwortfeld ist
+				if (!($this->tableDef[$key]['formtype'] == 'PASSWORD' and $val == '')) {
+					// gehe durch alle Felder der TableDef
+					foreach($this->tableDef as $tk => $tv) {
+						// Wenn Feld in TableDef enthalten ist
+						if($tk == $key) {
+							// Erzeuge Insert oder Update Quelltext
+							if($action == "INSERT") {
+
+								if($this->tableDef[$key]['formtype'] == 'PASSWORD') {
+									$sql_insert_key .= "`$key`, ";
+									$sql_insert_val .= "md5('$val'), ";
+									//} elseif($this->tableDef[$key]['formtype'] == 'MULTIPLE') {
+									// $val = implode($this->tableDef[$key]['separator'],$val);
+									// $sql_insert_key .= "`$key`, ";
+									// $sql_insert_val .= "'$val', ";
+								} else {
+									$sql_insert_key .= "`$key`, ";
+									$sql_insert_val .= "'$val', ";
+								}
+
 							} else {
-								$sql_insert_key .= "`$key`, ";
-								$sql_insert_val .= "'$val', ";
+
+								if($this->tableDef[$key]['formtype'] == 'PASSWORD') {
+									$sql_update .= "`$key` = md5('$val'), ";
+									//} elseif($this->tableDef[$key]['formtype'] == 'MULTIPLE') {
+									// $val = implode($this->tableDef[$key]['separator'],$val);
+									// $sql_update .= "`$key` = '$val', ";
+								} else {
+									$sql_update .= "`$key` = '$val', ";
+								}
+
 							}
-							
-						} else {
-							
-							if($this->tableDef[$key]['formtype'] == 'PASSWORD') {
-								$sql_update .= "`$key` = md5('$val'), ";
-							//} elseif($this->tableDef[$key]['formtype'] == 'MULTIPLE') {
-							//	$val = implode($this->tableDef[$key]['separator'],$val);
-							//	$sql_update .= "`$key` = '$val', ";
-							} else {
-								$sql_update .= "`$key` = '$val', ";
-							}
-							
 						}
 					}
 				}
 			}
 		}
-        }
-		
+
 		// Füge Backticks nur bei unvollständigen Tabellennamen ein
-		if(stristr($this->table_name,'.')) {
+		if(stristr($this->table_name, '.')) {
 			$escape = '';
 		} else {
 			$escape = '`';
 		}
-		
-		
+
+
 		if($action == "INSERT") {
-			$sql_insert_key = substr($sql_insert_key,0,-2);
-			$sql_insert_val = substr($sql_insert_val,0,-2);
+			$sql_insert_key = substr($sql_insert_key, 0, -2);
+			$sql_insert_val = substr($sql_insert_val, 0, -2);
 			$sql = "INSERT INTO ".$escape.$this->table_name.$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
 		} else {
 			if($primary_id != 0) {
-				$sql_update = substr($sql_update,0,-2);
+				$sql_update = substr($sql_update, 0, -2);
 				$sql = "UPDATE ".$escape.$this->table_name.$escape." SET ".$sql_update." WHERE ".$this->table_index ." = ".$primary_id;
 				if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
 			} else {
 				$app->error("Primary ID fehlt!");
 			}
 		}
-		
+
 		return $sql;
 	}
-	
+
+
+
+
+
 	/**
-	* Debugging arrays.
-	*
-	* @param array_data
-	*/
+	 * Debugging arrays.
+	 *
+	 * @param array_data
+	 */
 	function dbg($array_data) {
-		
+
 		echo "<pre>";
 		print_r($array_data);
 		echo "</pre>";
-		
+
 	}
-    
-    
-    function showForm() {
-    	global $app,$conf;
-        
-        if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
-        
-        if($this->errorMessage == '') {
-        	// wenn kein Fehler vorliegt
+
+
+	function showForm() {
+		global $app, $conf;
+
+		if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
+
+		if($this->errorMessage == '') {
+			// wenn kein Fehler vorliegt
 			if($_REQUEST["next_tab"] != '') {
-            	// wenn nächster Tab bekannt
-            	$active_tab = $_REQUEST["next_tab"];
-            } else {
-            	// ansonsten ersten tab nehmen
-            	$active_tab = $this->formDef["tabs"][0]["name"];
-            }
+				// wenn nächster Tab bekannt
+				$active_tab = $_REQUEST["next_tab"];
+			} else {
+				// ansonsten ersten tab nehmen
+				$active_tab = $this->formDef["tabs"][0]["name"];
+			}
 		} else {
-        	// bei Fehlern den gleichen Tab nochmal anzeigen
-            $active_tab = $_SESSION["s"]["form"]["tab"];
+			// bei Fehlern den gleichen Tab nochmal anzeigen
+			$active_tab = $_SESSION["s"]["form"]["tab"];
 		}
-        
-        // definiere Tabs
-        foreach( $this->formDef["tabs"] as $tab) {
-            
-            if($tab["name"] == $active_tab) {
-            	$app->tpl->setInclude('content_tpl',$tab["template"]);
-                $tab["active"] = 1;
-                $_SESSION["s"]["form"]["tab"] = $tab["name"];
-            } else {
-            	$tab["active"] = 0;
-            }
-			
-            $frmTab[] = $tab;
-        }
-        
-        // setze Loop
-        $app->tpl->setLoop("formTab", $frmTab);
+
+		// definiere Tabs
+		foreach( $this->formDef["tabs"] as $tab) {
+
+			if($tab["name"] == $active_tab) {
+				$app->tpl->setInclude('content_tpl', $tab["template"]);
+				$tab["active"] = 1;
+				$_SESSION["s"]["form"]["tab"] = $tab["name"];
+			} else {
+				$tab["active"] = 0;
+			}
+
+			$frmTab[] = $tab;
+		}
+
+		// setze Loop
+		$app->tpl->setLoop("formTab", $frmTab);
 
 		// Formular action setzen
-		$app->tpl->setVar('form_action',$this->formDef["action"]);
-    }
-	
-	
+		$app->tpl->setVar('form_action', $this->formDef["action"]);
+	}
+
+
 }
 
 ?>
diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index 64074d4..d2ac583 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -33,14 +33,14 @@
 
 class functions {
 	var $idn_converter = null;
-    var $idn_converter_name = '';
+	var $idn_converter_name = '';
 
 	public function mail($to, $subject, $text, $from, $filepath = '', $filetype = 'application/pdf', $filename = '', $cc = '', $bcc = '', $from_name = '') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		if($conf['demo_mode'] == true) $app->error("Mail sending disabled in demo mode.");
-		
-        $app->uses('getconf,ispcmail');
+
+		$app->uses('getconf,ispcmail');
 		$mail_config = $app->getconf->get_global_config('mail');
 		if($mail_config['smtp_enabled'] == 'y') {
 			$mail_config['use_smtp'] = true;
@@ -49,27 +49,27 @@
 		$app->ispcmail->setSender($from, $from_name);
 		$app->ispcmail->setSubject($subject);
 		$app->ispcmail->setMailText($text);
-		
+
 		if($filepath != '') {
 			if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
 			$app->ispcmail->readAttachFile($filepath);
 		}
-		
+
 		if($cc != '') $app->ispcmail->setHeader('Cc', $cc);
 		if($bcc != '') $app->ispcmail->setHeader('Bcc', $bcc);
-		
+
 		$app->ispcmail->send($to);
 		$app->ispcmail->finish();
-		
+
 		/* left in here just for the case...
 		if($filepath != '') {
 			if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
-			
+
 			$content = file_get_contents($filepath);
 			$content = chunk_split(base64_encode($content));
 			$uid = strtoupper(md5(uniqid(time())));
 			$subject      = "=?utf-8?B?".base64_encode($subject)."?=";
-			
+
 			if($filename == '') {
 				$path_parts = pathinfo($filepath);
 				$filename = $path_parts["basename"];
@@ -109,44 +109,44 @@
 		*/
 		return true;
 	}
-	
-	public function array_merge($array1,$array2) {
+
+	public function array_merge($array1, $array2) {
 		$out = $array1;
 		foreach($array2 as $key => $val) {
 			$out[$key] = $val;
 		}
 		return $out;
 	}
-	
+
 	public function currency_format($number, $view = '') {
 		global $app;
 		if($view != '') $number_format_decimals = (int)$app->lng('number_format_decimals_'.$view);
-        if(!$number_format_decimals) $number_format_decimals = (int)$app->lng('number_format_decimals');
-        
+		if(!$number_format_decimals) $number_format_decimals = (int)$app->lng('number_format_decimals');
+
 		$number_format_dec_point = $app->lng('number_format_dec_point');
 		$number_format_thousands_sep = $app->lng('number_format_thousands_sep');
 		if($number_format_thousands_sep == 'number_format_thousands_sep') $number_format_thousands_sep = '';
 		return number_format((double)$number, $number_format_decimals, $number_format_dec_point, $number_format_thousands_sep);
 	}
-	
+
 	//* convert currency formatted number back to floating number
 	public function currency_unformat($number) {
 		global $app;
-        
+
 		$number_format_dec_point = $app->lng('number_format_dec_point');
 		$number_format_thousands_sep = $app->lng('number_format_thousands_sep');
 		if($number_format_thousands_sep == 'number_format_thousands_sep') $number_format_thousands_sep = '';
-		
+
 		if($number_format_thousands_sep != '') $number = str_replace($number_format_thousands_sep, '', $number);
 		if($number_format_dec_point != '.' && $number_format_dec_point != '') $number = str_replace($number_format_dec_point, '.', $number);
-		
+
 		return (double)$number;
 	}
-	
+
 	public function get_ispconfig_url() {
 		global $app;
-		
-		$url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS') || stristr($_SERVER['HTTPS'],'on'))?'https':'http';
+
+		$url = (stristr($_SERVER['SERVER_PROTOCOL'], 'HTTPS') || stristr($_SERVER['HTTPS'], 'on'))?'https':'http';
 		if($_SERVER['SERVER_NAME'] != '_') {
 			$url .= '://'.$_SERVER['SERVER_NAME'];
 			if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
@@ -154,7 +154,7 @@
 			}
 		} else {
 			$app->uses("getconf");
-			$server_config = $app->getconf->get_server_config(1,'server');
+			$server_config = $app->getconf->get_server_config(1, 'server');
 			$url .= '://'.$server_config['hostname'];
 			if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
 				$url .= ':'.$_SERVER['SERVER_PORT'];
@@ -162,53 +162,53 @@
 		}
 		return $url;
 	}
-	
-    public function json_encode($data) {
+
+	public function json_encode($data) {
 		if(!function_exists('json_encode')){
 			if(is_array($data) || is_object($data)){
-				$islist = is_array($data) && (empty($data) || array_keys($data) === range(0,count($data)-1));
+				$islist = is_array($data) && (empty($data) || array_keys($data) === range(0, count($data)-1));
 
 				if($islist){
 					$json = '[' . implode(',', array_map(array($this, "json_encode"), $data) ) . ']';
 				} else {
-					$items = Array();
+					$items = array();
 					foreach( $data as $key => $value ) {
 						$items[] = $this->json_encode("$key") . ':' . $this->json_encode($value);
 					}
 					$json = '{' . implode(',', $items) . '}';
 				}
 			} elseif(is_string($data)){
-				# Escape non-printable or Non-ASCII characters.
-				# I also put the \\ character first, as suggested in comments on the 'addclashes' page.
+				// Escape non-printable or Non-ASCII characters.
+				// I also put the \\ character first, as suggested in comments on the 'addclashes' page.
 				$string = '"'.addcslashes($data, "\\\"\n\r\t/".chr(8).chr(12)).'"';
 				$json = '';
 				$len = strlen($string);
-				# Convert UTF-8 to Hexadecimal Codepoints.
+				// Convert UTF-8 to Hexadecimal Codepoints.
 				for($i = 0; $i < $len; $i++){
 					$char = $string[$i];
 					$c1 = ord($char);
 
-					# Single byte;
+					// Single byte;
 					if($c1 <128){
 						$json .= ($c1 > 31) ? $char : sprintf("\\u%04x", $c1);
 						continue;
 					}
 
-					# Double byte
+					// Double byte
 					$c2 = ord($string[++$i]);
 					if(($c1 & 32) === 0){
 						$json .= sprintf("\\u%04x", ($c1 - 192) * 64 + $c2 - 128);
 						continue;
 					}
 
-					# Triple
+					// Triple
 					$c3 = ord($string[++$i]);
 					if(($c1 & 16) === 0){
 						$json .= sprintf("\\u%04x", (($c1 - 224) <<12) + (($c2 - 128) << 6) + ($c3 - 128));
 						continue;
 					}
 
-					# Quadruple
+					// Quadruple
 					$c4 = ord($string[++$i]);
 					if(($c1 & 8) === 0){
 						$u = (($c1 & 15) << 2) + (($c2>>4) & 3) - 1;
@@ -219,25 +219,25 @@
 					}
 				}
 			} else {
-				# int, floats, bools, null
+				// int, floats, bools, null
 				$json = strtolower(var_export($data, true));
 			}
 			return $json;
 		} else {
 			return json_encode($data);
 		}
-    }
-	
+	}
+
 	public function suggest_ips($type = 'IPv4'){
 		global $app;
-	
+
 		if($type == 'IPv4'){
 			$regex = "/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/";
 		} else {
 			// IPv6
 			$regex = "/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i";
 		}
-		
+
 		$server_by_id = array();
 		$server_by_ip = array();
 		$servers = $app->db->queryAllRecords("SELECT * FROM server");
@@ -246,7 +246,7 @@
 				$server_by_id[$server['server_id']] = $server['server_name'];
 			}
 		}
-	
+
 		$ips = array();
 		$results = $app->db->queryAllRecords("SELECT ip_address AS ip, server_id FROM server_ip WHERE ip_type = '".$type."'");
 		if(!empty($results) && is_array($results)){
@@ -275,7 +275,7 @@
 				if(preg_match($regex, $result['ip'])) $ips[] = $result['ip'];
 			}
 		}
-	
+
 		$results = $app->db->queryAllRecords("SELECT xfer FROM dns_slave WHERE xfer != ''");
 		if(!empty($results) && is_array($results)){
 			foreach($results as $result){
@@ -320,105 +320,107 @@
 		sort($ips, SORT_NUMERIC);
 
 		$result_array = array('cheader' => array(), 'cdata' => array());
-	
+
 		if(!empty($ips)){
 			$result_array['cheader'] = array('title' => 'IPs',
-											'total' => count($ips),
-											'limit' => count($ips)
-											);
-	
+				'total' => count($ips),
+				'limit' => count($ips)
+			);
+
 			foreach($ips as $ip){
-				$result_array['cdata'][] = array(	'title' => $ip,
-													'description' => $type.($server_by_ip[$ip] != ''? ' &gt; '.$server_by_ip[$ip] : ''),
-													'onclick' => '',
-													'fill_text' => $ip
-												);
+				$result_array['cdata'][] = array( 'title' => $ip,
+					'description' => $type.($server_by_ip[$ip] != ''? ' &gt; '.$server_by_ip[$ip] : ''),
+					'onclick' => '',
+					'fill_text' => $ip
+				);
 			}
 		}
-	
+
 		return $result_array;
 	}
 
-    public function intval($string, $force_numeric = false) {
-        if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) {
-            if($force_numeric == true) return floatval($string);
-            elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
-            else return 0;
-        } else {
-            return intval($string);
-        }
-    }
-    
-    /** IDN converter wrapper.
-     * all converter classes should be placed in ISPC_CLASS_PATH.'/idn/'
-     */
-    private function _idn_encode_decode($domain, $encode = true) {
-        if($domain == '') return '';
-        if(preg_match('/^[0-9\.]+$/', $domain)) return $domain; // may be an ip address - anyway does not need to bee encoded
-        
-        // get domain and user part if it is an email
-        $user_part = false;
-        if(strpos($domain, '@') !== false) {
-            $user_part = substr($domain, 0, strrpos($domain, '@'));
-            $domain = substr($domain, strrpos($domain, '@') + 1);
-        }
-        
-        if($encode == true) {
-            if(function_exists('idn_to_ascii')) {
-                $domain = idn_to_ascii($domain);
-            } elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
-                 /* use idna class:
+	public function intval($string, $force_numeric = false) {
+		if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) {
+			if($force_numeric == true) return floatval($string);
+			elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
+			else return 0;
+		} else {
+			return intval($string);
+		}
+	}
+
+	/** IDN converter wrapper.
+	 * all converter classes should be placed in ISPC_CLASS_PATH.'/idn/'
+	 */
+
+
+	private function _idn_encode_decode($domain, $encode = true) {
+		if($domain == '') return '';
+		if(preg_match('/^[0-9\.]+$/', $domain)) return $domain; // may be an ip address - anyway does not need to bee encoded
+
+		// get domain and user part if it is an email
+		$user_part = false;
+		if(strpos($domain, '@') !== false) {
+			$user_part = substr($domain, 0, strrpos($domain, '@'));
+			$domain = substr($domain, strrpos($domain, '@') + 1);
+		}
+
+		if($encode == true) {
+			if(function_exists('idn_to_ascii')) {
+				$domain = idn_to_ascii($domain);
+			} elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
+				/* use idna class:
                  * @author  Matthias Sommerfeld <mso@phlylabs.de>
                  * @copyright 2004-2011 phlyLabs Berlin, http://phlylabs.de
                  * @version 0.8.0 2011-03-11
                  */
-                
-                if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
-                    include_once(ISPC_CLASS_PATH.'/idn/idna_convert.class.php');
-                    $this->idn_converter = new idna_convert(array('idn_version' => 2008));
-                    $this->idn_converter_name = 'idna_convert.class';
-                }
-                $domain = $this->idn_converter->encode($domain);
-            }
-        } else {
-            if(function_exists('idn_to_utf8')) {
-                $domain = idn_to_utf8($domain);
-            } elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
-                 /* use idna class:
+
+				if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
+					include_once ISPC_CLASS_PATH.'/idn/idna_convert.class.php';
+					$this->idn_converter = new idna_convert(array('idn_version' => 2008));
+					$this->idn_converter_name = 'idna_convert.class';
+				}
+				$domain = $this->idn_converter->encode($domain);
+			}
+		} else {
+			if(function_exists('idn_to_utf8')) {
+				$domain = idn_to_utf8($domain);
+			} elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
+				/* use idna class:
                  * @author  Matthias Sommerfeld <mso@phlylabs.de>
                  * @copyright 2004-2011 phlyLabs Berlin, http://phlylabs.de
                  * @version 0.8.0 2011-03-11
                  */
-                
-                if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
-                    include_once(ISPC_CLASS_PATH.'/idn/idna_convert.class.php');
-                    $this->idn_converter = new idna_convert(array('idn_version' => 2008));
-                    $this->idn_converter_name = 'idna_convert.class';
-                }
-                $domain = $this->idn_converter->decode($domain);
-            }
-        }
-        
-        if($user_part !== false) return $user_part . '@' . $domain;
-        else return $domain;
-    }
-     
-    public function idn_encode($domain) {
-        $domains = explode("\n", $domain);
-        for($d = 0; $d < count($domains); $d++) {
-            $domains[$d] = $this->_idn_encode_decode($domains[$d], true);
-        }
-        return implode("\n", $domains);
-    }
-    
-    public function idn_decode($domain) {
-        $domains = explode("\n", $domain);
-        for($d = 0; $d < count($domains); $d++) {
-            $domains[$d] = $this->_idn_encode_decode($domains[$d], false);
-        }
-        return implode("\n", $domains);
-    }
-		
+
+				if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
+					include_once ISPC_CLASS_PATH.'/idn/idna_convert.class.php';
+					$this->idn_converter = new idna_convert(array('idn_version' => 2008));
+					$this->idn_converter_name = 'idna_convert.class';
+				}
+				$domain = $this->idn_converter->decode($domain);
+			}
+		}
+
+		if($user_part !== false) return $user_part . '@' . $domain;
+		else return $domain;
+	}
+
+	public function idn_encode($domain) {
+		$domains = explode("\n", $domain);
+		for($d = 0; $d < count($domains); $d++) {
+			$domains[$d] = $this->_idn_encode_decode($domains[$d], true);
+		}
+		return implode("\n", $domains);
+	}
+
+	public function idn_decode($domain) {
+		$domains = explode("\n", $domain);
+		for($d = 0; $d < count($domains); $d++) {
+			$domains[$d] = $this->_idn_encode_decode($domains[$d], false);
+		}
+		return implode("\n", $domains);
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/getconf.inc.php b/interface/lib/classes/getconf.inc.php
index ad2a302..45fefa6 100644
--- a/interface/lib/classes/getconf.inc.php
+++ b/interface/lib/classes/getconf.inc.php
@@ -31,7 +31,7 @@
 class getconf {
 
 	private $config;
-	
+
 	public function get_server_config($server_id, $section = '') {
 		global $app;
 
@@ -43,10 +43,10 @@
 		}
 		return ($section == '') ? $this->config[$server_id] : $this->config[$server_id][$section];
 	}
-	
+
 	public function get_global_config($section = '') {
 		global $app;
-		
+
 		if(!isset($this->config['global'])) {
 			$app->uses('ini_parser');
 			$tmp = $app->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1');
@@ -54,6 +54,7 @@
 		}
 		return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
 	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/importer.inc.php b/interface/lib/classes/importer.inc.php
index e74c099..f6cbab5 100644
--- a/interface/lib/classes/importer.inc.php
+++ b/interface/lib/classes/importer.inc.php
@@ -30,56 +30,59 @@
 
 */
 
-require_once(realpath(dirname(__FILE__)) . '/remoting.inc.php');
+require_once realpath(dirname(__FILE__)) . '/remoting.inc.php';
 
 class fakeserver {
-    private $faultMessage;
-    private $faultText;
-    public function fault($message = '', $text = '') {
-        $this->faultMessage = $message;
-        $this->faultText = $text;
-    }
-    
-    public function getFault() {
-        $ret = $this->faultMessage . ' (' . $this->faultText . ')';
-        $this->faultMessage = null;
-        $this->faultText = null;
-        return $ret;
-    }
+	private $faultMessage;
+	private $faultText;
+	public function fault($message = '', $text = '') {
+		$this->faultMessage = $message;
+		$this->faultText = $text;
+	}
+
+	public function getFault() {
+		$ret = $this->faultMessage . ' (' . $this->faultText . ')';
+		$this->faultMessage = null;
+		$this->faultText = null;
+		return $ret;
+	}
+
 }
 
 class importer extends remoting {
 	public function __construct()
-    {
-        $this->server = new fakeserver();
-    }
+	{
+		$this->server = new fakeserver();
+	}
 
 	//* remote login function - overridden just to make sure it cannot be called from importer scripts
 	public function login($username, $password)
-    {
-		
+	{
+
 	}
-	
+
 	//* remote logout function - overridden just to make sure it cannot be called from importer scripts
 	public function logout($session_id)
-    {		
-		
+	{
+
 	}
-	
+
 	public function getFault() {
-        return $this->server->getFault();
-    }
-	
-	protected function checkPerm($session_id, $function_name)
-    {
-        // always return true as this is used from inside the application not through remote calls
-        return true;
+		return $this->server->getFault();
 	}
-	
-	
+
+	protected function checkPerm($session_id, $function_name)
+	{
+		// always return true as this is used from inside the application not through remote calls
+		return true;
+	}
+
+
 	protected function getSession($session_id)
-    {	
+	{
 		return array(); // we have no sessions here
 	}
+
 }
+
 ?>
diff --git a/interface/lib/classes/ini_parser.inc.php b/interface/lib/classes/ini_parser.inc.php
index 6303115..b8dffba 100644
--- a/interface/lib/classes/ini_parser.inc.php
+++ b/interface/lib/classes/ini_parser.inc.php
@@ -59,8 +59,8 @@
 			$content .= "[$section]\n";
 			foreach($data as $item => $value) {
 				if($item != ''){
-					$value 	= trim($value);
-					$item 	= trim($item);
+					$value  = trim($value);
+					$item  = trim($item);
 					$content .= "$item=$value\n";
 				}
 			}
diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php
index d49af96..dff71f3 100644
--- a/interface/lib/classes/ispcmail.inc.php
+++ b/interface/lib/classes/ispcmail.inc.php
@@ -30,498 +30,544 @@
 
 /**
  * email class
- * 
+ *
  * @package pxFramework
  *
  */
+
+
 class ispcmail {
-    
-    /**#@+
+
+	/**#@+
      * @access private
      */
-    private $html_part;
-    private $text_part;
-    
-    private $headers;
-    
-    private $_logged_in = false;
-    private $_smtp_conn = null;
-    
-    private $_crlf = "\n";
-    
-    private $attach_type = 'application/octet-stream';
-    private $attachments;
-    private $mime_boundary;
-    private $body = '';
-    private $_mail_sender = '';
-    private $_sent_mails = 0;
-    private $user_agent = 'ISPConfig/3 (Mailer Class)';
-    /**#@-*/
-    
-    /**
-     * set the mail charset
-     */
-    private $mail_charset  = 'UTF-8';//'ISO-8859-1';
-    
-    /**#@+
+	private $html_part;
+	private $text_part;
+
+	private $headers;
+
+	private $_logged_in = false;
+	private $_smtp_conn = null;
+
+	private $_crlf = "\n";
+
+	private $attach_type = 'application/octet-stream';
+	private $attachments;
+	private $mime_boundary;
+	private $body = '';
+	private $_mail_sender = '';
+	private $_sent_mails = 0;
+	private $user_agent = 'ISPConfig/3 (Mailer Class)';
+	/**#@-*/
+
+
+
+	/**
+	 * set the mail charset
+	 */
+	private $mail_charset  = 'UTF-8';//'ISO-8859-1';
+
+	/**#@+
      * Provide smtp credentials for smtp mail sending
      *
      * @access public
      */
-    /**
-     * if set to true smtp is used instead of mail() to send emails
-     * @see mail
-     */
-    private $use_smtp = false;
-    /**
-     * the smtp helo string - use the mail server name here!
-     */
-    private $smtp_helo = '';
-    /**
-     * the smtp server to send mails
-     */
-    private $smtp_host = '';
-    /**
-     * the smtp port
-     */
-    private $smtp_port = 25;
-    /**
-     * if the smtp server needs authentication you can set the smtp user here
-     */
-    private $smtp_user = '';
-    /**
-     * if the smtp server needs authentication you can set the smtp password here
-     */
-    private $smtp_pass = '';
-    /**
-     * If you want to use tls/ssl specify it here
-     */
-    private $smtp_crypt = ''; // tls or ssl
-    /**
-     * How many mails should be sent via one single smtp connection
-     */
-    private $smtp_max_mails = 20;
-    /**
-     * Should the mail be signed
-     */
-    private $sign_email = false;
-    /**
-     * The cert and key to use for email signing
-     */
-    private $sign_key = '';
-    private $sign_key_pass = '';
-    private $sign_cert = '';
-    private $sign_bundle = '';
-    private $_is_signed = false;
-    /**
-     * get disposition notification
-     */
-    private $notification = false;
-    /**#@-*/
-    
-    public function __construct($options = array()) {
-        $rand = md5(microtime());
-        $this->mime_boundary = '==Multipart_Boundary_x' . $rand . 'x';
-        
-        $this->headers = array();
-        $this->attachments = array();
-        
-        $this->headers['MIME-Version'] = '1.0';
-        $this->headers['User-Agent'] = $this->user_agent;
-        if(is_array($options) && count($options) > 0) $this->setOptions($options);
-    }
-    
-    public function __destruct() {
-        $this->finish();
-    }
-    
-    /**
-     * Set option
-     * 
-     * @param string $key the option to set
-     * @param string $value the option value to set
-     */
-    public function setOption($key, $value) {
-        switch($key) {
-            case 'smtp_helo':
-                $this->smtp_helo = $value;
-                break;
-            case 'smtp_host':
-                $this->smtp_host = $value;
-                break;
-            case 'smtp_server':
-                $this->smtp_host = $value;
-                break;
-            case 'smtp_port':
-                $this->smtp_port = $value;
-                break;
-            case 'smtp_user':
-                $this->smtp_user = $value;
-                break;
-            case 'smtp_pass':
-                $this->smtp_pass = $value;
-                break;
-            case 'smtp_max_mails':
-                $this->smtp_max_mails = intval($value);
-                if($this->smtp_max_mails < 1) $this->smtp_max_mails = 1;
-                break;
-            case 'use_smtp':
-                $this->use_smtp = ($value == true ? true : false);
-                if($value == true) $this->_crlf = "\r\n";
-                break;
-            case 'smtp_crypt':
-                if($value != 'ssl' && $value != 'tls') $value = '';
-                $this->smtp_crypt = $value;
-                break;
-            case 'sign_email':
-                $this->sign_email = ($value == true ? true : false);
-                break;
-            case 'sign_key':
-                $this->sign_key = $value;
-                break;
-            case 'sign_key_pass':
-                $this->sign_key_pass = $value;
-                break;
-            case 'sign_cert':
-                $this->sign_cert = $value;
-                break;
-            case 'sign_bundle':
-                $this->sign_bundle = $value;
-                break;
-            case 'mail_charset':
-                $this->mail_charset = $value;
-                break;
-            case 'notify':
-                $this->notification = ($value == true ? true : false);
-                break;
-        }
-    }
-    
-    /** Detect the helo string if none given
-     * 
-     */
-    private function detectHelo() {
-        if(isset($_SERVER['HTTP_HOST'])) $this->smtp_helo = $_SERVER['HTTP_HOST'];
-        elseif(isset($_SERVER['SERVER_NAME'])) $this->smtp_helo = $_SERVER['SERVER_NAME'];
-        else $this->smtp_helo = php_uname('n');
-        if($this->smtp_helo == '') $this->smtp_helo = 'localhost';
-    }
-    
-    /**
-     * Set options
-     * 
-     * @param array $options the options to set as an associative array key => value
-     */
-    public function setOptions($options) {
-        foreach($options as $key => $value) $this->setOption($key, $value);
-    }
-    
-    /**
-     * Read a file's contents
-     *
-     * Simply gets the file's content
-     *
-     * @access public
-     * @param string $filename name and path of file to read
-     * @return string file content (can be binary)
-     */
-    public function read_File($filename) {
-        $content = '';
-        
-        $fp = fopen($filename, 'r');
-        if(!$fp) return false;
-        
-        while(!feof($fp)) {
-            $content .= fread($fp, 1024);
-        }
-        fclose($fp);
-        
-        return $content;
-    }
-    
-    /**
-     * set smtp connection encryption
-     * 
-     * @access public
-     * @param string $mode encryption mode (tls, ssl or empty string)
-     */
-    public function setSMTPEncryption($mode = '') {
-        if($mode != 'ssl' && $mode != 'tls') $mode = '';
-        $this->smtp_crypt = $mode;
-    }
 
-    /**
-     * set a mail header
-     *
-     * Sets a single mail header to a given value
-     *
-     * @access public
-     * @param string $header header name to set
-     * @param string $value value to set in header field
-     */
-    public function setHeader($header, $value) {
-        if(strtolower($header) == 'bcc') $header = 'Bcc';
-        elseif(strtolower($header) == 'cc') $header = 'Cc';
-        elseif(strtolower($header) == 'from') $header = 'From';
-        $this->headers["$header"] = $value;
-    }
-    
-    /**
-     * get a mail header value
-     *
-     * Returns a value of a single mail header
-     *
-     * @access public
-     * @param string $header header name to get
-     * @return string header value
-     */
-    public function getHeader($header) {
-        if(strtolower($header) == 'bcc') $header = 'Bcc';
-        elseif(strtolower($header) == 'cc') $header = 'Cc';
-        elseif(strtolower($header) == 'from') $header = 'From';
-        return (isset($this->headers["$header"]) ? $this->headers["$header"] : '');
-    }
-    
-    /**
-     * Set email sender
-     *
-     * Sets the email sender and optionally the sender's name
-     *
-     * @access public
-     * @param string $email sender email address
-     * @param string $name sender name
-     */
-    public function setSender($email, $name = '') {
-        if($name) $header = '"' . $name . '" <' . $email . '>';
-        else $header = '<' . $email . '>';
-        
-        $this->_mail_sender = $email;
-        
-        $this->setHeader('From', $header);
-    }
-    
-    /**
-     * Set mail subject
-     *
-     * @access public
-     * @param string $subject the mail subject
-     * @return string where-string for db query
-     */
-    public function setSubject($subject) {
-        $this->setHeader('Subject', $subject);
-    }
-    
-    /**
-     * Get current mail subject
-     *
-     * @access public
-     * @return string mail subject
-     */
-    public function getSubject() {
-        return $this->headers['Subject'];
-    }
-    
-    /**
-     * Set mail content
-     *
-     * Sets the mail html and plain text content
-     *
-     * @access public
-     * @param string $text plain text mail content (can be empty)
-     * @param string $html html mail content
-     */
-    public function setMailText($text, $html = '') {
-        $this->text_part = $text;
-        $this->html_part = $html;
-    }
-    
-    /**
-     * Read and attach a file
-     *
-     * Reads a file and attaches it to the current email
-     *
-     * @access public
-     * @param string $filename the file to read and attach
-     * @param string $display_name the name that will be displayed in the mail
-     * @see read_File
-     */
-    public function readAttachFile($filename, $display_name = '') {
-        if($display_name == '') {
-            $path_parts = pathinfo($filename);
-            $display_name = $path_parts["basename"];
-            unset($path_parts);
-        }
-        $this->attachFile($this->read_File($filename), $display_name);
-    }
-    
-    /**
-     * Attach a file
-     *
-     * Attaches a string (can be binary) as a file to the mail
-     *
-     * @access public
-     * @param string $content attachment data string
-     * @param string $filename name for file attachment
-     */
-    public function attachFile($content, $filename) {
-        $attachment = array('content' => $content,
-                            'filename' => $filename,
-                            'type' => 'application/octet-stream',
-                            'encoding' => 'base64'
-                           );
-        $this->attachments[] = $attachment;
-    }
-    
-    /**
-     * @access private
-     */
-    private function create() {
-        $attach = false;
-        $html = false;
-        $text = false;
-        
-        if($this->html_part) $html = true;
-        if($this->text_part) $text = true;
-        if(count($this->attachments) > 0) $attach = true;
-        
-        $textonly = false;
-        $htmlonly = false;
-        if($text == true && $html == false && $attach == false) {
-            // only text
-            $content_type = 'text/plain; charset="' . strtolower($this->mail_charset) . '"';
-            $textonly = true;
-        } elseif($text == true && $html == false && $attach == true) {
-            // text and attachment
-            $content_type = 'multipart/mixed;';
-            $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
-        } elseif($html == true && $text == true && $attach == false) {
-            // html only (or text too)
-            $content_type = 'multipart/alternative;';
-            $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
-        } elseif($html == true && $text == false && $attach == false) {
-            // html only (or text too)
-            $content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"';
-            $htmlonly = true;
-        } elseif($html == true && $attach == true) {
-            // html and attachments
-            $content_type = 'multipart/mixed;';
-            $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
-        }
-        
-        $this->headers['Content-Type'] = $content_type;
-        
-        if($textonly == false && $htmlonly == false) {
-            $this->body = "This is a multi-part message in MIME format.\n\n";
-            
-            if($text) {
-                /*$this->body .= "--{$this->mime_boundary}\n" .
+	/**
+	 * if set to true smtp is used instead of mail() to send emails
+	 * @see mail
+	 */
+	private $use_smtp = false;
+
+	/**
+	 * the smtp helo string - use the mail server name here!
+	 */
+	private $smtp_helo = '';
+
+	/**
+	 * the smtp server to send mails
+	 */
+	private $smtp_host = '';
+
+	/**
+	 * the smtp port
+	 */
+	private $smtp_port = 25;
+
+	/**
+	 * if the smtp server needs authentication you can set the smtp user here
+	 */
+	private $smtp_user = '';
+
+	/**
+	 * if the smtp server needs authentication you can set the smtp password here
+	 */
+	private $smtp_pass = '';
+
+	/**
+	 * If you want to use tls/ssl specify it here
+	 */
+	private $smtp_crypt = ''; // tls or ssl
+	/**
+	 * How many mails should be sent via one single smtp connection
+	 */
+	private $smtp_max_mails = 20;
+
+	/**
+	 * Should the mail be signed
+	 */
+	private $sign_email = false;
+
+	/**
+	 * The cert and key to use for email signing
+	 */
+	private $sign_key = '';
+	private $sign_key_pass = '';
+	private $sign_cert = '';
+	private $sign_bundle = '';
+	private $_is_signed = false;
+
+	/**
+	 * get disposition notification
+	 */
+	private $notification = false;
+	/**#@-*/
+
+	public function __construct($options = array()) {
+		$rand = md5(microtime());
+		$this->mime_boundary = '==Multipart_Boundary_x' . $rand . 'x';
+
+		$this->headers = array();
+		$this->attachments = array();
+
+		$this->headers['MIME-Version'] = '1.0';
+		$this->headers['User-Agent'] = $this->user_agent;
+		if(is_array($options) && count($options) > 0) $this->setOptions($options);
+	}
+
+	public function __destruct() {
+		$this->finish();
+	}
+
+
+
+	/**
+	 * Set option
+	 *
+	 * @param string $key the option to set
+	 * @param string $value the option value to set
+	 */
+	public function setOption($key, $value) {
+		switch($key) {
+		case 'smtp_helo':
+			$this->smtp_helo = $value;
+			break;
+		case 'smtp_host':
+			$this->smtp_host = $value;
+			break;
+		case 'smtp_server':
+			$this->smtp_host = $value;
+			break;
+		case 'smtp_port':
+			$this->smtp_port = $value;
+			break;
+		case 'smtp_user':
+			$this->smtp_user = $value;
+			break;
+		case 'smtp_pass':
+			$this->smtp_pass = $value;
+			break;
+		case 'smtp_max_mails':
+			$this->smtp_max_mails = intval($value);
+			if($this->smtp_max_mails < 1) $this->smtp_max_mails = 1;
+			break;
+		case 'use_smtp':
+			$this->use_smtp = ($value == true ? true : false);
+			if($value == true) $this->_crlf = "\r\n";
+			break;
+		case 'smtp_crypt':
+			if($value != 'ssl' && $value != 'tls') $value = '';
+			$this->smtp_crypt = $value;
+			break;
+		case 'sign_email':
+			$this->sign_email = ($value == true ? true : false);
+			break;
+		case 'sign_key':
+			$this->sign_key = $value;
+			break;
+		case 'sign_key_pass':
+			$this->sign_key_pass = $value;
+			break;
+		case 'sign_cert':
+			$this->sign_cert = $value;
+			break;
+		case 'sign_bundle':
+			$this->sign_bundle = $value;
+			break;
+		case 'mail_charset':
+			$this->mail_charset = $value;
+			break;
+		case 'notify':
+			$this->notification = ($value == true ? true : false);
+			break;
+		}
+	}
+
+
+
+	/** Detect the helo string if none given
+	 *
+	 */
+	private function detectHelo() {
+		if(isset($_SERVER['HTTP_HOST'])) $this->smtp_helo = $_SERVER['HTTP_HOST'];
+		elseif(isset($_SERVER['SERVER_NAME'])) $this->smtp_helo = $_SERVER['SERVER_NAME'];
+		else $this->smtp_helo = php_uname('n');
+		if($this->smtp_helo == '') $this->smtp_helo = 'localhost';
+	}
+
+
+
+	/**
+	 * Set options
+	 *
+	 * @param array $options the options to set as an associative array key => value
+	 */
+	public function setOptions($options) {
+		foreach($options as $key => $value) $this->setOption($key, $value);
+	}
+
+
+
+	/**
+	 * Read a file's contents
+	 *
+	 * Simply gets the file's content
+	 *
+	 * @access public
+	 * @param string $filename name and path of file to read
+	 * @return string file content (can be binary)
+	 */
+	public function read_File($filename) {
+		$content = '';
+
+		$fp = fopen($filename, 'r');
+		if(!$fp) return false;
+
+		while(!feof($fp)) {
+			$content .= fread($fp, 1024);
+		}
+		fclose($fp);
+
+		return $content;
+	}
+
+
+
+	/**
+	 * set smtp connection encryption
+	 *
+	 * @access public
+	 * @param string $mode encryption mode (tls, ssl or empty string)
+	 */
+	public function setSMTPEncryption($mode = '') {
+		if($mode != 'ssl' && $mode != 'tls') $mode = '';
+		$this->smtp_crypt = $mode;
+	}
+
+	/**
+	 * set a mail header
+	 *
+	 * Sets a single mail header to a given value
+	 *
+	 * @access public
+	 * @param string $header header name to set
+	 * @param string $value value to set in header field
+	 */
+	public function setHeader($header, $value) {
+		if(strtolower($header) == 'bcc') $header = 'Bcc';
+		elseif(strtolower($header) == 'cc') $header = 'Cc';
+		elseif(strtolower($header) == 'from') $header = 'From';
+		$this->headers["$header"] = $value;
+	}
+
+
+
+	/**
+	 * get a mail header value
+	 *
+	 * Returns a value of a single mail header
+	 *
+	 * @access public
+	 * @param string $header header name to get
+	 * @return string header value
+	 */
+	public function getHeader($header) {
+		if(strtolower($header) == 'bcc') $header = 'Bcc';
+		elseif(strtolower($header) == 'cc') $header = 'Cc';
+		elseif(strtolower($header) == 'from') $header = 'From';
+		return isset($this->headers["$header"]) ? $this->headers["$header"] : '';
+	}
+
+
+
+	/**
+	 * Set email sender
+	 *
+	 * Sets the email sender and optionally the sender's name
+	 *
+	 * @access public
+	 * @param string $email sender email address
+	 * @param string $name sender name
+	 */
+	public function setSender($email, $name = '') {
+		if($name) $header = '"' . $name . '" <' . $email . '>';
+		else $header = '<' . $email . '>';
+
+		$this->_mail_sender = $email;
+
+		$this->setHeader('From', $header);
+	}
+
+
+
+	/**
+	 * Set mail subject
+	 *
+	 * @access public
+	 * @param string $subject the mail subject
+	 * @return string where-string for db query
+	 */
+	public function setSubject($subject) {
+		$this->setHeader('Subject', $subject);
+	}
+
+
+
+	/**
+	 * Get current mail subject
+	 *
+	 * @access public
+	 * @return string mail subject
+	 */
+	public function getSubject() {
+		return $this->headers['Subject'];
+	}
+
+
+
+	/**
+	 * Set mail content
+	 *
+	 * Sets the mail html and plain text content
+	 *
+	 * @access public
+	 * @param string $text plain text mail content (can be empty)
+	 * @param string $html html mail content
+	 */
+	public function setMailText($text, $html = '') {
+		$this->text_part = $text;
+		$this->html_part = $html;
+	}
+
+
+
+	/**
+	 * Read and attach a file
+	 *
+	 * Reads a file and attaches it to the current email
+	 *
+	 * @access public
+	 * @param string $filename the file to read and attach
+	 * @param string $display_name the name that will be displayed in the mail
+	 * @see read_File
+	 */
+	public function readAttachFile($filename, $display_name = '') {
+		if($display_name == '') {
+			$path_parts = pathinfo($filename);
+			$display_name = $path_parts["basename"];
+			unset($path_parts);
+		}
+		$this->attachFile($this->read_File($filename), $display_name);
+	}
+
+
+
+	/**
+	 * Attach a file
+	 *
+	 * Attaches a string (can be binary) as a file to the mail
+	 *
+	 * @access public
+	 * @param string $content attachment data string
+	 * @param string $filename name for file attachment
+	 */
+	public function attachFile($content, $filename) {
+		$attachment = array('content' => $content,
+			'filename' => $filename,
+			'type' => 'application/octet-stream',
+			'encoding' => 'base64'
+		);
+		$this->attachments[] = $attachment;
+	}
+
+
+
+	/**
+	 * @access private
+	 */
+	private function create() {
+		$attach = false;
+		$html = false;
+		$text = false;
+
+		if($this->html_part) $html = true;
+		if($this->text_part) $text = true;
+		if(count($this->attachments) > 0) $attach = true;
+
+		$textonly = false;
+		$htmlonly = false;
+		if($text == true && $html == false && $attach == false) {
+			// only text
+			$content_type = 'text/plain; charset="' . strtolower($this->mail_charset) . '"';
+			$textonly = true;
+		} elseif($text == true && $html == false && $attach == true) {
+			// text and attachment
+			$content_type = 'multipart/mixed;';
+			$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
+		} elseif($html == true && $text == true && $attach == false) {
+			// html only (or text too)
+			$content_type = 'multipart/alternative;';
+			$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
+		} elseif($html == true && $text == false && $attach == false) {
+			// html only (or text too)
+			$content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"';
+			$htmlonly = true;
+		} elseif($html == true && $attach == true) {
+			// html and attachments
+			$content_type = 'multipart/mixed;';
+			$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
+		}
+
+		$this->headers['Content-Type'] = $content_type;
+
+		if($textonly == false && $htmlonly == false) {
+			$this->body = "This is a multi-part message in MIME format.\n\n";
+
+			if($text) {
+				/*$this->body .= "--{$this->mime_boundary}\n" .
                               "Content-Type:text/plain; charset=\"" . strtolower($this->mail_charset) . "\"\n" .
                               "Content-Transfer-Encoding: 7bit\n\n" . $this->text_part . "\n\n";*/
 				$this->body .= "--{$this->mime_boundary}\n" .
-                              "Content-Type:text/plain; charset=\"UTF-8\"\n" .
-                              "Content-Transfer-Encoding: 8bit\n\n" . $this->text_part . "\n\n";
+					"Content-Type:text/plain; charset=\"UTF-8\"\n" .
+					"Content-Transfer-Encoding: 8bit\n\n" . $this->text_part . "\n\n";
 			}
-            
-            if($html) {
-                /*$this->body .= "--{$this->mime_boundary}\n" .
-                               "Content-Type:text/html; charset=\"" . strtolower($this->mail_charset) . "\"\n" . 
+
+			if($html) {
+				/*$this->body .= "--{$this->mime_boundary}\n" .
+                               "Content-Type:text/html; charset=\"" . strtolower($this->mail_charset) . "\"\n" .
                                "Content-Transfer-Encoding: 7bit\n\n" . $this->html_part . "\n\n";*/
 				$this->body .= "--{$this->mime_boundary}\n" .
-                              "Content-Type:text/html; charset=\"UTF-8\"\n" .
-                              "Content-Transfer-Encoding: 8bit\n\n" . $this->html_part . "\n\n";
+					"Content-Type:text/html; charset=\"UTF-8\"\n" .
+					"Content-Transfer-Encoding: 8bit\n\n" . $this->html_part . "\n\n";
 			}
-            
-            if($attach) {
-                foreach($this->attachments as $att) {
-                    $this->body .= "--{$this->mime_boundary}\n" .
-                                   "Content-Type: " . $att['type'] . ";\n" .
-                                   " name=\"" . $att['filename'] . "\"\n" .
-                                   "Content-Transfer-Encoding: base64\n" . 
-                                   "Content-Disposition: attachment;\n\n" .
-                                   chunk_split(base64_encode($att['content'])) . "\n\n";
-                }
-            }
-            $this->body .= "--{$this->mime_boundary}--\n";
-        } elseif($htmlonly == true) {
-            $this->body = $this->html_part;
-        } else {
-            $this->body = $this->text_part;
-        }
-        
-        if (isset($this->body)) {
-            // Add message ID header
-            $message_id = sprintf('<%s.%s@%s>', base_convert(time(), 10, 36), base_convert(rand(), 10, 36), $this->smtp_helo != '' ? $this->smtp_helo : $this->detectHelo());
-            $this->headers['Message-ID'] = $message_id;
-            return true;
-        } else {
-            return false;
-        }
-    }
-    
-    /**
-     * Function to sign an email body
-     */
-    private function sign() {
-        if($this->sign_email == false || $this->sign_key == '' || $this->sign_cert == '') return false;
-        if(function_exists('openssl_pkcs7_sign') == false) return false;
-        
-        $tmpin = tempnam(sys_get_temp_dir(), 'sign');
-        $tmpout = tempnam(sys_get_temp_dir(), 'sign');
-        if(!file_exists($tmpin) || !is_writable($tmpin)) return false;
-        
-        file_put_contents($tmpin, 'Content-Type: ' . $this->getHeader('Content-Type') . "\n\n" . $this->body);
-        $tmpf_key = tempnam(sys_get_temp_dir(), 'sign');
-        file_put_contents($tmpf_key, $this->sign_key);
-        $tmpf_cert = tempnam(sys_get_temp_dir(), 'sign');
-        file_put_contents($tmpf_cert, $this->sign_cert);
-        if($this->sign_bundle != '')  {
-            $tmpf_bundle = tempnam(sys_get_temp_dir(), 'sign');
-            file_put_contents($tmpf_bundle, $this->sign_bundle);
-            openssl_pkcs7_sign($tmpin, $tmpout, 'file://' . realpath($tmpf_cert), array('file://' . realpath($tmpf_key), $this->sign_key_pass), array(), PKCS7_DETACHED, realpath($tmpf_bundle));
-        } else {
-            openssl_pkcs7_sign($tmpin, $tmpout, 'file://' . realpath($tmpf_cert), array('file://' . realpath($tmpf_key), $this->sign_key_pass), array());
-        }
-        unlink($tmpin);
-        unlink($tmpf_cert);
-        unlink($tmpf_key);
-        if(file_exists($tmpf_bundle)) unlink($tmpf_bundle);
-        
-        if(!file_exists($tmpout) || !is_readable($tmpout)) return false;
-        $this->body = file_get_contents($tmpout);
-        unlink($tmpout);
-        
-        unset($this->headers['Content-Type']);
-        unset($this->headers['MIME-Version']);
-        
-        $this->_is_signed = true;
-    }
-    
-    private function _char_to_hex($matches) {
-        return '=' . strtoupper(dechex(ord($matches[1])));
-    }
-    
-    /**
-    * Function to encode a header if necessary
-    * according to RFC2047
-    * @access private
-    */
-    private function _encodeHeader($input, $charset = 'ISO-8859-1') {
+
+			if($attach) {
+				foreach($this->attachments as $att) {
+					$this->body .= "--{$this->mime_boundary}\n" .
+						"Content-Type: " . $att['type'] . ";\n" .
+						" name=\"" . $att['filename'] . "\"\n" .
+						"Content-Transfer-Encoding: base64\n" .
+						"Content-Disposition: attachment;\n\n" .
+						chunk_split(base64_encode($att['content'])) . "\n\n";
+				}
+			}
+			$this->body .= "--{$this->mime_boundary}--\n";
+		} elseif($htmlonly == true) {
+			$this->body = $this->html_part;
+		} else {
+			$this->body = $this->text_part;
+		}
+
+		if (isset($this->body)) {
+			// Add message ID header
+			$message_id = sprintf('<%s.%s@%s>', base_convert(time(), 10, 36), base_convert(rand(), 10, 36), $this->smtp_helo != '' ? $this->smtp_helo : $this->detectHelo());
+			$this->headers['Message-ID'] = $message_id;
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Function to sign an email body
+	 */
+	private function sign() {
+		if($this->sign_email == false || $this->sign_key == '' || $this->sign_cert == '') return false;
+		if(function_exists('openssl_pkcs7_sign') == false) return false;
+
+		$tmpin = tempnam(sys_get_temp_dir(), 'sign');
+		$tmpout = tempnam(sys_get_temp_dir(), 'sign');
+		if(!file_exists($tmpin) || !is_writable($tmpin)) return false;
+
+		file_put_contents($tmpin, 'Content-Type: ' . $this->getHeader('Content-Type') . "\n\n" . $this->body);
+		$tmpf_key = tempnam(sys_get_temp_dir(), 'sign');
+		file_put_contents($tmpf_key, $this->sign_key);
+		$tmpf_cert = tempnam(sys_get_temp_dir(), 'sign');
+		file_put_contents($tmpf_cert, $this->sign_cert);
+		if($this->sign_bundle != '')  {
+			$tmpf_bundle = tempnam(sys_get_temp_dir(), 'sign');
+			file_put_contents($tmpf_bundle, $this->sign_bundle);
+			openssl_pkcs7_sign($tmpin, $tmpout, 'file://' . realpath($tmpf_cert), array('file://' . realpath($tmpf_key), $this->sign_key_pass), array(), PKCS7_DETACHED, realpath($tmpf_bundle));
+		} else {
+			openssl_pkcs7_sign($tmpin, $tmpout, 'file://' . realpath($tmpf_cert), array('file://' . realpath($tmpf_key), $this->sign_key_pass), array());
+		}
+		unlink($tmpin);
+		unlink($tmpf_cert);
+		unlink($tmpf_key);
+		if(file_exists($tmpf_bundle)) unlink($tmpf_bundle);
+
+		if(!file_exists($tmpout) || !is_readable($tmpout)) return false;
+		$this->body = file_get_contents($tmpout);
+		unlink($tmpout);
+
+		unset($this->headers['Content-Type']);
+		unset($this->headers['MIME-Version']);
+
+		$this->_is_signed = true;
+	}
+
+	private function _char_to_hex($matches) {
+		return '=' . strtoupper(dechex(ord($matches[1])));
+	}
+
+
+
+	/**
+	 * Function to encode a header if necessary
+	 * according to RFC2047
+	 * @access private
+	 */
+	private function _encodeHeader($input, $charset = 'ISO-8859-1') {
 		preg_match_all('/(\s?\w*[\x80-\xFF]+\w*\s?)/', $input, $matches);
 		foreach ($matches[1] as $value) {
 			$replacement = preg_replace_callback('/([\x20\x80-\xFF])/', array($this, '_char_to_hex'), $value);
 			$input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input);
 		}
-        
-        return $input;
-    }
-	
+
+		return $input;
+	}
+
+
+
 	/**
-    * Function to encode the subject if necessary
-    * according to RFC2047
-    * @access private
-    */
-    private function _encodeSubject($input, $charset = 'ISO-8859-1') {
-        /*
+	 * Function to encode the subject if necessary
+	 * according to RFC2047
+	 * @access private
+	 */
+	private function _encodeSubject($input, $charset = 'ISO-8859-1') {
+		/*
 		if($charset == 'UTF-8' && function_exists('imap_8bit')) {
 			$input = "=?utf-8?Q?" . imap_8bit($input) . "?=";
 		} else {
@@ -532,204 +578,213 @@
 			}
 		}*/
 		$input='=?UTF-8?B?'.base64_encode($input).'?=';
-        
-        return $input;
-    }
-    
-    /**
-     * @access private
-     */
-    private function _smtp_login() {
-        $this->_smtp_conn = fsockopen(($this->smtp_crypt == 'ssl' ? 'ssl://' : '') . $this->smtp_host, $this->smtp_port, $errno, $errstr, 30);
-        $response = fgets($this->_smtp_conn, 515);
-        if(empty($this->_smtp_conn)) return false;
-        
-        // ENCRYPTED?
-        if($this->smtp_crypt == 'tls') {
-            fputs($this->_smtp_conn, 'STARTTLS' . $this->_crlf);
-            fgets($this->_smtp_conn, 515);
-            stream_socket_enable_crypto($this->_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
-        }
-        
-        //Say Hello to SMTP
-        if($this->smtp_helo == '') $this->detectHelo();
-        fputs($this->_smtp_conn, 'HELO ' . $this->smtp_helo . $this->_crlf);
-        $response = fgets($this->_smtp_conn, 515);
-        
-        //AUTH LOGIN
-        fputs($this->_smtp_conn, 'AUTH LOGIN' . $this->_crlf);
-        $response = fgets($this->_smtp_conn, 515);
-        
-        //Send username
-        fputs($this->_smtp_conn, base64_encode($this->smtp_user) . $this->_crlf);
-        $response = fgets($this->_smtp_conn, 515);
-        
-        //Send password
-        fputs($this->_smtp_conn, base64_encode($this->smtp_pass) . $this->_crlf);
-        $response = fgets($this->_smtp_conn, 515);
-        
-        $this->_logged_in = true;
-        return true;
-    }
-    
-    /**
-     * @access private
-     */
-    private function _smtp_close() {
-        $this->_logged_in = false;
-        
-        if(empty($this->_smtp_conn)) {
-            return false;
-        }
-        
-        fputs($this->_smtp_conn, 'QUIT' . $this->_crlf);
-        $response = @fgets($this->_smtp_conn, 515);
-        return true;
-    }
-    
-    /**
-     * Send the mail to one or more recipients
-     *
-     * The recipients can be either a string (1 recipient email without name) or an associative array of recipients with names as keys and email addresses as values.
-     *
-     * @access public
-     * @param mixed $recipients one email address or array of recipients with names as keys and email addresses as values
-     */
-    public function send($recipients) {
-        if(!is_array($recipients)) $recipients = array($recipients);
-        
-        if($this->use_smtp == true) $this->_crlf = "\r\n";
-        else $this->_crlf = "\n";
-        
-        $this->create();
-        if($this->sign_email == true) $this->sign();
-        
-        $subject = '';
-        if (!empty($this->headers['Subject'])) {
-            //$subject = $this->_encodeHeader($this->headers['Subject'], $this->mail_charset);
-            $subject = $this->headers['Subject'];
-            
-            //$enc_subject = $this->_encodeHeader($subject, $this->mail_charset);
-			$enc_subject = $this->_encodeSubject($subject, $this->mail_charset);
-            unset($this->headers['Subject']);
-        }
-        
-        if($this->notification == true) $this->setHeader('Disposition-Notification-To', $this->getHeader('From'));
-        
-        unset($this->headers['To']); // always reset the To header to prevent from sending to multiple users at once
-        $this->headers['Date'] = date('r'); //date('D, d M Y H:i:s O');
 
-        // Get flat representation of headers
-        foreach ($this->headers as $name => $value) {
-            if(strtolower($name) == 'to' || strtolower($name) == 'cc' || strtolower($name) == 'bcc') continue; // never add the To header
-            $headers[] = $name . ': ' . $this->_encodeHeader($value, $this->mail_charset);
-        }
-        
-        if($this->use_smtp == true) {
-            if(!$this->_logged_in || !$this->_smtp_conn) {
-                $result = $this->_smtp_login();
-                if(!$result) return false;
-            }
-            foreach($recipients as $recipname => $recip) {
-                if($this->_sent_mails >= $this->smtp_max_mails) {
-                    // close connection to smtp and reconnect
-                    $this->_sent_mails = 0;
-                    $this->_smtp_close();
-                    $result = $this->_smtp_login();
-                    if(!$result) return false;
-                }
-                $this->_sent_mails += 1;
-                
-                $recipname = trim(str_replace('"', '', $recipname));
-                $recip = $this->_encodeHeader($recip, $this->mail_charset);
-                $recipname = $this->_encodeHeader($recipname, $this->mail_charset);
-                
-                //Email From
-                fputs($this->_smtp_conn, 'MAIL FROM: ' . $this->_mail_sender . $this->_crlf);
-                $response = fgets($this->_smtp_conn, 515);
-                
-                //Email To
-                fputs($this->_smtp_conn, 'RCPT TO: ' . $recip . $this->_crlf);
-                $response = fgets($this->_smtp_conn, 515);
-                
-                //The Email
-                fputs($this->_smtp_conn, 'DATA' . $this->_crlf);
-                $response = fgets($this->_smtp_conn, 515);
-                
-                //Construct Headers
-                if($recipname && !is_numeric($recipname)) $this->setHeader('To', $recipname . ' <' . $recip . '>');
-                else $this->setHeader('To', $recip);
-                
-                $mail_content = 'Subject: ' . $enc_subject . $this->_crlf;
-                $mail_content .= 'To: ' . $this->getHeader('To') . $this->_crlf;
-                if($this->getHeader('Bcc') != '') $mail_content .= 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset) . $this->_crlf;
-                if($this->getHeader('Cc') != '') $mail_content .= 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset) . $this->_crlf;
-                $mail_content .= implode($this->_crlf, $headers) . $this->_crlf . ($this->_is_signed == false ? $this->_crlf : '') . $this->body;
-                
-                fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf);
-                $response = fgets($this->_smtp_conn, 515);
-                
-                // hopefully message was correctly sent now
-                $result = true;
-            }
-        } else {
-            if($this->getHeader('Bcc') != '') $headers[] = 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset);
-            if($this->getHeader('Cc') != '') $headers[] = 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset);
-            $rec_string = '';
-            foreach($recipients as $recipname => $recip) {
-                $recipname = trim(str_replace('"', '', $recipname));
-                
-                if($rec_string != '') $rec_string .= ', ';
-                if($recipname && !is_numeric($recipname)) $rec_string .= $recipname . '<' . $recip . '>';
-                else $rec_string .= $recip;
-            }
-            $to = $this->_encodeHeader($rec_string, $this->mail_charset);
-            //$result = mail($to, $subject, $this->body, implode($this->_crlf, $headers));
+		return $input;
+	}
+
+
+
+	/**
+	 * @access private
+	 */
+	private function _smtp_login() {
+		$this->_smtp_conn = fsockopen(($this->smtp_crypt == 'ssl' ? 'ssl://' : '') . $this->smtp_host, $this->smtp_port, $errno, $errstr, 30);
+		$response = fgets($this->_smtp_conn, 515);
+		if(empty($this->_smtp_conn)) return false;
+
+		// ENCRYPTED?
+		if($this->smtp_crypt == 'tls') {
+			fputs($this->_smtp_conn, 'STARTTLS' . $this->_crlf);
+			fgets($this->_smtp_conn, 515);
+			stream_socket_enable_crypto($this->_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
+		}
+
+		//Say Hello to SMTP
+		if($this->smtp_helo == '') $this->detectHelo();
+		fputs($this->_smtp_conn, 'HELO ' . $this->smtp_helo . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
+		//AUTH LOGIN
+		fputs($this->_smtp_conn, 'AUTH LOGIN' . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
+		//Send username
+		fputs($this->_smtp_conn, base64_encode($this->smtp_user) . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
+		//Send password
+		fputs($this->_smtp_conn, base64_encode($this->smtp_pass) . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
+		$this->_logged_in = true;
+		return true;
+	}
+
+
+
+	/**
+	 * @access private
+	 */
+	private function _smtp_close() {
+		$this->_logged_in = false;
+
+		if(empty($this->_smtp_conn)) {
+			return false;
+		}
+
+		fputs($this->_smtp_conn, 'QUIT' . $this->_crlf);
+		$response = @fgets($this->_smtp_conn, 515);
+		return true;
+	}
+
+
+
+	/**
+	 * Send the mail to one or more recipients
+	 *
+	 * The recipients can be either a string (1 recipient email without name) or an associative array of recipients with names as keys and email addresses as values.
+	 *
+	 * @access public
+	 * @param mixed $recipients one email address or array of recipients with names as keys and email addresses as values
+	 */
+	public function send($recipients) {
+		if(!is_array($recipients)) $recipients = array($recipients);
+
+		if($this->use_smtp == true) $this->_crlf = "\r\n";
+		else $this->_crlf = "\n";
+
+		$this->create();
+		if($this->sign_email == true) $this->sign();
+
+		$subject = '';
+		if (!empty($this->headers['Subject'])) {
+			//$subject = $this->_encodeHeader($this->headers['Subject'], $this->mail_charset);
+			$subject = $this->headers['Subject'];
+
+			//$enc_subject = $this->_encodeHeader($subject, $this->mail_charset);
+			$enc_subject = $this->_encodeSubject($subject, $this->mail_charset);
+			unset($this->headers['Subject']);
+		}
+
+		if($this->notification == true) $this->setHeader('Disposition-Notification-To', $this->getHeader('From'));
+
+		unset($this->headers['To']); // always reset the To header to prevent from sending to multiple users at once
+		$this->headers['Date'] = date('r'); //date('D, d M Y H:i:s O');
+
+		// Get flat representation of headers
+		foreach ($this->headers as $name => $value) {
+			if(strtolower($name) == 'to' || strtolower($name) == 'cc' || strtolower($name) == 'bcc') continue; // never add the To header
+			$headers[] = $name . ': ' . $this->_encodeHeader($value, $this->mail_charset);
+		}
+
+		if($this->use_smtp == true) {
+			if(!$this->_logged_in || !$this->_smtp_conn) {
+				$result = $this->_smtp_login();
+				if(!$result) return false;
+			}
+			foreach($recipients as $recipname => $recip) {
+				if($this->_sent_mails >= $this->smtp_max_mails) {
+					// close connection to smtp and reconnect
+					$this->_sent_mails = 0;
+					$this->_smtp_close();
+					$result = $this->_smtp_login();
+					if(!$result) return false;
+				}
+				$this->_sent_mails += 1;
+
+				$recipname = trim(str_replace('"', '', $recipname));
+				$recip = $this->_encodeHeader($recip, $this->mail_charset);
+				$recipname = $this->_encodeHeader($recipname, $this->mail_charset);
+
+				//Email From
+				fputs($this->_smtp_conn, 'MAIL FROM: ' . $this->_mail_sender . $this->_crlf);
+				$response = fgets($this->_smtp_conn, 515);
+
+				//Email To
+				fputs($this->_smtp_conn, 'RCPT TO: ' . $recip . $this->_crlf);
+				$response = fgets($this->_smtp_conn, 515);
+
+				//The Email
+				fputs($this->_smtp_conn, 'DATA' . $this->_crlf);
+				$response = fgets($this->_smtp_conn, 515);
+
+				//Construct Headers
+				if($recipname && !is_numeric($recipname)) $this->setHeader('To', $recipname . ' <' . $recip . '>');
+				else $this->setHeader('To', $recip);
+
+				$mail_content = 'Subject: ' . $enc_subject . $this->_crlf;
+				$mail_content .= 'To: ' . $this->getHeader('To') . $this->_crlf;
+				if($this->getHeader('Bcc') != '') $mail_content .= 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset) . $this->_crlf;
+				if($this->getHeader('Cc') != '') $mail_content .= 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset) . $this->_crlf;
+				$mail_content .= implode($this->_crlf, $headers) . $this->_crlf . ($this->_is_signed == false ? $this->_crlf : '') . $this->body;
+
+				fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf);
+				$response = fgets($this->_smtp_conn, 515);
+
+				// hopefully message was correctly sent now
+				$result = true;
+			}
+		} else {
+			if($this->getHeader('Bcc') != '') $headers[] = 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset);
+			if($this->getHeader('Cc') != '') $headers[] = 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset);
+			$rec_string = '';
+			foreach($recipients as $recipname => $recip) {
+				$recipname = trim(str_replace('"', '', $recipname));
+
+				if($rec_string != '') $rec_string .= ', ';
+				if($recipname && !is_numeric($recipname)) $rec_string .= $recipname . '<' . $recip . '>';
+				else $rec_string .= $recip;
+			}
+			$to = $this->_encodeHeader($rec_string, $this->mail_charset);
+			//$result = mail($to, $subject, $this->body, implode($this->_crlf, $headers));
 			$result = mail($to, $enc_subject, $this->body, implode($this->_crlf, $headers));
-        }
-        
-        // Reset the subject in case mail is resent
-        if ($subject !== '') {
-            $this->headers['Subject'] = $subject;
-        }
-        
-        // Return
-        return $result;
-    }
-    
-    /**
-     * Close mail connections
-     *
-     * This closes an open smtp connection so you should always call this function in your script if you have finished sending all emails
-     *
-     * @access public
-     */
-    public function finish() {
-        if($this->use_smtp == true) $this->_smtp_close();
-        
-        $rand = md5(microtime());
-        $this->mime_boundary = '==Multipart_Boundary_x' . $rand . 'x';
-        
-        $this->headers = array();
-        $this->attachments = array();
-        $this->text_part = '';
-        $this->html_part = '';
-        
-        $this->headers['MIME-Version'] = '1.0';
-        $this->headers['User-Agent'] = $this->user_agent;
-        
-        $this->smtp_helo = '';
-        $this->smtp_host = '';
-        $this->smtp_port = '';
-        $this->smtp_user = '';
-        $this->smtp_pass = '';
-        $this->use_smtp = false;
-        $this->smtp_crypt = false;
-        $this->mail_charset = 'UTF-8';
-        $this->_sent_mails = 0;
-        
-        return;
-    }
+		}
+
+		// Reset the subject in case mail is resent
+		if ($subject !== '') {
+			$this->headers['Subject'] = $subject;
+		}
+
+		// Return
+		return $result;
+	}
+
+
+
+	/**
+	 * Close mail connections
+	 *
+	 * This closes an open smtp connection so you should always call this function in your script if you have finished sending all emails
+	 *
+	 * @access public
+	 */
+	public function finish() {
+		if($this->use_smtp == true) $this->_smtp_close();
+
+		$rand = md5(microtime());
+		$this->mime_boundary = '==Multipart_Boundary_x' . $rand . 'x';
+
+		$this->headers = array();
+		$this->attachments = array();
+		$this->text_part = '';
+		$this->html_part = '';
+
+		$this->headers['MIME-Version'] = '1.0';
+		$this->headers['User-Agent'] = $this->user_agent;
+
+		$this->smtp_helo = '';
+		$this->smtp_host = '';
+		$this->smtp_port = '';
+		$this->smtp_user = '';
+		$this->smtp_pass = '';
+		$this->use_smtp = false;
+		$this->smtp_crypt = false;
+		$this->mail_charset = 'UTF-8';
+		$this->_sent_mails = 0;
+
+		return;
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index cf8f641..14c1a13 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -30,158 +30,160 @@
 
 class listform {
 
-    private $debug = 0;
-    private $errorMessage;
-    public  $listDef;
-    public  $searchValues;
-    public  $pagingHTML;
-    private $pagingValues;
-    private $searchChanged = 0;
-    private $module;
+	private $debug = 0;
+	private $errorMessage;
+	public  $listDef;
+	public  $searchValues;
+	public  $pagingHTML;
+	private $pagingValues;
+	private $searchChanged = 0;
+	private $module;
 	public $wordbook;
 
-    public function loadListDef($file, $module = '')
-    {
-        global $app,$conf;
-        if(!is_file($file)){
-            die("List-Definition: $file not found.");
-        }
-        require_once($file);
-        $this->listDef = $liste;
-        $this->module = $module;
-		
-		//* Fill datasources
-        if(@is_array($this->listDef['item'])) {
-		    foreach($this->listDef['item'] as $key => $field) {
-			    if(@is_array($field['datasource'])) {
-                    $this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
-                }
-		    }
+	public function loadListDef($file, $module = '')
+	{
+		global $app, $conf;
+		if(!is_file($file)){
+			die("List-Definition: $file not found.");
 		}
-        
+		require_once $file;
+		$this->listDef = $liste;
+		$this->module = $module;
+
+		//* Fill datasources
+		if(@is_array($this->listDef['item'])) {
+			foreach($this->listDef['item'] as $key => $field) {
+				if(@is_array($field['datasource'])) {
+					$this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
+				}
+			}
+		}
+
 		//* Set local Language File
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_'.$this->listDef['name'].'_list.lng';
 		if(!file_exists($lng_file)) $lng_file = 'lib/lang/en_'.$this->listDef['name'].'_list.lng';
-		include($lng_file);
-		
+		include $lng_file;
+
 		$this->wordbook = $wb;
-		
-        return true;
-    }
-		
+
+		return true;
+	}
+
 	/**
-    * Get the key => value array of a form filed from a datasource definitiom
-    *
-    * @param field = array with field definition
-    * @param record = Dataset as array
-    * @return array key => value array for the value field of a form
-    */
-    private function getDatasourceData($field)
-    {
-        global $app;
-        $values = array();
+	 * Get the key => value array of a form filed from a datasource definitiom
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return array key => value array for the value field of a form
+	 */
 
-        if($field['datasource']['type'] == 'SQL') {
 
-            //** Preparing SQL string. We will replace some common placeholders
-            $querystring = $field['datasource']['querystring'];
-            $querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
-            $querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
-            $querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
-            //TODO:
-            //$table_idx = $this->formDef['db_table_idx'];
-            //$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
+	private function getDatasourceData($field)
+	{
+		global $app;
+		$values = array();
+
+		if($field['datasource']['type'] == 'SQL') {
+
+			//** Preparing SQL string. We will replace some common placeholders
+			$querystring = $field['datasource']['querystring'];
+			$querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
+			$querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
+			$querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
+			//TODO:
+			//$table_idx = $this->formDef['db_table_idx'];
+			//$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
 			$app->uses('tform');
-            $querystring = str_replace("{AUTHSQL}",$app->tform->getAuthSQL('r'),$querystring);
-            $querystring = str_replace("{AUTHSQL-A}",$app->tform->getAuthSQL('r','a'),$querystring);
-            $querystring = str_replace("{AUTHSQL-B}",$app->tform->getAuthSQL('r','b'),$querystring);
+			$querystring = str_replace("{AUTHSQL}", $app->tform->getAuthSQL('r'), $querystring);
+			$querystring = str_replace("{AUTHSQL-A}", $app->tform->getAuthSQL('r', 'a'), $querystring);
+			$querystring = str_replace("{AUTHSQL-B}", $app->tform->getAuthSQL('r', 'b'), $querystring);
 
-            //* Getting the records
-            $tmp_records = $app->db->queryAllRecords($querystring);
-            if($app->db->errorMessage != '') die($app->db->errorMessage);
-            if(is_array($tmp_records)) {
-                $key_field = $field['datasource']['keyfield'];
-                $value_field = $field['datasource']['valuefield'];
-                foreach($tmp_records as $tmp_rec) {
-                    $tmp_id = $tmp_rec[$key_field];
-                    $values[$tmp_id] = $tmp_rec[$value_field];
-                }
-            }
-        }
+			//* Getting the records
+			$tmp_records = $app->db->queryAllRecords($querystring);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+			if(is_array($tmp_records)) {
+				$key_field = $field['datasource']['keyfield'];
+				$value_field = $field['datasource']['valuefield'];
+				foreach($tmp_records as $tmp_rec) {
+					$tmp_id = $tmp_rec[$key_field];
+					$values[$tmp_id] = $tmp_rec[$value_field];
+				}
+			}
+		}
 
-        if($field['datasource']['type'] == 'CUSTOM') {
-            //* Calls a custom class to validate this record
-            if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
-                $datasource_class = $field['datasource']['class'];
-                $datasource_function = $field['datasource']['function'];
-                $app->uses($datasource_class);
+		if($field['datasource']['type'] == 'CUSTOM') {
+			//* Calls a custom class to validate this record
+			if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
+				$datasource_class = $field['datasource']['class'];
+				$datasource_function = $field['datasource']['function'];
+				$app->uses($datasource_class);
 				$record = array();
-                $values = $app->$datasource_class->$datasource_function($field, $record);
-            } else {
-                $this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
-            }
-        }
-        return $values;
-    }
+				$values = $app->$datasource_class->$datasource_function($field, $record);
+			} else {
+				$this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
+			}
+		}
+		return $values;
+	}
 
-    public function getSearchSQL($sql_where = '') 
-    {
-        global $app, $db;
+	public function getSearchSQL($sql_where = '')
+	{
+		global $app, $db;
 
-        //* Get config variable
-        $list_name = $this->listDef['name'];
-        $search_prefix = $this->listDef['search_prefix'];
-		
+		//* Get config variable
+		$list_name = $this->listDef['name'];
+		$search_prefix = $this->listDef['search_prefix'];
+
 		if(isset($_REQUEST['Filter']) && !isset($_SESSION['search'][$list_name])) {
 			//* Jump back to page 1 of the list when a new search gets started.
 			$_SESSION['search'][$list_name]['page'] = 0;
 		}
 
-        //* store retrieval query
-        if(@is_array($this->listDef['item'])) { 
-            foreach($this->listDef['item'] as $i) {
-                $field = $i['field'];
+		//* store retrieval query
+		if(@is_array($this->listDef['item'])) {
+			foreach($this->listDef['item'] as $i) {
+				$field = $i['field'];
 
-                //* The search string has been changed
-                if(isset($_REQUEST[$search_prefix.$field]) && isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_REQUEST[$search_prefix.$field] != $_SESSION['search'][$list_name][$search_prefix.$field]){
-                        $this->searchChanged = 1;
-					    
-					    //* Jump back to page 1 of the list when search has changed.
-					    $_SESSION['search'][$list_name]['page'] = 0;
-                }
+				//* The search string has been changed
+				if(isset($_REQUEST[$search_prefix.$field]) && isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_REQUEST[$search_prefix.$field] != $_SESSION['search'][$list_name][$search_prefix.$field]){
+					$this->searchChanged = 1;
 
-                //* Store field in session
-                if(isset($_REQUEST[$search_prefix.$field]) && !stristr($_REQUEST[$search_prefix.$field],"'")){
-                    $_SESSION['search'][$list_name][$search_prefix.$field] = $_REQUEST[$search_prefix.$field];
+					//* Jump back to page 1 of the list when search has changed.
+					$_SESSION['search'][$list_name]['page'] = 0;
+				}
+
+				//* Store field in session
+				if(isset($_REQUEST[$search_prefix.$field]) && !stristr($_REQUEST[$search_prefix.$field], "'")){
+					$_SESSION['search'][$list_name][$search_prefix.$field] = $_REQUEST[$search_prefix.$field];
 					if(preg_match("/['\\\\]/", $_SESSION['search'][$list_name][$search_prefix.$field])) $_SESSION['search'][$list_name][$search_prefix.$field] = '';
 				}
 
-                if(isset($i['formtype']) && $i['formtype'] == 'SELECT'){
-                    if(is_array($i['value'])) {
-                        $out = '<option value=""></option>';
-                        foreach($i['value'] as $k => $v) {
-                            // TODO: this could be more elegant
-                            $selected = (isset($_SESSION['search'][$list_name][$search_prefix.$field]) 
-                                            && $k == $_SESSION['search'][$list_name][$search_prefix.$field] 
-                                            && $_SESSION['search'][$list_name][$search_prefix.$field] != '')
-                                            ? ' SELECTED' : '';
-                            $out .= "<option value='$k'$selected>$v</option>\r\n";
-                        }
-                    }
-                        $this->searchValues[$search_prefix.$field] = $out;
-                } else {
-                    if(isset($_SESSION['search'][$list_name][$search_prefix.$field])){
-                        $this->searchValues[$search_prefix.$field] = htmlspecialchars($_SESSION['search'][$list_name][$search_prefix.$field]);
-                    }
-                }
-            }
-        }
-        //* Store variables in object | $this->searchValues = $_SESSION["search"][$list_name];
-        if(@is_array($this->listDef['item'])) { 
-            foreach($this->listDef['item'] as $i) {
-                $field = $i['field'];
+				if(isset($i['formtype']) && $i['formtype'] == 'SELECT'){
+					if(is_array($i['value'])) {
+						$out = '<option value=""></option>';
+						foreach($i['value'] as $k => $v) {
+							// TODO: this could be more elegant
+							$selected = (isset($_SESSION['search'][$list_name][$search_prefix.$field])
+								&& $k == $_SESSION['search'][$list_name][$search_prefix.$field]
+								&& $_SESSION['search'][$list_name][$search_prefix.$field] != '')
+								? ' SELECTED' : '';
+							$out .= "<option value='$k'$selected>$v</option>\r\n";
+						}
+					}
+					$this->searchValues[$search_prefix.$field] = $out;
+				} else {
+					if(isset($_SESSION['search'][$list_name][$search_prefix.$field])){
+						$this->searchValues[$search_prefix.$field] = htmlspecialchars($_SESSION['search'][$list_name][$search_prefix.$field]);
+					}
+				}
+			}
+		}
+		//* Store variables in object | $this->searchValues = $_SESSION["search"][$list_name];
+		if(@is_array($this->listDef['item'])) {
+			foreach($this->listDef['item'] as $i) {
+				$field = $i['field'];
 				$table = $i['table'];
-				
+
 				$searchval = $_SESSION['search'][$list_name][$search_prefix.$field];
 				// format user date format to MySQL date format 0000-00-00
 				if($i['datatype'] == 'DATE' && $this->lng('conf_format_dateshort') != 'Y-m-d'){
@@ -189,15 +191,15 @@
 					$yearpos = strpos($dateformat, 'Y') + 1;
 					$monthpos = strpos($dateformat, 'm') + 1;
 					$daypos = strpos($dateformat, 'd') + 1;
-						
-					$full_date_trans = array	('Y' => '((?:19|20)\d\d)',
-									 'm' => '(0[1-9]|1[012])',
-									 'd' => '(0[1-9]|[12][0-9]|3[01])'
-									);
-					// d.m.Y  Y/m/d				
+
+					$full_date_trans = array ('Y' => '((?:19|20)\d\d)',
+						'm' => '(0[1-9]|1[012])',
+						'd' => '(0[1-9]|[12][0-9]|3[01])'
+					);
+					// d.m.Y  Y/m/d
 					$full_date_regex = strtr(preg_replace("@[^Ymd]@", "[^0-9]", $this->lng('conf_format_dateshort')), $full_date_trans);
 					//echo $full_date_regex;
-					
+
 					if (preg_match("@^\d+$@", $_SESSION['search'][$list_name][$search_prefix.$field])) { // we just have digits
 						$searchval = $_SESSION['search'][$list_name][$search_prefix.$field];
 					} elseif(preg_match("@^[^0-9]?\d+[^0-9]?$@", $_SESSION['search'][$list_name][$search_prefix.$field])){ // 10. or .10.
@@ -212,8 +214,8 @@
 						$searchval = $year.'-'.$month;
 					} elseif(preg_match("@^[^0-9]?(\d{1,2})[^0-9](\d{1,2})[^0-9]?$@", $_SESSION['search'][$list_name][$search_prefix.$field], $matches)){ // 04.10.
 						if($monthpos < $daypos){
-						$month = $matches[1];
-						$day = $matches[2];
+							$month = $matches[1];
+							$day = $matches[2];
 						} else {
 							$month = $matches[2];
 							$day = $matches[1];
@@ -227,332 +229,332 @@
 						$searchval = $year.'-'.$month.'-'.$day;
 					}
 				}
-				
-                // if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
-		        if(isset($searchval) && $searchval != ''){
-                    $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$searchval.$i['suffix'])."' and";
-                }
-            }
-        }
-        return ( $sql_where != '' ) ? $sql_where = substr($sql_where,0,-3) : '1';
-    }
-	
+
+				// if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
+				if(isset($searchval) && $searchval != ''){
+					$sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$searchval.$i['suffix'])."' and";
+				}
+			}
+		}
+		return ( $sql_where != '' ) ? $sql_where = substr($sql_where, 0, -3) : '1';
+	}
+
 	public function getPagingValue($key) {
 		if(!is_array($this->pagingValues)) return null;
 		if(!array_key_exists($key, $this->pagingValues)) return null;
 		return $this->pagingValues[$key];
 	}
-	
-    public function getPagingSQL($sql_where = '1') 
-    {
-        global $app, $conf;
-		
+
+	public function getPagingSQL($sql_where = '1')
+	{
+		global $app, $conf;
+
 		//* Add Global Limit from selectbox
-        if(!empty($_POST['search_limit']) AND $app->functions->intval($_POST['search_limit']) > 0){
+		if(!empty($_POST['search_limit']) and $app->functions->intval($_POST['search_limit']) > 0){
 			$_SESSION['search']['limit'] = $app->functions->intval($_POST['search_limit']);
 		}
-		
+
 		//if(preg_match('{^[0-9]$}',$_SESSION['search']['limit'])){
-		//	$_SESSION['search']['limit'] = 15;
+		// $_SESSION['search']['limit'] = 15;
 		//}
 		if(intval($_SESSION['search']['limit']) < 1) $_SESSION['search']['limit'] = 15;
 
-        //* Get Config variables
-        $list_name          = $this->listDef['name'];
-        $search_prefix      = $this->listDef['search_prefix'];
-        $records_per_page   = (empty($_SESSION['search']['limit']) ? $app->functions->intval($this->listDef['records_per_page']) : $app->functions->intval($_SESSION['search']['limit'])) ;
-        $table              = $this->listDef['table'];
+		//* Get Config variables
+		$list_name          = $this->listDef['name'];
+		$search_prefix      = $this->listDef['search_prefix'];
+		$records_per_page   = (empty($_SESSION['search']['limit']) ? $app->functions->intval($this->listDef['records_per_page']) : $app->functions->intval($_SESSION['search']['limit'])) ;
+		$table              = $this->listDef['table'];
 
-        //* set PAGE to zero, if in session not set
-        if(!isset($_SESSION['search'][$list_name]['page']) || $_SESSION['search'][$list_name]['page'] == ''){
-            $_SESSION['search'][$list_name]['page'] = 0;
-        }
+		//* set PAGE to zero, if in session not set
+		if(!isset($_SESSION['search'][$list_name]['page']) || $_SESSION['search'][$list_name]['page'] == ''){
+			$_SESSION['search'][$list_name]['page'] = 0;
+		}
 
-        //* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page"
-        if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]);
+		//* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page"
+		if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]);
 
-        //* PAGE to 0 set, if look for themselves ?  page auf 0 setzen, wenn suche sich ge�ndert hat.
-        if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0;
+		//* PAGE to 0 set, if look for themselves ?  page auf 0 setzen, wenn suche sich ge�ndert hat.
+		if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0;
 
-        $sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
-        $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table".($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')." WHERE $sql_where");
-        $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
+		$sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
+		$record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table".($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')." WHERE $sql_where");
+		$pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
 
 
-        $vars['list_file']      = $_SESSION['s']['module']['name'].'/'.$this->listDef['file'];
-        $vars['page']           = $_SESSION['search'][$list_name]['page'];
-        $vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
-        $vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
-        $vars['pages']          = $pages;
-        $vars['max_pages']      = $pages + 1;
-        $vars['records_gesamt'] = $record_count['anzahl'];
-        $vars['page_params']    = (isset($this->listDef['page_params'])) ? $this->listDef['page_params'] : '';
-        $vars['offset'] 		= $sql_von;
-        $vars['records_per_page'] = $records_per_page;
-        //$vars['module'] = $_SESSION['s']['module']['name'];
+		$vars['list_file']      = $_SESSION['s']['module']['name'].'/'.$this->listDef['file'];
+		$vars['page']           = $_SESSION['search'][$list_name]['page'];
+		$vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
+		$vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
+		$vars['pages']          = $pages;
+		$vars['max_pages']      = $pages + 1;
+		$vars['records_gesamt'] = $record_count['anzahl'];
+		$vars['page_params']    = (isset($this->listDef['page_params'])) ? $this->listDef['page_params'] : '';
+		$vars['offset']   = $sql_von;
+		$vars['records_per_page'] = $records_per_page;
+		//$vars['module'] = $_SESSION['s']['module']['name'];
 
-        if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
-        if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
+		if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
+		if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
 
-        $this->pagingValues = $vars;
-        $this->pagingHTML = $this->getPagingHTML($vars);
+		$this->pagingValues = $vars;
+		$this->pagingHTML = $this->getPagingHTML($vars);
 
-        //* Return limit sql
-        return "LIMIT $sql_von, $records_per_page";
-    }
+		//* Return limit sql
+		return "LIMIT $sql_von, $records_per_page";
+	}
 
-    public function getPagingHTML($vars)
-    {
-        global $app;
-        
-        // we want to show at max 17 page numbers (8 left, current, 8 right)
-        $show_pages_count = 17;
-        
-        $show_pages = array(0); // first page
-        if($vars['pages'] > 0) $show_pages[] = $vars['pages']; // last page
-        for($p = $vars['page'] - 2; $p <= $vars['page'] + 2; $p++) { // surrounding pages
-            if($p > 0 && $p < $vars['pages']) $show_pages[] = $p;
-        }
-        
-        $l_start = $vars['page'] - 13;
-        $l_start -= ($l_start % 10) + 1;
-        $h_end = $vars['page'] + 23;
-        $h_end -= ($h_end % 10) + 1;
-        for($p = $l_start; $p <= $h_end; $p += 10) { // surrounding pages
-            if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
-        }
-        
-        $l_start = $vars['page'] - 503;
-        $l_start -= ($l_start % 100) + 1;
-        $h_end = $vars['page'] + 603;
-        $h_end -= ($h_end % 100) + 1;
-        for($p = $l_start; $p <= $h_end; $p += 100) { // surrounding pages
-            if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
-        }
-        
-        $l_start = $vars['page'] - 203;
-        $l_start -= ($l_start % 25) + 1;
-        $h_end = $vars['page'] + 228;
-        $h_end -= ($h_end % 25) + 1;
-        for($p = $l_start; $p <= $h_end; $p += 25) { // surrounding pages
-            if($p > 0 && $p < $vars['pages'] && abs($p - $vars['page']) > 30 && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
-        }
-        
-        sort($show_pages);
-        $show_pages = array_unique($show_pages);
-        
-        //* Show Back 
-        if(isset($vars['show_page_back']) && $vars['show_page_back'] == 1){
-        $content = '<a class="btn-page first-page" href="'."javascript:loadContent('".$vars['list_file'].'?page=0'.$vars['page_params']."');".'">'
-                    .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop_180.png"></a> &nbsp; ';
-            $content .= '<a class="btn-page previous-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params']."');".'">'
-                        .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_180.png"></a> &nbsp; ';
-        }
-        $content .= ' '.$this->lng('page_txt').' ';
-        $prev = -1;
-        foreach($show_pages as $p) {
-            if($prev != -1 && $p > $prev + 1) $content .= '<span class="page-spacer">...</span>';
-            $content .= '<a class="link-page' . ($p == $vars['page'] ? ' current-page' : '') . '" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$p.$vars['page_params']."');".'">'. ($p+1) .'</a>';
-            $prev = $p;
-        }
-        //.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' &nbsp; ';
-        //* Show Next
-        if(isset($vars['show_page_next']) && $vars['show_page_next'] == 1){
-            $content .= '<a class="btn-page next-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params']."');".'">'
-                        .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow.png"></a> &nbsp; ';
-        $content .= '<a class="btn-page last-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['pages'].$vars['page_params']."');".'">'
-                    .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop.png"></a>';
-        }
-        return $content;
-    }
-		
+	public function getPagingHTML($vars)
+	{
+		global $app;
+
+		// we want to show at max 17 page numbers (8 left, current, 8 right)
+		$show_pages_count = 17;
+
+		$show_pages = array(0); // first page
+		if($vars['pages'] > 0) $show_pages[] = $vars['pages']; // last page
+		for($p = $vars['page'] - 2; $p <= $vars['page'] + 2; $p++) { // surrounding pages
+			if($p > 0 && $p < $vars['pages']) $show_pages[] = $p;
+		}
+
+		$l_start = $vars['page'] - 13;
+		$l_start -= ($l_start % 10) + 1;
+		$h_end = $vars['page'] + 23;
+		$h_end -= ($h_end % 10) + 1;
+		for($p = $l_start; $p <= $h_end; $p += 10) { // surrounding pages
+			if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
+		}
+
+		$l_start = $vars['page'] - 503;
+		$l_start -= ($l_start % 100) + 1;
+		$h_end = $vars['page'] + 603;
+		$h_end -= ($h_end % 100) + 1;
+		for($p = $l_start; $p <= $h_end; $p += 100) { // surrounding pages
+			if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
+		}
+
+		$l_start = $vars['page'] - 203;
+		$l_start -= ($l_start % 25) + 1;
+		$h_end = $vars['page'] + 228;
+		$h_end -= ($h_end % 25) + 1;
+		for($p = $l_start; $p <= $h_end; $p += 25) { // surrounding pages
+			if($p > 0 && $p < $vars['pages'] && abs($p - $vars['page']) > 30 && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
+		}
+
+		sort($show_pages);
+		$show_pages = array_unique($show_pages);
+
+		//* Show Back
+		if(isset($vars['show_page_back']) && $vars['show_page_back'] == 1){
+			$content = '<a class="btn-page first-page" href="'."javascript:loadContent('".$vars['list_file'].'?page=0'.$vars['page_params']."');".'">'
+				.'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop_180.png"></a> &nbsp; ';
+			$content .= '<a class="btn-page previous-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params']."');".'">'
+				.'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_180.png"></a> &nbsp; ';
+		}
+		$content .= ' '.$this->lng('page_txt').' ';
+		$prev = -1;
+		foreach($show_pages as $p) {
+			if($prev != -1 && $p > $prev + 1) $content .= '<span class="page-spacer">...</span>';
+			$content .= '<a class="link-page' . ($p == $vars['page'] ? ' current-page' : '') . '" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$p.$vars['page_params']."');".'">'. ($p+1) .'</a>';
+			$prev = $p;
+		}
+		//.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' &nbsp; ';
+		//* Show Next
+		if(isset($vars['show_page_next']) && $vars['show_page_next'] == 1){
+			$content .= '<a class="btn-page next-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params']."');".'">'
+				.'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow.png"></a> &nbsp; ';
+			$content .= '<a class="btn-page last-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['pages'].$vars['page_params']."');".'">'
+				.'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop.png"></a>';
+		}
+		return $content;
+	}
+
 	public function getPagingHTMLasTXT($vars)
-    {
-        global $app;
-        $content = '[<a href="'.$vars['list_file'].'?page=0'.$vars['page_params'].'">|&lt;&lt; </a>]';
-        if($vars['show_page_back'] == 1){
-            $content .= '[<< <a href="'.$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params'].'">'.$app->lng('page_back_txt').'</a>] ';
-        }
-        $content .= ' '.$this->lng('page_txt').' '.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' ';
-        if($vars['show_page_next'] == 1){
-            $content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params'].'">'.$app->lng('page_next_txt').' >></a>] ';
-        }
-        $content .= '[<a href="'.$vars['list_file'].'?page='.$vars['pages'].$vars['page_params'].'"> &gt;&gt;|</a>]';
-        return $content;
-    }
+	{
+		global $app;
+		$content = '[<a href="'.$vars['list_file'].'?page=0'.$vars['page_params'].'">|&lt;&lt; </a>]';
+		if($vars['show_page_back'] == 1){
+			$content .= '[<< <a href="'.$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params'].'">'.$app->lng('page_back_txt').'</a>] ';
+		}
+		$content .= ' '.$this->lng('page_txt').' '.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' ';
+		if($vars['show_page_next'] == 1){
+			$content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params'].'">'.$app->lng('page_next_txt').' >></a>] ';
+		}
+		$content .= '[<a href="'.$vars['list_file'].'?page='.$vars['pages'].$vars['page_params'].'"> &gt;&gt;|</a>]';
+		return $content;
+	}
 
-    public function getSortSQL()
-    {
-        global $app, $conf;
-        //* Get config vars
-        $sort_field = $this->listDef['sort_field'];
-        $sort_direction = $this->listDef['sort_direction'];
-        return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
-    }
+	public function getSortSQL()
+	{
+		global $app, $conf;
+		//* Get config vars
+		$sort_field = $this->listDef['sort_field'];
+		$sort_direction = $this->listDef['sort_direction'];
+		return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
+	}
 
-    public function decode($record) 
-    {
-        global $conf, $app;
-        if(is_array($record) && count($record) > 0 && is_array($this->listDef['item'])) {
-            foreach($this->listDef['item'] as $field){
-                $key = $field['field'];
-                //* Apply filter to record value.
-                if(isset($field['filters']) && is_array($field['filters'])) {
-                    $app->uses('tform');
-                    $record[$key] = $app->tform->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
-                }
-				if(isset($record[$key])) {
-                	switch ($field['datatype']){
-                    case 'VARCHAR':
-                    case 'TEXT':
-                        $record[$key] = htmlentities(stripslashes($record[$key]),ENT_QUOTES,$conf["html_content_encoding"]);
-                         break;
-
-                    case 'DATETSTAMP':
-                        if ($record[$key] > 0) {
-							// is value int?
-							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
-	                        	$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
-							} else {
-	                        	$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
-							}
-						}
-                        break;
-					case 'DATETIMETSTAMP':
-                        if ($record[$key] > 0) {
-							// is value int?
-							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
-	                        	$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
-							} else {
-	                        	$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
-							}
-						}
-                        break;
-					case 'DATE':
-                        if ($record[$key] > 0) {
-							// is value int?
-							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
-	                        	$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
-							} else {
-	                        	$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
-							}
-						}
-                        break;
-                        
-                    case 'DATETIME':
-                        if ($record[$key] > 0) {
-							// is value int?
-							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
-	                        	$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
-							} else {
-	                        	$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
-							}
-						}
-                        break;
-
-                    case 'INTEGER':
-                        $record[$key] = $app->functions->intval($record[$key]);
-                        break;
-
-                    case 'DOUBLE':
-                        $record[$key] = htmlentities($record[$key],ENT_QUOTES,$conf["html_content_encoding"]);
-                        break;
-
-                    case 'CURRENCY':
-                        $record[$key] = $app->functions->currency_format($record[$key]);
-                        break;
-
-                    default:
-                        $record[$key] = htmlentities(stripslashes($record[$key]),ENT_QUOTES,$conf["html_content_encoding"]);
-                	}
+	public function decode($record)
+	{
+		global $conf, $app;
+		if(is_array($record) && count($record) > 0 && is_array($this->listDef['item'])) {
+			foreach($this->listDef['item'] as $field){
+				$key = $field['field'];
+				//* Apply filter to record value.
+				if(isset($field['filters']) && is_array($field['filters'])) {
+					$app->uses('tform');
+					$record[$key] = $app->tform->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
 				}
-            }
-        }
-        return $record;
-    }
+				if(isset($record[$key])) {
+					switch ($field['datatype']){
+					case 'VARCHAR':
+						case 'TEXT':
+						$record[$key] = htmlentities(stripslashes($record[$key]), ENT_QUOTES, $conf["html_content_encoding"]);
+						break;
 
-    public function encode($record)
-    {
-	global $app;
-        if(is_array($record)) {
-            foreach($this->listDef['item'] as $field){
-                $key = $field['field'];
-                switch($field['datatype']){
-
-                    case 'VARCHAR':
-                    case 'TEXT':
-                        if(!is_array($record[$key])) {
-                            $record[$key] = $app->db->quote($record[$key]);
-                        } else {
-                            $record[$key] = implode($this->tableDef[$key]['separator'],$record[$key]);
-                        }
-                        break;
-                    
 					case 'DATETSTAMP':
-                        if($record[$key] > 0) {
-						    $record[$key] = date('Y-m-d',strtotime($record[$key]));
-                        }
-                        break;
-						
+						if ($record[$key] > 0) {
+							// is value int?
+							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
+								$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
+							} else {
+								$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
+							}
+						}
+						break;
 					case 'DATETIMETSTAMP':
-                        if($record[$key] > 0) {
-						    $record[$key] = date('Y-m-d H:i:s',strtotime($record[$key]));
-                        }
-                        break;
-					
-                    case 'DATE':
-                        if($record[$key] != '' && $record[$key] != '0000-00-00') {
-						    $record[$key] = $record[$key];
-                        }
-                        break;
+						if ($record[$key] > 0) {
+							// is value int?
+							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
+								$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
+							} else {
+								$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
+							}
+						}
+						break;
+					case 'DATE':
+						if ($record[$key] > 0) {
+							// is value int?
+							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
+								$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
+							} else {
+								$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
+							}
+						}
+						break;
 
-                    case 'DATETIME':
-                        if($record[$key] > 0) {
-						    $record[$key] = date('Y-m-d H:i:s',strtotime($record[$key]));
-                        }
-                        break;
+					case 'DATETIME':
+						if ($record[$key] > 0) {
+							// is value int?
+							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
+								$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
+							} else {
+								$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
+							}
+						}
+						break;
 
-                    case 'INTEGER':
-                        $record[$key] = $app->functions->intval($record[$key]);
-                        break;
+					case 'INTEGER':
+						$record[$key] = $app->functions->intval($record[$key]);
+						break;
 
-                    case 'DOUBLE':
-                        $record[$key] = $app->db->quote($record[$key]);
-                        break;
+					case 'DOUBLE':
+						$record[$key] = htmlentities($record[$key], ENT_QUOTES, $conf["html_content_encoding"]);
+						break;
 
-                    case 'CURRENCY':
-                        $record[$key] = str_replace(',', '.', $record[$key]);
-                        break;
-                }
-            }
-        }
-        return $record;
-    }
-	
+					case 'CURRENCY':
+						$record[$key] = $app->functions->currency_format($record[$key]);
+						break;
+
+					default:
+						$record[$key] = htmlentities(stripslashes($record[$key]), ENT_QUOTES, $conf["html_content_encoding"]);
+					}
+				}
+			}
+		}
+		return $record;
+	}
+
+	public function encode($record)
+	{
+		global $app;
+		if(is_array($record)) {
+			foreach($this->listDef['item'] as $field){
+				$key = $field['field'];
+				switch($field['datatype']){
+
+				case 'VARCHAR':
+				case 'TEXT':
+					if(!is_array($record[$key])) {
+						$record[$key] = $app->db->quote($record[$key]);
+					} else {
+						$record[$key] = implode($this->tableDef[$key]['separator'], $record[$key]);
+					}
+					break;
+
+				case 'DATETSTAMP':
+					if($record[$key] > 0) {
+						$record[$key] = date('Y-m-d', strtotime($record[$key]));
+					}
+					break;
+
+				case 'DATETIMETSTAMP':
+					if($record[$key] > 0) {
+						$record[$key] = date('Y-m-d H:i:s', strtotime($record[$key]));
+					}
+					break;
+
+				case 'DATE':
+					if($record[$key] != '' && $record[$key] != '0000-00-00') {
+						$record[$key] = $record[$key];
+					}
+					break;
+
+				case 'DATETIME':
+					if($record[$key] > 0) {
+						$record[$key] = date('Y-m-d H:i:s', strtotime($record[$key]));
+					}
+					break;
+
+				case 'INTEGER':
+					$record[$key] = $app->functions->intval($record[$key]);
+					break;
+
+				case 'DOUBLE':
+					$record[$key] = $app->db->quote($record[$key]);
+					break;
+
+				case 'CURRENCY':
+					$record[$key] = str_replace(',', '.', $record[$key]);
+					break;
+				}
+			}
+		}
+		return $record;
+	}
+
 	function lng($msg) {
 		global $app;
-			
+
 		if(isset($this->wordbook[$msg])) {
 			return $this->wordbook[$msg];
 		} else {
 			return $app->lng($msg);
-		}	
+		}
 	}
-	
+
 	function escapeArrayValues($search_values) {
-	    global $conf;
-		
+		global $conf;
+
 		$out = array();
 		if(is_array($search_values)) {
 			foreach($search_values as $key => $val) {
-				$out[$key] = htmlentities($val,ENT_QUOTES,$conf["html_content_encoding"]);
+				$out[$key] = htmlentities($val, ENT_QUOTES, $conf["html_content_encoding"]);
 			}
 		}
-		
+
 		return $out;
-		
+
 	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php
index fe167a9..0062d8e 100644
--- a/interface/lib/classes/listform_actions.inc.php
+++ b/interface/lib/classes/listform_actions.inc.php
@@ -29,7 +29,7 @@
 */
 
 class listform_actions {
-	
+
 	private $id;
 	public $idx_key;
 	public $DataRowColor;
@@ -37,139 +37,139 @@
 	public $SQLOrderBy = '';
 	public $SQLExtSelect = '';
 	private $sortKeys;
-    
-    private function _sort($aOne, $aTwo) {
-        if(!is_array($aOne) || !is_array($aTwo)) return 0;
-        
-        if(!is_array($this->sortKeys)) $this->sortKeys = array($this->sortKeys);
-        foreach($this->sortKeys as $sKey => $sDir) {
-            if(is_numeric($sKey)) {
-                $sKey = $sDir;
-                $sDir = 'ASC';
-            }
-            $a = $aOne[$sKey];
-            $b = $aTwo[$sKey];
-            if(is_string($a)) $a = strtolower($a);
-            if(is_string($b)) $b = strtolower($b);
-            if($a < $b) return ($sDir == 'DESC' ? 1 : -1);
-            elseif($a > $b) return ($sDir == 'DESC' ? -1 : 1);
-        }
-        return 0;
-    }
-    
+
+	private function _sort($aOne, $aTwo) {
+		if(!is_array($aOne) || !is_array($aTwo)) return 0;
+
+		if(!is_array($this->sortKeys)) $this->sortKeys = array($this->sortKeys);
+		foreach($this->sortKeys as $sKey => $sDir) {
+			if(is_numeric($sKey)) {
+				$sKey = $sDir;
+				$sDir = 'ASC';
+			}
+			$a = $aOne[$sKey];
+			$b = $aTwo[$sKey];
+			if(is_string($a)) $a = strtolower($a);
+			if(is_string($b)) $b = strtolower($b);
+			if($a < $b) return $sDir == 'DESC' ? 1 : -1;
+			elseif($a > $b) return $sDir == 'DESC' ? -1 : 1;
+		}
+		return 0;
+	}
+
 	public function onLoad()
-    {
+	{
 		global $app, $conf, $list_def_file;
-		
+
 		$app->uses('tpl,listform,tform');
-		
+
 		//* Clear session variable that is used when lists are embedded with the listview plugin
 		$_SESSION['s']['form']['return_to'] = '';
-		
+
 		// Load list definition
 		$app->listform->loadListDef($list_def_file);
-		
+
 		if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm')) {
 			$app->uses('listform_tpl_generator');
 			$app->listform_tpl_generator->buildHTML($app->listform->listDef);
 		}
-		
+
 		$app->tpl->newTemplate("listpage.tpl.htm");
-		$app->tpl->setInclude('content_tpl','templates/'.$app->listform->listDef["name"].'_list.htm');
-		
+		$app->tpl->setInclude('content_tpl', 'templates/'.$app->listform->listDef["name"].'_list.htm');
+
 		//* Manipulate order by for sorting / Every list has a stored value
 		//* Against notice error
 		if(!isset($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
-		  $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = '';
+			$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = '';
 		}
-        
-        $php_sort = false;
-        
+
+		$php_sort = false;
+
 		if(!empty($_GET['orderby'])){
-		  $order = str_replace('tbl_col_','',$_GET['orderby']);
-		  
-		  //* Check the css class submited value
-		  if (preg_match("/^[a-z\_]{1,}$/",$order)) {
-            
-            if(isset($app->listform->listDef['phpsort']) && is_array($app->listform->listDef['phpsort']) && in_array($order, $app->listform->listDef['phpsort'])) {
-                $php_sort = true;
-            } else {
-                // prepend correct table
-                $prepend_table = $app->listform->listDef['table'];
-                if(trim($app->listform->listDef['additional_tables']) != '' && is_array($app->listform->listDef['item']) && count($app->listform->listDef['item']) > 0) {
-                    foreach($app->listform->listDef['item'] as $field) {
-                        if($field['field'] == $order && $field['table'] != ''){
-                            $prepend_table = $field['table'];
-                            break;
-                        }
-                    }
-                }
-                $order = $prepend_table.'.'.$order;
-            }
-			
-		    if($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] == $order){
-				$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order.' DESC';
-		    } else {
-				$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order;
-		    }
-            $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php'] = $php_sort;
-		  }
+			$order = str_replace('tbl_col_', '', $_GET['orderby']);
+
+			//* Check the css class submited value
+			if (preg_match("/^[a-z\_]{1,}$/", $order)) {
+
+				if(isset($app->listform->listDef['phpsort']) && is_array($app->listform->listDef['phpsort']) && in_array($order, $app->listform->listDef['phpsort'])) {
+					$php_sort = true;
+				} else {
+					// prepend correct table
+					$prepend_table = $app->listform->listDef['table'];
+					if(trim($app->listform->listDef['additional_tables']) != '' && is_array($app->listform->listDef['item']) && count($app->listform->listDef['item']) > 0) {
+						foreach($app->listform->listDef['item'] as $field) {
+							if($field['field'] == $order && $field['table'] != ''){
+								$prepend_table = $field['table'];
+								break;
+							}
+						}
+					}
+					$order = $prepend_table.'.'.$order;
+				}
+
+				if($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] == $order){
+					$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order.' DESC';
+				} else {
+					$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order;
+				}
+				$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php'] = $php_sort;
+			}
 		}
 
 		// If a manuel oder by like customers isset the sorting will be infront
 		if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']) && !$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php']){
-          if(empty($this->SQLOrderBy)){
-		    $this->SQLOrderBy = "ORDER BY ".$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'];
-		  } else {
-		    $this->SQLOrderBy = str_replace("ORDER BY ","ORDER BY ".$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'].', ',$this->SQLOrderBy);
-		  }
+			if(empty($this->SQLOrderBy)){
+				$this->SQLOrderBy = "ORDER BY ".$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'];
+			} else {
+				$this->SQLOrderBy = str_replace("ORDER BY ", "ORDER BY ".$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'].', ', $this->SQLOrderBy);
+			}
 		}
-		
+
 		if($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php']) $php_sort = true;
-		
+
 		// Getting Datasets from DB
 		$records = $app->db->queryAllRecords($this->getQueryString($php_sort));
 
 		$this->DataRowColor = "#FFFFFF";
 		$records_new = '';
 		if(is_array($records)) {
-			$this->idx_key = $app->listform->listDef["table_idx"]; 
+			$this->idx_key = $app->listform->listDef["table_idx"];
 			foreach($records as $rec) {
 				$records_new[] = $this->prepareDataRow($rec);
 			}
 		}
-        
-        if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']) && $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php']) {
-            $order_by = $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'];
-            $order_dir = 'ASC';
-            if(substr($order_by, -5) === ' DESC') {
-                $order_by = substr($order_by, 0, -5);
-                $order_dir = 'DESC';
-            }
-            $this->sortKeys = array($order_by => $order_dir);
-            uasort($records_new, array($this, '_sort'));
-        }
-        if($php_sort) {
+
+		if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']) && $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php']) {
+			$order_by = $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'];
+			$order_dir = 'ASC';
+			if(substr($order_by, -5) === ' DESC') {
+				$order_by = substr($order_by, 0, -5);
+				$order_dir = 'DESC';
+			}
+			$this->sortKeys = array($order_by => $order_dir);
+			uasort($records_new, array($this, '_sort'));
+		}
+		if($php_sort) {
 			$records_new = array_slice($records_new, $app->listform->getPagingValue('offset'), $app->listform->getPagingValue('records_per_page'));
 		}
-        
-		$app->tpl->setLoop('records',$records_new);
+
+		$app->tpl->setLoop('records', $records_new);
 
 		$this->onShow();
-		
-		
+
+
 	}
-	
+
 	public function prepareDataRow($rec)
-    {
+	{
 		global $app;
-		
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
-		
+
 		//* substitute value for select fields
 		if(is_array($app->listform->listDef['item']) && count($app->listform->listDef['item']) > 0) {
 			foreach($app->listform->listDef['item'] as $field) {
@@ -184,12 +184,12 @@
 				}
 			}
 		}
-		
+
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
-	
+
 	public function getQueryString($no_limit = false) {
 		global $app;
 		$sql_where = '';
@@ -199,32 +199,32 @@
 			if($_SESSION['s']['user']['typ'] == "admin") {
 				$sql_where = '';
 			} else {
-				$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and'; 
-                //$sql_where = $app->tform->getAuthSQL('r').' and';
+				$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and';
+				//$sql_where = $app->tform->getAuthSQL('r').' and';
 			}
-		}		
+		}
 		if($this->SQLExtWhere != '') {
 			$sql_where .= ' '.$this->SQLExtWhere.' and';
 		}
-		
+
 		$sql_where = $app->listform->getSearchSQL($sql_where);
 		if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql'];
 		$app->tpl->setVar($app->listform->searchValues);
-		
+
 		$order_by_sql = $this->SQLOrderBy;
 
 		//* Generate SQL for paging
 		$limit_sql = $app->listform->getPagingSQL($sql_where);
-		$app->tpl->setVar('paging',$app->listform->pagingHTML);
+		$app->tpl->setVar('paging', $app->listform->pagingHTML);
 
 		$extselect = '';
 		$join = '';
-		
+
 		if($this->SQLExtSelect != '') {
-			if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; 
+			if(substr($this->SQLExtSelect, 0, 1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect;
 			$extselect .= $this->SQLExtSelect;
 		}
-		
+
 		$table_selects = array();
 		$table_selects[] = trim($app->listform->listDef['table']).'.*';
 		$app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']);
@@ -241,53 +241,54 @@
 		//echo $sql;
 		return $sql;
 	}
-	
-	
+
+
 	public function onShow()
-    {
+	{
 		global $app;
-		
+
 		//* Set global Language File
 		$lng_file = ISPC_LIB_PATH.'/lang/'.$_SESSION['s']['language'].'.lng';
 		if(!file_exists($lng_file))
-		$lng_file = ISPC_LIB_PATH.'/lang/en.lng';
-		include($lng_file);
+			$lng_file = ISPC_LIB_PATH.'/lang/en.lng';
+		include $lng_file;
 		$app->tpl->setVar($wb);
-		
+
 		//* Limit each page
-		$limits = array('5'=>'5','15'=>'15','25'=>'25','50'=>'50','100'=>'100','999999999' => 'all');
+		$limits = array('5'=>'5', '15'=>'15', '25'=>'25', '50'=>'50', '100'=>'100', '999999999' => 'all');
 
 		//* create options and set selected, if default -> 15 is selected
 
 		$options = '';
 		foreach($limits as $key => $val){
-		  $options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
+			$options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
 		}
-		$app->tpl->setVar('search_limit','<select name="search_limit" class="search_limit">'.$options.'</select>');
-		
-		$app->tpl->setVar('toolsarea_head_txt',$app->lng('toolsarea_head_txt'));
+		$app->tpl->setVar('search_limit', '<select name="search_limit" class="search_limit">'.$options.'</select>');
+
+		$app->tpl->setVar('toolsarea_head_txt', $app->lng('toolsarea_head_txt'));
 		$app->tpl->setVar($app->listform->wordbook);
 		$app->tpl->setVar('form_action', $app->listform->listDef['file']);
-		
-        if(isset($_SESSION['show_info_msg'])) {
-            $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
-            unset($_SESSION['show_info_msg']);
-        }
-        if(isset($_SESSION['show_error_msg'])) {
-            $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
-            unset($_SESSION['show_error_msg']);
-        }
-        
+
+		if(isset($_SESSION['show_info_msg'])) {
+			$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+			unset($_SESSION['show_info_msg']);
+		}
+		if(isset($_SESSION['show_error_msg'])) {
+			$app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+			unset($_SESSION['show_error_msg']);
+		}
+
 		//* Parse the templates and send output to the browser
 		$this->onShowEnd();
 	}
-	
+
 	public function onShowEnd()
-    {
+	{
 		global $app;
 		$app->tpl_defaults();
 		$app->tpl->pparse();
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/listform_tpl_generator.inc.php b/interface/lib/classes/listform_tpl_generator.inc.php
index e19b52c..b8a26a7 100644
--- a/interface/lib/classes/listform_tpl_generator.inc.php
+++ b/interface/lib/classes/listform_tpl_generator.inc.php
@@ -29,11 +29,11 @@
 */
 
 class listform_tpl_generator {
-	
-	function buildHTML($listDef,$module = '') {
-		
+
+	function buildHTML($listDef, $module = '') {
+
 		global $app;
-		
+
 		if($module == '') $module = $_SESSION["s"]["module"]["name"];
 
 		$lang = array();
@@ -57,22 +57,22 @@
         <thead>
           <tr>
 ';
-		
+
 		$lang["list_head_txt"] = $listDef["name"];
-      $colcount = 0;
+		$colcount = 0;
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
 			$html .= "            <th class=\"tbl_col_".$key."\" scope=\"col\"><tmpl_var name=\"".$key."_txt\"></th>\n";
 			$lang[$key."_txt"] = $key;
-         $colcount++;
+			$colcount++;
 		}
-		
+
 		$html .= '            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
           </tr>
           <tr>
 ';
-  
-  		foreach($listDef["item"] as $field) {
+
+		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
 			if($field["formtype"] == 'SELECT') {
 				$html .= "            <td class=\"tbl_col_".$key."\"><select name=\"".$listDef["search_prefix"].$key."\" onChange=\"submitForm('pageForm','".$module."/".$listDef["file"]."');\">{tmpl_var name='".$listDef["search_prefix"].$key."'}</select></td>\n";
@@ -80,7 +80,7 @@
 				$html .= "            <td class=\"tbl_col_".$key."\"><input type=\"text\" name=\"".$listDef["search_prefix"].$key."\" value=\"{tmpl_var name='".$listDef["search_prefix"].$key."'}\" /></td>\n";
 			}
 		}
-		
+
 		$html .= '            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="'."submitForm('pageForm','".$module."/".$listDef["file"]."');".'"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
           </tr>
         </thead>
@@ -88,14 +88,14 @@
           <tmpl_loop name="records">
           <tr class="tbl_row_<tmpl_if name=\'__EVEN__\'}even<tmpl_else>uneven</tmpl_if>">
 ';
-		
+
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
 			$html .= "            <td class=\"tbl_col_".$key."\"><a href=\"#\" onclick=\"loadContent('".$module."/".$listDef["edit_file"]."?id={tmpl_var name='id'}');\">{tmpl_var name=\"".$key."\"}</a></td>\n";
 		}
-		
+
 		$html .= "            <td class=\"tbl_col_buttons\">
-              <div class=\"buttons icons16\">    
+              <div class=\"buttons icons16\">
                 <a class=\"button icons16 icoDelete\" href=\"javascript: del_record('".$module."/".$listDef["delete_file"]."?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');\"><span>{tmpl_var name='delete_txt'}</span></a>
               </div>
             </td>
@@ -107,7 +107,7 @@
               </tr>
           </tmpl_unless>
         </tbody>";
-  $html .= '
+		$html .= '
         <tfoot>
           <tr>
             <td class="tbl_footer tbl_paging" colspan="'.(count($listDef["item"])+1).'"><tmpl_var name="paging"></td>
@@ -119,26 +119,26 @@
 
 </div>
 ';
-		
+
 		if($module == '') {
 			$filename = 'templates/'.$listDef["name"].'_list.htm';
 		} else {
 			$filename = '../'.$module.'/templates/'.$listDef["name"].'_list.htm';
 		}
-		
-		
+
+
 		// save template
-		if (!$handle = fopen($filename, 'w')) { 
-        	print "Cannot open file ($filename)"; 
-        	exit; 
-   		} 
- 
-   		if (!fwrite($handle, $html)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $html)) {
+			print "Cannot write to file ($filename)";
+			exit;
 		}
 		fclose($handle);
-		
+
 		/*$lang["page_txt"] = 'Page';
 		$lang["page_of_txt"] = 'of';
 		$lang["page_next_txt"] = 'Next';
@@ -147,41 +147,41 @@
 		$lang["filter_txt"] = 'Filter';
 		$lang["add_new_record_txt"] = 'Add new record';
 		*/
-		
+
 		// save language file
-		$this->lng_add($lang,$listDef,$module);
-    }
-	
-	function lng_add($lang,$listDef,$module = '') {
-		global $go_api, $go_info,$conf;
-		
+		$this->lng_add($lang, $listDef, $module);
+	}
+
+	function lng_add($lang, $listDef, $module = '') {
+		global $go_api, $go_info, $conf;
+
 		if($module == '') {
 			$lng_file = "lib/lang/".$conf["language"]."_".$listDef['name']."_list.lng";
 		} else {
 			$lng_file = '../'.$module."/lib/lang/en_".$listDef['name']."_list.lng";
 		}
-		
+
 		if(is_file($lng_file)) {
-			include_once($lng_file);
+			include_once $lng_file;
 		} else {
 			$wb = array();
 		}
-		
-		$wb_out = array_merge($lang,$wb);
-		
+
+		$wb_out = array_merge($lang, $wb);
+
 		if(is_array($wb_out)) {
-			$fp = fopen ($lng_file, "w");
-			fwrite($fp,"<?php\n");
+			$fp = fopen($lng_file, "w");
+			fwrite($fp, "<?php\n");
 			foreach($wb_out as $key => $val) {
 				$new_line = '$wb["'.$key.'"] = '."'$val';\n";
-				fwrite($fp,$new_line);
-				
+				fwrite($fp, $new_line);
+
 			}
-			fwrite($fp,"?>");
+			fwrite($fp, "?>");
 			fclose($fp);
 		}
 	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/plugin.inc.php b/interface/lib/classes/plugin.inc.php
index 341b186..aaaf567 100644
--- a/interface/lib/classes/plugin.inc.php
+++ b/interface/lib/classes/plugin.inc.php
@@ -29,92 +29,92 @@
 */
 
 class plugin {
-	
+
 	private $subscribed_events = array();
 	private $debug = false;
-	
-	
+
+
 	/*
 	 This function is called to load the plugins from the plugins folder and update the plugin cache
 	*/
-	
+
 	private function loadPluginCache() {
-		global $app,$conf;
-		
-		
+		global $app, $conf;
+
+
 		if(isset($_SESSION['s']['plugin_cache'])) unset($_SESSION['s']['plugin_cache']);
-		
+
 		$plugins_dir = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV;
 		$_SESSION['s']['plugin_cache'] = array();
 		$tmp_plugins = array();
-		
+
 		if (is_dir($plugins_dir)) {
 			if ($dh = opendir($plugins_dir)) {
 				//** Go trough all files in the plugin dir
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						$plugin_name = substr($file, 0, -8);
 						$tmp_plugins[$plugin_name] = $file;
 					}
 				}
 				//** sort the plugins by name
 				ksort($tmp_plugins);
-				
+
 				//** load the plugins
 				foreach($tmp_plugins as $plugin_name => $file) {
-					include_once($plugins_dir.$file);
-					if($this->debug) $app->log('Loading plugin: '.$plugin_name,LOGLEVEL_DEBUG);
+					include_once $plugins_dir.$file;
+					if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
 					$app->loaded_plugins[$plugin_name] = new $plugin_name;
 					$app->loaded_plugins[$plugin_name]->onLoad();
 				}
 			} else {
-				$app->log('Unable to open the plugins directory: '.$plugins_dir,LOGLEVEL_ERROR);
+				$app->log('Unable to open the plugins directory: '.$plugins_dir, LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log('Plugins directory missing: '.$plugins_dir,LOGLEVEL_ERROR);
+			$app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR);
 		}
-		
+
 	}
-	
+
 	/*
-	 This function is called by the plugin to register for an event which is saved into the plugin cache 
+	 This function is called by the plugin to register for an event which is saved into the plugin cache
 	 for faster lookups without the need to load all plugins for every page.
 	*/
-	
-	public function registerEvent($event_name,$plugin_name,$function_name) {
+
+	public function registerEvent($event_name, $plugin_name, $function_name) {
 		global $app;
-		
+
 		$_SESSION['s']['plugin_cache'][$event_name][] = array('plugin' => $plugin_name, 'function' => $function_name);
-		if($this->debug) $app->log("Plugin '$plugin_name' has registered the function '$function_name' for the event '$event_name'",LOGLEVEL_DEBUG);
+		if($this->debug) $app->log("Plugin '$plugin_name' has registered the function '$function_name' for the event '$event_name'", LOGLEVEL_DEBUG);
 	}
-	
+
 	/*
 		This function is called when a certian action occurs, e.g. a form gets saved or a user is logged in.
 	*/
-	
-	public function raiseEvent($event_name,$data) {
+
+	public function raiseEvent($event_name, $data) {
 		global $app;
-		
+
 		if(!isset($_SESSION['s']['plugin_cache'])) {
 			$this->loadPluginCache();
-			if($this->debug) $app->log('Loaded the plugin cache.',LOGLEVEL_DEBUG);
+			if($this->debug) $app->log('Loaded the plugin cache.', LOGLEVEL_DEBUG);
 		}
-		
-		
-		$sub_events = explode(':',$event_name);
-		
+
+
+		$sub_events = explode(':', $event_name);
+
 		if(is_array($sub_events)) {
 			if(count($sub_events) == 3) {
 				$tmp_event = $sub_events[2];
-				if($this->debug) $app->log("Called Event '$tmp_event'",LOGLEVEL_DEBUG);
-				$this->callPluginEvent($tmp_event,$data);
+				if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
+				$this->callPluginEvent($tmp_event, $data);
 				$tmp_event = $sub_events[0].':'.$sub_events[2];
-				if($this->debug) $app->log("Called Event '$tmp_event'",LOGLEVEL_DEBUG);
-				$this->callPluginEvent($tmp_event,$data);
+				if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
+				$this->callPluginEvent($tmp_event, $data);
 				$tmp_event = $sub_events[0].':'.$sub_events[1].':'.$sub_events[2];
-				if($this->debug) $app->log("Called Event '$tmp_event'",LOGLEVEL_DEBUG);
-				$this->callPluginEvent($tmp_event,$data);
-				
+				if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
+				$this->callPluginEvent($tmp_event, $data);
+
 				/*$sub_events = array_reverse($sub_events);
 				$tmp_event = '';
 				foreach($sub_events as $n => $sub_event) {
@@ -124,44 +124,44 @@
 				}
 				*/
 			} else {
-				if($this->debug) $app->log("Called Event '$sub_events[0]'",LOGLEVEL_DEBUG);
-				$this->callPluginEvent($sub_events[0],$data);
+				if($this->debug) $app->log("Called Event '$sub_events[0]'", LOGLEVEL_DEBUG);
+				$this->callPluginEvent($sub_events[0], $data);
 			}
 		}
-		
-	 } // end function raiseEvent
-	
-	 //* Internal function to load the plugin and call the event function in the plugin.
-	 private function callPluginEvent($event_name,$data) {
-	 	global $app;
 
-	 	//* execute the functions for the events
+	} // end function raiseEvent
+
+	//* Internal function to load the plugin and call the event function in the plugin.
+	private function callPluginEvent($event_name, $data) {
+		global $app;
+
+		//* execute the functions for the events
 		if(@is_array($_SESSION['s']['plugin_cache'][$event_name])) {
 			foreach($_SESSION['s']['plugin_cache'][$event_name] as $rec) {
 				$plugin_name = $rec['plugin'];
 				$function_name = $rec['function'];
 				$plugin_file = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV.$plugin_name.'.inc.php';
-		
-				
+
+
 				if(is_file($plugin_file)) {
 					if(!isset($app->loaded_plugins[$plugin_name])) {
-						include_once($plugin_file);
+						include_once $plugin_file;
 						$app->loaded_plugins[$plugin_name] = new $plugin_name;
 					}
-					
-					if($this->debug) $app->log("Called method: '$function_name' in plugin '$plugin_name' for event '$event_name'",LOGLEVEL_DEBUG);
+
+					if($this->debug) $app->log("Called method: '$function_name' in plugin '$plugin_name' for event '$event_name'", LOGLEVEL_DEBUG);
 					// call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data);
 
-					call_user_func(array($app->loaded_plugins[$plugin_name],$function_name),$event_name,$data);
-	
+					call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data);
+
 				}
 			}
-			
+
 		}
-		
-	 } // end functiom callPluginEvent
-	
-	
+
+	} // end functiom callPluginEvent
+
+
 }
 
 ?>
diff --git a/interface/lib/classes/plugin_backuplist.inc.php b/interface/lib/classes/plugin_backuplist.inc.php
index 1f90496..6d3cdd3 100644
--- a/interface/lib/classes/plugin_backuplist.inc.php
+++ b/interface/lib/classes/plugin_backuplist.inc.php
@@ -30,121 +30,121 @@
 
 class plugin_backuplist extends plugin_base {
 
-        var $module;
-        var $form;
-        var $tab;
-        var $record_id;
-        var $formdef;
-        var $options;
+	var $module;
+	var $form;
+	var $tab;
+	var $record_id;
+	var $formdef;
+	var $options;
 
-        function onShow() {
+	function onShow() {
 
-                global $app;
-				
-				$listTpl = new tpl;
-                $listTpl->newTemplate('templates/web_backup_list.htm');
-				
-				//* Loading language file
-                $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_backup_list.lng";
-                include($lng_file);
-                $listTpl->setVar($wb);
-				
-				$message = '';
-				$error = '';
-				
-				if(isset($_GET['backup_action'])) {
-					$backup_id = $app->functions->intval($_GET['backup_id']);
-					
-					//* check if the user is  owner of the parent domain
-					$domain_backup = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_backup WHERE backup_id = ".$backup_id);
-					
-                    $check_perm = 'u';
-                    if($_GET['backup_action'] == 'download') $check_perm = 'r'; // only check read permissions on download, not update permissions
-                    
-					$get_domain = $app->db->queryOneRecord("SELECT domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($domain_backup["parent_domain_id"])." AND ".$app->tform->getAuthSQL($check_perm));
-					if(empty($get_domain) || !$get_domain) {
-						$app->error($app->tform->lng('no_domain_perm'));
-					}
-					
-					if($_GET['backup_action'] == 'download' && $backup_id > 0) {
-						$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_download' AND action_param = '$backup_id'";
-						$tmp = $app->db->queryOneRecord($sql);
-						if($tmp['number'] == 0) {
-							$message .= $wb['download_info_txt'];
-							$sql = 	"INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-								"VALUES (".
-								(int)$this->form->dataRecord['server_id'] . ", " .
-								time() . ", " .
-								"'backup_download', " .
-								"'".$backup_id."', " .
-								"'pending', " .
-								"''" .
-								")";
-							$app->db->query($sql);
-						} else {
-							$error .= $wb['download_pending_txt'];
-						}
-					}
-					if($_GET['backup_action'] == 'restore' && $backup_id > 0) {
-						$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = '$backup_id'";
-						$tmp = $app->db->queryOneRecord($sql);
-						if($tmp['number'] == 0) {
-							$message .= $wb['restore_info_txt'];
-							$sql = 	"INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-								"VALUES (".
-								(int)$this->form->dataRecord['server_id'] . ", " .
-								time() . ", " .
-								"'backup_restore', " .
-								"'".$backup_id."', " .
-								"'pending', " .
-								"''" .
-								")";
-						$app->db->query($sql);
-						} else {
-							$error .= $wb['restore_pending_txt'];
-						}
-					}
-					
+		global $app;
+
+		$listTpl = new tpl;
+		$listTpl->newTemplate('templates/web_backup_list.htm');
+
+		//* Loading language file
+		$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_backup_list.lng";
+		include $lng_file;
+		$listTpl->setVar($wb);
+
+		$message = '';
+		$error = '';
+
+		if(isset($_GET['backup_action'])) {
+			$backup_id = $app->functions->intval($_GET['backup_id']);
+
+			//* check if the user is  owner of the parent domain
+			$domain_backup = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_backup WHERE backup_id = ".$backup_id);
+
+			$check_perm = 'u';
+			if($_GET['backup_action'] == 'download') $check_perm = 'r'; // only check read permissions on download, not update permissions
+
+			$get_domain = $app->db->queryOneRecord("SELECT domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($domain_backup["parent_domain_id"])." AND ".$app->tform->getAuthSQL($check_perm));
+			if(empty($get_domain) || !$get_domain) {
+				$app->error($app->tform->lng('no_domain_perm'));
+			}
+
+			if($_GET['backup_action'] == 'download' && $backup_id > 0) {
+				$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_download' AND action_param = '$backup_id'";
+				$tmp = $app->db->queryOneRecord($sql);
+				if($tmp['number'] == 0) {
+					$message .= $wb['download_info_txt'];
+					$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
+						"VALUES (".
+						(int)$this->form->dataRecord['server_id'] . ", " .
+						time() . ", " .
+						"'backup_download', " .
+						"'".$backup_id."', " .
+						"'pending', " .
+						"''" .
+						")";
+					$app->db->query($sql);
+				} else {
+					$error .= $wb['download_pending_txt'];
 				}
-				
-				//* Get the data
-				$web = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$this->form->id);
-				$sql = "SELECT * FROM web_backup WHERE parent_domain_id = ".$this->form->id." AND server_id = ".$web['server_id']." ORDER BY tstamp DESC, backup_type ASC";
-                $records = $app->db->queryAllRecords($sql);
+			}
+			if($_GET['backup_action'] == 'restore' && $backup_id > 0) {
+				$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = '$backup_id'";
+				$tmp = $app->db->queryOneRecord($sql);
+				if($tmp['number'] == 0) {
+					$message .= $wb['restore_info_txt'];
+					$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
+						"VALUES (".
+						(int)$this->form->dataRecord['server_id'] . ", " .
+						time() . ", " .
+						"'backup_restore', " .
+						"'".$backup_id."', " .
+						"'pending', " .
+						"''" .
+						")";
+					$app->db->query($sql);
+				} else {
+					$error .= $wb['restore_pending_txt'];
+				}
+			}
 
-                $bgcolor = "#FFFFFF";
-                if(is_array($records)) {
-                        foreach($records as $rec) {
+		}
 
-                                // Change of color
-                                $bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
-                                $rec["bgcolor"] = $bgcolor;
-								
-								$rec['date'] = date($app->lng('conf_format_datetime'),$rec['tstamp']);
-								$rec['backup_type'] = $wb[('backup_type_'.$rec['backup_type'])];
+		//* Get the data
+		$web = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$this->form->id);
+		$sql = "SELECT * FROM web_backup WHERE parent_domain_id = ".$this->form->id." AND server_id = ".$web['server_id']." ORDER BY tstamp DESC, backup_type ASC";
+		$records = $app->db->queryAllRecords($sql);
 
-                                $records_new[] = $rec;
-                        }
-                }
+		$bgcolor = "#FFFFFF";
+		if(is_array($records)) {
+			foreach($records as $rec) {
 
-                $listTpl->setLoop('records',@$records_new);
-				
-				$listTpl->setVar('parent_id',$this->form->id);
-				$listTpl->setVar('msg',$message);
-				$listTpl->setVar('error',$error);
-				
-				// Setting Returnto information in the session
-                $list_name = 'backup_list';
-                // $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
-				$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
-				$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
-                $_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
-                $_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
-                $_SESSION["s"]["form"]["return_to"] = $list_name;
-				
-				return $listTpl->grab();
-        }
-		
+				// Change of color
+				$bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
+				$rec["bgcolor"] = $bgcolor;
+
+				$rec['date'] = date($app->lng('conf_format_datetime'), $rec['tstamp']);
+				$rec['backup_type'] = $wb[('backup_type_'.$rec['backup_type'])];
+
+				$records_new[] = $rec;
+			}
+		}
+
+		$listTpl->setLoop('records', @$records_new);
+
+		$listTpl->setVar('parent_id', $this->form->id);
+		$listTpl->setVar('msg', $message);
+		$listTpl->setVar('error', $error);
+
+		// Setting Returnto information in the session
+		$list_name = 'backup_list';
+		// $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
+		$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
+		$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
+		$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
+		$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
+		$_SESSION["s"]["form"]["return_to"] = $list_name;
+
+		return $listTpl->grab();
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/plugin_base.inc.php b/interface/lib/classes/plugin_base.inc.php
index 5b69e03..92b8744 100644
--- a/interface/lib/classes/plugin_base.inc.php
+++ b/interface/lib/classes/plugin_base.inc.php
@@ -29,31 +29,31 @@
 */
 
 class plugin_base {
-	
+
 	var $plugin_name;
 	var $options;
 	var $form;
-	
+
 	function onLoad() {
-	
+
 	}
-	
+
 	function onShow() {
-	
+
 	}
-	
+
 	function onInsert() {
-	
+
 	}
-	
+
 	function onUpdate() {
-	
+
 	}
-	
+
 	function onDelete() {
-	
+
 	}
-	
+
 	function setOptions($plugin_name, $options) {
 		$this->options = $options;
 		$this->plugin_name = $plugin_name;
@@ -61,4 +61,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/plugin_dbhistory.inc.php b/interface/lib/classes/plugin_dbhistory.inc.php
index ebd9e74..c654731 100644
--- a/interface/lib/classes/plugin_dbhistory.inc.php
+++ b/interface/lib/classes/plugin_dbhistory.inc.php
@@ -30,40 +30,41 @@
 
 class plugin_dbhistory extends plugin_base {
 
-        var $module;
-        var $form;
-        var $tab;
-        var $record_id;
-        var $formdef;
-        var $options;
+	var $module;
+	var $form;
+	var $tab;
+	var $record_id;
+	var $formdef;
+	var $options;
 
-        function onShow() {
-		
-			global $app, $conf;
-			
-			$content = '';
-			
-			$db_table = $app->tform->formDef["db_table"];
-			$db_table_idx = $app->tform->formDef["db_table_idx"];
-			$primary_id = $this->form->id;
-			if($_SESSION["s"]["user"]["typ"] == 'admin') {
-				$sql = "SELECT action, tstamp, user, data FROM sys_datalog WHERE dbtable = '".$db_table."' AND dbidx = '".$db_table_idx.":".$primary_id."'";
-			} else {
-				$sql = "SELECT action, tstamp, user, data FROM sys_datalog WHERE user = '".$_SESSION["s"]["user"]["username"]."' dbtable = '".$db_table."' AND dbidx = '".$db_table_idx.":".$primary_id."'";
-			}
-			
-			$records = $app->db->queryAllRecords($sql);
-			if(is_array($records)) {
-				$content .= '<table>';
-				foreach($records as $rec) {
-					$content .= "<tr><td>".date("d.m.Y",$rec["tstamp"])."</td><td>".$rec["user"]."</td></tr>";
-				}
-				$content .= '</table>';
-			}
-			
-			return $content;
+	function onShow() {
 
-        }
+		global $app, $conf;
+
+		$content = '';
+
+		$db_table = $app->tform->formDef["db_table"];
+		$db_table_idx = $app->tform->formDef["db_table_idx"];
+		$primary_id = $this->form->id;
+		if($_SESSION["s"]["user"]["typ"] == 'admin') {
+			$sql = "SELECT action, tstamp, user, data FROM sys_datalog WHERE dbtable = '".$db_table."' AND dbidx = '".$db_table_idx.":".$primary_id."'";
+		} else {
+			$sql = "SELECT action, tstamp, user, data FROM sys_datalog WHERE user = '".$_SESSION["s"]["user"]["username"]."' dbtable = '".$db_table."' AND dbidx = '".$db_table_idx.":".$primary_id."'";
+		}
+
+		$records = $app->db->queryAllRecords($sql);
+		if(is_array($records)) {
+			$content .= '<table>';
+			foreach($records as $rec) {
+				$content .= "<tr><td>".date("d.m.Y", $rec["tstamp"])."</td><td>".$rec["user"]."</td></tr>";
+			}
+			$content .= '</table>';
+		}
+
+		return $content;
+
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/plugin_listview.inc.php b/interface/lib/classes/plugin_listview.inc.php
index 30932b9..e7d576c 100644
--- a/interface/lib/classes/plugin_listview.inc.php
+++ b/interface/lib/classes/plugin_listview.inc.php
@@ -30,153 +30,154 @@
 
 class plugin_listview extends plugin_base {
 
-        var $module;
-        var $form;
-        var $tab;
-        var $record_id;
-        var $formdef;
-        var $options;
+	var $module;
+	var $form;
+	var $tab;
+	var $record_id;
+	var $formdef;
+	var $options;
 
-        function onShow() {
+	function onShow() {
 
-                global $app;
+		global $app;
 
-                $app->uses('listform');
-                $app->listform->loadListDef($this->options["listdef"]);
+		$app->uses('listform');
+		$app->listform->loadListDef($this->options["listdef"]);
 
-                //$app->listform->SQLExtWhere = "type = 'alias'";
+		//$app->listform->SQLExtWhere = "type = 'alias'";
 
-                $listTpl = new tpl;
-                $listTpl->newTemplate('templates/'.$app->listform->listDef["name"].'_list.htm');
-				
-				//die(print_r($app->tform_actions));
+		$listTpl = new tpl;
+		$listTpl->newTemplate('templates/'.$app->listform->listDef["name"].'_list.htm');
 
-                // Changing some of the list values to reflect that the list is called within a tform page
-                $app->listform->listDef["file"] = $app->tform->formDef["action"];
-                // $app->listform->listDef["page_params"] = "&id=".$app->tform_actions->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
-				$app->listform->listDef["page_params"] = "&id=".$this->form->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
-				$listTpl->setVar('parent_id',$this->form->id);
-				$listTpl->setVar('theme', $_SESSION['s']['theme']);
+		//die(print_r($app->tform_actions));
 
-                // Generate the SQL for searching
-                $sql_where = "";
-                if($app->listform->listDef["auth"] != 'no') {
-                        if($_SESSION["s"]["user"]["typ"] != "admin") {
+		// Changing some of the list values to reflect that the list is called within a tform page
+		$app->listform->listDef["file"] = $app->tform->formDef["action"];
+		// $app->listform->listDef["page_params"] = "&id=".$app->tform_actions->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
+		$app->listform->listDef["page_params"] = "&id=".$this->form->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
+		$listTpl->setVar('parent_id', $this->form->id);
+		$listTpl->setVar('theme', $_SESSION['s']['theme']);
+
+		// Generate the SQL for searching
+		$sql_where = "";
+		if($app->listform->listDef["auth"] != 'no') {
+			if($_SESSION["s"]["user"]["typ"] != "admin") {
 				$sql_where = $app->tform->getAuthSQL('r')." and";
-                        }
-                }
+			}
+		}
 
-                if($this->options["sqlextwhere"] != '') {
-                        $sql_where .= " ".$this->options["sqlextwhere"]." and";
-                }
+		if($this->options["sqlextwhere"] != '') {
+			$sql_where .= " ".$this->options["sqlextwhere"]." and";
+		}
 
-                $sql_where = $app->listform->getSearchSQL($sql_where);
-                $listTpl->setVar($app->listform->searchValues);
+		$sql_where = $app->listform->getSearchSQL($sql_where);
+		$listTpl->setVar($app->listform->searchValues);
 
-                // Generate SQL for paging
-                $limit_sql = $app->listform->getPagingSQL($sql_where);
-                $listTpl->setVar("paging",$app->listform->pagingHTML);
-				
-				$sql_order_by = '';
-				if(isset($this->options["sql_order_by"])) {
-					$sql_order_by = $this->options["sql_order_by"];
-				}
+		// Generate SQL for paging
+		$limit_sql = $app->listform->getPagingSQL($sql_where);
+		$listTpl->setVar("paging", $app->listform->pagingHTML);
+
+		$sql_order_by = '';
+		if(isset($this->options["sql_order_by"])) {
+			$sql_order_by = $this->options["sql_order_by"];
+		}
 
 		//* Limit each page
-		$limits = array('5'=>'5','15'=>'15','25'=>'25','50'=>'50','100'=>'100','999999999' => 'all');
+		$limits = array('5'=>'5', '15'=>'15', '25'=>'25', '50'=>'50', '100'=>'100', '999999999' => 'all');
 
 		//* create options and set selected, if default -> 15 is selected
 		$options='';
 		foreach($limits as $key => $val){
-		  $options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
+			$options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
 		}
-		$listTpl->setVar('search_limit','<select name="search_limit" style="width:50px">'.$options.'</select>');
+		$listTpl->setVar('search_limit', '<select name="search_limit" style="width:50px">'.$options.'</select>');
 
 
 		//Sorting
 		if(!isset($_SESSION['search'][$app->listform->listDef["name"]]['order'])){
-		  $_SESSION['search'][$app->listform->listDef["name"]]['order'] = '';
+			$_SESSION['search'][$app->listform->listDef["name"]]['order'] = '';
 		}
 
 		if(!empty($_GET['orderby'])){
-		  $order = str_replace('tbl_col_','',$_GET['orderby']);
-		  //* Check the css class submited value
-		  if (preg_match("/^[a-z\_]{1,}$/",$order)) {
-		    if($_SESSION['search'][$app->listform->listDef["name"]]['order'] == $order){
-		      $_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order.' DESC';
-		    } else {
-		      $_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order;
-		    }
-		  }
+			$order = str_replace('tbl_col_', '', $_GET['orderby']);
+			//* Check the css class submited value
+			if (preg_match("/^[a-z\_]{1,}$/", $order)) {
+				if($_SESSION['search'][$app->listform->listDef["name"]]['order'] == $order){
+					$_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order.' DESC';
+				} else {
+					$_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order;
+				}
+			}
 		}
 
 		// If a manuel oder by like customers isset the sorting will be infront
 		if(!empty($_SESSION['search'][$app->listform->listDef["name"]]['order'])){
-		  if(empty($sql_order_by)){
-		    $sql_order_by = "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'];
-		  } else {
-		    $sql_order_by = str_replace("ORDER BY ","ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'].', ',$sql_order_by);
-		  }
+			if(empty($sql_order_by)){
+				$sql_order_by = "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'];
+			} else {
+				$sql_order_by = str_replace("ORDER BY ", "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'].', ', $sql_order_by);
+			}
 		}
-		
-				// Loading language field
-                $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
-                include($lng_file);
-                $listTpl->setVar($wb);
-				
 
-                // Get the data
-                $records = $app->db->queryAllRecords("SELECT * FROM ".$app->listform->listDef["table"]." WHERE $sql_where $sql_order_by $limit_sql");
+		// Loading language field
+		$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
+		include $lng_file;
+		$listTpl->setVar($wb);
 
-                $bgcolor = "#FFFFFF";
-                if(is_array($records)) {
-                        $idx_key = $app->listform->listDef["table_idx"];
-                        foreach($records as $rec) {
 
-                                $rec = $app->listform->decode($rec);
+		// Get the data
+		$records = $app->db->queryAllRecords("SELECT * FROM ".$app->listform->listDef["table"]." WHERE $sql_where $sql_order_by $limit_sql");
 
-                                // Change of color
-                                $bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
-                                $rec["bgcolor"] = $bgcolor;
-								
-								// substitute value for select fields
-								foreach($app->listform->listDef["item"] as $field) {
-									$key = $field["field"];
-									if($field['formtype'] == "SELECT") {
-										if(strtolower($rec[$key]) == 'y' or strtolower($rec[$key]) == 'n') {
-											// Set a additional image variable for bolean fields
-											$rec['_'.$key.'_'] = (strtolower($rec[$key]) == 'y')?'x16/tick_circle.png':'x16/cross_circle.png';
-										}
-										//* substitute value for select field
-										@$rec[$key] = $field['value'][$rec[$key]];
-									}
-									// Create a lowercase version of every item
-									$rec[$key.'_lowercase'] = strtolower($rec[$key]);
-								}
+		$bgcolor = "#FFFFFF";
+		if(is_array($records)) {
+			$idx_key = $app->listform->listDef["table_idx"];
+			foreach($records as $rec) {
 
-                                // The variable "id" contains always the index field
-                                $rec["id"] = $rec[$idx_key];
-								$rec["delete_confirmation"] = $wb['delete_confirmation'];
+				$rec = $app->listform->decode($rec);
 
-                                $records_new[] = $rec;
-                        }
-                }
+				// Change of color
+				$bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
+				$rec["bgcolor"] = $bgcolor;
 
-                $listTpl->setLoop('records',@$records_new);
+				// substitute value for select fields
+				foreach($app->listform->listDef["item"] as $field) {
+					$key = $field["field"];
+					if($field['formtype'] == "SELECT") {
+						if(strtolower($rec[$key]) == 'y' or strtolower($rec[$key]) == 'n') {
+							// Set a additional image variable for bolean fields
+							$rec['_'.$key.'_'] = (strtolower($rec[$key]) == 'y')?'x16/tick_circle.png':'x16/cross_circle.png';
+						}
+						//* substitute value for select field
+						@$rec[$key] = $field['value'][$rec[$key]];
+					}
+					// Create a lowercase version of every item
+					$rec[$key.'_lowercase'] = strtolower($rec[$key]);
+				}
 
-                // Setting Returnto information in the session
-                $list_name = $app->listform->listDef["name"];
-                // $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
-				$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
-				$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
-                $_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
-                $_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
-                $_SESSION["s"]["form"]["return_to"] = $list_name;
-				//die(print_r($_SESSION["s"]["list"][$list_name]));
+				// The variable "id" contains always the index field
+				$rec["id"] = $rec[$idx_key];
+				$rec["delete_confirmation"] = $wb['delete_confirmation'];
 
-                return $listTpl->grab();
+				$records_new[] = $rec;
+			}
+		}
 
-        }
+		$listTpl->setLoop('records', @$records_new);
+
+		// Setting Returnto information in the session
+		$list_name = $app->listform->listDef["name"];
+		// $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
+		$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
+		$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
+		$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
+		$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
+		$_SESSION["s"]["form"]["return_to"] = $list_name;
+		//die(print_r($_SESSION["s"]["list"][$list_name]));
+
+		return $listTpl->grab();
+
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 55759f4..bcd4665 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -35,38 +35,38 @@
 */
 
 class remoting {
-	
+
 	//* remote session timeout in seconds
 	private $session_timeout = 600;
-	
+
 	protected $server;
 	public $oldDataRecord;
 	public $dataRecord;
 	public $id;
-	
+
 	/*
-	These variables shall stay global. 
+	These variables shall stay global.
 	Please do not make them private variables.
-    
+
 	private $app;
     private $conf;
     */
 
-    public function __construct()
-    {
-        global $server;
-        $this->server = $server;
+	public function __construct()
+	{
+		global $server;
+		$this->server = $server;
 		/*
         $this->app = $app;
         $this->conf = $conf;
 		*/
-    }
+	}
 
 	//* remote login function
 	public function login($username, $password)
-    {
+	{
 		global $app, $conf, $server;
-		
+
 		// Maintenance mode
 		$app->uses('ini_parser,getconf');
 		$server_config_array = $app->getconf->get_global_config('misc');
@@ -74,134 +74,136 @@
 			$this->server->fault('maintenance_mode', 'This ISPConfig installation is currently under maintenance. We should be back shortly. Thank you for your patience.');
 			return false;
 		}
-		
+
 		if(empty($username)) {
 			$this->server->fault('login_username_empty', 'The login username is empty.');
 			return false;
 		}
-		
+
 		if(empty($password)) {
 			$this->server->fault('login_password_empty', 'The login password is empty.');
 			return false;
 		}
-		
+
 		//* Delete old remoting sessions
 		$sql = "DELETE FROM remote_session WHERE tstamp < ".time();
 		$app->db->query($sql);
-		
+
 		$username = $app->db->quote($username);
 		$password = $app->db->quote($password);
-		
+
 		$sql = "SELECT * FROM remote_user WHERE remote_username = '$username' and remote_password = md5('$password')";
 		$remote_user = $app->db->queryOneRecord($sql);
 		if($remote_user['remote_userid'] > 0) {
 			//* Create a remote user session
-			srand ((double)microtime()*1000000);
+			srand((double)microtime()*1000000);
 			$remote_session = md5(rand());
 			$remote_userid = $remote_user['remote_userid'];
 			$remote_functions = $remote_user['remote_functions'];
 			$tstamp = time() + $this->session_timeout;
 			$sql = 'INSERT INTO remote_session (remote_session,remote_userid,remote_functions,tstamp'
-                   .') VALUES ('
-                   ." '$remote_session',$remote_userid,'$remote_functions',$tstamp)";
+				.') VALUES ('
+				." '$remote_session',$remote_userid,'$remote_functions',$tstamp)";
 			$app->db->query($sql);
 			return $remote_session;
 		} else {
 			$this->server->fault('login_failed', 'The login failed. Username or password wrong.');
 			return false;
 		}
-		
+
 	}
-	
+
 	//* remote logout function
 	public function logout($session_id)
-    {		
+	{
 		global $app;
-		
+
 		if(empty($session_id)) {
 			$this->server->fault('session_id_empty', 'The SessionID is empty.');
 			return false;
 		}
-		
+
 		$session_id = $app->db->quote($session_id);
-		
+
 		$sql = "DELETE FROM remote_session WHERE remote_session = '$session_id'";
 		$app->db->query($sql);
-        return ($app->db->affectedRows() == 1);
+		return $app->db->affectedRows() == 1;
 	}
-	
 
-    /**
-	    Gets the server configuration
-	    @param int session id
-	    @param int server id
-	    @param string  section of the config field in the server table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
-	    @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
-    */
-    public function server_get($session_id, $server_id, $section ='') {
-        global $app;        
-        if(!$this->checkPerm($session_id, 'server_get')) {
-            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }
-        if (!empty($session_id) && !empty($server_id)) {    
-            $app->uses('remoting_lib , getconf');        
-            $section_config =  $app->getconf->get_server_config($server_id,$section);        
-            return $section_config;
-        } else {
-            return false;
-        }
-    }
-	
-	public function server_get_serverid_by_ip($session_id, $ipaddress)
-    {
-        global $app;
-		if(!$this->checkPerm($session_id, 'server_get_serverid_by_ip')) {
-        	$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+
+	/**
+	 Gets the server configuration
+	 @param int session id
+	 @param int server id
+	 @param string  section of the config field in the server table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
+	 @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 */
+
+
+	public function server_get($session_id, $server_id, $section ='') {
+		global $app;
+		if(!$this->checkPerm($session_id, 'server_get')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        $sql = "SELECT server_id FROM server_ip WHERE ip_address  = '$ipaddress' LIMIT 1 ";
-        $all = $app->db->queryAllRecords($sql);
-        return $all;
+		if (!empty($session_id) && !empty($server_id)) {
+			$app->uses('remoting_lib , getconf');
+			$section_config =  $app->getconf->get_server_config($server_id, $section);
+			return $section_config;
+		} else {
+			return false;
+		}
 	}
-	
+
+	public function server_get_serverid_by_ip($session_id, $ipaddress)
+	{
+		global $app;
+		if(!$this->checkPerm($session_id, 'server_get_serverid_by_ip')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$sql = "SELECT server_id FROM server_ip WHERE ip_address  = '$ipaddress' LIMIT 1 ";
+		$all = $app->db->queryAllRecords($sql);
+		return $all;
+	}
+
 	//* Add a IP address record
 	public function server_ip_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'server_ip_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../admin/form/server_ip.tform.php',$client_id,$params);
+		return $this->insertQuery('../admin/form/server_ip.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update IP address record
 	public function server_ip_update($session_id, $client_id, $ip_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'server_ip_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../admin/form/server_ip.tform.php',$client_id,$ip_id,$params);
+		$affected_rows = $this->updateQuery('../admin/form/server_ip.tform.php', $client_id, $ip_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete IP address record
 	public function server_ip_delete($session_id, $ip_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'server_ip_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../admin/form/server_ip.tform.php',$ip_id);
+		$affected_rows = $this->deleteQuery('../admin/form/server_ip.tform.php', $ip_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get mail domain details
 	public function mail_domain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_domain_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -210,21 +212,21 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_domain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a mail domain
 	public function mail_domain_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_domain_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$primary_id = $this->insertQuery('../mail/form/mail_domain.tform.php',$client_id,$params);
+		$primary_id = $this->insertQuery('../mail/form/mail_domain.tform.php', $client_id, $params);
 		return $primary_id;
 	}
-	
+
 	//* Update a mail domain
 	public function mail_domain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_domain_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -232,10 +234,10 @@
 		$affected_rows = $this->updateQuery('../mail/form/mail_domain.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a mail domain
 	public function mail_domain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_domain_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -243,12 +245,12 @@
 		$affected_rows = $this->deleteQuery('../mail/form/mail_domain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get alias details
 	public function mail_aliasdomain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_aliasdomain_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -257,13 +259,13 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_aliasdomain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* aliasy email
 	public function mail_aliasdomain_add($session_id, $client_id, $params)
 	{
 		if (!$this->checkPerm($session_id, 'mail_aliasdomain_add'))
 		{
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 		$affected_rows = $this->insertQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $params);
@@ -273,31 +275,31 @@
 
 	public function mail_aliasdomain_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_aliasdomain_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_aliasdomain_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 	public function mail_aliasdomain_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_aliasdomain_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_aliasdomain.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_aliasdomain_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_aliasdomain.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get mail mailinglist details
 	public function mail_mailinglist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_mailinglist_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -306,21 +308,21 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_mailinglist.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a mail mailinglist
 	public function mail_mailinglist_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_mailinglist_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$primary_id = $this->insertQuery('../mail/form/mail_mailinglist.tform.php',$client_id,$params);
+		$primary_id = $this->insertQuery('../mail/form/mail_mailinglist.tform.php', $client_id, $params);
 		return $primary_id;
 	}
-	
+
 	//* Update a mail mailinglist
 	public function mail_mailinglist_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_mailinglist_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -328,10 +330,10 @@
 		$affected_rows = $this->updateQuery('../mail/form/mail_mailinglist.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a mail mailinglist
 	public function mail_mailinglist_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_mailinglist_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -339,12 +341,12 @@
 		$affected_rows = $this->deleteQuery('../mail/form/mail_mailinglist.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get mail user details
 	public function mail_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_user_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -353,70 +355,70 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
-	
+
+
 	//* Add mail domain
 	public function mail_user_add($session_id, $client_id, $params){
 		global $app;
-		
+
 		if (!$this->checkPerm($session_id, 'mail_user_add')){
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Check if mail domain exists
-		$email_parts = explode('@',$params['email']);
+		$email_parts = explode('@', $params['email']);
 		$tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$app->db->quote($email_parts[1])."'");
 		if($tmp['domain'] != $email_parts[1]) {
-			$this->server->fault('mail_domain_does_not_exist','Mail domain - '.$email_parts[1].' - does not exist.');
+			$this->server->fault('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.');
 			return false;
 		}
-		
+
 		$affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params);
 		return $affected_rows;
 	}
 
-	//* Update mail user	
+	//* Update mail user
 	public function mail_user_update($session_id, $client_id, $primary_id, $params)
 	{
 		global $app;
-		
+
 		if (!$this->checkPerm($session_id, 'mail_user_update'))
 		{
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Check if mail domain exists
-		$email_parts = explode('@',$params['email']);
+		$email_parts = explode('@', $params['email']);
 		$tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$app->db->quote($email_parts[1])."'");
 		if($tmp['domain'] != $email_parts[1]) {
-			$this->server->fault('mail_domain_does_not_exist','Mail domain - '.$email_parts[1].' - does not exist.');
+			$this->server->fault('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.');
 			return false;
 		}
-		
+
 		$affected_rows = $this->updateQuery('../mail/form/mail_user.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
 
-	
+
 	//* Delete mail user
 	public function mail_user_delete($session_id, $primary_id)
 	{
 		if (!$this->checkPerm($session_id, 'mail_user_delete'))
 		{
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 		$affected_rows = $this->deleteQuery('../mail/form/mail_user.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get mail user filter details
 	public function mail_user_filter_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_user_filter_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -425,15 +427,15 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_user_filter.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	public function mail_user_filter_add($session_id, $client_id, $params)
 	{
 		global $app;
 		if (!$this->checkPerm($session_id, 'mail_user_filter_add')){
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params,'mail:mail_user_filter:on_after_insert');
+		$affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params, 'mail:mail_user_filter:on_after_insert');
 		// $app->plugin->raiseEvent('mail:mail_user_filter:on_after_insert',$this);
 		return $affected_rows;
 	}
@@ -443,10 +445,10 @@
 		global $app;
 		if (!$this->checkPerm($session_id, 'mail_user_filter_update'))
 		{
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params,'mail:mail_user_filter:on_after_update');
+		$affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params, 'mail:mail_user_filter:on_after_update');
 		// $app->plugin->raiseEvent('mail:mail_user_filter:on_after_update',$this);
 		return $affected_rows;
 	}
@@ -456,19 +458,19 @@
 		global $app;
 		if (!$this->checkPerm($session_id, 'mail_user_filter_delete'))
 		{
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id,'mail:mail_user_filter:on_after_delete');
+		$affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id, 'mail:mail_user_filter:on_after_delete');
 		// $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this);
 		return $affected_rows;
 	}
 
 	//* Get alias details
 	public function mail_alias_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_alias_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -477,25 +479,25 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_alias.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* aliasy email
 	public function mail_alias_add($session_id, $client_id, $params)
 	{
 		global $app;
-		
+
 		if (!$this->checkPerm($session_id, 'mail_alias_add'))
 		{
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Check if there is no active mailbox with this address
 		$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($params["source"])."'");
 		if($tmp['number'] > 0) {
-			$this->server->fault('duplicate','There is already a mailbox with this email address.');
+			$this->server->fault('duplicate', 'There is already a mailbox with this email address.');
 		}
 		unset($tmp);
-		
+
 		$affected_rows = $this->insertQuery('../mail/form/mail_alias.tform.php', $client_id, $params);
 		return $affected_rows;
 	}
@@ -504,40 +506,40 @@
 	public function mail_alias_update($session_id, $client_id, $primary_id, $params)
 	{
 		global $app;
-		
+
 		if (!$this->checkPerm($session_id, 'mail_alias_update'))
 		{
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-			
-			//* Check if there is no active mailbox with this address
+
+		//* Check if there is no active mailbox with this address
 		$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($params["source"])."'");
 		if($tmp['number'] > 0) {
-			$this->server->fault('duplicate','There is already a mailbox with this email address.');
+			$this->server->fault('duplicate', 'There is already a mailbox with this email address.');
 		}
 		unset($tmp);
-			
+
 		$affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
 
 	public function mail_alias_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_alias_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_alias.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_alias_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_alias.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get mail forwarding details
 	public function mail_forward_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_forward_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -546,48 +548,48 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_forward.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
- 	//* przekierowania email
+
+	//* przekierowania email
 	public function mail_forward_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_forward_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_forward_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_forward_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_forward_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_forward.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_forward_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_forward.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_forward_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_forward_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_forward_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get catchall details
 	public function mail_catchall_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_catchall_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -598,44 +600,44 @@
 	}
 
 	//* catchall e-mail
- 	public function mail_catchall_add($session_id, $client_id, $params)
+	public function mail_catchall_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_catchall_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_catchall_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 	public function mail_catchall_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_catchall_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_catchall_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 	public function mail_catchall_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_catchall_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_domain_catchall.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_catchall_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_domain_catchall.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get transport details
 	public function mail_transport_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_transport_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -644,48 +646,48 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_transport.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* przeniesienia e-mail
 	public function mail_transport_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_transport_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_transport_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_transport_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_transport_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_transport.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_transport_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_transport.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_transport_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_transport_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_transport.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_transport_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_transport.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get spamfilter whitelist details
 	public function mail_spamfilter_whitelist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -695,47 +697,47 @@
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
 
- 	//* biała lista e-mail
+	//* biała lista e-mail
 	public function mail_spamfilter_whitelist_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_whitelist_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_whitelist_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/spamfilter_whitelist.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/spamfilter_whitelist.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get spamfilter blacklist details
 	public function mail_spamfilter_blacklist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -744,48 +746,48 @@
 		$app->remoting_lib->loadFormDef('../mail/form/spamfilter_blacklist.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
- 	//* czarna lista e-mail
+
+	//* czarna lista e-mail
 	public function mail_spamfilter_blacklist_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_blacklist_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_blacklist_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/spamfilter_blacklist.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/spamfilter_blacklist.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get spamfilter user details
 	public function mail_spamfilter_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_spamfilter_user_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -798,44 +800,44 @@
 	//* filtr spamu użytkowników e-mail
 	public function mail_spamfilter_user_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_user_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_user_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_user_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_user_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/spamfilter_users.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_user_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/spamfilter_users.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_user_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_user_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/spamfilter_users.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_user_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/spamfilter_users.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get policy details
 	public function mail_policy_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_policy_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -844,48 +846,48 @@
 		$app->remoting_lib->loadFormDef('../mail/form/spamfilter_policy.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
- 	//* polityki filtrów spamu e-mail
+
+	//* polityki filtrów spamu e-mail
 	public function mail_policy_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_policy_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_policy_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_policy_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_policy_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_policy_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_policy_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_policy_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/spamfilter_policy.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_policy_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/spamfilter_policy.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get fetchmail details
 	public function mail_fetchmail_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_fetchmail_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -895,47 +897,47 @@
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
 
-	 //* fetchmail
+	//* fetchmail
 	public function mail_fetchmail_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_fetchmail_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_fetchmail_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_fetchmail_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_fetchmail_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_get.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_fetchmail_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_get.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_fetchmail_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_fetchmail_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_get.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_fetchmail_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_get.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get whitelist details
 	public function mail_whitelist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_whitelist_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -944,48 +946,48 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_whitelist.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* wpisy białej listy
 	public function mail_whitelist_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_whitelist_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_whitelist_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_whitelist_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_whitelist_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_whitelist.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_whitelist_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_whitelist.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_whitelist_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_whitelist_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_whitelist.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_whitelist_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_whitelist.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get Blacklist details
 	public function mail_blacklist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_blacklist_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -994,48 +996,48 @@
 		$app->remoting_lib->loadFormDef('../mail/form/mail_blacklist.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* wpisy białej listy
 	public function mail_blacklist_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_blacklist_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_blacklist_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_blacklist_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_blacklist_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_blacklist.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_blacklist_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_blacklist.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_blacklist_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_blacklist_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_blacklist.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_blacklist_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_blacklist.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get filter details
 	public function mail_filter_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_filter_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1048,55 +1050,55 @@
 	//* wpisy filtrow e-mail
 	public function mail_filter_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_filter_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_filter_add'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_filter_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_filter_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_filter_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_filter_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_filter_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_filter_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php', $primary_id);
+		return $affected_rows;
 	}
 
 
 
 
-/* 
- * 
- * 
- * 
+	/*
+ *
+ *
+ *
  * 	 * Client functions
- * 
- * 
+ *
+ *
  */
 	//* Get client details
 	public function client_get($session_id, $client_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'client_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1104,51 +1106,51 @@
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../client/form/client.tform.php');
 		$data = $app->remoting_lib->getDataRecord($client_id);
-        
-        // we need to get the new-style templates for backwards-compatibility - maybe we remove this in a later version
-        if(is_array($data) && count($data) > 0) {
-            if(isset($data['client_id'])) {
-                // this is a single record
-                if($data['template_additional'] == '') {
-                    $tpls = $app->db->queryAllRecords('SELECT CONCAT(`assigned_template_id`, \':\', `client_template_id`) as `item` FROM `client_template_assigned` WHERE `client_id` = ' . $data['client_id']);
-                    $tpl_arr = array();
-                    if($tpls) {
-                        foreach($tpls as $tpl) $tpl_arr[] = $tpl['item'];
-                    }
-                    $data['template_additional'] = implode('/', $tpl_arr);
-                    unset($tpl_arr);
-                    unset($tpls);
-                }
-            } elseif(isset($data[0]['client_id'])) {
-                // multiple client records
-                foreach($data as $index => $client) {
-                    if($client['template_additional'] == '') {
-                        $tpls = $app->db->queryAllRecords('SELECT CONCAT(`assigned_template_id`, \':\', `client_template_id`) as `item` FROM `client_template_assigned` WHERE `client_id` = ' . $client['client_id']);
-                        $tpl_arr = array();
-                        if($tpls) {
-                            foreach($tpls as $tpl) $tpl_arr[] = $tpl['item'];
-                        }
-                        $data[$index]['template_additional'] = implode('/', $tpl_arr); // dont use the $client array here - changes would not be returned to soap
-                    }
-                    unset($tpl_arr);
-                    unset($tpls);
-                }
-            }
-        }
-        
-        return $data;
+
+		// we need to get the new-style templates for backwards-compatibility - maybe we remove this in a later version
+		if(is_array($data) && count($data) > 0) {
+			if(isset($data['client_id'])) {
+				// this is a single record
+				if($data['template_additional'] == '') {
+					$tpls = $app->db->queryAllRecords('SELECT CONCAT(`assigned_template_id`, \':\', `client_template_id`) as `item` FROM `client_template_assigned` WHERE `client_id` = ' . $data['client_id']);
+					$tpl_arr = array();
+					if($tpls) {
+						foreach($tpls as $tpl) $tpl_arr[] = $tpl['item'];
+					}
+					$data['template_additional'] = implode('/', $tpl_arr);
+					unset($tpl_arr);
+					unset($tpls);
+				}
+			} elseif(isset($data[0]['client_id'])) {
+				// multiple client records
+				foreach($data as $index => $client) {
+					if($client['template_additional'] == '') {
+						$tpls = $app->db->queryAllRecords('SELECT CONCAT(`assigned_template_id`, \':\', `client_template_id`) as `item` FROM `client_template_assigned` WHERE `client_id` = ' . $client['client_id']);
+						$tpl_arr = array();
+						if($tpls) {
+							foreach($tpls as $tpl) $tpl_arr[] = $tpl['item'];
+						}
+						$data[$index]['template_additional'] = implode('/', $tpl_arr); // dont use the $client array here - changes would not be returned to soap
+					}
+					unset($tpl_arr);
+					unset($tpls);
+				}
+			}
+		}
+
+		return $data;
 	}
-	
+
 	public function client_get_id($session_id, $sys_userid)
-    {
+	{
 		global $app;
 		if(!$this->checkPerm($session_id, 'client_get_id')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$sys_userid = $app->functions->intval($sys_userid);
-		
+
 		$rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid);
 		if(isset($rec['client_id'])) {
 			return $app->functions->intval($rec['client_id']);
@@ -1156,19 +1158,19 @@
 			$this->server->fault('no_client_found', 'There is no sysuser account for this client ID.');
 			return false;
 		}
-		
+
 	}
-	
+
 	public function client_get_groupid($session_id, $client_id)
-    {
+	{
 		global $app;
 		if(!$this->checkPerm($session_id, 'client_get_id')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$client_id = $app->functions->intval($client_id);
-		
+
 		$rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client_id);
 		if(isset($rec['groupid'])) {
 			return $app->functions->intval($rec['groupid']);
@@ -1176,228 +1178,228 @@
 			$this->server->fault('no_group_found', 'There is no group for this client ID.');
 			return false;
 		}
-		
+
 	}
-	
-	
+
+
 	public function client_add($session_id, $reseller_id, $params)
 	{
 		if (!$this->checkPerm($session_id, 'client_add'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-        if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
-		$affected_rows = $this->klientadd('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php',$reseller_id, $params);
-		return $affected_rows;  
-				  
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
+		$affected_rows = $this->klientadd('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $params);
+		return $affected_rows;
+
 	}
-	
+
 	public function client_update($session_id, $client_id, $reseller_id, $params)
 	{
-			global $app;
-			
-			if (!$this->checkPerm($session_id, 'client_update'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-            
-            $app->uses('remoting_lib');
-            $app->remoting_lib->loadFormDef('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php');
-            $old_rec = $app->remoting_lib->getDataRecord($client_id);
-            
-            // we need the previuos templates assigned here
-            $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);
-            if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
-                // check previous type of storing templates
-                $tpls = explode('/', $old_rec['template_additional']);
-                $this->oldTemplatesAssigned = array();
-                foreach($tpls as $item) {
-                    $item = trim($item);
-                    if(!$item) continue;
-                    $this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $client_id);
-                }
-                unset($tpls);
-            }
-            if(isset($params['template_additional'])) {
-                $app->uses('client_templates');
-                $templates = explode('/', $params['template_additional']);
-                $params['template_additional'] = '';
-                $app->client_templates->update_client_templates($client_id, $templates);
-                unset($templates);
-            }
+		global $app;
 
-            
-            if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
-			$affected_rows = $this->updateQuery('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params, 'client:' . ($reseller_id ? 'reseller' : 'client') . ':on_after_update');
-			
-			$app->remoting_lib->ispconfig_sysuser_update($params,$client_id);
-			
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'client_update'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+
+		$app->uses('remoting_lib');
+		$app->remoting_lib->loadFormDef('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php');
+		$old_rec = $app->remoting_lib->getDataRecord($client_id);
+
+		// we need the previuos templates assigned here
+		$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);
+		if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
+			// check previous type of storing templates
+			$tpls = explode('/', $old_rec['template_additional']);
+			$this->oldTemplatesAssigned = array();
+			foreach($tpls as $item) {
+				$item = trim($item);
+				if(!$item) continue;
+				$this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $client_id);
+			}
+			unset($tpls);
+		}
+		if(isset($params['template_additional'])) {
+			$app->uses('client_templates');
+			$templates = explode('/', $params['template_additional']);
+			$params['template_additional'] = '';
+			$app->client_templates->update_client_templates($client_id, $templates);
+			unset($templates);
+		}
+
+
+		if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
+		$affected_rows = $this->updateQuery('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params, 'client:' . ($reseller_id ? 'reseller' : 'client') . ':on_after_update');
+
+		$app->remoting_lib->ispconfig_sysuser_update($params, $client_id);
+
+		return $affected_rows;
 	}
-    
-    public function client_template_additional_get($session_id, $client_id) {
-        global $app;
+
+	public function client_template_additional_get($session_id, $client_id) {
+		global $app;
 
 		if(!$this->checkPerm($session_id, 'client_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
-        if(@is_numeric($client_id)) {
-            $sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ".$client_id;
-            return $app->db->queryOneRecord($sql);
-        } else {
-            $this->server->fault('The ID must be an integer.');
-            return array();
-        }
-    }
-    
-    private function _set_client_formdata($client_id) {
-        global $app;
-        
-        $this->id = $client_id;
-        $this->dataRecord = $app->db->queryOneRecord('SELECT * FROM `client` WHERE `client_id` = ' . $client_id);
-        $this->oldDataRecord = $this->dataRecord;
-        
-        $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);
-        if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
-            // check previous type of storing templates
-            $tpls = explode('/', $this->oldDataRecord['template_additional']);
-            $this->oldTemplatesAssigned = array();
-            foreach($tpls as $item) {
-                $item = trim($item);
-                if(!$item) continue;
-                $this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $client_id);
-            }
-            unset($tpls);
-        }
-    }
-    
-    public function client_template_additional_add($session_id, $client_id, $template_id) {
-        global $app;
-        
-		if(!$this->checkPerm($session_id, 'client_update')) {
-			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-			return false;
-		}
-        
-        if(@is_numeric($client_id) && @is_numeric($template_id)) {
-            // check if client exists
-            $check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ' . $client_id);
-            if(!$check) {
-                $this->server->fault('Invalid client');
-                return false;
-            }
-            // check if template exists
-            $check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ' . $template_id);
-            if(!$check) {
-                $this->server->fault('Invalid template');
-                return false;
-            }
-            
-            // for the update event we have to cheat a bit
-            $this->_set_client_formdata($client_id);
-            
-            $sql = "INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (" . $client_id . ", " . $template_id . ")";
-            $app->db->query($sql);
-            $insert_id = $app->db->insertID();
-            
-            $app->plugin->raiseEvent('client:client:on_after_update',$this);
-            
-            return $insert_id;
-        } else {
-            $this->server->fault('The IDs must be of type integer.');
-            return false;
-        }
-    }
 
-    public function client_template_additional_delete($session_id, $client_id, $assigned_template_id) {
-        global $app;
-        
-		if(!$this->checkPerm($session_id, 'client_update')) {
-			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-			return false;
+		if(@is_numeric($client_id)) {
+			$sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ".$client_id;
+			return $app->db->queryOneRecord($sql);
+		} else {
+			$this->server->fault('The ID must be an integer.');
+			return array();
 		}
-        
-        if(@is_numeric($client_id) && @is_numeric($template_id)) {
-            // check if client exists
-            $check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ' . $client_id);
-            if(!$check) {
-                $this->server->fault('Invalid client');
-                return false;
-            }
-            // check if template exists
-            $check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `assigned_template_id` = ' . $assigned_template_id);
-            if(!$check) {
-                $this->server->fault('Invalid template');
-                return false;
-            }
-            
-            // for the update event we have to cheat a bit
-            $this->_set_client_formdata($client_id);
-            
-            $sql = "DELETE FROM `client_template_assigned` WHERE `assigned_template_id` = " . $template_id . " AND `client_id` = " . $client_id;
-            $app->db->query($sql);
-            $affected_rows = $app->db->affectedRows();
-            
-            $app->plugin->raiseEvent('client:client:on_after_update',$this);
-            
-            return $affected_rows;
-        } else {
-            $this->server->fault('The IDs must be of type integer.');
-            return false;
-        }
-    }
-
-	public function client_delete($session_id,$client_id)
-	{
-			global $app;
-			
-			if (!$this->checkPerm($session_id, 'client_delete'))
-			{
-					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../client/form/client.tform.php',$client_id);
-			
-			$app->remoting_lib->ispconfig_sysuser_delete($client_id);
-			
-			return $affected_rows;
 	}
-	
-	// -----------------------------------------------------------------------------------------------
-	
-	public function client_delete_everything($session_id, $client_id)
-    {
-        global $app, $conf;
-		
-		if(!$this->checkPerm($session_id, 'client_delete_everything')) {
-        	$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+
+	private function _set_client_formdata($client_id) {
+		global $app;
+
+		$this->id = $client_id;
+		$this->dataRecord = $app->db->queryOneRecord('SELECT * FROM `client` WHERE `client_id` = ' . $client_id);
+		$this->oldDataRecord = $this->dataRecord;
+
+		$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);
+		if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
+			// check previous type of storing templates
+			$tpls = explode('/', $this->oldDataRecord['template_additional']);
+			$this->oldTemplatesAssigned = array();
+			foreach($tpls as $item) {
+				$item = trim($item);
+				if(!$item) continue;
+				$this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $client_id);
+			}
+			unset($tpls);
 		}
-        
+	}
+
+	public function client_template_additional_add($session_id, $client_id, $template_id) {
+		global $app;
+
+		if(!$this->checkPerm($session_id, 'client_update')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+
+		if(@is_numeric($client_id) && @is_numeric($template_id)) {
+			// check if client exists
+			$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ' . $client_id);
+			if(!$check) {
+				$this->server->fault('Invalid client');
+				return false;
+			}
+			// check if template exists
+			$check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ' . $template_id);
+			if(!$check) {
+				$this->server->fault('Invalid template');
+				return false;
+			}
+
+			// for the update event we have to cheat a bit
+			$this->_set_client_formdata($client_id);
+
+			$sql = "INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (" . $client_id . ", " . $template_id . ")";
+			$app->db->query($sql);
+			$insert_id = $app->db->insertID();
+
+			$app->plugin->raiseEvent('client:client:on_after_update', $this);
+
+			return $insert_id;
+		} else {
+			$this->server->fault('The IDs must be of type integer.');
+			return false;
+		}
+	}
+
+	public function client_template_additional_delete($session_id, $client_id, $assigned_template_id) {
+		global $app;
+
+		if(!$this->checkPerm($session_id, 'client_update')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+
+		if(@is_numeric($client_id) && @is_numeric($template_id)) {
+			// check if client exists
+			$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ' . $client_id);
+			if(!$check) {
+				$this->server->fault('Invalid client');
+				return false;
+			}
+			// check if template exists
+			$check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `assigned_template_id` = ' . $assigned_template_id);
+			if(!$check) {
+				$this->server->fault('Invalid template');
+				return false;
+			}
+
+			// for the update event we have to cheat a bit
+			$this->_set_client_formdata($client_id);
+
+			$sql = "DELETE FROM `client_template_assigned` WHERE `assigned_template_id` = " . $template_id . " AND `client_id` = " . $client_id;
+			$app->db->query($sql);
+			$affected_rows = $app->db->affectedRows();
+
+			$app->plugin->raiseEvent('client:client:on_after_update', $this);
+
+			return $affected_rows;
+		} else {
+			$this->server->fault('The IDs must be of type integer.');
+			return false;
+		}
+	}
+
+	public function client_delete($session_id, $client_id)
+	{
+		global $app;
+
+		if (!$this->checkPerm($session_id, 'client_delete'))
+		{
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../client/form/client.tform.php', $client_id);
+
+		$app->remoting_lib->ispconfig_sysuser_delete($client_id);
+
+		return $affected_rows;
+	}
+
+	// -----------------------------------------------------------------------------------------------
+
+	public function client_delete_everything($session_id, $client_id)
+	{
+		global $app, $conf;
+
+		if(!$this->checkPerm($session_id, 'client_delete_everything')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+
 		$client_id = $app->functions->intval($client_id);
 
-		if($client_id > 0) {			
+		if($client_id > 0) {
 			//* remove the group of the client from the resellers group
 			$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
 			$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
 			$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-			$app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']);
-			
+			$app->auth->remove_group_from_user($parent_user['userid'], $client_group['groupid']);
+
 			//* delete the group of the client
 			$app->db->query("DELETE FROM sys_group WHERE client_id = $client_id");
-			
+
 			//* delete the sys user(s) of the client
 			$app->db->query("DELETE FROM sys_user WHERE client_id = $client_id");
-			
+
 			//* Delete all records (sub-clients, mail, web, etc....)  of this client.
 			$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic';
-			$tables_array = explode(',',$tables);
+			$tables_array = explode(',', $tables);
 			$client_group_id = $app->functions->intval($client_group['groupid']);
-			
+
 			if($client_group_id > 1) {
 				foreach($tables_array as $table) {
 					if($table != '') {
@@ -1425,29 +1427,29 @@
 								}
 							}
 						}
-						
+
 					}
 				}
 			}
-			
+
 		}
-        
+
 		if (!$this->checkPerm($session_id, 'client_delete')) {
-			$this->server->fault('permission_denied','You do not have the permissions to access this function.');
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../client/form/client.tform.php',$client_id);
+		$affected_rows = $this->deleteQuery('../client/form/client.tform.php', $client_id);
 
-        return $affected_rows;
+		return $affected_rows;
 	}
-	
+
 	// Website functions ---------------------------------------------------------------------------------------
-	
+
 	//* Get cron details
 	public function sites_cron_get($session_id, $cron_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_cron_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1456,46 +1458,46 @@
 		$app->remoting_lib->loadFormDef('../sites/form/cron.tform.php');
 		return $app->remoting_lib->getDataRecord($cron_id);
 	}
-	
+
 	//* Add a cron record
 	public function sites_cron_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_cron_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/cron.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/cron.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update cron record
 	public function sites_cron_update($session_id, $client_id, $cron_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_cron_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/cron.tform.php',$client_id,$cron_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/cron.tform.php', $client_id, $cron_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete cron record
 	public function sites_cron_delete($session_id, $cron_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_cron_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/cron.tform.php',$cron_id);
+		$affected_rows = $this->deleteQuery('../sites/form/cron.tform.php', $cron_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_database_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_database_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1504,17 +1506,17 @@
 		$app->remoting_lib->loadFormDef('../sites/form/database.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_database_add($session_id, $client_id, $params)
-    {
-        global $app;
-        
+	{
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'sites_database_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Check for duplicates
 		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$app->db->quote($params['database_name'])."' AND server_id = '".intval($params["server_id"])."'");
 		if($tmp['dbnum'] > 0) {
@@ -1522,66 +1524,66 @@
 			return false;
 		}
 
-        $sql = $this->insertQueryPrepare('../sites/form/database.tform.php', $client_id, $params);
-        if($sql !== false) {
-            $app->uses('sites_database_plugin');
-            
-            $this->id = 0;
-            $this->dataRecord = $params;
-            $app->sites_database_plugin->processDatabaseInsert($this);
+		$sql = $this->insertQueryPrepare('../sites/form/database.tform.php', $client_id, $params);
+		if($sql !== false) {
+			$app->uses('sites_database_plugin');
 
-            return $this->insertQueryExecute($sql, $params);
-        }
-        
-        return false;
+			$this->id = 0;
+			$this->dataRecord = $params;
+			$app->sites_database_plugin->processDatabaseInsert($this);
+
+			return $this->insertQueryExecute($sql, $params);
+		}
+
+		return false;
 	}
-	
+
 	//* Update a record
 	public function sites_database_update($session_id, $client_id, $primary_id, $params)
-    {
-        global $app;
-        
+	{
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'sites_database_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
+
 		$sql = $this->updateQueryPrepare('../sites/form/database.tform.php', $client_id, $primary_id, $params);
-        if($sql !== false) {
-            $app->uses('sites_database_plugin');
-            
-            $this->id = $primary_id;
-            $this->dataRecord = $params;
-            $app->sites_database_plugin->processDatabaseUpdate($this);
-            return $this->updateQueryExecute($sql, $primary_id, $params);
-        }
-        
-        return false;
+		if($sql !== false) {
+			$app->uses('sites_database_plugin');
+
+			$this->id = $primary_id;
+			$this->dataRecord = $params;
+			$app->sites_database_plugin->processDatabaseUpdate($this);
+			return $this->updateQueryExecute($sql, $primary_id, $params);
+		}
+
+		return false;
 	}
-	
+
 	//* Delete a record
 	public function sites_database_delete($session_id, $primary_id)
-    {
-        global $app;
+	{
+		global $app;
 		if(!$this->checkPerm($session_id, 'sites_database_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
-        $app->uses('sites_database_plugin');
-        $app->sites_database_plugin->processDatabaseDelete($primary_id);
-        
-		$affected_rows = $this->deleteQuery('../sites/form/database.tform.php',$primary_id);
+
+		$app->uses('sites_database_plugin');
+		$app->sites_database_plugin->processDatabaseDelete($primary_id);
+
+		$affected_rows = $this->deleteQuery('../sites/form/database.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_database_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_database_user_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1590,81 +1592,81 @@
 		$app->remoting_lib->loadFormDef('../sites/form/database_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_database_user_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_database_user_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 
-        return $this->insertQuery('../sites/form/database_user.tform.php', $client_id, $params);
+		return $this->insertQuery('../sites/form/database_user.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_database_user_update($session_id, $client_id, $primary_id, $params)
-    {
-        global $app;
-        
+	{
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'sites_database_user_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../sites/form/database_user.tform.php');
-        $old_rec = $app->remoting_lib->getDataRecord($primary_id);
-        
+		$old_rec = $app->remoting_lib->getDataRecord($primary_id);
+
 		$result = $this->updateQuery('../sites/form/database_user.tform.php', $client_id, $primary_id, $params);
-        
-        $new_rec = $app->remoting_lib->getDataRecord($primary_id);
-        
-        $records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
-        foreach($records as $rec) {
-            $tmp_rec = $new_rec;
-            $tmp_rec['server_id'] = $rec['server_id'];
-            $app->remoting_lib->datalogSave('UPDATE', $primary_id, $old_rec, $tmp_rec);
-        }
-        unset($new_rec);
-        unset($old_rec);
-        unset($records);
-        
-        return $result;
- 	}
-	
+
+		$new_rec = $app->remoting_lib->getDataRecord($primary_id);
+
+		$records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
+		foreach($records as $rec) {
+			$tmp_rec = $new_rec;
+			$tmp_rec['server_id'] = $rec['server_id'];
+			$app->remoting_lib->datalogSave('UPDATE', $primary_id, $old_rec, $tmp_rec);
+		}
+		unset($new_rec);
+		unset($old_rec);
+		unset($records);
+
+		return $result;
+	}
+
 	//* Delete a record
 	public function sites_database_user_delete($session_id, $primary_id)
-    {
-        global $app;
-        
+	{
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'sites_database_user_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
-        $app->db->datalogDelete('web_database_user', 'database_user_id', $primary_id);
-		$affected_rows = $this->deleteQuery('../sites/form/database_user.tform.php',$primary_id);
-        
-        $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogUpdate('web_database','database_user_id=NULL','database_id', $rec['database_id']);
-            
-        }
-        $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogUpdate('web_database','database_ro_user_id=NULL','database_id', $rec['database_id']);
-        }
-        
+
+		$app->db->datalogDelete('web_database_user', 'database_user_id', $primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/database_user.tform.php', $primary_id);
+
+		$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogUpdate('web_database', 'database_user_id=NULL', 'database_id', $rec['database_id']);
+
+		}
+		$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogUpdate('web_database', 'database_ro_user_id=NULL', 'database_id', $rec['database_id']);
+		}
+
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_ftp_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1673,66 +1675,66 @@
 		$app->remoting_lib->loadFormDef('../sites/form/ftp_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_ftp_user_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/ftp_user.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/ftp_user.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_ftp_user_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/ftp_user.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/ftp_user.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_ftp_user_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/ftp_user.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/ftp_user.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get server for an ftp user
 	public function sites_ftp_user_server_get($session_id, $ftp_user)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_server_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$data = $app->db->queryOneRecord("SELECT server_id FROM ftp_user WHERE username = '".$app->db->quote($ftp_user)."'");
 		//file_put_contents('/tmp/test.txt', serialize($data));
-        if(!isset($data['server_id'])) return false;
-		
-        $server = $this->server_get($session_id, $data['server_id'], 'server');
-        //file_put_contents('/tmp/test2.txt', serialize($server));
-        
+		if(!isset($data['server_id'])) return false;
+
+		$server = $this->server_get($session_id, $data['server_id'], 'server');
+		//file_put_contents('/tmp/test2.txt', serialize($server));
+
 		return $server;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_shell_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_shell_user_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1741,46 +1743,46 @@
 		$app->remoting_lib->loadFormDef('../sites/form/shell_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_shell_user_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_shell_user_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/shell_user.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/shell_user.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_shell_user_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_shell_user_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/shell_user.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/shell_user.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_shell_user_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_shell_user_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/shell_user.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/shell_user.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_domain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_domain_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1789,7 +1791,7 @@
 		$app->remoting_lib->loadFormDef('../sites/form/web_domain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_domain_add($session_id, $client_id, $params, $readonly = false)
 	{
@@ -1798,65 +1800,65 @@
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		if(!isset($params['client_group_id']) or (isset($params['client_group_id']) && empty($params['client_group_id']))) {
 			$rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($client_id));
 			$params['client_group_id'] = $rec['groupid'];
 		}
-		
+
 		//* Set a few params to "not empty" values which get overwritten by the sites_web_domain_plugin
 		if($params['document_root'] == '') $params['document_root'] = '-';
 		if($params['system_user'] == '') $params['system_user'] = '-';
 		if($params['system_group'] == '') $params['system_group'] = '-';
-		
+
 		//* Set a few defaults for nginx servers
 		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
 		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
 		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
 		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
-		
-		$domain_id = $this->insertQuery('../sites/form/web_domain.tform.php',$client_id,$params, 'sites:web_domain:on_after_insert');
+
+		$domain_id = $this->insertQuery('../sites/form/web_domain.tform.php', $client_id, $params, 'sites:web_domain:on_after_insert');
 		if ($readonly === true)
 			$app->db->query("UPDATE web_domain SET `sys_userid` = '1' WHERE domain_id = ".$domain_id);
-			return $domain_id;
-		}
-	
+		return $domain_id;
+	}
+
 	//* Update a record
 	public function sites_web_domain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_domain_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Set a few defaults for nginx servers
 		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
 		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
 		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
 		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
-		
-		$affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php',$client_id,$primary_id,$params);
+
+		$affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_domain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_domain_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_domain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_domain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_vhost_subdomain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1865,7 +1867,7 @@
 		$app->remoting_lib->loadFormDef('../sites/form/web_vhost_subdomain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_vhost_subdomain_add($session_id, $client_id, $params)
 	{
@@ -1874,58 +1876,58 @@
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Set a few params to "not empty" values which get overwritten by the sites_web_domain_plugin
 		if($params['document_root'] == '') $params['document_root'] = '-';
 		if($params['system_user'] == '') $params['system_user'] = '-';
 		if($params['system_group'] == '') $params['system_group'] = '-';
-		
+
 		//* Set a few defaults for nginx servers
 		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
 		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
 		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
 		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
-		
-		$domain_id = $this->insertQuery('../sites/form/web_vhost_subdomain.tform.php',$client_id,$params, 'sites:web_vhost_subdomain:on_after_insert');
-        return $domain_id;
-    }
-	
+
+		$domain_id = $this->insertQuery('../sites/form/web_vhost_subdomain.tform.php', $client_id, $params, 'sites:web_vhost_subdomain:on_after_insert');
+		return $domain_id;
+	}
+
 	//* Update a record
 	public function sites_web_vhost_subdomain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Set a few defaults for nginx servers
 		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
 		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
 		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
 		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
-		
-		$affected_rows = $this->updateQuery('../sites/form/web_vhost_subdomain.tform.php',$client_id,$primary_id,$params, 'sites:web_vhost_subdomain:on_after_insert');
+
+		$affected_rows = $this->updateQuery('../sites/form/web_vhost_subdomain.tform.php', $client_id, $primary_id, $params, 'sites:web_vhost_subdomain:on_after_insert');
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_vhost_subdomain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_vhost_subdomain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_vhost_subdomain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// -----------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_aliasdomain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1934,46 +1936,46 @@
 		$app->remoting_lib->loadFormDef('../sites/form/web_aliasdomain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_aliasdomain_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/web_aliasdomain.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_web_aliasdomain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/web_aliasdomain.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_aliasdomain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_aliasdomain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_aliasdomain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_subdomain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -1982,46 +1984,46 @@
 		$app->remoting_lib->loadFormDef('../sites/form/web_subdomain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_subdomain_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/web_subdomain.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/web_subdomain.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_web_subdomain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/web_subdomain.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/web_subdomain.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_subdomain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_subdomain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_subdomain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_folder_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_folder_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2030,56 +2032,56 @@
 		$app->remoting_lib->loadFormDef('../sites/form/web_folder.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_folder_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/web_folder.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/web_folder.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_web_folder_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/web_folder.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/web_folder.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_folder_delete($session_id, $primary_id)
-    {
+	{
 		global $app;
 		if(!$this->checkPerm($session_id, 'sites_web_folder_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
-        // Delete all users that belong to this folder. - taken from web_folder_delete.php
+
+		// Delete all users that belong to this folder. - taken from web_folder_delete.php
 		$records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$app->functions->intval($primary_id)."'");
 		foreach($records as $rec) {
-			$this->deleteQuery('../sites/form/web_folder_user.tform.php',$rec['web_folder_user_id']);
+			$this->deleteQuery('../sites/form/web_folder_user.tform.php', $rec['web_folder_user_id']);
 			//$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec['web_folder_user_id']);
 		}
 		unset($records);
-        
-		$affected_rows = $this->deleteQuery('../sites/form/web_folder.tform.php',$primary_id);
+
+		$affected_rows = $this->deleteQuery('../sites/form/web_folder.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// -----------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_folder_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_folder_user_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2088,46 +2090,46 @@
 		$app->remoting_lib->loadFormDef('../sites/form/web_folder_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_folder_user_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_user_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/web_folder_user.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/web_folder_user.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_web_folder_user_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_user_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/web_folder_user.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/web_folder_user.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_folder_user_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_user_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_folder_user.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_folder_user.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// -----------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function domains_domain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'domains_domain_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2139,77 +2141,77 @@
 
 	//* Add a record
 	public function domains_domain_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'domains_domain_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../client/form/domain.tform.php',$client_id,$params);
+		return $this->insertQuery('../client/form/domain.tform.php', $client_id, $params);
 	}
 
 	//* Delete a record
 	public function domains_domain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'domains_domain_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../client/form/domain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../client/form/domain.tform.php', $primary_id);
 		return $affected_rows;
 	}
 
-// -----------------------------------------------------------------------------------------------
+	// -----------------------------------------------------------------------------------------------
 
 	public function domains_get_all_by_user($session_id, $group_id)
-    {
-        global $app;
+	{
+		global $app;
 		if(!$this->checkPerm($session_id, 'domains_get_all_by_user')) {
-        	$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        $group_id = $app->functions->intval($group_id);
-        $sql = "SELECT domain_id, domain FROM domain WHERE sys_groupid  = $group_id ";
-        $all = $app->db->queryAllRecords($sql);
-        return $all;
+		$group_id = $app->functions->intval($group_id);
+		$sql = "SELECT domain_id, domain FROM domain WHERE sys_groupid  = $group_id ";
+		$all = $app->db->queryAllRecords($sql);
+		return $all;
 	}
-	
-	
+
+
 	// DNS Function --------------------------------------------------------------------------------------------------
-	
+
 	//* Create Zone with Template
 	public function dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email)
-    {
-        global $app, $conf;
+	{
+		global $app, $conf;
 		if(!$this->checkPerm($session_id, 'dns_templatezone_add')) {
-        	$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
 
 		$client = $app->db->queryOneRecord("SELECT default_dnsserver FROM client WHERE client_id = ".$app->functions->intval($client_id));
 		$server_id = $client["default_dnsserver"];
 		$template_record = $app->db->queryOneRecord("SELECT * FROM dns_template WHERE template_id = '$template_id'");
-		$fields = explode(',',$template_record['fields']);
+		$fields = explode(',', $template_record['fields']);
 		$tform_def_file = "../../web/dns/form/dns_soa.tform.php";
 		$app->uses('tform');
 		$app->tform->loadFormDef($tform_def_file);
 		$app->uses('tpl,validate_dns');
-		
+
 		//* replace template placeholders
 		$tpl_content = $template_record['template'];
-		if($domain != '') $tpl_content = str_replace('{DOMAIN}',$domain,$tpl_content);
-		if($ip != '') $tpl_content = str_replace('{IP}',$ip,$tpl_content);
-		if($ns1 != '') $tpl_content = str_replace('{NS1}',$ns1,$tpl_content);
-		if($ns2 != '') $tpl_content = str_replace('{NS2}',$ns2,$tpl_content);
-		if($email != '') $tpl_content = str_replace('{EMAIL}',$email,$tpl_content);
-		
+		if($domain != '') $tpl_content = str_replace('{DOMAIN}', $domain, $tpl_content);
+		if($ip != '') $tpl_content = str_replace('{IP}', $ip, $tpl_content);
+		if($ns1 != '') $tpl_content = str_replace('{NS1}', $ns1, $tpl_content);
+		if($ns2 != '') $tpl_content = str_replace('{NS2}', $ns2, $tpl_content);
+		if($email != '') $tpl_content = str_replace('{EMAIL}', $email, $tpl_content);
+
 		//* Parse the template
-		$tpl_rows = explode("\n",$tpl_content);
+		$tpl_rows = explode("\n", $tpl_content);
 		$section = '';
 		$vars = array();
 		$dns_rr = array();
 		foreach($tpl_rows as $row) {
 			$row = trim($row);
-			if(substr($row,0,1) == '[') {
+			if(substr($row, 0, 1) == '[') {
 				if($row == '[ZONE]') {
 					$section = 'zone';
 				} elseif($row == '[DNS_RECORDS]') {
@@ -2221,14 +2223,14 @@
 				if($row != '') {
 					//* Handle zone section
 					if($section == 'zone') {
-						$parts = explode('=',$row);
+						$parts = explode('=', $row);
 						$key = trim($parts[0]);
 						$val = trim($parts[1]);
 						if($key != '') $vars[$key] = $val;
 					}
 					//* Handle DNS Record rows
 					if($section == 'dns_records') {
-						$parts = explode('|',$row);
+						$parts = explode('|', $row);
 						$dns_rr[] = array(
 							'name' => $app->db->quote($parts[1]),
 							'type' => $app->db->quote($parts[0]),
@@ -2238,9 +2240,9 @@
 						);
 					}
 				}
-			}		
+			}
 		} // end foreach
-		
+
 		if($vars['origin'] == '') $error .= $app->lng('error_origin_empty').'<br />';
 		if($vars['ns'] == '') $error .= $app->lng('error_ns_empty').'<br />';
 		if($vars['mbox'] == '') $error .= $app->lng('error_mbox_empty').'<br />';
@@ -2248,8 +2250,8 @@
 		if($vars['retry'] == '') $error .= $app->lng('error_retry_empty').'<br />';
 		if($vars['expire'] == '') $error .= $app->lng('error_expire_empty').'<br />';
 		if($vars['minimum'] == '') $error .= $app->lng('error_minimum_empty').'<br />';
-		if($vars['ttl'] == '') $error .= $app->lng('error_ttl_empty').'<br />';	
-		
+		if($vars['ttl'] == '') $error .= $app->lng('error_ttl_empty').'<br />';
+
 		if($error == '') {
 			// Insert the soa record
 			$tmp = $app->db->queryOneRecord("SELECT userid,default_group FROM sys_user WHERE client_id = ".$app->functions->intval($client_id));
@@ -2258,7 +2260,7 @@
 			unset($tmp);
 			$origin = $app->db->quote($vars['origin']);
 			$ns = $app->db->quote($vars['ns']);
-			$mbox = $app->db->quote(str_replace('@','.',$vars['mbox']));
+			$mbox = $app->db->quote(str_replace('@', '.', $vars['mbox']));
 			$refresh = $app->db->quote($vars['refresh']);
 			$retry = $app->db->quote($vars['retry']);
 			$expire = $app->db->quote($vars['expire']);
@@ -2267,14 +2269,14 @@
 			$xfer = $app->db->quote($vars['xfer']);
 			$also_notify = $app->db->quote($vars['also_notify']);
 			$update_acl = $app->db->quote($vars['update_acl']);
-			$serial = $app->validate_dns->increase_serial(0);		
-			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`, `also_notify`, `update_acl`) VALUES 
+			$serial = $app->validate_dns->increase_serial(0);
+			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`, `also_notify`, `update_acl`) VALUES
 			('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '$xfer', '$also_notify', '$update_acl')";
-			$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');	
+			$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
 			// Insert the dns_rr records
 			if(is_array($dns_rr) && $dns_soa_id > 0) {
 				foreach($dns_rr as $rr) {
-					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES 
+					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES
 					('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$rr[name]', '$rr[type]', '$rr[data]', '$rr[aux]', '$rr[ttl]', 'Y')";
 					$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
 				}
@@ -2284,13 +2286,13 @@
 			$this->server->fault('permission_denied', $error);
 		}
 	}
-	
-	
+
+
 	//* Get record details
 	public function dns_zone_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_zone_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2299,70 +2301,70 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_soa.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-    
-    //* Get record id by origin
-    public function dns_zone_get_id($session_id, $origin)
-    {
-        global $app;
-        
-        if(!$this->checkPerm($session_id, 'dns_zone_get_id')) {
-            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }
-        
-        if(!preg_match('/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i', $origin)){
-            $this->server->fault('no_domain_found', 'Invalid domain name.');
-            return false;
-        }
 
-        $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin."%'");
-        if(isset($rec['id'])) {
-            return $app->functions->intval($rec['id']);
-        } else {
-            $this->server->fault('no_domain_found', 'There is no domain ID with informed domain name.');
-            return false;
-        }
-    }
-	
+	//* Get record id by origin
+	public function dns_zone_get_id($session_id, $origin)
+	{
+		global $app;
+
+		if(!$this->checkPerm($session_id, 'dns_zone_get_id')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+
+		if(!preg_match('/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i', $origin)){
+			$this->server->fault('no_domain_found', 'Invalid domain name.');
+			return false;
+		}
+
+		$rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin."%'");
+		if(isset($rec['id'])) {
+			return $app->functions->intval($rec['id']);
+		} else {
+			$this->server->fault('no_domain_found', 'There is no domain ID with informed domain name.');
+			return false;
+		}
+	}
+
 	//* Add a record
 	public function dns_zone_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_zone_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_soa.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_soa.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_zone_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_zone_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_zone_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_zone_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_soa.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_soa.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_aaaa_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_aaaa_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2371,46 +2373,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_aaaa.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_aaaa_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_aaaa_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_aaaa.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_aaaa.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_aaaa_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_aaaa_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_aaaa_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_aaaa_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php', $primary_id);
 		return $affected_rows;
 	}
 
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_a_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_a_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2419,46 +2421,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_a.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_a_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_a_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_a.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_a.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_a_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_a_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_a_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_a_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_alias_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_alias_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2467,46 +2469,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_alias.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_alias_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_alias_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_alias.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_alias.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_alias_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_alias_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_alias_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_alias_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_cname_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_cname_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2515,46 +2517,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_cname.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_cname_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_cname_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_cname.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_cname.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_cname_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_cname_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_cname_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_cname_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_hinfo_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_hinfo_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2563,46 +2565,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_hinfo.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_hinfo_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_hinfo_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_hinfo.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_hinfo.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_hinfo_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_hinfo_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_hinfo_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_hinfo_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_mx_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_mx_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2611,46 +2613,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_mx.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_mx_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_mx_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_mx.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_mx.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_mx_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_mx_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_mx_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_mx_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_ns_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_ns_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2659,46 +2661,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_ns.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_ns_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ns_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_ns.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_ns.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_ns_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ns_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_ns_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ns_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_ptr_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_ptr_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2707,46 +2709,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_ptr.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_ptr_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ptr_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_ptr.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_ptr.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_ptr_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ptr_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_ptr_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ptr_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_rp_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_rp_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2755,46 +2757,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_rp.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_rp_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_rp_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_rp.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_rp.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_rp_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_rp_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_rp_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_rp_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_srv_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_srv_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2803,46 +2805,46 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_srv.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_srv_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_srv_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_srv.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_srv.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_srv_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_srv_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_srv_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_srv_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_txt_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_txt_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -2851,646 +2853,657 @@
 		$app->remoting_lib->loadFormDef('../dns/form/dns_txt.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_txt_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_txt_add')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_txt.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_txt.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_txt_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_txt_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_txt_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_txt_delete')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-        
+
+
+
+
+
+
+
+
+
+
+
 
 
 	//** protected functions -----------------------------------------------------------------------------------
-	
-	
+
+
 
 
 	protected function klientadd($formdef_file, $reseller_id, $params)
-    {
+	{
 		global $app;
 		$app->uses('remoting_lib');
-			
+
 		//* Load the form definition
 		$app->remoting_lib->loadFormDef($formdef_file);
-		
+
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile($reseller_id);
-		
+
 		//* Get the SQL query
-		$sql = $app->remoting_lib->getSQL($params,'INSERT',0);
-		
+		$sql = $app->remoting_lib->getSQL($params, 'INSERT', 0);
+
 		//* Check if no system user with that username exists
 		$username = $app->db->quote($params["username"]);
 		$tmp = $app->db->queryOneRecord("SELECT count(userid) as number FROM sys_user WHERE username = '$username'");
 		if($tmp['number'] > 0) $app->remoting_lib->errorMessage .= "Duplicate username<br />";
-		
+
 		//* Stop on error while preparing the sql query
 		if($app->remoting_lib->errorMessage != '') {
 			$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
-		
+
 		//* Execute the SQL query
 		$app->db->query($sql);
 		$insert_id = $app->db->insertID();
-		
-		
+
+
 		//* Stop on error while executing the sql query
 		if($app->remoting_lib->errorMessage != '') {
 			$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
-		
+
 		$this->id = $insert_id;
 		$this->dataRecord = $params;
-		
-		$app->plugin->raiseEvent('client:' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . ':on_after_insert',$this);
-		
+
+		$app->plugin->raiseEvent('client:' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . ':on_after_insert', $this);
+
 		/*
 		if($app->db->errorMessage != '') {
 			$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql);
 			return false;
 		}
 		*/
-		
-        /* copied from the client_edit php */
+
+		/* copied from the client_edit php */
 		exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
 		$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa.pub'))."' WHERE client_id = ".$this->id);
 		exec('rm -f /tmp/id_rsa /tmp/id_rsa.pub');
-        
-        
-			
+
+
+
 		//$app->uses('tform');
 		//* Save changes to Datalog
 		if($app->remoting_lib->formDef["db_history"] == 'yes') {
 			$new_rec = $app->remoting_lib->getDataRecord($insert_id);
-			$app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec);			
-			$app->remoting_lib->ispconfig_sysuser_add($params,$insert_id);
+			$app->remoting_lib->datalogSave('INSERT', $primary_id, array(), $new_rec);
+			$app->remoting_lib->ispconfig_sysuser_add($params, $insert_id);
 
-            if($reseller_id) {
-                $client_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = ".$insert_id);
-                $reseller_user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = ".$reseller_id);
-                $app->auth->add_group_to_user($reseller_user['userid'], $client_group['groupid']);
-                $app->db->query("UPDATE client SET parent_client_id = ".$reseller_id." WHERE client_id = ".$insert_id);
-            }   
+			if($reseller_id) {
+				$client_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = ".$insert_id);
+				$reseller_user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = ".$reseller_id);
+				$app->auth->add_group_to_user($reseller_user['userid'], $client_group['groupid']);
+				$app->db->query("UPDATE client SET parent_client_id = ".$reseller_id." WHERE client_id = ".$insert_id);
+			}
 
 		}
 		return $insert_id;
 	}
 
-    protected function insertQuery($formdef_file, $client_id, $params,$event_identifier = '')
-    {
-        $sql = $this->insertQueryPrepare($formdef_file, $client_id, $params);
-        if($sql !== false) return $this->insertQueryExecute($sql, $params,$event_identifier);
-        else return false;
-    }
+	protected function insertQuery($formdef_file, $client_id, $params, $event_identifier = '')
+	{
+		$sql = $this->insertQueryPrepare($formdef_file, $client_id, $params);
+		if($sql !== false) return $this->insertQueryExecute($sql, $params, $event_identifier);
+		else return false;
+	}
 
 	protected function insertQueryPrepare($formdef_file, $client_id, $params)
-    {
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-		
+
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile($client_id);
-		
+
 		//* Load the form definition
 		$app->remoting_lib->loadFormDef($formdef_file);
-		
+
 		//* Get the SQL query
-		$sql = $app->remoting_lib->getSQL($params,'INSERT',0);
+		$sql = $app->remoting_lib->getSQL($params, 'INSERT', 0);
 		if($app->remoting_lib->errorMessage != '') {
 			$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
 		$app->log('Executed insertQueryPrepare', LOGLEVEL_DEBUG);
-        return $sql;
+		return $sql;
 	}
-	
-	protected function insertQueryExecute($sql, $params,$event_identifier = '')
-    {
+
+	protected function insertQueryExecute($sql, $params, $event_identifier = '')
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-        
+
 		$app->db->query($sql);
-		
+
 		if($app->db->errorMessage != '') {
 			$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql);
 			return false;
 		}
-		
+
 		$insert_id = $app->db->insertID();
-		
+
 		// set a few values for compatibility with tform actions, mostly used by plugins
 		$this->id = $insert_id;
 		$this->dataRecord = $params;
 		$app->log('Executed insertQueryExecute, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
-		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this);
-	
+		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier, $this);
+
 		//$app->uses('tform');
 		//* Save changes to Datalog
 		if($app->remoting_lib->formDef["db_history"] == 'yes') {
 			$new_rec = $app->remoting_lib->getDataRecord($insert_id);
-			$app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec);			
-		}		
+			$app->remoting_lib->datalogSave('INSERT', $primary_id, array(), $new_rec);
+		}
 		return $insert_id;
 	}
-    
+
 	protected function updateQuery($formdef_file, $client_id, $primary_id, $params, $event_identifier = '')
-    {
+	{
 		global $app;
-		
+
 		$sql = $this->updateQueryPrepare($formdef_file, $client_id, $primary_id, $params);
-        if($sql !== false) return $this->updateQueryExecute($sql, $primary_id, $params,$event_identifier);
-        else return false;
+		if($sql !== false) return $this->updateQueryExecute($sql, $primary_id, $params, $event_identifier);
+		else return false;
 	}
-	
+
 	protected function updateQueryPrepare($formdef_file, $client_id, $primary_id, $params)
-    {
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-		
+
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile($client_id);
-		
+
 		//* Load the form definition
 		$app->remoting_lib->loadFormDef($formdef_file);
-		
+
 		//* Get the SQL query
-		$sql = $app->remoting_lib->getSQL($params,'UPDATE',$primary_id);
+		$sql = $app->remoting_lib->getSQL($params, 'UPDATE', $primary_id);
 		// $this->server->fault('debug', $sql);
 		if($app->remoting_lib->errorMessage != '') {
 			$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
-		
-        return $sql;
+
+		return $sql;
 	}
 
 	protected function updateQueryExecute($sql, $primary_id, $params, $event_identifier = '')
-    {
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-		
+
 		$old_rec = $app->remoting_lib->getDataRecord($primary_id);
-		
+
 		// set a few values for compatibility with tform actions, mostly used by plugins
 		$this->oldDataRecord = $old_rec;
 		$this->id = $primary_id;
 		$this->dataRecord = $params;
-		
+
 		$app->db->query($sql);
-		
+
 		if($app->db->errorMessage != '') {
 			$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql);
 			return false;
 		}
-		
+
 		$affected_rows = $app->db->affectedRows();
 		$app->log('Executed updateQueryExecute, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
-		
-		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this);
-		
+
+		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier, $this);
+
 		//* Save changes to Datalog
 		if($app->remoting_lib->formDef["db_history"] == 'yes') {
 			$new_rec = $app->remoting_lib->getDataRecord($primary_id);
-			$app->remoting_lib->datalogSave('UPDATE',$primary_id,$old_rec,$new_rec);
+			$app->remoting_lib->datalogSave('UPDATE', $primary_id, $old_rec, $new_rec);
 		}
-		
+
 		return $affected_rows;
 	}
 
 	protected function deleteQuery($formdef_file, $primary_id, $event_identifier = '')
-    {
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-		
+
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile(0);
-		
+
 		//* Load the form definition
 		$app->remoting_lib->loadFormDef($formdef_file);
-		
+
 		$old_rec = $app->remoting_lib->getDataRecord($primary_id);
-		
+
 		// set a few values for compatibility with tform actions, mostly used by plugins
 		$this->oldDataRecord = $old_rec;
 		$this->id = $primary_id;
 		$this->dataRecord = $old_rec;
 		$app->log('Executed deleteQuery, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
 		//$this->dataRecord = $params;
-		
+
 		//* Get the SQL query
 		$sql = $app->remoting_lib->getDeleteSQL($primary_id);
 		$app->db->errorMessage = '';
 		$app->db->query($sql);
 		$affected_rows = $app->db->affectedRows();
-		
+
 		if($app->db->errorMessage != '') {
 			$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql);
 			return false;
 		}
-		
+
 		if($event_identifier != '') {
-			$app->plugin->raiseEvent($event_identifier,$this);
+			$app->plugin->raiseEvent($event_identifier, $this);
 		}
-		
+
 		//* Save changes to Datalog
 		if($app->remoting_lib->formDef["db_history"] == 'yes') {
-			$app->remoting_lib->datalogSave('DELETE',$primary_id,$old_rec,array());
+			$app->remoting_lib->datalogSave('DELETE', $primary_id, $old_rec, array());
 		}
-		
-		
+
+
 		return $affected_rows;
 	}
-	
-	
+
+
 	protected function checkPerm($session_id, $function_name)
-    {
-        global $app;
-	$dobre=array();
-	$session = $this->getSession($session_id);
-        if(!$session){
-            return false;
-        }
-		
-		$dobre= str_replace(';',',',$session['remote_functions']);
+	{
+		global $app;
+		$dobre=array();
+		$session = $this->getSession($session_id);
+		if(!$session){
+			return false;
+		}
+
+		$dobre= str_replace(';', ',', $session['remote_functions']);
 		$check = in_array($function_name, explode(',', $dobre) );
 		if(!$check) {
-		  $app->log("REMOTE-LIB DENY: ".$session_id ." /". $function_name, LOGLEVEL_WARN);
+			$app->log("REMOTE-LIB DENY: ".$session_id ." /". $function_name, LOGLEVEL_WARN);
 		}
 		return $check;
 	}
-	
-	
+
+
 	protected function getSession($session_id)
-    {	
+	{
 		global $app;
-		
+
 		if(empty($session_id)) {
-			$this->server->fault('session_id_empty','The SessionID is empty.');
+			$this->server->fault('session_id_empty', 'The SessionID is empty.');
 			return false;
 		}
-		
+
 		$session_id = $app->db->quote($session_id);
-		
+
 		$now = time();
 		$sql = "SELECT * FROM remote_session WHERE remote_session = '$session_id' AND tstamp >= $now";
 		$session = $app->db->queryOneRecord($sql);
 		if($session['remote_userid'] > 0) {
 			return $session;
 		} else {
-			$this->server->fault('session_does_not_exist','The Session is expired or does not exist.');
+			$this->server->fault('session_does_not_exist', 'The Session is expired or does not exist.');
 			return false;
 		}
 	}
-	
+
 	//---
-	
-	
+
+
 	/**
 	 * Gets sites by $sys_userid & $sys_groupid
-	 * @param	int		session id
-	 * @param	int		user id
-	 * @param	array	list of groups
-	 * @return	mixed	array with sites by user
-	 * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 * @param int  session id
+	 * @param int  user id
+	 * @param array list of groups
+	 * @return mixed array with sites by user
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
 	public function client_get_sites_by_user($session_id, $sys_userid, $sys_groupid) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'client_get_sites_by_user')) {
-              $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-              return false;
-        }
-        $sys_userid  = $app->functions->intval($sys_userid);        
-        $sys_groupid = explode(',', $sys_groupid);
-        $new_group = array();
-        foreach($sys_groupid as $group_id) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'client_get_sites_by_user')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$sys_userid  = $app->functions->intval($sys_userid);
+		$sys_groupid = explode(',', $sys_groupid);
+		$new_group = array();
+		foreach($sys_groupid as $group_id) {
 			$new_group[] = $app->functions->intval( $group_id);
-        }
-        $group_list = implode(',', $new_group);
+		}
+		$group_list = implode(',', $new_group);
 		$sql ="SELECT domain, domain_id, document_root, active FROM web_domain WHERE ( (sys_userid = $sys_userid  AND sys_perm_user LIKE '%r%') OR (sys_groupid IN ($group_list) AND sys_perm_group LIKE '%r%') OR  sys_perm_other LIKE '%r%') AND type = 'vhost'";
-        $result = $app->db->queryAllRecords($sql);
-        if(isset($result)) {
+		$result = $app->db->queryAllRecords($sql);
+		if(isset($result)) {
 			return $result;
-        } else {
+		} else {
 			$this->server->fault('no_client_found', 'There is no site for this user');
 			return false;
-        }
-    }
-    
-    /**
-     * Change domains status
-	 * @param	int		session id
-	 * @param	int		site id
-	 * @param	string	active or inactive string 
-	 * @return	mixed	false if error
-	 * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+		}
+	}
+
+
+
+	/**
+	 * Change domains status
+	 * @param int  session id
+	 * @param int  site id
+	 * @param string active or inactive string
+	 * @return mixed false if error
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
-	 
-    public function sites_web_domain_set_status($session_id, $primary_id, $status) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'sites_web_domain_set_status')) {
-            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }        
-        if(in_array($status, array('active', 'inactive'))) {        	    	
-        	if ($status == 'active') {
-        		$status = 'y';
-        	} else {
-        		$status = 'n';
-        	}
-	        $sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);	        
-	        $app->db->query($sql);
-	        $result = $app->db->affectedRows();	
-	         return $result;
-        } else {
+	public function sites_web_domain_set_status($session_id, $primary_id, $status) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'sites_web_domain_set_status')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if(in_array($status, array('active', 'inactive'))) {
+			if ($status == 'active') {
+				$status = 'y';
+			} else {
+				$status = 'n';
+			}
+			$sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);
+			$app->db->query($sql);
+			$result = $app->db->affectedRows();
+			return $result;
+		} else {
 			$this->server->fault('status_undefined', 'The status is not available');
 			return false;
-        }      
+		}
 	}
-	
+
+
+
 	/**
 	 * Get sys_user information by username
-	 * @param	int		session id
-	 * @param	string	user's name  
-	 * @return	mixed	false if error
-	 * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 * @param int  session id
+	 * @param string user's name
+	 * @return mixed false if error
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
 	public function client_get_by_username($session_id, $username) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'client_get_by_username')) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'client_get_by_username')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
-        }
-        $username = $app->db->quote($username);
-        $rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$username."'");
-        if (isset($rec)) {
+		}
+		$username = $app->db->quote($username);
+		$rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$username."'");
+		if (isset($rec)) {
 			return $rec;
-        } else {
+		} else {
 			$this->server->fault('no_client_found', 'There is no user account for this user name.');
 			return false;
-        }
-    }
-      /**
-       * Get All client_id's from database
-       * @param int	session_id
-       * @return Array of all client_id's
-       */
-	public function client_get_all($session_id) {
-	  global $app;
-	  if(!$this->checkPerm($session_id, 'client_get_all')) {
-	    $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-	    return false;
-	  }
-	  $result = $app->db->queryAllRecords("SELECT client_id FROM client WHERE 1");
-	  if(!$result) {
-	    return false;
-	  }
-	  foreach( $result as $record) {
-	    $rarrary[] = $record['client_id'];
-	  }
-	  return $rarrary;
+		}
 	}
 
-    /**
-     * Changes client password
-     * 
-  	 * @param	int		session id
-  	 * @param	int		client	id
-  	 * @param	string	new password
-  	 * @return	bool	true if success 
-	 * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
-     * 
-     */
-    public function client_change_password($session_id, $client_id, $new_password) {
-        global $app;
-
-        if(!$this->checkPerm($session_id, 'client_change_password')) {
+	/**
+	 * Get All client_id's from database
+	 * @param int session_id
+	 * @return Array of all client_id's
+	 */
+	public function client_get_all($session_id) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'client_get_all')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }
-        $client_id = $app->functions->intval($client_id);
-        $client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ".$client_id);
-        if($client['client_id'] > 0) {
-            $new_password = $app->db->quote($new_password);
-            $sql = "UPDATE client SET password = md5('".($new_password)."') 	WHERE client_id = ".$client_id;
-            $app->db->query($sql);            
-            $sql = "UPDATE sys_user SET passwort = md5('".($new_password)."') 	WHERE client_id = ".$client_id;
-            $app->db->query($sql);            
-            return true;
-        } else {
+			return false;
+		}
+		$result = $app->db->queryAllRecords("SELECT client_id FROM client WHERE 1");
+		if(!$result) {
+			return false;
+		}
+		foreach( $result as $record) {
+			$rarrary[] = $record['client_id'];
+		}
+		return $rarrary;
+	}
+
+	/**
+	 * Changes client password
+	 *
+	 * @param int  session id
+	 * @param int  client id
+	 * @param string new password
+	 * @return bool true if success
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 *
+	 */
+	public function client_change_password($session_id, $client_id, $new_password) {
+		global $app;
+
+		if(!$this->checkPerm($session_id, 'client_change_password')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$client_id = $app->functions->intval($client_id);
+		$client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ".$client_id);
+		if($client['client_id'] > 0) {
+			$new_password = $app->db->quote($new_password);
+			$sql = "UPDATE client SET password = md5('".($new_password)."') 	WHERE client_id = ".$client_id;
+			$app->db->query($sql);
+			$sql = "UPDATE sys_user SET passwort = md5('".($new_password)."') 	WHERE client_id = ".$client_id;
+			$app->db->query($sql);
+			return true;
+		} else {
 			$this->server->fault('no_client_found', 'There is no user account for this client_id');
 			return false;
-        }
-    }
-
-    /**
-    * Fetch the mail_domain record for the provided domain.
-    * @param int session_id
-    * @param string the fully qualified domain (or subdomain)
-    * @return array array of arrays corresponding to the mail_domain table's records
-    * @author till, benlake
-    */
-	public function mail_domain_get_by_domain($session_id, $domain) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
-			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }        
-        if (!empty($domain)) {
-        	$domain      	= $app->db->quote($domain);        	
-    	    $sql            = "SELECT * FROM mail_domain WHERE domain = '$domain'";
-        	$result         = $app->db->queryAllRecords($sql);
-        	return          $result;
-        }
-        return false;
-    }
+		}
+	}
 
 	/**
-   	* Get a list of functions
-   	* @param 	int		session id
-   	* @return	mixed	array of the available functions
-    * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
-    */
-    public function get_function_list($session_id) 
-    {
-        if(!$this->checkPerm($session_id, 'get_function_list')) {
+	 * Fetch the mail_domain record for the provided domain.
+	 * @param int session_id
+	 * @param string the fully qualified domain (or subdomain)
+	 * @return array array of arrays corresponding to the mail_domain table's records
+	 * @author till, benlake
+	 */
+	public function mail_domain_get_by_domain($session_id, $domain) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
-        }
-        return get_class_methods($this);
-    }
-    
-    /**
-     * Get all databases by user
-     * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
-     */
-	public function sites_database_get_all_by_user($session_id, $client_id)
-    {
-        global $app;
-		if(!$this->checkPerm($session_id, 'sites_database_get')) {
-        	$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
 		}
-        $client_id = $app->functions->intval($client_id);
-        $sql = "SELECT d.database_id, d.database_name, d.database_user_id, d.database_ro_user_id, du.database_user, du.database_password FROM web_database d LEFT JOIN web_database_user du ON (du.database_user_id = d.database_user_id) INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id";
-		$all = $app->db->queryAllRecords($sql);
-        return $all;
+		if (!empty($domain)) {
+			$domain       = $app->db->quote($domain);
+			$sql            = "SELECT * FROM mail_domain WHERE domain = '$domain'";
+			$result         = $app->db->queryAllRecords($sql);
+			return          $result;
+		}
+		return false;
 	}
-	
+
 	/**
-	 * 	Get all client templates
-	 *	@param 	int		session id
-	 *	@author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 * Get a list of functions
+	 * @param  int  session id
+	 * @return mixed array of the available functions
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 */
+	public function get_function_list($session_id)
+	{
+		if(!$this->checkPerm($session_id, 'get_function_list')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		return get_class_methods($this);
+	}
+
+
+
+	/**
+	 * Get all databases by user
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 */
+	public function sites_database_get_all_by_user($session_id, $client_id)
+	{
+		global $app;
+		if(!$this->checkPerm($session_id, 'sites_database_get')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$client_id = $app->functions->intval($client_id);
+		$sql = "SELECT d.database_id, d.database_name, d.database_user_id, d.database_ro_user_id, du.database_user, du.database_password FROM web_database d LEFT JOIN web_database_user du ON (du.database_user_id = d.database_user_id) INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id";
+		$all = $app->db->queryAllRecords($sql);
+		return $all;
+	}
+
+
+
+	/**
+	 *  Get all client templates
+	 * @param  int  session id
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
 	public function client_templates_get_all($session_id) {
 		global $app;
 		if(!$this->checkPerm($session_id, 'client_templates_get_all')) {
-			 $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-		}
-        $sql    = "SELECT * FROM client_template";
-		$result = $app->db->queryAllRecords($sql);
-        return $result;
-   }
-	
-	/**
-	 * Get all DNS zone by user 
-	 *@author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
-	 */	 
-    public function dns_zone_get_by_user($session_id, $client_id, $server_id) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'dns_zone_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }        
-        if (!empty($client_id) && !empty($server_id)) {
-        	$server_id      = $app->functions->intval($server_id);
-        	$client_id      = $app->functions->intval($client_id);
-    	    $sql            = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id";
-        	$result         = $app->db->queryAllRecords($sql);
-        	return          $result;
-        }
-        return false;
-    }
-    
+			return false;
+		}
+		$sql    = "SELECT * FROM client_template";
+		$result = $app->db->queryAllRecords($sql);
+		return $result;
+	}
+
+
+
 	/**
-	 * 	Get all dns records for a zone
-	 *	@param 	int		session id
-	 *	@param 	int		dns zone id
-	 *	@author	Sebastian Mogilowski <sebastian@mogilowski.net> 2011
+	 * Get all DNS zone by user
+	 *@author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 */
+	public function dns_zone_get_by_user($session_id, $client_id, $server_id) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'dns_zone_get')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if (!empty($client_id) && !empty($server_id)) {
+			$server_id      = $app->functions->intval($server_id);
+			$client_id      = $app->functions->intval($client_id);
+			$sql            = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id";
+			$result         = $app->db->queryAllRecords($sql);
+			return          $result;
+		}
+		return false;
+	}
+
+
+
+	/**
+	 *  Get all dns records for a zone
+	 * @param  int  session id
+	 * @param  int  dns zone id
+	 * @author Sebastian Mogilowski <sebastian@mogilowski.net> 2011
 	 */
 	public function dns_rr_get_all_by_zone($session_id, $zone_id) {
 		global $app;
 		if(!$this->checkPerm($session_id, 'dns_zone_get')) {
-			 $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        $sql    = "SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($zone_id);;
+		$sql    = "SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($zone_id);;
 		$result = $app->db->queryAllRecords($sql);
-        return $result;
-   }
+		return $result;
+	}
 
 	/**
-	 * Changes DNS zone status 
-	 *	@param 	int		session id
-	 *	@param	int		dns soa id
-	 *	@param	string	status active or inactive string
-	 *	@author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 * Changes DNS zone status
+	 * @param  int  session id
+	 * @param int  dns soa id
+	 * @param string status active or inactive string
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
-	 
-    public function dns_zone_set_status($session_id, $primary_id, $status) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'dns_zone_set_status')) {
-              $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-               return false;
-        }        
-        if(in_array($status, array('active', 'inactive'))) {	    	        	
-	    	if ($status == 'active') {
-	    		$status = 'Y';
-	    	} else {
-	    		$status = 'N';
-	    	}
-	        $sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".$app->functions->intval($primary_id);
-	        $app->db->query($sql);
-	        $result = $app->db->affectedRows();
-	        return $result;
-        } else {
+	public function dns_zone_set_status($session_id, $primary_id, $status) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'dns_zone_set_status')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if(in_array($status, array('active', 'inactive'))) {
+			if ($status == 'active') {
+				$status = 'Y';
+			} else {
+				$status = 'N';
+			}
+			$sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".$app->functions->intval($primary_id);
+			$app->db->query($sql);
+			$result = $app->db->affectedRows();
+			return $result;
+		} else {
 			$this->server->fault('status_undefined', 'The status is not available');
 			return false;
-        }  
-    }
-    
-    public function mail_domain_set_status($session_id, $primary_id, $status) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
-              $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
-               return false;
-        }        
-        if(in_array($status, array('active', 'inactive'))) {	    	        	
-	    	if ($status == 'active') {
-	    		$status = 'y';
-	    	} else {
-	    		$status = 'n';
-	    	}
-	        $sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);
-	        $app->db->query($sql);
-	        $result = $app->db->affectedRows();
-	        return $result;
-        } else {
+		}
+	}
+
+	public function mail_domain_set_status($session_id, $primary_id, $status) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if(in_array($status, array('active', 'inactive'))) {
+			if ($status == 'active') {
+				$status = 'y';
+			} else {
+				$status = 'n';
+			}
+			$sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);
+			$app->db->query($sql);
+			$result = $app->db->affectedRows();
+			return $result;
+		} else {
 			$this->server->fault('status_undefined', 'The status is not available');
 			return false;
-        }  
-    }
-	
+		}
+	}
+
 	//* Functions for virtual machine management
-	
+
 	//* Get OpenVZ OStemplate details
 	public function openvz_ostemplate_get($session_id, $ostemplate_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -3499,44 +3512,44 @@
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_ostemplate.tform.php');
 		return $app->remoting_lib->getDataRecord($ostemplate_id);
 	}
-	
+
 	//* Add a openvz ostemplate record
 	public function openvz_ostemplate_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../vm/form/openvz_ostemplate.tform.php',$client_id,$params);
+		return $this->insertQuery('../vm/form/openvz_ostemplate.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update openvz ostemplate record
 	public function openvz_ostemplate_update($session_id, $client_id, $ostemplate_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../vm/form/openvz_ostemplate.tform.php',$client_id,$ostemplate_id,$params);
+		$affected_rows = $this->updateQuery('../vm/form/openvz_ostemplate.tform.php', $client_id, $ostemplate_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete openvz ostemplate record
 	public function openvz_ostemplate_delete($session_id, $ostemplate_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../vm/form/openvz_ostemplate.tform.php',$ostemplate_id);
+		$affected_rows = $this->deleteQuery('../vm/form/openvz_ostemplate.tform.php', $ostemplate_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get OpenVZ template details
 	public function openvz_template_get($session_id, $template_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -3545,44 +3558,44 @@
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_template.tform.php');
 		return $app->remoting_lib->getDataRecord($template_id);
 	}
-	
+
 	//* Add a openvz template record
 	public function openvz_template_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../vm/form/openvz_template.tform.php',$client_id,$params);
+		return $this->insertQuery('../vm/form/openvz_template.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update openvz template record
 	public function openvz_template_update($session_id, $client_id, $template_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../vm/form/openvz_template.tform.php',$client_id,$template_id,$params);
+		$affected_rows = $this->updateQuery('../vm/form/openvz_template.tform.php', $client_id, $template_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete openvz template record
 	public function openvz_template_delete($session_id, $template_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../vm/form/openvz_template.tform.php',$template_id);
+		$affected_rows = $this->deleteQuery('../vm/form/openvz_template.tform.php', $template_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get OpenVZ ip details
 	public function openvz_ip_get($session_id, $ip_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -3591,68 +3604,68 @@
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_ip.tform.php');
 		return $app->remoting_lib->getDataRecord($ip_id);
 	}
-	
+
 	//* Get OpenVZ a free IP address
 	public function openvz_get_free_ip($session_id, $server_id = 0)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 		$server_id = $app->functions->intval($server_id);
-		
+
 		if($server_id > 0) {
 			$tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = $server_id LIMIT 0,1");
 		} else {
 			$tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 LIMIT 0,1");
 		}
-		
+
 		if(count($tmp) > 0) {
 			return $tmp;
 		} else {
 			$this->server->fault('no_free_ip', 'There is no free IP available.');
 		}
 	}
-	
+
 	//* Add a openvz ip record
 	public function openvz_ip_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../vm/form/openvz_ip.tform.php',$client_id,$params);
+		return $this->insertQuery('../vm/form/openvz_ip.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update openvz ip record
 	public function openvz_ip_update($session_id, $client_id, $ip_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../vm/form/openvz_ip.tform.php',$client_id,$ip_id,$params);
+		$affected_rows = $this->updateQuery('../vm/form/openvz_ip.tform.php', $client_id, $ip_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete openvz ip record
 	public function openvz_ip_delete($session_id, $ip_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../vm/form/openvz_ip.tform.php',$ip_id);
+		$affected_rows = $this->deleteQuery('../vm/form/openvz_ip.tform.php', $ip_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get OpenVZ vm details
 	public function openvz_vm_get($session_id, $vm_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -3661,51 +3674,51 @@
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
 		return $app->remoting_lib->getDataRecord($vm_id);
 	}
-	
+
 	//* Get OpenVZ list
 	public function openvz_vm_get_by_client($session_id, $client_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		if (!empty($client_id)) {
-        	$client_id      = $app->functions->intval($client_id);
-			$tmp 			= $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-    	    $sql            = "SELECT * FROM openvz_vm WHERE sys_groupid = ".$app->functions->intval($tmp['groupid']);
-        	$result         = $app->db->queryAllRecords($sql);
-        	return          $result;
-        }
-        return false;
+			$client_id      = $app->functions->intval($client_id);
+			$tmp    = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
+			$sql            = "SELECT * FROM openvz_vm WHERE sys_groupid = ".$app->functions->intval($tmp['groupid']);
+			$result         = $app->db->queryAllRecords($sql);
+			return          $result;
+		}
+		return false;
 	}
-	
+
 	//* Add a openvz vm record
 	public function openvz_vm_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../vm/form/openvz_vm.tform.php',$client_id,$params);
+		return $this->insertQuery('../vm/form/openvz_vm.tform.php', $client_id, $params);
 	}
-	
+
 	//* Add a openvz vm record from template
 	public function openvz_vm_add_from_template($session_id, $client_id, $ostemplate_id, $template_id, $override_params = array())
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
-		
+
+
 		$template_id = $app->functions->intval($template_id);
 		$ostemplate_id = $app->functions->intval($ostemplate_id);
-		
+
 		//* Verify parameters
 		if($template_id == 0) {
 			$this->server->fault('template_id_error', 'Template ID must be > 0.');
@@ -3715,7 +3728,7 @@
 			$this->server->fault('ostemplate_id_error', 'OSTemplate ID must be > 0.');
 			return false;
 		}
-		
+
 		// Verify if template and ostemplate exist
 		$tmp = $app->db->queryOneRecord("SELECT template_id FROM openvz_template WHERE template_id = $template_id");
 		if(!is_array($tmp)) {
@@ -3727,10 +3740,10 @@
 			$this->server->fault('ostemplate_id_error', 'OSTemplate does not exist.');
 			return false;
 		}
-		
+
 		//* Get the template
 		$vtpl = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = $template_id");
-		
+
 		//* Get the IP address and server_id
 		if($override_params['server_id'] > 0) {
 			$vmip = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = ".$override_params['server_id']." LIMIT 0,1");
@@ -3741,7 +3754,7 @@
 			$this->server->fault('vm_ip_error', 'Unable to get a free VM IP.');
 			return false;
 		}
-		
+
 		//* Build the $params array
 		$params = array();
 		$params['server_id'] = $vmip['server_id'];
@@ -3754,8 +3767,8 @@
 		$params['active'] = (isset($override_params['active']))?$override_params['active']:'y';
 		$params['active_until_date'] = (isset($override_params['active_until_date']))?$override_params['active_until_date']:'0000-00-00';
 		$params['description'] = (isset($override_params['description']))?$override_params['description']:'';
-		
-		//* The next params get filled with pseudo values, as the get replaced 
+
+		//* The next params get filled with pseudo values, as the get replaced
 		//* by the openvz event plugin anyway with values from the template
 		$params['veid'] = 1;
 		$params['diskspace'] = 1;
@@ -3768,181 +3781,182 @@
 		$params['nameserver'] = '8.8.8.8 8.8.4.4';
 		$params['create_dns'] = 'n';
 		$params['capability'] = '';
-		
-		return $this->insertQuery('../vm/form/openvz_vm.tform.php',$client_id,$params,'vm:openvz_vm:on_after_insert');
+
+		return $this->insertQuery('../vm/form/openvz_vm.tform.php', $client_id, $params, 'vm:openvz_vm:on_after_insert');
 	}
-	
+
 	//* Update openvz vm record
 	public function openvz_vm_update($session_id, $client_id, $vm_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../vm/form/openvz_vm.tform.php',$client_id,$vm_id,$params,'vm:openvz_vm:on_after_update');
+		$affected_rows = $this->updateQuery('../vm/form/openvz_vm.tform.php', $client_id, $vm_id, $params, 'vm:openvz_vm:on_after_update');
 		return $affected_rows;
 	}
-	
+
 	//* Delete openvz vm record
 	public function openvz_vm_delete($session_id, $vm_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../vm/form/openvz_vm.tform.php',$vm_id,'vm:openvz_vm:on_after_delete');
+		$affected_rows = $this->deleteQuery('../vm/form/openvz_vm.tform.php', $vm_id, 'vm:openvz_vm:on_after_delete');
 		return $affected_rows;
 	}
-	
+
 	//* Start VM
 	public function openvz_vm_start($session_id, $vm_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
 		$vm = $app->remoting_lib->getDataRecord($vm_id);
-		
+
 		if(!is_array($vm)) {
 			$this->server->fault('action_pending', 'No VM with this ID available.');
 			return false;
 		}
-		
+
 		if($vm['active'] == 'n') {
 			$this->server->fault('action_pending', 'VM is not in active state.');
 			return false;
 		}
-		
+
 		$action = 'openvz_start_vm';
-		
-		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction 
-				WHERE server_id = '".$vm['server_id']."' 
+
+		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
+				WHERE server_id = '".$vm['server_id']."'
 				AND action_type = '$action'
 				AND action_param = '".$vm['veid']."'
 				AND action_state = 'pending'");
-		
+
 		if($tmp['actions'] > 0) {
 			$this->server->fault('action_pending', 'There is already a action pending for this VM.');
 			return false;
 		} else {
 			$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-					"VALUES (".
-					(int)$vm['server_id'] . ", ".
-					time() . ", ".
-					"'".$action."', ".
-					$vm['veid'].", ".
-					"'pending', ".
-					"''".
-					")";
+				"VALUES (".
+				(int)$vm['server_id'] . ", ".
+				time() . ", ".
+				"'".$action."', ".
+				$vm['veid'].", ".
+				"'pending', ".
+				"''".
+				")";
 			$app->db->query($sql);
 		}
 	}
-	
+
 	//* Stop VM
 	public function openvz_vm_stop($session_id, $vm_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
 		$vm = $app->remoting_lib->getDataRecord($vm_id);
-		
+
 		if(!is_array($vm)) {
 			$this->server->fault('action_pending', 'No VM with this ID available.');
 			return false;
 		}
-		
+
 		if($vm['active'] == 'n') {
 			$this->server->fault('action_pending', 'VM is not in active state.');
 			return false;
 		}
-		
+
 		$action = 'openvz_stop_vm';
-		
-		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction 
-				WHERE server_id = '".$vm['server_id']."' 
+
+		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
+				WHERE server_id = '".$vm['server_id']."'
 				AND action_type = '$action'
 				AND action_param = '".$vm['veid']."'
 				AND action_state = 'pending'");
-		
+
 		if($tmp['actions'] > 0) {
 			$this->server->fault('action_pending', 'There is already a action pending for this VM.');
 			return false;
 		} else {
 			$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-					"VALUES (".
-					(int)$vm['server_id'] . ", ".
-					time() . ", ".
-					"'".$action."', ".
-					$vm['veid'].", ".
-					"'pending', ".
-					"''".
-					")";
+				"VALUES (".
+				(int)$vm['server_id'] . ", ".
+				time() . ", ".
+				"'".$action."', ".
+				$vm['veid'].", ".
+				"'pending', ".
+				"''".
+				")";
 			$app->db->query($sql);
 		}
 	}
-	
+
 	//* Restart VM
 	public function openvz_vm_restart($session_id, $vm_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
 		$vm = $app->remoting_lib->getDataRecord($vm_id);
-		
+
 		if(!is_array($vm)) {
 			$this->server->fault('action_pending', 'No VM with this ID available.');
 			return false;
 		}
-		
+
 		if($vm['active'] == 'n') {
 			$this->server->fault('action_pending', 'VM is not in active state.');
 			return false;
 		}
-		
+
 		$action = 'openvz_restart_vm';
-		
-		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction 
-				WHERE server_id = '".$vm['server_id']."' 
+
+		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
+				WHERE server_id = '".$vm['server_id']."'
 				AND action_type = '$action'
 				AND action_param = '".$vm['veid']."'
 				AND action_state = 'pending'");
-		
+
 		if($tmp['actions'] > 0) {
 			$this->server->fault('action_pending', 'There is already a action pending for this VM.');
 			return false;
 		} else {
 			$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-					"VALUES (".
-					(int)$vm['server_id'] . ", ".
-					time() . ", ".
-					"'".$action."', ".
-					$vm['veid'].", ".
-					"'pending', ".
-					"''".
-					")";
+				"VALUES (".
+				(int)$vm['server_id'] . ", ".
+				time() . ", ".
+				"'".$action."', ".
+				$vm['veid'].", ".
+				"'pending', ".
+				"''".
+				")";
 			$app->db->query($sql);
 		}
 	}
-	
-	
-	
-	
+
+
+
+
 }
+
 ?>
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 7ecc663..0b97498 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -35,882 +35,890 @@
 */
 
 /**
-* Formularbehandlung
-*
-* Functions to validate, display and save form values
-*
-*        Database table field definitions
-*
-*        Datatypes:
-*        - INTEGER (Converts data to int automatically)
-*        - DOUBLE
-*        - CURRENCY (Formats digits in currency notation)
-*        - VARCHAR (No format check)
-*        - DATE (Date format, converts from and to UNIX timestamps automatically)
-*
-*        Formtype:
-*        - TEXT (Normal text field)
-*        - PASSWORD (password field, the content will not be displayed again to the user)
-*        - SELECT (Option fiield)
-*        - MULTIPLE (Allows selection of multiple values)
-*
-*        VALUE:
-*        - Value or array
-*
-*        SEPARATOR
-*        - separator char used for fileds with multiple values
-*
-*        Hint: The auto increment (ID) filed of the table has not be be definied separately.
-*
-*/
+ * Formularbehandlung
+ *
+ * Functions to validate, display and save form values
+ *
+ *        Database table field definitions
+ *
+ *        Datatypes:
+ *        - INTEGER (Converts data to int automatically)
+ *        - DOUBLE
+ *        - CURRENCY (Formats digits in currency notation)
+ *        - VARCHAR (No format check)
+ *        - DATE (Date format, converts from and to UNIX timestamps automatically)
+ *
+ *        Formtype:
+ *        - TEXT (Normal text field)
+ *        - PASSWORD (password field, the content will not be displayed again to the user)
+ *        - SELECT (Option fiield)
+ *        - MULTIPLE (Allows selection of multiple values)
+ *
+ *        VALUE:
+ *        - Value or array
+ *
+ *        SEPARATOR
+ *        - separator char used for fileds with multiple values
+ *
+ *        Hint: The auto increment (ID) filed of the table has not be be definied separately.
+ *
+ */
+
 
 class remoting_lib {
-	
-        /**
-        * Definition of the database table (array)
-        * @var tableDef
-        */
-        private $tableDef;
 
-        /**
-        * Private
-        * @var action
-        */
-        private $action;
 
-        /**
-        * Table name (String)
-        * @var table_name
-        */
-        private $table_name;
 
-        /**
-        * Debug Variable
-        * @var debug
-        */
-        private $debug = 0;
+	/**
+	 * Definition of the database table (array)
+	 * @var tableDef
+	 */
+	private $tableDef;
 
-        /**
-        * name of the primary field of the database table (string)
-        * @var table_index
-        */
-        var $table_index;
+	/**
+	 * Private
+	 * @var action
+	 */
+	private $action;
 
-        /**
-        * contains the error messages
-        * @var errorMessage
-        */
-        var $errorMessage = '';
+	/**
+	 * Table name (String)
+	 * @var table_name
+	 */
+	private $table_name;
 
-        var $dateformat = "d.m.Y";
-    	var $formDef = array();
-        var $wordbook;
-        var $module;
-        var $primary_id;
-		var $diffrec = array();
-		
-		var $sys_username;
-		var $sys_userid;
-		var $sys_default_group;
-		var $sys_groups;
-		var $client_id;
-		var $dataRecord;
+	/**
+	 * Debug Variable
+	 * @var debug
+	 */
+	private $debug = 0;
 
-		
-		//* Load the form definition from file.
-    	function loadFormDef($file) {
-			global $app,$conf;
-            
-			include($file);
-				
-			$this->formDef = $form;
-			unset($this->formDef['tabs']);
-                
-			//* Copy all fields from all tabs into one form definition
-			foreach($form['tabs'] as $tab) {
-				foreach($tab['fields'] as $key => $value) {
-					$this->formDef['fields'][$key] = $value;
-				}
+	/**
+	 * name of the primary field of the database table (string)
+	 * @var table_index
+	 */
+	var $table_index;
+
+	/**
+	 * contains the error messages
+	 * @var errorMessage
+	 */
+	var $errorMessage = '';
+
+	var $dateformat = "d.m.Y";
+	var $formDef = array();
+	var $wordbook;
+	var $module;
+	var $primary_id;
+	var $diffrec = array();
+
+	var $sys_username;
+	var $sys_userid;
+	var $sys_default_group;
+	var $sys_groups;
+	var $client_id;
+	var $dataRecord;
+
+
+	//* Load the form definition from file.
+	function loadFormDef($file) {
+		global $app, $conf;
+
+		include $file;
+
+		$this->formDef = $form;
+		unset($this->formDef['tabs']);
+
+		//* Copy all fields from all tabs into one form definition
+		foreach($form['tabs'] as $tab) {
+			foreach($tab['fields'] as $key => $value) {
+				$this->formDef['fields'][$key] = $value;
 			}
-			unset($form);
-			
-			$this->dateformat = $app->lng('conf_format_dateshort');
-				
-            return true;
-        }
-		
-		//* Load the user profile
-		function loadUserProfile($client_id_param = 0) {
-			global $app,$conf;
+		}
+		unset($form);
 
-			$this->client_id = $app->functions->intval($client_id_param);
-            
-			if($this->client_id == 0) {
-				$this->sys_username         = 'admin';
-				$this->sys_userid            = 1;
-				$this->sys_default_group     = 1;
-				$this->sys_groups            = 1;
-				$_SESSION["s"]["user"]["typ"] = 'admin';
-			} else {
-				//* load system user - try with sysuser and before with userid (workarrond)
-				/*
+		$this->dateformat = $app->lng('conf_format_dateshort');
+
+		return true;
+	}
+
+	//* Load the user profile
+	function loadUserProfile($client_id_param = 0) {
+		global $app, $conf;
+
+		$this->client_id = $app->functions->intval($client_id_param);
+
+		if($this->client_id == 0) {
+			$this->sys_username         = 'admin';
+			$this->sys_userid            = 1;
+			$this->sys_default_group     = 1;
+			$this->sys_groups            = 1;
+			$_SESSION["s"]["user"]["typ"] = 'admin';
+		} else {
+			//* load system user - try with sysuser and before with userid (workarrond)
+			/*
 				$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE sysuser_id = $client_id");
 				if(empty($user["userid"])) {
-						$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $client_id");		
+						$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $client_id");
 						if(empty($user["userid"])) {
 								$this->errorMessage .= "No sysuser with the ID $client_id found.";
 								return false;
 						}
 				}*/
-				
-				$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = $this->client_id");
-				$this->sys_username         = $user['username'];
-				$this->sys_userid            = $user['userid'];
-				$this->sys_default_group     = $user['default_group'];
-				$this->sys_groups             = $user['groups'];
-				// $_SESSION["s"]["user"]["typ"] = $user['typ'];
-				// we have to force admin priveliges for the remoting API as some function calls might fail otherwise.
-				$_SESSION["s"]["user"]["typ"] = 'admin';
-			}
+
+			$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = $this->client_id");
+			$this->sys_username         = $user['username'];
+			$this->sys_userid            = $user['userid'];
+			$this->sys_default_group     = $user['default_group'];
+			$this->sys_groups             = $user['groups'];
+			// $_SESSION["s"]["user"]["typ"] = $user['typ'];
+			// we have to force admin priveliges for the remoting API as some function calls might fail otherwise.
+			$_SESSION["s"]["user"]["typ"] = 'admin';
+		}
 
 		return true;
-	    }  
+	}
 
 
-        /**
-        * Converts the data in the array to human readable format
-        * Datatype conversion e.g. to show the data in lists
-        *
-        * @param record
-        * @return record
-        */
-        function decode($record) {
-                $new_record = '';
-				if(is_array($record)) {
-                        foreach($this->formDef['fields'] as $key => $field) {
-                                switch ($field['datatype']) {
-                                case 'VARCHAR':
-                                        $new_record[$key] = stripslashes($record[$key]);
-                                break;
+	/**
+	 * Converts the data in the array to human readable format
+	 * Datatype conversion e.g. to show the data in lists
+	 *
+	 * @param record
+	 * @return record
+	 */
+	function decode($record) {
+		$new_record = '';
+		if(is_array($record)) {
+			foreach($this->formDef['fields'] as $key => $field) {
+				switch ($field['datatype']) {
+				case 'VARCHAR':
+					$new_record[$key] = stripslashes($record[$key]);
+					break;
 
-                                case 'TEXT':
-                                        $new_record[$key] = stripslashes($record[$key]);
-                                break;
+				case 'TEXT':
+					$new_record[$key] = stripslashes($record[$key]);
+					break;
 
-                                case 'DATETSTAMP':
-                                        if($record[$key] > 0) {
-                                                $new_record[$key] = date($this->dateformat,$record[$key]);
-                                        }
-                                break;
-								
-								case 'DATE':
-                                        if($record[$key] != '' && $record[$key] != '0000-00-00') {
-												$tmp = explode('-',$record[$key]);
-                                                $new_record[$key] = date($this->dateformat,mktime(0, 0, 0, $tmp[1]  , $tmp[2], $tmp[0]));
-                                        }
-                                break;
+				case 'DATETSTAMP':
+					if($record[$key] > 0) {
+						$new_record[$key] = date($this->dateformat, $record[$key]);
+					}
+					break;
 
-                                case 'INTEGER':
-                                        $new_record[$key] = $app->functions->intval($record[$key]);
-                                break;
+				case 'DATE':
+					if($record[$key] != '' && $record[$key] != '0000-00-00') {
+						$tmp = explode('-', $record[$key]);
+						$new_record[$key] = date($this->dateformat, mktime(0, 0, 0, $tmp[1]  , $tmp[2], $tmp[0]));
+					}
+					break;
 
-                                case 'DOUBLE':
-                                        $new_record[$key] = $record[$key];
-                                break;
+				case 'INTEGER':
+					$new_record[$key] = $app->functions->intval($record[$key]);
+					break;
 
-                                case 'CURRENCY':
-                                        $new_record[$key] = $app->functions->currency_format($record[$key]);
-                                break;
+				case 'DOUBLE':
+					$new_record[$key] = $record[$key];
+					break;
 
-                                default:
-                                        $new_record[$key] = stripslashes($record[$key]);
-                                }
-                        }
+				case 'CURRENCY':
+					$new_record[$key] = $app->functions->currency_format($record[$key]);
+					break;
 
-                }
-				
-        return $new_record;
-        }
+				default:
+					$new_record[$key] = stripslashes($record[$key]);
+				}
+			}
 
-        /**
-        * Get the key => value array of a form filled from a datasource definitiom
-        *
-        * @param field = array with field definition
-        * @param record = Dataset as array
-        * @return key => value array for the value field of a form
-        */
+		}
 
-        function getDatasourceData($field, $record) {
-                global $app;
+		return $new_record;
+	}
 
-                $values = array();
 
-                if($field["datasource"]["type"] == 'SQL') {
-
-                        // Preparing SQL string. We will replace some
-                        // common placeholders
-                        $querystring = $field["datasource"]["querystring"];
-                        $querystring = str_replace("{USERID}",$this->sys_userid,$querystring);
-                        $querystring = str_replace("{GROUPID}",$this->sys_default_group,$querystring);
-                        $querystring = str_replace("{GROUPS}",$this->sys_groups,$querystring);
-                        $table_idx = $this->formDef['db_table_idx'];
-						
-						$tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0;
-                        $querystring = str_replace("{RECORDID}",$tmp_recordid,$querystring);
-						unset($tmp_recordid);
-						
-                        $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
-						
-                        // Getting the records
-                        $tmp_records = $app->db->queryAllRecords($querystring);
-                        if($app->db->errorMessage != '') die($app->db->errorMessage);
-                        if(is_array($tmp_records)) {
-                                $key_field = $field["datasource"]["keyfield"];
-                                $value_field = $field["datasource"]["valuefield"];
-                                foreach($tmp_records as $tmp_rec) {
-                                        $tmp_id = $tmp_rec[$key_field];
-                                        $values[$tmp_id] = $tmp_rec[$value_field];
-                                }
-                        }
-                }
-
-                if($field["datasource"]["type"] == 'CUSTOM') {
-                        // Calls a custom class to validate this record
-                        if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
-                                $datasource_class = $field["datasource"]['class'];
-                                $datasource_function = $field["datasource"]['function'];
-                                $app->uses($datasource_class);
-                                $values = $app->$datasource_class->$datasource_function($field, $record);
-                        } else {
-                                $this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
-                        }
-                }
-
-                return $values;
-
-        }
-
-        /**
-        /**
-        * Rewrite the record data to be stored in the database
-        * and check values with regular expressions.
-        *
-        * @param record = Datensatz als Array
-        * @return record
-        */
-        function encode($record,$dbencode = true) {
+	/**
+	 * Get the key => value array of a form filled from a datasource definitiom
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return key => value array for the value field of a form
+	 */
+	function getDatasourceData($field, $record) {
 		global $app;
-                if(is_array($record)) {
-                        foreach($this->formDef['fields'] as $key => $field) {
 
-								//* Apply filter to record value
-                                if(isset($field['filters']) && is_array($field['filters'])) {
-									$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SAVE');
-								}
-								
-								//* Validate record value
-								if(isset($field['validators']) && is_array($field['validators'])) {
-									$this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
-								}
+		$values = array();
 
-                                switch ($field['datatype']) {
-                                case 'VARCHAR':
-                                        if(!@is_array($record[$key])) {
-												$new_record[$key] = (isset($record[$key]))?$record[$key]:'';
-                                        } else {
-                                                $new_record[$key] = implode($field['separator'],$record[$key]);
-                                        }
-                                break;
-                                case 'TEXT':
-                                        if(!is_array($record[$key])) {
-                                                $new_record[$key] = $record[$key];
-                                        } else {
-                                                $new_record[$key] = implode($field['separator'],$record[$key]);
-                                        }
-                                break;
-                                case 'DATETSTAMP':
-                                        if($record[$key] > 0) {
-                                                list($tag,$monat,$jahr) = explode('.',$record[$key]);
-                                                $new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
-                                        } else {
-											$new_record[$key] = 0;
-										}
-                                break;
-								case 'DATE':
-                                        if($record[$key] != '' && $record[$key] != '0000-00-00') {
-												if(function_exists('date_parse_from_format')) {
-													$date_parts = date_parse_from_format($this->dateformat,$record[$key]);
-													//list($tag,$monat,$jahr) = explode('.',$record[$key]);
-													$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
-													//$tmp = strptime($record[$key],$this->dateformat);
-													//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
-												} else {
-													//$tmp = strptime($record[$key],$this->dateformat);
-													//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
-													$tmp = strtotime($record[$key]);
-													$new_record[$key] = date('Y-m-d',$tmp);
-												}
-                                        } else {
-											$new_record[$key] = '0000-00-00';
-										}
-                                break;
-                                case 'INTEGER':
-                                        $new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0;
-                                        //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
-                                        //if($key == 'refresh') die($record[$key]);
-                                break;
-                                case 'DOUBLE':
-                                        $new_record[$key] = $record[$key];
-                                break;
-                                case 'CURRENCY':
-                                        $new_record[$key] = str_replace(",",".",$record[$key]);
-                                break;
-                                
-                                case 'DATETIME':
-                                		if (is_array($record[$key]))
-                                		{
-	                                		$filtered_values = array_map(create_function('$item','return (int)$item;'), $record[$key]);
-                                			extract($filtered_values, EXTR_PREFIX_ALL, '_dt');
-                                			
-                                			if ($_dt_day != 0 && $_dt_month != 0 && $_dt_year != 0) {
-	                                			$new_record[$key] = date( 'Y-m-d H:i:s', mktime($_dt_hour, $_dt_minute, $_dt_second, $_dt_month, $_dt_day, $_dt_year) );
-	                                		}
-                                		}
-                                break;
-                                }
+		if($field["datasource"]["type"] == 'SQL') {
 
-                                // The use of the field value is deprecated, use validators instead
-                                if(isset($field['regex']) && $field['regex'] != '') {
-                                        // Enable that "." matches also newlines
-                                        $field['regex'] .= 's';
-                                        if(!preg_match($field['regex'], $record[$key])) {
-                                                $errmsg = $field['errmsg'];
-                                                $this->errorMessage .= $errmsg."\r\n";
-                                        }
-                                }
-								
-								//* Add slashes to all records, when we encode data which shall be inserted into mysql.
-								if($dbencode == true) $new_record[$key] = $app->db->quote($new_record[$key]);
-                        }
-                }
-                if(isset($record['_ispconfig_pw_crypted'])) $new_record['_ispconfig_pw_crypted'] = $record['_ispconfig_pw_crypted']; // this one is not in form definitions!
-                return $new_record;
-        }
-		
-		/**
-        * process the filters for a given field.
-        *
-        * @param field_name = Name of the field
-        * @param field_value = value of the field
-        * @param filters = Array of filters
-		* @param filter_event = 'SAVE'or 'SHOW'
-        * @return record
-        */
+			// Preparing SQL string. We will replace some
+			// common placeholders
+			$querystring = $field["datasource"]["querystring"];
+			$querystring = str_replace("{USERID}", $this->sys_userid, $querystring);
+			$querystring = str_replace("{GROUPID}", $this->sys_default_group, $querystring);
+			$querystring = str_replace("{GROUPS}", $this->sys_groups, $querystring);
+			$table_idx = $this->formDef['db_table_idx'];
 
-        function filterField($field_name, $field_value, $filters, $filter_event) {
+			$tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0;
+			$querystring = str_replace("{RECORDID}", $tmp_recordid, $querystring);
+			unset($tmp_recordid);
 
-			global $app;
-			$returnval = $field_value;
-				
-			//* Loop trough all filters
-			foreach($filters as $filter) {
-				if($filter['event'] == $filter_event) {
-					switch ($filter['type']) {
-						case 'TOLOWER':
-							$returnval = strtolower($field_value);
-						break;
-						case 'TOUPPER':
-							$returnval = strtoupper($field_value);
-						break;
-						case 'IDNTOASCII':
-							$returnval = $app->functions->idn_encode($field_value);
-						break;
-						case 'IDNTOUTF8':
-							$returnval = $app->functions->idn_decode($field_value);
-						break;
-						default:
-							$this->errorMessage .= "Unknown Filter: ".$filter['type'];
-						break;
-					}
+			$querystring = str_replace("{AUTHSQL}", $this->getAuthSQL('r'), $querystring);
+
+			// Getting the records
+			$tmp_records = $app->db->queryAllRecords($querystring);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+			if(is_array($tmp_records)) {
+				$key_field = $field["datasource"]["keyfield"];
+				$value_field = $field["datasource"]["valuefield"];
+				foreach($tmp_records as $tmp_rec) {
+					$tmp_id = $tmp_rec[$key_field];
+					$values[$tmp_id] = $tmp_rec[$value_field];
 				}
 			}
-
-			return $returnval;
-        }
-
-        /**
-        * process the validators for a given field.
-        *
-        * @param field_name = Name of the field
-        * @param field_value = value of the field
-        * @param validatoors = Array of validators
-        * @return record
-        */
-
-        function validateField($field_name, $field_value, $validators) {
-
-                global $app;
-				
-				$escape = '`';
-				
-                // loop trough the validators
-                foreach($validators as $validator) {
-
-                        switch ($validator['type']) {
-                                case 'REGEX':
-                                        $validator['regex'] .= 's';
-                                        if(!preg_match($validator['regex'], $field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                	$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-                                        }
-                                break;
-                                case 'UNIQUE':
-										if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
-										if($validator['allowempty'] == 'n' || ($validator['allowempty'] == 'y' && $field_value != '')){
-											if($this->action == 'NEW') {
-                                                $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
-                                                if($num_rec["number"] > 0) {
-                                                        $errmsg = $validator['errmsg'];
-														if(isset($this->wordbook[$errmsg])) {
-                                                        	$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-														} else {
-															$this->errorMessage .= $errmsg."<br />\r\n";
-														}
-                                                }
-											} else {
-                                                $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
-                                                if($num_rec["number"] > 0) {
-                                                        $errmsg = $validator['errmsg'];
-                                                        if(isset($this->wordbook[$errmsg])) {
-                                                        	$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-														} else {
-															$this->errorMessage .= $errmsg."<br />\r\n";
-														}
-                                                }
-											}
-										}
-                                break;
-                                case 'NOTEMPTY':
-                                        if(empty($field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-                                        }
-                                break;
-                                case 'ISEMAIL':
-                                    if(function_exists('filter_var')) {
-										if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
-											$errmsg = $validator['errmsg'];
-                                            if(isset($this->wordbook[$errmsg])) {
-                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-                                        }
-									} else {
-										if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-                                        }
-									}
-                                break;
-                                case 'ISINT':
-									if(function_exists('filter_var')) {
-										if($field_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) {
-											$errmsg = $validator['errmsg'];
-											if(isset($this->wordbook[$errmsg])) {
-                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-                                        }
-									} else {
-                                        $tmpval = $app->functions->intval($field_value);
-                                        if($tmpval === 0 and !empty($field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-                                        }
-									}
-                                break;
-                                case 'ISPOSITIVE':
-                                        if(!is_numeric($field_value) || $field_value <= 0){
-                                          $errmsg = $validator['errmsg'];
-                                          if(isset($this->wordbook[$errmsg])) {
-                                             $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-										  } else {
-											 $this->errorMessage .= $errmsg."<br />\r\n";
-										  }
-                                        }
-                                break;
-								case 'ISIPV4':
-								$vip=1;
-								if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
-								$groups=explode(".",$field_value);
-								foreach($groups as $group){
-									if($group<0 OR $group>255)
-									$vip=0;
-								}
-								}else{$vip=0;}
-                                        if($vip==0) {
-										$errmsg = $validator['errmsg'];
-                                          if(isset($this->wordbook[$errmsg])) {
-                                             $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-										  } else {
-											 $this->errorMessage .= $errmsg."<br />\r\n";
-										  }
-										}
-                                break;
-								case 'ISIP':
-								if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
-								if($validator['allowempty'] == 'y' && $field_value == '') {
-									//* Do nothing
-								} else {
-								//* Check if its a IPv4 or IPv6 address
-									if(isset($validator['separator']) && $validator['separator'] != '') {
-										//* When the field may contain several IP addresses, split them by the char defined as separator
-										$field_value_array = explode($validator['separator'],$field_value);
-									} else {
-										$field_value_array[] = $field_value;
-									}
-									foreach($field_value_array as $field_value) {
-										if(function_exists('filter_var')) {
-											if(!filter_var($field_value,FILTER_VALIDATE_IP)) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-											}
-										} else {
-											//* Check content with regex, if we use php < 5.2
-											$ip_ok = 0;
-											if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){
-												$ip_ok = 1;
-											}
-											if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
-												$ip_ok = 1;
-											}
-											if($ip_ok == 0) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-											}
-										}
-									}
-								}
-                                break;
-								case 'RANGE':
-                                        //* Checks if the value is within the given range or above / below a value
-										//* Range examples: < 10 = ":10", between 2 and 10 = "2:10", above 5 = "5:".
-										$range_parts = explode(':',trim($validator['range']));
-										$ok = true;
-                                        if($range_parts[0] != '' && $field_value < $range_parts[0]) {
-											$ok = false;
-										}
-										if($range_parts[1] != '' && $field_value > $range_parts[1]) {
-											$ok = false;
-										}
-										if($ok != true) {
-											$errmsg = $validator['errmsg'];
-											if(isset($this->wordbook[$errmsg])) {
-												$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-                                        }
-										unset($range_parts);
-                                break;
-                                case 'CUSTOM':
-                                        // Calls a custom class to validate this record
-                                        if($validator['class'] != '' and $validator['function'] != '') {
-                                                $validator_class = $validator['class'];
-                                                $validator_function = $validator['function'];
-                                                $app->uses($validator_class);
-                                                $this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
-                                        } else {
-                                                $this->errorMessage .= "Custom validator class or function is empty<br />\r\n";
-                                        }
-                                break;
-								default:
-									$this->errorMessage .= "Unknown Validator: ".$validator['type'];
-								break;
-                        }
-
-
-                }
-
-                return true;
-        }
-
-        /**
-        * Create SQL statement
-        *
-        * @param record = Datensatz als Array
-        * @param action = INSERT oder UPDATE
-        * @param primary_id
-        * @return record
-        */
-        function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
-
-                global $app;
-
-                $this->action = $action;
-                $this->primary_id = $primary_id;
-				$this->dataRecord = $record;
-
-                $record = $this->encode($record,true);
-                $sql_insert_key = '';
-                $sql_insert_val = '';
-                $sql_update = '';
-
-                if(!is_array($this->formDef)) $app->error("Form definition not found.");
-
-                // go trough all fields of the tab
-                if(is_array($record)) {
-                foreach($this->formDef['fields'] as $key => $field) {
-                                // Wenn es kein leeres Passwortfeld ist
-                                if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
-                                        // Erzeuge Insert oder Update Quelltext
-                                        if($action == "INSERT") {
-                                                if($field['formtype'] == 'PASSWORD') {
-                                                        $sql_insert_key .= "`$key`, ";
-														if ((isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') || (isset($record['_ispconfig_pw_crypted']) && $record['_ispconfig_pw_crypted'] == 1)) {
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-                                                        } elseif(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
-																$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-														} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
-																$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
-																$record[$key] = $tmp['crypted'];
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-                                                        } else {
-                                                                $record[$key] = md5(stripslashes($record[$key]));
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-                                                        }
-														
-                                                } elseif ($field['formtype'] == 'CHECKBOX') {
-                                                        $sql_insert_key .= "`$key`, ";
-														if($record[$key] == '') {
-															// if a checkbox is not set, we set it to the unchecked value
-															$sql_insert_val .= "'".$field['value'][0]."', ";
-															$record[$key] = $field['value'][0];
-														} else {
-															$sql_insert_val .= "'".$record[$key]."', ";
-														}
-                                                } else {
-                                                        $sql_insert_key .= "`$key`, ";
-                                                        $sql_insert_val .= "'".$record[$key]."', ";
-                                                }
-                                        } else {
-                                                if($field['formtype'] == 'PASSWORD') {
-														if ((isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') || (isset($record['_ispconfig_pw_crypted']) && $record['_ispconfig_pw_crypted'] == 1)) {
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-                                                        } elseif(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
-                                                                $record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-														} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
-																$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
-																$record[$key] = $tmp['crypted'];
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-														} else {
-                                                                $record[$key] = md5(stripslashes($record[$key]));
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-                                                        }
-                                                        
-                                                } elseif ($field['formtype'] == 'CHECKBOX') {
-														if($record[$key] == '') {
-															// if a checkbox is not set, we set it to the unchecked value
-															$sql_update .= "`$key` = '".$field['value'][0]."', ";
-															$record[$key] = $field['value'][0];
-														} else {
-															$sql_update .= "`$key` = '".$record[$key]."', ";
-														}
-                                                } else {
-                                                        $sql_update .= "`$key` = '".$record[$key]."', ";
-                                                }
-                                        }
-                                } else {
-									// we unset the password filed, if empty to tell the datalog function 
-									// that the password has not been changed
-								    unset($record[$key]);
-								}
-                        }
-        }
-
-
-                // Add backticks for incomplete table names
-                if(stristr($this->formDef['db_table'],'.')) {
-                        $escape = '';
-                } else {
-                        $escape = '`';
-                }
-
-
-                if($action == "INSERT") {
-                        if($this->formDef['auth'] == 'yes') {
-                                // Set user and group
-                                $sql_insert_key .= "`sys_userid`, ";
-                                $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$this->sys_userid."', ";
-                                $sql_insert_key .= "`sys_groupid`, ";
-                                $sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$this->sys_default_group."', ";
-                                $sql_insert_key .= "`sys_perm_user`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
-                                $sql_insert_key .= "`sys_perm_group`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
-                                $sql_insert_key .= "`sys_perm_other`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
-                        }
-                        $sql_insert_key = substr($sql_insert_key,0,-2);
-                        $sql_insert_val = substr($sql_insert_val,0,-2);
-                        $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
-                } else {
-                        if($primary_id != 0) {
-                                // update client permissions only if client_id > 0
-								if($this->formDef['auth'] == 'yes' && $this->client_id > 0) {
-									$sql_update .= '`sys_userid` = '.$this->sys_userid.', ';
-									$sql_update .= '`sys_groupid` = '.$this->sys_default_group.', ';
-								}
-								$sql_update = substr($sql_update,0,-2);
-                                $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-                                if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
-                        } else {
-                                $app->error("Primary ID fehlt!");
-                        }
-                }
-                
-                return $sql;
-        }
-		
-		function getDeleteSQL($primary_id) {
-			
-			if(stristr($this->formDef['db_table'],'.')) {
-				$escape = '';
-			} else {
-				$escape = '`';
-			}
-			
-			$sql = "DELETE FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-			return $sql;
 		}
 
+		if($field["datasource"]["type"] == 'CUSTOM') {
+			// Calls a custom class to validate this record
+			if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
+				$datasource_class = $field["datasource"]['class'];
+				$datasource_function = $field["datasource"]['function'];
+				$app->uses($datasource_class);
+				$values = $app->$datasource_class->$datasource_function($field, $record);
+			} else {
+				$this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
+			}
+		}
 
-		function getDataRecord($primary_id) {
-			global $app;
-			$escape = '`';
-			if(@is_numeric($primary_id)) {
-				$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-            	return $app->db->queryOneRecord($sql);
-			} elseif (@is_array($primary_id) || @is_object($primary_id)) {
-                if(@is_object($primary_id)) $primary_id = get_object_vars($primary_id); // do not use cast (array)xxx because it returns private and protected properties!
-				$sql_offset = 0;
-                $sql_limit = 0;
-                $sql_where = '';
-				foreach($primary_id as $key => $val) {
-					$key = $app->db->quote($key);
-					$val = $app->db->quote($val);
-                    if($key == '#OFFSET#') $sql_offset = $app->functions->intval($val);
-                    elseif($key == '#LIMIT#') $sql_limit = $app->functions->intval($val);
-					elseif(stristr($val,'%')) {
-						$sql_where .= "$key like '$val' AND ";
+		return $values;
+
+	}
+
+
+	/**
+	 /**
+	 * Rewrite the record data to be stored in the database
+	 * and check values with regular expressions.
+	 *
+	 * @param record = Datensatz als Array
+	 * @return record
+	 */
+	function encode($record, $dbencode = true) {
+		global $app;
+		if(is_array($record)) {
+			foreach($this->formDef['fields'] as $key => $field) {
+
+				//* Apply filter to record value
+				if(isset($field['filters']) && is_array($field['filters'])) {
+					$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SAVE');
+				}
+
+				//* Validate record value
+				if(isset($field['validators']) && is_array($field['validators'])) {
+					$this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
+				}
+
+				switch ($field['datatype']) {
+				case 'VARCHAR':
+					if(!@is_array($record[$key])) {
+						$new_record[$key] = (isset($record[$key]))?$record[$key]:'';
 					} else {
-						$sql_where .= "$key = '$val' AND ";
+						$new_record[$key] = implode($field['separator'], $record[$key]);
+					}
+					break;
+				case 'TEXT':
+					if(!is_array($record[$key])) {
+						$new_record[$key] = $record[$key];
+					} else {
+						$new_record[$key] = implode($field['separator'], $record[$key]);
+					}
+					break;
+				case 'DATETSTAMP':
+					if($record[$key] > 0) {
+						list($tag, $monat, $jahr) = explode('.', $record[$key]);
+						$new_record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
+					} else {
+						$new_record[$key] = 0;
+					}
+					break;
+				case 'DATE':
+					if($record[$key] != '' && $record[$key] != '0000-00-00') {
+						if(function_exists('date_parse_from_format')) {
+							$date_parts = date_parse_from_format($this->dateformat, $record[$key]);
+							//list($tag,$monat,$jahr) = explode('.',$record[$key]);
+							$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
+							//$tmp = strptime($record[$key],$this->dateformat);
+							//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
+						} else {
+							//$tmp = strptime($record[$key],$this->dateformat);
+							//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
+							$tmp = strtotime($record[$key]);
+							$new_record[$key] = date('Y-m-d', $tmp);
+						}
+					} else {
+						$new_record[$key] = '0000-00-00';
+					}
+					break;
+				case 'INTEGER':
+					$new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0;
+					//if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
+					//if($key == 'refresh') die($record[$key]);
+					break;
+				case 'DOUBLE':
+					$new_record[$key] = $record[$key];
+					break;
+				case 'CURRENCY':
+					$new_record[$key] = str_replace(",", ".", $record[$key]);
+					break;
+
+				case 'DATETIME':
+					if (is_array($record[$key]))
+					{
+						$filtered_values = array_map(create_function('$item', 'return (int)$item;'), $record[$key]);
+						extract($filtered_values, EXTR_PREFIX_ALL, '_dt');
+
+						if ($_dt_day != 0 && $_dt_month != 0 && $_dt_year != 0) {
+							$new_record[$key] = date( 'Y-m-d H:i:s', mktime($_dt_hour, $_dt_minute, $_dt_second, $_dt_month, $_dt_day, $_dt_year) );
+						}
+					}
+					break;
+				}
+
+				// The use of the field value is deprecated, use validators instead
+				if(isset($field['regex']) && $field['regex'] != '') {
+					// Enable that "." matches also newlines
+					$field['regex'] .= 's';
+					if(!preg_match($field['regex'], $record[$key])) {
+						$errmsg = $field['errmsg'];
+						$this->errorMessage .= $errmsg."\r\n";
 					}
 				}
-				$sql_where = substr($sql_where,0,-5);
-                if($sql_where == '') $sql_where = '1';
-				$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$sql_where;
-                if($sql_offset >= 0 && $sql_limit > 0) $sql .= ' LIMIT ' . $sql_offset . ',' . $sql_limit;
-				return $app->db->queryAllRecords($sql);
-			} else {
-				$this->errorMessage = 'The ID must be either an integer or an array.';
-				return array();
-			}
-			
-			
-		}
 
-		function ispconfig_sysuser_add($params,$insert_id){
-			global $conf,$app,$sql1;
-			$username = $app->db->quote($params["username"]);
-			$password = $app->db->quote($params["password"]);
-			if(!isset($params['modules'])) {
-				$modules = $conf['interface_modules_enabled'];
-			} else {
-				$modules = $app->db->quote($params['modules']);
+				//* Add slashes to all records, when we encode data which shall be inserted into mysql.
+				if($dbencode == true) $new_record[$key] = $app->db->quote($new_record[$key]);
 			}
-			if(isset($params['limit_client']) && $params['limit_client'] > 0) {
-				$modules .= ',client';
-			}
-			
-			if(!isset($params['startmodule'])) {			
-				$startmodule = 'dashboard';
-			} else {						
-				$startmodule = $app->db->quote($params["startmodule"]);
-				if(!preg_match('/'.$startmodule.'/',$modules)) {
-					$_modules = explode(',',$modules);
-					$startmodule=$_modules[0];
+		}
+		if(isset($record['_ispconfig_pw_crypted'])) $new_record['_ispconfig_pw_crypted'] = $record['_ispconfig_pw_crypted']; // this one is not in form definitions!
+		return $new_record;
+	}
+
+
+
+
+
+	/**
+	 * process the filters for a given field.
+	 *
+	 * @param field_name = Name of the field
+	 * @param field_value = value of the field
+	 * @param filters = Array of filters
+	 * @param filter_event = 'SAVE'or 'SHOW'
+	 * @return record
+	 */
+	function filterField($field_name, $field_value, $filters, $filter_event) {
+
+		global $app;
+		$returnval = $field_value;
+
+		//* Loop trough all filters
+		foreach($filters as $filter) {
+			if($filter['event'] == $filter_event) {
+				switch ($filter['type']) {
+				case 'TOLOWER':
+					$returnval = strtolower($field_value);
+					break;
+				case 'TOUPPER':
+					$returnval = strtoupper($field_value);
+					break;
+				case 'IDNTOASCII':
+					$returnval = $app->functions->idn_encode($field_value);
+					break;
+				case 'IDNTOUTF8':
+					$returnval = $app->functions->idn_decode($field_value);
+					break;
+				default:
+					$this->errorMessage .= "Unknown Filter: ".$filter['type'];
+					break;
 				}
 			}
-			$usertheme = $app->db->quote($params["usertheme"]);
-			$type = 'user';
-			$active = 1;
-			$insert_id = $app->functions->intval($insert_id);
-			$language = $app->db->quote($params["language"]);
-			$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid');
-			$groups = $groupid;
-			if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($password));
-			$sql1 = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
-			VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,$insert_id)";
-			$app->db->query($sql1);
-		}
-		
-		function ispconfig_sysuser_update($params,$client_id){
-			global $app;
-			$username = $app->db->quote($params["username"]);
-			$clear_password = $app->db->quote($params["password"]);
-			$client_id = $app->functions->intval($client_id);
-			if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($clear_password));
-            else $password = $clear_password;
-			if ($clear_password) $pwstring = ", passwort = '$password'"; else $pwstring ="" ;
-			$sql = "UPDATE sys_user set username = '$username' $pwstring WHERE client_id = $client_id";
-			$app->db->query($sql);
-		}
-		
-		function ispconfig_sysuser_delete($client_id){
-			global $app;
-			$client_id = $app->functions->intval($client_id);
-			$sql = "DELETE FROM sys_user WHERE client_id = $client_id";
-			$app->db->query($sql);
-			$sql = "DELETE FROM sys_group WHERE client_id = $client_id";
-			$app->db->query($sql);
 		}
 
-        function datalogSave($action,$primary_id, $record_old, $record_new) {
-                global $app,$conf;
-				
-				$app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new);
-				return true;
-				
-				/*
+		return $returnval;
+	}
+
+
+	/**
+	 * process the validators for a given field.
+	 *
+	 * @param field_name = Name of the field
+	 * @param field_value = value of the field
+	 * @param validatoors = Array of validators
+	 * @return record
+	 */
+	function validateField($field_name, $field_value, $validators) {
+
+		global $app;
+
+		$escape = '`';
+
+		// loop trough the validators
+		foreach($validators as $validator) {
+
+			switch ($validator['type']) {
+			case 'REGEX':
+				$validator['regex'] .= 's';
+				if(!preg_match($validator['regex'], $field_value)) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'UNIQUE':
+				if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
+				if($validator['allowempty'] == 'n' || ($validator['allowempty'] == 'y' && $field_value != '')){
+					if($this->action == 'NEW') {
+						$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
+						if($num_rec["number"] > 0) {
+							$errmsg = $validator['errmsg'];
+							if(isset($this->wordbook[$errmsg])) {
+								$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+							} else {
+								$this->errorMessage .= $errmsg."<br />\r\n";
+							}
+						}
+					} else {
+						$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
+						if($num_rec["number"] > 0) {
+							$errmsg = $validator['errmsg'];
+							if(isset($this->wordbook[$errmsg])) {
+								$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+							} else {
+								$this->errorMessage .= $errmsg."<br />\r\n";
+							}
+						}
+					}
+				}
+				break;
+			case 'NOTEMPTY':
+				if(empty($field_value)) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'ISEMAIL':
+				if(function_exists('filter_var')) {
+					if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				} else {
+					if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				}
+				break;
+			case 'ISINT':
+				if(function_exists('filter_var')) {
+					if($field_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				} else {
+					$tmpval = $app->functions->intval($field_value);
+					if($tmpval === 0 and !empty($field_value)) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				}
+				break;
+			case 'ISPOSITIVE':
+				if(!is_numeric($field_value) || $field_value <= 0){
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'ISIPV4':
+				$vip=1;
+				if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
+					$groups=explode(".", $field_value);
+					foreach($groups as $group){
+						if($group<0 or $group>255)
+							$vip=0;
+					}
+				}else{$vip=0;}
+				if($vip==0) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'ISIP':
+				if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
+				if($validator['allowempty'] == 'y' && $field_value == '') {
+					//* Do nothing
+				} else {
+					//* Check if its a IPv4 or IPv6 address
+					if(isset($validator['separator']) && $validator['separator'] != '') {
+						//* When the field may contain several IP addresses, split them by the char defined as separator
+						$field_value_array = explode($validator['separator'], $field_value);
+					} else {
+						$field_value_array[] = $field_value;
+					}
+					foreach($field_value_array as $field_value) {
+						if(function_exists('filter_var')) {
+							if(!filter_var($field_value, FILTER_VALIDATE_IP)) {
+								$errmsg = $validator['errmsg'];
+								if(isset($this->wordbook[$errmsg])) {
+									$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+								} else {
+									$this->errorMessage .= $errmsg."<br />\r\n";
+								}
+							}
+						} else {
+							//* Check content with regex, if we use php < 5.2
+							$ip_ok = 0;
+							if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){
+								$ip_ok = 1;
+							}
+							if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
+								$ip_ok = 1;
+							}
+							if($ip_ok == 0) {
+								$errmsg = $validator['errmsg'];
+								if(isset($this->wordbook[$errmsg])) {
+									$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+								} else {
+									$this->errorMessage .= $errmsg."<br />\r\n";
+								}
+							}
+						}
+					}
+				}
+				break;
+			case 'RANGE':
+				//* Checks if the value is within the given range or above / below a value
+				//* Range examples: < 10 = ":10", between 2 and 10 = "2:10", above 5 = "5:".
+				$range_parts = explode(':', trim($validator['range']));
+				$ok = true;
+				if($range_parts[0] != '' && $field_value < $range_parts[0]) {
+					$ok = false;
+				}
+				if($range_parts[1] != '' && $field_value > $range_parts[1]) {
+					$ok = false;
+				}
+				if($ok != true) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				unset($range_parts);
+				break;
+			case 'CUSTOM':
+				// Calls a custom class to validate this record
+				if($validator['class'] != '' and $validator['function'] != '') {
+					$validator_class = $validator['class'];
+					$validator_function = $validator['function'];
+					$app->uses($validator_class);
+					$this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
+				} else {
+					$this->errorMessage .= "Custom validator class or function is empty<br />\r\n";
+				}
+				break;
+			default:
+				$this->errorMessage .= "Unknown Validator: ".$validator['type'];
+				break;
+			}
+
+
+		}
+
+		return true;
+	}
+
+
+	/**
+	 * Create SQL statement
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = INSERT oder UPDATE
+	 * @param primary_id
+	 * @return record
+	 */
+	function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
+
+		global $app;
+
+		$this->action = $action;
+		$this->primary_id = $primary_id;
+		$this->dataRecord = $record;
+
+		$record = $this->encode($record, true);
+		$sql_insert_key = '';
+		$sql_insert_val = '';
+		$sql_update = '';
+
+		if(!is_array($this->formDef)) $app->error("Form definition not found.");
+
+		// go trough all fields of the tab
+		if(is_array($record)) {
+			foreach($this->formDef['fields'] as $key => $field) {
+				// Wenn es kein leeres Passwortfeld ist
+				if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
+					// Erzeuge Insert oder Update Quelltext
+					if($action == "INSERT") {
+						if($field['formtype'] == 'PASSWORD') {
+							$sql_insert_key .= "`$key`, ";
+							if ((isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') || (isset($record['_ispconfig_pw_crypted']) && $record['_ispconfig_pw_crypted'] == 1)) {
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} elseif(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
+								$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
+								$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
+								$record[$key] = $tmp['crypted'];
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} else {
+								$record[$key] = md5(stripslashes($record[$key]));
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							}
+
+						} elseif ($field['formtype'] == 'CHECKBOX') {
+							$sql_insert_key .= "`$key`, ";
+							if($record[$key] == '') {
+								// if a checkbox is not set, we set it to the unchecked value
+								$sql_insert_val .= "'".$field['value'][0]."', ";
+								$record[$key] = $field['value'][0];
+							} else {
+								$sql_insert_val .= "'".$record[$key]."', ";
+							}
+						} else {
+							$sql_insert_key .= "`$key`, ";
+							$sql_insert_val .= "'".$record[$key]."', ";
+						}
+					} else {
+						if($field['formtype'] == 'PASSWORD') {
+							if ((isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') || (isset($record['_ispconfig_pw_crypted']) && $record['_ispconfig_pw_crypted'] == 1)) {
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} elseif(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
+								$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
+								$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
+								$record[$key] = $tmp['crypted'];
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} else {
+								$record[$key] = md5(stripslashes($record[$key]));
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							}
+
+						} elseif ($field['formtype'] == 'CHECKBOX') {
+							if($record[$key] == '') {
+								// if a checkbox is not set, we set it to the unchecked value
+								$sql_update .= "`$key` = '".$field['value'][0]."', ";
+								$record[$key] = $field['value'][0];
+							} else {
+								$sql_update .= "`$key` = '".$record[$key]."', ";
+							}
+						} else {
+							$sql_update .= "`$key` = '".$record[$key]."', ";
+						}
+					}
+				} else {
+					// we unset the password filed, if empty to tell the datalog function
+					// that the password has not been changed
+					unset($record[$key]);
+				}
+			}
+		}
+
+
+		// Add backticks for incomplete table names
+		if(stristr($this->formDef['db_table'], '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
+
+
+		if($action == "INSERT") {
+			if($this->formDef['auth'] == 'yes') {
+				// Set user and group
+				$sql_insert_key .= "`sys_userid`, ";
+				$sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$this->sys_userid."', ";
+				$sql_insert_key .= "`sys_groupid`, ";
+				$sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$this->sys_default_group."', ";
+				$sql_insert_key .= "`sys_perm_user`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
+				$sql_insert_key .= "`sys_perm_group`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
+				$sql_insert_key .= "`sys_perm_other`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
+			}
+			$sql_insert_key = substr($sql_insert_key, 0, -2);
+			$sql_insert_val = substr($sql_insert_val, 0, -2);
+			$sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
+		} else {
+			if($primary_id != 0) {
+				// update client permissions only if client_id > 0
+				if($this->formDef['auth'] == 'yes' && $this->client_id > 0) {
+					$sql_update .= '`sys_userid` = '.$this->sys_userid.', ';
+					$sql_update .= '`sys_groupid` = '.$this->sys_default_group.', ';
+				}
+				$sql_update = substr($sql_update, 0, -2);
+				$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+				if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+			} else {
+				$app->error("Primary ID fehlt!");
+			}
+		}
+
+		return $sql;
+	}
+
+	function getDeleteSQL($primary_id) {
+
+		if(stristr($this->formDef['db_table'], '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
+
+		$sql = "DELETE FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+		return $sql;
+	}
+
+
+	function getDataRecord($primary_id) {
+		global $app;
+		$escape = '`';
+		if(@is_numeric($primary_id)) {
+			$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+			return $app->db->queryOneRecord($sql);
+		} elseif (@is_array($primary_id) || @is_object($primary_id)) {
+			if(@is_object($primary_id)) $primary_id = get_object_vars($primary_id); // do not use cast (array)xxx because it returns private and protected properties!
+			$sql_offset = 0;
+			$sql_limit = 0;
+			$sql_where = '';
+			foreach($primary_id as $key => $val) {
+				$key = $app->db->quote($key);
+				$val = $app->db->quote($val);
+				if($key == '#OFFSET#') $sql_offset = $app->functions->intval($val);
+				elseif($key == '#LIMIT#') $sql_limit = $app->functions->intval($val);
+				elseif(stristr($val, '%')) {
+					$sql_where .= "$key like '$val' AND ";
+				} else {
+					$sql_where .= "$key = '$val' AND ";
+				}
+			}
+			$sql_where = substr($sql_where, 0, -5);
+			if($sql_where == '') $sql_where = '1';
+			$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$sql_where;
+			if($sql_offset >= 0 && $sql_limit > 0) $sql .= ' LIMIT ' . $sql_offset . ',' . $sql_limit;
+			return $app->db->queryAllRecords($sql);
+		} else {
+			$this->errorMessage = 'The ID must be either an integer or an array.';
+			return array();
+		}
+
+
+	}
+
+	function ispconfig_sysuser_add($params, $insert_id){
+		global $conf, $app, $sql1;
+		$username = $app->db->quote($params["username"]);
+		$password = $app->db->quote($params["password"]);
+		if(!isset($params['modules'])) {
+			$modules = $conf['interface_modules_enabled'];
+		} else {
+			$modules = $app->db->quote($params['modules']);
+		}
+		if(isset($params['limit_client']) && $params['limit_client'] > 0) {
+			$modules .= ',client';
+		}
+
+		if(!isset($params['startmodule'])) {
+			$startmodule = 'dashboard';
+		} else {
+			$startmodule = $app->db->quote($params["startmodule"]);
+			if(!preg_match('/'.$startmodule.'/', $modules)) {
+				$_modules = explode(',', $modules);
+				$startmodule=$_modules[0];
+			}
+		}
+		$usertheme = $app->db->quote($params["usertheme"]);
+		$type = 'user';
+		$active = 1;
+		$insert_id = $app->functions->intval($insert_id);
+		$language = $app->db->quote($params["language"]);
+		$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid');
+		$groups = $groupid;
+		if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($password));
+		$sql1 = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
+			VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,$insert_id)";
+		$app->db->query($sql1);
+	}
+
+	function ispconfig_sysuser_update($params, $client_id){
+		global $app;
+		$username = $app->db->quote($params["username"]);
+		$clear_password = $app->db->quote($params["password"]);
+		$client_id = $app->functions->intval($client_id);
+		if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($clear_password));
+		else $password = $clear_password;
+		if ($clear_password) $pwstring = ", passwort = '$password'"; else $pwstring ="" ;
+		$sql = "UPDATE sys_user set username = '$username' $pwstring WHERE client_id = $client_id";
+		$app->db->query($sql);
+	}
+
+	function ispconfig_sysuser_delete($client_id){
+		global $app;
+		$client_id = $app->functions->intval($client_id);
+		$sql = "DELETE FROM sys_user WHERE client_id = $client_id";
+		$app->db->query($sql);
+		$sql = "DELETE FROM sys_group WHERE client_id = $client_id";
+		$app->db->query($sql);
+	}
+
+	function datalogSave($action, $primary_id, $record_old, $record_new) {
+		global $app, $conf;
+
+		$app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new);
+		return true;
+
+		/*
                 // Add backticks for incomplete table names.
                 if(stristr($this->formDef['db_table'],'.')) {
                         $escape = '';
@@ -919,7 +927,7 @@
                 }
 
                 $diffrec = array();
-				
+
                 if(is_array($record_new) && count($record_new) > 0) {
                         foreach($record_new as $key => $val) {
                                 if($record_old[$key] != $val) {
@@ -938,8 +946,8 @@
                         }
                 }
 				$this->diffrec = $diffrec;
-				
-				
+
+
 				// Full diff records for ISPConfig, they have a different format then the simple diffrec
 				$diffrec_full = array();
 
@@ -966,8 +974,8 @@
 								}
                         }
                 }
-				
-				
+
+
 				// Insert the server_id, if the record has a server_id
 				$server_id = (isset($record_old["server_id"]) && $record_old["server_id"] > 0)?$record_old["server_id"]:0;
 				if(isset($record_new["server_id"])) $server_id = $record_new["server_id"];
@@ -977,7 +985,7 @@
                         $username = $app->db->quote($this->sys_username);
                         $dbidx = $this->formDef['db_table_idx'].":".$primary_id;
                         // $action = ($action == 'INSERT')?'i':'u';
-						
+
 						if($action == 'INSERT') $action = 'i';
 						if($action == 'UPDATE') $action = 'u';
 						if($action == 'DELETE') $action = 'd';
@@ -988,7 +996,7 @@
                 return true;
 				*/
 
-        }
+	}
 
 }
 
diff --git a/interface/lib/classes/searchform.inc.php b/interface/lib/classes/searchform.inc.php
index e87547a..cfa8f28 100644
--- a/interface/lib/classes/searchform.inc.php
+++ b/interface/lib/classes/searchform.inc.php
@@ -30,224 +30,225 @@
 
 class searchform {
 
-    public $debug = 0;
-    public $errorMessage;
-    public $listDef;
-    public $searchValues;
-    public $pagingHTML;
-    public $pagingValues;
-    public $searchChanged = 0;
-    public $module;
+	public $debug = 0;
+	public $errorMessage;
+	public $listDef;
+	public $searchValues;
+	public $pagingHTML;
+	public $pagingValues;
+	public $searchChanged = 0;
+	public $module;
 
-    public function loadListDef($file, $module = '')
-    {
-        global $app, $conf;
-        if(!is_file($file)){
-            die("List-Definition: $file not found.");
-        }
-        include_once($file);
-        $this->listDef = $liste;
-        $this->module = $module;
-		
+	public function loadListDef($file, $module = '')
+	{
+		global $app, $conf;
+		if(!is_file($file)){
+			die("List-Definition: $file not found.");
+		}
+		include_once $file;
+		$this->listDef = $liste;
+		$this->module = $module;
+
 		//* Fill datasources
 		foreach($this->listDef['item'] as $key => $field) {
 			if(is_array($field['datasource'])) {
-                $this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
-            }
-		}	
-        return true;
-    }
-		
+				$this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
+			}
+		}
+		return true;
+	}
+
 	/**
-    * Get the key => value array of a form filed from a datasource definitiom
-    *
-    * @param field = array with field definition
-    * @param record = Dataset as array
-    * @return key => value array for the value field of a form
-    */
+	 * Get the key => value array of a form filed from a datasource definitiom
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return key => value array for the value field of a form
+	 */
 
-    public function getDatasourceData($field)
-    {
-        global $app;
-        $values = array();
 
-        if($field['datasource']['type'] == 'SQL') {
-            //* Preparing SQL string. We will replace some common placeholders
-            $querystring = $field['datasource']['querystring'];
-            $querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
-            $querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
-            $querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
-            $table_idx = $this->formDef['db_table_idx'];
-            //$querystring = str_replace('{RECORDID}',$record[$table_idx],$querystring);
-            $app->uses('tform');
-            $querystring = str_replace('{AUTHSQL}', $app->tform->getAuthSQL('r'), $querystring);
+	public function getDatasourceData($field)
+	{
+		global $app;
+		$values = array();
 
-            //* Getting the records
-            $tmp_records = $app->db->queryAllRecords($querystring);
-            if($app->db->errorMessage != ''){
-                die($app->db->errorMessage);
-            }
-            if(is_array($tmp_records)) {
-                $key_field = $field['datasource']['keyfield'];
-                $value_field = $field['datasource']['valuefield'];
-                foreach($tmp_records as $tmp_rec) {
-                    $values[$tmp_rec[$key_field]] = $tmp_rec[$value_field];
-                }
-            }
-        }
-        if($field['datasource']['type'] == 'CUSTOM') {
-            //* Calls a custom class to validate this record
-            if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
-                $datasource_class = $field['datasource']['class'];
-                $datasource_function = $field['datasource']['function'];
-                $app->uses($datasource_class);
-                $record = array();
-                $values = $app->$datasource_class->$datasource_function($field, $record);
-            }else{
-                $this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
-            }
-        }
-        return $values;
-    }
+		if($field['datasource']['type'] == 'SQL') {
+			//* Preparing SQL string. We will replace some common placeholders
+			$querystring = $field['datasource']['querystring'];
+			$querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
+			$querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
+			$querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
+			$table_idx = $this->formDef['db_table_idx'];
+			//$querystring = str_replace('{RECORDID}',$record[$table_idx],$querystring);
+			$app->uses('tform');
+			$querystring = str_replace('{AUTHSQL}', $app->tform->getAuthSQL('r'), $querystring);
 
-    public function getSearchSQL($sql_where = '')
-    {
-        global $db;
+			//* Getting the records
+			$tmp_records = $app->db->queryAllRecords($querystring);
+			if($app->db->errorMessage != ''){
+				die($app->db->errorMessage);
+			}
+			if(is_array($tmp_records)) {
+				$key_field = $field['datasource']['keyfield'];
+				$value_field = $field['datasource']['valuefield'];
+				foreach($tmp_records as $tmp_rec) {
+					$values[$tmp_rec[$key_field]] = $tmp_rec[$value_field];
+				}
+			}
+		}
+		if($field['datasource']['type'] == 'CUSTOM') {
+			//* Calls a custom class to validate this record
+			if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
+				$datasource_class = $field['datasource']['class'];
+				$datasource_function = $field['datasource']['function'];
+				$app->uses($datasource_class);
+				$record = array();
+				$values = $app->$datasource_class->$datasource_function($field, $record);
+			}else{
+				$this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
+			}
+		}
+		return $values;
+	}
 
-        //* Config vars
-        $list_name = $this->listDef['name'];
-        $search_prefix = $this->listDef['search_prefix'];
+	public function getSearchSQL($sql_where = '')
+	{
+		global $db;
 
-        //* store retrieval query
-        foreach($this->listDef['item'] as $i) {
-            $field = $i['field'];
+		//* Config vars
+		$list_name = $this->listDef['name'];
+		$search_prefix = $this->listDef['search_prefix'];
 
-            //* TODO ?  hat sich die suche ge�ndert - has itself search  ?
-            $ki = $search_prefix.$field;
-            if(isset($_REQUEST) and $_REQUEST[$ki] != $_SESSION['search'][$list_name][$ki]){
-                $this->searchChanged = 1;
-            }
+		//* store retrieval query
+		foreach($this->listDef['item'] as $i) {
+			$field = $i['field'];
 
-            //* suchfield in session store.
-            if(isset($_REQUEST[$ki])){
-                $_SESSION['search'][$list_name][$ki] = $_REQUEST[$ki];
-            }
+			//* TODO ?  hat sich die suche ge�ndert - has itself search  ?
+			$ki = $search_prefix.$field;
+			if(isset($_REQUEST) and $_REQUEST[$ki] != $_SESSION['search'][$list_name][$ki]){
+				$this->searchChanged = 1;
+			}
 
-            if($i['formtype'] == 'SELECT'){
-                if(is_array($i['value'])) {
-                    $out = '<option value=""></option>';
-                    foreach($i['value'] as $k => $v) {
-                        $selected = ($k == $_SESSION['search'][$list_name][$ki] && $_SESSION['search'][$list_name][$ki] != '') ? ' SELECTED' : '';
-                        $out .= "<option value='$k'$selected>$v</option>\r\n";
-                    }
-                }
-                $this->searchValues[$ki] = $out;
-            }else{
-                $this->searchValues[$ki] = $_SESSION['search'][$list_name][$ki];
-            }
-        }
+			//* suchfield in session store.
+			if(isset($_REQUEST[$ki])){
+				$_SESSION['search'][$list_name][$ki] = $_REQUEST[$ki];
+			}
 
-        //* store variables in object. $this->searchValues = $_SESSION["search"][$list_name];
-        foreach($this->listDef['item'] as $i) {
-            $field = $i['field'];
-            //if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
+			if($i['formtype'] == 'SELECT'){
+				if(is_array($i['value'])) {
+					$out = '<option value=""></option>';
+					foreach($i['value'] as $k => $v) {
+						$selected = ($k == $_SESSION['search'][$list_name][$ki] && $_SESSION['search'][$list_name][$ki] != '') ? ' SELECTED' : '';
+						$out .= "<option value='$k'$selected>$v</option>\r\n";
+					}
+				}
+				$this->searchValues[$ki] = $out;
+			}else{
+				$this->searchValues[$ki] = $_SESSION['search'][$list_name][$ki];
+			}
+		}
+
+		//* store variables in object. $this->searchValues = $_SESSION["search"][$list_name];
+		foreach($this->listDef['item'] as $i) {
+			$field = $i['field'];
+			//if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
 			if($_SESSION['search'][$list_name][$ki] != ''){
-                $sql_where .= " $field ".$i['op']." '".$i['prefix'].$_SESSION['search'][$list_name][$ki].$i['suffix']."' and";
-            }
-        }
-        return ($sql_where != '') ? substr($sql_where, 0, -3) : '1';
-    }
+				$sql_where .= " $field ".$i['op']." '".$i['prefix'].$_SESSION['search'][$list_name][$ki].$i['suffix']."' and";
+			}
+		}
+		return ($sql_where != '') ? substr($sql_where, 0, -3) : '1';
+	}
 
-    public function getPagingSQL($sql_where = '1') {
-        global $app, $conf;
-
-        $list_name          = $this->listDef['name'];
-        $search_prefix      = $this->listDef['search_prefix'];
-        $records_per_page   = $this->listDef['records_per_page'];
-        $table              = $this->listDef['table'];
-
-        //* set page to seror id session not set
-        if($_SESSION['search'][$list_name]['page'] == '')   $_SESSION['search'][$list_name]['page'] = 0;
-
-        //* Set page size to request if set
-        if(isset($_REQUEST['page']))    $_SESSION['search'][$list_name]['page'] = $_REQUEST['page']; 
-
-        //* TODO PAGE to 0 set, if look for themselves ge?ndert. =  page auf 0 setzen, wenn suche sich ge�ndert hat.
-        if($this->searchChanged == 1)   $_SESSION['search'][$list_name]['page'] = 0;
-
-        $sql_von = $_SESSION['search'][$list_name]['page'] * $records_per_page;
-        $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
-        $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
-
-        $vars['list_file']      = $this->listDef['file'];
-        $vars['page']           = $_SESSION['search'][$list_name]['page'];
-        $vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
-        $vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
-        $vars['pages']          = $pages;
-        $vars['max_pages']      = $pages + 1;
-        $vars['records_gesamt'] = $record_count['anzahl'];
-        $vars['page_params']    = $this->listDef['page_params'];
-
-        if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
-        if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
-
-        $this->pagingValues = $vars;
-        $this->pagingHTML = $this->getPagingHTML($vars);
-
-        return "LIMIT $sql_von, $records_per_page";
-    }
-
-    public function getPagingHTML($vars) {
-        global $app;
-        $page_params = $vars['page_params'];
-        $list_file = $vars['list_file'];
-        $content = '<a href="'.$list_file.'?page=0'.$page_params.'"><img src="../themes/iprg/images/btn_left.png" border="0"></a> &nbsp; ';
-        if($vars['show_page_back'] == 1){
-            $content .= '<a href="'.$list_file.'?page='.$vars['last_page'].$page_params.'"><img src="../themes/iprg/images/btn_back.png" border="0"></a> ';
-        }
-        $content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
-        if($vars['show_page_next'] == 1){
-            $content .= '<a href="'.$list_file.'?page='.$vars['next_page'].$page_params.'"><img src="../themes/iprg/images/btn_next.png" border="0"></a> &nbsp; ';
-        } else{
-            $content .= '&nbsp;';
-        }
-        $content .= '<a href="'.$list_file.'?page='.$vars['pages'].$page_params.'"> <img src="../themes/iprg/images/btn_right.png" border="0"></a>';
-        return $content;
-    }
-		
-    public function getPagingHTMLasTXT($vars)
-    {
-        global $app;
-        $page_params = $vars['page_params'];
-        $list_file = $vars['list_file'];
-        $content = '[<a href="'.$list_file.'?page=0'.$page_params.'">|&lt;&lt; </a>]';
-        if($vars['show_page_back'] == 1){
-            $content .= '[<< <a href="'.$list_file.'?page='.$vars['last_page'].$page_params.'">'.$app->lng('Back').'</a>] ';
-        }
-        $content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
-        if($vars['show_page_next'] == 1){
-            $content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$page_params.'">'.$app->lng('Next').' >></a>] ';
-        }
-        $content .= '[<a href="'.$list_file.'?page='.$vars['pages'].$page_params.'"> &gt;&gt;|</a>]';
-        return $content;
-    }
-
-    public function getSortSQL()
-    {
-        $sort_field = $this->listDef['sort_field'];
-        $sort_direction = $this->listDef['sort_direction'];
-        return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
-    }
-		
-	public function saveSearchSettings($searchresult_name)
-    {
+	public function getPagingSQL($sql_where = '1') {
 		global $app, $conf;
-		
+
+		$list_name          = $this->listDef['name'];
+		$search_prefix      = $this->listDef['search_prefix'];
+		$records_per_page   = $this->listDef['records_per_page'];
+		$table              = $this->listDef['table'];
+
+		//* set page to seror id session not set
+		if($_SESSION['search'][$list_name]['page'] == '')   $_SESSION['search'][$list_name]['page'] = 0;
+
+		//* Set page size to request if set
+		if(isset($_REQUEST['page']))    $_SESSION['search'][$list_name]['page'] = $_REQUEST['page'];
+
+		//* TODO PAGE to 0 set, if look for themselves ge?ndert. =  page auf 0 setzen, wenn suche sich ge�ndert hat.
+		if($this->searchChanged == 1)   $_SESSION['search'][$list_name]['page'] = 0;
+
+		$sql_von = $_SESSION['search'][$list_name]['page'] * $records_per_page;
+		$record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
+		$pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
+
+		$vars['list_file']      = $this->listDef['file'];
+		$vars['page']           = $_SESSION['search'][$list_name]['page'];
+		$vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
+		$vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
+		$vars['pages']          = $pages;
+		$vars['max_pages']      = $pages + 1;
+		$vars['records_gesamt'] = $record_count['anzahl'];
+		$vars['page_params']    = $this->listDef['page_params'];
+
+		if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
+		if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
+
+		$this->pagingValues = $vars;
+		$this->pagingHTML = $this->getPagingHTML($vars);
+
+		return "LIMIT $sql_von, $records_per_page";
+	}
+
+	public function getPagingHTML($vars) {
+		global $app;
+		$page_params = $vars['page_params'];
+		$list_file = $vars['list_file'];
+		$content = '<a href="'.$list_file.'?page=0'.$page_params.'"><img src="../themes/iprg/images/btn_left.png" border="0"></a> &nbsp; ';
+		if($vars['show_page_back'] == 1){
+			$content .= '<a href="'.$list_file.'?page='.$vars['last_page'].$page_params.'"><img src="../themes/iprg/images/btn_back.png" border="0"></a> ';
+		}
+		$content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
+		if($vars['show_page_next'] == 1){
+			$content .= '<a href="'.$list_file.'?page='.$vars['next_page'].$page_params.'"><img src="../themes/iprg/images/btn_next.png" border="0"></a> &nbsp; ';
+		} else{
+			$content .= '&nbsp;';
+		}
+		$content .= '<a href="'.$list_file.'?page='.$vars['pages'].$page_params.'"> <img src="../themes/iprg/images/btn_right.png" border="0"></a>';
+		return $content;
+	}
+
+	public function getPagingHTMLasTXT($vars)
+	{
+		global $app;
+		$page_params = $vars['page_params'];
+		$list_file = $vars['list_file'];
+		$content = '[<a href="'.$list_file.'?page=0'.$page_params.'">|&lt;&lt; </a>]';
+		if($vars['show_page_back'] == 1){
+			$content .= '[<< <a href="'.$list_file.'?page='.$vars['last_page'].$page_params.'">'.$app->lng('Back').'</a>] ';
+		}
+		$content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
+		if($vars['show_page_next'] == 1){
+			$content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$page_params.'">'.$app->lng('Next').' >></a>] ';
+		}
+		$content .= '[<a href="'.$list_file.'?page='.$vars['pages'].$page_params.'"> &gt;&gt;|</a>]';
+		return $content;
+	}
+
+	public function getSortSQL()
+	{
+		$sort_field = $this->listDef['sort_field'];
+		$sort_direction = $this->listDef['sort_direction'];
+		return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
+	}
+
+	public function saveSearchSettings($searchresult_name)
+	{
+		global $app, $conf;
+
 		$list_name = $this->listDef['name'];
 		$settings = $_SESSION['search'][$list_name];
 		unset($settings['page']);
 		$data = $app->db->quote(serialize($settings));
-		
+
 		$userid = $_SESSION['s']['user']['userid'];
 		$groupid = $_SESSION['s']['user']['default_group'];
 		$sys_perm_user = 'riud';
@@ -256,92 +257,93 @@
 		$module = $_SESSION['s']['module']['name'];
 		$searchform = $this->listDef['name'];
 		$title = $searchresult_name;
-		
+
 		$sql = 'INSERT INTO `searchform` ( '
-               .'`sys_userid` , `sys_groupid` , `sys_perm_user` , `sys_perm_group` , `sys_perm_other` , `module` , `searchform` , `title` , `data` '
-               .')VALUES ('
-               ."'$userid', '$groupid', '$sys_perm_user', '$sys_perm_group', '$sys_perm_other', '$module', '$searchform', '$title', '$data')";
+			.'`sys_userid` , `sys_groupid` , `sys_perm_user` , `sys_perm_group` , `sys_perm_other` , `module` , `searchform` , `title` , `data` '
+			.')VALUES ('
+			."'$userid', '$groupid', '$sys_perm_user', '$sys_perm_group', '$sys_perm_other', '$module', '$searchform', '$title', '$data')";
 		$app->db->query($sql);
 	}
 
-    public function decode($record)
-    {
-        global $app;
-        if(is_array($record)) {
-            foreach($this->listDef['item'] as $field) {
-                $key = $field['field'];
-                switch ($field['datatype'])
-                {
-                    case 'DATE':
-                        if($val > 0) {
-                            $record[$key] = date($this->dateformat, $record[$key]);
-                        }
-                        break;
-    
-                    case 'INTEGER':
-                        $record[$key] = $app->functions->intval($record[$key]);
-                        break;
-    
-                    case 'DOUBLE':
-                        $record[$key] = $record[$key];
-                        break;
-    
-                    case 'CURRENCY':
-                        $record[$key] = number_format($record[$key], 2, ',', '');
-                        break;
-    
-                    
-                    case 'VARCHAR':
-                    case 'TEXT':
-                    default:
-                        $record[$key] = stripslashes($record[$key]);
-                        break;
-                    }
-            }
-        }
-        return $record;
-    }
+	public function decode($record)
+	{
+		global $app;
+		if(is_array($record)) {
+			foreach($this->listDef['item'] as $field) {
+				$key = $field['field'];
+				switch ($field['datatype'])
+				{
+				case 'DATE':
+					if($val > 0) {
+						$record[$key] = date($this->dateformat, $record[$key]);
+					}
+					break;
 
-    public function encode($record)
-    {
-	global $app;
-        if(is_array($record)) {
-            foreach($this->listDef['item'] as $field) {
-                $key = $field['field'];
-                switch ($field['datatype'])
-                {
-                    case 'VARCHAR':
-                    case 'TEXT':
-                        if(!is_array($record[$key])) {
-                            $record[$key] = $app->db->quote($record[$key]);
-                        } else {
-                            $record[$key] = implode($this->tableDef[$key]['separator'],$record[$key]);
-                        }
-                        break;
+				case 'INTEGER':
+					$record[$key] = $app->functions->intval($record[$key]);
+					break;
 
-                    case 'DATE':
-                        if($record[$key] > 0) {
-                            list($tag, $monat, $jahr) = explode('.', $record[$key]);
-                            $record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
-                        }
-                        break;
+				case 'DOUBLE':
+					$record[$key] = $record[$key];
+					break;
 
-                    case 'INTEGER':
-                        $record[$key] = $app->functions->intval($record[$key]);
-                        break;
+				case 'CURRENCY':
+					$record[$key] = number_format($record[$key], 2, ',', '');
+					break;
 
-                    case 'DOUBLE':
-                        $record[$key] = $app->db->quote($record[$key]);
-                        break;
 
-                    case 'CURRENCY':
-                        $record[$key] = str_replace(',', '.', $record[$key]);
-                        break;
-                }
-            }
-        }
-        return $record;
-    }
+				case 'VARCHAR':
+				case 'TEXT':
+				default:
+					$record[$key] = stripslashes($record[$key]);
+					break;
+				}
+			}
+		}
+		return $record;
+	}
+
+	public function encode($record)
+	{
+		global $app;
+		if(is_array($record)) {
+			foreach($this->listDef['item'] as $field) {
+				$key = $field['field'];
+				switch ($field['datatype'])
+				{
+				case 'VARCHAR':
+				case 'TEXT':
+					if(!is_array($record[$key])) {
+						$record[$key] = $app->db->quote($record[$key]);
+					} else {
+						$record[$key] = implode($this->tableDef[$key]['separator'], $record[$key]);
+					}
+					break;
+
+				case 'DATE':
+					if($record[$key] > 0) {
+						list($tag, $monat, $jahr) = explode('.', $record[$key]);
+						$record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
+					}
+					break;
+
+				case 'INTEGER':
+					$record[$key] = $app->functions->intval($record[$key]);
+					break;
+
+				case 'DOUBLE':
+					$record[$key] = $app->db->quote($record[$key]);
+					break;
+
+				case 'CURRENCY':
+					$record[$key] = str_replace(',', '.', $record[$key]);
+					break;
+				}
+			}
+		}
+		return $record;
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/searchform_actions.inc.php b/interface/lib/classes/searchform_actions.inc.php
index a451f4a..e48eb85 100644
--- a/interface/lib/classes/searchform_actions.inc.php
+++ b/interface/lib/classes/searchform_actions.inc.php
@@ -29,44 +29,44 @@
 */
 
 class searchform_actions {
-	
+
 	var $id;
 	var $idx_key;
 	var $DataRowColor;
 	var $SQLExtWhere = '';
 	var $SQLOrderBy = '';
-	
+
 	function onLoad() {
 		global $app, $conf, $list_def_file;
-		
+
 		if(!is_object($app->tpl)) $app->uses('tpl');
 		if(!is_object($app->searchform)) $app->uses('searchform');
 		if(!is_object($app->tform)) $app->uses('tform');
-		
+
 		// Load list definition
 		$app->searchform->loadListDef($list_def_file);
-		
+
 		// Delete the search form contents, if requested
 		if($_REQUEST["empty_searchfields"] == 'yes') {
 			$list_name = $app->searchform->listDef["name"];
 			unset($_SESSION["search"][$list_name]);
 		}
-		
+
 		// Save the search for later usage
 		if($_REQUEST["btn_submit_search_save"] && $_REQUEST["search_save_as"] != '') {
 			$app->searchform->saveSearchSettings($_REQUEST["search_save_as"]);
 		}
-		
+
 		// Set th returnto value for forms
 		$_SESSION["s"]["form"]["return_to_url"] = $app->searchform->listDef["file"];
-		
+
 		if(!is_file('templates/'.$app->searchform->listDef["name"].'_search.htm')) {
 			$app->uses('searchform_tpl_generator');
 			$app->searchform_tpl_generator->buildHTML($app->searchform->listDef);
 		}
-		
+
 		$app->tpl->newTemplate("searchpage.tpl.htm");
-		$app->tpl->setInclude('content_tpl','templates/'.$app->searchform->listDef["name"].'_search.htm');
+		$app->tpl->setInclude('content_tpl', 'templates/'.$app->searchform->listDef["name"].'_search.htm');
 
 		// Getting Datasets from DB
 		$records = $app->db->queryAllRecords($this->getQueryString());
@@ -74,30 +74,30 @@
 
 		$this->DataRowColor = "#FFFFFF";
 		if(is_array($records)) {
-			$this->idx_key = $app->searchform->listDef["table_idx"]; 
+			$this->idx_key = $app->searchform->listDef["table_idx"];
 			foreach($records as $rec) {
 				$records_new[] = $this->prepareDataRow($rec);
 			}
 		}
 
-		$app->tpl->setLoop('records',$records_new);
-		
+		$app->tpl->setLoop('records', $records_new);
+
 		//print_r($records_new);
 
 		$this->onShow();
-		
-		
+
+
 	}
-	
+
 	function prepareDataRow($rec) {
 		global $app;
-		
+
 		$rec = $app->searchform->decode($rec);
 
 		// Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
 		$rec["bgcolor"] = $this->DataRowColor;
-		
+
 		// substitute value for select fields
 		foreach($app->searchform->listDef["item"] as $field) {
 			$key = $field["field"];
@@ -110,16 +110,16 @@
 				$rec[$key] = $field['value'][$rec[$key]];
 			}
 		}
-		
+
 		// The variable "id" contains always the index variable
 		$rec["id"] = $rec[$this->idx_key];
-		
+
 		return $rec;
 	}
-	
+
 	function getQueryString() {
 		global $app;
-		
+
 		// Generate the search sql
 		if($app->searchform->listDef["auth"] != 'no') {
 			if($_SESSION["s"]["user"]["typ"] == "admin") {
@@ -128,74 +128,75 @@
 				$sql_where = $app->tform->getAuthSQL('r')." and";
 			}
 		}
-		
+
 		if($this->SQLExtWhere != '') {
 			$sql_where .= " ".$this->SQLExtWhere." and";
 		}
 
 		$sql_where = $app->searchform->getSearchSQL($sql_where);
 		$app->tpl->setVar($app->searchform->searchValues);
-		
+
 		$order_by_sql = $this->SQLOrderBy;
 
 		// Generate SQL for paging
 		$limit_sql = $app->searchform->getPagingSQL($sql_where);
-		$app->tpl->setVar("paging",$app->searchform->pagingHTML);
+		$app->tpl->setVar("paging", $app->searchform->pagingHTML);
 
 		return "SELECT * FROM ".$app->searchform->listDef["table"]." WHERE $sql_where $order_by_sql $limit_sql";
-		
+
 	}
-	
-	
+
+
 	function onShow() {
 		global $app;
-		
+
 		// Language File setzen
 		$lng_file = ISPC_WEB_PATH.'/lang/lib/lang/'.$_SESSION['s']['language'].'_list.lng';
 		if(!file_exists($lng_file)) $lng_file = ISPC_WEB_PATH.'/lang/lib/lang/en_'.'_list.lng';
-		include($lng_file);
+		include $lng_file;
 		$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->searchform->listDef['name']."_search.lng";
 		if(!file_exists($lng_file)) $lng_file = 'lib/lang/en_'.$app->searchform->listDef['name']."_search.lng";
-		include($lng_file);
+		include $lng_file;
 		$app->tpl->setVar($wb);
-		$app->tpl->setVar("form_action",$app->searchform->listDef["file"]);
-		
+		$app->tpl->setVar("form_action", $app->searchform->listDef["file"]);
+
 		// Parse the templates and send output to the browser
 		$this->onShowEnd();
 	}
-	
+
 	function onShowEnd() {
 		global $app;
 
 		if(count($_REQUEST) > 0) {
-			$app->tpl->setVar('searchresult_visible',1);
-			if($_REQUEST['searchresult_visible'] == 'no') $app->tpl->setVar('searchresult_visible',0);
-			
+			$app->tpl->setVar('searchresult_visible', 1);
+			if($_REQUEST['searchresult_visible'] == 'no') $app->tpl->setVar('searchresult_visible', 0);
+
 			if($_REQUEST['searchform_visible'] == 'yes') {
-				$app->tpl->setVar('searchform_visible',1);
+				$app->tpl->setVar('searchform_visible', 1);
 			} else {
-				$app->tpl->setVar('searchform_visible',0);
+				$app->tpl->setVar('searchform_visible', 0);
 			}
 		} else {
-			$app->tpl->setVar('searchform_visible',1);
-			if($_REQUEST['searchform_visible'] == 'no') $app->tpl->setVar('searchform_visible',0);
-			
+			$app->tpl->setVar('searchform_visible', 1);
+			if($_REQUEST['searchform_visible'] == 'no') $app->tpl->setVar('searchform_visible', 0);
+
 			if($_REQUEST['searchresult_visible'] == 'yes') {
-				$app->tpl->setVar('searchresult_visible',1);
+				$app->tpl->setVar('searchresult_visible', 1);
 			} else {
-				$app->tpl->setVar('searchresult_visible',0);
+				$app->tpl->setVar('searchresult_visible', 0);
 			}
 		}
-		
+
 		// make columns visible
-		$visible_columns = explode(",",$app->searchform->listDef['default_columns']);
+		$visible_columns = explode(",", $app->searchform->listDef['default_columns']);
 		foreach($visible_columns as $col) {
-			$app->tpl->setVar($col.'_visible',1);
+			$app->tpl->setVar($col.'_visible', 1);
 		}
-		
+
 		$app->tpl_defaults();
 		$app->tpl->pparse();
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/searchform_tpl_generator.inc.php b/interface/lib/classes/searchform_tpl_generator.inc.php
index 4232e3b..81e2f4e 100644
--- a/interface/lib/classes/searchform_tpl_generator.inc.php
+++ b/interface/lib/classes/searchform_tpl_generator.inc.php
@@ -29,11 +29,11 @@
 */
 
 class searchform_tpl_generator {
-	
-	function buildHTML($listDef,$module = '') {
-		
+
+	function buildHTML($listDef, $module = '') {
+
 		global $app;
-		
+
 		$lang = array();
 		$html = '<form name="myform" action="'.$listDef["file"].'" method="POST">
 <div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
@@ -43,23 +43,23 @@
 		$lang["list_head_txt"] = $listDef["name"];
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
-			
+
 			if($field["formtype"] == 'SELECT') {
 				$html .= "
   <tr>
     <td class=\"frmText11\"><tmpl_var name=\"".$key."_txt\">:</td>
 	<td><select name=\"".$listDef["search_prefix"].$key."\">{tmpl_var name='".$listDef["search_prefix"].$key."'}</select></td>
   </tr>";
-  			} else {
+			} else {
 				$html .= "
   <tr>
     <td class=\"frmText11\"><tmpl_var name=\"".$key."_txt\">:</td>
 	<td><input type=\"text\" name=\"".$listDef["search_prefix"].$key."\" value=\"{tmpl_var name='".$listDef["search_prefix"].$key."'}\" class=\"text\" /></td>
   </tr>";
-  			}
+			}
 		}
 
-$html .= '
+		$html .= '
   <tr>
     <td colspan="2" align="center"><input name="Filter" type="image" id="Filter" src="../themes/iprg/images/btn_filter.png"></td>
   </tr>
@@ -67,14 +67,14 @@
 </tmpl_if>
 <tmpl_if name="searchresult_visible">
 <p>
-[<a class="frmText11" href="domain_search.php?searchform_visible=yes&searchresult_visible=no&empty_searchfields=yes">Neue Suche</a>] 
+[<a class="frmText11" href="domain_search.php?searchform_visible=yes&searchresult_visible=no&empty_searchfields=yes">Neue Suche</a>]
 [<a class="frmText11" href="domain_search.php?searchform_visible=yes&searchresult_visible=no&empty_searchfields=no">Suchkriterien ändern</a>]
-Suche speichern unter: <input type="text" name="search_save_as" /> <input type="submit" name="btn_submit_search_save" value="Speichern" /> 
+Suche speichern unter: <input type="text" name="search_save_as" /> <input type="submit" name="btn_submit_search_save" value="Speichern" />
 </p>
 <table width="100%" border="0" cellspacing="0" cellpadding="4">
   <tr>
 ';
-		
+
 		$lang["list_head_txt"] = $listDef["name"];
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
@@ -83,25 +83,25 @@
 			$html .= "</tmpl_if>";
 			$lang[$key."_txt"] = $key;
 		}
-		
+
 		$html .= '    <td class="tblHead">&nbsp;</td>
   </tr>
   <tmpl_loop name="records">
   <tr bgcolor="{tmpl_var name="bgcolor"}">
 ';
-		
+
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
 			$html .= "<tmpl_if name='".$key."_visible'>";
 			$html .= "    <td class=\"frmText11\"><a href=\"".$listDef["edit_file"]."?id={tmpl_var name='id'}\" class=\"frmText11\">{tmpl_var name=\"".$key."\"}</a></td>\r\n";
 			$html .= "</tmpl_if>";
 		}
-		
+
 		$html .= "    <td class=\"frmText11\" align=\"right\">[<a href=\"javascript: del_record('".$listDef["delete_file"]."?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');\" class=\"frmText11\">{tmpl_var name='delete_txt'}</a>]</td>
   </tr>
   </tmpl_loop>
 ";
-  $html .= '
+		$html .= '
 </table><table width="100%" border="0" cellspacing="0" cellpadding="4">
   <tr>
   	<td height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
@@ -109,28 +109,28 @@
 </table>
 </tmpl_if>
 </form>';
-		
+
 		if($module == '') {
 			$filename = 'templates/'.$listDef["name"].'_search.htm';
 		} else {
 			$filename = '../'.$module.'/templates/'.$listDef["name"].'_search.htm';
 		}
-		
-		
+
+
 		// speichere Template
-		if (!$handle = fopen($filename, 'w')) { 
-        	print "Cannot open file ($filename)"; 
-        	exit; 
-   		} 
- 
-   		if (!fwrite($handle, $html)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $html)) {
+			print "Cannot write to file ($filename)";
+			exit;
 		}
 		fclose($handle);
-		
-    }
-	
+
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/session.inc.php b/interface/lib/classes/session.inc.php
index dc12800..be0ca84 100644
--- a/interface/lib/classes/session.inc.php
+++ b/interface/lib/classes/session.inc.php
@@ -29,101 +29,101 @@
 */
 
 class session {
-	
+
 	private $session_array = array();
 	private $db;
-	
+
 	function __construct() {
 		$this->db = new db;
 	}
-	
+
 	function open ($save_path, $session_name) {
 		return true;
 	}
-	
+
 	function close () {
 
 		if (!empty($this->session_array)) {
-            $result = $this->gc(ini_get('session.gc_maxlifetime'));
-            return $result;
-        }
-        return false;
-    }
-	
+			$result = $this->gc(ini_get('session.gc_maxlifetime'));
+			return $result;
+		}
+		return false;
+	}
+
 	function read ($session_id) {
-		
+
 		$rec = $this->db->queryOneRecord("SELECT * FROM sys_session WHERE session_id = '".$this->db->quote($session_id)."'");
 
-        if (is_array($rec)) {
+		if (is_array($rec)) {
 			$this->session_array = $rec;
 			return $this->session_array['session_data'];
 		} else {
 			return '';
 		}
 	}
-	
+
 	function write ($session_id, $session_data) {
-		
+
 		if (!empty($this->session_array) && $this->session_array['session_id'] != $session_id) {
-            $this->session_array = array();
-        }
-		
+			$this->session_array = array();
+		}
+
 		// Dont write session_data to DB if session data has not been changed after reading it.
 		if(isset($this->session_array['session_data']) && $this->session_array['session_data'] != '' && $this->session_array['session_data'] == $session_data) {
 			$session_id   = $this->db->quote($session_id);
 			$last_updated = date('Y-m-d H:i:s');
-            $this->db->query("UPDATE sys_session SET last_updated = '$last_updated' WHERE session_id = '$session_id'");
+			$this->db->query("UPDATE sys_session SET last_updated = '$last_updated' WHERE session_id = '$session_id'");
 			return true;
 		}
-		
 
-        if (@$this->session_array['session_id'] == '') {
+
+		if (@$this->session_array['session_id'] == '') {
 			$session_id   = $this->db->quote($session_id);
-            $date_created = date('Y-m-d H:i:s');
-            $last_updated = date('Y-m-d H:i:s');
-            $session_data = $this->db->quote($session_data);
+			$date_created = date('Y-m-d H:i:s');
+			$last_updated = date('Y-m-d H:i:s');
+			$session_data = $this->db->quote($session_data);
 			$sql = "INSERT INTO sys_session (session_id,date_created,last_updated,session_data) VALUES ('$session_id','$date_created','$last_updated','$session_data')";
 			$this->db->query($sql);
 
-        } else {
-            $session_id   = $this->db->quote($session_id);
+		} else {
+			$session_id   = $this->db->quote($session_id);
 			$last_updated = date('Y-m-d H:i:s');
-            $session_data = $this->db->quote($session_data);
-            $sql = "UPDATE sys_session SET last_updated = '$last_updated', session_data = '$session_data' WHERE session_id = '$session_id'";
+			$session_data = $this->db->quote($session_data);
+			$sql = "UPDATE sys_session SET last_updated = '$last_updated', session_data = '$session_data' WHERE session_id = '$session_id'";
 			$this->db->query($sql);
 
-        }
-		
-        return true;
-    }
-	
+		}
+
+		return true;
+	}
+
 	function destroy ($session_id) {
 
 		$session_id   = $this->db->quote($session_id);
 		$sql = "DELETE FROM sys_session WHERE session_id = '$session_id'";
 		$this->db->query($sql);
-        
-        return true;
-    }
-	
+
+		return true;
+	}
+
 	function gc ($max_lifetime) {
 
 		$real_now = date('Y-m-d H:i:s');
-        $dt1 = strtotime("$real_now -$max_lifetime seconds");
-        $dt2 = date('Y-m-d H:i:s', $dt1);
-		
+		$dt1 = strtotime("$real_now -$max_lifetime seconds");
+		$dt2 = date('Y-m-d H:i:s', $dt1);
+
 		$sql = "DELETE FROM sys_session WHERE last_updated < '$dt2'";
 		$this->db->query($sql);
-        
-        return true;
-        
-    }
+
+		return true;
+
+	}
 
 	function __destruct () {
-        @session_write_close();
+		@session_write_close();
 
-    }
+	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/simplepie.inc.php b/interface/lib/classes/simplepie.inc.php
index 4fcb2c3..5d36c09 100644
--- a/interface/lib/classes/simplepie.inc.php
+++ b/interface/lib/classes/simplepie.inc.php
@@ -11,16 +11,16 @@
  * 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 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.
+ *  * 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 the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
+ *  * Neither the name of the SimplePie Team 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
@@ -42,6 +42,7 @@
  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
  * @todo phpDoc comments
  */
+
 
 /**
  * SimplePie Name
@@ -395,6 +396,7 @@
  */
 class simplepie
 {
+
 	/**
 	 * @var array Raw data
 	 * @access private
@@ -711,6 +713,7 @@
 	 */
 	var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
 
+
 	/**
 	 * The SimplePie class contains feed level data and options
 	 *
@@ -756,6 +759,7 @@
 		}
 	}
 
+
 	/**
 	 * Used for converting object to a string
 	 */
@@ -763,6 +767,7 @@
 	{
 		return md5(serialize($this->data));
 	}
+
 
 	/**
 	 * Remove items that link back to this before destroying this object
@@ -790,6 +795,7 @@
 		}
 	}
 
+
 	/**
 	 * Force the given data/URL to be treated as a feed no matter what it
 	 * appears like
@@ -802,6 +808,7 @@
 	{
 		$this->force_feed = (bool) $enable;
 	}
+
 
 	/**
 	 * This is the URL of the feed you want to parse.
@@ -835,6 +842,7 @@
 		}
 	}
 
+
 	/**
 	 * Provides an instance of SimplePie_File to use as a feed
 	 *
@@ -853,6 +861,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to use a string of RSS/Atom data instead of a remote feed.
 	 *
@@ -870,6 +879,7 @@
 		$this->raw_data = $data;
 	}
 
+
 	/**
 	 * Allows you to override the default timeout for fetching remote feeds.
 	 *
@@ -885,6 +895,7 @@
 		$this->timeout = (int) $timeout;
 	}
 
+
 	/**
 	 * Forces SimplePie to use fsockopen() instead of the preferred cURL
 	 * functions.
@@ -897,6 +908,7 @@
 	{
 		$this->force_fsockopen = (bool) $enable;
 	}
+
 
 	/**
 	 * Outputs the raw XML content of the feed, after it has gone through
@@ -918,6 +930,7 @@
 		$this->xml_dump = (bool) $enable;
 	}
 
+
 	/**
 	 * Enables/disables caching in SimplePie.
 	 *
@@ -933,6 +946,7 @@
 		$this->cache = (bool) $enable;
 	}
 
+
 	/**
 	 * Set the length of time (in seconds) that the contents of a feed
 	 * will be cached.
@@ -944,6 +958,7 @@
 	{
 		$this->cache_duration = (int) $seconds;
 	}
+
 
 	/**
 	 * Set the length of time (in seconds) that the autodiscovered feed
@@ -957,6 +972,7 @@
 		$this->autodiscovery_cache_duration = (int) $seconds;
 	}
 
+
 	/**
 	 * Set the file system location where the cached files should be stored.
 	 *
@@ -968,6 +984,7 @@
 		$this->cache_location = (string) $location;
 	}
 
+
 	/**
 	 * Determines whether feed items should be sorted into reverse chronological order.
 	 *
@@ -978,6 +995,7 @@
 	{
 		$this->order_by_date = (bool) $enable;
 	}
+
 
 	/**
 	 * Allows you to override the character encoding reported by the feed.
@@ -996,6 +1014,7 @@
 			$this->input_encoding = false;
 		}
 	}
+
 
 	/**
 	 * Set how much feed autodiscovery to do
@@ -1016,6 +1035,7 @@
 		$this->autodiscovery = (int) $level;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for caching.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1034,6 +1054,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * Allows you to change which class SimplePie uses for auto-discovery.
@@ -1054,6 +1075,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for XML parsing.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1072,6 +1094,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * Allows you to change which class SimplePie uses for remote file fetching.
@@ -1092,6 +1115,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for data sanitization.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1110,6 +1134,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * Allows you to change which class SimplePie uses for handling feed items.
@@ -1130,6 +1155,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for handling author data.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1148,6 +1174,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * Allows you to change which class SimplePie uses for handling category data.
@@ -1168,6 +1195,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for feed enclosures.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1186,6 +1214,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * Allows you to change which class SimplePie uses for <media:text> captions
@@ -1206,6 +1235,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for <media:copyright>
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1224,6 +1254,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * Allows you to change which class SimplePie uses for <media:credit>
@@ -1244,6 +1275,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for <media:rating>
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1262,6 +1294,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * Allows you to change which class SimplePie uses for <media:restriction>
@@ -1282,6 +1315,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for content-type sniffing.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1300,6 +1334,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * Allows you to change which class SimplePie uses item sources.
@@ -1320,6 +1355,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Allows you to override the default user agent string.
 	 *
@@ -1330,6 +1366,7 @@
 	{
 		$this->useragent = (string) $ua;
 	}
+
 
 	/**
 	 * Set callback function to create cache filename with
@@ -1344,6 +1381,7 @@
 			$this->cache_name_function = $function;
 		}
 	}
+
 
 	/**
 	 * Set javascript query string parameter
@@ -1362,6 +1400,7 @@
 			$this->javascript = false;
 		}
 	}
+
 
 	/**
 	 * Set options to make SP as fast as possible.  Forgoes a
@@ -1382,6 +1421,7 @@
 			$this->set_image_handler(false);
 		}
 	}
+
 
 	/**
 	 * Set maximum number of feeds to check with autodiscovery
@@ -1436,6 +1476,7 @@
 		$this->sanitize->strip_comments($strip);
 	}
 
+
 	/**
 	 * Set element/attribute key/value pairs of HTML attributes
 	 * containing URLs that need to be resolved relative to the feed
@@ -1448,6 +1489,7 @@
 	{
 		$this->sanitize->set_url_replacements($element_attribute);
 	}
+
 
 	/**
 	 * Set the handler to enable the display of cached favicons.
@@ -1468,6 +1510,7 @@
 		}
 	}
 
+
 	/**
 	 * Set the handler to enable the display of cached images.
 	 *
@@ -1486,6 +1529,7 @@
 			$this->image_handler = '';
 		}
 	}
+
 
 	/**
 	 * Set the limit for items returned per-feed with multifeeds.
@@ -1830,6 +1874,7 @@
 		}
 	}
 
+
 	/**
 	 * Return the error message for the occured error
 	 *
@@ -1879,16 +1924,16 @@
 			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
 			{
 				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
 				{
 					$this->data['type'] &= SIMPLEPIE_TYPE_RSS_10;
 				}
 				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
 				{
 					$this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
 				}
@@ -1900,38 +1945,38 @@
 				{
 					switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
 					{
-						case '0.91':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
-							if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
+					case '0.91':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
+						if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
+						{
+							switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
 							{
-								switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
-								{
-									case '0':
-										$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
-										break;
+							case '0':
+								$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
+								break;
 
-									case '24':
-										$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
-										break;
-								}
+							case '24':
+								$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
+								break;
 							}
-							break;
+						}
+						break;
 
-						case '0.92':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
-							break;
+					case '0.92':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
+						break;
 
-						case '0.93':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
-							break;
+					case '0.93':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
+						break;
 
-						case '0.94':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
-							break;
+					case '0.94':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
+						break;
 
-						case '2.0':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
-							break;
+					case '2.0':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
+						break;
 					}
 				}
 			}
@@ -1942,6 +1987,7 @@
 		}
 		return $this->data['type'];
 	}
+
 
 	/**
 	 * Returns the URL for the favicon of the feed's website.
@@ -2003,6 +2049,7 @@
 		}
 		return false;
 	}
+
 
 	/**
 	 * @todo If we have a perm redirect we should return the new URL
@@ -2068,6 +2115,7 @@
 			return null;
 		}
 	}
+
 
 	/**
 	 * Creates the subscribe_* methods' return data
@@ -2577,6 +2625,7 @@
 		}
 	}
 
+
 	/**
 	 * Added for parity between the parent-level and the item/entry-level.
 	 */
@@ -2774,7 +2823,7 @@
 
 	function get_latitude()
 	{
-		
+
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
 		{
 			return (float) $return[0]['data'];
@@ -3048,6 +3097,7 @@
 		}
 	}
 
+
 	/**
 	 * @static
 	 */
@@ -3055,6 +3105,7 @@
 	{
 		return $a->get_date('U') <= $b->get_date('U');
 	}
+
 
 	/**
 	 * @static
@@ -3106,6 +3157,7 @@
 			return array();
 		}
 	}
+
 }
 
 class SimplePie_Item
@@ -3123,6 +3175,7 @@
 	{
 		return md5(serialize($this->data));
 	}
+
 
 	/**
 	 * Remove items that link back to this before destroying this object
@@ -3621,14 +3674,14 @@
 			$date_format = (string) $date_format;
 			switch ($date_format)
 			{
-				case '':
-					return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
+			case '':
+				return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
 
-				case 'U':
-					return $this->data['date']['parsed'];
+			case 'U':
+				return $this->data['date']['parsed'];
 
-				default:
-					return date($date_format, $this->data['date']['parsed']);
+			default:
+				return date($date_format, $this->data['date']['parsed']);
 			}
 		}
 		else
@@ -3758,6 +3811,7 @@
 		}
 	}
 
+
 	/**
 	 * @todo Add ability to prefer one type of content over another (in a media group).
 	 */
@@ -3773,6 +3827,7 @@
 			return null;
 		}
 	}
+
 
 	/**
 	 * Grabs all available enclosures (podcasts, etc.)
@@ -5626,6 +5681,7 @@
 		}
 	}
 
+
 	/**
 	 * Creates the add_to_* methods' return data
 	 *
@@ -5725,6 +5781,7 @@
 	{
 		return $this->add_to_service('http://www.technorati.com/search/');
 	}
+
 }
 
 class SimplePie_Source
@@ -6043,6 +6100,7 @@
 		}
 	}
 
+
 	/**
 	 * Added for parity between the parent-level and the item/entry-level.
 	 */
@@ -6276,6 +6334,7 @@
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Author
@@ -6333,6 +6392,7 @@
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Category
@@ -6390,6 +6450,7 @@
 			return $this->get_term();
 		}
 	}
+
 }
 
 class SimplePie_Enclosure
@@ -6914,6 +6975,7 @@
 		return $this->embed($options, true);
 	}
 
+
 	/**
 	 * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
 	 */
@@ -6950,45 +7012,45 @@
 					$opt[1] = trim($opt[1]);
 					switch ($opt[0])
 					{
-						case 'audio':
-							$audio = $opt[1];
-							break;
+					case 'audio':
+						$audio = $opt[1];
+						break;
 
-						case 'video':
-							$video = $opt[1];
-							break;
+					case 'video':
+						$video = $opt[1];
+						break;
 
-						case 'alt':
-							$alt = $opt[1];
-							break;
+					case 'alt':
+						$alt = $opt[1];
+						break;
 
-						case 'altclass':
-							$altclass = $opt[1];
-							break;
+					case 'altclass':
+						$altclass = $opt[1];
+						break;
 
-						case 'loop':
-							$loop = $opt[1];
-							break;
+					case 'loop':
+						$loop = $opt[1];
+						break;
 
-						case 'width':
-							$width = $opt[1];
-							break;
+					case 'width':
+						$width = $opt[1];
+						break;
 
-						case 'height':
-							$height = $opt[1];
-							break;
+					case 'height':
+						$height = $opt[1];
+						break;
 
-						case 'bgcolor':
-							$bgcolor = $opt[1];
-							break;
+					case 'bgcolor':
+						$bgcolor = $opt[1];
+						break;
 
-						case 'mediaplayer':
-							$mediaplayer = $opt[1];
-							break;
+					case 'mediaplayer':
+						$mediaplayer = $opt[1];
+						break;
 
-						case 'widescreen':
-							$widescreen = $opt[1];
-							break;
+					case 'widescreen':
+						$widescreen = $opt[1];
+						break;
 					}
 				}
 			}
@@ -7175,7 +7237,7 @@
 
 		// Mime-types by handler.
 		$types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
-		$types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
+		$types_fmedia = array('video/flv', 'video/x-flv', 'flv-application/octet-stream'); // Flash Media Player
 		$types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
 		$types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
 		$types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
@@ -7195,121 +7257,121 @@
 			switch (strtolower($this->get_extension()))
 			{
 				// Audio mime-types
-				case 'aac':
-				case 'adts':
-					$type = 'audio/acc';
-					break;
+			case 'aac':
+			case 'adts':
+				$type = 'audio/acc';
+				break;
 
-				case 'aif':
-				case 'aifc':
-				case 'aiff':
-				case 'cdda':
-					$type = 'audio/aiff';
-					break;
+			case 'aif':
+			case 'aifc':
+			case 'aiff':
+			case 'cdda':
+				$type = 'audio/aiff';
+				break;
 
-				case 'bwf':
-					$type = 'audio/wav';
-					break;
+			case 'bwf':
+				$type = 'audio/wav';
+				break;
 
-				case 'kar':
-				case 'mid':
-				case 'midi':
-				case 'smf':
-					$type = 'audio/midi';
-					break;
+			case 'kar':
+			case 'mid':
+			case 'midi':
+			case 'smf':
+				$type = 'audio/midi';
+				break;
 
-				case 'm4a':
-					$type = 'audio/x-m4a';
-					break;
+			case 'm4a':
+				$type = 'audio/x-m4a';
+				break;
 
-				case 'mp3':
-				case 'swa':
-					$type = 'audio/mp3';
-					break;
+			case 'mp3':
+			case 'swa':
+				$type = 'audio/mp3';
+				break;
 
-				case 'wav':
-					$type = 'audio/wav';
-					break;
+			case 'wav':
+				$type = 'audio/wav';
+				break;
 
-				case 'wax':
-					$type = 'audio/x-ms-wax';
-					break;
+			case 'wax':
+				$type = 'audio/x-ms-wax';
+				break;
 
-				case 'wma':
-					$type = 'audio/x-ms-wma';
-					break;
+			case 'wma':
+				$type = 'audio/x-ms-wma';
+				break;
 
 				// Video mime-types
-				case '3gp':
-				case '3gpp':
-					$type = 'video/3gpp';
-					break;
+			case '3gp':
+			case '3gpp':
+				$type = 'video/3gpp';
+				break;
 
-				case '3g2':
-				case '3gp2':
-					$type = 'video/3gpp2';
-					break;
+			case '3g2':
+			case '3gp2':
+				$type = 'video/3gpp2';
+				break;
 
-				case 'asf':
-					$type = 'video/x-ms-asf';
-					break;
+			case 'asf':
+				$type = 'video/x-ms-asf';
+				break;
 
-				case 'flv':
-					$type = 'video/x-flv';
-					break;
+			case 'flv':
+				$type = 'video/x-flv';
+				break;
 
-				case 'm1a':
-				case 'm1s':
-				case 'm1v':
-				case 'm15':
-				case 'm75':
-				case 'mp2':
-				case 'mpa':
-				case 'mpeg':
-				case 'mpg':
-				case 'mpm':
-				case 'mpv':
-					$type = 'video/mpeg';
-					break;
+			case 'm1a':
+			case 'm1s':
+			case 'm1v':
+			case 'm15':
+			case 'm75':
+			case 'mp2':
+			case 'mpa':
+			case 'mpeg':
+			case 'mpg':
+			case 'mpm':
+			case 'mpv':
+				$type = 'video/mpeg';
+				break;
 
-				case 'm4v':
-					$type = 'video/x-m4v';
-					break;
+			case 'm4v':
+				$type = 'video/x-m4v';
+				break;
 
-				case 'mov':
-				case 'qt':
-					$type = 'video/quicktime';
-					break;
+			case 'mov':
+			case 'qt':
+				$type = 'video/quicktime';
+				break;
 
-				case 'mp4':
-				case 'mpg4':
-					$type = 'video/mp4';
-					break;
+			case 'mp4':
+			case 'mpg4':
+				$type = 'video/mp4';
+				break;
 
-				case 'sdv':
-					$type = 'video/sd-video';
-					break;
+			case 'sdv':
+				$type = 'video/sd-video';
+				break;
 
-				case 'wm':
-					$type = 'video/x-ms-wm';
-					break;
+			case 'wm':
+				$type = 'video/x-ms-wm';
+				break;
 
-				case 'wmv':
-					$type = 'video/x-ms-wmv';
-					break;
+			case 'wmv':
+				$type = 'video/x-ms-wmv';
+				break;
 
-				case 'wvx':
-					$type = 'video/x-ms-wvx';
-					break;
+			case 'wvx':
+				$type = 'video/x-ms-wvx';
+				break;
 
 				// Flash mime-types
-				case 'spl':
-					$type = 'application/futuresplash';
-					break;
+			case 'spl':
+				$type = 'application/futuresplash';
+				break;
 
-				case 'swf':
-					$type = 'application/x-shockwave-flash';
-					break;
+			case 'swf':
+				$type = 'application/x-shockwave-flash';
+				break;
 			}
 		}
 
@@ -7345,6 +7407,7 @@
 			return $type;
 		}
 	}
+
 }
 
 class SimplePie_Caption
@@ -7430,6 +7493,7 @@
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Credit
@@ -7487,6 +7551,7 @@
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Copyright
@@ -7530,6 +7595,7 @@
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Rating
@@ -7573,6 +7639,7 @@
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Restriction
@@ -7630,6 +7697,7 @@
 			return null;
 		}
 	}
+
 }
 
 /**
@@ -7810,35 +7878,35 @@
 								// Hey, we act dumb elsewhere, so let's do that here too
 								switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20")))
 								{
-									case 'gzip':
-									case 'x-gzip':
-										$decoder = new SimplePie_gzdecode($this->body);
-										if (!$decoder->parse())
+								case 'gzip':
+								case 'x-gzip':
+									$decoder = new SimplePie_gzdecode($this->body);
+									if (!$decoder->parse())
+									{
+										$this->error = 'Unable to decode HTTP "gzip" stream';
+										$this->success = false;
+									}
+									else
+									{
+										$this->body = $decoder->data;
+									}
+									break;
+
+								case 'deflate':
+									if (($body = gzuncompress($this->body)) === false)
+									{
+										if (($body = gzinflate($this->body)) === false)
 										{
-											$this->error = 'Unable to decode HTTP "gzip" stream';
+											$this->error = 'Unable to decode HTTP "deflate" stream';
 											$this->success = false;
 										}
-										else
-										{
-											$this->body = $decoder->data;
-										}
-										break;
+									}
+									$this->body = $body;
+									break;
 
-									case 'deflate':
-										if (($body = gzuncompress($this->body)) === false)
-										{
-											if (($body = gzinflate($this->body)) === false)
-											{
-												$this->error = 'Unable to decode HTTP "deflate" stream';
-												$this->success = false;
-											}
-										}
-										$this->body = $body;
-										break;
-
-									default:
-										$this->error = 'Unknown content coding';
-										$this->success = false;
+								default:
+									$this->error = 'Unknown content coding';
+									$this->success = false;
 								}
 							}
 						}
@@ -7862,6 +7930,7 @@
 			}
 		}
 	}
+
 }
 
 /**
@@ -7871,6 +7940,7 @@
  */
 class SimplePie_HTTP_Parser
 {
+
 	/**
 	 * HTTP Version
 	 *
@@ -7959,6 +8029,7 @@
 	 */
 	var $value = '';
 
+
 	/**
 	 * Create an instance of the class with the input data
 	 *
@@ -7970,6 +8041,7 @@
 		$this->data = $data;
 		$this->data_length = strlen($this->data);
 	}
+
 
 	/**
 	 * Parse the input data
@@ -8000,6 +8072,7 @@
 		}
 	}
 
+
 	/**
 	 * Check whether there is data beyond the pointer
 	 *
@@ -8010,6 +8083,7 @@
 	{
 		return (bool) ($this->position < $this->data_length);
 	}
+
 
 	/**
 	 * See if the next character is LWS
@@ -8025,6 +8099,7 @@
 				&& isset($this->data[$this->position + 1])
 				&& ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
 	}
+
 
 	/**
 	 * Parse the HTTP version
@@ -8055,6 +8130,7 @@
 		}
 	}
 
+
 	/**
 	 * Parse the status code
 	 *
@@ -8074,6 +8150,7 @@
 		}
 	}
 
+
 	/**
 	 * Parse the reason phrase
 	 *
@@ -8086,6 +8163,7 @@
 		$this->position += $len + 1;
 		$this->state = 'new_line';
 	}
+
 
 	/**
 	 * Deal with a new line, shifting data around as needed
@@ -8125,6 +8203,7 @@
 		}
 	}
 
+
 	/**
 	 * Parse a header name
 	 *
@@ -8153,6 +8232,7 @@
 		}
 	}
 
+
 	/**
 	 * Parse LWS, replacing consecutive LWS characters with a single space
 	 *
@@ -8175,6 +8255,7 @@
 		$this->value .= "\x20";
 	}
 
+
 	/**
 	 * See what state to move to while within non-quoted header values
 	 *
@@ -8190,22 +8271,23 @@
 		{
 			switch ($this->data[$this->position])
 			{
-				case '"':
-					$this->position++;
-					$this->state = 'quote';
-					break;
+			case '"':
+				$this->position++;
+				$this->state = 'quote';
+				break;
 
-				case "\x0A":
-					$this->position++;
-					$this->state = 'new_line';
-					break;
+			case "\x0A":
+				$this->position++;
+				$this->state = 'new_line';
+				break;
 
-				default:
-					$this->state = 'value_char';
-					break;
+			default:
+				$this->state = 'value_char';
+				break;
 			}
 		}
 	}
+
 
 	/**
 	 * Parse a header value while outside quotes
@@ -8219,6 +8301,7 @@
 		$this->position += $len;
 		$this->state = 'value';
 	}
+
 
 	/**
 	 * See what state to move to while within quoted header values
@@ -8235,27 +8318,28 @@
 		{
 			switch ($this->data[$this->position])
 			{
-				case '"':
-					$this->position++;
-					$this->state = 'value';
-					break;
+			case '"':
+				$this->position++;
+				$this->state = 'value';
+				break;
 
-				case "\x0A":
-					$this->position++;
-					$this->state = 'new_line';
-					break;
+			case "\x0A":
+				$this->position++;
+				$this->state = 'new_line';
+				break;
 
-				case '\\':
-					$this->position++;
-					$this->state = 'quote_escaped';
-					break;
+			case '\\':
+				$this->position++;
+				$this->state = 'quote_escaped';
+				break;
 
-				default:
-					$this->state = 'quote_char';
-					break;
+			default:
+				$this->state = 'quote_char';
+				break;
 			}
 		}
 	}
+
 
 	/**
 	 * Parse a header value while within quotes
@@ -8270,6 +8354,7 @@
 		$this->state = 'value';
 	}
 
+
 	/**
 	 * Parse an escaped character within quotes
 	 *
@@ -8282,6 +8367,7 @@
 		$this->state = 'quote';
 	}
 
+
 	/**
 	 * Parse the body
 	 *
@@ -8292,6 +8378,7 @@
 		$this->body = substr($this->data, $this->position);
 		$this->state = 'emit';
 	}
+
 }
 
 /**
@@ -8301,6 +8388,7 @@
  */
 class SimplePie_gzdecode
 {
+
 	/**
 	 * Compressed data
 	 *
@@ -8407,6 +8495,7 @@
 	 */
 	var $comment;
 
+
 	/**
 	 * Don't allow anything to be set
 	 *
@@ -8416,6 +8505,7 @@
 	{
 		trigger_error("Cannot write property $name", E_USER_ERROR);
 	}
+
 
 	/**
 	 * Set the compressed string and related properties
@@ -8427,6 +8517,7 @@
 		$this->compressed_data = $data;
 		$this->compressed_size = strlen($data);
 	}
+
 
 	/**
 	 * Decode the GZIP stream
@@ -8602,10 +8693,13 @@
 			return false;
 		}
 	}
+
 }
 
 class SimplePie_Cache
 {
+
+
 	/**
 	 * Don't call the constructor. Please.
 	 *
@@ -8615,6 +8709,7 @@
 	{
 		trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
 	}
+
 
 	/**
 	 * Create a new SimplePie_Cache object
@@ -8627,17 +8722,18 @@
 		$location_iri = new SimplePie_IRI($location);
 		switch ($location_iri->get_scheme())
 		{
-			case 'mysql':
-				if (extension_loaded('mysql'))
-				{
-					return new SimplePie_Cache_MySQL($location_iri, $filename, $extension);
-				}
-				break;
+		case 'mysql':
+			if (extension_loaded('mysql'))
+			{
+				return new SimplePie_Cache_MySQL($location_iri, $filename, $extension);
+			}
+			break;
 
-			default:
-				return new SimplePie_Cache_File($location, $filename, $extension);
+		default:
+			return new SimplePie_Cache_File($location, $filename, $extension);
 		}
 	}
+
 }
 
 class SimplePie_Cache_File
@@ -8719,6 +8815,7 @@
 		}
 		return false;
 	}
+
 }
 
 class SimplePie_Cache_DB
@@ -8799,6 +8896,7 @@
 		}
 		return array(serialize($data->data), $items_by_id);
 	}
+
 }
 
 class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
@@ -9071,6 +9169,7 @@
 			return false;
 		}
 	}
+
 }
 
 class SimplePie_Misc
@@ -9225,18 +9324,18 @@
 		{
 			switch ($level)
 			{
-				case E_USER_ERROR:
-					$note = 'PHP Error';
-					break;
-				case E_USER_WARNING:
-					$note = 'PHP Warning';
-					break;
-				case E_USER_NOTICE:
-					$note = 'PHP Notice';
-					break;
-				default:
-					$note = 'Unknown Error';
-					break;
+			case E_USER_ERROR:
+				$note = 'PHP Error';
+				break;
+			case E_USER_WARNING:
+				$note = 'PHP Warning';
+				break;
+			case E_USER_NOTICE:
+				$note = 'PHP Notice';
+				break;
+			default:
+				$note = 'Unknown Error';
+				break;
 			}
 
 			$log_error = true;
@@ -9259,6 +9358,7 @@
 
 		return $message;
 	}
+
 
 	/**
 	 * If a file has been cached, retrieve and display it.
@@ -9378,6 +9478,7 @@
 		}
 	}
 
+
 	/**
 	 * Remove bad UTF-8 bytes
 	 *
@@ -9412,6 +9513,7 @@
 			return '';
 		}
 	}
+
 
 	/**
 	 * Converts a Windows-1252 encoded string to a UTF-8 encoded string
@@ -9474,1314 +9576,1314 @@
 		// Normalization from UTS #22
 		switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset)))
 		{
-			case 'adobestandardencoding':
-			case 'csadobestandardencoding':
-				return 'Adobe-Standard-Encoding';
+		case 'adobestandardencoding':
+		case 'csadobestandardencoding':
+			return 'Adobe-Standard-Encoding';
 
-			case 'adobesymbolencoding':
-			case 'cshppsmath':
-				return 'Adobe-Symbol-Encoding';
+		case 'adobesymbolencoding':
+		case 'cshppsmath':
+			return 'Adobe-Symbol-Encoding';
 
-			case 'ami1251':
-			case 'amiga1251':
-				return 'Amiga-1251';
+		case 'ami1251':
+		case 'amiga1251':
+			return 'Amiga-1251';
 
-			case 'ansix31101983':
-			case 'csat5001983':
-			case 'csiso99naplps':
-			case 'isoir99':
-			case 'naplps':
-				return 'ANSI_X3.110-1983';
+		case 'ansix31101983':
+		case 'csat5001983':
+		case 'csiso99naplps':
+		case 'isoir99':
+		case 'naplps':
+			return 'ANSI_X3.110-1983';
 
-			case 'arabic7':
-			case 'asmo449':
-			case 'csiso89asmo449':
-			case 'iso9036':
-			case 'isoir89':
-				return 'ASMO_449';
+		case 'arabic7':
+		case 'asmo449':
+		case 'csiso89asmo449':
+		case 'iso9036':
+		case 'isoir89':
+			return 'ASMO_449';
 
-			case 'big5':
-			case 'csbig5':
-			case 'xxbig5':
-				return 'Big5';
+		case 'big5':
+		case 'csbig5':
+		case 'xxbig5':
+			return 'Big5';
 
-			case 'big5hkscs':
-				return 'Big5-HKSCS';
+		case 'big5hkscs':
+			return 'Big5-HKSCS';
 
-			case 'bocu1':
-			case 'csbocu1':
-				return 'BOCU-1';
+		case 'bocu1':
+		case 'csbocu1':
+			return 'BOCU-1';
 
-			case 'brf':
-			case 'csbrf':
-				return 'BRF';
+		case 'brf':
+		case 'csbrf':
+			return 'BRF';
 
-			case 'bs4730':
-			case 'csiso4unitedkingdom':
-			case 'gb':
-			case 'iso646gb':
-			case 'isoir4':
-			case 'uk':
-				return 'BS_4730';
+		case 'bs4730':
+		case 'csiso4unitedkingdom':
+		case 'gb':
+		case 'iso646gb':
+		case 'isoir4':
+		case 'uk':
+			return 'BS_4730';
 
-			case 'bsviewdata':
-			case 'csiso47bsviewdata':
-			case 'isoir47':
-				return 'BS_viewdata';
+		case 'bsviewdata':
+		case 'csiso47bsviewdata':
+		case 'isoir47':
+			return 'BS_viewdata';
 
-			case 'cesu8':
-			case 'cscesu8':
-				return 'CESU-8';
+		case 'cesu8':
+		case 'cscesu8':
+			return 'CESU-8';
 
-			case 'ca':
-			case 'csa71':
-			case 'csaz243419851':
-			case 'csiso121canadian1':
-			case 'iso646ca':
-			case 'isoir121':
-				return 'CSA_Z243.4-1985-1';
+		case 'ca':
+		case 'csa71':
+		case 'csaz243419851':
+		case 'csiso121canadian1':
+		case 'iso646ca':
+		case 'isoir121':
+			return 'CSA_Z243.4-1985-1';
 
-			case 'csa72':
-			case 'csaz243419852':
-			case 'csiso122canadian2':
-			case 'iso646ca2':
-			case 'isoir122':
-				return 'CSA_Z243.4-1985-2';
+		case 'csa72':
+		case 'csaz243419852':
+		case 'csiso122canadian2':
+		case 'iso646ca2':
+		case 'isoir122':
+			return 'CSA_Z243.4-1985-2';
 
-			case 'csaz24341985gr':
-			case 'csiso123csaz24341985gr':
-			case 'isoir123':
-				return 'CSA_Z243.4-1985-gr';
+		case 'csaz24341985gr':
+		case 'csiso123csaz24341985gr':
+		case 'isoir123':
+			return 'CSA_Z243.4-1985-gr';
 
-			case 'csiso139csn369103':
-			case 'csn369103':
-			case 'isoir139':
-				return 'CSN_369103';
+		case 'csiso139csn369103':
+		case 'csn369103':
+		case 'isoir139':
+			return 'CSN_369103';
 
-			case 'csdecmcs':
-			case 'dec':
-			case 'decmcs':
-				return 'DEC-MCS';
+		case 'csdecmcs':
+		case 'dec':
+		case 'decmcs':
+			return 'DEC-MCS';
 
-			case 'csiso21german':
-			case 'de':
-			case 'din66003':
-			case 'iso646de':
-			case 'isoir21':
-				return 'DIN_66003';
+		case 'csiso21german':
+		case 'de':
+		case 'din66003':
+		case 'iso646de':
+		case 'isoir21':
+			return 'DIN_66003';
 
-			case 'csdkus':
-			case 'dkus':
-				return 'dk-us';
+		case 'csdkus':
+		case 'dkus':
+			return 'dk-us';
 
-			case 'csiso646danish':
-			case 'dk':
-			case 'ds2089':
-			case 'iso646dk':
-				return 'DS_2089';
+		case 'csiso646danish':
+		case 'dk':
+		case 'ds2089':
+		case 'iso646dk':
+			return 'DS_2089';
 
-			case 'csibmebcdicatde':
-			case 'ebcdicatde':
-				return 'EBCDIC-AT-DE';
+		case 'csibmebcdicatde':
+		case 'ebcdicatde':
+			return 'EBCDIC-AT-DE';
 
-			case 'csebcdicatdea':
-			case 'ebcdicatdea':
-				return 'EBCDIC-AT-DE-A';
+		case 'csebcdicatdea':
+		case 'ebcdicatdea':
+			return 'EBCDIC-AT-DE-A';
 
-			case 'csebcdiccafr':
-			case 'ebcdiccafr':
-				return 'EBCDIC-CA-FR';
+		case 'csebcdiccafr':
+		case 'ebcdiccafr':
+			return 'EBCDIC-CA-FR';
 
-			case 'csebcdicdkno':
-			case 'ebcdicdkno':
-				return 'EBCDIC-DK-NO';
+		case 'csebcdicdkno':
+		case 'ebcdicdkno':
+			return 'EBCDIC-DK-NO';
 
-			case 'csebcdicdknoa':
-			case 'ebcdicdknoa':
-				return 'EBCDIC-DK-NO-A';
+		case 'csebcdicdknoa':
+		case 'ebcdicdknoa':
+			return 'EBCDIC-DK-NO-A';
 
-			case 'csebcdices':
-			case 'ebcdices':
-				return 'EBCDIC-ES';
+		case 'csebcdices':
+		case 'ebcdices':
+			return 'EBCDIC-ES';
 
-			case 'csebcdicesa':
-			case 'ebcdicesa':
-				return 'EBCDIC-ES-A';
+		case 'csebcdicesa':
+		case 'ebcdicesa':
+			return 'EBCDIC-ES-A';
 
-			case 'csebcdicess':
-			case 'ebcdicess':
-				return 'EBCDIC-ES-S';
+		case 'csebcdicess':
+		case 'ebcdicess':
+			return 'EBCDIC-ES-S';
 
-			case 'csebcdicfise':
-			case 'ebcdicfise':
-				return 'EBCDIC-FI-SE';
+		case 'csebcdicfise':
+		case 'ebcdicfise':
+			return 'EBCDIC-FI-SE';
 
-			case 'csebcdicfisea':
-			case 'ebcdicfisea':
-				return 'EBCDIC-FI-SE-A';
+		case 'csebcdicfisea':
+		case 'ebcdicfisea':
+			return 'EBCDIC-FI-SE-A';
 
-			case 'csebcdicfr':
-			case 'ebcdicfr':
-				return 'EBCDIC-FR';
+		case 'csebcdicfr':
+		case 'ebcdicfr':
+			return 'EBCDIC-FR';
 
-			case 'csebcdicit':
-			case 'ebcdicit':
-				return 'EBCDIC-IT';
+		case 'csebcdicit':
+		case 'ebcdicit':
+			return 'EBCDIC-IT';
 
-			case 'csebcdicpt':
-			case 'ebcdicpt':
-				return 'EBCDIC-PT';
+		case 'csebcdicpt':
+		case 'ebcdicpt':
+			return 'EBCDIC-PT';
 
-			case 'csebcdicuk':
-			case 'ebcdicuk':
-				return 'EBCDIC-UK';
+		case 'csebcdicuk':
+		case 'ebcdicuk':
+			return 'EBCDIC-UK';
 
-			case 'csebcdicus':
-			case 'ebcdicus':
-				return 'EBCDIC-US';
+		case 'csebcdicus':
+		case 'ebcdicus':
+			return 'EBCDIC-US';
 
-			case 'csiso111ecmacyrillic':
-			case 'ecmacyrillic':
-			case 'isoir111':
-			case 'koi8e':
-				return 'ECMA-cyrillic';
+		case 'csiso111ecmacyrillic':
+		case 'ecmacyrillic':
+		case 'isoir111':
+		case 'koi8e':
+			return 'ECMA-cyrillic';
 
-			case 'csiso17spanish':
-			case 'es':
-			case 'iso646es':
-			case 'isoir17':
-				return 'ES';
+		case 'csiso17spanish':
+		case 'es':
+		case 'iso646es':
+		case 'isoir17':
+			return 'ES';
 
-			case 'csiso85spanish2':
-			case 'es2':
-			case 'iso646es2':
-			case 'isoir85':
-				return 'ES2';
+		case 'csiso85spanish2':
+		case 'es2':
+		case 'iso646es2':
+		case 'isoir85':
+			return 'ES2';
 
-			case 'cseucfixwidjapanese':
-			case 'extendedunixcodefixedwidthforjapanese':
-				return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
+		case 'cseucfixwidjapanese':
+		case 'extendedunixcodefixedwidthforjapanese':
+			return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
 
-			case 'cseucpkdfmtjapanese':
-			case 'eucjp':
-			case 'extendedunixcodepackedformatforjapanese':
-				return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
+		case 'cseucpkdfmtjapanese':
+		case 'eucjp':
+		case 'extendedunixcodepackedformatforjapanese':
+			return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
 
-			case 'gb18030':
-				return 'GB18030';
+		case 'gb18030':
+			return 'GB18030';
 
-			case 'chinese':
-			case 'cp936':
-			case 'csgb2312':
-			case 'csiso58gb231280':
-			case 'gb2312':
-			case 'gb231280':
-			case 'gbk':
-			case 'isoir58':
-			case 'ms936':
-			case 'windows936':
-				return 'GBK';
+		case 'chinese':
+		case 'cp936':
+		case 'csgb2312':
+		case 'csiso58gb231280':
+		case 'gb2312':
+		case 'gb231280':
+		case 'gbk':
+		case 'isoir58':
+		case 'ms936':
+		case 'windows936':
+			return 'GBK';
 
-			case 'cn':
-			case 'csiso57gb1988':
-			case 'gb198880':
-			case 'iso646cn':
-			case 'isoir57':
-				return 'GB_1988-80';
+		case 'cn':
+		case 'csiso57gb1988':
+		case 'gb198880':
+		case 'iso646cn':
+		case 'isoir57':
+			return 'GB_1988-80';
 
-			case 'csiso153gost1976874':
-			case 'gost1976874':
-			case 'isoir153':
-			case 'stsev35888':
-				return 'GOST_19768-74';
+		case 'csiso153gost1976874':
+		case 'gost1976874':
+		case 'isoir153':
+		case 'stsev35888':
+			return 'GOST_19768-74';
 
-			case 'csiso150':
-			case 'csiso150greekccitt':
-			case 'greekccitt':
-			case 'isoir150':
-				return 'greek-ccitt';
+		case 'csiso150':
+		case 'csiso150greekccitt':
+		case 'greekccitt':
+		case 'isoir150':
+			return 'greek-ccitt';
 
-			case 'csiso88greek7':
-			case 'greek7':
-			case 'isoir88':
-				return 'greek7';
+		case 'csiso88greek7':
+		case 'greek7':
+		case 'isoir88':
+			return 'greek7';
 
-			case 'csiso18greek7old':
-			case 'greek7old':
-			case 'isoir18':
-				return 'greek7-old';
+		case 'csiso18greek7old':
+		case 'greek7old':
+		case 'isoir18':
+			return 'greek7-old';
 
-			case 'cshpdesktop':
-			case 'hpdesktop':
-				return 'HP-DeskTop';
+		case 'cshpdesktop':
+		case 'hpdesktop':
+			return 'HP-DeskTop';
 
-			case 'cshplegal':
-			case 'hplegal':
-				return 'HP-Legal';
+		case 'cshplegal':
+		case 'hplegal':
+			return 'HP-Legal';
 
-			case 'cshpmath8':
-			case 'hpmath8':
-				return 'HP-Math8';
+		case 'cshpmath8':
+		case 'hpmath8':
+			return 'HP-Math8';
 
-			case 'cshppifont':
-			case 'hppifont':
-				return 'HP-Pi-font';
+		case 'cshppifont':
+		case 'hppifont':
+			return 'HP-Pi-font';
 
-			case 'cshproman8':
-			case 'hproman8':
-			case 'r8':
-			case 'roman8':
-				return 'hp-roman8';
+		case 'cshproman8':
+		case 'hproman8':
+		case 'r8':
+		case 'roman8':
+			return 'hp-roman8';
 
-			case 'hzgb2312':
-				return 'HZ-GB-2312';
+		case 'hzgb2312':
+			return 'HZ-GB-2312';
 
-			case 'csibmsymbols':
-			case 'ibmsymbols':
-				return 'IBM-Symbols';
+		case 'csibmsymbols':
+		case 'ibmsymbols':
+			return 'IBM-Symbols';
 
-			case 'csibmthai':
-			case 'ibmthai':
-				return 'IBM-Thai';
+		case 'csibmthai':
+		case 'ibmthai':
+			return 'IBM-Thai';
 
-			case 'ccsid858':
-			case 'cp858':
-			case 'ibm858':
-			case 'pcmultilingual850euro':
-				return 'IBM00858';
+		case 'ccsid858':
+		case 'cp858':
+		case 'ibm858':
+		case 'pcmultilingual850euro':
+			return 'IBM00858';
 
-			case 'ccsid924':
-			case 'cp924':
-			case 'ebcdiclatin9euro':
-			case 'ibm924':
-				return 'IBM00924';
+		case 'ccsid924':
+		case 'cp924':
+		case 'ebcdiclatin9euro':
+		case 'ibm924':
+			return 'IBM00924';
 
-			case 'ccsid1140':
-			case 'cp1140':
-			case 'ebcdicus37euro':
-			case 'ibm1140':
-				return 'IBM01140';
+		case 'ccsid1140':
+		case 'cp1140':
+		case 'ebcdicus37euro':
+		case 'ibm1140':
+			return 'IBM01140';
 
-			case 'ccsid1141':
-			case 'cp1141':
-			case 'ebcdicde273euro':
-			case 'ibm1141':
-				return 'IBM01141';
+		case 'ccsid1141':
+		case 'cp1141':
+		case 'ebcdicde273euro':
+		case 'ibm1141':
+			return 'IBM01141';
 
-			case 'ccsid1142':
-			case 'cp1142':
-			case 'ebcdicdk277euro':
-			case 'ebcdicno277euro':
-			case 'ibm1142':
-				return 'IBM01142';
+		case 'ccsid1142':
+		case 'cp1142':
+		case 'ebcdicdk277euro':
+		case 'ebcdicno277euro':
+		case 'ibm1142':
+			return 'IBM01142';
 
-			case 'ccsid1143':
-			case 'cp1143':
-			case 'ebcdicfi278euro':
-			case 'ebcdicse278euro':
-			case 'ibm1143':
-				return 'IBM01143';
+		case 'ccsid1143':
+		case 'cp1143':
+		case 'ebcdicfi278euro':
+		case 'ebcdicse278euro':
+		case 'ibm1143':
+			return 'IBM01143';
 
-			case 'ccsid1144':
-			case 'cp1144':
-			case 'ebcdicit280euro':
-			case 'ibm1144':
-				return 'IBM01144';
+		case 'ccsid1144':
+		case 'cp1144':
+		case 'ebcdicit280euro':
+		case 'ibm1144':
+			return 'IBM01144';
 
-			case 'ccsid1145':
-			case 'cp1145':
-			case 'ebcdices284euro':
-			case 'ibm1145':
-				return 'IBM01145';
+		case 'ccsid1145':
+		case 'cp1145':
+		case 'ebcdices284euro':
+		case 'ibm1145':
+			return 'IBM01145';
 
-			case 'ccsid1146':
-			case 'cp1146':
-			case 'ebcdicgb285euro':
-			case 'ibm1146':
-				return 'IBM01146';
+		case 'ccsid1146':
+		case 'cp1146':
+		case 'ebcdicgb285euro':
+		case 'ibm1146':
+			return 'IBM01146';
 
-			case 'ccsid1147':
-			case 'cp1147':
-			case 'ebcdicfr297euro':
-			case 'ibm1147':
-				return 'IBM01147';
+		case 'ccsid1147':
+		case 'cp1147':
+		case 'ebcdicfr297euro':
+		case 'ibm1147':
+			return 'IBM01147';
 
-			case 'ccsid1148':
-			case 'cp1148':
-			case 'ebcdicinternational500euro':
-			case 'ibm1148':
-				return 'IBM01148';
+		case 'ccsid1148':
+		case 'cp1148':
+		case 'ebcdicinternational500euro':
+		case 'ibm1148':
+			return 'IBM01148';
 
-			case 'ccsid1149':
-			case 'cp1149':
-			case 'ebcdicis871euro':
-			case 'ibm1149':
-				return 'IBM01149';
+		case 'ccsid1149':
+		case 'cp1149':
+		case 'ebcdicis871euro':
+		case 'ibm1149':
+			return 'IBM01149';
 
-			case 'cp37':
-			case 'csibm37':
-			case 'ebcdiccpca':
-			case 'ebcdiccpnl':
-			case 'ebcdiccpus':
-			case 'ebcdiccpwt':
-			case 'ibm37':
-				return 'IBM037';
+		case 'cp37':
+		case 'csibm37':
+		case 'ebcdiccpca':
+		case 'ebcdiccpnl':
+		case 'ebcdiccpus':
+		case 'ebcdiccpwt':
+		case 'ibm37':
+			return 'IBM037';
 
-			case 'cp38':
-			case 'csibm38':
-			case 'ebcdicint':
-			case 'ibm38':
-				return 'IBM038';
+		case 'cp38':
+		case 'csibm38':
+		case 'ebcdicint':
+		case 'ibm38':
+			return 'IBM038';
 
-			case 'cp273':
-			case 'csibm273':
-			case 'ibm273':
-				return 'IBM273';
+		case 'cp273':
+		case 'csibm273':
+		case 'ibm273':
+			return 'IBM273';
 
-			case 'cp274':
-			case 'csibm274':
-			case 'ebcdicbe':
-			case 'ibm274':
-				return 'IBM274';
+		case 'cp274':
+		case 'csibm274':
+		case 'ebcdicbe':
+		case 'ibm274':
+			return 'IBM274';
 
-			case 'cp275':
-			case 'csibm275':
-			case 'ebcdicbr':
-			case 'ibm275':
-				return 'IBM275';
+		case 'cp275':
+		case 'csibm275':
+		case 'ebcdicbr':
+		case 'ibm275':
+			return 'IBM275';
 
-			case 'csibm277':
-			case 'ebcdiccpdk':
-			case 'ebcdiccpno':
-			case 'ibm277':
-				return 'IBM277';
+		case 'csibm277':
+		case 'ebcdiccpdk':
+		case 'ebcdiccpno':
+		case 'ibm277':
+			return 'IBM277';
 
-			case 'cp278':
-			case 'csibm278':
-			case 'ebcdiccpfi':
-			case 'ebcdiccpse':
-			case 'ibm278':
-				return 'IBM278';
+		case 'cp278':
+		case 'csibm278':
+		case 'ebcdiccpfi':
+		case 'ebcdiccpse':
+		case 'ibm278':
+			return 'IBM278';
 
-			case 'cp280':
-			case 'csibm280':
-			case 'ebcdiccpit':
-			case 'ibm280':
-				return 'IBM280';
+		case 'cp280':
+		case 'csibm280':
+		case 'ebcdiccpit':
+		case 'ibm280':
+			return 'IBM280';
 
-			case 'cp281':
-			case 'csibm281':
-			case 'ebcdicjpe':
-			case 'ibm281':
-				return 'IBM281';
+		case 'cp281':
+		case 'csibm281':
+		case 'ebcdicjpe':
+		case 'ibm281':
+			return 'IBM281';
 
-			case 'cp284':
-			case 'csibm284':
-			case 'ebcdiccpes':
-			case 'ibm284':
-				return 'IBM284';
+		case 'cp284':
+		case 'csibm284':
+		case 'ebcdiccpes':
+		case 'ibm284':
+			return 'IBM284';
 
-			case 'cp285':
-			case 'csibm285':
-			case 'ebcdiccpgb':
-			case 'ibm285':
-				return 'IBM285';
+		case 'cp285':
+		case 'csibm285':
+		case 'ebcdiccpgb':
+		case 'ibm285':
+			return 'IBM285';
 
-			case 'cp290':
-			case 'csibm290':
-			case 'ebcdicjpkana':
-			case 'ibm290':
-				return 'IBM290';
+		case 'cp290':
+		case 'csibm290':
+		case 'ebcdicjpkana':
+		case 'ibm290':
+			return 'IBM290';
 
-			case 'cp297':
-			case 'csibm297':
-			case 'ebcdiccpfr':
-			case 'ibm297':
-				return 'IBM297';
+		case 'cp297':
+		case 'csibm297':
+		case 'ebcdiccpfr':
+		case 'ibm297':
+			return 'IBM297';
 
-			case 'cp420':
-			case 'csibm420':
-			case 'ebcdiccpar1':
-			case 'ibm420':
-				return 'IBM420';
+		case 'cp420':
+		case 'csibm420':
+		case 'ebcdiccpar1':
+		case 'ibm420':
+			return 'IBM420';
 
-			case 'cp423':
-			case 'csibm423':
-			case 'ebcdiccpgr':
-			case 'ibm423':
-				return 'IBM423';
+		case 'cp423':
+		case 'csibm423':
+		case 'ebcdiccpgr':
+		case 'ibm423':
+			return 'IBM423';
 
-			case 'cp424':
-			case 'csibm424':
-			case 'ebcdiccphe':
-			case 'ibm424':
-				return 'IBM424';
+		case 'cp424':
+		case 'csibm424':
+		case 'ebcdiccphe':
+		case 'ibm424':
+			return 'IBM424';
 
-			case '437':
-			case 'cp437':
-			case 'cspc8codepage437':
-			case 'ibm437':
-				return 'IBM437';
+		case '437':
+		case 'cp437':
+		case 'cspc8codepage437':
+		case 'ibm437':
+			return 'IBM437';
 
-			case 'cp500':
-			case 'csibm500':
-			case 'ebcdiccpbe':
-			case 'ebcdiccpch':
-			case 'ibm500':
-				return 'IBM500';
+		case 'cp500':
+		case 'csibm500':
+		case 'ebcdiccpbe':
+		case 'ebcdiccpch':
+		case 'ibm500':
+			return 'IBM500';
 
-			case 'cp775':
-			case 'cspc775baltic':
-			case 'ibm775':
-				return 'IBM775';
+		case 'cp775':
+		case 'cspc775baltic':
+		case 'ibm775':
+			return 'IBM775';
 
-			case '850':
-			case 'cp850':
-			case 'cspc850multilingual':
-			case 'ibm850':
-				return 'IBM850';
+		case '850':
+		case 'cp850':
+		case 'cspc850multilingual':
+		case 'ibm850':
+			return 'IBM850';
 
-			case '851':
-			case 'cp851':
-			case 'csibm851':
-			case 'ibm851':
-				return 'IBM851';
+		case '851':
+		case 'cp851':
+		case 'csibm851':
+		case 'ibm851':
+			return 'IBM851';
 
-			case '852':
-			case 'cp852':
-			case 'cspcp852':
-			case 'ibm852':
-				return 'IBM852';
+		case '852':
+		case 'cp852':
+		case 'cspcp852':
+		case 'ibm852':
+			return 'IBM852';
 
-			case '855':
-			case 'cp855':
-			case 'csibm855':
-			case 'ibm855':
-				return 'IBM855';
+		case '855':
+		case 'cp855':
+		case 'csibm855':
+		case 'ibm855':
+			return 'IBM855';
 
-			case '857':
-			case 'cp857':
-			case 'csibm857':
-			case 'ibm857':
-				return 'IBM857';
+		case '857':
+		case 'cp857':
+		case 'csibm857':
+		case 'ibm857':
+			return 'IBM857';
 
-			case '860':
-			case 'cp860':
-			case 'csibm860':
-			case 'ibm860':
-				return 'IBM860';
+		case '860':
+		case 'cp860':
+		case 'csibm860':
+		case 'ibm860':
+			return 'IBM860';
 
-			case '861':
-			case 'cp861':
-			case 'cpis':
-			case 'csibm861':
-			case 'ibm861':
-				return 'IBM861';
+		case '861':
+		case 'cp861':
+		case 'cpis':
+		case 'csibm861':
+		case 'ibm861':
+			return 'IBM861';
 
-			case '862':
-			case 'cp862':
-			case 'cspc862latinhebrew':
-			case 'ibm862':
-				return 'IBM862';
+		case '862':
+		case 'cp862':
+		case 'cspc862latinhebrew':
+		case 'ibm862':
+			return 'IBM862';
 
-			case '863':
-			case 'cp863':
-			case 'csibm863':
-			case 'ibm863':
-				return 'IBM863';
+		case '863':
+		case 'cp863':
+		case 'csibm863':
+		case 'ibm863':
+			return 'IBM863';
 
-			case 'cp864':
-			case 'csibm864':
-			case 'ibm864':
-				return 'IBM864';
+		case 'cp864':
+		case 'csibm864':
+		case 'ibm864':
+			return 'IBM864';
 
-			case '865':
-			case 'cp865':
-			case 'csibm865':
-			case 'ibm865':
-				return 'IBM865';
+		case '865':
+		case 'cp865':
+		case 'csibm865':
+		case 'ibm865':
+			return 'IBM865';
 
-			case '866':
-			case 'cp866':
-			case 'csibm866':
-			case 'ibm866':
-				return 'IBM866';
+		case '866':
+		case 'cp866':
+		case 'csibm866':
+		case 'ibm866':
+			return 'IBM866';
 
-			case 'cp868':
-			case 'cpar':
-			case 'csibm868':
-			case 'ibm868':
-				return 'IBM868';
+		case 'cp868':
+		case 'cpar':
+		case 'csibm868':
+		case 'ibm868':
+			return 'IBM868';
 
-			case '869':
-			case 'cp869':
-			case 'cpgr':
-			case 'csibm869':
-			case 'ibm869':
-				return 'IBM869';
+		case '869':
+		case 'cp869':
+		case 'cpgr':
+		case 'csibm869':
+		case 'ibm869':
+			return 'IBM869';
 
-			case 'cp870':
-			case 'csibm870':
-			case 'ebcdiccproece':
-			case 'ebcdiccpyu':
-			case 'ibm870':
-				return 'IBM870';
+		case 'cp870':
+		case 'csibm870':
+		case 'ebcdiccproece':
+		case 'ebcdiccpyu':
+		case 'ibm870':
+			return 'IBM870';
 
-			case 'cp871':
-			case 'csibm871':
-			case 'ebcdiccpis':
-			case 'ibm871':
-				return 'IBM871';
+		case 'cp871':
+		case 'csibm871':
+		case 'ebcdiccpis':
+		case 'ibm871':
+			return 'IBM871';
 
-			case 'cp880':
-			case 'csibm880':
-			case 'ebcdiccyrillic':
-			case 'ibm880':
-				return 'IBM880';
+		case 'cp880':
+		case 'csibm880':
+		case 'ebcdiccyrillic':
+		case 'ibm880':
+			return 'IBM880';
 
-			case 'cp891':
-			case 'csibm891':
-			case 'ibm891':
-				return 'IBM891';
+		case 'cp891':
+		case 'csibm891':
+		case 'ibm891':
+			return 'IBM891';
 
-			case 'cp903':
-			case 'csibm903':
-			case 'ibm903':
-				return 'IBM903';
+		case 'cp903':
+		case 'csibm903':
+		case 'ibm903':
+			return 'IBM903';
 
-			case '904':
-			case 'cp904':
-			case 'csibbm904':
-			case 'ibm904':
-				return 'IBM904';
+		case '904':
+		case 'cp904':
+		case 'csibbm904':
+		case 'ibm904':
+			return 'IBM904';
 
-			case 'cp905':
-			case 'csibm905':
-			case 'ebcdiccptr':
-			case 'ibm905':
-				return 'IBM905';
+		case 'cp905':
+		case 'csibm905':
+		case 'ebcdiccptr':
+		case 'ibm905':
+			return 'IBM905';
 
-			case 'cp918':
-			case 'csibm918':
-			case 'ebcdiccpar2':
-			case 'ibm918':
-				return 'IBM918';
+		case 'cp918':
+		case 'csibm918':
+		case 'ebcdiccpar2':
+		case 'ibm918':
+			return 'IBM918';
 
-			case 'cp1026':
-			case 'csibm1026':
-			case 'ibm1026':
-				return 'IBM1026';
+		case 'cp1026':
+		case 'csibm1026':
+		case 'ibm1026':
+			return 'IBM1026';
 
-			case 'ibm1047':
-				return 'IBM1047';
+		case 'ibm1047':
+			return 'IBM1047';
 
-			case 'csiso143iecp271':
-			case 'iecp271':
-			case 'isoir143':
-				return 'IEC_P27-1';
+		case 'csiso143iecp271':
+		case 'iecp271':
+		case 'isoir143':
+			return 'IEC_P27-1';
 
-			case 'csiso49inis':
-			case 'inis':
-			case 'isoir49':
-				return 'INIS';
+		case 'csiso49inis':
+		case 'inis':
+		case 'isoir49':
+			return 'INIS';
 
-			case 'csiso50inis8':
-			case 'inis8':
-			case 'isoir50':
-				return 'INIS-8';
+		case 'csiso50inis8':
+		case 'inis8':
+		case 'isoir50':
+			return 'INIS-8';
 
-			case 'csiso51iniscyrillic':
-			case 'iniscyrillic':
-			case 'isoir51':
-				return 'INIS-cyrillic';
+		case 'csiso51iniscyrillic':
+		case 'iniscyrillic':
+		case 'isoir51':
+			return 'INIS-cyrillic';
 
-			case 'csinvariant':
-			case 'invariant':
-				return 'INVARIANT';
+		case 'csinvariant':
+		case 'invariant':
+			return 'INVARIANT';
 
-			case 'iso2022cn':
-				return 'ISO-2022-CN';
+		case 'iso2022cn':
+			return 'ISO-2022-CN';
 
-			case 'iso2022cnext':
-				return 'ISO-2022-CN-EXT';
+		case 'iso2022cnext':
+			return 'ISO-2022-CN-EXT';
 
-			case 'csiso2022jp':
-			case 'iso2022jp':
-				return 'ISO-2022-JP';
+		case 'csiso2022jp':
+		case 'iso2022jp':
+			return 'ISO-2022-JP';
 
-			case 'csiso2022jp2':
-			case 'iso2022jp2':
-				return 'ISO-2022-JP-2';
+		case 'csiso2022jp2':
+		case 'iso2022jp2':
+			return 'ISO-2022-JP-2';
 
-			case 'csiso2022kr':
-			case 'iso2022kr':
-				return 'ISO-2022-KR';
+		case 'csiso2022kr':
+		case 'iso2022kr':
+			return 'ISO-2022-KR';
 
-			case 'cswindows30latin1':
-			case 'iso88591windows30latin1':
-				return 'ISO-8859-1-Windows-3.0-Latin-1';
+		case 'cswindows30latin1':
+		case 'iso88591windows30latin1':
+			return 'ISO-8859-1-Windows-3.0-Latin-1';
 
-			case 'cswindows31latin1':
-			case 'iso88591windows31latin1':
-				return 'ISO-8859-1-Windows-3.1-Latin-1';
+		case 'cswindows31latin1':
+		case 'iso88591windows31latin1':
+			return 'ISO-8859-1-Windows-3.1-Latin-1';
 
-			case 'csisolatin2':
-			case 'iso88592':
-			case 'iso885921987':
-			case 'isoir101':
-			case 'l2':
-			case 'latin2':
-				return 'ISO-8859-2';
+		case 'csisolatin2':
+		case 'iso88592':
+		case 'iso885921987':
+		case 'isoir101':
+		case 'l2':
+		case 'latin2':
+			return 'ISO-8859-2';
 
-			case 'cswindows31latin2':
-			case 'iso88592windowslatin2':
-				return 'ISO-8859-2-Windows-Latin-2';
+		case 'cswindows31latin2':
+		case 'iso88592windowslatin2':
+			return 'ISO-8859-2-Windows-Latin-2';
 
-			case 'csisolatin3':
-			case 'iso88593':
-			case 'iso885931988':
-			case 'isoir109':
-			case 'l3':
-			case 'latin3':
-				return 'ISO-8859-3';
+		case 'csisolatin3':
+		case 'iso88593':
+		case 'iso885931988':
+		case 'isoir109':
+		case 'l3':
+		case 'latin3':
+			return 'ISO-8859-3';
 
-			case 'csisolatin4':
-			case 'iso88594':
-			case 'iso885941988':
-			case 'isoir110':
-			case 'l4':
-			case 'latin4':
-				return 'ISO-8859-4';
+		case 'csisolatin4':
+		case 'iso88594':
+		case 'iso885941988':
+		case 'isoir110':
+		case 'l4':
+		case 'latin4':
+			return 'ISO-8859-4';
 
-			case 'csisolatincyrillic':
-			case 'cyrillic':
-			case 'iso88595':
-			case 'iso885951988':
-			case 'isoir144':
-				return 'ISO-8859-5';
+		case 'csisolatincyrillic':
+		case 'cyrillic':
+		case 'iso88595':
+		case 'iso885951988':
+		case 'isoir144':
+			return 'ISO-8859-5';
 
-			case 'arabic':
-			case 'asmo708':
-			case 'csisolatinarabic':
-			case 'ecma114':
-			case 'iso88596':
-			case 'iso885961987':
-			case 'isoir127':
-				return 'ISO-8859-6';
+		case 'arabic':
+		case 'asmo708':
+		case 'csisolatinarabic':
+		case 'ecma114':
+		case 'iso88596':
+		case 'iso885961987':
+		case 'isoir127':
+			return 'ISO-8859-6';
 
-			case 'csiso88596e':
-			case 'iso88596e':
-				return 'ISO-8859-6-E';
+		case 'csiso88596e':
+		case 'iso88596e':
+			return 'ISO-8859-6-E';
 
-			case 'csiso88596i':
-			case 'iso88596i':
-				return 'ISO-8859-6-I';
+		case 'csiso88596i':
+		case 'iso88596i':
+			return 'ISO-8859-6-I';
 
-			case 'csisolatingreek':
-			case 'ecma118':
-			case 'elot928':
-			case 'greek':
-			case 'greek8':
-			case 'iso88597':
-			case 'iso885971987':
-			case 'isoir126':
-				return 'ISO-8859-7';
+		case 'csisolatingreek':
+		case 'ecma118':
+		case 'elot928':
+		case 'greek':
+		case 'greek8':
+		case 'iso88597':
+		case 'iso885971987':
+		case 'isoir126':
+			return 'ISO-8859-7';
 
-			case 'csisolatinhebrew':
-			case 'hebrew':
-			case 'iso88598':
-			case 'iso885981988':
-			case 'isoir138':
-				return 'ISO-8859-8';
+		case 'csisolatinhebrew':
+		case 'hebrew':
+		case 'iso88598':
+		case 'iso885981988':
+		case 'isoir138':
+			return 'ISO-8859-8';
 
-			case 'csiso88598e':
-			case 'iso88598e':
-				return 'ISO-8859-8-E';
+		case 'csiso88598e':
+		case 'iso88598e':
+			return 'ISO-8859-8-E';
 
-			case 'csiso88598i':
-			case 'iso88598i':
-				return 'ISO-8859-8-I';
+		case 'csiso88598i':
+		case 'iso88598i':
+			return 'ISO-8859-8-I';
 
-			case 'cswindows31latin5':
-			case 'iso88599windowslatin5':
-				return 'ISO-8859-9-Windows-Latin-5';
+		case 'cswindows31latin5':
+		case 'iso88599windowslatin5':
+			return 'ISO-8859-9-Windows-Latin-5';
 
-			case 'csisolatin6':
-			case 'iso885910':
-			case 'iso8859101992':
-			case 'isoir157':
-			case 'l6':
-			case 'latin6':
-				return 'ISO-8859-10';
+		case 'csisolatin6':
+		case 'iso885910':
+		case 'iso8859101992':
+		case 'isoir157':
+		case 'l6':
+		case 'latin6':
+			return 'ISO-8859-10';
 
-			case 'iso885913':
-				return 'ISO-8859-13';
+		case 'iso885913':
+			return 'ISO-8859-13';
 
-			case 'iso885914':
-			case 'iso8859141998':
-			case 'isoceltic':
-			case 'isoir199':
-			case 'l8':
-			case 'latin8':
-				return 'ISO-8859-14';
+		case 'iso885914':
+		case 'iso8859141998':
+		case 'isoceltic':
+		case 'isoir199':
+		case 'l8':
+		case 'latin8':
+			return 'ISO-8859-14';
 
-			case 'iso885915':
-			case 'latin9':
-				return 'ISO-8859-15';
+		case 'iso885915':
+		case 'latin9':
+			return 'ISO-8859-15';
 
-			case 'iso885916':
-			case 'iso8859162001':
-			case 'isoir226':
-			case 'l10':
-			case 'latin10':
-				return 'ISO-8859-16';
+		case 'iso885916':
+		case 'iso8859162001':
+		case 'isoir226':
+		case 'l10':
+		case 'latin10':
+			return 'ISO-8859-16';
 
-			case 'iso10646j1':
-				return 'ISO-10646-J-1';
+		case 'iso10646j1':
+			return 'ISO-10646-J-1';
 
-			case 'csunicode':
-			case 'iso10646ucs2':
-				return 'ISO-10646-UCS-2';
+		case 'csunicode':
+		case 'iso10646ucs2':
+			return 'ISO-10646-UCS-2';
 
-			case 'csucs4':
-			case 'iso10646ucs4':
-				return 'ISO-10646-UCS-4';
+		case 'csucs4':
+		case 'iso10646ucs4':
+			return 'ISO-10646-UCS-4';
 
-			case 'csunicodeascii':
-			case 'iso10646ucsbasic':
-				return 'ISO-10646-UCS-Basic';
+		case 'csunicodeascii':
+		case 'iso10646ucsbasic':
+			return 'ISO-10646-UCS-Basic';
 
-			case 'csunicodelatin1':
-			case 'iso10646':
-			case 'iso10646unicodelatin1':
-				return 'ISO-10646-Unicode-Latin1';
+		case 'csunicodelatin1':
+		case 'iso10646':
+		case 'iso10646unicodelatin1':
+			return 'ISO-10646-Unicode-Latin1';
 
-			case 'csiso10646utf1':
-			case 'iso10646utf1':
-				return 'ISO-10646-UTF-1';
+		case 'csiso10646utf1':
+		case 'iso10646utf1':
+			return 'ISO-10646-UTF-1';
 
-			case 'csiso115481':
-			case 'iso115481':
-			case 'isotr115481':
-				return 'ISO-11548-1';
+		case 'csiso115481':
+		case 'iso115481':
+		case 'isotr115481':
+			return 'ISO-11548-1';
 
-			case 'csiso90':
-			case 'isoir90':
-				return 'iso-ir-90';
+		case 'csiso90':
+		case 'isoir90':
+			return 'iso-ir-90';
 
-			case 'csunicodeibm1261':
-			case 'isounicodeibm1261':
-				return 'ISO-Unicode-IBM-1261';
+		case 'csunicodeibm1261':
+		case 'isounicodeibm1261':
+			return 'ISO-Unicode-IBM-1261';
 
-			case 'csunicodeibm1264':
-			case 'isounicodeibm1264':
-				return 'ISO-Unicode-IBM-1264';
+		case 'csunicodeibm1264':
+		case 'isounicodeibm1264':
+			return 'ISO-Unicode-IBM-1264';
 
-			case 'csunicodeibm1265':
-			case 'isounicodeibm1265':
-				return 'ISO-Unicode-IBM-1265';
+		case 'csunicodeibm1265':
+		case 'isounicodeibm1265':
+			return 'ISO-Unicode-IBM-1265';
 
-			case 'csunicodeibm1268':
-			case 'isounicodeibm1268':
-				return 'ISO-Unicode-IBM-1268';
+		case 'csunicodeibm1268':
+		case 'isounicodeibm1268':
+			return 'ISO-Unicode-IBM-1268';
 
-			case 'csunicodeibm1276':
-			case 'isounicodeibm1276':
-				return 'ISO-Unicode-IBM-1276';
+		case 'csunicodeibm1276':
+		case 'isounicodeibm1276':
+			return 'ISO-Unicode-IBM-1276';
 
-			case 'csiso646basic1983':
-			case 'iso646basic1983':
-			case 'ref':
-				return 'ISO_646.basic:1983';
+		case 'csiso646basic1983':
+		case 'iso646basic1983':
+		case 'ref':
+			return 'ISO_646.basic:1983';
 
-			case 'csiso2intlrefversion':
-			case 'irv':
-			case 'iso646irv1983':
-			case 'isoir2':
-				return 'ISO_646.irv:1983';
+		case 'csiso2intlrefversion':
+		case 'irv':
+		case 'iso646irv1983':
+		case 'isoir2':
+			return 'ISO_646.irv:1983';
 
-			case 'csiso2033':
-			case 'e13b':
-			case 'iso20331983':
-			case 'isoir98':
-				return 'ISO_2033-1983';
+		case 'csiso2033':
+		case 'e13b':
+		case 'iso20331983':
+		case 'isoir98':
+			return 'ISO_2033-1983';
 
-			case 'csiso5427cyrillic':
-			case 'iso5427':
-			case 'isoir37':
-				return 'ISO_5427';
+		case 'csiso5427cyrillic':
+		case 'iso5427':
+		case 'isoir37':
+			return 'ISO_5427';
 
-			case 'iso5427cyrillic1981':
-			case 'iso54271981':
-			case 'isoir54':
-				return 'ISO_5427:1981';
+		case 'iso5427cyrillic1981':
+		case 'iso54271981':
+		case 'isoir54':
+			return 'ISO_5427:1981';
 
-			case 'csiso5428greek':
-			case 'iso54281980':
-			case 'isoir55':
-				return 'ISO_5428:1980';
+		case 'csiso5428greek':
+		case 'iso54281980':
+		case 'isoir55':
+			return 'ISO_5428:1980';
 
-			case 'csiso6937add':
-			case 'iso6937225':
-			case 'isoir152':
-				return 'ISO_6937-2-25';
+		case 'csiso6937add':
+		case 'iso6937225':
+		case 'isoir152':
+			return 'ISO_6937-2-25';
 
-			case 'csisotextcomm':
-			case 'iso69372add':
-			case 'isoir142':
-				return 'ISO_6937-2-add';
+		case 'csisotextcomm':
+		case 'iso69372add':
+		case 'isoir142':
+			return 'ISO_6937-2-add';
 
-			case 'csiso8859supp':
-			case 'iso8859supp':
-			case 'isoir154':
-			case 'latin125':
-				return 'ISO_8859-supp';
+		case 'csiso8859supp':
+		case 'iso8859supp':
+		case 'isoir154':
+		case 'latin125':
+			return 'ISO_8859-supp';
 
-			case 'csiso10367box':
-			case 'iso10367box':
-			case 'isoir155':
-				return 'ISO_10367-box';
+		case 'csiso10367box':
+		case 'iso10367box':
+		case 'isoir155':
+			return 'ISO_10367-box';
 
-			case 'csiso15italian':
-			case 'iso646it':
-			case 'isoir15':
-			case 'it':
-				return 'IT';
+		case 'csiso15italian':
+		case 'iso646it':
+		case 'isoir15':
+		case 'it':
+			return 'IT';
 
-			case 'csiso13jisc6220jp':
-			case 'isoir13':
-			case 'jisc62201969':
-			case 'jisc62201969jp':
-			case 'katakana':
-			case 'x2017':
-				return 'JIS_C6220-1969-jp';
+		case 'csiso13jisc6220jp':
+		case 'isoir13':
+		case 'jisc62201969':
+		case 'jisc62201969jp':
+		case 'katakana':
+		case 'x2017':
+			return 'JIS_C6220-1969-jp';
 
-			case 'csiso14jisc6220ro':
-			case 'iso646jp':
-			case 'isoir14':
-			case 'jisc62201969ro':
-			case 'jp':
-				return 'JIS_C6220-1969-ro';
+		case 'csiso14jisc6220ro':
+		case 'iso646jp':
+		case 'isoir14':
+		case 'jisc62201969ro':
+		case 'jp':
+			return 'JIS_C6220-1969-ro';
 
-			case 'csiso42jisc62261978':
-			case 'isoir42':
-			case 'jisc62261978':
-				return 'JIS_C6226-1978';
+		case 'csiso42jisc62261978':
+		case 'isoir42':
+		case 'jisc62261978':
+			return 'JIS_C6226-1978';
 
-			case 'csiso87jisx208':
-			case 'isoir87':
-			case 'jisc62261983':
-			case 'jisx2081983':
-			case 'x208':
-				return 'JIS_C6226-1983';
+		case 'csiso87jisx208':
+		case 'isoir87':
+		case 'jisc62261983':
+		case 'jisx2081983':
+		case 'x208':
+			return 'JIS_C6226-1983';
 
-			case 'csiso91jisc62291984a':
-			case 'isoir91':
-			case 'jisc62291984a':
-			case 'jpocra':
-				return 'JIS_C6229-1984-a';
+		case 'csiso91jisc62291984a':
+		case 'isoir91':
+		case 'jisc62291984a':
+		case 'jpocra':
+			return 'JIS_C6229-1984-a';
 
-			case 'csiso92jisc62991984b':
-			case 'iso646jpocrb':
-			case 'isoir92':
-			case 'jisc62291984b':
-			case 'jpocrb':
-				return 'JIS_C6229-1984-b';
+		case 'csiso92jisc62991984b':
+		case 'iso646jpocrb':
+		case 'isoir92':
+		case 'jisc62291984b':
+		case 'jpocrb':
+			return 'JIS_C6229-1984-b';
 
-			case 'csiso93jis62291984badd':
-			case 'isoir93':
-			case 'jisc62291984badd':
-			case 'jpocrbadd':
-				return 'JIS_C6229-1984-b-add';
+		case 'csiso93jis62291984badd':
+		case 'isoir93':
+		case 'jisc62291984badd':
+		case 'jpocrbadd':
+			return 'JIS_C6229-1984-b-add';
 
-			case 'csiso94jis62291984hand':
-			case 'isoir94':
-			case 'jisc62291984hand':
-			case 'jpocrhand':
-				return 'JIS_C6229-1984-hand';
+		case 'csiso94jis62291984hand':
+		case 'isoir94':
+		case 'jisc62291984hand':
+		case 'jpocrhand':
+			return 'JIS_C6229-1984-hand';
 
-			case 'csiso95jis62291984handadd':
-			case 'isoir95':
-			case 'jisc62291984handadd':
-			case 'jpocrhandadd':
-				return 'JIS_C6229-1984-hand-add';
+		case 'csiso95jis62291984handadd':
+		case 'isoir95':
+		case 'jisc62291984handadd':
+		case 'jpocrhandadd':
+			return 'JIS_C6229-1984-hand-add';
 
-			case 'csiso96jisc62291984kana':
-			case 'isoir96':
-			case 'jisc62291984kana':
-				return 'JIS_C6229-1984-kana';
+		case 'csiso96jisc62291984kana':
+		case 'isoir96':
+		case 'jisc62291984kana':
+			return 'JIS_C6229-1984-kana';
 
-			case 'csjisencoding':
-			case 'jisencoding':
-				return 'JIS_Encoding';
+		case 'csjisencoding':
+		case 'jisencoding':
+			return 'JIS_Encoding';
 
-			case 'cshalfwidthkatakana':
-			case 'jisx201':
-			case 'x201':
-				return 'JIS_X0201';
+		case 'cshalfwidthkatakana':
+		case 'jisx201':
+		case 'x201':
+			return 'JIS_X0201';
 
-			case 'csiso159jisx2121990':
-			case 'isoir159':
-			case 'jisx2121990':
-			case 'x212':
-				return 'JIS_X0212-1990';
+		case 'csiso159jisx2121990':
+		case 'isoir159':
+		case 'jisx2121990':
+		case 'x212':
+			return 'JIS_X0212-1990';
 
-			case 'csiso141jusib1002':
-			case 'iso646yu':
-			case 'isoir141':
-			case 'js':
-			case 'jusib1002':
-			case 'yu':
-				return 'JUS_I.B1.002';
+		case 'csiso141jusib1002':
+		case 'iso646yu':
+		case 'isoir141':
+		case 'js':
+		case 'jusib1002':
+		case 'yu':
+			return 'JUS_I.B1.002';
 
-			case 'csiso147macedonian':
-			case 'isoir147':
-			case 'jusib1003mac':
-			case 'macedonian':
-				return 'JUS_I.B1.003-mac';
+		case 'csiso147macedonian':
+		case 'isoir147':
+		case 'jusib1003mac':
+		case 'macedonian':
+			return 'JUS_I.B1.003-mac';
 
-			case 'csiso146serbian':
-			case 'isoir146':
-			case 'jusib1003serb':
-			case 'serbian':
-				return 'JUS_I.B1.003-serb';
+		case 'csiso146serbian':
+		case 'isoir146':
+		case 'jusib1003serb':
+		case 'serbian':
+			return 'JUS_I.B1.003-serb';
 
-			case 'koi7switched':
-				return 'KOI7-switched';
+		case 'koi7switched':
+			return 'KOI7-switched';
 
-			case 'cskoi8r':
-			case 'koi8r':
-				return 'KOI8-R';
+		case 'cskoi8r':
+		case 'koi8r':
+			return 'KOI8-R';
 
-			case 'koi8u':
-				return 'KOI8-U';
+		case 'koi8u':
+			return 'KOI8-U';
 
-			case 'csksc5636':
-			case 'iso646kr':
-			case 'ksc5636':
-				return 'KSC5636';
+		case 'csksc5636':
+		case 'iso646kr':
+		case 'ksc5636':
+			return 'KSC5636';
 
-			case 'cskz1048':
-			case 'kz1048':
-			case 'rk1048':
-			case 'strk10482002':
-				return 'KZ-1048';
+		case 'cskz1048':
+		case 'kz1048':
+		case 'rk1048':
+		case 'strk10482002':
+			return 'KZ-1048';
 
-			case 'csiso19latingreek':
-			case 'isoir19':
-			case 'latingreek':
-				return 'latin-greek';
+		case 'csiso19latingreek':
+		case 'isoir19':
+		case 'latingreek':
+			return 'latin-greek';
 
-			case 'csiso27latingreek1':
-			case 'isoir27':
-			case 'latingreek1':
-				return 'Latin-greek-1';
+		case 'csiso27latingreek1':
+		case 'isoir27':
+		case 'latingreek1':
+			return 'Latin-greek-1';
 
-			case 'csiso158lap':
-			case 'isoir158':
-			case 'lap':
-			case 'latinlap':
-				return 'latin-lap';
+		case 'csiso158lap':
+		case 'isoir158':
+		case 'lap':
+		case 'latinlap':
+			return 'latin-lap';
 
-			case 'csmacintosh':
-			case 'mac':
-			case 'macintosh':
-				return 'macintosh';
+		case 'csmacintosh':
+		case 'mac':
+		case 'macintosh':
+			return 'macintosh';
 
-			case 'csmicrosoftpublishing':
-			case 'microsoftpublishing':
-				return 'Microsoft-Publishing';
+		case 'csmicrosoftpublishing':
+		case 'microsoftpublishing':
+			return 'Microsoft-Publishing';
 
-			case 'csmnem':
-			case 'mnem':
-				return 'MNEM';
+		case 'csmnem':
+		case 'mnem':
+			return 'MNEM';
 
-			case 'csmnemonic':
-			case 'mnemonic':
-				return 'MNEMONIC';
+		case 'csmnemonic':
+		case 'mnemonic':
+			return 'MNEMONIC';
 
-			case 'csiso86hungarian':
-			case 'hu':
-			case 'iso646hu':
-			case 'isoir86':
-			case 'msz77953':
-				return 'MSZ_7795.3';
+		case 'csiso86hungarian':
+		case 'hu':
+		case 'iso646hu':
+		case 'isoir86':
+		case 'msz77953':
+			return 'MSZ_7795.3';
 
-			case 'csnatsdano':
-			case 'isoir91':
-			case 'natsdano':
-				return 'NATS-DANO';
+		case 'csnatsdano':
+		case 'isoir91':
+		case 'natsdano':
+			return 'NATS-DANO';
 
-			case 'csnatsdanoadd':
-			case 'isoir92':
-			case 'natsdanoadd':
-				return 'NATS-DANO-ADD';
+		case 'csnatsdanoadd':
+		case 'isoir92':
+		case 'natsdanoadd':
+			return 'NATS-DANO-ADD';
 
-			case 'csnatssefi':
-			case 'isoir81':
-			case 'natssefi':
-				return 'NATS-SEFI';
+		case 'csnatssefi':
+		case 'isoir81':
+		case 'natssefi':
+			return 'NATS-SEFI';
 
-			case 'csnatssefiadd':
-			case 'isoir82':
-			case 'natssefiadd':
-				return 'NATS-SEFI-ADD';
+		case 'csnatssefiadd':
+		case 'isoir82':
+		case 'natssefiadd':
+			return 'NATS-SEFI-ADD';
 
-			case 'csiso151cuba':
-			case 'cuba':
-			case 'iso646cu':
-			case 'isoir151':
-			case 'ncnc1081':
-				return 'NC_NC00-10:81';
+		case 'csiso151cuba':
+		case 'cuba':
+		case 'iso646cu':
+		case 'isoir151':
+		case 'ncnc1081':
+			return 'NC_NC00-10:81';
 
-			case 'csiso69french':
-			case 'fr':
-			case 'iso646fr':
-			case 'isoir69':
-			case 'nfz62010':
-				return 'NF_Z_62-010';
+		case 'csiso69french':
+		case 'fr':
+		case 'iso646fr':
+		case 'isoir69':
+		case 'nfz62010':
+			return 'NF_Z_62-010';
 
-			case 'csiso25french':
-			case 'iso646fr1':
-			case 'isoir25':
-			case 'nfz620101973':
-				return 'NF_Z_62-010_(1973)';
+		case 'csiso25french':
+		case 'iso646fr1':
+		case 'isoir25':
+		case 'nfz620101973':
+			return 'NF_Z_62-010_(1973)';
 
-			case 'csiso60danishnorwegian':
-			case 'csiso60norwegian1':
-			case 'iso646no':
-			case 'isoir60':
-			case 'no':
-			case 'ns45511':
-				return 'NS_4551-1';
+		case 'csiso60danishnorwegian':
+		case 'csiso60norwegian1':
+		case 'iso646no':
+		case 'isoir60':
+		case 'no':
+		case 'ns45511':
+			return 'NS_4551-1';
 
-			case 'csiso61norwegian2':
-			case 'iso646no2':
-			case 'isoir61':
-			case 'no2':
-			case 'ns45512':
-				return 'NS_4551-2';
+		case 'csiso61norwegian2':
+		case 'iso646no2':
+		case 'isoir61':
+		case 'no2':
+		case 'ns45512':
+			return 'NS_4551-2';
 
-			case 'osdebcdicdf3irv':
-				return 'OSD_EBCDIC_DF03_IRV';
+		case 'osdebcdicdf3irv':
+			return 'OSD_EBCDIC_DF03_IRV';
 
-			case 'osdebcdicdf41':
-				return 'OSD_EBCDIC_DF04_1';
+		case 'osdebcdicdf41':
+			return 'OSD_EBCDIC_DF04_1';
 
-			case 'osdebcdicdf415':
-				return 'OSD_EBCDIC_DF04_15';
+		case 'osdebcdicdf415':
+			return 'OSD_EBCDIC_DF04_15';
 
-			case 'cspc8danishnorwegian':
-			case 'pc8danishnorwegian':
-				return 'PC8-Danish-Norwegian';
+		case 'cspc8danishnorwegian':
+		case 'pc8danishnorwegian':
+			return 'PC8-Danish-Norwegian';
 
-			case 'cspc8turkish':
-			case 'pc8turkish':
-				return 'PC8-Turkish';
+		case 'cspc8turkish':
+		case 'pc8turkish':
+			return 'PC8-Turkish';
 
-			case 'csiso16portuguese':
-			case 'iso646pt':
-			case 'isoir16':
-			case 'pt':
-				return 'PT';
+		case 'csiso16portuguese':
+		case 'iso646pt':
+		case 'isoir16':
+		case 'pt':
+			return 'PT';
 
-			case 'csiso84portuguese2':
-			case 'iso646pt2':
-			case 'isoir84':
-			case 'pt2':
-				return 'PT2';
+		case 'csiso84portuguese2':
+		case 'iso646pt2':
+		case 'isoir84':
+		case 'pt2':
+			return 'PT2';
 
-			case 'cp154':
-			case 'csptcp154':
-			case 'cyrillicasian':
-			case 'pt154':
-			case 'ptcp154':
-				return 'PTCP154';
+		case 'cp154':
+		case 'csptcp154':
+		case 'cyrillicasian':
+		case 'pt154':
+		case 'ptcp154':
+			return 'PTCP154';
 
-			case 'scsu':
-				return 'SCSU';
+		case 'scsu':
+			return 'SCSU';
 
-			case 'csiso10swedish':
-			case 'fi':
-			case 'iso646fi':
-			case 'iso646se':
-			case 'isoir10':
-			case 'se':
-			case 'sen850200b':
-				return 'SEN_850200_B';
+		case 'csiso10swedish':
+		case 'fi':
+		case 'iso646fi':
+		case 'iso646se':
+		case 'isoir10':
+		case 'se':
+		case 'sen850200b':
+			return 'SEN_850200_B';
 
-			case 'csiso11swedishfornames':
-			case 'iso646se2':
-			case 'isoir11':
-			case 'se2':
-			case 'sen850200c':
-				return 'SEN_850200_C';
+		case 'csiso11swedishfornames':
+		case 'iso646se2':
+		case 'isoir11':
+		case 'se2':
+		case 'sen850200c':
+			return 'SEN_850200_C';
 
-			case 'csshiftjis':
-			case 'mskanji':
-			case 'shiftjis':
-				return 'Shift_JIS';
+		case 'csshiftjis':
+		case 'mskanji':
+		case 'shiftjis':
+			return 'Shift_JIS';
 
-			case 'csiso102t617bit':
-			case 'isoir102':
-			case 't617bit':
-				return 'T.61-7bit';
+		case 'csiso102t617bit':
+		case 'isoir102':
+		case 't617bit':
+			return 'T.61-7bit';
 
-			case 'csiso103t618bit':
-			case 'isoir103':
-			case 't61':
-			case 't618bit':
-				return 'T.61-8bit';
+		case 'csiso103t618bit':
+		case 'isoir103':
+		case 't61':
+		case 't618bit':
+			return 'T.61-8bit';
 
-			case 'csiso128t101g2':
-			case 'isoir128':
-			case 't101g2':
-				return 'T.101-G2';
+		case 'csiso128t101g2':
+		case 'isoir128':
+		case 't101g2':
+			return 'T.101-G2';
 
-			case 'cstscii':
-			case 'tscii':
-				return 'TSCII';
+		case 'cstscii':
+		case 'tscii':
+			return 'TSCII';
 
-			case 'csunicode11':
-			case 'unicode11':
-				return 'UNICODE-1-1';
+		case 'csunicode11':
+		case 'unicode11':
+			return 'UNICODE-1-1';
 
-			case 'csunicode11utf7':
-			case 'unicode11utf7':
-				return 'UNICODE-1-1-UTF-7';
+		case 'csunicode11utf7':
+		case 'unicode11utf7':
+			return 'UNICODE-1-1-UTF-7';
 
-			case 'csunknown8bit':
-			case 'unknown8bit':
-				return 'UNKNOWN-8BIT';
+		case 'csunknown8bit':
+		case 'unknown8bit':
+			return 'UNKNOWN-8BIT';
 
-			case 'ansix341968':
-			case 'ansix341986':
-			case 'ascii':
-			case 'cp367':
-			case 'csascii':
-			case 'ibm367':
-			case 'iso646irv1991':
-			case 'iso646us':
-			case 'isoir6':
-			case 'us':
-			case 'usascii':
-				return 'US-ASCII';
+		case 'ansix341968':
+		case 'ansix341986':
+		case 'ascii':
+		case 'cp367':
+		case 'csascii':
+		case 'ibm367':
+		case 'iso646irv1991':
+		case 'iso646us':
+		case 'isoir6':
+		case 'us':
+		case 'usascii':
+			return 'US-ASCII';
 
-			case 'csusdk':
-			case 'usdk':
-				return 'us-dk';
+		case 'csusdk':
+		case 'usdk':
+			return 'us-dk';
 
-			case 'utf7':
-				return 'UTF-7';
+		case 'utf7':
+			return 'UTF-7';
 
-			case 'utf8':
-				return 'UTF-8';
+		case 'utf8':
+			return 'UTF-8';
 
-			case 'utf16':
-				return 'UTF-16';
+		case 'utf16':
+			return 'UTF-16';
 
-			case 'utf16be':
-				return 'UTF-16BE';
+		case 'utf16be':
+			return 'UTF-16BE';
 
-			case 'utf16le':
-				return 'UTF-16LE';
+		case 'utf16le':
+			return 'UTF-16LE';
 
-			case 'utf32':
-				return 'UTF-32';
+		case 'utf32':
+			return 'UTF-32';
 
-			case 'utf32be':
-				return 'UTF-32BE';
+		case 'utf32be':
+			return 'UTF-32BE';
 
-			case 'utf32le':
-				return 'UTF-32LE';
+		case 'utf32le':
+			return 'UTF-32LE';
 
-			case 'csventurainternational':
-			case 'venturainternational':
-				return 'Ventura-International';
+		case 'csventurainternational':
+		case 'venturainternational':
+			return 'Ventura-International';
 
-			case 'csventuramath':
-			case 'venturamath':
-				return 'Ventura-Math';
+		case 'csventuramath':
+		case 'venturamath':
+			return 'Ventura-Math';
 
-			case 'csventuraus':
-			case 'venturaus':
-				return 'Ventura-US';
+		case 'csventuraus':
+		case 'venturaus':
+			return 'Ventura-US';
 
-			case 'csiso70videotexsupp1':
-			case 'isoir70':
-			case 'videotexsuppl':
-				return 'videotex-suppl';
+		case 'csiso70videotexsupp1':
+		case 'isoir70':
+		case 'videotexsuppl':
+			return 'videotex-suppl';
 
-			case 'csviqr':
-			case 'viqr':
-				return 'VIQR';
+		case 'csviqr':
+		case 'viqr':
+			return 'VIQR';
 
-			case 'csviscii':
-			case 'viscii':
-				return 'VISCII';
+		case 'csviscii':
+		case 'viscii':
+			return 'VISCII';
 
-			case 'cswindows31j':
-			case 'windows31j':
-				return 'Windows-31J';
+		case 'cswindows31j':
+		case 'windows31j':
+			return 'Windows-31J';
 
-			case 'iso885911':
-			case 'tis620':
-				return 'windows-874';
+		case 'iso885911':
+		case 'tis620':
+			return 'windows-874';
 
-			case 'cseuckr':
-			case 'csksc56011987':
-			case 'euckr':
-			case 'isoir149':
-			case 'korean':
-			case 'ksc5601':
-			case 'ksc56011987':
-			case 'ksc56011989':
-			case 'windows949':
-				return 'windows-949';
+		case 'cseuckr':
+		case 'csksc56011987':
+		case 'euckr':
+		case 'isoir149':
+		case 'korean':
+		case 'ksc5601':
+		case 'ksc56011987':
+		case 'ksc56011989':
+		case 'windows949':
+			return 'windows-949';
 
-			case 'windows1250':
-				return 'windows-1250';
+		case 'windows1250':
+			return 'windows-1250';
 
-			case 'windows1251':
-				return 'windows-1251';
+		case 'windows1251':
+			return 'windows-1251';
 
-			case 'cp819':
-			case 'csisolatin1':
-			case 'ibm819':
-			case 'iso88591':
-			case 'iso885911987':
-			case 'isoir100':
-			case 'l1':
-			case 'latin1':
-			case 'windows1252':
-				return 'windows-1252';
+		case 'cp819':
+		case 'csisolatin1':
+		case 'ibm819':
+		case 'iso88591':
+		case 'iso885911987':
+		case 'isoir100':
+		case 'l1':
+		case 'latin1':
+		case 'windows1252':
+			return 'windows-1252';
 
-			case 'windows1253':
-				return 'windows-1253';
+		case 'windows1253':
+			return 'windows-1253';
 
-			case 'csisolatin5':
-			case 'iso88599':
-			case 'iso885991989':
-			case 'isoir148':
-			case 'l5':
-			case 'latin5':
-			case 'windows1254':
-				return 'windows-1254';
+		case 'csisolatin5':
+		case 'iso88599':
+		case 'iso885991989':
+		case 'isoir148':
+		case 'l5':
+		case 'latin5':
+		case 'windows1254':
+			return 'windows-1254';
 
-			case 'windows1255':
-				return 'windows-1255';
+		case 'windows1255':
+			return 'windows-1255';
 
-			case 'windows1256':
-				return 'windows-1256';
+		case 'windows1256':
+			return 'windows-1256';
 
-			case 'windows1257':
-				return 'windows-1257';
+		case 'windows1257':
+			return 'windows-1257';
 
-			case 'windows1258':
-				return 'windows-1258';
+		case 'windows1258':
+			return 'windows-1258';
 
-			default:
-				return $charset;
+		default:
+			return $charset;
 		}
 	}
 
@@ -10840,6 +10942,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Strip HTML comments
 	 *
@@ -10885,6 +10988,7 @@
 		return $decoder->parse();
 	}
 
+
 	/**
 	 * Remove RFC822 comments
 	 *
@@ -10920,13 +11024,13 @@
 					{
 						switch ($string[$position])
 						{
-							case '(':
-								$depth++;
-								break;
+						case '(':
+							$depth++;
+							break;
 
-							case ')':
-								$depth--;
-								break;
+						case ')':
+							$depth--;
+							break;
 						}
 						$position++;
 					}
@@ -10984,20 +11088,20 @@
 		{
 			switch (strtolower(trim($attribs['']['type'])))
 			{
-				case 'text':
-				case 'text/plain':
-					return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+			case 'text':
+			case 'text/plain':
+				return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
 
-				case 'html':
-				case 'text/html':
-					return SIMPLEPIE_CONSTRUCT_HTML | $mode;
+			case 'html':
+			case 'text/html':
+				return SIMPLEPIE_CONSTRUCT_HTML | $mode;
 
-				case 'xhtml':
-				case 'application/xhtml+xml':
-					return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
+			case 'xhtml':
+			case 'application/xhtml+xml':
+				return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
 
-				default:
-					return SIMPLEPIE_CONSTRUCT_NONE | $mode;
+			default:
+				return SIMPLEPIE_CONSTRUCT_NONE | $mode;
 			}
 		}
 		else
@@ -11012,17 +11116,17 @@
 		{
 			switch (strtolower(trim($attribs['']['type'])))
 			{
-				case 'text':
-					return SIMPLEPIE_CONSTRUCT_TEXT;
+			case 'text':
+				return SIMPLEPIE_CONSTRUCT_TEXT;
 
-				case 'html':
-					return SIMPLEPIE_CONSTRUCT_HTML;
+			case 'html':
+				return SIMPLEPIE_CONSTRUCT_HTML;
 
-				case 'xhtml':
-					return SIMPLEPIE_CONSTRUCT_XHTML;
+			case 'xhtml':
+				return SIMPLEPIE_CONSTRUCT_XHTML;
 
-				default:
-					return SIMPLEPIE_CONSTRUCT_NONE;
+			default:
+				return SIMPLEPIE_CONSTRUCT_NONE;
 			}
 		}
 		return SIMPLEPIE_CONSTRUCT_TEXT;
@@ -11035,14 +11139,14 @@
 			$type = strtolower(trim($attribs['']['type']));
 			switch ($type)
 			{
-				case 'text':
-					return SIMPLEPIE_CONSTRUCT_TEXT;
+			case 'text':
+				return SIMPLEPIE_CONSTRUCT_TEXT;
 
-				case 'html':
-					return SIMPLEPIE_CONSTRUCT_HTML;
+			case 'html':
+				return SIMPLEPIE_CONSTRUCT_HTML;
 
-				case 'xhtml':
-					return SIMPLEPIE_CONSTRUCT_XHTML;
+			case 'xhtml':
+				return SIMPLEPIE_CONSTRUCT_XHTML;
 			}
 			if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/')
 			{
@@ -11125,6 +11229,7 @@
 		}
 	}
 
+
 	/**
 	 * Converts a unicode codepoint to a UTF-8 character
 	 *
@@ -11141,27 +11246,28 @@
 			return false;
 		}
 		else if ($codepoint <= 0x7f)
-		{
-			return chr($codepoint);
-		}
+			{
+				return chr($codepoint);
+			}
 		else if ($codepoint <= 0x7ff)
-		{
-			return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
-		}
+			{
+				return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+			}
 		else if ($codepoint <= 0xffff)
-		{
-			return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
-		}
+			{
+				return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+			}
 		else if ($codepoint <= 0x10ffff)
-		{
-			return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
-		}
+			{
+				return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+			}
 		else
 		{
 			// U+FFFD REPLACEMENT CHARACTER
 			return "\xEF\xBF\xBD";
 		}
 	}
+
 
 	/**
 	 * Re-implementation of PHP 5's stripos()
@@ -11205,6 +11311,7 @@
 			return strpos(strtolower($haystack), $needle, $offset);
 		}
 	}
+
 
 	/**
 	 * Similar to parse_str()
@@ -11354,7 +11461,7 @@
 		header('Content-type: text/javascript; charset: UTF-8');
 		header('Cache-Control: must-revalidate');
 		header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
-		?>
+?>
 function embed_odeo(link) {
 	document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
 }
@@ -11381,6 +11488,7 @@
 }
 		<?php
 	}
+
 }
 
 /**
@@ -11392,6 +11500,7 @@
  */
 class SimplePie_Decode_HTML_Entities
 {
+
 	/**
 	 * Data to be parsed
 	 *
@@ -11416,6 +11525,7 @@
 	 */
 	var $position = 0;
 
+
 	/**
 	 * Create an instance of the class with the input data
 	 *
@@ -11426,6 +11536,7 @@
 	{
 		$this->data = $data;
 	}
+
 
 	/**
 	 * Parse the input data
@@ -11443,6 +11554,7 @@
 		}
 		return $this->data;
 	}
+
 
 	/**
 	 * Consume the next byte
@@ -11462,6 +11574,7 @@
 			return false;
 		}
 	}
+
 
 	/**
 	 * Consume a range of characters
@@ -11485,6 +11598,7 @@
 		}
 	}
 
+
 	/**
 	 * Unconsume one byte
 	 *
@@ -11496,6 +11610,7 @@
 		$this->position--;
 	}
 
+
 	/**
 	 * Decode an entity
 	 *
@@ -11505,86 +11620,87 @@
 	{
 		switch ($this->consume())
 		{
-			case "\x09":
-			case "\x0A":
-			case "\x0B":
-			case "\x0B":
-			case "\x0C":
-			case "\x20":
-			case "\x3C":
-			case "\x26":
-			case false:
-				break;
+		case "\x09":
+		case "\x0A":
+		case "\x0B":
+		case "\x0B":
+		case "\x0C":
+		case "\x20":
+		case "\x3C":
+		case "\x26":
+		case false:
+			break;
 
-			case "\x23":
-				switch ($this->consume())
-				{
-					case "\x78":
-					case "\x58":
-						$range = '0123456789ABCDEFabcdef';
-						$hex = true;
-						break;
-
-					default:
-						$range = '0123456789';
-						$hex = false;
-						$this->unconsume();
-						break;
-				}
-
-				if ($codepoint = $this->consume_range($range))
-				{
-					static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
-
-					if ($hex)
-					{
-						$codepoint = hexdec($codepoint);
-					}
-					else
-					{
-						$codepoint = intval($codepoint);
-					}
-
-					if (isset($windows_1252_specials[$codepoint]))
-					{
-						$replacement = $windows_1252_specials[$codepoint];
-					}
-					else
-					{
-						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
-					}
-
-					if (!in_array($this->consume(), array(';', false), true))
-					{
-						$this->unconsume();
-					}
-
-					$consumed_length = strlen($this->consumed);
-					$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
-					$this->position += strlen($replacement) - $consumed_length;
-				}
+		case "\x23":
+			switch ($this->consume())
+			{
+			case "\x78":
+			case "\x58":
+				$range = '0123456789ABCDEFabcdef';
+				$hex = true;
 				break;
 
 			default:
-				static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
-
-				for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
-				{
-					$consumed = substr($this->consumed, 1);
-					if (isset($entities[$consumed]))
-					{
-						$match = $consumed;
-					}
-				}
-
-				if ($match !== null)
-				{
- 					$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
-					$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
-				}
+				$range = '0123456789';
+				$hex = false;
+				$this->unconsume();
 				break;
+			}
+
+			if ($codepoint = $this->consume_range($range))
+			{
+				static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
+
+				if ($hex)
+				{
+					$codepoint = hexdec($codepoint);
+				}
+				else
+				{
+					$codepoint = intval($codepoint);
+				}
+
+				if (isset($windows_1252_specials[$codepoint]))
+				{
+					$replacement = $windows_1252_specials[$codepoint];
+				}
+				else
+				{
+					$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
+				}
+
+				if (!in_array($this->consume(), array(';', false), true))
+				{
+					$this->unconsume();
+				}
+
+				$consumed_length = strlen($this->consumed);
+				$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
+				$this->position += strlen($replacement) - $consumed_length;
+			}
+			break;
+
+		default:
+			static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
+
+			for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
+			{
+				$consumed = substr($this->consumed, 1);
+				if (isset($entities[$consumed]))
+				{
+					$match = $consumed;
+				}
+			}
+
+			if ($match !== null)
+			{
+				$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
+				$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
+			}
+			break;
 		}
 	}
+
 }
 
 /**
@@ -11594,6 +11710,7 @@
  */
 class SimplePie_IRI
 {
+
 	/**
 	 * Scheme
 	 *
@@ -11658,6 +11775,7 @@
 	 */
 	var $valid = array();
 
+
 	/**
 	 * Return the entire IRI when you try and read the object as a string
 	 *
@@ -11668,6 +11786,7 @@
 	{
 		return $this->get_iri();
 	}
+
 
 	/**
 	 * Create a new IRI object, from a specified string
@@ -11771,6 +11890,7 @@
 		return $target;
 	}
 
+
 	/**
 	 * Parse an IRI into scheme/authority/path/query/fragment segments
 	 *
@@ -11787,6 +11907,7 @@
 		}
 		return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
 	}
+
 
 	/**
 	 * Remove dot segments from a path
@@ -11848,6 +11969,7 @@
 		}
 		return $output . $input;
 	}
+
 
 	/**
 	 * Replace invalid character with percent encoding
@@ -11928,6 +12050,7 @@
 		return $string;
 	}
 
+
 	/**
 	 * Check if the object represents a valid IRI
 	 *
@@ -11938,6 +12061,7 @@
 	{
 		return array_sum($this->valid) === count($this->valid);
 	}
+
 
 	/**
 	 * Set the scheme. Returns true on success, false on failure (if there are
@@ -11958,27 +12082,28 @@
 			$len = strlen($scheme);
 			switch (true)
 			{
-				case $len > 1:
-					if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
-					{
-						$this->scheme = null;
-						$this->valid[__FUNCTION__] = false;
-						return false;
-					}
+			case $len > 1:
+				if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
+				{
+					$this->scheme = null;
+					$this->valid[__FUNCTION__] = false;
+					return false;
+				}
 
-				case $len > 0:
-					if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
-					{
-						$this->scheme = null;
-						$this->valid[__FUNCTION__] = false;
-						return false;
-					}
+			case $len > 0:
+				if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
+				{
+					$this->scheme = null;
+					$this->valid[__FUNCTION__] = false;
+					return false;
+				}
 			}
 			$this->scheme = strtolower($scheme);
 		}
 		$this->valid[__FUNCTION__] = true;
 		return true;
 	}
+
 
 	/**
 	 * Set the authority. Returns true on success, false on failure (if there are
@@ -12013,6 +12138,7 @@
 		return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port);
 	}
 
+
 	/**
 	 * Set the userinfo.
 	 *
@@ -12033,6 +12159,7 @@
 		$this->valid[__FUNCTION__] = true;
 		return true;
 	}
+
 
 	/**
 	 * Set the host. Returns true on success, false on failure (if there are
@@ -12073,6 +12200,7 @@
 		}
 	}
 
+
 	/**
 	 * Set the port. Returns true on success, false on failure (if there are
 	 * any invalid characters).
@@ -12102,6 +12230,7 @@
 			return false;
 		}
 	}
+
 
 	/**
 	 * Set the path.
@@ -12136,6 +12265,7 @@
 		}
 	}
 
+
 	/**
 	 * Set the query.
 	 *
@@ -12157,6 +12287,7 @@
 		return true;
 	}
 
+
 	/**
 	 * Set the fragment.
 	 *
@@ -12177,6 +12308,7 @@
 		$this->valid[__FUNCTION__] = true;
 		return true;
 	}
+
 
 	/**
 	 * Get the complete IRI
@@ -12218,6 +12350,7 @@
 		}
 	}
 
+
 	/**
 	 * Get the scheme
 	 *
@@ -12228,6 +12361,7 @@
 	{
 		return $this->scheme;
 	}
+
 
 	/**
 	 * Get the complete authority
@@ -12261,6 +12395,7 @@
 		}
 	}
 
+
 	/**
 	 * Get the user information
 	 *
@@ -12271,6 +12406,7 @@
 	{
 		return $this->userinfo;
 	}
+
 
 	/**
 	 * Get the host
@@ -12283,6 +12419,7 @@
 		return $this->host;
 	}
 
+
 	/**
 	 * Get the port
 	 *
@@ -12293,6 +12430,7 @@
 	{
 		return $this->port;
 	}
+
 
 	/**
 	 * Get the path
@@ -12305,6 +12443,7 @@
 		return $this->path;
 	}
 
+
 	/**
 	 * Get the query
 	 *
@@ -12316,6 +12455,7 @@
 		return $this->query;
 	}
 
+
 	/**
 	 * Get the fragment
 	 *
@@ -12326,6 +12466,7 @@
 	{
 		return $this->fragment;
 	}
+
 }
 
 /**
@@ -12342,6 +12483,8 @@
  */
 class SimplePie_Net_IPv6
 {
+
+
 	/**
 	 * Removes a possible existing netmask specification of an IP address.
 	 *
@@ -12364,6 +12507,7 @@
 		return $addr;
 	}
 
+
 	/**
 	 * Uncompresses an IPv6 address
 	 *
@@ -12371,8 +12515,8 @@
 	 * function expects an valid IPv6 address and expands the '::' to
 	 * the required zeros.
 	 *
-	 * Example:	 FF01::101	->	FF01:0:0:0:0:0:0:101
-	 *			 ::1		->	0:0:0:0:0:0:0:1
+	 * Example:  FF01::101 -> FF01:0:0:0:0:0:0:101
+	 *    ::1  -> 0:0:0:0:0:0:0:1
 	 *
 	 * @access public
 	 * @static
@@ -12430,26 +12574,27 @@
 			}
 			// ::xxx
 			else if ($c1 === -1)
-			{
-				$fill = str_repeat('0:', 7 - $c2);
-				$uip =	str_replace('::', $fill, $uip);
-			}
+				{
+					$fill = str_repeat('0:', 7 - $c2);
+					$uip = str_replace('::', $fill, $uip);
+				}
 			// xxx::
 			else if ($c2 === -1)
-			{
-				$fill = str_repeat(':0', 7 - $c1);
-				$uip =	str_replace('::', $fill, $uip);
-			}
+				{
+					$fill = str_repeat(':0', 7 - $c1);
+					$uip = str_replace('::', $fill, $uip);
+				}
 			// xxx::xxx
 			else
 			{
 				$fill = str_repeat(':0:', 6 - $c2 - $c1);
-				$uip =	str_replace('::', $fill, $uip);
-				$uip =	str_replace('::', ':', $uip);
+				$uip = str_replace('::', $fill, $uip);
+				$uip = str_replace('::', ':', $uip);
 			}
 		}
 		return $uip;
 	}
+
 
 	/**
 	 * Splits an IPv6 address into the IPv6 and a possible IPv4 part
@@ -12457,8 +12602,8 @@
 	 * RFC 2373 allows you to note the last two parts of an IPv6 address as
 	 * an IPv4 compatible address
 	 *
-	 * Example:	 0:0:0:0:0:0:13.1.68.3
-	 *			 0:0:0:0:0:FFFF:129.144.52.38
+	 * Example:  0:0:0:0:0:0:13.1.68.3
+	 *    0:0:0:0:0:FFFF:129.144.52.38
 	 *
 	 * @access public
 	 * @static
@@ -12480,6 +12625,7 @@
 			return array($ip, '');
 		}
 	}
+
 
 	/**
 	 * Checks an IPv6 address
@@ -12538,6 +12684,7 @@
 			return false;
 		}
 	}
+
 }
 
 /**
@@ -12547,6 +12694,7 @@
  */
 class SimplePie_Parse_Date
 {
+
 	/**
 	 * Input data
 	 *
@@ -13029,6 +13177,7 @@
 	 */
 	var $user = array();
 
+
 	/**
 	 * Create new SimplePie_Parse_Date object, and set self::day_pcre,
 	 * self::month_pcre, and self::built_in
@@ -13075,6 +13224,7 @@
 		return $object;
 	}
 
+
 	/**
 	 * Parse a date
 	 *
@@ -13104,6 +13254,7 @@
 		return false;
 	}
 
+
 	/**
 	 * Add a callback method to parse a date
 	 *
@@ -13122,6 +13273,7 @@
 			trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
 		}
 	}
+
 
 	/**
 	 * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
@@ -13196,6 +13348,7 @@
 		}
 	}
 
+
 	/**
 	 * Remove RFC822 comments
 	 *
@@ -13231,13 +13384,13 @@
 					{
 						switch ($string[$position])
 						{
-							case '(':
-								$depth++;
-								break;
+						case '(':
+							$depth++;
+							break;
 
-							case ')':
-								$depth--;
-								break;
+						case ')':
+							$depth--;
+							break;
 						}
 						$position++;
 					}
@@ -13256,6 +13409,7 @@
 
 		return $output;
 	}
+
 
 	/**
 	 * Parse RFC2822's date format
@@ -13350,6 +13504,7 @@
 		}
 	}
 
+
 	/**
 	 * Parse RFC850's date format
 	 *
@@ -13415,6 +13570,7 @@
 		}
 	}
 
+
 	/**
 	 * Parse C99's asctime()'s date format
 	 *
@@ -13457,6 +13613,7 @@
 		}
 	}
 
+
 	/**
 	 * Parse dates using strtotime()
 	 *
@@ -13475,6 +13632,7 @@
 			return $strtotime;
 		}
 	}
+
 }
 
 /**
@@ -13484,6 +13642,7 @@
  */
 class SimplePie_Content_Type_Sniffer
 {
+
 	/**
 	 * File object
 	 *
@@ -13491,6 +13650,7 @@
 	 * @access private
 	 */
 	var $file;
+
 
 	/**
 	 * Create an instance of the class with the input file
@@ -13502,6 +13662,7 @@
 	{
 		$this->file = $file;
 	}
+
 
 	/**
 	 * Get the Content-Type of the specified file
@@ -13568,6 +13729,7 @@
 		}
 	}
 
+
 	/**
 	 * Sniff text or binary
 	 *
@@ -13592,6 +13754,7 @@
 			return 'text/plain';
 		}
 	}
+
 
 	/**
 	 * Sniff unknown
@@ -13639,6 +13802,7 @@
 		}
 	}
 
+
 	/**
 	 * Sniff images
 	 *
@@ -13670,6 +13834,7 @@
 		}
 	}
 
+
 	/**
 	 * Sniff HTML
 	 *
@@ -13685,19 +13850,19 @@
 		{
 			switch ($this->file->body[$pos])
 			{
-				case "\x09":
-				case "\x0A":
-				case "\x0D":
-				case "\x20":
-					$pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
-					continue 2;
+			case "\x09":
+			case "\x0A":
+			case "\x0D":
+			case "\x20":
+				$pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
+				continue 2;
 
-				case '<':
-					$pos++;
-					break;
+			case '<':
+				$pos++;
+				break;
 
-				default:
-					return 'text/html';
+			default:
+				return 'text/html';
 			}
 
 			if (substr($this->file->body, $pos, 3) === '!--')
@@ -13751,6 +13916,7 @@
 
 		return 'text/html';
 	}
+
 }
 
 /**
@@ -13760,6 +13926,7 @@
  */
 class SimplePie_XML_Declaration_Parser
 {
+
 	/**
 	 * XML Version
 	 *
@@ -13816,6 +13983,7 @@
 	 */
 	var $position = 0;
 
+
 	/**
 	 * Create an instance of the class with the input data
 	 *
@@ -13827,6 +13995,7 @@
 		$this->data = $data;
 		$this->data_length = strlen($this->data);
 	}
+
 
 	/**
 	 * Parse the input data
@@ -13855,6 +14024,7 @@
 		}
 	}
 
+
 	/**
 	 * Check whether there is data beyond the pointer
 	 *
@@ -13865,6 +14035,7 @@
 	{
 		return (bool) ($this->position < $this->data_length);
 	}
+
 
 	/**
 	 * Advance past any whitespace
@@ -13877,6 +14048,7 @@
 		$this->position += $whitespace;
 		return $whitespace;
 	}
+
 
 	/**
 	 * Read value
@@ -14040,17 +14212,17 @@
 		{
 			switch ($standalone)
 			{
-				case 'yes':
-					$this->standalone = true;
-					break;
+			case 'yes':
+				$this->standalone = true;
+				break;
 
-				case 'no':
-					$this->standalone = false;
-					break;
+			case 'no':
+				$this->standalone = false;
+				break;
 
-				default:
-					$this->state = false;
-					return;
+			default:
+				$this->state = false;
+				return;
 			}
 
 			$this->skip_whitespace();
@@ -14068,6 +14240,7 @@
 			$this->state = false;
 		}
 	}
+
 }
 
 class SimplePie_Locator
@@ -14325,6 +14498,7 @@
 		}
 		return null;
 	}
+
 }
 
 class SimplePie_Parser
@@ -14443,51 +14617,51 @@
 				switch ($xml->nodeType)
 				{
 
-					case constant('XMLReader::END_ELEMENT'):
+				case constant('XMLReader::END_ELEMENT'):
+					if ($xml->namespaceURI !== '')
+					{
+						$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+					}
+					else
+					{
+						$tagName = $xml->localName;
+					}
+					$this->tag_close(null, $tagName);
+					break;
+				case constant('XMLReader::ELEMENT'):
+					$empty = $xml->isEmptyElement;
+					if ($xml->namespaceURI !== '')
+					{
+						$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+					}
+					else
+					{
+						$tagName = $xml->localName;
+					}
+					$attributes = array();
+					while ($xml->moveToNextAttribute())
+					{
 						if ($xml->namespaceURI !== '')
 						{
-							$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+							$attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
 						}
 						else
 						{
-							$tagName = $xml->localName;
+							$attrName = $xml->localName;
 						}
+						$attributes[$attrName] = $xml->value;
+					}
+					$this->tag_open(null, $tagName, $attributes);
+					if ($empty)
+					{
 						$this->tag_close(null, $tagName);
-						break;
-					case constant('XMLReader::ELEMENT'):
-						$empty = $xml->isEmptyElement;
-						if ($xml->namespaceURI !== '')
-						{
-							$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
-						}
-						else
-						{
-							$tagName = $xml->localName;
-						}
-						$attributes = array();
-						while ($xml->moveToNextAttribute())
-						{
-							if ($xml->namespaceURI !== '')
-							{
-								$attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
-							}
-							else
-							{
-								$attrName = $xml->localName;
-							}
-							$attributes[$attrName] = $xml->value;
-						}
-						$this->tag_open(null, $tagName, $attributes);
-						if ($empty)
-						{
-							$this->tag_close(null, $tagName);
-						}
-						break;
-					case constant('XMLReader::TEXT'):
+					}
+					break;
+				case constant('XMLReader::TEXT'):
 
-					case constant('XMLReader::CDATA'):
-						$this->cdata(null, $xml->value);
-						break;
+				case constant('XMLReader::CDATA'):
+					$this->cdata(null, $xml->value);
+					break;
 				}
 			}
 			if ($error = libxml_get_last_error())
@@ -14588,7 +14762,7 @@
 			$this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
 			$this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
 			if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
-			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml'))
+				|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml'))
 			{
 				$this->current_xhtml_construct = 0;
 			}
@@ -14663,6 +14837,7 @@
 		}
 		return $cache[$string];
 	}
+
 }
 
 /**
@@ -14817,6 +14992,7 @@
 	{
 		$this->output_encoding = (string) $encoding;
 	}
+
 
 	/**
 	 * Set element/attribute key/value pairs of HTML attributes
@@ -15018,6 +15194,7 @@
 			return '';
 		}
 	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/sites_database_plugin.inc.php b/interface/lib/classes/sites_database_plugin.inc.php
index 37cc546..d255fdc 100644
--- a/interface/lib/classes/sites_database_plugin.inc.php
+++ b/interface/lib/classes/sites_database_plugin.inc.php
@@ -31,22 +31,22 @@
 class sites_database_plugin {
 
 	public function processDatabaseInsert($form_page) {
-        global $app;
-        
+		global $app;
+
 		/*if($form_page->dataRecord["parent_domain_id"] > 0) {
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($form_page->dataRecord["parent_domain_id"]));
-		
+
 			//* The Database user shall be owned by the same group then the website
 			$sys_groupid = $web['sys_groupid'];
         } else {
             $sys_groupid = $form_page->dataRecord['sys_groupid'];
         }
-        
-        
+
+
         if($form_page->dataRecord['database_user_id']) {
             // check if there has already been a database on this server with that user
             $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "')");
-            
+
             if($check && $check['cnt'] < 1) {
                 // we need to make a datalog insert for the database users that are connected to this database
                 $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "'");
@@ -60,7 +60,7 @@
         if($form_page->dataRecord['database_ro_user_id']) {
             // check if there has already been a database on this server with that user
             $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "')");
-            
+
             if($check && $check['cnt'] < 1) {
                 // we need to make a datalog insert for the database users that are connected to this database
                 $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "'");
@@ -70,22 +70,22 @@
                 }
             }
         }*/
-    }
-    
-    public function processDatabaseUpdate($form_page) {
-        global $app;
-        
-        /*$old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($form_page->id));
-        
+	}
+
+	public function processDatabaseUpdate($form_page) {
+		global $app;
+
+		/*$old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($form_page->id));
+
         if($form_page->dataRecord["parent_domain_id"] > 0) {
             $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($form_page->dataRecord["parent_domain_id"]));
-        
+
             //* The Database user shall be owned by the same group then the website
             $sys_groupid = $web['sys_groupid'];
         } else {
             $sys_groupid = $form_page->dataRecord['sys_groupid'];
         }
-        
+
         // check if database user has changed
         if($old_record['database_user_id'] && $old_record['database_user_id'] != $form_page->dataRecord['database_user_id'] && $old_record['database_user_id'] != $form_page->dataRecord['database_ro_user_id']) {
             // check if any database on the server still uses this one
@@ -112,11 +112,11 @@
                 }
             }
         }*/
-        
-        /*if($form_page->dataRecord['database_user_id']) {
+
+		/*if($form_page->dataRecord['database_user_id']) {
             // check if there has already been a database on this server with that user
             $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "')");
-            
+
             if($check && $check['cnt'] < 1) {
                 // we need to make a datalog insert for the database users that are connected to this database
                 $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "'");
@@ -130,7 +130,7 @@
         if($form_page->dataRecord['database_ro_user_id']) {
             // check if there has already been a database on this server with that user
             $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "')");
-            
+
             if($check && $check['cnt'] < 1) {
                 // we need to make a datalog insert for the database users that are connected to this database
                 $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "'");
@@ -140,13 +140,13 @@
                 }
             }
         }*/
-        
-    }
-    
-    public function processDatabaseDelete($primary_id) {
-        global $app;
-        
-        /*$old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($primary_id));
+
+	}
+
+	public function processDatabaseDelete($primary_id) {
+		global $app;
+
+		/*$old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($primary_id));
         if($old_record['database_user_id']) {
             // check if any database on the server still uses this one
             $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($old_record['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "') AND `database_id` != '" . $app->functions->intval($primary_id) . "'");
@@ -171,8 +171,9 @@
                 }
             }
         }*/
-        
-    }
+
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 706d3b0..40736a3 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -29,87 +29,88 @@
 */
 
 /**
-* Formularbehandlung
-*
-* Functions to validate, display and save form values
-*
-*        Database table field definitions
-*
-*        Datatypes:
-*        - INTEGER (Converts data to int automatically)
-*        - DOUBLE
-*        - CURRENCY (Formats digits in currency notation)
-*        - VARCHAR (No format check)
-*        - DATE (Date format, converts from and to UNIX timestamps automatically)
-*
-*        Formtype:
-*        - TEXT (Normal text field)
-*        - PASSWORD (password field, the content will not be displayed again to the user)
-*        - SELECT (Option fiield)
-*        - MULTIPLE (Allows selection of multiple values)
-*
-*        VALUE:
-*        - Value or array
-*
-*        SEPARATOR
-*        - separator char used for fileds with multiple values
-*
-*        Hint: The auto increment (ID) filed of the table has not be be definied separately.
-*
-*/
+ * Formularbehandlung
+ *
+ * Functions to validate, display and save form values
+ *
+ *        Database table field definitions
+ *
+ *        Datatypes:
+ *        - INTEGER (Converts data to int automatically)
+ *        - DOUBLE
+ *        - CURRENCY (Formats digits in currency notation)
+ *        - VARCHAR (No format check)
+ *        - DATE (Date format, converts from and to UNIX timestamps automatically)
+ *
+ *        Formtype:
+ *        - TEXT (Normal text field)
+ *        - PASSWORD (password field, the content will not be displayed again to the user)
+ *        - SELECT (Option fiield)
+ *        - MULTIPLE (Allows selection of multiple values)
+ *
+ *        VALUE:
+ *        - Value or array
+ *
+ *        SEPARATOR
+ *        - separator char used for fileds with multiple values
+ *
+ *        Hint: The auto increment (ID) filed of the table has not be be definied separately.
+ *
+ */
+
 
 class tform {
 
-        /**
-        * Definition of the database table (array)
-        * @var tableDef
-        */
-        var $tableDef;
+	/**
+	 * Definition of the database table (array)
+	 * @var tableDef
+	 */
+	var $tableDef;
 
-        /**
-        * Private
-        * @var action
-        */
-        var $action;
+	/**
+	 * Private
+	 * @var action
+	 */
+	var $action;
 
-        /**
-        * Table name (String)
-        * @var table_name
-        */
-        var $table_name;
+	/**
+	 * Table name (String)
+	 * @var table_name
+	 */
+	var $table_name;
 
-        /**
-        * Debug Variable
-        * @var debug
-        */
-        var $debug = 0;
+	/**
+	 * Debug Variable
+	 * @var debug
+	 */
+	var $debug = 0;
 
-        /**
-        * name of the primary field of the database table (string)
-        * @var table_index
-        */
-        var $table_index;
+	/**
+	 * name of the primary field of the database table (string)
+	 * @var table_index
+	 */
+	var $table_index;
 
-        /**
-        * contains the error messages
-        * @var errorMessage
-        */
-        var $errorMessage = '';
+	/**
+	 * contains the error messages
+	 * @var errorMessage
+	 */
+	var $errorMessage = '';
 
-        var $dateformat = "d.m.Y";
-    	var $formDef = array();
-        var $wordbook;
-        var $module;
-        var $primary_id;
-		var $diffrec = array();
+	var $dateformat = "d.m.Y";
+	var $formDef = array();
+	var $wordbook;
+	var $module;
+	var $primary_id;
+	var $diffrec = array();
 
-        /**
-        * Loading of the table definition
-        *
-        * @param file: path to the form definition file
-        * @return true
-        */
-        /*
+	/**
+	 * Loading of the table definition
+	 *
+	 * @param file: path to the form definition file
+	 * @return true
+	 */
+	/*
         function loadTableDef($file) {
                 global $app,$conf;
 
@@ -121,778 +122,782 @@
         }
         */
 
-    function loadFormDef($file,$module = '') {
-                global $app,$conf;
+	function loadFormDef($file, $module = '') {
+		global $app, $conf;
 
-                include($file);
-                $this->formDef = $form;
+		include $file;
+		$this->formDef = $form;
 
-                $this->module = $module;
-				$wb = array();
-				
-				include_once(ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng');
-				
-				if(is_array($wb)) $wb_global = $wb;
-				
-                if($module == '') {
-					$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
-					if(!file_exists($lng_file)) $lng_file = "lib/lang/en_".$this->formDef["name"].".lng";
-					include($lng_file);
-                } else {
-					$lng_file = "../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
-					if(!file_exists($lng_file)) $lng_file = "../$module/lib/lang/en_".$this->formDef["name"].".lng";
-					include($lng_file);
-                }
+		$this->module = $module;
+		$wb = array();
 
-				if(is_array($wb_global)) {
-					$wb = $app->functions->array_merge($wb_global,$wb);
-				}
-				if(isset($wb_global)) unset($wb_global);
-				
-                $this->wordbook = $wb;
-				
-				$this->dateformat = $app->lng('conf_format_dateshort');
+		include_once ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng';
 
-                return true;
-        }
+		if(is_array($wb)) $wb_global = $wb;
 
-
-        /**
-        * Converts the data in the array to human readable format
-        * Datatype conversion e.g. to show the data in lists
-        *
-        * @param record
-        * @return record
-        */
-        function decode($record,$tab) {
-                global $conf, $app;
-				if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab does not exist or the tab is empty (TAB: $tab).");
-                $new_record = '';
-				$table_idx = $this->formDef['db_table_idx'];
-				if(isset($record[$table_idx])) $new_record[$table_idx] = $app->functions->intval($record[$table_idx ]);
-				
-				if(is_array($record)) {
-						foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-                                
-								//* Apply filter to record value.
-								if(isset($field['filters']) && is_array($field['filters'])) {
-									$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
-								}
-								
-								switch ($field['datatype']) {
-                                case 'VARCHAR':
-                                        $new_record[$key] = $record[$key];
-                                break;
-
-                                case 'TEXT':
-                                        $new_record[$key] = $record[$key];
-                                break;
-
-                                case 'DATETSTAMP':
-                                        if($record[$key] > 0) {
-                                                $new_record[$key] = date($this->dateformat,$record[$key]);
-                                        }
-                                break;
-								
-								case 'DATE':
-                                        if($record[$key] != '' && $record[$key] != '0000-00-00') {
-												$tmp = explode('-',$record[$key]);
-                                                $new_record[$key] = date($this->dateformat,mktime(0, 0, 0, $tmp[1]  , $tmp[2], $tmp[0]));
-                                        }
-                                break;
-
-                                case 'INTEGER':
-                                        $new_record[$key] = $app->functions->intval($record[$key]);
-                                break;
-
-                                case 'DOUBLE':
-                                        $new_record[$key] = $record[$key];
-                                break;
-
-                                case 'CURRENCY':
-                                        $new_record[$key] = $app->functions->currency_format($record[$key]);
-                                break;
-
-                                default:
-                                        $new_record[$key] = $record[$key];
-                                }
-                        }
-
-                }
-				
-        return $new_record;
-        }
-
-        /**
-        * Get the key => value array of a form filled from a datasource definitiom
-        *
-        * @param field = array with field definition
-        * @param record = Dataset as array
-        * @return key => value array for the value field of a form
-        */
-
-        function getDatasourceData($field, $record) {
-                global $app;
-
-                $values = array();
-
-                if($field["datasource"]["type"] == 'SQL') {
-
-                        // Preparing SQL string. We will replace some
-                        // common placeholders
-                        $querystring = $field["datasource"]["querystring"];
-                        $querystring = str_replace("{USERID}",$_SESSION["s"]["user"]["userid"],$querystring);
-                        $querystring = str_replace("{GROUPID}",$_SESSION["s"]["user"]["default_group"],$querystring);
-                        $querystring = str_replace("{GROUPS}",$_SESSION["s"]["user"]["groups"],$querystring);
-                        $table_idx = $this->formDef['db_table_idx'];
-						
-						$tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0;
-                        $querystring = str_replace("{RECORDID}",$tmp_recordid,$querystring);
-						unset($tmp_recordid);
-						
-                        $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
-						$querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', "self::table_auth_sql", $querystring);
-						
-                        // Getting the records
-                        $tmp_records = $app->db->queryAllRecords($querystring);
-                        if($app->db->errorMessage != '') die($app->db->errorMessage);
-                        if(is_array($tmp_records)) {
-                                $key_field = $field["datasource"]["keyfield"];
-                                $value_field = $field["datasource"]["valuefield"];
-                                foreach($tmp_records as $tmp_rec) {
-                                        $tmp_id = $tmp_rec[$key_field];
-                                        $values[$tmp_id] = $tmp_rec[$value_field];
-                                }
-                        }
-                }
-
-                if($field["datasource"]["type"] == 'CUSTOM') {
-                        // Calls a custom class to validate this record
-                        if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
-                                $datasource_class = $field["datasource"]['class'];
-                                $datasource_function = $field["datasource"]['function'];
-                                $app->uses($datasource_class);
-                                $values = $app->$datasource_class->$datasource_function($field, $record);
-                        } else {
-                                $this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
-                        }
-                }
-                
-                if(isset($field['filters']) && is_array($field['filters'])) {
-                    $new_values = array();
-                    foreach($values as $index => $value) {
-                        $new_index = $this->filterField($index, $index, $field['filters'], 'SHOW');
-                        $new_values[$new_index] = $this->filterField($index, (isset($values[$index]))?$values[$index]:'', $field['filters'], 'SHOW');
-                    }
-                    $values = $new_values;
-                    unset($new_values);
-                    unset($new_index);
-                }
-
-                return $values;
-
-        }
-		
-		function table_auth_sql($matches){
-			return $this->getAuthSQL('r', $matches[1]);
+		if($module == '') {
+			$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
+			if(!file_exists($lng_file)) $lng_file = "lib/lang/en_".$this->formDef["name"].".lng";
+			include $lng_file;
+		} else {
+			$lng_file = "../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
+			if(!file_exists($lng_file)) $lng_file = "../$module/lib/lang/en_".$this->formDef["name"].".lng";
+			include $lng_file;
 		}
-		
-		//* If the parameter 'valuelimit' is set
-		function applyValueLimit($limit,$values) {
-			
-			global $app;
-			
-			$limit_parts = explode(':',$limit);
-			
-			//* values are limited to a comma separated list
-			if($limit_parts[0] == 'list') {
-				$allowed = explode(',',$limit_parts[1]);
-			}
-			
-			//* values are limited to a field in the client settings
-			if($limit_parts[0] == 'client') {
-				if($_SESSION["s"]["user"]["typ"] == 'admin') {
-					return $values;
-				} else {
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-					$client = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-					$allowed = explode(',',$client['lm']);
+
+		if(is_array($wb_global)) {
+			$wb = $app->functions->array_merge($wb_global, $wb);
+		}
+		if(isset($wb_global)) unset($wb_global);
+
+		$this->wordbook = $wb;
+
+		$this->dateformat = $app->lng('conf_format_dateshort');
+
+		return true;
+	}
+
+
+	/**
+	 * Converts the data in the array to human readable format
+	 * Datatype conversion e.g. to show the data in lists
+	 *
+	 * @param record
+	 * @return record
+	 */
+	function decode($record, $tab) {
+		global $conf, $app;
+		if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab does not exist or the tab is empty (TAB: $tab).");
+		$new_record = '';
+		$table_idx = $this->formDef['db_table_idx'];
+		if(isset($record[$table_idx])) $new_record[$table_idx] = $app->functions->intval($record[$table_idx ]);
+
+		if(is_array($record)) {
+			foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+
+				//* Apply filter to record value.
+				if(isset($field['filters']) && is_array($field['filters'])) {
+					$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
+				}
+
+				switch ($field['datatype']) {
+				case 'VARCHAR':
+					$new_record[$key] = $record[$key];
+					break;
+
+				case 'TEXT':
+					$new_record[$key] = $record[$key];
+					break;
+
+				case 'DATETSTAMP':
+					if($record[$key] > 0) {
+						$new_record[$key] = date($this->dateformat, $record[$key]);
+					}
+					break;
+
+				case 'DATE':
+					if($record[$key] != '' && $record[$key] != '0000-00-00') {
+						$tmp = explode('-', $record[$key]);
+						$new_record[$key] = date($this->dateformat, mktime(0, 0, 0, $tmp[1]  , $tmp[2], $tmp[0]));
+					}
+					break;
+
+				case 'INTEGER':
+					$new_record[$key] = $app->functions->intval($record[$key]);
+					break;
+
+				case 'DOUBLE':
+					$new_record[$key] = $record[$key];
+					break;
+
+				case 'CURRENCY':
+					$new_record[$key] = $app->functions->currency_format($record[$key]);
+					break;
+
+				default:
+					$new_record[$key] = $record[$key];
 				}
 			}
-			
-			//* values are limited to a field in the reseller settings
-			if($limit_parts[0] == 'reseller') {
-				if($_SESSION["s"]["user"]["typ"] == 'admin') {
-					return $values;
-				} else {
-					//* Get the limits of the client that is currently logged in
+
+		}
+
+		return $new_record;
+	}
+
+
+	/**
+	 * Get the key => value array of a form filled from a datasource definitiom
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return key => value array for the value field of a form
+	 */
+	function getDatasourceData($field, $record) {
+		global $app;
+
+		$values = array();
+
+		if($field["datasource"]["type"] == 'SQL') {
+
+			// Preparing SQL string. We will replace some
+			// common placeholders
+			$querystring = $field["datasource"]["querystring"];
+			$querystring = str_replace("{USERID}", $_SESSION["s"]["user"]["userid"], $querystring);
+			$querystring = str_replace("{GROUPID}", $_SESSION["s"]["user"]["default_group"], $querystring);
+			$querystring = str_replace("{GROUPS}", $_SESSION["s"]["user"]["groups"], $querystring);
+			$table_idx = $this->formDef['db_table_idx'];
+
+			$tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0;
+			$querystring = str_replace("{RECORDID}", $tmp_recordid, $querystring);
+			unset($tmp_recordid);
+
+			$querystring = str_replace("{AUTHSQL}", $this->getAuthSQL('r'), $querystring);
+			$querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', "self::table_auth_sql", $querystring);
+
+			// Getting the records
+			$tmp_records = $app->db->queryAllRecords($querystring);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+			if(is_array($tmp_records)) {
+				$key_field = $field["datasource"]["keyfield"];
+				$value_field = $field["datasource"]["valuefield"];
+				foreach($tmp_records as $tmp_rec) {
+					$tmp_id = $tmp_rec[$key_field];
+					$values[$tmp_id] = $tmp_rec[$value_field];
+				}
+			}
+		}
+
+		if($field["datasource"]["type"] == 'CUSTOM') {
+			// Calls a custom class to validate this record
+			if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
+				$datasource_class = $field["datasource"]['class'];
+				$datasource_function = $field["datasource"]['function'];
+				$app->uses($datasource_class);
+				$values = $app->$datasource_class->$datasource_function($field, $record);
+			} else {
+				$this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
+			}
+		}
+
+		if(isset($field['filters']) && is_array($field['filters'])) {
+			$new_values = array();
+			foreach($values as $index => $value) {
+				$new_index = $this->filterField($index, $index, $field['filters'], 'SHOW');
+				$new_values[$new_index] = $this->filterField($index, (isset($values[$index]))?$values[$index]:'', $field['filters'], 'SHOW');
+			}
+			$values = $new_values;
+			unset($new_values);
+			unset($new_index);
+		}
+
+		return $values;
+
+	}
+
+	function table_auth_sql($matches){
+		return $this->getAuthSQL('r', $matches[1]);
+	}
+
+	//* If the parameter 'valuelimit' is set
+	function applyValueLimit($limit, $values) {
+
+		global $app;
+
+		$limit_parts = explode(':', $limit);
+
+		//* values are limited to a comma separated list
+		if($limit_parts[0] == 'list') {
+			$allowed = explode(',', $limit_parts[1]);
+		}
+
+		//* values are limited to a field in the client settings
+		if($limit_parts[0] == 'client') {
+			if($_SESSION["s"]["user"]["typ"] == 'admin') {
+				return $values;
+			} else {
+				$client_group_id = $_SESSION["s"]["user"]["default_group"];
+				$client = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+				$allowed = explode(',', $client['lm']);
+			}
+		}
+
+		//* values are limited to a field in the reseller settings
+		if($limit_parts[0] == 'reseller') {
+			if($_SESSION["s"]["user"]["typ"] == 'admin') {
+				return $values;
+			} else {
+				//* Get the limits of the client that is currently logged in
+				$client_group_id = $_SESSION["s"]["user"]["default_group"];
+				$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+				//echo "SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id";
+				//* If the client belongs to a reseller, we will check against the reseller Limit too
+				if($client['parent_client_id'] != 0) {
+
+					//* first we need to know the groups of this reseller
+					$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
+					$reseller_groups = $tmp["groups"];
+					$reseller_userid = $tmp["userid"];
+
+					// Get the limits of the reseller of the logged in client
 					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-					$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-					//echo "SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id";
-					//* If the client belongs to a reseller, we will check against the reseller Limit too
-					if($client['parent_client_id'] != 0) {
-				
-						//* first we need to know the groups of this reseller
-						$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
-						$reseller_groups = $tmp["groups"];
-						$reseller_userid = $tmp["userid"];
-				
-						// Get the limits of the reseller of the logged in client
-						$client_group_id = $_SESSION["s"]["user"]["default_group"];
-						$reseller = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM client WHERE client_id = ".$client['parent_client_id']);
-						$allowed = explode(',',$reseller['lm']);
+					$reseller = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM client WHERE client_id = ".$client['parent_client_id']);
+					$allowed = explode(',', $reseller['lm']);
+				} else {
+					return $values;
+				}
+			} // end if admin
+		} // end if reseller
+
+		//* values are limited to a field in the system settings
+		if($limit_parts[0] == 'system') {
+			$app->uses('getconf');
+			$tmp_conf = $app->getconf->get_global_config($limit_parts[1]);
+			$tmp_key = $limit_parts[2];
+			$allowed = $tmp_conf[$tmp_key];
+		}
+
+		$values_new = array();
+		foreach($values as $key => $val) {
+			if(in_array($key, $allowed)) $values_new[$key] = $val;
+		}
+
+		return $values_new;
+	}
+
+
+	/**
+	 * Prepare the data record to show the data in a form.
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = NEW oder EDIT
+	 * @return record
+	 */
+	function getHTML($record, $tab, $action = 'NEW') {
+
+		global $app;
+
+		$this->action = $action;
+
+		if(!is_array($this->formDef)) $app->error("No form definition found.");
+		if(!is_array($this->formDef['tabs'][$tab])) $app->error("The tab is empty or does not exist (TAB: $tab).");
+
+		$new_record = array();
+		if($action == 'EDIT') {
+			$record = $this->decode($record, $tab);
+			if(is_array($record)) {
+				foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+
+					if(isset($record[$key])) {
+						$val = $record[$key];
 					} else {
-						return $values;
+						$val = '';
 					}
-				} // end if admin
-			} // end if reseller
-			
-			//* values are limited to a field in the system settings
-			if($limit_parts[0] == 'system') {
-				$app->uses('getconf');
-				$tmp_conf = $app->getconf->get_global_config($limit_parts[1]);
-				$tmp_key = $limit_parts[2];
-				$allowed = $tmp_conf[$tmp_key];
-			}
-			
-			$values_new = array();
-			foreach($values as $key => $val) {
-				if(in_array($key,$allowed)) $values_new[$key] = $val;
-			}
-			
-			return $values_new;
-		}
 
+					// If Datasource is set, get the data from there
+					if(isset($field['datasource']) && is_array($field['datasource'])) {
+						if(is_array($field["value"])) {
+							//$field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
+							$field["value"] = $app->functions->array_merge($field["value"], $this->getDatasourceData($field, $record));
+						} else {
+							$field["value"] = $this->getDatasourceData($field, $record);
+						}
+					}
 
-        /**
-        * Prepare the data record to show the data in a form.
-        *
-        * @param record = Datensatz als Array
-        * @param action = NEW oder EDIT
-        * @return record
-        */
-        function getHTML($record, $tab, $action = 'NEW') {
+					// If a limitation for the values is set
+					if(isset($field['valuelimit']) && is_array($field["value"])) {
+						$field["value"] = $this->applyValueLimit($field['valuelimit'], $field["value"]);
+					}
 
-                global $app;
+					switch ($field['formtype']) {
+					case 'SELECT':
+						$out = '';
+						if(is_array($field['value'])) {
+							foreach($field['value'] as $k => $v) {
+								$selected = ($k == $val)?' SELECTED':'';
+								if(!empty($this->wordbook[$v]))
+									$v = $this->wordbook[$v];
+								$out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
+							}
+						}
+						$new_record[$key] = $out;
+						break;
+					case 'MULTIPLE':
+						if(is_array($field['value'])) {
 
-                $this->action = $action;
+							// Split
+							$vals = explode($field['separator'], $val);
 
-                if(!is_array($this->formDef)) $app->error("No form definition found.");
-                if(!is_array($this->formDef['tabs'][$tab])) $app->error("The tab is empty or does not exist (TAB: $tab).");
+							// write HTML
+							$out = '';
+							foreach($field['value'] as $k => $v) {
 
-                $new_record = array();
-                if($action == 'EDIT') {
-                        $record = $this->decode($record,$tab);
-                        if(is_array($record)) {
-                                foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-								
-                                        if(isset($record[$key])) {
-											$val = $record[$key];
-										} else {
-											$val = '';
-										}
-
-                                        // If Datasource is set, get the data from there
-                                        if(isset($field['datasource']) && is_array($field['datasource'])) {
-												if(is_array($field["value"])) {
-													//$field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
-													$field["value"] = $app->functions->array_merge($field["value"],$this->getDatasourceData($field, $record));
-												} else {
-                                                	$field["value"] = $this->getDatasourceData($field, $record);
-												}
-                                        }
-										
-										// If a limitation for the values is set
-										if(isset($field['valuelimit']) && is_array($field["value"])) {
-											$field["value"] = $this->applyValueLimit($field['valuelimit'],$field["value"]);
-										}
-
-                                        switch ($field['formtype']) {
-                                        case 'SELECT':
-												$out = '';
-                                                if(is_array($field['value'])) {
-                                                        foreach($field['value'] as $k => $v) {
-                                                                $selected = ($k == $val)?' SELECTED':'';
-																if(!empty($this->wordbook[$v]))
-																	$v = $this->wordbook[$v];
-                                                                $out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-                                        case 'MULTIPLE':
-                                                if(is_array($field['value'])) {
-
-                                                        // Split
-                                                        $vals = explode($field['separator'],$val);
-
-                                                        // write HTML
-                                                        $out = '';
-                                                        foreach($field['value'] as $k => $v) {
-
-                                                                $selected = '';
-                                                                foreach($vals as $tvl) {
-                                                                        if(trim($tvl) == trim($k)) $selected = ' SELECTED';
-                                                                }
-
-                                                                $out .= "<option value='$k'$selected>$v</option>\r\n";
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-
-                                        case 'PASSWORD':
-                                                $new_record[$key] = '';
-                                        break;
-
-                                        case 'CHECKBOX':
-                                                $checked = ($val == $field['value'][1])?' CHECKED':'';
-                                                $new_record[$key] = "<input name=\"".$key."\" id=\"".$key."\" value=\"".$field['value'][1]."\" type=\"checkbox\" $checked />\r\n";
-                                        break;
-
-                                        case 'CHECKBOXARRAY':
-                                                if(is_array($field['value'])) {
-
-                                                        // aufsplitten ergebnisse
-                                                        $vals = explode($field['separator'],$val);
-
-                                                        // HTML schreiben
-                                                        $out = '';
-                                                        $elementNo = 0;
-                                                        foreach($field['value'] as $k => $v) {
-
-                                                                $checked = '';
-                                                                foreach($vals as $tvl) {
-                                                                        if(trim($tvl) == trim($k)) $checked = ' CHECKED';
-                                                                }
-                                                                // $out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"checkbox\" $checked /> $v</label>\r\n";
-																$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"checkbox\" $checked /> $v</label><br/>\r\n";
-                                                                $elementNo++;
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-
-                                        case 'RADIO':
-                                                if(is_array($field['value'])) {
-
-                                                        // HTML schreiben
-                                                        $out = '';
-                                                        $elementNo = 0;
-                                                        foreach($field['value'] as $k => $v) {
-                                                                $checked = ($k == $val)?' CHECKED':'';
-                                                                //$out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
-																$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"radio\" $checked/> $v </label>\r\n";
-                                                                $elementNo++;
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-                                        
-                                        case 'DATETIME':
-                                        		if (strtotime($val) !== false) {
-                                        			$dt_value = $val;
-                                        		} elseif ( isset($field['default']) && (strtotime($field['default']) !== false) ) {
-                                        			$dt_value = $field['default'];
-                                        		} else {
-                                        			$dt_value = 0;
-                                        		}
-                                        		
-                                        		$display_seconds = (isset($field['display_seconds']) && $field['display_seconds'] == true) ? true : false;
-		                              
-		                                        $new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
-                                        break;
-
-                                        default:
-											if(isset($record[$key])) {
-                                                $new_record[$key] = htmlspecialchars($record[$key]);
-											} else {
-												$new_record[$key] = '';
-											}
-                                        }
-                                }
-                        }
-                } else {
-                        // Action: NEW
-                        foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-
-                                // If Datasource is set, get the data from there
-                                if(@is_array($field['datasource'])) {
-                                	if(is_array($field["value"])) {
-										$field["value"] = $app->functions->array_merge($field["value"],$this->getDatasourceData($field, $record));
-									} else {
-                                    	$field["value"] = $this->getDatasourceData($field, $record);
-									}
-                                }
-								
-								// If a limitation for the values is set
-								if(isset($field['valuelimit']) && is_array($field["value"])) {
-									$field["value"] = $this->applyValueLimit($field['valuelimit'],$field["value"]);
+								$selected = '';
+								foreach($vals as $tvl) {
+									if(trim($tvl) == trim($k)) $selected = ' SELECTED';
 								}
 
-                                switch ($field['formtype']) {
-                                case 'SELECT':
-                                        if(is_array($field['value'])) {
-                                                $out = '';
-                                                foreach($field['value'] as $k => $v) {
-                                                    $selected = ($k == $field["default"])?' SELECTED':'';
-                                                    $out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
-                                                }
-                                        }
-                                        if(isset($out)) $new_record[$key] = $out;
-                                break;
-                                case 'MULTIPLE':
-                                                if(is_array($field['value'])) {
+								$out .= "<option value='$k'$selected>$v</option>\r\n";
+							}
+						}
+						$new_record[$key] = $out;
+						break;
 
-                                                        // aufsplitten ergebnisse
-                                                        $vals = explode($field['separator'],$val);
+					case 'PASSWORD':
+						$new_record[$key] = '';
+						break;
 
-                                                        // HTML schreiben
-                                                        $out = '';
-                                                        foreach($field['value'] as $k => $v) {
+					case 'CHECKBOX':
+						$checked = ($val == $field['value'][1])?' CHECKED':'';
+						$new_record[$key] = "<input name=\"".$key."\" id=\"".$key."\" value=\"".$field['value'][1]."\" type=\"checkbox\" $checked />\r\n";
+						break;
 
-                                                                $out .= "<option value='$k'>$v</option>\r\n";
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
+					case 'CHECKBOXARRAY':
+						if(is_array($field['value'])) {
 
-                                case 'PASSWORD':
-                                        //$new_record[$key] = '';
-										$new_record[$key] = htmlspecialchars($field['default']);
-                                break;
+							// aufsplitten ergebnisse
+							$vals = explode($field['separator'], $val);
 
-                                case 'CHECKBOX':
-                                        // $checked = (empty($field["default"]))?'':' CHECKED';
-										                    $checked = ($field["default"] == $field['value'][1])?' CHECKED':'';
-                                        $new_record[$key] = "<input name=\"".$key."\" id=\"".$key."\" value=\"".$field['value'][1]."\" type=\"checkbox\" $checked />\r\n"; 
-                                break;
+							// HTML schreiben
+							$out = '';
+							$elementNo = 0;
+							foreach($field['value'] as $k => $v) {
 
-                                case 'CHECKBOXARRAY':
-                                        if(is_array($field['value'])) {
-
-                                                // aufsplitten ergebnisse
-                                                $vals = explode($field['separator'],$field["default"]);
-
-                                                // HTML schreiben
-                                                $out = '';
-                                                $elementNo = 0;
-                                                foreach($field['value'] as $k => $v) {
-
-                                                        $checked = '';
-                                                        foreach($vals as $tvl) {
-                                                                if(trim($tvl) == trim($k)) $checked = ' CHECKED';
-                                                        }
-                                                        // $out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"checkbox\" $checked /> $v</label>\r\n";
-														$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"checkbox\" $checked /> $v</label> &nbsp;\r\n";
-                                                        $elementNo++;
-                                                }
-                                        }
-                                        $new_record[$key] = $out;
-                                break;
-
-                                case 'RADIO':
-                                        if(is_array($field['value'])) {
-
-                                                // HTML schreiben
-                                                $out = '';
-                                                $elementNo = 0;
-                                                foreach($field['value'] as $k => $v) {
-                                                        $checked = ($k == $field["default"])?' CHECKED':'';
-                                                        //$out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
-														$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
-                                                        $elementNo++;
-                                                }
-                                        }
-                                        $new_record[$key] = $out;
-                                break;
-                                
-                                case 'DATETIME':
-                                        $dt_value = (isset($field['default'])) ? $field['default'] : 0;
-                                        $display_seconds = (isset($field['display_seconds']) && $field['display_seconds'] == true) ? true : false;
-                              
-                                        $new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
-                                break;
-
-                                default:
-                                        $new_record[$key] = htmlspecialchars($field['default']);
-                                }
-                        }
-
-                }
-
-                if($this->debug == 1) $this->dbg($new_record);
-
-                return $new_record;
-        }
-
-        /**
-        * Rewrite the record data to be stored in the database
-        * and check values with regular expressions.
-        *
-        * @param record = Datensatz als Array
-        * @return record
-        */
-        function encode($record,$tab,$dbencode = true) {
-			global $app;
-			
-                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab is empty or does not exist (TAB: $tab).");
-                //$this->errorMessage = '';
-
-                if(is_array($record)) {
-                        foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-								
-								//* Apply filter to record value
-                                if(isset($field['filters']) && is_array($field['filters'])) {
-									$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SAVE');
+								$checked = '';
+								foreach($vals as $tvl) {
+									if(trim($tvl) == trim($k)) $checked = ' CHECKED';
 								}
-								//* Validate record value
-								if(isset($field['validators']) && is_array($field['validators'])) {
-									$this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
-								}
+								// $out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"checkbox\" $checked /> $v</label>\r\n";
+								$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"checkbox\" $checked /> $v</label><br/>\r\n";
+								$elementNo++;
+							}
+						}
+						$new_record[$key] = $out;
+						break;
 
-                                switch ($field['datatype']) {
-                                case 'VARCHAR':
-                                        if(!@is_array($record[$key])) {
-												$new_record[$key] = (isset($record[$key]))?$record[$key]:'';
-                                        } else {
-                                                $new_record[$key] = implode($field['separator'],$record[$key]);
-                                        }
-                                break;
-                                case 'TEXT':
-                                        if(!is_array($record[$key])) {
-                                                $new_record[$key] = $record[$key];
-                                        } else {
-                                                $new_record[$key] = implode($field['separator'],$record[$key]);
-                                        }
-                                break;
-                                case 'DATETSTAMP':
-                                        if($record[$key] > 0) {
-                                                list($tag,$monat,$jahr) = explode('.',$record[$key]);
-                                                $new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
-                                        } else {
-											$new_record[$key] = 0;
-										}
-                                break;
-								case 'DATE':
-                                        if($record[$key] != '' && $record[$key] != '0000-00-00') {
-												if(function_exists('date_parse_from_format')) {
-													$date_parts = date_parse_from_format($this->dateformat,$record[$key]);
-													//list($tag,$monat,$jahr) = explode('.',$record[$key]);
-													$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
-													//$tmp = strptime($record[$key],$this->dateformat);
-													//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
-												} else {
-													//$tmp = strptime($record[$key],$this->dateformat);
-													//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
-													$tmp = strtotime($record[$key]);
-													$new_record[$key] = date('Y-m-d',$tmp);
-												}
-                                        } else {
-											$new_record[$key] = '0000-00-00';
-										}
-                                break;
-                                case 'INTEGER':
-										$new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0;
-                                        //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
-                                        //if($key == 'refresh') die($record[$key]);
-                                break;
-                                case 'DOUBLE':
-                                        $new_record[$key] = $record[$key];
-                                break;
-                                case 'CURRENCY':
-                                        $new_record[$key] = str_replace(",",".",$record[$key]);
-                                break;
-                                
-                                case 'DATETIME':
-                                		if (is_array($record[$key]))
-                                		{
-	                                		$filtered_values = array_map(create_function('$item','return (int)$item;'), $record[$key]);
-                                			extract($filtered_values, EXTR_PREFIX_ALL, '_dt');
-                                			
-                                			if ($_dt_day != 0 && $_dt_month != 0 && $_dt_year != 0) {
-	                                			$new_record[$key] = date( 'Y-m-d H:i:s', mktime($_dt_hour, $_dt_minute, $_dt_second, $_dt_month, $_dt_day, $_dt_year) );
-	                                		}
-                                		}
-                                break;
-                                }
+					case 'RADIO':
+						if(is_array($field['value'])) {
 
-                                // The use of the field value is deprecated, use validators instead
-                                if(isset($field['regex']) && $field['regex'] != '') {
-                                        // Enable that "." matches also newlines
-                                        $field['regex'] .= 's';
-                                        if(!preg_match($field['regex'], $record[$key])) {
-                                                $errmsg = $field['errmsg'];
-                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-                                        }
-                                }
-								
-								//* Add slashes to all records, when we encode data which shall be inserted into mysql.
-								if($dbencode == true) $new_record[$key] = $app->db->quote($new_record[$key]);
-                        }
-                }
-                return $new_record;
-        }
-		
-		/**
-        * process the filters for a given field.
-        *
-        * @param field_name = Name of the field
-        * @param field_value = value of the field
-        * @param filters = Array of filters
-		* @param filter_event = 'SAVE'or 'SHOW'
-        * @return record
-        */
+							// HTML schreiben
+							$out = '';
+							$elementNo = 0;
+							foreach($field['value'] as $k => $v) {
+								$checked = ($k == $val)?' CHECKED':'';
+								//$out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
+								$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"radio\" $checked/> $v </label>\r\n";
+								$elementNo++;
+							}
+						}
+						$new_record[$key] = $out;
+						break;
 
-        function filterField($field_name, $field_value, $filters, $filter_event) {
+					case 'DATETIME':
+						if (strtotime($val) !== false) {
+							$dt_value = $val;
+						} elseif ( isset($field['default']) && (strtotime($field['default']) !== false) ) {
+							$dt_value = $field['default'];
+						} else {
+							$dt_value = 0;
+						}
 
-			global $app;
-			$returnval = $field_value;
-				
-			//* Loop trough all filters
-			foreach($filters as $filter) {
-				if($filter['event'] == $filter_event) {
-					switch ($filter['type']) {
-						case 'TOLOWER':
-							$returnval = strtolower($returnval);
+						$display_seconds = (isset($field['display_seconds']) && $field['display_seconds'] == true) ? true : false;
+
+						$new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
 						break;
-						case 'TOUPPER':
-							$returnval = strtoupper($returnval);
-						break;
-						case 'IDNTOASCII':
-							$returnval = $app->functions->idn_encode($returnval);
-						break;
-						case 'IDNTOUTF8':
-							$returnval = $app->functions->idn_decode($returnval);
-						break;
-						default:
-							$this->errorMessage .= "Unknown Filter: ".$filter['type'];
-						break;
+
+					default:
+						if(isset($record[$key])) {
+							$new_record[$key] = htmlspecialchars($record[$key]);
+						} else {
+							$new_record[$key] = '';
+						}
 					}
 				}
 			}
-            return $returnval;
-        }
+		} else {
+			// Action: NEW
+			foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
 
-        /**
-        * process the validators for a given field.
-        *
-        * @param field_name = Name of the field
-        * @param field_value = value of the field
-        * @param validatoors = Array of validators
-        * @return record
-        */
+				// If Datasource is set, get the data from there
+				if(@is_array($field['datasource'])) {
+					if(is_array($field["value"])) {
+						$field["value"] = $app->functions->array_merge($field["value"], $this->getDatasourceData($field, $record));
+					} else {
+						$field["value"] = $this->getDatasourceData($field, $record);
+					}
+				}
 
-        function validateField($field_name, $field_value, $validators) {
+				// If a limitation for the values is set
+				if(isset($field['valuelimit']) && is_array($field["value"])) {
+					$field["value"] = $this->applyValueLimit($field['valuelimit'], $field["value"]);
+				}
 
-                global $app;
-				
-				$escape = '`';
-				
-                // loop trough the validators
-                foreach($validators as $validator) {
+				switch ($field['formtype']) {
+				case 'SELECT':
+					if(is_array($field['value'])) {
+						$out = '';
+						foreach($field['value'] as $k => $v) {
+							$selected = ($k == $field["default"])?' SELECTED':'';
+							$out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
+						}
+					}
+					if(isset($out)) $new_record[$key] = $out;
+					break;
+				case 'MULTIPLE':
+					if(is_array($field['value'])) {
 
-                        switch ($validator['type']) {
-                                case 'REGEX':
-                                        $validator['regex'] .= 's';
-                                        if(!preg_match($validator['regex'], $field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                	$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-                                        }
-                                break;
-                                case 'UNIQUE':
-										if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
-										if($validator['allowempty'] == 'n' || ($validator['allowempty'] == 'y' && $field_value != '')){
-											if($this->action == 'NEW') {
-                                                $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
-                                                if($num_rec["number"] > 0) {
-                                                        $errmsg = $validator['errmsg'];
-														if(isset($this->wordbook[$errmsg])) {
-                                                        	$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-														} else {
-															$this->errorMessage .= $errmsg."<br />\r\n";
-														}
-                                                }
-											} else {
-                                                $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
-                                                if($num_rec["number"] > 0) {
-                                                        $errmsg = $validator['errmsg'];
-                                                        if(isset($this->wordbook[$errmsg])) {
-                                                        	$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-														} else {
-															$this->errorMessage .= $errmsg."<br />\r\n";
-														}
-                                                }
-											}
-										}
-                                break;
-                                case 'NOTEMPTY':
-                                        if(empty($field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-                                        }
-                                break;
-                                case 'ISEMAIL':
-                                    if(function_exists('filter_var')) {
-										if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
-											$errmsg = $validator['errmsg'];
-                                            if(isset($this->wordbook[$errmsg])) {
-                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-                                        }
-									} else {
-										if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-                                        }
-									}
-                                break;
-                                case 'ISINT':
-									if(function_exists('filter_var') && $field_value < 2147483647) {
-										if($field_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) {
-											$errmsg = $validator['errmsg'];
-											if(isset($this->wordbook[$errmsg])) {
-                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-                                        }
-									} else {
-                                        $tmpval = $app->functions->intval($field_value);
-                                        if($tmpval === 0 and !empty($field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-                                        }
-									}
-                                break;
-                                case 'ISPOSITIVE':
-                                        if(!is_numeric($field_value) || $field_value <= 0){
-                                          $errmsg = $validator['errmsg'];
-                                          if(isset($this->wordbook[$errmsg])) {
-                                             $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-										  } else {
-											 $this->errorMessage .= $errmsg."<br />\r\n";
-										  }
-                                        }
-                                break;
+						// aufsplitten ergebnisse
+						$vals = explode($field['separator'], $val);
+
+						// HTML schreiben
+						$out = '';
+						foreach($field['value'] as $k => $v) {
+
+							$out .= "<option value='$k'>$v</option>\r\n";
+						}
+					}
+					$new_record[$key] = $out;
+					break;
+
+				case 'PASSWORD':
+					//$new_record[$key] = '';
+					$new_record[$key] = htmlspecialchars($field['default']);
+					break;
+
+				case 'CHECKBOX':
+					// $checked = (empty($field["default"]))?'':' CHECKED';
+					$checked = ($field["default"] == $field['value'][1])?' CHECKED':'';
+					$new_record[$key] = "<input name=\"".$key."\" id=\"".$key."\" value=\"".$field['value'][1]."\" type=\"checkbox\" $checked />\r\n";
+					break;
+
+				case 'CHECKBOXARRAY':
+					if(is_array($field['value'])) {
+
+						// aufsplitten ergebnisse
+						$vals = explode($field['separator'], $field["default"]);
+
+						// HTML schreiben
+						$out = '';
+						$elementNo = 0;
+						foreach($field['value'] as $k => $v) {
+
+							$checked = '';
+							foreach($vals as $tvl) {
+								if(trim($tvl) == trim($k)) $checked = ' CHECKED';
+							}
+							// $out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"checkbox\" $checked /> $v</label>\r\n";
+							$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"checkbox\" $checked /> $v</label> &nbsp;\r\n";
+							$elementNo++;
+						}
+					}
+					$new_record[$key] = $out;
+					break;
+
+				case 'RADIO':
+					if(is_array($field['value'])) {
+
+						// HTML schreiben
+						$out = '';
+						$elementNo = 0;
+						foreach($field['value'] as $k => $v) {
+							$checked = ($k == $field["default"])?' CHECKED':'';
+							//$out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
+							$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
+							$elementNo++;
+						}
+					}
+					$new_record[$key] = $out;
+					break;
+
+				case 'DATETIME':
+					$dt_value = (isset($field['default'])) ? $field['default'] : 0;
+					$display_seconds = (isset($field['display_seconds']) && $field['display_seconds'] == true) ? true : false;
+
+					$new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
+					break;
+
+				default:
+					$new_record[$key] = htmlspecialchars($field['default']);
+				}
+			}
+
+		}
+
+		if($this->debug == 1) $this->dbg($new_record);
+
+		return $new_record;
+	}
+
+
+	/**
+	 * Rewrite the record data to be stored in the database
+	 * and check values with regular expressions.
+	 *
+	 * @param record = Datensatz als Array
+	 * @return record
+	 */
+	function encode($record, $tab, $dbencode = true) {
+		global $app;
+
+		if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab is empty or does not exist (TAB: $tab).");
+		//$this->errorMessage = '';
+
+		if(is_array($record)) {
+			foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+
+				//* Apply filter to record value
+				if(isset($field['filters']) && is_array($field['filters'])) {
+					$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SAVE');
+				}
+				//* Validate record value
+				if(isset($field['validators']) && is_array($field['validators'])) {
+					$this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
+				}
+
+				switch ($field['datatype']) {
+				case 'VARCHAR':
+					if(!@is_array($record[$key])) {
+						$new_record[$key] = (isset($record[$key]))?$record[$key]:'';
+					} else {
+						$new_record[$key] = implode($field['separator'], $record[$key]);
+					}
+					break;
+				case 'TEXT':
+					if(!is_array($record[$key])) {
+						$new_record[$key] = $record[$key];
+					} else {
+						$new_record[$key] = implode($field['separator'], $record[$key]);
+					}
+					break;
+				case 'DATETSTAMP':
+					if($record[$key] > 0) {
+						list($tag, $monat, $jahr) = explode('.', $record[$key]);
+						$new_record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
+					} else {
+						$new_record[$key] = 0;
+					}
+					break;
+				case 'DATE':
+					if($record[$key] != '' && $record[$key] != '0000-00-00') {
+						if(function_exists('date_parse_from_format')) {
+							$date_parts = date_parse_from_format($this->dateformat, $record[$key]);
+							//list($tag,$monat,$jahr) = explode('.',$record[$key]);
+							$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
+							//$tmp = strptime($record[$key],$this->dateformat);
+							//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
+						} else {
+							//$tmp = strptime($record[$key],$this->dateformat);
+							//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
+							$tmp = strtotime($record[$key]);
+							$new_record[$key] = date('Y-m-d', $tmp);
+						}
+					} else {
+						$new_record[$key] = '0000-00-00';
+					}
+					break;
+				case 'INTEGER':
+					$new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0;
+					//if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
+					//if($key == 'refresh') die($record[$key]);
+					break;
+				case 'DOUBLE':
+					$new_record[$key] = $record[$key];
+					break;
+				case 'CURRENCY':
+					$new_record[$key] = str_replace(",", ".", $record[$key]);
+					break;
+
+				case 'DATETIME':
+					if (is_array($record[$key]))
+					{
+						$filtered_values = array_map(create_function('$item', 'return (int)$item;'), $record[$key]);
+						extract($filtered_values, EXTR_PREFIX_ALL, '_dt');
+
+						if ($_dt_day != 0 && $_dt_month != 0 && $_dt_year != 0) {
+							$new_record[$key] = date( 'Y-m-d H:i:s', mktime($_dt_hour, $_dt_minute, $_dt_second, $_dt_month, $_dt_day, $_dt_year) );
+						}
+					}
+					break;
+				}
+
+				// The use of the field value is deprecated, use validators instead
+				if(isset($field['regex']) && $field['regex'] != '') {
+					// Enable that "." matches also newlines
+					$field['regex'] .= 's';
+					if(!preg_match($field['regex'], $record[$key])) {
+						$errmsg = $field['errmsg'];
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					}
+				}
+
+				//* Add slashes to all records, when we encode data which shall be inserted into mysql.
+				if($dbencode == true) $new_record[$key] = $app->db->quote($new_record[$key]);
+			}
+		}
+		return $new_record;
+	}
+
+
+
+
+
+	/**
+	 * process the filters for a given field.
+	 *
+	 * @param field_name = Name of the field
+	 * @param field_value = value of the field
+	 * @param filters = Array of filters
+	 * @param filter_event = 'SAVE'or 'SHOW'
+	 * @return record
+	 */
+	function filterField($field_name, $field_value, $filters, $filter_event) {
+
+		global $app;
+		$returnval = $field_value;
+
+		//* Loop trough all filters
+		foreach($filters as $filter) {
+			if($filter['event'] == $filter_event) {
+				switch ($filter['type']) {
+				case 'TOLOWER':
+					$returnval = strtolower($returnval);
+					break;
+				case 'TOUPPER':
+					$returnval = strtoupper($returnval);
+					break;
+				case 'IDNTOASCII':
+					$returnval = $app->functions->idn_encode($returnval);
+					break;
+				case 'IDNTOUTF8':
+					$returnval = $app->functions->idn_decode($returnval);
+					break;
+				default:
+					$this->errorMessage .= "Unknown Filter: ".$filter['type'];
+					break;
+				}
+			}
+		}
+		return $returnval;
+	}
+
+
+	/**
+	 * process the validators for a given field.
+	 *
+	 * @param field_name = Name of the field
+	 * @param field_value = value of the field
+	 * @param validatoors = Array of validators
+	 * @return record
+	 */
+	function validateField($field_name, $field_value, $validators) {
+
+		global $app;
+
+		$escape = '`';
+
+		// loop trough the validators
+		foreach($validators as $validator) {
+
+			switch ($validator['type']) {
+			case 'REGEX':
+				$validator['regex'] .= 's';
+				if(!preg_match($validator['regex'], $field_value)) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'UNIQUE':
+				if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
+				if($validator['allowempty'] == 'n' || ($validator['allowempty'] == 'y' && $field_value != '')){
+					if($this->action == 'NEW') {
+						$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
+						if($num_rec["number"] > 0) {
+							$errmsg = $validator['errmsg'];
+							if(isset($this->wordbook[$errmsg])) {
+								$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+							} else {
+								$this->errorMessage .= $errmsg."<br />\r\n";
+							}
+						}
+					} else {
+						$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
+						if($num_rec["number"] > 0) {
+							$errmsg = $validator['errmsg'];
+							if(isset($this->wordbook[$errmsg])) {
+								$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+							} else {
+								$this->errorMessage .= $errmsg."<br />\r\n";
+							}
+						}
+					}
+				}
+				break;
+			case 'NOTEMPTY':
+				if(empty($field_value)) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'ISEMAIL':
+				if(function_exists('filter_var')) {
+					if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				} else {
+					if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				}
+				break;
+			case 'ISINT':
+				if(function_exists('filter_var') && $field_value < 2147483647) {
+					if($field_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				} else {
+					$tmpval = $app->functions->intval($field_value);
+					if($tmpval === 0 and !empty($field_value)) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				}
+				break;
+			case 'ISPOSITIVE':
+				if(!is_numeric($field_value) || $field_value <= 0){
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
 				/*
 				case 'ISV6PREFIX':
 					$v6_prefix_ok = 0;
@@ -903,674 +908,681 @@
 					                        $v6_prefix_ok = 1;
                 					}
         					}
-					} else { 
-						$v6_prefix_ok = 2; 
+					} else {
+						$v6_prefix_ok = 2;
 					}
 					// check subnet against defined server-ipv6
 					$sql_v6 = $app->db->queryOneRecord("SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND virtualhost = 'y' LIMIT 0,1");
 					$sql_v6_explode=explode(':',$sql_v6['ip_address']);
-					if ( count($sql_v6_explode) < count($explode_field_value) && isset($sql_v6['ip_address']) )  { 
-						$v6_prefix_ok = 3; 
+					if ( count($sql_v6_explode) < count($explode_field_value) && isset($sql_v6['ip_address']) )  {
+						$v6_prefix_ok = 3;
 					}
-					if($v6_prefix_ok == 0) { 
-						$errmsg = $validator['errmsg']; 
+					if($v6_prefix_ok == 0) {
+						$errmsg = $validator['errmsg'];
 					}
-					if($v6_prefix_ok == 2) { 
-						$errmsg = 'IPv6 Prefix must end with ::'; 
+					if($v6_prefix_ok == 2) {
+						$errmsg = 'IPv6 Prefix must end with ::';
 					}
-					if($v6_prefix_ok == 3) { 
-						$errmsg = 'IPv6 Prefix too long (according to Server IP Addresses)'; 
+					if($v6_prefix_ok == 3) {
+						$errmsg = 'IPv6 Prefix too long (according to Server IP Addresses)';
 					}
 					if($v6_prefix_ok <> 1){
-						$this->errorMessage .= $errmsg."<br />\r\n"; 
+						$this->errorMessage .= $errmsg."<br />\r\n";
 					}
 				break;
 				*/
-								case 'ISIPV4':
-								$vip=1;
-								if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
-								$groups=explode(".",$field_value);
-								foreach($groups as $group){
-									if($group<0 OR $group>255)
-									$vip=0;
-								}
-								}else{$vip=0;}
-                                        if($vip==0) {
-										$errmsg = $validator['errmsg'];
-                                          if(isset($this->wordbook[$errmsg])) {
-                                             $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-										  } else {
-											 $this->errorMessage .= $errmsg."<br />\r\n";
-										  }
-										}
-                                break;
-								case 'ISIP':
-								if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
-								if($validator['allowempty'] == 'y' && $field_value == '') {
-									//* Do nothing
-								} else {
-								//* Check if its a IPv4 or IPv6 address
-									if(isset($validator['separator']) && $validator['separator'] != '') {
-										//* When the field may contain several IP addresses, split them by the char defined as separator
-										$field_value_array = explode($validator['separator'],$field_value);
-									} else {
-										$field_value_array[] = $field_value;
-									}
-									foreach($field_value_array as $field_value) {
-										$field_value = trim($field_value);
-										if(function_exists('filter_var')) {
-											if(!filter_var($field_value,FILTER_VALIDATE_IP)) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-											}
-										} else {
-											//* Check content with regex, if we use php < 5.2
-											$ip_ok = 0;
-											if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){
-												$ip_ok = 1;
-											}
-											if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
-												$ip_ok = 1;
-											}
-											if($ip_ok == 0) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-											}
-										}
-									}
-								}
-                                break;
-								case 'RANGE':
-                                        //* Checks if the value is within the given range or above / below a value
-										//* Range examples: < 10 = ":10", between 2 and 10 = "2:10", above 5 = "5:".
-										$range_parts = explode(':',trim($validator['range']));
-										$ok = true;
-                                        if($range_parts[0] != '' && $field_value < $range_parts[0]) {
-											$ok = false;
-										}
-										if($range_parts[1] != '' && $field_value > $range_parts[1]) {
-											$ok = false;
-										}
-										if($ok != true) {
-											$errmsg = $validator['errmsg'];
-											if(isset($this->wordbook[$errmsg])) {
-												$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-                                        }
-										unset($range_parts);
-                                break;
-                                case 'CUSTOM':
-                                        // Calls a custom class to validate this record
-                                        if($validator['class'] != '' and $validator['function'] != '') {
-                                                $validator_class = $validator['class'];
-                                                $validator_function = $validator['function'];
-                                                $app->uses($validator_class);
-                                                $this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
-                                        } else {
-                                                $this->errorMessage .= "Custom validator class or function is empty<br />\r\n";
-                                        }
-                                break;
-								default:
-									$this->errorMessage .= "Unknown Validator: ".$validator['type'];
-								break;
-                        }
-
-
-                }
-
-                return true;
-        }
-
-        /**
-        * Create SQL statement
-        *
-        * @param record = Datensatz als Array
-        * @param action = INSERT oder UPDATE
-        * @param primary_id
-        * @return record
-        */
-        function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
-
-                global $app;
-
-                // If there are no data records on the tab, return empty sql string
-                if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
-
-                // checking permissions
-                if($this->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
-                        if($action == "INSERT") {
-                                if(!$this->checkPerm($primary_id,'i')) $this->errorMessage .= "Insert denied.<br />\r\n";
-                        } else {
-                                if(!$this->checkPerm($primary_id,'u')) $this->errorMessage .= "Update denied.<br />\r\n";
-                        }
-                }
-
-                $this->action = $action;
-                $this->primary_id = $primary_id;
-
-                $record = $this->encode($record,$tab,true);
-                $sql_insert_key = '';
-                $sql_insert_val = '';
-                $sql_update = '';
-
-                if(!is_array($this->formDef)) $app->error("Form definition not found.");
-                if(!is_array($this->formDef['tabs'][$tab])) $app->error("The tab is empty or does not exist (TAB: $tab).");
-
-                // go trough all fields of the tab
-                if(is_array($record)) {
-                foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-                                // Wenn es kein leeres Passwortfeld ist
-                                if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
-                                        // Erzeuge Insert oder Update Quelltext
-                                        if($action == "INSERT") {
-                                                if($field['formtype'] == 'PASSWORD') {
-                                                        $sql_insert_key .= "`$key`, ";
-                                                        if($field['encryption'] == 'CRYPT') {
-																$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-														} elseif ($field['encryption'] == 'MYSQL') {
-																$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
-																$record[$key] = $tmp['crypted'];
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-														} elseif ($field['encryption'] == 'CLEARTEXT') {
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-                                                        } else {
-                                                                $record[$key] = md5(stripslashes($record[$key]));
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-                                                        }
-														
-                                                } elseif ($field['formtype'] == 'CHECKBOX') {
-                                                        $sql_insert_key .= "`$key`, ";
-														if($record[$key] == '') {
-															// if a checkbox is not set, we set it to the unchecked value
-															$sql_insert_val .= "'".$field['value'][0]."', ";
-															$record[$key] = $field['value'][0];
-														} else {
-															$sql_insert_val .= "'".$record[$key]."', ";
-														}
-                                                } else {
-                                                        $sql_insert_key .= "`$key`, ";
-                                                        $sql_insert_val .= "'".$record[$key]."', ";
-                                                }
-                                        } else {
-                                                if($field['formtype'] == 'PASSWORD') {
-														if(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
-                                                                $record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-														} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
-																$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
-																$record[$key] = $tmp['crypted'];
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-														} elseif (isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') {
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-                                                        } else {
-                                                                $record[$key] = md5(stripslashes($record[$key]));
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-                                                        }
-                                                        
-                                                } elseif ($field['formtype'] == 'CHECKBOX') {
-														if($record[$key] == '') {
-															// if a checkbox is not set, we set it to the unchecked value
-															$sql_update .= "`$key` = '".$field['value'][0]."', ";
-															$record[$key] = $field['value'][0];
-														} else {
-															$sql_update .= "`$key` = '".$record[$key]."', ";
-														}
-                                                } else {
-                                                        $sql_update .= "`$key` = '".$record[$key]."', ";
-                                                }
-                                        }
-                                } else {
-									// we unset the password filed, if empty to tell the datalog function 
-									// that the password has not been changed
-								    unset($record[$key]);
-								}
-                        }
-        }
-
-
-                // Add backticks for incomplete table names
-                if(stristr($this->formDef['db_table'],'.')) {
-                        $escape = '';
-                } else {
-                        $escape = '`';
-                }
-
-
-                if($action == "INSERT") {
-                        if($this->formDef['auth'] == 'yes') {
-                                // Set user and group
-                                $sql_insert_key .= "`sys_userid`, ";
-                                $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$_SESSION["s"]["user"]["userid"]."', ";
-                                $sql_insert_key .= "`sys_groupid`, ";
-                                $sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$_SESSION["s"]["user"]["default_group"]."', ";
-                                $sql_insert_key .= "`sys_perm_user`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
-                                $sql_insert_key .= "`sys_perm_group`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
-                                $sql_insert_key .= "`sys_perm_other`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
-                        }
-                        $sql_insert_key = substr($sql_insert_key,0,-2);
-                        $sql_insert_val = substr($sql_insert_val,0,-2);
-                        $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
-                } else {
-					if($this->formDef['auth'] == 'yes') {
-                        if($primary_id != 0) {
-                                $sql_update = substr($sql_update,0,-2);
-                                $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->getAuthSQL('u')." AND ".$this->formDef['db_table_idx']." = ".$primary_id;
-                                if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
-                        } else {
-                                $app->error("Primary ID fehlt!");
-                        }
-					} else {
-						if($primary_id != 0) {
-                                $sql_update = substr($sql_update,0,-2);
-                                $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-                                if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
-                        } else {
-                                $app->error("Primary ID fehlt!");
-                        }
+			case 'ISIPV4':
+				$vip=1;
+				if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
+					$groups=explode(".", $field_value);
+					foreach($groups as $group){
+						if($group<0 or $group>255)
+							$vip=0;
 					}
-					//* return a empty string if there is nothing to update
-					if(trim($sql_update) == '') $sql = '';
-                }
-
-                return $sql;
-        }
-
-        /**
-        * Debugging arrays.
-        *
-        * @param array_data
-        */
-        function dbg($array_data) {
-
-                echo "<pre>";
-                print_r($array_data);
-                echo "</pre>";
-
-        }
+				}else{$vip=0;}
+				if($vip==0) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'ISIP':
+				if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
+				if($validator['allowempty'] == 'y' && $field_value == '') {
+					//* Do nothing
+				} else {
+					//* Check if its a IPv4 or IPv6 address
+					if(isset($validator['separator']) && $validator['separator'] != '') {
+						//* When the field may contain several IP addresses, split them by the char defined as separator
+						$field_value_array = explode($validator['separator'], $field_value);
+					} else {
+						$field_value_array[] = $field_value;
+					}
+					foreach($field_value_array as $field_value) {
+						$field_value = trim($field_value);
+						if(function_exists('filter_var')) {
+							if(!filter_var($field_value, FILTER_VALIDATE_IP)) {
+								$errmsg = $validator['errmsg'];
+								if(isset($this->wordbook[$errmsg])) {
+									$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+								} else {
+									$this->errorMessage .= $errmsg."<br />\r\n";
+								}
+							}
+						} else {
+							//* Check content with regex, if we use php < 5.2
+							$ip_ok = 0;
+							if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){
+								$ip_ok = 1;
+							}
+							if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
+								$ip_ok = 1;
+							}
+							if($ip_ok == 0) {
+								$errmsg = $validator['errmsg'];
+								if(isset($this->wordbook[$errmsg])) {
+									$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+								} else {
+									$this->errorMessage .= $errmsg."<br />\r\n";
+								}
+							}
+						}
+					}
+				}
+				break;
+			case 'RANGE':
+				//* Checks if the value is within the given range or above / below a value
+				//* Range examples: < 10 = ":10", between 2 and 10 = "2:10", above 5 = "5:".
+				$range_parts = explode(':', trim($validator['range']));
+				$ok = true;
+				if($range_parts[0] != '' && $field_value < $range_parts[0]) {
+					$ok = false;
+				}
+				if($range_parts[1] != '' && $field_value > $range_parts[1]) {
+					$ok = false;
+				}
+				if($ok != true) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				unset($range_parts);
+				break;
+			case 'CUSTOM':
+				// Calls a custom class to validate this record
+				if($validator['class'] != '' and $validator['function'] != '') {
+					$validator_class = $validator['class'];
+					$validator_function = $validator['function'];
+					$app->uses($validator_class);
+					$this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
+				} else {
+					$this->errorMessage .= "Custom validator class or function is empty<br />\r\n";
+				}
+				break;
+			default:
+				$this->errorMessage .= "Unknown Validator: ".$validator['type'];
+				break;
+			}
 
 
-    function showForm() {
-            global $app,$conf;
+		}
 
-        if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
+		return true;
+	}
 
-                $active_tab = $this->getNextTab();
 
-        // go trough the tabs
-        foreach( $this->formDef["tabs"] as $key => $tab) {
+	/**
+	 * Create SQL statement
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = INSERT oder UPDATE
+	 * @param primary_id
+	 * @return record
+	 */
+	function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
 
-            $tab['name'] = $key;
+		global $app;
+
+		// If there are no data records on the tab, return empty sql string
+		if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
+
+		// checking permissions
+		if($this->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
+			if($action == "INSERT") {
+				if(!$this->checkPerm($primary_id, 'i')) $this->errorMessage .= "Insert denied.<br />\r\n";
+			} else {
+				if(!$this->checkPerm($primary_id, 'u')) $this->errorMessage .= "Update denied.<br />\r\n";
+			}
+		}
+
+		$this->action = $action;
+		$this->primary_id = $primary_id;
+
+		$record = $this->encode($record, $tab, true);
+		$sql_insert_key = '';
+		$sql_insert_val = '';
+		$sql_update = '';
+
+		if(!is_array($this->formDef)) $app->error("Form definition not found.");
+		if(!is_array($this->formDef['tabs'][$tab])) $app->error("The tab is empty or does not exist (TAB: $tab).");
+
+		// go trough all fields of the tab
+		if(is_array($record)) {
+			foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+				// Wenn es kein leeres Passwortfeld ist
+				if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
+					// Erzeuge Insert oder Update Quelltext
+					if($action == "INSERT") {
+						if($field['formtype'] == 'PASSWORD') {
+							$sql_insert_key .= "`$key`, ";
+							if($field['encryption'] == 'CRYPT') {
+								$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} elseif ($field['encryption'] == 'MYSQL') {
+								$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
+								$record[$key] = $tmp['crypted'];
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} elseif ($field['encryption'] == 'CLEARTEXT') {
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} else {
+								$record[$key] = md5(stripslashes($record[$key]));
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							}
+
+						} elseif ($field['formtype'] == 'CHECKBOX') {
+							$sql_insert_key .= "`$key`, ";
+							if($record[$key] == '') {
+								// if a checkbox is not set, we set it to the unchecked value
+								$sql_insert_val .= "'".$field['value'][0]."', ";
+								$record[$key] = $field['value'][0];
+							} else {
+								$sql_insert_val .= "'".$record[$key]."', ";
+							}
+						} else {
+							$sql_insert_key .= "`$key`, ";
+							$sql_insert_val .= "'".$record[$key]."', ";
+						}
+					} else {
+						if($field['formtype'] == 'PASSWORD') {
+							if(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
+								$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
+								$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
+								$record[$key] = $tmp['crypted'];
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} elseif (isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') {
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} else {
+								$record[$key] = md5(stripslashes($record[$key]));
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							}
+
+						} elseif ($field['formtype'] == 'CHECKBOX') {
+							if($record[$key] == '') {
+								// if a checkbox is not set, we set it to the unchecked value
+								$sql_update .= "`$key` = '".$field['value'][0]."', ";
+								$record[$key] = $field['value'][0];
+							} else {
+								$sql_update .= "`$key` = '".$record[$key]."', ";
+							}
+						} else {
+							$sql_update .= "`$key` = '".$record[$key]."', ";
+						}
+					}
+				} else {
+					// we unset the password filed, if empty to tell the datalog function
+					// that the password has not been changed
+					unset($record[$key]);
+				}
+			}
+		}
+
+
+		// Add backticks for incomplete table names
+		if(stristr($this->formDef['db_table'], '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
+
+
+		if($action == "INSERT") {
+			if($this->formDef['auth'] == 'yes') {
+				// Set user and group
+				$sql_insert_key .= "`sys_userid`, ";
+				$sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$_SESSION["s"]["user"]["userid"]."', ";
+				$sql_insert_key .= "`sys_groupid`, ";
+				$sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$_SESSION["s"]["user"]["default_group"]."', ";
+				$sql_insert_key .= "`sys_perm_user`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
+				$sql_insert_key .= "`sys_perm_group`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
+				$sql_insert_key .= "`sys_perm_other`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
+			}
+			$sql_insert_key = substr($sql_insert_key, 0, -2);
+			$sql_insert_val = substr($sql_insert_val, 0, -2);
+			$sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
+		} else {
+			if($this->formDef['auth'] == 'yes') {
+				if($primary_id != 0) {
+					$sql_update = substr($sql_update, 0, -2);
+					$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->getAuthSQL('u')." AND ".$this->formDef['db_table_idx']." = ".$primary_id;
+					if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+				} else {
+					$app->error("Primary ID fehlt!");
+				}
+			} else {
+				if($primary_id != 0) {
+					$sql_update = substr($sql_update, 0, -2);
+					$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+					if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+				} else {
+					$app->error("Primary ID fehlt!");
+				}
+			}
+			//* return a empty string if there is nothing to update
+			if(trim($sql_update) == '') $sql = '';
+		}
+
+		return $sql;
+	}
+
+
+	/**
+	 * Debugging arrays.
+	 *
+	 * @param array_data
+	 */
+	function dbg($array_data) {
+
+		echo "<pre>";
+		print_r($array_data);
+		echo "</pre>";
+
+	}
+
+
+	function showForm() {
+		global $app, $conf;
+
+		if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
+
+		$active_tab = $this->getNextTab();
+
+		// go trough the tabs
+		foreach( $this->formDef["tabs"] as $key => $tab) {
+
+			$tab['name'] = $key;
 			// Translate the title of the tab
 			$tab['title'] = $this->lng($tab['title']);
-			
-            if($tab['name'] == $active_tab) {
 
-                // If module is set, then set the template path relative to the module..
-                if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
+			if($tab['name'] == $active_tab) {
 
-                // Generate the template if it does not exist yet.
-				
-				
-								
-                if(!is_file($tab["template"])) {
-                     $app->uses('tform_tpl_generator');
-                     $app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
-                }
-                $app->tpl->setVar('readonly_tab', (isset($tab['readonly']) && $tab['readonly'] == true));
-                $app->tpl->setInclude('content_tpl',$tab["template"]);
-                $tab["active"] = 1;
-                $_SESSION["s"]["form"]["tab"] = $tab['name'];
-            } else {
-                    $tab["active"] = 0;
-            }
+				// If module is set, then set the template path relative to the module..
+				if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
 
-                        // Unset unused variables.
-                        unset($tab["fields"]);
-                        unset($tab["plugins"]);
+				// Generate the template if it does not exist yet.
 
-            $frmTab[] = $tab;
-        }
 
-        // setting form tabs
-        $app->tpl->setLoop("formTab", $frmTab);
 
-                // Set form action
-                $app->tpl->setVar('form_action',$this->formDef["action"]);
-                $app->tpl->setVar('form_active_tab',$active_tab);
-
-                // Set form title
-                $form_hint = $this->lng($this->formDef["title"]);
-                if($this->formDef["description"] != '') $form_hint .= '<div class="pageForm_description">'.$this->lng($this->formDef["description"]).'</div>';
-                $app->tpl->setVar('form_hint',$form_hint);
-
-                // Set Wordbook for this form
-
-                $app->tpl->setVar($this->wordbook);
-    	}
-
-		function getDataRecord($primary_id) {
-			global $app;
-			$escape = '`';
-			$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id." AND ".$this->getAuthSQL('r',$this->formDef['db_table']);
-            return $app->db->queryOneRecord($sql);
-		}
-		
-
-        function datalogSave($action,$primary_id, $record_old, $record_new) {
-                global $app,$conf;
-				
-				$app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new);
-				return true;
-        }
-
-        function getAuthSQL($perm, $table = '') {
-				if($_SESSION["s"]["user"]["typ"] == 'admin') {
-					return '1';
-				} else {
-					if ($table != ''){
-						$table = ' ' . $table . '.';
-					}
-                	$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
-					$sql = '(';
-                	$sql .= "(" . $table . "sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND " . $table . "sys_perm_user like '%$perm%') OR  ";
-                	$sql .= "(" . $table . "sys_groupid IN (".$groups.") AND " . $table ."sys_perm_group like '%$perm%') OR ";
-                	$sql .= $table . "sys_perm_other like '%$perm%'";
-                	$sql .= ')';
-
-                	return $sql;
+				if(!is_file($tab["template"])) {
+					$app->uses('tform_tpl_generator');
+					$app->tform_tpl_generator->buildHTML($this->formDef, $tab['name']);
 				}
-        }
+				$app->tpl->setVar('readonly_tab', (isset($tab['readonly']) && $tab['readonly'] == true));
+				$app->tpl->setInclude('content_tpl', $tab["template"]);
+				$tab["active"] = 1;
+				$_SESSION["s"]["form"]["tab"] = $tab['name'];
+			} else {
+				$tab["active"] = 0;
+			}
 
-        /*
+			// Unset unused variables.
+			unset($tab["fields"]);
+			unset($tab["plugins"]);
+
+			$frmTab[] = $tab;
+		}
+
+		// setting form tabs
+		$app->tpl->setLoop("formTab", $frmTab);
+
+		// Set form action
+		$app->tpl->setVar('form_action', $this->formDef["action"]);
+		$app->tpl->setVar('form_active_tab', $active_tab);
+
+		// Set form title
+		$form_hint = $this->lng($this->formDef["title"]);
+		if($this->formDef["description"] != '') $form_hint .= '<div class="pageForm_description">'.$this->lng($this->formDef["description"]).'</div>';
+		$app->tpl->setVar('form_hint', $form_hint);
+
+		// Set Wordbook for this form
+
+		$app->tpl->setVar($this->wordbook);
+	}
+
+	function getDataRecord($primary_id) {
+		global $app;
+		$escape = '`';
+		$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id." AND ".$this->getAuthSQL('r', $this->formDef['db_table']);
+		return $app->db->queryOneRecord($sql);
+	}
+
+
+	function datalogSave($action, $primary_id, $record_old, $record_new) {
+		global $app, $conf;
+
+		$app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new);
+		return true;
+	}
+
+	function getAuthSQL($perm, $table = '') {
+		if($_SESSION["s"]["user"]["typ"] == 'admin') {
+			return '1';
+		} else {
+			if ($table != ''){
+				$table = ' ' . $table . '.';
+			}
+			$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
+			$sql = '(';
+			$sql .= "(" . $table . "sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND " . $table . "sys_perm_user like '%$perm%') OR  ";
+			$sql .= "(" . $table . "sys_groupid IN (".$groups.") AND " . $table ."sys_perm_group like '%$perm%') OR ";
+			$sql .= $table . "sys_perm_other like '%$perm%'";
+			$sql .= ')';
+
+			return $sql;
+		}
+	}
+
+	/*
         This function checks if a user has the parmissions $perm for the data record with the ID $record_id
         If record_id = 0, the the permissions are tested against the defaults of the form file.
         */
-        function checkPerm($record_id,$perm) {
-                global $app;
+	function checkPerm($record_id, $perm) {
+		global $app;
 
-                if($record_id > 0) {
-                        // Add backticks for incomplete table names.
-                        if(stristr($this->formDef['db_table'],'.')) {
-                                $escape = '';
-                        } else {
-                                $escape = '`';
-                        }
-
-                        $sql = "SELECT ".$this->formDef['db_table_idx']." FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$record_id." AND ".$this->getAuthSQL($perm);
-                        if($record = $app->db->queryOneRecord($sql)) {
-                                return true;
-                        } else {
-                                return false;
-                        }
-                } else {
-                        $result = false;
-                        if(@$this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm,$this->formDef["auth_preset"]["perm_user"])) $result = true;
-                        if(@$this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true;
-                        if(@stristr($this->formDef["auth_preset"]["perm_other"],$perm)) $result = true;
-
-                        // if preset == 0, everyone can insert a record of this type
-                        if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0 AND (@stristr($this->formDef["auth_preset"]["perm_user"],$perm) OR @stristr($this->formDef["auth_preset"]["perm_group"],$perm))) $result = true;
-
-                        return $result;
-
-                }
-
-        }
-
-        function getNextTab() {
-                // Which tab is shown
-                if($this->errorMessage == '') {
-                    // If there is no error
-                    if(isset($_REQUEST["next_tab"]) && $_REQUEST["next_tab"] != '') {
-                                // If the next tab is known
-                                $active_tab = $_REQUEST["next_tab"];
-                    } else {
-                        // else use the default tab
-                        $active_tab = $this->formDef['tab_default'];
-                    }
-                } else {
-                    // Show the same tab again in case of an error
-                    $active_tab = $_SESSION["s"]["form"]["tab"];
-                }
-
-                return $active_tab;
-        }
-
-        function getCurrentTab() {
-                return $_SESSION["s"]["form"]["tab"];
-        }
-		
-		function isReadonlyTab($tab, $primary_id) {
-			global $app, $conf;
-			
+		if($record_id > 0) {
 			// Add backticks for incomplete table names.
-            if(stristr($this->formDef['db_table'],'.')) {
-                $escape = '';
-            } else {
-                $escape = '`';
-            }
-			
-			$sql = "SELECT sys_userid FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-            $record = $app->db->queryOneRecord($sql);
-			
-			// return true if the readonly flag of the form is set and the current loggedin user is not the owner of the record.
-			if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true && $record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) {
+			if(stristr($this->formDef['db_table'], '.')) {
+				$escape = '';
+			} else {
+				$escape = '`';
+			}
+
+			$sql = "SELECT ".$this->formDef['db_table_idx']." FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$record_id." AND ".$this->getAuthSQL($perm);
+			if($record = $app->db->queryOneRecord($sql)) {
 				return true;
 			} else {
 				return false;
 			}
-        }
-		
-		
-		// translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook
-		function lng($msg) {
-			global $app,$conf;
-			
-			if(isset($this->wordbook[$msg])) {
-				return $this->wordbook[$msg];
-			} else {
-				return $app->lng($msg);
-			}
-			
+		} else {
+			$result = false;
+			if(@$this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm, $this->formDef["auth_preset"]["perm_user"])) $result = true;
+			if(@$this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm, $this->formDef["auth_preset"]["perm_group"])) $result = true;
+			if(@stristr($this->formDef["auth_preset"]["perm_other"], $perm)) $result = true;
+
+			// if preset == 0, everyone can insert a record of this type
+			if($this->formDef["auth_preset"]["userid"] == 0 and $this->formDef["auth_preset"]["groupid"] == 0 and (@stristr($this->formDef["auth_preset"]["perm_user"], $perm) or @stristr($this->formDef["auth_preset"]["perm_group"], $perm))) $result = true;
+
+			return $result;
+
 		}
-		
-		function checkClientLimit($limit_name,$sql_where = '') {
-			global $app;
-			
-			$check_passed = true;
-			$limit_name = $app->db->quote($limit_name);
-			if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
-			
-			// Get the limits of the client that is currently logged in
+
+	}
+
+	function getNextTab() {
+		// Which tab is shown
+		if($this->errorMessage == '') {
+			// If there is no error
+			if(isset($_REQUEST["next_tab"]) && $_REQUEST["next_tab"] != '') {
+				// If the next tab is known
+				$active_tab = $_REQUEST["next_tab"];
+			} else {
+				// else use the default tab
+				$active_tab = $this->formDef['tab_default'];
+			}
+		} else {
+			// Show the same tab again in case of an error
+			$active_tab = $_SESSION["s"]["form"]["tab"];
+		}
+
+		return $active_tab;
+	}
+
+	function getCurrentTab() {
+		return $_SESSION["s"]["form"]["tab"];
+	}
+
+	function isReadonlyTab($tab, $primary_id) {
+		global $app, $conf;
+
+		// Add backticks for incomplete table names.
+		if(stristr($this->formDef['db_table'], '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
+
+		$sql = "SELECT sys_userid FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+		$record = $app->db->queryOneRecord($sql);
+
+		// return true if the readonly flag of the form is set and the current loggedin user is not the owner of the record.
+		if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true && $record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+
+	// translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook
+	function lng($msg) {
+		global $app, $conf;
+
+		if(isset($this->wordbook[$msg])) {
+			return $this->wordbook[$msg];
+		} else {
+			return $app->lng($msg);
+		}
+
+	}
+
+	function checkClientLimit($limit_name, $sql_where = '') {
+		global $app;
+
+		$check_passed = true;
+		$limit_name = $app->db->quote($limit_name);
+		if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
+
+		// Get the limits of the client that is currently logged in
+		$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		$client = $app->db->queryOneRecord("SELECT $limit_name as number, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+		// Check if the user may add another item
+		if($client["number"] >= 0) {
+			$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE ".$this->getAuthSQL('u');
+			if($sql_where != '') $sql .= ' and '.$sql_where;
+			$tmp = $app->db->queryOneRecord($sql);
+			if($tmp["number"] >= $client["number"]) $check_passed = false;
+		}
+
+		return $check_passed;
+	}
+
+	function checkResellerLimit($limit_name, $sql_where = '') {
+		global $app;
+
+		$check_passed = true;
+		$limit_name = $app->db->quote($limit_name);
+		if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
+
+		// Get the limits of the client that is currently logged in
+		$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+		//* If the client belongs to a reseller, we will check against the reseller Limit too
+		if($client['parent_client_id'] != 0) {
+
+			//* first we need to know the groups of this reseller
+			$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
+			$reseller_groups = $tmp["groups"];
+			$reseller_userid = $tmp["userid"];
+
+			// Get the limits of the reseller of the logged in client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT $limit_name as number, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+			$reseller = $app->db->queryOneRecord("SELECT $limit_name as number FROM client WHERE client_id = ".$client['parent_client_id']);
+
 			// Check if the user may add another item
-			if($client["number"] >= 0) {
-				$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE ".$this->getAuthSQL('u');
+			if($reseller["number"] >= 0) {
+				$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE (sys_groupid IN (".$reseller_groups.") or sys_userid = ".$reseller_userid.")";
 				if($sql_where != '') $sql .= ' and '.$sql_where;
 				$tmp = $app->db->queryOneRecord($sql);
-				if($tmp["number"] >= $client["number"]) $check_passed = false;
+				if($tmp["number"] >= $reseller["number"]) $check_passed = false;
 			}
-			
-			return $check_passed;
 		}
-		
-		function checkResellerLimit($limit_name,$sql_where = '') {
-			global $app;
-			
-			$check_passed = true;
-			$limit_name = $app->db->quote($limit_name);
-			if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
-			
-			// Get the limits of the client that is currently logged in
-			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
-			//* If the client belongs to a reseller, we will check against the reseller Limit too
-			if($client['parent_client_id'] != 0) {
-				
-				//* first we need to know the groups of this reseller
-				$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
-				$reseller_groups = $tmp["groups"];
-				$reseller_userid = $tmp["userid"];
-				
-				// Get the limits of the reseller of the logged in client
-				$client_group_id = $_SESSION["s"]["user"]["default_group"];
-				$reseller = $app->db->queryOneRecord("SELECT $limit_name as number FROM client WHERE client_id = ".$client['parent_client_id']);
-			
-				// Check if the user may add another item
-				if($reseller["number"] >= 0) {
-					$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE (sys_groupid IN (".$reseller_groups.") or sys_userid = ".$reseller_userid.")";
-					if($sql_where != '') $sql .= ' and '.$sql_where;
-					$tmp = $app->db->queryOneRecord($sql);
-					if($tmp["number"] >= $reseller["number"]) $check_passed = false;
-				}
-			}
-			
-			return $check_passed;
-		}
-		
-		//* get the difference record of two arrays
-		function getDiffRecord($record_old,$record_new) {
-			
-			if(is_array($record_new) && count($record_new) > 0) {
+
+		return $check_passed;
+	}
+
+	//* get the difference record of two arrays
+	function getDiffRecord($record_old, $record_new) {
+
+		if(is_array($record_new) && count($record_new) > 0) {
 			foreach($record_new as $key => $val) {
 				if(@$record_old[$key] != $val) {
 					// Record has changed
-					$diffrec[$key] = array(	'old' => @$record_old[$key],
-											'new' => $val);
-					}
+					$diffrec[$key] = array( 'old' => @$record_old[$key],
+						'new' => $val);
 				}
-			} elseif(is_array($record_old)) {
-				foreach($record_old as $key => $val) {
-					if($record_new[$key] != $val) {
-						// Record has changed
-						$diffrec[$key] = array(	'new' => $record_new[$key],
-												'old' => $val);
-						}
-					}
+			}
+		} elseif(is_array($record_old)) {
+			foreach($record_old as $key => $val) {
+				if($record_new[$key] != $val) {
+					// Record has changed
+					$diffrec[$key] = array( 'new' => $record_new[$key],
+						'old' => $val);
 				}
-			return $diffrec;
-		
+			}
 		}
-		
-		/**
-		 * Generate HTML for DATETIME fields.
-		 * 
-		 * @access private
-		 * @param string $form_element Name of the form element.
-		 * @param string $default_value Selected value for fields.
-		 * @param bool $display_secons Include seconds selection.
-		 * @return string HTML	
-		 */
-		function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
-		{
-			$_datetime = strtotime($default_value);
-			$_showdate = ($_datetime === false) ? false : true;
+		return $diffrec;
 
-			$dselect = array('day','month','year','hour','minute');
-            if ($display_seconds === true) {
-			 	$dselect[] = 'second';
-			}
-			 
-			$out = '';
-			 
-			foreach ($dselect as $dt_element)
-			{
-			 	$dt_options = array();
-			 	$dt_space = 1;
-			 	
-			 	switch ($dt_element) {
-			 		case 'day':
-					 	for ($i = 1; $i <= 31; $i++) {
-				            $dt_options[] = array('name' =>  sprintf('%02d', $i),
-				            					  'value' => sprintf('%d', $i));
-				        }
-				        $selected_value = date('d', $_datetime);
-			 			break;
-			 			
-			 		case 'month':
-				 		for ($i = 1; $i <= 12; $i++) {
-				            $dt_options[] = array('name' => strftime('%b', mktime(0, 0, 0, $i, 1, 2000)),
-				            					  'value' => strftime('%m', mktime(0, 0, 0, $i, 1, 2000)));
-				        }
-				        $selected_value = date('n', $_datetime);
-			 			break;
-			 			
-			 		case 'year':
-					 	$start_year = strftime("%Y");
-						$years = range((int)$start_year, (int)($start_year+3));
-				        
-				        foreach ($years as $year) {
-				        	$dt_options[] = array('name' => $year,
-				            					 'value' => $year);
-				        }
-				        $selected_value = date('Y', $_datetime);
-				        $dt_space = 2;
-			 			break;
-			 			
-			 		case 'hour':
-			 			foreach(range(0, 23) as $hour) {
-			 				$dt_options[] = array('name' =>  sprintf('%02d', $hour),
-            			    					  'value' => sprintf('%d', $hour));
-			 			}
-			 			$selected_value = date('G', $_datetime);
-			 			break;
-			 			
-			 		case 'minute':
-			 			foreach(range(0, 59) as $minute) {
-			 				if (($minute % 5) == 0) {
-			 					$dt_options[] = array('name' =>  sprintf('%02d', $minute),
-													  'value' => sprintf('%d', $minute));
-			 				}
-			 			}
-			 			$selected_value = (int)floor(date('i', $_datetime));
-			 			break;
-			 			
-			 		case 'second':	
-			 			foreach(range(0, 59) as $second) {
-			 				$dt_options[] = array('name' =>  sprintf('%02d', $second),
-							      				  'value' => sprintf('%d', $second));
-			 			}
-			 			$selected_value = (int)floor(date('s', $_datetime));
-			 			break;
-			 	}
-					 	
-				$out .= "<select name=\"".$form_element."[$dt_element]\" id=\"".$form_element."_$dt_element\" class=\"selectInput\" style=\"width: auto; float: none;\">";
-				if (!$_showdate) {
-					$out .= "<option value=\"-\" selected=\"selected\">--</option>" . PHP_EOL;
-				} else {
-					$out .= "<option value=\"-\">--</option>" . PHP_EOL;
+	}
+
+
+
+
+
+	/**
+	 * Generate HTML for DATETIME fields.
+	 *
+	 * @access private
+	 * @param string $form_element Name of the form element.
+	 * @param string $default_value Selected value for fields.
+	 * @param bool $display_secons Include seconds selection.
+	 * @return string HTML
+	 */
+	function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
+	{
+		$_datetime = strtotime($default_value);
+		$_showdate = ($_datetime === false) ? false : true;
+
+		$dselect = array('day', 'month', 'year', 'hour', 'minute');
+		if ($display_seconds === true) {
+			$dselect[] = 'second';
+		}
+
+		$out = '';
+
+		foreach ($dselect as $dt_element)
+		{
+			$dt_options = array();
+			$dt_space = 1;
+
+			switch ($dt_element) {
+			case 'day':
+				for ($i = 1; $i <= 31; $i++) {
+					$dt_options[] = array('name' =>  sprintf('%02d', $i),
+						'value' => sprintf('%d', $i));
 				}
-				 
-				foreach ($dt_options as $dt_opt) {
-					if ( $_showdate && ($selected_value == $dt_opt['value']) ) {
-						$out .= "<option value=\"{$dt_opt['value']}\" selected=\"selected\">{$dt_opt['name']}</option>" . PHP_EOL;
-					} else {
-						$out .= "<option value=\"{$dt_opt['value']}\">{$dt_opt['name']}</option>" . PHP_EOL;
+				$selected_value = date('d', $_datetime);
+				break;
+
+			case 'month':
+				for ($i = 1; $i <= 12; $i++) {
+					$dt_options[] = array('name' => strftime('%b', mktime(0, 0, 0, $i, 1, 2000)),
+						'value' => strftime('%m', mktime(0, 0, 0, $i, 1, 2000)));
+				}
+				$selected_value = date('n', $_datetime);
+				break;
+
+			case 'year':
+				$start_year = strftime("%Y");
+				$years = range((int)$start_year, (int)($start_year+3));
+
+				foreach ($years as $year) {
+					$dt_options[] = array('name' => $year,
+						'value' => $year);
+				}
+				$selected_value = date('Y', $_datetime);
+				$dt_space = 2;
+				break;
+
+			case 'hour':
+				foreach(range(0, 23) as $hour) {
+					$dt_options[] = array('name' =>  sprintf('%02d', $hour),
+						'value' => sprintf('%d', $hour));
+				}
+				$selected_value = date('G', $_datetime);
+				break;
+
+			case 'minute':
+				foreach(range(0, 59) as $minute) {
+					if (($minute % 5) == 0) {
+						$dt_options[] = array('name' =>  sprintf('%02d', $minute),
+							'value' => sprintf('%d', $minute));
 					}
 				}
-												        
-				$out .= '</select>' . str_repeat('&nbsp;', $dt_space);
+				$selected_value = (int)floor(date('i', $_datetime));
+				break;
+
+			case 'second':
+				foreach(range(0, 59) as $second) {
+					$dt_options[] = array('name' =>  sprintf('%02d', $second),
+						'value' => sprintf('%d', $second));
+				}
+				$selected_value = (int)floor(date('s', $_datetime));
+				break;
 			}
-			
-			return $out;
+
+			$out .= "<select name=\"".$form_element."[$dt_element]\" id=\"".$form_element."_$dt_element\" class=\"selectInput\" style=\"width: auto; float: none;\">";
+			if (!$_showdate) {
+				$out .= "<option value=\"-\" selected=\"selected\">--</option>" . PHP_EOL;
+			} else {
+				$out .= "<option value=\"-\">--</option>" . PHP_EOL;
+			}
+
+			foreach ($dt_options as $dt_opt) {
+				if ( $_showdate && ($selected_value == $dt_opt['value']) ) {
+					$out .= "<option value=\"{$dt_opt['value']}\" selected=\"selected\">{$dt_opt['name']}</option>" . PHP_EOL;
+				} else {
+					$out .= "<option value=\"{$dt_opt['value']}\">{$dt_opt['name']}</option>" . PHP_EOL;
+				}
+			}
+
+			$out .= '</select>' . str_repeat('&nbsp;', $dt_space);
 		}
+
+		return $out;
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php
index 4db3157..336d2fb 100644
--- a/interface/lib/classes/tform_actions.inc.php
+++ b/interface/lib/classes/tform_actions.inc.php
@@ -30,570 +30,578 @@
 
 class tform_actions {
 
-        public $id;
-        public $activeTab;
-        public $dataRecord;
-        public $plugins = array();
-		public $oldDataRecord; // This array is only filled during updates and when db_history is enabled.
+	public $id;
+	public $activeTab;
+	public $dataRecord;
+	public $plugins = array();
+	public $oldDataRecord; // This array is only filled during updates and when db_history is enabled.
 
-        function onLoad() {
-                global $app, $conf, $tform_def_file;
+	function onLoad() {
+		global $app, $conf, $tform_def_file;
 
-                // Loading template classes and initialize template
-                if(!is_object($app->tpl)) $app->uses('tpl');
-                if(!is_object($app->tform)) $app->uses('tform');
+		// Loading template classes and initialize template
+		if(!is_object($app->tpl)) $app->uses('tpl');
+		if(!is_object($app->tform)) $app->uses('tform');
 
-                $app->tpl->newTemplate("tabbed_form.tpl.htm");
+		$app->tpl->newTemplate("tabbed_form.tpl.htm");
 
-                // Load table definition from file
-                $app->tform->loadFormDef($tform_def_file);
-				
-				// Importing ID
-                $this->id = (isset($_REQUEST["id"]))?$app->functions->intval($_REQUEST["id"]):0;
-				
-				// show print version of the form
-				if(isset($_GET["print_form"]) && $_GET["print_form"] == 1) {
-					die('Function disabled.');
-					$this->onPrintForm();
-				}
-				
-				// send this form by email
-				if(isset($_GET["send_form_by_mail"]) && $_GET["send_form_by_mail"] == 1) {
-					die('Function disabled.');
-					$this->onMailSendForm();
-				}
+		// Load table definition from file
+		$app->tform->loadFormDef($tform_def_file);
 
-                if(count($_POST) > 1) {
-                        $this->dataRecord = $_POST;
-                        $this->onSubmit();
-                } else {
-                        $this->onShow();
-                }
-        }
+		// Importing ID
+		$this->id = (isset($_REQUEST["id"]))?$app->functions->intval($_REQUEST["id"]):0;
 
-        /**
-        * Function called on page submit
-        */
+		// show print version of the form
+		if(isset($_GET["print_form"]) && $_GET["print_form"] == 1) {
+			die('Function disabled.');
+			$this->onPrintForm();
+		}
 
-        function onSubmit() {
-                global $app, $conf;
-                
-                // check if the client is locked - he may not change anything, then.
-				if(!$app->auth->is_admin()) {
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-					$client = $app->db->queryOneRecord("SELECT client.locked FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($client_group_id));
-					if(is_array($client) && $client['locked'] == 'y') {
-						$app->tform->errorMessage .= $app->lng("client_you_are_locked")."<br />";
-					}
-				}
-                
-                // Calling the action functions
-                if($this->id > 0) {
-					$app->tform->action == 'EDIT';
-					$this->onUpdate();
-                } else {
-					$app->tform->action == 'NEW';
-					$this->onInsert();
-                }
-        }
+		// send this form by email
+		if(isset($_GET["send_form_by_mail"]) && $_GET["send_form_by_mail"] == 1) {
+			die('Function disabled.');
+			$this->onMailSendForm();
+		}
 
-        /**
-        * Function called on data update
-        */
+		if(count($_POST) > 1) {
+			$this->dataRecord = $_POST;
+			$this->onSubmit();
+		} else {
+			$this->onShow();
+		}
+	}
 
-        function onUpdate() {
-                global $app, $conf;
-				
-				$this->onBeforeUpdate();
-				
-                $ext_where = '';
-                $sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'UPDATE',$this->id,$ext_where);
-                if($app->tform->errorMessage == '') {
-						
-						if($app->tform->formDef['db_history'] == 'yes') {
-							$this->oldDataRecord = $app->tform->getDataRecord($this->id);
-						}
-						
-						// Save record in database
-						$this->onUpdateSave($sql);
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_update_save',array('page_form'=>$this, 'sql'=>$sql));
-                        
-						// loading plugins
-						$next_tab = $app->tform->getCurrentTab();
-                		$this->loadPlugins($next_tab);
+	/**
+	 * Function called on page submit
+	 */
 
-                        // Call plugin
-                        foreach($this->plugins as $plugin) {
-                                $plugin->onUpdate();
-                        }
-						
-						$this->onAfterUpdate();
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_update',$this);
-						
-						// Write data history (sys_datalog)
-						if($app->tform->formDef['db_history'] == 'yes') {
-							$new_data_record = $app->tform->getDataRecord($this->id);
-							$app->tform->datalogSave('UPDATE',$this->id,$this->oldDataRecord,$new_data_record);
-							unset($new_data_record);
-							unset($old_data_record);
-						}
 
-                        if($_REQUEST["next_tab"] == '') {
-                           $list_name = $_SESSION["s"]["form"]["return_to"];
-						   // When a list is embedded inside of a form
-						   
-                           //if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-						   if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-                                $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
-                                $_SESSION["s"]["form"]["return_to"] = '';
-                                session_write_close();
-                                header($redirect);
-							// When a returnto variable is set
-							} elseif (isset($_SESSION["s"]["form"]["return_to_url"]) && $_SESSION["s"]["form"]["return_to_url"] != '') {
-								$redirect = $_SESSION["s"]["form"]["return_to_url"];
-								$_SESSION["s"]["form"]["return_to_url"] = '';
-								session_write_close();
-								header("Location: ".$redirect);
-								exit;
-								// Use the default list of the form
-                        	} else {
-                            	header("Location: ".$app->tform->formDef['list_default']);
-                        	}
-                        	exit;
-                    	} else {
-                                $this->onShow();
-                        }
-                } else {
-                        $this->onError();
-                }
-        }
-		
-		/*
-		 Save record in database
-		*/
-		
-		function onUpdateSave($sql) {
-			global $app;
-			if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(),$this->id)) {
-				$app->db->query($sql);
-				if($app->db->errorMessage != '') die($app->db->errorMessage);
+	function onSubmit() {
+		global $app, $conf;
+
+		// check if the client is locked - he may not change anything, then.
+		if(!$app->auth->is_admin()) {
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT client.locked FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($client_group_id));
+			if(is_array($client) && $client['locked'] == 'y') {
+				$app->tform->errorMessage .= $app->lng("client_you_are_locked")."<br />";
 			}
 		}
-		
 
-        /**
-        * Function called on data insert
-        */
-
-        function onInsert() {
-                global $app, $conf;
-				
-				$this->onBeforeInsert();
-
-                $ext_where = '';
-                $sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'INSERT',$this->id,$ext_where);
-                if($app->tform->errorMessage == '') {
-						
-						$this->id = $this->onInsertSave($sql);
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_insert_save',array('page_form'=>$this, 'sql'=>$sql));
-                        
-						// loading plugins
-						$next_tab = $app->tform->getCurrentTab();
-                		$this->loadPlugins($next_tab);
-						
-                        // Call plugin
-                        foreach($this->plugins as $plugin) {
-                                $plugin->onInsert();
-                        }
-
-                        $this->onAfterInsert();
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_insert',$this);
-
-						// Write data history (sys_datalog)
-						if($app->tform->formDef['db_history'] == 'yes') {
-							$new_data_record = $app->tform->getDataRecord($this->id);
-							$app->tform->datalogSave('INSERT',$this->id,array(),$new_data_record);
-							unset($new_data_record);
-						}
-						
-
-                     if($_REQUEST["next_tab"] == '') {
-                         $list_name = $_SESSION["s"]["form"]["return_to"];
-                         // if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-						 if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-                            $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
-                            $_SESSION["s"]["form"]["return_to"] = '';
-                            session_write_close();
-                            header($redirect);
-							exit;
-                        } elseif ($_SESSION["s"]["form"]["return_to_url"] != '') {
-							$redirect = $_SESSION["s"]["form"]["return_to_url"];
-							$_SESSION["s"]["form"]["return_to_url"] = '';
-							session_write_close();
-							header("Location: ".$redirect);
-							exit;
-						} else {
-                                header("Location: ".$app->tform->formDef['list_default']);
-                        }
-                        exit;
-                    } else {
-                            $this->onShow();
-                        }
-                } else {
-                        $this->onError();
-                }
-        }
-		
-		/*
-		 Save record in database
-		*/
-		
-		function onInsertSave($sql) {
-			global $app, $conf;
-			$app->db->query($sql);
-            if($app->db->errorMessage != '') die($app->db->errorMessage);
-            return $app->db->insertID();
+		// Calling the action functions
+		if($this->id > 0) {
+			$app->tform->action == 'EDIT';
+			$this->onUpdate();
+		} else {
+			$app->tform->action == 'NEW';
+			$this->onInsert();
 		}
-
-        function onBeforeUpdate() {
-            global $app, $conf;
-        }
-
-        function onBeforeInsert() {
-            global $app, $conf;
-        }
-		
-		function onAfterUpdate() {
-            global $app, $conf;
-        }
-
-        function onAfterInsert() {
-            global $app, $conf;
-        }
+	}
 
 
-        /**
-        * Function called on data insert or update error
-        */
+	/**
+	 * Function called on data update
+	 */
+	function onUpdate() {
+		global $app, $conf;
 
-        function onError() {
-                global $app, $conf;
+		$this->onBeforeUpdate();
 
-                $app->tpl->setVar("error","<li>".$app->tform->errorMessage."</li>");
-                $app->tpl->setVar($this->dataRecord);
-                $this->onShow();
-        }
+		$ext_where = '';
+		$sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'UPDATE', $this->id, $ext_where);
+		if($app->tform->errorMessage == '') {
 
-        /**
-        * Function called on data delete
-        */
+			if($app->tform->formDef['db_history'] == 'yes') {
+				$this->oldDataRecord = $app->tform->getDataRecord($this->id);
+			}
 
-        function onDelete() {
-                global $app, $conf,$list_def_file,$tform_def_file;
+			// Save record in database
+			$this->onUpdateSave($sql);
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_update_save', array('page_form'=>$this, 'sql'=>$sql));
 
-                include_once($list_def_file);
+			// loading plugins
+			$next_tab = $app->tform->getCurrentTab();
+			$this->loadPlugins($next_tab);
 
-                // Loading tform framework
-                if(!is_object($app->tform)) $app->uses('tform');
+			// Call plugin
+			foreach($this->plugins as $plugin) {
+				$plugin->onUpdate();
+			}
 
-                // Load table definition from file
-                $app->tform->loadFormDef($tform_def_file);
+			$this->onAfterUpdate();
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_update', $this);
 
-                // importing ID
-                $this->id = $app->functions->intval($_REQUEST["id"]);
+			// Write data history (sys_datalog)
+			if($app->tform->formDef['db_history'] == 'yes') {
+				$new_data_record = $app->tform->getDataRecord($this->id);
+				$app->tform->datalogSave('UPDATE', $this->id, $this->oldDataRecord, $new_data_record);
+				unset($new_data_record);
+				unset($old_data_record);
+			}
 
-                if($this->id > 0) {
+			if($_REQUEST["next_tab"] == '') {
+				$list_name = $_SESSION["s"]["form"]["return_to"];
+				// When a list is embedded inside of a form
 
-                        // checking permissions
-                        if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
-                                if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-                        }
-
-                        //$this->dataRecord = $app->db->queryOneRecord("SELECT * FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = ".$this->id);
-						$this->dataRecord = $app->tform->getDataRecord($this->id);
-						
-						$this->onBeforeDelete();
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_delete',$this);
-						
-                        // Saving record to datalog when db_history enabled
-                        if($app->tform->formDef["db_history"] == 'yes') {
-							//$old_data_record = $app->tform->getDataRecord($this->id);
-							$app->tform->datalogSave('DELETE',$this->id,$this->dataRecord,array());
-                        }
-
-                        $app->db->query("DELETE FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." LIMIT 1");
-						
-						
-						// loading plugins
-						$next_tab = $app->tform->getCurrentTab();
-                		$this->loadPlugins($next_tab);
-						
-                	
-                        // Call plugin
-                        foreach($this->plugins as $plugin) {
-                                $plugin->onDelete();
-                        }
-						
-						$this->onAfterDelete();
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_delete',$this);
-                }
-
-                		//header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
-                 $list_name = $_SESSION["s"]["form"]["return_to"];
-                 if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-                        $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
-                        $_SESSION["s"]["form"]["return_to"] = '';
-                        session_write_close();
-                        header($redirect);
-                } else {
-                    header("Location: ".$liste["file"]);
-                }
-                exit;
-
-        }
-		
-		function onBeforeDelete() {
-            global $app, $conf;
-        }
-		
-		function onAfterDelete() {
-            global $app, $conf;
-        }
-		
-		/**
-        * Function to print the form content
-        */
-		
-		function onPrintForm() {
-			global $app, $conf;
-			
-			if($app->tform->formDef['template_print'] == '') die('No print template available.');
-			
-			$app->tpl->newTemplate("print.tpl.htm");
-			$app->tpl->setInclude("content_tpl",$app->tform->formDef['template_print']);
-
-			if($app->tform->formDef['auth'] == 'no') {
-            	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
-            } else {
-            	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
-            }
-            if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
-			
-			$record["datum"] = date("d.m.Y");
-			
-			$app->tpl->setVar($app->tform->wordbook);
-
-			$app->tpl->setVar($record);
-			$app->tpl_defaults();
-			$app->tpl->pparse();
-			exit;
-			
-		}
-		
-		/**
-        * Function to print the form content
-        */
-		
-		function onMailSendForm() {
-			global $app, $conf;
-			
-			if($app->tform->formDef['template_mailsend'] == '') die('No print template available.');
-			
-			if($_POST["email"] == '' && $_POST["sender"] == '') {
-				// Zeige Formular zum versenden an.
-				$app->tpl->newTemplate("form.tpl.htm");
-				$app->tpl->setInclude("content_tpl",$app->tform->formDef['template_mailsend']);
-				$app->tpl->setVar('show_form',1);
-				$app->tpl->setVar("form_action",$app->tform->formDef['action'].'?send_form_by_mail=1');
-				$app->tpl->setVar("id",$this->id);
-				$app->tpl_defaults();
-				$app->tpl->pparse();
+				//if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+				if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+					$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
+					$_SESSION["s"]["form"]["return_to"] = '';
+					session_write_close();
+					header($redirect);
+					// When a returnto variable is set
+				} elseif (isset($_SESSION["s"]["form"]["return_to_url"]) && $_SESSION["s"]["form"]["return_to_url"] != '') {
+					$redirect = $_SESSION["s"]["form"]["return_to_url"];
+					$_SESSION["s"]["form"]["return_to_url"] = '';
+					session_write_close();
+					header("Location: ".$redirect);
+					exit;
+					// Use the default list of the form
+				} else {
+					header("Location: ".$app->tform->formDef['list_default']);
+				}
 				exit;
 			} else {
-				$app->tpl->newTemplate("mail.tpl.htm");
-				$app->tpl->setInclude("content_tpl",$app->tform->formDef['template_mailsend']);
-				$app->tpl->setVar('show_mail',1);
-				if($app->tform->formDef['auth'] == 'no') {
-            		$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
-            	} else {
-            		$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
-            	}
-            	if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
-			
-				$record["datum"] = date("d.m.Y");
-				$record["mailmessage"] = $_POST["message"];
-			
-				$app->tpl->setVar($app->tform->wordbook);
-
-				$app->tpl->setVar($record);
-				$app->tpl_defaults();
-				
-				$email_message = $app->tpl->grab();
-				$email = $_POST["email"];
-				$sender = $_POST["sender"];
-				
-				$headers  = "MIME-Version: 1.0\n";
-				$headers .= "Content-type: text/html; charset=iso-8859-1\n";
-				$headers .= "From: $sender\n";
-				
-				if (!preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $sender)) {
-    				$sender = 'noreply@iprguard.de';
-  				}
-				
-				if (preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $email)) {
-    				mail($email, 'Domainrecherche Statement '.$record["domain"], $email_message, $headers);
-  				}
-				echo "<p>&nbsp;</p><p>Email wurde versand.</p>";
-				exit;
+				$this->onShow();
 			}
-			
-			
+		} else {
+			$this->onError();
+		}
+	}
 
+	/*
+		 Save record in database
+		*/
+
+	function onUpdateSave($sql) {
+		global $app;
+		if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(), $this->id)) {
+			$app->db->query($sql);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+		}
+	}
+
+
+
+
+
+	/**
+	 * Function called on data insert
+	 */
+	function onInsert() {
+		global $app, $conf;
+
+		$this->onBeforeInsert();
+
+		$ext_where = '';
+		$sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'INSERT', $this->id, $ext_where);
+		if($app->tform->errorMessage == '') {
+
+			$this->id = $this->onInsertSave($sql);
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_insert_save', array('page_form'=>$this, 'sql'=>$sql));
+
+			// loading plugins
+			$next_tab = $app->tform->getCurrentTab();
+			$this->loadPlugins($next_tab);
+
+			// Call plugin
+			foreach($this->plugins as $plugin) {
+				$plugin->onInsert();
+			}
+
+			$this->onAfterInsert();
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_insert', $this);
+
+			// Write data history (sys_datalog)
+			if($app->tform->formDef['db_history'] == 'yes') {
+				$new_data_record = $app->tform->getDataRecord($this->id);
+				$app->tform->datalogSave('INSERT', $this->id, array(), $new_data_record);
+				unset($new_data_record);
+			}
+
+
+			if($_REQUEST["next_tab"] == '') {
+				$list_name = $_SESSION["s"]["form"]["return_to"];
+				// if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+				if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+					$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
+					$_SESSION["s"]["form"]["return_to"] = '';
+					session_write_close();
+					header($redirect);
+					exit;
+				} elseif ($_SESSION["s"]["form"]["return_to_url"] != '') {
+					$redirect = $_SESSION["s"]["form"]["return_to_url"];
+					$_SESSION["s"]["form"]["return_to_url"] = '';
+					session_write_close();
+					header("Location: ".$redirect);
+					exit;
+				} else {
+					header("Location: ".$app->tform->formDef['list_default']);
+				}
+				exit;
+			} else {
+				$this->onShow();
+			}
+		} else {
+			$this->onError();
+		}
+	}
+
+	/*
+		 Save record in database
+		*/
+
+	function onInsertSave($sql) {
+		global $app, $conf;
+		$app->db->query($sql);
+		if($app->db->errorMessage != '') die($app->db->errorMessage);
+		return $app->db->insertID();
+	}
+
+	function onBeforeUpdate() {
+		global $app, $conf;
+	}
+
+	function onBeforeInsert() {
+		global $app, $conf;
+	}
+
+	function onAfterUpdate() {
+		global $app, $conf;
+	}
+
+	function onAfterInsert() {
+		global $app, $conf;
+	}
+
+
+	/**
+	 * Function called on data insert or update error
+	 */
+	function onError() {
+		global $app, $conf;
+
+		$app->tpl->setVar("error", "<li>".$app->tform->errorMessage."</li>");
+		$app->tpl->setVar($this->dataRecord);
+		$this->onShow();
+	}
+
+
+	/**
+	 * Function called on data delete
+	 */
+	function onDelete() {
+		global $app, $conf, $list_def_file, $tform_def_file;
+
+		include_once $list_def_file;
+
+		// Loading tform framework
+		if(!is_object($app->tform)) $app->uses('tform');
+
+		// Load table definition from file
+		$app->tform->loadFormDef($tform_def_file);
+
+		// importing ID
+		$this->id = $app->functions->intval($_REQUEST["id"]);
+
+		if($this->id > 0) {
+
+			// checking permissions
+			if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
+				if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+			}
+
+			//$this->dataRecord = $app->db->queryOneRecord("SELECT * FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = ".$this->id);
+			$this->dataRecord = $app->tform->getDataRecord($this->id);
+
+			$this->onBeforeDelete();
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_delete', $this);
+
+			// Saving record to datalog when db_history enabled
+			if($app->tform->formDef["db_history"] == 'yes') {
+				//$old_data_record = $app->tform->getDataRecord($this->id);
+				$app->tform->datalogSave('DELETE', $this->id, $this->dataRecord, array());
+			}
+
+			$app->db->query("DELETE FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." LIMIT 1");
+
+
+			// loading plugins
+			$next_tab = $app->tform->getCurrentTab();
+			$this->loadPlugins($next_tab);
+
+
+			// Call plugin
+			foreach($this->plugins as $plugin) {
+				$plugin->onDelete();
+			}
+
+			$this->onAfterDelete();
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_delete', $this);
+		}
+
+		//header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
+		$list_name = $_SESSION["s"]["form"]["return_to"];
+		if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+			$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
+			$_SESSION["s"]["form"]["return_to"] = '';
+			session_write_close();
+			header($redirect);
+		} else {
+			header("Location: ".$liste["file"]);
+		}
+		exit;
+
+	}
+
+	function onBeforeDelete() {
+		global $app, $conf;
+	}
+
+	function onAfterDelete() {
+		global $app, $conf;
+	}
+
+
+
+
+
+	/**
+	 * Function to print the form content
+	 */
+	function onPrintForm() {
+		global $app, $conf;
+
+		if($app->tform->formDef['template_print'] == '') die('No print template available.');
+
+		$app->tpl->newTemplate("print.tpl.htm");
+		$app->tpl->setInclude("content_tpl", $app->tform->formDef['template_print']);
+
+		if($app->tform->formDef['auth'] == 'no') {
+			$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
+		} else {
+			$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
+		}
+		if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
+
+		$record["datum"] = date("d.m.Y");
+
+		$app->tpl->setVar($app->tform->wordbook);
+
+		$app->tpl->setVar($record);
+		$app->tpl_defaults();
+		$app->tpl->pparse();
+		exit;
+
+	}
+
+
+
+
+
+	/**
+	 * Function to print the form content
+	 */
+	function onMailSendForm() {
+		global $app, $conf;
+
+		if($app->tform->formDef['template_mailsend'] == '') die('No print template available.');
+
+		if($_POST["email"] == '' && $_POST["sender"] == '') {
+			// Zeige Formular zum versenden an.
+			$app->tpl->newTemplate("form.tpl.htm");
+			$app->tpl->setInclude("content_tpl", $app->tform->formDef['template_mailsend']);
+			$app->tpl->setVar('show_form', 1);
+			$app->tpl->setVar("form_action", $app->tform->formDef['action'].'?send_form_by_mail=1');
+			$app->tpl->setVar("id", $this->id);
+			$app->tpl_defaults();
+			$app->tpl->pparse();
+			exit;
+		} else {
+			$app->tpl->newTemplate("mail.tpl.htm");
+			$app->tpl->setInclude("content_tpl", $app->tform->formDef['template_mailsend']);
+			$app->tpl->setVar('show_mail', 1);
 			if($app->tform->formDef['auth'] == 'no') {
-            	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
-            } else {
-            	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
-            }
-            if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
-			
+				$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
+			} else {
+				$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
+			}
+			if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
+
 			$record["datum"] = date("d.m.Y");
-			
+			$record["mailmessage"] = $_POST["message"];
+
 			$app->tpl->setVar($app->tform->wordbook);
 
 			$app->tpl->setVar($record);
 			$app->tpl_defaults();
-			$app->tpl->pparse();
+
+			$email_message = $app->tpl->grab();
+			$email = $_POST["email"];
+			$sender = $_POST["sender"];
+
+			$headers  = "MIME-Version: 1.0\n";
+			$headers .= "Content-type: text/html; charset=iso-8859-1\n";
+			$headers .= "From: $sender\n";
+
+			if (!preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $sender)) {
+				$sender = 'noreply@iprguard.de';
+			}
+
+			if (preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $email)) {
+				mail($email, 'Domainrecherche Statement '.$record["domain"], $email_message, $headers);
+			}
+			echo "<p>&nbsp;</p><p>Email wurde versand.</p>";
 			exit;
-			
 		}
 
-        /**
-        * Function called on page show
-        */
 
-        function onShow() {
-                global $app, $conf;
 
-                // Which tab do we render
-                $this->active_tab = $app->tform->getNextTab();
-
-                if($this->id > 0) {
-                        $this->onShowEdit();
-                } else {
-                        $this->onShowNew();
-                }
-
-                // make Form and Tabs
-                $app->tform->showForm();
-
-                // Setting default values
-                $app->tpl_defaults();
-				
-				// Show the navigation bar of the form
-				if(isset($app->tform->formDef['navibar']) && $app->tform->formDef['navibar'] == 'yes') {
-					$navibar = '';
-					if($app->tform->formDef['template_print'] != '') {
-						$navibar .= '<a href="'.$app->tform->formDef['action'].'?id='.$this->id.'&print_form=1" target="_blank"><img src="../themes/iprg/icons/printer.png" border="0" alt="Drucken" /></a> &nbsp;';
-					}
-					if($app->tform->formDef['template_mailsend'] != '') {
-						$navibar .= "<a href=\"#\" onclick=\"window.open('".$app->tform->formDef['action'].'?id='.$this->id."&send_form_by_mail=1','send','width=370,height=240')\"><img src=\"../themes/iprg/icons/mail.png\" border=\"0\" alt=\"Als E-Mail versenden\" /></a>";
-					}
-					$app->tpl->setVar('form_navibar',$navibar);
-				}
-				
-                if(isset($_SESSION['show_info_msg'])) {
-                    $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
-                    unset($_SESSION['show_info_msg']);
-                }
-                if(isset($_SESSION['show_error_msg'])) {
-                    $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
-                    unset($_SESSION['show_error_msg']);
-                }
-				
-				// loading plugins
-                $this->loadPlugins($this->active_tab);
-
-                // Calling the Plugin onShow Events and set the data in the
-                // plugins placeholder in the template
-                foreach($this->plugins as $plugin_name => $plugin) {
-                        $app->tpl->setVar($plugin_name,$plugin->onShow());
-                }
-
-                // Parse the templates and send output to the browser
-                $this->onShowEnd();
-
-        }
-
-        /**
-        * Function called on new record
-        */
-
-        function onShowNew() {
-                global $app, $conf;
-
-                if($app->tform->errorMessage == '') {
-                        $record = array();
-                        $record = $app->tform->getHTML($record, $app->tform->formDef['tab_default'],'NEW');
-                } else {
-                        $record = $app->tform->getHTML($app->tform->encode($_POST,$this->active_tab),$this->active_tab,'EDIT');
-                }
-
-                $app->tpl->setVar($record);
-        }
-
-        /**
-        * Function called on edit record
-        */
-
-        function onShowEdit() {
-                global $app, $conf;
-
-                // bestehenden Datensatz anzeigen
-                if($app->tform->errorMessage == '') {
-                        if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
-                        	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
-                        } else {
-                        	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
-                        }
-                        if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
-                } else {
-                        // $record = $app->tform->encode($_POST,$this->active_tab);
-						$record = $app->tform->encode($this->dataRecord,$this->active_tab,false);
-                }
-
-                $this->dataRecord = $record;
-
-            	// Userdaten umwandeln
-                $record = $app->tform->getHTML($record, $this->active_tab,'EDIT');
-                $record['id'] = $this->id;
-
-                $app->tpl->setVar($record);
-        }
-
-        function onShowEnd() {
-                global $app, $conf;
-
-                // Template parsen
-                $app->tpl->pparse();
-        }
-		
-		function loadPlugins($next_tab) {
-			global $app;
-			if(@is_array($app->tform->formDef["tabs"][$next_tab]["plugins"])) {
-                 $app->load('plugin_base');
-                 foreach($app->tform->formDef["tabs"][$next_tab]["plugins"] as $plugin_name => $plugin_settings) {
-                      $plugin_class = $plugin_settings["class"];
-                      $app->load($plugin_class);
-                      $this->plugins[$plugin_name] = new $plugin_class;
-                      $this->plugins[$plugin_name]->setOptions($plugin_name,$plugin_settings['options']);
-					  // Make the data of the form easily accessible for the plugib
-					  $this->plugins[$plugin_name]->form = $this;
-                      $this->plugins[$plugin_name]->onLoad();
-                  }
-             }
+		if($app->tform->formDef['auth'] == 'no') {
+			$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
+		} else {
+			$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
 		}
+		if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
+
+		$record["datum"] = date("d.m.Y");
+
+		$app->tpl->setVar($app->tform->wordbook);
+
+		$app->tpl->setVar($record);
+		$app->tpl_defaults();
+		$app->tpl->pparse();
+		exit;
+
+	}
+
+
+	/**
+	 * Function called on page show
+	 */
+	function onShow() {
+		global $app, $conf;
+
+		// Which tab do we render
+		$this->active_tab = $app->tform->getNextTab();
+
+		if($this->id > 0) {
+			$this->onShowEdit();
+		} else {
+			$this->onShowNew();
+		}
+
+		// make Form and Tabs
+		$app->tform->showForm();
+
+		// Setting default values
+		$app->tpl_defaults();
+
+		// Show the navigation bar of the form
+		if(isset($app->tform->formDef['navibar']) && $app->tform->formDef['navibar'] == 'yes') {
+			$navibar = '';
+			if($app->tform->formDef['template_print'] != '') {
+				$navibar .= '<a href="'.$app->tform->formDef['action'].'?id='.$this->id.'&print_form=1" target="_blank"><img src="../themes/iprg/icons/printer.png" border="0" alt="Drucken" /></a> &nbsp;';
+			}
+			if($app->tform->formDef['template_mailsend'] != '') {
+				$navibar .= "<a href=\"#\" onclick=\"window.open('".$app->tform->formDef['action'].'?id='.$this->id."&send_form_by_mail=1','send','width=370,height=240')\"><img src=\"../themes/iprg/icons/mail.png\" border=\"0\" alt=\"Als E-Mail versenden\" /></a>";
+			}
+			$app->tpl->setVar('form_navibar', $navibar);
+		}
+
+		if(isset($_SESSION['show_info_msg'])) {
+			$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+			unset($_SESSION['show_info_msg']);
+		}
+		if(isset($_SESSION['show_error_msg'])) {
+			$app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+			unset($_SESSION['show_error_msg']);
+		}
+
+		// loading plugins
+		$this->loadPlugins($this->active_tab);
+
+		// Calling the Plugin onShow Events and set the data in the
+		// plugins placeholder in the template
+		foreach($this->plugins as $plugin_name => $plugin) {
+			$app->tpl->setVar($plugin_name, $plugin->onShow());
+		}
+
+		// Parse the templates and send output to the browser
+		$this->onShowEnd();
+
+	}
+
+
+	/**
+	 * Function called on new record
+	 */
+	function onShowNew() {
+		global $app, $conf;
+
+		if($app->tform->errorMessage == '') {
+			$record = array();
+			$record = $app->tform->getHTML($record, $app->tform->formDef['tab_default'], 'NEW');
+		} else {
+			$record = $app->tform->getHTML($app->tform->encode($_POST, $this->active_tab), $this->active_tab, 'EDIT');
+		}
+
+		$app->tpl->setVar($record);
+	}
+
+
+	/**
+	 * Function called on edit record
+	 */
+	function onShowEdit() {
+		global $app, $conf;
+
+		// bestehenden Datensatz anzeigen
+		if($app->tform->errorMessage == '') {
+			if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
+				$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
+			} else {
+				$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
+			}
+			if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
+		} else {
+			// $record = $app->tform->encode($_POST,$this->active_tab);
+			$record = $app->tform->encode($this->dataRecord, $this->active_tab, false);
+		}
+
+		$this->dataRecord = $record;
+
+		// Userdaten umwandeln
+		$record = $app->tform->getHTML($record, $this->active_tab, 'EDIT');
+		$record['id'] = $this->id;
+
+		$app->tpl->setVar($record);
+	}
+
+	function onShowEnd() {
+		global $app, $conf;
+
+		// Template parsen
+		$app->tpl->pparse();
+	}
+
+	function loadPlugins($next_tab) {
+		global $app;
+		if(@is_array($app->tform->formDef["tabs"][$next_tab]["plugins"])) {
+			$app->load('plugin_base');
+			foreach($app->tform->formDef["tabs"][$next_tab]["plugins"] as $plugin_name => $plugin_settings) {
+				$plugin_class = $plugin_settings["class"];
+				$app->load($plugin_class);
+				$this->plugins[$plugin_name] = new $plugin_class;
+				$this->plugins[$plugin_name]->setOptions($plugin_name, $plugin_settings['options']);
+				// Make the data of the form easily accessible for the plugib
+				$this->plugins[$plugin_name]->form = $this;
+				$this->plugins[$plugin_name]->onLoad();
+			}
+		}
+	}
 
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tform_tpl_generator.inc.php b/interface/lib/classes/tform_tpl_generator.inc.php
index bfc932f..635aa04 100644
--- a/interface/lib/classes/tform_tpl_generator.inc.php
+++ b/interface/lib/classes/tform_tpl_generator.inc.php
@@ -29,13 +29,13 @@
 */
 
 class tform_tpl_generator {
-	
-	function buildHTML($formDef,$tab) {
-		
+
+	function buildHTML($formDef, $tab) {
+
 		global $app;
-		
+
 		$module = $_SESSION["s"]["module"]["name"];
-		
+
 		$html = '<h2><tmpl_var name="list_head_txt"></h2>
 <p><tmpl_var name="list_desc_txt"></p>
 
@@ -51,22 +51,22 @@
 			if ($field['required'] == true ) { $html_reqcode = $html_reqestedelement; } else { $html_reqcode = ''; }
 
 			switch ($field['formtype']) {
-				case 'TEXT':
-					$html .= "
+			case 'TEXT':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <input name=\"".$key."\" id=\"".$key."\" value=\"{tmpl_var name='".$key."'}\" size=\"".$field['width']."\" maxlength=\"".$field['maxlength']."\" type=\"text\" class=\"textInput\" />
 			</div>";
 				break;
-				case 'TEXTAREA':
-					$html .= "
+			case 'TEXTAREA':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <textarea name=\"".$key."\" id=\"".$key."\" rows='".$field['rows']."' cols='".$field['cols']."'>{tmpl_var name='".$key."'}</textarea>
       </div>";
 				break;
-				case 'SELECT':
-					$html .= "
+			case 'SELECT':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <select name=\"".$key."\" id=\"".$key."\" class=\"selectInput\">
@@ -74,8 +74,8 @@
 				</select>
       </div>";
 				break;
-				case 'MULTIPLE':
-					$html .= "
+			case 'MULTIPLE':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <select multiple name=\"".$key."\" id=\"".$key."\" class=\"selectInput\">
@@ -83,15 +83,15 @@
 				</select>
       </div>";
 				break;
-				case 'PASSWORD':
-					$html .= "
+			case 'PASSWORD':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <input name=\"".$key."\" id=\"".$key."\" value=\"{tmpl_var name='".$key."'}\" size=\"".$field['width']."\" maxlength=\"".$field['maxlength']."\" type=\"password\" class=\"textInput\" />
 			</div>";
 				break;
-				case 'CHECKBOX':
-					$html .= "
+			case 'CHECKBOX':
+				$html .= "
       <div class=\"ctrlHolder\">
 				<p class=\"label\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</p>
 					<div class=\"multiField\">
@@ -99,8 +99,8 @@
 					</div>
 			</div>";
 				break;
-				case 'CHECKBOXARRAY':
-					$html .= "
+			case 'CHECKBOXARRAY':
+				$html .= "
       <div class=\"ctrlHolder\">
 				<p class=\"label\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</p>
 					<div class=\"multiField\">
@@ -108,8 +108,8 @@
 					</div>
 			</div>";
 				break;
-				case 'RADIO':
-					$html .= "
+			case 'RADIO':
+				$html .= "
       <div class=\"ctrlHolder\">
 				<p class=\"label\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</p>
 					<div class=\"multiField\">
@@ -118,18 +118,18 @@
 			</div>";
 				break;
 			}
-			
+
 			// Language File Eintrag für "Feld-Titel" anlegen
 			$lang[$key."_txt"] = $key;
-			
+
 			// language File Eintrag, für error-Text anlegen
 			if(isset($field["errmsg"]) && $field["errmsg"] != '') {
 				$errmsg = $field["errmsg"];
 				$lang[$errmsg] = $errmsg;
 			}
-			
+
 		}
-		
+
 		$html .= "
     </fieldset>
 
@@ -140,94 +140,94 @@
       <button class=\"negative iconstxt icoNegative\" type=\"button\" value=\"{tmpl_var name='btn_cancel_txt'}\" onclick=\"loadContent('".$module."/".$formDef["list_default"]."');\"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
     </div>
   </div>
-  
+
 </div>
 ";
 
-				
+
 		// speichere Template
-		if (!$handle = fopen($formDef['tabs'][$tab]['template'], 'w')) { 
-        	print "Cannot open file (".$formDef['tabs'][$tab]['template'].")"; 
-        	exit; 
-   		} 
- 
-   		if (!fwrite($handle, $html)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
+		if (!$handle = fopen($formDef['tabs'][$tab]['template'], 'w')) {
+			print "Cannot open file (".$formDef['tabs'][$tab]['template'].")";
+			exit;
+		}
+
+		if (!fwrite($handle, $html)) {
+			print "Cannot write to file ($filename)";
+			exit;
 		}
 		fclose($handle);
-		
-		$this->lng_add($lang,$formDef);
-		
+
+		$this->lng_add($lang, $formDef);
+
 		// überprüfe, ob es die Tabelle schon gibt,
 		// ansonsten wird sie angelegt
 		$tables = $app->db->getTables();
-		
-		if(!@in_array($formDef['db_table'],$tables)) {
+
+		if(!@in_array($formDef['db_table'], $tables)) {
 			// Datenbank noch nicht vorhanden
-			
+
 			$columns = array();
-			
+
 			// füge ID Feld hinzu
-			$col = array(	'action' 		=> 'add',
-							'name'			=> $formDef["db_table_idx"],
-							'type'			=> 'int64',
-							'typeValue'		=> '',
-							'defaultValue'	=> false,
-							'notNull'		=> true,
-							'autoInc'		=> true,
-							'option'		=> 'primary'
-						);
-					
+			$col = array( 'action'   => 'add',
+				'name'   => $formDef["db_table_idx"],
+				'type'   => 'int64',
+				'typeValue'  => '',
+				'defaultValue' => false,
+				'notNull'  => true,
+				'autoInc'  => true,
+				'option'  => 'primary'
+			);
+
 			$columns[] = $col;
 			$app->db->show_error_messages = true;
-			
+
 			if($formDef["auth"] == 'yes') {
-				
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_userid',
-								'type'			=> 'int32',
-								'typeValue'		=> '',
-								'defaultValue'	=> '0',
-								'notNull'		=> true
-							);
+
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_userid',
+					'type'   => 'int32',
+					'typeValue'  => '',
+					'defaultValue' => '0',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_groupid',
-								'type'			=> 'int32',
-								'typeValue'		=> '',
-								'defaultValue'	=> '0',
-								'notNull'		=> true
-							);
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_groupid',
+					'type'   => 'int32',
+					'typeValue'  => '',
+					'defaultValue' => '0',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_perm_user',
-								'type'			=> 'varchar',
-								'typeValue'		=> '5',
-								'defaultValue'	=> 'NULL',
-								'notNull'		=> true
-							);
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_perm_user',
+					'type'   => 'varchar',
+					'typeValue'  => '5',
+					'defaultValue' => 'NULL',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_perm_group',
-								'type'			=> 'varchar',
-								'typeValue'		=> '5',
-								'defaultValue'	=> 'NULL',
-								'notNull'		=> true
-							);
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_perm_group',
+					'type'   => 'varchar',
+					'typeValue'  => '5',
+					'defaultValue' => 'NULL',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_perm_other',
-								'type'			=> 'varchar',
-								'typeValue'		=> '5',
-								'defaultValue'	=> 'NULL',
-								'notNull'		=> true
-							);
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_perm_other',
+					'type'   => 'varchar',
+					'typeValue'  => '5',
+					'defaultValue' => 'NULL',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-			
+
 			}
-			
-			
+
+
 			foreach($formDef['tabs'] as $tab) {
 				foreach($tab["fields"] as $name => $field) {
 					/*
@@ -240,85 +240,86 @@
 				                        notNull =>   true | false
 				                        autoInc =>   true | false
 				                        option =>   unique | primary | index)
-				       
-				       
+
+
 					*/
 					switch ($field["datatype"]) {
-						case 'INTEGER':
-							$type = 'int32';
-							$typevalue = '';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'0';
+					case 'INTEGER':
+						$type = 'int32';
+						$typevalue = '';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'0';
 						break;
-						case 'DOUBLE':
-							$type = 'double';
-							$typevalue = '';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'0';
+					case 'DOUBLE':
+						$type = 'double';
+						$typevalue = '';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'0';
 						break;
-						case 'CURRENCY':
-							$type = 'double';
-							$typevalue = '';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'0';
+					case 'CURRENCY':
+						$type = 'double';
+						$typevalue = '';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'0';
 						break;
-						case 'VARCHAR':
-							$type = 'varchar';
-							$typeValue = ($field["maxlength"] > 0 and $field["maxlength"] <= 256)?$field["maxlength"]:255;
-							// $defaultValue	= ($field["default"] != '')?$field["default"]:'NOT NULL';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'NULL';
+					case 'VARCHAR':
+						$type = 'varchar';
+						$typeValue = ($field["maxlength"] > 0 and $field["maxlength"] <= 256)?$field["maxlength"]:255;
+						// $defaultValue = ($field["default"] != '')?$field["default"]:'NOT NULL';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'NULL';
 						break;
-						case 'TEXT':
-							$type = 'text';
-							$typevalue = '';
-							$defaultValue = 'NULL';
+					case 'TEXT':
+						$type = 'text';
+						$typevalue = '';
+						$defaultValue = 'NULL';
 						break;
-						case 'DATE':
-							$type = 'int64';
-							$typevalue = '';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'0';
+					case 'DATE':
+						$type = 'int64';
+						$typevalue = '';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'0';
 						break;
 					}
-					
-					
-					$col = array(	'action' 		=> 'add',
-									'name'			=> $name,
-									'type'			=> $type,
-									'typeValue'		=> $typeValue,
-									'defaultValue'	=> $defaultValue,
-									'notNull'		=> true
-									);
-					
+
+
+					$col = array( 'action'   => 'add',
+						'name'   => $name,
+						'type'   => $type,
+						'typeValue'  => $typeValue,
+						'defaultValue' => $defaultValue,
+						'notNull'  => true
+					);
+
 					$columns[] = $col;
 				}
 			}
-		
-		$app->db->createTable($formDef["db_table"],$columns);
-		
+
+			$app->db->createTable($formDef["db_table"], $columns);
+
 		}
 	}
-	
-	function lng_add($lang,$formDef) {
-		global $go_api, $go_info,$conf;
-		
+
+	function lng_add($lang, $formDef) {
+		global $go_api, $go_info, $conf;
+
 		$lng_file = "lib/lang/".$conf["language"]."_".$formDef['name'].".lng";
 		if(is_file($lng_file)) {
-			include($lng_file);
+			include $lng_file;
 		} else {
 			$wb = array();
 		}
-		
-		$wb_out = array_merge($lang,$wb);
-		
+
+		$wb_out = array_merge($lang, $wb);
+
 		if(is_array($wb_out)) {
-			$fp = fopen ($lng_file, "w");
-			fwrite($fp,"<?php\n");
+			$fp = fopen($lng_file, "w");
+			fwrite($fp, "<?php\n");
 			foreach($wb_out as $key => $val) {
 				$new_line = '$wb["'.$key.'"] = '."'$val';\n";
-				fwrite($fp,$new_line);
-				
+				fwrite($fp, $new_line);
+
 			}
-			fwrite($fp,"?>");
+			fwrite($fp, "?>");
 			fclose($fp);
 		}
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tools_monitor.inc.php b/interface/lib/classes/tools_monitor.inc.php
index 121ab93..abf8923 100644
--- a/interface/lib/classes/tools_monitor.inc.php
+++ b/interface/lib/classes/tools_monitor.inc.php
@@ -29,21 +29,21 @@
 
 class tools_monitor {
 
-    function showServerLoad() {
-        global $app;
+	function showServerLoad() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'server_load' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'server_load' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            if (strlen($data['up_minutes']) == "1") $data['up_minutes'] = "0".$data['up_minutes'];
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			if (strlen($data['up_minutes']) == "1") $data['up_minutes'] = "0".$data['up_minutes'];
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>
                 <tr>
@@ -54,7 +54,7 @@
                 <td>' . $app->lng("Users online").':</td>
                 <td>' . $data['user_online'] . '</td>
                 </tr>' .
-                    '<tr>
+				'<tr>
                 <td>' . $app->lng("System load 1 minute") . ':</td>
                 <td>' . $data['load_1'] . '</td>
                 </tr>
@@ -69,27 +69,27 @@
                 </table>
                 </div>
                 </div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_serverload_txt").'</p>';
-        }
+		} else {
+			$html = '<p>'.$app->lng("no_data_serverload_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showDiskUsage () {
-        global $app;
+	function showDiskUsage () {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'disk_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'disk_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>
                 <tr>
@@ -101,412 +101,414 @@
                 <td>'.$app->lng("monitor_diskusage_usage_txt").'</td>
                 <td>'.$app->lng("monitor_diskusage_mounted_txt").'</td>
                 </tr>';
-            foreach($data as $line) {
-                $html .= '<tr>';
-                foreach ($line as $item) {
-                    $html .= '<td>' . $item . '</td>';
-                }
-                $html .= '</tr>';
-            }
-            $html .= '</table>';
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_diskusage_txt").'</p>';
-        }
+			foreach($data as $line) {
+				$html .= '<tr>';
+				foreach ($line as $item) {
+					$html .= '<td>' . $item . '</td>';
+				}
+				$html .= '</tr>';
+			}
+			$html .= '</table>';
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_diskusage_txt").'</p>';
+		}
 
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showMemUsage () {
-        global $app;
+	function showMemUsage () {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mem_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mem_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>';
 
-            foreach($data as $key => $value) {
-                if ($key != '') {
-                    $html .= '<tr>
+			foreach($data as $key => $value) {
+				if ($key != '') {
+					$html .= '<tr>
                         <td>' . $key . ':</td>
                         <td>' . $value . '</td>
                         </tr>';
-                }
-            }
-            $html .= '</table>';
-            $html .= '</div></div>';
+				}
+			}
+			$html .= '</table>';
+			$html .= '</div></div>';
 
-        } else {
-            $html = '<p>'.$app->lng("no_data_memusage_txt").'</p>';
-        }
+		} else {
+			$html = '<p>'.$app->lng("no_data_memusage_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showCpuInfo () {
-        global $app;
+	function showCpuInfo () {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'cpu_info' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'cpu_info' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>';
-            foreach($data as $key => $value) {
-                if ($key != '') {
-                    $html .= '<tr>
+			foreach($data as $key => $value) {
+				if ($key != '') {
+					$html .= '<tr>
                         <td>' . $key . ':</td>
                         <td>' . $value . '</td>
                         </tr>';
-                }
-            }
-            $html .= '</table>';
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_cpuinfo_txt").'</p>';
-        }
+				}
+			}
+			$html .= '</table>';
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_cpuinfo_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showServices () {
-        global $app;
+	function showServices () {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>';
 
-            if($data['webserver'] != -1) {
-                if($data['webserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['webserver'] != -1) {
+				if($data['webserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_web_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
 
-            if($data['ftpserver'] != -1) {
-                if($data['ftpserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['ftpserver'] != -1) {
+				if($data['ftpserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_ftp_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
-            if($data['smtpserver'] != -1) {
-                if($data['smtpserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['smtpserver'] != -1) {
+				if($data['smtpserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_smtp_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
-            if($data['pop3server'] != -1) {
-                if($data['pop3server'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['pop3server'] != -1) {
+				if($data['pop3server'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_pop_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
-            if($data['imapserver'] != -1) {
-                if($data['imapserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['imapserver'] != -1) {
+				if($data['imapserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_imap_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
-            if($data['bindserver'] != -1) {
-                if($data['bindserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['bindserver'] != -1) {
+				if($data['bindserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_mydns_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
-            if($data['mysqlserver'] != -1) {
-                if($data['mysqlserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['mysqlserver'] != -1) {
+				if($data['mysqlserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_mysql_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
 
-            $html .= '</table></div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_services_txt").'</p>';
-        }
+			$html .= '</table></div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_services_txt").'</p>';
+		}
 
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showSystemUpdate() {
-        global $app;
+	function showSystemUpdate() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'system_update' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'system_update' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because the destribution is not supported) show this.
             */
-            if ($record['state'] == 'no_state') {
-                $html .= '<p>'.$app->lng("monitor_updates_nosupport_txt").'</p>';
-            }
-            else {
-                $data = unserialize($record['data']);
-                $html .= nl2br(html_entity_decode($data['output']));
-            }
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
-        }
+			if ($record['state'] == 'no_state') {
+				$html .= '<p>'.$app->lng("monitor_updates_nosupport_txt").'</p>';
+			}
+			else {
+				$data = unserialize($record['data']);
+				$html .= nl2br(html_entity_decode($data['output']));
+			}
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
 
-    function showOpenVzBeancounter() {
-        global $app;
+	function showOpenVzBeancounter() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'openvz_beancounter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'openvz_beancounter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because the server is not a VE) show this.
             */
-            $data = unserialize($record['data']);
-            if ((!isset($data)) || ($data == '')) {
-                $html .= '<p>'.$app->lng("monitor_beancounter_nosupport_txt").'</p>';
-            }
-            else {
-                $html .= '<pre>' . nl2br($data) . '</pre>';
-            }
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
-        }
+			$data = unserialize($record['data']);
+			if ((!isset($data)) || ($data == '')) {
+				$html .= '<p>'.$app->lng("monitor_beancounter_nosupport_txt").'</p>';
+			}
+			else {
+				$html .= '<pre>' . nl2br($data) . '</pre>';
+			}
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showRaidState() {
-        global $app;
+	function showRaidState() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'raid_state' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'raid_state' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
 
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because the RAID-Controler is not supported yet) show this.
             */
-            if ($record['state'] == 'no_state') {
-                $html .= '<p>'.$app->lng("monitor_nosupportedraid1_txt").'</p>';
-            }
-            else {
-                $data = unserialize($record['data']);
-                $html .= nl2br($data['output']);
-            }
-            $html .= '</div></div>';
+			if ($record['state'] == 'no_state') {
+				$html .= '<p>'.$app->lng("monitor_nosupportedraid1_txt").'</p>';
+			}
+			else {
+				$data = unserialize($record['data']);
+				$html .= nl2br($data['output']);
+			}
+			$html .= '</div></div>';
 
-        } else {
-            $html = '<p>'.$app->lng("no_data_raid_txt").'</p>';
-        }
+		} else {
+			$html = '<p>'.$app->lng("no_data_raid_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showRKHunter() {
-        global $app;
+	function showRKHunter() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
 
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because rkhunter is not installed) show this.
             */
-            $data = unserialize($record['data']);
-            if ($data['output'] == '') {
-                $html .= '<p>'.$app->lng("monitor_norkhunter_txt").'</p>';
-            }
-            else {
-                $html .= nl2br($data['output']);
-            }
-            $html .= '</div></div>';
+			$data = unserialize($record['data']);
+			if ($data['output'] == '') {
+				$html .= '<p>'.$app->lng("monitor_norkhunter_txt").'</p>';
+			}
+			else {
+				$html .= nl2br($data['output']);
+			}
+			$html .= '</div></div>';
 
-        } else {
-            $html = '<p>'.$app->lng("no_data_rkhunter_txt").'</p>';
-        }
+		} else {
+			$html = '<p>'.$app->lng("no_data_rkhunter_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showFail2ban() {
-        global $app;
+	function showFail2ban() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_fail2ban' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_fail2ban' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
 
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because fail2ban is not installed) show this.
             */
-            $data = unserialize($record['data']);
-            if ($data == '') {
-                $html .= '<p>'.
-                        'fail2ban is not installed at this server.<br />' .
-                        'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
-                        '</p>';
-            }
-            else {
-                $html .= nl2br($data);
-            }
-            $html .= '</div></div>';
+			$data = unserialize($record['data']);
+			if ($data == '') {
+				$html .= '<p>'.
+					'fail2ban is not installed at this server.<br />' .
+					'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
+					'</p>';
+			}
+			else {
+				$html .= nl2br($data);
+			}
+			$html .= '</div></div>';
 
-        } else {
-            $html = '<p>There is no data available at the moment.</p>';
-        }
+		} else {
+			$html = '<p>There is no data available at the moment.</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showIPTables() {
-        global $app;
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+	function showIPTables() {
+		global $app;
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
-            $data = unserialize($record['data']);
-            if ($data == '') {
-                $html .= '<p>Problem, there are no rules listed for the server</p>';
-            }
-            else {
-                $html .= nl2br($data['output']);
-            }
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>There is no data available at the moment.</p>';
-        }
-        return $html;
-    }
+			$data = unserialize($record['data']);
+			if ($data == '') {
+				$html .= '<p>Problem, there are no rules listed for the server</p>';
+			}
+			else {
+				$html .= nl2br($data['output']);
+			}
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>There is no data available at the moment.</p>';
+		}
+		return $html;
+	}
 
 
-    function showMailq() {
-        global $app;
+	function showMailq() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
-            $html = nl2br($data['output']);
-        } else {
-            $html = '<p>'.$app->lng("no_data_mailq_txt").'</p>';
-        }
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
+			$html = nl2br($data['output']);
+		} else {
+			$html = '<p>'.$app->lng("no_data_mailq_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function getDataTime($type) {
-        global $app;
+	function getDataTime($type) {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        /* TODO: datetimeformat should be set somewhat other way */
-        $dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt");
+		/* TODO: datetimeformat should be set somewhat other way */
+		$dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt");
 
-        if(isset($record['created'])) {
-    //        $res = date('Y-m-d H:i', $record['created']);
-            $res = date($dateTimeFormat, $record['created']);
-        } else {
-            $res = '????-??-?? ??:??';
-        }
-        return $res;
-    }
+		if(isset($record['created'])) {
+			//        $res = date('Y-m-d H:i', $record['created']);
+			$res = date($dateTimeFormat, $record['created']);
+		} else {
+			$res = '????-??-?? ??:??';
+		}
+		return $res;
+	}
+
 }
+
 ?>
diff --git a/interface/lib/classes/tools_sites.inc.php b/interface/lib/classes/tools_sites.inc.php
index deb57f5..c636bbc 100644
--- a/interface/lib/classes/tools_sites.inc.php
+++ b/interface/lib/classes/tools_sites.inc.php
@@ -29,147 +29,148 @@
 
 class tools_sites {
 
-    function replacePrefix($name, $dataRecord) {
-        // No input -> no possible output -> go out!
-        if ($name=="") return "";
+	function replacePrefix($name, $dataRecord) {
+		// No input -> no possible output -> go out!
+		if ($name=="") return "";
 
-        // Array containing keys to search
-        $keywordlist=array('CLIENTNAME','CLIENTID','DOMAINID');
+		// Array containing keys to search
+		$keywordlist=array('CLIENTNAME', 'CLIENTID', 'DOMAINID');
 
-        // Try to match the key within the string
-        foreach ($keywordlist as $keyword) {
-            if (substr_count($name, '['.$keyword.']') > 0) {
-                switch ($keyword) {
-                    case 'CLIENTNAME':
-                        $name=str_replace('['.$keyword.']', $this->getClientName($dataRecord),$name);
-                    break;
-                    case 'CLIENTID':
-                        $name=str_replace('['.$keyword.']', $this->getClientID($dataRecord),$name);
-                    break;
-                    case 'DOMAINID':
-                        $name=str_replace('['.$keyword.']', $dataRecord['parent_domain_id'],$name);
-                    break;
-                }
-            }
-        }
-        return $name;
-    }
-    
-    function removePrefix($name, $currentPrefix, $globalPrefix) {
-        if($name == "") return "";
-        
-        if($currentPrefix === '') return $name; // empty prefix, do not change name
-        if($currentPrefix === '#') $currentPrefix = $globalPrefix; // entry has no prefix set, maybe it was created before this function was introduced
-        
-        if($currentPrefix === '') return $name; // no current prefix and global prefix is empty -> nothing to remove here.
-        
-        return preg_replace('/^' . preg_quote($currentPrefix, '/') . '/', '', $name); // return name without prefix
-    }
-    
-    function getPrefix($currentPrefix, $userPrefix, $adminPrefix = false) {
-        global $app;
-        
-        if($currentPrefix !== '#') return $currentPrefix; // return the currently set prefix for this entry (# = no prefix set yet)
-        
-        if($adminPrefix === false) $adminPrefix = $userPrefix;
-        
-        if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) return $adminPrefix;
-        else return $userPrefix;
-    }
-    
-    function getClientName($dataRecord) {
-        global $app, $conf;
-        if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-            // Get the group-id of the user if the logged in user is neither admin nor reseller
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-        } else {
-            // Get the group-id from the data itself
-            if(isset($dataRecord['client_group_id'])) {
-                $client_group_id = $dataRecord['client_group_id'];
-            } elseif (isset($dataRecord['parent_domain_id'])) {
-                $tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = " . $dataRecord['parent_domain_id']);
-                $client_group_id = $tmp['sys_groupid'];
-            } elseif(isset($dataRecord['sys_groupid'])) {
-                $client_group_id = $dataRecord['sys_groupid'];
-            } else {
-                $client_group_id = 0;
-            }
-        }
-        
-        $tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id));
-        $clientName = $tmp['name'];
-        if ($clientName == "") $clientName = 'default';
-        $clientName = $this->convertClientName($clientName);
-        return $clientName;
-    }
+		// Try to match the key within the string
+		foreach ($keywordlist as $keyword) {
+			if (substr_count($name, '['.$keyword.']') > 0) {
+				switch ($keyword) {
+				case 'CLIENTNAME':
+					$name=str_replace('['.$keyword.']', $this->getClientName($dataRecord), $name);
+					break;
+				case 'CLIENTID':
+					$name=str_replace('['.$keyword.']', $this->getClientID($dataRecord), $name);
+					break;
+				case 'DOMAINID':
+					$name=str_replace('['.$keyword.']', $dataRecord['parent_domain_id'], $name);
+					break;
+				}
+			}
+		}
+		return $name;
+	}
 
-    function getClientID($dataRecord) {
-        global $app, $conf;
+	function removePrefix($name, $currentPrefix, $globalPrefix) {
+		if($name == "") return "";
 
-        if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-            // Get the group-id of the user
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-        } else {
-            // Get the group-id from the data itself
-            if(isset($dataRecord['client_group_id'])) {
-                $client_group_id = $dataRecord['client_group_id'];
-            } elseif (isset($dataRecord['parent_domain_id']) && $dataRecord['parent_domain_id'] != 0) {
-                $tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = " . $dataRecord['parent_domain_id']);
-                $client_group_id = $tmp['sys_groupid'];
-            } elseif(isset($dataRecord['sys_groupid'])) {
-                $client_group_id = $dataRecord['sys_groupid'];
-            } else {
-                $client_group_id = 0;
-            }
-        }
-        $tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id));
-        $clientID = $tmp['client_id'];
-        if ($clientID == '') $clientID = '0';
-        return $clientID;
-    }
-    
-    function convertClientName($name){
-        $allowed = 'abcdefghijklmnopqrstuvwxyz0123456789_';
-        $res = '';
-        $name = strtolower(trim($name));
-        for ($i=0; $i < strlen($name); $i++){
-            if ($name[$i] == ' ') continue;
-            if (strpos($allowed, $name[$i]) !== false){
-                $res .= $name[$i];
-            }
-            else {
-                $res .= '_';
-            }
-        }
-        return $res;
-    }
-    
-    function getDomainModuleDomains() {
-        global $app;
-        
-        $sql = "SELECT domain_id, domain FROM domain WHERE";
-        if ($_SESSION["s"]["user"]["typ"] == 'admin') {
-            $sql .= " 1";
-        } else {
-            $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
-            $sql .= " sys_groupid IN (".$groups.")";
-        }
-        $sql .= " ORDER BY domain";
-        return $app->db->queryAllRecords($sql);
-    }
-    
-    function checkDomainModuleDomain($domain_id) {
-        global $app;
-        
-        $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($domain_id);
-        if ($_SESSION["s"]["user"]["typ"] != 'admin') {
-            $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
-            $sql .= " AND sys_groupid IN (".$groups.")";
-        }
-        $domain = $app->db->queryOneRecord($sql);
-        if(!$domain || !$domain['domain_id']) return false;
-        return $domain['domain'];
-    }
+		if($currentPrefix === '') return $name; // empty prefix, do not change name
+		if($currentPrefix === '#') $currentPrefix = $globalPrefix; // entry has no prefix set, maybe it was created before this function was introduced
+
+		if($currentPrefix === '') return $name; // no current prefix and global prefix is empty -> nothing to remove here.
+
+		return preg_replace('/^' . preg_quote($currentPrefix, '/') . '/', '', $name); // return name without prefix
+	}
+
+	function getPrefix($currentPrefix, $userPrefix, $adminPrefix = false) {
+		global $app;
+
+		if($currentPrefix !== '#') return $currentPrefix; // return the currently set prefix for this entry (# = no prefix set yet)
+
+		if($adminPrefix === false) $adminPrefix = $userPrefix;
+
+		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) return $adminPrefix;
+		else return $userPrefix;
+	}
+
+	function getClientName($dataRecord) {
+		global $app, $conf;
+		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			// Get the group-id of the user if the logged in user is neither admin nor reseller
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		} else {
+			// Get the group-id from the data itself
+			if(isset($dataRecord['client_group_id'])) {
+				$client_group_id = $dataRecord['client_group_id'];
+			} elseif (isset($dataRecord['parent_domain_id'])) {
+				$tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = " . $dataRecord['parent_domain_id']);
+				$client_group_id = $tmp['sys_groupid'];
+			} elseif(isset($dataRecord['sys_groupid'])) {
+				$client_group_id = $dataRecord['sys_groupid'];
+			} else {
+				$client_group_id = 0;
+			}
+		}
+
+		$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id));
+		$clientName = $tmp['name'];
+		if ($clientName == "") $clientName = 'default';
+		$clientName = $this->convertClientName($clientName);
+		return $clientName;
+	}
+
+	function getClientID($dataRecord) {
+		global $app, $conf;
+
+		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			// Get the group-id of the user
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		} else {
+			// Get the group-id from the data itself
+			if(isset($dataRecord['client_group_id'])) {
+				$client_group_id = $dataRecord['client_group_id'];
+			} elseif (isset($dataRecord['parent_domain_id']) && $dataRecord['parent_domain_id'] != 0) {
+				$tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = " . $dataRecord['parent_domain_id']);
+				$client_group_id = $tmp['sys_groupid'];
+			} elseif(isset($dataRecord['sys_groupid'])) {
+				$client_group_id = $dataRecord['sys_groupid'];
+			} else {
+				$client_group_id = 0;
+			}
+		}
+		$tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id));
+		$clientID = $tmp['client_id'];
+		if ($clientID == '') $clientID = '0';
+		return $clientID;
+	}
+
+	function convertClientName($name){
+		$allowed = 'abcdefghijklmnopqrstuvwxyz0123456789_';
+		$res = '';
+		$name = strtolower(trim($name));
+		for ($i=0; $i < strlen($name); $i++){
+			if ($name[$i] == ' ') continue;
+			if (strpos($allowed, $name[$i]) !== false){
+				$res .= $name[$i];
+			}
+			else {
+				$res .= '_';
+			}
+		}
+		return $res;
+	}
+
+	function getDomainModuleDomains() {
+		global $app;
+
+		$sql = "SELECT domain_id, domain FROM domain WHERE";
+		if ($_SESSION["s"]["user"]["typ"] == 'admin') {
+			$sql .= " 1";
+		} else {
+			$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
+			$sql .= " sys_groupid IN (".$groups.")";
+		}
+		$sql .= " ORDER BY domain";
+		return $app->db->queryAllRecords($sql);
+	}
+
+	function checkDomainModuleDomain($domain_id) {
+		global $app;
+
+		$sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($domain_id);
+		if ($_SESSION["s"]["user"]["typ"] != 'admin') {
+			$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
+			$sql .= " AND sys_groupid IN (".$groups.")";
+		}
+		$domain = $app->db->queryOneRecord($sql);
+		if(!$domain || !$domain['domain_id']) return false;
+		return $domain['domain'];
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php
index 070e349..4b411e2 100644
--- a/interface/lib/classes/tpl.inc.php
+++ b/interface/lib/classes/tpl.inc.php
@@ -1,15 +1,16 @@
 <?php
 /**
-* vlibTemplate is a class used to seperate PHP and HTML.
-* For instructions on how to use vlibTemplate, see the
-* vlibTemplate.html file, located in the 'docs' directory.
-*
-* @since 07/03/2002
-* @author Kelvin Jones <kelvin@kelvinjones.co.uk>
-* @package vLIB
-* @access public
-* @see vlibTemplate.html
-*/
+ * vlibTemplate is a class used to seperate PHP and HTML.
+ * For instructions on how to use vlibTemplate, see the
+ * vlibTemplate.html file, located in the 'docs' directory.
+ *
+ * @since 07/03/2002
+ * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
+ * @package vLIB
+ * @access public
+ * @see vlibTemplate.html
+ */
+
 
 /* vim: set expandtab tabstop=4 shiftwidth=4: */
 // +----------------------------------------------------------------------+
@@ -25,200 +26,243 @@
 //** check and avoid multiple loading of class
 if (!defined('vlibTemplateClassLoaded')) {
 
-    define('vlibTemplateClassLoaded', 1);
-   	include_once (ISPC_CLASS_PATH.'/tpl_error.inc.php');
-   	include_once (ISPC_CLASS_PATH.'/tpl_ini.inc.php');
+	define('vlibTemplateClassLoaded', 1);
+	include_once ISPC_CLASS_PATH.'/tpl_error.inc.php';
+	include_once ISPC_CLASS_PATH.'/tpl_ini.inc.php';
 
-    class tpl{
-    
-        /*-----------------------------------------------------------------------------\
+	class tpl{
+
+		/*-----------------------------------------------------------------------------\
         |                                 ATTENTION                                    |
         |  Do not touch the following variables. vlibTemplate will not work otherwise. |
         \-----------------------------------------------------------------------------*/
-        private $OPTIONS = array(
-                'MAX_INCLUDES'          =>   10,
-                'TEMPLATE_DIR'          => null,
-                'GLOBAL_VARS'           => null,
-                'GLOBAL_CONTEXT_VARS'   => null,
-                'LOOP_CONTEXT_VARS'     => null,
-                'SET_LOOP_VAR'          => null,
-                'DEFAULT_ESCAPE'        => null,
-                'STRICT'                => null,
-                'CASELESS'              => null,
-                'UNKNOWNS'              => null,
-                'TIME_PARSE'            => null,
-                'ENABLE_PHPINCLUDE'     => null,
-                'INCLUDE_PATHS'         => array(),
-                'CACHE_DIRECTORY'       => null,
-                'CACHE_LIFETIME'        => null,
-                'CACHE_EXTENSION'       => null
-                );
+		private $OPTIONS = array(
+			'MAX_INCLUDES'          =>   10,
+			'TEMPLATE_DIR'          => null,
+			'GLOBAL_VARS'           => null,
+			'GLOBAL_CONTEXT_VARS'   => null,
+			'LOOP_CONTEXT_VARS'     => null,
+			'SET_LOOP_VAR'          => null,
+			'DEFAULT_ESCAPE'        => null,
+			'STRICT'                => null,
+			'CASELESS'              => null,
+			'UNKNOWNS'              => null,
+			'TIME_PARSE'            => null,
+			'ENABLE_PHPINCLUDE'     => null,
+			'INCLUDE_PATHS'         => array(),
+			'CACHE_DIRECTORY'       => null,
+			'CACHE_LIFETIME'        => null,
+			'CACHE_EXTENSION'       => null
+		);
 
-        /** open and close tags used for escaping */
-        private $ESCAPE_TAGS = array(
-                'html'      => array('open' => 'htmlspecialchars('    ,'close'=> ', ENT_QUOTES)'),
-                'url'       => array('open' => 'urlencode('           ,'close'=> ')'),
-                'rawurl'    => array('open' => 'rawurlencode('        ,'close'=> ')'),
-                'sq'        => array('open' => 'addcslashes('         ,'close'=> ", \"'\")"),
-                'dq'        => array('open' => 'addcslashes('         ,'close'=> ", '\"')"),
-                '1'         => array('open' => 'htmlspecialchars('    ,'close'=> ', ENT_QUOTES)'),
-                '0'         => array('open' => ''                     ,'close'=> ''),
-                'none'      => array('open' => ''                     ,'close'=> ''),
-                'hex'       => array('open' => '$this->_escape_hex('  ,'close'=> ', false)'),
-                'hexentity' => array('open' => '$this->_escape_hex('  ,'close'=> ', true)')
-                );
-    
-        /** open and close tags used for formatting */
-        private $FORMAT_TAGS = array(
-                'strtoupper' => array('open' => 'strtoupper(',          'close'=> ')'),
-                'uc'         => array('open' => 'strtoupper(',          'close'=> ')'),
-                'strtolower' => array('open' => 'strtolower(',          'close'=> ')'),
-                'lc'         => array('open' => 'strtolower(',          'close'=> ')'),
-                'ucfirst'    => array('open' => 'ucfirst(',             'close'=> ')'),
-                'lcucfirst'  => array('open' => 'ucfirst(strtolower(',  'close'=> '))'),
-                'ucwords'    => array('open' => 'ucwords(',             'close'=> ')'),
-                'lcucwords'  => array('open' => 'ucwords(strtolower(',  'close'=> '))')
-                );
+		/** open and close tags used for escaping */
+		private $ESCAPE_TAGS = array(
+			'html'      => array('open' => 'htmlspecialchars('    , 'close'=> ', ENT_QUOTES)'),
+			'url'       => array('open' => 'urlencode('           , 'close'=> ')'),
+			'rawurl'    => array('open' => 'rawurlencode('        , 'close'=> ')'),
+			'sq'        => array('open' => 'addcslashes('         , 'close'=> ", \"'\")"),
+			'dq'        => array('open' => 'addcslashes('         , 'close'=> ", '\"')"),
+			'1'         => array('open' => 'htmlspecialchars('    , 'close'=> ', ENT_QUOTES)'),
+			'0'         => array('open' => ''                     , 'close'=> ''),
+			'none'      => array('open' => ''                     , 'close'=> ''),
+			'hex'       => array('open' => '$this->_escape_hex('  , 'close'=> ', false)'),
+			'hexentity' => array('open' => '$this->_escape_hex('  , 'close'=> ', true)')
+		);
 
-        /** operators allowed when using extended TMPL_IF syntax */
-        private $allowed_if_ops = array('==','!=','<>','<','>','<=','>=');
-    
-        /** dbs allowed by vlibTemplate::setDbLoop(). */
-        private $allowed_loop_dbs = array('MYSQL','POSTGRESQL','INFORMIX','INTERBASE','INGRES',
-                                        'MSSQL','MSQL','OCI8','ORACLE','OVRIMOS','SYBASE');
-    
-        /** root directory of vlibTemplate automagically filled in */
-        private $VLIBTEMPLATE_ROOT = null;
-    
-        /** contains current directory used when doing recursive include */
-        private $_currentincludedir = array();
-    
-        /** current depth of includes */
-        private $_includedepth = 0;
-    
-        /** full path to tmpl file */
-        private $_tmplfilename = null;
-    
-        /** file data before it's parsed */
-        private $_tmplfile = null;
-    
-        /** parsed version of file, ready for eval()ing */
-        private $_tmplfilep = null;
-    
-        /** eval()ed version ready for printing or whatever */
-        private $_tmploutput = null;
-    
-        /** array for variables to be kept */
-        private $_vars = array();
-    
-        /** array where loop variables are kept */
-        private $_arrvars = array();
 
-        /** array which holds the current namespace during parse */
-        private $_namespace = array();
-    
-        /** variable is set to true once the template is parsed, to save re-parsing everything */
-        private $_parsed = false;
-    
-        /** array holds all unknowns vars */
-        private $_unknowns = array();
-    
-        /** microtime when template parsing began */
-        private $_firstparsetime = null;
-    
-        /** total time taken to parse template */
-        private $_totalparsetime = null;
-    
-        /** name of current loop being passed in */
-        private $_currloopname = null;
-    
-        /** rows with the above loop */
-        private $_currloop = array();
-    
-        /** define vars to avoid warnings */
-        private $_debug = null;
-        private $_cache = null;
-        
-        /** array which holds the dynamic Includes */
-        private $_dyninclude = array();
 
-        /*-----------------------------------------------------------------------------\
+		/** open and close tags used for formatting */
+		private $FORMAT_TAGS = array(
+			'strtoupper' => array('open' => 'strtoupper(',          'close'=> ')'),
+			'uc'         => array('open' => 'strtoupper(',          'close'=> ')'),
+			'strtolower' => array('open' => 'strtolower(',          'close'=> ')'),
+			'lc'         => array('open' => 'strtolower(',          'close'=> ')'),
+			'ucfirst'    => array('open' => 'ucfirst(',             'close'=> ')'),
+			'lcucfirst'  => array('open' => 'ucfirst(strtolower(',  'close'=> '))'),
+			'ucwords'    => array('open' => 'ucwords(',             'close'=> ')'),
+			'lcucwords'  => array('open' => 'ucwords(strtolower(',  'close'=> '))')
+		);
+
+		/** operators allowed when using extended TMPL_IF syntax */
+		private $allowed_if_ops = array('==', '!=', '<>', '<', '>', '<=', '>=');
+
+
+
+		/** dbs allowed by vlibTemplate::setDbLoop(). */
+		private $allowed_loop_dbs = array('MYSQL', 'POSTGRESQL', 'INFORMIX', 'INTERBASE', 'INGRES',
+			'MSSQL', 'MSQL', 'OCI8', 'ORACLE', 'OVRIMOS', 'SYBASE');
+
+
+
+		/** root directory of vlibTemplate automagically filled in */
+		private $VLIBTEMPLATE_ROOT = null;
+
+
+
+		/** contains current directory used when doing recursive include */
+		private $_currentincludedir = array();
+
+
+
+		/** current depth of includes */
+		private $_includedepth = 0;
+
+
+
+		/** full path to tmpl file */
+		private $_tmplfilename = null;
+
+
+
+		/** file data before it's parsed */
+		private $_tmplfile = null;
+
+
+
+		/** parsed version of file, ready for eval()ing */
+		private $_tmplfilep = null;
+
+
+
+		/** eval()ed version ready for printing or whatever */
+		private $_tmploutput = null;
+
+
+
+		/** array for variables to be kept */
+		private $_vars = array();
+
+
+
+		/** array where loop variables are kept */
+		private $_arrvars = array();
+
+		/** array which holds the current namespace during parse */
+		private $_namespace = array();
+
+
+
+		/** variable is set to true once the template is parsed, to save re-parsing everything */
+		private $_parsed = false;
+
+
+
+		/** array holds all unknowns vars */
+		private $_unknowns = array();
+
+
+
+		/** microtime when template parsing began */
+		private $_firstparsetime = null;
+
+
+
+		/** total time taken to parse template */
+		private $_totalparsetime = null;
+
+
+
+		/** name of current loop being passed in */
+		private $_currloopname = null;
+
+
+
+		/** rows with the above loop */
+		private $_currloop = array();
+
+
+
+		/** define vars to avoid warnings */
+		private $_debug = null;
+		private $_cache = null;
+
+
+
+		/** array which holds the dynamic Includes */
+		private $_dyninclude = array();
+
+		/*-----------------------------------------------------------------------------\
         |                           public functions                                   |
         \-----------------------------------------------------------------------------*/
-		    
-		
-        /**
-         * Usually called by the class constructor.
-         * Stores the filename in $this->_tmplfilename.
-         * Raises an error if the template file is not found.
-         * @param string $tmplfile full path to template file
-         * @return boolean true
-         * @access public
-         */
-        public function newTemplate($tmplfile)
-        {
-            if (!$tfile = $this->_fileSearch($tmplfile)){
-                vlibTemplateError::raiseError('VT_ERROR_NOFILE', KILL, $tmplfile);
-            }
 
-            //* make sure that any parsing vars are cleared for the new template
-            $this->_tmplfile = null;
-            $this->_tmplfilep = null;
-            $this->_tmploutput = null;
-            $this->_parsed = false;
-            $this->_unknowns = array();
-            $this->_firstparsetime = null;
-            $this->_totalparsetime = null;
 
-            //* reset debug module
-            if ($this->_debug){
-                $this->_debugReset();
-            }
-            $this->_tmplfilename = $tfile;
-            return true;
-        }
 
-        /**
-         * Sets variables to be used by the template
-         * If $k is an array, then it will treat it as an associative array
-         * using the keys as variable names and the values as variable values.
-         * @param mixed $k key to define variable name
-         * @param mixed $v variable to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        public function setVar($k, $v = null)
-        {
-            if (is_array($k)) {
-                foreach($k as $key => $value){
-                    $key = ($this->OPTIONS['CASELESS']) ? strtolower(trim($key)) : trim($key);
-                    if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $key) && $value !== null ) {
-                        $this->_vars[$key] = $value;
-                    }
-                }
-            } else {
-                if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k) && $v !== null) {
-                    if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
-                    $this->_vars[trim($k)] = $v;
-                } else {
-                    return false;
-                }
-            }
-            return true;
-        }
-        
-        /**
-         * Sets dynamic includes to be used by the template
-         * If $k is an array, then it will treat it as an associative array
-         * using the keys as variable names and the values as variable values.
-         * @param mixed $k key to define variable name
-         * @param mixed $v variable to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        public function setInclude($k, $v = null) 
-        {
-        	if(is_array($k)) {
+
+
+		/**
+		 * Usually called by the class constructor.
+		 * Stores the filename in $this->_tmplfilename.
+		 * Raises an error if the template file is not found.
+		 * @param string $tmplfile full path to template file
+		 * @return boolean true
+		 * @access public
+		 */
+		public function newTemplate($tmplfile)
+		{
+			if (!$tfile = $this->_fileSearch($tmplfile)){
+				vlibTemplateError::raiseError('VT_ERROR_NOFILE', KILL, $tmplfile);
+			}
+
+			//* make sure that any parsing vars are cleared for the new template
+			$this->_tmplfile = null;
+			$this->_tmplfilep = null;
+			$this->_tmploutput = null;
+			$this->_parsed = false;
+			$this->_unknowns = array();
+			$this->_firstparsetime = null;
+			$this->_totalparsetime = null;
+
+			//* reset debug module
+			if ($this->_debug){
+				$this->_debugReset();
+			}
+			$this->_tmplfilename = $tfile;
+			return true;
+		}
+
+		/**
+		 * Sets variables to be used by the template
+		 * If $k is an array, then it will treat it as an associative array
+		 * using the keys as variable names and the values as variable values.
+		 * @param mixed $k key to define variable name
+		 * @param mixed $v variable to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function setVar($k, $v = null)
+		{
+			if (is_array($k)) {
+				foreach($k as $key => $value){
+					$key = ($this->OPTIONS['CASELESS']) ? strtolower(trim($key)) : trim($key);
+					if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $key) && $value !== null ) {
+						$this->_vars[$key] = $value;
+					}
+				}
+			} else {
+				if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k) && $v !== null) {
+					if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
+					$this->_vars[trim($k)] = $v;
+				} else {
+					return false;
+				}
+			}
+			return true;
+		}
+
+
+
+		/**
+		 * Sets dynamic includes to be used by the template
+		 * If $k is an array, then it will treat it as an associative array
+		 * using the keys as variable names and the values as variable values.
+		 * @param mixed $k key to define variable name
+		 * @param mixed $v variable to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function setInclude($k, $v = null)
+		{
+			if(is_array($k)) {
 				foreach($k as $key => $val) {
 					$this->_dyninclude[$key] = $val;
 				}
@@ -228,103 +272,103 @@
 			return true;
 		}
 
-        /**
-         * Unsets a variable which has already been set
-         * Parse in all vars wanted for deletion in seperate parametres
-         * @param string var name to remove use: vlibTemplate::unsetVar(var[, var..])
-         * @return boolean true/false returns true unless called with 0 params
-         * @access public
-         */
-        public function unsetVar()
-        {
-            $num_args = func_num_args();
-            if ($num_args < 1)  return false;
+		/**
+		 * Unsets a variable which has already been set
+		 * Parse in all vars wanted for deletion in seperate parametres
+		 * @param string var name to remove use: vlibTemplate::unsetVar(var[, var..])
+		 * @return boolean true/false returns true unless called with 0 params
+		 * @access public
+		 */
+		public function unsetVar()
+		{
+			$num_args = func_num_args();
+			if ($num_args < 1)  return false;
 
-            for ($i = 0; $i < $num_args; $i++) {
-                $var = func_get_arg($i);
-                if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-                if (!preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $var)) continue;
-                unset($this->_vars[$var]);
-            }
-            return true;
-        }
+			for ($i = 0; $i < $num_args; $i++) {
+				$var = func_get_arg($i);
+				if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
+				if (!preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $var)) continue;
+				unset($this->_vars[$var]);
+			}
+			return true;
+		}
 
-        /**
-         * Gets all vars currently set in global namespace.
-         * @return array
-         * @access public
-         */
-        public function getVars()
-        {
-            return empty($this->_vars) ? false : $this->_vars;
-        }
+		/**
+		 * Gets all vars currently set in global namespace.
+		 * @return array
+		 * @access public
+		 */
+		public function getVars()
+		{
+			return empty($this->_vars) ? false : $this->_vars;
+		}
 
-        /**
-         * Gets a single var from the global namespace
-         * @return var
-         * @access public
-         */
-        public function getVar($var)
-        {
-            if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-            return (empty($var) || !isset($this->_vars[$var])) ? false : $this->_vars[$var];
-        }
+		/**
+		 * Gets a single var from the global namespace
+		 * @return var
+		 * @access public
+		 */
+		public function getVar($var)
+		{
+			if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
+			return (empty($var) || !isset($this->_vars[$var])) ? false : $this->_vars[$var];
+		}
 
-        /**
-         * sets the GLOBAL_CONTEXT_VARS
-         * @return true
-         * @access public
-         */
-        public function setContextVars()
-        {
-            $_phpself = @$GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'];
-            $_pathinfo = @$GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'];
-            $_request_uri = @$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
-            $_qs   = @$GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
+		/**
+		 * sets the GLOBAL_CONTEXT_VARS
+		 * @return true
+		 * @access public
+		 */
+		public function setContextVars()
+		{
+			$_phpself = @$GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'];
+			$_pathinfo = @$GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'];
+			$_request_uri = @$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
+			$_qs   = @$GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
 
-            //* the following fixes bug of $PHP_SELF on Win32 CGI and IIS.
-            $_self = (!empty($_pathinfo)) ? $_pathinfo : $_phpself;
-            $_uri  = (!empty($_request_uri)) ? $_request_uri : $_self.'?'.$_qs;
+			//* the following fixes bug of $PHP_SELF on Win32 CGI and IIS.
+			$_self = (!empty($_pathinfo)) ? $_pathinfo : $_phpself;
+			$_uri  = (!empty($_request_uri)) ? $_request_uri : $_self.'?'.$_qs;
 
-            $this->setvar('__SELF__', $_self);
-            $this->setvar('__REQUEST_URI__', $_uri);
-            return true;
-        }
+			$this->setvar('__SELF__', $_self);
+			$this->setvar('__REQUEST_URI__', $_uri);
+			return true;
+		}
 
-        /**
-         * Builds the loop construct for use with <TMPL_LOOP>.
-         * @param string $k string to define loop name
-         * @param array $v array to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        public function setLoop($k, $v)
-        {
-            if (is_array($v) && preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k)) {
-                $k = ($this->OPTIONS['CASELESS']) ? strtolower(trim($k)) : trim($k);
-                $this->_arrvars[$k] = array();
-                if ($this->OPTIONS['SET_LOOP_VAR'] && !empty($v)) $this->setvar($k, 1);
-                if (($this->_arrvars[$k] = $this->_arrayBuild($v)) == false) {
-                    vlibTemplateError::raiseError('VT_WARNING_INVALID_ARR', WARNING, $k);
-                } else {
-                    $this->vars['_'.$k.'_num'] = count($v);
-                }
-            }
-            return true;
-        }
+		/**
+		 * Builds the loop construct for use with <TMPL_LOOP>.
+		 * @param string $k string to define loop name
+		 * @param array $v array to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function setLoop($k, $v)
+		{
+			if (is_array($v) && preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k)) {
+				$k = ($this->OPTIONS['CASELESS']) ? strtolower(trim($k)) : trim($k);
+				$this->_arrvars[$k] = array();
+				if ($this->OPTIONS['SET_LOOP_VAR'] && !empty($v)) $this->setvar($k, 1);
+				if (($this->_arrvars[$k] = $this->_arrayBuild($v)) == false) {
+					vlibTemplateError::raiseError('VT_WARNING_INVALID_ARR', WARNING, $k);
+				} else {
+					$this->vars['_'.$k.'_num'] = count($v);
+				}
+			}
+			return true;
+		}
 
-        /**
-         * [** EXPERIMENTAL **]
-         * Function to create a loop from a Db result resource link.
-         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
-         * @param string $result link to a Db result resource
-         * @param string $db_type, type of db that the result resource belongs to.
-         * @return boolean true/false
-         * @access public
-         */
-        public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
-        {
-            /*
+		/**
+		 * [** EXPERIMENTAL **]
+		 * Function to create a loop from a Db result resource link.
+		 * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
+		 * @param string $result link to a Db result resource
+		 * @param string $db_type, type of db that the result resource belongs to.
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
+		{
+			/*
 			$db_type = strtoupper($db_type);
             if (!in_array($db_type, $this->allowed_loop_dbs)) {
                 vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB', WARNING, $db_type);
@@ -452,932 +496,936 @@
             $this->setLoop($loopname, $loop_arr);
             return true;
 			*/
-        }
+		}
 
-        /**
-         * Sets the name for the curent loop in the 3 step loop process.
-         * @param string $name string to define loop name
-         * @return boolean true/false
-         * @access public
-         */
-        public function newLoop($loopname)
-        {
-            if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {
-                $this->_currloopname[$loopname] = $loopname;
-                $this->_currloop[$loopname] = array();
-                return true;
-            } else {
-                return false;
-            }
-        }
+		/**
+		 * Sets the name for the curent loop in the 3 step loop process.
+		 * @param string $name string to define loop name
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function newLoop($loopname)
+		{
+			if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {
+				$this->_currloopname[$loopname] = $loopname;
+				$this->_currloop[$loopname] = array();
+				return true;
+			} else {
+				return false;
+			}
+		}
 
-        /**
-         * Adds a row to the current loop in the 3 step loop process.
-         * @param array $row loop row to add to current loop
-         * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().
-         * @return boolean true/false
-         * @access public
-         */
-        public function addRow($row, $loopname = null)
-        {
-            if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
+		/**
+		 * Adds a row to the current loop in the 3 step loop process.
+		 * @param array $row loop row to add to current loop
+		 * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function addRow($row, $loopname = null)
+		{
+			if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
 
-            if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
-                vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
-                return false;
-            }
-            if (is_array($row)) {
-                $this->_currloop[$loopname][] = $row;
-                return true;
-            } else {
-                return false;
-            }
-        }
+			if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
+				vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
+				return false;
+			}
+			if (is_array($row)) {
+				$this->_currloop[$loopname][] = $row;
+				return true;
+			} else {
+				return false;
+			}
+		}
 
-        /**
-         * Completes the 3 step loop process. This assigns the rows and resets
-         * the variables used.
-         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
-         * @return boolean true/false
-         * @access public
-         */
-        public function addLoop($loopname = null)
-        {
-            if ($loopname == null) { // add last loop used
-                if (!empty($this->_currloop)) {
-                    foreach ($this->_currloop as $k => $v) {
-                        $this->setLoop($k, $v);
-                        unset($this->_currloop[$k]);
-                    }
-                    $this->_currloopname = array();
-                    return true;
-                } else {
-                    return false;
-                }
-            } elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked
-                    vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
-                    return false;
-            } else { // add a specific loop
-                $this->setLoop($loopname, $this->_currloop[$loopname]);
-                unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);
-            }
-            return true;
-        }
+		/**
+		 * Completes the 3 step loop process. This assigns the rows and resets
+		 * the variables used.
+		 * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function addLoop($loopname = null)
+		{
+			if ($loopname == null) { // add last loop used
+				if (!empty($this->_currloop)) {
+					foreach ($this->_currloop as $k => $v) {
+						$this->setLoop($k, $v);
+						unset($this->_currloop[$k]);
+					}
+					$this->_currloopname = array();
+					return true;
+				} else {
+					return false;
+				}
+			} elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked
+				vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
+				return false;
+			} else { // add a specific loop
+				$this->setLoop($loopname, $this->_currloop[$loopname]);
+				unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);
+			}
+			return true;
+		}
 
-        /**
-         * Unsets a loop which has already been set.
-         * Can only unset top level loops.
-         * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])
-         * @return boolean true/false returns true unless called with 0 params
-         * @access public
-         */
-        public function unsetLoop()
-        {
-            $num_args = func_num_args();
-            if ($num_args < 1) return false;
+		/**
+		 * Unsets a loop which has already been set.
+		 * Can only unset top level loops.
+		 * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])
+		 * @return boolean true/false returns true unless called with 0 params
+		 * @access public
+		 */
+		public function unsetLoop()
+		{
+			$num_args = func_num_args();
+			if ($num_args < 1) return false;
 
-            for ($i = 0; $i < $num_args; $i++) {
-                $var = func_get_arg($i);
-                if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-                if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;
-                unset($this->_arrvars[$var]);
-            }
-            return true;
-        }
+			for ($i = 0; $i < $num_args; $i++) {
+				$var = func_get_arg($i);
+				if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
+				if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;
+				unset($this->_arrvars[$var]);
+			}
+			return true;
+		}
 
-        /**
-         * Resets the vlibTemplate object. After using vlibTemplate::reset() you must
-         * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.
-         * @return boolean true
-         * @access public
-         */
-        public function reset()
-        {
-            $this->clearVars();
-            $this->clearLoops();
-            $this->_tmplfilename = null;
-            $this->_tmplfile = null;
-            $this->_tmplfilep = null;
-            $this->_tmploutput = null;
-            $this->_parsed = false;
-            $this->_unknowns = array();
-            $this->_firstparsetime = null;
-            $this->_totalparsetime = null;
-            $this->_currloopname = null;
-            $this->_currloop = array();
-            return true;
-        }
+		/**
+		 * Resets the vlibTemplate object. After using vlibTemplate::reset() you must
+		 * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.
+		 * @return boolean true
+		 * @access public
+		 */
+		public function reset()
+		{
+			$this->clearVars();
+			$this->clearLoops();
+			$this->_tmplfilename = null;
+			$this->_tmplfile = null;
+			$this->_tmplfilep = null;
+			$this->_tmploutput = null;
+			$this->_parsed = false;
+			$this->_unknowns = array();
+			$this->_firstparsetime = null;
+			$this->_totalparsetime = null;
+			$this->_currloopname = null;
+			$this->_currloop = array();
+			return true;
+		}
 
-        /**
-         * Unsets all variables in the template
-         * @return boolean true
-         * @access public
-         */
-        public function clearVars()
-        {
-            $this->_vars = array();
-            return true;
-        }
+		/**
+		 * Unsets all variables in the template
+		 * @return boolean true
+		 * @access public
+		 */
+		public function clearVars()
+		{
+			$this->_vars = array();
+			return true;
+		}
 
-        /**
-         * Unsets all loops in the template
-         * @return boolean true
-         * @access public
-         */
-        public function clearLoops()
-        {
-            $this->_arrvars = array();
-            $this->_currloopname = null;
-            $this->_currloop = array();
-            return true;
-        }
+		/**
+		 * Unsets all loops in the template
+		 * @return boolean true
+		 * @access public
+		 */
+		public function clearLoops()
+		{
+			$this->_arrvars = array();
+			$this->_currloopname = null;
+			$this->_currloop = array();
+			return true;
+		}
 
-        /**
-         * Unsets all variables and loops set using setVar/Loop()
-         * @return boolean true
-         * @access public
-         */
-        public function clearAll()
-        {
-            $this->clearVars();
-            $this->clearLoops();
-            return true;
-        }
+		/**
+		 * Unsets all variables and loops set using setVar/Loop()
+		 * @return boolean true
+		 * @access public
+		 */
+		public function clearAll()
+		{
+			$this->clearVars();
+			$this->clearLoops();
+			return true;
+		}
 
-        /**
-         * Returns true if unknowns were found after parsing.
-         * Function MUST be called AFTER one of the parsing functions to have any relevance.
-         * @return boolean true/false
-         * @access public
-         */
-        public function unknownsExist()
-        {
-            return (!empty($this->_unknowns));
-        }
+		/**
+		 * Returns true if unknowns were found after parsing.
+		 * Function MUST be called AFTER one of the parsing functions to have any relevance.
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function unknownsExist()
+		{
+			return !empty($this->_unknowns);
+		}
 
-        /**
-         * Alias for unknownsExist.
-         * @access public
-         */
-        public function unknowns()
-        {
-            return $this->unknownsExist();
-        }
+		/**
+		 * Alias for unknownsExist.
+		 * @access public
+		 */
+		public function unknowns()
+		{
+			return $this->unknownsExist();
+		}
 
-        /**
-         * Returns an array of all unknown vars found when parsing.
-         * This function is only relevant after parsing a document.
-         * @return array
-         * @access public
-         */
-        public function getUnknowns()
-        {
-            return $this->_unknowns;
-        }
+		/**
+		 * Returns an array of all unknown vars found when parsing.
+		 * This function is only relevant after parsing a document.
+		 * @return array
+		 * @access public
+		 */
+		public function getUnknowns()
+		{
+			return $this->_unknowns;
+		}
 
-        /**
-          * Sets how you want to handle variables that were found in the
-         * template but not set in vlibTemplate using vlibTemplate::setVar().
-         * @param  string $arg ignore, remove, print, leave or comment
-         * @return boolean
-         * @access public
-         */
-        public function setUnknowns($arg)
-        {
-            $arg = strtolower(trim($arg));
-            if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {
-                $this->OPTIONS['UNKNOWNS'] = $arg;
-                return true;
-            }
-            return false;
-        }
+		/**
+		 * Sets how you want to handle variables that were found in the
+		 * template but not set in vlibTemplate using vlibTemplate::setVar().
+		 * @param  string $arg ignore, remove, print, leave or comment
+		 * @return boolean
+		 * @access public
+		 */
+		public function setUnknowns($arg)
+		{
+			$arg = strtolower(trim($arg));
+			if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {
+				$this->OPTIONS['UNKNOWNS'] = $arg;
+				return true;
+			}
+			return false;
+		}
 
-        /**
-         * function sets the paths to use when including files.
-         * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);
-         * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');
-         * with as many paths as you like.
-         * if this function is called without any arguments, it will just delete any previously set paths.
-         *
-         * @param string path (mulitple)
-         * @return bool success
-         * @access public
-         */
-        public function setPath()
-        {
-            $num_args = func_num_args();
-            if ($num_args < 1) {
-                $this->OPTIONS['INCLUDE_PATHS'] = array();
-                return true;
-            }
-            for ($i = 0; $i < $num_args; $i++) {
-                $thispath = func_get_arg($i);
-                array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));
-            }
-            return true;
-        }
+		/**
+		 * function sets the paths to use when including files.
+		 * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);
+		 * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');
+		 * with as many paths as you like.
+		 * if this function is called without any arguments, it will just delete any previously set paths.
+		 *
+		 * @param string path (mulitple)
+		 * @return bool success
+		 * @access public
+		 */
+		public function setPath()
+		{
+			$num_args = func_num_args();
+			if ($num_args < 1) {
+				$this->OPTIONS['INCLUDE_PATHS'] = array();
+				return true;
+			}
+			for ($i = 0; $i < $num_args; $i++) {
+				$thispath = func_get_arg($i);
+				array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));
+			}
+			return true;
+		}
 
-        /**
-         * After using one of the parse functions, this will allow you
-         * access the time taken to parse the template.
-         * see OPTION 'TIME_PARSE'.
-         *
-         * @return float time taken to parse template
-         * @access public
-         */
-        public function getParseTime()
-        {
-            if ($this->OPTIONS['TIME_PARSE'] && $this->_parsed) {
-                return $this->_totalparsetime;
-            }
-            return false;
-        }
+		/**
+		 * After using one of the parse functions, this will allow you
+		 * access the time taken to parse the template.
+		 * see OPTION 'TIME_PARSE'.
+		 *
+		 * @return float time taken to parse template
+		 * @access public
+		 */
+		public function getParseTime()
+		{
+			if ($this->OPTIONS['TIME_PARSE'] && $this->_parsed) {
+				return $this->_totalparsetime;
+			}
+			return false;
+		}
 
 
-        /**
-         * Identical to pparse() except that it uses output buffering w/ gz compression thus
-         * printing the output directly and compressed if poss.
-         * Will possibly if parsing a huge template.
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        public function fastPrint()
-        {
-            $ret = $this->_parse('ob_gzhandler');
-            print($this->_tmploutput);
-            return $ret;
-        }
+		/**
+		 * Identical to pparse() except that it uses output buffering w/ gz compression thus
+		 * printing the output directly and compressed if poss.
+		 * Will possibly if parsing a huge template.
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		public function fastPrint()
+		{
+			$ret = $this->_parse('ob_gzhandler');
+			print($this->_tmploutput);
+			return $ret;
+		}
 
 
-        /**
-         * Calls parse, and then prints out $this->_tmploutput
-         * @access public
-         * @return boolean true/false
-         */
-        public function pparse()
-        {
-            if (!$this->_parsed) $this->_parse();
-            print($this->_tmploutput);
-            return true;
-        }
+		/**
+		 * Calls parse, and then prints out $this->_tmploutput
+		 * @access public
+		 * @return boolean true/false
+		 */
+		public function pparse()
+		{
+			if (!$this->_parsed) $this->_parse();
+			print($this->_tmploutput);
+			return true;
+		}
 
-        /**
-         * Alias for pparse()
-         * @access public
-         */
-        public function pprint()
-        {
-            return $this->pparse();
-        }
+		/**
+		 * Alias for pparse()
+		 * @access public
+		 */
+		public function pprint()
+		{
+			return $this->pparse();
+		}
 
 
-        /**
-         * Returns the parsed output, ready for printing, passing to mail() ...etc.
-         * Invokes $this->_parse() if template has not yet been parsed.
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        public function grab()
-        {
-            if (!$this->_parsed) $this->_parse();
-            return $this->_tmploutput;
-        }
+		/**
+		 * Returns the parsed output, ready for printing, passing to mail() ...etc.
+		 * Invokes $this->_parse() if template has not yet been parsed.
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		public function grab()
+		{
+			if (!$this->_parsed) $this->_parse();
+			return $this->_tmploutput;
+		}
 
-        /*-----------------------------------------------------------------------------\
+		/*-----------------------------------------------------------------------------\
         |                           private functions                                  |
         \-----------------------------------------------------------------------------*/
 
-        /**
-         * vlibTemplate constructor.
-         * if $tmplfile has been passed to it, it will send to $this->newTemplate()
-         * @param string $tmplfile full path to template file
-         * @param array $options see above
-         * @return boolean true/false
-         * @access private
-         */
-        public function __construct($tmplfile = null, $options = null)
-        {
-            if (is_array($tmplfile) && $options == null) {
-                $options = $tmplfile;
-                unset($tmplfile);
-            }
+		/**
+		 * vlibTemplate constructor.
+		 * if $tmplfile has been passed to it, it will send to $this->newTemplate()
+		 * @param string $tmplfile full path to template file
+		 * @param array $options see above
+		 * @return boolean true/false
+		 * @access private
+		 */
+		public function __construct($tmplfile = null, $options = null)
+		{
+			if (is_array($tmplfile) && $options == null) {
+				$options = $tmplfile;
+				unset($tmplfile);
+			}
 
-            $this->VLIBTEMPLATE_ROOT = dirname(realpath(__FILE__));
+			$this->VLIBTEMPLATE_ROOT = dirname(realpath(__FILE__));
 
-            if (is_array(vlibIni::vlibTemplate())) {
-                foreach (vlibIni::vlibTemplate() as $name => $val) {
-                    $this->OPTIONS[$name] = $val;
-                }
-            }
+			if (is_array(vlibIni::vlibTemplate())) {
+				foreach (vlibIni::vlibTemplate() as $name => $val) {
+					$this->OPTIONS[$name] = $val;
+				}
+			}
 
-            if (is_array($options)) {
-                foreach($options as $key => $val) {
-                    $key = strtoupper($key);
-                    if ($key == 'PATH') {
-                        $this->setPath($val);
-                    } else {
-                        $this->_setOption($key, strtolower($val));
-                    }
-                }
-            }
-            if($tmplfile) $this->newTemplate($tmplfile);
-            if ($this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setContextVars();
-            return true;
-        }
+			if (is_array($options)) {
+				foreach($options as $key => $val) {
+					$key = strtoupper($key);
+					if ($key == 'PATH') {
+						$this->setPath($val);
+					} else {
+						$this->_setOption($key, strtolower($val));
+					}
+				}
+			}
+			if($tmplfile) $this->newTemplate($tmplfile);
+			if ($this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setContextVars();
+			return true;
+		}
 
-        /**
-         * function returns the text from the file, or if we're using cache, the text
-         * from the cache file. MUST RETURN DATA.
-         * @param string tmplfile contains path to template file
-         * @param do_eval used for included files. If set then this function must do the eval()'ing.
-         * @access private
-         * @return mixed data/string or boolean
-         */
-        private function _getData ($tmplfile, $do_eval=false)
-        {
-            //* check the current file depth
-            if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
-                return;
-            } else {
-                if ($this->_debug){
-                    array_push ($this->_debugIncludedfiles, $tmplfile);
-                }
-                if ($do_eval) {
-                    array_push($this->_currentincludedir, dirname($tmplfile));
-                    $this->_includedepth++;
-                }
-            }
+		/**
+		 * function returns the text from the file, or if we're using cache, the text
+		 * from the cache file. MUST RETURN DATA.
+		 * @param string tmplfile contains path to template file
+		 * @param do_eval used for included files. If set then this function must do the eval()'ing.
+		 * @access private
+		 * @return mixed data/string or boolean
+		 */
+		private function _getData ($tmplfile, $do_eval=false)
+		{
+			//* check the current file depth
+			if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
+				return;
+			} else {
+				if ($this->_debug){
+					array_push($this->_debugIncludedfiles, $tmplfile);
+				}
+				if ($do_eval) {
+					array_push($this->_currentincludedir, dirname($tmplfile));
+					$this->_includedepth++;
+				}
+			}
 
 
-            if($this->_cache && $this->_checkCache($tmplfile)) { //* cache exists so lets use it
-                $data = fread($fp = fopen($this->_cachefile, 'r'), filesize($this->_cachefile));
-                fclose($fp);
-            } else { //* no cache lets parse the file
-                $data = fread($fp = fopen($tmplfile, 'r'), filesize($tmplfile));
-                fclose($fp);
+			if($this->_cache && $this->_checkCache($tmplfile)) { //* cache exists so lets use it
+				$data = fread($fp = fopen($this->_cachefile, 'r'), filesize($this->_cachefile));
+				fclose($fp);
+			} else { //* no cache lets parse the file
+				$data = fread($fp = fopen($tmplfile, 'r'), filesize($tmplfile));
+				fclose($fp);
 
-                $regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*';
-                $regex.= 'tmpl_([\w]+)\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value|file)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')?';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:>|\/>|}|-->){1}';
-                $regex.= '([\r\n|\n|\r])?/i';
-                $data = preg_replace_callback($regex, array($this, _parseTag), $data);
+				$regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*';
+				$regex.= 'tmpl_([\w]+)\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value|file)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')?';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:>|\/>|}|-->){1}';
+				$regex.= '([\r\n|\n|\r])?/i';
+				$data = preg_replace_callback($regex, array($this, _parseTag), $data);
 
-                if ($this->_cache) { // add cache if need be
-                    $this->_createCache($data);
-                }
-            }
+				if ($this->_cache) { // add cache if need be
+					$this->_createCache($data);
+				}
+			}
 
-            //* now we must parse the $data and check for any <tmpl_include>'s
-            if ($this->_debug) $this->doDebugWarnings(file($tmplfile), $tmplfile);
+			//* now we must parse the $data and check for any <tmpl_include>'s
+			if ($this->_debug) $this->doDebugWarnings(file($tmplfile), $tmplfile);
 
-            if ($do_eval) {
-                $success = @eval('?>'.$data.'<?php return 1;');
-                $this->_includedepth--;
-                array_pop($this->_currentincludedir);
-                return $success;
-            } else {
-                return $data;
-            }
-        }
+			if ($do_eval) {
+				$success = @eval('?>'.$data.'<?php return 1;');
+				$this->_includedepth--;
+				array_pop($this->_currentincludedir);
+				return $success;
+			} else {
+				return $data;
+			}
+		}
 
-        /**
-         * Searches for all possible instances of file { $file }
-         * @param string $file path of file we're looking for
-         * @access private
-         * @return mixed fullpath to file or boolean false
-         */
-        private function _fileSearch($file) 
-        {
-			
+		/**
+		 * Searches for all possible instances of file { $file }
+		 * @param string $file path of file we're looking for
+		 * @access private
+		 * @return mixed fullpath to file or boolean false
+		 */
+		private function _fileSearch($file)
+		{
+
 			$filename = basename($file);
-            $filepath = dirname($file);
-			
+			$filepath = dirname($file);
+
 			if(isset($_SESSION['s']['module']['name']) && isset($_SESSION['s']['theme'])) {
 				if(is_file(ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates/'.$_SESSION['s']['module']['name'].'/'.$filename)) {
 					return ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates/'.$_SESSION['s']['module']['name'].'/'.$filename;
 				}
 			}
 
-            //* check fullpath first..
-            $fullpath = $filepath.'/'.$filename;
-            if (is_file($fullpath)) return $fullpath;
+			//* check fullpath first..
+			$fullpath = $filepath.'/'.$filename;
+			if (is_file($fullpath)) return $fullpath;
 
-            //* ..then check for relative path for current directory..
-            if (!empty($this->_currentincludedir)) {
-                $currdir = $this->_currentincludedir[(count($this->_currentincludedir) -1)];
-                $relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
-                if (is_file($relativepath)) {
-                    array_push ($this->_currentincludedir, dirname($relativepath));
-                    return $relativepath;
-                }
-            }
+			//* ..then check for relative path for current directory..
+			if (!empty($this->_currentincludedir)) {
+				$currdir = $this->_currentincludedir[(count($this->_currentincludedir) -1)];
+				$relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
+				if (is_file($relativepath)) {
+					array_push($this->_currentincludedir, dirname($relativepath));
+					return $relativepath;
+				}
+			}
 
-            //* ..then check for relative path for all additional given paths..
-            if (!empty($this->OPTIONS['INCLUDE_PATHS'])) {
-                foreach ($this->OPTIONS['INCLUDE_PATHS'] as $currdir) {
-                    $relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
-                    if (is_file($relativepath)) {
-                        return $relativepath;
-                    }
-                }
-            }
+			//* ..then check for relative path for all additional given paths..
+			if (!empty($this->OPTIONS['INCLUDE_PATHS'])) {
+				foreach ($this->OPTIONS['INCLUDE_PATHS'] as $currdir) {
+					$relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
+					if (is_file($relativepath)) {
+						return $relativepath;
+					}
+				}
+			}
 
-            //* ..then check path from TEMPLATE_DIR..
-            if (!empty($this->OPTIONS['TEMPLATE_DIR'])) {
-                $fullpath = realpath($this->OPTIONS['TEMPLATE_DIR'].'/'.$filepath.'/'.$filename);
-                if (is_file($fullpath)) return $fullpath;
-            }
+			//* ..then check path from TEMPLATE_DIR..
+			if (!empty($this->OPTIONS['TEMPLATE_DIR'])) {
+				$fullpath = realpath($this->OPTIONS['TEMPLATE_DIR'].'/'.$filepath.'/'.$filename);
+				if (is_file($fullpath)) return $fullpath;
+			}
 
-            //* ..then check relative path from executing php script..
-            $fullpath = realpath($filepath.'/'.$filename);
-            if (is_file($fullpath)) return $fullpath;
+			//* ..then check relative path from executing php script..
+			$fullpath = realpath($filepath.'/'.$filename);
+			if (is_file($fullpath)) return $fullpath;
 
-            //* ..then check path from template file.
-            if (!empty($this->VLIBTEMPLATE_ROOT)) {
-                $fullpath = realpath($this->VLIBTEMPLATE_ROOT.'/'.$filepath.'/'.$filename);
-                if (is_file($fullpath)) return $fullpath;
-            }
+			//* ..then check path from template file.
+			if (!empty($this->VLIBTEMPLATE_ROOT)) {
+				$fullpath = realpath($this->VLIBTEMPLATE_ROOT.'/'.$filepath.'/'.$filename);
+				if (is_file($fullpath)) return $fullpath;
+			}
 
-            return false; // uh oh, file not found
-        }
+			return false; // uh oh, file not found
+		}
 
-        /**
-         * Modifies the array $arr to add Template variables, __FIRST__, __LAST__ ..etc
-         * if $this->OPTIONS['LOOP_CONTEXT_VARS'] is true.
-         * Used by $this->setloop().
-         * @param array $arr
-         * @return array new look array
-         * @access private
-         */
-        private function _arrayBuild($arr)
-        {
-            if (is_array($arr) && !empty($arr)) {
-                $arr = array_values($arr); // to prevent problems w/ non sequential arrays
-                for ($i = 0; $i < count($arr); $i++) {
-                    if(!is_array($arr[$i]))  return false;
-                    foreach ($arr[$i] as $k => $v) {
-                        unset($arr[$i][$k]);
-                        if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
-                        if (preg_match('/^[0-9]+$/', $k)) $k = '_'.$k;
+		/**
+		 * Modifies the array $arr to add Template variables, __FIRST__, __LAST__ ..etc
+		 * if $this->OPTIONS['LOOP_CONTEXT_VARS'] is true.
+		 * Used by $this->setloop().
+		 * @param array $arr
+		 * @return array new look array
+		 * @access private
+		 */
+		private function _arrayBuild($arr)
+		{
+			if (is_array($arr) && !empty($arr)) {
+				$arr = array_values($arr); // to prevent problems w/ non sequential arrays
+				for ($i = 0; $i < count($arr); $i++) {
+					if(!is_array($arr[$i]))  return false;
+					foreach ($arr[$i] as $k => $v) {
+						unset($arr[$i][$k]);
+						if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
+						if (preg_match('/^[0-9]+$/', $k)) $k = '_'.$k;
 
-                        if (is_array($v)) {
-                            if (($arr[$i][$k] = $this->_arrayBuild($v)) == false) return false;
-                        } else { // reinsert the var
-                            $arr[$i][$k] = $v;
-                        }
-                    }
-                    if ($this->OPTIONS['LOOP_CONTEXT_VARS']) {
-                        if ($i == 0) $arr[$i]['__FIRST__'] = true;
-                        if (($i + 1) == count($arr)) $arr[$i]['__LAST__'] = true;
-                        if ($i != 0 && (($i + 1) < count($arr))) $arr[$i]['__INNER__'] = true;
-                        if (is_int(($i+1) / 2))  $arr[$i]['__EVEN__'] = true;
-                        if (!is_int(($i+1) / 2))  $arr[$i]['__ODD__'] = true;
-                        $arr[$i]['__ROWNUM__'] = ($i + 1);
-                    }
-                }
-                return $arr;
-            } elseif (empty($arr)) {
-                return true;
-            }
-        }
+						if (is_array($v)) {
+							if (($arr[$i][$k] = $this->_arrayBuild($v)) == false) return false;
+						} else { // reinsert the var
+							$arr[$i][$k] = $v;
+						}
+					}
+					if ($this->OPTIONS['LOOP_CONTEXT_VARS']) {
+						if ($i == 0) $arr[$i]['__FIRST__'] = true;
+						if (($i + 1) == count($arr)) $arr[$i]['__LAST__'] = true;
+						if ($i != 0 && (($i + 1) < count($arr))) $arr[$i]['__INNER__'] = true;
+						if (is_int(($i+1) / 2))  $arr[$i]['__EVEN__'] = true;
+						if (!is_int(($i+1) / 2))  $arr[$i]['__ODD__'] = true;
+						$arr[$i]['__ROWNUM__'] = ($i + 1);
+					}
+				}
+				return $arr;
+			} elseif (empty($arr)) {
+				return true;
+			}
+		}
 
-        /**
-         * returns a string used for parsing in tmpl_if statements.
-         * @param string $varname
-         * @param string $value
-         * @param string $op
-         * @param string $namespace current namespace
-         * @access private
-         * @return string used for eval'ing
-         */
-        private function _parseIf($varname, $value = null, $op = null, $namespace = null)
-        {
-            if (isset($namespace)) $namespace = substr($namespace, 0, -1);
-            $comp_str = ''; // used for extended if statements
+		/**
+		 * returns a string used for parsing in tmpl_if statements.
+		 * @param string $varname
+		 * @param string $value
+		 * @param string $op
+		 * @param string $namespace current namespace
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		private function _parseIf($varname, $value = null, $op = null, $namespace = null)
+		{
+			if (isset($namespace)) $namespace = substr($namespace, 0, -1);
+			$comp_str = ''; // used for extended if statements
 
-            // work out what to put on the end id value="whatever" is used
-            if (isset($value)) {
+			// work out what to put on the end id value="whatever" is used
+			if (isset($value)) {
 
-                // add the correct operator depending on whether it's been specified or not
-                if (!empty($op)) {
-                    if (in_array($op, $this->allowed_if_ops)) {
-                        $comp_str .= $op;
-                    } else {
-                        vlibTemplateError::raiseError('VT_WARNING_INVALID_IF_OP', WARNING, $op);
-                    }
-                } else {
-                    $comp_str .= '==';
-                }
+				// add the correct operator depending on whether it's been specified or not
+				if (!empty($op)) {
+					if (in_array($op, $this->allowed_if_ops)) {
+						$comp_str .= $op;
+					} else {
+						vlibTemplateError::raiseError('VT_WARNING_INVALID_IF_OP', WARNING, $op);
+					}
+				} else {
+					$comp_str .= '==';
+				}
 
-                // now we add the value, if it's numeric, then we leave the quotes off
-                if (is_numeric($value)) {
-                    $comp_str .= $value;
-                } else {
-                    $comp_str .= '\''.$value.'\'';
-                }
-            }
+				// now we add the value, if it's numeric, then we leave the quotes off
+				if (is_numeric($value)) {
+					$comp_str .= $value;
+				} else {
+					$comp_str .= '\''.$value.'\'';
+				}
+			}
 
-            if (count($this->_namespace) == 0 || $namespace == 'global') return '$this->_vars[\''.$varname.'\']'.$comp_str;
-            $retstr = '$this->_arrvars';
-            $numnamespaces = count($this->_namespace);
-            for ($i=0; $i < $numnamespaces; $i++) {
-                if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
-                    $retstr .= "['".$namespace."'][\$_".$i."]";
-                    break 1;
-                } else {
-                    $retstr .= "['".$this->_namespace[$i]."'][\$_".$i."]";
-                }
-            }
-            if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
-                return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
-            } else {
-                return $retstr."['".$varname."']".$comp_str;
-            }
-        }
+			if (count($this->_namespace) == 0 || $namespace == 'global') return '$this->_vars[\''.$varname.'\']'.$comp_str;
+			$retstr = '$this->_arrvars';
+			$numnamespaces = count($this->_namespace);
+			for ($i=0; $i < $numnamespaces; $i++) {
+				if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
+					$retstr .= "['".$namespace."'][\$_".$i."]";
+					break 1;
+				} else {
+					$retstr .= "['".$this->_namespace[$i]."'][\$_".$i."]";
+				}
+			}
+			if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
+				return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
+			} else {
+				return $retstr."['".$varname."']".$comp_str;
+			}
+		}
 
 
-        /**
-         * returns a string used for parsing in tmpl_loop statements.
-         * @param string $varname
-         * @access private
-         * @return string used for eval'ing
-         */
-        private function _parseLoop ($varname)
-        {
-            array_push($this->_namespace, $varname);
-            $tempvar = count($this->_namespace) - 1;
-            $retstr = "for (\$_".$tempvar."=0 ; \$_".$tempvar." < count(\$this->_arrvars";
-            for ($i=0; $i < count($this->_namespace); $i++) {
-                $retstr .= "['".$this->_namespace[$i]."']";
-                if ($this->_namespace[$i] != $varname) $retstr .= "[\$_".$i."]";
-            }
-            return $retstr."); \$_".$tempvar."++) {";
-        }
+		/**
+		 * returns a string used for parsing in tmpl_loop statements.
+		 * @param string $varname
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		private function _parseLoop ($varname)
+		{
+			array_push($this->_namespace, $varname);
+			$tempvar = count($this->_namespace) - 1;
+			$retstr = "for (\$_".$tempvar."=0 ; \$_".$tempvar." < count(\$this->_arrvars";
+			for ($i=0; $i < count($this->_namespace); $i++) {
+				$retstr .= "['".$this->_namespace[$i]."']";
+				if ($this->_namespace[$i] != $varname) $retstr .= "[\$_".$i."]";
+			}
+			return $retstr."); \$_".$tempvar."++) {";
+		}
 
-        /**
-         * returns a string used for parsing in tmpl_var statements.
-         * @param string $wholetag
-         * @param string $tag
-         * @param string $varname
-         * @param string $escape
-         * @param string $format
-         * @param string $namespace
-         * @access private
-         * @return string used for eval'ing
-         */
-        private function _parseVar ($wholetag, $tag, $varname, $escape, $format, $namespace)
-        {
-            if (!empty($namespace)) $namespace = substr($namespace, 0, -1);
-            $wholetag = stripslashes($wholetag);
+		/**
+		 * returns a string used for parsing in tmpl_var statements.
+		 * @param string $wholetag
+		 * @param string $tag
+		 * @param string $varname
+		 * @param string $escape
+		 * @param string $format
+		 * @param string $namespace
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		private function _parseVar ($wholetag, $tag, $varname, $escape, $format, $namespace)
+		{
+			if (!empty($namespace)) $namespace = substr($namespace, 0, -1);
+			$wholetag = stripslashes($wholetag);
 
-            if (count($this->_namespace) == 0 || $namespace == 'global') {
-                $var1 = '$this->_vars[\''.$varname.'\']';
-            } else {
-                $var1build = "\$this->_arrvars";
-                $numnamespaces = count($this->_namespace);
-                for ($i=0; $i < $numnamespaces; $i++) {
-                    if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
-                        $var1build .= "['".$namespace."'][\$_".$i."]";
-                        break 1;
-                    } else {
-                        $var1build .= "['".$this->_namespace[$i]."'][\$_".$i."]";
-                    }
-                }
-                $var1 = $var1build . "['$varname']";
-                if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
-                    $var2 = '$this->_vars[\''.$varname.'\']';
-                }
-            }
+			if (count($this->_namespace) == 0 || $namespace == 'global') {
+				$var1 = '$this->_vars[\''.$varname.'\']';
+			} else {
+				$var1build = "\$this->_arrvars";
+				$numnamespaces = count($this->_namespace);
+				for ($i=0; $i < $numnamespaces; $i++) {
+					if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
+						$var1build .= "['".$namespace."'][\$_".$i."]";
+						break 1;
+					} else {
+						$var1build .= "['".$this->_namespace[$i]."'][\$_".$i."]";
+					}
+				}
+				$var1 = $var1build . "['$varname']";
+				if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
+					$var2 = '$this->_vars[\''.$varname.'\']';
+				}
+			}
 
-            $beforevar = '';
-            $aftervar  = '';
-            if (!empty($escape)&& isset($this->ESCAPE_TAGS[$escape])) {
-                $beforevar .= $this->ESCAPE_TAGS[$escape]['open'];
-                $aftervar   = $this->ESCAPE_TAGS[$escape]['close'] . $aftervar;
-            }
+			$beforevar = '';
+			$aftervar  = '';
+			if (!empty($escape)&& isset($this->ESCAPE_TAGS[$escape])) {
+				$beforevar .= $this->ESCAPE_TAGS[$escape]['open'];
+				$aftervar   = $this->ESCAPE_TAGS[$escape]['close'] . $aftervar;
+			}
 
-            if (!empty($format)&& isset($this->FORMAT_TAGS[$format])) {
-                $beforevar .= $this->FORMAT_TAGS[$format]['open'];
-                $aftervar   = $this->FORMAT_TAGS[$format]['close'] . $aftervar;
-            }
+			if (!empty($format)&& isset($this->FORMAT_TAGS[$format])) {
+				$beforevar .= $this->FORMAT_TAGS[$format]['open'];
+				$aftervar   = $this->FORMAT_TAGS[$format]['close'] . $aftervar;
+			}
 
-            //* build return values
-            $retstr  = 'if ('.$var1.' !== null) { ';
-            $retstr .= 'print('.$beforevar.$var1.$aftervar.'); ';
-            $retstr .= '}';
+			//* build return values
+			$retstr  = 'if ('.$var1.' !== null) { ';
+			$retstr .= 'print('.$beforevar.$var1.$aftervar.'); ';
+			$retstr .= '}';
 
-            if (@$var2) {
-                $retstr .= ' elseif ('.$var2.' !== null) { ';
-                $retstr .= 'print('.$beforevar.$var2.$aftervar.'); ';
-                $retstr .= '}';
-            }
+			if (@$var2) {
+				$retstr .= ' elseif ('.$var2.' !== null) { ';
+				$retstr .= 'print('.$beforevar.$var2.$aftervar.'); ';
+				$retstr .= '}';
+			}
 
-            switch (strtolower($this->OPTIONS['UNKNOWNS'])) {
-                case 'comment':
-                    $comment = addcslashes('<!-- unknown variable '.preg_replace('/<!--|-->/', '', $wholetag).'//-->', '"');
-                    $retstr .= ' else { print("'.$comment.'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
+			switch (strtolower($this->OPTIONS['UNKNOWNS'])) {
+			case 'comment':
+				$comment = addcslashes('<!-- unknown variable '.preg_replace('/<!--|-->/', '', $wholetag).'//-->', '"');
+				$retstr .= ' else { print("'.$comment.'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
 
-                case 'leave':
-                    $retstr .= ' else { print("'.addcslashes($wholetag, '"').'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
+			case 'leave':
+				$retstr .= ' else { print("'.addcslashes($wholetag, '"').'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
 
-                case 'print':
-                    $retstr .= ' else { print("'.htmlspecialchars($wholetag, ENT_QUOTES).'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
+			case 'print':
+				$retstr .= ' else { print("'.htmlspecialchars($wholetag, ENT_QUOTES).'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
 
-                case 'ignore':
-                    return $retstr;
+			case 'ignore':
+				return $retstr;
 
-                case 'remove':
-                default:
-                    $retstr .= ' else { $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
+			case 'remove':
+			default:
+				$retstr .= ' else { $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
 
-            }
-        }
+			}
+		}
 
-        /**
-         * takes values from preg_replace in $this->_intparse() and determines
-         * the replace string.
-         *
-         * @param array $args array of all matches found by preg_replace
-         * @access private
-         * @return string replace values
-         */
-        private function _parseTag ($args)
-        {
-            $wholetag = $args[0];
-            $openclose = $args[1];
-            $tag = strtolower($args[2]);
-            $newline = $args[9];
+		/**
+		 * takes values from preg_replace in $this->_intparse() and determines
+		 * the replace string.
+		 *
+		 * @param array $args array of all matches found by preg_replace
+		 * @access private
+		 * @return string replace values
+		 */
+		private function _parseTag ($args)
+		{
+			$wholetag = $args[0];
+			$openclose = $args[1];
+			$tag = strtolower($args[2]);
+			$newline = $args[9];
 
-            if ($tag == 'else') return '<?php } else { ?>'.$newline;
-            if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags
+			if ($tag == 'else') return '<?php } else { ?>'.$newline;
+			if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags
 
-            if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) {
-                if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
-                if ($tag == 'comment' || $tag == 'endcomment') {
-                    return '<?php */ ?>'.$newline;
-                } else {
-                    return '<?php } ?>'.$newline;
-                }
-            }
+			if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) {
+				if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
+				if ($tag == 'comment' || $tag == 'endcomment') {
+					return '<?php */ ?>'.$newline;
+				} else {
+					return '<?php } ?>'.$newline;
+				}
+			}
 
-            //* arrange attributes
-            for ($i=3; $i < 8; $i=($i+2)) {
-                if (empty($args[$i]) && empty($args[($i+1)])) break;
-                $key = (empty($args[$i])) ? 'name' : strtolower($args[$i]);
-                if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file';
-                $$key = $args[($i+1)];
-            }
+			//* arrange attributes
+			for ($i=3; $i < 8; $i=($i+2)) {
+				if (empty($args[$i]) && empty($args[($i+1)])) break;
+				$key = (empty($args[$i])) ? 'name' : strtolower($args[$i]);
+				if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file';
+				$$key = $args[($i+1)];
+			}
 
-            $var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
+			$var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
 
-            if ($this->_debug && !empty($var)) {
-                if (preg_match("/^global\.([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) $var2 = $matches[1];
-                if (empty($this->_debugTemplatevars[$tag])) $this->_debugTemplatevars[$tag] = array();
-                if (!isset($var2)) $var2 = $var;
-                if (!in_array($var2, $this->_debugTemplatevars[$tag])) array_push($this->_debugTemplatevars[$tag], $var2);
-            }
+			if ($this->_debug && !empty($var)) {
+				if (preg_match("/^global\.([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) $var2 = $matches[1];
+				if (empty($this->_debugTemplatevars[$tag])) $this->_debugTemplatevars[$tag] = array();
+				if (!isset($var2)) $var2 = $var;
+				if (!in_array($var2, $this->_debugTemplatevars[$tag])) array_push($this->_debugTemplatevars[$tag], $var2);
+			}
 
-            if (preg_match("/^([A-Za-z_]+[_A-Za-z0-9]*(\.)+)?([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) {
-                $var = $matches[3];
-                $namespace = $matches[1];
-            }
+			if (preg_match("/^([A-Za-z_]+[_A-Za-z0-9]*(\.)+)?([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) {
+				$var = $matches[3];
+				$namespace = $matches[1];
+			}
 
 
-            //* return correct string (tag dependent)
-            switch ($tag) {
-                case 'var':
-                    if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
-                        $escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
-                    }
-                    return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace)." ?>$newline";
+			//* return correct string (tag dependent)
+			switch ($tag) {
+			case 'var':
+				if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
+					$escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
+				}
+				return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace)." ?>$newline";
 
-                case 'if':
-                    return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+			case 'if':
+				return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
 
-                case 'unless':
-                      return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+			case 'unless':
+				return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
 
-                case 'elseif':
-                      return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+			case 'elseif':
+				return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
 
-                case 'loop':
-                      return '<?php '. $this->_parseLoop($var) .'?>'.$newline;
+			case 'loop':
+				return '<?php '. $this->_parseLoop($var) .'?>'.$newline;
 
-                case 'comment':
-                    if (empty($var)) { // full open/close style comment
-                        return '<?php /* ?>'.$newline;
-                    } else { // just ignore tag if it was a one line comment
-                        return;
-                    }
+			case 'comment':
+				if (empty($var)) { // full open/close style comment
+					return '<?php /* ?>'.$newline;
+				} else { // just ignore tag if it was a one line comment
+					return;
+				}
 
-                case 'phpinclude':
-                	if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
-                    	return '<?php include(\''.$file.'\'); ?>'.$newline;
-                    }
+			case 'phpinclude':
+				if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
+					return '<?php include(\''.$file.'\'); ?>'.$newline;
+				}
 
-                case 'include':
-                    return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
-                
-                case 'dyninclude':
-                    return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
+			case 'include':
+				return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
 
-                default:
-                    if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));
-                break;
-            }
+			case 'dyninclude':
+				return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
 
-        }
+			default:
+				if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));
+				break;
+			}
 
-        /**
-         * Parses $this->_tmplfile into correct format for eval() to work
-         * Called by $this->_parse(), or $this->fastPrint, this replaces all <tmpl_*> references
-         * with their correct php representation, i.e. <tmpl_var title> becomes $this->vars['title']
-         * Sets final parsed file to $this->_tmplfilep.
-         *
-         * @access private
-         * @return boolean true/false
-         */
-        private function _intParse ()
-        {
-            //$mqrt = get_magic_quotes_runtime();
-            //set_magic_quotes_runtime(0);
-            $this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
-            //set_magic_quotes_runtime($mqrt);
-            return true;
-        }
+		}
 
-        /**
-         * Calls _intParse, and eval()s $this->tmplfilep
-         * and outputs the results to $this->tmploutput
-         *
-         * @param bool compress whether to compress contents
-         * @access private
-         * @return boolean true/false
-         */
-        private function _parse ($compress = '')
-        {
-            if (!$this->_parsed) {
-                if ($this->OPTIONS['TIME_PARSE']) $this->_firstparsetime = $this->_getMicroTime();
+		/**
+		 * Parses $this->_tmplfile into correct format for eval() to work
+		 * Called by $this->_parse(), or $this->fastPrint, this replaces all <tmpl_*> references
+		 * with their correct php representation, i.e. <tmpl_var title> becomes $this->vars['title']
+		 * Sets final parsed file to $this->_tmplfilep.
+		 *
+		 * @access private
+		 * @return boolean true/false
+		 */
+		private function _intParse ()
+		{
+			//$mqrt = get_magic_quotes_runtime();
+			//set_magic_quotes_runtime(0);
+			$this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
+			//set_magic_quotes_runtime($mqrt);
+			return true;
+		}
 
-                $this->_intParse();
-                $this->_parsed = true;
+		/**
+		 * Calls _intParse, and eval()s $this->tmplfilep
+		 * and outputs the results to $this->tmploutput
+		 *
+		 * @param bool compress whether to compress contents
+		 * @access private
+		 * @return boolean true/false
+		 */
+		private function _parse ($compress = '')
+		{
+			if (!$this->_parsed) {
+				if ($this->OPTIONS['TIME_PARSE']) $this->_firstparsetime = $this->_getMicroTime();
 
-                if ($this->OPTIONS['TIME_PARSE']) $this->_totalparsetime = ($this->_getMicroTime() - $this->_firstparsetime);
-                if ($this->OPTIONS['TIME_PARSE'] && $this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setVar('__PARSE_TIME__', $this->getParseTime());
-            }
-			
+				$this->_intParse();
+				$this->_parsed = true;
+
+				if ($this->OPTIONS['TIME_PARSE']) $this->_totalparsetime = ($this->_getMicroTime() - $this->_firstparsetime);
+				if ($this->OPTIONS['TIME_PARSE'] && $this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setVar('__PARSE_TIME__', $this->getParseTime());
+			}
+
 			// ob_start($compress);
-            ob_start();
+			ob_start();
 
-                array_push($this->_currentincludedir, dirname($this->_tmplfilename));
-                $this->_includedepth++;
-                $success = @eval($this->_tmplfilep);
-                $this->_includedepth--;
-                array_pop($this->_currentincludedir);
+			array_push($this->_currentincludedir, dirname($this->_tmplfilename));
+			$this->_includedepth++;
+			$success = @eval($this->_tmplfilep);
+			$this->_includedepth--;
+			array_pop($this->_currentincludedir);
 
-                if ($this->_debug) $this->doDebug();
-                if (!$success) vlibTemplateError::raiseError('VT_ERROR_PARSE', FATAL);
-                $this->_tmploutput .= ob_get_contents();
-            ob_end_clean();
-            return true;
-        }
+			if ($this->_debug) $this->doDebug();
+			if (!$success) vlibTemplateError::raiseError('VT_ERROR_PARSE', FATAL);
+			$this->_tmploutput .= ob_get_contents();
+			ob_end_clean();
+			return true;
+		}
 
-        /**
-         * Sets one or more of the boolean options 1/0, that control certain actions in the template.
-         * Use of this function:
-         * either: vlibTemplate::_setOptions(string option_name, bool option_val [, string option_name, bool option_val ..]);
-         * or      vlibTemplate::_setOptions(array);
-         *          with an associative array where the key is the option_name
-         *          and the value is the option_value.
-         *
-         * @param mixed (mulitple)
-         * @return bool true/false
-         * @access private
-         */
-        private function _setOption() 
-        {
-            $numargs = func_num_args();
-            if ($numargs < 1) {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                return false;
-            }
+		/**
+		 * Sets one or more of the boolean options 1/0, that control certain actions in the template.
+		 * Use of this function:
+		 * either: vlibTemplate::_setOptions(string option_name, bool option_val [, string option_name, bool option_val ..]);
+		 * or      vlibTemplate::_setOptions(array);
+		 *          with an associative array where the key is the option_name
+		 *          and the value is the option_value.
+		 *
+		 * @param mixed (mulitple)
+		 * @return bool true/false
+		 * @access private
+		 */
+		private function _setOption()
+		{
+			$numargs = func_num_args();
+			if ($numargs < 1) {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+				return false;
+			}
 
-            if ($numargs == 1) {
-                $options = func_get_arg(1);
-                if (is_array($options)) {
-                    foreach ($options as $k => $v) {
-                        if ($v != null) {
-                            if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
-                        } else {
-                            continue;
-                        }
-                    }
-                } else {
-                    vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                    return false;
-                }
-            }elseif (is_int($numargs / 2)) {
-                for ($i = 0; $i < $numargs; $i=($i+2)) {
-                    $k  = func_get_arg($i);
-                    $v = func_get_arg(($i+1));
-                    if ($v != null) {
-                        if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
-                    }
-                }
-            } else {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                return false;
-            }
-            return true;
-        }
+			if ($numargs == 1) {
+				$options = func_get_arg(1);
+				if (is_array($options)) {
+					foreach ($options as $k => $v) {
+						if ($v != null) {
+							if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
+						} else {
+							continue;
+						}
+					}
+				} else {
+					vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+					return false;
+				}
+			}elseif (is_int($numargs / 2)) {
+				for ($i = 0; $i < $numargs; $i=($i+2)) {
+					$k  = func_get_arg($i);
+					$v = func_get_arg(($i+1));
+					if ($v != null) {
+						if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
+					}
+				}
+			} else {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+				return false;
+			}
+			return true;
+		}
 
-        /**
-         * Used during parsing, this function sets an unknown var checking to see if it
-         * has been previously set.
-         * @param string var
-         * @access private
-         */
-        private function _setUnknown($var) 
-        {
-            if (!in_array($var, $this->_unknowns)) array_push($this->_unknowns, $var);
-        }
+		/**
+		 * Used during parsing, this function sets an unknown var checking to see if it
+		 * has been previously set.
+		 * @param string var
+		 * @access private
+		 */
+		private function _setUnknown($var)
+		{
+			if (!in_array($var, $this->_unknowns)) array_push($this->_unknowns, $var);
+		}
 
-        /**
-         * Returns microtime as a float number
-         * @return float microtime
-         * @access private
-         */
-        private function _getMicrotime() 
-        {
-            list($msec, $sec) = explode(' ',microtime());
-            return ((float)$msec + (float)$sec);
-        }
+		/**
+		 * Returns microtime as a float number
+		 * @return float microtime
+		 * @access private
+		 */
+		private function _getMicrotime()
+		{
+			list($msec, $sec) = explode(' ', microtime());
+			return (float)$msec + (float)$sec;
+		}
 
-        /**
-         * Returns str encoded to hex code.
-         * @param string str to be encoded
-         * @param bool true/false specify whether to use hex_entity
-         * @return string encoded in hex
-         * @access private
-         */
-        private  function _escape_hex($str = '', $entity = false) {
-            $prestr = $entity ? '&#x' : '%';
-            $poststr= $entity ? ';' : '';
-            for ($i=0; $i < strlen($str); $i++) {
-                $return .= $prestr.bin2hex($str[$i]).$poststr;
-            }
-            return $return;
-        }
+		/**
+		 * Returns str encoded to hex code.
+		 * @param string str to be encoded
+		 * @param bool true/false specify whether to use hex_entity
+		 * @return string encoded in hex
+		 * @access private
+		 */
+		private  function _escape_hex($str = '', $entity = false) {
+			$prestr = $entity ? '&#x' : '%';
+			$poststr= $entity ? ';' : '';
+			for ($i=0; $i < strlen($str); $i++) {
+				$return .= $prestr.bin2hex($str[$i]).$poststr;
+			}
+			return $return;
+		}
 
-    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+		/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     The following functions have no use and are included just so that if the user
     is making use of vlibTemplateCache functions, this doesn't crash when changed to
     vlibTemplate if the user is quickly bypassing the vlibTemplateCache class.
     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-        function clearCache()        {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'clearCache()');}
-        function recache()           {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'recache()');}
-        function setCacheLifeTime()  {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheLifeTime()');}
-        function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');}
-    } // << end class Def
+		function clearCache()        {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'clearCache()');}
 
-    //include_once (ISPC_CLASS_PATH.'/vlibTemplate/debug.php');
-    include_once (ISPC_CLASS_PATH.'/tpl_cache.inc.php');
+		function recache()           {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'recache()');}
+
+		function setCacheLifeTime()  {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheLifeTime()');}
+
+		function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');}
+
+	} // << end class Def
+
+	//include_once (ISPC_CLASS_PATH.'/vlibTemplate/debug.php');
+	include_once ISPC_CLASS_PATH.'/tpl_cache.inc.php';
 
 } // << end if(!defined())..
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tpl_cache.inc.php b/interface/lib/classes/tpl_cache.inc.php
index a399946..4bf75fa 100644
--- a/interface/lib/classes/tpl_cache.inc.php
+++ b/interface/lib/classes/tpl_cache.inc.php
@@ -20,167 +20,174 @@
  * @access public
  */
 
+
 class tplc extends tpl {
 
-/*-----------------------------------------------------------------------------\
+	/*-----------------------------------------------------------------------------\
 |     DO NOT TOUCH ANYTHING IN THIS CLASS, IT MAY NOT WORK OTHERWISE           |
 \-----------------------------------------------------------------------------*/
 
-    var $_cache = 1;     // tells vlibTemplate that we're caching
-    var $_cachefile;     // full path to current cache file (even if it doesn't yet exist)
-    var $_cacheexists;   // has this file been cached before
-    var $_cachefilelocked; // is this file currently locked whilst writing
-    var $_cachefiledir;  // dir of current cache file
-    var $_clearcache = 0;
+	var $_cache = 1;     // tells vlibTemplate that we're caching
+	var $_cachefile;     // full path to current cache file (even if it doesn't yet exist)
+	var $_cacheexists;   // has this file been cached before
+	var $_cachefilelocked; // is this file currently locked whilst writing
+	var $_cachefiledir;  // dir of current cache file
+	var $_clearcache = 0;
 
 
-    /**
-     * FUNCTION: clearCache
-     * will unset a file, and set $this->_cacheexists to 0.
-     *
-     * @access public
-     * @return boolean
-     */
-    function clearCache() {
-        $this->_clearcache = 1;
-        return true;
-    }
-
-    /**
-     * FUNCTION: recache
-     * alias for clearCache().
-     *
-     * @access public
-     * @return boolean
-     */
-    function recache() {
-        return $this->clearCache();
-    }
-
-    /**
-     * FUNCTION: setCacheLifeTime
-     * sets the lifetime of the cached file
-     *
-     * @param int $int number of seconds to set lifetime to
-     * @access public
-     * @return boolean
-     */
-    function setCacheLifeTime($int = null) {
-        if ($int == null || !is_int($int)) return false;
-        if ($int == 0) $int = 60;
-        if ($int == -1) $int = 157680000; // set to 5 yrs time
-        $this->OPTIONS['CACHE_LIFETIME'] = $int;
-        return true;
-    }
-
-    /**
-     * FUNCTION: setCacheExtension
-     * sets the extention of the cache file
-     *
-     * @param str $str name of new cache extention
-     * @access public
-     * @return boolean
-     */
-    function setCacheExtension($str = null) {
-        if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
-        $this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
-        return true;
-    }
+	/**
+	 * FUNCTION: clearCache
+	 * will unset a file, and set $this->_cacheexists to 0.
+	 *
+	 * @access public
+	 * @return boolean
+	 */
+	function clearCache() {
+		$this->_clearcache = 1;
+		return true;
+	}
 
 
-/*----------------------------------------\
+	/**
+	 * FUNCTION: recache
+	 * alias for clearCache().
+	 *
+	 * @access public
+	 * @return boolean
+	 */
+	function recache() {
+		return $this->clearCache();
+	}
+
+
+	/**
+	 * FUNCTION: setCacheLifeTime
+	 * sets the lifetime of the cached file
+	 *
+	 * @param int $int number of seconds to set lifetime to
+	 * @access public
+	 * @return boolean
+	 */
+	function setCacheLifeTime($int = null) {
+		if ($int == null || !is_int($int)) return false;
+		if ($int == 0) $int = 60;
+		if ($int == -1) $int = 157680000; // set to 5 yrs time
+		$this->OPTIONS['CACHE_LIFETIME'] = $int;
+		return true;
+	}
+
+
+	/**
+	 * FUNCTION: setCacheExtension
+	 * sets the extention of the cache file
+	 *
+	 * @param str $str name of new cache extention
+	 * @access public
+	 * @return boolean
+	 */
+	function setCacheExtension($str = null) {
+		if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
+		$this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
+		return true;
+	}
+
+
+	/*----------------------------------------\
           Private Functions
 -----------------------------------------*/
 
-    /**
-     * FUNCTION: _checkCache
-     * checks if there's a cache, if there is then it will read the cache file as the template.
-     */
-    function _checkCache ($tmplfile) {
-        $this->_cachefile = $this->_getFilename($tmplfile);
-        if ($this->_clearcache) {
-            if (file_exists($this->_cachefile)) unlink($this->_cachefile);
-            return false;
-        }
 
-        if (file_exists($this->_cachefile)) {
-            $this->_cacheexists = 1;
+	/**
+	 * FUNCTION: _checkCache
+	 * checks if there's a cache, if there is then it will read the cache file as the template.
+	 */
+	function _checkCache ($tmplfile) {
+		$this->_cachefile = $this->_getFilename($tmplfile);
+		if ($this->_clearcache) {
+			if (file_exists($this->_cachefile)) unlink($this->_cachefile);
+			return false;
+		}
 
-            // if it's expired
-            if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date ('U')
-                  || filectime($this->_cachefile) < filemtime($tmplfile)) {
-                $this->_cacheexists = 0;
-                return false; // so that we know to recache
-            }
-            else {
-                return true;
-            }
+		if (file_exists($this->_cachefile)) {
+			$this->_cacheexists = 1;
 
-        } else {
-            $this->_cacheexists = 0;
-            return false;
-        }
-    }
+			// if it's expired
+			if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date('U')
+				|| filectime($this->_cachefile) < filemtime($tmplfile)) {
+				$this->_cacheexists = 0;
+				return false; // so that we know to recache
+			}
+			else {
+				return true;
+			}
+
+		} else {
+			$this->_cacheexists = 0;
+			return false;
+		}
+	}
 
 
-    /**
-     * FUNCTION: _getFilename
-     * gets the full pathname for the cached file
-     *
-     */
-    function _getFilename($tmplfile) {
-        return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
-    }
+	/**
+	 * FUNCTION: _getFilename
+	 * gets the full pathname for the cached file
+	 *
+	 */
+	function _getFilename($tmplfile) {
+		return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
+	}
 
-    /**
-     * FUNCTION: _createCache
-     * creates the cached file
-     *
-     */
-    function _createCache($data) {
-        $cache_file = $this->_cachefile;
-        if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
 
-        $f = fopen ($cache_file, "w");
-        flock($f, 2); // set an EXclusive lock
-        if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE',KILL,$cache_file);
-        fputs ($f, $data); // write the parsed string from vlibTemplate
-        flock($f, 3); // UNlock file
-        fclose ($f);
-        touch ($cache_file);
-        return true;
-    }
+	/**
+	 * FUNCTION: _createCache
+	 * creates the cached file
+	 *
+	 */
+	function _createCache($data) {
+		$cache_file = $this->_cachefile;
+		if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
 
-    /**
-     * FUNCTION: _prepareDirs
-     * prepares the directory structure
-     *
-     */
-    function _prepareDirs($file) {
-        if (empty($file)) die('no filename'); //do error in future
-        $filepath = dirname($file);
-        if (is_dir($filepath)) return true;
+		$f = fopen($cache_file, "w");
+		flock($f, 2); // set an EXclusive lock
+		if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE', KILL, $cache_file);
+		fputs($f, $data); // write the parsed string from vlibTemplate
+		flock($f, 3); // UNlock file
+		fclose($f);
+		touch($cache_file);
+		return true;
+	}
 
-        $dirs = preg_split('/[\\/]/', $filepath);
-        $currpath;
-        foreach ($dirs as $dir) {
-            $currpath .= $dir .'/';
-            $type = @filetype($currpath);
 
-            ($type=='link') and $type = 'dir';
-            if ($type != 'dir' && $type != false && !empty($type)) {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE',KILL,'directory: '.$currpath.', type: '.$type);
-            }
-            if ($type == 'dir') {
-                continue;
-            }
-            else {
-                $s = @mkdir($currpath, 0775);
-                if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE',KILL,'directory: '.$currpath);
-            }
-        }
-        return true;
-    }
+	/**
+	 * FUNCTION: _prepareDirs
+	 * prepares the directory structure
+	 *
+	 */
+	function _prepareDirs($file) {
+		if (empty($file)) die('no filename'); //do error in future
+		$filepath = dirname($file);
+		if (is_dir($filepath)) return true;
+
+		$dirs = preg_split('/[\\/]/', $filepath);
+		$currpath;
+		foreach ($dirs as $dir) {
+			$currpath .= $dir .'/';
+			$type = @filetype($currpath);
+
+			($type=='link') and $type = 'dir';
+			if ($type != 'dir' && $type != false && !empty($type)) {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE', KILL, 'directory: '.$currpath.', type: '.$type);
+			}
+			if ($type == 'dir') {
+				continue;
+			}
+			else {
+				$s = @mkdir($currpath, 0775);
+				if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE', KILL, 'directory: '.$currpath);
+			}
+		}
+		return true;
+	}
 
 } // -- end vlibTemplateCache class
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tpl_error.inc.php b/interface/lib/classes/tpl_error.inc.php
index a4095d8..b4433cd 100644
--- a/interface/lib/classes/tpl_error.inc.php
+++ b/interface/lib/classes/tpl_error.inc.php
@@ -25,68 +25,71 @@
  * @access private
  */
 
+
 class vlibTemplateError {
 
-/*-----------------------------------------------------------------------------\
+	/*-----------------------------------------------------------------------------\
 |     DO NOT TOUCH ANYTHING IN THIS CLASS IT MAY NOT WORK OTHERWISE            |
 \-----------------------------------------------------------------------------*/
 
-    public static function raiseError ($code, $level = null, $extra=null) {
-        if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
+	public static function raiseError ($code, $level = null, $extra=null) {
+		if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
 
-        $error_codes = array(
-                        'VT_ERROR_NOFILE'               => 'vlibTemplate Error: Template ('.$extra.') file not found.',
-                        'VT_ERROR_PARSE'                => 'vlibTemplate Error: Parse error!<br />To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
-                        'VT_NOTICE_INVALID_TAG'         => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
-                        'VT_ERROR_INVALID_TAG'          => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
-                        'VT_NOTICE_INVALID_ATT'         => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
-                        'VT_WARNING_INVALID_ARR'        => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
-                        'VT_ERROR_INVALID_ERROR_CODE'   => 'vlibTemplate Error: Invalid error raised.',
-                        'VT_ERROR_WRONG_NO_PARAMS'      => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
-                        'VT_ERROR_UNKNOWN_VAR'          => 'vlibTemplate Error: template var not found.',
-                        'VT_ERROR_NO_CACHE_WRITE'       => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
-                        'VT_ERROR_WRONG_CACHE_TYPE'     => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
-                        'VT_ERROR_CACHE_MKDIR_FAILURE'  => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
-                        'VT_WARNING_NOT_CACHE_OBJ'      => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
-                        'VT_WARNING_LOOP_NOT_SET'       => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
-                        'VT_WARNING_INVALID_RESOURCE'   => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
-                        'VT_WARNING_INVALID_LOOP_DB'    => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
-                        'VT_WARNING_INVALID_IF_OP'      => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
-                            );
+		$error_codes = array(
+			'VT_ERROR_NOFILE'               => 'vlibTemplate Error: Template ('.$extra.') file not found.',
+			'VT_ERROR_PARSE'                => 'vlibTemplate Error: Parse error!<br />To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
+			'VT_NOTICE_INVALID_TAG'         => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
+			'VT_ERROR_INVALID_TAG'          => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
+			'VT_NOTICE_INVALID_ATT'         => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
+			'VT_WARNING_INVALID_ARR'        => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
+			'VT_ERROR_INVALID_ERROR_CODE'   => 'vlibTemplate Error: Invalid error raised.',
+			'VT_ERROR_WRONG_NO_PARAMS'      => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
+			'VT_ERROR_UNKNOWN_VAR'          => 'vlibTemplate Error: template var not found.',
+			'VT_ERROR_NO_CACHE_WRITE'       => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
+			'VT_ERROR_WRONG_CACHE_TYPE'     => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
+			'VT_ERROR_CACHE_MKDIR_FAILURE'  => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
+			'VT_WARNING_NOT_CACHE_OBJ'      => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
+			'VT_WARNING_LOOP_NOT_SET'       => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
+			'VT_WARNING_INVALID_RESOURCE'   => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
+			'VT_WARNING_INVALID_LOOP_DB'    => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
+			'VT_WARNING_INVALID_IF_OP'      => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
+		);
 
-        $error_levels = array(
-                        'VT_ERROR_NOFILE'               => FATAL,
-                        'VT_ERROR_PARSE'                => FATAL,
-                        'VT_NOTICE_INVALID_TAG'         => NOTICE,
-                        'VT_ERROR_INVALID_TAG'          => FATAL,
-                        'VT_NOTICE_INVALID_ATT'         => NOTICE,
-                        'VT_WARNING_INVALID_ARR'        => WARNING,
-                        'VT_ERROR_INVALID_ERROR_CODE'   => FATAL,
-                        'VT_ERROR_WRONG_NO_PARAMS'      => WARNING,
-                        'VT_ERROR_UNKNOWN_VAR'          => WARNING,
-                        'VT_ERROR_NO_CACHE_WRITE'       => KILL,
-                        'VT_ERROR_WRONG_CACHE_TYPE'     => KILL,
-                        'VT_ERROR_CACHE_MKDIR_FAILURE'  => KILL,
-                        'VT_WARNING_NOT_CACHE_OBJ'      => WARNING,
-                        'VT_WARNING_LOOP_NOT_SET'       => WARNING,
-                        'VT_WARNING_INVALID_RESOURCE'   => WARNING,
-                        'VT_WARNING_INVALID_LOOP_DB'    => WARNING,
-                        'VT_WARNING_INVALID_IF_OP'      => WARNING
-                            );
+		$error_levels = array(
+			'VT_ERROR_NOFILE'               => FATAL,
+			'VT_ERROR_PARSE'                => FATAL,
+			'VT_NOTICE_INVALID_TAG'         => NOTICE,
+			'VT_ERROR_INVALID_TAG'          => FATAL,
+			'VT_NOTICE_INVALID_ATT'         => NOTICE,
+			'VT_WARNING_INVALID_ARR'        => WARNING,
+			'VT_ERROR_INVALID_ERROR_CODE'   => FATAL,
+			'VT_ERROR_WRONG_NO_PARAMS'      => WARNING,
+			'VT_ERROR_UNKNOWN_VAR'          => WARNING,
+			'VT_ERROR_NO_CACHE_WRITE'       => KILL,
+			'VT_ERROR_WRONG_CACHE_TYPE'     => KILL,
+			'VT_ERROR_CACHE_MKDIR_FAILURE'  => KILL,
+			'VT_WARNING_NOT_CACHE_OBJ'      => WARNING,
+			'VT_WARNING_LOOP_NOT_SET'       => WARNING,
+			'VT_WARNING_INVALID_RESOURCE'   => WARNING,
+			'VT_WARNING_INVALID_LOOP_DB'    => WARNING,
+			'VT_WARNING_INVALID_IF_OP'      => WARNING
+		);
 
-        ($level === null) and $level = $error_levels[$code];
-        if ($level == KILL) {
-            die ($error_codes[$code]);
-        }
+		($level === null) and $level = $error_levels[$code];
+		if ($level == KILL) {
+			die ($error_codes[$code]);
+		}
 
-        if ($msg = $error_codes[$code]) {
-            trigger_error($msg, $level);
-        } else {
-            $level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
-            $msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
-            trigger_error($msg, $level);
-        }
-        return;
-    }
+		if ($msg = $error_codes[$code]) {
+			trigger_error($msg, $level);
+		} else {
+			$level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
+			$msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
+			trigger_error($msg, $level);
+		}
+		return;
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/lib/classes/tpl_ini.inc.php b/interface/lib/classes/tpl_ini.inc.php
index 8388148..e745254 100644
--- a/interface/lib/classes/tpl_ini.inc.php
+++ b/interface/lib/classes/tpl_ini.inc.php
@@ -1,14 +1,15 @@
 <?php
-    /**
-     * vlibIni is a class used to store configuration parameters
-     * for the vLIB library.
-     *
-     * @since 21/07/2002
-     * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
-     * @copyright 2002 Active Fish Group 
-     * @package vLIB
-     * @access private
-     */
+/**
+ * vlibIni is a class used to store configuration parameters
+ * for the vLIB library.
+ *
+ * @since 21/07/2002
+ * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
+ * @copyright 2002 Active Fish Group
+ * @package vLIB
+ * @access private
+ */
+
 
 /* vim: set expandtab tabstop=4 shiftwidth=4: */
 // +----------------------------------------------------------------------+
@@ -39,80 +40,80 @@
 */
 
 if (!defined('vlibIniClassLoaded')) {
-    define('vlibIniClassLoaded', 1);
+	define('vlibIniClassLoaded', 1);
 
 
 
-    class vlibIni{
+	class vlibIni{
 
-        /** Returns $array of config vars for vlibTemplate */
-        public static function vlibTemplate()
-        {
+		/** Returns $array of config vars for vlibTemplate */
+		public static function vlibTemplate()
+		{
 
 			$tpl_dir = ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates';
 			$def_tpl_dir = ISPC_THEMES_PATH.'/default/templates';
-            return array(
+			return array(
 
-                        'INCLUDE_PATHS' => array($tpl_dir),   // The path, searched BEVORE the template_dir is searched for the template-file
+				'INCLUDE_PATHS' => array($tpl_dir),   // The path, searched BEVORE the template_dir is searched for the template-file
 
-                        'TEMPLATE_DIR' => $def_tpl_dir,			   // Default directory for your template files (full path)
-                                                                   // leave the '/' or '\' off the end of the directory.
+				'TEMPLATE_DIR' => $def_tpl_dir,      // Default directory for your template files (full path)
+				// leave the '/' or '\' off the end of the directory.
 
-                        'MAX_INCLUDES' => 10,                      // Drill depth for tmpl_include's
+				'MAX_INCLUDES' => 10,                      // Drill depth for tmpl_include's
 
-                        'GLOBAL_VARS' => 1,                        // if set to 1, any variables not found in a
-                                                                   // loop will search for a global var as well
+				'GLOBAL_VARS' => 1,                        // if set to 1, any variables not found in a
+				// loop will search for a global var as well
 
-                        'GLOBAL_CONTEXT_VARS' => 1,                // if set to 1, vlibTemplate will add global vars
-                                                                   // reflecting the environment.
+				'GLOBAL_CONTEXT_VARS' => 1,                // if set to 1, vlibTemplate will add global vars
+				// reflecting the environment.
 
-                        'LOOP_CONTEXT_VARS' => 1,                  // if set to 1, vlibTemplate will add loop specific vars
-                                                                   // on each row of the loop.
+				'LOOP_CONTEXT_VARS' => 1,                  // if set to 1, vlibTemplate will add loop specific vars
+				// on each row of the loop.
 
-                        'SET_LOOP_VAR' => 1,                       // Sets a global variable for each top level loops
+				'SET_LOOP_VAR' => 1,                       // Sets a global variable for each top level loops
 
-                        'DEFAULT_ESCAPE' => 'none',                // 1 of the following: html, url, sq, dq, none
+				'DEFAULT_ESCAPE' => 'none',                // 1 of the following: html, url, sq, dq, none
 
-                        'STRICT' => 0,                             // Dies when encountering an incorrect tmpl_*
-                                                                   // style tags i.e. tmpl_vae
+				'STRICT' => 0,                             // Dies when encountering an incorrect tmpl_*
+				// style tags i.e. tmpl_vae
 
-                        'CASELESS' => 0,                           // Removes case sensitivity on all variables
+				'CASELESS' => 0,                           // Removes case sensitivity on all variables
 
-                        'UNKNOWNS' => 'ignore',                    // How to handle unknown variables.
-                                                                   // 1 of the following: ignore, remove, leave,print, comment
-                                                                   // 1 of the following: ignore, remove, leave, print, comment
+				'UNKNOWNS' => 'ignore',                    // How to handle unknown variables.
+				// 1 of the following: ignore, remove, leave,print, comment
+				// 1 of the following: ignore, remove, leave, print, comment
 
-                        'TIME_PARSE' => '0',                       // Will enable you to time how long vlibTemplate takes to parse
-                                                                   // your template. You then use the function: getParseTime().
+				'TIME_PARSE' => '0',                       // Will enable you to time how long vlibTemplate takes to parse
+				// your template. You then use the function: getParseTime().
 
-                        'ENABLE_PHPINCLUDE' => '1',                // Will allow template to include a php file using <TMPL_PHPINCLUDE>
+				'ENABLE_PHPINCLUDE' => '1',                // Will allow template to include a php file using <TMPL_PHPINCLUDE>
 
 
-                        /* the following are only used by the vlibTemplateCache class. */
-                        // pedro notes:: triggers a notice as its not set - was $conf['template']['cache_dir'],
-                        'CACHE_DIRECTORY' => ISPC_CACHE_PATH,
-                                                                   // Directory where the cached filesystem
-                                                                   // will be set up (full path, and must be writable)
-                                                                   // '/' or '\' off the end of the directory.
+				/* the following are only used by the vlibTemplateCache class. */
+				// pedro notes:: triggers a notice as its not set - was $conf['template']['cache_dir'],
+				'CACHE_DIRECTORY' => ISPC_CACHE_PATH,
+				// Directory where the cached filesystem
+				// will be set up (full path, and must be writable)
+				// '/' or '\' off the end of the directory.
 
-                        'CACHE_LIFETIME' => 604800,                // Duration until file is re-cached in seconds (604800 = 1 week)
+				'CACHE_LIFETIME' => 604800,                // Duration until file is re-cached in seconds (604800 = 1 week)
 
-                        'CACHE_EXTENSION' => 'vtc'                  // extention to be used by the cached file i.e. index.php will become
-                                                                   // index.vtc (vlibTemplate Compiled)
-                    );
+				'CACHE_EXTENSION' => 'vtc'                  // extention to be used by the cached file i.e. index.php will become
+				// index.vtc (vlibTemplate Compiled)
+			);
 
-        } // << end function vlibTemplate
+		} // << end function vlibTemplate
 
 
 
-        /** Returns $array of config vars for vlibDate */
-        public function vlibDate()
-        {
-            return array( 'DEFAULT_LANG' => 'de' ); //* default language for the date displays
-        }
+		/** Returns $array of config vars for vlibDate */
+		public function vlibDate()
+		{
+			return array( 'DEFAULT_LANG' => 'de' ); //* default language for the date displays
+		}
 
 
-    }// << end class vlibIni
+	}// << end class vlibIni
 
 } // << if Defined
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tree.inc.php b/interface/lib/classes/tree.inc.php
index dcc2d61..8d29a67 100644
--- a/interface/lib/classes/tree.inc.php
+++ b/interface/lib/classes/tree.inc.php
@@ -38,218 +38,218 @@
 class tree
 {
 
-    var $obj;
-    var $events;
-    
-    // Feld Definitionen
-	var $data_field		= 'name';
-	var $primary_field	= 'media_cat_id';
-	var $parent_field 	= 'parent';
-	var $root_id 		= '0';
-	var $opt_spacer 	= '&nbsp;';
-	
+	var $obj;
+	var $events;
+
+	// Feld Definitionen
+	var $data_field  = 'name';
+	var $primary_field = 'media_cat_id';
+	var $parent_field  = 'parent';
+	var $root_id   = '0';
+	var $opt_spacer  = '&nbsp;';
+
 	// interne Vars
 	var $_last_id;
-	
+
 	/*
 		Funktion zum laden des Baumes aus Array
 	*/
-    
-    function loadFromArray ($nodes) {
-    	
-    	$this->obj[$this->root_id] = new node();
+
+	function loadFromArray ($nodes) {
+
+		$this->obj[$this->root_id] = new node();
 		if(is_array($nodes)) {
-        	foreach($nodes as $row) {
+			foreach($nodes as $row) {
 
-            	$id = $row[$this->primary_field];
-            	$data = $row[$this->data_field];
-            	$ordner = $row[$this->parent_field];
-            
-            	//$this->raw_data[$id] = $row;
-            
-            	if($id > $this->_last_id) $this->_last_id = $id;
-            
-            	if(!is_object($this->obj[$id])) $this->obj[$id] = new node();
-            
-            	$this->obj[$id]->data = $data;
-            	$this->obj[$id]->id = $row[$this->primary_field];
-            	$this->obj[$id]->parent = $row[$this->parent_field];
+				$id = $row[$this->primary_field];
+				$data = $row[$this->data_field];
+				$ordner = $row[$this->parent_field];
 
-            	if(is_object($this->obj[$ordner])) {
-                 	$this->obj[$ordner]->childs[$id] = &$this->obj[$id];
-           		} else {
-                	$this->obj[$ordner] = new node();
-                	$this->obj[$ordner]->childs[$id] = &$this->obj[$id];
-            	}
-        	}
+				//$this->raw_data[$id] = $row;
+
+				if($id > $this->_last_id) $this->_last_id = $id;
+
+				if(!is_object($this->obj[$id])) $this->obj[$id] = new node();
+
+				$this->obj[$id]->data = $data;
+				$this->obj[$id]->id = $row[$this->primary_field];
+				$this->obj[$id]->parent = $row[$this->parent_field];
+
+				if(is_object($this->obj[$ordner])) {
+					$this->obj[$ordner]->childs[$id] = &$this->obj[$id];
+				} else {
+					$this->obj[$ordner] = new node();
+					$this->obj[$ordner]->childs[$id] = &$this->obj[$id];
+				}
+			}
 		}
-    }
-    
-    function optionlist($nroot = '')
-    {
-        
-        if($nroot == '') $nroot = $this->obj[$this->root_id];
+	}
+
+	function optionlist($nroot = '')
+	{
+
+		if($nroot == '') $nroot = $this->obj[$this->root_id];
 		$opt_spacer = $this->opt_spacer;
-		
-        $this->ptree($nroot,'',$optionlist, $opt_spacer); 
-        
-        if(is_array($optionlist)){
+
+		$this->ptree($nroot, '', $optionlist, $opt_spacer);
+
+		if(is_array($optionlist)){
 			return $optionlist;
 		} else {
 			return false;
 		}
-    }
-	
-	function ptree($myobj, $ebene, &$optionlist, $opt_spacer){
-			$ebene .= $opt_spacer;
+	}
 
-            if(is_array($myobj->childs)) {
-                foreach($myobj->childs as $val) {
-                	$id = $val->id;
-                    if(!empty($id)) $optionlist[$id] = array( 	data => $ebene . $val->data,
-                                   								id => $id);
-                    $this->ptree($val,$ebene, $optionlist, $opt_spacer);
-                }
-            }
+	function ptree($myobj, $ebene, &$optionlist, $opt_spacer){
+		$ebene .= $opt_spacer;
+
+		if(is_array($myobj->childs)) {
+			foreach($myobj->childs as $val) {
+				$id = $val->id;
+				if(!empty($id)) $optionlist[$id] = array(  data => $ebene . $val->data,
+						id => $id);
+				$this->ptree($val, $ebene, $optionlist, $opt_spacer);
+			}
 		}
-    
-    function add($parent,$data) {
-    	
-    	$id = $this->_last_id + 1;
-    	$this->obj[$id] = new node;
-    	$this->obj[$id]->data = $data;
-    	$this->obj[$id]->id = $id;
-    	$this->obj[$id]->parent = $parent;
-    	$this->obj[$parent]->childs[$id] = &$this->obj[$id];
-    	
-    	// Event Aufrufen
-    	$this->_callEvent('insert',$this->obj[$id]);
-    	
-    }
-    
-    /*
+	}
+
+	function add($parent, $data) {
+
+		$id = $this->_last_id + 1;
+		$this->obj[$id] = new node;
+		$this->obj[$id]->data = $data;
+		$this->obj[$id]->id = $id;
+		$this->obj[$id]->parent = $parent;
+		$this->obj[$parent]->childs[$id] = &$this->obj[$id];
+
+		// Event Aufrufen
+		$this->_callEvent('insert', $this->obj[$id]);
+
+	}
+
+	/*
     	Löschen von Einträgen ohne Child's
     */
-    
-    function del($id) {
-    	if(count($this->obj[$id]->childs) == 0) {
-    		$this->obj[$id] = NULL;
-    		unset($this->obj[$id]);
-    		return true;
-    	} else {
-    		return false;
-    	}
-    }
-    
-    /*
+
+	function del($id) {
+		if(count($this->obj[$id]->childs) == 0) {
+			$this->obj[$id] = NULL;
+			unset($this->obj[$id]);
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	/*
     	Rekursives löschen von Einträgen
     */
-    
-    function deltree($tree_id) {
-    	// lösche Einträge recursiv
-    	$this->_deltree_recurse($this->obj[$this->root_id],$tree_id, 0);
-    }
-    
-    /*
+
+	function deltree($tree_id) {
+		// lösche Einträge recursiv
+		$this->_deltree_recurse($this->obj[$this->root_id], $tree_id, 0);
+	}
+
+	/*
     	Hilfsfunktion für deltree
     */
-    
-    function _deltree_recurse(&$myobj,$tree_id,$delete) {
+
+	function _deltree_recurse(&$myobj, $tree_id, $delete) {
 		if(is_array($myobj->childs)) {
-            foreach($myobj->childs as $val) {
-            	
-            	// Setze Delete Flag
-            	if($val->id == $tree_id) {
-                	$delete = 1;
-                }
-                
-                // recurse durch Objekte
-            	$this->_deltree_recurse($val,$tree_id,$delete);
-                
-                // lösche Eintrag
-                if($delete == 1) {
-                	$tmp_id = $val->id;
-                	$this->obj[$tmp_id] = NULL;
-    				unset($this->obj[$tmp_id]);
-    				$this->_callEvent('delete',$val);
-    				//echo "Deleting ID: $tmp_id \r\n";
-                }
-                
-                // entferne Delete Flag
-                if($val->id == $tree_id) {
-                	$delete = 0;
-                }
-            }
-        }
-    }
-    
-    
-    /*
+			foreach($myobj->childs as $val) {
+
+				// Setze Delete Flag
+				if($val->id == $tree_id) {
+					$delete = 1;
+				}
+
+				// recurse durch Objekte
+				$this->_deltree_recurse($val, $tree_id, $delete);
+
+				// lösche Eintrag
+				if($delete == 1) {
+					$tmp_id = $val->id;
+					$this->obj[$tmp_id] = NULL;
+					unset($this->obj[$tmp_id]);
+					$this->_callEvent('delete', $val);
+					//echo "Deleting ID: $tmp_id \r\n";
+				}
+
+				// entferne Delete Flag
+				if($val->id == $tree_id) {
+					$delete = 0;
+				}
+			}
+		}
+	}
+
+
+	/*
     	private Funktion zum aufrufen der eventHandler
     */
-    
-    function _callEvent($event, $myobj, $myobj_old = '') {
-    	global $app;
+
+	function _callEvent($event, $myobj, $myobj_old = '') {
+		global $app;
 		if(is_array($this->events)) {
-    		foreach($this->events as $val) {
-    			if($val["event"] == $event) {
-    				$class_name = $val["class_name"];
-    				$function_name = $val["function_name"];
-    				if($val["class_name"] != '') {
-    					$app->uses($class_name);
-    					$app->$class_name->$function_name($myobj,$myobj_old);
-    				} else {
-    					call_user_func ($function_name, $myobj, $myobj_old);
-    				}
-    			}
+			foreach($this->events as $val) {
+				if($val["event"] == $event) {
+					$class_name = $val["class_name"];
+					$function_name = $val["function_name"];
+					if($val["class_name"] != '') {
+						$app->uses($class_name);
+						$app->$class_name->$function_name($myobj, $myobj_old);
+					} else {
+						call_user_func($function_name, $myobj, $myobj_old);
+					}
+				}
 			}
-    	}
-    }
-    
-    /*
+		}
+	}
+
+	/*
     	Funktion zum Verschieben von Einträgen
     */
-    
-    function move($id, $new_parent) {
-    	
-    	$obj_old = $this->obj[$id];
-    	$parent = $this->obj[$id]->parent;
-    	$this->obj[$new_parent]->childs[$id] = &$this->obj[$id];
-    	$this->obj[$id]->parent = $new_parent;
-    	unset($this->obj[$parent]->childs[$id]);
-    	
-    	// event aufrufen
-    	$this->_callEvent('update',$this->obj[$id],$obj_old);
-    	
-    }
-    
-    /*
+
+	function move($id, $new_parent) {
+
+		$obj_old = $this->obj[$id];
+		$parent = $this->obj[$id]->parent;
+		$this->obj[$new_parent]->childs[$id] = &$this->obj[$id];
+		$this->obj[$id]->parent = $new_parent;
+		unset($this->obj[$parent]->childs[$id]);
+
+		// event aufrufen
+		$this->_callEvent('update', $this->obj[$id], $obj_old);
+
+	}
+
+	/*
     	Funktion zum updaten der Daten eines Nodes
     */
-    
-    function update($id,$data) {
-    	
-    	$obj_old = $this->obj[$id];
-    	$this->obj[$id]->data = $data;
-    	$this->_callEvent('update',$this->obj[$id],$obj_old);
-    	
-    }
-    
-    /*
+
+	function update($id, $data) {
+
+		$obj_old = $this->obj[$id];
+		$this->obj[$id]->data = $data;
+		$this->_callEvent('update', $this->obj[$id], $obj_old);
+
+	}
+
+	/*
     	Funktion zum registrieren von Events
     	mögliche events: insert, update, delete
-    	
+
     */
-    
-    function regEvent($event,$class_name,$function_name) {
-    	
-    	$this->events[] = array( 	event 			=> $event,
-    								class_name 		=> $class_name,
-    								function_name 	=> $function_name);
-    	
-    }
+
+	function regEvent($event, $class_name, $function_name) {
+
+		$this->events[] = array(  event    => $event,
+			class_name   => $class_name,
+			function_name  => $function_name);
+
+	}
 
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/validate_autoresponder.inc.php b/interface/lib/classes/validate_autoresponder.inc.php
index c5e989e..fa29b7e 100755
--- a/interface/lib/classes/validate_autoresponder.inc.php
+++ b/interface/lib/classes/validate_autoresponder.inc.php
@@ -27,41 +27,42 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-include_once('validate_datetime.inc.php');
+include_once 'validate_datetime.inc.php';
 
-class validate_autoresponder extends validate_datetime 
+class validate_autoresponder extends validate_datetime
 {
 	function start_date($field_name, $field_value, $validator)
 	{
-		# save field value for later use in end_date()
+		// save field value for later use in end_date()
 		$this->start_date = $field_value;
-		
+
 		if ($this->_datetime_selected($field_value)) {
-			# We just require a start date be set
+			// We just require a start date be set
 			return;
 		}
 		if($_POST['autoresponder'] == 'y') {
 			return "No start date selected";
 		}
 	}
-	
+
 	function end_date($field_name, $field_value, $validator)
 	{
 		global $app;
-		
+
 		$start_date = $this->start_date;
 		//$start_date = $app->tform_actions->dataRecord['autoresponder_start_date'];
-		
+
 		$_msg = $this->not_empty('autoresponder_start_date', $start_date, $validator);
-		if (!$_msg) // Start date set 
-		{
-			if ( !($_msg = $this->not_empty($field_name, $field_value, $validator)) ) // End date set
+		if (!$_msg) // Start date set
 			{
+			if ( !($_msg = $this->not_empty($field_name, $field_value, $validator)) ) // End date set
+				{
 				$validator['compare'] = $this->_get_timestamp_value($start_date);
 				$_msg = $this->is_greater($field_name, $field_value, $validator);
 			}
-			
+
 			return $_msg;
 		}
 	}
-}
\ No newline at end of file
+
+}
diff --git a/interface/lib/classes/validate_client.inc.php b/interface/lib/classes/validate_client.inc.php
index 36370ab..6bd0015 100644
--- a/interface/lib/classes/validate_client.inc.php
+++ b/interface/lib/classes/validate_client.inc.php
@@ -29,60 +29,60 @@
 */
 
 class validate_client {
-	
+
 	/*
 		Validator function to check if a username is unique.
 	*/
 	function username_unique($field_name, $field_value, $validator) {
 		global $app;
-		
+
 		if(isset($app->remoting_lib->primary_id)) {
 			$client_id = $app->remoting_lib->primary_id;
 		} else {
 			$client_id = $app->tform->primary_id;
 		}
-		
+
 		if($client_id == 0) {
-        	$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."'");
-            	if($num_rec["number"] > 0) {
-                	$errmsg = $validator['errmsg'];
-					if(isset($app->tform->wordbook[$errmsg])) {
-                    	return $app->tform->wordbook[$errmsg]."<br>\r\n";
-					} else {
-						return $errmsg."<br>\r\n";
-					}
-                }
-        } else {
-        	$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."' AND client_id != ".$client_id);
+			$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."'");
 			if($num_rec["number"] > 0) {
-            	$errmsg = $validator['errmsg'];
-                if(isset($app->tform->wordbook[$errmsg])) {
-                	return $app->tform->wordbook[$errmsg]."<br>\r\n";
+				$errmsg = $validator['errmsg'];
+				if(isset($app->tform->wordbook[$errmsg])) {
+					return $app->tform->wordbook[$errmsg]."<br>\r\n";
+				} else {
+					return $errmsg."<br>\r\n";
+				}
+			}
+		} else {
+			$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."' AND client_id != ".$client_id);
+			if($num_rec["number"] > 0) {
+				$errmsg = $validator['errmsg'];
+				if(isset($app->tform->wordbook[$errmsg])) {
+					return $app->tform->wordbook[$errmsg]."<br>\r\n";
 				} else {
 					return $errmsg."<br>\r\n";
 				}
 			}
 		}
 	}
-	
+
 	function username_collision($field_name, $field_value, $validator) {
 		global $app;
-		
+
 		if(isset($app->remoting_lib->primary_id)) {
 			$client_id = $app->remoting_lib->primary_id;
 		} else {
 			$client_id = $app->tform->primary_id;
 		}
-		
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('sites');
-		
-		if((trim($field_value) == 'web' || preg_match('/^web[0-9]/',$field_value)) && 
-		  ($global_config['ftpuser_prefix'] == '[CLIENTNAME]' || 
-		   $global_config['ftpuser_prefix'] == '' ||
-		   $global_config['shelluser_prefix'] == '[CLIENTNAME]' ||
-		   $global_config['shelluser_prefix'] == '' ) &&
-		   $global_config['client_username_web_check_disabled'] == 'n') {
+
+		if((trim($field_value) == 'web' || preg_match('/^web[0-9]/', $field_value)) &&
+			($global_config['ftpuser_prefix'] == '[CLIENTNAME]' ||
+				$global_config['ftpuser_prefix'] == '' ||
+				$global_config['shelluser_prefix'] == '[CLIENTNAME]' ||
+				$global_config['shelluser_prefix'] == '' ) &&
+			$global_config['client_username_web_check_disabled'] == 'n') {
 			$errmsg = $validator['errmsg'];
 			if(isset($app->tform->wordbook[$errmsg])) {
 				return $app->tform->wordbook[$errmsg]."<br>\r\n";
@@ -90,13 +90,13 @@
 				return $errmsg."<br>\r\n";
 			}
 		}
-		
-		
-		
-		
+
+
+
+
 	}
-	
-	
-	
-	
-}
\ No newline at end of file
+
+
+
+
+}
diff --git a/interface/lib/classes/validate_cron.inc.php b/interface/lib/classes/validate_cron.inc.php
index e551af3..7e95e18 100644
--- a/interface/lib/classes/validate_cron.inc.php
+++ b/interface/lib/classes/validate_cron.inc.php
@@ -30,32 +30,32 @@
 */
 
 class validate_cron {
-	
-    function get_error($errmsg) {
-        global $app;
-        
-        if(isset($app->tform->wordbook[$errmsg])) {
-            return $app->tform->wordbook[$errmsg]."<br>\r\n";
-        } else {
-            return $errmsg."<br>\r\n";
-        }
-    }
-    
-    /*
+
+	function get_error($errmsg) {
+		global $app;
+
+		if(isset($app->tform->wordbook[$errmsg])) {
+			return $app->tform->wordbook[$errmsg]."<br>\r\n";
+		} else {
+			return $errmsg."<br>\r\n";
+		}
+	}
+
+	/*
         Validator function to check if a given cron command is in correct form (url only).
     */
-    function command_format($field_name, $field_value, $validator) {
-        if(preg_match("'^(\w+):\/\/'", $field_value, $matches)) {
-            
-            $parsed = parse_url($field_value);
-            if($parsed === false) return $this->get_error($validator['errmsg']);
-            
-            if($parsed["scheme"] != "http" && $parsed["scheme"] != "https") return $this->get_error($validator['errmsg']);
-            
-            if(preg_match("'^([a-z0-9][a-z0-9-]{0,62}\.)+([a-z]{2,30})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
-        }
-    }
-	
+	function command_format($field_name, $field_value, $validator) {
+		if(preg_match("'^(\w+):\/\/'", $field_value, $matches)) {
+
+			$parsed = parse_url($field_value);
+			if($parsed === false) return $this->get_error($validator['errmsg']);
+
+			if($parsed["scheme"] != "http" && $parsed["scheme"] != "https") return $this->get_error($validator['errmsg']);
+
+			if(preg_match("'^([a-z0-9][a-z0-9-]{0,62}\.)+([a-z]{2,30})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
+		}
+	}
+
 	function run_month_format($field_name, $field_value, $validator) {
 		global $app;
 		//* allow value @reboot in month field
@@ -63,137 +63,137 @@
 			return $this->run_time_format($field_name, $field_value, $validator);
 		}
 	}
-    
+
 	/*
 		Validator function to check if a given cron time is in correct form.
 	*/
 	function run_time_format($field_name, $field_value, $validator) {
 		global $app;
-		
-        //* check general form
-        $is_ok = true;
-        $field_value = str_replace(" ", "", $field_value); // spaces are not needed
-        $used_times = array();
-        
-        if(preg_match("'^[0-9\-\,\/\*]+$'", $field_value) == false) return $this->get_error($validator['errmsg']); // allowed characters are 0-9, comma, *, -, /
-        elseif(preg_match("'[\-\,\/][\-\,\/]'", $field_value) == true) return $this->get_error($validator['errmsg']); // comma, - and / never stand together
-        //* now split list and check each entry. store used values in array for later limit-check
-        $time_list = explode(",", $field_value);
-        if(count($time_list) < 1) return $this->get_error($validator['errmsg']);
-        
-        $max_entry = 0;
-        $min_entry = 0;
-        $in_minutes = 1;
-        //* get maximum value of entry for each field type (name)
-        switch($field_name) {
-            case "run_min":
-                $max_entry = 59;
-                break;
-            case "run_hour":
-                $max_entry = 23;
-                $in_minutes = 60;
-                break;
-            case "run_mday":
-                $max_entry = 31;
-                $min_entry = 1;
-                $in_minutes = 1440;
-                break;
-            case "run_month":
-                $max_entry = 12;
-                $min_entry = 1;
-                $in_minutes = 1440 * 28; // not exactly but enough
-                break;
-            case "run_wday":
-                $max_entry = 7;
-                $in_minutes = 1440;
-                break;
-        }
-        
-        if($max_entry == 0) return $this->get_error('unknown_fieldtype_error');
-        
-        foreach($time_list as $entry) {
-            //* possible value combinations:
-            //* x               =>      ^(\d+)$
-            //* x-y             =>      ^(\d+)\-(\d+)$
-            //* x/y             =>      ^(\d+)\/([1-9]\d*)$
-            //* x-y/z           =>      ^(\d+)\-(\d+)\/([1-9]\d*)$
-            //* */x             =>      ^\*\/([1-9]\d*)$
-            //* combined regex  =>      ^(\d+|\*)(\-(\d+))?(\/([1-9]\d*))?$
-            
-            if(preg_match("'^(((\d+)(\-(\d+))?)|\*)(\/([1-9]\d*))?$'", $entry, $matches) == false) {
-                return $this->get_error($validator['errmsg']);
-            }
-            
-            //* matches contains:
-            //* 1       =>      * or value or x-y range
-            //* 2       =>      unused
-            //* 3       =>      value if [1] != *
-            //* 4       =>      empty if no range was used
-            //* 5       =>      2nd value of range if [1] != * and range was used
-            //* 6       =>      empty if step was not used
-            //* 7       =>      step
-            
-            $loop_step = 1;
-            $loop_from = $min_entry;
-            $loop_to = $max_entry;
-            
-            //* calculate used values
-            if($matches[1] == "*") {
-                //* not to check
-            } else {
-                if($matches[3] < $min_entry || $matches[3] > $max_entry) {
-                    //* check if value is in allowed range
-                    return $this->get_error($validator['errmsg']);
-                } elseif($matches[4] && ($matches[5] < $min_entry || $matches[5] > $max_entry || $matches[5] <= $matches[3])) {
-                    //* check if value is in allowed range and not less or equal to first value
-                    return $this->get_error($validator['errmsg']);
-                }
-                
-                $loop_from = $matches[3];
-                $loop_to = $matches[3];
-                if($matches[4]) $loop_to = $matches[5];
-            }
-            if($matches[6] && ($matches[7] < 2 || $matches[7] > $max_entry - 1)) {
-                //* check if step value is valid
-                return $this->get_error($validator['errmsg']);
-            }
-            if($matches[7]) $loop_step = $matches[7];
-            
-            //* loop through values to set used times
-            for($t = $loop_from; $t <= $loop_to; $t = $t + $loop_step) {
-                $used_times[] = $t;
-            }
-        } //* end foreach entry loop
-        
-        //* sort used times and erase doubles
-        sort($used_times);
-        $used_times = array_unique($used_times);
-        
-        //* get minimum frequency and store it in $app->tform->cron_min_freq for usage in onUpdateSave and onInsertSave!
-        $min_freq = -1;
-        $prev_time = -1;
-        foreach($used_times as $curtime) {
-            if($prev_time != -1) {
-                $freq = $curtime - $prev_time;
-                if($min_freq == -1 || $freq < $min_freq) $min_freq = $freq;
-            }
-            $prev_time = $curtime;
-        }
-        
-        //* check last against first (needed because e.g. wday 1,4,7 has diff 1 not 3
-        $prev_time = $used_times[0];
-        $freq = ($prev_time - $min_entry) + ($max_entry - $curtime) + 1;
-        if($min_freq == -1 || $freq < $min_freq) $min_freq = $freq;
-        
-        if($min_freq > 0 && $min_freq <= $max_entry) { //* only store if > 1 && < $max_entry!
-            $min_freq = $min_freq * $in_minutes; // we have to overwrite $app->tform->cron_min_freq if this is higher value
-            if(!$app->tform->cron_min_freq || $app->tform->cron_min_freq > $min_freq) $app->tform->cron_min_freq = $min_freq;
-        }
-        
-        //return "DEBUG: " . $app->tform->cron_min_freq . " ($min_freq) --- " . var_export($used_times, true) . "<br />";
+
+		//* check general form
+		$is_ok = true;
+		$field_value = str_replace(" ", "", $field_value); // spaces are not needed
+		$used_times = array();
+
+		if(preg_match("'^[0-9\-\,\/\*]+$'", $field_value) == false) return $this->get_error($validator['errmsg']); // allowed characters are 0-9, comma, *, -, /
+		elseif(preg_match("'[\-\,\/][\-\,\/]'", $field_value) == true) return $this->get_error($validator['errmsg']); // comma, - and / never stand together
+		//* now split list and check each entry. store used values in array for later limit-check
+		$time_list = explode(",", $field_value);
+		if(count($time_list) < 1) return $this->get_error($validator['errmsg']);
+
+		$max_entry = 0;
+		$min_entry = 0;
+		$in_minutes = 1;
+		//* get maximum value of entry for each field type (name)
+		switch($field_name) {
+		case "run_min":
+			$max_entry = 59;
+			break;
+		case "run_hour":
+			$max_entry = 23;
+			$in_minutes = 60;
+			break;
+		case "run_mday":
+			$max_entry = 31;
+			$min_entry = 1;
+			$in_minutes = 1440;
+			break;
+		case "run_month":
+			$max_entry = 12;
+			$min_entry = 1;
+			$in_minutes = 1440 * 28; // not exactly but enough
+			break;
+		case "run_wday":
+			$max_entry = 7;
+			$in_minutes = 1440;
+			break;
+		}
+
+		if($max_entry == 0) return $this->get_error('unknown_fieldtype_error');
+
+		foreach($time_list as $entry) {
+			//* possible value combinations:
+			//* x               =>      ^(\d+)$
+			//* x-y             =>      ^(\d+)\-(\d+)$
+			//* x/y             =>      ^(\d+)\/([1-9]\d*)$
+			//* x-y/z           =>      ^(\d+)\-(\d+)\/([1-9]\d*)$
+			//* */x             =>      ^\*\/([1-9]\d*)$
+			//* combined regex  =>      ^(\d+|\*)(\-(\d+))?(\/([1-9]\d*))?$
+
+			if(preg_match("'^(((\d+)(\-(\d+))?)|\*)(\/([1-9]\d*))?$'", $entry, $matches) == false) {
+				return $this->get_error($validator['errmsg']);
+			}
+
+			//* matches contains:
+			//* 1       =>      * or value or x-y range
+			//* 2       =>      unused
+			//* 3       =>      value if [1] != *
+			//* 4       =>      empty if no range was used
+			//* 5       =>      2nd value of range if [1] != * and range was used
+			//* 6       =>      empty if step was not used
+			//* 7       =>      step
+
+			$loop_step = 1;
+			$loop_from = $min_entry;
+			$loop_to = $max_entry;
+
+			//* calculate used values
+			if($matches[1] == "*") {
+				//* not to check
+			} else {
+				if($matches[3] < $min_entry || $matches[3] > $max_entry) {
+					//* check if value is in allowed range
+					return $this->get_error($validator['errmsg']);
+				} elseif($matches[4] && ($matches[5] < $min_entry || $matches[5] > $max_entry || $matches[5] <= $matches[3])) {
+					//* check if value is in allowed range and not less or equal to first value
+					return $this->get_error($validator['errmsg']);
+				}
+
+				$loop_from = $matches[3];
+				$loop_to = $matches[3];
+				if($matches[4]) $loop_to = $matches[5];
+			}
+			if($matches[6] && ($matches[7] < 2 || $matches[7] > $max_entry - 1)) {
+				//* check if step value is valid
+				return $this->get_error($validator['errmsg']);
+			}
+			if($matches[7]) $loop_step = $matches[7];
+
+			//* loop through values to set used times
+			for($t = $loop_from; $t <= $loop_to; $t = $t + $loop_step) {
+				$used_times[] = $t;
+			}
+		} //* end foreach entry loop
+
+		//* sort used times and erase doubles
+		sort($used_times);
+		$used_times = array_unique($used_times);
+
+		//* get minimum frequency and store it in $app->tform->cron_min_freq for usage in onUpdateSave and onInsertSave!
+		$min_freq = -1;
+		$prev_time = -1;
+		foreach($used_times as $curtime) {
+			if($prev_time != -1) {
+				$freq = $curtime - $prev_time;
+				if($min_freq == -1 || $freq < $min_freq) $min_freq = $freq;
+			}
+			$prev_time = $curtime;
+		}
+
+		//* check last against first (needed because e.g. wday 1,4,7 has diff 1 not 3
+		$prev_time = $used_times[0];
+		$freq = ($prev_time - $min_entry) + ($max_entry - $curtime) + 1;
+		if($min_freq == -1 || $freq < $min_freq) $min_freq = $freq;
+
+		if($min_freq > 0 && $min_freq <= $max_entry) { //* only store if > 1 && < $max_entry!
+			$min_freq = $min_freq * $in_minutes; // we have to overwrite $app->tform->cron_min_freq if this is higher value
+			if(!$app->tform->cron_min_freq || $app->tform->cron_min_freq > $min_freq) $app->tform->cron_min_freq = $min_freq;
+		}
+
+		//return "DEBUG: " . $app->tform->cron_min_freq . " ($min_freq) --- " . var_export($used_times, true) . "<br />";
 	}
-	
-	
-	
-	
-}
\ No newline at end of file
+
+
+
+
+}
diff --git a/interface/lib/classes/validate_database.inc.php b/interface/lib/classes/validate_database.inc.php
index db419e4..0e6ffef 100644
--- a/interface/lib/classes/validate_database.inc.php
+++ b/interface/lib/classes/validate_database.inc.php
@@ -29,44 +29,44 @@
 */
 
 class validate_database {
-	
+
 	/*
 		Validator function to check if a given list of ips is ok.
 	*/
 	function valid_ip_list($field_name, $field_value, $validator) {
 		global $app;
-		
-    if($_POST["remote_access"] == "y") {
-        if(trim($field_value) == "") return;
-        
-        $values = explode(",", $field_value);
-        foreach($values as $cur_value) {
-            $cur_value = trim($cur_value);
-            
-            $valid = true;
-            if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $cur_value)) {
-                $groups = explode(".", $cur_value);
-                foreach($groups as $group){
-                  if($group<0 OR $group>255)
-                  $valid=false;
-                }
-            } else {
-                $valid = false;
-            }
-            
-            if($valid == false) {
-                $errmsg = $validator['errmsg'];
-                if(isset($app->tform->wordbook[$errmsg])) {
-                    return $app->tform->wordbook[$errmsg]."<br>\r\n";
-                } else {
-                    return $errmsg."<br>\r\n";
-                }
-            }
-        }
-    }
-  }
-	
-	
-	
-	
-}
\ No newline at end of file
+
+		if($_POST["remote_access"] == "y") {
+			if(trim($field_value) == "") return;
+
+			$values = explode(",", $field_value);
+			foreach($values as $cur_value) {
+				$cur_value = trim($cur_value);
+
+				$valid = true;
+				if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $cur_value)) {
+					$groups = explode(".", $cur_value);
+					foreach($groups as $group){
+						if($group<0 or $group>255)
+							$valid=false;
+					}
+				} else {
+					$valid = false;
+				}
+
+				if($valid == false) {
+					$errmsg = $validator['errmsg'];
+					if(isset($app->tform->wordbook[$errmsg])) {
+						return $app->tform->wordbook[$errmsg]."<br>\r\n";
+					} else {
+						return $errmsg."<br>\r\n";
+					}
+				}
+			}
+		}
+	}
+
+
+
+
+}
diff --git a/interface/lib/classes/validate_datetime.inc.php b/interface/lib/classes/validate_datetime.inc.php
index 42afeaf..2cb35f4 100755
--- a/interface/lib/classes/validate_datetime.inc.php
+++ b/interface/lib/classes/validate_datetime.inc.php
@@ -27,66 +27,80 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-class validate_datetime 
+class validate_datetime
 {
 	/**
 	 * Check if the parsed datetime selectors are not set
 	 * to it's default value (zero).
-	 * 
+	 *
 	 * @param array $field_value
 	 * @return bool
 	 */
+
+
 	function _datetime_selected($field_value)
 	{
-		if (is_array($field_value) && count($field_value) >= 5) 
+		if (is_array($field_value) && count($field_value) >= 5)
 		{
 			$result = array_filter($field_value, create_function('$dt_unit', 'return ($dt_unit > 0);'));
-			return (count($result) !== 0);
+			return count($result) !== 0;
 		}
-		
+
 		return false;
 	}
-	
+
+
+
+
+
 	/**
 	 * Check wordbook for the existence of an
 	 * error message. If not found will return
 	 * the parsed error message with line break.
-	 * 
+	 *
 	 * @param $errmsg
 	 * @return string
 	 */
 	function _get_error($errmsg)
 	{
 		global $app;
-		
+
 		$errmsg = (isset($app->tform->wordbook[$errmsg])) ? $app->tform->wordbook[$errmsg] : $errmsg;
 		$errmsg .= '<br />' . PHP_EOL;
-		
+
 		return $errmsg;
 	}
-	
+
+
+
+
+
 	/**
-	 * Helper function - filter the contents of the 
+	 * Helper function - filter the contents of the
 	 * selectors and return the resulting unix timestamp.
-	 * 
+	 *
 	 * @param $field_value
 	 * @return int Unix timestamp
 	 */
 	function _get_timestamp_value($field_value)
 	{
 		if(!is_array($field_value)) return 0;
-        $second = 0;
-		$filtered_values = array_map(create_function('$item','return (int)$item;'), $field_value);
+		$second = 0;
+		$filtered_values = array_map(create_function('$item', 'return (int)$item;'), $field_value);
 		extract($filtered_values, EXTR_OVERWRITE);
-		
+
 		return mktime($hour, $minute, $second, $month, $day, $year);
 	}
-	
+
+
+
+
+
 	/**
 	 * The minimum requirement to submit a datetime field
 	 * is to set the day, month and year values. Check that
 	 * these values are not zero (default).
-	 * 
+	 *
 	 * @param string $field_name
 	 * @param array $field_value
 	 * @param array $validator
@@ -94,31 +108,39 @@
 	 */
 	function not_empty($field_name, $field_value, $validator)
 	{
-        if(!is_array($field_value)) return $this->_get_error($validator['errmsg']);
+		if(!is_array($field_value)) return $this->_get_error($validator['errmsg']);
 		extract($field_value);
 		if ( !($day > 0 && $month > 0 && $year > 0) ) {
 			return $this->_get_error($validator['errmsg']);
 		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Check that the selected datetime is in the future.
-	 * 
+	 *
 	 * @param string $field_name
 	 * @param array $field_value
 	 * @param array $validator
 	 * @return string|void Error message if found
 	 */
-	function is_future($field_name, $field_value, $validator) 
+	function is_future($field_name, $field_value, $validator)
 	{
-		$validator['compare'] = mktime(date('H'), (date('i')-30), 0, date('m'), date('d'), date('Y')); // Turn back the clock 30 minutes for slow posters.	
+		$validator['compare'] = mktime(date('H'), (date('i')-30), 0, date('m'), date('d'), date('Y')); // Turn back the clock 30 minutes for slow posters.
 		return $this->is_greater($field_name, $field_value, $validator);
 	}
-	
+
+
+
+
+
 	/**
 	 * Compare the selected datetime to a timestamp
 	 * parsed via the validator array (key: compare).
-	 * 
+	 *
 	 * @param string $field_name
 	 * @param array $field_value
 	 * @param array $validator
@@ -129,12 +151,12 @@
 		if ( !isset($validator['compare']) || !is_numeric($validator['compare']) || (date('d/m/Y', $validator['compare']) == '01/01/1970') ) {
 			return $this->_get_error('Could not find a unix timestamp to compare datetime with.');
 		}
-		
+
 		$dt_stamp = $this->_get_timestamp_value($field_value);
 		if ($dt_stamp < $validator['compare']) {
 			return $this->_get_error($validator['errmsg']);
 		}
 	}
-	
-	
-}
\ No newline at end of file
+
+
+}
diff --git a/interface/lib/classes/validate_dns.inc.php b/interface/lib/classes/validate_dns.inc.php
index 2e5643d..99ff6c5 100644
--- a/interface/lib/classes/validate_dns.inc.php
+++ b/interface/lib/classes/validate_dns.inc.php
@@ -34,254 +34,254 @@
 
 class validate_dns {
 
-function validate_field($field, $area, $zoneid, $wildcard_allowed = 1){
-  //$desc: Name, Data, RP mbox, RP txtref, SRV target, Zone origin, Name server, Admin email
-  global $app, $conf;
+	function validate_field($field, $area, $zoneid, $wildcard_allowed = 1){
+		//$desc: Name, Data, RP mbox, RP txtref, SRV target, Zone origin, Name server, Admin email
+		global $app, $conf;
 
-  switch ($area) {
-  case "Name":
-    $desc = $app->tform->wordbook['name_txt'];
-    break;
-  case "Data":
-    $desc = $app->tform->wordbook['data_txt'];
-    break;
-  case "RP mbox":
-    $desc = $app->tform->wordbook['rp_mbox_txt'];
-    break;
-  case "RP txtref":
-    $desc = $app->tform->wordbook['rp_txtref_txt'];
-    break;
-  case "SRV target":
-    $desc = $app->tform->wordbook['srv_target_txt'];
-    break;
-  case "Zone origin":
-    $desc = $app->tform->wordbook['zone_origin_txt'];
-    break;
-  case "Name server":
-    $desc = $app->tform->wordbook['ns_txt'];
-    break;
-  case "Admin email":
-    $desc = $app->tform->wordbook['mbox_txt'];
-    break;
-  }
+		switch ($area) {
+		case "Name":
+			$desc = $app->tform->wordbook['name_txt'];
+			break;
+		case "Data":
+			$desc = $app->tform->wordbook['data_txt'];
+			break;
+		case "RP mbox":
+			$desc = $app->tform->wordbook['rp_mbox_txt'];
+			break;
+		case "RP txtref":
+			$desc = $app->tform->wordbook['rp_txtref_txt'];
+			break;
+		case "SRV target":
+			$desc = $app->tform->wordbook['srv_target_txt'];
+			break;
+		case "Zone origin":
+			$desc = $app->tform->wordbook['zone_origin_txt'];
+			break;
+		case "Name server":
+			$desc = $app->tform->wordbook['ns_txt'];
+			break;
+		case "Admin email":
+			$desc = $app->tform->wordbook['mbox_txt'];
+			break;
+		}
 
-  $error = '';
+		$error = '';
 
-  $valid_characters = "*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_";
+		$valid_characters = "*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_";
 
-  if(strlen($field) > 255) $error .= $desc." ".$app->tform->wordbook['error_255_characters']."<br>\r\n";
+		if(strlen($field) > 255) $error .= $desc." ".$app->tform->wordbook['error_255_characters']."<br>\r\n";
 
-  $parts = explode(".", $field);
-  $i = 0;
-  $empty = 0;
-  foreach ($parts as $part){
-    $i++;
+		$parts = explode(".", $field);
+		$i = 0;
+		$empty = 0;
+		foreach ($parts as $part){
+			$i++;
 
-    if(trim($part) == '') $empty += 1;
+			if(trim($part) == '') $empty += 1;
 
-    if(strlen($part) > 63) $error .= $desc." ".$app->tform->wordbook['error_63_characters']."<br>\r\n";
+			if(strlen($part) > 63) $error .= $desc." ".$app->tform->wordbook['error_63_characters']."<br>\r\n";
 
-    if(strspn($part, $valid_characters) != strlen($part)) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
+			if(strspn($part, $valid_characters) != strlen($part)) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
 
-    if(substr($part, 0, 1) == '-') $error .= $desc." ".$app->tform->wordbook['error_hyphen_begin']."<br>\r\n";
-    if(substr($part, -1) == '-') $error .= $desc." ".$app->tform->wordbook['error_hyphen_end']."<br>\r\n";
+			if(substr($part, 0, 1) == '-') $error .= $desc." ".$app->tform->wordbook['error_hyphen_begin']."<br>\r\n";
+			if(substr($part, -1) == '-') $error .= $desc." ".$app->tform->wordbook['error_hyphen_end']."<br>\r\n";
 
-    if(strstr($part, "*")){
-      if($wildcard_allowed){
-        if($i != 1) $error .= $desc." ".$app->tform->wordbook['error_wildcard_non_initial_part']."<br>\r\n";
+			if(strstr($part, "*")){
+				if($wildcard_allowed){
+					if($i != 1) $error .= $desc." ".$app->tform->wordbook['error_wildcard_non_initial_part']."<br>\r\n";
 
-        if($part != "*") $error .= $desc." ".$app->tform->wordbook['error_wildcard_mix']."<br>\r\n";
-      } else {
-        $error .= $desc." ".$app->tform->wordbook['error_no_wildcard_allowed']."<br>\r\n";
-      }
-    }
-  }
+					if($part != "*") $error .= $desc." ".$app->tform->wordbook['error_wildcard_mix']."<br>\r\n";
+				} else {
+					$error .= $desc." ".$app->tform->wordbook['error_no_wildcard_allowed']."<br>\r\n";
+				}
+			}
+		}
 
-  if(substr($field, -1) == '.'){
-    if($i > 2 && $empty > 1) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
-  } else {
-    if($empty > 0 && $field != '') $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
-  }
+		if(substr($field, -1) == '.'){
+			if($i > 2 && $empty > 1) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
+		} else {
+			if($empty > 0 && $field != '') $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
+		}
 
-  if(substr($field, -1) == '.' && $area == 'Name'){
-    $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$zoneid);
-    if(substr($field, (strlen($field) - strlen($soa['origin']))) != $soa['origin']) $error .= $desc." ".$app->tform->wordbook['error_out_of_zone']."<br>\r\n";
-  }
+		if(substr($field, -1) == '.' && $area == 'Name'){
+			$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$zoneid);
+			if(substr($field, (strlen($field) - strlen($soa['origin']))) != $soa['origin']) $error .= $desc." ".$app->tform->wordbook['error_out_of_zone']."<br>\r\n";
+		}
 
-  return $error;
+		return $error;
+	}
+
+	function validate_rp_data(&$data, $zoneid){
+		global $app, $conf;
+		$error = '';
+		$fields = explode(" ", trim($data));
+		if(count($fields) != 2) return $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_invalid_rp']."<br>\r\n";
+		$mbox = $fields[0];
+		$txtref = $fields[1];
+
+		$error .= $this->validate_field($mbox, 'RP mbox', $zoneid, 0);
+		$error .= $this->validate_field($txtref, 'RP txtref', $zoneid, 0);
+
+		$data = $mbox." ".$txtref;
+		return $error;
+	}
+
+	function validate_srv_data(&$data, $zoneid){
+		global $app, $conf;
+		$error = '';
+
+		$fields = explode(" ", trim($data));
+		if(count($fields) != 3) return $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_invalid_srv']."<br>\r\n";
+
+		$weight = $fields[0];
+		$port = $fields[1];
+		$target = $fields[2];
+		if($weight < 0 || $weight > 65535) $error .= $app->tform->wordbook['weight_txt']." (\"<i>" . htmlentities($weight, ENT_QUOTES, $conf["html_content_encoding"])."</i>\") ".$app->tform->wordbook['error_srv_out_of_range']."<br>\r\n";
+		if($port < 0 || $port > 65535) $error .= $app->tform->wordbook['port_txt']." (\"<i>".htmlentities($port, ENT_QUOTES, $conf["html_content_encoding"])."</i>\") ".$app->tform->wordbook['error_srv_out_of_range']."<br>\r\n";
+
+		$error .= $this->validate_field($target, "SRV target", $zoneid, 0);
+
+		$data = (int)$weight." ".(int)$port." ".$target;
+		return $error;
+	}
+
+	function is_integer($value, $fieldname, $zero_allowed = 0){
+		global $app, $conf;
+
+		$error = '';
+
+		if($app->functions->intval($value, true) != $value || !is_numeric($value)) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_integer']."<br>\r\n";
+		if($value > 2147483647) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_greater_than_2147483647']."<br>\r\n";
+		if(!$zero_allowed){
+			if($value <= 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_positive']."<br>\r\n";
+		} else {
+			if($value < 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_negative']."<br>\r\n";
+		}
+
+		return $error;
+	}
+
+	function validate_rr(&$rr){
+		global $app, $conf;
+
+		$error = '';
+
+		$tmp_rr = $rr;
+		foreach($tmp_rr as $key => $val){
+			$rr[$key] = trim($val);
+		}
+		unset($tmp_rr);
+
+		$error .= $this->validate_field($rr['name'], 'Name', $rr['zone'], 1);
+
+		switch ($rr['type']) {
+		case "A":
+			$ip_parts = explode(".", $rr['data']);
+			if(count($ip_parts) != 4){
+				$error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
+			} else {
+				for($n = 0; $n < 4; $n++){
+					$q = $ip_parts[$n];
+					if(!is_numeric($q) || (int)$q < 0 || (int)$q > 255 || trim($q) !== $q) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
+				}
+			}
+			$rr['data'] = (int)$ip_parts[0].".".(int)$ip_parts[1].".".(int)$ip_parts[2].".".(int)$ip_parts[3];
+			break;
+		case "AAAA":
+			$valid_chars = "ABCDEFabcdef1234567890:";
+
+			if(strspn($rr['data'], $valid_chars) != strlen($rr['data'])) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_aaaa']."<br>\r\n";
+			break;
+		case "ALIAS":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			break;
+		case "CNAME":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			break;
+		case "HINFO":
+			if(!strchr($rr['data'], ' ')) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_hinfo']."<br>\r\n";
+			break;
+		case "MX":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			$error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
+			break;
+		case "NS":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			break;
+		case "PTR":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			if(substr($rr['data'], -1) != '.') $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_ptr']."<br>\r\n";
+			break;
+		case "RP":
+			$error .= $this->validate_rp_data($rr['data'], $rr['zone']);
+			break;
+		case "SRV":
+			$error .= $this->validate_srv_data($rr['data'], $rr['zone']);
+			$error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
+			break;
+		case "TXT":
+			break;
+		}
+
+		$error .= $this->is_integer($rr['ttl'], $app->tform->wordbook['ttl_txt']);
+
+
+		return $error;
+	}
+
+	function validate_soa(&$soa){
+		global $app, $conf;
+
+		$error = '';
+
+		$tmp_soa = $soa;
+		foreach($tmp_soa as $key => $val){
+			if($key != 'active') $soa[$key] = trim($val);
+		}
+		unset($tmp_soa);
+
+		if($soa['origin'] == '') $error .= $app->tform->wordbook['origin_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
+		if(substr($soa['origin'], -1) != '.') $error .= $app->tform->wordbook['origin_txt']." ".$app->tform->wordbook['error_dot']."<br>\r\n";
+		$error .= $this->validate_field($soa['origin'], "Zone origin", $soa['id'], 0);
+
+		$error .= $this->is_integer($soa['ttl'], $app->tform->wordbook['ttl_txt']);
+
+		if($soa['ns'] == '') $error .= $app->tform->wordbook['ns_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
+		$error .= $this->validate_field($soa['ns'], "Name server", $soa['id'], 0);
+
+		if($soa['mbox'] == '') $error .= $app->tform->wordbook['mbox_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
+		$error .= $this->validate_field($soa['mbox'], "Admin email", $soa['id'], 0);
+
+		$error .= $this->is_integer($soa['refresh'], $app->tform->wordbook['refresh_txt']);
+
+		$error .= $this->is_integer($soa['retry'], $app->tform->wordbook['retry_txt']);
+
+		$error .= $this->is_integer($soa['expire'], $app->tform->wordbook['expire_txt']);
+
+		$error .= $this->is_integer($soa['minimum'], $app->tform->wordbook['minimum_txt']);
+
+		return $error;
+	}
+
+	function increase_serial($serial){
+		global $app, $conf;
+
+		// increase serial
+		$serial_date = substr($serial, 0, 8);
+		$count = $app->functions->intval(substr($serial, 8, 2));
+		$current_date = date("Ymd");
+		if($serial_date >= $current_date){
+			$count += 1;
+			if ($count > 99) {
+				$serial_date += 1;
+				$count = 0;
+			}
+			$count = str_pad($count, 2, "0", STR_PAD_LEFT);
+			$new_serial = $serial_date.$count;
+		} else {
+			$new_serial = $current_date.'01';
+		}
+		return $new_serial;
+	}
+
 }
-
-function validate_rp_data(&$data, $zoneid){
-  global $app, $conf;
-  $error = '';
-  $fields = explode(" ", trim($data));
-  if(count($fields) != 2) return $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_invalid_rp']."<br>\r\n";
-  $mbox = $fields[0];
-  $txtref = $fields[1];
-
-  $error .= $this->validate_field($mbox, 'RP mbox', $zoneid, 0);
-  $error .= $this->validate_field($txtref, 'RP txtref', $zoneid, 0);
-
-  $data = $mbox." ".$txtref;
-  return $error;
-}
-
-function validate_srv_data(&$data, $zoneid){
-  global $app, $conf;
-  $error = '';
-
-  $fields = explode(" ", trim($data));
-  if(count($fields) != 3) return $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_invalid_srv']."<br>\r\n";
-
-  $weight = $fields[0];
-  $port = $fields[1];
-  $target = $fields[2];
-  if($weight < 0 || $weight > 65535) $error .= $app->tform->wordbook['weight_txt']." (\"<i>" . htmlentities($weight,ENT_QUOTES,$conf["html_content_encoding"])."</i>\") ".$app->tform->wordbook['error_srv_out_of_range']."<br>\r\n";
-  if($port < 0 || $port > 65535) $error .= $app->tform->wordbook['port_txt']." (\"<i>".htmlentities($port,ENT_QUOTES,$conf["html_content_encoding"])."</i>\") ".$app->tform->wordbook['error_srv_out_of_range']."<br>\r\n";
-
-  $error .= $this->validate_field($target, "SRV target", $zoneid, 0);
-
-  $data = (int)$weight." ".(int)$port." ".$target;
-  return $error;
-}
-
-function is_integer($value, $fieldname, $zero_allowed = 0){
-  global $app, $conf;
-
-  $error = '';
-
-  if($app->functions->intval($value, true) != $value || !is_numeric($value)) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_integer']."<br>\r\n";
-  if($value > 2147483647) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_greater_than_2147483647']."<br>\r\n";
-  if(!$zero_allowed){
-    if($value <= 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_positive']."<br>\r\n";
-  } else {
-    if($value < 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_negative']."<br>\r\n";
-  }
-
-  return $error;
-}
-
-function validate_rr(&$rr){
-  global $app, $conf;
-
-  $error = '';
-
-  $tmp_rr = $rr;
-  foreach($tmp_rr as $key => $val){
-    $rr[$key] = trim($val);
-  }
-  unset($tmp_rr);
-
-  $error .= $this->validate_field($rr['name'], 'Name', $rr['zone'], 1);
-
-  switch ($rr['type']) {
-  case "A":
-    $ip_parts = explode(".", $rr['data']);
-    if(count($ip_parts) != 4){
-      $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
-    } else {
-      for($n = 0; $n < 4; $n++){
-        $q = $ip_parts[$n];
-        if(!is_numeric($q) || (int)$q < 0 || (int)$q > 255 || trim($q) !== $q) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
-      }
-    }
-    $rr['data'] = (int)$ip_parts[0].".".(int)$ip_parts[1].".".(int)$ip_parts[2].".".(int)$ip_parts[3];
-    break;
-  case "AAAA":
-    $valid_chars = "ABCDEFabcdef1234567890:";
-
-    if(strspn($rr['data'], $valid_chars) != strlen($rr['data'])) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_aaaa']."<br>\r\n";
-    break;
-  case "ALIAS":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    break;
-  case "CNAME":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    break;
-  case "HINFO":
-    if(!strchr($rr['data'], ' ')) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_hinfo']."<br>\r\n";
-    break;
-  case "MX":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    $error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
-    break;
-  case "NS":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    break;
-  case "PTR":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    if(substr($rr['data'], -1) != '.') $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_ptr']."<br>\r\n";
-    break;
-  case "RP":
-    $error .= $this->validate_rp_data($rr['data'], $rr['zone']);
-    break;
-  case "SRV":
-    $error .= $this->validate_srv_data($rr['data'], $rr['zone']);
-    $error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
-    break;
-  case "TXT":
-    break;
-  }
-
-  $error .= $this->is_integer($rr['ttl'], $app->tform->wordbook['ttl_txt']);
-
-
-  return $error;
-}
-
-function validate_soa(&$soa){
-  global $app, $conf;
-
-  $error = '';
-
-  $tmp_soa = $soa;
-  foreach($tmp_soa as $key => $val){
-    if($key != 'active') $soa[$key] = trim($val);
-  }
-  unset($tmp_soa);
-
-  if($soa['origin'] == '') $error .= $app->tform->wordbook['origin_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
-  if(substr($soa['origin'], -1) != '.') $error .= $app->tform->wordbook['origin_txt']." ".$app->tform->wordbook['error_dot']."<br>\r\n";
-  $error .= $this->validate_field($soa['origin'], "Zone origin", $soa['id'], 0);
-
-  $error .= $this->is_integer($soa['ttl'], $app->tform->wordbook['ttl_txt']);
-
-  if($soa['ns'] == '') $error .= $app->tform->wordbook['ns_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
-  $error .= $this->validate_field($soa['ns'], "Name server", $soa['id'], 0);
-
-  if($soa['mbox'] == '') $error .= $app->tform->wordbook['mbox_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
-  $error .= $this->validate_field($soa['mbox'], "Admin email", $soa['id'], 0);
-
-  $error .= $this->is_integer($soa['refresh'], $app->tform->wordbook['refresh_txt']);
-
-  $error .= $this->is_integer($soa['retry'], $app->tform->wordbook['retry_txt']);
-
-  $error .= $this->is_integer($soa['expire'], $app->tform->wordbook['expire_txt']);
-
-  $error .= $this->is_integer($soa['minimum'], $app->tform->wordbook['minimum_txt']);
-
-  return $error;
-}
-
-function increase_serial($serial){
-  global $app, $conf;
-
-  // increase serial
-  $serial_date = substr($serial, 0, 8);
-  $count = $app->functions->intval(substr($serial, 8, 2));
-  $current_date = date("Ymd");
-  if($serial_date >= $current_date){
-    $count += 1;
-    if ($count > 99) {
-        $serial_date += 1;
-        $count = 0;
-    }
-    $count = str_pad($count, 2, "0", STR_PAD_LEFT);
-    $new_serial = $serial_date.$count;
-  } else {
-    $new_serial = $current_date.'01';
-  }
-  return $new_serial;
-}
-
-}
\ No newline at end of file
diff --git a/interface/lib/classes/validate_domain.inc.php b/interface/lib/classes/validate_domain.inc.php
index ca137f6..3135c7a 100644
--- a/interface/lib/classes/validate_domain.inc.php
+++ b/interface/lib/classes/validate_domain.inc.php
@@ -30,98 +30,98 @@
 */
 
 class validate_domain {
-	
-    function get_error($errmsg) {
-        global $app;
-        
-        if(isset($app->tform->wordbook[$errmsg])) {
-            return $app->tform->wordbook[$errmsg]."<br>\r\n";
-        } else {
-            return $errmsg."<br>\r\n";
-        }
-    }
-    
-    /* Validator function for domain (website) */
-    function web_domain($field_name, $field_value, $validator) {
-        if(empty($field_value)) return $this->get_error('domain_error_empty');
-        
-        // do not allow wildcards on website domains
-        $result = $this->_regex_validate($field_value);
-        if(!$result) return $this->get_error('domain_error_regex');
-        
-        $result = $this->_check_unique($field_value);
-        if(!$result) return $this->get_error('domain_error_unique');
-    }
-    
-    /* Validator function for sub domain */
-    function sub_domain($field_name, $field_value, $validator) {
-        if(empty($field_value)) return $this->get_error('domain_error_empty');
-        
-        $allow_wildcard = $this->_wildcard_limit();
-        if($allow_wildcard == false && substr($field_value, 0, 2) === '*.') return $this->get_error('domain_error_wildcard');
-        
-        $result = $this->_regex_validate($field_value, $allow_wildcard);
-        if(!$result) return $this->get_error('domain_error_regex');
-        
-        $result = $this->_check_unique($field_value);
-        if(!$result) return $this->get_error('domain_error_unique');
-    }
-    
-    /* Validator function for alias domain */
-    function alias_domain($field_name, $field_value, $validator) {
-        if(empty($field_value)) return $this->get_error('domain_error_empty');
-        
-        // do not allow wildcards on alias domains
-        $result = $this->_regex_validate($field_value);
-        if(!$result) return $this->get_error('domain_error_regex');
-        
-        $result = $this->_check_unique($field_value);
-        if(!$result) return $this->get_error('domain_error_unique');
-    }
-    
-    /* Validator function for checking the auto subdomain of a web/aliasdomain */
-    function web_domain_autosub($field_name, $field_value, $validator) {
-        global $app;
-        if(empty($field_value) || $field_name != 'subdomain') return; // none set
-        
-        $check_domain = $_POST['domain'];
-        $app->uses('ini_parser,getconf');
-        $settings = $app->getconf->get_global_config('domains');
-        if ($settings['use_domain_module'] == 'y') {
-            $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($check_domain);
-            $domain_check = $app->db->queryOneRecord($sql);
-            if(!$domain_check) return;
-            $check_domain = $domain_check['domain'];
-        }
-        
-        $result = $this->_check_unique($field_value . '.' . $check_domain, true);
-        if(!$result) return $this->get_error('domain_error_autosub');
-    }
-    
-    /* internal validator function to match regexp */
-    function _regex_validate($domain_name, $allow_wildcard = false) {
-        $pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/';
-        return preg_match($pattern, $domain_name);
-    }
-    
-    /* check if the domain hostname is unique (keep in mind the auto subdomains!) */
-    function _check_unique($domain_name, $only_domain = false) {
-        global $app, $page;
-        
-        if(isset($app->remoting_lib->primary_id)) {
-            $primary_id = $app->remoting_lib->primary_id;
+
+	function get_error($errmsg) {
+		global $app;
+
+		if(isset($app->tform->wordbook[$errmsg])) {
+			return $app->tform->wordbook[$errmsg]."<br>\r\n";
+		} else {
+			return $errmsg."<br>\r\n";
+		}
+	}
+
+	/* Validator function for domain (website) */
+	function web_domain($field_name, $field_value, $validator) {
+		if(empty($field_value)) return $this->get_error('domain_error_empty');
+
+		// do not allow wildcards on website domains
+		$result = $this->_regex_validate($field_value);
+		if(!$result) return $this->get_error('domain_error_regex');
+
+		$result = $this->_check_unique($field_value);
+		if(!$result) return $this->get_error('domain_error_unique');
+	}
+
+	/* Validator function for sub domain */
+	function sub_domain($field_name, $field_value, $validator) {
+		if(empty($field_value)) return $this->get_error('domain_error_empty');
+
+		$allow_wildcard = $this->_wildcard_limit();
+		if($allow_wildcard == false && substr($field_value, 0, 2) === '*.') return $this->get_error('domain_error_wildcard');
+
+		$result = $this->_regex_validate($field_value, $allow_wildcard);
+		if(!$result) return $this->get_error('domain_error_regex');
+
+		$result = $this->_check_unique($field_value);
+		if(!$result) return $this->get_error('domain_error_unique');
+	}
+
+	/* Validator function for alias domain */
+	function alias_domain($field_name, $field_value, $validator) {
+		if(empty($field_value)) return $this->get_error('domain_error_empty');
+
+		// do not allow wildcards on alias domains
+		$result = $this->_regex_validate($field_value);
+		if(!$result) return $this->get_error('domain_error_regex');
+
+		$result = $this->_check_unique($field_value);
+		if(!$result) return $this->get_error('domain_error_unique');
+	}
+
+	/* Validator function for checking the auto subdomain of a web/aliasdomain */
+	function web_domain_autosub($field_name, $field_value, $validator) {
+		global $app;
+		if(empty($field_value) || $field_name != 'subdomain') return; // none set
+
+		$check_domain = $_POST['domain'];
+		$app->uses('ini_parser,getconf');
+		$settings = $app->getconf->get_global_config('domains');
+		if ($settings['use_domain_module'] == 'y') {
+			$sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($check_domain);
+			$domain_check = $app->db->queryOneRecord($sql);
+			if(!$domain_check) return;
+			$check_domain = $domain_check['domain'];
+		}
+
+		$result = $this->_check_unique($field_value . '.' . $check_domain, true);
+		if(!$result) return $this->get_error('domain_error_autosub');
+	}
+
+	/* internal validator function to match regexp */
+	function _regex_validate($domain_name, $allow_wildcard = false) {
+		$pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/';
+		return preg_match($pattern, $domain_name);
+	}
+
+	/* check if the domain hostname is unique (keep in mind the auto subdomains!) */
+	function _check_unique($domain_name, $only_domain = false) {
+		global $app, $page;
+
+		if(isset($app->remoting_lib->primary_id)) {
+			$primary_id = $app->remoting_lib->primary_id;
 			$domain = $app->remoting_lib->dataRecord;
-        } else {
-            $primary_id = $app->tform->primary_id;
+		} else {
+			$primary_id = $app->tform->primary_id;
 			$domain = $page->dataRecord;
-        }
+		}
 
 		if($domain['ip_address'] == '' || $domain['ipv6_address'] == ''){
 			if($domain['parent_domain_id'] > 0){
 				$parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$domain['parent_domain_id']);
 			}
 		}
-		
+
 		// check if domain has alias/subdomains - if we move a web to another IP, make sure alias/subdomains are checked as well
 		$aliassubdomains = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$app->functions->intval($primary_id)." AND (type = 'alias' OR type = 'subdomain')");
 		$additional_sql1 = '';
@@ -132,10 +132,10 @@
 				$additional_sql2 .= " OR CONCAT(`subdomain`, '.', `domain`) = '".$app->db->quote($aliassubdomain['domain'])."'";
 			}
 		}
-		
-        //$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `domain` = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
+
+		//$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `domain` = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
 		//if($check['cnt'] > 0) return false;
-		
+
 		// we can have the same domain on different servers or different IPs, so we have to check for identical domains on the same IP (or wildcard IPs)
 		$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (`domain` = '" . $app->db->quote($domain_name) . "'".$additional_sql1.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql1 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
 
@@ -151,14 +151,14 @@
 						$check_parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ".$check['parent_domain_id']);
 					}
 				}
-					
+
 				if($domain['ip_address'] == '' && $check['ip_address'] != ''){
 					if(is_array($parent_domain) && !empty($parent_domain)){
 						if($parent_domain['ip_address'] == '*') return false;
 						if($parent_domain['ip_address'] != '' && $check['ip_address'] == $parent_domain['ip_address']) return false;
 					}
 				}
-				
+
 				if($domain['ip_address'] == '' && $check['ip_address'] == ''){
 					if($check['parent_domain_id'] > 0){
 						if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -170,7 +170,7 @@
 						if($parent_domain['ip_address'] != '' && $check_parent_domain['ip_address'] == $parent_domain['ip_address']) return false;
 					}
 				}
-				
+
 				if($check['ip_address'] == '' && $domain['ip_address'] != ''){
 					if($check['parent_domain_id'] > 0){
 						if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -179,19 +179,19 @@
 						}
 					}
 				}
-				
+
 				if($domain['ipv6_address'] == '' && $check['ipv6_address'] != ''){
 					if(is_array($parent_domain) && !empty($parent_domain)){
 						if($parent_domain['ipv6_address'] != '' && $check['ipv6_address'] == $parent_domain['ipv6_address']) return false;
 					}
 				}
-				
+
 				if($domain['ipv6_address'] == '' && $check['ipv6_address'] == ''){
 					if(is_array($parent_domain) && !empty($parent_domain)){
 						if($parent_domain['ipv6_address'] != '' && $check_parent_domain['ipv6_address'] == $parent_domain['ipv6_address']) return false;
 					}
 				}
-				
+
 				if($check['ipv6_address'] == '' && $domain['ipv6_address'] != ''){
 					if($check['parent_domain_id'] > 0){
 						if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -201,10 +201,10 @@
 				}
 			}
 		}
-        
-        
-        if($only_domain == false) {
-            //$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
+
+
+		if($only_domain == false) {
+			//$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
 			//if($check['cnt'] > 0) return false;
 			// we can have the same domain on different servers or different IPs, so we have to check for identical domains on the same IP (or wildcard IPs)
 			$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "'".$additional_sql2.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql2 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
@@ -220,14 +220,14 @@
 							$check_parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ".$check['parent_domain_id']);
 						}
 					}
-					
+
 					if($domain['ip_address'] == '' && $check['ip_address'] != ''){
 						if(is_array($parent_domain) && !empty($parent_domain)){
 							if($parent_domain['ip_address'] == '*') return false;
 							if($parent_domain['ip_address'] != '' && $check['ip_address'] == $parent_domain['ip_address']) return false;
 						}
 					}
-				
+
 					if($domain['ip_address'] == '' && $check['ip_address'] == ''){
 						if($check['parent_domain_id'] > 0){
 							if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -239,7 +239,7 @@
 							if($parent_domain['ip_address'] != '' && $check_parent_domain['ip_address'] == $parent_domain['ip_address']) return false;
 						}
 					}
-				
+
 					if($check['ip_address'] == '' && $domain['ip_address'] != ''){
 						if($check['parent_domain_id'] > 0){
 							if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -248,19 +248,19 @@
 							}
 						}
 					}
-				
+
 					if($domain['ipv6_address'] == '' && $check['ipv6_address'] != ''){
 						if(is_array($parent_domain) && !empty($parent_domain)){
 							if($parent_domain['ipv6_address'] != '' && $check['ipv6_address'] == $parent_domain['ipv6_address']) return false;
 						}
 					}
-				
+
 					if($domain['ipv6_address'] == '' && $check['ipv6_address'] == ''){
 						if(is_array($parent_domain) && !empty($parent_domain)){
 							if($parent_domain['ipv6_address'] != '' && $check_parent_domain['ipv6_address'] == $parent_domain['ipv6_address']) return false;
 						}
 					}
-				
+
 					if($check['ipv6_address'] == '' && $domain['ipv6_address'] != ''){
 						if($check['parent_domain_id'] > 0){
 							if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -270,24 +270,25 @@
 					}
 				}
 			}
-            
-        }
-        
-        return true;
-    }
-    
-    /* check if the client may add wildcard domains */
-    function _wildcard_limit() {
-        global $app;
-        
-        if($_SESSION["s"]["user"]["typ"] != 'admin') {
-            // Get the limits of the client
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-            $client = $app->db->queryOneRecord("SELECT limit_wildcard FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-        
-            if($client["limit_wildcard"] == 'y') return true;
-            else return false;
-        }
-        return true; // admin may always add wildcard domain
-    }
-}
\ No newline at end of file
+
+		}
+
+		return true;
+	}
+
+	/* check if the client may add wildcard domains */
+	function _wildcard_limit() {
+		global $app;
+
+		if($_SESSION["s"]["user"]["typ"] != 'admin') {
+			// Get the limits of the client
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT limit_wildcard FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+			if($client["limit_wildcard"] == 'y') return true;
+			else return false;
+		}
+		return true; // admin may always add wildcard domain
+	}
+
+}
diff --git a/interface/lib/classes/validate_ftpuser.inc.php b/interface/lib/classes/validate_ftpuser.inc.php
index 60768a3..64ca12f 100644
--- a/interface/lib/classes/validate_ftpuser.inc.php
+++ b/interface/lib/classes/validate_ftpuser.inc.php
@@ -29,66 +29,66 @@
 */
 
 class validate_ftpuser {
-	
+
 	/*
 		Validator function to check if a given dir is ok.
 	*/
 	function ftp_dir($field_name, $field_value, $validator) {
 		global $app;
-		
-        if($app->tform->primary_id == 0) {
-            $errmsg = $validator['errmsg'];
-            if(isset($app->tform->wordbook[$errmsg])) {
-                return $app->tform->wordbook[$errmsg]."<br>\r\n";
-            } else {
-                return $errmsg."<br>\r\n";
-            }
-        }
-        
-        
-        $ftp_data = $app->db->queryOneRecord("SELECT parent_domain_id FROM ftp_user WHERE ftp_user_id = '".$app->db->quote($app->tform->primary_id)."'");
-        if(!is_array($ftp_data) || $ftp_data["parent_domain_id"] < 1) {
-            $errmsg = $validator['errmsg'];
-            if(isset($app->tform->wordbook[$errmsg])) {
-                return $app->tform->wordbook[$errmsg]."<br>\r\n";
-            } else {
-                return $errmsg."<br>\r\n";
-            }
-        }
-        
-        $domain_data = $app->db->queryOneRecord("SELECT domain_id, document_root FROM web_domain WHERE domain_id = '".$app->db->quote($ftp_data["parent_domain_id"])."'");
-        if(!is_array($domain_data) || $domain_data["domain_id"] < 1) {
-            $errmsg = $validator['errmsg'];
-            if(isset($app->tform->wordbook[$errmsg])) {
-                return $app->tform->wordbook[$errmsg]."<br>\r\n";
-            } else {
-                return $errmsg."<br>\r\n";
-            }
-        }
-        
-        $doc_root = $domain_data["document_root"];
-        $is_ok = false;
-        if($doc_root == $field_value) $is_ok = true;
-        
-        $doc_root .= "/";
-        if(substr($field_value, 0, strlen($doc_root)) == $doc_root) $is_ok = true;
-		
-		if(stristr($field_value,'..') or stristr($field_value,'./') or stristr($field_value,'/.')) $is_ok = false;
-        
+
+		if($app->tform->primary_id == 0) {
+			$errmsg = $validator['errmsg'];
+			if(isset($app->tform->wordbook[$errmsg])) {
+				return $app->tform->wordbook[$errmsg]."<br>\r\n";
+			} else {
+				return $errmsg."<br>\r\n";
+			}
+		}
+
+
+		$ftp_data = $app->db->queryOneRecord("SELECT parent_domain_id FROM ftp_user WHERE ftp_user_id = '".$app->db->quote($app->tform->primary_id)."'");
+		if(!is_array($ftp_data) || $ftp_data["parent_domain_id"] < 1) {
+			$errmsg = $validator['errmsg'];
+			if(isset($app->tform->wordbook[$errmsg])) {
+				return $app->tform->wordbook[$errmsg]."<br>\r\n";
+			} else {
+				return $errmsg."<br>\r\n";
+			}
+		}
+
+		$domain_data = $app->db->queryOneRecord("SELECT domain_id, document_root FROM web_domain WHERE domain_id = '".$app->db->quote($ftp_data["parent_domain_id"])."'");
+		if(!is_array($domain_data) || $domain_data["domain_id"] < 1) {
+			$errmsg = $validator['errmsg'];
+			if(isset($app->tform->wordbook[$errmsg])) {
+				return $app->tform->wordbook[$errmsg]."<br>\r\n";
+			} else {
+				return $errmsg."<br>\r\n";
+			}
+		}
+
+		$doc_root = $domain_data["document_root"];
+		$is_ok = false;
+		if($doc_root == $field_value) $is_ok = true;
+
+		$doc_root .= "/";
+		if(substr($field_value, 0, strlen($doc_root)) == $doc_root) $is_ok = true;
+
+		if(stristr($field_value, '..') or stristr($field_value, './') or stristr($field_value, '/.')) $is_ok = false;
+
 		//* Final check if docroot path of website is >= 5 chars
 		if(strlen($doc_root) < 5) $is_ok = false;
-		
-        if($is_ok == false) {
-            $errmsg = $validator['errmsg'];
-            if(isset($app->tform->wordbook[$errmsg])) {
-                return $app->tform->wordbook[$errmsg]."<br>\r\n";
-            } else {
-                return $errmsg."<br>\r\n";
-            }
-        }
+
+		if($is_ok == false) {
+			$errmsg = $validator['errmsg'];
+			if(isset($app->tform->wordbook[$errmsg])) {
+				return $app->tform->wordbook[$errmsg]."<br>\r\n";
+			} else {
+				return $errmsg."<br>\r\n";
+			}
+		}
 	}
-	
-	
-	
-	
-}
\ No newline at end of file
+
+
+
+
+}
diff --git a/interface/lib/classes/validate_reseller.inc.php b/interface/lib/classes/validate_reseller.inc.php
index 5453905..c02c4fd 100644
--- a/interface/lib/classes/validate_reseller.inc.php
+++ b/interface/lib/classes/validate_reseller.inc.php
@@ -29,19 +29,19 @@
 */
 
 class validate_reseller {
-    
-    /*
+
+	/*
         Validator function to check if a given cron command is in correct form (url only).
     */
-    function limit_client($field_name, $field_value, $validator) {
-        global $app;
-		
+	function limit_client($field_name, $field_value, $validator) {
+		global $app;
+
 		if($field_value <= 0) {
 			return $app->tform->lng('limit_client_error_positive');
 		} else {
 			return '';
 		}
-    }
+	}
 
-	
-}
\ No newline at end of file
+
+}
diff --git a/interface/lib/config.inc.php b/interface/lib/config.inc.php
index 3cd1723..7de46b7 100644
--- a/interface/lib/config.inc.php
+++ b/interface/lib/config.inc.php
@@ -31,16 +31,16 @@
 //** Web-only
 if( !empty($_SERVER['DOCUMENT_ROOT']) ) {
 
-	Header("Pragma: no-cache");
-	Header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
-	Header("Content-Type: text/html; charset=utf-8");
+	header("Pragma: no-cache");
+	header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
+	header("Content-Type: text/html; charset=utf-8");
 
-	ini_set('register_globals',0);
+	ini_set('register_globals', 0);
 }
 
 //** SVN Revision
 $svn_revision = '$Revision: 1525 $';
-$revision = str_replace(array('Revision:','$',' '), '', $svn_revision);
+$revision = str_replace(array('Revision:', '$', ' '), '', $svn_revision);
 
 //** Application
 define('ISPC_APP_TITLE', 'ISPConfig');
@@ -58,21 +58,21 @@
 $conf['db_new_link'] = false;
 $conf['db_client_flags'] = 0;
 
-define('DB_TYPE',$conf['db_type']);
-define('DB_HOST',$conf['db_host']);
-define('DB_DATABASE',$conf['db_database']);
-define('DB_USER',$conf['db_user']);
-define('DB_PASSWORD',$conf['db_password']);
-define('DB_CHARSET',$conf['db_charset']);
+define('DB_TYPE', $conf['db_type']);
+define('DB_HOST', $conf['db_host']);
+define('DB_DATABASE', $conf['db_database']);
+define('DB_USER', $conf['db_user']);
+define('DB_PASSWORD', $conf['db_password']);
+define('DB_CHARSET', $conf['db_charset']);
 
 
 //** Database settings for the master DB. This setting is only used in multiserver setups
-$conf['dbmaster_type']			= 'mysql';
-$conf['dbmaster_host']			= '{mysql_master_server_host}';
-$conf['dbmaster_database']		= '{mysql_master_server_database}';
-$conf['dbmaster_user']			= '{mysql_master_server_ispconfig_user}';
-$conf['dbmaster_password']		= '{mysql_master_server_ispconfig_password}';
-$conf['dbmaster_new_link'] 		= false;
+$conf['dbmaster_type']   = 'mysql';
+$conf['dbmaster_host']   = '{mysql_master_server_host}';
+$conf['dbmaster_database']  = '{mysql_master_server_database}';
+$conf['dbmaster_user']   = '{mysql_master_server_ispconfig_user}';
+$conf['dbmaster_password']  = '{mysql_master_server_ispconfig_password}';
+$conf['dbmaster_new_link']   = false;
 $conf['dbmaster_client_flags']  = 0;
 
 
@@ -87,15 +87,15 @@
 define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache');
 
 //** Paths (Do not change!)
-$conf['rootpath'] = substr(dirname(__FILE__),0,-4);
+$conf['rootpath'] = substr(dirname(__FILE__), 0, -4);
 $conf['fs_div'] = '/'; // File system separator (divider), "\\" on Windows and "/" on Linux and UNIX
 $conf['classpath'] = $conf['rootpath'].$conf['fs_div'].'lib'.$conf['fs_div'].'classes';
 $conf['temppath'] = $conf['rootpath'].$conf['fs_div'].'temp';
 
-define('FS_DIV',$conf['fs_div']);
-define('SERVER_ROOT',$conf['rootpath']);
-define('INCLUDE_ROOT',SERVER_ROOT.FS_DIV.'lib');
-define('CLASSES_ROOT',INCLUDE_ROOT.FS_DIV.'classes');
+define('FS_DIV', $conf['fs_div']);
+define('SERVER_ROOT', $conf['rootpath']);
+define('INCLUDE_ROOT', SERVER_ROOT.FS_DIV.'lib');
+define('CLASSES_ROOT', INCLUDE_ROOT.FS_DIV.'classes');
 
 
 //** Server
@@ -110,8 +110,8 @@
 $conf['interface_modules_enabled'] = 'dashboard,mail,sites,dns,tools';
 
 //** Demo mode
-/* The demo mode is an option to restrict certain actions in the interface like 
-*  changing the password of users with sys_userid < 3 etc. to be 
+/* The demo mode is an option to restrict certain actions in the interface like
+*  changing the password of users with sys_userid < 3 etc. to be
 *  able to run the ISPConfig interface as online demo. It does not
 *  affect the server part. The demo mode should be always set to false
 *  on every normal installation
@@ -154,8 +154,8 @@
 
 
 //** Constants
-define('LOGLEVEL_DEBUG',0);
-define('LOGLEVEL_WARN',1);
-define('LOGLEVEL_ERROR',2);
+define('LOGLEVEL_DEBUG', 0);
+define('LOGLEVEL_WARN', 1);
+define('LOGLEVEL_ERROR', 2);
 
 ?>
diff --git a/interface/lib/plugins/clients_template_plugin.inc.php b/interface/lib/plugins/clients_template_plugin.inc.php
index 4bf222e..c4899bf 100644
--- a/interface/lib/plugins/clients_template_plugin.inc.php
+++ b/interface/lib/plugins/clients_template_plugin.inc.php
@@ -1,34 +1,36 @@
 <?php
 /**
  * clients_template_plugin plugin
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG
  * @author (original tools.inc.php) Till Brehm, projektfarm Gmbh
  * @author (original tools.inc.php) Oliver Vogel www.muv.com
  */
- 
+
+
 class clients_template_plugin {
 
 	var $plugin_name        = 'clients_template_plugin';
 	var $class_name         = 'clients_template_plugin';
-	
 
-    /*
+
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        $app->plugin->registerEvent('client:client:on_after_insert','clients_template_plugin','apply_client_templates');
-        $app->plugin->registerEvent('client:client:on_after_update','clients_template_plugin','apply_client_templates');
-        $app->plugin->registerEvent('client:reseller:on_after_insert','clients_template_plugin','apply_client_templates');
-        $app->plugin->registerEvent('client:reseller:on_after_update','clients_template_plugin','apply_client_templates');
-    }
-    
-    function apply_client_templates($event_name, $page_form) {
-        global $app;
-        
-        $app->uses('client_templates');
-        $app->client_templates->apply_client_templates($page_form->id);
-    }
-}
\ No newline at end of file
+	function onLoad() {
+		global $app;
+		//Register for the events
+		$app->plugin->registerEvent('client:client:on_after_insert', 'clients_template_plugin', 'apply_client_templates');
+		$app->plugin->registerEvent('client:client:on_after_update', 'clients_template_plugin', 'apply_client_templates');
+		$app->plugin->registerEvent('client:reseller:on_after_insert', 'clients_template_plugin', 'apply_client_templates');
+		$app->plugin->registerEvent('client:reseller:on_after_update', 'clients_template_plugin', 'apply_client_templates');
+	}
+
+	function apply_client_templates($event_name, $page_form) {
+		global $app;
+
+		$app->uses('client_templates');
+		$app->client_templates->apply_client_templates($page_form->id);
+	}
+
+}
diff --git a/interface/lib/plugins/mail_user_filter_plugin.inc.php b/interface/lib/plugins/mail_user_filter_plugin.inc.php
index f376a77..df939d3 100644
--- a/interface/lib/plugins/mail_user_filter_plugin.inc.php
+++ b/interface/lib/plugins/mail_user_filter_plugin.inc.php
@@ -29,44 +29,44 @@
 */
 
 class mail_user_filter_plugin {
-	
+
 	var $plugin_name = 'mail_user_filter_plugin';
 	var $class_name = 'mail_user_filter_plugin';
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugin->registerEvent('mail:mail_user_filter:on_after_insert','mail_user_filter_plugin','mail_user_filter_edit');
-		$app->plugin->registerEvent('mail:mail_user_filter:on_after_update','mail_user_filter_plugin','mail_user_filter_edit');
-		$app->plugin->registerEvent('mail:mail_user_filter:on_after_delete','mail_user_filter_plugin','mail_user_filter_del');
-		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_insert','mail_user_filter_plugin','mail_user_filter_edit');
-		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_update','mail_user_filter_plugin','mail_user_filter_edit');
-		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_delete','mail_user_filter_plugin','mail_user_filter_del');
-		
+
+		$app->plugin->registerEvent('mail:mail_user_filter:on_after_insert', 'mail_user_filter_plugin', 'mail_user_filter_edit');
+		$app->plugin->registerEvent('mail:mail_user_filter:on_after_update', 'mail_user_filter_plugin', 'mail_user_filter_edit');
+		$app->plugin->registerEvent('mail:mail_user_filter:on_after_delete', 'mail_user_filter_plugin', 'mail_user_filter_del');
+		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_insert', 'mail_user_filter_plugin', 'mail_user_filter_edit');
+		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_update', 'mail_user_filter_plugin', 'mail_user_filter_edit');
+		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_delete', 'mail_user_filter_plugin', 'mail_user_filter_del');
+
 	}
-	
-	
+
+
 	/*
-		function to create the mail filter rule and insert it into the custom rules 
+		function to create the mail filter rule and insert it into the custom rules
 		field when a new mail filter is added or modified.
 	*/
-	function mail_user_filter_edit($event_name,$page_form) {
+	function mail_user_filter_edit($event_name, $page_form) {
 		global $app, $conf;
-				
+
 		$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$page_form->dataRecord["mailuser_id"]);
 		$skip = false;
-		$lines = explode("\n",$mailuser['custom_mailfilter']);
+		$lines = explode("\n", $mailuser['custom_mailfilter']);
 		$out = '';
 		$found = false;
-		
+
 		foreach($lines as $line) {
 			$line = rtrim($line);
 			if($line == '### BEGIN FILTER_ID:'.$page_form->id) {
@@ -79,27 +79,27 @@
 				$skip = false;
 			}
 		}
-		
+
 		// We did not found our rule, so we add it now as first rule.
 		if($found == false && $page_form->dataRecord["active"] == 'y') {
 			$new_rule = $this->mail_user_filter_get_rule($page_form);
 			$out = $new_rule . $out;
 		}
-		
+
 		$out = $app->db->quote($out);
 		$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $page_form->dataRecord["mailuser_id"]);
-		
-		
+
+
 	}
-	
-	function mail_user_filter_del($event_name,$page_form) {
+
+	function mail_user_filter_del($event_name, $page_form) {
 		global $app, $conf;
-		
+
 		$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$page_form->dataRecord["mailuser_id"]);
 		$skip = false;
-		$lines = explode("\n",$mailuser['custom_mailfilter']);
+		$lines = explode("\n", $mailuser['custom_mailfilter']);
 		$out = '';
-		
+
 		foreach($lines as $line) {
 			$line = trim($line);
 			if($line == '### BEGIN FILTER_ID:'.$page_form->id) {
@@ -110,40 +110,40 @@
 				$skip = false;
 			}
 		}
-		
+
 		$out = $app->db->quote($out);
 		$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $page_form->dataRecord["mailuser_id"]);
 	}
-	
-	
+
+
 	/*
 		private function to create the mail filter rules in maildrop or sieve format.
 	*/
 	private function mail_user_filter_get_rule($page_form) {
-		
-		global $app,$conf;
-		
+
+		global $app, $conf;
+
 		$app->uses("getconf");
 		$mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ".$app->functions->intval($page_form->dataRecord["mailuser_id"]));
-		$mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]),'mail');
-		
+		$mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]), 'mail');
+
 		if($mail_config['mail_filter_syntax'] == 'sieve') {
-			
+
 			// #######################################################
 			// Filter in Sieve Syntax
 			// #######################################################
-			
+
 			$content = '';
 			$content .= '### BEGIN FILTER_ID:'.$page_form->id."\n";
-			
+
 			//$content .= 'require ["fileinto", "regex", "vacation"];'."\n";
-			
+
 			$content .= 'if header :regex    ["'.strtolower($page_form->dataRecord["source"]).'"] ["';
-			
+
 			$searchterm = preg_quote($page_form->dataRecord["searchterm"]);
-			$searchterm = str_replace('\\[','\\\\[',$searchterm);
-			$searchterm = str_replace('\\]','\\\\]',$searchterm);
-			
+			$searchterm = str_replace('\\[', '\\\\[', $searchterm);
+			$searchterm = str_replace('\\]', '\\\\]', $searchterm);
+
 			if($page_form->dataRecord["op"] == 'contains') {
 				$content .= ".*".$searchterm;
 			} elseif ($page_form->dataRecord["op"] == 'is') {
@@ -153,21 +153,21 @@
 			} elseif ($page_form->dataRecord["op"] == 'ends') {
 				$content .= ".*".$searchterm."$";
 			}
-			
+
 			$content .= '"] {'."\n";
-			
+
 			if($page_form->dataRecord["action"] == 'move') {
 				$content .= '    fileinto "'.$page_form->dataRecord["target"].'";' . "\n";
 			} else {
 				$content .= "    discard;\n";
 			}
-			
+
 			$content .= "    stop;\n}\n";
-			
+
 			$content .= '### END FILTER_ID:'.$page_form->id."\n";
-		
+
 		} else {
-		
+
 			// #######################################################
 			// Filter in Maildrop Syntax
 			// #######################################################
@@ -187,7 +187,7 @@
 
 			if($page_form->dataRecord["action"] == 'move') {
 
-			$content .= "
+				$content .= "
 `test -e ".$TestChDirQuotes." && exit 1 || exit 0`
 if ( ".'$RETURNCODE'." != 1 )
 {
@@ -224,19 +224,19 @@
 
 			$content .= "}\n";
 			$content .= "}\n";
-		
+
 			//}
-		
+
 			$content .= '### END FILTER_ID:'.$page_form->id."\n";
-		
+
 		}
-		
+
 		return $content;
 	}
-	
+
 
 } // end class
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/plugins/sites_web_database_user_plugin.inc.php b/interface/lib/plugins/sites_web_database_user_plugin.inc.php
index 791ee59..1a880a1 100644
--- a/interface/lib/plugins/sites_web_database_user_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_database_user_plugin.inc.php
@@ -1,41 +1,43 @@
 <?php
 /**
  * sites_web_database_user_plugin plugin
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG 2012
  */
- 
+
+
 class sites_web_database_user_plugin {
 
 	var $plugin_name        = 'sites_web_database_user_plugin';
 	var $class_name         = 'sites_web_database_user_plugin';
-	
-    /*
+
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        $app->plugin->registerEvent('sites:web_database_user:on_after_update','sites_web_database_user_plugin','sites_web_database_user_edit');
-        $app->plugin->registerEvent('sites:web_database_user:on_after_insert','sites_web_database_user_plugin','sites_web_database_user_edit');
-    }
-
-    /*
-		Function to create the sites_web_database_user rule and insert it into the custom rules           
-    */
-    function sites_web_database_user_edit($event_name, $page_form) {
-        global $app, $conf;   
-        
-        // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
-        // also make sure that the user can not delete entry created by an admin
-        if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
-            $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
-            $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE database_user_id = ".$page_form->id);
-        }
-        if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) {
-            $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
-            $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$page_form->id);
-        }
-        //$app->db->query("UPDATE web_database_user SET server_id = '" . $app->functions->intval($conf['server_id']) . "' WHERE database_user_id = ".$page_form->id);
+	function onLoad() {
+		global $app;
+		//Register for the events
+		$app->plugin->registerEvent('sites:web_database_user:on_after_update', 'sites_web_database_user_plugin', 'sites_web_database_user_edit');
+		$app->plugin->registerEvent('sites:web_database_user:on_after_insert', 'sites_web_database_user_plugin', 'sites_web_database_user_edit');
 	}
-}              	
\ No newline at end of file
+
+	/*
+		Function to create the sites_web_database_user rule and insert it into the custom rules
+    */
+	function sites_web_database_user_edit($event_name, $page_form) {
+		global $app, $conf;
+
+		// make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
+		// also make sure that the user can not delete entry created by an admin
+		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
+			$client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE database_user_id = ".$page_form->id);
+		}
+		if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) {
+			$client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$page_form->id);
+		}
+		//$app->db->query("UPDATE web_database_user SET server_id = '" . $app->functions->intval($conf['server_id']) . "' WHERE database_user_id = ".$page_form->id);
+	}
+
+}
diff --git a/interface/lib/plugins/sites_web_domain_plugin.inc.php b/interface/lib/plugins/sites_web_domain_plugin.inc.php
index a21c56f..a84857a 100644
--- a/interface/lib/plugins/sites_web_domain_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_domain_plugin.inc.php
@@ -1,20 +1,21 @@
 <?php
 /**
  * sites_web_domain_plugin plugin
- * 
+ *
  * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
  */
- 
+
+
 class sites_web_domain_plugin {
 
 	var $plugin_name        = 'sites_web_domain_plugin';
 	var $class_name         = 'sites_web_domain_plugin';
-	
+
 	// TODO: This function is a duplicate from the one in interface/web/sites/web_domain_edit.php
 	//       There should be a single "token replacement" function to be called from modules and
-	//	 from the main code.
+	//  from the main code.
 	// Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -26,67 +27,68 @@
 		return $hash;
 	}
 
-    /*
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        $app->plugin->registerEvent('sites:web_domain:on_after_insert','sites_web_domain_plugin','sites_web_domain_edit');
-    }
+	function onLoad() {
+		global $app;
+		//Register for the events
+		$app->plugin->registerEvent('sites:web_domain:on_after_insert', 'sites_web_domain_plugin', 'sites_web_domain_edit');
+	}
 
-    /*
-		Function to create the sites_web_domain rule and insert it into the custom rules           
+	/*
+		Function to create the sites_web_domain rule and insert it into the custom rules
     */
-    function sites_web_domain_edit($event_name, $page_form) {
-        global $app, $conf;   
-        // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
-        // also make sure that the user can not delete domain created by a admin
-        if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
-            $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
-            $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$page_form->id);
-        }
-        if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) {
-            $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
-            $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$page_form->id);
-        }
-        // Get configuration for the web system
-        $app->uses("getconf");        
-        $web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']),'web');            
-        $document_root = str_replace("[website_id]",$page_form->id,$web_config["website_path"]);
-		$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);
-		
-        // get the ID of the client
-        if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {                    
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-            $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
-            $client_id = $app->functions->intval($client["client_id"]);
-        } else {                
-            //$client_id = $app->functions->intval($this->dataRecord["client_group_id"]);
-            $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($page_form->dataRecord["client_group_id"]));
-            $client_id = $app->functions->intval($client["client_id"]);
-        }
+	function sites_web_domain_edit($event_name, $page_form) {
+		global $app, $conf;
+		// make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
+		// also make sure that the user can not delete domain created by a admin
+		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
+			$client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$page_form->id);
+		}
+		if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) {
+			$client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$page_form->id);
+		}
+		// Get configuration for the web system
+		$app->uses("getconf");
+		$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']), 'web');
+		$document_root = str_replace("[website_id]", $page_form->id, $web_config["website_path"]);
+		$document_root = str_replace("[website_idhash_1]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_2]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_3]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_4]", $this->id_hash($page_form->id, 1), $document_root);
 
-        // Set the values for document_root, system_user and system_group
-        $system_user 				= $app->db->quote('web'.$page_form->id);
-        $system_group 				= $app->db->quote('client'.$client_id);
-		
-		$document_root 				= str_replace("[client_id]",$client_id,$document_root);
-		$document_root				= str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
-		$document_root				= str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
-		$document_root				= str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
-		$document_root				= str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
-		$document_root 				= $app->db->quote($document_root);
-        
-		$php_open_basedir 			= str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
-        $php_open_basedir 			= $app->db->quote(str_replace("[website_domain]",$page_form->dataRecord['domain'],$php_open_basedir));
-		
-		$htaccess_allow_override 	= $app->db->quote($web_config["htaccess_allow_override"]);
-        
+		// get the ID of the client
+		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
+			$client_id = $app->functions->intval($client["client_id"]);
+		} else {
+			//$client_id = $app->functions->intval($this->dataRecord["client_group_id"]);
+			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($page_form->dataRecord["client_group_id"]));
+			$client_id = $app->functions->intval($client["client_id"]);
+		}
+
+		// Set the values for document_root, system_user and system_group
+		$system_user     = $app->db->quote('web'.$page_form->id);
+		$system_group     = $app->db->quote('client'.$client_id);
+
+		$document_root     = str_replace("[client_id]", $client_id, $document_root);
+		$document_root    = str_replace("[client_idhash_1]", $this->id_hash($client_id, 1), $document_root);
+		$document_root    = str_replace("[client_idhash_2]", $this->id_hash($client_id, 2), $document_root);
+		$document_root    = str_replace("[client_idhash_3]", $this->id_hash($client_id, 3), $document_root);
+		$document_root    = str_replace("[client_idhash_4]", $this->id_hash($client_id, 4), $document_root);
+		$document_root     = $app->db->quote($document_root);
+
+		$php_open_basedir    = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]);
+		$php_open_basedir    = $app->db->quote(str_replace("[website_domain]", $page_form->dataRecord['domain'], $php_open_basedir));
+
+		$htaccess_allow_override  = $app->db->quote($web_config["htaccess_allow_override"]);
+
 		$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$page_form->id;
 		$app->db->query($sql);
 	}
-}              	
\ No newline at end of file
+
+}
diff --git a/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php b/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
index e4de54a..e28c184 100644
--- a/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
@@ -1,21 +1,22 @@
 <?php
 /**
  * sites_web_domain_plugin plugin
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG 2012, copied and adapted from web_domain plugin by:
  * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
  */
- 
+
+
 class sites_web_vhost_subdomain_plugin {
 
 	var $plugin_name        = 'sites_web_vhost_subdomain_plugin';
 	var $class_name         = 'sites_web_vhost_subdomain_plugin';
-	
+
 	// TODO: This function is a duplicate from the one in interface/web/sites/web_vhost_subdomain_edit.php
 	//       There should be a single "token replacement" function to be called from modules and
-	//	 from the main code.
+	//  from the main code.
 	// Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -27,40 +28,41 @@
 		return $hash;
 	}
 
-    /*
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        // both event call the same function as the things to do do not differ here
-        $app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_insert','sites_web_vhost_subdomain_plugin','sites_web_vhost_subdomain_edit');
-        $app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_update','sites_web_vhost_subdomain_plugin','sites_web_vhost_subdomain_edit');
-    }
+	function onLoad() {
+		global $app;
+		//Register for the events
+		// both event call the same function as the things to do do not differ here
+		$app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_insert', 'sites_web_vhost_subdomain_plugin', 'sites_web_vhost_subdomain_edit');
+		$app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_update', 'sites_web_vhost_subdomain_plugin', 'sites_web_vhost_subdomain_edit');
+	}
 
-    /*
-		Function to create the sites_web_vhost_subdomain rule and insert it into the custom rules           
+	/*
+		Function to create the sites_web_vhost_subdomain rule and insert it into the custom rules
     */
-    function sites_web_vhost_subdomain_edit($event_name, $page_form) {
-        global $app, $conf;   
-        
+	function sites_web_vhost_subdomain_edit($event_name, $page_form) {
+		global $app, $conf;
+
 		// Get configuration for the web system
-        $app->uses("getconf");        
-		$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']),'web');            
-        
-        $parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($page_form->dataRecord['parent_domain_id']) . "'");
-        
+		$app->uses("getconf");
+		$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']), 'web');
+
+		$parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($page_form->dataRecord['parent_domain_id']) . "'");
+
 		// Set the values for document_root, system_user and system_group
 		$system_user = $app->db->quote($parent_domain['system_user']);
 		$system_group = $app->db->quote($parent_domain['system_group']);
 		$document_root = $app->db->quote($parent_domain['document_root']);
-		$php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$page_form->dataRecord['web_folder'],$web_config["php_open_basedir"]);
-		$php_open_basedir = str_replace("[website_domain]/web",$page_form->dataRecord['domain'].'/'.$page_form->dataRecord['web_folder'],$php_open_basedir);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$page_form->dataRecord['domain'],$php_open_basedir));
+		$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$page_form->dataRecord['web_folder'], $web_config["php_open_basedir"]);
+		$php_open_basedir = str_replace("[website_domain]/web", $page_form->dataRecord['domain'].'/'.$page_form->dataRecord['web_folder'], $php_open_basedir);
+		$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+		$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $page_form->dataRecord['domain'], $php_open_basedir));
 		$htaccess_allow_override = $app->db->quote($parent_domain['allow_override']);
 
 		$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($parent_domain['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$page_form->id;
 		$app->db->query($sql);
 	}
-}              	
\ No newline at end of file
+
+}
diff --git a/interface/lib/plugins/vm_openvz_plugin.inc.php b/interface/lib/plugins/vm_openvz_plugin.inc.php
index 0e8696e..98b0f9f 100644
--- a/interface/lib/plugins/vm_openvz_plugin.inc.php
+++ b/interface/lib/plugins/vm_openvz_plugin.inc.php
@@ -1,10 +1,11 @@
 <?php
 /**
  * sites_web_domain_plugin plugin
- * 
+ *
  * @author Till Brehm, projektfarm GmbH
  */
- 
+
+
 class vm_openvz_plugin {
 
 	var $plugin_name        = 'vm_openvz_plugin';
@@ -14,28 +15,28 @@
 	var $oldDataRecord = array();
 
 
-    /*
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        
-		//* Register for events        
-        $app->plugin->registerEvent('vm:openvz_vm:on_after_insert','vm_openvz_plugin','openvz_vm_insert');
-		$app->plugin->registerEvent('vm:openvz_vm:on_after_update','vm_openvz_plugin','openvz_vm_update');
-		$app->plugin->registerEvent('vm:openvz_vm:on_after_delete','vm_openvz_plugin','openvz_vm_delete');
-    }
+	function onLoad() {
+		global $app;
 
-    /*
-		Function that gets called after a new vm was inserted           
+		//* Register for events
+		$app->plugin->registerEvent('vm:openvz_vm:on_after_insert', 'vm_openvz_plugin', 'openvz_vm_insert');
+		$app->plugin->registerEvent('vm:openvz_vm:on_after_update', 'vm_openvz_plugin', 'openvz_vm_update');
+		$app->plugin->registerEvent('vm:openvz_vm:on_after_delete', 'vm_openvz_plugin', 'openvz_vm_delete');
+	}
+
+	/*
+		Function that gets called after a new vm was inserted
     */
-    function openvz_vm_insert($event_name, $page_form) {
-        global $app, $conf;  
+	function openvz_vm_insert($event_name, $page_form) {
+		global $app, $conf;
 
 		$this->id = $page_form->id;
-		$this->dataRecord = $page_form->dataRecord;	
-		$this->oldDataRecord = $page_form->oldDataRecord;	
-        
+		$this->dataRecord = $page_form->dataRecord;
+		$this->oldDataRecord = $page_form->oldDataRecord;
+
 		// make sure that the record belongs to the clinet group and not the admin group when admin inserts it
 		// also make sure that the user can not delete domain created by a admin
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
@@ -46,37 +47,37 @@
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
 			$app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id);
 		}
-		
+
 		// Set the VEID
 		$tmp = $app->db->queryOneRecord('SELECT MAX(veid) + 1 as newveid FROM openvz_vm');
 		$veid = ($tmp['newveid'] > 100)?$tmp['newveid']:101;
 		$app->db->query("UPDATE openvz_vm SET veid = ".$veid." WHERE vm_id = ".$this->id);
 		unset($tmp);
-		
+
 		// Apply template values to the advanced tab settings
 		$this->applyTemplate();
-		
+
 		// Set the IP address
 		$app->db->query("UPDATE openvz_ip SET vm_id = ".$this->id." WHERE ip_address = '".$this->dataRecord['ip_address']."'");
-		
+
 		// Create the OpenVZ config file and store it in config field
 		$this->makeOpenVZConfig();
-		
+
 		// Create the DNS record
 		$this->createDNS();
-		
+
 	}
-	
+
 	/*
-		Function that gets called after a vm was updated          
+		Function that gets called after a vm was updated
     */
-    function openvz_vm_update($event_name, $page_form) {
-        global $app, $conf;
-		
+	function openvz_vm_update($event_name, $page_form) {
+		global $app, $conf;
+
 		$this->id = $page_form->id;
 		$this->dataRecord = $page_form->dataRecord;
-		$this->oldDataRecord = $page_form->oldDataRecord;	
-		
+		$this->oldDataRecord = $page_form->oldDataRecord;
+
 		// make sure that the record belongs to the clinet group and not the admin group when a admin inserts it
 		// also make sure that the user can not delete domain created by a admin
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
@@ -87,40 +88,40 @@
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
 			$app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id);
 		}
-		
+
 		if(isset($this->dataRecord["ostemplate_id"]) && $this->oldDataRecord["ostemplate_id"] != $this->dataRecord["ostemplate_id"]) {
 			$this->applyTemplate();
 		}
-		
+
 		// Set the IP address
 		if(isset($this->dataRecord['ip_address'])) $app->db->query("UPDATE openvz_ip SET vm_id = ".$this->id." WHERE ip_address = '".$this->dataRecord['ip_address']."'");
-		
+
 		// Create the OpenVZ config file and store it in config field
 		$this->makeOpenVZConfig();
-		
+
 		// Create the DNS record
-		if((isset($this->dataRecord['hostname']) && $this->dataRecord['hostname'] != $this->oldDataRecord['hostname']) 
-		or (isset($this->dataRecord['create_dns']) && $this->dataRecord['create_dns'] != $this->oldDataRecord['create_dns'])) {
+		if((isset($this->dataRecord['hostname']) && $this->dataRecord['hostname'] != $this->oldDataRecord['hostname'])
+			or (isset($this->dataRecord['create_dns']) && $this->dataRecord['create_dns'] != $this->oldDataRecord['create_dns'])) {
 			$this->createDNS();
 		}
-        
+
 	}
-	
+
 	function openvz_vm_delete($event_name, $page_form) {
-        global $app, $conf;
-		
+		global $app, $conf;
+
 		//* Free the IP address
 		$tmp = $app->db->queryOneRecord("SELECT ip_address_id FROM openvz_ip WHERE vm_id = ".$page_form->id);
 		$app->db->datalogUpdate('openvz_ip', 'vm_id = 0', 'ip_address_id', $tmp['ip_address_id']);
 		unset($tmp);
-		
+
 	}
-	
+
 	private function applyTemplate() {
 		global $app, $conf;
-		
+
 		$tpl = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ".$this->dataRecord["template_id"]);
-		
+
 		$sql = "UPDATE openvz_vm SET ";
 		$sql .= "diskspace = '".$tpl['diskspace']."', ";
 		$sql .= "ram = '".$tpl['ram']."', ";
@@ -134,113 +135,113 @@
 		$sql .= "capability = '".$tpl['capability']."' ";
 		$sql .= "WHERE vm_id = ".$this->id;
 		$app->db->query($sql);
-		
+
 	}
-	
+
 	private function makeOpenVZConfig() {
 		global $app, $conf;
-		
+
 		$vm = $app->db->queryOneRecord("SELECT * FROM openvz_vm WHERE vm_id = ".$this->id);
 		$vm_template = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ".$vm['template_id']);
 		$burst_ram = $vm['ram_burst']*256;
 		$guar_ram = $vm['ram']*256;
-		
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate('../vm/templates/openvz.conf.tpl');
-		
+
 		$onboot = ($vm['start_boot'] == 'y')?'yes':'no';
-		$tpl->setVar('onboot',$onboot);
-		
-		$tpl->setVar('kmemsize',$vm_template['kmemsize']);
-		$tpl->setVar('lockedpages',$vm_template['lockedpages']);
-		$tpl->setVar('privvmpages',$burst_ram.':'.$burst_ram);
-		$tpl->setVar('shmpages',$guar_ram.':'.$guar_ram);
-		$tpl->setVar('numproc',$vm_template['numproc']);
-		$tpl->setVar('physpages',$vm_template['physpages']);
-		$tpl->setVar('vmguarpages',$guar_ram.':'.$guar_ram);
-		$tpl->setVar('oomguarpages',$guar_ram.':'.$guar_ram);
-		$tpl->setVar('numtcpsock',$vm_template['numtcpsock']);
-		$tpl->setVar('numflock',$vm_template['numflock']);
-		$tpl->setVar('numpty',$vm_template['numpty']);
-		$tpl->setVar('numsiginfo',$vm_template['numsiginfo']);
-		$tpl->setVar('tcpsndbuf',$vm_template['tcpsndbuf']);
-		$tpl->setVar('tcprcvbuf',$vm_template['tcprcvbuf']);
-		$tpl->setVar('othersockbuf',$vm_template['othersockbuf']);
-		$tpl->setVar('dgramrcvbuf',$vm_template['dgramrcvbuf']);
-		$tpl->setVar('numothersock',$vm_template['numothersock']);
-		$tpl->setVar('dcachesize',$vm_template['dcachesize']);
-		$tpl->setVar('numfile',$vm_template['numfile']);
-		$tpl->setVar('avnumproc',$vm_template['avnumproc']);
-		$tpl->setVar('numiptent',$vm_template['numiptent']);
-		$tpl->setVar('swappages',$vm_template['swappages']);
-		
+		$tpl->setVar('onboot', $onboot);
+
+		$tpl->setVar('kmemsize', $vm_template['kmemsize']);
+		$tpl->setVar('lockedpages', $vm_template['lockedpages']);
+		$tpl->setVar('privvmpages', $burst_ram.':'.$burst_ram);
+		$tpl->setVar('shmpages', $guar_ram.':'.$guar_ram);
+		$tpl->setVar('numproc', $vm_template['numproc']);
+		$tpl->setVar('physpages', $vm_template['physpages']);
+		$tpl->setVar('vmguarpages', $guar_ram.':'.$guar_ram);
+		$tpl->setVar('oomguarpages', $guar_ram.':'.$guar_ram);
+		$tpl->setVar('numtcpsock', $vm_template['numtcpsock']);
+		$tpl->setVar('numflock', $vm_template['numflock']);
+		$tpl->setVar('numpty', $vm_template['numpty']);
+		$tpl->setVar('numsiginfo', $vm_template['numsiginfo']);
+		$tpl->setVar('tcpsndbuf', $vm_template['tcpsndbuf']);
+		$tpl->setVar('tcprcvbuf', $vm_template['tcprcvbuf']);
+		$tpl->setVar('othersockbuf', $vm_template['othersockbuf']);
+		$tpl->setVar('dgramrcvbuf', $vm_template['dgramrcvbuf']);
+		$tpl->setVar('numothersock', $vm_template['numothersock']);
+		$tpl->setVar('dcachesize', $vm_template['dcachesize']);
+		$tpl->setVar('numfile', $vm_template['numfile']);
+		$tpl->setVar('avnumproc', $vm_template['avnumproc']);
+		$tpl->setVar('numiptent', $vm_template['numiptent']);
+		$tpl->setVar('swappages', $vm_template['swappages']);
+
 		$diskspace = $vm['diskspace']*1048576;
 		$diskinodes = $vm['diskspace']*524288;
-		
-		$tpl->setVar('diskspace',$diskspace.":".$diskspace);
-		$tpl->setVar('diskinodes',$diskinodes.":".$diskinodes);
-		$tpl->setVar('io_priority',$vm['io_priority']);
-		
-		$tpl->setVar('cpu_num',$vm['cpu_num']);
-		$tpl->setVar('cpu_units',$vm['cpu_units']);
-		$tpl->setVar('cpu_limit',$vm['cpu_limit']);
-		
-		$hostname = str_replace('{VEID}',$vm['veid'],$vm['hostname']);
-		
-		$tpl->setVar('hostname',$hostname);
-		$tpl->setVar('ip_address',$vm['ip_address']);
-		$tpl->setVar('nameserver',$vm['nameserver']);
-		$tpl->setVar('capability',$vm['capability']);
-		
+
+		$tpl->setVar('diskspace', $diskspace.":".$diskspace);
+		$tpl->setVar('diskinodes', $diskinodes.":".$diskinodes);
+		$tpl->setVar('io_priority', $vm['io_priority']);
+
+		$tpl->setVar('cpu_num', $vm['cpu_num']);
+		$tpl->setVar('cpu_units', $vm['cpu_units']);
+		$tpl->setVar('cpu_limit', $vm['cpu_limit']);
+
+		$hostname = str_replace('{VEID}', $vm['veid'], $vm['hostname']);
+
+		$tpl->setVar('hostname', $hostname);
+		$tpl->setVar('ip_address', $vm['ip_address']);
+		$tpl->setVar('nameserver', $vm['nameserver']);
+		$tpl->setVar('capability', $vm['capability']);
+
 		$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ".$vm['ostemplate_id']);
-		$tpl->setVar('ostemplate',$tmp['template_file']);
+		$tpl->setVar('ostemplate', $tmp['template_file']);
 		unset($tmp);
-		
+
 		$openvz_config = $app->db->quote($tpl->grab());
 		$app->db->query("UPDATE openvz_vm SET config = '".$openvz_config."' WHERE vm_id = ".$this->id);
-		
+
 		unset($tpl);
-		
+
 	}
-	
+
 	private function createDNS() {
 		global $app, $conf;
-		
+
 		$vm = $app->db->queryOneRecord("SELECT * FROM openvz_vm WHERE vm_id = ".$this->id);
-		
+
 		if($vm['create_dns'] != 'y') return;
-		
-		$full_hostname = str_replace('{VEID}',$vm['veid'],$vm['hostname']);
-		$hostname_parts = explode('.',$full_hostname);
+
+		$full_hostname = str_replace('{VEID}', $vm['veid'], $vm['hostname']);
+		$hostname_parts = explode('.', $full_hostname);
 		$hostname = $hostname_parts[0];
 		unset($hostname_parts[0]);
-		$zone = implode('.',$hostname_parts);
+		$zone = implode('.', $hostname_parts);
 		unset($hostname_parts);
-		
+
 		// Find the dns zone
 		$zone_rec = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '$zone.'");
 		$rr_rec = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$zone_rec['id']."' AND name = '$hostname'");
-		
+
 		if($zone_rec['id'] > 0) {
 			$ip_address = $vm['ip_address'];
 			$sys_userid = $zone_rec['sys_userid'];
 			$sys_groupid = $zone_rec['sys_groupid'];
 			$server_id = $zone_rec['server_id'];
 			$dns_soa_id = $zone_rec['id'];
-			
+
 			if($rr_rec['id'] > 0) {
 				$app->uses('validate_dns');
 				$app->db->datalogUpdate('dns_rr', "data = '$ip_address'", 'id', $rr_rec['id']);
 				$serial = $app->validate_dns->increase_serial($zone_rec['serial']);
 				$app->db->datalogUpdate('dns_soa', "serial = '$serial'", 'id', $zone_rec['id']);
 			} else {
-				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES 
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES
 				('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$hostname', 'A', '$ip_address', '0', '3600', 'Y')";
 				$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
 			}
-			
+
 		}
 	}
 
-}              	
\ No newline at end of file
+}
diff --git a/interface/web/admin/directive_snippets_del.php b/interface/web/admin/directive_snippets_del.php
index ee1ab8b..551634f 100644
--- a/interface/web/admin/directive_snippets_del.php
+++ b/interface/web/admin/directive_snippets_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/directive_snippets_edit.php b/interface/web/admin/directive_snippets_edit.php
index 317dc58..06cea79 100644
--- a/interface/web/admin/directive_snippets_edit.php
+++ b/interface/web/admin/directive_snippets_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,4 +50,4 @@
 // let tform_actions handle the page
 $app->tform_actions->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/directive_snippets_list.php b/interface/web/admin/directive_snippets_list.php
index 4f41194..5fb75c7 100644
--- a/interface/web/admin/directive_snippets_list.php
+++ b/interface/web/admin/directive_snippets_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/firewall_del.php b/interface/web/admin/firewall_del.php
index 0df60d1..c4ea560 100644
--- a/interface/web/admin/firewall_del.php
+++ b/interface/web/admin/firewall_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/firewall_edit.php b/interface/web/admin/firewall_edit.php
index 03e0def..d0c35db 100644
--- a/interface/web/admin/firewall_edit.php
+++ b/interface/web/admin/firewall_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -64,9 +64,10 @@
 			unset($rec);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/firewall_list.php b/interface/web/admin/firewall_list.php
index d958f45..3d39050 100644
--- a/interface/web/admin/firewall_list.php
+++ b/interface/web/admin/firewall_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/dbsync.tform.php b/interface/web/admin/form/dbsync.tform.php
index 27ad1f6..8a4181b 100644
--- a/interface/web/admin/form/dbsync.tform.php
+++ b/interface/web/admin/form/dbsync.tform.php
@@ -62,14 +62,14 @@
 
 //* Load modules
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != "." && $file != "..") {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != "." && $file != "..") {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
 				$modules_list[$file] = $file;
 			}
-        }
+		}
 	}
 }
 closedir($handle);
@@ -77,10 +77,10 @@
 //* read data bases in with more activated db_history.
 $db_tables = array();
 foreach($modules_list as $md) {
-	$handle = @opendir(ISPC_WEB_PATH."/$md/form"); 
-	while ($file = @readdir ($handle)) { 
-    	if ($file != '.' && $file != '..' && substr($file, 0, 1) != '.') {
-        	include_once(ISPC_WEB_PATH."/$md/form/$file");
+	$handle = @opendir(ISPC_WEB_PATH."/$md/form");
+	while ($file = @readdir($handle)) {
+		if ($file != '.' && $file != '..' && substr($file, 0, 1) != '.') {
+			include_once ISPC_WEB_PATH."/$md/form/$file";
 			if(isset($form['db_history']) && $form['db_history'] == 'yes') {
 				$tmp_id = $form['db_table'];
 				$db_tables[$tmp_id] = $form['db_table'];
@@ -105,160 +105,160 @@
 
 
 $form['tabs']['dbsync'] = array (
-    'title'     => 'DB sync',
-    'width'     => 80,
-    'template'  => 'templates/dbsync_edit.htm',
-    'fields'    => array (
-    ##################################
-    # Beginn Datenbankfelder
-    ##################################
-        'jobname' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '/^.{1,30}$/',
-            'errmsg'    => 'jobname_err',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '15',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'sync_interval_minutes' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '15',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => array('mysql' => 'mysql'),
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_host' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_name' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_username' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_password' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_tables' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'CHECKBOXARRAY',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => 'admin,forms',
-            'value'     => $db_tables,
-            'separator' => ',',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'empty_datalog' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'CHECKBOX',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => array(0 => 0,1 => 1),
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'sync_datalog_external' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'CHECKBOX',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => array(0 => 0,1 => 1),
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'active' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'CHECKBOX',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '1',
-            'value'     => array(0 => 0,1 => 1),
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        )
-    ##################################
-    # ENDE Datenbankfelder
-    ##################################
-    )
+	'title'     => 'DB sync',
+	'width'     => 80,
+	'template'  => 'templates/dbsync_edit.htm',
+	'fields'    => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
+		'jobname' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '/^.{1,30}$/',
+			'errmsg'    => 'jobname_err',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '15',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'sync_interval_minutes' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '15',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => array('mysql' => 'mysql'),
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_host' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_name' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_username' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_password' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_tables' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'CHECKBOXARRAY',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => 'admin,forms',
+			'value'     => $db_tables,
+			'separator' => ',',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'empty_datalog' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'CHECKBOX',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'sync_datalog_external' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'CHECKBOX',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'active' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'CHECKBOX',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '1',
+			'value'     => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		)
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
+	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/directive_snippets.tform.php b/interface/web/admin/form/directive_snippets.tform.php
index b41e0e4..2af05af 100644
--- a/interface/web/admin/form/directive_snippets.tform.php
+++ b/interface/web/admin/form/directive_snippets.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Directive Snippets";
-$form["description"] 	= "";
-$form["name"] 			= "directive_snippets";
-$form["action"]			= "directive_snippets_edit.php";
-$form["db_table"]		= "directive_snippets";
-$form["db_table_idx"]	= "directive_snippets_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "directive_snippets";
-$form["list_default"]	= "directive_snippets_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Directive Snippets";
+$form["description"]  = "";
+$form["name"]    = "directive_snippets";
+$form["action"]   = "directive_snippets_edit.php";
+$form["db_table"]  = "directive_snippets";
+$form["db_table_idx"] = "directive_snippets_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "directive_snippets";
+$form["list_default"] = "directive_snippets_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,54 +56,54 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['directive_snippets'] = array (
-	'title' 	=> "Directive Snippets",
-	'width' 	=> 100,
-	'template' 	=> "templates/directive_snippets_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Directive Snippets",
+	'width'  => 100,
+	'template'  => "templates/directive_snippets_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 =>  array (    'type'	=> 'NOTEMPTY',
-                                                         'errmsg'=> 'directive_snippets_name_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'directive_snippets_name_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 =>  array (    'type' => 'NOTEMPTY',
+					'errmsg'=> 'directive_snippets_name_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'directive_snippets_name_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('apache' => 'Apache','nginx' => 'nginx','php' => 'PHP','proxy' => 'Proxy'),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('apache' => 'Apache', 'nginx' => 'nginx', 'php' => 'PHP', 'proxy' => 'Proxy'),
 			'searchable' => 2
 		),
 		'snippet' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/filesync.tform.php b/interface/web/admin/form/filesync.tform.php
index 45d081a..0dfa5b1 100644
--- a/interface/web/admin/form/filesync.tform.php
+++ b/interface/web/admin/form/filesync.tform.php
@@ -60,146 +60,146 @@
 
 */
 
-$form["title"] 			= "Datei Synchronisation";
-$form["description"] 	= "Formular zum Anlegen von Datei-Synchronisierungen.";
-$form["name"] 			= "filesync";
-$form["action"]			= "filesync_edit.php";
-$form["db_table"]		= "sys_filesync";
-$form["db_table_idx"]	= "id";
-$form["tab_default"]	= "filesync";
-$form["list_default"]	= "filesync_list.php";
-$form["auth"]			= 'no';
+$form["title"]    = "Datei Synchronisation";
+$form["description"]  = "Formular zum Anlegen von Datei-Synchronisierungen.";
+$form["name"]    = "filesync";
+$form["action"]   = "filesync_edit.php";
+$form["db_table"]  = "sys_filesync";
+$form["db_table_idx"] = "id";
+$form["tab_default"] = "filesync";
+$form["list_default"] = "filesync_list.php";
+$form["auth"]   = 'no';
 
 
 $form["tabs"]['filesync'] = array (
-	'title' 	=> "Datei sync",
-	'width' 	=> 80,
-	'template' 	=> "templates/filesync_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Datei sync",
+	'width'  => 80,
+	'template'  => "templates/filesync_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'jobname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '/^.{1,30}$/',
-			'errmsg'	=> 'jobname_err',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '/^.{1,30}$/',
+			'errmsg' => 'jobname_err',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'sync_interval_minutes' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ftp_host' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ftp_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ftp_username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ftp_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'local_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'wput_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '--timestamping --dont-continue',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '--timestamping --dont-continue',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '1',
-			'value'		=> array(0 => 0,1 => 1),
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '1',
+			'value'  => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		)
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/firewall.tform.php b/interface/web/admin/form/firewall.tform.php
index c5209fc..0bef6eb 100644
--- a/interface/web/admin/form/firewall.tform.php
+++ b/interface/web/admin/form/firewall.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Firewall";
-$form["description"] 	= "";
-$form["name"] 			= "firewall";
-$form["action"]			= "firewall_edit.php";
-$form["db_table"]		= "firewall";
-$form["db_table_idx"]	= "firewall_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "firewall";
-$form["list_default"]	= "firewall_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Firewall";
+$form["description"]  = "";
+$form["name"]    = "firewall";
+$form["action"]   = "firewall_edit.php";
+$form["db_table"]  = "firewall";
+$form["db_table_idx"] = "firewall_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "firewall";
+$form["list_default"] = "firewall_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,62 +51,62 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['firewall'] = array (
-	'title' 	=> "Firewall",
-	'width' 	=> 100,
-	'template' 	=> "templates/firewall_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Firewall",
+	'width'  => 100,
+	'template'  => "templates/firewall_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'firewall_error_unique'),
-									),
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'firewall_error_unique'),
+			),
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'tcp_port' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\s0-9\,\:]{0,255}$/',
-														'errmsg'=> 'tcp_ports_error_regex'),
-									),
-			'default'	=> '20,21,22,25,53,80,110,143,443,993,995,3306,8080,8081,10000',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\s0-9\,\:]{0,255}$/',
+					'errmsg'=> 'tcp_ports_error_regex'),
+			),
+			'default' => '20,21,22,25,53,80,110,143,443,993,995,3306,8080,8081,10000',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'udp_port' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\s0-9\,\:]{0,255}$/',
-														'errmsg'=> 'tcp_ports_error_regex'),
-									),
-			'default'	=> '53,3306',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\s0-9\,\:]{0,255}$/',
+					'errmsg'=> 'tcp_ports_error_regex'),
+			),
+			'default' => '53,3306',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/groups.tform.php b/interface/web/admin/form/groups.tform.php
index ce78a66..c7b3f74 100644
--- a/interface/web/admin/form/groups.tform.php
+++ b/interface/web/admin/form/groups.tform.php
@@ -59,54 +59,54 @@
 
 */
 
-$form["title"] 			= "Groups";
-$form["description"] 	= "groups_description";
-$form["name"] 			= "groups";
-$form["action"]			= "groups_edit.php";
-$form["db_table"]		= "sys_group";
-$form["db_table_idx"]	= "groupid";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "groups";
-$form["list_default"]	= "groups_list.php";
-$form["auth"]			= 'no';
+$form["title"]    = "Groups";
+$form["description"]  = "groups_description";
+$form["name"]    = "groups";
+$form["action"]   = "groups_edit.php";
+$form["db_table"]  = "sys_group";
+$form["db_table_idx"] = "groupid";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "groups";
+$form["list_default"] = "groups_list.php";
+$form["auth"]   = 'no';
 
 $form["tabs"]['groups'] = array (
-	'title' 	=> "Groups",
-	'width' 	=> 80,
-	'template' 	=> "templates/groups_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Groups",
+	'width'  => 80,
+	'template'  => "templates/groups_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '/^.{1,30}$/',
-			'errmsg'	=> 'name_err',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '/^.{1,30}$/',
+			'errmsg' => 'name_err',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '5',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '5',
+			'cols'  => '30'
 		)
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/iptables.tform.php b/interface/web/admin/form/iptables.tform.php
index 87f7b7f..7d09ca3 100644
--- a/interface/web/admin/form/iptables.tform.php
+++ b/interface/web/admin/form/iptables.tform.php
@@ -1,15 +1,15 @@
 <?php
 
-$form["title"] 			= "IPTables";
-$form["description"] 	= "IPTables based firewall";
-$form["name"] 			= "iptables";
-$form["action"]			= "iptables_edit.php";
-$form["db_table"]		= "iptables";
-$form["db_table_idx"]	= "iptables_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "iptables";
-$form["list_default"]	= "iptables_list.php";
-//$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "IPTables";
+$form["description"]  = "IPTables based firewall";
+$form["name"]    = "iptables";
+$form["action"]   = "iptables_edit.php";
+$form["db_table"]  = "iptables";
+$form["db_table_idx"] = "iptables_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "iptables";
+$form["list_default"] = "iptables_list.php";
+//$form["auth"]   = 'yes'; // yes / no
 
 //$form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 //$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -18,92 +18,92 @@
 //$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['iptables'] = array (
-	'title' 	=> "Rules",
-	'width' 	=> "100",
-	'template' 	=> "templates/iptables_edit.htm",
-	'fields' 	=> array (
+	'title'  => "Rules",
+	'width'  => "100",
+	'template'  => "templates/iptables_edit.htm",
+	'fields'  => array (
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'),
+			'value'  => ''
 		),
 		'protocol' => array (
-						'datatype'	=> 'VARCHAR',
-						'formtype'	=> 'SELECT',
-						'default'	=> '',
-						'value'		=> array('none'=>'None','tcp'=>'TCP','udp'=>'UDP'),
-						'width'		=> '',
-						'maxlength'	=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('none'=>'None', 'tcp'=>'TCP', 'udp'=>'UDP'),
+			'width'  => '',
+			'maxlength' => ''
 		),
 		'table' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'SELECT',
-                        'validators'    => array (      0  => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'table_error_empty')),
-                        'default'       => 'INPUT',
-                        'value'         => array('INPUT'=>'INPUT','OUTPUT'=>'OUTPUT','FORWARD'=>'FORWARD'),
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'SELECT',
+			'validators'    => array (      0  => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'table_error_empty')),
+			'default'       => 'INPUT',
+			'value'         => array('INPUT'=>'INPUT', 'OUTPUT'=>'OUTPUT', 'FORWARD'=>'FORWARD'),
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'source_ip' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'destination_ip' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'singleport' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'multiport' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'state' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'target' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'SELECT',
-                        'validators'    => array (      0  => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'target_error_empty')),
-                        'default'       => '',
-                        'value'         => array('ACCEPT'=>'ACCEPT','DROP'=>'DROP','REJECT'=>'REJECT'),
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'SELECT',
+			'validators'    => array (      0  => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'target_error_empty')),
+			'default'       => '',
+			'value'         => array('ACCEPT'=>'ACCEPT', 'DROP'=>'DROP', 'REJECT'=>'REJECT'),
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/remote_user.tform.php b/interface/web/admin/form/remote_user.tform.php
index 5fb2529..fd765ce 100644
--- a/interface/web/admin/form/remote_user.tform.php
+++ b/interface/web/admin/form/remote_user.tform.php
@@ -40,21 +40,21 @@
 if(is_array($modules)) {
 	foreach($modules as $mt) {
 		if(is_file(ISPC_WEB_PATH.'/'.$mt.'/lib/remote.conf.php')) {
-			include(ISPC_WEB_PATH."/$mt/lib/remote.conf.php");
+			include ISPC_WEB_PATH."/$mt/lib/remote.conf.php";
 		}
 	}
 }
 
-$form["title"] 			= "Remote user";
-$form["description"] 	= "";
-$form["name"] 			= "remote_user";
-$form["action"]			= "remote_user_edit.php";
-$form["db_table"]		= "remote_user";
-$form["db_table_idx"]	= "remote_userid";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "remote_user";
-$form["list_default"]	= "remote_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Remote user";
+$form["description"]  = "";
+$form["name"]    = "remote_user";
+$form["action"]   = "remote_user_edit.php";
+$form["db_table"]  = "remote_user";
+$form["db_table_idx"] = "remote_userid";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "remote_user";
+$form["list_default"] = "remote_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -63,67 +63,67 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['remote_user'] = array (
-	'title' 	=> "Remote User",
-	'width' 	=> 100,
-	'template' 	=> "templates/remote_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Remote User",
+	'width'  => 100,
+	'template'  => "templates/remote_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'remote_userid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username',
-										'keyfield'=> 'remote_userid',
-										'valuefield'=> 'remote_username'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username',
+				'keyfield'=> 'remote_userid',
+				'valuefield'=> 'remote_username'
+			),
+			'value'  => ''
 		),
-		
+
 		'remote_username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'username_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-2 => array (	'type' => 'NOTEMPTY',
-		'errmsg'=> 'username_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'username_error_unique'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+				2 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'username_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'remote_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'MD5',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'remote_functions' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $function_list,
-			'separator'	=> ';',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '5',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'CHECKBOXARRAY',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $function_list,
+			'separator' => ';',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '5',
+			'cols'  => '30'
 		)
-		
-	##################################
-	# ENDE Datatable fields
-	##################################
+
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/admin/form/server.tform.php b/interface/web/admin/form/server.tform.php
index 20947c8..a2eac6c 100644
--- a/interface/web/admin/form/server.tform.php
+++ b/interface/web/admin/form/server.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Server";
-$form["description"] 	= "";
-$form["name"] 			= "server";
-$form["action"]			= "server_edit.php";
-$form["db_table"]		= "server";
-$form["db_table_idx"]	= "server_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "services";
-$form["list_default"]	= "server_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Server";
+$form["description"]  = "";
+$form["name"]    = "server";
+$form["action"]   = "server_edit.php";
+$form["db_table"]  = "server";
+$form["db_table_idx"] = "server_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "services";
+$form["list_default"] = "server_list.php";
+$form["auth"]   = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 1; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,62 +51,62 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['services'] = array (
-	'title' 	=> "Services",
-	'width' 	=> 100,
-	'template' 	=> "templates/server_edit_services.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Services",
+	'width'  => 100,
+	'template'  => "templates/server_edit_services.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'mail_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'web_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'dns_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'file_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'db_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'vserver_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'mirror_server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		/*
 		'update' => array (
@@ -117,14 +117,14 @@
 		),
 		*/
 		'active' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'value'		=> array(0 => 'No', 1 => 'Yes')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'value'  => array(0 => 'No', 1 => 'Yes')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -154,4 +154,4 @@
 );
 */
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php
index 7e0f63e..89eae71 100644
--- a/interface/web/admin/form/server_config.tform.php
+++ b/interface/web/admin/form/server_config.tform.php
@@ -55,9 +55,9 @@
 	'width' => 70,
 	'template' => "templates/server_config_server_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'auto_network_configuration' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
@@ -119,13 +119,13 @@
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => 'server1.domain.tld',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
 			'validators' => array(0 => array('type' => 'NOTEMPTY',
 					'errmsg' => 'hostname_error_empty'),
 			),
@@ -183,10 +183,10 @@
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => '',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
-                                                                'errmsg'=> 'monit_url_error_regex'),
-                                                ),
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+					'errmsg'=> 'monit_url_error_regex'),
+			),
 			'value' => '',
 			'width' => '40',
 			'maxlength' => '255'
@@ -211,10 +211,10 @@
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => '',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
-                                                                'errmsg'=> 'munin_url_error_regex'),
-                                                ),
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+					'errmsg'=> 'munin_url_error_regex'),
+			),
 			'value' => '',
 			'width' => '40',
 			'maxlength' => '255'
@@ -235,9 +235,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -246,9 +246,9 @@
 	'width' => 60,
 	'template' => "templates/server_config_mail_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'module' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'SELECT',
@@ -377,16 +377,16 @@
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
 			'default' => 'y',
-			'value' => array(0 => 'n',1 => 'y')
+			'value' => array(0 => 'n', 1 => 'y')
 		),
 		'realtime_blackhole_list' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(,\s*(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))*)?$/',
-														'errmsg'=> 'rbl_error_regex'),
-									),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(,\s*(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))*)?$/',
+					'errmsg'=> 'rbl_error_regex'),
+			),
 			'value' => '',
 			'width' => '40',
 			'maxlength' => '255'
@@ -408,8 +408,8 @@
 			'formtype' => 'TEXT',
 			'default' => '7',
 			'value' => '',
-            'width' => '20',
-            'maxlength' => '255'
+			'width' => '20',
+			'maxlength' => '255'
 		),
 		'overquota_notify_onok' => array(
 			'datatype' => 'VARCHAR',
@@ -417,9 +417,9 @@
 			'default' => 'n',
 			'value' => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -428,9 +428,9 @@
 	'width' => 80,
 	'template' => "templates/server_config_getmail_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'getmail_config_dir' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -442,9 +442,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -453,9 +453,9 @@
 	'width' => 60,
 	'template' => "templates/server_config_web_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_type' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'SELECT',
@@ -499,7 +499,7 @@
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
 			'default' => 'n',
-			'value' => array(0 => 'n',1 => 'y')
+			'value' => array(0 => 'n', 1 => 'y')
 		),
 		'website_autoalias' => array(
 			'datatype' => 'VARCHAR',
@@ -509,7 +509,7 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-/*
+		/*
 'vhost_rewrite_v6' => array (
 'datatype' => 'VARCHAR',
 'formtype' => 'CHECKBOX',
@@ -648,8 +648,8 @@
 			'formtype' => 'TEXT',
 			'default' => '7',
 			'value' => '',
-            'width' => '20',
-            'maxlength' => '255'
+			'width' => '20',
+			'maxlength' => '255'
 		),
 		'overquota_notify_onok' => array(
 			'datatype' => 'VARCHAR',
@@ -890,9 +890,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -901,9 +901,9 @@
 	'width' => 60,
 	'template' => "templates/server_config_dns_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'bind_user' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -959,9 +959,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -970,9 +970,9 @@
 	'width' => 80,
 	'template' => "templates/server_config_fastcgi_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'fastcgi_starter_path' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -1032,11 +1032,11 @@
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => '',
-			'validators' => array(	0 => array(	'type' => 'ISINT',
-												'errmsg' => 'fastcgi_max_requests_error_empty'),
-									1 => array(	'type' => 'RANGE',
-												'range' => '0:',
-												'errmsg' => 'fastcgi_max_requests_error_empty'),
+			'validators' => array( 0 => array( 'type' => 'ISINT',
+					'errmsg' => 'fastcgi_max_requests_error_empty'),
+				1 => array( 'type' => 'RANGE',
+					'range' => '0:',
+					'errmsg' => 'fastcgi_max_requests_error_empty'),
 			),
 			'value' => '',
 			'width' => '40',
@@ -1061,9 +1061,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -1073,9 +1073,9 @@
 	'width' => 80,
 	'template' => "templates/server_config_jailkit_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'jailkit_chroot_home' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -1120,9 +1120,9 @@
 			'width' => '40',
 			'maxlength' => '1000'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -1195,9 +1195,9 @@
 	'width' => 80,
 	'template' => "templates/server_config_vlogger_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'config_dir' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -1209,9 +1209,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -1222,9 +1222,9 @@
 	'width' => 80,
 	'template' => "templates/server_config_cron_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'init_script' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -1258,9 +1258,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -1269,9 +1269,9 @@
 	'width' => 80,
 	'template' => "templates/server_config_rescue_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'try_rescue' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
@@ -1296,9 +1296,9 @@
 			'default' => 'n',
 			'value' => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 ?>
diff --git a/interface/web/admin/form/server_ip.tform.php b/interface/web/admin/form/server_ip.tform.php
index e565e1e..c044f2d 100644
--- a/interface/web/admin/form/server_ip.tform.php
+++ b/interface/web/admin/form/server_ip.tform.php
@@ -55,7 +55,7 @@
 
 	Hinweis:
 	Das ID-Feld ist nicht bei den Table Values einzufügen.
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -64,16 +64,16 @@
 
 */
 
-$form["title"] 			= "IP Addresses";
-$form["description"] 	= "Form to edit system IP Addresses";
-$form["name"] 			= "server_ip";
-$form["action"]			= "server_ip_edit.php";
-$form["db_table"]		= "server_ip";
-$form["db_table_idx"]	= "server_ip_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "server_ip";
-$form["list_default"]	= "server_ip_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "IP Addresses";
+$form["description"]  = "Form to edit system IP Addresses";
+$form["name"]    = "server_ip";
+$form["action"]   = "server_ip_edit.php";
+$form["db_table"]  = "server_ip";
+$form["db_table_idx"] = "server_ip_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "server_ip";
+$form["list_default"] = "server_ip_list.php";
+$form["auth"]   = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -82,83 +82,83 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['server_ip'] = array (
-	'title' 	=> "IP Address",
-	'width' 	=> 80,
-	'template' 	=> "templates/server_ip_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "IP Address",
+	'width'  => 80,
+	'template'  => "templates/server_ip_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'client_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT client_id,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
-										'keyfield'=> 'client_id',
-										'valuefield'=> 'name'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT client_id,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
+				'keyfield'=> 'client_id',
+				'valuefield'=> 'name'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'ip_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('IPv4' => 'IPv4', 'IPv6' => 'IPv6'),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('IPv4' => 'IPv4', 'IPv6' => 'IPv6'),
 			'searchable' => 2
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISIP',
-														'errmsg'=> 'ip_error_wrong'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'ip_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '15',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISIP',
+					'errmsg'=> 'ip_error_wrong'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'ip_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '15',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 1
 		),
 		'virtualhost' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'virtualhost_port' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([0-9]{1,5}\,{0,1}){1,}$/i',
-														'errmsg'=> 'error_port_syntax'),
-									),
-			'default'	=> '80,443',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '15',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^([0-9]{1,5}\,{0,1}){1,}$/i',
+					'errmsg'=> 'error_port_syntax'),
+			),
+			'default' => '80,443',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '15',
+			'rows'  => '',
+			'cols'  => ''
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/server_php.tform.php b/interface/web/admin/form/server_php.tform.php
index 58c1d7f..66bb504 100644
--- a/interface/web/admin/form/server_php.tform.php
+++ b/interface/web/admin/form/server_php.tform.php
@@ -59,16 +59,16 @@
 
 */
 
-$form["title"] 			= "Additional PHP Versions";
-$form["description"] 	= "Form to edit additional PHP versions";
-$form["name"] 			= "server_php";
-$form["action"]			= "server_php_edit.php";
-$form["db_table"]		= "server_php";
-$form["db_table_idx"]	= "server_php_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "php_name";
-$form["list_default"]	= "server_php_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Additional PHP Versions";
+$form["description"]  = "Form to edit additional PHP versions";
+$form["name"]    = "server_php";
+$form["action"]   = "server_php_edit.php";
+$form["db_table"]  = "server_php";
+$form["db_table_idx"] = "server_php_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "php_name";
+$form["list_default"] = "server_php_list.php";
+$form["auth"]   = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -77,50 +77,50 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['php_name'] = array (
-	'title' 	=> "Name",
-	'width' 	=> 80,
-	'template' 	=> "templates/server_php_name_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Name",
+	'width'  => 80,
+	'template'  => "templates/server_php_name_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'client_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT client_id,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
-										'keyfield'=> 'client_id',
-										'valuefield'=> 'name'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT client_id,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
+				'keyfield'=> 'client_id',
+				'valuefield'=> 'name'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 			'validators' => array(0 => array('type' => 'NOTEMPTY',
-											 'errmsg' => 'server_php_name_error_empty'),
+					'errmsg' => 'server_php_name_error_empty'),
 			),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
@@ -129,9 +129,9 @@
 	'width' => 80,
 	'template' => "templates/server_php_fastcgi_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'php_fastcgi_binary' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -148,9 +148,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -159,9 +159,9 @@
 	'width' => 80,
 	'template' => "templates/server_php_fpm_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'php_fpm_init_script' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -186,9 +186,9 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/software_package.tform.php b/interface/web/admin/form/software_package.tform.php
index 96ce5aa..1db7056 100644
--- a/interface/web/admin/form/software_package.tform.php
+++ b/interface/web/admin/form/software_package.tform.php
@@ -59,16 +59,16 @@
 
 */
 
-$form["title"] 			= "Software Package";
-$form["description"] 	= "Modify software package details";
-$form["name"] 			= "software_package";
-$form["action"]			= "software_package_edit.php";
-$form["db_table"]		= "software_package";
-$form["db_table_idx"]	= "package_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "software_package";
-$form["list_default"]	= "software_package_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Software Package";
+$form["description"]  = "Modify software package details";
+$form["name"]    = "software_package";
+$form["action"]   = "software_package_edit.php";
+$form["db_table"]  = "software_package";
+$form["db_table_idx"] = "package_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "software_package";
+$form["list_default"] = "software_package_list.php";
+$form["auth"]   = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -77,40 +77,40 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['software_package'] = array (
-	'title' 	=> "Software Package",
-	'width' 	=> 80,
-	'template' 	=> "templates/software_package_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Software Package",
+	'width'  => 80,
+	'template'  => "templates/software_package_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'package_title' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '40',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '40',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'package_key' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '40',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '40',
+			'rows'  => '',
+			'cols'  => ''
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/software_repo.tform.php b/interface/web/admin/form/software_repo.tform.php
index 0396e6f..6d1c50f 100644
--- a/interface/web/admin/form/software_repo.tform.php
+++ b/interface/web/admin/form/software_repo.tform.php
@@ -59,16 +59,16 @@
 
 */
 
-$form["title"] 			= "Software Repository";
-$form["description"] 	= "Software Repository which may contain addons or updates";
-$form["name"] 			= "software_repo";
-$form["action"]			= "software_repo_edit.php";
-$form["db_table"]		= "software_repo";
-$form["db_table_idx"]	= "software_repo_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "software_repo";
-$form["list_default"]	= "software_repo_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Software Repository";
+$form["description"]  = "Software Repository which may contain addons or updates";
+$form["name"]    = "software_repo";
+$form["action"]   = "software_repo_edit.php";
+$form["db_table"]  = "software_repo";
+$form["db_table_idx"] = "software_repo_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "software_repo";
+$form["list_default"] = "software_repo_list.php";
+$form["auth"]   = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -77,77 +77,77 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['software_repo'] = array (
-	'title' 	=> "Repository",
-	'width' 	=> 80,
-	'template' 	=> "templates/software_repo_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Repository",
+	'width'  => 80,
+	'template'  => "templates/software_repo_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'repo_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'repo_name_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'repo_name_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '40',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'repo_name_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'repo_name_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '40',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'repo_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'repo_name_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'repo_name_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '40',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'repo_name_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'repo_name_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '40',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'repo_username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '30',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '30',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'repo_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CLEARTEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '30',
-			'rows'		=> '',
-			'cols'		=> ''
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '30',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php
index d04923b..8e957cf 100644
--- a/interface/web/admin/form/system_config.tform.php
+++ b/interface/web/admin/form/system_config.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 		= "System Config";
-$form["description"] 	= "system_config_desc_txt";
-$form["name"] 		= "system_config";
-$form["action"]		= "system_config_edit.php";
-$form["db_table"]	= "sys_ini";
-$form["db_table_idx"]	= "sysini_id";
-$form["db_history"]	= "yes";
-$form["tab_default"]	= "sites";
-$form["list_default"]	= "server_list.php";
-$form["auth"]		= 'yes'; // yes / no
+$form["title"]   = "System Config";
+$form["description"]  = "system_config_desc_txt";
+$form["name"]   = "system_config";
+$form["action"]  = "system_config_edit.php";
+$form["db_table"] = "sys_ini";
+$form["db_table_idx"] = "sysini_id";
+$form["db_history"] = "yes";
+$form["tab_default"] = "sites";
+$form["list_default"] = "server_list.php";
+$form["auth"]  = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,275 +51,275 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['sites'] = array (
-	'title' 	=> "Sites",
-	'width' 	=> 70,
-	'template' 	=> "templates/system_config_sites_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Sites",
+	'width'  => 70,
+	'template'  => "templates/system_config_sites_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'dbname_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'dbname_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'dbname_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'dbuser_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'dbuser_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'dbuser_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'ftpuser_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'ftpuser_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'ftpuser_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'shelluser_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'shelluser_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'shelluser_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'webdavuser_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'webdavuser_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'webdavuser_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'dblist_phpmyadmin_link' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'phpmyadmin_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
-                                                                'errmsg'=> 'phpmyadmin_url_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+					'errmsg'=> 'phpmyadmin_url_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'webftp_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
-                                                                'errmsg'=> 'webftp_url_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
+					'errmsg'=> 'webftp_url_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'vhost_subdomains' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'client_username_web_check_disabled' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['mail'] = array (
-	'title' 	=> "Mail",
-	'width' 	=> 70,
-	'template' 	=> "templates/system_config_mail_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-    'enable_custom_login' => array(
-      'datatype' => 'VARCHAR',
-      'formtype' => 'CHECKBOX',
-      'default' => 'n',
-      'value' => array(0 => 'n', 1 => 'y')
-    ),
+	'title'  => "Mail",
+	'width'  => 70,
+	'template'  => "templates/system_config_mail_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
+		'enable_custom_login' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value' => array(0 => 'n', 1 => 'y')
+		),
 		'mailboxlist_webmail_link' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'webmail_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                /*'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}(\?.+)?$/',*/
-																'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
-                                                                'errmsg'=> 'webmail_url_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					/*'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}(\?.+)?$/',*/
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+					'errmsg'=> 'webmail_url_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'mailmailinglist_link' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'mailmailinglist_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
-                                                                'errmsg'=> 'mailinglist_url_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
+					'errmsg'=> 'mailinglist_url_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'admin_mail' => array (
-			'datatype'	=> 'VARCHAR',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'admin_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_enabled' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'smtp_host' => array (
-			'datatype'	=> 'VARCHAR',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_port' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '25',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '25',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_pass' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_crypt' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['domains'] = array (
-	'title' 	=> "Domains",
-	'width' 	=> 70,
-	'template' 	=> "templates/system_config_domains_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domains",
+	'width'  => 70,
+	'template'  => "templates/system_config_domains_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'use_domain_module' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'new_domain_html' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -348,106 +348,106 @@
 
  END: Branding */
 $form["tabs"]['misc'] = array (
-	'title' 	=> "Misc",
-	'width' 	=> 70,
-	'template' 	=> "templates/system_config_misc_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Misc",
+	'width'  => 70,
+	'template'  => "templates/system_config_misc_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'dashboard_atom_url_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://www.ispconfig.org/atom',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://www.ispconfig.org/atom',
+			'value'  => ''
 		),
 		'dashboard_atom_url_reseller' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://www.ispconfig.org/atom',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://www.ispconfig.org/atom',
+			'value'  => ''
 		),
 		'dashboard_atom_url_client' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://www.ispconfig.org/atom',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://www.ispconfig.org/atom',
+			'value'  => ''
 		),
 		'monitor_key' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'tab_change_discard' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'tab_change_warning' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'use_loadindicator' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'use_combobox' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'maintenance_mode' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'admin_dashlets_left' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'admin_dashlets_right' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'reseller_dashlets_left' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'reseller_dashlets_right' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'client_dashlets_left' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'client_dashlets_right' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/admin/form/tpl_default.tform.php b/interface/web/admin/form/tpl_default.tform.php
index de63948..df52bbe 100644
--- a/interface/web/admin/form/tpl_default.tform.php
+++ b/interface/web/admin/form/tpl_default.tform.php
@@ -59,16 +59,16 @@
 
 */
 
-$form["title"] 		= "tpl_default_head_txt";
-$form["description"] 	= "tpl_default_desc_txt";
-$form["name"] 		= "tpl_default";
-$form["action"]		= "tpl_default.php";
-$form["db_table"]	= "sys_theme";
-$form["db_table_idx"]	= "id";
-$form["db_history"]	= "yes";
-$form["tab_default"]	= "basic";
-$form["list_default"]	= "system_config_edit.php";
-$form["auth"]		= 'yes';
+$form["title"]   = "tpl_default_head_txt";
+$form["description"]  = "tpl_default_desc_txt";
+$form["name"]   = "tpl_default";
+$form["action"]  = "tpl_default.php";
+$form["db_table"] = "sys_theme";
+$form["db_table_idx"] = "id";
+$form["db_history"] = "yes";
+$form["tab_default"] = "basic";
+$form["list_default"] = "system_config_edit.php";
+$form["auth"]  = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -77,37 +77,37 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['basic'] = array (
-	'title' 	=> "Basic Settings",
-	'width' 	=> 80,
-	'template' 	=> "templates/tpl_default_basic.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Basic Settings",
+	'width'  => 80,
+	'template'  => "templates/tpl_default_basic.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 			'validators'    => '',
-			'default'	=> 'global',
-			'value'		=> 'global',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '64'
+			'default' => 'global',
+			'value'  => 'global',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '64'
 		),
 		'logo_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 			'validators'    => '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/users.tform.php b/interface/web/admin/form/users.tform.php
index b6ff5f3..06f07c0 100644
--- a/interface/web/admin/form/users.tform.php
+++ b/interface/web/admin/form/users.tform.php
@@ -60,62 +60,62 @@
 
 */
 
-$form['title'] 		= 'Users';
-$form['description'] 	= 'Form to edit systemusers.';
-$form['name'] 		= 'users';
-$form['action']		= 'users_edit.php';
-$form['db_table']	= 'sys_user';
-$form['db_table_idx']	= 'userid';
-$form["db_history"]	= "no";
-$form['tab_default']	= 'users';
-$form['list_default']	= 'users_list.php';
-$form['auth']		= 'yes';
+$form['title']   = 'Users';
+$form['description']  = 'Form to edit systemusers.';
+$form['name']   = 'users';
+$form['action']  = 'users_edit.php';
+$form['db_table'] = 'sys_user';
+$form['db_table_idx'] = 'userid';
+$form["db_history"] = "no";
+$form['tab_default'] = 'users';
+$form['list_default'] = 'users_list.php';
+$form['auth']  = 'yes';
 
 //* 0 = id of the user, > 0 id must match with id of current user
-$form['auth_preset']['userid']  = 0; 
+$form['auth_preset']['userid']  = 0;
 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
-$form['auth_preset']['groupid'] = 0; 
+$form['auth_preset']['groupid'] = 0;
 
 //** Permissions are: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user']  = 'riud';
 $form['auth_preset']['perm_group'] = 'riud';
-$form['auth_preset']['perm_other'] = ''; 
+$form['auth_preset']['perm_other'] = '';
 
 //* Pick out modules
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
 				$modules_list[$file] = $file;
 			}
-        }
+		}
 	}
 }
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 //* Languages
 $language_list = array();
-$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
@@ -129,133 +129,133 @@
 }
 
 $form['tabs']['users'] = array (
-	'title' 	=> 'Users',
-	'width' 	=> 80,
-	'template' 	=> 'templates/users_user_edit.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => 'Users',
+	'width'  => 80,
+	'template'  => 'templates/users_user_edit.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array (  0 => array (    'type'	=> 'NOTEMPTY',
-                                                                    'errmsg'=> 'username_empty'),
-                                                    1 => array (    'type'	=> 'UNIQUE',
-                                                                    'errmsg'=> 'username_unique'),
-                                                    2 => array (    'type'	=> 'REGEX',
-                                                                    'regex' => '/^[\w\.\-\_]{0,64}$/',
-                                                                    'errmsg'=> 'username_err'),
-													3 => array (	'type'	=> 'CUSTOM',
-														'class' => 'validate_client',
-														'function' => 'username_collision',
-														'errmsg'=> 'username_error_collision'),
-                                                ),
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '30',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array (    'type' => 'NOTEMPTY',
+					'errmsg'=> 'username_empty'),
+				1 => array (    'type' => 'UNIQUE',
+					'errmsg'=> 'username_unique'),
+				2 => array (    'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\_]{0,64}$/',
+					'errmsg'=> 'username_err'),
+				3 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_collision',
+					'errmsg'=> 'username_error_collision'),
+			),
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '30',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'passwort' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'    => 'CRYPT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '100',
-			'rows'		=> '',
-			'cols'		=> ''
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '100',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'modules' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> 'admin,forms',
-			'value'		=> $modules_list,
-			'separator'	=> ',',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => 'admin,forms',
+			'value'  => $modules_list,
+			'separator' => ',',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'startmodule' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $modules_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $modules_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'app_theme' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'RADIO',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> 'default',
-			'value'		=> $themes_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'RADIO',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => 'default',
+			'value'  => $themes_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'typ' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'RADIO',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> 'user',
-			'value'		=> array ('user' => 'user', 'admin' => 'admin'),
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'RADIO',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => 'user',
+			'value'  => array ('user' => 'user', 'admin' => 'admin'),
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> array(0 => 0,1 => 1),
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '2',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '2',
+			'rows'  => '',
+			'cols'  => ''
 		)
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 /*
@@ -419,44 +419,44 @@
 */
 
 $form['tabs']['groups'] = array (
-	'title' 	=> 'Groups',
-	'width' 	=> 80,
-	'template' 	=> 'templates/users_groups_edit.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => 'Groups',
+	'width'  => 80,
+	'template'  => 'templates/users_groups_edit.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'default_group' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $groups_list,
-			'separator'	=> ',',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $groups_list,
+			'separator' => ',',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'groups' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $groups_list,
-			'separator'	=> ',',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $groups_list,
+			'separator' => ',',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		)
 
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/groups_del.php b/interface/web/admin/groups_del.php
index 3303154..57b47d9 100644
--- a/interface/web/admin/groups_del.php
+++ b/interface/web/admin/groups_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/groups_edit.php b/interface/web/admin/groups_edit.php
index d2acf2b..5ecf75f 100644
--- a/interface/web/admin/groups_edit.php
+++ b/interface/web/admin/groups_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,4 +50,4 @@
 // let tform_actions handle the page
 $app->tform_actions->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/groups_list.php b/interface/web/admin/groups_list.php
index f75f5de..aa2c37c 100644
--- a/interface/web/admin/groups_list.php
+++ b/interface/web/admin/groups_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,4 +48,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/index.php b/interface/web/admin/index.php
index 3691df1..7cbfddb 100644
--- a/interface/web/admin/index.php
+++ b/interface/web/admin/index.php
@@ -34,14 +34,14 @@
 	var $target = '';
 
 	function render() {
-		
+
 		global $app;
-		
+
 		$app->uses('tpl');
 		$app->tpl->newTemplate("form.tpl.htm");
 
-		$app->tpl->setVar('error',$error);
-		$app->tpl->setInclude('content_tpl','admin/templates/index.htm');
+		$app->tpl->setVar('error', $error);
+		$app->tpl->setInclude('content_tpl', 'admin/templates/index.htm');
 		return $app->tpl->grab();
 		/*
 		$filename = 'test.txt';
@@ -69,10 +69,11 @@
 
 
 
-		
+
 		return 'dd';
 		*/
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/iptables_del.php b/interface/web/admin/iptables_del.php
index 2f1830f..2497768 100644
--- a/interface/web/admin/iptables_del.php
+++ b/interface/web/admin/iptables_del.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -47,4 +47,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/iptables_edit.php b/interface/web/admin/iptables_edit.php
index cf9152b..61d1ee3 100644
--- a/interface/web/admin/iptables_edit.php
+++ b/interface/web/admin/iptables_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,10 +49,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/iptables_list.php b/interface/web/admin/iptables_list.php
index 71f8887..8110460 100644
--- a/interface/web/admin/iptables_list.php
+++ b/interface/web/admin/iptables_list.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,4 +48,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_add.php b/interface/web/admin/language_add.php
index a296171..3444179 100644
--- a/interface/web/admin/language_add.php
+++ b/interface/web/admin/language_add.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -46,13 +46,13 @@
 $language_option = '';
 $error = '';
 $msg = '';
-$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'],0,2):'en';
+$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'], 0, 2):'en';
 if(!preg_match("/^[a-z]{2}$/i", $selected_language)) die('unallowed characters in selected language name.');
 
-$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/'); 
-while ($file = readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-		$tmp_lng = substr($file,0,-4);
+$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/');
+while ($file = readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		$tmp_lng = substr($file, 0, -4);
 		if($tmp_lng !='') {
 			$selected = ($tmp_lng == $selected_language)?'SELECTED':'';
 			$language_option .= "<option value='$tmp_lng' $selected>$tmp_lng</option>";
@@ -60,29 +60,29 @@
 		}
 	}
 }
-$app->tpl->setVar('language_option',$language_option);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('language_option', $language_option);
+$app->tpl->setVar('error', $error);
 
 if(isset($_POST['lng_new']) && strlen($_POST['lng_new']) == 2 && $error == '') {
 	$lng_new = $_POST['lng_new'];
 	if(!preg_match("/^[a-z]{2}$/i", $lng_new)) die('unallowed characters in language name.');
-	
+
 	//* Copy the main language file
-	copy(ISPC_LIB_PATH."/lang/$selected_language.lng",ISPC_LIB_PATH."/lang/$lng_new.lng");
-	
+	copy(ISPC_LIB_PATH."/lang/$selected_language.lng", ISPC_LIB_PATH."/lang/$lng_new.lng");
+
 	//* Make a copy of every language file
 	$bgcolor = '#FFFFFF';
 	$language_files_list = array();
-	$handle = @opendir(ISPC_WEB_PATH); 
-	while ($file = @readdir ($handle)) { 
-	   	if ($file != '.' && $file != '..') {
-	        if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
+	$handle = @opendir(ISPC_WEB_PATH);
+	while ($file = @readdir($handle)) {
+		if ($file != '.' && $file != '..') {
+			if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
 				$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-				while ($lang_file = @readdir ($handle2)) {
-					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) {
-						$new_lang_file = $lng_new.substr($lang_file,2);
+				while ($lang_file = @readdir($handle2)) {
+					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == $selected_language) {
+						$new_lang_file = $lng_new.substr($lang_file, 2);
 						//echo ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file.' ## '.ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$new_lang_file;
-						copy(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file,ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$new_lang_file);
+						copy(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file, ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$new_lang_file);
 						$msg = 'Added new language '.$lng_new;
 					}
 				}
@@ -91,15 +91,15 @@
 	}
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_add.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_complete.php b/interface/web/admin/language_complete.php
index 75343bd..67cfb86 100644
--- a/interface/web/admin/language_complete.php
+++ b/interface/web/admin/language_complete.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -46,13 +46,13 @@
 $language_option = '';
 $error = '';
 $msg = '';
-$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'],0,2):'en';
+$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'], 0, 2):'en';
 if(!preg_match("/^[a-z]{2}$/i", $selected_language)) die('unallowed characters in selected language name.');
 
-$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/'); 
-while ($file = readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-		$tmp_lng = substr($file,0,-4);
+$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/');
+while ($file = readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		$tmp_lng = substr($file, 0, -4);
 		if($tmp_lng !='' && $tmp_lng != 'en') {
 			$selected = ($tmp_lng == $selected_language)?'SELECTED':'';
 			$language_option .= "<option value='$tmp_lng' $selected>$tmp_lng</option>";
@@ -60,65 +60,65 @@
 		}
 	}
 }
-$app->tpl->setVar('language_option',$language_option);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('language_option', $language_option);
+$app->tpl->setVar('error', $error);
 
 // Export the language file
 if(isset($_POST['lng_select']) && $error == '') {
-	
+
 	// complete the global langauge file
-	merge_langfile(ISPC_LIB_PATH."/lang/".$selected_language.".lng",ISPC_LIB_PATH."/lang/en.lng");
-	
+	merge_langfile(ISPC_LIB_PATH."/lang/".$selected_language.".lng", ISPC_LIB_PATH."/lang/en.lng");
+
 	// Go trough all language files
 	$bgcolor = '#FFFFFF';
 	$language_files_list = array();
-	$handle = @opendir(ISPC_WEB_PATH); 
-	while ($file = @readdir ($handle)) { 
-	   	if ($file != '.' && $file != '..') {
-	        if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
+	$handle = @opendir(ISPC_WEB_PATH);
+	while ($file = @readdir($handle)) {
+		if ($file != '.' && $file != '..') {
+			if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
 				$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-				while ($lang_file = @readdir ($handle2)) {
-					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == 'en') {
-						$target_lang_file = $selected_language.substr($lang_file,2);
-						merge_langfile(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$target_lang_file,ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file);
+				while ($lang_file = @readdir($handle2)) {
+					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == 'en') {
+						$target_lang_file = $selected_language.substr($lang_file, 2);
+						merge_langfile(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$target_lang_file, ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file);
 					}
 				}
 				$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-				while ($lang_file = @readdir ($handle2)) {
-					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) {
-						$master_lang_file=ISPC_WEB_PATH.'/'.$file.'/lib/lang/en'.substr($lang_file,2);
+				while ($lang_file = @readdir($handle2)) {
+					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == $selected_language) {
+						$master_lang_file=ISPC_WEB_PATH.'/'.$file.'/lib/lang/en'.substr($lang_file, 2);
 						$target_lang_file=ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file;
 						if(!file_exists($master_lang_file)){
-						unlink($target_lang_file);
-						$msg.="File $target_lang_file removed because does not exist in master language<br />";
+							unlink($target_lang_file);
+							$msg.="File $target_lang_file removed because does not exist in master language<br />";
 						}
 					}
 				}//Finish of remove the files how not exists in master language
 			}
 		}
 	}
-if($msg=='')
-$msg="No files created, removed or modified<br />";
+	if($msg=='')
+		$msg="No files created, removed or modified<br />";
 }
 
-function merge_langfile($langfile,$masterfile) {
+function merge_langfile($langfile, $masterfile) {
 	global $msg;
-	
+
 	if(is_file($langfile)) {
-	
+
 		// Load the english language file
-		include($masterfile);
+		include $masterfile;
 		if(isset($wb) && is_array($wb)) {
 			$wb_master = $wb;
 			unset($wb);
 		} else {
 			$wb_master = array();
 		}
-	
+
 		// Load the incomplete language file
 		$wb = array();
-		include($langfile);
-	
+		include $langfile;
+
 		$n = 0;
 		foreach($wb_master as $key => $val) {
 			if(!isset($wb[$key])) {
@@ -126,7 +126,7 @@
 				$n++;
 			}
 		}
-		
+
 		$r = 0;
 		foreach($wb as $key => $val) {
 			if(!isset($wb_master[$key])) {
@@ -134,35 +134,35 @@
 				$r++;
 			}
 		}
-	
+
 		$file_content = "<?php\n";
 		foreach($wb as $key => $val) {
-			$val = str_replace("'","\\'",$val);
-			$val = str_replace('"','\"',$val);
+			$val = str_replace("'", "\\'", $val);
+			$val = str_replace('"', '\"', $val);
 			$file_content .= '$wb['."'$key'".'] = '."'$val';\n";
 		}
 		$file_content .= "?>\n";
-		
+
 		if($n!=0)
-		$msg .= "Added $n lines to the file $langfile<br />";
+			$msg .= "Added $n lines to the file $langfile<br />";
 		if($r!=0)
-		$msg .= "Removed $r lines to the file $langfile<br />";
-		file_put_contents($langfile ,$file_content);
+			$msg .= "Removed $r lines to the file $langfile<br />";
+		file_put_contents($langfile , $file_content);
 	} else {
 		$msg .= "File does not exist yet. Copied file $masterfile to $langfile<br />";
-		copy($masterfile,$langfile);
+		copy($masterfile, $langfile);
 	}
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_complete.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_edit.php b/interface/web/admin/language_edit.php
index ffba65d..fda70a6 100644
--- a/interface/web/admin/language_edit.php
+++ b/interface/web/admin/language_edit.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -57,27 +57,27 @@
 	$file_content = "<?php\n";
 	foreach($_POST['records'] as $key => $val) {
 		$val = stripslashes($val);
-		$val = str_replace('"','\"',$val);
-		$val = str_replace('$','',$val);
+		$val = str_replace('"', '\"', $val);
+		$val = str_replace('$', '', $val);
 		$file_content .= '$wb['."'$key'".'] = "'.$val.'";'."\n";
 		$msg = 'File saved.';
 	}
 	$file_content .= "?>\n";
 	if($module == 'global') {
-		file_put_contents(ISPC_LIB_PATH."/lang/$lang_file" ,$file_content);
+		file_put_contents(ISPC_LIB_PATH."/lang/$lang_file" , $file_content);
 	} else {
-		file_put_contents(ISPC_WEB_PATH."/$module/lib/lang/$lang_file" ,$file_content);
+		file_put_contents(ISPC_WEB_PATH."/$module/lib/lang/$lang_file" , $file_content);
 	}
 }
 
 
-$app->tpl->setVar(array('module' => $module,'lang_file' => $lang_file, 'lang' => $lang, 'msg' => $msg));
+$app->tpl->setVar(array('module' => $module, 'lang_file' => $lang_file, 'lang' => $lang, 'msg' => $msg));
 
 if($module == 'global') {
-	include(ISPC_LIB_PATH."/lang/$lang_file");
+	include ISPC_LIB_PATH."/lang/$lang_file";
 	$file_path = ISPC_LIB_PATH."/lang/$lang_file";
 } else {
-	include(ISPC_WEB_PATH."/$module/lib/lang/$lang_file");
+	include ISPC_WEB_PATH."/$module/lib/lang/$lang_file";
 	$file_path = ISPC_WEB_PATH."/$module/lib/lang/$lang_file";
 }
 $app->tpl->setVar("file_path", $file_path);
@@ -85,7 +85,7 @@
 $keyword_list = array();
 if(isset($wb) && is_array($wb)) {
 	foreach($wb as $key => $val) {
-		$keyword_list[] = array('key' => $key, 'val' => htmlentities($val,ENT_COMPAT | ENT_HTML401,'UTF-8'));
+		$keyword_list[] = array('key' => $key, 'val' => htmlentities($val, ENT_COMPAT | ENT_HTML401, 'UTF-8'));
 	}
 
 	$app->tpl->setLoop('records', $keyword_list);
@@ -93,9 +93,9 @@
 }
 
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_edit.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
diff --git a/interface/web/admin/language_export.php b/interface/web/admin/language_export.php
index 5c192c3..a4c75f3 100644
--- a/interface/web/admin/language_export.php
+++ b/interface/web/admin/language_export.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -46,13 +46,13 @@
 $language_option = '';
 $error = '';
 $msg = '';
-$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'],0,2):'en';
+$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'], 0, 2):'en';
 if(!preg_match("/^[a-z]{2}$/i", $selected_language)) die('unallowed characters in selected language name.');
 
-$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/'); 
-while ($file = readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-		$tmp_lng = substr($file,0,-4);
+$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/');
+while ($file = readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		$tmp_lng = substr($file, 0, -4);
 		if($tmp_lng !='') {
 			$selected = ($tmp_lng == $selected_language)?'SELECTED':'';
 			$language_option .= "<option value='$tmp_lng' $selected>$tmp_lng</option>";
@@ -60,34 +60,34 @@
 		}
 	}
 }
-$app->tpl->setVar('language_option',$language_option);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('language_option', $language_option);
+$app->tpl->setVar('error', $error);
 
 // Export the language file
 if(isset($_POST['lng_select']) && $error == '') {
 	//$lng_select = $_POST['lng_select'];
 	//if(!preg_match("/^[a-z]{2}$/i", $lng_select)) die('unallowed characters in language name.');
-	
+
 	// This variable contains the content of the language files
 	$content = '';
 	$content .= "---|ISPConfig Language File|".$conf["app_version"]."|".$selected_language."\n";
-	
+
 	//* get the global language file
 	$content .= "--|global|".$selected_language."|".$selected_language.".lng\n";
 	$content .= file_get_contents(ISPC_LIB_PATH."/lang/".$selected_language.".lng")."\n";
-	
+
 	//* Get the global file of the module
 	//$content .= "---|$module|$selected_language|\n";
 	//copy(ISPC_WEB_PATH."/$module/lib/lang/$selected_language.lng",ISPC_WEB_PATH."/$module/lib/lang/$lng_new.lng");
 	$bgcolor = '#FFFFFF';
 	$language_files_list = array();
-	$handle = @opendir(ISPC_WEB_PATH); 
-	while ($file = @readdir ($handle)) { 
-	   	if ($file != '.' && $file != '..') {
-	        if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
+	$handle = @opendir(ISPC_WEB_PATH);
+	while ($file = @readdir($handle)) {
+		if ($file != '.' && $file != '..') {
+			if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
 				$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-				while ($lang_file = @readdir ($handle2)) {
-					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) {
+				while ($lang_file = @readdir($handle2)) {
+					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == $selected_language) {
 						$content .= "--|".$file."|".$selected_language."|".$lang_file."\n";
 						$content .= file_get_contents(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file)."\n";
 						$msg .= 'Exported language file '.$lang_file.'<br />';
@@ -96,26 +96,26 @@
 			}
 		}
 	}
-	
+
 	$content .= '---|EOF';
-	
+
 	// Write the language file
 	file_put_contents(ISPC_WEB_TEMP_PATH.'/'.$selected_language.'.lng', $content);
-	
+
 	$msg = "Exported language file to: <a href='temp/$selected_language.lng' target='_blank'>/temp/".$selected_language.'.lng</a>';
-	
+
 	//$msg = nl2br($content);
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_export.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_import.php b/interface/web/admin/language_import.php
index c25406a..1dfaa18 100644
--- a/interface/web/admin/language_import.php
+++ b/interface/web/admin/language_import.php
@@ -27,87 +27,87 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 function normalize_string($string, $quote, $allow_special = false) {
-    $escaped = false;
-    $in_string = true;
-    $new_string = '';
-    
-    for($c = 0; $c < mb_strlen($string); $c++) {
-        $char = $string{$c};
-        
-        if($in_string === true && $escaped === false && $char === $quote) {
-            // this marks a string end (e.g. for concatenation)
-            $in_string = false;
-            continue;
-        } elseif($in_string === false) {
-            if($escaped === false && $char === $quote) {
-                $in_string = true;
-                continue;
-            } else {
-                continue; // we strip everything from outside the string!
-            }
-        }
-        
-        if($char === '"' && $escaped === true && $quote === '"') {
-            // unescape this
-            $new_string .= $char;
-            $escaped = false;
-            continue;
-        } elseif($char === "'" && $escaped === false && $quote === '"') {
-            // escape this
-            $new_string .= '\\' . $char;
-            continue;
-        }
-        
-        if($escaped === true) {
-            // the next character is the escaped one.
-            if($allow_special === true && ($char === 'n' || $char === 'r' || $char === 't')) {
-                $new_string .= '\' . "\\' . $char . '" . \'';
-            } else {
-                $new_string .= '\\' . $char;
-            }
-            $escaped = false;
-        } else {
-            if($char === '\\') {
-                $escaped = true;
-            } else {
-                $new_string .= $char;
-            }
-        }
-    }
-    return $new_string;
+	$escaped = false;
+	$in_string = true;
+	$new_string = '';
+
+	for($c = 0; $c < mb_strlen($string); $c++) {
+		$char = $string{$c};
+
+		if($in_string === true && $escaped === false && $char === $quote) {
+			// this marks a string end (e.g. for concatenation)
+			$in_string = false;
+			continue;
+		} elseif($in_string === false) {
+			if($escaped === false && $char === $quote) {
+				$in_string = true;
+				continue;
+			} else {
+				continue; // we strip everything from outside the string!
+			}
+		}
+
+		if($char === '"' && $escaped === true && $quote === '"') {
+			// unescape this
+			$new_string .= $char;
+			$escaped = false;
+			continue;
+		} elseif($char === "'" && $escaped === false && $quote === '"') {
+			// escape this
+			$new_string .= '\\' . $char;
+			continue;
+		}
+
+		if($escaped === true) {
+			// the next character is the escaped one.
+			if($allow_special === true && ($char === 'n' || $char === 'r' || $char === 't')) {
+				$new_string .= '\' . "\\' . $char . '" . \'';
+			} else {
+				$new_string .= '\\' . $char;
+			}
+			$escaped = false;
+		} else {
+			if($char === '\\') {
+				$escaped = true;
+			} else {
+				$new_string .= $char;
+			}
+		}
+	}
+	return $new_string;
 }
 
 function validate_line($line) {
-    $line = trim($line);
-    if($line === '' || $line === '<?php' || $line === '?>') return $line; // don't treat empty lines as malicious
-    
-    $ok = preg_match('/^\s*\$wb\[(["\'])(.*?)\\1\]\s*=\s*(["\'])(.*?)\\3\s*;\s*$/', $line, $matches);
-    if(!$ok) return false; // this line has invalid form and could lead to malfunction
-    
-    $keyquote = $matches[1]; // ' or "
-    $key = $matches[2];
-    if(strpos($key, '"') !== false || strpos($key, "'") !== false) return false;
-    
-    $textquote = $matches[3]; // ' or "
-    $text = $matches[4];
+	$line = trim($line);
+	if($line === '' || $line === '<?php' || $line === '?>') return $line; // don't treat empty lines as malicious
 
-    $new_line = '$wb[\'';
-    
-    // validate the language key
-    $key = normalize_string($key, $keyquote);
-    
-    $new_line .= $key . '\'] = \'';
-    
-    // validate this text to avoid code injection
-    $text = normalize_string($text, $textquote, true);
-    
-    $new_line .= $text . '\';';
-    
-    return $new_line;
+	$ok = preg_match('/^\s*\$wb\[(["\'])(.*?)\\1\]\s*=\s*(["\'])(.*?)\\3\s*;\s*$/', $line, $matches);
+	if(!$ok) return false; // this line has invalid form and could lead to malfunction
+
+	$keyquote = $matches[1]; // ' or "
+	$key = $matches[2];
+	if(strpos($key, '"') !== false || strpos($key, "'") !== false) return false;
+
+	$textquote = $matches[3]; // ' or "
+	$text = $matches[4];
+
+	$new_line = '$wb[\'';
+
+	// validate the language key
+	$key = normalize_string($key, $keyquote);
+
+	$new_line .= $key . '\'] = \'';
+
+	// validate this text to avoid code injection
+	$text = normalize_string($text, $textquote, true);
+
+	$new_line .= $text . '\';';
+
+	return $new_line;
 }
 
 //* Check permissions for module
@@ -130,20 +130,20 @@
 if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
 	$lines = file($_FILES['file']['tmp_name']);
 	// initial check
-	$parts = explode('|',$lines[0]);
+	$parts = explode('|', $lines[0]);
 	if($parts[0] == '---' && $parts[1] == 'ISPConfig Language File') {
 		if($_POST['ignore_version'] != 1 && $parts[2] != $conf["app_version"]) {
 			$error .= 'Application version does not match. Appversion: '.$conf["app_version"].' Lanfile version: '.$parts[2];
 		} else {
 			unset($lines[0]);
-			
+
 			$buffer = '';
 			$langfile_path = '';
 			// all other lines
-            $ln = 1;
+			$ln = 1;
 			foreach($lines as $line) {
-                $ln++;
-				$parts = explode('|',$line);
+				$ln++;
+				$parts = explode('|', $line);
 				if(is_array($parts) && count($parts) > 0 && $parts[0] == '--') {
 					// Write language file, if its not the first file
 					if($buffer != '' && $langfile_path != '') {
@@ -151,7 +151,7 @@
 							$error .= "File exists, not written: $langfile_path<br />";
 						} else {
 							$msg .= "File written: $langfile_path<br />";
-							file_put_contents($langfile_path,$buffer);
+							file_put_contents($langfile_path, $buffer);
 						}
 					}
 					// empty buffer and set variables
@@ -161,17 +161,17 @@
 					$file_name = trim($parts[3]);
 					if(!preg_match("/^[a-z]{2}$/i", $selected_language)) die("unallowed characters in selected language name: $selected_language");
 					if(!preg_match("/^[a-z_]+$/i", $module_name)) die('unallowed characters in module name.');
-					if(!preg_match("/^[a-z\._\-]+$/i", $file_name) || stristr($file_name,'..')) die("unallowed characters in language file name: '$file_name'");
+					if(!preg_match("/^[a-z\._\-]+$/i", $file_name) || stristr($file_name, '..')) die("unallowed characters in language file name: '$file_name'");
 					if($module_name == 'global') {
 						$langfile_path = trim(ISPC_LIB_PATH."/lang/".$selected_language.".lng");
 					} else {
 						$langfile_path = trim(ISPC_WEB_PATH.'/'.$module_name.'/lib/lang/'.$file_name);
 					}
 				} elseif(is_array($parts) && count($parts) > 1 && $parts[0] == '---' && $parts[1] == 'EOF') {
-                    // EOF line, ignore it.
-                } else {
-                    $line = validate_line($line);
-                    if($line === false) $error .= "Language file contains invalid language entry on line $ln.<br />";
+					// EOF line, ignore it.
+				} else {
+					$line = validate_line($line);
+					if($line === false) $error .= "Language file contains invalid language entry on line $ln.<br />";
 					else $buffer .= $line."\n";
 				}
 			}
@@ -179,16 +179,16 @@
 	}
 }
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_import.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_list.php b/interface/web/admin/language_list.php
index 84b8007..2cb28dc 100644
--- a/interface/web/admin/language_list.php
+++ b/interface/web/admin/language_list.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -46,45 +46,45 @@
 
 //* reading languages
 $language_option = '';
-$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'],0,2):$_SESSION['s']['language'];
-$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/'); 
-while ($file = readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-		$tmp_lng = substr($file,0,-4);
+$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'], 0, 2):$_SESSION['s']['language'];
+$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/');
+while ($file = readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		$tmp_lng = substr($file, 0, -4);
 		if($tmp_lng !='') {
 			$selected = ($tmp_lng == $selected_language)?'SELECTED':'';
 			$language_option .= "<option value='$tmp_lng' $selected>$tmp_lng</option>";
-			
+
 			//$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 			if($file == $selected_language.'.lng') {
-			$language_files_list[] = array(	'module' => 'global',
-											'lang_file' => $file,
-											'lang_file_date' => date("Y-m-d H:i:s", filectime(ISPC_ROOT_PATH.'/lib/lang/'.$file)),
-											'bgcolor'  => $bgcolor,
-											'lang' => $selected_language);
+				$language_files_list[] = array( 'module' => 'global',
+					'lang_file' => $file,
+					'lang_file_date' => date("Y-m-d H:i:s", filectime(ISPC_ROOT_PATH.'/lib/lang/'.$file)),
+					'bgcolor'  => $bgcolor,
+					'lang' => $selected_language);
 			}
-			
-			
+
+
 		}
 	}
 }
-$app->tpl->setVar('language_option',$language_option);
+$app->tpl->setVar('language_option', $language_option);
 // $app->tpl->setLoop('records', $language_list);
 
 //* list all language files of the selected language
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
 			$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-			while ($lang_file = @readdir ($handle2)) {
-				if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) {
+			while ($lang_file = @readdir($handle2)) {
+				if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == $selected_language) {
 					$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
-					$language_files_list[] = array(	'module' => $file,
-													'lang_file' => $lang_file,
-													'lang_file_date' => date("Y-m-d H:i:s", filectime(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file)),
-													'bgcolor'  => $bgcolor,
-													'lang' => $selected_language);
+					$language_files_list[] = array( 'module' => $file,
+						'lang_file' => $lang_file,
+						'lang_file_date' => date("Y-m-d H:i:s", filectime(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file)),
+						'bgcolor'  => $bgcolor,
+						'lang' => $selected_language);
 				}
 			}
 		}
@@ -96,9 +96,9 @@
 
 
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_list.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php
index 92e1979..7f4d19d 100644
--- a/interface/web/admin/lib/module.conf.php
+++ b/interface/web/admin/lib/module.conf.php
@@ -2,61 +2,61 @@
 
 global $conf;
 
-$module['name'] 	= 'admin';
-$module['title'] 	= 'top_menu_system';
-$module['template'] 	= 'module.tpl.htm';
-$module['startpage'] 	= 'admin/server_list.php';
+$module['name']  = 'admin';
+$module['title']  = 'top_menu_system';
+$module['template']  = 'module.tpl.htm';
+$module['startpage']  = 'admin/server_list.php';
 $module['tab_width']    = '60';
 
 
 $items[] = array(   'title'     => 'CP Users',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/users_list.php',
-                    'html_id'   => 'user_list');
+	'target'  => 'content',
+	'link' => 'admin/users_list.php',
+	'html_id'   => 'user_list');
 
-$items[] = array(   'title' 	=> 'Remote Users',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/remote_user_list.php',
-                    'html_id'   => 'remote_user_list');
+$items[] = array(   'title'  => 'Remote Users',
+	'target'  => 'content',
+	'link' => 'admin/remote_user_list.php',
+	'html_id'   => 'remote_user_list');
 
-$module['nav'][] = array(   'title'	=> 'User Management',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module['nav'][] = array(   'title' => 'User Management',
+	'open'  => 1,
+	'items' => $items);
 
 // cleanup
 unset($items);
 
-$items[] = array(   'title' 	=> 'Server Services',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/server_list.php',
-                    'html_id'   => 'server_list');
+$items[] = array(   'title'  => 'Server Services',
+	'target'  => 'content',
+	'link' => 'admin/server_list.php',
+	'html_id'   => 'server_list');
 
-$items[] = array(   'title' 	=> 'Server Config',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/server_config_list.php',
-                    'html_id'   => 'server_config_list');
+$items[] = array(   'title'  => 'Server Config',
+	'target'  => 'content',
+	'link' => 'admin/server_config_list.php',
+	'html_id'   => 'server_config_list');
 
-$items[] = array(   'title' 	=> 'Server IP addresses',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/server_ip_list.php',
-                    'html_id'   => 'server_ip_list');
+$items[] = array(   'title'  => 'Server IP addresses',
+	'target'  => 'content',
+	'link' => 'admin/server_ip_list.php',
+	'html_id'   => 'server_ip_list');
 
 
 
-$items[] = array(   'title' 	=> 'Additional PHP Versions',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/server_php_list.php',
-                    'html_id'   => 'server_php_list');
-					
-$items[] = array(   'title' 	=> 'Directive Snippets',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/directive_snippets_list.php',
-                    'html_id'   => 'directive_snippets_list');
+$items[] = array(   'title'  => 'Additional PHP Versions',
+	'target'  => 'content',
+	'link' => 'admin/server_php_list.php',
+	'html_id'   => 'server_php_list');
 
-$items[] = array(   'title' 	=> 'Firewall',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/firewall_list.php',
-                    'html_id'   => 'firewall_list');
+$items[] = array(   'title'  => 'Directive Snippets',
+	'target'  => 'content',
+	'link' => 'admin/directive_snippets_list.php',
+	'html_id'   => 'directive_snippets_list');
+
+$items[] = array(   'title'  => 'Firewall',
+	'target'  => 'content',
+	'link' => 'admin/firewall_list.php',
+	'html_id'   => 'firewall_list');
 
 /*
 $items[] = array( 'title' 	=> 'Firewall IPTables',
@@ -65,104 +65,104 @@
 
 $items[] = array( 'title' 	=> 'Packet Filter',
 				  'target' 	=> 'content',
-				  'link'	=> 'admin/firewall_filter_list.php');				  
+				  'link'	=> 'admin/firewall_filter_list.php');
 
 $items[] = array( 'title' 	=> 'Port Forward',
 				  'target' 	=> 'content',
-				  'link'	=> 'admin/firewall_forward_list.php');				  
+				  'link'	=> 'admin/firewall_forward_list.php');
 */
 
 $module['nav'][] = array(   'title'     => 'System',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+	'open'  => 1,
+	'items' => $items);
 // cleanup
 unset($items);
 
-$items[] = array(   'title' 	=> 'Interface Config',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/system_config_edit.php?id=1',
-                    'html_id'   => 'interface_config');
+$items[] = array(   'title'  => 'Interface Config',
+	'target'  => 'content',
+	'link' => 'admin/system_config_edit.php?id=1',
+	'html_id'   => 'interface_config');
 
 $module['nav'][] = array(   'title'     => 'Interface',
-                            'open'      => "1",
-                            'items'     => $items);
+	'open'      => "1",
+	'items'     => $items);
 
 
 // cleanup
 unset($items);
 
 
-$items[] = array(   'title' 	=> 'Repositories',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/software_repo_list.php',
-                    'html_id'   => 'software_repo_list');
+$items[] = array(   'title'  => 'Repositories',
+	'target'  => 'content',
+	'link' => 'admin/software_repo_list.php',
+	'html_id'   => 'software_repo_list');
 
-$items[] = array(   'title' 	=> 'Packages',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/software_package_list.php',
-                    'html_id'   => 'software_package_list');
+$items[] = array(   'title'  => 'Packages',
+	'target'  => 'content',
+	'link' => 'admin/software_package_list.php',
+	'html_id'   => 'software_package_list');
 
-$items[] = array(   'title' 	=> 'Updates',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/software_update_list.php',
-                    'html_id'   => 'software_update_list');
+$items[] = array(   'title'  => 'Updates',
+	'target'  => 'content',
+	'link' => 'admin/software_update_list.php',
+	'html_id'   => 'software_update_list');
 
 $module['nav'][] = array(   'title'     => 'Software',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+	'open'  => 1,
+	'items' => $items);
 
 
 // cleanup
 unset($items);
 
-$items[] = array(   'title' 	=> 'Languages',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_list.php',
-                    'html_id'   => 'language_list');
+$items[] = array(   'title'  => 'Languages',
+	'target'  => 'content',
+	'link' => 'admin/language_list.php',
+	'html_id'   => 'language_list');
 
-$items[] = array(   'title' 	=> 'New Language',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_add.php',
-                    'html_id'   => 'language_add');
+$items[] = array(   'title'  => 'New Language',
+	'target'  => 'content',
+	'link' => 'admin/language_add.php',
+	'html_id'   => 'language_add');
 
-$items[] = array(   'title' 	=> 'Merge',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_complete.php',
-                    'html_id'   => 'language_complete');
+$items[] = array(   'title'  => 'Merge',
+	'target'  => 'content',
+	'link' => 'admin/language_complete.php',
+	'html_id'   => 'language_complete');
 
-$items[] = array(   'title' 	=> 'Export',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_export.php',
-                    'html_id'   => 'language_export');
+$items[] = array(   'title'  => 'Export',
+	'target'  => 'content',
+	'link' => 'admin/language_export.php',
+	'html_id'   => 'language_export');
 
-$items[] = array(   'title' 	=> 'Import',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_import.php',
-                    'html_id'   => 'language_import');
+$items[] = array(   'title'  => 'Import',
+	'target'  => 'content',
+	'link' => 'admin/language_import.php',
+	'html_id'   => 'language_import');
 
 $module['nav'][] = array(   'title'     => 'Language Editor',
-                            'open'      => 1,
-                            'items'     => $items);
+	'open'      => 1,
+	'items'     => $items);
 
 
 // cleanup
 unset($items);
 
 
-$items[] = array(   'title' 	=> 'Do OS-Update',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/remote_action_osupdate.php',
-                    'html_id'   => 'osupdate');
+$items[] = array(   'title'  => 'Do OS-Update',
+	'target'  => 'content',
+	'link' => 'admin/remote_action_osupdate.php',
+	'html_id'   => 'osupdate');
 
 // ISPConfig interface update has been removed. Please use ispconfig_update.sh on the shell instead.
-$items[] = array(   'title' 	=> 'Do ISPConfig-Update',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/remote_action_ispcupdate.php',
-                    'html_id'   => 'ispcupdate');
+$items[] = array(   'title'  => 'Do ISPConfig-Update',
+	'target'  => 'content',
+	'link' => 'admin/remote_action_ispcupdate.php',
+	'html_id'   => 'ispcupdate');
 
-$module['nav'][] = array(   'title'	=> 'Remote Actions',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module['nav'][] = array(   'title' => 'Remote Actions',
+	'open'  => 1,
+	'items' => $items);
 
 
 // Getting the admin options from other modules
@@ -171,7 +171,7 @@
 	foreach($modules as $mt) {
 		if(is_file($mt.'/lib/admin.conf.php')) {
 			$options = array();
-			include_once(ISPC_WEB_PATH."/$mt/lib/admin.conf.php");
+			include_once ISPC_WEB_PATH."/$mt/lib/admin.conf.php";
 			if(is_array($options)) {
 				foreach($options as $opt) {
 					$module['nav'][] = $opt;
@@ -181,4 +181,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/lib/remote.conf.php b/interface/web/admin/lib/remote.conf.php
index 6a87e95..4268f47 100644
--- a/interface/web/admin/lib/remote.conf.php
+++ b/interface/web/admin/lib/remote.conf.php
@@ -2,4 +2,4 @@
 
 $function_list['server_get,get_function_list,client_templates_get_all,server_get_serverid_by_ip,server_ip_add,server_ip_update,server_ip_delete'] = 'Server functions';
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/directive_snippets.list.php b/interface/web/admin/list/directive_snippets.list.php
index 593ff80..8522e07 100644
--- a/interface/web/admin/list/directive_snippets.list.php
+++ b/interface/web/admin/list/directive_snippets.list.php
@@ -13,66 +13,66 @@
 
 
 // Name of the list
-$liste["name"] 				= "directive_snippets";
+$liste["name"]     = "directive_snippets";
 
 // Database table
-$liste["table"] 			= "directive_snippets";
+$liste["table"]    = "directive_snippets";
 
 // Index index field of the database table
-$liste["table_idx"]			= "directive_snippets_id";
+$liste["table_idx"]   = "directive_snippets_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "directive_snippets_list.php";
+$liste["file"]    = "directive_snippets_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "directive_snippets_edit.php";
+$liste["edit_file"]   = "directive_snippets_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "directive_snippets_del.php";
+$liste["delete_file"]  = "directive_snippets_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('apache' => 'Apache', 'nginx' => 'nginx', 'php' => 'PHP', 'proxy' => 'Proxy'));
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('apache' => 'Apache', 'nginx' => 'nginx', 'php' => 'PHP', 'proxy' => 'Proxy'));
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/firewall.list.php b/interface/web/admin/list/firewall.list.php
index 97d2fe9..058e86c 100644
--- a/interface/web/admin/list/firewall.list.php
+++ b/interface/web/admin/list/firewall.list.php
@@ -13,81 +13,81 @@
 
 
 // Name of the list
-$liste["name"] 				= "firewall";
+$liste["name"]     = "firewall";
 
 // Database table
-$liste["table"] 			= "firewall";
+$liste["table"]    = "firewall";
 
 // Index index field of the database table
-$liste["table_idx"]			= "firewall_id";
+$liste["table_idx"]   = "firewall_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "firewall_list.php";
+$liste["file"]    = "firewall_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "firewall_edit.php";
+$liste["edit_file"]   = "firewall_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "firewall_del.php";
+$liste["delete_file"]  = "firewall_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "tcp_port",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "tcp_port",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "udp_port",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "udp_port",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/groups.list.php b/interface/web/admin/list/groups.list.php
index ded1306..9d8d4c9 100644
--- a/interface/web/admin/list/groups.list.php
+++ b/interface/web/admin/list/groups.list.php
@@ -10,52 +10,52 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'groups';
+$liste['name']     = 'groups';
 
 //* Database table
-$liste['table'] 			= 'sys_group';
+$liste['table']    = 'sys_group';
 
 //* Primary index column
-$liste['table_idx']			= 'groupid';
+$liste['table_idx']   = 'groupid';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'groups_list.php';
+$liste['file']    = 'groups_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'groups_edit.php';
+$liste['edit_file']   = 'groups_edit.php';
 
 //* Script file for deleting
-$liste['delete_file']		= 'groups_del.php';
+$liste['delete_file']  = 'groups_del.php';
 
 //* Paging Template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'name',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '');
+$liste['item'][] = array( 'field'  => 'name',
+	'datatype' => 'VARCHAR',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '');
 
-$liste['item'][] = array(	'field'		=> 'description',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '');  
+$liste['item'][] = array( 'field'  => 'description',
+	'datatype' => 'VARCHAR',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '');
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/iptables.list.php b/interface/web/admin/list/iptables.list.php
index 657f521..ad487e5 100644
--- a/interface/web/admin/list/iptables.list.php
+++ b/interface/web/admin/list/iptables.list.php
@@ -1,107 +1,107 @@
 <?php
 
-$liste["name"] 				= "iptables";
-$liste["table"] 			= "iptables";
-$liste["table_idx"]			= "iptables_id";
-$liste["search_prefix"] 	= "search_";
-$liste["records_per_page"] 	= "15";
-$liste["file"]				= "iptables_list.php";
-$liste["edit_file"]			= "iptables_edit.php";
-$liste["delete_file"]		= "iptables_del.php";
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
-$liste["auth"]				= "yes";
+$liste["name"]     = "iptables";
+$liste["table"]    = "iptables";
+$liste["table_idx"]   = "iptables_id";
+$liste["search_prefix"]  = "search_";
+$liste["records_per_page"]  = "15";
+$liste["file"]    = "iptables_list.php";
+$liste["edit_file"]   = "iptables_edit.php";
+$liste["delete_file"]  = "iptables_del.php";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
+$liste["auth"]    = "yes";
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array("y" => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>","n" => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array("y" => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", "n" => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> "SQL",
-														'querystring' => "SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND db_server = 1 ORDER BY server_name",
-														'keyfield'=> "server_id",
-														'valuefield'=> "server_name"),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => "SQL",
+		'querystring' => "SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND db_server = 1 ORDER BY server_name",
+		'keyfield'=> "server_id",
+		'valuefield'=> "server_name"),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "singleport",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "singleport",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "multiport",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "multiport",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
 $liste["item"][] = array(   'field'     => "protocol",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "SELECT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => array('none'=>'None','tcp' => "TCP",'udp' => "UDP"));
+	'datatype'  => "VARCHAR",
+	'formtype'  => "SELECT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => array('none'=>'None', 'tcp' => "TCP", 'udp' => "UDP"));
 
 $liste["item"][] = array(   'field'     => "table",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "SELECT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => array('INPUT' => "INPUT",'OUTPUT' => "OUTPUT",'FORWARD' => "FORWARD"));
+	'datatype'  => "VARCHAR",
+	'formtype'  => "SELECT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => array('INPUT' => "INPUT", 'OUTPUT' => "OUTPUT", 'FORWARD' => "FORWARD"));
 
 $liste["item"][] = array(   'field'     => "source_ip",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "16",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "16",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "destination_ip",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "16",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "16",
+	'value'     => "");
 
-$liste["item"][] = array(	'field'		=> "target",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-                            'value'     => array('ACCEPT' => "ACCEPT",'DROP' => "DROP",'REJECT' => "REJECT",'LOG' => "LOG"));
+$liste["item"][] = array( 'field'  => "target",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'     => array('ACCEPT' => "ACCEPT", 'DROP' => "DROP", 'REJECT' => "REJECT", 'LOG' => "LOG"));
 
-$liste["item"][] = array(	'field'		=> "state",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "state",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+?>
diff --git a/interface/web/admin/list/remote_user.list.php b/interface/web/admin/list/remote_user.list.php
index 09f4e3d..7dc0fbf 100644
--- a/interface/web/admin/list/remote_user.list.php
+++ b/interface/web/admin/list/remote_user.list.php
@@ -34,32 +34,31 @@
 //****** Search fields
 
 $liste['item'][] = array(
-            'field'      => 'remote_userid',
-            'datatype'   => 'VARCHAR',
-            'formtype'   => 'SELECT',
-            'op'         => '=',
-            'prefix'     => '',
-            'suffix'     => '',
-            'width'      => '',
-            'datasource' => array(
-                    'type' => 'SQL',
-                    'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username',
-                    'keyfield'    => 'remote_userid',
-                    'valuefield'  => 'remote_userid'
-                                  ),
-            'value'      => ''
-        );
+	'field'      => 'remote_userid',
+	'datatype'   => 'VARCHAR',
+	'formtype'   => 'SELECT',
+	'op'         => '=',
+	'prefix'     => '',
+	'suffix'     => '',
+	'width'      => '',
+	'datasource' => array(
+		'type' => 'SQL',
+		'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username',
+		'keyfield'    => 'remote_userid',
+		'valuefield'  => 'remote_userid'
+	),
+	'value'      => ''
+);
 
 $liste['item'][] = array(
-            'field'      => 'remote_username',
-            'datatype'   => 'VARCHAR',
-            'formtype'   => 'TEXT',
-            'op'         => 'like',
-            'prefix'     => '%',
-            'suffix'     => '%',
-            'width'      => '',
-            'value'      => ''
-        );
+	'field'      => 'remote_username',
+	'datatype'   => 'VARCHAR',
+	'formtype'   => 'TEXT',
+	'op'         => 'like',
+	'prefix'     => '%',
+	'suffix'     => '%',
+	'width'      => '',
+	'value'      => ''
+);
 
 ?>
-
diff --git a/interface/web/admin/list/server.list.php b/interface/web/admin/list/server.list.php
index acca81a..85b6e65 100644
--- a/interface/web/admin/list/server.list.php
+++ b/interface/web/admin/list/server.list.php
@@ -10,104 +10,104 @@
 */
 
 //* Name of the list
-$liste['name'] 				= 'server';
+$liste['name']     = 'server';
 
 //* Database table
-$liste['table'] 			= 'server';
+$liste['table']    = 'server';
 
 //* Index index field of the database table
-$liste['table_idx']			= 'server_id';
+$liste['table_idx']   = 'server_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script File of the list
-$liste['file']				= 'server_list.php';
+$liste['file']    = 'server_list.php';
 
 //* Script file of the edit form
-$liste['edit_file']			= 'server_edit.php';
+$liste['edit_file']   = 'server_edit.php';
 
 //* Script File of the delete script
-$liste['delete_file']		= 'server_del.php';
+$liste['delete_file']  = 'server_del.php';
 
 //* Paging Template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'yes';
+$liste['auth']    = 'yes';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'server_name',
-							'datatype'	=> 'VARCHAR',
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'server_name',
+	'datatype' => 'VARCHAR',
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => '');
 
-$liste['item'][] = array(	'field'		=> 'mail_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste['item'][] = array( 'field'  => 'mail_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste['item'][] = array(	'field'		=> 'web_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste['item'][] = array( 'field'  => 'web_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste['item'][] = array(	'field'		=> 'dns_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste['item'][] = array( 'field'  => 'dns_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste['item'][] = array(	'field'		=> 'file_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste['item'][] = array( 'field'  => 'file_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste['item'][] = array(	'field'		=> 'db_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste['item'][] = array( 'field'  => 'db_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste['item'][] = array(	'field'		=> 'vserver_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste['item'][] = array( 'field'  => 'vserver_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/server_config.list.php b/interface/web/admin/list/server_config.list.php
index f0540f4..fb7ac32 100644
--- a/interface/web/admin/list/server_config.list.php
+++ b/interface/web/admin/list/server_config.list.php
@@ -13,48 +13,48 @@
 
 
 // Name of the list
-$liste["name"] 				= "server_config";
+$liste["name"]     = "server_config";
 
 // Database table
-$liste["table"] 			= "server";
+$liste["table"]    = "server";
 
 // Index index field of the database table
-$liste["table_idx"]			= "server_id";
+$liste["table_idx"]   = "server_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "server_config_list.php";
+$liste["file"]    = "server_config_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "server_config_edit.php";
+$liste["edit_file"]   = "server_config_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "server_config_del.php";
+$liste["delete_file"]  = "server_config_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "server_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/server_ip.list.php b/interface/web/admin/list/server_ip.list.php
index 10001fb..dba0c68 100644
--- a/interface/web/admin/list/server_ip.list.php
+++ b/interface/web/admin/list/server_ip.list.php
@@ -10,99 +10,99 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'server_ip';
+$liste['name']     = 'server_ip';
 
 //* Database table
-$liste['table'] 			= 'server_ip';
+$liste['table']    = 'server_ip';
 
 //* Primary index column
-$liste['table_idx']			= 'server_ip_id';
+$liste['table_idx']   = 'server_ip_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'server_ip_list.php';
+$liste['file']    = 'server_ip_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'server_ip_edit.php';
+$liste['edit_file']   = 'server_ip_edit.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'server_ip_del.php';
+$liste['delete_file']  = 'server_ip_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'server_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'server_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => '',
+	'value'  => '');
 
-$liste['item'][] = array(	'field'		=> 'client_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
-														'keyfield'=> 'client_id',
-														'valuefield'=> 'contact_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'client_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
+		'keyfield'=> 'client_id',
+		'valuefield'=> 'contact_name'
+	),
+	'width'  => '',
+	'value'  => '');
 
-$liste['item'][] = array(	'field'		=> 'ip_type',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> '',
-							'value'		=> array('IPv4' => 'IPv4', 'IPv6' => 'IPv6'));
+$liste['item'][] = array( 'field'  => 'ip_type',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '',
+	'value'  => array('IPv4' => 'IPv4', 'IPv6' => 'IPv6'));
 
-$liste['item'][] = array(	'field'		=> 'ip_address',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> '');  
+$liste['item'][] = array( 'field'  => 'ip_address',
+	'datatype' => 'VARCHAR',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '');
 
-$liste["item"][] = array(	'field'		=> "virtualhost",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "virtualhost",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste['item'][] = array(	'field'		=> 'virtualhost_port',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> ''); 
+$liste['item'][] = array( 'field'  => 'virtualhost_port',
+	'datatype' => 'VARCHAR',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '');
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/server_php.list.php b/interface/web/admin/list/server_php.list.php
index 1464d16..ce8944d 100644
--- a/interface/web/admin/list/server_php.list.php
+++ b/interface/web/admin/list/server_php.list.php
@@ -10,73 +10,73 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'server_php';
+$liste['name']     = 'server_php';
 
 //* Database table
-$liste['table'] 			= 'server_php';
+$liste['table']    = 'server_php';
 
 //* Primary index column
-$liste['table_idx']			= 'server_php_id';
+$liste['table_idx']   = 'server_php_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'server_php_list.php';
+$liste['file']    = 'server_php_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'server_php_edit.php';
+$liste['edit_file']   = 'server_php_edit.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'server_php_del.php';
+$liste['delete_file']  = 'server_php_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'server_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'server_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => '',
+	'value'  => '');
 
-$liste['item'][] = array(	'field'		=> 'client_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
-														'keyfield'=> 'client_id',
-														'valuefield'=> 'contact_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'client_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
+		'keyfield'=> 'client_id',
+		'valuefield'=> 'contact_name'
+	),
+	'width'  => '',
+	'value'  => '');
 
-$liste['item'][] = array(	'field'		=> 'name',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '');
+$liste['item'][] = array( 'field'  => 'name',
+	'datatype' => 'VARCHAR',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '');
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/software_repo.list.php b/interface/web/admin/list/software_repo.list.php
index 7c11113..2eb3dd5 100644
--- a/interface/web/admin/list/software_repo.list.php
+++ b/interface/web/admin/list/software_repo.list.php
@@ -13,66 +13,66 @@
 
 
 // Name of the list
-$liste["name"] 				= "software_repo";
+$liste["name"]     = "software_repo";
 
 // Database table
-$liste["table"] 			= "software_repo";
+$liste["table"]    = "software_repo";
 
 // Index index field of the database table
-$liste["table_idx"]			= "software_repo_id";
+$liste["table_idx"]   = "software_repo_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "software_repo_list.php";
+$liste["file"]    = "software_repo_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "software_repo_edit.php";
+$liste["edit_file"]   = "software_repo_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "software_repo_del.php";
+$liste["delete_file"]  = "software_repo_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste["item"][] = array(	'field'		=> "repo_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "repo_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "repo_url",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "repo_url",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/users.list.php b/interface/web/admin/list/users.list.php
index 69cd880..b260c2b 100644
--- a/interface/web/admin/list/users.list.php
+++ b/interface/web/admin/list/users.list.php
@@ -13,31 +13,31 @@
 $liste['name']                  = 'users';
 
 //* Database table
-$liste['table'] 		= 'sys_user';
+$liste['table']   = 'sys_user';
 
 //* Primary index column
-$liste['table_idx']		= 'userid';
+$liste['table_idx']  = 'userid';
 
 //* Search column prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for list
-$liste['file']			= 'users_list.php';
+$liste['file']   = 'users_list.php';
 
 //* Script file to edit
-$liste['edit_file']		= 'users_edit.php';
+$liste['edit_file']  = 'users_edit.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'users_del.php';
+$liste['delete_file']  = 'users_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']			= 'no';
+$liste['auth']   = 'no';
 
 
 /*****************************************************
@@ -45,35 +45,35 @@
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "client_id",
-                            'datatype'	=> "INTEGER",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => "");
 
-$liste["item"][] = array(   'field'	=> "active",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array(   'field' => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste['item'][] = array(   'field'	=> 'username',
-                            'datatype'	=> 'VARCHAR',
-                            'op'	=> 'like',
-                            'prefix'	=> '%',
-                            'suffix'	=> '%',
-                            'width'	=> '');
+$liste['item'][] = array(   'field' => 'username',
+	'datatype' => 'VARCHAR',
+	'op' => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width' => '');
 
-$liste['item'][] = array(   'field'	=> 'groups',
-                            'datatype'	=> 'VARCHAR',
-                            'op'	=> 'like',
-                            'prefix'	=> '%',
-                            'suffix'	=> '%',
-                            'width'	=> '');
+$liste['item'][] = array(   'field' => 'groups',
+	'datatype' => 'VARCHAR',
+	'op' => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width' => '');
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/login_as.php b/interface/web/admin/login_as.php
index f7103b7..a5a34f1 100644
--- a/interface/web/admin/login_as.php
+++ b/interface/web/admin/login_as.php
@@ -28,8 +28,8 @@
 */
 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /* Check permissions for module */
 $app->auth->check_module_permissions('admin');
@@ -41,7 +41,7 @@
 
 /* get the id of the user (must be int!) */
 if (!isset($_GET['id']) && !isset($_GET['cid'])){
-    die ("No user selected!");
+	die ("No user selected!");
 }
 
 if(isset($_GET['id'])) {
@@ -61,16 +61,16 @@
  * Get the data to login as user x
  */
 $dbData = $app->db->queryOneRecord(
-    "SELECT username, passwort FROM sys_user WHERE userid = " . $userId);
+	"SELECT username, passwort FROM sys_user WHERE userid = " . $userId);
 
 /*
  * Now generate the login-Form
  * TODO: move the login_as form to a template file -> themeability
  */
- 
- $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_login_as.lng';
-include($lng_file);
- 
+
+$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_login_as.lng';
+include $lng_file;
+
 echo '
 	<br /> <br />	<br /> <br />
 	'.$wb['login_1_txt'].' ' .  $dbData['username'] . '?<br />
diff --git a/interface/web/admin/remote_action_ispcupdate.php b/interface/web/admin/remote_action_ispcupdate.php
index a72f942..e8c8b24 100644
--- a/interface/web/admin/remote_action_ispcupdate.php
+++ b/interface/web/admin/remote_action_ispcupdate.php
@@ -29,8 +29,8 @@
 
 //die('Function has been removed.');
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -45,7 +45,7 @@
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_remote_action.lng';
-include($lng_file);
+include $lng_file;
 
 /*
  * We need a list of all Servers
@@ -80,20 +80,20 @@
 	}
 	foreach ($servers as $serverId) {
 		$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-				"VALUES (".
-				(int)$serverId . ", " .
-				time() . ", " .
-				"'ispc_update', " .
-				"'', " .
-				"'pending', " .
-				"''" .
-				")";
+			"VALUES (".
+			(int)$serverId . ", " .
+			time() . ", " .
+			"'ispc_update', " .
+			"'', " .
+			"'pending', " .
+			"''" .
+			")";
 		$app->db->query($sql);
 	}
 	$msg = $wb['action_scheduled'];
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
 $app->tpl->setVar($wb);
 
@@ -101,4 +101,4 @@
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/remote_action_osupdate.php b/interface/web/admin/remote_action_osupdate.php
index b0f2878..08925b0 100644
--- a/interface/web/admin/remote_action_osupdate.php
+++ b/interface/web/admin/remote_action_osupdate.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -43,7 +43,7 @@
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_remote_action.lng';
-include($lng_file);
+include $lng_file;
 
 /*
  * We need a list of all Servers
@@ -75,20 +75,20 @@
 	}
 	foreach ($servers as $serverId) {
 		$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-				"VALUES (".
-				(int)$serverId . ", " .
-				time() . ", " .
-				"'os_update', " .
-				"'', " .
-				"'pending', " .
-				"''" .
-				")";
+			"VALUES (".
+			(int)$serverId . ", " .
+			time() . ", " .
+			"'os_update', " .
+			"'', " .
+			"'pending', " .
+			"''" .
+			")";
 		$app->db->query($sql);
 	}
 	$msg = $wb['action_scheduled'];
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
 $app->tpl->setVar($wb);
 
@@ -96,4 +96,4 @@
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/remote_user_del.php b/interface/web/admin/remote_user_del.php
index 2779105..e3a3832 100644
--- a/interface/web/admin/remote_user_del.php
+++ b/interface/web/admin/remote_user_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,14 +48,15 @@
 $app->uses('tpl,tform');
 $app->load('tform_actions');
 
-// Create a class page_action that extends the tform_actions base class 
+// Create a class page_action that extends the tform_actions base class
 
-class page_action extends tform_actions { 
+class page_action extends tform_actions {
 
 
 	// Customisations for the page actions will be defined here
-   	
+
 }
+
 $page = new page_action;
 $page->onDelete();
 
diff --git a/interface/web/admin/remote_user_edit.php b/interface/web/admin/remote_user_edit.php
index a99e983..962aa57 100644
--- a/interface/web/admin/remote_user_edit.php
+++ b/interface/web/admin/remote_user_edit.php
@@ -4,13 +4,13 @@
 $tform_def_file = 'form/remote_user.tform.php';
 
 // include the core configuration and application classes
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check the  module permissions and redirect if not allowed.
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-    header('Location: ../index.php');
-    die;
+if(!stristr($_SESSION['s']['user']['modules'], 'admin')) {
+	header('Location: ../index.php');
+	die;
 }
 
 // Disable this function in demo mode
@@ -23,15 +23,15 @@
 // Create a class page_action that extends the tform_actions base class
 class page_action extends tform_actions {
 
-    //* Customisations for the page actions will be defined here
+	//* Customisations for the page actions will be defined here
 	function onShow() {
 		global $app;
-		
+
 		// Translate the items, very bad trick... :( because the language file is not loaded yet when the form file gets parsed
 		foreach($app->tform->formDef["tabs"]['remote_user']['fields']['remote_functions']['value'] as $key => $val) {
 			$app->tform->formDef["tabs"]['remote_user']['fields']['remote_functions']['value'][$key] = $app->tform->lng($val).'<br>';
 		}
-		
+
 		parent::onShow();
 	}
 
diff --git a/interface/web/admin/remote_user_list.php b/interface/web/admin/remote_user_list.php
index 90a92b5..1830ba5 100644
--- a/interface/web/admin/remote_user_list.php
+++ b/interface/web/admin/remote_user_list.php
@@ -1,15 +1,15 @@
 <?php
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Path to the list definition file
 $list_def_file = 'list/remote_user.list.php';
 
 // Check the module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-    header('Location: ../index.php');
-    die();
+if(!stristr($_SESSION['s']['user']['modules'], 'admin')) {
+	header('Location: ../index.php');
+	die();
 }
 
 // Loading the class
diff --git a/interface/web/admin/server_config_del.php b/interface/web/admin/server_config_del.php
index 7b30ea3..c50ca14 100644
--- a/interface/web/admin/server_config_del.php
+++ b/interface/web/admin/server_config_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,4 +49,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_config_edit.php b/interface/web/admin/server_config_edit.php
index 2ebf0a1..a471181 100644
--- a/interface/web/admin/server_config_edit.php
+++ b/interface/web/admin/server_config_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,39 +49,39 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowEdit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
-		
+
 		if($app->tform->errorMessage == '') {
 			$app->uses('ini_parser,getconf');
-		
+
 			$section = $this->active_tab;
 			$server_id = $this->id;
-		
-			$this->dataRecord = $app->getconf->get_server_config($server_id,$section);
+
+			$this->dataRecord = $app->getconf->get_server_config($server_id, $section);
 		}
-		
-		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab,'EDIT');
-		
+
+		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT');
+
 		$record['id'] = $this->id;
 		$app->tpl->setVar($record);
 	}
-	
+
 	function onUpdateSave($sql) {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
 		$app->uses('ini_parser,getconf');
-		
+
 		if($conf['demo_mode'] != true) {
 			$section = $app->tform->getCurrentTab();
 			$server_id = $this->id;
-		
+
 			$server_config_array = $app->getconf->get_server_config($server_id);
-			
+
 			foreach($app->tform->formDef['tabs'][$section]['fields'] as $key => $field) {
 				if ($field['formtype'] == 'CHECKBOX') {
 					if($this->dataRecord[$key] == '') {
@@ -90,18 +90,18 @@
 					}
 				}
 			}
-		
-			$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
+
+			$server_config_array[$section] = $app->tform->encode($this->dataRecord, $section);
 			$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
-		
+
 			$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id);
 		}
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_config_list.php b/interface/web/admin/server_config_list.php
index 5fc8ddb..5a1d615 100644
--- a/interface/web/admin/server_config_list.php
+++ b/interface/web/admin/server_config_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -50,4 +50,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_del.php b/interface/web/admin/server_del.php
index d5b3b96..c39b732 100644
--- a/interface/web/admin/server_del.php
+++ b/interface/web/admin/server_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,4 +49,4 @@
 $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 e718576..c81c6ee 100644
--- a/interface/web/admin/server_edit.php
+++ b/interface/web/admin/server_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -52,8 +52,8 @@
 
 	function onShowEnd() {
 		global $app, $conf;
-		
-		// Getting Servers 
+
+		// Getting Servers
 		$sql = "SELECT server_id,server_name FROM server WHERE server_id != $this->id ORDER BY server_name";
 		$mirror_servers = $app->db->queryAllRecords($sql);
 		$mirror_server_select = '<option value="0">'.$app->tform->lng('- None -').'</option>';
@@ -63,19 +63,19 @@
 				$mirror_server_select .= "<option value='$mirror_server[server_id]' $selected>$mirror_server[server_name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("mirror_server_id",$mirror_server_select);
-		
+		$app->tpl->setVar("mirror_server_id", $mirror_server_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app;
-		
+
 		//* We do not want to mirror the the server itself
 		if($this->id == $this->dataRecord['mirror_server_id']) $this->dataRecord['mirror_server_id'] = 0;
-		
+
 		parent::onSubmit();
-		
+
 	}
 
 }
@@ -83,4 +83,4 @@
 $page = new page_action;
 $page->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 1229958..e1df934 100644
--- a/interface/web/admin/server_ip_del.php
+++ b/interface/web/admin/server_ip_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_ip_edit.php b/interface/web/admin/server_ip_edit.php
index baffa14..be48434 100644
--- a/interface/web/admin/server_ip_edit.php
+++ b/interface/web/admin/server_ip_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -65,9 +65,10 @@
 			unset($rec);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_ip_list.php b/interface/web/admin/server_ip_list.php
index 939d41f..2962242 100644
--- a/interface/web/admin/server_ip_list.php
+++ b/interface/web/admin/server_ip_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -51,4 +51,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_list.php b/interface/web/admin/server_list.php
index 985dac6..30ba123 100644
--- a/interface/web/admin/server_list.php
+++ b/interface/web/admin/server_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,4 +48,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_php_del.php b/interface/web/admin/server_php_del.php
index 9b6a6fe..d9c7baf 100644
--- a/interface/web/admin/server_php_del.php
+++ b/interface/web/admin/server_php_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_php_edit.php b/interface/web/admin/server_php_edit.php
index aeac621..e88575e 100644
--- a/interface/web/admin/server_php_edit.php
+++ b/interface/web/admin/server_php_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -65,9 +65,10 @@
 			unset($rec);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_php_list.php b/interface/web/admin/server_php_list.php
index bcd323b..7d69ab7 100644
--- a/interface/web/admin/server_php_list.php
+++ b/interface/web/admin/server_php_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -51,4 +51,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_package_del.php b/interface/web/admin/software_package_del.php
index bd43b34..ff9ab6e 100644
--- a/interface/web/admin/software_package_del.php
+++ b/interface/web/admin/software_package_del.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -37,7 +37,7 @@
 
 $software_update_inst_id = $app->functions->intval($_GET['software_update_inst_id']);
 
-if($software_update_inst_id > 0) {	
+if($software_update_inst_id > 0) {
 	$app->db->datalogDelete('software_update_inst', 'software_update_inst_id', $software_update_inst_id);
 	//header('Location: admin/software_package_list.php');
 	die('HEADER_REDIRECT: admin/software_package_list.php');
@@ -50,4 +50,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_package_edit.php b/interface/web/admin/software_package_edit.php
index 27a40f2..038f377 100644
--- a/interface/web/admin/software_package_edit.php
+++ b/interface/web/admin/software_package_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,10 +50,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_package_install.php b/interface/web/admin/software_package_install.php
index f838177..6150709 100644
--- a/interface/web/admin/software_package_install.php
+++ b/interface/web/admin/software_package_install.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,20 +49,20 @@
 
 //* verify the key
 if($package['package_installable'] == 'key' && $install_key != '') {
-	
+
 	$repo = $app->db->queryOneRecord("SELECT * FROM software_repo WHERE software_repo_id = ".$package['software_repo_id']);
-	
+
 	$client = new SoapClient(null, array('location' => $repo['repo_url'],
-                                     	 'uri'      => $repo['repo_url']));
-		
+			'uri'      => $repo['repo_url']));
+
 	$install_key_verified = $client->check_installable($package_name, $install_key, $repo['repo_username'], $repo['repo_password']);
-	
+
 	if($install_key_verified == false) {
 		//$install_key = '';
 		$message_err = 'Verification of the key failed.';
 	} else {
 		// Store the verified key into the database
-		$app->db->datalogUpdate('software_package', "package_key = '$install_key'", 'package_id',$package['package_id']);
+		$app->db->datalogUpdate('software_package', "package_key = '$install_key'", 'package_id', $package['package_id']);
 	}
 } else {
 	$message_ok = 'Please enter the software key for the package.';
@@ -73,64 +73,64 @@
 	$sql = "SELECT software_update_id, package_name, update_title FROM software_update WHERE type = 'full' AND package_name = '$package_name' ORDER BY v1 DESC, v2 DESC, v3 DESC, v4 DESC LIMIT 0,1";
 	$tmp = $app->db->queryOneRecord($sql);
 	$software_update_id = $tmp['software_update_id'];
-	
+
 	//* if package requires a DB and there is no data for a db in config, then we create this data now
 	if($package['package_requires_db'] == 'mysql') {
 		$app->uses('ini_parser,getconf');
-		
+
 		$package_config_array = array();
 		if(trim($package['package_config']) != '') {
 			$package_config_array = $app->ini_parser->parse_ini_string(stripslashes($package['package_config']));
 		}
-		
+
 		if(!isset($package_config_array['mysql'])) {
-			$package_config_array['mysql'] = array(	'database_name' => 'ispapp'.$package['package_id'],
-													'database_user' => 'ispapp'.$package['package_id'],
-													'database_password' => md5(mt_rand()),
-													'database_host' => 'localhost');
+			$package_config_array['mysql'] = array( 'database_name' => 'ispapp'.$package['package_id'],
+				'database_user' => 'ispapp'.$package['package_id'],
+				'database_password' => md5(mt_rand()),
+				'database_host' => 'localhost');
 			$package_config_str = $app->ini_parser->get_ini_string($package_config_array);
 			$package['package_config'] = $package_config_str;
-			$app->db->datalogUpdate('software_package', "package_config = '".$app->db->quote($package_config_str)."'", 'package_id',$package['package_id']);
+			$app->db->datalogUpdate('software_package', "package_config = '".$app->db->quote($package_config_str)."'", 'package_id', $package['package_id']);
 		}
 	}
-	
+
 	//* If the packages requires a remote user
 	if($package['package_remote_functions'] != '') {
-		
+
 		if(trim($package['package_config']) != '') {
 			$package_config_array = $app->ini_parser->parse_ini_string(stripslashes($package['package_config']));
 		}
-		
+
 		if(!isset($package_config_array['remote_api'])) {
 			$remote_user = 'ispapp'.$package['package_id'];
 			$remote_password = md5(mt_rand());
 			$remote_functions = $app->db->quote($package['package_remote_functions']);
-			
+
 			$package_config_array['remote_api'] = array(
-													'remote_hostname'	=> $_SERVER['HTTP_HOST'],
-													'remote_user' 		=> $remote_user,
-													'remote_password' 	=> $remote_password
-														);
+				'remote_hostname' => $_SERVER['HTTP_HOST'],
+				'remote_user'   => $remote_user,
+				'remote_password'  => $remote_password
+			);
 
 			$package_config_str = $app->ini_parser->get_ini_string($package_config_array);
 			$package['package_config'] = $package_config_str;
 			$remote_password_md5 = md5($remote_password);
-			$app->db->datalogUpdate('software_package', "package_config = '".$app->db->quote($package_config_str)."'", 'package_id',$package['package_id']);
-			
+			$app->db->datalogUpdate('software_package', "package_config = '".$app->db->quote($package_config_str)."'", 'package_id', $package['package_id']);
+
 			$sql = "INSERT INTO `remote_user` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `remote_username`, `remote_password`, `remote_functions`) VALUES
 					(1, 1, 'riud', 'riud', '', '$remote_user', '$remote_password_md5', '$remote_functions');";
-			
+
 			$app->db->query($sql);
-			
+
 		}
-	
+
 	}
-	
+
 	//* Add the record to start the install process
 	$insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$install_server_id', '$software_update_id','installing')";
 	$app->db->datalogInsert('software_update_inst', $insert_data, 'software_update_inst_id');
 	$message_ok = 'Starting package installation '."<a href=\"#\" onclick=\"submitForm('pageForm','admin/software_package_list.php');\">".$app->lng('next')."</a>";
-	
+
 }
 
 if(count($_POST) > 2 && $install_key == '') {
@@ -147,17 +147,17 @@
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/software_package_install.htm');
+$app->tpl->setInclude('content_tpl', 'templates/software_package_install.htm');
 
-$app->tpl->setVar('message_ok',$message_ok);
-$app->tpl->setVar('message_err',$message_err);
-$app->tpl->setVar('insert_key',$insert_key);
-$app->tpl->setVar('install_key',$install_key);
-$app->tpl->setVar('package_name',$package_name);
-$app->tpl->setVar('server_id',$install_server_id);
+$app->tpl->setVar('message_ok', $message_ok);
+$app->tpl->setVar('message_err', $message_err);
+$app->tpl->setVar('insert_key', $insert_key);
+$app->tpl->setVar('install_key', $install_key);
+$app->tpl->setVar('package_name', $package_name);
+$app->tpl->setVar('server_id', $install_server_id);
 
 
-include_once('lib/lang/en_software_package_install.lng');
+include_once 'lib/lang/en_software_package_install.lng';
 $app->tpl->setVar($wb);
 
 
diff --git a/interface/web/admin/software_package_list.php b/interface/web/admin/software_package_list.php
index af6887b..e05ccc9 100644
--- a/interface/web/admin/software_package_list.php
+++ b/interface/web/admin/software_package_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -43,14 +43,14 @@
 if(is_array($repos) && isset($_GET['action']) && $_GET['action'] == 'repoupdate' ) {
 	foreach($repos as $repo) {
 		$client = new SoapClient(null, array('location' => $repo['repo_url'],
-                                     		 'uri'      => $repo['repo_url']));
-		
+				'uri'      => $repo['repo_url']));
+
 		$packages = $client->get_packages($repo['repo_username'], $repo['repo_password']);
 		if(is_array($packages)) {
 			foreach($packages as $p) {
 				$package_name = $app->db->quote($p['name']);
 				$tmp = $app->db->queryOneRecord("SELECT package_id FROM software_package WHERE package_name = '$package_name'");
-				
+
 				$package_title = $app->db->quote($p['title']);
 				$package_description = $app->db->quote($p['description']);
 				$software_repo_id = $app->functions->intval($repo['software_repo_id']);
@@ -58,7 +58,7 @@
 				$package_installable = $app->db->quote($p['installable']);
 				$package_requires_db = $app->db->quote($p['requires_db']);
 				$package_remote_functions = $app->db->quote($p['remote_functions']);
-				
+
 				if(empty($tmp['package_id'])) {
 					//$sql = "INSERT INTO software_package (software_repo_id, package_name, package_title, package_description,package_type,package_installable,package_requires_db) VALUES ($software_repo_id, '$package_name', '$package_title', '$package_description','$package_type','$package_installable','$package_requires_db')";
 					//$app->db->query($sql);
@@ -70,53 +70,53 @@
 					//$app->db->query($sql);
 					$update_data = "software_repo_id = $software_repo_id, package_title = '$package_title', package_description = '$package_description', package_type = '$package_type', package_installable = '$package_installable', package_requires_db = '$package_requires_db', package_remote_functions = '$package_remote_functions'";
 					//echo $update_data;
-					$app->db->datalogUpdate('software_package', $update_data, 'package_id',$tmp['package_id']);
+					$app->db->datalogUpdate('software_package', $update_data, 'package_id', $tmp['package_id']);
 				}
 			}
 		}
-        
-        $packages = $app->db->queryAllRecords("SELECT software_package.package_name, v1, v2, v3, v4 FROM software_package LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) GROUP BY package_name ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC");
-        if(is_array($packages)) {
-            foreach($packages as $p) {
-            
-                $version = $p['v1'].'.'.$p['v2'].'.'.$p['v3'].'.'.$p['v4'];
-                $updates = $client->get_updates($p['package_name'], $version,$repo['repo_username'], $repo['repo_password']);
-                
-                if(is_array($updates)) {
-                    foreach($updates as $u) {
-                        
-                        $version_array = explode('.',$u['version']);
-                        $v1 = $app->functions->intval($version_array[0]);
-                        $v2 = $app->functions->intval($version_array[1]);
-                        $v3 = $app->functions->intval($version_array[2]);
-                        $v4 = $app->functions->intval($version_array[3]);
-                        
-                        $package_name = $app->db->quote($u['package_name']);
-                        $software_repo_id = $app->functions->intval($repo['software_repo_id']);
-                        $update_url = $app->db->quote($u['url']);
-                        $update_md5 = $app->db->quote($u['md5']);
-                        $update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):'';
-                        $update_title = $app->db->quote($u['title']);
-                        $type = $app->db->quote($u['type']);
-                        
-                        // Check that we do not have this update in the database yet
-                        $sql = "SELECT * FROM software_update WHERE package_name = '$package_name' and v1 = '$v1' and v2 = '$v2' and v3 = '$v3' and v4 = '$v4'";
-                        $tmp = $app->db->queryOneRecord($sql);
-                        if(!isset($tmp['software_update_id'])) {
-                            // Insert the update in the datbase
-                            //$sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type) 
-                            //VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')";
-                            //die($sql);
-                            //$app->db->query($sql);
-							$insert_data = "(software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type) 
+
+		$packages = $app->db->queryAllRecords("SELECT software_package.package_name, v1, v2, v3, v4 FROM software_package LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) GROUP BY package_name ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC");
+		if(is_array($packages)) {
+			foreach($packages as $p) {
+
+				$version = $p['v1'].'.'.$p['v2'].'.'.$p['v3'].'.'.$p['v4'];
+				$updates = $client->get_updates($p['package_name'], $version, $repo['repo_username'], $repo['repo_password']);
+
+				if(is_array($updates)) {
+					foreach($updates as $u) {
+
+						$version_array = explode('.', $u['version']);
+						$v1 = $app->functions->intval($version_array[0]);
+						$v2 = $app->functions->intval($version_array[1]);
+						$v3 = $app->functions->intval($version_array[2]);
+						$v4 = $app->functions->intval($version_array[3]);
+
+						$package_name = $app->db->quote($u['package_name']);
+						$software_repo_id = $app->functions->intval($repo['software_repo_id']);
+						$update_url = $app->db->quote($u['url']);
+						$update_md5 = $app->db->quote($u['md5']);
+						$update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):'';
+						$update_title = $app->db->quote($u['title']);
+						$type = $app->db->quote($u['type']);
+
+						// Check that we do not have this update in the database yet
+						$sql = "SELECT * FROM software_update WHERE package_name = '$package_name' and v1 = '$v1' and v2 = '$v2' and v3 = '$v3' and v4 = '$v4'";
+						$tmp = $app->db->queryOneRecord($sql);
+						if(!isset($tmp['software_update_id'])) {
+							// Insert the update in the datbase
+							//$sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type)
+							//VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')";
+							//die($sql);
+							//$app->db->query($sql);
+							$insert_data = "(software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type)
                             VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')";
 							$app->db->datalogInsert('software_update', $insert_data, 'software_update_id');
-                        }
-                        
-                    }
-                }
-            }
-        }
+						}
+
+					}
+				}
+			}
+		}
 	}
 }
 
@@ -128,7 +128,7 @@
 	$sql = "SELECT software_update_id, package_name, update_title FROM software_update WHERE type = 'full' AND package_name = '$package_name' ORDER BY v1 DESC, v2 DESC, v3 DESC, v4 DESC LIMIT 0,1";
 	$tmp = $app->db->queryOneRecord($sql);
 	$software_update_id = $tmp['software_update_id'];
-	
+
 	$insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installing')";
 	// $insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installed')";
 	$app->db->datalogInsert('software_update_inst', $insert_data, 'software_update_inst_id');
@@ -141,7 +141,7 @@
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/software_package_list.htm');
+$app->tpl->setInclude('content_tpl', 'templates/software_package_list.htm');
 
 
 $servers = $app->db->queryAllRecords('SELECT server_id, server_name FROM server ORDER BY server_name');
@@ -152,13 +152,13 @@
 		foreach($servers as $s) {
 			$inst = $app->db->queryOneRecord("SELECT * FROM software_update, software_update_inst WHERE software_update_inst.software_update_id = software_update.software_update_id AND software_update_inst.package_name = '".addslashes($p["package_name"])."' AND server_id = '".$s["server_id"]."'");
 			$version = $inst['v1'].'.'.$inst['v2'].'.'.$inst['v3'].'.'.$inst['v4'];
-			
+
 			if($inst['status'] == 'installed') {
 				$installed_txt .= $s['server_name'].": ".$app->lng("Installed version $version")."<br />";
-            } elseif ($inst['status'] == 'installing') {
-                $installed_txt .= $s['server_name'].": ".$app->lng("Installation in progress")."<br />";
-            } elseif ($inst['status'] == 'failed') {
-                $installed_txt .= $s['server_name'].": ".$app->lng("Installation failed")."<br />";
+			} elseif ($inst['status'] == 'installing') {
+				$installed_txt .= $s['server_name'].": ".$app->lng("Installation in progress")."<br />";
+			} elseif ($inst['status'] == 'failed') {
+				$installed_txt .= $s['server_name'].": ".$app->lng("Installation failed")."<br />";
 			} elseif ($inst['status'] == 'deleting') {
 				$installed_txt .= $s['server_name'].": ".$app->lng("Deletion in progress")."<br />";
 			} else {
@@ -172,17 +172,17 @@
 		$packages[$key]['software_update_inst_id'] = intval($inst['software_update_inst_id']);
 		$packages[$key]['installed'] = $installed_txt;
 	}
-	$app->tpl->setVar('has_packages',1);
+	$app->tpl->setVar('has_packages', 1);
 } else {
-	$app->tpl->setVar('has_packages',0);
+	$app->tpl->setVar('has_packages', 0);
 }
 
 
 
-$app->tpl->setLoop('records',$packages);
+$app->tpl->setLoop('records', $packages);
 
 $language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language'];
-include_once('lib/lang/'.$language.'_software_package_list.lng');
+include_once 'lib/lang/'.$language.'_software_package_list.lng';
 $app->tpl->setVar($wb);
 
 
@@ -190,4 +190,4 @@
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_repo_del.php b/interface/web/admin/software_repo_del.php
index a6522fa..b8effc1 100644
--- a/interface/web/admin/software_repo_del.php
+++ b/interface/web/admin/software_repo_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,4 +49,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_repo_edit.php b/interface/web/admin/software_repo_edit.php
index 17902f1..2a6a4f4 100644
--- a/interface/web/admin/software_repo_edit.php
+++ b/interface/web/admin/software_repo_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,10 +50,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_repo_list.php b/interface/web/admin/software_repo_list.php
index 0c05490..b8afc8f 100644
--- a/interface/web/admin/software_repo_list.php
+++ b/interface/web/admin/software_repo_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_update_list.php b/interface/web/admin/software_update_list.php
index 682a644..9a1df8a 100644
--- a/interface/web/admin/software_update_list.php
+++ b/interface/web/admin/software_update_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -42,7 +42,7 @@
 $repos = $app->db->queryAllRecords("SELECT software_repo_id, repo_url, repo_username, repo_password FROM software_repo WHERE active = 'y'");
 if(is_array($repos)) {
 	foreach($repos as $repo) {
-	
+
 		/*
 		SELECT software_package.package_name, v1, v2, v3, v4
 		FROM software_package
@@ -51,26 +51,26 @@
 		GROUP BY package_name
 		ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC
 		*/
-		
+
 		$client = new SoapClient(null, array('location' => $repo['repo_url'],
-                                     		 'uri'      => $repo['repo_url']));
-		
+				'uri'      => $repo['repo_url']));
+
 		$packages = $app->db->queryAllRecords("SELECT software_package.package_name, v1, v2, v3, v4 FROM software_package LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) GROUP BY package_name ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC");
 		if(is_array($packages)) {
 			foreach($packages as $p) {
-			
+
 				$version = $p['v1'].'.'.$p['v2'].'.'.$p['v3'].'.'.$p['v4'];
-				$updates = $client->get_updates($p['package_name'], $version,$repo['repo_username'], $repo['repo_password']);
-				
+				$updates = $client->get_updates($p['package_name'], $version, $repo['repo_username'], $repo['repo_password']);
+
 				if(is_array($updates)) {
 					foreach($updates as $u) {
-						
-						$version_array = explode('.',$u['version']);
+
+						$version_array = explode('.', $u['version']);
 						$v1 = $app->functions->intval($version_array[0]);
 						$v2 = $app->functions->intval($version_array[1]);
 						$v3 = $app->functions->intval($version_array[2]);
 						$v4 = $app->functions->intval($version_array[3]);
-						
+
 						$package_name = $app->db->quote($u['package_name']);
 						$software_repo_id = $app->functions->intval($repo['software_repo_id']);
 						$update_url = $app->db->quote($u['url']);
@@ -78,18 +78,18 @@
 						$update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):'';
 						$update_title = $app->db->quote($u['title']);
 						$type = $app->db->quote($u['type']);
-						
+
 						// Check that we do not have this update in the database yet
 						$sql = "SELECT * FROM software_update WHERE package_name = '$package_name' and v1 = '$v1' and v2 = '$v2' and v3 = '$v3' and v4 = '$v4'";
 						$tmp = $app->db->queryOneRecord($sql);
 						if(!isset($tmp['software_update_id'])) {
 							// Insert the update in the datbase
-							$sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type) 
+							$sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type)
 							VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')";
 							//die($sql);
 							$app->db->query($sql);
 						}
-						
+
 					}
 				}
 			}
@@ -103,11 +103,11 @@
 	$package_name = $app->db->quote($_GET['package']);
 	$server_id = $app->functions->intval($_GET['server_id']);
 	$software_update_id = $app->functions->intval($_GET['id']);
-	
+
 	$insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installing')";
 	// $insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installed')";
 	$app->db->datalogInsert('software_update_inst', $insert_data, 'software_update_inst_id');
-	
+
 }
 
 
@@ -116,7 +116,7 @@
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/software_update_list.htm');
+$app->tpl->setInclude('content_tpl', 'templates/software_update_list.htm');
 
 /*
 SELECT software_package.package_name, software_package.package_title, software_update.update_title, v1, v2, v3, v4, software_update_inst.status
@@ -144,7 +144,7 @@
 	}
 }
 
-$app->tpl->setLoop('servers',$servers);
+$app->tpl->setLoop('servers', $servers);
 
 $sql = "SELECT v1, v2, v3, v4, software_update.update_title, software_update.software_update_id, software_update.package_name, v1, v2, v3, v4, software_update_inst.status
 		FROM software_update LEFT JOIN software_update_inst ON ( software_update.software_update_id = software_update_inst.software_update_id )
@@ -159,25 +159,25 @@
 
 if(is_array($installed_packages)) {
 	foreach($installed_packages as $ip) {
-		
+
 		// Get version number of the latest installed version
 		$sql = "SELECT v1, v2, v3, v4 FROM software_update, software_update_inst WHERE software_update.software_update_id = software_update_inst.software_update_id AND server_id = ".$server_id." ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC LIMIT 0,1";
 		$lu = $app->db->queryOneRecord($sql);
-		
+
 		// Get all installable updates
 		$sql = "SELECT * FROM software_update WHERE v1 >= $lu[v1] AND v2 >= $lu[v2] AND v3 >= $lu[v3] AND v4 >= $lu[v4] AND package_name = '$ip[package_name]' ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC";
 		$updates = $app->db->queryAllRecords($sql);
 		//die($sql);
-		
+
 		if(is_array($updates)) {
 			// Delete the last record as it is already installed
 			unset($updates[count($updates)-1]);
-			
+
 			foreach($updates as $key => $u) {
 				$version = $u['v1'].'.'.$u['v2'].'.'.$u['v3'].'.'.$u['v4'];
 				$installed_txt = "<a href=\"#\" onclick=\"loadContent('admin/software_update_list.php?action=install&package=".$u["package_name"]."&id=".$u["software_update_id"]."&server_id=".$server_id."');\">Install Update</a><br />";
 				$records_out[] = array('version' => $version, 'update_title' => $u["update_title"], 'installed' => $installed_txt);
-		
+
 			}
 		}
 	}
@@ -193,7 +193,7 @@
 if(is_array($updates)) {
 	foreach($updates as $key => $u) {
 		$installed_txt = '';
-		
+
 		$version = $u['v1'].'.'.$u['v2'].'.'.$u['v3'].'.'.$u['v4'];
 		$updates[$key]['version'] = $version;
 		if($u['status'] == 'installed' || $u['status'] == 'installing' || $u['status'] == 'deleting') {
@@ -202,17 +202,17 @@
 			$installed_txt .= "<a href=\"#\" onclick=\"loadContent('admin/software_update_list.php?action=install&package=".$u["package_name"]."&id=".$u["software_update_id"]."&server_id=".$server_id."');\">Install now</a><br />";
 		}
 		$updates[$key]['installed'] = $installed_txt;
-		
+
 	}
 }
 */
 
 
 
-$app->tpl->setLoop('records',$records_out);
+$app->tpl->setLoop('records', $records_out);
 
 $language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language'];
-include_once('lib/lang/'.$language.'_software_update_list.lng');
+include_once 'lib/lang/'.$language.'_software_update_list.lng';
 $app->tpl->setVar($wb);
 
 
@@ -220,4 +220,4 @@
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/system_config_edit.php b/interface/web/admin/system_config_edit.php
index c2702c7..d267c8e 100644
--- a/interface/web/admin/system_config_edit.php
+++ b/interface/web/admin/system_config_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -54,15 +54,15 @@
 
 	function onShowEdit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
-		
+
 		if($app->tform->errorMessage == '') {
 			$app->uses('ini_parser,getconf');
-			
+
 			$section = $this->active_tab;
 			$server_id = $this->id;
-		
+
 			$this->dataRecord = $app->getconf->get_global_config($section);
 			if ($section == 'domains'){
 				if (isset($this->dataRecord['use_domain_module'])){
@@ -70,61 +70,61 @@
 				}
 			}
 		}
-		
-		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab,'EDIT');
-		
+
+		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT');
+
 		$record['warning'] = $app->tform->lng('warning');
 		$record['id'] = $this->id;
 		$app->tpl->setVar($record);
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		// available dashlets
 		$available_dashlets_txt = '';
-		$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets'); 
-		while ($file = @readdir ($handle)) { 
+		$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets');
+		while ($file = @readdir($handle)) {
 			if ($file != '.' && $file != '..' && !is_dir($file)) {
-				$available_dashlets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.substr($file,0,-4).']<pre class="addPlaceholderContent" style="display:none;">['.substr($file,0,-4).'],</pre></a> ';
+				$available_dashlets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.substr($file, 0, -4).']<pre class="addPlaceholderContent" style="display:none;">['.substr($file, 0, -4).'],</pre></a> ';
 			}
 		}
-		
+
 		if($available_dashlets_txt == '') $available_dashlets_txt = '------';
-		$app->tpl->setVar("available_dashlets_txt",$available_dashlets_txt);
-		
+		$app->tpl->setVar("available_dashlets_txt", $available_dashlets_txt);
+
 		parent::onShowEnd();
 	}
-	
-    function onSubmit() {
-        global $app;
-        
-        $app->uses('ini_parser,getconf');
-		
-        $section = $app->tform->getCurrentTab();
-		
+
+	function onSubmit() {
+		global $app;
+
+		$app->uses('ini_parser,getconf');
+
+		$section = $app->tform->getCurrentTab();
+
 		$server_config_array = $app->getconf->get_global_config();
-		$new_config = $app->tform->encode($this->dataRecord,$section);
-        if($section == 'mail') {
-            if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
-            if($new_config['smtp_enabled'] == 'y' && ($new_config['admin_mail'] == '' || $new_config['admin_name'] == '')) {
-                $app->tform->errorMessage .= $app->tform->lng("smtp_missing_admin_mail_txt");
-            }
-        }
-        
-        parent::onSubmit();
-    }
-    
+		$new_config = $app->tform->encode($this->dataRecord, $section);
+		if($section == 'mail') {
+			if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
+			if($new_config['smtp_enabled'] == 'y' && ($new_config['admin_mail'] == '' || $new_config['admin_name'] == '')) {
+				$app->tform->errorMessage .= $app->tform->lng("smtp_missing_admin_mail_txt");
+			}
+		}
+
+		parent::onSubmit();
+	}
+
 	function onUpdateSave($sql) {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
 		$app->uses('ini_parser,getconf');
-		
+
 		$section = $app->tform->getCurrentTab();
-		
+
 		$server_config_array = $app->getconf->get_global_config();
-		
+
 		foreach($app->tform->formDef['tabs'][$section]['fields'] as $key => $field) {
 			if ($field['formtype'] == 'CHECKBOX') {
 				if($this->dataRecord[$key] == '') {
@@ -133,26 +133,26 @@
 				}
 			}
 		}
-		
+
 		/*
 		if((isset($this->dataRecord['use_loadindicator']) && $this->dataRecord['use_loadindicator'] != $server_config_array[$section]['use_loadindicator']) || (isset($this->dataRecord['use_combobox']) && $this->dataRecord['use_combobox'] != $server_config_array[$section]['use_combobox'])){
 			$this->_js_changed = true;
 		}
 		*/
 
-		$new_config = $app->tform->encode($this->dataRecord,$section);
-        if($section == 'sites' && $new_config['vhost_subdomains'] != 'y' && $server_config_array['vhost_subdomains'] == 'y') {
-            // check for existing vhost subdomains, if found the mode cannot be disabled
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain'");
-            if($check['cnt'] > 0) {
-                $new_config['vhost_subdomains'] = 'y';
-            }
-        } elseif($section == 'mail') {
-            if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
-        }
-        $server_config_array[$section] = $new_config;
+		$new_config = $app->tform->encode($this->dataRecord, $section);
+		if($section == 'sites' && $new_config['vhost_subdomains'] != 'y' && $server_config_array['vhost_subdomains'] == 'y') {
+			// check for existing vhost subdomains, if found the mode cannot be disabled
+			$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain'");
+			if($check['cnt'] > 0) {
+				$new_config['vhost_subdomains'] = 'y';
+			}
+		} elseif($section == 'mail') {
+			if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
+		}
+		$server_config_array[$section] = $new_config;
 		$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
-		
+
 		//$sql = "UPDATE sys_ini SET config = '".$app->db->quote($server_config_str)."' WHERE sysini_id = 1";
 		//if($conf['demo_mode'] != true) $app->db->query($sql);
 		if($conf['demo_mode'] != true) $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($server_config_str)."'", 'sysini_id', 1);
@@ -161,9 +161,9 @@
 		 * If we should use the domain-module, we have to insert all existing domains into the table
 		 * (only the first time!)
 		 */
-		if (($section == 'domains') && 
-				($_SESSION['use_domain_module_old_value'] == '') &&
-				($server_config_array['domains']['use_domain_module'] == 'y')){
+		if (($section == 'domains') &&
+			($_SESSION['use_domain_module_old_value'] == '') &&
+			($server_config_array['domains']['use_domain_module'] == 'y')){
 			$sql = "REPLACE INTO domain (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain ) " .
 				"SELECT sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain " .
 				"FROM mail_domain";
@@ -173,7 +173,7 @@
 				"FROM web_domain WHERE type NOT IN ('subdomain','vhostsubdomain')";
 			$app->db->query($sql);
 		}
-		
+
 		// Maintenance mode
 		if($server_config_array['misc']['maintenance_mode'] == 'y'){
 			//print_r($_SESSION);
@@ -181,7 +181,7 @@
 			$app->db->query("DELETE FROM sys_session WHERE session_id != '".$_SESSION['s']['id']."'");
 		}
 	}
-	
+
 	/*
 	function onAfterUpdate() {
         if($this->_js_changed == true) {
@@ -192,11 +192,11 @@
         }
     }
 	*/
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/tpl_default.php b/interface/web/admin/tpl_default.php
index 80de37b..b9477f1 100644
--- a/interface/web/admin/tpl_default.php
+++ b/interface/web/admin/tpl_default.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,24 +50,24 @@
 
 class page_action extends tform_actions {
 
-//	function onBeforeUpdate() {
-//		global $app, $conf;
-//
-//		//* Check if the server has been changed
-//		// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
-//		if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["server_id"])) {
-//			$rec = $app->db->queryOneRecord("SELECT server_id from server_php WHERE server_php_id = ".$this->id);
-//			if($rec['server_id'] != $this->dataRecord["server_id"]) {
-//				//* Add a error message and switch back to old server
-//				$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
-//				$this->dataRecord["server_id"] = $rec['server_id'];
-//			}
-//			unset($rec);
-//		}
-//	}
+	// function onBeforeUpdate() {
+	//  global $app, $conf;
+	//
+	//  //* Check if the server has been changed
+	//  // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
+	//  if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["server_id"])) {
+	//   $rec = $app->db->queryOneRecord("SELECT server_id from server_php WHERE server_php_id = ".$this->id);
+	//   if($rec['server_id'] != $this->dataRecord["server_id"]) {
+	//    //* Add a error message and switch back to old server
+	//    $app->tform->errorMessage .= $app->lng('The Server can not be changed.');
+	//    $this->dataRecord["server_id"] = $rec['server_id'];
+	//   }
+	//   unset($rec);
+	//  }
+	// }
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/users_del.php b/interface/web/admin/users_del.php
index dfea889..299eed2 100644
--- a/interface/web/admin/users_del.php
+++ b/interface/web/admin/users_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,4 +49,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/users_edit.php b/interface/web/admin/users_edit.php
index 487be72..d94ef61 100644
--- a/interface/web/admin/users_edit.php
+++ b/interface/web/admin/users_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,33 +49,33 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onBeforeInsert() {
 		global $app, $conf;
-		
-		if(!in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
+
+		if(!in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
 			$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
 		}
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf;
-		
+
 		if($conf['demo_mode'] == true && $_REQUEST['id'] <= 3) $app->error('This function is disabled in demo mode.');
-		
-		if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
+
+		if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
 			$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
 		}
 		$this->oldDataRecord = $app->tform->getDataRecord($this->id);
 	}
-	
+
 	/*
 	 This function is called automatically right after
 	 the data was successful updated in the database.
 	*/
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		$client = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = ".$this->id);
 		$client_id = $client['client_id'];
 		$username = $app->db->quote($this->dataRecord["username"]);
@@ -89,28 +89,28 @@
 			$app->db->datalogUpdate("sys_group", "name = '$username'", 'groupid', $tmp['groupid']);
 			unset($tmp);
 		}
-		
+
 		// password changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["passwort"]) && $this->dataRecord["passwort"] != '') {
 			$password = $app->db->quote($this->dataRecord["passwort"]);
 			$salt="$1$";
 			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 			for ($n=0;$n<8;$n++) {
-				$salt.=$base64_alphabet[mt_rand(0,63)];
+				$salt.=$base64_alphabet[mt_rand(0, 63)];
 			}
 			$salt.="$";
-			$password = crypt(stripslashes($password),$salt);
+			$password = crypt(stripslashes($password), $salt);
 			$sql = "UPDATE client SET password = '$password' WHERE client_id = $client_id AND username = '$username'";
 			$app->db->query($sql);
 		}
-		
+
 		// language changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
 			$language = $app->db->quote($this->dataRecord["language"]);
 			$sql = "UPDATE client SET language = '$language' WHERE client_id = $client_id AND username = '$username'";
 			$app->db->query($sql);
 		}
-		
+
 		// reseller status changed
 		/*
 		if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != $this->oldDataRecord["limit_client"]) {
@@ -130,4 +130,4 @@
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/users_list.php b/interface/web/admin/users_list.php
index 412d4fa..1f83258 100644
--- a/interface/web/admin/users_list.php
+++ b/interface/web/admin/users_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/capp.php b/interface/web/capp.php
index 7917aa0..2c14318 100644
--- a/interface/web/capp.php
+++ b/interface/web/capp.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../lib/config.inc.php');
-require_once('../lib/app.inc.php');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
 //* Import module variable
 $mod = $_REQUEST["mod"];
@@ -45,28 +45,28 @@
 if(!preg_match("/^[a-z]{2,20}$/i", $mod)) die('module name contains unallowed chars.');
 
 //* Check if user may use the module.
-$user_modules = explode(",",$_SESSION["s"]["user"]["modules"]);
+$user_modules = explode(",", $_SESSION["s"]["user"]["modules"]);
 
-if(!in_array($mod,$user_modules)) $app->error($app->lng(301));
+if(!in_array($mod, $user_modules)) $app->error($app->lng(301));
 
 //* Load module configuration into the session.
 if(is_file($mod."/lib/module.conf.php")) {
-	include_once($mod."/lib/module.conf.php");
-	
-    $menu_dir = ISPC_WEB_PATH.'/' . $mod . '/lib/menu.d';
+	include_once $mod."/lib/module.conf.php";
 
-    if (is_dir($menu_dir)) {
-        if ($dh = opendir($menu_dir)) {
-            //** Go through all files in the menu dir
-            while (($file = readdir($dh)) !== false) {
-                if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
-                    include_once($menu_dir . '/' . $file);
-                }
-            }
-        }
-    }
-    
-    $_SESSION["s"]["module"] = $module;
+	$menu_dir = ISPC_WEB_PATH.'/' . $mod . '/lib/menu.d';
+
+	if (is_dir($menu_dir)) {
+		if ($dh = opendir($menu_dir)) {
+			//** Go through all files in the menu dir
+			while (($file = readdir($dh)) !== false) {
+				if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
+					include_once $menu_dir . '/' . $file;
+				}
+			}
+		}
+	}
+
+	$_SESSION["s"]["module"] = $module;
 	session_write_close();
 	if($redirect == ''){
 		echo "HEADER_REDIRECT:".$_SESSION["s"]["module"]["startpage"];
@@ -77,4 +77,4 @@
 } else {
 	$app->error($app->lng(302));
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/client_circle_del.php b/interface/web/client/client_circle_del.php
index 5764eb5..702d547 100644
--- a/interface/web/client/client_circle_del.php
+++ b/interface/web/client/client_circle_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
diff --git a/interface/web/client/client_circle_edit.php b/interface/web/client/client_circle_edit.php
index 407efba..679b802 100644
--- a/interface/web/client/client_circle_edit.php
+++ b/interface/web/client/client_circle_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
diff --git a/interface/web/client/client_circle_list.php b/interface/web/client/client_circle_list.php
index f37da38..94c6d16 100644
--- a/interface/web/client/client_circle_list.php
+++ b/interface/web/client/client_circle_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/client_del.php b/interface/web/client/client_del.php
index ecee8f5..a8cd7cc 100644
--- a/interface/web/client/client_del.php
+++ b/interface/web/client/client_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -50,90 +50,90 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onDelete() {
-		global $app, $conf,$list_def_file,$tform_def_file;
-		
+		global $app, $conf, $list_def_file, $tform_def_file;
+
 		// Loading tform framework
-        if(!is_object($app->tform)) $app->uses('tform');
-		
+		if(!is_object($app->tform)) $app->uses('tform');
+
 		if($_POST["confirm"] == 'yes') {
 			parent::onDelete();
 		} else {
-		
-		$app->uses('tpl');
-		$app->tpl->newTemplate("form.tpl.htm");
-		$app->tpl->setInclude('content_tpl', 'templates/client_del.htm');
-		
-		include_once($list_def_file);
-		
-		// Load table definition from file
-        $app->tform->loadFormDef($tform_def_file);
-		
-		$this->id = $app->functions->intval($_REQUEST["id"]);
-		
-		$this->dataRecord = $app->tform->getDataRecord($this->id);
-		$client_id = $app->functions->intval($this->dataRecord['client_id']);
 
-        
-		//$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
-		//$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
-		$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-		
-		// Get all records (sub-clients, mail, web, etc....)  of this client.
-		$tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain';
-		$tables_array = explode(',',$tables);
-		$client_group_id = $app->functions->intval($client_group['groupid']);
-		
-		$table_list = array();
-		if($client_group_id > 1) {
-			foreach($tables_array as $table) {
-				if($table != '') {
-					$records = $app->db->queryAllRecords("SELECT * FROM $table WHERE sys_groupid = ".$client_group_id);
-					$number = count($records);
-					if($number > 0) $table_list[] = array('table' => $table."(".$number.")");
+			$app->uses('tpl');
+			$app->tpl->newTemplate("form.tpl.htm");
+			$app->tpl->setInclude('content_tpl', 'templates/client_del.htm');
+
+			include_once $list_def_file;
+
+			// Load table definition from file
+			$app->tform->loadFormDef($tform_def_file);
+
+			$this->id = $app->functions->intval($_REQUEST["id"]);
+
+			$this->dataRecord = $app->tform->getDataRecord($this->id);
+			$client_id = $app->functions->intval($this->dataRecord['client_id']);
+
+
+			//$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
+			//$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
+			$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
+
+			// Get all records (sub-clients, mail, web, etc....)  of this client.
+			$tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain';
+			$tables_array = explode(',', $tables);
+			$client_group_id = $app->functions->intval($client_group['groupid']);
+
+			$table_list = array();
+			if($client_group_id > 1) {
+				foreach($tables_array as $table) {
+					if($table != '') {
+						$records = $app->db->queryAllRecords("SELECT * FROM $table WHERE sys_groupid = ".$client_group_id);
+						$number = count($records);
+						if($number > 0) $table_list[] = array('table' => $table."(".$number.")");
+					}
 				}
 			}
-		}
-		
-		$app->tpl->setVar('id',$this->id);
-		$app->tpl->setVar('number_records',$number);
-		$app->tpl->setLoop('records', $table_list);
-		
-		//* load language file 
-		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_client_del.lng';
-		include($lng_file);
-		$app->tpl->setVar($wb);
-		
-		$app->tpl_defaults();
-		$app->tpl->pparse();
+
+			$app->tpl->setVar('id', $this->id);
+			$app->tpl->setVar('number_records', $number);
+			$app->tpl->setLoop('records', $table_list);
+
+			//* load language file
+			$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_client_del.lng';
+			include $lng_file;
+			$app->tpl->setVar($wb);
+
+			$app->tpl_defaults();
+			$app->tpl->pparse();
 		}
 	}
-	
-	
-	
-	
+
+
+
+
 	function onBeforeDelete() {
 		global $app, $conf;
-		
+
 		$client_id = $app->functions->intval($this->dataRecord['client_id']);
-		
-		if($client_id > 0) {			
+
+		if($client_id > 0) {
 			// remove the group of the client from the resellers group
 			$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
 			$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
 			$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-			$app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']);
-			
+			$app->auth->remove_group_from_user($parent_user['userid'], $client_group['groupid']);
+
 			// delete the group of the client
 			$app->db->query("DELETE FROM sys_group WHERE client_id = $client_id");
-			
+
 			// delete the sys user(s) of the client
 			$app->db->query("DELETE FROM sys_user WHERE client_id = $client_id");
-			
+
 			// Delete all records (sub-clients, mail, web, etc....)  of this client.
 			$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_folder,web_folder_user,domain';
-			$tables_array = explode(',',$tables);
+			$tables_array = explode(',', $tables);
 			$client_group_id = $app->functions->intval($client_group['groupid']);
 			if($client_group_id > 1) {
 				foreach($tables_array as $table) {
@@ -161,16 +161,17 @@
 								}
 							}
 						}
-						
+
 					}
 				}
 			}
-			
-			
-			
+
+
+
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index ab33d9e..3fa7837 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -49,18 +49,18 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-    var $_template_additional = array();
-    
+	var $_template_additional = array();
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_client FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another website.
 			if($client["limit_client"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE sys_groupid = $client_group_id");
@@ -69,21 +69,21 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
-	
+
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user' && $this->id == 0) {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_client FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another website.
 			if($client["limit_client"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE sys_groupid = $client_group_id");
@@ -92,28 +92,28 @@
 				}
 			}
 		}
-        
-        if($this->id != 0) {
-            $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id);
-            if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
-                // check previous type of storing templates
-                $tpls = explode('/', $this->oldDataRecord['template_additional']);
-                $this->oldTemplatesAssigned = array();
-                foreach($tpls as $item) {
-                    $item = trim($item);
-                    if(!$item) continue;
-                    $this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $this->id);
-                }
-                unset($tpls);
-            }
-        } else {
-            $this->oldTemplatesAssigned = array();
-        }
-        
-        $this->_template_additional = explode('/', $this->dataRecord['template_additional']);
-        $this->dataRecord['template_additional'] = '';
-        
-        parent::onSubmit();
+
+		if($this->id != 0) {
+			$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id);
+			if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
+				// check previous type of storing templates
+				$tpls = explode('/', $this->oldDataRecord['template_additional']);
+				$this->oldTemplatesAssigned = array();
+				foreach($tpls as $item) {
+					$item = trim($item);
+					if(!$item) continue;
+					$this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $this->id);
+				}
+				unset($tpls);
+			}
+		} else {
+			$this->oldTemplatesAssigned = array();
+		}
+
+		$this->_template_additional = explode('/', $this->dataRecord['template_additional']);
+		$this->dataRecord['template_additional'] = '';
+
+		parent::onSubmit();
 	}
 
 	function onShowEnd() {
@@ -128,54 +128,54 @@
 			$option .= '<option value="' . $item['template_id'] . '|' .  $item['template_name'] . '">' . $item['template_name'] . '</option>';
 			$tpl[$item['template_id']] = $item['template_name'];
 		}
-		$app->tpl->setVar('tpl_add_select',$option);
+		$app->tpl->setVar('tpl_add_select', $option);
 
-        // check for new-style records
-        $result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
-        if($result && count($result) > 0) {
-            // new style
-            $items = array();
-            $text = '';
-            foreach($result as $item){
-                if (trim($item['client_template_id']) != ''){
-                    if ($text != '') $text .= '';
-                    $text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']];
-                    $text .= '<a href="#" class="button icons16 icoDelete"></a>';
-                                        $tmp = new stdClass();
-                    $tmp->id = $item['assigned_template_id'];
-                    $tmp->data = '';
-                    $app->plugin->raiseEvent('get_client_template_details', $tmp);
-                    if($tmp->data != '') $text .= '<br /><em>' . $tmp->data . '</em>';
+		// check for new-style records
+		$result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
+		if($result && count($result) > 0) {
+			// new style
+			$items = array();
+			$text = '';
+			foreach($result as $item){
+				if (trim($item['client_template_id']) != ''){
+					if ($text != '') $text .= '';
+					$text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']];
+					$text .= '<a href="#" class="button icons16 icoDelete"></a>';
+					$tmp = new stdClass();
+					$tmp->id = $item['assigned_template_id'];
+					$tmp->data = '';
+					$app->plugin->raiseEvent('get_client_template_details', $tmp);
+					if($tmp->data != '') $text .= '<br /><em>' . $tmp->data . '</em>';
 
-                    $text .= '</li>';
-                    $items[] = $item['assigned_template_id'] . ':' . $item['client_template_id'];
-                }
-            }
+					$text .= '</li>';
+					$items[] = $item['assigned_template_id'] . ':' . $item['client_template_id'];
+				}
+			}
 
-            $tmprec = $app->tform->getHTML(array('template_additional' => implode('/', $items)), $this->active_tab, 'EDIT');
-            $app->tpl->setVar('template_additional', $tmprec['template_additional']);
-            unset($tmprec);
-        } else {
-            // old style
-            $sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
-            $result = $app->db->queryOneRecord($sql);
-            $tplAdd = explode("/", $result['template_additional']);
-            $text = '';
-            foreach($tplAdd as $item){
-                if (trim($item) != ''){
-                    if ($text != '') $text .= '';
-                    $text .= '<li>' . $tpl[$item]. '<a href="#" class="button icons16 icoDelete"></a></li>';
-                }
-            }
-        }
+			$tmprec = $app->tform->getHTML(array('template_additional' => implode('/', $items)), $this->active_tab, 'EDIT');
+			$app->tpl->setVar('template_additional', $tmprec['template_additional']);
+			unset($tmprec);
+		} else {
+			// old style
+			$sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
+			$result = $app->db->queryOneRecord($sql);
+			$tplAdd = explode("/", $result['template_additional']);
+			$text = '';
+			foreach($tplAdd as $item){
+				if (trim($item) != ''){
+					if ($text != '') $text .= '';
+					$text .= '<li>' . $tpl[$item]. '<a href="#" class="button icons16 icoDelete"></a></li>';
+				}
+			}
+		}
 
 		$app->tpl->setVar('template_additional_list', $text);
-		$app->tpl->setVar('app_module','client');
+		$app->tpl->setVar('app_module', 'client');
 
 		parent::onShowEnd();
 
 	}
-    
+
 	/*
 	 This function is called automatically right after
 	 the data was successful inserted in the database.
@@ -185,36 +185,36 @@
 		// Create the group for the client
 		$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('".$app->db->quote($this->dataRecord["username"])."','',".$this->id.")", 'groupid');
 		$groups = $groupid;
-		
+
 		$username = $app->db->quote($this->dataRecord["username"]);
 		$password = $app->db->quote($this->dataRecord["password"]);
 		$modules = $conf['interface_modules_enabled'];
 		if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] > 0) $modules .= ',client';
-		$startmodule = (stristr($modules,'dashboard'))?'dashboard':'client';
+		$startmodule = (stristr($modules, 'dashboard'))?'dashboard':'client';
 		$usertheme = $app->db->quote($this->dataRecord["usertheme"]);
 		$type = 'user';
 		$active = 1;
 		$language = $app->db->quote($this->dataRecord["language"]);
 		$password = $app->auth->crypt_password($password);
-		
+
 		// Create the controlpaneluser for the client
 		//Generate ssh-rsa-keys
 		exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
 		$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa.pub'))."' WHERE client_id = ".$this->id);
 		exec('rm -f /tmp/id_rsa /tmp/id_rsa.pub');
-		
+
 		// Create the controlpaneluser for the client
 		$sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
 		VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")";
 		$app->db->query($sql);
-		
-		//* If the user who inserted the client is a reseller (not admin), we will have to add this new client group 
+
+		//* If the user who inserted the client is a reseller (not admin), we will have to add this new client group
 		//* to his groups, so he can administrate the records of this client.
 		if($_SESSION['s']['user']['typ'] == 'user') {
-			$app->auth->add_group_to_user($_SESSION['s']['user']['userid'],$groupid);
+			$app->auth->add_group_to_user($_SESSION['s']['user']['userid'], $groupid);
 			$app->db->query("UPDATE client SET parent_client_id = ".$app->functions->intval($_SESSION['s']['user']['client_id'])." WHERE client_id = ".$this->id);
 		}
-		
+
 		//* Set the default servers
 		$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE mail_server = 1 AND mirror_server_id = 0 LIMIT 0,1');
 		$default_mailserver = $app->functions->intval($tmp['server_id']);
@@ -224,19 +224,19 @@
 		$default_dnsserver = $app->functions->intval($tmp['server_id']);
 		$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE db_server = 1 AND mirror_server_id = 0 LIMIT 0,1');
 		$default_dbserver = $app->functions->intval($tmp['server_id']);
-		
+
 		$sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
 		$app->db->query($sql);
-		
-        if(isset($this->dataRecord['template_master'])) {
-            $app->uses('client_templates');
-            $app->client_templates->update_client_templates($this->id, $this->_template_additional);
-        }
+
+		if(isset($this->dataRecord['template_master'])) {
+			$app->uses('client_templates');
+			$app->client_templates->update_client_templates($this->id, $this->_template_additional);
+		}
 
 		parent::onAfterInsert();
 	}
-	
-	
+
+
 	/*
 	 This function is called automatically right after
 	 the data was successful updated in the database.
@@ -249,120 +249,121 @@
 			$client_id = $this->id;
 			$sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
 			$app->db->query($sql);
-			
+
 			$tmp = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = $client_id");
 			$app->db->datalogUpdate("sys_group", "name = '$username'", 'groupid', $tmp['groupid']);
 			unset($tmp);
 		}
-		
+
 		// password changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
 			$password = $app->db->quote($this->dataRecord["password"]);
 			$salt="$1$";
 			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 			for ($n=0;$n<8;$n++) {
-				$salt.=$base64_alphabet[mt_rand(0,63)];
+				$salt.=$base64_alphabet[mt_rand(0, 63)];
 			}
 			$salt.="$";
-			$password = crypt(stripslashes($password),$salt);
+			$password = crypt(stripslashes($password), $salt);
 			$client_id = $this->id;
 			$sql = "UPDATE sys_user SET passwort = '$password' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
-        if(!isset($this->dataRecord['locked'])) $this->dataRecord['locked'] = 'n';
-        if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["locked"] != $this->oldDataRecord['locked']) {
-            /** lock all the things like web, mail etc. - easy to extend */
-            
-            // get tmp_data of client
-            $client_data = $app->db->queryOneRecord('SELECT `tmp_data` FROM `client` WHERE `client_id` = ' . $this->id);
-            
-            if($client_data['tmp_data'] == '') $tmp_data = array();
-            else $tmp_data = unserialize($client_data['tmp_data']);
-            
-            if(!is_array($tmp_data)) $tmp_data = array();
-            
-            // database tables with their primary key columns
-            $to_disable = array('cron' => 'id',
-                                'ftp_user' => 'ftp_user_id',
-                                'mail_domain' => 'domain_id',
-                                'mail_forwarding' => 'forwarding_id',
-                                'mail_get' => 'mailget_id',
-                                'openvz_vm' => 'vm_id',
-                                'shell_user' => 'shell_user_id',
-                                'webdav_user' => 'webdav_user_id',
-                                'web_database' => 'database_id',
-                                'web_domain' => 'domain_id',
-                                'web_folder' => 'web_folder_id',
-                                'web_folder_user' => 'web_folder_user_id'
-                               );
-            
-            $udata = $app->db->queryOneRecord('SELECT `userid` FROM `sys_user` WHERE `client_id` = ' . $this->id);
-            $gdata = $app->db->queryOneRecord('SELECT `groupid` FROM `sys_group` WHERE `client_id` = ' . $this->id);
-            $sys_groupid = $gdata['groupid'];
-            $sys_userid = $udata['userid'];
-            
-            $entries = array();
-            if($this->dataRecord['locked'] == 'y') {
-                $prev_active = array();
-                $prev_sysuser = array();
-                foreach($to_disable as $current => $keycolumn) {
-                    $prev_active[$current] = array();
-                    $prev_sysuser[$current] = array();
-                    
-                    $entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id`, `sys_userid`, `active` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
-                    foreach($entries as $item) {
-                        
-                        if($item['active'] != 'y') $prev_active[$current][$item['id']]['active'] = 'n';
-                        if($item['sys_userid'] != $sys_userid) $prev_sysuser[$current][$item['id']]['active'] = $item['sys_userid'];
-                        // we don't have to store these if y, as everything without previous state gets enabled later
-                        
-                        $app->db->datalogUpdate($current, array('active' => 'n', 'sys_userid' => $_SESSION["s"]["user"]["userid"]), $keycolumn, $item['id']);
-                    }
-                }
-                
-                $tmp_data['prev_active'] = $prev_active;
-                $tmp_data['prev_sys_userid'] = $prev_sysuser;
-                $app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
-                unset($prev_active);
-                unset($prev_sysuser);
-            } elseif($this->dataRecord['locked'] == 'n') {
-                foreach($to_disable as $current => $keycolumn) {
-                    $entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
-                    foreach($entries as $item) {
-                        $set_active = 'y';
-                        $set_sysuser = $sys_userid;
-                        if(array_key_exists('prev_active', $tmp_data) == true
-                            && array_key_exists($current, $tmp_data['prev_active']) == true
-                            && array_key_exists($item['id'], $tmp_data['prev_active'][$current]) == true
-                            && $tmp_data['prev_active'][$current][$item['id']] == 'n') $set_active = 'n';
-                        if(array_key_exists('prev_sysuser', $tmp_data) == true
-                            && array_key_exists($current, $tmp_data['prev_sysuser']) == true
-                            && array_key_exists($item['id'], $tmp_data['prev_sysuser'][$current]) == true
-                            && $tmp_data['prev_sysuser'][$current][$item['id']] != $sys_userid) $set_sysuser = $tmp_data['prev_sysuser'][$current][$item['id']];
-                        
-                        $app->db->datalogUpdate($current, array('active' => $set_active, 'sys_userid' => $set_sysuser), $keycolumn, $item['id']);
-                    }
-                }
-                if(array_key_exists('prev_active', $tmp_data)) unset($tmp_data['prev_active']);
-                $app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
-            }
-            unset($tmp_data);
-            unset($entries);
-            unset($to_disable);
-        }
-        
-        if(!isset($this->dataRecord['canceled'])) $this->dataRecord['canceled'] = 'n';
-        if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["canceled"] != $this->oldDataRecord['canceled']) {
-            if($this->dataRecord['canceled'] == 'y') {
-                $sql = "UPDATE sys_user SET active = '0' WHERE client_id = " . $this->id;
-                $app->db->query($sql);
-            } elseif($this->dataRecord['canceled'] == 'n') {
-                $sql = "UPDATE sys_user SET active = '1' WHERE client_id = " . $this->id;
-                $app->db->query($sql);
-            }
-        }
-        
+
+		if(!isset($this->dataRecord['locked'])) $this->dataRecord['locked'] = 'n';
+		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["locked"] != $this->oldDataRecord['locked']) {
+			/** lock all the things like web, mail etc. - easy to extend */
+
+
+			// get tmp_data of client
+			$client_data = $app->db->queryOneRecord('SELECT `tmp_data` FROM `client` WHERE `client_id` = ' . $this->id);
+
+			if($client_data['tmp_data'] == '') $tmp_data = array();
+			else $tmp_data = unserialize($client_data['tmp_data']);
+
+			if(!is_array($tmp_data)) $tmp_data = array();
+
+			// database tables with their primary key columns
+			$to_disable = array('cron' => 'id',
+				'ftp_user' => 'ftp_user_id',
+				'mail_domain' => 'domain_id',
+				'mail_forwarding' => 'forwarding_id',
+				'mail_get' => 'mailget_id',
+				'openvz_vm' => 'vm_id',
+				'shell_user' => 'shell_user_id',
+				'webdav_user' => 'webdav_user_id',
+				'web_database' => 'database_id',
+				'web_domain' => 'domain_id',
+				'web_folder' => 'web_folder_id',
+				'web_folder_user' => 'web_folder_user_id'
+			);
+
+			$udata = $app->db->queryOneRecord('SELECT `userid` FROM `sys_user` WHERE `client_id` = ' . $this->id);
+			$gdata = $app->db->queryOneRecord('SELECT `groupid` FROM `sys_group` WHERE `client_id` = ' . $this->id);
+			$sys_groupid = $gdata['groupid'];
+			$sys_userid = $udata['userid'];
+
+			$entries = array();
+			if($this->dataRecord['locked'] == 'y') {
+				$prev_active = array();
+				$prev_sysuser = array();
+				foreach($to_disable as $current => $keycolumn) {
+					$prev_active[$current] = array();
+					$prev_sysuser[$current] = array();
+
+					$entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id`, `sys_userid`, `active` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
+					foreach($entries as $item) {
+
+						if($item['active'] != 'y') $prev_active[$current][$item['id']]['active'] = 'n';
+						if($item['sys_userid'] != $sys_userid) $prev_sysuser[$current][$item['id']]['active'] = $item['sys_userid'];
+						// we don't have to store these if y, as everything without previous state gets enabled later
+
+						$app->db->datalogUpdate($current, array('active' => 'n', 'sys_userid' => $_SESSION["s"]["user"]["userid"]), $keycolumn, $item['id']);
+					}
+				}
+
+				$tmp_data['prev_active'] = $prev_active;
+				$tmp_data['prev_sys_userid'] = $prev_sysuser;
+				$app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
+				unset($prev_active);
+				unset($prev_sysuser);
+			} elseif($this->dataRecord['locked'] == 'n') {
+				foreach($to_disable as $current => $keycolumn) {
+					$entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
+					foreach($entries as $item) {
+						$set_active = 'y';
+						$set_sysuser = $sys_userid;
+						if(array_key_exists('prev_active', $tmp_data) == true
+							&& array_key_exists($current, $tmp_data['prev_active']) == true
+							&& array_key_exists($item['id'], $tmp_data['prev_active'][$current]) == true
+							&& $tmp_data['prev_active'][$current][$item['id']] == 'n') $set_active = 'n';
+						if(array_key_exists('prev_sysuser', $tmp_data) == true
+							&& array_key_exists($current, $tmp_data['prev_sysuser']) == true
+							&& array_key_exists($item['id'], $tmp_data['prev_sysuser'][$current]) == true
+							&& $tmp_data['prev_sysuser'][$current][$item['id']] != $sys_userid) $set_sysuser = $tmp_data['prev_sysuser'][$current][$item['id']];
+
+						$app->db->datalogUpdate($current, array('active' => $set_active, 'sys_userid' => $set_sysuser), $keycolumn, $item['id']);
+					}
+				}
+				if(array_key_exists('prev_active', $tmp_data)) unset($tmp_data['prev_active']);
+				$app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
+			}
+			unset($tmp_data);
+			unset($entries);
+			unset($to_disable);
+		}
+
+		if(!isset($this->dataRecord['canceled'])) $this->dataRecord['canceled'] = 'n';
+		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["canceled"] != $this->oldDataRecord['canceled']) {
+			if($this->dataRecord['canceled'] == 'y') {
+				$sql = "UPDATE sys_user SET active = '0' WHERE client_id = " . $this->id;
+				$app->db->query($sql);
+			} elseif($this->dataRecord['canceled'] == 'n') {
+				$sql = "UPDATE sys_user SET active = '1' WHERE client_id = " . $this->id;
+				$app->db->query($sql);
+			}
+		}
+
 		// language changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
 			$language = $app->db->quote($this->dataRecord["language"]);
@@ -370,7 +371,7 @@
 			$sql = "UPDATE sys_user SET language = '$language' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
+
 		// reseller status changed
 		if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != $this->oldDataRecord["limit_client"]) {
 			$modules = $conf['interface_modules_enabled'];
@@ -380,14 +381,15 @@
 			$sql = "UPDATE sys_user SET modules = '$modules' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
-        if(isset($this->dataRecord['template_master'])) {
-            $app->uses('client_templates');
-            $app->client_templates->update_client_templates($this->id, $this->_template_additional);
-        }
-        
+
+		if(isset($this->dataRecord['template_master'])) {
+			$app->uses('client_templates');
+			$app->client_templates->update_client_templates($this->id, $this->_template_additional);
+		}
+
 		parent::onAfterUpdate();
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/client/client_list.php b/interface/web/client/client_list.php
index 35258b8..7d09217 100644
--- a/interface/web/client/client_list.php
+++ b/interface/web/client/client_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/client_message.php b/interface/web/client/client_message.php
index 73c43bb..4275edb 100644
--- a/interface/web/client/client_message.php
+++ b/interface/web/client/client_message.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -41,9 +41,9 @@
 $app->tpl->newTemplate('form.tpl.htm');
 $app->tpl->setInclude('content_tpl', 'templates/client_message.htm');
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_client_message.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $msg = '';
@@ -51,18 +51,18 @@
 
 //* Save data
 if(isset($_POST) && count($_POST) > 1) {
-	
+
 	//* Check values
 	if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $_POST['sender'])) $error .= $wb['sender_invalid_error'].'<br />';
 	if(empty($_POST['subject'])) $error .= $wb['subject_invalid_error'].'<br />';
 	if(empty($_POST['message'])) $error .= $wb['message_invalid_error'].'<br />';
-	
+
 	//* Send message
 	if($error == '') {
 		if($app->functions->intval($_POST['recipient']) > 0){
 			$circle = $app->db->queryOneRecord("SELECT client_ids FROM client_circle WHERE active = 'y' AND circle_id = ".$app->functions->intval($_POST['recipient'])." AND ".$app->tform->getAuthSQL('r'));
 			if(isset($circle['client_ids']) && $circle['client_ids'] != ''){
-				$tmp_client_ids = explode(',',$circle['client_ids']);
+				$tmp_client_ids = explode(',', $circle['client_ids']);
 				$where = array();
 				foreach($tmp_client_ids as $tmp_client_id){
 					$where[] = 'client_id = '.$tmp_client_id;
@@ -82,7 +82,7 @@
 				$sql = "SELECT * FROM client WHERE email != '' AND parent_client_id = '$client_id'";
 			}
 		}
-		
+
 		//* Get clients
 		$clients = $app->db->queryAllRecords($sql);
 		if(is_array($clients)) {
@@ -92,28 +92,28 @@
 				$message = $_POST['message'];
 				foreach($client as $key => $val) {
 					switch ($key) {
-						case 'password':
-							$message = str_replace('{'.$key.'}', '---', $message);
-							break;
-						case 'gender':
-							$message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message);
-							break;
-						default:
-							$message = str_replace('{'.$key.'}', $val, $message);
+					case 'password':
+						$message = str_replace('{'.$key.'}', '---', $message);
+						break;
+					case 'gender':
+						$message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message);
+						break;
+					default:
+						$message = str_replace('{'.$key.'}', $val, $message);
 					}
 				}
-				
+
 				//* Send the email
 				$app->functions->mail($client['email'], $_POST['subject'], $message, $_POST['sender']);
 				$msg .= $client['email'].', ';
 			}
-			$msg = substr($msg,0,-2);
+			$msg = substr($msg, 0, -2);
 		}
-		
+
 	} else {
-		$app->tpl->setVar('sender',$_POST['sender']);
-		$app->tpl->setVar('subject',$_POST['subject']);
-		$app->tpl->setVar('message',$_POST['message']);
+		$app->tpl->setVar('sender', $_POST['sender']);
+		$app->tpl->setVar('subject', $_POST['subject']);
+		$app->tpl->setVar('message', $_POST['message']);
 	}
 } else {
 	// pre-fill Sender field with reseller's email address
@@ -122,7 +122,7 @@
 		if($client_id > 0){
 			$sql = "SELECT email FROM client WHERE client_id = ".$client_id;
 			$client = $app->db->queryOneRecord($sql);
-			if($client['email'] != '') $app->tpl->setVar('sender',$client['email']);
+			if($client['email'] != '') $app->tpl->setVar('sender', $client['email']);
 		}
 	}
 }
@@ -136,12 +136,12 @@
 		$recipient .= '<option value="'.$circle['circle_id'].'"'.($app->functions->intval($_POST['recipient']) == $circle['circle_id'] ? ' selected="selected"' : '').'>'.$circle['circle_name'].'</option>';
 	}
 }
-$app->tpl->setVar('recipient',$recipient);
+$app->tpl->setVar('recipient', $recipient);
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'){
-	$app->tpl->setVar('form_legend_txt',$wb['form_legend_admin_txt']);
+	$app->tpl->setVar('form_legend_txt', $wb['form_legend_admin_txt']);
 } else {
-	$app->tpl->setVar('form_legend_txt',$wb['form_legend_client_txt']);
+	$app->tpl->setVar('form_legend_txt', $wb['form_legend_client_txt']);
 }
 
 //message variables
@@ -159,10 +159,10 @@
 		}
 	}
 }
-$app->tpl->setVar('message_variables',trim($message_variables));
+$app->tpl->setVar('message_variables', trim($message_variables));
 
-$app->tpl->setVar('okmsg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('okmsg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
diff --git a/interface/web/client/client_template_del.php b/interface/web/client/client_template_del.php
index 647ad7c..b57224f 100644
--- a/interface/web/client/client_template_del.php
+++ b/interface/web/client/client_template_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -52,23 +52,24 @@
 class page_action extends tform_actions {
 	function onBeforeDelete() {
 		global $app;
-		
+
 		// check new style
-        $rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client_template_assigned WHERE client_template_id = ".$this->id);
+		$rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client_template_assigned WHERE client_template_id = ".$this->id);
 		if($rec['number'] > 0) {
 			$app->error($app->tform->lng('template_del_aborted_txt'));
 		}
-        
-        // check old style
+
+		// check old style
 		$rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE template_master = ".$this->id." OR template_additional like '%/".$this->id."/%'");
 		if($rec['number'] > 0) {
 			$app->error($app->tform->lng('template_del_aborted_txt'));
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete()
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/client_template_edit.php b/interface/web/client/client_template_edit.php
index e14c746..d956faf 100644
--- a/interface/web/client/client_template_edit.php
+++ b/interface/web/client/client_template_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -53,7 +53,7 @@
 
 	function onBeforeUpdate() {
 		global $app;
-		
+
 		if(isset($this->dataRecord['template_type'])) {
 			//* Check if the template_type has been changed
 			$rec = $app->db->queryOneRecord("SELECT template_type from client_template WHERE template_id = ".$this->id);
@@ -65,16 +65,16 @@
 			unset($rec);
 		}
 	}
-	
-	
+
+
 	/*
 	 This function is called automatically right after
 	 the data was successful updated in the database.
 	*/
 	function onAfterUpdate() {
 		global $app;
-		
-        $app->uses('client_templates');
+
+		$app->uses('client_templates');
 		/*
 		 * the template has changed. apply the new data to all clients
 		 */
@@ -86,10 +86,11 @@
 		$clients = $app->db->queryAllRecords($sql);
 		if (is_array($clients)){
 			foreach ($clients as $client){
-                $app->client_templates->apply_client_templates($client['client_id']);
+				$app->client_templates->apply_client_templates($client['client_id']);
 			}
 		}
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/client/client_template_list.php b/interface/web/client/client_template_list.php
index bdfe1d1..c87cea0 100644
--- a/interface/web/client/client_template_list.php
+++ b/interface/web/client/client_template_list.php
@@ -26,8 +26,8 @@
 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
diff --git a/interface/web/client/domain_del.php b/interface/web/client/domain_del.php
index 6e80480..2ec8e86 100644
--- a/interface/web/client/domain_del.php
+++ b/interface/web/client/domain_del.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -52,11 +52,11 @@
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
+
 		//* load language file
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
-		include($lng_file);
-		
+		include $lng_file;
+
 		/*
 		 * We can only delete domains if they are NOT in use
 		 */
@@ -67,16 +67,17 @@
 		if (is_array($res)){
 			$app->error($wb['error_domain_in mailuse']);
 		}
-		
+
 		$sql = "SELECT domain_id FROM web_domain WHERE domain = '" . $app->db->quote($domain) . "'";
 		$res = $app->db->queryOneRecord($sql);
 		if (is_array($res)){
 			$app->error($wb['error_domain_in webuse']);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php
index 13e35b8..3c20ddb 100644
--- a/interface/web/client/domain_edit.php
+++ b/interface/web/client/domain_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -50,7 +50,7 @@
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
-include($lng_file);
+include $lng_file;
 
 class page_action extends tform_actions {
 
@@ -80,7 +80,7 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 		}
 
@@ -146,9 +146,10 @@
 			$app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/domain_list.php b/interface/web/client/domain_list.php
index e4ef725..622e52a 100644
--- a/interface/web/client/domain_list.php
+++ b/interface/web/client/domain_list.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@
 $app->listform_actions->SQLOrderBy = 'ORDER BY domain.domain';
 $app->listform_actions->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/domain_new_client.php b/interface/web/client/domain_new_client.php
index 81ce075..d24174a 100644
--- a/interface/web/client/domain_new_client.php
+++ b/interface/web/client/domain_new_client.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index 37d51bd..16e68c0 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 		= "Client";
+$form["title"]   = "Client";
 $form["description"]    = "";
-$form["name"] 		= "client";
-$form["action"]		= "client_edit.php";
-$form["db_table"]	= "client";
-$form["db_table_idx"]	= "client_id";
-$form["db_history"]	= "yes";
-$form["tab_default"]	= "address";
-$form["list_default"]	= "client_list.php";
-$form["auth"]		= 'yes';
+$form["name"]   = "client";
+$form["action"]  = "client_edit.php";
+$form["db_table"] = "client";
+$form["db_table_idx"] = "client_id";
+$form["db_history"] = "yes";
+$form["tab_default"] = "address";
+$form["list_default"] = "client_list.php";
+$form["auth"]  = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -58,1033 +58,1033 @@
 //* Languages
 $language_list = array();
 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
-while ($file = @readdir ($handle)) {
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 $form["tabs"]['address'] = array (
-	'title' 	=> "Address",
-	'width' 	=> 100,
-	'template' 	=> "templates/client_edit_address.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Address",
+	'width'  => 100,
+	'template'  => "templates/client_edit_address.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'company_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'gender' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => '', 'm' => 'gender_m_txt', 'f' => 'gender_f_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => '', 'm' => 'gender_m_txt', 'f' => 'gender_f_txt')
 		),
 		'contact_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'NOTEMPTY',
-                                                                'errmsg'=> 'contact_error_empty'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'contact_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 1
 		),
 		'customer_no' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'customer_no_error_unique',
-														'allowempty' => 'y'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'customer_no_error_unique',
+					'allowempty' => 'y'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-                                                                        'errmsg'=> 'username_error_empty'),
-                                                        1 => array (	'type'	=> 'CUSTOM',
-                                                                        'class' => 'validate_client',
-                                                                        'function' => 'username_unique',
-                                                                        'errmsg'=> 'username_error_unique'),
-                                                        2 => array (	'type'	=> 'CUSTOM',
-                                                                        'class' => 'validate_client',
-                                                                        'function' => 'username_collision',
-                                                                        'errmsg'=> 'username_error_collision'),
-                                                        3 => array (	'type'	=> 'REGEX',
-                                                                        'regex' => '/^[\w\.\-\_]{0,64}$/',
-                                                                        'errmsg'=> 'username_error_regex'),
-                                                        ),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'username_error_empty'),
+				1 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_unique',
+					'errmsg'=> 'username_error_unique'),
+				2 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_collision',
+					'errmsg'=> 'username_error_collision'),
+				3 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\_]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> $conf["language"],
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => $conf["language"],
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'usertheme' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> $conf["theme"],
-			'value'		=> $themes_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => $conf["theme"],
+			'value'  => $themes_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'street' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'zip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'city' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'state' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'country' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> (isset($conf['language']) ? strtoupper($conf['language']) : ''),
-			'datasource'	=> array (  'type'          => 'SQL',
-                                                    'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
-                                                    'keyfield'      => 'iso',
-                                                    'valuefield'    => 'printable_name'
-                                                ),
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => (isset($conf['language']) ? strtoupper($conf['language']) : ''),
+			'datasource' => array (  'type'          => 'SQL',
+				'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
+				'keyfield'      => 'iso',
+				'valuefield'    => 'printable_name'
+			),
+			'value'  => ''
 		),
 		'telephone' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'mobile' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'fax' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'internet' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'icq' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'vat_id' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'company_id' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_owner' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_number' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_code' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_iban' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_swift' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'notes' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30'
 		),
 		'paypal_email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'paypal_email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'paypal_email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'locked' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'canceled' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['limits'] = array (
-	'title' 	=> "Limits",
-	'width' 	=> 80,
-	'template' 	=> "templates/client_edit_limits.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Limits",
+	'width'  => 80,
+	'template'  => "templates/client_edit_limits.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_master' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'master_templates'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'master_templates'
+			),
+			'value'  => ''
 		),
 		'template_additional' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 		),
 		'default_mailserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_mailserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_mailserver'
 		),
 		'limit_maildomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_maildomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_maildomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailbox' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailbox_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailbox_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailalias' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailalias_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailalias_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailaliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailaliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailaliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailmailinglist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailmailinglist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailmailinglist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailforward' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailforward_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailforward_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailcatchall' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailcatchall_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailcatchall_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailrouting' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailrouting_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailrouting_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailfilter' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfilter_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfilter_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_fetchmail' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfetchmail_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfetchmail_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailquota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailquota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailquota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_wblist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_policy' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_policy_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_policy_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_webserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_webserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_webserver'
 		),
 		'limit_web_domain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_domain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_domain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'web_php_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'web_php_options_notempty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'web_php_options_notempty'),
+			),
+			'default' => '',
 			'separator' => ',',
 			'valuelimit' => 'client:web_php_options',
-			'value'		=> array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
+			'value'  => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
 		),
 		'limit_cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'force_suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_hterror' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_wildcard' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_web_aliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_aliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_aliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_subdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_subdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_subdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_ftp_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_ftp_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_ftp_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_shell_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_shell_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_shell_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ssh_chroot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ssh_chroot_notempty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ssh_chroot_notempty'),
+			),
+			'default' => '',
 			'separator' => ',',
 			'valuelimit' => 'client:ssh_chroot',
-			'value'		=> array('no' => 'None', 'jailkit' => 'Jailkit')
+			'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
 		),
 		'limit_webdav_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_webdav_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_webdav_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_dnsserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_dnsserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_dnsserver'
 		),
 		'limit_dns_zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_zone_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_zone_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_slave_dnsserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_slave_dnsserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_slave_dnsserver'
 		),
 		'limit_dns_slave_zone' => array (
-            'datatype'      => 'INTEGER',
-            'formtype'      => 'TEXT',
-            'validators'    => array (      0 => array (    'type'  => 'ISINT',
-                                                                                                                'errmsg'=> 'limit_dns_slave_zone_error_notint'),
-                                                                        ),
-            'default'       => '-1',
-            'value'         => '',
-            'separator'     => '',
-            'width'         => '10',
-            'maxlength'     => '10',
-            'rows'          => '',
-            'cols'          => ''
-        ),
+			'datatype'      => 'INTEGER',
+			'formtype'      => 'TEXT',
+			'validators'    => array (      0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_dns_slave_zone_error_notint'),
+			),
+			'default'       => '-1',
+			'value'         => '',
+			'separator'     => '',
+			'width'         => '10',
+			'maxlength'     => '10',
+			'rows'          => '',
+			'cols'          => ''
+		),
 		'limit_dns_record' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_record_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_record_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_client' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_client_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_client_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_dbserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_dbserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_dbserver'
 		),
 		'limit_database' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_database_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_database_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
-        'limit_cron' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_notint'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'limit_cron_type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'default'   => '',
-            'value'     => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron')
-        ),
-        'limit_cron_frequency' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_frequency'),
-                                    ),
-            'default'   => '-1',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
+		'limit_cron' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_notint'),
+			),
+			'default'   => '0',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'limit_cron_type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'default'   => '',
+			'value'     => array('full' => 'Full Cron', 'chrooted' => 'Chrooted Cron', 'url' => 'URL Cron')
+		),
+		'limit_cron_frequency' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_frequency'),
+			),
+			'default'   => '-1',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
 		'limit_traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_traffic_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_traffic_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_openvz_vm_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_openvz_vm_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm_template_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
-										'keyfield'=> 'template_id',
-										'valuefield'=> 'template_name'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
+				'keyfield'=> 'template_id',
+				'valuefield'=> 'template_name'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'limit_aps' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_aps_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_aps_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/client/form/client_circle.tform.php b/interface/web/client/form/client_circle.tform.php
index bb5a140..91b96b3 100644
--- a/interface/web/client/form/client_circle.tform.php
+++ b/interface/web/client/form/client_circle.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Client Circle";
-$form["description"] 	= "";
-$form["name"] 			= "client_circle";
-$form["action"]			= "client_circle_edit.php";
-$form["db_table"]		= "client_circle";
-$form["db_table_idx"]	= "circle_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "circle";
-$form["list_default"]	= "client_circle_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Client Circle";
+$form["description"]  = "";
+$form["name"]    = "client_circle";
+$form["action"]   = "client_circle_edit.php";
+$form["db_table"]  = "client_circle";
+$form["db_table_idx"] = "circle_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "circle";
+$form["list_default"] = "client_circle_list.php";
+$form["auth"]   = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -58,80 +58,80 @@
 //* Languages
 $language_list = array();
 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
-while ($file = @readdir ($handle)) {
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 $form["tabs"]['circle'] = array (
-	'title' 	=> "Circle",
-	'width' 	=> 100,
-	'template' 	=> "templates/client_circle_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Circle",
+	'width'  => 100,
+	'template'  => "templates/client_circle_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'circle_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'client_ids' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'default' => '',
 			'separator' => ',',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
-										'keyfield'=> 'client_id',
-										'valuefield'=> 'contact_name'
-									 ),
-			'value'		=> ''
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
+				'keyfield'=> 'client_id',
+				'valuefield'=> 'contact_name'
+			),
+			'value'  => ''
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php
index 917266e..ecf61f7 100644
--- a/interface/web/client/form/client_template.tform.php
+++ b/interface/web/client/form/client_template.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Client-Templates";
-$form["description"] 	= "";
-$form["name"] 			= "client_template";
-$form["action"]			= "client_template_edit.php";
-$form["db_table"]		= "client_template";
-$form["db_table_idx"]	= "template_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "template";
-$form["list_default"]	= "client_template_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Client-Templates";
+$form["description"]  = "";
+$form["name"]    = "client_template";
+$form["action"]   = "client_template_edit.php";
+$form["db_table"]  = "client_template";
+$form["db_table_idx"] = "template_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "template";
+$form["list_default"] = "client_template_list.php";
+$form["auth"]   = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -53,465 +53,465 @@
 //* Languages
 $language_list = array();
 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
-while ($file = @readdir ($handle)) {
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
 $form["tabs"]['template'] = array (
-	'title' 	=> "Template",
-	'width' 	=> 80,
-	'template' 	=> "templates/client_template_edit_template.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Template",
+	'width'  => 80,
+	'template'  => "templates/client_template_edit_template.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'm',
-			'value'		=> array('m' => "Main Template",'a' => "Additional Template"),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'm',
+			'value'  => array('m' => "Main Template", 'a' => "Additional Template"),
 		),
 		'template_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'error_template_name_empty'),
-										),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'error_template_name_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['limits'] = array (
-	'title' 	=> "Limits",
-	'width' 	=> 80,
-	'template' 	=> "templates/client_template_edit_limits.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Limits",
+	'width'  => 80,
+	'template'  => "templates/client_template_edit_limits.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'limit_maildomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_maildomain_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_maildomain_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailbox' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailbox_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailbox_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailalias' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailalias_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailalias_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailaliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailaliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailaliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailmailinglist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailmailinglist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailmailinglist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailforward' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailforward_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailforward_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailcatchall' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailcatchall_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailcatchall_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailrouting' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailrouting_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailrouting_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailfilter' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfilter_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfilter_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_fetchmail' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfetchmail_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfetchmail_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailquota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailquota_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailquota_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_wblist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_user_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_user_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_policy' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_policy_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_policy_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_domain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_domain_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_domain_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'web_php_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'default' => '',
 			'separator' => ',',
 			'valuelimit' => 'client:web_php_options',
-			'value'		=> array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
+			'value'  => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
 		),
 		'limit_cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'force_suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_hterror' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_wildcard' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_web_aliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_aliasdomain_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_aliasdomain_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_subdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_subdomain_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_subdomain_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_ftp_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_ftp_user_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_ftp_user_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_shell_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_shell_user_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_shell_user_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ssh_chroot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array (
-			  0 => array (
-			    'type'=> 'NOTEMPTY',
-			    'errmsg'=> 'ssh_chroot_notempty'
-			  ),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (
+				0 => array (
+					'type'=> 'NOTEMPTY',
+					'errmsg'=> 'ssh_chroot_notempty'
+				),
 			),
-			'default'	=> '',
+			'default' => '',
 			'separator' => ',',
 			'valuelimit' => 'client:ssh_chroot',
-			'value'		=> array('no' => 'None', 'jailkit' => 'Jailkit')
+			'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
 		),
 		'limit_webdav_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_webdav_user_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_webdav_user_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_dns_zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_zone_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_zone_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
-                'limit_dns_slave_zone' => array (
-                        'datatype'      => 'INTEGER',
-                        'formtype'      => 'TEXT',
-                        'validators'    => array (      0 => array (    'type'  => 'ISINT',
-                                                                                                                'errmsg'=> 'limit_dns_slave_zone_error_notint'),
-                                                                        ),
-                        'default'       => '0',
-                        'value'         => '',
-                        'separator'     => '',
-                        'width'         => '10',
-                        'maxlength'     => '10',
-                        'rows'          => '',
-                        'cols'          => ''
-                ),
+		'limit_dns_slave_zone' => array (
+			'datatype'      => 'INTEGER',
+			'formtype'      => 'TEXT',
+			'validators'    => array (      0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_dns_slave_zone_error_notint'),
+			),
+			'default'       => '0',
+			'value'         => '',
+			'separator'     => '',
+			'width'         => '10',
+			'maxlength'     => '10',
+			'rows'          => '',
+			'cols'          => ''
+		),
 		'limit_dns_record' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_record_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_record_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		/*
 		'limit_client' => array (
@@ -530,109 +530,109 @@
 		),
 		*/
 		'limit_database' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_database_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_database_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
-        'limit_cron' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_notint'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'limit_cron_type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'default'   => '',
-            'value'     => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron')
-        ),
-        'limit_cron_frequency' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_frequency'),
-                                    ),
-            'default'   => '-1',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
+		'limit_cron' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_notint'),
+			),
+			'default'   => '0',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'limit_cron_type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'default'   => '',
+			'value'     => array('full' => 'Full Cron', 'chrooted' => 'Chrooted Cron', 'url' => 'URL Cron')
+		),
+		'limit_cron_frequency' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_frequency'),
+			),
+			'default'   => '-1',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
 		'limit_traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_traffic_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_traffic_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_openvz_vm_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_openvz_vm_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm_template_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
-										'keyfield'=> 'template_id',
-										'valuefield'=> 'template_name'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
+				'keyfield'=> 'template_id',
+				'valuefield'=> 'template_name'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'limit_aps' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_aps_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_aps_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/client/form/domain.tform.php b/interface/web/client/form/domain.tform.php
index 40f9a90a..a128783 100644
--- a/interface/web/client/form/domain.tform.php
+++ b/interface/web/client/form/domain.tform.php
@@ -60,16 +60,16 @@
 
 */
 
-$form["title"] 			= "Domain";
-$form["description"] 	= "";
-$form["name"] 			= "domain";
-$form["action"]			= "domain_edit.php";
-$form["db_table"]		= "domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "domain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Domain";
+$form["description"]  = "";
+$form["name"]    = "domain";
+$form["action"]   = "domain_edit.php";
+$form["db_table"]  = "domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "domain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -78,41 +78,41 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/domain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/domain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'domain_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'domain_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
-														'errmsg'=> 'domain_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'domain_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'domain_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php
index c78ed8e..fad0cd7 100644
--- a/interface/web/client/form/reseller.tform.php
+++ b/interface/web/client/form/reseller.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Reseller";
-$form["description"] 	= "";
-$form["name"] 			= "reseller";
-$form["action"]			= "reseller_edit.php";
-$form["db_table"]		= "client";
-$form["db_table_idx"]	= "client_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "address";
-$form["list_default"]	= "reseller_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Reseller";
+$form["description"]  = "";
+$form["name"]    = "reseller";
+$form["action"]   = "reseller_edit.php";
+$form["db_table"]  = "client";
+$form["db_table_idx"] = "client_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "address";
+$form["list_default"] = "reseller_list.php";
+$form["auth"]   = 'yes';
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -58,1031 +58,1031 @@
 //* Load themes
 $themes_list = array();
 $handle = @opendir(ISPC_THEMES_PATH);
-while ($file = @readdir ($handle)) {
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
-    }
+				$themes_list[$file] = $file;
+			}
+		}
+	}
 }
 
 //* Languages
 $language_list = array();
 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
-while ($file = @readdir ($handle)) {
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
 $form["tabs"]['address'] = array (
-	'title' 	=> "Address",
-	'width' 	=> 100,
-	'template' 	=> "templates/reseller_edit_address.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Address",
+	'width'  => 100,
+	'template'  => "templates/reseller_edit_address.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'company_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'gender' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => '', 'm' => 'gender_m_txt', 'f' => 'gender_f_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => '', 'm' => 'gender_m_txt', 'f' => 'gender_f_txt')
 		),
 		'contact_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'contact_error_empty'),
-										),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'contact_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 1
 		),
 		'customer_no' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'customer_no_error_unique',
-														'allowempty' => 'y'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'customer_no_error_unique',
+					'allowempty' => 'y'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'username_error_empty'),
-										1 => array (	'type'	=> 'CUSTOM',
-														'class' => 'validate_client',
-														'function' => 'username_unique',
-														'errmsg'=> 'username_error_unique'),
-										2 => array (	'type'	=> 'CUSTOM',
-														'class' => 'validate_client',
-														'function' => 'username_collision',
-														'errmsg'=> 'username_error_collision'),
-										3 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\_]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-										),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'username_error_empty'),
+				1 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_unique',
+					'errmsg'=> 'username_error_unique'),
+				2 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_collision',
+					'errmsg'=> 'username_error_collision'),
+				3 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\_]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> $conf["language"],
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => $conf["language"],
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'usertheme' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> $conf["theme"],
-			'value'		=> $themes_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => $conf["theme"],
+			'value'  => $themes_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'street' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'zip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'city' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'state' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'country' => array (
-			'datatype'	=> 'VARCHAR',
+			'datatype' => 'VARCHAR',
 
-			'formtype'	=> 'SELECT',
-			'default'	=> (isset($conf['language']) ? strtoupper($conf['language']) : ''),
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
-										'keyfield'=> 'iso',
-										'valuefield'=> 'printable_name'
-									 ),
-			'value'		=> ''
+			'formtype' => 'SELECT',
+			'default' => (isset($conf['language']) ? strtoupper($conf['language']) : ''),
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
+				'keyfield'=> 'iso',
+				'valuefield'=> 'printable_name'
+			),
+			'value'  => ''
 		),
 		'telephone' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'mobile' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'fax' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'internet' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'icq' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'vat_id' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'company_id' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '20',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '20',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_owner' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_number' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_code' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_iban' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_swift' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'notes' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30'
 		),
 		'paypal_email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'paypal_email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'paypal_email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'locked' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'canceled' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['limits'] = array (
-	'title' 	=> "Limits",
-	'width' 	=> 80,
-	'template' 	=> "templates/reseller_edit_limits.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Limits",
+	'width'  => 80,
+	'template'  => "templates/reseller_edit_limits.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_master' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'master_templates'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'master_templates'
+			),
+			'value'  => ''
 		),
 		'template_additional' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 		),
 		'default_mailserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'limit_maildomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_maildomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_maildomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailmailinglist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailmailinglist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailmailinglist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailbox' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailbox_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailbox_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailalias' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailalias_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailalias_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailaliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailaliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailaliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailforward' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailforward_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailforward_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailcatchall' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailcatchall_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailcatchall_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailrouting' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailrouting_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailrouting_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailfilter' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfilter_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfilter_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_fetchmail' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfetchmail_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfetchmail_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailquota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailquota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailquota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_wblist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_policy' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_policy_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_policy_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_webserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE web_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'limit_web_domain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_domain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_domain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'web_php_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'web_php_options_notempty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'web_php_options_notempty'),
+			),
+			'default' => '',
 			'separator' => ',',
-			'value'		=> array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
+			'value'  => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
 		),
 		'limit_cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'force_suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_hterror' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_wildcard' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_web_aliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_aliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_aliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_subdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_subdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_subdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_ftp_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_ftp_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_ftp_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_shell_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_shell_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_shell_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ssh_chroot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ssh_chroot_notempty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ssh_chroot_notempty'),
+			),
+			'default' => '',
 			'separator' => ',',
-			'value'		=> array('no' => 'None', 'jailkit' => 'Jailkit')
+			'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
 		),
 		'limit_webdav_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_webdav_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_webdav_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_dnsserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'limit_dns_zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_zone_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_zone_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_slave_dnsserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
-                'limit_dns_slave_zone' => array (
-                        'datatype'      => 'INTEGER',
-                        'formtype'      => 'TEXT',
-                        'validators'    => array (      0 => array (    'type'  => 'ISINT',
-                                                                                                                'errmsg'=> 'limit_dns_slave_zone_error_notint'),
-                                                                        ),
-                        'default'       => '-1',
-                        'value'         => '',
-                        'separator'     => '',
-                        'width'         => '10',
-                        'maxlength'     => '10',
-                        'rows'          => '',
-                        'cols'          => ''
-                ),
+		'limit_dns_slave_zone' => array (
+			'datatype'      => 'INTEGER',
+			'formtype'      => 'TEXT',
+			'validators'    => array (      0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_dns_slave_zone_error_notint'),
+			),
+			'default'       => '-1',
+			'value'         => '',
+			'separator'     => '',
+			'width'         => '10',
+			'maxlength'     => '10',
+			'rows'          => '',
+			'cols'          => ''
+		),
 		'limit_dns_record' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_record_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_record_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_client' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_client_error_notint'),
-										1 => array (	'type'	=> 'CUSTOM',
-														'class' => 'validate_reseller',
-														'function' => 'limit_client'),
-									),
-			'default'	=> '1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_client_error_notint'),
+				1 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_reseller',
+					'function' => 'limit_client'),
+			),
+			'default' => '1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_dbserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE db_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE db_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'limit_database' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_database_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_database_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
-        'limit_cron' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_notint'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'limit_cron_type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'default'   => '',
-            'value'     => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron')
-        ),
-        'limit_cron_frequency' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_frequency'),
-                                    ),
-            'default'   => '-1',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
+		'limit_cron' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_notint'),
+			),
+			'default'   => '0',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'limit_cron_type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'default'   => '',
+			'value'     => array('full' => 'Full Cron', 'chrooted' => 'Chrooted Cron', 'url' => 'URL Cron')
+		),
+		'limit_cron_frequency' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_frequency'),
+			),
+			'default'   => '-1',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
 		'limit_traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_traffic_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_traffic_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_openvz_vm_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_openvz_vm_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm_template_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
-										'keyfield'=> 'template_id',
-										'valuefield'=> 'template_name'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
+				'keyfield'=> 'template_id',
+				'valuefield'=> 'template_name'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'limit_aps' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_aps_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_aps_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/client/lib/admin.conf.php b/interface/web/client/lib/admin.conf.php
index 67c94a5..acb6c35 100644
--- a/interface/web/client/lib/admin.conf.php
+++ b/interface/web/client/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/lib/module.conf.php b/interface/web/client/lib/module.conf.php
index f0564f1..bfb6ac8 100644
--- a/interface/web/client/lib/module.conf.php
+++ b/interface/web/client/lib/module.conf.php
@@ -1,68 +1,68 @@
 <?php
 
-$module["name"] 	= "client";
-$module["title"] 	= "top_menu_client";
-$module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "client/client_list.php";
+$module["name"]  = "client";
+$module["title"]  = "top_menu_client";
+$module["template"]  = "module.tpl.htm";
+$module["startpage"]  = "client/client_list.php";
 $module["tab_width"]    = '';
 
 
-$items[] = array(   'title' 	=> "Edit Client",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_list.php',
-                    'html_id'   => 'client_list');
+$items[] = array(   'title'  => "Edit Client",
+	'target'  => 'content',
+	'link' => 'client/client_list.php',
+	'html_id'   => 'client_list');
 
-$items[] = array(   'title' 	=> "Add Client",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_edit.php',
-                    'html_id'   => 'client_add');
-				  
+$items[] = array(   'title'  => "Add Client",
+	'target'  => 'content',
+	'link' => 'client/client_edit.php',
+	'html_id'   => 'client_add');
+
 if($_SESSION["s"]["user"]["typ"] == 'admin'){
-$items[] = array(   'title' 	=> "Edit Client-Templates",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_template_list.php',
-                    'html_id'   => 'client_template_list');
+	$items[] = array(   'title'  => "Edit Client-Templates",
+		'target'  => 'content',
+		'link' => 'client/client_template_list.php',
+		'html_id'   => 'client_template_list');
 }
 
-$module["nav"][] = array(   'title'	=> 'Clients',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module["nav"][] = array(   'title' => 'Clients',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'){
 
-$items[] = array(   'title' 	=> "Edit Reseller",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/reseller_list.php',
-                    'html_id'   => 'reseller_list');
+	$items[] = array(   'title'  => "Edit Reseller",
+		'target'  => 'content',
+		'link' => 'client/reseller_list.php',
+		'html_id'   => 'reseller_list');
 
-$items[] = array(   'title' 	=> "Add Reseller",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/reseller_edit.php',
-                    'html_id'   => 'reseller_add');
+	$items[] = array(   'title'  => "Add Reseller",
+		'target'  => 'content',
+		'link' => 'client/reseller_edit.php',
+		'html_id'   => 'reseller_add');
 
-$module["nav"][] = array(   'title'	=> 'Resellers',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+	$module["nav"][] = array(   'title' => 'Resellers',
+		'open'  => 1,
+		'items' => $items);
 
-unset($items);
+	unset($items);
 }
 
-$items[] = array(   'title' 	=> "Edit Client Circle",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_circle_list.php',
-                    'html_id'   => 'client_circle_list');
+$items[] = array(   'title'  => "Edit Client Circle",
+	'target'  => 'content',
+	'link' => 'client/client_circle_list.php',
+	'html_id'   => 'client_circle_list');
 
-$items[] = array(   'title' 	=> "Send email",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_message.php',
-                    'html_id'   => 'reseller_add');
+$items[] = array(   'title'  => "Send email",
+	'target'  => 'content',
+	'link' => 'client/client_message.php',
+	'html_id'   => 'reseller_add');
 
-$module["nav"][] = array(   'title'	=> 'Messaging',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module["nav"][] = array(   'title' => 'Messaging',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
@@ -71,13 +71,13 @@
 
 if ($settings['use_domain_module'] == 'y') {
 	$items = array();
-	$items[] = array( 'title' 	=> 'Domains',
-					'target' 	=> 'content',
-					'link'	=> 'client/domain_list.php');
+	$items[] = array( 'title'  => 'Domains',
+		'target'  => 'content',
+		'link' => 'client/domain_list.php');
 
-	$module['nav'][] = array(	'title'	=> 'Domains',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Domains',
+		'open'  => 1,
+		'items' => $items);
 
 	unset($items);
 }
@@ -97,4 +97,4 @@
 unset($items);
 }
 */
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/list/client.list.php b/interface/web/client/list/client.list.php
index 0169810..40af2a7 100644
--- a/interface/web/client/list/client.list.php
+++ b/interface/web/client/list/client.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "clients";
+$liste["name"]    = "clients";
 
 // Database table
-$liste["table"] 		= "client";
+$liste["table"]   = "client";
 
 // Index index field of the database table
-$liste["table_idx"]		= "client_id";
+$liste["table_idx"]  = "client_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "client_list.php";
+$liste["file"]   = "client_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "client_edit.php";
+$liste["edit_file"]  = "client_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "client_del.php";
+$liste["delete_file"]  = "client_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -48,71 +48,71 @@
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "client_id",
-                            'datatype'	=> "INTEGER",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "company_name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "contact_name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "customer_no",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");							
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "username",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> ""); 
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "city",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "country",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'datasource'=> array (  'type'          => 'SQL',
-                                                    'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
-                                                    'keyfield'      => 'iso',
-                                                    'valuefield'    => 'printable_name'
-                                                ),
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource'=> array (  'type'          => 'SQL',
+		'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
+		'keyfield'      => 'iso',
+		'valuefield'    => 'printable_name'
+	),
+	'width' => "",
+	'value' => "");
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/list/client_circle.list.php b/interface/web/client/list/client_circle.list.php
index 075c9cd..d1ef3ad 100644
--- a/interface/web/client/list/client_circle.list.php
+++ b/interface/web/client/list/client_circle.list.php
@@ -13,74 +13,74 @@
 
 
 // Name of the list
-$liste["name"] 				= "client_circle";
+$liste["name"]     = "client_circle";
 
 // Database table
-$liste["table"] 			= "client_circle";
+$liste["table"]    = "client_circle";
 
 // Index index field of the database table
-$liste["table_idx"]			= "circle_id";
+$liste["table_idx"]   = "circle_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "client_circle_list.php";
+$liste["file"]    = "client_circle_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "client_circle_edit.php";
+$liste["edit_file"]   = "client_circle_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "client_circle_del.php";
+$liste["delete_file"]  = "client_circle_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "circle_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "circle_id",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "circle_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste["item"][] = array(	'field'		=> "description",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "circle_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "description",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+?>
diff --git a/interface/web/client/list/client_template.list.php b/interface/web/client/list/client_template.list.php
index ef348e3..cb37eb3 100644
--- a/interface/web/client/list/client_template.list.php
+++ b/interface/web/client/list/client_template.list.php
@@ -11,65 +11,65 @@
 */
 
 // Name of the list
-$liste["name"] 				= "client_template";
+$liste["name"]     = "client_template";
 
 // Database table
-$liste["table"] 			= "client_template";
+$liste["table"]    = "client_template";
 
 // Index index field of the database table
-$liste["table_idx"]			= "template_id";
+$liste["table_idx"]   = "template_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "client_template_list.php";
+$liste["file"]    = "client_template_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "client_template_edit.php";
+$liste["edit_file"]   = "client_template_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "client_template_del.php";
+$liste["delete_file"]  = "client_template_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "template_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "template_id",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "template_type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('m' => "Main Template",'a' => "Additional Template"));
+$liste["item"][] = array( 'field'  => "template_type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('m' => "Main Template", 'a' => "Additional Template"));
 
-$liste["item"][] = array(	'field'		=> "template_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "template_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 ?>
diff --git a/interface/web/client/list/domain.list.php b/interface/web/client/list/domain.list.php
index a7534a2..82c6772 100644
--- a/interface/web/client/list/domain.list.php
+++ b/interface/web/client/list/domain.list.php
@@ -40,63 +40,63 @@
 
 
 // Name of the list
-$liste["name"] 				= "domain";
+$liste["name"]     = "domain";
 
 // Database table
-$liste["table"] 			= "domain";
+$liste["table"]    = "domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "domain_list.php";
+$liste["file"]    = "domain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "domain_edit.php";
+$liste["edit_file"]   = "domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "domain_del.php";
+$liste["delete_file"]  = "domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "LIKE",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "LIKE",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT a.groupid, a.name FROM sys_group a, domain b WHERE (a.groupid = b.sys_groupid) AND ({AUTHSQL-B}) ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "sys_groupid",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT a.groupid, a.name FROM sys_group a, domain b WHERE (a.groupid = b.sys_groupid) AND ({AUTHSQL-B}) ORDER BY name',
+		'keyfield'=> 'groupid',
+		'valuefield'=> 'name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/list/reseller.list.php b/interface/web/client/list/reseller.list.php
index 67ae882..625a5cf 100644
--- a/interface/web/client/list/reseller.list.php
+++ b/interface/web/client/list/reseller.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "resellers";
+$liste["name"]    = "resellers";
 
 // Database table
-$liste["table"] 		= "client";
+$liste["table"]   = "client";
 
 // Index index field of the database table
-$liste["table_idx"]		= "client_id";
+$liste["table_idx"]  = "client_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "reseller_list.php";
+$liste["file"]   = "reseller_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "reseller_edit.php";
+$liste["edit_file"]  = "reseller_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "reseller_del.php";
+$liste["delete_file"]  = "reseller_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -48,71 +48,71 @@
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "client_id",
-                            'datatype'	=> "INTEGER",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => "");
 
-$liste["item"][] = array(   'field'	=> "company_name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+$liste["item"][] = array(   'field' => "company_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
-$liste["item"][] = array(   'field'	=> "contact_name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");  
-							
+$liste["item"][] = array(   'field' => "contact_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
 $liste["item"][] = array(   'field'     => "customer_no",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");	
-							
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
 $liste["item"][] = array(   'field'     => "username",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
-$liste["item"][] = array(   'field'	=> "city",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+$liste["item"][] = array(   'field' => "city",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
-$liste["item"][] = array(   'field'	=> "country",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'datasource'=> array (  'type'          => 'SQL',
-                                                    'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY printable_name ASC',
-                                                    'keyfield'      => 'iso',
-                                                    'valuefield'    => 'printable_name'
-                                                ),
-                            'width'	=> "",
-                            'value'	=> "" );
+$liste["item"][] = array(   'field' => "country",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource'=> array (  'type'          => 'SQL',
+		'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY printable_name ASC',
+		'keyfield'      => 'iso',
+		'valuefield'    => 'printable_name'
+	),
+	'width' => "",
+	'value' => "" );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/reseller_del.php b/interface/web/client/reseller_del.php
index 2cf2003..e9d1dd3 100644
--- a/interface/web/client/reseller_del.php
+++ b/interface/web/client/reseller_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -51,44 +51,45 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onBeforeDelete() {
 		global $app, $conf;
-		
+
 		if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
-		
+
 		$client_id = $app->functions->intval($this->dataRecord['client_id']);
-		
+
 		$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE parent_client_id = ".$client_id);
 		if($tmp["number"] > 0) $app->error($app->lng('error_has_clients'));
-		
+
 	}
-	
+
 	function onAfterDelete() {
 		global $app, $conf;
-		
+
 		$client_id = $app->functions->intval($this->dataRecord['client_id']);
-		
+
 		if($client_id > 0) {
 			// TODO: Delete all records (sub-clients, mail, web, etc....)  of this client.
-			
+
 			// remove the group of the client from the resellers group
 			$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
 			$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
 			$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-			$app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']);
-			
+			$app->auth->remove_group_from_user($parent_user['userid'], $client_group['groupid']);
+
 			// delete the group of the client
 			$app->db->query("DELETE FROM sys_group WHERE client_id = $client_id");
-			
+
 			// delete the sys user(s) of the client
 			$app->db->query("DELETE FROM sys_user WHERE client_id = $client_id");
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete()
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php
index ca2780c..3007ce0 100644
--- a/interface/web/client/reseller_edit.php
+++ b/interface/web/client/reseller_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -55,14 +55,14 @@
 
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_client FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another website.
 			if($client["limit_client"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE sys_groupid = $client_group_id");
@@ -71,21 +71,21 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
-	
+
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user' && $this->id == 0) {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_client FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another website.
 			if($client["limit_client"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE sys_groupid = $client_group_id");
@@ -94,7 +94,7 @@
 				}
 			}
 		}
-		
+
 		parent::onSubmit();
 	}
 
@@ -111,32 +111,32 @@
 			$option .= '<option value="' . $item['template_id'] . '|' .  $item['template_name'] . '">' . $item['template_name'] . '</option>';
 			$tpl[$item['template_id']] = $item['template_name'];
 		}
-		$app->tpl->setVar('tpl_add_select',$option);
+		$app->tpl->setVar('tpl_add_select', $option);
 
-        // check for new-style records
-        $result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
-        if($result && count($result) > 0) {
-            // new style
-            $text = '';
-            foreach($result as $item){
-                if (trim($item['client_template_id']) != ''){
-                    if ($text != '') $text .= '';
-                    $text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']]. '<a href="#" class="button icons16 icoDelete"></a></li>';
-                }
-            }
-        } else {
-            // old style
-            $sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
-            $result = $app->db->queryOneRecord($sql);
-            $tplAdd = explode("/", $result['template_additional']);
-            $text = '';
-            foreach($tplAdd as $item){
-                if (trim($item) != ''){
-                    if ($text != '') $text .= '';
-                    $text .= '<li>' . $tpl[$item]. '<a href="#" class="button icons16 icoDelete"></a></li>';
-                }
-            }
-        }
+		// check for new-style records
+		$result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
+		if($result && count($result) > 0) {
+			// new style
+			$text = '';
+			foreach($result as $item){
+				if (trim($item['client_template_id']) != ''){
+					if ($text != '') $text .= '';
+					$text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']]. '<a href="#" class="button icons16 icoDelete"></a></li>';
+				}
+			}
+		} else {
+			// old style
+			$sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
+			$result = $app->db->queryOneRecord($sql);
+			$tplAdd = explode("/", $result['template_additional']);
+			$text = '';
+			foreach($tplAdd as $item){
+				if (trim($item) != ''){
+					if ($text != '') $text .= '';
+					$text .= '<li>' . $tpl[$item]. '<a href="#" class="button icons16 icoDelete"></a></li>';
+				}
+			}
+		}
 
 		$app->tpl->setVar('template_additional_list', $text);
 
@@ -153,32 +153,32 @@
 		// Create the group for the reseller
 		$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('".$app->db->quote($this->dataRecord["username"])."','',".$this->id.")", 'groupid');
 		$groups = $groupid;
-		
+
 		$username = $app->db->quote($this->dataRecord["username"]);
 		$password = $app->db->quote($this->dataRecord["password"]);
 		$modules = $conf['interface_modules_enabled'] . ',client';
-		$startmodule = (stristr($modules,'dashboard'))?'dashboard':'client'; 
+		$startmodule = (stristr($modules, 'dashboard'))?'dashboard':'client';
 		$usertheme = $app->db->quote($this->dataRecord["usertheme"]);
 		$type = 'user';
 		$active = 1;
 		$language = $app->db->quote($this->dataRecord["language"]);
-		
+
 		$salt="$1$";
 		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 		for ($n=0;$n<8;$n++) {
-			$salt.=$base64_alphabet[mt_rand(0,63)];
+			$salt.=$base64_alphabet[mt_rand(0, 63)];
 		}
 		$salt.="$";
-		$password = crypt(stripslashes($password),$salt);
-		
+		$password = crypt(stripslashes($password), $salt);
+
 		// Create the controlpaneluser for the reseller
 		$sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
 		VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")";
 		$app->db->query($sql);
-		
+
 		//* set the number of clients to 1
 		$app->db->query("UPDATE client SET limit_client = 1 WHERE client_id = ".$this->id);
-		
+
 		//* Set the default servers
 		$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE mail_server = 1 LIMIT 0,1');
 		$default_mailserver = $app->functions->intval($tmp['server_id']);
@@ -188,33 +188,33 @@
 		$default_dnsserver = $app->functions->intval($tmp['server_id']);
 		$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE db_server = 1 LIMIT 0,1');
 		$default_dbserver = $app->functions->intval($tmp['server_id']);
-		
+
 		$sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
 		$app->db->query($sql);
 
 		parent::onAfterInsert();
 	}
-	
-	
+
+
 	/*
 	 This function is called automatically right after
 	 the data was successful updated in the database.
 	*/
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		// username changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
 			$username = $app->db->quote($this->dataRecord["username"]);
 			$client_id = $this->id;
 			$sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
 			$app->db->query($sql);
-			
+
 			$tmp = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = $client_id");
 			$app->db->datalogUpdate("sys_group", "name = '$username'", 'groupid', $tmp['groupid']);
 			unset($tmp);
 		}
-		
+
 		// password changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
 			$password = $app->db->quote($this->dataRecord["password"]);
@@ -222,14 +222,14 @@
 			$salt="$1$";
 			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 			for ($n=0;$n<8;$n++) {
-				$salt.=$base64_alphabet[mt_rand(0,63)];
+				$salt.=$base64_alphabet[mt_rand(0, 63)];
 			}
 			$salt.="$";
-			$password = crypt(stripslashes($password),$salt);
+			$password = crypt(stripslashes($password), $salt);
 			$sql = "UPDATE sys_user SET passwort = '$password' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
+
 		// language changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
 			$language = $app->db->quote($this->dataRecord["language"]);
@@ -237,14 +237,14 @@
 			$sql = "UPDATE sys_user SET language = '$language' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
+
 		// ensure that a reseller is not converted to a client in demo mode when client_id <= 2
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] == true && $this->id <= 2) {
 			if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != -1) {
 				$app->db->query('UPDATE client set limit_client = -1 WHERE client_id = '.$this->id);
 			}
 		}
-		
+
 		// reseller status changed
 		if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != $this->oldDataRecord["limit_client"]) {
 			$modules = $conf['interface_modules_enabled'] . ',client';
@@ -256,9 +256,10 @@
 
 		parent::onAfterUpdate();
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/reseller_list.php b/interface/web/client/reseller_list.php
index fd8fca0..83f5d61 100644
--- a/interface/web/client/reseller_list.php
+++ b/interface/web/client/reseller_list.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -53,4 +53,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/content.php b/interface/web/content.php
index 52ea216..ea23f5a 100644
--- a/interface/web/content.php
+++ b/interface/web/content.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../lib/config.inc.php');
-require_once('../lib/app.inc.php');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
 /*
 $module = $_REQUEST["s_mod"];
@@ -43,36 +43,36 @@
 if(!preg_match("/^[a-z]{2,20}$/i", $page)) die('page name contains unallowed chars.');
 
 if(is_file(ISPC_WEB_PATH."/$module/$page.php")) {
-	
-	include_once(ISPC_WEB_PATH."/$module/$page.php");
+
+	include_once ISPC_WEB_PATH."/$module/$page.php";
 
 	$classname = $module.'_'.$page;
 	$page = new $classname();
-	
+
 	$content = $page->render();
 	if($page->status == 'OK') {
 		echo $content;
 	} elseif($page->status == 'REDIRECT') {
-		$target_parts = explode(':',$page->target);
+		$target_parts = explode(':', $page->target);
 		$module = $target_parts[0];
 		$page = $target_parts[1];
 		if(!preg_match("/^[a-z]{2,20}$/i", $module)) die('target module name contains unallowed chars.');
 		if(!preg_match("/^[a-z]{2,20}$/i", $page)) die('target page name contains unallowed chars.');
-		
+
 		if(is_file(ISPC_WEB_PATH."/$module/$page.php")) {
-			include_once(ISPC_WEB_PATH."/$module/$page.php");
-			
+			include_once ISPC_WEB_PATH."/$module/$page.php";
+
 			$classname = $module.'_'.$page;
 			$page = new $classname();
-			
+
 			$content = $page->render();
 			if($page->status == 'OK') {
 				echo $content;
 			}
 		}
-		
+
 	}
-	
+
 } elseif (is_array($_SESSION["s"]['user']) or is_array($_SESSION["s"]["module"])) {
 	// If the user is logged in, we try to load the default page of the module
 	die('- error -');
@@ -80,4 +80,4 @@
 	die('Page does not exist.');
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/ajax_get_json.php b/interface/web/dashboard/ajax_get_json.php
index e761f3e..4829418 100644
--- a/interface/web/dashboard/ajax_get_json.php
+++ b/interface/web/dashboard/ajax_get_json.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dashboard');
@@ -40,46 +40,46 @@
 
 //if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-	
-	if($type == 'globalsearch'){
-		$q = $app->db->quote(trim($_GET["q"]));
-		$authsql = " AND ".$app->tform->getAuthSQL('r');
-		$modules = explode(',', $_SESSION['s']['user']['modules']);
-		
-		$result = array();
-		
-		// clients
-		$result[] = _search('client', 'client', "AND limit_client = 0");
-		
-		// resellers
-		$result[] = _search('client', 'reseller', "AND limit_client != 0");
-		
-		// web sites
-		$result[] = _search('sites', 'web_domain', "AND type = 'vhost'");
-		
-		// subdomains
-		$result[] = _search('sites', 'web_subdomain', "AND type = 'subdomain'");
-		
-		// web site aliases
-		$result[] = _search('sites', 'web_aliasdomain', "AND type = 'alias'");
-		
-		// vhostsubdomains
-		$result[] = _search('sites', 'web_vhost_subdomain', "AND type = 'vhostsubdomain'");
-		
-		// FTP users
-		$result[] = _search('sites', 'ftp_user');
-		
-		// shell users
-		$result[] = _search('sites', 'shell_user');
-		
-		// databases
-		/*
+
+if($type == 'globalsearch'){
+	$q = $app->db->quote(trim($_GET["q"]));
+	$authsql = " AND ".$app->tform->getAuthSQL('r');
+	$modules = explode(',', $_SESSION['s']['user']['modules']);
+
+	$result = array();
+
+	// clients
+	$result[] = _search('client', 'client', "AND limit_client = 0");
+
+	// resellers
+	$result[] = _search('client', 'reseller', "AND limit_client != 0");
+
+	// web sites
+	$result[] = _search('sites', 'web_domain', "AND type = 'vhost'");
+
+	// subdomains
+	$result[] = _search('sites', 'web_subdomain', "AND type = 'subdomain'");
+
+	// web site aliases
+	$result[] = _search('sites', 'web_aliasdomain', "AND type = 'alias'");
+
+	// vhostsubdomains
+	$result[] = _search('sites', 'web_vhost_subdomain', "AND type = 'vhostsubdomain'");
+
+	// FTP users
+	$result[] = _search('sites', 'ftp_user');
+
+	// shell users
+	$result[] = _search('sites', 'shell_user');
+
+	// databases
+	/*
 		$result_databases = array('cheader' => array(), 'cdata' => array());
 		if(in_array('sites', $modules)){
 			$sql = "SELECT * FROM web_database WHERE database_name LIKE '%".$q."%' OR database_user LIKE '%".$q."%' OR remote_ips LIKE '%".$q."%'".$authsql." ORDER BY database_name";
 			$results = $app->db->queryAllRecords($sql);
 
-			if(is_array($results) && !empty($results)){	
+			if(is_array($results) && !empty($results)){
 				$result_databases['cheader'] = array('title' => 'Databases',
 														'total' => count($results),
 														'limit' => count($results)
@@ -91,65 +91,65 @@
 												'onclick' => 'capp(\'sites\',\'sites/database_edit.php?id='.$result['database_id'].'\');',
 												'fill_text' => strtolower($result['database_name'])
 												);
-				}	
+				}
 			}
 		}
 		*/
-		$result[] = _search('sites', 'database');
-		
-		// database users
-		$result[] = _search('sites', 'database_user');
-		
-		// email domains
-		$result[] = _search('mail', 'mail_domain');
-		
-		// email alias domains
-		$result[] = _search('mail', 'mail_aliasdomain', "AND type = 'aliasdomain'");
-		
-		// email mailboxes
-		$result[] = _search('mail', 'mail_user');
-		
-		// email aliases
-		$result[] = _search('mail', 'mail_alias', "AND type = 'alias'");
-		
-		// email forwards
-		$result[] = _search('mail', 'mail_forward', "AND type = 'forward'");
-		
-		// email catchalls
-		$result[] = _search('mail', 'mail_domain_catchall', "AND type = 'catchall'");
-		
-		// email transports
-		$result[] = _search('mail', 'mail_transport');
-		
-		// mailinglists
-		$result[] = _search('mail', 'mail_mailinglist');
-		
-		// getmails
-		$result[] = _search('mail', 'mail_get');
-		
-		// dns zones
-		$result[] = _search('dns', 'dns_soa');
-		
-		// secondary dns zones
-		$result[] = _search('dns', 'dns_slave');
-		
-		// virtual machines
-		$result[] = _search('vm', 'openvz_vm');
-		
-		// virtual machines os templates
-		$result[] = _search('vm', 'openvz_ostemplate');
-		
-		// virtual machines vm templates
-		$result[] = _search('vm', 'openvz_template');
-		
-		// virtual machines ip addresses
-		$result[] = _search('vm', 'openvz_ip');
-		
-		// directive snippets
-		$result[] = _search('admin', 'directive_snippets');
+	$result[] = _search('sites', 'database');
 
-		$json = $app->functions->json_encode($result);
-	}
+	// database users
+	$result[] = _search('sites', 'database_user');
+
+	// email domains
+	$result[] = _search('mail', 'mail_domain');
+
+	// email alias domains
+	$result[] = _search('mail', 'mail_aliasdomain', "AND type = 'aliasdomain'");
+
+	// email mailboxes
+	$result[] = _search('mail', 'mail_user');
+
+	// email aliases
+	$result[] = _search('mail', 'mail_alias', "AND type = 'alias'");
+
+	// email forwards
+	$result[] = _search('mail', 'mail_forward', "AND type = 'forward'");
+
+	// email catchalls
+	$result[] = _search('mail', 'mail_domain_catchall', "AND type = 'catchall'");
+
+	// email transports
+	$result[] = _search('mail', 'mail_transport');
+
+	// mailinglists
+	$result[] = _search('mail', 'mail_mailinglist');
+
+	// getmails
+	$result[] = _search('mail', 'mail_get');
+
+	// dns zones
+	$result[] = _search('dns', 'dns_soa');
+
+	// secondary dns zones
+	$result[] = _search('dns', 'dns_slave');
+
+	// virtual machines
+	$result[] = _search('vm', 'openvz_vm');
+
+	// virtual machines os templates
+	$result[] = _search('vm', 'openvz_ostemplate');
+
+	// virtual machines vm templates
+	$result[] = _search('vm', 'openvz_template');
+
+	// virtual machines ip addresses
+	$result[] = _search('vm', 'openvz_ip');
+
+	// directive snippets
+	$result[] = _search('admin', 'directive_snippets');
+
+	$json = $app->functions->json_encode($result);
+}
 
 //}
 
@@ -161,14 +161,14 @@
 		$search_fields = array();
 		$desc_fields = array();
 		if(is_file('../'.$module.'/form/'.$section.'.tform.php')){
-			include_once('../'.$module.'/form/'.$section.'.tform.php');
-			
+			include_once '../'.$module.'/form/'.$section.'.tform.php';
+
 			$category_title = $form["title"];
 			$form_file = $form["action"];
 			$db_table = $form["db_table"];
 			$db_table_idx = $form["db_table_idx"];
 			$order_by = $db_table_idx;
-			
+
 			if(is_array($form["tabs"]) && !empty($form["tabs"])){
 				foreach($form["tabs"] as $tab){
 					if(is_array($tab['fields']) && !empty($tab['fields'])){
@@ -189,7 +189,7 @@
 			}
 		}
 		unset($form);
-		
+
 		$where_clause = '';
 		if(!empty($search_fields)){
 			$where_clause = implode(' OR ', $search_fields);
@@ -201,17 +201,17 @@
 		if($additional_sql != '') $where_clause .= ' '.$additional_sql.' ';
 		$order_clause = '';
 		if($order_by != '') $order_clause = ' ORDER BY '.$order_by;
-		
+
 		$sql = "SELECT * FROM ".$db_table." WHERE ".$where_clause.$authsql.$order_clause." LIMIT 0,10";
 		$results = $app->db->queryAllRecords($sql);
-		
-		if(is_array($results) && !empty($results)){	
+
+		if(is_array($results) && !empty($results)){
 			$lng_file = '../'.$module.'/lib/lang/'.$_SESSION['s']['language'].'_'.$section.'.lng';
-			if(is_file($lng_file)) include($lng_file);
+			if(is_file($lng_file)) include $lng_file;
 			$result_array['cheader'] = array('title' => $category_title,
-											'total' => count($results),
-											'limit' => count($results)
-											);
+				'total' => count($results),
+				'limit' => count($results)
+			);
 			foreach($results as $result){
 				$description = '';
 				if(!empty($desc_fields)){
@@ -221,18 +221,18 @@
 					}
 					if(!empty($desc_items)) $description = implode(' - ', $desc_items);
 				}
-				
+
 				$result_array['cdata'][] = array('title' => $wb[$title_key.'_txt'].': '.$result[$title_key],
-												'description' => $description,
-												'onclick' => "capp('".$module."','".$module."/".$form_file."?id=".$result[$db_table_idx]."');",
-												'fill_text' => strtolower($result[$title_key])
-												);
-			}	
+					'description' => $description,
+					'onclick' => "capp('".$module."','".$module."/".$form_file."?id=".$result[$db_table_idx]."');",
+					'fill_text' => strtolower($result[$title_key])
+				);
+			}
 		}
 	}
 	return $result_array;
 }
-		
+
 header('Content-type: application/json');
 echo $json;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/dashboard.php b/interface/web/dashboard/dashboard.php
index 0626758..485bb32 100644
--- a/interface/web/dashboard/dashboard.php
+++ b/interface/web/dashboard/dashboard.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dashboard');
@@ -39,7 +39,7 @@
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 //* set Default - Values
@@ -94,12 +94,12 @@
 $info = array();
 
 if(isset($_SESSION['show_info_msg'])) {
-    $info[] = array('info_msg' => '<p>'.$_SESSION['show_info_msg'].'</p>');
-    unset($_SESSION['show_info_msg']);
+	$info[] = array('info_msg' => '<p>'.$_SESSION['show_info_msg'].'</p>');
+	unset($_SESSION['show_info_msg']);
 }
 if(isset($_SESSION['show_error_msg'])) {
-    $app->tpl->setloop('error', array(array('error_msg' => '<p>'.$_SESSION['show_error_msg'].'</p>')));
-    unset($_SESSION['show_error_msg']);
+	$app->tpl->setloop('error', array(array('error_msg' => '<p>'.$_SESSION['show_error_msg'].'</p>')));
+	unset($_SESSION['show_error_msg']);
 }
 
 
@@ -113,7 +113,7 @@
 	}
 	$v1 = ISPC_APP_VERSION;
 	$v2 = $_SESSION['s']['new_ispconfig_version'];
-	$this_version = explode(".",$v1);
+	$this_version = explode(".", $v1);
 	/*
 	$this_fullversion = (($this_version[0] < 10) ? '0'.$this_version[0] : $this_version[0]) .
 			    ((isset($this_version[1]) && $this_version[1] < 10) ? '0'.$this_version[1] : $this_version[1]) .
@@ -121,20 +121,20 @@
 			    ((isset($this_version[3]) && $this_version[3] < 10) ? (($this_version[3] < 1) ? '00' : '0'.$this_version[3]) : @$this_version[3]);
 
 	*/
-	
-	$new_version = explode(".",$v2);
+
+	$new_version = explode(".", $v2);
 	/*
 	$new_fullversion =  (($new_version[0] < 10) ? '0'.$new_version[0] : $new_version[0]) .
 			    ((isset($new_version[1]) && $new_version[1] < 10) ? '0'.$new_version[1] : $new_version[1]) .
 			    ((isset($new_version[2]) && $new_version[2] < 10) ? '0'.$new_version[2] : $new_version[2]) .
 			    ((isset($new_version[3]) && $new_version[3] < 10) ? (($new_version[3] < 1) ? '00' : '0'.$new_version[3]) : @$new_version[3]);
 	*/
-	
-	$this_fullversion = str_pad($this_version[0], 2,'0',STR_PAD_LEFT).str_pad($this_version[1], 2,'0',STR_PAD_LEFT).@str_pad($this_version[2], 2,'0',STR_PAD_LEFT).@str_pad($this_version[3], 2,'0',STR_PAD_LEFT);
-	$new_fullversion = str_pad($new_version[0], 2,'0',STR_PAD_LEFT).str_pad($new_version[1], 2,'0',STR_PAD_LEFT).@str_pad($new_version[2], 2,'0',STR_PAD_LEFT).@str_pad($new_version[3], 2,'0',STR_PAD_LEFT);
+
+	$this_fullversion = str_pad($this_version[0], 2, '0', STR_PAD_LEFT).str_pad($this_version[1], 2, '0', STR_PAD_LEFT).@str_pad($this_version[2], 2, '0', STR_PAD_LEFT).@str_pad($this_version[3], 2, '0', STR_PAD_LEFT);
+	$new_fullversion = str_pad($new_version[0], 2, '0', STR_PAD_LEFT).str_pad($new_version[1], 2, '0', STR_PAD_LEFT).@str_pad($new_version[2], 2, '0', STR_PAD_LEFT).@str_pad($new_version[3], 2, '0', STR_PAD_LEFT);
 	if($new_fullversion > $this_fullversion) {
-		$info[] = array('info_msg' => '<p>There is a new Version of ISPConfig 3 available!</p>' . 
-			'<p>This Version: <b>' . $v1 . '</b></p>' . 
+		$info[] = array('info_msg' => '<p>There is a new Version of ISPConfig 3 available!</p>' .
+			'<p>This Version: <b>' . $v1 . '</b></p>' .
 			'<p>New Version : <b>' . $v2 .  '</b></p>' .
 			'<p><a href="http://www.ispconfig.org/ispconfig-3/download" target="ISPC">See more...</a></p>');
 	}
@@ -144,12 +144,12 @@
 
 /* Load the dashlets*/
 $dashlet_list = array();
-$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..' && !is_dir($file)) {
-        $dashlet_name = substr($file,0,-4);
+$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..' && !is_dir($file)) {
+		$dashlet_name = substr($file, 0, -4);
 		$dashlet_class = 'dashlet_'.$dashlet_name;
-		include_once(ISPC_WEB_PATH.'/dashboard/dashlets/'.$file);
+		include_once ISPC_WEB_PATH.'/dashboard/dashlets/'.$file;
 		$dashlet_list[$dashlet_name] = new $dashlet_class;
 	}
 }
@@ -157,7 +157,7 @@
 
 /* Which dashlets in which column */
 /******************************************************************************/
-$default_leftcol_dashlets = array('modules','invoices','quota','mailquota');
+$default_leftcol_dashlets = array('modules', 'invoices', 'quota', 'mailquota');
 $default_rightcol_dashlets = array('limits');
 
 $app->uses('getconf');
@@ -165,10 +165,10 @@
 //* Client: If the logged in user is not admin and has no sub clients (no reseller)
 if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 	$role = 'client';
-//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
+	//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
 } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 	$role = 'reseller';
-//* Admin: If the logged in user is admin
+	//* Admin: If the logged in user is admin
 } else {
 	$role = 'admin';
 }
@@ -177,7 +177,7 @@
 
 if($dashlets_config[$role.'_dashlets_left'] != ''){
 	preg_match_all('@\[(.*?)\]@', $dashlets_config[$role.'_dashlets_left'], $matches);
-	$leftcol_dashlets = $matches[1]; 
+	$leftcol_dashlets = $matches[1];
 } else {
 	$leftcol_dashlets = $default_leftcol_dashlets;
 }
@@ -212,4 +212,4 @@
 //* Do Output
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/dashlets/limits.php b/interface/web/dashboard/dashlets/limits.php
index 16144f2..2d63925 100644
--- a/interface/web/dashboard/dashlets/limits.php
+++ b/interface/web/dashboard/dashlets/limits.php
@@ -1,136 +1,136 @@
 <?php
 
 class dashlet_limits {
-	
+
 	function show() {
 		global $app, $conf;
-		
+
 		$limits = array();
-		
+
 		/* Limits to be shown*/
-		
+
 		$limits[] = array('field' => 'limit_maildomain',
-						  'db_table' => 'mail_domain',
-						  'db_where' => '');
-						  
+			'db_table' => 'mail_domain',
+			'db_where' => '');
+
 		$limits[] = array('field' => 'limit_mailmailinglist',
-						  'db_table' => 'mail_mailinglist',
-						  'db_where' => '');
-		
+			'db_table' => 'mail_mailinglist',
+			'db_where' => '');
+
 		$limits[] = array('field' => 'limit_mailbox',
-						  'db_table' => 'mail_user',
-						  'db_where' => '');
-		
+			'db_table' => 'mail_user',
+			'db_where' => '');
+
 		$limits[] = array('field' => 'limit_mailalias',
-						  'db_table' => 'mail_forwarding',
-						  'db_where' => "type = 'alias'");
-		
+			'db_table' => 'mail_forwarding',
+			'db_where' => "type = 'alias'");
+
 		$limits[] = array('field' => 'limit_mailaliasdomain',
-						  'db_table' => 'mail_forwarding',
-						  'db_where' => "type = 'aliasdomain'");
-		
+			'db_table' => 'mail_forwarding',
+			'db_where' => "type = 'aliasdomain'");
+
 		$limits[] = array('field' => 'limit_mailforward',
-						  'db_table' => 'mail_forwarding',
-						  'db_where' => "type = 'forward'");
-		
+			'db_table' => 'mail_forwarding',
+			'db_where' => "type = 'forward'");
+
 		$limits[] = array('field' => 'limit_mailcatchall',
-						  'db_table' => 'mail_forwarding',
-						  'db_where' => "type = 'catchall'");
-		
+			'db_table' => 'mail_forwarding',
+			'db_where' => "type = 'catchall'");
+
 		$limits[] = array('field' => 'limit_mailrouting',
-						  'db_table' => 'mail_transport',
-						  'db_where' => "");
-		
+			'db_table' => 'mail_transport',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_mailfilter',
-						  'db_table' => 'mail_user_filter',
-						  'db_where' => "");
-		
+			'db_table' => 'mail_user_filter',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_fetchmail',
-						  'db_table' => 'mail_get',
-						  'db_where' => "");
-		
+			'db_table' => 'mail_get',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_spamfilter_wblist',
-						  'db_table' => 'spamfilter_wblist',
-						  'db_where' => "");
-		
+			'db_table' => 'spamfilter_wblist',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_spamfilter_user',
-						  'db_table' => 'spamfilter_users',
-						  'db_where' => "");
-		
+			'db_table' => 'spamfilter_users',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_spamfilter_policy',
-						  'db_table' => 'spamfilter_policy',
-						  'db_where' => "");
-		
+			'db_table' => 'spamfilter_policy',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_web_domain',
-						  'db_table' => 'web_domain',
-						  'db_where' => "type = 'vhost'");
-		
+			'db_table' => 'web_domain',
+			'db_where' => "type = 'vhost'");
+
 		$limits[] = array('field' => 'limit_web_subdomain',
-						  'db_table' => 'web_domain',
-						  'db_where' => "(type = 'subdomain' OR type = 'vhostsubdomain')");
-		
+			'db_table' => 'web_domain',
+			'db_where' => "(type = 'subdomain' OR type = 'vhostsubdomain')");
+
 		$limits[] = array('field' => 'limit_web_aliasdomain',
-						  'db_table' => 'web_domain',
-						  'db_where' => "type = 'alias'");
-		
+			'db_table' => 'web_domain',
+			'db_where' => "type = 'alias'");
+
 		$limits[] = array('field' => 'limit_ftp_user',
-						  'db_table' => 'ftp_user',
-						  'db_where' => "");
+			'db_table' => 'ftp_user',
+			'db_where' => "");
 
 		$limits[] = array('field' => 'limit_shell_user',
-						  'db_table' => 'shell_user',
-						  'db_where' => "");
-		
+			'db_table' => 'shell_user',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_dns_zone',
-						  'db_table' => 'dns_soa',
-						  'db_where' => "");
+			'db_table' => 'dns_soa',
+			'db_where' => "");
 
 		$limits[] = array('field' => 'limit_dns_slave_zone',
-						  'db_table' => 'dns_slave',
-						  'db_where' => "");
+			'db_table' => 'dns_slave',
+			'db_where' => "");
 
 		$limits[] = array('field' => 'limit_dns_record',
-						  'db_table' => 'dns_rr',
-						  'db_where' => "");
-		
+			'db_table' => 'dns_rr',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_database',
-						  'db_table' => 'web_database',
-						  'db_where' => "");
-		
+			'db_table' => 'web_database',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_cron',
-						  'db_table' => 'cron',
-						  'db_where' => "");
-		
+			'db_table' => 'cron',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_client',
-						  'db_table' => 'client',
-						  'db_where' => "");
-		
-		
-		
-		
+			'db_table' => 'client',
+			'db_where' => "");
+
+
+
+
 		//* Loading Template
 		$app->uses('tpl,tform');
-		
+
 		$tpl = new tpl;
 		$tpl->newTemplate("dashlets/templates/limits.htm");
-		
+
 		$wb = array();
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_limits.lng';
-		if(is_file($lng_file)) include($lng_file);
+		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
-		
+
 		if($app->auth->is_admin()) {
 			$user_is_admin = true;
 		} else {
 			$user_is_admin = false;
 		}
-		$tpl->setVar('is_admin',$user_is_admin);
-		
+		$tpl->setVar('is_admin', $user_is_admin);
+
 		if($user_is_admin == false) {
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 		}
-		
+
 		$rows = array();
 		foreach($limits as $limit) {
 			$field = $limit['field'];
@@ -142,29 +142,29 @@
 			if($value != 0 || $value == $wb['unlimited_txt']) {
 				$value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value;
 				$rows[] = array('field' => $field,
-								'field_txt' => $wb[$field.'_txt'],
-								'value' => $value_formatted,
-								'usage' => $this->_get_limit_usage($limit));
+					'field_txt' => $wb[$field.'_txt'],
+					'value' => $value_formatted,
+					'usage' => $this->_get_limit_usage($limit));
 			}
 		}
-		$tpl->setLoop('rows',$rows);
-		
-		
+		$tpl->setLoop('rows', $rows);
+
+
 		return $tpl->grab();
-		
+
 	}
-	
+
 	function _get_limit_usage($limit) {
 		global $app;
-		
+
 		$sql = "SELECT count(sys_userid) as number FROM ".$limit['db_table']." WHERE ";
 		if($limit['db_where'] != '') $sql .= $limit['db_where']." AND ";
 		$sql .= $app->tform->getAuthSQL('r');
 		$rec = $app->db->queryOneRecord($sql);
 		return $rec['number'];
-		
+
 	}
-	
+
 }
 
 
diff --git a/interface/web/dashboard/dashlets/mailquota.php b/interface/web/dashboard/dashlets/mailquota.php
index dd8d72b..956c4e6 100644
--- a/interface/web/dashboard/dashlets/mailquota.php
+++ b/interface/web/dashboard/dashlets/mailquota.php
@@ -1,21 +1,21 @@
 <?php
 
 class dashlet_mailquota {
-	
+
 	function show() {
 		global $app, $conf;
-		
+
 		//* Loading Template
 		$app->uses('tpl');
-		
+
 		$tpl = new tpl;
 		$tpl->newTemplate("dashlets/templates/mailquota.htm");
-		
+
 		$wb = array();
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_mailquota.lng';
-		if(is_file($lng_file)) include($lng_file);
+		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
-		
+
 		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'email_quota' ORDER BY created DESC");
 		$monitor_data = array();
 		if(is_array($tmp_rec)) {
@@ -33,7 +33,7 @@
 		if($_SESSION["s"]["user"]["typ"] != 'admin'){
 			$sql_where = " AND sys_groupid = ".$_SESSION['s']['user']['default_group'];
 		}
-		
+
 		$has_mailquota = false;
 		// select email accounts belonging to client
 		$emails = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE 1".$sql_where);
@@ -41,11 +41,11 @@
 		if(is_array($emails) && !empty($emails)){
 			for($i=0;$i<sizeof($emails);$i++){
 				$email = $emails[$i]['email'];
-		
+
 				$emails[$i]['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
-		
+
 				if (!is_numeric($emails[$i]['used'])) $emails[$i]['used']=$emails[$i]['used'][1];
-				
+
 				// colours
 				$emails[$i]['display_colour'] = '#000000';
 				if($emails[$i]['quota'] > 0){
@@ -59,28 +59,29 @@
 				if($emails[$i]['quota'] == 0){
 					$emails[$i]['quota'] = $app->lng('unlimited');
 				} else {
-					$emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576,4).' MB';
+					$emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576, 4).' MB';
 				}
 
 
 				if($emails[$i]['used'] < 1544000) {
-					$emails[$i]['used'] = round($emails[$i]['used'] / 1024,4).' KB';
+					$emails[$i]['used'] = round($emails[$i]['used'] / 1024, 4).' KB';
 				} else {
-					$emails[$i]['used'] = round($emails[$i]['used'] / 1048576,4).' MB';
-				} 
-		
+					$emails[$i]['used'] = round($emails[$i]['used'] / 1048576, 4).' MB';
+				}
+
 			}
 			$has_mailquota = true;
 			$tpl->setloop('mailquota', $emails);
 		}
 		//print_r($sites);
-		
-		$tpl->setVar('has_mailquota',$has_mailquota);
-		
+
+		$tpl->setVar('has_mailquota', $has_mailquota);
+
 		return $tpl->grab();
-		
-		
+
+
 	}
+
 }
 
 
@@ -90,4 +91,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/dashlets/modules.php b/interface/web/dashboard/dashlets/modules.php
index 2f16329..1b1d2ef 100644
--- a/interface/web/dashboard/dashlets/modules.php
+++ b/interface/web/dashboard/dashlets/modules.php
@@ -1,21 +1,21 @@
 <?php
 
 class dashlet_modules {
-	
+
 	function show() {
 		global $app, $conf;
-		
+
 		//* Loading Template
 		$app->uses('tpl');
-		
+
 		$tpl = new tpl;
 		$tpl->newTemplate("dashlets/templates/modules.htm");
-		
+
 		$wb = array();
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_modules.lng';
-		if(is_file($lng_file)) include($lng_file);
+		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
-		
+
 		/*
 		 * Show all modules, the user is allowed to use
 		*/
@@ -25,28 +25,29 @@
 			foreach($modules as $mt) {
 				if(is_file('../' . $mt . '/lib/module.conf.php')) {
 					if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
-					include_once('../' . $mt.'/lib/module.conf.php');
+					include_once '../' . $mt.'/lib/module.conf.php';
 					/* We don't want to show the dashboard */
 					if ($mt != 'dashboard') {
 						$module_title = $app->lng($module['title']);
 						if(function_exists('mb_strlen')) {
-							if(mb_strlen($module_title,"UTF-8") > 8) $module_title = mb_substr($module_title,0,7,"UTF-8").'..';
+							if(mb_strlen($module_title, "UTF-8") > 8) $module_title = mb_substr($module_title, 0, 7, "UTF-8").'..';
 						} else {
-							if(strlen($module_title) > 8) $module_title = substr($module_title,0,7).'..';
+							if(strlen($module_title) > 8) $module_title = substr($module_title, 0, 7).'..';
 						}
-						$mod[] = array(	'modules_title' 	=> $module_title,
-								'modules_startpage'	=> $module['startpage'],
-								'modules_name'  	=> $module['name']);
+						$mod[] = array( 'modules_title'  => $module_title,
+							'modules_startpage' => $module['startpage'],
+							'modules_name'   => $module['name']);
 					}
 				}
 			}
 
 			$tpl->setloop('modules', $mod);
 		}
-		
+
 		return $tpl->grab();
-		
+
 	}
+
 }
 
 
@@ -56,4 +57,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/dashlets/quota.php b/interface/web/dashboard/dashlets/quota.php
index 29d1d3b..1cb5671 100644
--- a/interface/web/dashboard/dashlets/quota.php
+++ b/interface/web/dashboard/dashlets/quota.php
@@ -1,33 +1,33 @@
 <?php
 
 class dashlet_quota {
-	
+
 	function show() {
 		global $app, $conf;
-		
+
 		//* Loading Template
 		$app->uses('tpl');
-		
+
 		$tpl = new tpl;
 		$tpl->newTemplate("dashlets/templates/quota.htm");
-		
+
 		$wb = array();
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_quota.lng';
-		if(is_file($lng_file)) include($lng_file);
+		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
-		
+
 		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
 		$monitor_data = array();
 		if(is_array($tmp_rec)) {
 			foreach ($tmp_rec as $tmp_mon) {
-				$monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
+				$monitor_data = array_merge_recursive($monitor_data, unserialize($app->db->unquote($tmp_mon['data'])));
 			}
 		}
 		//print_r($monitor_data);
 		if($_SESSION["s"]["user"]["typ"] != 'admin'){
 			$sql_where = " AND sys_groupid = ".$_SESSION['s']['user']['default_group'];
 		}
-		
+
 		$has_quota = false;
 		// select websites belonging to client
 		$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'".$sql_where);
@@ -39,7 +39,7 @@
 				$sites[$i]['soft'] = $monitor_data['user'][$username]['soft'];
 				$sites[$i]['hard'] = $monitor_data['user'][$username]['hard'];
 				$sites[$i]['files'] = $monitor_data['user'][$username]['files'];
-				
+
 				if (!is_numeric($sites[$i]['used'])){
 					if ($sites[$i]['used'][0] > $sites[$i]['used'][1]){
 						$sites[$i]['used'] = $sites[$i]['used'][0];
@@ -50,7 +50,7 @@
 				if (!is_numeric($sites[$i]['soft'])) $sites[$i]['soft']=$sites[$i]['soft'][1];
 				if (!is_numeric($sites[$i]['hard'])) $sites[$i]['hard']=$sites[$i]['hard'][1];
 				if (!is_numeric($sites[$i]['files'])) $sites[$i]['files']=$sites[$i]['files'][1];
-				
+
 				// colours
 				$sites[$i]['display_colour'] = '#000000';
 				if($sites[$i]['soft'] > 0){
@@ -60,50 +60,51 @@
 				}
 				if($used_ratio >= 0.8) $sites[$i]['display_colour'] = '#fd934f';
 				if($used_ratio >= 1) $sites[$i]['display_colour'] = '#cc0000';
-		
+
 				if($sites[$i]['used'] > 1024) {
-					$sites[$i]['used'] = round($sites[$i]['used'] / 1024,2).' MB';
+					$sites[$i]['used'] = round($sites[$i]['used'] / 1024, 2).' MB';
 				} else {
 					if ($sites[$i]['used'] != '') $sites[$i]['used'] .= ' KB';
 				}
-		
+
 				if($sites[$i]['soft'] > 1024) {
-					$sites[$i]['soft'] = round($sites[$i]['soft'] / 1024,2).' MB';
+					$sites[$i]['soft'] = round($sites[$i]['soft'] / 1024, 2).' MB';
 				} else {
 					$sites[$i]['soft'] .= ' KB';
 				}
-		
+
 				if($sites[$i]['hard'] > 1024) {
-					$sites[$i]['hard'] = round($sites[$i]['hard'] / 1024,2).' MB';
+					$sites[$i]['hard'] = round($sites[$i]['hard'] / 1024, 2).' MB';
 				} else {
 					$sites[$i]['hard'] .= ' KB';
 				}
-		
+
 				if($sites[$i]['soft'] == " KB") $sites[$i]['soft'] = $app->lng('unlimited');
 				if($sites[$i]['hard'] == " KB") $sites[$i]['hard'] = $app->lng('unlimited');
-		
-		
+
+
 				/*
 				if(!strstr($sites[$i]['used'],'M') && !strstr($sites[$i]['used'],'K')) $sites[$i]['used'].= ' B';
 				if(!strstr($sites[$i]['soft'],'M') && !strstr($sites[$i]['soft'],'K')) $sites[$i]['soft'].= ' B';
 				if(!strstr($sites[$i]['hard'],'M') && !strstr($sites[$i]['hard'],'K')) $sites[$i]['hard'].= ' B';
 				*/
-		
+
 				if($sites[$i]['soft'] == '0 B' || $sites[$i]['soft'] == '0 KB' || $sites[$i]['soft'] == '0') $sites[$i]['soft'] = $app->lng('unlimited');
 				if($sites[$i]['hard'] == '0 B' || $sites[$i]['hard'] == '0 KB' || $sites[$i]['hard'] == '0') $sites[$i]['hard'] = $app->lng('unlimited');
-		
+
 			}
 			$has_quota = true;
 			$tpl->setloop('quota', $sites);
 		}
 		//print_r($sites);
-		
-		$tpl->setVar('has_quota',$has_quota);
-		
+
+		$tpl->setVar('has_quota', $has_quota);
+
 		return $tpl->grab();
-		
-		
+
+
 	}
+
 }
 
 
@@ -113,4 +114,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/lib/admin.conf.php b/interface/web/dashboard/lib/admin.conf.php
index 584f28b..b4b2eb9 100644
--- a/interface/web/dashboard/lib/admin.conf.php
+++ b/interface/web/dashboard/lib/admin.conf.php
@@ -26,4 +26,4 @@
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/lib/custom_menu.inc.php b/interface/web/dashboard/lib/custom_menu.inc.php
index 8796023..b71bd16 100644
--- a/interface/web/dashboard/lib/custom_menu.inc.php
+++ b/interface/web/dashboard/lib/custom_menu.inc.php
@@ -38,24 +38,24 @@
 
 
 switch($_SESSION['s']['user']['typ']) {
-	case 'admin':
-		$atom_url = $misc_config['dashboard_atom_url_admin'];
-		break;
-	case 'user':
-		if ($app->auth->has_clients($_SESSION['s']['user']['userid']) === true)
-			$atom_url = $misc_config['dashboard_atom_url_reseller'];
-		else
-			$atom_url = $misc_config['dashboard_atom_url_client'];
-		break;
-	default:
-		$atom_url = "";
+case 'admin':
+	$atom_url = $misc_config['dashboard_atom_url_admin'];
+	break;
+case 'user':
+	if ($app->auth->has_clients($_SESSION['s']['user']['userid']) === true)
+		$atom_url = $misc_config['dashboard_atom_url_reseller'];
+	else
+		$atom_url = $misc_config['dashboard_atom_url_client'];
+	break;
+default:
+	$atom_url = "";
 }
 
 $rows = array();
 
 if( $atom_url != '' ) {
 	if(!isset($_SESSION['s']['rss_news'])) {
-		
+
 		$app->simplepie->set_feed_url($atom_url);
 		$app->simplepie->enable_cache(false);
 		$app->simplepie->init();
@@ -69,24 +69,24 @@
 			//* We want to show only the first 10 news records
 			if($n <= 10) {
 				$rows[] = array('title' => $item->get_title(),
-								'link' => $item->get_link(),
-								'content' => $item->get_content(),
-								'date' => $item->get_date('Y-m-d')
-								);
+					'link' => $item->get_link(),
+					'content' => $item->get_content(),
+					'date' => $item->get_date('Y-m-d')
+				);
 			}
 			$n++;
 		}
-		
+
 		$_SESSION['s']['rss_news'] = $rows;
-		
+
 	} else {
 		$rows = $_SESSION['s']['rss_news'];
 	}
-	
-	$app->tpl->setVar('latest_news_txt',$app->lng('latest_news_txt'));
+
+	$app->tpl->setVar('latest_news_txt', $app->lng('latest_news_txt'));
 
 }
 
-$app->tpl->setLoop('news',$rows);
+$app->tpl->setLoop('news', $rows);
 
 ?>
diff --git a/interface/web/dashboard/lib/module.conf.php b/interface/web/dashboard/lib/module.conf.php
index 337d6b7..67f769e 100644
--- a/interface/web/dashboard/lib/module.conf.php
+++ b/interface/web/dashboard/lib/module.conf.php
@@ -27,22 +27,22 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-$module['name'] 		= 'dashboard'; 
-$module['title'] 		= 'top_menu_dashboard';
-$module['template'] 	= 'dashboard.tpl.htm';
-$module['startpage'] 	= 'dashboard/dashboard.php';
+$module['name']   = 'dashboard';
+$module['title']   = 'top_menu_dashboard';
+$module['template']  = 'dashboard.tpl.htm';
+$module['startpage']  = 'dashboard/dashboard.php';
 $module['tab_width']    = '';
 
 //$items = array();
 //
-//$items[] = array( 'title' 	=> 'Dashboard 1',
-//				  'target' 	=> 'content',
-//				  'link'	=> 'dashboard/dashboard.php');
+//$items[] = array( 'title'  => 'Dashboard 1',
+//      'target'  => 'content',
+//      'link' => 'dashboard/dashboard.php');
 //
-//$module['nav'][] = array(	'title'	=> 'Dashboard 2',
-//							'open' 	=> 1,
-//							'items'	=> $items);
+//$module['nav'][] = array( 'title' => 'Dashboard 2',
+//       'open'  => 1,
+//       'items' => $items);
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/form_edit.php b/interface/web/designer/form_edit.php
index 90acd2e..2127fea 100644
--- a/interface/web/designer/form_edit.php
+++ b/interface/web/designer/form_edit.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,15 +39,15 @@
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/form_edit.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.");
+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;
 
@@ -59,52 +59,52 @@
 		$action = 'INSERT';
 	}
 
-	
+
 	if($error == '') {
-		
+
 		$filename = "../".$module_name."/form/".$form_name.".tform.php";
 		$form_new = $_POST["form"];
-		
+
 		if(@is_file($filename)) {
-			include_once($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; 
-		} 
-    
+		$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;
-			
+		header("Location: form_list.php");
+		exit;
+
 	} else {
-		$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
+		$app->tpl->setVar("error", "<b>Fehler:</b><br>".$error);
 		$app->tpl->setVar($_POST);
 	}
 }
 
 if($id != '') {
-// Datensatz besteht bereits
+	// Datensatz besteht bereits
 	// bestehenden Datensatz anzeigen
 	if($error == '') {
 		// es liegt ein Fehler vor
-		include_once("../".$module_name."/form/".$form_name.".tform.php");
+		include_once "../".$module_name."/form/".$form_name.".tform.php";
 		//$tabs = $form["tabs"];
 		unset($form["tabs"]);
 		$record = $form;
@@ -123,7 +123,7 @@
 	}
 	$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
 } else {
-// neuer datensatz
+	// neuer datensatz
 	if($error == '') {
 		// es liegt kein Fehler vor
 		// Pewsets
@@ -132,7 +132,7 @@
 		// ein Fehler
 		$record = $_POST;
 		unset($_POST["tabs"]);
-		
+
 	}
 	$record["readonly"] = '';
 }
@@ -141,7 +141,7 @@
 
 $app->tpl->setVar($record);
 
-include_once("lib/lang/".$_SESSION["s"]["language"]."_form_edit.lng");
+include_once "lib/lang/".$_SESSION["s"]["language"]."_form_edit.lng";
 $app->tpl->setVar($wb);
 
 // Defaultwerte setzen
@@ -150,4 +150,4 @@
 // 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 6bd8bc6..0093275 100644
--- a/interface/web/designer/form_list.php
+++ b/interface/web/designer/form_list.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('designer');
@@ -40,50 +40,50 @@
 
 function getinfo($file, $form_file, $bgcolor) {
 	$module_name = $file;
-	include(ISPC_WEB_PATH."/$file/form/$form_file");
-	return array( 	'name' =>        $form['name'],
-					'title' =>       $form['title'],
-					'description' => $form['description'],
-					'module_name' => $module_name,
-					'bgcolor' =>     $bgcolor
-                );
+	include ISPC_WEB_PATH."/$file/form/$form_file";
+	return array(  'name' =>        $form['name'],
+		'title' =>       $form['title'],
+		'description' => $form['description'],
+		'module_name' => $module_name,
+		'bgcolor' =>     $bgcolor
+	);
 }
 
 // lese Module aus
 $bgcolor = '#FFFFFF';
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH.'/'.$file.'/lib/module.conf.php') and $file != 'login') {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH.'/'.$file.'/lib/module.conf.php') and $file != 'login') {
 				if(@is_dir(ISPC_WEB_PATH."/$file/form")) {
 					$handle2 = opendir(ISPC_WEB_PATH."/$file/form");
-					while ($form_file = @readdir ($handle2)) {
-						if (substr($form_file,0,1) != ".") {
-						    //echo ISPC_ROOT_PATH."/web/".$file."/form/$form_file<br>";
+					while ($form_file = @readdir($handle2)) {
+						if (substr($form_file, 0, 1) != ".") {
+							//echo ISPC_ROOT_PATH."/web/".$file."/form/$form_file<br>";
 							//include_once(ISPC_ROOT_PATH."/web/".$file."/form/$form_file");
 							// Farbwechsel
-							$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';				
+							$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 							$modules_list[] = getinfo($file, $form_file, $bgcolor);
 
 						}
 					}
 				}
 			}
-        }
+		}
 	}
 }
 
 $app->tpl->setLoop('records', $modules_list);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_form_list.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/form_show.php b/interface/web/designer/form_show.php
index 4cb8056..74e609b 100644
--- a/interface/web/designer/form_show.php
+++ b/interface/web/designer/form_show.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('designer');
@@ -38,26 +38,26 @@
 $app->uses('tpl');
 
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/form_show.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.");
+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");
+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 
+// loading language file
 $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_form_show.lng";
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 // baue Tabs navi
@@ -65,8 +65,8 @@
 $n1 = 0;
 $n2 = 0;
 if(is_array($tabs)) {
-foreach($tabs as $tab_id => $tab) {
-	$content .= "<tr>
+	foreach($tabs as $tab_id => $tab) {
+		$content .= "<tr>
     <td colspan='2' class='frmText11'>
 	  <table width='100%'>
 	  	<tr>
@@ -79,12 +79,12 @@
 		  <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>
+		//$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\" />
@@ -93,14 +93,14 @@
 		  <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>
+			$n2++;
+		}
+		$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
 	  </table>
 	</td>
   </tr>";
-	$n1++;
-}
+		$n1++;
+	}
 }
 
 $record["nav"] = $content;
@@ -109,11 +109,11 @@
 $app->tpl->setVar($record);
 
 
-$app->tpl->setLoop('records',$modules_list);
+$app->tpl->setLoop('records', $modules_list);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/index.php b/interface/web/designer/index.php
index e69de29..8b13789 100644
--- a/interface/web/designer/index.php
+++ b/interface/web/designer/index.php
@@ -0,0 +1 @@
+
diff --git a/interface/web/designer/lib/admin.conf.php b/interface/web/designer/lib/admin.conf.php
index dc10d56..6eff33c 100644
--- a/interface/web/designer/lib/admin.conf.php
+++ b/interface/web/designer/lib/admin.conf.php
@@ -1,4 +1,4 @@
 <?php
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/lib/module.conf.php b/interface/web/designer/lib/module.conf.php
index 117f79b..6104f49 100644
--- a/interface/web/designer/lib/module.conf.php
+++ b/interface/web/designer/lib/module.conf.php
@@ -1,47 +1,47 @@
 <?php
 $module = array (
-  'name' => 'designer',
-  'title' => 'BE Designer',
-  'template' => 'module.tpl.htm',
-  'navframe_page' => '',
-  'startpage' => 'designer/module_list.php',
-  'tab_width' => '',
-  'nav' => 
-  array (
-    0 => 
-    array (
-      'title' => 'Modules',
-      'open' => '1',
-      'items' => 
-      array (
-        0 => 
-        array (
-          'title' => 'Add',
-          'target' => 'content',
-          'link' => 'designer/module_edit.php',
-        ),
-        1 => 
-        array (
-          'title' => 'Edit',
-          'target' => 'content',
-          'link' => 'designer/module_list.php',
-        ),
-      ),
-    ),
-    /*
-	1 => 
+	'name' => 'designer',
+	'title' => 'BE Designer',
+	'template' => 'module.tpl.htm',
+	'navframe_page' => '',
+	'startpage' => 'designer/module_list.php',
+	'tab_width' => '',
+	'nav' =>
+	array (
+		0 =>
+		array (
+			'title' => 'Modules',
+			'open' => '1',
+			'items' =>
+			array (
+				0 =>
+				array (
+					'title' => 'Add',
+					'target' => 'content',
+					'link' => 'designer/module_edit.php',
+				),
+				1 =>
+				array (
+					'title' => 'Edit',
+					'target' => 'content',
+					'link' => 'designer/module_list.php',
+				),
+			),
+		),
+		/*
+	1 =>
     array (
       'title' => 'Formulare',
       'open' => '1',
-      'items' => 
+      'items' =>
       array (
-        2 => 
+        2 =>
         array (
           'title' => 'Add',
           'target' => 'content',
           'link' => 'designer/form_edit.php',
         ),
-        3 => 
+        3 =>
         array (
           'title' => 'Edit',
           'target' => 'content',
@@ -49,19 +49,19 @@
         ),
       ),
     ),
-    2 => 
+    2 =>
     array (
       'title' => 'Lists',
       'open' => '1',
-      'items' => 
+      'items' =>
       array (
-        4 => 
+        4 =>
         array (
           'title' => 'Add',
           'target' => 'content',
           'link' => 'designer/list_edit.php',
         ),
-        5 => 
+        5 =>
         array (
           'title' => 'Edit',
           'target' => 'content',
@@ -69,19 +69,19 @@
         ),
       ),
     ),
-    3 => 
+    3 =>
     array (
       'title' => 'Languages',
       'open' => '1',
-      'items' => 
+      'items' =>
       array (
-        6 => 
+        6 =>
         array (
           'title' => 'Add',
           'target' => 'content',
           'link' => 'designer/lang_edit.php',
         ),
-        7 => 
+        7 =>
         array (
           'title' => 'Edit',
           'target' => 'content',
@@ -90,6 +90,6 @@
       ),
     ),
 	*/
-  ),
+	),
 )
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_edit.php b/interface/web/designer/module_edit.php
index 26e229a..af7dbb0 100644
--- a/interface/web/designer/module_edit.php
+++ b/interface/web/designer/module_edit.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,11 +39,11 @@
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_edit.htm');
 
 // ID importieren
 $id = $_REQUEST["id"];
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$id)) die("id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $id)) die("id contains invalid chars.");
 
 if(count($_POST) > 1) {
 	// Bestimme aktion
@@ -53,24 +53,24 @@
 		$action = 'INSERT';
 	}
 
-	
+
 	if($error == '') {
-		
+
 		$id = $_POST["module"]["name"];
-		if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$id)) die("id contains invalid chars.");
-		
+		if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $id)) die("id contains invalid chars.");
+
 		$filename = "../".$id."/lib/module.conf.php";
 		$module_new = $_POST["module"];
-		
+
 		if(@is_file($filename)) {
-			include_once($filename);
+			include_once $filename;
 			$navi = $module["nav"];
 			unset($module);
 			$module_new["nav"] = $navi;
 		}
-		
-		$m = "<?php\r\n".'$module = '.var_export($module_new,true)."\r\n?>";
-		
+
+		$m = "<?php\r\n".'$module = '.var_export($module_new, true)."\r\n?>";
+
 		// creating the module directories
 		if(!@is_dir("../".$id)) mkdir("../".$id) or die("Cannot make directory: ../".$id);
 		if(!@is_dir("../".$id."/lib")) mkdir("../".$id."/lib") or die("Cannot make directory: ../".$id."/lib");
@@ -78,52 +78,52 @@
 		if(!@is_dir("../".$id."/form")) mkdir("../".$id."/form") or die("Cannot make directory: ../".$id."/form");
 		if(!@is_dir("../".$id."/list")) mkdir("../".$id."/list") or die("Cannot make directory: ../".$id."/list");
 		if(!@is_dir("../".$id."/templates")) mkdir("../".$id."/templates") or die("Cannot make directory: ../".$id."/templates");
-		
-		// writing module.conf
-		if (!$handle = fopen($filename, 'w')) { 
-			print "Cannot open file ($filename)"; 
-			exit; 
-		} 
 
-		if (!fwrite($handle, $m)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
-		} 
-    
+		// writing module.conf
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $m)) {
+			print "Cannot write to file ($filename)";
+			exit;
+		}
+
 		fclose($handle);
-		
+
 		// writing admin conf
 		$admin_conf_filename = "../".$id."/lib/admin.conf.php";
 		if(!is_file($admin_conf_filename)) {
-			if (!$handle = fopen($admin_conf_filename, 'w')) { 
-				print "Cannot open file ($admin_conf_filename)"; 
-				exit; 
-			} 
+			if (!$handle = fopen($admin_conf_filename, 'w')) {
+				print "Cannot open file ($admin_conf_filename)";
+				exit;
+			}
 
-			if (!fwrite($handle, "<?php\r\n?>")) { 
-				print "Cannot write to file ($admin_conf_filename)"; 
-				exit; 
-			} 
-    
-			fclose($handle); 
+			if (!fwrite($handle, "<?php\r\n?>")) {
+				print "Cannot write to file ($admin_conf_filename)";
+				exit;
+			}
+
+			fclose($handle);
 		}
-		
+
 		// zu Liste springen
-    	header("Location: module_list.php");
-        exit;
-			
+		header("Location: module_list.php");
+		exit;
+
 	} else {
-		$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
+		$app->tpl->setVar("error", "<b>Fehler:</b><br>".$error);
 		$app->tpl->setVar($_POST);
 	}
 }
 
 if($id != '') {
-// Datensatz besteht bereits
+	// Datensatz besteht bereits
 	// bestehenden Datensatz anzeigen
 	if($error == '') {
 		// es liegt ein Fehler vor
-		include_once("../".$id."/lib/module.conf.php");
+		include_once "../".$id."/lib/module.conf.php";
 		//$navi = $module["nav"];
 		unset($module["nav"]);
 		$record = $module;
@@ -135,7 +135,7 @@
 	}
 	$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
 } else {
-// neuer datensatz
+	// neuer datensatz
 	if($error == '') {
 		// es liegt ein Fehler vor
 		$record["template"] = "module.tpl.htm";
@@ -144,7 +144,7 @@
 		$record = $_POST;
 		//$navi = $_POST["nav"];
 		unset($_POST["nav"]);
-		
+
 	}
 	$record["readonly"] = '';
 }
@@ -172,7 +172,7 @@
 
 $app->tpl->setVar($record);
 
-include_once("lib/lang/".$_SESSION["s"]["language"]."_module_edit.lng");
+include_once "lib/lang/".$_SESSION["s"]["language"]."_module_edit.lng";
 $app->tpl->setVar($wb);
 
 // Defaultwerte setzen
@@ -181,4 +181,4 @@
 // Template parsen
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_list.php b/interface/web/designer/module_list.php
index 92aa4f0..b08707e 100644
--- a/interface/web/designer/module_list.php
+++ b/interface/web/designer/module_list.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('designer');
@@ -36,34 +36,34 @@
 $app->uses('tpl');
 
 $app->tpl->newTemplate('form.tpl.htm');
-$app->tpl->setInclude('content_tpl','templates/module_list.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_list.htm');
 
 //* Pick out modules
 $bgcolor = '#FFFFFF';
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
-				include_once(ISPC_WEB_PATH."/$file/lib/module.conf.php");
-				$modules_list[] = array( 	'module' =>   $module['name'],
-											'title' =>    $module['title'],
-											'bgcolor' =>  ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'
-                                        );
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
+				include_once ISPC_WEB_PATH."/$file/lib/module.conf.php";
+				$modules_list[] = array(  'module' =>   $module['name'],
+					'title' =>    $module['title'],
+					'bgcolor' =>  ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'
+				);
 			}
-        }
+		}
 	}
 }
 
 $app->tpl->setLoop('records', $modules_list);
 
-//* loading language file 
+//* loading language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_module_list.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_del.php b/interface/web/designer/module_nav_del.php
index b0fd55a..c5781d9 100644
--- a/interface/web/designer/module_nav_del.php
+++ b/interface/web/designer/module_nav_del.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
@@ -39,43 +39,43 @@
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
 $nav_id = $_REQUEST["nav_id"];
 
-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}$/',$nav_id)) die("nav_id contains invalid chars.");
+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}$/', $nav_id)) die("nav_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
 if($nav_id != '') {
 
 	$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 	if(!@is_file($filename)) die("File not found: $filename");
-	include_once($filename);
-	
+	include_once $filename;
+
 	unset($module["nav"][$nav_id]);
-	
-	$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-			
+
+	$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 	// writing module.conf
-	if (!$handle = fopen($filename, 'w')) { 
-		print "Cannot open file ($filename)"; 
-		exit; 
-	} 
-	if (!fwrite($handle, $m)) { 
-		print "Cannot write to file ($filename)"; 
-		exit; 
-	} 
-   
+	if (!$handle = fopen($filename, 'w')) {
+		print "Cannot open file ($filename)";
+		exit;
+	}
+	if (!fwrite($handle, $m)) {
+		print "Cannot write to file ($filename)";
+		exit;
+	}
+
 	fclose($handle);
-	
-	
+
+
 	// zu Liste springen
-   	header("Location: module_show.php?id=$module_name");
-    exit;
+	header("Location: module_show.php?id=$module_name");
+	exit;
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_edit.php b/interface/web/designer/module_nav_edit.php
index a7acf40..e7e63e1 100644
--- a/interface/web/designer/module_nav_edit.php
+++ b/interface/web/designer/module_nav_edit.php
@@ -27,12 +27,12 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Security checkpoint
 if($_SESSION['s']['user']['typ'] != 'admin'){
-    die('Admin permissions required.');
+	die('Admin permissions required.');
 }
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
 
@@ -50,61 +50,61 @@
 
 //** Sanity checks of module
 if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)){
-    die('module_name contains invalid chars.');
+	die('module_name contains invalid chars.');
 }
 if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $nav_id)){
-    die('nav_id contains invalid chars.');
+	die('nav_id contains invalid chars.');
 }
 if(empty($module_name)){
-    die('module is empty.');
+	die('module is empty.');
 }
 
 if(count($_POST) > 0) {
 	//* Determine Action
 	$action = ($nav_id != '') ? 'UPDATE' : 'INSERT';
 	$error = '';
-	
+
 	// TODO: Check variables
-	
+
 	if($error == '') {
-	
+
 		$filename = '../'.$module_name.'/lib/module.conf.php';
-		
+
 		if(!@is_file($filename)){
-            die("File not found: $filename");
-        }
-		include_once($filename);
-		
-        $items = ($action == 'UPDATE') ?  $module['nav'][$nav_id]['items'] : array();
-		
+			die("File not found: $filename");
+		}
+		include_once $filename;
+
+		$items = ($action == 'UPDATE') ?  $module['nav'][$nav_id]['items'] : array();
+
 		$tmp = array('title' => $_POST['nav']['title'],
-					 'open' =>  1,
-					 'items' => $items);
-        
+			'open' =>  1,
+			'items' => $items);
+
 		if($action == 'UPDATE') {
 			$module['nav'][$nav_id] = $tmp;
 		} else {
 			$module['nav'][] = $tmp;
 		}
-		
-		$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-				
-		//* writing module.conf
-		if (!$handle = fopen($filename, 'w')) { 
-			die("Cannot open file ($filename)"); 
-		} 
 
-		if (!fwrite($handle, $m)) { 
-			die("Cannot write to file ($filename)"); 
-		} 
-    
+		$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
+		//* writing module.conf
+		if (!$handle = fopen($filename, 'w')) {
+			die("Cannot open file ($filename)");
+		}
+
+		if (!fwrite($handle, $m)) {
+			die("Cannot write to file ($filename)");
+		}
+
 		fclose($handle);
-		
-		
+
+
 		//* Jump to list
-    	header('Location: module_show.php?id='.urlencode($module_name));
-        exit;
-			
+		header('Location: module_show.php?id='.urlencode($module_name));
+		exit;
+
 	} else {
 		$app->tpl->setVar('error', '<b>Fehler:</b><br>'.$error);
 		$app->tpl->setVar($_POST);
@@ -112,9 +112,9 @@
 }
 
 if($nav_id != '') {
-    //* Data record exists
+	//* Data record exists
 	if($error == '') {
-		include_once('../'.$module_name.'/lib/module.conf.php');
+		include_once '../'.$module_name.'/lib/module.conf.php';
 		$record = $module['nav'][$nav_id];
 	} else {
 		//* error
@@ -122,13 +122,13 @@
 	}
 	//$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
 } else {
-    //* New data record
+	//* New data record
 	if($error == '') {
 		//* es liegt kein Fehler vor
 	} else {
 		//* error
 		$record = $_POST;
-		
+
 	}
 	//$record["readonly"] = '';
 }
@@ -138,10 +138,10 @@
 
 $app->tpl->setVar($record);
 
-include_once('lib/lang/'.$_SESSION['s']['language'].'_module_nav_edit.lng');
+include_once 'lib/lang/'.$_SESSION['s']['language'].'_module_nav_edit.lng';
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_flip.php b/interface/web/designer/module_nav_flip.php
index 6599a5f..09cdd17 100644
--- a/interface/web/designer/module_nav_flip.php
+++ b/interface/web/designer/module_nav_flip.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
@@ -39,54 +39,54 @@
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
 $nav_id = $_REQUEST["nav_id"];
 $dir = $_REQUEST["dir"];
 
-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}$/',$nav_id)) die("nav_id contains invalid chars.");
+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}$/', $nav_id)) die("nav_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
 if($nav_id != '') {
 
 	$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 	if(!@is_file($filename)) die("File not found: $filename");
-	include_once($filename);
-	
+	include_once $filename;
+
 	if($dir == 'up' and $nav_id > 0) {
 		$tmp = $module["nav"][$nav_id - 1];
 		$module["nav"][$nav_id - 1] = $module["nav"][$nav_id];
 		$module["nav"][$nav_id] = $tmp;
 	}
-	
+
 	if($dir == 'down' and $nav_id < count($module["nav"]) -1) {
 		$tmp = $module["nav"][$nav_id + 1];
 		$module["nav"][$nav_id + 1] = $module["nav"][$nav_id];
 		$module["nav"][$nav_id] = $tmp;
 	}
-	
-	$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-			
+
+	$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 	// writing module.conf
-	if (!$handle = fopen($filename, 'w')) { 
-		print "Cannot open file ($filename)"; 
-		exit; 
-	} 
-	if (!fwrite($handle, $m)) { 
-		print "Cannot write to file ($filename)"; 
-		exit; 
-	} 
-   
+	if (!$handle = fopen($filename, 'w')) {
+		print "Cannot open file ($filename)";
+		exit;
+	}
+	if (!fwrite($handle, $m)) {
+		print "Cannot write to file ($filename)";
+		exit;
+	}
+
 	fclose($handle);
-	
-	
+
+
 	// zu Liste springen
-   	echo "HEADER_REDIRECT:designer/module_show.php?id=$module_name";
-    exit;
+	echo "HEADER_REDIRECT:designer/module_show.php?id=$module_name";
+	exit;
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_item_del.php b/interface/web/designer/module_nav_item_del.php
index 6360c46..66a17b5 100644
--- a/interface/web/designer/module_nav_item_del.php
+++ b/interface/web/designer/module_nav_item_del.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,45 +39,45 @@
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
 $nav_id = $_REQUEST["nav_id"];
 $item_id = $_REQUEST["item_id"];
 
-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}$/',$nav_id)) die("nav_id contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$item_id)) die("item_id contains invalid chars.");
+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}$/', $nav_id)) die("nav_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $item_id)) die("item_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
 if($nav_id != '') {
 
 	$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 	if(!@is_file($filename)) die("File not found: $filename");
-	include_once($filename);
-	
+	include_once $filename;
+
 	unset($module["nav"][$nav_id]["items"][$item_id]);
-	
-	$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-			
+
+	$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 	// writing module.conf
-	if (!$handle = fopen($filename, 'w')) { 
-		print "Cannot open file ($filename)"; 
-		exit; 
-	} 
-	if (!fwrite($handle, $m)) { 
-		print "Cannot write to file ($filename)"; 
-		exit; 
-	} 
-   
+	if (!$handle = fopen($filename, 'w')) {
+		print "Cannot open file ($filename)";
+		exit;
+	}
+	if (!fwrite($handle, $m)) {
+		print "Cannot write to file ($filename)";
+		exit;
+	}
+
 	fclose($handle);
-	
-	
+
+
 	// zu Liste springen
-   	header("Location: module_show.php?id=$module_name");
-    exit;
+	header("Location: module_show.php?id=$module_name");
+	exit;
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_item_edit.php b/interface/web/designer/module_nav_item_edit.php
index 21e1e35..2faff74 100644
--- a/interface/web/designer/module_nav_item_edit.php
+++ b/interface/web/designer/module_nav_item_edit.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,16 +39,16 @@
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_item_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_item_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
 $nav_id = $_REQUEST["nav_id"];
 $item_id = $_REQUEST["item_id"];
 
-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}$/',$nav_id)) die("nav_id contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$item_id)) die("item_id contains invalid chars.");
+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}$/', $nav_id)) die("nav_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $item_id)) die("item_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
@@ -59,61 +59,61 @@
 	} else {
 		$action = 'INSERT';
 	}
-	
+
 	$error = '';
-	
+
 	// TODO: Check variables
 
-	
+
 	if($error == '') {
-	
+
 		$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 		if(!@is_file($filename)) die("File not found: $filename");
-		include_once($filename);
-		
+		include_once $filename;
+
 		$tmp = array('title' =>$_POST["title"],
-					 'target' => $_POST["target"],
-					 'link' => $_POST["link"]);
-		
+			'target' => $_POST["target"],
+			'link' => $_POST["link"]);
+
 		if($action == 'UPDATE') {
 			$module["nav"][$nav_id]["items"][$item_id] = $tmp;
 		} else {
 			$module["nav"][$nav_id]["items"][] = $tmp;
 		}
-		
-		$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-				
-		// writing module.conf
-		if (!$handle = fopen($filename, 'w')) { 
-			print "Cannot open file ($filename)"; 
-			exit; 
-		} 
 
-		if (!fwrite($handle, $m)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
-		} 
-    
+		$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
+		// writing module.conf
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $m)) {
+			print "Cannot write to file ($filename)";
+			exit;
+		}
+
 		fclose($handle);
-		
-		
+
+
 		// zu Liste springen
-    	header("Location: module_show.php?id=$module_name");
-        exit;
-			
+		header("Location: module_show.php?id=$module_name");
+		exit;
+
 	} else {
-		$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
+		$app->tpl->setVar("error", "<b>Fehler:</b><br>".$error);
 		$app->tpl->setVar($_POST);
 	}
 }
 
 if($item_id != '') {
-// Datensatz besteht bereits
+	// Datensatz besteht bereits
 	// bestehenden Datensatz anzeigen
 	if($error == '') {
 		// es liegt ein Fehler vor
-		include_once("../".$module_name."/lib/module.conf.php");
+		include_once "../".$module_name."/lib/module.conf.php";
 		$record = $module["nav"][$nav_id]["items"][$item_id];
 	} else {
 		// ein Fehler
@@ -121,14 +121,14 @@
 	}
 	//$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
 } else {
-// neuer datensatz
+	// neuer datensatz
 	if($error == '') {
 		// es liegt kein Fehler vor
 		$record["target"] = "content";
 	} else {
 		// ein Fehler
 		$record = $_POST;
-		
+
 	}
 	//$record["readonly"] = '';
 }
@@ -139,7 +139,7 @@
 
 $app->tpl->setVar($record);
 
-include_once("lib/lang/".$_SESSION["s"]["language"]."_module_nav_item_edit.lng");
+include_once "lib/lang/".$_SESSION["s"]["language"]."_module_nav_item_edit.lng";
 $app->tpl->setVar($wb);
 
 // Defaultwerte setzen
@@ -148,4 +148,4 @@
 // Template parsen
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_item_flip.php b/interface/web/designer/module_nav_item_flip.php
index 1aec179..94f210b 100644
--- a/interface/web/designer/module_nav_item_flip.php
+++ b/interface/web/designer/module_nav_item_flip.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,7 +39,7 @@
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
@@ -47,48 +47,48 @@
 $item_id = $_REQUEST["item_id"];
 $dir = $_REQUEST["dir"];
 
-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}$/',$nav_id)) die("nav_id contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$item_id)) die("item_id contains invalid chars.");
+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}$/', $nav_id)) die("nav_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $item_id)) die("item_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
 if($nav_id != '') {
 
 	$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 	if(!@is_file($filename)) die("File not found: $filename");
-	include_once($filename);
-	
+	include_once $filename;
+
 	if($dir == 'up' and $item_id > 0) {
 		$tmp = $module["nav"][$nav_id]["items"][$item_id - 1];
 		$module["nav"][$nav_id]["items"][$item_id -1] = $module["nav"][$nav_id]["items"][$item_id];
 		$module["nav"][$nav_id]["items"][$item_id] = $tmp;
 	}
-	
+
 	if($dir == 'down' and $item_id < count($module["nav"][$nav_id]["items"]) -1) {
 		$tmp = $module["nav"][$nav_id]["items"][$item_id + 1];
 		$module["nav"][$nav_id]["items"][$item_id + 1] = $module["nav"][$nav_id]["items"][$item_id];
 		$module["nav"][$nav_id]["items"][$item_id] = $tmp;
 	}
-	
-	$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-			
+
+	$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 	// writing module.conf
-	if (!$handle = fopen($filename, 'w')) { 
-		print "Cannot open file ($filename)"; 
-		exit; 
-	} 
-	if (!fwrite($handle, $m)) { 
-		print "Cannot write to file ($filename)"; 
-		exit; 
-	} 
-   
+	if (!$handle = fopen($filename, 'w')) {
+		print "Cannot open file ($filename)";
+		exit;
+	}
+	if (!fwrite($handle, $m)) {
+		print "Cannot write to file ($filename)";
+		exit;
+	}
+
 	fclose($handle);
-	
-	
+
+
 	// zu Liste springen
-   	header("Location: module_show.php?id=$module_name");
-    exit;
+	header("Location: module_show.php?id=$module_name");
+	exit;
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_show.php b/interface/web/designer/module_show.php
index 504d313..f3e9812 100644
--- a/interface/web/designer/module_show.php
+++ b/interface/web/designer/module_show.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('designer');
@@ -38,20 +38,20 @@
 $app->uses('tpl');
 
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_show.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_show.htm');
 
 
 $module_name = $_REQUEST["id"];
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$module_name)) die("id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $module_name)) die("id contains invalid chars.");
 
-include_once("../".$module_name."/lib/module.conf.php");
+include_once "../".$module_name."/lib/module.conf.php";
 $navi = $module["nav"];
 unset($module["nav"]);
 $record = $module;
 
-// loading language file 
+// loading language file
 $lng_file = "lib/lang/".$_SESSION["s"]["user"]["language"]."_module_show.lng";
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 // baue Modul navi
@@ -59,8 +59,8 @@
 $n1 = 0;
 $n2 = 0;
 if(is_array($navi)) {
-foreach($navi as $nav_id => $section) {
-	$content .= "<tr>
+	foreach($navi as $nav_id => $section) {
+		$content .= "<tr>
     <td colspan='2' class='frmText11'>
 	  <table width='100%'>
 	  	<tr>
@@ -73,12 +73,12 @@
 		  <input type=\"button\" name=\"bt5$n2\" value=\"$wb[down_txt]\" onclick=\"loadContent('designer/module_nav_flip.php?module_name=$module_name&nav_id=$nav_id&dir=down');\" class=\"button\" /><div class=\"buttonEnding\"></div>
 		  </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($section["items"] as $item_id => $item) {
-		//$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>
+		//$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($section["items"] as $item_id => $item) {
+			//$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'>$item[title]</td>
 		  <td class='frmText11' width='280' align='right'>
 		  <input type=\"button\" name=\"bt6$n2\" value=\"$wb[edit_txt]\" onclick=\"loadContent('designer/module_nav_item_edit.php?module_name=$module_name&nav_id=$nav_id&item_id=$item_id');\" class=\"button\" /><div class=\"buttonEnding\"></div>
@@ -87,14 +87,14 @@
 		  <input type=\"button\" name=\"bt9$n2\" value=\"$wb[down_txt]\" onclick=\"loadContent('designer/module_nav_item_flip.php?module_name=$module_name&nav_id=$nav_id&item_id=$item_id&dir=down');\" class=\"button\" /><div class=\"buttonEnding\"></div>
 		  </td>
 		</tr>";
-		$n2++;
-	}
-	$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
+			$n2++;
+		}
+		$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
 	  </table>
 	</td>
   </tr>";
-	$n1++;
-}
+		$n1++;
+	}
 }
 
 $record["nav"] = $content;
@@ -103,11 +103,11 @@
 $app->tpl->setVar($record);
 
 
-$app->tpl->setLoop('records',$modules_list);
+$app->tpl->setLoop('records', $modules_list);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/ajax_get_json.php b/interface/web/dns/ajax_get_json.php
index 4ff46c2..781fa8e 100644
--- a/interface/web/dns/ajax_get_json.php
+++ b/interface/web/dns/ajax_get_json.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -40,34 +40,34 @@
 
 //if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-	
-	if($type == 'get_ipv4'){
-		//$q = $app->db->quote(trim($_GET["q"]));
-		//$authsql = " AND ".$app->tform->getAuthSQL('r');
-		//$modules = explode(',', $_SESSION['s']['user']['modules']);
-		
-		$result = array();
-		
-		// ipv4
-		//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
-		$result[] = $app->functions->suggest_ips('IPv4');
 
-		$json = $app->functions->json_encode($result);
-	}
-	
-	if($type == 'get_ipv6'){
-		//$q = $app->db->quote(trim($_GET["q"]));
-		//$authsql = " AND ".$app->tform->getAuthSQL('r');
-		//$modules = explode(',', $_SESSION['s']['user']['modules']);
-		
-		$result = array();
-		
-		// ipv6
-		//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
-		$result[] = $app->functions->suggest_ips('IPv6');
-		
-		$json = $app->functions->json_encode($result);
-	}
+if($type == 'get_ipv4'){
+	//$q = $app->db->quote(trim($_GET["q"]));
+	//$authsql = " AND ".$app->tform->getAuthSQL('r');
+	//$modules = explode(',', $_SESSION['s']['user']['modules']);
+
+	$result = array();
+
+	// ipv4
+	//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
+	$result[] = $app->functions->suggest_ips('IPv4');
+
+	$json = $app->functions->json_encode($result);
+}
+
+if($type == 'get_ipv6'){
+	//$q = $app->db->quote(trim($_GET["q"]));
+	//$authsql = " AND ".$app->tform->getAuthSQL('r');
+	//$modules = explode(',', $_SESSION['s']['user']['modules']);
+
+	$result = array();
+
+	// ipv6
+	//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
+	$result[] = $app->functions->suggest_ips('IPv6');
+
+	$json = $app->functions->json_encode($result);
+}
 
 //}
 
@@ -81,13 +81,13 @@
 		$desc_fields = array();
 		if(is_file('../'.$module.'/form/'.$section.'.tform.php')){
 			include_once('../'.$module.'/form/'.$section.'.tform.php');
-			
+
 			$category_title = $form["title"];
 			$form_file = $form["action"];
 			$db_table = $form["db_table"];
 			$db_table_idx = $form["db_table_idx"];
 			$order_by = $db_table_idx;
-			
+
 			if(is_array($form["tabs"]) && !empty($form["tabs"])){
 				foreach($form["tabs"] as $tab){
 					if(is_array($tab['fields']) && !empty($tab['fields'])){
@@ -108,7 +108,7 @@
 			}
 		}
 		unset($form);
-		
+
 		$where_clause = '';
 		if(!empty($search_fields)){
 			$where_clause = implode(' OR ', $search_fields);
@@ -120,11 +120,11 @@
 		if($additional_sql != '') $where_clause .= ' '.$additional_sql.' ';
 		$order_clause = '';
 		if($order_by != '') $order_clause = ' ORDER BY '.$order_by;
-		
+
 		$sql = "SELECT * FROM ".$db_table." WHERE ".$where_clause.$authsql.$order_clause." LIMIT 0,10";
 		$results = $app->db->queryAllRecords($sql);
-		
-		if(is_array($results) && !empty($results)){	
+
+		if(is_array($results) && !empty($results)){
 			$lng_file = '../'.$module.'/lib/lang/'.$_SESSION['s']['language'].'_'.$section.'.lng';
 			if(is_file($lng_file)) include($lng_file);
 			$result_array['cheader'] = array('title' => $category_title,
@@ -140,7 +140,7 @@
 					}
 					if(!empty($desc_items)) $description = implode(' - ', $desc_items);
 				}
-				
+
 				$result_array['cdata'][] = array(	'title' => $wb[$title_key.'_txt'].': '.$result[$title_key],
 													'description' => $description,
 													'onclick' => '',
@@ -156,7 +156,7 @@
 	return $result_array;
 }
 */
-		
+
 header('Content-type: application/json');
 echo $json;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_a_edit.php b/interface/web/dns/dns_a_edit.php
index 1f94633..99d0d99 100644
--- a/interface/web/dns/dns_a_edit.php
+++ b/interface/web/dns/dns_a_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,27 +95,27 @@
 				}
 			}
 		} // end if user is not admin
-		
+
 		//* Check for duplicates where IP and hostname are the same
 		$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'A' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and data = '".$this->dataRecord["data"]."' and id != ".$this->id.") OR (type = 'CNAME' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.")");
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("data_error_duplicate")."<br>";
 		unset($tmp);
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -125,17 +125,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_a_list.php b/interface/web/dns/dns_a_list.php
index afe76b6..d525585 100644
--- a/interface/web/dns/dns_a_list.php
+++ b/interface/web/dns/dns_a_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_aaaa_edit.php b/interface/web/dns/dns_aaaa_edit.php
index ccd6fe8..02aea58 100644
--- a/interface/web/dns/dns_aaaa_edit.php
+++ b/interface/web/dns/dns_aaaa_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,17 +120,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_alias_edit.php b/interface/web/dns/dns_alias_edit.php
index 86a6dcd..dc370a6 100644
--- a/interface/web/dns/dns_alias_edit.php
+++ b/interface/web/dns/dns_alias_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_cname_edit.php b/interface/web/dns/dns_cname_edit.php
index 75ec7c4..5d9d19b 100644
--- a/interface/web/dns/dns_cname_edit.php
+++ b/interface/web/dns/dns_cname_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,27 +95,27 @@
 				}
 			}
 		} // end if user is not admin
-		
+
 		//* Check for duplicates where IP and hostname are the same
 		$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'A' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.") OR (type = 'CNAME' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.")");
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("data_error_duplicate")."<br>";
 		unset($tmp);
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -125,16 +125,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_hinfo_edit.php b/interface/web/dns/dns_hinfo_edit.php
index 910ebea..0c3f004 100644
--- a/interface/web/dns/dns_hinfo_edit.php
+++ b/interface/web/dns/dns_hinfo_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_import.php b/interface/web/dns/dns_import.php
index 255d290..b015453 100644
--- a/interface/web/dns/dns_import.php
+++ b/interface/web/dns/dns_import.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -40,7 +40,7 @@
 // Loading the template
 $app->uses('tpl,validate_dns');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/dns_import.htm');
+$app->tpl->setInclude('content_tpl', 'templates/dns_import.htm');
 $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng');
 
 // import variables
@@ -69,11 +69,11 @@
 	$n++;
 }
 unset($n);
-$app->tpl->setVar("template_id_option",$template_id_option);
+$app->tpl->setVar("template_id_option", $template_id_option);
 
 // If the user is administrator
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	
+
 	// Load the list of servers
 	$records = $app->db->queryAllRecords("SELECT server_id, server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 ORDER BY server_name");
 	$server_id_option = '';
@@ -81,8 +81,8 @@
 		$checked = ($rec['server_id'] == $server_id)?' SELECTED':'';
 		$server_id_option .= '<option value="'.$rec['server_id'].'"'.$checked.'>'.$rec['server_name'].'</option>';
 	}
-	$app->tpl->setVar("server_id",$server_id_option);
-	
+	$app->tpl->setVar("server_id", $server_id_option);
+
 	// load the list of clients
 	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 	$clients = $app->db->queryAllRecords($sql);
@@ -95,16 +95,16 @@
 		}
 	}
 
-	$app->tpl->setVar("client_group_id",$client_select);
+	$app->tpl->setVar("client_group_id", $client_select);
 }
 
 if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-	
+
 	// Get the limits of the client
 	$client_group_id = $_SESSION["s"]["user"]["default_group"];
 	$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 
-	
+
 	// load the list of clients
 	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
 	$clients = $app->db->queryAllRecords($sql);
@@ -117,37 +117,37 @@
 		}
 	}
 
-	$app->tpl->setVar("client_group_id",$client_select);
+	$app->tpl->setVar("client_group_id", $client_select);
 }
 
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dns_import.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 // Import the zone-file
 //if(1=="1")
 if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'])){
 	$valid_zone_file = FALSE;
-	
+
 	$sql = "SELECT server_name FROM `server` WHERE server_id=".$app->functions->intval($server_id)." OR mirror_server_id=".$app->functions->intval($server_id)." ORDER BY server_name ASC";
 	$servers = $app->db->queryAllRecords($sql);
 	for ($i=0;$i<count($servers);$i++)
 	{
-		if (substr($servers[$i]['server_name'],strlen($servers[$i]['server_name'])-1) != ".")
+		if (substr($servers[$i]['server_name'], strlen($servers[$i]['server_name'])-1) != ".")
 		{
 			$servers[$i]['server_name'] .= ".";
 		}
 	}
 	$lines = file($_FILES['file']['tmp_name']);
-	
+
 	// Remove empty lines, comments, whitespace, tabs, etc.
 	$new_lines = array();
 	foreach($lines as $line){
 		$line = trim($line);
-		if ($line != '' && substr($line,0,1) != ';'){
-			if(strpos($line,";") !== FALSE) $line = substr($line,0,strpos($line,";"));
-			if(strpos($line,"(") !== FALSE) $line = substr($line,0,strpos($line,"("));
-			if(strpos($line,")") !== FALSE) $line = substr($line,0,strpos($line,")"));
+		if ($line != '' && substr($line, 0, 1) != ';'){
+			if(strpos($line, ";") !== FALSE) $line = substr($line, 0, strpos($line, ";"));
+			if(strpos($line, "(") !== FALSE) $line = substr($line, 0, strpos($line, "("));
+			if(strpos($line, ")") !== FALSE) $line = substr($line, 0, strpos($line, ")"));
 			$line = trim($line);
 			if ($line != ''){
 				$sPattern = '/\s+/m';
@@ -159,19 +159,19 @@
 	unset($lines);
 	$lines = $new_lines;
 	unset($new_lines);
-	
+
 	//$lines = file("apriqot.se.txt");
-	$name = str_replace("txt","",$_FILES['file']['name']);
-	$name = str_replace("zone","",$name);
+	$name = str_replace("txt", "", $_FILES['file']['name']);
+	$name = str_replace("zone", "", $name);
 
 	if ($domain !== NULL){
 		$name = $domain;
 	}
-	
-	if (substr($name,-1) != "."){
+
+	if (substr($name, -1) != "."){
 		$name .= ".";
 	}
-	
+
 	$i = 0;
 	$origin_exists = FALSE;
 	$soa_array_key = -1;
@@ -180,9 +180,9 @@
 	$r = 0;
 	$dns_rr = array();
 	foreach($lines as $line){
-	
+
 		$parts = explode(' ', $line);
-		
+
 		// make all elements lowercase
 		$new_parts = array();
 		foreach($parts as $part){
@@ -191,7 +191,7 @@
 		unset($parts);
 		$parts = $new_parts;
 		unset($new_parts);
-		
+
 		// if ORIGIN exists, overwrite $soa['name']
 		if($parts[0] == '$origin'){
 			$soa['name'] = $parts[1];
@@ -199,25 +199,25 @@
 		}
 		// TTL
 		if($parts[0] == '$ttl'){
-			$time_format = strtolower(substr($parts[1],-1));
+			$time_format = strtolower(substr($parts[1], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1));
-					break;
-				case 'm':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 604800;
-					break;
-				default:
-					$soa['ttl'] = $app->functions->intval($parts[1]);
+			case 's':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1));
+				break;
+			case 'm':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['ttl'] = $app->functions->intval($parts[1]);
 			}
 			unset($time_format);
 		}
@@ -237,103 +237,103 @@
 		if($i == ($soa_array_key + 1)) $soa['serial'] = $app->functions->intval($parts[0]);
 		// REFRESH
 		if($i == ($soa_array_key + 2)){
-			$time_format = strtolower(substr($parts[0],-1));
+			$time_format = strtolower(substr($parts[0], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1));
-					break;
-				case 'm':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800;
-					break;
-				default:
-					$soa['refresh'] = $app->functions->intval($parts[0]);
+			case 's':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1));
+				break;
+			case 'm':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['refresh'] = $app->functions->intval($parts[0]);
 			}
 			unset($time_format);
 		}
 		// RETRY
 		if($i == ($soa_array_key + 3)){
-			$time_format = strtolower(substr($parts[0],-1));
+			$time_format = strtolower(substr($parts[0], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1));
-					break;
-				case 'm':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800;
-					break;
-				default:
-					$soa['retry'] = $app->functions->intval($parts[0]);
+			case 's':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1));
+				break;
+			case 'm':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['retry'] = $app->functions->intval($parts[0]);
 			}
 			unset($time_format);
 		}
 		// EXPIRE
 		if($i == ($soa_array_key + 4)){
-			$time_format = strtolower(substr($parts[0],-1));
+			$time_format = strtolower(substr($parts[0], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1));
-					break;
-				case 'm':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800;
-					break;
-				default:
-					$soa['expire'] = $app->functions->intval($parts[0]);
+			case 's':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1));
+				break;
+			case 'm':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['expire'] = $app->functions->intval($parts[0]);
 			}
 			unset($time_format);
 		}
 		// MINIMUM
 		if($i == ($soa_array_key + 5)){
-			$time_format = strtolower(substr($parts[0],-1));
+			$time_format = strtolower(substr($parts[0], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1));
-					break;
-				case 'm':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800;
-					break;
-				default:
-					$soa['minimum'] = $app->functions->intval($parts[0]);
+			case 's':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1));
+				break;
+			case 'm':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['minimum'] = $app->functions->intval($parts[0]);
 			}
 			unset($time_format);
 		}
 		// RESOURCE RECORDS
 		if($i > ($soa_array_key + 5)){
-			if(substr($parts[0],-1) == '.' || $parts[0] == '@' || ($parts[0] != 'a' && $parts[0] != 'aaaa' && $parts[0] != 'ns' && $parts[0] != 'cname' && $parts[0] != 'hinfo' && $parts[0] != 'mx' && $parts[0] != 'naptr' && $parts[0] != 'ptr' && $parts[0] != 'rp' && $parts[0] != 'srv' && $parts[0] != 'txt')){
+			if(substr($parts[0], -1) == '.' || $parts[0] == '@' || ($parts[0] != 'a' && $parts[0] != 'aaaa' && $parts[0] != 'ns' && $parts[0] != 'cname' && $parts[0] != 'hinfo' && $parts[0] != 'mx' && $parts[0] != 'naptr' && $parts[0] != 'ptr' && $parts[0] != 'rp' && $parts[0] != 'srv' && $parts[0] != 'txt')){
 				if(is_numeric($parts[1])){
 					if($parts[2] == 'in'){
 						$resource_type = $parts[3];
@@ -363,20 +363,20 @@
 					$dns_rr[$r]['ttl'] = $soa['ttl'];
 				}
 				switch ($resource_type) {
-					case 'mx':
-					case 'srv':
-						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-						$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-						break;
-					case 'txt':
-						$dns_rr[$r]['aux'] = 0;
-						$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-						if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-						if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-						break;
-					default:
-						$dns_rr[$r]['aux'] = 0;
-						$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+				case 'mx':
+				case 'srv':
+					$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+					$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+					break;
+				case 'txt':
+					$dns_rr[$r]['aux'] = 0;
+					$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+					if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+					if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+					break;
+				default:
+					$dns_rr[$r]['aux'] = 0;
+					$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 				}
 			} else {
 				// a 3600 IN A 1.2.3.4
@@ -387,22 +387,22 @@
 					$dns_rr[$r]['name'] = $parts[0];
 					$dns_rr[$r]['ttl'] = $app->functions->intval($parts[1]);
 					switch ($resource_type) {
-						case 'mx':
-						case 'srv':
-							$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-							break;
-						case 'txt':
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-							if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-							if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-							break;
-						default:
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+					case 'mx':
+					case 'srv':
+						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+						break;
+					case 'txt':
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+						if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+						if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+						break;
+					default:
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 					}
-				} 
+				}
 				// a IN A 1.2.3.4
 				elseif($parts[1] == 'in' && ($parts[2] == 'a' || $parts[2] == 'aaaa' || $parts[2] == 'ns'|| $parts[2] == 'cname' || $parts[2] == 'hinfo' || $parts[2] == 'mx' || $parts[2] == 'naptr' || $parts[2] == 'ptr' || $parts[2] == 'rp' || $parts[2] == 'srv' || $parts[2] == 'txt')){
 					$resource_type = $parts[2];
@@ -411,22 +411,22 @@
 					$dns_rr[$r]['name'] = $parts[0];
 					$dns_rr[$r]['ttl'] = $soa['ttl'];
 					switch ($resource_type) {
-						case 'mx':
-						case 'srv':
-							$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-							break;
-						case 'txt':
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-							if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-							if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-							break;
-						default:
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+					case 'mx':
+					case 'srv':
+						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+						break;
+					case 'txt':
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+						if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+						if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+						break;
+					default:
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 					}
-				} 
+				}
 				// a 3600 A 1.2.3.4
 				elseif(is_numeric($parts[1]) && ($parts[2] == 'a' || $parts[2] == 'aaaa' || $parts[2] == 'ns'|| $parts[2] == 'cname' || $parts[2] == 'hinfo' || $parts[2] == 'mx' || $parts[2] == 'naptr' || $parts[2] == 'ptr' || $parts[2] == 'rp' || $parts[2] == 'srv' || $parts[2] == 'txt')){
 					$resource_type = $parts[2];
@@ -435,22 +435,22 @@
 					$dns_rr[$r]['name'] = $parts[0];
 					$dns_rr[$r]['ttl'] = $app->functions->intval($parts[1]);
 					switch ($resource_type) {
-						case 'mx':
-						case 'srv':
-							$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-							break;
-						case 'txt':
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-							if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-							if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-							break;
-						default:
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+					case 'mx':
+					case 'srv':
+						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+						break;
+					case 'txt':
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+						if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+						if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+						break;
+					default:
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 					}
-				} 
+				}
 				// A 1.2.3.4
 				// MX 10 mail
 				// TXT "v=spf1 a mx ptr -all"
@@ -461,20 +461,20 @@
 					$dns_rr[$r]['name'] = $soa['name'];
 					$dns_rr[$r]['ttl'] = $soa['ttl'];
 					switch ($resource_type) {
-						case 'mx':
-						case 'srv':
-							$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-							break;
-						case 'txt':
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-							if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-							if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-							break;
-						default:
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+					case 'mx':
+					case 'srv':
+						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+						break;
+					case 'txt':
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+						if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+						if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+						break;
+					default:
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 					}
 				}
 			}
@@ -486,7 +486,7 @@
 		}
 		$i++;
 	}
-	
+
 	/*
 	$i = 0;
 	$r = 0;
@@ -586,7 +586,7 @@
 							if (!empty($mx[$r][$m]))
 								$dns_rr[$r]['data'] = $mx[$r][$m];
 						}
-						
+
 						$dns_rr[$r]['aux'] = $mx[$r][0];
 					}
 					else if (strtolower($dns_rr[$r]['type'])=='txt')
@@ -618,11 +618,11 @@
 		$dns_rr[$r]['aux'] = 0;
 		$r++;
 	}
-					//print('<pre>');
-					//print_r($dns_rr);
-					//print('</pre>');
-					
-					
+	//print('<pre>');
+	//print_r($dns_rr);
+	//print('</pre>');
+
+
 	// Insert the soa record
 	$sys_userid = $_SESSION['s']['user']['userid'];
 	$origin = $app->db->quote($soa['name']);
@@ -641,7 +641,7 @@
 		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`) VALUES
 		('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '$xfer')";
 		$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
-	
+
 		// Insert the dns_rr records
 		if(is_array($dns_rr) && $dns_soa_id > 0)
 		{
@@ -664,11 +664,11 @@
 }
 
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_mx_edit.php b/interface/web/dns/dns_mx_edit.php
index 8ce9b87..a839f70 100644
--- a/interface/web/dns/dns_mx_edit.php
+++ b/interface/web/dns/dns_mx_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,44 +95,44 @@
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onInsert() {
 		global $app, $conf;
-		
+
 		// Check if record is existing already
 		$duplicate_mx = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($this->dataRecord["zone"])." AND name = '".$this->dataRecord["name"]."' AND type = '".$this->dataRecord["type"]."' AND data = '".$this->dataRecord["data"]."' AND ".$app->tform->getAuthSQL('r'));
-		
+
 		if(is_array($duplicate_mx) && !empty($duplicate_mx)) $app->error($app->tform->wordbook["duplicate_mx_record_txt"]);
-		
+
 		parent::onInsert();
 	}
-	
+
 	function onUpdate() {
 		global $app, $conf;
-		
+
 		// Check if record is existing already
 		$duplicate_mx = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($this->dataRecord["zone"])." AND name = '".$this->dataRecord["name"]."' AND type = '".$this->dataRecord["type"]."' AND data = '".$this->dataRecord["data"]."' AND id != ".$app->functions->intval($this->dataRecord["id"])." AND ".$app->tform->getAuthSQL('r'));
-		
+
 		if(is_array($duplicate_mx) && !empty($duplicate_mx)) $app->error($app->tform->wordbook["duplicate_mx_record_txt"]);
-		
+
 		parent::onUpdate();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -142,16 +142,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_ns_edit.php b/interface/web/dns/dns_ns_edit.php
index 059c0e0..31df6ef 100644
--- a/interface/web/dns/dns_ns_edit.php
+++ b/interface/web/dns/dns_ns_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_ptr_edit.php b/interface/web/dns/dns_ptr_edit.php
index 8dc790e..323d76c 100644
--- a/interface/web/dns/dns_ptr_edit.php
+++ b/interface/web/dns/dns_ptr_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_rp_edit.php b/interface/web/dns/dns_rp_edit.php
index 0e4eb0b..a4f81a0 100644
--- a/interface/web/dns/dns_rp_edit.php
+++ b/interface/web/dns/dns_rp_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_rr_del.php b/interface/web/dns/dns_rr_del.php
index 46356e1..a20c9c0 100644
--- a/interface/web/dns/dns_rr_del.php
+++ b/interface/web/dns/dns_rr_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -52,16 +52,17 @@
 
 	function onAfterDelete() {
 		global $app; $conf;
-				
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($this->dataRecord["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_slave_del.php b/interface/web/dns/dns_slave_del.php
index a2bba00..d3ca18f 100644
--- a/interface/web/dns/dns_slave_del.php
+++ b/interface/web/dns/dns_slave_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -52,18 +52,19 @@
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-		
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
 		// Delete all records that belog to this zone.
 		$records = $app->db->queryAllRecords("SELECT id FROM dns_slave WHERE zone = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('dns_slave','id',$rec['id']);
+			$app->db->datalogDelete('dns_slave', 'id', $rec['id']);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_slave_edit.php b/interface/web/dns/dns_slave_edit.php
index 46e251a..a968804 100644
--- a/interface/web/dns/dns_slave_edit.php
+++ b/interface/web/dns/dns_slave_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,10 +49,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_dns_slave_zone')) {
@@ -62,13 +62,13 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_dns_slave_zone_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		// If user is admin, we will allow him to select to whom this record belongs
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Domains of the user
@@ -83,29 +83,29 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-		$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 		} else if($app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-		
-			// Get the limits of the client
-			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, sys_group.name, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
-			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
-			$clients = $app->db->queryAllRecords($sql);
-			$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
-			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
-			//$tmp_data_record = $app->tform->getDataRecord($this->id);
-			if(is_array($clients)) {
-				foreach( $clients as $client) {
-					$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
-					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
+
+				// Get the limits of the client
+				$client_group_id = $_SESSION["s"]["user"]["default_group"];
+				$client = $app->db->queryOneRecord("SELECT client.client_id, sys_group.name, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+				// Fill the client select field
+				$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+				$clients = $app->db->queryAllRecords($sql);
+				$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
+				$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
+				//$tmp_data_record = $app->tform->getDataRecord($this->id);
+				if(is_array($clients)) {
+					foreach( $clients as $client) {
+						$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
+						$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
+					}
 				}
+				$app->tpl->setVar("client_group_id", $client_select);
+
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-		
-		}
-		
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -113,29 +113,29 @@
 		} else {
 			$app->tpl->setVar("edit_disabled", 0);
 		}
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_slave_zone, default_slave_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-		
+
 			// When the record is updated
 			if($this->id > 0) {
 				// restore the server ID if the user is not admin and record is edited
 				$tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_slave WHERE id = ".$app->functions->intval($this->id));
 				$this->dataRecord["server_id"] = $tmp["server_id"];
 				unset($tmp);
-			// When the record is inserted
+				// When the record is inserted
 			} else {
 				// set the server ID to the default dnsserver of the client
 				$this->dataRecord["server_id"] = $client["default_slave_dnsserver"];
-				
+
 				// Check if the user may add anoter secondary domain.
 				if(!$app->tform->checkClientLimit('limit_dns_slave_zone')) {
 					$app->error($app->tform->wordbook["limit_dns_slave_zone_txt"]);
@@ -145,33 +145,33 @@
 				}
 			}
 		}
-		
+
 		//* Check if the zone name has a dot at the end
-		if(strlen($this->dataRecord["origin"]) > 0 && substr($this->dataRecord["origin"],-1,1) != '.') $this->dataRecord["origin"] .= '.';
-	
-		//* Check if a primary zone with the same name already exists 	
+		if(strlen($this->dataRecord["origin"]) > 0 && substr($this->dataRecord["origin"], -1, 1) != '.') $this->dataRecord["origin"] .= '.';
+
+		//* Check if a primary zone with the same name already exists
 		$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_soa WHERE origin = \"".$this->dataRecord["origin"]."\" AND server_id= \"".$this->dataRecord["server_id"]."\"");
 		if($tmp["number"] > 0) {
-  			$app->error($app->tform->wordbook["origin_error_unique"]);
+			$app->error($app->tform->wordbook["origin_error_unique"]);
 		}
 
 		parent::onSubmit();
 	}
-	
+
 	function onInsert() {
 		global $app, $conf;
-		
+
 		// Check if record is existing already
 		$duplicate_slave = $app->db->queryOneRecord("SELECT * FROM dns_slave WHERE origin = '".$this->dataRecord["origin"]."' AND server_id = ".$app->functions->intval($this->dataRecord["server_id"])." AND ".$app->tform->getAuthSQL('r'));
-		
+
 		if(is_array($duplicate_slave) && !empty($duplicate_slave)) $app->error($app->tform->wordbook["origin_error_unique"]);
-		
+
 		parent::onInsert();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -183,11 +183,11 @@
 		}
 
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
-		$tmp = $app->db->diffrec($this->oldDataRecord,$app->tform->getDataRecord($this->id));
+
+		$tmp = $app->db->diffrec($this->oldDataRecord, $app->tform->getDataRecord($this->id));
 
 		// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
@@ -198,7 +198,7 @@
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
 			$app->db->query("UPDATE dns_slave SET sys_groupid = $client_group_id WHERE id = ".$this->id);
 		}
-		
+
 		//** When the client group has changed, change also the owner of the record if the owner is not the admin user
 		if($this->oldDataRecord["client_group_id"] != $this->dataRecord["client_group_id"] && $this->dataRecord["sys_userid"] != 1) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -207,9 +207,9 @@
 				$app->db->query("UPDATE dns_slave SET sys_userid = ".$tmp["userid"]." WHERE id = ".$this->id);
 			}
 		}
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_slave_list.php b/interface/web/dns/dns_slave_list.php
index fe78ca2..b277a86 100644
--- a/interface/web/dns/dns_slave_list.php
+++ b/interface/web/dns/dns_slave_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -22,4 +22,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_soa_del.php b/interface/web/dns/dns_soa_del.php
index 82d680b..f9a06fc 100644
--- a/interface/web/dns/dns_soa_del.php
+++ b/interface/web/dns/dns_soa_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -52,18 +52,19 @@
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-		
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
 		// Delete all records that belog to this zone.
 		$records = $app->db->queryAllRecords("SELECT id FROM dns_rr WHERE zone = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('dns_rr','id',$rec['id']);
+			$app->db->datalogDelete('dns_rr', 'id', $rec['id']);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_soa_edit.php b/interface/web/dns/dns_soa_edit.php
index 9f524e8..94ce065 100644
--- a/interface/web/dns/dns_soa_edit.php
+++ b/interface/web/dns/dns_soa_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,7 +49,7 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShow() {
 		global $app;
 		//* Reset the page number of the list form for the dns
@@ -59,10 +59,10 @@
 		}
 		parent::onShow();
 	}
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_dns_zone')) {
@@ -72,13 +72,13 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_dns_zone_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		// If user is admin, we will allow him to select to whom this record belongs
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Domains of the user
@@ -93,29 +93,29 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-		$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 		} else if($app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-		
-			// Get the limits of the client
-			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
-			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
-			$clients = $app->db->queryAllRecords($sql);
-			$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
-			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
-			//$tmp_data_record = $app->tform->getDataRecord($this->id);
-			if(is_array($clients)) {
-				foreach( $clients as $client) {
-					$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
-					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
+
+				// Get the limits of the client
+				$client_group_id = $_SESSION["s"]["user"]["default_group"];
+				$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+				// Fill the client select field
+				$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+				$clients = $app->db->queryAllRecords($sql);
+				$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
+				$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
+				//$tmp_data_record = $app->tform->getDataRecord($this->id);
+				if(is_array($clients)) {
+					foreach( $clients as $client) {
+						$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
+						$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
+					}
 				}
+				$app->tpl->setVar("client_group_id", $client_select);
+
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-		
-		}
-		
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -123,29 +123,29 @@
 		} else {
 			$app->tpl->setVar("edit_disabled", 0);
 		}
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_zone, default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-		
+
 			// When the record is updated
 			if($this->id > 0) {
 				// restore the server ID if the user is not admin and record is edited
 				$tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_soa WHERE id = ".$app->functions->intval($this->id));
 				$this->dataRecord["server_id"] = $tmp["server_id"];
 				unset($tmp);
-			// When the record is inserted
+				// When the record is inserted
 			} else {
 				// set the server ID to the default dnsserver of the client
 				$this->dataRecord["server_id"] = $client["default_dnsserver"];
-				
+
 				// Check if the user may add another maildomain.
 				if($client["limit_dns_zone"] >= 0) {
 					$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_soa WHERE sys_groupid = $client_group_id");
@@ -155,39 +155,39 @@
 				}
 			}
 		}
-		
+
 		/*
 		// Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		*/
-		
-		
+
+
 		//* Check if soa, ns and mbox have a dot at the end
-		if(strlen($this->dataRecord["origin"]) > 0 && substr($this->dataRecord["origin"],-1,1) != '.') $this->dataRecord["origin"] .= '.';
-		if(strlen($this->dataRecord["ns"]) > 0 && substr($this->dataRecord["ns"],-1,1) != '.') $this->dataRecord["ns"] .= '.';
-		if(strlen($this->dataRecord["mbox"]) > 0 && substr($this->dataRecord["mbox"],-1,1) != '.') $this->dataRecord["mbox"] .= '.';
-		
+		if(strlen($this->dataRecord["origin"]) > 0 && substr($this->dataRecord["origin"], -1, 1) != '.') $this->dataRecord["origin"] .= '.';
+		if(strlen($this->dataRecord["ns"]) > 0 && substr($this->dataRecord["ns"], -1, 1) != '.') $this->dataRecord["ns"] .= '.';
+		if(strlen($this->dataRecord["mbox"]) > 0 && substr($this->dataRecord["mbox"], -1, 1) != '.') $this->dataRecord["mbox"] .= '.';
+
 		//* Replace @ in mbox
-		if(stristr($this->dataRecord["mbox"],'@')) {
-			$this->dataRecord["mbox"] = str_replace('@','.',$this->dataRecord["mbox"]);
+		if(stristr($this->dataRecord["mbox"], '@')) {
+			$this->dataRecord["mbox"] = str_replace('@', '.', $this->dataRecord["mbox"]);
 		}
-		
+
 		$this->dataRecord["xfer"] = preg_replace('/\s+/', '', $this->dataRecord["xfer"]);
 		$this->dataRecord["also_notify"] = preg_replace('/\s+/', '', $this->dataRecord["also_notify"]);
 
-		//* Check if a secondary zone with the same name already exists 	
+		//* Check if a secondary zone with the same name already exists
 		$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_slave WHERE origin = \"".$this->dataRecord["origin"]."\" AND server_id = \"".$this->dataRecord["server_id"]."\"");
 		if($tmp["number"] > 0) {
-  			$app->error($app->tform->wordbook["origin_error_unique"]);
-		}		
+			$app->error($app->tform->wordbook["origin_error_unique"]);
+		}
 
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -203,7 +203,7 @@
 		}
 
 	}
-	
+
 	function onBeforeUpdate () {
 		global $app, $conf;
 
@@ -212,7 +212,7 @@
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 			//* We do not allow users to change a domain which has been created by the admin
 			$rec = $app->db->queryOneRecord("SELECT origin from dns_soa WHERE id = ".$this->id);
-			if(isset($this->dataRecord["origin"]) && $rec['origin'] != $this->dataRecord["origin"] && $app->tform->checkPerm($this->id,'u')) {
+			if(isset($this->dataRecord["origin"]) && $rec['origin'] != $this->dataRecord["origin"] && $app->tform->checkPerm($this->id, 'u')) {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Zone (soa) can not be changed. Please ask your Administrator if you want to change the Zone name.');
 				$this->dataRecord["origin"] = $rec['origin'];
@@ -220,17 +220,17 @@
 			unset($rec);
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
-		$tmp = $app->db->diffrec($this->oldDataRecord,$app->tform->getDataRecord($this->id));
+
+		$tmp = $app->db->diffrec($this->oldDataRecord, $app->tform->getDataRecord($this->id));
 		if($tmp['diff_num'] > 0) {
 			// Update the serial number of the SOA record
 			$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = ".$this->id);
 			$app->db->query("UPDATE dns_soa SET serial = '".$app->validate_dns->increase_serial($soa["serial"])."' WHERE id = ".$this->id);
 		}
-		
+
 		// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -244,7 +244,7 @@
 			// And we want to update all rr records too, that belong to this record
 			$app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id);
 		}
-		
+
 		//** When the client group has changed, change also the owner of the record if the owner is not the admin user
 		if($this->oldDataRecord["client_group_id"] != $this->dataRecord["client_group_id"] && $this->dataRecord["sys_userid"] != 1) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -254,9 +254,9 @@
 				$app->db->query("UPDATE dns_rr SET sys_userid = ".$tmp["userid"]." WHERE zone = ".$this->id);
 			}
 		}
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_soa_list.php b/interface/web/dns/dns_soa_list.php
index 27604fb..da02729 100644
--- a/interface/web/dns/dns_soa_list.php
+++ b/interface/web/dns/dns_soa_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -22,4 +22,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_srv_edit.php b/interface/web/dns/dns_srv_edit.php
index e41b554..a382e61 100644
--- a/interface/web/dns/dns_srv_edit.php
+++ b/interface/web/dns/dns_srv_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -77,7 +77,7 @@
 
 		// Split the 3 parts of the SRV Record apart
 		$split = explode(' ', $this->dataRecord['data']);
-		
+
 		$app->tpl->setVar('weight', $split[0]);
 		$app->tpl->setVar('port', $split[1]);
 		$app->tpl->setVar('target', $split[2]);
@@ -151,6 +151,7 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_template_del.php b/interface/web/dns/dns_template_del.php
index bfb343c..fee0900 100644
--- a/interface/web/dns/dns_template_del.php
+++ b/interface/web/dns/dns_template_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -55,4 +55,4 @@
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_template_edit.php b/interface/web/dns/dns_template_edit.php
index 5dda4da..1b63eaa 100644
--- a/interface/web/dns/dns_template_edit.php
+++ b/interface/web/dns/dns_template_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -51,10 +51,10 @@
 if($_SESSION["s"]["user"]["typ"] != 'admin') die('Access denied for non admin users.');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_template_list.php b/interface/web/dns/dns_template_list.php
index acad5d3..3fab001 100644
--- a/interface/web/dns/dns_template_list.php
+++ b/interface/web/dns/dns_template_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -22,4 +22,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_txt_edit.php b/interface/web/dns/dns_txt_edit.php
index 2445f03..2bacd35 100644
--- a/interface/web/dns/dns_txt_edit.php
+++ b/interface/web/dns/dns_txt_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php
index ad26c43..e51c76d 100644
--- a/interface/web/dns/dns_wizard.php
+++ b/interface/web/dns/dns_wizard.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -38,7 +38,7 @@
 // Loading the template
 $app->uses('tpl,validate_dns');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/dns_wizard.htm');
+$app->tpl->setInclude('content_tpl', 'templates/dns_wizard.htm');
 $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng');
 
 // import variables
@@ -66,11 +66,11 @@
 	$n++;
 }
 unset($n);
-$app->tpl->setVar("template_id_option",$template_id_option);
+$app->tpl->setVar("template_id_option", $template_id_option);
 
 // If the user is administrator
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	
+
 	// Load the list of servers
 	$records = $app->db->queryAllRecords("SELECT server_id, server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 ORDER BY server_name");
 	$server_id_option = '';
@@ -78,8 +78,8 @@
 		$checked = ($rec['server_id'] == $server_id)?' SELECTED':'';
 		$server_id_option .= '<option value="'.$rec['server_id'].'"'.$checked.'>'.$rec['server_name'].'</option>';
 	}
-	$app->tpl->setVar("server_id",$server_id_option);
-	
+	$app->tpl->setVar("server_id", $server_id_option);
+
 	// load the list of clients
 	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 	$clients = $app->db->queryAllRecords($sql);
@@ -92,16 +92,16 @@
 		}
 	}
 
-	$app->tpl->setVar("client_group_id",$client_select);
+	$app->tpl->setVar("client_group_id", $client_select);
 }
 
 if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-	
+
 	// Get the limits of the client
 	$client_group_id = $_SESSION["s"]["user"]["default_group"];
 	$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 
-	
+
 	// load the list of clients
 	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
 	$clients = $app->db->queryAllRecords($sql);
@@ -114,24 +114,24 @@
 		}
 	}
 
-	$app->tpl->setVar("client_group_id",$client_select);
+	$app->tpl->setVar("client_group_id", $client_select);
 }
 
 
 $template_record = $app->db->queryOneRecord("SELECT * FROM dns_template WHERE template_id = '$template_id'");
-$fields = explode(',',$template_record['fields']);
+$fields = explode(',', $template_record['fields']);
 if(is_array($fields)) {
 	foreach($fields as $field) {
-		$app->tpl->setVar($field."_VISIBLE",1);
+		$app->tpl->setVar($field."_VISIBLE", 1);
 		$field = strtolower($field);
-		$app->tpl->setVar($field,$_POST[$field]);
+		$app->tpl->setVar($field, $_POST[$field]);
 	}
 }
 
 if($_POST['create'] == 1) {
-	
+
 	$error = '';
-	
+
 	// apply filters
 	if(isset($_POST['domain']) && $_POST['domain'] != ''){
 		$_POST['domain'] = $app->functions->idn_encode($_POST['domain']);
@@ -149,22 +149,22 @@
 		$_POST['email'] = $app->functions->idn_encode($_POST['email']);
 		$_POST['email'] = strtolower($_POST['email']);
 	}
-	
-	
+
+
 	if(isset($_POST['domain']) && $_POST['domain'] == '') $error .= $app->lng('error_domain_empty').'<br />';
-	elseif(isset($_POST['domain']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,30}$/',$_POST['domain'])) $error .= $app->lng('error_domain_regex').'<br />';
+	elseif(isset($_POST['domain']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,30}$/', $_POST['domain'])) $error .= $app->lng('error_domain_regex').'<br />';
 
 	if(isset($_POST['ip']) && $_POST['ip'] == '') $error .= $app->lng('error_ip_empty').'<br />';
 
 	if(isset($_POST['ns1']) && $_POST['ns1'] == '') $error .= $app->lng('error_ns1_empty').'<br />';
-	elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/',$_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
+	elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
 
 	if(isset($_POST['ns2']) && $_POST['ns2'] == '') $error .= $app->lng('error_ns2_empty').'<br />';
-	elseif(isset($_POST['ns2']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/',$_POST['ns2'])) $error .= $app->lng('error_ns2_regex').'<br />';
+	elseif(isset($_POST['ns2']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns2'])) $error .= $app->lng('error_ns2_regex').'<br />';
 
 	if(isset($_POST['email']) && $_POST['email'] == '') $error .= $app->lng('error_email_empty').'<br />';
-	elseif(isset($_POST['email']) && !preg_match('/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z0-9\-]{2,30}$/i',$_POST['email'])) $error .= $app->lng('error_email_regex').'<br />';
-	
+	elseif(isset($_POST['email']) && !preg_match('/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z0-9\-]{2,30}$/i', $_POST['email'])) $error .= $app->lng('error_email_regex').'<br />';
+
 	// make sure that the record belongs to the client group and not the admin group when admin inserts it
 	if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($_POST['client_group_id'])) {
 		$sys_groupid = $app->functions->intval($_POST['client_group_id']);
@@ -173,11 +173,11 @@
 	} else {
 		$sys_groupid = $_SESSION["s"]["user"]["default_group"];
 	}
-	
+
 	$tform_def_file = "form/dns_soa.tform.php";
 	$app->uses('tform');
 	$app->tform->loadFormDef($tform_def_file);
-	
+
 	if($_SESSION['s']['user']['typ'] != 'admin') {
 		if(!$app->tform->checkClientLimit('limit_dns_zone')) {
 			$error .= $app->tform->wordbook["limit_dns_zone_txt"];
@@ -186,24 +186,24 @@
 			$error .= $app->tform->wordbook["limit_dns_zone_txt"];
 		}
 	}
-	
-	
+
+
 	// replace template placeholders
 	$tpl_content = $template_record['template'];
-	if($_POST['domain'] != '') $tpl_content = str_replace('{DOMAIN}',$_POST['domain'],$tpl_content);
-	if($_POST['ip'] != '') $tpl_content = str_replace('{IP}',$_POST['ip'],$tpl_content);
-	if($_POST['ns1'] != '') $tpl_content = str_replace('{NS1}',$_POST['ns1'],$tpl_content);
-	if($_POST['ns2'] != '') $tpl_content = str_replace('{NS2}',$_POST['ns2'],$tpl_content);
-	if($_POST['email'] != '') $tpl_content = str_replace('{EMAIL}',$_POST['email'],$tpl_content);
-	
+	if($_POST['domain'] != '') $tpl_content = str_replace('{DOMAIN}', $_POST['domain'], $tpl_content);
+	if($_POST['ip'] != '') $tpl_content = str_replace('{IP}', $_POST['ip'], $tpl_content);
+	if($_POST['ns1'] != '') $tpl_content = str_replace('{NS1}', $_POST['ns1'], $tpl_content);
+	if($_POST['ns2'] != '') $tpl_content = str_replace('{NS2}', $_POST['ns2'], $tpl_content);
+	if($_POST['email'] != '') $tpl_content = str_replace('{EMAIL}', $_POST['email'], $tpl_content);
+
 	// Parse the template
-	$tpl_rows = explode("\n",$tpl_content);
+	$tpl_rows = explode("\n", $tpl_content);
 	$section = '';
 	$vars = array();
 	$dns_rr = array();
 	foreach($tpl_rows as $row) {
 		$row = trim($row);
-		if(substr($row,0,1) == '[') {
+		if(substr($row, 0, 1) == '[') {
 			if($row == '[ZONE]') {
 				$section = 'zone';
 			} elseif($row == '[DNS_RECORDS]') {
@@ -215,14 +215,14 @@
 			if($row != '') {
 				// Handle zone section
 				if($section == 'zone') {
-					$parts = explode('=',$row);
+					$parts = explode('=', $row);
 					$key = trim($parts[0]);
 					$val = trim($parts[1]);
 					if($key != '') $vars[$key] = $val;
 				}
 				// Handle DNS Record rows
 				if($section == 'dns_records') {
-					$parts = explode('|',$row);
+					$parts = explode('|', $row);
 					$dns_rr[] = array(
 						'name' => $app->db->quote($parts[1]),
 						'type' => $app->db->quote($parts[0]),
@@ -233,9 +233,9 @@
 				}
 			}
 		}
-		
+
 	} // end foreach
-	
+
 	if($vars['origin'] == '') $error .= $app->lng('error_origin_empty').'<br />';
 	if($vars['ns'] == '') $error .= $app->lng('error_ns_empty').'<br />';
 	if($vars['mbox'] == '') $error .= $app->lng('error_mbox_empty').'<br />';
@@ -244,13 +244,13 @@
 	if($vars['expire'] == '') $error .= $app->lng('error_expire_empty').'<br />';
 	if($vars['minimum'] == '') $error .= $app->lng('error_minimum_empty').'<br />';
 	if($vars['ttl'] == '') $error .= $app->lng('error_ttl_empty').'<br />';
-	
+
 	if($error == '') {
 		// Insert the soa record
 		$sys_userid = $_SESSION['s']['user']['userid'];
 		$origin = $app->db->quote($vars['origin']);
 		$ns = $app->db->quote($vars['ns']);
-		$mbox = $app->db->quote(str_replace('@','.',$vars['mbox']));
+		$mbox = $app->db->quote(str_replace('@', '.', $vars['mbox']));
 		$refresh = $app->db->quote($vars['refresh']);
 		$retry = $app->db->quote($vars['retry']);
 		$expire = $app->db->quote($vars['expire']);
@@ -260,39 +260,39 @@
 		$also_notify = $app->db->quote($vars['also_notify']);
 		$update_acl = $app->db->quote($vars['update_acl']);
 		$serial = $app->validate_dns->increase_serial(0);
-		
-		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`, `also_notify`, `update_acl`) VALUES 
+
+		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`, `also_notify`, `update_acl`) VALUES
 		('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '$xfer', '$also_notify', '$update_acl')";
 		$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
-		
+
 		// Insert the dns_rr records
 		if(is_array($dns_rr) && $dns_soa_id > 0) {
 			foreach($dns_rr as $rr) {
-				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES 
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES
 				('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$rr[name]', '$rr[type]', '$rr[data]', '$rr[aux]', '$rr[ttl]', 'Y')";
 				$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
 			}
 		}
-		
+
 		header("Location: dns_soa_list.php");
 		exit;
-		
+
 	} else {
-		$app->tpl->setVar("error",$error);
+		$app->tpl->setVar("error", $error);
 	}
-	
+
 }
 
 
 
-$app->tpl->setVar("title",'DNS Wizard');
+$app->tpl->setVar("title", 'DNS Wizard');
 
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_a.tform.php b/interface/web/dns/form/dns_a.tform.php
index d6e93ff..7d4d276 100644
--- a/interface/web/dns/form/dns_a.tform.php
+++ b/interface/web/dns/form/dns_a.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS A";
-$form["description"] 	= "";
-$form["name"] 			= "dns_a";
-$form["action"]			= "dns_a_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS A";
+$form["description"]  = "";
+$form["name"]    = "dns_a";
+$form["action"]   = "dns_a_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,69 +52,69 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS A",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_a_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS A",
+	'width'  => 100,
+	'template'  => "templates/dns_a_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\a-zA-Z0-9\.\-\*]{0,64}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\a-zA-Z0-9\.\-\*]{0,64}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'A',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'A',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9]{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^([1-9]{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -127,41 +127,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_aaaa.tform.php b/interface/web/dns/form/dns_aaaa.tform.php
index d674913..c03423b 100644
--- a/interface/web/dns/form/dns_aaaa.tform.php
+++ b/interface/web/dns/form/dns_aaaa.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS AAAA";
-$form["description"] 	= "";
-$form["name"] 			= "dns_aaaa";
-$form["action"]			= "dns_aaaa_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS AAAA";
+$form["description"]  = "";
+$form["name"]    = "dns_aaaa";
+$form["action"]   = "dns_aaaa_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,62 +52,62 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS AAAA",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_aaaa_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS AAAA",
+	'width'  => 100,
+	'template'  => "templates/dns_aaaa_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\*]{0,64}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\*]{0,64}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'AAAA',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'AAAA',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^\s*((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){0,1}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4}){0,4}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?\s*$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^\s*((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){0,1}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4}){0,4}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?\s*$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -120,41 +120,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_alias.tform.php b/interface/web/dns/form/dns_alias.tform.php
index b358b72..b97889b 100644
--- a/interface/web/dns/form/dns_alias.tform.php
+++ b/interface/web/dns/form/dns_alias.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS ALIAS";
-$form["description"] 	= "";
-$form["name"] 			= "dns_alias";
-$form["action"]			= "dns_alias_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS ALIAS";
+$form["description"]  = "";
+$form["name"]    = "dns_alias";
+$form["action"]   = "dns_alias_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,78 +52,78 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS ALIAS",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_alias_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS ALIAS",
+	'width'  => 100,
+	'template'  => "templates/dns_alias_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'name_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'name_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'ALIAS',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'ALIAS',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -136,41 +136,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_cname.tform.php b/interface/web/dns/form/dns_cname.tform.php
index ccfef73..b9d246c 100644
--- a/interface/web/dns/form/dns_cname.tform.php
+++ b/interface/web/dns/form/dns_cname.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS CNAME";
-$form["description"] 	= "";
-$form["name"] 			= "dns_cname";
-$form["action"]			= "dns_cname_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS CNAME";
+$form["description"]  = "";
+$form["name"]    = "dns_cname";
+$form["action"]   = "dns_cname_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,76 +52,76 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS CNAME",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_cname_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS CNAME",
+	'width'  => 100,
+	'template'  => "templates/dns_cname_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\*]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\*]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'CNAME',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'CNAME',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -134,41 +134,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_hinfo.tform.php b/interface/web/dns/form/dns_hinfo.tform.php
index 70971cf..c64dea0 100644
--- a/interface/web/dns/form/dns_hinfo.tform.php
+++ b/interface/web/dns/form/dns_hinfo.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS hinfo";
-$form["description"] 	= "";
-$form["name"] 			= "dns_hinfo";
-$form["action"]			= "dns_hinfo_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS hinfo";
+$form["description"]  = "";
+$form["name"]    = "dns_hinfo";
+$form["action"]   = "dns_hinfo_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,68 +52,68 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS HINFO",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_hinfo_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS HINFO",
+	'width'  => 100,
+	'template'  => "templates/dns_hinfo_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'name_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,64}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'name_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,64}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'HINFO',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'HINFO',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -126,41 +126,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_mx.tform.php b/interface/web/dns/form/dns_mx.tform.php
index a1f7b78..34268f9 100644
--- a/interface/web/dns/form/dns_mx.tform.php
+++ b/interface/web/dns/form/dns_mx.tform.php
@@ -35,16 +35,16 @@
 
 global $app;
 
-$form["title"] 			= "DNS mx";
-$form["description"] 	= "";
-$form["name"] 			= "dns_mx";
-$form["action"]			= "dns_mx_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS mx";
+$form["description"]  = "";
+$form["name"]    = "dns_mx";
+$form["action"]   = "dns_mx_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -53,123 +53,123 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS mx",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_mx_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS mx",
+	'width'  => 100,
+	'template'  => "templates/dns_mx_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\*]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\*]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'MX',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'MX',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-		
+
 		'aux' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '10',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-		
+
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_ns.tform.php b/interface/web/dns/form/dns_ns.tform.php
index 00a842f..3eb39a9 100644
--- a/interface/web/dns/form/dns_ns.tform.php
+++ b/interface/web/dns/form/dns_ns.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS ns";
-$form["description"] 	= "";
-$form["name"] 			= "dns_ns";
-$form["action"]			= "dns_ns_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS ns";
+$form["description"]  = "";
+$form["name"]    = "dns_ns";
+$form["action"]   = "dns_ns_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,76 +52,76 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS ns",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_ns_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS ns",
+	'width'  => 100,
+	'template'  => "templates/dns_ns_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'NS',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'NS',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -134,41 +134,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_ptr.tform.php b/interface/web/dns/form/dns_ptr.tform.php
index 68ea83c..3ba441b 100644
--- a/interface/web/dns/form/dns_ptr.tform.php
+++ b/interface/web/dns/form/dns_ptr.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS ptr";
-$form["description"] 	= "";
-$form["name"] 			= "dns_ptr";
-$form["action"]			= "dns_ptr_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS ptr";
+$form["description"]  = "";
+$form["name"]    = "dns_ptr";
+$form["action"]   = "dns_ptr_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,76 +52,76 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS ptr",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_ptr_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS ptr",
+	'width'  => 100,
+	'template'  => "templates/dns_ptr_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,256}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,256}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'PTR',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'PTR',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,256}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,256}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -134,41 +134,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_rp.tform.php b/interface/web/dns/form/dns_rp.tform.php
index 5a7ff83..86c43ed 100644
--- a/interface/web/dns/form/dns_rp.tform.php
+++ b/interface/web/dns/form/dns_rp.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS RP";
-$form["description"] 	= "";
-$form["name"] 			= "dns_rp";
-$form["action"]			= "dns_rp_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS RP";
+$form["description"]  = "";
+$form["name"]    = "dns_rp";
+$form["action"]   = "dns_rp_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,69 +52,69 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS RP",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_rp_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS RP",
+	'width'  => 100,
+	'template'  => "templates/dns_rp_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 			'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                          'type' => 'IDNTOASCII'),
-                              1 => array( 'event' => 'SHOW',
-                                          'type' => 'IDNTOUTF8'),
-                              2 => array( 'event' => 'SAVE',
-                                          'type' => 'TOLOWER')
-                            ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'RP',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'RP',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\s]{1,128}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\s]{1,128}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -127,41 +127,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_slave.tform.php b/interface/web/dns/form/dns_slave.tform.php
index 0ff6a5e..c518731 100644
--- a/interface/web/dns/form/dns_slave.tform.php
+++ b/interface/web/dns/form/dns_slave.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Secondary DNS Zone";
-$form["description"] 	= "";
-$form["name"] 			= "dns_slave";
-$form["action"]			= "dns_slave_edit.php";
-$form["db_table"]		= "dns_slave";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns_slave";
-$form["list_default"]	= "dns_slave_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Secondary DNS Zone";
+$form["description"]  = "";
+$form["name"]    = "dns_slave";
+$form["action"]   = "dns_slave_edit.php";
+$form["db_table"]  = "dns_slave";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns_slave";
+$form["list_default"] = "dns_slave_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,85 +56,85 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns_slave'] = array (
-	'title' 	=> "Secondary DNS Zone",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_slave_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Secondary DNS Zone",
+	'width'  => 100,
+	'template'  => "templates/dns_slave_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'server_id_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'server_id_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'origin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'origin_error_empty'),
-										/*
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'origin_error_empty'),
+				/*
 										1 => array (	'type'	=> 'UNIQUE',
 														'errmsg'=> 'origin_error_unique'),
 										*/
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,10}[\.]{0,1}$/',
-														'errmsg'=> 'origin_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,10}[\.]{0,1}$/',
+					'errmsg'=> 'origin_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'ns' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[0-9\.]{1,255}$/',
-														'errmsg'=> 'ns_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9\.]{1,255}$/',
+					'errmsg'=> 'ns_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
-                'xfer' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '30',
-                        'maxlength'     => '255'
-                ),
-		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+		'xfer' => array (
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '30',
+			'maxlength'     => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		'active' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/dns/form/dns_soa.tform.php b/interface/web/dns/form/dns_soa.tform.php
index ebc49cf..fd41c87 100644
--- a/interface/web/dns/form/dns_soa.tform.php
+++ b/interface/web/dns/form/dns_soa.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -39,16 +39,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS Zone";
-$form["description"] 	= "";
-$form["name"] 			= "dns_soa";
-$form["action"]			= "dns_soa_edit.php";
-$form["db_table"]		= "dns_soa";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns_soa";
-$form["list_default"]	= "dns_soa_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS Zone";
+$form["description"]  = "";
+$form["name"]    = "dns_soa";
+$form["action"]   = "dns_soa_edit.php";
+$form["db_table"]  = "dns_soa";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns_soa";
+$form["list_default"] = "dns_soa_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -57,235 +57,235 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns_soa'] = array (
-	'title' 	=> "DNS Zone",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_soa_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS Zone",
+	'width'  => 100,
+	'template'  => "templates/dns_soa_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'server_id_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'server_id_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'origin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'origin_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'origin_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
-														'errmsg'=> 'origin_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'origin_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'origin_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
+					'errmsg'=> 'origin_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'ns' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'ns_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'ns_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'mbox' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mbox_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[[a-zA-Z0-9\.\-\_]{0,255}\.$/',
-														'errmsg'=> 'mbox_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mbox_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[[a-zA-Z0-9\.\-\_]{0,255}\.$/',
+					'errmsg'=> 'mbox_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'refresh' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'refresh_range_error'),
-									),
-			'default'	=> '7200',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'refresh_range_error'),
+			),
+			'default' => '7200',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'retry' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'retry_range_error'),
-									),
-			'default'	=> '540',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'retry_range_error'),
+			),
+			'default' => '540',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'expire' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'expire_range_error'),
-									),
-			'default'	=> '604800',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'expire_range_error'),
+			),
+			'default' => '604800',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'minimum' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'minimum_range_error'),
-									),
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'minimum_range_error'),
+			),
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'ttl_range_error'),
-									),
-			'default'	=> '3600',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
+			'default' => '3600',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'xfer' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISIP',
-														'allowempty' => 'y',
-														'separator' => ',',
-														'errmsg'=> 'xfer_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISIP',
+					'allowempty' => 'y',
+					'separator' => ',',
+					'errmsg'=> 'xfer_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'also_notify' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'    => array (  0 => array (	'type'	=> 'ISIP',
-														'allowempty' => 'y',
-														'separator' => ',',
-														'errmsg'=> 'also_notify_error_regex'
-													),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators'    => array (  0 => array ( 'type' => 'ISIP',
+					'allowempty' => 'y',
+					'separator' => ',',
+					'errmsg'=> 'also_notify_error_regex'
+				),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'update_acl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['dns_records'] = array (
-	'title' 	=> "Records",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_records_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		
-	##################################
-	# ENDE Datatable fields
-	##################################
+	'title'  => "Records",
+	'width'  => 100,
+	'template'  => "templates/dns_records_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
+
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	),
 	'plugins' => array (
-     	'dns_records' => array (
-         	'class'   => 'plugin_listview',
-     		'options' => array(
+		'dns_records' => array (
+			'class'   => 'plugin_listview',
+			'options' => array(
 				'listdef' => 'list/dns_a.list.php',
 				'sqlextwhere' => "zone = ".@$app->functions->intval(@$_REQUEST['id']),
 				'sql_order_by' => "ORDER BY type, name"
 			)
-        )
+		)
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_srv.tform.php b/interface/web/dns/form/dns_srv.tform.php
index 736bbc9..b737bbd 100644
--- a/interface/web/dns/form/dns_srv.tform.php
+++ b/interface/web/dns/form/dns_srv.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS SRV";
-$form["description"] 	= "";
-$form["name"] 			= "dns_srv";
-$form["action"]			= "dns_srv_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS SRV";
+$form["description"]  = "";
+$form["name"]    = "dns_srv";
+$form["action"]   = "dns_srv_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,114 +52,114 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS SRV",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_srv_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS SRV",
+	'width'  => 100,
+	'template'  => "templates/dns_srv_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'SRV',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'SRV',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
- 										1 => array (	'type'	=> 'REGEX',
- 														'regex' => '/^[\w\.\-]{0,64}\s[\w\.\-]{0,64}\s[\w\.\-]{0,64}$/',
- 														'errmsg'=> 'srv_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}\s[\w\.\-]{0,64}\s[\w\.\-]{0,64}$/',
+					'errmsg'=> 'srv_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'aux' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_template.tform.php b/interface/web/dns/form/dns_template.tform.php
index 1f020da..c874928 100644
--- a/interface/web/dns/form/dns_template.tform.php
+++ b/interface/web/dns/form/dns_template.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "DNS Wizard template";
-$form["description"] 	= "";
-$form["name"] 			= "dns_template";
-$form["action"]			= "dns_template_edit.php";
-$form["db_table"]		= "dns_template";
-$form["db_table_idx"]	= "template_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "template";
-$form["list_default"]	= "dns_template_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS Wizard template";
+$form["description"]  = "";
+$form["name"]    = "dns_template";
+$form["action"]   = "dns_template_edit.php";
+$form["db_table"]  = "dns_template";
+$form["db_table_idx"] = "template_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "template";
+$form["list_default"] = "dns_template_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,51 +51,51 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['template'] = array (
-	'title' 	=> "DNS Template",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_template_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS Template",
+	'width'  => 100,
+	'template'  => "templates/dns_template_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'name_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'name_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'fields' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'default' => '',
 			'separator' => ',',
-			'value'		=> array('DOMAIN' => 'Domain','IP' => 'IP Address','NS1' => 'NS 1','NS2' => 'NS 2','EMAIL' => 'Email')
+			'value'  => array('DOMAIN' => 'Domain', 'IP' => 'IP Address', 'NS1' => 'NS 1', 'NS2' => 'NS 2', 'EMAIL' => 'Email')
 		),
 		'template' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '40',
-			'rows'		=> '15'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'cols'  => '40',
+			'rows'  => '15'
 		),
 		'visible' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_txt.tform.php b/interface/web/dns/form/dns_txt.tform.php
index c59fa75..159629b 100644
--- a/interface/web/dns/form/dns_txt.tform.php
+++ b/interface/web/dns/form/dns_txt.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS TXT Record";
-$form["description"] 	= "";
-$form["name"] 			= "dns_txt";
-$form["action"]			= "dns_txt_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS TXT Record";
+$form["description"]  = "";
+$form["name"]    = "dns_txt";
+$form["action"]   = "dns_txt_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,66 +52,66 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS TXT",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_txt_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS TXT",
+	'width'  => 100,
+	'template'  => "templates/dns_txt_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'TXT',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'TXT',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -124,41 +124,41 @@
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/lib/admin.conf.php b/interface/web/dns/lib/admin.conf.php
index 67c94a5..acb6c35 100644
--- a/interface/web/dns/lib/admin.conf.php
+++ b/interface/web/dns/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/lib/module.conf.php b/interface/web/dns/lib/module.conf.php
index 1af3a89..83027c6 100644
--- a/interface/web/dns/lib/module.conf.php
+++ b/interface/web/dns/lib/module.conf.php
@@ -1,33 +1,33 @@
 <?php
 
-$module["name"] 		= "dns";
-$module["title"] 		= "top_menu_dns";
-$module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "dns/dns_soa_list.php";
+$module["name"]   = "dns";
+$module["title"]   = "top_menu_dns";
+$module["template"]  = "module.tpl.htm";
+$module["startpage"]  = "dns/dns_soa_list.php";
 $module["tab_width"]    = '';
 
 
-$items[] = array( 'title' 	=> "Add DNS Zone",
-				  'target' 	=> 'content',
-				  'link'	=> 'dns/dns_wizard.php',
-				  'html_id' => 'dns_wizard');
+$items[] = array( 'title'  => "Add DNS Zone",
+	'target'  => 'content',
+	'link' => 'dns/dns_wizard.php',
+	'html_id' => 'dns_wizard');
 
-$items[] = array( 'title' 	=> "Import Zone File",
-				  'target' 	=> 'content',
-				  'link'	=> 'dns/dns_import.php',
-				  'html_id' => 'dns_import');
+$items[] = array( 'title'  => "Import Zone File",
+	'target'  => 'content',
+	'link' => 'dns/dns_import.php',
+	'html_id' => 'dns_import');
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
-  $items[] = array( 	'title' 	=> "Templates",
-				  'target' 	=> 'content',
-				  'link'		=> 'dns/dns_template_list.php',
-				  'html_id' => 'dns_template_list');
+	$items[] = array(  'title'  => "Templates",
+		'target'  => 'content',
+		'link'  => 'dns/dns_template_list.php',
+		'html_id' => 'dns_template_list');
 }
 
 
-$module["nav"][] = array(	'title'	=> 'DNS Wizard',
-							'open' 	=> 1,
-							'items'	=> $items);
+$module["nav"][] = array( 'title' => 'DNS Wizard',
+	'open'  => 1,
+	'items' => $items);
 
 
 unset($items);
@@ -37,10 +37,10 @@
 */
 
 
-$items[] = array( 'title' 	=> "Zones",
-				  'target' 	=> 'content',
-				  'link'	=> 'dns/dns_soa_list.php',
-				  'html_id' => 'dns_soa_list');
+$items[] = array( 'title'  => "Zones",
+	'target'  => 'content',
+	'link' => 'dns/dns_soa_list.php',
+	'html_id' => 'dns_soa_list');
 /*
 $items[] = array( 'title' 	=> "A-Records",
 				  'target' 	=> 'content',
@@ -49,20 +49,20 @@
 */
 
 
-$module["nav"][] = array(	'title'	=> 'DNS',
-							'open' 	=> 1,
-							'items'	=> $items);
+$module["nav"][] = array( 'title' => 'DNS',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
-$items[] = array( 'title' 	=> "Secondary Zones",
-				  'target' 	=> 'content',
-				  'link'	=> 'dns/dns_slave_list.php',
-				  'html_id' => 'dns_slave_list');
+$items[] = array( 'title'  => "Secondary Zones",
+	'target'  => 'content',
+	'link' => 'dns/dns_slave_list.php',
+	'html_id' => 'dns_slave_list');
 
-$module["nav"][] = array(	'title'	=> 'Secondary DNS',
-							'open' 	=> 1,
-							'items'	=> $items);
+$module["nav"][] = array( 'title' => 'Secondary DNS',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
@@ -70,4 +70,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/lib/remote.conf.php b/interface/web/dns/lib/remote.conf.php
index e14b5b7..dcabf94 100644
--- a/interface/web/dns/lib/remote.conf.php
+++ b/interface/web/dns/lib/remote.conf.php
@@ -13,4 +13,4 @@
 $function_list['dns_srv_get,dns_srv_add,dns_srv_update,dns_srv_delete'] = 'DNS srv functions';
 $function_list['dns_txt_get,dns_txt_add,dns_txt_update,dns_txt_delete'] = 'DNS txt functions';
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/list/dns_a.list.php b/interface/web/dns/list/dns_a.list.php
index 75076d0..3b47cf1 100644
--- a/interface/web/dns/list/dns_a.list.php
+++ b/interface/web/dns/list/dns_a.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "dns_a";
+$liste["name"]     = "dns_a";
 
 // Database table
-$liste["table"] 			= "dns_rr";
+$liste["table"]    = "dns_rr";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "dns_a_list.php";
+$liste["file"]    = "dns_a_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "dns_a_edit.php";
+$liste["edit_file"]   = "dns_a_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "dns_a_del.php";
+$liste["delete_file"]  = "dns_a_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,91 +48,91 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "zone",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT id,origin FROM dns_soa WHERE {AUTHSQL} ORDER BY origin',
-														'keyfield'=> 'id',
-														'valuefield'=> 'origin'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "zone",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT id,origin FROM dns_soa WHERE {AUTHSQL} ORDER BY origin',
+		'keyfield'=> 'id',
+		'valuefield'=> 'origin'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "data",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "data",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "aux",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "aux",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "ttl",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "ttl",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('A'=>'A','AAAA' => 'AAAA','ALIAS'=>'ALIAS','CNAME'=>'CNAME','HINFO'=>'HINFO','MX'=>'MX','NS'=>'NS','PTR'=>'PTR','RP'=>'RP','SRV'=>'SRV','TXT'=>'TXT'));
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('A'=>'A', 'AAAA' => 'AAAA', 'ALIAS'=>'ALIAS', 'CNAME'=>'CNAME', 'HINFO'=>'HINFO', 'MX'=>'MX', 'NS'=>'NS', 'PTR'=>'PTR', 'RP'=>'RP', 'SRV'=>'SRV', 'TXT'=>'TXT'));
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/list/dns_slave.list.php b/interface/web/dns/list/dns_slave.list.php
index f00d33b..5a242de 100644
--- a/interface/web/dns/list/dns_slave.list.php
+++ b/interface/web/dns/list/dns_slave.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "dns_slave";
+$liste["name"]    = "dns_slave";
 
 // Database table
-$liste["table"] 		= "dns_slave";
+$liste["table"]   = "dns_slave";
 
 // Index index field of the database table
-$liste["table_idx"]		= "id";
+$liste["table_idx"]  = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "dns_slave_list.php";
+$liste["file"]   = "dns_slave_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "dns_slave_edit.php";
+$liste["edit_file"]  = "dns_slave_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "dns_slave_del.php";
+$liste["delete_file"]  = "dns_slave_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -49,51 +49,51 @@
 
 
 $liste["item"][] = array(   'field'     => "active",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(   'field'	=> "server_id",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'datasource'=> array (  'type' => 'CUSTOM',
-                                                    'class' => 'custom_datasource',
-                                                    'function' => 'slave_dns_servers'
-                                                ),
-                            'width'	=> "",
-                            'value'	=> "");
+$liste["item"][] = array(   'field' => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource'=> array (  'type' => 'CUSTOM',
+		'class' => 'custom_datasource',
+		'function' => 'slave_dns_servers'
+	),
+	'width' => "",
+	'value' => "");
 
-$liste["item"][] = array(   'field'	=> "origin",
-                            'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+$liste["item"][] = array(   'field' => "origin",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 
-$liste["item"][] = array(   'field'	=> "ns",
-                            'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+$liste["item"][] = array(   'field' => "ns",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/list/dns_soa.list.php b/interface/web/dns/list/dns_soa.list.php
index 46ec9c9..e3b240a 100644
--- a/interface/web/dns/list/dns_soa.list.php
+++ b/interface/web/dns/list/dns_soa.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "dns_soa";
+$liste["name"]     = "dns_soa";
 
 // Database table
-$liste["table"] 			= "dns_soa";
+$liste["table"]    = "dns_soa";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "dns_soa_list.php";
+$liste["file"]    = "dns_soa_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "dns_soa_edit.php";
+$liste["edit_file"]   = "dns_soa_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "dns_soa_del.php";
+$liste["delete_file"]  = "dns_soa_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,66 +48,66 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-														'class'=> 'custom_datasource',
-														'function'=> 'dns_servers'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'CUSTOM',
+		'class'=> 'custom_datasource',
+		'function'=> 'dns_servers'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "origin",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "origin",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "ns",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "ns",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "mbox",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "mbox",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
 
@@ -117,4 +117,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/list/dns_template.list.php b/interface/web/dns/list/dns_template.list.php
index 58055fb..63302d9 100644
--- a/interface/web/dns/list/dns_template.list.php
+++ b/interface/web/dns/list/dns_template.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "dns_template";
+$liste["name"]    = "dns_template";
 
 // Database table
-$liste["table"] 		= "dns_template";
+$liste["table"]   = "dns_template";
 
 // Index index field of the database table
-$liste["table_idx"]		= "template_id";
+$liste["table_idx"]  = "template_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "dns_template_list.php";
+$liste["file"]   = "dns_template_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "dns_template_edit.php";
+$liste["edit_file"]  = "dns_template_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "dns_template_del.php";
+$liste["delete_file"]  = "dns_template_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -49,22 +49,22 @@
 
 
 $liste["item"][] = array(   'field'     => "visible",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(   'field'	=> "name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+$liste["item"][] = array(   'field' => "name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/faq_delete.php b/interface/web/help/faq_delete.php
index 2e501d4..e8f3627 100644
--- a/interface/web/help/faq_delete.php
+++ b/interface/web/help/faq_delete.php
@@ -5,11 +5,11 @@
 $tform_def_file = 'form/faq.tform.php';
 
 // Include the base libraries
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die;
 }
diff --git a/interface/web/help/faq_edit.php b/interface/web/help/faq_edit.php
index 028c511..629bde8 100644
--- a/interface/web/help/faq_edit.php
+++ b/interface/web/help/faq_edit.php
@@ -4,11 +4,11 @@
 $tform_def_file = 'form/faq.tform.php';
 
 // include the core configuration and application classes
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check the  module permissions and redirect if not allowed.
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die;
 }
diff --git a/interface/web/help/faq_list.php b/interface/web/help/faq_list.php
index 79e9b6f..2f48b4d 100644
--- a/interface/web/help/faq_list.php
+++ b/interface/web/help/faq_list.php
@@ -1,13 +1,13 @@
 <?php
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Path to the list definition file
 $list_def_file = 'list/faq_list.php';
 
 // Check the module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die();
 }
@@ -18,7 +18,7 @@
 // Optional limit
 $hf_section = 0;
 if(isset($_GET['hfs_id']))
-	$hf_section = preg_replace("/[^0-9]/","",$_GET['hfs_id']);
+	$hf_section = preg_replace("/[^0-9]/", "", $_GET['hfs_id']);
 
 // if section id is not specified in the url, choose the first existing section
 if(!$hf_section)
diff --git a/interface/web/help/faq_manage_questions_list.php b/interface/web/help/faq_manage_questions_list.php
index ad34619..e728244 100644
--- a/interface/web/help/faq_manage_questions_list.php
+++ b/interface/web/help/faq_manage_questions_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Path to the list definition file
 $list_def_file = "list/faq_manage_questions_list.php";
@@ -12,7 +12,7 @@
 $app->uses('listform_actions');
 
 //* Optional limit
-#$app->listform_actions->SQLExtWhere = "recipient_id = ".$_SESSION['s']['user']['userid'];
+//$app->listform_actions->SQLExtWhere = "recipient_id = ".$_SESSION['s']['user']['userid'];
 
 //* Start the form rendering and action ahndling
 $app->listform_actions->onLoad();
diff --git a/interface/web/help/faq_sections_delete.php b/interface/web/help/faq_sections_delete.php
index 9a47e9b..adcacf4 100644
--- a/interface/web/help/faq_sections_delete.php
+++ b/interface/web/help/faq_sections_delete.php
@@ -5,11 +5,11 @@
 $tform_def_file = 'form/faq_sections.tform.php';
 
 // Include the base libraries
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die;
 }
diff --git a/interface/web/help/faq_sections_edit.php b/interface/web/help/faq_sections_edit.php
index 73d0280..32f0123 100644
--- a/interface/web/help/faq_sections_edit.php
+++ b/interface/web/help/faq_sections_edit.php
@@ -4,11 +4,11 @@
 $tform_def_file = 'form/faq_sections.tform.php';
 
 // include the core configuration and application classes
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check the  module permissions and redirect if not allowed.
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die;
 }
diff --git a/interface/web/help/faq_sections_list.php b/interface/web/help/faq_sections_list.php
index e6f9979..4acb4ae 100644
--- a/interface/web/help/faq_sections_list.php
+++ b/interface/web/help/faq_sections_list.php
@@ -1,13 +1,13 @@
 <?php
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Path to the list definition file
 $list_def_file = 'list/faq_sections_list.php';
 
 // Check the module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die();
 }
diff --git a/interface/web/help/form/faq.tform.php b/interface/web/help/form/faq.tform.php
index 276b9d8..e795f35 100644
--- a/interface/web/help/form/faq.tform.php
+++ b/interface/web/help/form/faq.tform.php
@@ -1,105 +1,105 @@
 <?php
 
 // Title of the form.
-$form['title'] 			= 'Frequently Asked Questions';
+$form['title']    = 'Frequently Asked Questions';
 
 // Optional description of the form.
-$form['description'] 	= '';
+$form['description']  = '';
 
 // Name of the form which cannot contain spaces or foreign characters.
-$form['name'] 			= 'faq_form';
+$form['name']    = 'faq_form';
 
 // The file that is used to call the form in the browser.
-$form['action']			= 'faq_edit.php';
+$form['action']   = 'faq_edit.php';
 
 // The name of the database table used to store the data
-$form['db_table']		= 'help_faq';
+$form['db_table']  = 'help_faq';
 
 // The name of the database table index field.
 // This field must be a numeric auto increment column.
-$form['db_table_idx']	= 'hf_id';
+$form['db_table_idx'] = 'hf_id';
 
 // Should changes to this table be stored in the database history (sys_datalog) table.
 // This should be set to 'yes' for all tables that store configuration information.
-$form['db_history']		= 'no'; 
+$form['db_history']  = 'no';
 
 // The name of the tab that is shown when the form is opened
-$form['tab_default']	= 'message';
+$form['tab_default'] = 'message';
 
 // The name of the default list file of this form
-$form['list_default']	= 'faq_manage_questions_list.php';
+$form['list_default'] = 'faq_manage_questions_list.php';
 
 // Use the internal authentication system for this table. This should
 // be set to 'yes' in most cases, otherwise 'no'.
-$form['auth']			= 'yes'; 
+$form['auth']   = 'yes';
 
 //** Authentication presets. The defaults below does not need to be changed in most cases.
 
 // 0 = id of the user, > 0 id must match with id of current user
 $form['auth_preset']['userid']  = 0;
 
- // 0 = default groupid of the user, > 0 id must match with groupid of current
+// 0 = default groupid of the user, > 0 id must match with groupid of current
 $form['auth_preset']['groupid'] = 0;
 
 // Permissions with the following codes: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user'] = 'riud';
 $form['auth_preset']['perm_group'] = 'riud';
-$form['auth_preset']['perm_other'] = 'r'; 
+$form['auth_preset']['perm_other'] = 'r';
 
 // The form definition of the first tab. The name of the tab is called 'message'. We refer
 // to this name in the $form['tab_default'] setting above.
 $form['tabs']['message'] = array(
-	'title'		=> 'FAQ', // Title of the Tab
-	'width' 	=> 100,       // Tab width
-	'template' 	=> 'templates/faq_edit.htm', // Template file name
-	'fields' 	=> array(
+	'title'  => 'FAQ', // Title of the Tab
+	'width'  => 100,       // Tab width
+	'template'  => 'templates/faq_edit.htm', // Template file name
+	'fields'  => array(
 
-        //*** BEGIN Datatable columns **********************************
+		//*** BEGIN Datatable columns **********************************
 
-	'hf_section' => array (
-		'datatype'      => 'INTEGER',
-		'formtype'      => 'SELECT',
-		'default'       => '',
-		'datasource'    => array (	'type'		=> 'SQL',
-						'querystring'	=> 'SELECT hfs_id,hfs_name FROM help_faq_sections',
-						'keyfield'	=> 'hfs_id',
-						'valuefield'    => 'hfs_name'
-						),
-		'validators'	=> array (	0 => array (
-							'type'  => 'ISINT',
-							'errmsg'=> 'recipient_id_is_not_integer'),
-						),
-		'value'		=> ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
+		'hf_section' => array (
+			'datatype'      => 'INTEGER',
+			'formtype'      => 'SELECT',
+			'default'       => '',
+			'datasource'    => array ( 'type'  => 'SQL',
+				'querystring' => 'SELECT hfs_id,hfs_name FROM help_faq_sections',
+				'keyfield' => 'hfs_id',
+				'valuefield'    => 'hfs_name'
+			),
+			'validators' => array ( 0 => array (
+					'type'  => 'ISINT',
+					'errmsg'=> 'recipient_id_is_not_integer'),
+			),
+			'value'  => ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
 		),
 
-	'hf_question' => array(
-		'datatype'	=> 'VARCHAR',
-		'formtype'	=> 'TEXT',
-		'validators'	=> array( 0 => array(	'type'  => 'NOTEMPTY',
-							'errmsg'=> 'subject_is_empty'
-					),
-			),
-		'default'     => '',
-		'value'      => '',
-		'width'      => '30',
-		'maxlength'  => '255'
-	),
-
-	'hf_answer' => array(
-		'datatype'	=> 'TEXT',
-		'formtype'	=> 'TEXTAREA',
-		'validators' => array( 0 => array( 	'type'		=> 'NOTEMPTY',
-							'errmsg'	=> 'message_is_empty'
-					),
+		'hf_question' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array( 0 => array( 'type'  => 'NOTEMPTY',
+					'errmsg'=> 'subject_is_empty'
 				),
-		'default'	=> '',
-		'value'		=> '',
-		'cols'		=> '30',
-		'rows'		=> '10',
-		'maxlength'	=> '255'
-	),
+			),
+			'default'     => '',
+			'value'      => '',
+			'width'      => '30',
+			'maxlength'  => '255'
+		),
 
-	//*** END Datatable columns **********************************
+		'hf_answer' => array(
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'validators' => array( 0 => array(  'type'  => 'NOTEMPTY',
+					'errmsg' => 'message_is_empty'
+				),
+			),
+			'default' => '',
+			'value'  => '',
+			'cols'  => '30',
+			'rows'  => '10',
+			'maxlength' => '255'
+		),
+
+		//*** END Datatable columns **********************************
 	)
 );
 ?>
diff --git a/interface/web/help/form/faq_sections.tform.php b/interface/web/help/form/faq_sections.tform.php
index d849f27..1a10768 100644
--- a/interface/web/help/form/faq_sections.tform.php
+++ b/interface/web/help/form/faq_sections.tform.php
@@ -1,72 +1,72 @@
 <?php
 
 // Title of the form.
-$form['title'] 			= 'FAQ Sections';
+$form['title']    = 'FAQ Sections';
 
 // Optional description of the form.
-$form['description'] 	= '';
+$form['description']  = '';
 
 // Name of the form which cannot contain spaces or foreign characters.
-$form['name'] 			= 'faq_sections_form';
+$form['name']    = 'faq_sections_form';
 
 // The file that is used to call the form in the browser.
-$form['action']			= 'faq_sections_edit.php';
+$form['action']   = 'faq_sections_edit.php';
 
 // The name of the database table used to store the data
-$form['db_table']		= 'help_faq_sections';
+$form['db_table']  = 'help_faq_sections';
 
 // The name of the database table index field.
 // This field must be a numeric auto increment column.
-$form['db_table_idx']	= 'hfs_id';
+$form['db_table_idx'] = 'hfs_id';
 
 // Should changes to this table be stored in the database history (sys_datalog) table.
 // This should be set to 'yes' for all tables that store configuration information.
-$form['db_history']		= 'no'; 
+$form['db_history']  = 'no';
 
 // The name of the tab that is shown when the form is opened
-$form['tab_default']	= 'message';
+$form['tab_default'] = 'message';
 
 // The name of the default list file of this form
-$form['list_default']	= 'faq_sections_list.php';
+$form['list_default'] = 'faq_sections_list.php';
 
 // Use the internal authentication system for this table. This should
 // be set to 'yes' in most cases, otherwise 'no'.
-$form['auth']			= 'yes'; 
+$form['auth']   = 'yes';
 
 //** Authentication presets. The defaults below does not need to be changed in most cases.
 
 // 0 = id of the user, > 0 id must match with id of current user
 $form['auth_preset']['userid']  = 0;
 
- // 0 = default groupid of the user, > 0 id must match with groupid of current
+// 0 = default groupid of the user, > 0 id must match with groupid of current
 $form['auth_preset']['groupid'] = 0;
 
 // Permissions with the following codes: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user'] = 'riud';
 $form['auth_preset']['perm_group'] = 'riud';
-$form['auth_preset']['perm_other'] = ''; 
+$form['auth_preset']['perm_other'] = '';
 
 // The form definition of the first tab. The name of the tab is called 'message'. We refer
 // to this name in the $form['tab_default'] setting above.
 $form['tabs']['message'] = array(
-	'title' 	=> 'FAQ', // Title of the Tab
-	'width' 	=> 100,       // Tab width
-	'template' 	=> 'templates/faq_sections_edit.htm', // Template file name
-	'fields' 	=> array(
+	'title'  => 'FAQ', // Title of the Tab
+	'width'  => 100,       // Tab width
+	'template'  => 'templates/faq_sections_edit.htm', // Template file name
+	'fields'  => array(
 
-	//*** BEGIN Datatable columns **********************************
+		//*** BEGIN Datatable columns **********************************
 
-	'hfs_name' 	=> array(
-		'datatype'	=> 'VARCHAR',
-		'formtype'	=> 'TEXT',
-		'validators'=> array( 0 => array( 	'type'	=> 'NOTEMPTY',
-											'errmsg'=> 'subject_is_empty'
-										),
-							),
-		'default'	=> '',
-		'value'		=> '',
-		'width'		=> '30',
-		'maxlength'	=> '255'
+		'hfs_name'  => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators'=> array( 0 => array(  'type' => 'NOTEMPTY',
+					'errmsg'=> 'subject_is_empty'
+				),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		//*** END Datatable columns *********************************
 	)
diff --git a/interface/web/help/form/support_message.tform.php b/interface/web/help/form/support_message.tform.php
index a8c0847..d982712 100644
--- a/interface/web/help/form/support_message.tform.php
+++ b/interface/web/help/form/support_message.tform.php
@@ -1,36 +1,36 @@
 <?php
 
 //* Title of the form
-$form["title"] 			= "Support Message";
+$form["title"]    = "Support Message";
 
 //* Description of the form (optional)
-$form["description"] 	= "";
+$form["description"]  = "";
 
 //* Name of the form. The name shall not contain spaces or foreign characters
-$form["name"] 			= "support_message";
+$form["name"]    = "support_message";
 
 //* The file that is used to call the form in the browser
-$form["action"]			= "support_message_edit.php";
+$form["action"]   = "support_message_edit.php";
 
 //* The name of the database table that shall be used to store the data
-$form["db_table"]		= "support_message";
+$form["db_table"]  = "support_message";
 
 //* The name of the database table index field, this field must be a numeric auto increment column
-$form["db_table_idx"]	= "support_message_id";
+$form["db_table_idx"] = "support_message_id";
 
 //* Shall changes to this table be stored in the database history (sys_datalog) table.
 //* This should be set to "yes" for all tables that store configuration information.
-$form["db_history"]		= "no"; // yes / no
+$form["db_history"]  = "no"; // yes / no
 
 //* The name of the tab that is shown when the form is opened
-$form["tab_default"]	= "message";
+$form["tab_default"] = "message";
 
 //* The name of the default list file of this form
-$form["list_default"]	= "support_message_list.php";
+$form["list_default"] = "support_message_list.php";
 
 //* Use the internal authentication system for this table. This should
 //* be set to yes in most cases
-$form["auth"]			= 'yes'; // yes / no
+$form["auth"]   = 'yes'; // yes / no
 
 //* Authentication presets. The defaults below does not need to be changed in most cases.
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
@@ -45,12 +45,12 @@
 $sm_default_subject = '';
 if(isset($_GET['reply']))
 {
-	$sm_msg_id = preg_replace("/[^0-9]/","",$_GET['reply']);
+	$sm_msg_id = preg_replace("/[^0-9]/", "", $_GET['reply']);
 	$res = $app->db->queryOneRecord("SELECT sender_id, subject FROM support_message WHERE support_message_id=$sm_msg_id");
 	if($res['sender_id'])
 	{
-		$sm_default_recipient_id = $res['sender_id'];	
-		$sm_default_subject = (preg_match("/^Re:/",$res['subject'])?"":"Re: ") . $res['subject'];
+		$sm_default_recipient_id = $res['sender_id'];
+		$sm_default_subject = (preg_match("/^Re:/", $res['subject'])?"":"Re: ") . $res['subject'];
 	}
 }
 
@@ -59,75 +59,75 @@
 //* Begin of the form definition of the first tab. The name of the tab is called "message". We refer
 //* to this name in the $form["tab_default"] setting above.
 $form["tabs"]['message'] = array (
-	'title' 	=> "Message", // Title of the Tab
-	'width' 	=> 100, // Tab width
-	'template' 	=> "templates/support_message_edit.htm", // Template file name
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Message", // Title of the Tab
+	'width'  => 100, // Tab width
+	'template'  => "templates/support_message_edit.htm", // Template file name
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'recipient_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> $sm_default_recipient_id,
-			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'querystring' 	=> "SELECT sys_user.userid, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_user, client WHERE sys_user.userid != 1 AND sys_user.client_id = client.client_id AND $authsql ORDER BY sys_user.username",
-										'keyfield'		=> 'userid',
-										'valuefield'	=> 'contactname'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'recipient_id_is_not_integer'),
-									),
-			'value'		=> ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => $sm_default_recipient_id,
+			'datasource' => array (  'type'   => 'SQL',
+				'querystring'  => "SELECT sys_user.userid, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_user, client WHERE sys_user.userid != 1 AND sys_user.client_id = client.client_id AND $authsql ORDER BY sys_user.username",
+				'keyfield'  => 'userid',
+				'valuefield' => 'contactname'
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'recipient_id_is_not_integer'),
+			),
+			'value'  => ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
 		),
 		'sender_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'querystring' 	=> 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
-										'keyfield'		=> 'userid',
-										'valuefield'	=> 'username'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'recipient_id_is_not_integer'),
-									),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type'   => 'SQL',
+				'querystring'  => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
+				'keyfield'  => 'userid',
+				'valuefield' => 'username'
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'recipient_id_is_not_integer'),
+			),
+			'value'  => ''
 		),
 		'subject' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'subject_is_empty'),
-									),
-			'default'	=> $sm_default_subject,
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'subject_is_empty'),
+			),
+			'default' => $sm_default_subject,
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'message' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXTAREA',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'message_is_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXTAREA',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'message_is_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'cols'  => '30',
+			'rows'  => '10',
+			'maxlength' => '255'
 		),
 		'tstamp' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> time(),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '30'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => time(),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '30'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/help/index.php b/interface/web/help/index.php
index 93204bc..5aa5f9c 100644
--- a/interface/web/help/index.php
+++ b/interface/web/help/index.php
@@ -13,4 +13,4 @@
   <p>&nbsp;</p>
 </div>
 </BODY>
-</HTML>
\ No newline at end of file
+</HTML>
diff --git a/interface/web/help/lib/admin.conf.php b/interface/web/help/lib/admin.conf.php
index b0163e5..62616b1 100644
--- a/interface/web/help/lib/admin.conf.php
+++ b/interface/web/help/lib/admin.conf.php
@@ -5,4 +5,4 @@
 */
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/lib/module.conf.php b/interface/web/help/lib/module.conf.php
index 0761a4c..bee099d 100644
--- a/interface/web/help/lib/module.conf.php
+++ b/interface/web/help/lib/module.conf.php
@@ -31,52 +31,52 @@
 
 //* Add a menu item with the label 'Send message'
 $items[] = array( 'title'   => 'Send message',
-                  'target'  => 'content',
-                  'link'    => 'help/support_message_edit.php',
-                  'html_id' => 'help_message_send');
+	'target'  => 'content',
+	'link'    => 'help/support_message_edit.php',
+	'html_id' => 'help_message_send');
 
 //* Add a menu item with the label 'View messages'
 $items[] = array( 'title'   => 'View messages',
-                  'target'  => 'content',
-                  'link'    => 'help/support_message_list.php',
-                  'html_id' => 'help_message_list');
+	'target'  => 'content',
+	'link'    => 'help/support_message_list.php',
+	'html_id' => 'help_message_list');
 
 
 //* Add the menu items defined above to a menu section labeled 'Support'
 $module['nav'][] = array( 'title' => 'Support',
-                          'open'  => 1,
-                          'items'	=> $items);
+	'open'  => 1,
+	'items' => $items);
 
 //* the FAQ menu section
 $itemsfaq = array();
 //* admin's tools
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$itemsfaq[] = array( 	'title'		=> 'Manage Sections',
-							'target'	=> 'content',
-							'link'		=> 'help/faq_sections_list.php');
-	$itemsfaq[] = array( 	'title'		=> 'Manage Questions',
-							'target'	=> 'content',
-							'link'		=> 'help/faq_manage_questions_list.php');
-							
-	$module['nav'][] = array( 	'title'	=> 'FAQ',
-								'open'	=> 1,
-								'items'	=> $itemsfaq);
+	$itemsfaq[] = array(  'title'  => 'Manage Sections',
+		'target' => 'content',
+		'link'  => 'help/faq_sections_list.php');
+	$itemsfaq[] = array(  'title'  => 'Manage Questions',
+		'target' => 'content',
+		'link'  => 'help/faq_manage_questions_list.php');
+
+	$module['nav'][] = array(  'title' => 'FAQ',
+		'open' => 1,
+		'items' => $itemsfaq);
 }
 else
-{ //* the user
+	{ //* the user
 	$sql = "SELECT * FROM help_faq_sections";
 	$res = $app->db->queryAllRecords($sql);
 	//* all the content sections
 	if(is_array($res) && !empty($res)) {
 		foreach($res as $v) {
-			$itemsfaq[] = array( 	'title'		=> $v['hfs_name'],
-									'target'	=> 'content',
-									'link'		=> 'help/faq_list.php?hfs_id='.$v['hfs_id']);
+			$itemsfaq[] = array(  'title'  => $v['hfs_name'],
+				'target' => 'content',
+				'link'  => 'help/faq_list.php?hfs_id='.$v['hfs_id']);
 		}
 		// Display 'FAQ' menu only if there are sections
-		$module['nav'][] = array( 	'title'	=> 'FAQ',
-									'open'	=> 1,
-									'items'	=> $itemsfaq);
+		$module['nav'][] = array(  'title' => 'FAQ',
+			'open' => 1,
+			'items' => $itemsfaq);
 	}
 }
 //* -- end of the FAQ menu section
@@ -84,23 +84,23 @@
 
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-//* make sure that the items array is empty
-$items = array();
+	//* make sure that the items array is empty
+	$items = array();
 
-//* Add a menu item with the label 'Version'
-$items[] = array( 'title'   => 'Version',
-                  'target'  => 'content',
-                  'link'    => 'help/version.php',
-                  'html_id' => 'help_version' );
+	//* Add a menu item with the label 'Version'
+	$items[] = array( 'title'   => 'Version',
+		'target'  => 'content',
+		'link'    => 'help/version.php',
+		'html_id' => 'help_version' );
 
 
-//* Add the menu items defined above to a menu section labeled 'Support'
-$module['nav'][] = array( 'title' => 'About ISPConfig',
-                          'open'  => 1,
-                          'items'	=> $items);
+	//* Add the menu items defined above to a menu section labeled 'Support'
+	$module['nav'][] = array( 'title' => 'About ISPConfig',
+		'open'  => 1,
+		'items' => $items);
 
 }
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/list/faq_list.php b/interface/web/help/list/faq_list.php
index 0893e90..1f7e2bc 100644
--- a/interface/web/help/list/faq_list.php
+++ b/interface/web/help/list/faq_list.php
@@ -10,7 +10,7 @@
 $liste['table_idx'] = 'hf_id';
 
 // Search Field Prefix
-#$liste['search_prefix'] = 'search_';
+//$liste['search_prefix'] = 'search_';
 
 // Records per page
 $liste['records_per_page']= 100;
diff --git a/interface/web/help/list/faq_manage_questions_list.php b/interface/web/help/list/faq_manage_questions_list.php
index 6bff574..aac10fa 100644
--- a/interface/web/help/list/faq_manage_questions_list.php
+++ b/interface/web/help/list/faq_manage_questions_list.php
@@ -10,7 +10,7 @@
 $liste['table_idx'] = 'hf_id';
 
 // Search Field Prefix
-#$liste['search_prefix'] = 'search_';
+//$liste['search_prefix'] = 'search_';
 
 // Records per page
 $liste['records_per_page']= 30;
@@ -32,16 +32,16 @@
 
 
 $liste["item"][] = array(   'field'     => "hf_section",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "SELECT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'datasource'    => array (  'type'  => 'SQL',
-														'querystring' => 'SELECT a.hf_section, b.hfs_name FROM help_faq a, help_faq_sections b WHERE (a.hf_section = b.hfs_id)',
-                                                        'keyfield'=> 'hf_section',
-                                                        'valuefield'=> 'hfs_name'
-                                                      ),
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "SELECT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'datasource'    => array (  'type'  => 'SQL',
+		'querystring' => 'SELECT a.hf_section, b.hfs_name FROM help_faq a, help_faq_sections b WHERE (a.hf_section = b.hfs_id)',
+		'keyfield'=> 'hf_section',
+		'valuefield'=> 'hfs_name'
+	),
+	'width'     => "",
+	'value'     => "");
 ?>
diff --git a/interface/web/help/list/faq_sections_list.php b/interface/web/help/list/faq_sections_list.php
index 59e30e7..cfe3915 100644
--- a/interface/web/help/list/faq_sections_list.php
+++ b/interface/web/help/list/faq_sections_list.php
@@ -10,7 +10,7 @@
 $liste['table_idx'] = 'hfs_id';
 
 // Search Field Prefix
-#$liste['search_prefix'] = 'search_';
+//$liste['search_prefix'] = 'search_';
 
 // Records per page
 $liste['records_per_page'] = 100;
diff --git a/interface/web/help/list/support_message.list.php b/interface/web/help/list/support_message.list.php
index 1474959..1724c54 100644
--- a/interface/web/help/list/support_message.list.php
+++ b/interface/web/help/list/support_message.list.php
@@ -1,71 +1,71 @@
 <?php
 
 //* Name of the list
-$liste['name'] 				= 'support_message';
+$liste['name']     = 'support_message';
 
 //* Database table
-$liste['table'] 			= 'support_message';
+$liste['table']    = 'support_message';
 
 //* Index index field of the database table
-$liste['table_idx']			= 'support_message_id';
+$liste['table_idx']   = 'support_message_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= 15;
+$liste['records_per_page']  = 15;
 
 //* Script File of the list
-$liste['file']				= 'support_message_list.php';
+$liste['file']    = 'support_message_list.php';
 
 //* Script file of the edit form
-$liste['edit_file']			= 'support_message_edit.php';
+$liste['edit_file']   = 'support_message_edit.php';
 
 //* Script File of the delete script
-$liste['delete_file']		= 'support_message_del.php';
+$liste['delete_file']  = 'support_message_del.php';
 
 //* Paging Template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'yes';
+$liste['auth']    = 'yes';
 
 
 /*****************************************************
 * Search fields
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'sender_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> '',
-							'datasource'=> array ( 	'type' => 'SQL',
-										'querystring' 	=> 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
-										'keyfield'		=> 'userid',
-										'valuefield'	=> 'username'
-									 ),
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'sender_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '',
+	'datasource'=> array (  'type' => 'SQL',
+		'querystring'  => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
+		'keyfield'  => 'userid',
+		'valuefield' => 'username'
+	),
+	'value'  => '');
 
-$liste['item'][] = array(	'field'		=> 'subject',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> '');
-							
-$liste['item'][] = array(	'field'		=> 'tstamp',
-							'datatype'	=> 'DATETIMETSTAMP',
-							'formtype'	=> 'TEXT',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> '',
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'subject',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => '');
+
+$liste['item'][] = array( 'field'  => 'tstamp',
+	'datatype' => 'DATETIMETSTAMP',
+	'formtype' => 'TEXT',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '',
+	'value'  => '');
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/support_message_del.php b/interface/web/help/support_message_del.php
index 63c23a0..6b66d8e 100644
--- a/interface/web/help/support_message_del.php
+++ b/interface/web/help/support_message_del.php
@@ -35,8 +35,8 @@
 $tform_def_file = 'form/support_message.tform.php';
 
 //* Include the base libraries
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('help');
@@ -45,4 +45,4 @@
 $app->uses('tform_actions');
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/support_message_edit.php b/interface/web/help/support_message_edit.php
index b1cbf2a..a3b6fa5 100644
--- a/interface/web/help/support_message_edit.php
+++ b/interface/web/help/support_message_edit.php
@@ -4,8 +4,8 @@
 $tform_def_file = 'form/support_message.tform.php';
 
 //* include the basic application and configuration files
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('help');
@@ -19,18 +19,18 @@
 
 	//* Custom onSubmit Event handler
 	function onSubmit()
-    {
+	{
 		global $app, $conf;
-		
+
 		//* If the current user is not the admin user
 		if($_SESSION['s']['user']['typ'] != 'admin') {
 			//* Set the admin as recipient
 			$this->dataRecord['recipient_id'] = 1;
 		}
-		
+
 		//* Set the sender_id field to the ID of the current user
 		$this->dataRecord['sender_id'] = $_SESSION['s']['user']['userid'];
-		
+
 		//* Get recipient email address
 		if($this->dataRecord['recipient_id'] > 1){
 			$sql = "SELECT client.email FROM sys_user, client WHERE sys_user.userid = ".$this->dataRecord['recipient_id']." AND sys_user.client_id = client.client_id";
@@ -41,7 +41,7 @@
 			$system_config_mail_settings = $app->getconf->get_global_config('mail');
 			$recipient_email = $system_config_mail_settings['admin_mail'];
 		}
-		
+
 		//* Get sender email address
 		if($this->dataRecord['sender_id'] > 1){
 			$sql = "SELECT client.email FROM sys_user, client WHERE sys_user.userid = ".$this->dataRecord['sender_id']." AND sys_user.client_id = client.client_id";
@@ -52,7 +52,7 @@
 			$system_config_mail_settings = $app->getconf->get_global_config('mail');
 			$sender_email = $system_config_mail_settings['admin_mail'];
 		}
-		
+
 		$email_regex = '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i';
 		if(preg_match($email_regex, $sender_email, $match) && preg_match($email_regex, $recipient_email, $match)){
 			$subject = $app->tform->lng('support_request_subject_txt').': '.$this->dataRecord['subject'];
@@ -64,7 +64,7 @@
 			$message .= "\n\n".$app->tform->lng('message_txt').": \"".$this->dataRecord['message']."\"";
 			$message .= "\n\nISPConfig: ".($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'];
 			$app->functions->mail($recipient_email, $subject, $message, $sender_email);
-			
+
 			//* Send confirmation email to sender
 			if($this->dataRecord['sender_id'] == 1){
 				$confirmation_message = $app->tform->lng('answer_to_support_request_sent_txt');
@@ -77,47 +77,47 @@
 		} else {
 			$app->tform->errorMessage .= $app->tform->lng("recipient_or_sender_email_address_not_valid_txt")."<br />";
 		}
-		
+
 		//* call the onSubmit function of the parent class
 		parent::onSubmit();
 	}
-	
+
 	//* Custom onShow Event handler
-	function onShow() 
-    {
+	function onShow()
+	{
 		global $app, $conf;
 
-		//* We do not want that messages get edited, so we switch to a 
+		//* We do not want that messages get edited, so we switch to a
 		//*  read only template  if a existing message is loaded
 		if($this->id > 0) {
 			$app->tform->formDef['tabs']['message']['template'] = 'templates/support_message_view.htm';
 			$record = $app->db->queryOneRecord("SELECT * FROM support_message WHERE support_message_id = ".$this->id);
 			if ($record['tstamp'] > 0) {
-							// is value int?
-							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record['tstamp'], $p)) {
-	                        	$record['tstamp'] = date($app->lng('conf_format_datetime'), $record['tstamp']);
-							} else {
-	                        	$record['tstamp'] = date($app->lng('conf_format_datetime'), strtotime($record['tstamp']));
-							}
-						}
+				// is value int?
+				if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record['tstamp'], $p)) {
+					$record['tstamp'] = date($app->lng('conf_format_datetime'), $record['tstamp']);
+				} else {
+					$record['tstamp'] = date($app->lng('conf_format_datetime'), strtotime($record['tstamp']));
+				}
+			}
 			$app->tpl->setVar("date", $record['tstamp']);
 			//die(print_r($this->dataRecord));
 		}
-		
+
 		//* call the onShow function of the parent class
 		parent::onShow();
 	}
-	
-	function onAfterInsert() 
-    {
+
+	function onAfterInsert()
+	{
 		global $app, $conf;
-		
+
 		if($_SESSION['s']['user']['typ'] == 'admin') {
 			$app->db->query("UPDATE support_message SET sys_userid = ".$this->dataRecord['recipient_id']." WHERE support_message_id = ".$this->id);
 		}
-		
+
 	}
-	
+
 }
 
 //* Create the new page object
@@ -126,4 +126,4 @@
 //* Start the page rendering and action handling
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/support_message_list.php b/interface/web/help/support_message_list.php
index b2ac8c0..42db17d 100644
--- a/interface/web/help/support_message_list.php
+++ b/interface/web/help/support_message_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Path to the list definition file
 $list_def_file = "list/support_message.list.php";
@@ -17,4 +17,4 @@
 //* Start the form rendering and action ahndling
 $app->listform_actions->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/version.php b/interface/web/help/version.php
index dc0577e..4110c96 100644
--- a/interface/web/help/version.php
+++ b/interface/web/help/version.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('help');
@@ -49,4 +49,4 @@
 	echo '<p>&nbsp;</p><p>&nbsp;</p><p class="frmTextHead" style="text-align:center;">'.$app->lng('ISPConfig Version:').' '.ISPC_APP_VERSION.'</p>';
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/index.php b/interface/web/index.php
index a7d2965..c6f0ff3 100644
--- a/interface/web/index.php
+++ b/interface/web/index.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../lib/config.inc.php');
-require_once('../lib/app.inc.php');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
 if(!isset($_SESSION['s']['module']['name'])) $_SESSION['s']['module']['name'] = 'login';
 
@@ -41,26 +41,26 @@
 $app->uses('getconf');
 $sys_config = $app->getconf->get_global_config('misc');
 if($sys_config['tab_change_warning'] == 'y') {
-    $app->tpl->setVar('tabchange_warning_enabled', 'y');
-    $app->tpl->setVar('global_tabchange_warning_txt', $app->lng('global_tabchange_warning_txt'));
+	$app->tpl->setVar('tabchange_warning_enabled', 'y');
+	$app->tpl->setVar('global_tabchange_warning_txt', $app->lng('global_tabchange_warning_txt'));
 } else {
-    $app->tpl->setVar('tabchange_warning_enabled', 'n');
+	$app->tpl->setVar('tabchange_warning_enabled', 'n');
 }
 $app->tpl->setVar('tabchange_discard_enabled', $sys_config['tab_change_discard']);
 if($sys_config['tab_change_discard'] == 'y') {
-    $app->tpl->setVar('global_tabchange_discard_txt', $app->lng('global_tabchange_discard_txt'));
+	$app->tpl->setVar('global_tabchange_discard_txt', $app->lng('global_tabchange_discard_txt'));
 }
 
 if(isset($_SESSION['show_info_msg'])) {
-    $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
-    unset($_SESSION['show_info_msg']);
+	$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+	unset($_SESSION['show_info_msg']);
 }
 if(isset($_SESSION['show_error_msg'])) {
-    $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
-    unset($_SESSION['show_error_msg']);
+	$app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+	unset($_SESSION['show_error_msg']);
 }
 
 
 $app->tpl_defaults();
 $app->tpl->pparse();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index 418b26b..197c46f 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -1,13 +1,13 @@
 <?php
-	session_start();
-	include('../../lib/config.inc.php');
-    header('Content-Type: text/javascript; charset=utf-8'); // the config file sets the content type header so we have to override it here!
-	require_once('../../lib/app.inc.php');
-	$lang = (isset($_SESSION['s']['language']) && $_SESSION['s']['language'] != '')?$_SESSION['s']['language']:'en';
-	include_once(ISPC_ROOT_PATH.'/web/strengthmeter/lib/lang/'.$lang.'_strengthmeter.lng');
-	
-	$app->uses('ini_parser,getconf');
-	$server_config_array = $app->getconf->get_global_config();
+session_start();
+include '../../lib/config.inc.php';
+header('Content-Type: text/javascript; charset=utf-8'); // the config file sets the content type header so we have to override it here!
+require_once '../../lib/app.inc.php';
+$lang = (isset($_SESSION['s']['language']) && $_SESSION['s']['language'] != '')?$_SESSION['s']['language']:'en';
+include_once ISPC_ROOT_PATH.'/web/strengthmeter/lib/lang/'.$lang.'_strengthmeter.lng';
+
+$app->uses('ini_parser,getconf');
+$server_config_array = $app->getconf->get_global_config();
 ?>
 var pageFormChanged = false;
 var tabChangeWarningTxt = '';
@@ -21,10 +21,10 @@
 redirect = '';
 
 function reportError(request) {
-	/* Error reporting is disabled by default as some browsers like safari 
-	   sometimes throw errors when a ajax request is delayed even if the 
+	/* Error reporting is disabled by default as some browsers like safari
+	   sometimes throw errors when a ajax request is delayed even if the
 	   ajax request worked. */
-	   
+
 	/*alert(request);*/
 }
 
@@ -39,7 +39,7 @@
 if($server_config_array['misc']['use_loadindicator'] == 'y'){
 ?>
     requestsRunning += 1;
-    
+
     if(requestsRunning < 2) {
         var indicator = jQuery('#ajaxloader');
         if(indicator.length < 1) {
@@ -49,7 +49,7 @@
         var parent = jQuery('#content');
         if(parent.length < 1) return;
         indicatorCompleted = false;
-        
+
         var atx = parent.offset().left + 150; //((parent.outerWidth(true) - indicator.outerWidth(true)) / 2);
         var aty = parent.offset().top + 150;
         indicator.css( {'left': atx, 'top': aty } ).fadeIn('fast', function() {
@@ -84,9 +84,9 @@
 }
 
 function loadContentRefresh(pagename) {
-	
+
   if(document.getElementById('refreshinterval').value > 0) {
-	var pageContentObject2 = jQuery.ajax({	type: "GET", 
+	var pageContentObject2 = jQuery.ajax({	type: "GET",
 											url: pagename,
 											data: "refresh="+document.getElementById('refreshinterval').value,
 											dataType: "html",
@@ -109,8 +109,8 @@
 }
 
 function capp(module, redirect) {
-	var submitFormObj = jQuery.ajax({		type: "GET", 
-											url: "capp.php", 
+	var submitFormObj = jQuery.ajax({		type: "GET",
+											url: "capp.php",
 											data: "mod="+module+((redirect != undefined) ? '&redirect='+redirect : ''),
 											dataType: "html",
 											beforeSend: function() {
@@ -151,12 +151,12 @@
         passwordObj.focus();
         return;
     }
-	
+
 	$('#dummy_username').val(userNameObj.value);
 	$('#dummy_passwort').val(passwordObj.value);
 	$('#dummy_login_form').submit();
 
-	var submitFormObj = jQuery.ajax({		type: "POST", 
+	var submitFormObj = jQuery.ajax({		type: "POST",
 											url: "content.php",
 											data: jQuery('#'+formname).serialize(),
 											dataType: "html",
@@ -193,11 +193,11 @@
 	}
 	document.getElementById('footer').innerHTML = 'Powered by <a href="http://www.ispconfig.org" target="_blank">ISPConfig</a>';
 	*/
-	
+
 }
 
 function submitForm(formname,target) {
-	var submitFormObj = jQuery.ajax({		type: "POST", 
+	var submitFormObj = jQuery.ajax({		type: "POST",
 											url: target,
 											data: jQuery('#'+formname).serialize(),
 											dataType: "html",
@@ -235,7 +235,7 @@
 function submitFormConfirm(formname,target,confirmation) {
 	var successMessage = arguments[3];
 	if(window.confirm(confirmation)) {
-		var submitFormObj = jQuery.ajax({	type: "POST", 
+		var submitFormObj = jQuery.ajax({	type: "POST",
 											url: target,
 											data: jQuery('#'+formname).serialize(),
 											dataType: "html",
@@ -266,10 +266,10 @@
 	}
 }
 
-function submitUploadForm(formname,target) {		
+function submitUploadForm(formname,target) {
 	var handleResponse = function(loadedFrame) {
 		var response, responseStr = loadedFrame.contentWindow.document.body.innerHTML;
-		
+
 		try {
 			response = JSON.parse(responseStr);
 		} catch(e) {
@@ -285,9 +285,9 @@
 			msg = msg+'<div id="errorMsg">'+errormsg+'</div>';
 		}
 		return msg;
-		
+
     };
-	
+
 	var frame_id = 'ajaxUploader-iframe-' + Math.round(new Date().getTime() / 1000);
 	jQuery('body').after('<iframe width="0" height="0" style="display:none;" name="'+frame_id+'" id="'+frame_id+'"/>');
 	jQuery('input[type="file"]').closest("form").attr({target: frame_id, action: target}).submit();
@@ -309,7 +309,7 @@
 
 function loadContent(pagename) {
   var params = arguments[1];
-  var pageContentObject2 = jQuery.ajax({	type: "GET", 
+  var pageContentObject2 = jQuery.ajax({	type: "GET",
 											url: pagename,
                                             data: (params ? params : null),
 											dataType: "html",
@@ -328,7 +328,7 @@
 													//var reponse = jQuery(jqXHR.responseText);
 													//var reponseScript = reponse.filter("script");
 													//jQuery.each(reponseScript, function(idx, val) { eval(val.text); } );
-													
+
 													jQuery('#pageContent').html(jqXHR.responseText);
                                                     onAfterContentLoad();
                                                     pageFormChanged = false;
@@ -344,7 +344,7 @@
 
 
 function loadInitContent() {
-	var pageContentObject = jQuery.ajax({	type: "GET", 
+	var pageContentObject = jQuery.ajax({	type: "GET",
 											url: "content.php",
 											data: "s_mod=login&s_pg=index",
 											dataType: "html",
@@ -367,7 +367,7 @@
 												reportError('Ajax Request was not successful. 114');
 											}
 										});
-  
+
   loadMenus();
   keepalive();
   setTimeout("setFocus()",1000);
@@ -383,7 +383,7 @@
 
 
 function loadMenus() {
-  var sideNavObject = jQuery.ajax({			type: "GET", 
+  var sideNavObject = jQuery.ajax({			type: "GET",
 											url: "nav.php",
 											data: "nav=side",
 											dataType: "html",
@@ -399,8 +399,8 @@
 												reportError('Ajax Request was not successful. 115');
 											}
 									});
-	
-  var topNavObject = jQuery.ajax({			type: "GET", 
+
+  var topNavObject = jQuery.ajax({			type: "GET",
 											url: "nav.php",
 											data: "nav=top",
 											dataType: "html",
@@ -422,7 +422,7 @@
 function changeTab(tab,target,force) {
 	//document.forms[0].next_tab.value = tab;
 	document.pageForm.next_tab.value = tab;
-    
+
     var idel = jQuery('form#pageForm').find('[name="id"]');
     var id = null;
     if(idel.length > 0) id = idel.val();
@@ -448,7 +448,7 @@
         }
     }
 }
-	
+
 function del_record(link,confirmation) {
   if(window.confirm(confirmation)) {
           loadContent(link);
@@ -462,7 +462,7 @@
 }
 
 function loadContentInto(elementid,pagename) {
-  var pageContentObject2 = jQuery.ajax({	type: "GET", 
+  var pageContentObject2 = jQuery.ajax({	type: "GET",
 											url: pagename,
 											dataType: "html",
 											beforeSend: function() {
@@ -480,7 +480,7 @@
 }
 
 function loadOptionInto(elementid,pagename) {
-	var pageContentObject2 = jQuery.ajax({	type: "GET", 
+	var pageContentObject2 = jQuery.ajax({	type: "GET",
 											url: pagename,
 											dataType: "html",
 											beforeSend: function() {
@@ -508,7 +508,7 @@
 }
 
 function keepalive() {
-	var pageContentObject3 = jQuery.ajax({	type: "GET", 
+	var pageContentObject3 = jQuery.ajax({	type: "GET",
 											url: "keepalive.php",
 											dataType: "html",
 											success: function(data, textStatus, jqXHR) {
@@ -563,24 +563,24 @@
 		pass_result(0);
 		return;
 	}
-	
+
 	if (length < 5) {
 		pass_result(1);
 		return;
 	}
-	
+
 	if (pass_contains(password, "ABCDEFGHIJKLNMOPQRSTUVWXYZ")) {
 		points += 1;
 	}
-	
+
 	if (pass_contains(password, "0123456789")) {
 		points += 1;
 	}
-	
+
 	if (pass_contains(password, "`~!@#$%^&*()_+|\=-[]}{';:/?.>,<\" ")) {
 		points += 1;
 	}
-	
+
 	if (points == 0) {
 		if (length >= 5 && length <=6) {
 			pass_result(1);
@@ -671,7 +671,7 @@
 		var $el = jQuery('#template_additional_list ul').find('li[rel="' + tpl_id + '"]').eq(0); // only the first
         var addTplText = $el.text();
         $el.remove();
-        
+
 		var oldVal = tpl_add.split('/');
 		var newVal = new Array();
         for(var i = 0; i < oldVal.length; i++) {
@@ -695,7 +695,7 @@
             }
             return this;
         });
-        
+
 		var newVal = tpl_add;
         var repl = new RegExp('(^|\/)' + addTplId + '(\/|$)');
 		newVal = newVal.replace(repl, '');
@@ -705,7 +705,7 @@
   } else {
   	alert('no additional template selcted');
   }
-  
+
 }
 
 function getInternetExplorerVersion() {
@@ -796,7 +796,7 @@
 	var template2 = jQuery(this).siblings(':input');
 	template2.insertAtCaret(placeholderContentText);
 });
-		
+
 jQuery.fn.extend({
 	insertAtCaret: function(myValue){
 		return this.each(function(i) {
@@ -823,4 +823,3 @@
 		})
 	}
 });
-
diff --git a/interface/web/keepalive.php b/interface/web/keepalive.php
index fd9c1d7..fe91978 100644
--- a/interface/web/keepalive.php
+++ b/interface/web/keepalive.php
@@ -30,7 +30,7 @@
 
 error_reporting(E_ALL|E_STRICT);
 
-require_once('../lib/config.inc.php');
-require_once('../lib/app.inc.php');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index 2c596f8..950c692 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -51,7 +51,7 @@
 		$app->uses('tpl');
 		$app->tpl->newTemplate('form.tpl.htm');
 
-	    $error = '';
+		$error = '';
 
 		$app->load_language_file('web/login/lib/lang/'.$conf["language"].'.lng');
 
@@ -72,14 +72,14 @@
 			if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $_POST['username'])) $error = $app->lng('user_regex_error');
 			if(!preg_match("/^.{1,64}$/i", $_POST['passwort'])) $error = $app->lng('pw_error_length');
 
-	        //** iporting variables
-	        $ip 	  = $app->db->quote(ip2long($_SERVER['REMOTE_ADDR']));
-	        $username = $app->db->quote($_POST['username']);
-	        $passwort = $app->db->quote($_POST['passwort']);
+			//** iporting variables
+			$ip    = $app->db->quote(ip2long($_SERVER['REMOTE_ADDR']));
+			$username = $app->db->quote($_POST['username']);
+			$passwort = $app->db->quote($_POST['passwort']);
 			$loginAs  = false;
 			$time = time();
 
-	        if($username != '' && $passwort != '' && $error == '') {
+			if($username != '' && $passwort != '' && $error == '') {
 				/*
 				 *  Check, if there is a "login as" instead of a "normal" login
 				 */
@@ -108,28 +108,28 @@
 					$loginAs = false;
 				}
 
-	        	//* Check if there are already wrong logins
-	        	$sql = "SELECT * FROM `attempts_login` WHERE `ip`= '{$ip}' AND  `login_time` > (NOW() - INTERVAL 1 MINUTE) LIMIT 1";
-	        	$alreadyfailed = $app->db->queryOneRecord($sql);
-	        	//* too many failedlogins
-	        	if($alreadyfailed['times'] > 5) {
-	        		$error = $app->lng('error_user_too_many_logins');
-	        	} else {
+				//* Check if there are already wrong logins
+				$sql = "SELECT * FROM `attempts_login` WHERE `ip`= '{$ip}' AND  `login_time` > (NOW() - INTERVAL 1 MINUTE) LIMIT 1";
+				$alreadyfailed = $app->db->queryOneRecord($sql);
+				//* too many failedlogins
+				if($alreadyfailed['times'] > 5) {
+					$error = $app->lng('error_user_too_many_logins');
+				} else {
 
 					if ($loginAs){
-			        	$sql = "SELECT * FROM sys_user WHERE USERNAME = '$username' and PASSWORT = '". $passwort. "'";
+						$sql = "SELECT * FROM sys_user WHERE USERNAME = '$username' and PASSWORT = '". $passwort. "'";
 						$user = $app->db->queryOneRecord($sql);
 					} else {
-						if(stristr($username,'@')) {
+						if(stristr($username, '@')) {
 							//* mailuser login
 							$sql = "SELECT * FROM mail_user WHERE login = '$username'";
 							$mailuser = $app->db->queryOneRecord($sql);
 							$user = false;
 							if($mailuser) {
 								$saved_password = stripslashes($mailuser['password']);
-								$salt = '$1$'.substr($saved_password,3,8).'$';
+								$salt = '$1$'.substr($saved_password, 3, 8).'$';
 								//* Check if mailuser password is correct
-								if(crypt(stripslashes($passwort),$salt) == $saved_password) {
+								if(crypt(stripslashes($passwort), $salt) == $saved_password) {
 									//* we build a fake user here which has access to the mailuser module only and userid 0
 									$user = array();
 									$user['userid'] = 0;
@@ -155,11 +155,11 @@
 							if($user) {
 								$saved_password = stripslashes($user['passwort']);
 
-								if(substr($saved_password,0,3) == '$1$') {
+								if(substr($saved_password, 0, 3) == '$1$') {
 									//* The password is crypt-md5 encrypted
-									$salt = '$1$'.substr($saved_password,3,8).'$';
+									$salt = '$1$'.substr($saved_password, 3, 8).'$';
 
-									if(crypt(stripslashes($passwort),$salt) != $saved_password) {
+									if(crypt(stripslashes($passwort), $salt) != $saved_password) {
 										$user = false;
 									}
 								} else {
@@ -175,8 +175,8 @@
 						}
 					}
 
-		            if($user) {
-		                if($user['active'] == 1) {
+					if($user) {
+						if($user['active'] == 1) {
 							// Maintenance mode - allow logins only when maintenance mode is off or if the user is admin
 							if(!$maintenance_mode || $user['typ'] == 'admin'){
 								// User login right, so attempts can be deleted
@@ -194,34 +194,34 @@
 								$_SESSION["s"]['theme'] = $_SESSION['s']['user']['theme'];
 
 								if(is_file($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php')) {
-									include_once($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php');
-                                    $menu_dir = ISPC_WEB_PATH.'/' . $_SESSION['s']['user']['startmodule'] . '/lib/menu.d';
+									include_once $_SESSION['s']['user']['startmodule'].'/lib/module.conf.php';
+									$menu_dir = ISPC_WEB_PATH.'/' . $_SESSION['s']['user']['startmodule'] . '/lib/menu.d';
 
-                                    if (is_dir($menu_dir)) {
-                                        if ($dh = opendir($menu_dir)) {
-                                            //** Go through all files in the menu dir
-                                            while (($file = readdir($dh)) !== false) {
-                                                if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
-                                                    include_once($menu_dir . '/' . $file);
-                                                }
-                                            }
-                                        }
-                                    }
+									if (is_dir($menu_dir)) {
+										if ($dh = opendir($menu_dir)) {
+											//** Go through all files in the menu dir
+											while (($file = readdir($dh)) !== false) {
+												if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
+													include_once $menu_dir . '/' . $file;
+												}
+											}
+										}
+									}
 									$_SESSION['s']['module'] = $module;
 								}
-                                
-                                // check if the user theme is valid
-                                if($_SESSION['s']['user']['theme'] != 'default') {
-                                    $tmp_path = ISPC_THEMES_PATH."/".$_SESSION['s']['user']['theme'];
-                                    if(!@is_dir($tmp_path) || !@file_exists($tmp_path."/ispconfig_version") || trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION) {
-                                        // fall back to default theme if this one is not compatible with current ispc version
-                                        $_SESSION['s']['user']['theme'] = 'default';
-                                        $_SESSION['s']['theme'] = 'default';
-                                        $_SESSION['show_error_msg'] = $app->lng('theme_not_compatible');
-                                    }
-                                }
 
-								$app->plugin->raiseEvent('login',$this);
+								// check if the user theme is valid
+								if($_SESSION['s']['user']['theme'] != 'default') {
+									$tmp_path = ISPC_THEMES_PATH."/".$_SESSION['s']['user']['theme'];
+									if(!@is_dir($tmp_path) || !@file_exists($tmp_path."/ispconfig_version") || trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION) {
+										// fall back to default theme if this one is not compatible with current ispc version
+										$_SESSION['s']['user']['theme'] = 'default';
+										$_SESSION['s']['theme'] = 'default';
+										$_SESSION['show_error_msg'] = $app->lng('theme_not_compatible');
+									}
+								}
+
+								$app->plugin->raiseEvent('login', $this);
 
 								//* Save successfull login message to var
 								$authlog = 'Successful login for user \''. $username .'\' from '. long2ip($ip) .' at '. date('Y-m-d H:i:s');
@@ -237,55 +237,55 @@
 
 								exit;
 							}
-		             	} else {
-		                	$error = $app->lng('error_user_blocked');
-		                }
+						} else {
+							$error = $app->lng('error_user_blocked');
+						}
 
-		        	} else {
-		        		if(!$alreadyfailed['times'] )
-		        		{
-		        			//* user login the first time wrong
-		        			$sql = "INSERT INTO `attempts_login` (`ip`, `times`, `login_time`) VALUES ('{$ip}', 1, NOW())";
-		        			$app->db->query($sql);
-		        		} elseif($alreadyfailed['times'] >= 1) {
-		        			//* update times wrong
-		        			$sql = "UPDATE `attempts_login` SET `times`=`times`+1, `login_time`=NOW() WHERE `login_time` >= '{$time}' LIMIT 1";
-		        			$app->db->query($sql);
-		        		}
-		            	//* Incorrect login - Username and password incorrect
-		                $error = $app->lng('error_user_password_incorrect');
-		                if($app->db->errorMessage != '') $error .= '<br />'.$app->db->errorMessage != '';
+					} else {
+						if(!$alreadyfailed['times'] )
+						{
+							//* user login the first time wrong
+							$sql = "INSERT INTO `attempts_login` (`ip`, `times`, `login_time`) VALUES ('{$ip}', 1, NOW())";
+							$app->db->query($sql);
+						} elseif($alreadyfailed['times'] >= 1) {
+							//* update times wrong
+							$sql = "UPDATE `attempts_login` SET `times`=`times`+1, `login_time`=NOW() WHERE `login_time` >= '{$time}' LIMIT 1";
+							$app->db->query($sql);
+						}
+						//* Incorrect login - Username and password incorrect
+						$error = $app->lng('error_user_password_incorrect');
+						if($app->db->errorMessage != '') $error .= '<br />'.$app->db->errorMessage != '';
 
-						$app->plugin->raiseEvent('login_failed',$this);
+						$app->plugin->raiseEvent('login_failed', $this);
 
 						//* Save failed login message to var
 						$authlog = 'Failed login for user \''. $username .'\' from '. long2ip($ip) .' at '. date('Y-m-d H:i:s');
 						$authlog_handle = fopen($conf['ispconfig_log_dir'].'/auth.log', 'a');
 						fwrite($authlog_handle, $authlog ."\n");
 						fclose($authlog_handle);
-		           	}
-	        	}
+					}
+				}
 
-	      	} else {
-	       		//* Username or password empty
-	            if($error == '') $error = $app->lng('error_user_password_empty');
+			} else {
+				//* Username or password empty
+				if($error == '') $error = $app->lng('error_user_password_empty');
 
-				$app->plugin->raiseEvent('login_empty',$this);
-	        }
+				$app->plugin->raiseEvent('login_empty', $this);
+			}
 		}
 
 		// Maintenance mode - show message when people try to log in and also when people are forcedly logged off
 		if($maintenance_mode_error != '') $error = '<strong>'.$maintenance_mode_error.'</strong><br><br>'.$error;
 		if($error != ''){
-	  		$error = '<div class="box box_error"><h1>Error</h1>'.$error.'</div>';
+			$error = '<div class="box box_error"><h1>Error</h1>'.$error.'</div>';
 		}
 
 		$app->tpl->setVar('error', $error);
-        $app->tpl->setVar('pw_lost_txt', $app->lng('pw_lost_txt'));
+		$app->tpl->setVar('pw_lost_txt', $app->lng('pw_lost_txt'));
 		$app->tpl->setVar('username_txt', $app->lng('username_txt'));
 		$app->tpl->setVar('password_txt', $app->lng('password_txt'));
 		$app->tpl->setVar('login_button_txt', $app->lng('login_button_txt'));
-		$app->tpl->setInclude('content_tpl','login/templates/index.htm');
+		$app->tpl->setInclude('content_tpl', 'login/templates/index.htm');
 		$app->tpl_defaults();
 
 		$this->status = 'OK';
@@ -296,4 +296,4 @@
 
 } // << end class
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/login/lib/module.conf.php b/interface/web/login/lib/module.conf.php
index 477bd9e..0936235 100644
--- a/interface/web/login/lib/module.conf.php
+++ b/interface/web/login/lib/module.conf.php
@@ -1,6 +1,6 @@
 <?php
-$module["name"] 		= "login";
-$module["title"] 		= "top_menu_login";
-$module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "login/index.php";
-?>
\ No newline at end of file
+$module["name"]   = "login";
+$module["title"]   = "top_menu_login";
+$module["template"]  = "module.tpl.htm";
+$module["startpage"]  = "login/index.php";
+?>
diff --git a/interface/web/login/logout.php b/interface/web/login/logout.php
index c56b73d..b2b1ac2 100644
--- a/interface/web/login/logout.php
+++ b/interface/web/login/logout.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /*
  * Check if the logout is forced
@@ -59,7 +59,7 @@
 	exit;
 }
 
-$app->plugin->raiseEvent('logout',true);
+$app->plugin->raiseEvent('logout', true);
 
 $_SESSION["s"]["user"] = null;
 $_SESSION["s"]["module"] = null;
@@ -68,12 +68,12 @@
 //header("Location: ../index.php?phpsessid=".$_SESSION["s"]["id"]);
 
 if($_SESSION["s"]["site"]["logout"] != '') {
-	echo('URL_REDIRECT:'.$_SESSION["s"]["site"]["logout"]);
+	echo 'URL_REDIRECT:'.$_SESSION["s"]["site"]["logout"];
 } else {
 	if($conf["interface_logout_url"] != '') {
-		echo('URL_REDIRECT:'.$conf["interface_logout_url"]);
+		echo 'URL_REDIRECT:'.$conf["interface_logout_url"];
 	} else {
-		echo('URL_REDIRECT:index.php');
+		echo 'URL_REDIRECT:index.php';
 	}
 }
 // Destroy the session completely now
diff --git a/interface/web/login/password_reset.php b/interface/web/login/password_reset.php
index cea2056..e29b163 100644
--- a/interface/web/login/password_reset.php
+++ b/interface/web/login/password_reset.php
@@ -28,39 +28,39 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/password_reset.htm');
+$app->tpl->setInclude('content_tpl', 'templates/password_reset.htm');
 
 $app->tpl_defaults();
 
-include(ISPC_ROOT_PATH.'/web/login/lib/lang/'.$_SESSION['s']['language'].'.lng');
+include ISPC_ROOT_PATH.'/web/login/lib/lang/'.$_SESSION['s']['language'].'.lng';
 $app->tpl->setVar($wb);
 
 if(isset($_POST['username']) && $_POST['username'] != '' && $_POST['email'] != '' && $_POST['username'] != 'admin') {
-	
+
 	if(!preg_match("/^[\w\.\-\_]{1,64}$/", $_POST['username'])) die($app->lng('user_regex_error'));
 	if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $_POST['email'])) die($app->lng('email_error'));
-	
+
 	$username = $app->db->quote($_POST['username']);
 	$email = $app->db->quote($_POST['email']);
-	
+
 	$client = $app->db->queryOneRecord("SELECT * FROM client WHERE username = '$username' AND email = '$email'");
 
 	if($client['client_id'] > 0) {
 		$new_password = $app->auth->get_random_password();
 		$new_password_encrypted = $app->auth->crypt_password($new_password);
 		$new_password_encrypted = $app->db->quote($new_password_encrypted);
-		
+
 		$username = $app->db->quote($client['username']);
 		$app->db->query("UPDATE sys_user SET passwort = '$new_password_encrypted' WHERE username = '$username'");
 		$app->db->query("UPDATE client SET password = '$new_password_encrypted' WHERE username = '$username'");
-		$app->tpl->setVar("message",$wb['pw_reset']);
-		
+		$app->tpl->setVar("message", $wb['pw_reset']);
+
 		$app->uses('getconf,ispcmail');
 		$mail_config = $app->getconf->get_global_config('mail');
 		if($mail_config['smtp_enabled'] == 'y') {
@@ -72,15 +72,15 @@
 		$app->ispcmail->setMailText($wb['pw_reset_mail_msg'].$new_password);
 		$app->ispcmail->send(array($client['contact_name'] => $client['email']));
 		$app->ispcmail->finish();
-		
-		$app->plugin->raiseEvent('password_reset',true);
-		$app->tpl->setVar("msg",$wb['pw_reset']);
+
+		$app->plugin->raiseEvent('password_reset', true);
+		$app->tpl->setVar("msg", $wb['pw_reset']);
 	} else {
-		$app->tpl->setVar("error",$wb['pw_error']);
+		$app->tpl->setVar("error", $wb['pw_error']);
 	}
-	
+
 } else {
-	$app->tpl->setVar("msg",$wb['pw_error_noinput']);
+	$app->tpl->setVar("msg", $wb['pw_error_noinput']);
 }
 
 
@@ -91,4 +91,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_alias.tform.php b/interface/web/mail/form/mail_alias.tform.php
index 181cdc9..e20ac76 100644
--- a/interface/web/mail/form/mail_alias.tform.php
+++ b/interface/web/mail/form/mail_alias.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Email Alias";
-$form["description"] 	= "";
-$form["name"] 			= "mail_alias";
-$form["action"]			= "mail_alias_edit.php";
-$form["db_table"]		= "mail_forwarding";
-$form["db_table_idx"]	= "forwarding_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "alias";
-$form["list_default"]	= "mail_alias_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Alias";
+$form["description"]  = "";
+$form["name"]    = "mail_alias";
+$form["action"]   = "mail_alias_edit.php";
+$form["db_table"]  = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "alias";
+$form["list_default"] = "mail_alias_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,80 +56,80 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['alias'] = array (
-	'title' 	=> "Email Alias",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_alias_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Email Alias",
+	'width'  => 100,
+	'template'  => "templates/mail_alias_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'		=> 'email',
-										'valuefield'	=> 'email'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'destination_error_isemail'),
-									),
-			'value'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'datasource' => array (  'type'   => 'SQL',
+				'querystring'  => 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'  => 'email',
+				'valuefield' => 'email'
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'destination_error_isemail'),
+			),
+			'value'  => '',
 			'searchable' => 2
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('alias' => 'Alias','forward'=>'Forward')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('alias' => 'Alias', 'forward'=>'Forward')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_aliasdomain.tform.php b/interface/web/mail/form/mail_aliasdomain.tform.php
index 29ed73f..fb93500 100644
--- a/interface/web/mail/form/mail_aliasdomain.tform.php
+++ b/interface/web/mail/form/mail_aliasdomain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Domain Alias";
-$form["description"] 	= "";
-$form["name"] 			= "mail_aliasdomain";
-$form["action"]			= "mail_aliasdomain_edit.php";
-$form["db_table"]		= "mail_forwarding";
-$form["db_table_idx"]	= "forwarding_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "alias";
-$form["list_default"]	= "mail_aliasdomain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Domain Alias";
+$form["description"]  = "";
+$form["name"]    = "mail_aliasdomain";
+$form["action"]   = "mail_aliasdomain_edit.php";
+$form["db_table"]  = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "alias";
+$form["list_default"] = "mail_aliasdomain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,79 +56,79 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['alias'] = array (
-	'title' 	=> "Domain Alias",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_aliasdomain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain Alias",
+	'width'  => 100,
+	'template'  => "templates/mail_aliasdomain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'source_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^\@[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,10}$/',
-														'errmsg'=> 'source_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'source_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^\@[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,10}$/',
+					'errmsg'=> 'source_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('alias' => 'Alias','forward'=>'Forward')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('alias' => 'Alias', 'forward'=>'Forward')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_blacklist.tform.php b/interface/web/mail/form/mail_blacklist.tform.php
index df63f7f..66d63ac 100644
--- a/interface/web/mail/form/mail_blacklist.tform.php
+++ b/interface/web/mail/form/mail_blacklist.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Email Blacklist";
-$form["description"] 	= "";
-$form["name"] 			= "mail_blacklist";
-$form["action"]			= "mail_blacklist_edit.php";
-$form["db_table"]		= "mail_access";
-$form["db_table_idx"]	= "access_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "blacklist";
-$form["list_default"]	= "mail_blacklist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Blacklist";
+$form["description"]  = "";
+$form["name"]    = "mail_blacklist";
+$form["action"]   = "mail_blacklist_edit.php";
+$form["db_table"]  = "mail_access";
+$form["db_table_idx"] = "access_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "blacklist";
+$form["list_default"] = "mail_blacklist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,60 +51,60 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['blacklist'] = array (
-	'title' 	=> "Blacklist",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_blacklist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Blacklist",
+	'width'  => 100,
+	'template'  => "templates/mail_blacklist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'access' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'REJECT',
-			'value'		=> 'REJECT',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'REJECT',
+			'value'  => 'REJECT',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_content_filter.tform.php b/interface/web/mail/form/mail_content_filter.tform.php
index a838e0a..517174d 100644
--- a/interface/web/mail/form/mail_content_filter.tform.php
+++ b/interface/web/mail/form/mail_content_filter.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Mail Content Filter";
-$form["description"] 	= "";
-$form["name"] 			= "mail_content_filter";
-$form["action"]			= "mail_content_filter_edit.php";
-$form["db_table"]		= "mail_content_filter";
-$form["db_table_idx"]	= "content_filter_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "filter";
-$form["list_default"]	= "mail_content_filter_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Mail Content Filter";
+$form["description"]  = "";
+$form["name"]    = "mail_content_filter";
+$form["action"]   = "mail_content_filter_edit.php";
+$form["db_table"]  = "mail_content_filter";
+$form["db_table_idx"] = "content_filter_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "filter";
+$form["list_default"] = "mail_content_filter_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,66 +51,66 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['filter'] = array (
-	'title' 	=> "Filter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_content_filter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Filter",
+	'width'  => 100,
+	'template'  => "templates/mail_content_filter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('header' => 'Header Filter','body' => 'Body Filter','mime_header' => 'MIME-Header Filter','nested_header' => 'Nested-Header Filter')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('header' => 'Header Filter', 'body' => 'Body Filter', 'mime_header' => 'MIME-Header Filter', 'nested_header' => 'Nested-Header Filter')
 		),
 		'pattern' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'pattern_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'pattern_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('DISCARD' => 'DISCARD','DUNNO'=>'DUNNO','FILTER'=>'FILTER','HOLD'=>'HOLD','IGNORE'=>'IGNORE','PREPEND'=>'PREPEND','REDIRECT'=>'REDIRECT','REPLACE'=>'REPLACE','REJECT'=>'REJECT','WARN'=>'WARN')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('DISCARD' => 'DISCARD', 'DUNNO'=>'DUNNO', 'FILTER'=>'FILTER', 'HOLD'=>'HOLD', 'IGNORE'=>'IGNORE', 'PREPEND'=>'PREPEND', 'REDIRECT'=>'REDIRECT', 'REPLACE'=>'REPLACE', 'REJECT'=>'REJECT', 'WARN'=>'WARN')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_domain.tform.php b/interface/web/mail/form/mail_domain.tform.php
index 506f934..effe444 100644
--- a/interface/web/mail/form/mail_domain.tform.php
+++ b/interface/web/mail/form/mail_domain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Mail Domain";
-$form["description"] 	= "";
-$form["name"] 			= "mail_domain";
-$form["action"]			= "mail_domain_edit.php";
-$form["db_table"]		= "mail_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "mail_domain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Mail Domain";
+$form["description"]  = "";
+$form["name"]    = "mail_domain";
+$form["action"]   = "mail_domain_edit.php";
+$form["db_table"]  = "mail_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "mail_domain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,59 +56,59 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_domain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/mail_domain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'domain_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'domain_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
-														'errmsg'=> 'domain_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'domain_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'domain_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_domain_catchall.tform.php b/interface/web/mail/form/mail_domain_catchall.tform.php
index ea8fb56..8d0c029 100644
--- a/interface/web/mail/form/mail_domain_catchall.tform.php
+++ b/interface/web/mail/form/mail_domain_catchall.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Email Catchall";
-$form["description"] 	= "";
-$form["name"] 			= "mail_domain_catchall";
-$form["action"]			= "mail_domain_catchall_edit.php";
-$form["db_table"]		= "mail_forwarding";
-$form["db_table_idx"]	= "forwarding_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "catchall";
-$form["list_default"]	= "mail_domain_catchall_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Catchall";
+$form["description"]  = "";
+$form["name"]    = "mail_domain_catchall";
+$form["action"]   = "mail_domain_catchall_edit.php";
+$form["db_table"]  = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "catchall";
+$form["list_default"] = "mail_domain_catchall_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,56 +56,56 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['catchall'] = array (
-	'title' 	=> "Email Catchall",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_domain_catchall_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Email Catchall",
+	'width'  => 100,
+	'template'  => "templates/mail_domain_catchall_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'domain_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'domain_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^\@[\w\.\-]{2,255}\.[a-zA-Z\-]{2,30}$/',
-														'errmsg'=> 'domain_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'domain_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'domain_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^\@[\w\.\-]{2,255}\.[a-zA-Z\-]{2,30}$/',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
 			/*
 			'datasource'	=> array ( 	'type'			=> 'SQL',
 										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
@@ -113,30 +113,30 @@
 										'valuefield'	=> 'email'
 									 ),
 			*/
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'destination_error_isemail'),
-									),
-			'value'		=> '',
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'destination_error_isemail'),
+			),
+			'value'  => '',
 			'searchable' => 2
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('alias' => 'Alias','forward'=>'Forward','catchall'=>'Catchall')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('alias' => 'Alias', 'forward'=>'Forward', 'catchall'=>'Catchall')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_forward.tform.php b/interface/web/mail/form/mail_forward.tform.php
index cdfb785..dcd5e54 100644
--- a/interface/web/mail/form/mail_forward.tform.php
+++ b/interface/web/mail/form/mail_forward.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Email Forward";
-$form["description"] 	= "";
-$form["name"] 			= "mail_forward";
-$form["action"]			= "mail_forward_edit.php";
-$form["db_table"]		= "mail_forwarding";
-$form["db_table_idx"]	= "forwarding_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "forward";
-$form["list_default"]	= "mail_forward_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Forward";
+$form["description"]  = "";
+$form["name"]    = "mail_forward";
+$form["action"]   = "mail_forward_edit.php";
+$form["db_table"]  = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "forward";
+$form["list_default"] = "mail_forward_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,74 +56,74 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['forward'] = array (
-	'title' 	=> "Email Forward",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_forward_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Email Forward",
+	'width'  => 100,
+	'template'  => "templates/mail_forward_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('forward'=>'Forward','alias' => 'Alias')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('forward'=>'Forward', 'alias' => 'Alias')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_get.tform.php b/interface/web/mail/form/mail_get.tform.php
index e23c4e1..7ed9699 100644
--- a/interface/web/mail/form/mail_get.tform.php
+++ b/interface/web/mail/form/mail_get.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Get Email";
-$form["description"] 	= "";
-$form["name"] 			= "mail_get";
-$form["action"]			= "mail_get_edit.php";
-$form["db_table"]		= "mail_get";
-$form["db_table_idx"]	= "mailget_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "mailget";
-$form["list_default"]	= "mail_get_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Get Email";
+$form["description"]  = "";
+$form["name"]    = "mail_get";
+$form["action"]   = "mail_get_edit.php";
+$form["db_table"]  = "mail_get";
+$form["db_table_idx"] = "mailget_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "mailget";
+$form["list_default"] = "mail_get_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,122 +56,122 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailget'] = array (
-	'title' 	=> "Get Email",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_get_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Get Email",
+	'width'  => 100,
+	'template'  => "templates/mail_get_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value' => array('pop3' => 'POP3','imap'=>'IMAP','pop3ssl' => 'POP3SSL','imapssl'=>'IMAPSSL'),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value' => array('pop3' => 'POP3', 'imap'=>'IMAP', 'pop3ssl' => 'POP3SSL', 'imapssl'=>'IMAPSSL'),
 			'searchable' => 2
 		),
 		'source_server' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_server_error_isempty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,64}\.[a-zA-Z\-]{2,10}$/',
-														'errmsg'=> 'source_server_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_server_error_isempty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{2,64}\.[a-zA-Z\-]{2,10}$/',
+					'errmsg'=> 'source_server_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'source_username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_username_error_isempty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_username_error_isempty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'source_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_password_error_isempty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_password_error_isempty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source_delete' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'source_read_all' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'		=> 'email',
-										'valuefield'	=> 'email'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'destination_error_isemail'),
-									),
-			'value'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'datasource' => array (  'type'   => 'SQL',
+				'querystring'  => 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'  => 'email',
+				'valuefield' => 'email'
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'destination_error_isemail'),
+			),
+			'value'  => '',
 			'searchable' => 1
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_mailinglist.tform.php b/interface/web/mail/form/mail_mailinglist.tform.php
index 3166c26..dbd7c0e 100644
--- a/interface/web/mail/form/mail_mailinglist.tform.php
+++ b/interface/web/mail/form/mail_mailinglist.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Mailing List";
-$form["description"] 	= "";
-$form["name"] 			= "mail_mailinglist";
-$form["action"]			= "mail_mailinglist_edit.php";
-$form["db_table"]		= "mail_mailinglist";
-$form["db_table_idx"]	= "mailinglist_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "mailinglist";
-$form["list_default"]	= "mail_mailinglist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Mailing List";
+$form["description"]  = "";
+$form["name"]    = "mail_mailinglist";
+$form["action"]   = "mail_mailinglist_edit.php";
+$form["db_table"]  = "mail_mailinglist";
+$form["db_table_idx"] = "mailinglist_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "mailinglist";
+$form["list_default"] = "mail_mailinglist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,91 +56,91 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailinglist'] = array (
-	'title' 	=> "Mailing List",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_mailinglist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Mailing List",
+	'width'  => 100,
+	'template'  => "templates/mail_mailinglist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'	=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value' => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'domain_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
-														'errmsg'=> 'domain_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'domain_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'listname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'listname_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'listname_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'listname_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'listname_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CLEARTEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_relay_recipient.tform.php b/interface/web/mail/form/mail_relay_recipient.tform.php
index 69dfe28..be80668 100644
--- a/interface/web/mail/form/mail_relay_recipient.tform.php
+++ b/interface/web/mail/form/mail_relay_recipient.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Email relay recipient";
-$form["description"] 	= "";
-$form["name"] 			= "mail_relay_recipient";
-$form["action"]			= "mail_relay_recipient_edit.php";
-$form["db_table"]		= "mail_relay_recipient";
-$form["db_table_idx"]	= "relay_recipient_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "relay_recipient";
-$form["list_default"]	= "mail_relay_recipient_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email relay recipient";
+$form["description"]  = "";
+$form["name"]    = "mail_relay_recipient";
+$form["action"]   = "mail_relay_recipient_edit.php";
+$form["db_table"]  = "mail_relay_recipient";
+$form["db_table_idx"] = "relay_recipient_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "relay_recipient";
+$form["list_default"] = "mail_relay_recipient_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,54 +51,54 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['relay_recipient'] = array (
-	'title' 	=> "Relay recipient",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_relay_recipient_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Relay recipient",
+	'width'  => 100,
+	'template'  => "templates/mail_relay_recipient_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'access' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'OK',
-			'value'		=> 'OK',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'OK',
+			'value'  => 'OK',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_spamfilter.tform.php b/interface/web/mail/form/mail_spamfilter.tform.php
index aee5d85..a197c3e 100644
--- a/interface/web/mail/form/mail_spamfilter.tform.php
+++ b/interface/web/mail/form/mail_spamfilter.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter";
-$form["description"] 	= "";
-$form["name"] 			= "mail_spamfilter";
-$form["action"]			= "mail_spamfilter_edit.php";
-$form["db_table"]		= "mail_spamfilter";
-$form["db_table_idx"]	= "spamfilter_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "spamfilter";
-$form["list_default"]	= "mail_spamfilter_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter";
+$form["description"]  = "";
+$form["name"]    = "mail_spamfilter";
+$form["action"]   = "mail_spamfilter_edit.php";
+$form["db_table"]  = "mail_spamfilter";
+$form["db_table_idx"] = "spamfilter_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "spamfilter";
+$form["list_default"] = "mail_spamfilter_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,96 +51,96 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['spamfilter'] = array (
-	'title' 	=> "Spamfilter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_spamfilter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Spamfilter",
+	'width'  => 100,
+	'template'  => "templates/mail_spamfilter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'email_error_notempty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'email_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'email_error_notempty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'email_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_rewrite_score_int' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '5.00',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '5.00',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'spam_redirect_score_int' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '7.00',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '7.00',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'spam_delete_score_int' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '15.00',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '15.00',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'spam_rewrite_subject' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '***SPAM***',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '***SPAM***',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_redirect_maildir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT mailbox_id,email FROM mail_box WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'=> 'mailbox_id',
-										'valuefield'=> 'email'
-									 ),
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT mailbox_id,email FROM mail_box WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'=> 'mailbox_id',
+				'valuefield'=> 'email'
+			),
+			'default' => '',
+			'value'  => ''
 		),
 		'spam_redirect_maildir_purge' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '7',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '7',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_transport.tform.php b/interface/web/mail/form/mail_transport.tform.php
index a7ae27d..0005842 100644
--- a/interface/web/mail/form/mail_transport.tform.php
+++ b/interface/web/mail/form/mail_transport.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Email Routing";
-$form["description"] 	= "";
-$form["name"] 			= "mail_transport";
-$form["action"]			= "mail_transport_edit.php";
-$form["db_table"]		= "mail_transport";
-$form["db_table_idx"]	= "transport_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "transport";
-$form["list_default"]	= "mail_transport_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Routing";
+$form["description"]  = "";
+$form["name"]    = "mail_transport";
+$form["action"]   = "mail_transport_edit.php";
+$form["db_table"]  = "mail_transport";
+$form["db_table_idx"] = "transport_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "transport";
+$form["list_default"] = "mail_transport_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,67 +56,67 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['transport'] = array (
-	'title' 	=> "Email transport",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_transport_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Email transport",
+	'width'  => 100,
+	'template'  => "templates/mail_transport_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'transport' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'sort_order' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> 5,
-			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => 5,
+			'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_user.tform.php b/interface/web/mail/form/mail_user.tform.php
index 5ec0cbc..11fb012 100644
--- a/interface/web/mail/form/mail_user.tform.php
+++ b/interface/web/mail/form/mail_user.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -39,16 +39,16 @@
 */
 global $app;
 
-$form["title"] 			= "Mailbox";
-$form["description"] 	= "";
-$form["name"] 			= "mail_user";
-$form["action"]			= "mail_user_edit.php";
-$form["db_table"]		= "mail_user";
-$form["db_table_idx"]	= "mailuser_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "mailuser";
-$form["list_default"]	= "mail_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Mailbox";
+$form["description"]  = "";
+$form["name"]    = "mail_user";
+$form["action"]   = "mail_user_edit.php";
+$form["db_table"]  = "mail_user";
+$form["db_table_idx"] = "mailuser_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "mailuser";
+$form["list_default"] = "mail_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -57,152 +57,152 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailuser'] = array (
-	'title' 	=> "Mailbox",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_mailbox_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Mailbox",
+	'width'  => 100,
+	'template'  => "templates/mail_user_mailbox_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'email_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'email_error_isemail'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'email_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
-    'login' => array (
-      'datatype'  => 'VARCHAR',
-      'formtype'  => 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-      'validators'  => array (
-                    0 => array (  'type'  => 'UNIQUE',
-                            'errmsg'=> 'login_error_unique'),
-                    1 => array (  'type'  => 'REGEX',
-                            'regex' => '/^[a-z0-9][\w\.\-_\+@]{1,63}$/',
-                            'errmsg'=> 'login_error_regex'),
-                  ),
-      'default' => '',
-      'value'   => '',
-      'width'   => '30',
-      'maxlength' => '255'
-    ),
+		'login' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'  => array (
+				0 => array (  'type'  => 'UNIQUE',
+					'errmsg'=> 'login_error_unique'),
+				1 => array (  'type'  => 'REGEX',
+					'regex' => '/^[a-z0-9][\w\.\-_\+@]{1,63}$/',
+					'errmsg'=> 'login_error_regex'),
+			),
+			'default' => '',
+			'value'   => '',
+			'width'   => '30',
+			'maxlength' => '255'
+		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'quota' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	1 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'quota_error_isint'),
-										0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([0-9]{1,})$/',
-														'errmsg'=> 'quota_error_value'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  1 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'quota_error_isint'),
+				0 => array ( 'type' => 'REGEX',
+					'regex' => '/^([0-9]{1,})$/',
+					'errmsg'=> 'quota_error_value'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'cc' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'cc_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'cc_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'maildir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'homedir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'uid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'gid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'postfix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
 		/*
 		'access' => array (
@@ -213,132 +213,132 @@
 		),
 		*/
 		'disableimap' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
 		'disablepop3' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['autoresponder'] = array (
-	'title' 	=> "Autoresponder",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_autoresponder_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Autoresponder",
+	'width'  => 100,
+	'template'  => "templates/mail_user_autoresponder_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'autoresponder_subject' => array (
 			'datatype'  => 'VARCHAR',
 			'formtype'  => 'TEXT',
 			'default'   => 'Out of office reply',
 			'value'     => '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'autoresponder_text' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '15'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'cols'  => '30',
+			'rows'  => '15'
 		),
 		'autoresponder' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
 		'autoresponder_start_date' => array (
-			'datatype'	=> 'DATETIME',
-			'formtype'	=> 'DATETIME',
+			'datatype' => 'DATETIME',
+			'formtype' => 'DATETIME',
 			'validators'=> array ( 0 => array ( 'type' => 'CUSTOM',
-				'class' => 'validate_autoresponder',
-				'function' => 'start_date',
-				'errmsg'=> 'autoresponder_start_date_is_required'),
+					'class' => 'validate_autoresponder',
+					'function' => 'start_date',
+					'errmsg'=> 'autoresponder_start_date_is_required'),
 			)
 		),
 		'autoresponder_end_date' => array (
-			'datatype'	=> 'DATETIME',
-			'formtype'	=> 'DATETIME',
-			'validators'=> array ( 	0 => array (	'type'	=> 'CUSTOM',
-													'class' => 'validate_autoresponder',
-													'function' => 'end_date',
-													'errmsg'=> 'autoresponder_end_date_isgreater'),
-								 ),
+			'datatype' => 'DATETIME',
+			'formtype' => 'DATETIME',
+			'validators'=> array (  0 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_autoresponder',
+					'function' => 'end_date',
+					'errmsg'=> 'autoresponder_end_date_isgreater'),
+			),
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['filter_records'] = array (
-	'title' 	=> "Mail Filter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_mailfilter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Mail Filter",
+	'width'  => 100,
+	'template'  => "templates/mail_user_mailfilter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'move_junk' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	),
 	'plugins' => array (
-     	'filter_records' => array (
-         	'class'   => 'plugin_listview',
-     		'options' => array(
+		'filter_records' => array (
+			'class'   => 'plugin_listview',
+			'options' => array(
 				'listdef' => 'list/mail_user_filter.list.php',
 				'sqlextwhere' => "mailuser_id = ".@$app->functions->intval(@$_REQUEST['id']),
 				'sql_order_by' => "ORDER BY rulename"
 			)
-        )
+		)
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['mailfilter'] = array (
-	'title' 	=> "Custom Rules",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_custom_rules_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'custom_mailfilter' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '15'
-		),
-	##################################
-	# END Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['mailfilter'] = array (
+		'title'  => "Custom Rules",
+		'width'  => 100,
+		'template'  => "templates/mail_user_custom_rules_edit.htm",
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'custom_mailfilter' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '15'
+			),
+			//#################################
+			// END Datatable fields
+			//#################################
+		)
+	);
 
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_user_filter.tform.php b/interface/web/mail/form/mail_user_filter.tform.php
index 8962e79..e001f68 100644
--- a/interface/web/mail/form/mail_user_filter.tform.php
+++ b/interface/web/mail/form/mail_user_filter.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "Email filter";
-$form["description"] 	= "";
-$form["name"] 			= "mail_user_filter";
-$form["action"]			= "mail_user_filter_edit.php";
-$form["db_table"]		= "mail_user_filter";
-$form["db_table_idx"]	= "filter_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "filter";
-$form["list_default"]	= "mail_user_filter_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email filter";
+$form["description"]  = "";
+$form["name"]    = "mail_user_filter";
+$form["action"]   = "mail_user_filter_edit.php";
+$form["db_table"]  = "mail_user_filter";
+$form["db_table_idx"] = "filter_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "filter";
+$form["list_default"] = "mail_user_filter_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,83 +52,83 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['filter'] = array (
-	'title' 	=> "Filter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_filter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Filter",
+	'width'  => 100,
+	'template'  => "templates/mail_user_filter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'mailuser_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["mailuser_id"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["mailuser_id"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'rulename' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'rulename_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'rulename_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('Subject' => 'subject_txt','From'=>'from_txt','To'=>'to_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('Subject' => 'subject_txt', 'From'=>'from_txt', 'To'=>'to_txt')
 		),
 		'op' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			#'value'		=> array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
-			'value'		=> array('contains'=>'contains_txt','is' => 'is_txt','begins'=>'begins_with_txt','ends'=>'ends_with_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			//'value'  => array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
+			'value'  => array('contains'=>'contains_txt', 'is' => 'is_txt', 'begins'=>'begins_with_txt', 'ends'=>'ends_with_txt')
 		),
 		'searchterm' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'searchterm_is_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'searchterm_is_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('move' => 'move_to_txt','delete'=>'delete_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('move' => 'move_to_txt', 'delete'=>'delete_txt')
 		),
 		'target' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\p{Latin}0-9\.\-\_\ ]{0,100}$/u',
-														'errmsg'=> 'target_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\p{Latin}0-9\.\-\_\ ]{0,100}$/u',
+					'errmsg'=> 'target_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/mail/form/mail_whitelist.tform.php b/interface/web/mail/form/mail_whitelist.tform.php
index 8d98346..3edb132 100644
--- a/interface/web/mail/form/mail_whitelist.tform.php
+++ b/interface/web/mail/form/mail_whitelist.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Email Whitelist";
-$form["description"] 	= "";
-$form["name"] 			= "mail_whitelist";
-$form["action"]			= "mail_whitelist_edit.php";
-$form["db_table"]		= "mail_access";
-$form["db_table_idx"]	= "access_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "whitelist";
-$form["list_default"]	= "mail_whitelist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Whitelist";
+$form["description"]  = "";
+$form["name"]    = "mail_whitelist";
+$form["action"]   = "mail_whitelist_edit.php";
+$form["db_table"]  = "mail_access";
+$form["db_table_idx"] = "access_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "whitelist";
+$form["list_default"] = "mail_whitelist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,60 +51,60 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['whitelist'] = array (
-	'title' 	=> "Witelist",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_whitelist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Witelist",
+	'width'  => 100,
+	'template'  => "templates/mail_whitelist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'access' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'OK',
-			'value'		=> 'OK',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'OK',
+			'value'  => 'OK',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/spamfilter_blacklist.tform.php b/interface/web/mail/form/spamfilter_blacklist.tform.php
index a51addb..091fb45 100644
--- a/interface/web/mail/form/spamfilter_blacklist.tform.php
+++ b/interface/web/mail/form/spamfilter_blacklist.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter blacklist";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_blacklist";
-$form["action"]			= "spamfilter_blacklist_edit.php";
-$form["db_table"]		= "spamfilter_wblist";
-$form["db_table_idx"]	= "wblist_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "blacklist";
-$form["list_default"]	= "spamfilter_blacklist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter blacklist";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_blacklist";
+$form["action"]   = "spamfilter_blacklist_edit.php";
+$form["db_table"]  = "spamfilter_wblist";
+$form["db_table_idx"] = "wblist_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "blacklist";
+$form["list_default"] = "spamfilter_blacklist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,69 +51,69 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['blacklist'] = array (
-	'title' 	=> "Blacklist",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_blacklist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Blacklist",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_blacklist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'wb' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'B',
-			'value'		=> array('W' => 'blacklist', 'B' => 'Blacklist')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'B',
+			'value'  => array('W' => 'blacklist', 'B' => 'Blacklist')
 		),
 		'rid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'=> 'id',
-										'valuefield'=> 'email'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'=> 'id',
+				'valuefield'=> 'email'
+			),
+			'value'  => ''
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'email_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'email_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> 5,
-			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => 5,
+			'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/spamfilter_config.tform.php b/interface/web/mail/form/spamfilter_config.tform.php
index 224cb60..39c1b35 100644
--- a/interface/web/mail/form/spamfilter_config.tform.php
+++ b/interface/web/mail/form/spamfilter_config.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter Config";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_config";
-$form["action"]			= "spamfilter_config_edit.php";
-$form["db_table"]		= "server";
-$form["db_table_idx"]	= "server_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "server";
-$form["list_default"]	= "spamfilter_config_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter Config";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_config";
+$form["action"]   = "spamfilter_config_edit.php";
+$form["db_table"]  = "server";
+$form["db_table_idx"] = "server_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "server";
+$form["list_default"] = "spamfilter_config_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,232 +51,232 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['server'] = array (
-	'title' 	=> "Server",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_config_server_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Server",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_config_server_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '192.168.0.105',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ip_address_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '192.168.0.105',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ip_address_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '15',
+			'maxlength' => '255'
 		),
 		'netmask' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '255.255.255.0',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'netmask_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '255.255.255.0',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'netmask_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '15',
+			'maxlength' => '255'
 		),
 		'gateway' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '192.168.0.1',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'gateway_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '192.168.0.1',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'gateway_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '15',
+			'maxlength' => '255'
 		),
 		'hostname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'server1.domain.tld',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'hostname_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'server1.domain.tld',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'hostname_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'nameservers' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '192.168.0.1,192.168.0.2',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'nameservers_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '192.168.0.1,192.168.0.2',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'nameservers_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['mail'] = array (
-	'title' 	=> "Mail",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_config_mail_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Mail",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_config_mail_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'module' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('postfix_mysql' => 'postfix_mysql')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('postfix_mysql' => 'postfix_mysql')
 		),
 		'maildir_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '/home/vmail/[domain]/[localpart]/',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'maildir_path_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '/home/vmail/[domain]/[localpart]/',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'maildir_path_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'homedir_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '/home/vmail/',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'homedir_path_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '/home/vmail/',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'homedir_path_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'mailuser_uid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '5000',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mailuser_uid_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '5000',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mailuser_uid_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'mailuser_gid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '5000',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mailuser_gid_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '5000',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mailuser_gid_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'mailuser_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'vmail',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mailuser_name_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'vmail',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mailuser_name_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'mailuser_group' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'vmail',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mailuser_group_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'vmail',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mailuser_group_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'relayhost' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'relayhost_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'relayhost_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'mailbox_size_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '15'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '15'
 		),
 		'message_size_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '15'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '15'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['getmail'] = array (
-	'title' 	=> "Getmail",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_config_getmail_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Getmail",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_config_getmail_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'getmail_config_dir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'getmail_config_dir_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'getmail_config_dir_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/spamfilter_policy.tform.php b/interface/web/mail/form/spamfilter_policy.tform.php
index 0e83e67..da63732 100644
--- a/interface/web/mail/form/spamfilter_policy.tform.php
+++ b/interface/web/mail/form/spamfilter_policy.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter policy";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_policy";
-$form["action"]			= "spamfilter_policy_edit.php";
-$form["db_table"]		= "spamfilter_policy";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "policy";
-$form["list_default"]	= "spamfilter_policy_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter policy";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_policy";
+$form["action"]   = "spamfilter_policy_edit.php";
+$form["db_table"]  = "spamfilter_policy";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "policy";
+$form["list_default"] = "spamfilter_policy_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,332 +51,332 @@
 $form["auth_preset"]["perm_other"] = 'r'; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['policy'] = array (
-	'title' 	=> "Policy",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_policy_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Policy",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_policy_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'policy_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'policyname_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'policyname_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'virus_lover' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'spam_lover' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'banned_files_lover' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'bad_header_lover' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'bypass_virus_checks' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'bypass_banned_checks' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'bypass_header_checks' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 $form["tabs"]['quarantine'] = array (
-	'title' 	=> "Quarantine",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_quarantine_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Quarantine",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_quarantine_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'virus_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'banned_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'bad_header_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'clean_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'other_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['taglevel'] = array (
-	'title' 	=> "Tag-Level",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_taglevel_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Tag-Level",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_taglevel_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'spam_tag_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_tag2_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_kill_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_dsn_cutoff_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_quarantine_cutoff_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_modifies_subj' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'spam_subject_tag' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_subject_tag2' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 $form["tabs"]['other'] = array (
-	'title' 	=> "Other",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_other_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Other",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_other_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'addr_extension_virus' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'addr_extension_spam' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'addr_extension_banned' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'addr_extension_bad_header' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'warnvirusrecip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'warnbannedrecip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'warnbadhrecip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'newvirus_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'virus_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'banned_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'bad_header_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-		
+
 		'message_size_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'banned_rulenames' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-		
-	##################################
-	# ENDE Datatable fields
-	##################################
+
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/spamfilter_users.tform.php b/interface/web/mail/form/spamfilter_users.tform.php
index 980a64f..7bd6c46 100644
--- a/interface/web/mail/form/spamfilter_users.tform.php
+++ b/interface/web/mail/form/spamfilter_users.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter users";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_users";
-$form["action"]			= "spamfilter_users_edit.php";
-$form["db_table"]		= "spamfilter_users";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "users";
-$form["list_default"]	= "spamfilter_users_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter users";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_users";
+$form["action"]   = "spamfilter_users_edit.php";
+$form["db_table"]  = "spamfilter_users";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "users";
+$form["list_default"] = "spamfilter_users_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,80 +51,80 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['users'] = array (
-	'title' 	=> "Users",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_users_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Users",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_users_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> 5,
-			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => 5,
+			'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
 		),
 		'policy_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '5',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
-										'keyfield'=> 'id',
-										'valuefield'=> 'policy_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '5',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
+				'keyfield'=> 'id',
+				'valuefield'=> 'policy_name'
+			),
+			'value'  => ''
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'email_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'email_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'fullname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'fullname_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'fullname_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'local' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'Y',
-			'value'		=> array('Y' => 'Yes','N' => 'No')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'Y',
+			'value'  => array('Y' => 'Yes', 'N' => 'No')
 		),
-		
-	##################################
-	# ENDE Datatable fields
-	##################################
+
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/mail/form/spamfilter_whitelist.tform.php b/interface/web/mail/form/spamfilter_whitelist.tform.php
index 73d53f8..bf2ae43 100644
--- a/interface/web/mail/form/spamfilter_whitelist.tform.php
+++ b/interface/web/mail/form/spamfilter_whitelist.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter Whitelist";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_whitelist";
-$form["action"]			= "spamfilter_whitelist_edit.php";
-$form["db_table"]		= "spamfilter_wblist";
-$form["db_table_idx"]	= "wblist_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "whitelist";
-$form["list_default"]	= "spamfilter_whitelist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter Whitelist";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_whitelist";
+$form["action"]   = "spamfilter_whitelist_edit.php";
+$form["db_table"]  = "spamfilter_wblist";
+$form["db_table_idx"] = "wblist_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "whitelist";
+$form["list_default"] = "spamfilter_whitelist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,76 +51,76 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['whitelist'] = array (
-	'title' 	=> "Whitelist",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_whitelist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Whitelist",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_whitelist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'wb' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'W',
-			'value'		=> array('W' => 'Whitelist', 'B' => 'Blacklist')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'W',
+			'value'  => array('W' => 'Whitelist', 'B' => 'Blacklist')
 		),
 		'rid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'=> 'id',
-										'valuefield'=> 'email'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'=> 'id',
+				'valuefield'=> 'email'
+			),
+			'value'  => ''
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'email_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'email_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> 5,
-			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => 5,
+			'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/lib/admin.conf.php b/interface/web/mail/lib/admin.conf.php
index 67c94a5..acb6c35 100644
--- a/interface/web/mail/lib/admin.conf.php
+++ b/interface/web/mail/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php
index 731fa91..45e06f2 100644
--- a/interface/web/mail/lib/module.conf.php
+++ b/interface/web/mail/lib/module.conf.php
@@ -2,150 +2,150 @@
 
 $userid=$app->auth->get_user_id();
 
-$module['name'] 		= 'mail';
-$module['title'] 		= 'top_menu_email';
-$module['template'] 	= 'module.tpl.htm';
-$module['startpage'] 	= 'mail/mail_domain_list.php';
+$module['name']   = 'mail';
+$module['title']   = 'top_menu_email';
+$module['template']  = 'module.tpl.htm';
+$module['startpage']  = 'mail/mail_domain_list.php';
 $module['tab_width']    = '';
 
 
 //**** Email accounts menu
 $items = array();
 
-if($app->auth->get_client_limit($userid,'maildomain') != 0)
+if($app->auth->get_client_limit($userid, 'maildomain') != 0)
 {
-	$items[] = array( 'title' 	=> 'Domain',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_domain_list.php',
-					  'html_id' => 'mail_domain_list');
-}
-	
-if($app->auth->get_client_limit($userid,'mailaliasdomain') != 0)
-{
-	$items[] = array( 'title' 	=> 'Domain Alias',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_aliasdomain_list.php',
-					  'html_id' => 'mail_aliasdomain_list');
+	$items[] = array( 'title'  => 'Domain',
+		'target'  => 'content',
+		'link' => 'mail/mail_domain_list.php',
+		'html_id' => 'mail_domain_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailbox') != 0)
+if($app->auth->get_client_limit($userid, 'mailaliasdomain') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Mailbox',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_user_list.php',
-					  'html_id' => 'mail_user_list');
+	$items[] = array( 'title'  => 'Domain Alias',
+		'target'  => 'content',
+		'link' => 'mail/mail_aliasdomain_list.php',
+		'html_id' => 'mail_aliasdomain_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailalias') != 0)
+if($app->auth->get_client_limit($userid, 'mailbox') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Alias',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_alias_list.php',
-					  'html_id' => 'mail_alias_list');
+	$items[] = array( 'title'  => 'Email Mailbox',
+		'target'  => 'content',
+		'link' => 'mail/mail_user_list.php',
+		'html_id' => 'mail_user_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailforward') != 0)
+if($app->auth->get_client_limit($userid, 'mailalias') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Forward',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_forward_list.php',
-					  'html_id' => 'mail_forward_list');
+	$items[] = array( 'title'  => 'Email Alias',
+		'target'  => 'content',
+		'link' => 'mail/mail_alias_list.php',
+		'html_id' => 'mail_alias_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailcatchall') != 0)
+if($app->auth->get_client_limit($userid, 'mailforward') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Catchall',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_domain_catchall_list.php',
-					  'html_id' => 'mail_domain_catchall_list');
+	$items[] = array( 'title'  => 'Email Forward',
+		'target'  => 'content',
+		'link' => 'mail/mail_forward_list.php',
+		'html_id' => 'mail_forward_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailrouting') != 0)
+if($app->auth->get_client_limit($userid, 'mailcatchall') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Routing',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_transport_list.php',
-					  'html_id' => 'mail_transport_list');
+	$items[] = array( 'title'  => 'Email Catchall',
+		'target'  => 'content',
+		'link' => 'mail/mail_domain_catchall_list.php',
+		'html_id' => 'mail_domain_catchall_list');
+}
+
+if($app->auth->get_client_limit($userid, 'mailrouting') != 0)
+{
+	$items[] = array( 'title'  => 'Email Routing',
+		'target'  => 'content',
+		'link' => 'mail/mail_transport_list.php',
+		'html_id' => 'mail_transport_list');
 }
 
 if(count($items))
 {
-	$module['nav'][] = array(	'title'	=> 'Email Accounts',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Email Accounts',
+		'open'  => 1,
+		'items' => $items);
 }
 
 //**** Mailinglist menu
 $items = array();
 
-if($app->auth->get_client_limit($userid,'mailmailinglist') != 0)
+if($app->auth->get_client_limit($userid, 'mailmailinglist') != 0)
 {
-	$items[] = array( 'title' 	=> 'Mailing List',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_mailinglist_list.php',
-					  'html_id' => 'mail_mailinglist_list');
+	$items[] = array( 'title'  => 'Mailing List',
+		'target'  => 'content',
+		'link' => 'mail/mail_mailinglist_list.php',
+		'html_id' => 'mail_mailinglist_list');
 }
 
 if(count($items))
 {
-	$module['nav'][] = array(	'title'	=> 'Mailing List',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Mailing List',
+		'open'  => 1,
+		'items' => $items);
 }
 
 //**** Spamfilter menu
 $items = array();
 
-if($app->auth->get_client_limit($userid,'spamfilter_wblist') != 0)
+if($app->auth->get_client_limit($userid, 'spamfilter_wblist') != 0)
 {
-	$items[] = array( 'title' 	=> 'Whitelist',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/spamfilter_whitelist_list.php',
-					  'html_id' => 'spamfilter_whitelist_list');
-		
-	$items[] = array( 'title' 	=> 'Blacklist',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/spamfilter_blacklist_list.php',
-					  'html_id' => 'spamfilter_blacklist_list');
+	$items[] = array( 'title'  => 'Whitelist',
+		'target'  => 'content',
+		'link' => 'mail/spamfilter_whitelist_list.php',
+		'html_id' => 'spamfilter_whitelist_list');
+
+	$items[] = array( 'title'  => 'Blacklist',
+		'target'  => 'content',
+		'link' => 'mail/spamfilter_blacklist_list.php',
+		'html_id' => 'spamfilter_blacklist_list');
 }
 
 if($app->auth->is_admin()) {
 
-	$items[] = array( 	'title' 	=> 'User / Domain',
-				  		'target' 	=> 'content',
-				  		'link'	    => 'mail/spamfilter_users_list.php',
-				  		'html_id' => 'spamfilter_users_list');
+	$items[] = array(  'title'  => 'User / Domain',
+		'target'  => 'content',
+		'link'     => 'mail/spamfilter_users_list.php',
+		'html_id' => 'spamfilter_users_list');
 
-	$items[] = array( 	'title' 	=> 'Policy',
-				  		'target' 	=> 'content',
-				  		'link'	    => 'mail/spamfilter_policy_list.php',
-				  		'html_id' => 'spamfilter_policy_list');
+	$items[] = array(  'title'  => 'Policy',
+		'target'  => 'content',
+		'link'     => 'mail/spamfilter_policy_list.php',
+		'html_id' => 'spamfilter_policy_list');
 
-//	$items[] = array( 	'title' 	=> 'Server Settings',
-//				  		'target' 	=> 'content',
-//				  		'link'	    => 'mail/spamfilter_config_list.php');
+	// $items[] = array(  'title'  => 'Server Settings',
+	//        'target'  => 'content',
+	//        'link'     => 'mail/spamfilter_config_list.php');
 }
 
 if(count($items))
 {
-	$module['nav'][] = array(	'title'	=> 'Spamfilter',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Spamfilter',
+		'open'  => 1,
+		'items' => $items);
 }
 
 //**** Fetchmail menu
 $items = array();
 
-if($app->auth->get_client_limit($userid,'fetchmail') != 0)
+if($app->auth->get_client_limit($userid, 'fetchmail') != 0)
 {
-	$items[] = array( 'title' 	=> 'Fetchmail',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_get_list.php',
-					  'html_id' => 'mail_get_list');
-		
-	$module['nav'][] = array(	'title'	=> 'Fetchmail',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$items[] = array( 'title'  => 'Fetchmail',
+		'target'  => 'content',
+		'link' => 'mail/mail_get_list.php',
+		'html_id' => 'mail_get_list');
+
+	$module['nav'][] = array( 'title' => 'Fetchmail',
+		'open'  => 1,
+		'items' => $items);
 }
 
 
@@ -156,52 +156,52 @@
 
 //** Email Quotas
 $items[] = array( 'title'   => 'Mailbox quota',
-                  'target'  => 'content',
-                  'link'    => 'mail/user_quota_stats.php',
-                  'html_id' => 'user_quota_stats');
+	'target'  => 'content',
+	'link'    => 'mail/user_quota_stats.php',
+	'html_id' => 'user_quota_stats');
 
-$items[] = array( 'title' 	=> 'Mailbox traffic',
-				  'target' 	=> 'content',
-				  'link'	=> 'mail/mail_user_stats.php',
-				  'html_id' => 'mail_user_stats');
+$items[] = array( 'title'  => 'Mailbox traffic',
+	'target'  => 'content',
+	'link' => 'mail/mail_user_stats.php',
+	'html_id' => 'mail_user_stats');
 
 
 
-$module['nav'][] = array(	'title'	=> 'Statistics',
-							'open' 	=> 1,
-							'items'	=> $items);
+$module['nav'][] = array( 'title' => 'Statistics',
+	'open'  => 1,
+	'items' => $items);
 
 
 //**** Global filters menu
 $items = array();
 if($_SESSION['s']['user']['typ'] == 'admin') {
 
-	$items[] = array(   'title' 	=> 'Postfix Whitelist',
-  				  	    'target' 	=> 'content',
-				  	    'link'	    => 'mail/mail_whitelist_list.php',
-				  	    'html_id' => 'mail_whitelist_list');
+	$items[] = array(   'title'  => 'Postfix Whitelist',
+		'target'  => 'content',
+		'link'     => 'mail/mail_whitelist_list.php',
+		'html_id' => 'mail_whitelist_list');
 
 
-	$items[] = array(   'title' 	=> 'Postfix Blacklist',
-				 	    'target' 	=> 'content',
-				  	    'link'	    => 'mail/mail_blacklist_list.php',
-				  	    'html_id' => 'mail_blacklist_list');
+	$items[] = array(   'title'  => 'Postfix Blacklist',
+		'target'  => 'content',
+		'link'     => 'mail/mail_blacklist_list.php',
+		'html_id' => 'mail_blacklist_list');
 
 
-	$items[] = array(   'title' 	=> 'Content Filter',
-				 	    'target' 	=> 'content',
-				  	    'link'	    => 'mail/mail_content_filter_list.php',
-				  	    'html_id' => 'mail_content_filter_list');
+	$items[] = array(   'title'  => 'Content Filter',
+		'target'  => 'content',
+		'link'     => 'mail/mail_content_filter_list.php',
+		'html_id' => 'mail_content_filter_list');
 
 
-	$items[] = array(   'title' 	=> 'Relay Recipients',
-				 	    'target' 	=> 'content',
-				  	    'link'	    => 'mail/mail_relay_recipient_list.php',
-				  	    'html_id' => 'mail_relay_recipient_list');
+	$items[] = array(   'title'  => 'Relay Recipients',
+		'target'  => 'content',
+		'link'     => 'mail/mail_relay_recipient_list.php',
+		'html_id' => 'mail_relay_recipient_list');
 
 
-	$module['nav'][] = array(	'title'	=> 'Global Filters',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Global Filters',
+		'open'  => 1,
+		'items' => $items);
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/lib/remote.conf.php b/interface/web/mail/lib/remote.conf.php
index 8d426d5..acb9aea 100644
--- a/interface/web/mail/lib/remote.conf.php
+++ b/interface/web/mail/lib/remote.conf.php
@@ -19,4 +19,4 @@
 $function_list['mail_filter_get,mail_filter_add,mail_filter_update,mail_filter_delete'] = 'Mail filter functions';
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_alias.list.php b/interface/web/mail/list/mail_alias.list.php
index 1016444..2f92e2c 100644
--- a/interface/web/mail/list/mail_alias.list.php
+++ b/interface/web/mail/list/mail_alias.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_alias";
+$liste["name"]     = "mail_alias";
 
 // Database table
-$liste["table"] 			= "mail_forwarding";
+$liste["table"]    = "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "forwarding_id";
+$liste["table_idx"]   = "forwarding_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_alias_list.php";
+$liste["file"]    = "mail_alias_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_alias_edit.php";
+$liste["edit_file"]   = "mail_alias_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_alias_del.php";
+$liste["delete_file"]  = "mail_alias_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_aliasdomain.list.php b/interface/web/mail/list/mail_aliasdomain.list.php
index f4385d8..c5dc4e3 100644
--- a/interface/web/mail/list/mail_aliasdomain.list.php
+++ b/interface/web/mail/list/mail_aliasdomain.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_aliasdomain";
+$liste["name"]     = "mail_aliasdomain";
 
 // Database table
-$liste["table"] 			= "mail_forwarding";
+$liste["table"]    = "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "forwarding_id";
+$liste["table_idx"]   = "forwarding_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_aliasdomain_list.php";
+$liste["file"]    = "mail_aliasdomain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_aliasdomain_edit.php";
+$liste["edit_file"]   = "mail_aliasdomain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_aliasdomain_del.php";
+$liste["delete_file"]  = "mail_aliasdomain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_blacklist.list.php b/interface/web/mail/list/mail_blacklist.list.php
index fd3ab4f..434656b 100644
--- a/interface/web/mail/list/mail_blacklist.list.php
+++ b/interface/web/mail/list/mail_blacklist.list.php
@@ -13,83 +13,83 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_blacklist";
+$liste["name"]     = "mail_blacklist";
 
 // Database table
-$liste["table"] 			= "mail_access";
+$liste["table"]    = "mail_access";
 
 // Index index field of the database table
-$liste["table_idx"]			= "access_id";
+$liste["table_idx"]   = "access_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_blacklist_list.php";
+$liste["file"]    = "mail_blacklist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_blacklist_edit.php";
+$liste["edit_file"]   = "mail_blacklist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_blacklist_del.php";
+$liste["delete_file"]  = "mail_blacklist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client'));
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client'));
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_content_filter.list.php b/interface/web/mail/list/mail_content_filter.list.php
index 1588d58..aa79312 100644
--- a/interface/web/mail/list/mail_content_filter.list.php
+++ b/interface/web/mail/list/mail_content_filter.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_content_filter";
+$liste["name"]     = "mail_content_filter";
 
 // Database table
-$liste["table"] 			= "mail_content_filter";
+$liste["table"]    = "mail_content_filter";
 
 // Index index field of the database table
-$liste["table_idx"]			= "content_filter_id";
+$liste["table_idx"]   = "content_filter_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_content_filter_list.php";
+$liste["file"]    = "mail_content_filter_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_content_filter_edit.php";
+$liste["edit_file"]   = "mail_content_filter_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_content_filter_del.php";
+$liste["delete_file"]  = "mail_content_filter_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,49 +48,49 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "pattern",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "pattern",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "action",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> array('DISCARD' => 'DISCARD','DUNNO'=>'DUNNO','FILTER'=>'FILTER','HOLD'=>'HOLD','IGNORE'=>'IGNORE','PREPEND'=>'PREPEND','REDIRECT'=>'REDIRECT','REPLACE'=>'REPLACE','REJECT'=>'REJECT','WARN'=>'WARN'));
+$liste["item"][] = array( 'field'  => "action",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => array('DISCARD' => 'DISCARD', 'DUNNO'=>'DUNNO', 'FILTER'=>'FILTER', 'HOLD'=>'HOLD', 'IGNORE'=>'IGNORE', 'PREPEND'=>'PREPEND', 'REDIRECT'=>'REDIRECT', 'REPLACE'=>'REPLACE', 'REJECT'=>'REJECT', 'WARN'=>'WARN'));
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_domain.list.php b/interface/web/mail/list/mail_domain.list.php
index 0012e1c..5524f28 100644
--- a/interface/web/mail/list/mail_domain.list.php
+++ b/interface/web/mail/list/mail_domain.list.php
@@ -14,37 +14,37 @@
 
 // Name of the list
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$liste["name"] 				= "mail_domain_admin";
+	$liste["name"]     = "mail_domain_admin";
 } else {
-	$liste["name"] 				= "mail_domain";
+	$liste["name"]     = "mail_domain";
 }
 
 // Database table
-$liste["table"] 			= "mail_domain";
+$liste["table"]    = "mail_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_domain_list.php";
+$liste["file"]    = "mail_domain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_domain_edit.php";
+$liste["edit_file"]   = "mail_domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_domain_del.php";
+$liste["delete_file"]  = "mail_domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -52,58 +52,58 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+	$liste["item"][] = array( 'field'  => "sys_groupid",
+		'datatype' => "INTEGER",
+		'formtype' => "SELECT",
+		'op'  => "=",
+		'prefix' => "",
+		'suffix' => "",
+		'datasource' => array (  'type' => 'SQL',
+			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'keyfield'=> 'groupid',
+			'valuefield'=> 'name'
+		),
+		'width'  => "",
+		'value'  => "");
 }
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT a.server_id, a.server_name FROM server a, mail_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT a.server_id, a.server_name FROM server a, mail_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_domain_catchall.list.php b/interface/web/mail/list/mail_domain_catchall.list.php
index 07f7e9f..75d311d 100644
--- a/interface/web/mail/list/mail_domain_catchall.list.php
+++ b/interface/web/mail/list/mail_domain_catchall.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_domain_catchall";
+$liste["name"]     = "mail_domain_catchall";
 
 // Database table
-$liste["table"] 			= "mail_forwarding";
+$liste["table"]    = "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "forwarding_id";
+$liste["table_idx"]   = "forwarding_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_domain_catchall_list.php";
+$liste["file"]    = "mail_domain_catchall_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_domain_catchall_edit.php";
+$liste["edit_file"]   = "mail_domain_catchall_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_domain_catchall_del.php";
+$liste["delete_file"]  = "mail_domain_catchall_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_forward.list.php b/interface/web/mail/list/mail_forward.list.php
index 5aae2bb..524c2a7 100644
--- a/interface/web/mail/list/mail_forward.list.php
+++ b/interface/web/mail/list/mail_forward.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_forward";
+$liste["name"]     = "mail_forward";
 
 // Database table
-$liste["table"] 			= "mail_forwarding";
+$liste["table"]    = "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "forwarding_id";
+$liste["table_idx"]   = "forwarding_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_forward_list.php";
+$liste["file"]    = "mail_forward_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_forward_edit.php";
+$liste["edit_file"]   = "mail_forward_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_forward_del.php";
+$liste["delete_file"]  = "mail_forward_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_get.list.php b/interface/web/mail/list/mail_get.list.php
index bcce2c0..aa93386 100644
--- a/interface/web/mail/list/mail_get.list.php
+++ b/interface/web/mail/list/mail_get.list.php
@@ -13,93 +13,93 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_get";
+$liste["name"]     = "mail_get";
 
 // Database table
-$liste["table"] 			= "mail_get";
+$liste["table"]    = "mail_get";
 
 // Index index field of the database table
-$liste["table_idx"]			= "mailget_id";
+$liste["table_idx"]   = "mailget_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_get_list.php";
+$liste["file"]    = "mail_get_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_get_edit.php";
+$liste["edit_file"]   = "mail_get_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_get_del.php";
+$liste["delete_file"]  = "mail_get_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "source_server",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source_server",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "source_username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source_username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_mailinglist.list.php b/interface/web/mail/list/mail_mailinglist.list.php
index 4bc3b06..b72a9ec 100644
--- a/interface/web/mail/list/mail_mailinglist.list.php
+++ b/interface/web/mail/list/mail_mailinglist.list.php
@@ -13,58 +13,58 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_mailinglist";
+$liste["name"]     = "mail_mailinglist";
 
 // Database table
-$liste["table"] 			= "mail_mailinglist";
+$liste["table"]    = "mail_mailinglist";
 
 // Index index field of the database table
-$liste["table_idx"]			= "mailinglist_id";
+$liste["table_idx"]   = "mailinglist_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_mailinglist_list.php";
+$liste["file"]    = "mail_mailinglist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_mailinglist_edit.php";
+$liste["edit_file"]   = "mail_mailinglist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_mailinglist_del.php";
+$liste["delete_file"]  = "mail_mailinglist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
-$liste["item"][] = array(	'field'		=> "listname",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "listname",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+?>
diff --git a/interface/web/mail/list/mail_relay_recipient.list.php b/interface/web/mail/list/mail_relay_recipient.list.php
index a442ece..cc26721 100644
--- a/interface/web/mail/list/mail_relay_recipient.list.php
+++ b/interface/web/mail/list/mail_relay_recipient.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_relay_recipient";
+$liste["name"]     = "mail_relay_recipient";
 
 // Database table
-$liste["table"] 			= "mail_relay_recipient";
+$liste["table"]    = "mail_relay_recipient";
 
 // Index index field of the database table
-$liste["table_idx"]			= "relay_recipient_id";
+$liste["table_idx"]   = "relay_recipient_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_relay_recipient_list.php";
+$liste["file"]    = "mail_relay_recipient_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_relay_recipient_edit.php";
+$liste["edit_file"]   = "mail_relay_recipient_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_relay_recipient_del.php";
+$liste["delete_file"]  = "mail_relay_recipient_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_spamfilter.list.php b/interface/web/mail/list/mail_spamfilter.list.php
index 8c154f0..645feac 100644
--- a/interface/web/mail/list/mail_spamfilter.list.php
+++ b/interface/web/mail/list/mail_spamfilter.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_spamfilter";
+$liste["name"]     = "mail_spamfilter";
 
 // Database table
-$liste["table"] 			= "server";
+$liste["table"]    = "server";
 
 // Index index field of the database table
-$liste["table_idx"]			= "server_id";
+$liste["table_idx"]   = "server_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_spamfilter_list.php";
+$liste["file"]    = "mail_spamfilter_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_spamfilter_edit.php";
+$liste["edit_file"]   = "mail_spamfilter_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_spamfilter_del.php";
+$liste["delete_file"]  = "mail_spamfilter_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "server_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_transport.list.php b/interface/web/mail/list/mail_transport.list.php
index ccea270..d554da9 100644
--- a/interface/web/mail/list/mail_transport.list.php
+++ b/interface/web/mail/list/mail_transport.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_transport";
+$liste["name"]     = "mail_transport";
 
 // Database table
-$liste["table"] 			= "mail_transport";
+$liste["table"]    = "mail_transport";
 
 // Index index field of the database table
-$liste["table_idx"]			= "transport_id";
+$liste["table_idx"]   = "transport_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_transport_list.php";
+$liste["file"]    = "mail_transport_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_transport_edit.php";
+$liste["edit_file"]   = "mail_transport_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_transport_del.php";
+$liste["delete_file"]  = "mail_transport_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,60 +48,60 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "transport",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "transport",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "sort_order",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "sort_order",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_user.list.php b/interface/web/mail/list/mail_user.list.php
index 8d03773..0b17bf7 100644
--- a/interface/web/mail/list/mail_user.list.php
+++ b/interface/web/mail/list/mail_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "mail_user";
+$liste["name"]    = "mail_user";
 
 // Database table
-$liste["table"] 		= "mail_user";
+$liste["table"]   = "mail_user";
 
 // Index index field of the database table
-$liste["table_idx"]		= "mailuser_id";
+$liste["table_idx"]  = "mailuser_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "mail_user_list.php";
+$liste["file"]   = "mail_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "mail_user_edit.php";
+$liste["edit_file"]  = "mail_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_del.php";
+$liste["delete_file"]  = "mail_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -48,45 +48,45 @@
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "email",
-                            'datatype'  => "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "login",
-                            'datatype'  => "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "autoresponder",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));							
-							
-?>
\ No newline at end of file
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+?>
diff --git a/interface/web/mail/list/mail_user_filter.list.php b/interface/web/mail/list/mail_user_filter.list.php
index 445fe6f..6b71b41 100644
--- a/interface/web/mail/list/mail_user_filter.list.php
+++ b/interface/web/mail/list/mail_user_filter.list.php
@@ -13,48 +13,48 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_user_filter";
+$liste["name"]     = "mail_user_filter";
 
 // Database table
-$liste["table"] 			= "mail_user_filter";
+$liste["table"]    = "mail_user_filter";
 
 // Index index field of the database table
-$liste["table_idx"]			= "filter_id";
+$liste["table_idx"]   = "filter_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_user_list.php";
+$liste["file"]    = "mail_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_user_filter_edit.php";
+$liste["edit_file"]   = "mail_user_filter_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_filter_del.php";
+$liste["delete_file"]  = "mail_user_filter_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "no";
+$liste["auth"]    = "no";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "rulename",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "rulename",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_user_stats.list.php b/interface/web/mail/list/mail_user_stats.list.php
index aa14431..4bc0d2b 100644
--- a/interface/web/mail/list/mail_user_stats.list.php
+++ b/interface/web/mail/list/mail_user_stats.list.php
@@ -13,51 +13,51 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_user_stats";
+$liste["name"]     = "mail_user_stats";
 
 // Database table
-$liste["table"] 			= "mail_user";
+$liste["table"]    = "mail_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "mailuser_id";
+$liste["table_idx"]   = "mailuser_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_user_stats.php";
+$liste["file"]    = "mail_user_stats.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_user_edit.php";
+$liste["edit_file"]   = "mail_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_del.php";
+$liste["delete_file"]  = "mail_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "email",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "email",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_whitelist.list.php b/interface/web/mail/list/mail_whitelist.list.php
index beb3cab..2069a6b 100644
--- a/interface/web/mail/list/mail_whitelist.list.php
+++ b/interface/web/mail/list/mail_whitelist.list.php
@@ -13,82 +13,82 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_whitelist";
+$liste["name"]     = "mail_whitelist";
 
 // Database table
-$liste["table"] 			= "mail_access";
+$liste["table"]    = "mail_access";
 
 // Index index field of the database table
-$liste["table_idx"]			= "access_id";
+$liste["table_idx"]   = "access_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_whitelist_list.php";
+$liste["file"]    = "mail_whitelist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_whitelist_edit.php";
+$liste["edit_file"]   = "mail_whitelist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_whitelist_del.php";
+$liste["delete_file"]  = "mail_whitelist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('recipient' => 'recipient_txt', 'sender' => 'sender_txt', 'client' => 'client_txt'));
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('recipient' => 'recipient_txt', 'sender' => 'sender_txt', 'client' => 'client_txt'));
 
 
 ?>
diff --git a/interface/web/mail/list/spamfilter_blacklist.list.php b/interface/web/mail/list/spamfilter_blacklist.list.php
index 2978161..faadd53 100644
--- a/interface/web/mail/list/spamfilter_blacklist.list.php
+++ b/interface/web/mail/list/spamfilter_blacklist.list.php
@@ -13,96 +13,96 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_blacklist";
+$liste["name"]     = "spamfilter_blacklist";
 
 // Database table
-$liste["table"] 			= "spamfilter_wblist";
+$liste["table"]    = "spamfilter_wblist";
 
 // Index index field of the database table
-$liste["table_idx"]			= "wblist_id";
+$liste["table_idx"]   = "wblist_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_blacklist_list.php";
+$liste["file"]    = "spamfilter_blacklist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_blacklist_edit.php";
+$liste["edit_file"]   = "spamfilter_blacklist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_blacklist_del.php";
+$liste["delete_file"]  = "spamfilter_blacklist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "priority",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
+$liste["item"][] = array( 'field'  => "priority",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
 
-$liste["item"][] = array(	'field'		=> "rid",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
-														'keyfield'=> 'id',
-														'valuefield'=> 'email'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "rid",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
+		'keyfield'=> 'id',
+		'valuefield'=> 'email'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "email",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "email",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/spamfilter_config.list.php b/interface/web/mail/list/spamfilter_config.list.php
index 2263ffa..315856f 100644
--- a/interface/web/mail/list/spamfilter_config.list.php
+++ b/interface/web/mail/list/spamfilter_config.list.php
@@ -13,48 +13,48 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_config";
+$liste["name"]     = "spamfilter_config";
 
 // Database table
-$liste["table"] 			= "server";
+$liste["table"]    = "server";
 
 // Index index field of the database table
-$liste["table_idx"]			= "server_id";
+$liste["table_idx"]   = "server_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_config_list.php";
+$liste["file"]    = "spamfilter_config_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_config_edit.php";
+$liste["edit_file"]   = "spamfilter_config_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_config_del.php";
+$liste["delete_file"]  = "spamfilter_config_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "server_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/spamfilter_policy.list.php b/interface/web/mail/list/spamfilter_policy.list.php
index a486294..03b3972 100644
--- a/interface/web/mail/list/spamfilter_policy.list.php
+++ b/interface/web/mail/list/spamfilter_policy.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_policy";
+$liste["name"]     = "spamfilter_policy";
 
 // Database table
-$liste["table"] 			= "spamfilter_policy";
+$liste["table"]    = "spamfilter_policy";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_policy_list.php";
+$liste["file"]    = "spamfilter_policy_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_policy_edit.php";
+$liste["edit_file"]   = "spamfilter_policy_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_policy_del.php";
+$liste["delete_file"]  = "spamfilter_policy_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,54 +48,54 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "policy_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "policy_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "virus_lover",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "virus_lover",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "spam_lover",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "spam_lover",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "banned_files_lover",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "banned_files_lover",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "bad_header_lover",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "bad_header_lover",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
 
@@ -113,4 +113,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/spamfilter_users.list.php b/interface/web/mail/list/spamfilter_users.list.php
index d02b4ca..6438d9f 100644
--- a/interface/web/mail/list/spamfilter_users.list.php
+++ b/interface/web/mail/list/spamfilter_users.list.php
@@ -13,96 +13,96 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_users";
+$liste["name"]     = "spamfilter_users";
 
 // Database table
-$liste["table"] 			= "spamfilter_users";
+$liste["table"]    = "spamfilter_users";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_users_list.php";
+$liste["file"]    = "spamfilter_users_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_users_edit.php";
+$liste["edit_file"]   = "spamfilter_users_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_users_del.php";
+$liste["delete_file"]  = "spamfilter_users_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "local",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "local",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "priority",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
+$liste["item"][] = array( 'field'  => "priority",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
 
-$liste["item"][] = array(	'field'		=> "policy_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
-														'keyfield'=> 'id',
-														'valuefield'=> 'policy_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "policy_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
+		'keyfield'=> 'id',
+		'valuefield'=> 'policy_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "fullname",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "fullname",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/spamfilter_whitelist.list.php b/interface/web/mail/list/spamfilter_whitelist.list.php
index f49e235..8e5d8b7 100644
--- a/interface/web/mail/list/spamfilter_whitelist.list.php
+++ b/interface/web/mail/list/spamfilter_whitelist.list.php
@@ -13,96 +13,96 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_whitelist";
+$liste["name"]     = "spamfilter_whitelist";
 
 // Database table
-$liste["table"] 			= "spamfilter_wblist";
+$liste["table"]    = "spamfilter_wblist";
 
 // Index index field of the database table
-$liste["table_idx"]			= "wblist_id";
+$liste["table_idx"]   = "wblist_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_whitelist_list.php";
+$liste["file"]    = "spamfilter_whitelist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_whitelist_edit.php";
+$liste["edit_file"]   = "spamfilter_whitelist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_whitelist_del.php";
+$liste["delete_file"]  = "spamfilter_whitelist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "priority",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
+$liste["item"][] = array( 'field'  => "priority",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
 
-$liste["item"][] = array(	'field'		=> "rid",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
-														'keyfield'=> 'id',
-														'valuefield'=> 'email'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "rid",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
+		'keyfield'=> 'id',
+		'valuefield'=> 'email'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "email",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "email",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/user_quota_stats.list.php b/interface/web/mail/list/user_quota_stats.list.php
index 5787556..e8faae3 100644
--- a/interface/web/mail/list/user_quota_stats.list.php
+++ b/interface/web/mail/list/user_quota_stats.list.php
@@ -11,34 +11,34 @@
 */
 
 // Name of the list
-$liste["name"] 				= "user_quota_stats";
+$liste["name"]     = "user_quota_stats";
 
 // Database table
-$liste["table"] 			= "mail_user";
+$liste["table"]    = "mail_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "mailuser_id";
+$liste["table_idx"]   = "mailuser_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "user_quota_stats.php";
+$liste["file"]    = "user_quota_stats.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_user_edit.php";
+$liste["edit_file"]   = "mail_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_del.php";
+$liste["delete_file"]  = "mail_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 // mark columns for php sorting (no real mySQL columns)
 $liste["phpsort"] = array('used_sort', 'percentage_sort');
@@ -48,34 +48,34 @@
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "email",
-                            'datatype'  => "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "name",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "quota",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_alias_del.php b/interface/web/mail/mail_alias_del.php
index 6457f6d..74f6047 100644
--- a/interface/web/mail/mail_alias_del.php
+++ b/interface/web/mail/mail_alias_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $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 bb96a7e..30eae14 100644
--- a/interface/web/mail/mail_alias_edit.php
+++ b/interface/web/mail/mail_alias_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,31 +49,31 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailalias',"type = 'alias'")) {
+			if(!$app->tform->checkClientLimit('limit_mailalias', "type = 'alias'")) {
 				$app->error($app->tform->wordbook["limit_mailalias_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailalias',"type = 'alias'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailalias', "type = 'alias'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailalias_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$email = $this->dataRecord["source"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
-        $email_parts[1] = $app->functions->idn_decode($email_parts[1]);
-		
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
+		$email_parts[1] = $app->functions->idn_decode($email_parts[1]);
+
 		// Getting Domains of the user
 		// $sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$sql = "SELECT domain FROM mail_domain WHERE domain NOT IN (SELECT SUBSTR(source,2) FROM mail_forwarding WHERE type = 'aliasdomain') AND ".$app->tform->getAuthSQL('r')." ORDER BY domain";
@@ -81,29 +81,29 @@
 		$domain_select = '';
 		if(is_array($domains)) {
 			foreach( $domains as $domain) {
-                $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+				$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 				$selected = ($domain["domain"] == @$email_parts[1])?'SELECTED':'';
 				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
+		$app->tpl->setVar("email_domain", $domain_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["email_domain"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		//* Check if destination email belongs to user
 		if(isset($_POST["destination"])) {
 			$email = $app->db->queryOneRecord("SELECT email FROM mail_user WHERE email = '".$app->db->quote($app->functions->idn_encode($_POST["destination"]))."' AND ".$app->tform->getAuthSQL('r'));
 			if($email["email"] != $app->functions->idn_encode($_POST["destination"])) $app->tform->errorMessage .= $app->tform->lng("no_destination_perm");
 		}
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -119,21 +119,21 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
-		 		
+
+
 		// compose the email field
 		$this->dataRecord["source"] = $_POST["email_local_part"]."@".$app->functions->idn_encode($_POST["email_domain"]);
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		unset($this->dataRecord["email_local_part"]);
 		unset($this->dataRecord["email_domain"]);
-		
+
 		//* Check if there is no active mailbox with this address
 		$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($this->dataRecord["source"])."'");
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_mailbox_txt")."<br>";
 		unset($tmp);
-		
+
 		//* Check if email alias exists
 		if($this->id > 0) {
 			$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE source = '".$app->db->quote($this->dataRecord["source"])."' AND destination = '".$app->db->quote($this->dataRecord["destination"])."' AND forwarding_id != ".$this->id);
@@ -142,22 +142,22 @@
 		}
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_email_alias_txt")."<br>";
 		unset($tmp);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
-		
+
 	}
-	
-	
+
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_alias_list.php b/interface/web/mail/mail_alias_list.php
index 6921894..c3b208c 100644
--- a/interface/web/mail/mail_alias_list.php
+++ b/interface/web/mail/mail_alias_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_aliasdomain_del.php b/interface/web/mail/mail_aliasdomain_del.php
index fba0aea..9e97779 100644
--- a/interface/web/mail/mail_aliasdomain_del.php
+++ b/interface/web/mail/mail_aliasdomain_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_aliasdomain_edit.php b/interface/web/mail/mail_aliasdomain_edit.php
index 8c7b554..0f2c684 100644
--- a/interface/web/mail/mail_aliasdomain_edit.php
+++ b/interface/web/mail/mail_aliasdomain_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,94 +49,94 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+			if(!$app->tform->checkClientLimit('limit_mailaliasdomain', "type = 'aliasdomain'")) {
 				$app->error($app->tform->wordbook["limit_mailaliasdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailaliasdomain', "type = 'aliasdomain'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailaliasdomain_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
-		$source_domain = $app->functions->idn_decode(substr($this->dataRecord["source"],1));
-		$destination_domain = $app->functions->idn_decode(substr($this->dataRecord["destination"],1));
-		
+
+		$source_domain = $app->functions->idn_decode(substr($this->dataRecord["source"], 1));
+		$destination_domain = $app->functions->idn_decode(substr($this->dataRecord["destination"], 1));
+
 		// Getting Domains of the user
 		$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$domains = $app->db->queryAllRecords($sql);
-		
+
 		$source_select = '';
 		$destination_select = '';
 		if(is_array($domains)) {
 			foreach( $domains as $domain) {
-                $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+				$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 				$selected = ($domain["domain"] == @$source_domain)?'SELECTED':'';
 				$source_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 				$selected = ($domain["domain"] == @$destination_domain)?'SELECTED':'';
 				$destination_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("source_domain",$source_select);
-		$app->tpl->setVar("destination_domain",$destination_select);
-		
+		$app->tpl->setVar("source_domain", $source_select);
+		$app->tpl->setVar("destination_domain", $destination_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if source Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["source"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["source"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// Check if the destination domain belongs to the user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["destination"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["destination"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
-			if(!$app->tform->checkClientLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+			if(!$app->tform->checkClientLimit('limit_mailaliasdomain', "type = 'aliasdomain'")) {
 				$app->error($app->tform->wordbook["limit_mailaliasdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailaliasdomain', "type = 'aliasdomain'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailaliasdomain_txt"]);
 			}
 		} // end if user is not admin
-		
+
 		if($this->dataRecord["source"] == $this->dataRecord["destination"]) $app->tform->errorMessage .= $app->tform->wordbook["source_destination_identical_txt"];
-		 		
+
 		// compose the source and destination field
 		$this->dataRecord["source"] = "@".$app->db->quote($this->dataRecord["source"]);
 		$this->dataRecord["destination"] = "@".$app->db->quote($this->dataRecord["destination"]);
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["destination"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
-		
+
 	}
-	
-	
+
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_aliasdomain_list.php b/interface/web/mail/mail_aliasdomain_list.php
index 396aa61..3734f18 100644
--- a/interface/web/mail/mail_aliasdomain_list.php
+++ b/interface/web/mail/mail_aliasdomain_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@
 $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 52308e6..3cb83a5 100644
--- a/interface/web/mail/mail_blacklist_del.php
+++ b/interface/web/mail/mail_blacklist_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $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 b2f4f67..2358ef9 100644
--- a/interface/web/mail/mail_blacklist_edit.php
+++ b/interface/web/mail/mail_blacklist_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,10 +49,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailfilter')) {
@@ -62,7 +62,7 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailfilter_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
 
@@ -85,7 +85,7 @@
 
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -101,14 +101,14 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_blacklist_list.php b/interface/web/mail/mail_blacklist_list.php
index 9c118b3..cf1e50d 100644
--- a/interface/web/mail/mail_blacklist_list.php
+++ b/interface/web/mail/mail_blacklist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_content_filter_del.php b/interface/web/mail/mail_content_filter_del.php
index 1cf9246..86f5937 100644
--- a/interface/web/mail/mail_content_filter_del.php
+++ b/interface/web/mail/mail_content_filter_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_content_filter_edit.php b/interface/web/mail/mail_content_filter_edit.php
index 7ec4322..5672135 100644
--- a/interface/web/mail/mail_content_filter_edit.php
+++ b/interface/web/mail/mail_content_filter_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -67,9 +67,10 @@
 			unset($rec);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_content_filter_list.php b/interface/web/mail/mail_content_filter_list.php
index c2eb5e1..daa202d 100644
--- a/interface/web/mail/mail_content_filter_list.php
+++ b/interface/web/mail/mail_content_filter_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_catchall_del.php b/interface/web/mail/mail_domain_catchall_del.php
index 7eb21c7..e862d86 100644
--- a/interface/web/mail/mail_domain_catchall_del.php
+++ b/interface/web/mail/mail_domain_catchall_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $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 7dc7330..db49e46 100644
--- a/interface/web/mail/mail_domain_catchall_edit.php
+++ b/interface/web/mail/mail_domain_catchall_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,54 +49,54 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailcatchall',"type = 'catchall'")) {
+			if(!$app->tform->checkClientLimit('limit_mailcatchall', "type = 'catchall'")) {
 				$app->error($app->tform->wordbook["limit_mailcatchall_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailcatchall',"type = 'catchall'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailcatchall', "type = 'catchall'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailcatchall_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$email = $this->dataRecord["source"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
 		$email_parts[1] = $app->functions->idn_decode($email_parts[1]);
-        
+
 		// Getting Domains of the user
 		$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r');
 		$domains = $app->db->queryAllRecords($sql);
 		$domain_select = '';
 		if(is_array($domains)) {
 			foreach( $domains as $domain) {
-                $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+				$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 				$selected = (isset($email_parts[1]) && $domain["domain"] == $email_parts[1])?'SELECTED':'';
 				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
+		$app->tpl->setVar("email_domain", $domain_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["email_domain"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -112,29 +112,29 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		 		
+
 		// compose the email field
 		$this->dataRecord["source"] = "@".$app->functions->idn_encode($_POST["email_domain"]);
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		//unset($this->dataRecord["email_local_part"]);
 		unset($this->dataRecord["email_domain"]);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_catchall_list.php b/interface/web/mail/mail_domain_catchall_list.php
index a703a17..49b4123 100644
--- a/interface/web/mail/mail_domain_catchall_list.php
+++ b/interface/web/mail/mail_domain_catchall_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_del.php b/interface/web/mail/mail_domain_del.php
index 806996a..ba715a6 100644
--- a/interface/web/mail/mail_domain_del.php
+++ b/interface/web/mail/mail_domain_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -53,46 +53,47 @@
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
+
 		$domain = $this->dataRecord['domain'];
-		
+
 		// Before we delete the email domain,
 		// we will delete all depending records.
-		
+
 		// Delete all forwardings where the source or destination belongs to this domain
 		$records = $app->db->queryAllRecords("SELECT forwarding_id as id FROM mail_forwarding WHERE source like '%@".$app->db->quote($domain)."' OR (destination like '%@".$app->db->quote($domain)."' AND type != 'forward')");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('mail_forwarding','forwarding_id',$rec['id']);
+			$app->db->datalogDelete('mail_forwarding', 'forwarding_id', $rec['id']);
 		}
-		
+
 		// Delete all fetchmail accounts where destination belongs to this domain
 		$records = $app->db->queryAllRecords("SELECT mailget_id as id FROM mail_get WHERE destination like '%@".$app->db->quote($domain)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('mail_get','mailget_id',$rec['id']);
+			$app->db->datalogDelete('mail_get', 'mailget_id', $rec['id']);
 		}
-		
+
 		// Delete all mailboxes where destination belongs to this domain
 		$records = $app->db->queryAllRecords("SELECT mailuser_id as id FROM mail_user WHERE email like '%@".$app->db->quote($domain)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('mail_user','mailuser_id',$rec['id']);
+			$app->db->datalogDelete('mail_user', 'mailuser_id', $rec['id']);
 		}
-		
+
 		// Delete all spamfilters that belong to this domain
 		$records = $app->db->queryAllRecords("SELECT id FROM spamfilter_users WHERE email = '%@".$app->db->quote($domain)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('spamfilter_users','id',$rec['id']);
+			$app->db->datalogDelete('spamfilter_users', 'id', $rec['id']);
 		}
-		
+
 		// Delete all mailinglists that belong to this domain
 		$records = $app->db->queryAllRecords("SELECT mailinglist_id FROM mail_mailinglist WHERE domain = '".$app->db->quote($domain)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('mail_mailinglist','mailinglist_id',$rec['id']);
+			$app->db->datalogDelete('mail_mailinglist', 'mailinglist_id', $rec['id']);
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index f8ce78d..0f90dd6 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -72,7 +72,7 @@
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Clients of the user
 			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
-			
+
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = '';
 			if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
@@ -83,7 +83,7 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
@@ -93,7 +93,7 @@
 
 			// Set the mailserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_mailserver]");
-			$app->tpl->setVar("server_id","<option value='$client[default_mailserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_mailserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 			// Fill the client select field
@@ -108,7 +108,7 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 		}
 
@@ -142,7 +142,7 @@
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
+			$app->tpl->setVar("domain_option", $domain_select);
 		}
 
 
@@ -157,7 +157,7 @@
 				$policy_select .= "<option value='$p[id]' $selected>$p[policy_name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("policy",$policy_select);
+		$app->tpl->setVar("policy", $policy_select);
 		unset($policys);
 		unset($policy_select);
 		unset($tmp_user);
@@ -175,21 +175,21 @@
 
 	function onSubmit() {
 		global $app, $conf;
-		
-        /* check if the domain module is used - and check if the selected domain can be used! */
+
+		/* check if the domain module is used - and check if the selected domain can be used! */
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
-            $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
-            if(!$domain_check) {
-                // invalid domain selected
-                $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-            } else {
-                $this->dataRecord['domain'] = $domain_check;
-            }
-        }
-        
-        if($_SESSION["s"]["user"]["typ"] != 'admin') {
+			$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
+			if(!$domain_check) {
+				// invalid domain selected
+				$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+			} else {
+				$this->dataRecord['domain'] = $domain_check;
+			}
+		}
+
+		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -275,7 +275,7 @@
 		} else {
 			//* We do not allow users to change a domain which has been created by the admin
 			$rec = $app->db->queryOneRecord("SELECT domain from mail_domain WHERE domain_id = ".$this->id);
-			if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
+			if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id, 'u')) {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
 				$this->dataRecord["domain"] = $rec['domain'];
@@ -328,7 +328,7 @@
 		//** If the domain name or owner has been changed, change the domain and owner in all mailbox records
 		if($this->oldDataRecord['domain'] != $this->dataRecord['domain'] || (isset($this->dataRecord['client_group_id']) && $this->oldDataRecord['sys_groupid'] != $this->dataRecord['client_group_id'])) {
 			$app->uses('getconf');
-			$mail_config = $app->getconf->get_server_config($this->dataRecord["server_id"],'mail');
+			$mail_config = $app->getconf->get_server_config($this->dataRecord["server_id"], 'mail');
 
 			//* Update the mailboxes
 			$mailusers = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE email like '%@".$app->db->quote($this->oldDataRecord['domain'])."'");
@@ -338,9 +338,9 @@
 			if(is_array($mailusers)) {
 				foreach($mailusers as $rec) {
 					// setting Maildir, Homedir, UID and GID
-					$mail_parts = explode("@",$rec['email']);
-					$maildir = str_replace("[domain]",$this->dataRecord['domain'],$mail_config["maildir_path"]);
-					$maildir = str_replace("[localpart]",$mail_parts[0],$maildir);
+					$mail_parts = explode("@", $rec['email']);
+					$maildir = str_replace("[domain]", $this->dataRecord['domain'], $mail_config["maildir_path"]);
+					$maildir = str_replace("[localpart]", $mail_parts[0], $maildir);
 					$maildir = $app->db->quote($maildir);
 					$email = $app->db->quote($mail_parts[0].'@'.$this->dataRecord['domain']);
 					$app->db->datalogUpdate('mail_user', "maildir = '$maildir', email = '$email', sys_userid = $client_user_id, sys_groupid = '$sys_groupid'", 'mailuser_id', $rec['mailuser_id']);
@@ -351,12 +351,12 @@
 			$forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE source like '%@".$app->db->quote($this->oldDataRecord['domain'])."' OR destination like '%@".$app->db->quote($this->oldDataRecord['domain'])."'");
 			if(is_array($forwardings)) {
 				foreach($forwardings as $rec) {
-					$destination = $app->db->quote(str_replace($this->oldDataRecord['domain'],$this->dataRecord['domain'],$rec['destination']));
-					$source = $app->db->quote(str_replace($this->oldDataRecord['domain'],$this->dataRecord['domain'],$rec['source']));
+					$destination = $app->db->quote(str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['destination']));
+					$source = $app->db->quote(str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['source']));
 					$app->db->datalogUpdate('mail_forwarding', "source = '$source', destination = '$destination', sys_userid = $client_user_id, sys_groupid = '$sys_groupid'", 'forwarding_id', $rec['forwarding_id']);
 				}
 			}
-			
+
 			//* Update the mailinglist
 			$app->db->query("UPDATE mail_mailinglist SET sys_userid = $client_user_id, sys_groupid = $sys_groupid WHERE domain = '".$app->db->quote($this->oldDataRecord['domain'])."'");
 
@@ -374,4 +374,4 @@
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_list.php b/interface/web/mail/mail_domain_list.php
index cad6506..ac2d394 100644
--- a/interface/web/mail/mail_domain_list.php
+++ b/interface/web/mail/mail_domain_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -25,4 +25,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_forward_del.php b/interface/web/mail/mail_forward_del.php
index 716a780..3e2a80a 100644
--- a/interface/web/mail/mail_forward_del.php
+++ b/interface/web/mail/mail_forward_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $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 e9fca47..808e394 100644
--- a/interface/web/mail/mail_forward_edit.php
+++ b/interface/web/mail/mail_forward_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,53 +49,53 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailforward',"type = 'forward'")) {
+			if(!$app->tform->checkClientLimit('limit_mailforward', "type = 'forward'")) {
 				$app->error($app->tform->wordbook["limit_mailforward_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailforward',"type = 'forward'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailforward', "type = 'forward'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailforward_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$email = $this->dataRecord["source"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
 		$email_parts[1] = $app->functions->idn_decode($email_parts[1]);
-        
+
 		// Getting Domains of the user
 		//$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$sql = "SELECT domain FROM mail_domain WHERE domain NOT IN (SELECT SUBSTR(source,2) FROM mail_forwarding WHERE type = 'aliasdomain') AND ".$app->tform->getAuthSQL('r')." ORDER BY domain";
 		$domains = $app->db->queryAllRecords($sql);
 		$domain_select = '';
 		foreach( $domains as $domain) {
-            $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+			$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 			$selected = (isset($email_parts[1]) && $domain["domain"] == $email_parts[1])?'SELECTED':'';
 			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
+		$app->tpl->setVar("email_domain", $domain_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["email_domain"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -111,34 +111,34 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		 		
+
 		// compose the email field
 		$this->dataRecord["source"] = $_POST["email_local_part"]."@".$app->functions->idn_encode($_POST["email_domain"]);
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		unset($this->dataRecord["email_local_part"]);
 		unset($this->dataRecord["email_domain"]);
-		
+
 		//* Check if there is no active mailbox with this address
 		$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($this->dataRecord["source"])."'");
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_mailbox_txt")."<br>";
 		unset($tmp);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_forward_list.php b/interface/web/mail/mail_forward_list.php
index 4fd4790..48b8975 100644
--- a/interface/web/mail/mail_forward_list.php
+++ b/interface/web/mail/mail_forward_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@
 $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 5a528a8..0476047 100644
--- a/interface/web/mail/mail_get_del.php
+++ b/interface/web/mail/mail_get_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_get_edit.php b/interface/web/mail/mail_get_edit.php
index cd7741b..815990f 100644
--- a/interface/web/mail/mail_get_edit.php
+++ b/interface/web/mail/mail_get_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,10 +49,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_fetchmail')) {
@@ -62,19 +62,19 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_fetchmail_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		//* Check if destination email belongs to user
 		if(isset($_POST["destination"])) {
 			$email = $app->db->queryOneRecord("SELECT email FROM mail_user WHERE email = '".$app->db->quote($app->functions->idn_encode($_POST["destination"]))."' AND ".$app->tform->getAuthSQL('r'));
 			if($email["email"] != $app->functions->idn_encode($_POST["destination"])) $app->tform->errorMessage .= $app->tform->lng("no_destination_perm");
 		}
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -90,32 +90,32 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID according to the selected destination
 		$tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE email = '".$app->db->quote($this->dataRecord["destination"])."'");
 		$this->dataRecord["server_id"] = $tmp["server_id"];
 		unset($tmp);
-		
+
 		//* Check that no illegal combination of options is set
 		if((!isset($this->dataRecord['source_delete']) || @$this->dataRecord['source_delete'] == 'n') && $this->dataRecord['source_read_all'] == 'y') {
 			$app->tform->errorMessage .= $app->tform->lng('error_delete_read_all_combination')."<br>";
 		}
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_user WHERE email = '".$app->db->quote($this->dataRecord["destination"])."'");
 		$app->db->query("update mail_get SET sys_groupid = ".$tmp['sys_groupid']." WHERE mailget_id = ".$this->id);
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_get_list.php b/interface/web/mail/mail_get_list.php
index f485058..eb9c42b 100644
--- a/interface/web/mail/mail_get_list.php
+++ b/interface/web/mail/mail_get_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_mailinglist_del.php b/interface/web/mail/mail_mailinglist_del.php
index 1622aef..2782ec5 100644
--- a/interface/web/mail/mail_mailinglist_del.php
+++ b/interface/web/mail/mail_mailinglist_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -55,4 +55,4 @@
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_mailinglist_edit.php b/interface/web/mail/mail_mailinglist_edit.php
index 5864396..837995c 100644
--- a/interface/web/mail/mail_mailinglist_edit.php
+++ b/interface/web/mail/mail_mailinglist_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,11 +49,11 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
-	
+
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailmailinglist')) {
@@ -63,13 +63,13 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailmailinglist_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Clients of the user
 			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
@@ -83,7 +83,7 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
@@ -103,9 +103,9 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 		}
-		
+
 		// Getting Domains of the user
 		$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$domains = $app->db->queryAllRecords($sql);
@@ -116,8 +116,8 @@
 				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("domain_option",$domain_select);
-		
+		$app->tpl->setVar("domain_option", $domain_select);
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -127,19 +127,19 @@
 		} else {
 			$app->tpl->setVar("edit_disabled", 0);
 		}
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_mailmailinglist, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			//* Check if Domain belongs to user
 			if(isset($_POST["domain"])) {
 				$domain = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$this->dataRecord["domain"]."' AND ".$app->tform->getAuthSQL('r'));
@@ -151,19 +151,19 @@
 				//Check if email is in use
 				$check = $app->db->queryOneRecord("SELECT count(source) as number FROM mail_forwarding WHERE source = '".$this->dataRecord["listname"]."@".$this->dataRecord["domain"]."'");
 				if($check['number'] != 0) {
-						$app->error($app->tform->wordbook["email_in_use_txt"]);
+					$app->error($app->tform->wordbook["email_in_use_txt"]);
 				}
-				
+
 				$check = $app->db->queryOneRecord("SELECT count(email) as number FROM mail_user WHERE email = '".$this->dataRecord["listname"]."@".$this->dataRecord["domain"]."'");
 				if($check['number'] != 0) {
-						$app->error($app->tform->wordbook["email_in_use_txt"]);
+					$app->error($app->tform->wordbook["email_in_use_txt"]);
 				}
-				
+
 				$check = $app->db->queryOneRecord("SELECT count(mailinglist_id) as number FROM mail_mailinglist WHERE listname = '".$this->dataRecord["listname"]."' AND domain = '".$this->dataRecord["domain"]."'");
 				if($check['number'] != 0) {
-						$app->error($app->tform->wordbook["email_in_use_txt"]);
+					$app->error($app->tform->wordbook["email_in_use_txt"]);
 				}
-				
+
 				// Check if the user may add another mail_domain
 				if($client["limit_mailmailinglist"] >= 0) {
 					$tmp = $app->db->queryOneRecord("SELECT count(mailinglist_id) as number FROM mail_mailinglist WHERE sys_groupid = $client_group_id");
@@ -182,7 +182,7 @@
 
 		parent::onSubmit();
 	}
-	
+
 	function onBeforeInsert() {
 		global $app, $conf;
 
@@ -190,7 +190,7 @@
 		$domain = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain = '".$this->dataRecord["domain"]."'");
 		$this->dataRecord["server_id"] = $domain['server_id'];
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
 
@@ -205,10 +205,10 @@
 			$app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id);
 		}
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf;
-		
+
 		//* Check if the server has been changed
 		// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
 		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -219,7 +219,7 @@
 		} else {
 			//* We do not allow users to change a domain which has been created by the admin
 			$rec = $app->db->queryOneRecord("SELECT domain from mail_mailinglist WHERE mailinglist_id = ".$this->id);
-			if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
+			if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id, 'u')) {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
 				$this->dataRecord["domain"] = $rec['domain'];
@@ -227,10 +227,10 @@
 			unset($rec);
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		// make sure that the record belongs to the clinet group and not the admin group when admin inserts it
 		// also make sure that the user can not delete domain created by a admin
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
@@ -242,7 +242,7 @@
 			$app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id);
 		}
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_mailinglist_list.php b/interface/web/mail/mail_mailinglist_list.php
index 732b143..e1e2daf 100644
--- a/interface/web/mail/mail_mailinglist_list.php
+++ b/interface/web/mail/mail_mailinglist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -19,26 +19,26 @@
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('mail');
-		
+
 		if($global_config['mailmailinglist_link'] == 'y') {
-			$app->tpl->setVar('mailmailinglist_link',1);
+			$app->tpl->setVar('mailmailinglist_link', 1);
 		} else {
-			$app->tpl->setVar('mailmailinglist_link',0);
+			$app->tpl->setVar('mailmailinglist_link', 0);
 		}
-		
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_relay_recipient_del.php b/interface/web/mail/mail_relay_recipient_del.php
index 62972ec..8cbba81 100644
--- a/interface/web/mail/mail_relay_recipient_del.php
+++ b/interface/web/mail/mail_relay_recipient_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_relay_recipient_edit.php b/interface/web/mail/mail_relay_recipient_edit.php
index 46a5d4c..f0ca784 100644
--- a/interface/web/mail/mail_relay_recipient_edit.php
+++ b/interface/web/mail/mail_relay_recipient_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,11 +49,11 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_relay_recipient_list.php b/interface/web/mail/mail_relay_recipient_list.php
index 5e6963c..d03609c 100644
--- a/interface/web/mail/mail_relay_recipient_list.php
+++ b/interface/web/mail/mail_relay_recipient_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -16,9 +16,9 @@
 $app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
-# $app->listform_actions->SQLExtWhere = "access = 'OK'";
+// $app->listform_actions->SQLExtWhere = "access = 'OK'";
 
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_spamfilter_del.php b/interface/web/mail/mail_spamfilter_del.php
index 6d922b5..06763b0 100644
--- a/interface/web/mail/mail_spamfilter_del.php
+++ b/interface/web/mail/mail_spamfilter_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_spamfilter_edit.php b/interface/web/mail/mail_spamfilter_edit.php
index 768ec9b..50ecb4f 100644
--- a/interface/web/mail/mail_spamfilter_edit.php
+++ b/interface/web/mail/mail_spamfilter_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,15 +49,15 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		// Getting email from data record
 		$email = $this->dataRecord["email"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
-		
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
+
 		// Getting Domains of the user
 		$sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
 		$domains = $app->db->queryAllRecords($sql);
@@ -66,30 +66,30 @@
 			$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
 			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
+		$app->tpl->setVar("email_domain", $domain_select);
+
 		// calculate scores
 		if(count($this->dataRecord) > 0) {
-			$app->tpl->setVar("spam_rewrite_score_int",number_format($this->dataRecord["spam_rewrite_score_int"] / 100, 2, '.', ''));
-			$app->tpl->setVar("spam_redirect_score_int",number_format($this->dataRecord["spam_redirect_score_int"] / 100, 2, '.', ''));
-			$app->tpl->setVar("spam_delete_score_int",number_format($this->dataRecord["spam_delete_score_int"] / 100, 2, '.', ''));
+			$app->tpl->setVar("spam_rewrite_score_int", number_format($this->dataRecord["spam_rewrite_score_int"] / 100, 2, '.', ''));
+			$app->tpl->setVar("spam_redirect_score_int", number_format($this->dataRecord["spam_redirect_score_int"] / 100, 2, '.', ''));
+			$app->tpl->setVar("spam_delete_score_int", number_format($this->dataRecord["spam_delete_score_int"] / 100, 2, '.', ''));
 		}
-		
+
 		// Changing maildir to mailbox_id
 		$sql = "SELECT mailbox_id FROM mail_box WHERE maildir = '".$this->dataRecord["spam_redirect_maildir"]."' AND ".$app->tform->getAuthSQL('r');
 		$mailbox = $app->db->queryOneRecord($sql);
 		$this->dataRecord["spam_redirect_maildir"] = $mailbox["mailbox_id"];
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// compose the email field
 		if($_POST["email_local_part"] != '') {
 			$this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
@@ -98,27 +98,27 @@
 		}
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		unset($this->dataRecord["email_local_part"]);
 		unset($this->dataRecord["email_domain"]);
-		
+
 		// calculate scores
-		$this->dataRecord["spam_rewrite_score_int"] 	= $_POST["spam_rewrite_score_int"] * 100;
-		$this->dataRecord["spam_redirect_score_int"] 	= $_POST["spam_redirect_score_int"] * 100;
-		$this->dataRecord["spam_delete_score_int"] 		= $_POST["spam_delete_score_int"] * 100;
-		
+		$this->dataRecord["spam_rewrite_score_int"]  = $_POST["spam_rewrite_score_int"] * 100;
+		$this->dataRecord["spam_redirect_score_int"]  = $_POST["spam_redirect_score_int"] * 100;
+		$this->dataRecord["spam_delete_score_int"]   = $_POST["spam_delete_score_int"] * 100;
+
 		// Changing mailbox_id to maildir
 		$sql = "SELECT maildir FROM mail_box WHERE mailbox_id = '".$app->functions->intval($_POST["spam_redirect_maildir"])."' AND ".$app->tform->getAuthSQL('r');
 		$mailbox = $app->db->queryOneRecord($sql);
 		$this->dataRecord["spam_redirect_maildir"] = $mailbox["maildir"];
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_spamfilter_list.php b/interface/web/mail/mail_spamfilter_list.php
index 8979a46..39bc8ce 100644
--- a/interface/web/mail/mail_spamfilter_list.php
+++ b/interface/web/mail/mail_spamfilter_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -20,4 +20,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_transport_del.php b/interface/web/mail/mail_transport_del.php
index 1c2ec67..5c40b91 100644
--- a/interface/web/mail/mail_transport_del.php
+++ b/interface/web/mail/mail_transport_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_transport_edit.php b/interface/web/mail/mail_transport_edit.php
index c33970e..51abd68 100644
--- a/interface/web/mail/mail_transport_edit.php
+++ b/interface/web/mail/mail_transport_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -50,10 +50,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailrouting')) {
@@ -63,15 +63,15 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailrouting_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
-		$tmp_parts = explode(":",$this->dataRecord["transport"]);
-		if(!empty($this->id) && !stristr($this->dataRecord["transport"],':')) {
+
+		$tmp_parts = explode(":", $this->dataRecord["transport"]);
+		if(!empty($this->id) && !stristr($this->dataRecord["transport"], ':')) {
 			$rec["type"] = 'custom';
 		} else {
 			if(empty($this->id) && empty($tmp_parts[0])) {
@@ -87,15 +87,15 @@
 		} else {
 			$dest = $this->dataRecord["transport"];
 		}
-		if(@substr($dest,0,1) == '[') {
+		if(@substr($dest, 0, 1) == '[') {
 			$rec["mx"] = 'checked="CHECKED"';
-			$rec["destination"] = @str_replace(']','',@str_replace('[','',$dest));
+			$rec["destination"] = @str_replace(']', '', @str_replace('[', '', $dest));
 		} else {
 			$rec["mx"] = '';
 			$rec["destination"] = @$dest;
 		}
-		
-		$types = array('smtp' => 'smtp','uucp' => 'uucp','slow' => 'slow', 'error' => 'error', 'custom' => 'custom','' => 'null');
+
+		$types = array('smtp' => 'smtp', 'uucp' => 'uucp', 'slow' => 'slow', 'error' => 'error', 'custom' => 'custom', '' => 'null');
 		$type_select = '';
 		if(is_array($types)) {
 			foreach( $types as $key => $val) {
@@ -107,7 +107,7 @@
 		$app->tpl->setVar($rec);
 		unset($type);
 		unset($types);
-		
+
 		parent::onShowEnd();
 	}
 
@@ -129,7 +129,7 @@
 
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -145,11 +145,11 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		//* Compose transport field
 		if($this->dataRecord["mx"] == 'y') {
-			if(stristr($this->dataRecord["destination"],':')) {
-				$tmp_parts = explode(":",$this->dataRecord["destination"]);
+			if(stristr($this->dataRecord["destination"], ':')) {
+				$tmp_parts = explode(":", $this->dataRecord["destination"]);
 				$transport = '['.$tmp_parts[0].']:'.$tmp_parts[1];
 			} else {
 				$transport = '['.$this->dataRecord["destination"].']';
@@ -157,23 +157,23 @@
 		} else {
 			$transport = $this->dataRecord["destination"];
 		}
-		
+
 		if($this->dataRecord["type"] == 'custom') {
 			$this->dataRecord["transport"] = $transport;
 		} else {
 			$this->dataRecord["transport"] = $this->dataRecord["type"].':'.$transport;
 		}
-		
+
 		unset($this->dataRecord["type"]);
 		unset($this->dataRecord["mx"]);
 		unset($this->dataRecord["destination"]);
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_transport_list.php b/interface/web/mail/mail_transport_list.php
index 9d87728..d96959f 100644
--- a/interface/web/mail/mail_transport_list.php
+++ b/interface/web/mail/mail_transport_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_del.php b/interface/web/mail/mail_user_del.php
index a6d5346..6b309f8 100644
--- a/interface/web/mail/mail_user_del.php
+++ b/interface/web/mail/mail_user_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -53,21 +53,22 @@
 
 	function onBeforeDelete() {
 		global $app; $conf;
-			
-			$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'");
-			$app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]);
-			
-			$tmp_filters = $app->db->queryAllRecords("SELECT filter_id FROM mail_user_filter WHERE mailuser_id = '".$this->id."'");
-			if(is_array($tmp_filters)) {
-				foreach($tmp_filters as $tmp) {
-					$app->db->datalogDelete('mail_user_filter', 'filter_id', $tmp["filter_id"]);
-				}
+
+		$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'");
+		$app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]);
+
+		$tmp_filters = $app->db->queryAllRecords("SELECT filter_id FROM mail_user_filter WHERE mailuser_id = '".$this->id."'");
+		if(is_array($tmp_filters)) {
+			foreach($tmp_filters as $tmp) {
+				$app->db->datalogDelete('mail_user_filter', 'filter_id', $tmp["filter_id"]);
 			}
-			
 		}
+
+	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index da3f99cb..7e983ae 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,11 +49,11 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
-	
+
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailbox')) {
@@ -63,18 +63,18 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailbox_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$email = $this->dataRecord["email"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
 		$email_parts[1] = $app->functions->idn_decode($email_parts[1]);
-        
+
 		// Getting Domains of the user
 		// $sql = "SELECT domain, server_id FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$sql = "SELECT domain, server_id FROM mail_domain WHERE domain NOT IN (SELECT SUBSTR(source,2) FROM mail_forwarding WHERE type = 'aliasdomain') AND ".$app->tform->getAuthSQL('r')." ORDER BY domain";
@@ -82,15 +82,15 @@
 		$domain_select = '';
 		if(is_array($domains)) {
 			foreach( $domains as $domain) {
-                $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+				$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 				$selected = ($domain["domain"] == @$email_parts[1])?'SELECTED':'';
 				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
+		$app->tpl->setVar("email_domain", $domain_select);
 		unset($domains);
 		unset($domain_select);
-		
+
 		// Get the spamfilter policys for the user
 		$tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = '".$this->dataRecord["email"]."'");
 		$sql = "SELECT id, policy_name FROM spamfilter_policy WHERE ".$app->tform->getAuthSQL('r');
@@ -102,59 +102,59 @@
 				$policy_select .= "<option value='$p[id]' $selected>$p[policy_name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("policy",$policy_select);
+		$app->tpl->setVar("policy", $policy_select);
 		unset($policys);
 		unset($policy_select);
 		unset($tmp_user);
-		
+
 		// Convert quota from Bytes to MB
-		if($this->dataRecord["quota"] != -1) $app->tpl->setVar("quota",$this->dataRecord["quota"] / 1024 / 1024);
-		
+		if($this->dataRecord["quota"] != -1) $app->tpl->setVar("quota", $this->dataRecord["quota"] / 1024 / 1024);
+
 		// Is autoresponder set?
 		if (!empty($this->dataRecord['autoresponder']) && $this->dataRecord['autoresponder'] == 'y') {
 			$app->tpl->setVar("ar_active", 'checked="checked"');
 		} else {
 			$app->tpl->setVar("ar_active", '');
 		}
-		
+
 		if($this->dataRecord['autoresponder_subject'] == '') {
 			$app->tpl->setVar('autoresponder_subject', $app->tform->lng('autoresponder_subject'));
 		} else {
 			$app->tpl->setVar('autoresponder_subject', $this->dataRecord['autoresponder_subject']);
 		}
-		
-    $app->uses('getconf');
-    $mail_config = $app->getconf->get_global_config('mail');
+
+		$app->uses('getconf');
+		$mail_config = $app->getconf->get_global_config('mail');
 		if($mail_config["enable_custom_login"] == "y") {
-		    $app->tpl->setVar("enable_custom_login", 1);
+			$app->tpl->setVar("enable_custom_login", 1);
 		} else {
-		    $app->tpl->setVar("enable_custom_login", 0);
+			$app->tpl->setVar("enable_custom_login", 0);
 		}
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		//* Check if Domain belongs to user
 		if(isset($_POST["email_domain"])) {
 			$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 			if($domain["domain"] != $app->functions->idn_encode($_POST["email_domain"])) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 		}
-		
-		
+
+
 		//* if its an insert, check that the password is not empty
 		if($this->id == 0 && $_POST["password"] == '') {
 			$app->tform->errorMessage .= $app->tform->lng("error_no_pwd")."<br>";
 		}
-		
+
 		//* Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_mailbox, limit_mailquota FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_mailbox"] >= 0) {
@@ -164,7 +164,7 @@
 				}
 				unset($tmp);
 			}
-			
+
 			// Check the quota and adjust
 			if(isset($_POST["quota"]) && $client["limit_mailquota"] >= 0 && $app->functions->intval($this->dataRecord["quota"]) * 1024 * 1024 != $this->oldDataRecord['quota']) {
 				$tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
@@ -180,62 +180,62 @@
 				unset($tmp_quota);
 			}
 		} // end if user is not admin
-		
 
-    $app->uses('getconf');
-    $mail_config = $app->getconf->get_server_config(!empty($domain["server_id"]) ? $domain["server_id"] : '','mail');
-		
+
+		$app->uses('getconf');
+		$mail_config = $app->getconf->get_server_config(!empty($domain["server_id"]) ? $domain["server_id"] : '', 'mail');
+
 		//* compose the email field
 		if(isset($_POST["email_local_part"]) && isset($_POST["email_domain"])) {
 			$this->dataRecord["email"] = strtolower($_POST["email_local_part"]."@".$app->functions->idn_encode($_POST["email_domain"]));
-		
+
 			// Set the server id of the mailbox = server ID of mail domain.
 			$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 			unset($this->dataRecord["email_local_part"]);
 			unset($this->dataRecord["email_domain"]);
-		
+
 			// Convert quota from MB to Bytes
 			if($this->dataRecord["quota"] != -1) $this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024 * 1024;
-		
+
 			// setting Maildir, Homedir, UID and GID
-			$maildir = str_replace("[domain]",$domain["domain"],$mail_config["maildir_path"]);
-			$maildir = str_replace("[localpart]",strtolower($_POST["email_local_part"]),$maildir);
+			$maildir = str_replace("[domain]", $domain["domain"], $mail_config["maildir_path"]);
+			$maildir = str_replace("[localpart]", strtolower($_POST["email_local_part"]), $maildir);
 			$this->dataRecord["maildir"] = $maildir;
 			$this->dataRecord["homedir"] = $mail_config["homedir_path"];
 			$this->dataRecord["uid"] = $mail_config["mailuser_uid"];
 			$this->dataRecord["gid"] = $mail_config["mailuser_gid"];
-			
+
 			//* Check if there is no alias or forward with this address
 			$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE active = 'y' AND source = '".$app->db->quote($this->dataRecord["email"])."'");
 			if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_alias_or_forward_txt")."<br>";
 			unset($tmp);
-			
+
 		}
-		
-    $sys_config = $app->getconf->get_global_config('mail');
-    if($sys_config["enable_custom_login"] == "y") {
-        if(!isset($_POST["login"]) || $_POST["login"] == '') $this->dataRecord["login"] = $this->dataRecord["email"];
-        elseif(strpos($_POST["login"], '@') !== false && $_POST["login"] != $this->dataRecord["email"]) $app->tform->errorMessage .= $app->tform->lng("error_login_email_txt")."<br>";
+
+		$sys_config = $app->getconf->get_global_config('mail');
+		if($sys_config["enable_custom_login"] == "y") {
+			if(!isset($_POST["login"]) || $_POST["login"] == '') $this->dataRecord["login"] = $this->dataRecord["email"];
+			elseif(strpos($_POST["login"], '@') !== false && $_POST["login"] != $this->dataRecord["email"]) $app->tform->errorMessage .= $app->tform->lng("error_login_email_txt")."<br>";
 		} else {
-        $this->dataRecord["login"] = isset($this->dataRecord["email"]) ? $this->dataRecord["email"] : '';
+			$this->dataRecord["login"] = isset($this->dataRecord["email"]) ? $this->dataRecord["email"] : '';
 		}
 		//* if autoresponder checkbox not selected, do not save dates
 		if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
-			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_start_date']);
-			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_end_date']);
+			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_start_date']);
+			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_end_date']);
 		}
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		// Set the domain owner as mailbox owner
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("UPDATE mail_user SET sys_groupid = ".$domain["sys_groupid"]." WHERE mailuser_id = ".$this->id);
-		
+
 		// Spamfilter policy
 		$policy_id = $app->functions->intval($this->dataRecord["policy"]);
 		if($policy_id > 0) {
@@ -245,33 +245,33 @@
 				$app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]);
 			} else {
 				// We create a new record
-				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) 
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
 				        VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($this->dataRecord["email"])."', '".$app->db->quote($this->dataRecord["email"])."', 'Y')";
 				$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
 			}
 		}  // endif spamfilter policy
-		
-		
+
+
 		// Set the fields for dovecot
 		if(isset($this->dataRecord["email"])) {
 			$disableimap = ($this->dataRecord["disableimap"])?'y':'n';
 			$disablepop3 = ($this->dataRecord["disablepop3"])?'y':'n';
 			$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 			$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
-		
+
 			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver', disabledoveadm = '$disableimap' WHERE mailuser_id = ".$this->id;
 			$app->db->query($sql);
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		// Set the domain owner as mailbox owner
 		if(isset($_POST["email_domain"])) {
 			$domain = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 			$app->db->query("UPDATE mail_user SET sys_groupid = ".$domain["sys_groupid"]." WHERE mailuser_id = ".$this->id);
-		
+
 			// Spamfilter policy
 			$policy_id = $app->functions->intval($this->dataRecord["policy"]);
 			$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'");
@@ -281,7 +281,7 @@
 					$app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]);
 				} else {
 					// We create a new record
-					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) 
+					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
 				        	VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($this->dataRecord["email"])."', '".$app->db->quote($this->dataRecord["email"])."', 'Y')";
 					$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
 				}
@@ -292,22 +292,22 @@
 				}
 			} // endif spamfilter policy
 		}
-		
+
 		// Set the fields for dovecot
 		if(isset($this->dataRecord["email"])) {
 			$disableimap = (isset($this->dataRecord["disableimap"]) && $this->dataRecord["disableimap"])?'y':'n';
 			$disablepop3 = (isset($this->dataRecord["disablepop3"]) && $this->dataRecord["disablepop3"])?'y':'n';
 			$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 			$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
-		
+
 			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver', disabledoveadm = '$disableimap' WHERE mailuser_id = ".$this->id;
 			$app->db->query($sql);
 		}
-		
+
 		//** If the email address has been changed, change it in all aliases too
 		if(isset($this->dataRecord['email']) && $this->oldDataRecord['email'] != $this->dataRecord['email']) {
-		//if($this->oldDataRecord['email'] != $this->dataRecord['email']) {
-			
+			//if($this->oldDataRecord['email'] != $this->dataRecord['email']) {
+
 			//* Update the aliases
 			$forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE destination = '".$app->db->quote($this->oldDataRecord['email'])."'");
 			if(is_array($forwardings)) {
@@ -316,11 +316,11 @@
 					$app->db->datalogUpdate('mail_forwarding', "destination = '$destination'", 'forwarding_id', $rec['forwarding_id']);
 				}
 			}
-			
+
 		} // end if email addess changed
-		
+
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_user_filter_del.php b/interface/web/mail/mail_user_filter_del.php
index a02d68d..e352a8e 100644
--- a/interface/web/mail/mail_user_filter_del.php
+++ b/interface/web/mail/mail_user_filter_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -50,17 +50,17 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	/*
 	//* Code moved to mailfilter plugin
 	function onAfterDelete() {
 		global $app, $conf;
-		
+
 		$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$this->dataRecord["mailuser_id"]);
 		$skip = false;
 		$lines = explode("\n",$mailuser['custom_mailfilter']);
 		$out = '';
-		
+
 		foreach($lines as $line) {
 			$line = trim($line);
 			if($line == '### BEGIN FILTER_ID:'.$this->id) {
@@ -71,16 +71,16 @@
 				$skip = false;
 			}
 		}
-		
+
 		$out = $app->db->quote($out);
 		$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $this->dataRecord["mailuser_id"]);
-	
+
 	}
 	*/
-	
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_filter_edit.php b/interface/web/mail/mail_user_filter_edit.php
index d74a85a..be62674 100644
--- a/interface/web/mail/mail_user_filter_edit.php
+++ b/interface/web/mail/mail_user_filter_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,38 +49,38 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailfilter',"")) {
+			if(!$app->tform->checkClientLimit('limit_mailfilter', "")) {
 				$app->error($app->tform->lng("limit_mailfilter_txt"));
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailfilter',"")) {
+			if(!$app->tform->checkResellerLimit('limit_mailfilter', "")) {
 				$app->error('Reseller: '.$app->tform->lng("limit_mailfilter_txt"));
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent mail_user record
 		$mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".$app->functions->intval($_REQUEST["mailuser_id"])."' AND ".$app->tform->getAuthSQL('r'));
-		
+
 		// Check if Domain belongs to user
 		if($mailuser["mailuser_id"] != $_POST["mailuser_id"]) $app->tform->errorMessage .= $app->tform->wordbook["no_mailuser_perm"];
-		
+
 		// Set the mailuser_id
 		$this->dataRecord["mailuser_id"] = $mailuser["mailuser_id"];
-		
+
 		// Remove leading dots
-		if(substr($this->dataRecord['target'],0,1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'],1);
-		
+		if(substr($this->dataRecord['target'], 0, 1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'], 1);
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -96,28 +96,28 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
-	
+
 	/*
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$this->onAfterUpdate();
-		
+
 		$app->db->query("UPDATE mail_user_filter SET sys_groupid = ".$mailuser['sys_groupid']." WHERE filter_id = ".$this->id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$this->dataRecord["mailuser_id"]);
 		$skip = false;
 		$lines = explode("\n",$mailuser['custom_mailfilter']);
 		$out = '';
 		$found = false;
-		
+
 		foreach($lines as $line) {
 			$line = rtrim($line);
 			if($line == '### BEGIN FILTER_ID:'.$this->id) {
@@ -130,41 +130,41 @@
 				$skip = false;
 			}
 		}
-		
+
 		// We did not found our rule, so we add it now as first rule.
 		if($found == false) {
 			$new_rule = $this->getRule();
 			$out = $new_rule . $out;
 		}
-		
+
 		$out = $app->db->quote($out);
 		$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $this->dataRecord["mailuser_id"]);
-	
+
 	}
-	
+
 	function getRule() {
-		
+
 		global $app,$conf;
-		
+
 		$app->uses("getconf");
 		$mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ".$app->functions->intval($this->dataRecord["mailuser_id"]));
 		$mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]),'mail');
-		
+
 		if($mail_config['mail_filter_syntax'] == 'sieve') {
-			
+
 			// #######################################################
 			// Filter in Sieve Syntax
 			// #######################################################
-			
+
 			$content = '';
 			$content .= '### BEGIN FILTER_ID:'.$this->id."\n";
-			
+
 			//$content .= 'require ["fileinto", "regex", "vacation"];'."\n";
-			
+
 			$content .= 'if header :regex    ["'.strtolower($this->dataRecord["source"]).'"] ["';
-			
+
 			$searchterm = preg_quote($this->dataRecord["searchterm"]);
-			
+
 			if($this->dataRecord["op"] == 'contains') {
 				$content .= ".*".$searchterm;
 			} elseif ($this->dataRecord["op"] == 'is') {
@@ -174,21 +174,21 @@
 			} elseif ($this->dataRecord["op"] == 'ends') {
 				$content .= ".*".$searchterm."$";
 			}
-			
+
 			$content .= '"] {'."\n";
-			
+
 			if($this->dataRecord["action"] == 'move') {
 				$content .= '    fileinto "'.$this->dataRecord["target"].'";' . "\n";
 			} else {
 				$content .= "    discard;\n";
 			}
-			
+
 			$content .= "    stop;\n}\n";
-			
+
 			$content .= '### END FILTER_ID:'.$this->id."\n";
-		
+
 		} else {
-		
+
 			// #######################################################
 			// Filter in Maildrop Syntax
 			// #######################################################
@@ -245,20 +245,20 @@
 
 			$content .= "}\n";
 			$content .= "}\n";
-		
+
 			//}
-		
+
 			$content .= '### END FILTER_ID:'.$this->id."\n";
-		
+
 		}
-		
+
 		return $content;
 	}
 	*/
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_list.php b/interface/web/mail/mail_user_list.php
index 7f93e2b..fa26861 100644
--- a/interface/web/mail/mail_user_list.php
+++ b/interface/web/mail/mail_user_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -19,28 +19,28 @@
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('mail');
-		
+
 		if($global_config['mailboxlist_webmail_link'] == 'y') {
-			$app->tpl->setVar('mailboxlist_webmail_link',1);
+			$app->tpl->setVar('mailboxlist_webmail_link', 1);
 		} else {
-			$app->tpl->setVar('mailboxlist_webmail_link',0);
+			$app->tpl->setVar('mailboxlist_webmail_link', 0);
 		}
 
-    if($global_config["enable_custom_login"] == "y") {
-        $app->tpl->setVar("enable_custom_login", 1);
-    } else {
-        $app->tpl->setVar("enable_custom_login", 0);
-    }
-		
+		if($global_config["enable_custom_login"] == "y") {
+			$app->tpl->setVar("enable_custom_login", 1);
+		} else {
+			$app->tpl->setVar("enable_custom_login", 0);
+		}
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
@@ -48,4 +48,4 @@
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_stats.php b/interface/web/mail/mail_user_stats.php
index 65b179d..2e385e7 100644
--- a/interface/web/mail/mail_user_stats.php
+++ b/interface/web/mail/mail_user_stats.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -18,43 +18,43 @@
 $app->load('listform_actions');
 
 class list_action extends listform_actions {
-	
+
 	function prepareDataRow($rec)
-    {
+	{
 		global $app;
-		
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
-		
+
 		//* Set the statistics colums
 		//** Traffic of the current month
 		$tmp_date = date('Y-m');
 		$tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month = '$tmp_date'");
 		$rec['this_month'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
-		
+
 		//** Traffic of the current year
 		$tmp_date = date('Y');
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month like '$tmp_date%'");
 		$rec['this_year'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
-		
+
 		//** Traffic of the last month
-		$tmp_date = date('Y-m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		$tmp_date = date('Y-m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
 		$tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month = '$tmp_date'");
 		$rec['last_month'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
-		
+
 		//** Traffic of the last year
-		$tmp_date = date('Y',mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
+		$tmp_date = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month like '$tmp_date%'");
 		$rec['last_year'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
-		
+
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
-	
+
 	function getQueryString() {
 		global $app;
 		$sql_where = '';
@@ -64,62 +64,62 @@
 			if($_SESSION['s']['user']['typ'] == "admin") {
 				$sql_where = '';
 			} else {
-				$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and'; 
-                //$sql_where = $app->tform->getAuthSQL('r').' and';
+				$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and';
+				//$sql_where = $app->tform->getAuthSQL('r').' and';
 			}
-		}		
+		}
 		if($this->SQLExtWhere != '') {
 			$sql_where .= ' '.$this->SQLExtWhere.' and';
 		}
-		
+
 		$sql_where = $app->listform->getSearchSQL($sql_where);
 		if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql'];
 		$app->tpl->setVar($app->listform->searchValues);
-		
+
 		$order_by_sql = $this->SQLOrderBy;
 
 		//* Generate SQL for paging
 		$limit_sql = $app->listform->getPagingSQL($sql_where);
-		$app->tpl->setVar('paging',$app->listform->pagingHTML);
+		$app->tpl->setVar('paging', $app->listform->pagingHTML);
 
 		$extselect = '';
 		$join = '';
-		
+
 		if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
-		  $order = str_replace(' DESC','',$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
-		  list($tmp_table, $order) = explode('.', $order);
-		  if($order == 'mail_traffic_last_month'){
-		    $tmp_date = date('Y-m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
-		    $sql_where .= " AND mt.month like '$tmp_date%'";
-		    $order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_last_month','traffic',$order_by_sql);
-		  } elseif($order == 'mail_traffic_this_month'){
-		    $tmp_date = date('Y-m');
-		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
-		    $sql_where .= " AND mt.month like '$tmp_date%'";
-		    $order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_this_month','traffic',$order_by_sql);
-		  } elseif($order == 'mail_traffic_last_year'){
-		    $tmp_date = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $extselect .= ', SUM(mt.traffic) as calctraffic';
-		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
-		    $sql_where .= " AND mt.month like '$tmp_date%'";;
-		    $order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_last_year','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
-		  } elseif($order == 'mail_traffic_this_year'){
-		    $tmp_date = date('Y');
-		    $extselect .= ', SUM(mt.traffic) as calctraffic';
-		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
-		    $sql_where .= " AND mt.month like '$tmp_date%'";
-		    $order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_this_year','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
-		  }
+			$order = str_replace(' DESC', '', $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
+			list($tmp_table, $order) = explode('.', $order);
+			if($order == 'mail_traffic_last_month'){
+				$tmp_date = date('Y-m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+				$join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+				$sql_where .= " AND mt.month like '$tmp_date%'";
+				$order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_last_month', 'traffic', $order_by_sql);
+			} elseif($order == 'mail_traffic_this_month'){
+				$tmp_date = date('Y-m');
+				$join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+				$sql_where .= " AND mt.month like '$tmp_date%'";
+				$order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_this_month', 'traffic', $order_by_sql);
+			} elseif($order == 'mail_traffic_last_year'){
+				$tmp_date = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+				$extselect .= ', SUM(mt.traffic) as calctraffic';
+				$join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+				$sql_where .= " AND mt.month like '$tmp_date%'";;
+				$order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_last_year', 'calctraffic', $order_by_sql);
+				$order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
+			} elseif($order == 'mail_traffic_this_year'){
+				$tmp_date = date('Y');
+				$extselect .= ', SUM(mt.traffic) as calctraffic';
+				$join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+				$sql_where .= " AND mt.month like '$tmp_date%'";
+				$order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_this_year', 'calctraffic', $order_by_sql);
+				$order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
+			}
 		}
-		
+
 		if($this->SQLExtSelect != '') {
-			if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; 
+			if(substr($this->SQLExtSelect, 0, 1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect;
 			$extselect .= $this->SQLExtSelect;
 		}
-		
+
 		$table_selects = array();
 		$table_selects[] = trim($app->listform->listDef['table']).'.*';
 		$app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']);
@@ -134,10 +134,11 @@
 		$sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql";
 		return $sql;
 	}
+
 }
 
 $list = new list_action;
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_whitelist_del.php b/interface/web/mail/mail_whitelist_del.php
index bb083e6..94be228 100644
--- a/interface/web/mail/mail_whitelist_del.php
+++ b/interface/web/mail/mail_whitelist_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $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 a377729..67075e2 100644
--- a/interface/web/mail/mail_whitelist_edit.php
+++ b/interface/web/mail/mail_whitelist_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -52,7 +52,7 @@
 
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailfilter')) {
@@ -62,10 +62,10 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailfilter_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf;
 
@@ -84,7 +84,7 @@
 
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -100,14 +100,14 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_whitelist_list.php b/interface/web/mail/mail_whitelist_list.php
index a4c39a9..4fd33dd 100644
--- a/interface/web/mail/mail_whitelist_list.php
+++ b/interface/web/mail/mail_whitelist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mailinglist.php b/interface/web/mail/mailinglist.php
index dfabb48..6ef779c 100644
--- a/interface/web/mail/mailinglist.php
+++ b/interface/web/mail/mailinglist.php
@@ -28,15 +28,15 @@
 */
 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
 
 /* get the id of the mail (must be int!) */
 if (!isset($_GET['id'])){
-    die ("No List selected!");
+	die ("No List selected!");
 }
 $listId = $app->functions->intval($_GET['id']);
 
@@ -46,7 +46,7 @@
 $dbData = $app->db->queryAllRecords("SELECT server_id, listname FROM mail_mailinglist WHERE mailinglist_id = " . $listId);
 $serverId = $app->functions->intval($dbData[0]['server_id']);
 if ($serverId == 0){
-    die ("No List - Server found!");
+	die ("No List - Server found!");
 }
 
 $serverData = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$serverId);
@@ -58,11 +58,11 @@
 	header('Location:' . $global_config['mailmailinglist_url']);
 } else {
 
-/*
+	/*
  * We only redirect to the login-form, so there is no need, to check any rights
  */
 	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
 	header('Location:' . $http . '://' . $serverData['server_name'] . '/cgi-bin/mailman/admin/' . $dbData[0]['listname']);
 }
 exit;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_blacklist_del.php b/interface/web/mail/spamfilter_blacklist_del.php
index 479d6fd..76db812 100644
--- a/interface/web/mail/spamfilter_blacklist_del.php
+++ b/interface/web/mail/spamfilter_blacklist_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_blacklist_edit.php b/interface/web/mail/spamfilter_blacklist_edit.php
index 860319c..a601674 100644
--- a/interface/web/mail/spamfilter_blacklist_edit.php
+++ b/interface/web/mail/spamfilter_blacklist_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -51,7 +51,7 @@
 class page_action extends tform_actions {
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_spamfilter_wblist')) {
@@ -61,10 +61,10 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_wblist_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	/*
 	function onBeforeUpdate() {
 		global $app, $conf;
@@ -83,9 +83,9 @@
 	}
 	*/
 
-function onSubmit() {
+	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -101,18 +101,19 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		// Select and set the server_id so it matches the server_id of the spa,filter_users record
 		$tmp = $app->db->queryOneRecord("SELECT server_id FROM spamfilter_users WHERE id = ".$app->functions->intval($this->dataRecord["rid"]));
 		$this->dataRecord["server_id"] = $tmp["server_id"];
 		unset($tmp);
-		
+
 		parent::onSubmit();
 	}
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_blacklist_list.php b/interface/web/mail/spamfilter_blacklist_list.php
index 087e533..0d233a5 100644
--- a/interface/web/mail/spamfilter_blacklist_list.php
+++ b/interface/web/mail/spamfilter_blacklist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_config_del.php b/interface/web/mail/spamfilter_config_del.php
index 8da9f45..07793e4 100644
--- a/interface/web/mail/spamfilter_config_del.php
+++ b/interface/web/mail/spamfilter_config_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_config_edit.php b/interface/web/mail/spamfilter_config_edit.php
index ad9d2b5..aeba3f4 100644
--- a/interface/web/mail/spamfilter_config_edit.php
+++ b/interface/web/mail/spamfilter_config_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,48 +49,48 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowEdit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
-		
+
 		if($app->tform->errorMessage == '') {
 			$app->uses('ini_parser,getconf');
-		
+
 			$section = $this->active_tab;
 			$server_id = $this->id;
-		
-			$this->dataRecord = $app->getconf->get_server_config($server_id,$section);
+
+			$this->dataRecord = $app->getconf->get_server_config($server_id, $section);
 		}
-		
-		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab,'EDIT');
-		
+
+		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT');
+
 		$record['id'] = $this->id;
 		$app->tpl->setVar($record);
 	}
-	
+
 	function onUpdateSave($sql) {
 		global $app;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
 		$app->uses('ini_parser,getconf');
-		
+
 		$section = $app->tform->getCurrentTab();
 		$server_id = $this->id;
-		
+
 		$server_config_array = $app->getconf->get_server_config($server_id);
-		$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
+		$server_config_array[$section] = $app->tform->encode($this->dataRecord, $section);
 		$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
-		
+
 		$sql = "UPDATE server SET config = '".$app->db->quote($server_config_str)."' WHERE server_id = ".$server_id;
 		$app->db->query($sql);
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_config_list.php b/interface/web/mail/spamfilter_config_list.php
index b61472b..019f2f3 100644
--- a/interface/web/mail/spamfilter_config_list.php
+++ b/interface/web/mail/spamfilter_config_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_policy_del.php b/interface/web/mail/spamfilter_policy_del.php
index 12b6a19..7a113a9 100644
--- a/interface/web/mail/spamfilter_policy_del.php
+++ b/interface/web/mail/spamfilter_policy_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_policy_edit.php b/interface/web/mail/spamfilter_policy_edit.php
index abc28e9..0321cb5 100644
--- a/interface/web/mail/spamfilter_policy_edit.php
+++ b/interface/web/mail/spamfilter_policy_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -51,7 +51,7 @@
 class page_action extends tform_actions {
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_spamfilter_policy')) {
@@ -61,13 +61,13 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_policy_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -83,13 +83,14 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_policy_list.php b/interface/web/mail/spamfilter_policy_list.php
index 504a2bd..c2ab38d 100644
--- a/interface/web/mail/spamfilter_policy_list.php
+++ b/interface/web/mail/spamfilter_policy_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_users_del.php b/interface/web/mail/spamfilter_users_del.php
index 83418c8..0dc9293 100644
--- a/interface/web/mail/spamfilter_users_del.php
+++ b/interface/web/mail/spamfilter_users_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_users_edit.php b/interface/web/mail/spamfilter_users_edit.php
index 02cebbf..c1e50f3 100644
--- a/interface/web/mail/spamfilter_users_edit.php
+++ b/interface/web/mail/spamfilter_users_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -51,7 +51,7 @@
 class page_action extends tform_actions {
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_spamfilter_user')) {
@@ -61,10 +61,10 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_user_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf;
 
@@ -81,9 +81,9 @@
 		}
 	}
 
-function onSubmit() {
+	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -99,13 +99,14 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_users_list.php b/interface/web/mail/spamfilter_users_list.php
index af17f13..edd2401 100644
--- a/interface/web/mail/spamfilter_users_list.php
+++ b/interface/web/mail/spamfilter_users_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_whitelist_del.php b/interface/web/mail/spamfilter_whitelist_del.php
index 2f27d02..5a3c93d 100644
--- a/interface/web/mail/spamfilter_whitelist_del.php
+++ b/interface/web/mail/spamfilter_whitelist_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_whitelist_edit.php b/interface/web/mail/spamfilter_whitelist_edit.php
index 1670597..f73023f 100644
--- a/interface/web/mail/spamfilter_whitelist_edit.php
+++ b/interface/web/mail/spamfilter_whitelist_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -51,7 +51,7 @@
 class page_action extends tform_actions {
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_spamfilter_wblist')) {
@@ -61,10 +61,10 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_wblist_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	/*
 	function onBeforeUpdate() {
 		global $app, $conf;
@@ -85,7 +85,7 @@
 
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -101,19 +101,20 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		// Select and set the server_id so it matches the server_id of the spa,filter_users record
 		$tmp = $app->db->queryOneRecord("SELECT server_id FROM spamfilter_users WHERE id = ".$app->functions->intval($this->dataRecord["rid"]));
 		$this->dataRecord["server_id"] = $tmp["server_id"];
 		unset($tmp);
-		
-		
+
+
 		parent::onSubmit();
 	}
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_whitelist_list.php b/interface/web/mail/spamfilter_whitelist_list.php
index ffb0fc9..313c595 100644
--- a/interface/web/mail/spamfilter_whitelist_list.php
+++ b/interface/web/mail/spamfilter_whitelist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/user_quota_stats.php b/interface/web/mail/user_quota_stats.php
index dfc1d8a..d491071 100644
--- a/interface/web/mail/user_quota_stats.php
+++ b/interface/web/mail/user_quota_stats.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -35,44 +35,45 @@
 
 
 class list_action extends listform_actions {
-	
+
 	function prepareDataRow($rec)
-    {
-		global $app,$monitor_data;
-		
+	{
+		global $app, $monitor_data;
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
 		$email = $rec['email'];
-		
+
 		$rec['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
-		
+
 		if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1];
-		
+
 		if($rec['quota'] == 0){
 			$rec['quota'] = $app->lng('unlimited');
-            $rec['percentage'] = '';
-            $rec['percentage_sort'] = 0;
+			$rec['percentage'] = '';
+			$rec['percentage_sort'] = 0;
 		} else {
-            $rec['percentage'] = round(100 * $rec['used'] / $rec['quota']) . '%';
+			$rec['percentage'] = round(100 * $rec['used'] / $rec['quota']) . '%';
 			$rec['percentage_sort'] = round(100 * $rec['used'] / $rec['quota']);
-			$rec['quota'] = round($rec['quota'] / 1048576,4).' MB';
+			$rec['quota'] = round($rec['quota'] / 1048576, 4).' MB';
 		}
 
 
-        $rec['used_sort'] = $rec['used'];
-        if($rec['used'] < 1544000) {
-            $rec['used'] = round($rec['used'] / 1024,4).' KB';
-        } else {
-            $rec['used'] = round($rec['used'] / 1048576,4).' MB';
-        }
+		$rec['used_sort'] = $rec['used'];
+		if($rec['used'] < 1544000) {
+			$rec['used'] = round($rec['used'] / 1024, 4).' KB';
+		} else {
+			$rec['used'] = round($rec['used'] / 1048576, 4).' MB';
+		}
 
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
+
 }
 
 $list = new list_action;
@@ -81,4 +82,4 @@
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/webmailer.php b/interface/web/mail/webmailer.php
index 7b3e862..3a10c0f 100644
--- a/interface/web/mail/webmailer.php
+++ b/interface/web/mail/webmailer.php
@@ -28,15 +28,15 @@
 */
 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
 
 /* get the id of the mail (must be int!) */
 if (!isset($_GET['id'])){
-    die ("No E-Mail selected!");
+	die ("No E-Mail selected!");
 }
 $emailId = $app->functions->intval($_GET['id']);
 
@@ -46,7 +46,7 @@
 $dbData = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = " . $emailId);
 $serverId = $app->functions->intval($dbData['server_id']);
 if ($serverId == 0){
-    die ("No E-Mail - Server found!");
+	die ("No E-Mail - Server found!");
 }
 
 $serverData = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$serverId);
@@ -60,7 +60,7 @@
 	header('Location:' . $webmail_url);
 } else {
 
-/*
+	/*
  * We only redirect to the login-form, so there is no need, to check any rights
  */
 	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
@@ -72,4 +72,4 @@
 	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
 }
 exit;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/form/mail_user_autoresponder.tform.php b/interface/web/mailuser/form/mail_user_autoresponder.tform.php
index 9414772..44ce15c 100644
--- a/interface/web/mailuser/form/mail_user_autoresponder.tform.php
+++ b/interface/web/mailuser/form/mail_user_autoresponder.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "mailbox_autoresponder_txt";
+$form["title"]    = "mailbox_autoresponder_txt";
 $form["description"]            = "";
-$form["name"] 			= "mail_user_autoresponder";
-$form["action"]			= "mail_user_autoresponder_edit.php";
-$form["db_table"]		= "mail_user";
+$form["name"]    = "mail_user_autoresponder";
+$form["action"]   = "mail_user_autoresponder_edit.php";
+$form["db_table"]  = "mail_user";
 $form["db_table_idx"]           = "mailuser_id";
-$form["db_history"]		= "yes";
+$form["db_history"]  = "yes";
 $form["tab_default"]            = "autoresponder";
 $form["list_default"]           = "index.php";
-$form["auth"]			= 'no'; // yes / no
+$form["auth"]   = 'no'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -52,58 +52,58 @@
 
 
 $form["tabs"]['autoresponder'] = array (
-	'title' 	=> "Autoresponder",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_autoresponder_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Autoresponder",
+	'width'  => 100,
+	'template'  => "templates/mail_user_autoresponder_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'autoresponder_subject' => array (
 			'datatype'      => 'VARCHAR',
 			'formtype'      => 'TEXT',
 			'default'       => 'Out of office reply',
 			'value'         => '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'autoresponder_text' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '15'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'cols'  => '30',
+			'rows'  => '15'
 		),
 		'autoresponder' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
 		'autoresponder_start_date' => array (
-			'datatype'	=> 'DATETIME',
-			'formtype'	=> 'DATETIME',
-			'validators'=> array ( 	0 => array (	'type'	=> 'CUSTOM',
-													'class' => 'validate_autoresponder',
-													'function' => 'start_date',
-													'errmsg'=> 'autoresponder_start_date_isfuture'),
-								 ),
+			'datatype' => 'DATETIME',
+			'formtype' => 'DATETIME',
+			'validators'=> array (  0 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_autoresponder',
+					'function' => 'start_date',
+					'errmsg'=> 'autoresponder_start_date_isfuture'),
+			),
 		),
 		'autoresponder_end_date' => array (
-			'datatype'	=> 'DATETIME',
-			'formtype'	=> 'DATETIME',
-			'validators'    => array ( 	0 => array (	'type'	=> 'CUSTOM',
-													'class' => 'validate_autoresponder',
-													'function' => 'end_date',
-													'errmsg'=> 'autoresponder_end_date_isgreater'),
-								 ),
+			'datatype' => 'DATETIME',
+			'formtype' => 'DATETIME',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_autoresponder',
+					'function' => 'end_date',
+					'errmsg'=> 'autoresponder_end_date_isgreater'),
+			),
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/form/mail_user_cc.tform.php b/interface/web/mailuser/form/mail_user_cc.tform.php
index 222745d..6458bb7 100644
--- a/interface/web/mailuser/form/mail_user_cc.tform.php
+++ b/interface/web/mailuser/form/mail_user_cc.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "mailbox_cc_txt";
+$form["title"]    = "mailbox_cc_txt";
 $form["description"]            = "";
-$form["name"] 			= "mail_user_cc";
-$form["action"]			= "mail_user_cc_edit.php";
-$form["db_table"]		= "mail_user";
+$form["name"]    = "mail_user_cc";
+$form["action"]   = "mail_user_cc_edit.php";
+$form["db_table"]  = "mail_user";
 $form["db_table_idx"]           = "mailuser_id";
-$form["db_history"]		= "yes";
+$form["db_history"]  = "yes";
 $form["tab_default"]            = "mailuser";
 $form["list_default"]           = "index.php";
-$form["auth"]			= 'no'; // yes / no
+$form["auth"]   = 'no'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,37 +51,37 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailuser'] = array (
-	'title' 	=> "cc_txt",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_cc_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "cc_txt",
+	'width'  => 100,
+	'template'  => "templates/mail_user_cc_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'cc' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'cc_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'cc_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/form/mail_user_filter.tform.php b/interface/web/mailuser/form/mail_user_filter.tform.php
index 02b6c79..b785ae0 100644
--- a/interface/web/mailuser/form/mail_user_filter.tform.php
+++ b/interface/web/mailuser/form/mail_user_filter.tform.php
@@ -35,16 +35,16 @@
 
 global $app;
 
-$form["title"] 			= "mailbox_filter_txt";
+$form["title"]    = "mailbox_filter_txt";
 $form["description"]            = "";
-$form["name"] 			= "mail_user_filter";
-$form["action"]			= "mail_user_filter_edit.php";
-$form["db_table"]		= "mail_user_filter";
+$form["name"]    = "mail_user_filter";
+$form["action"]   = "mail_user_filter_edit.php";
+$form["db_table"]  = "mail_user_filter";
 $form["db_table_idx"]           = "filter_id";
-$form["db_history"]		= "no";
+$form["db_history"]  = "no";
 $form["tab_default"]            = "filter";
 $form["list_default"]           = "mail_user_filter_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -53,83 +53,83 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['filter'] = array (
-	'title' 	=> "Filter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_filter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Filter",
+	'width'  => 100,
+	'template'  => "templates/mail_user_filter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'mailuser_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["mailuser_id"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["mailuser_id"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'rulename' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'rulename_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'rulename_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('Subject' => 'subject_txt','From'=>'from_txt','To'=>'to_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('Subject' => 'subject_txt', 'From'=>'from_txt', 'To'=>'to_txt')
 		),
 		'op' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			#'value'		=> array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
-			'value'		=> array('contains'=>'contains_txt','is' => 'is_txt','begins'=>'begins_with_txt','ends'=>'ends_with_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			//'value'  => array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
+			'value'  => array('contains'=>'contains_txt', 'is' => 'is_txt', 'begins'=>'begins_with_txt', 'ends'=>'ends_with_txt')
 		),
 		'searchterm' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'searchterm_is_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'searchterm_is_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('move' => 'move_to_txt','delete'=>'delete_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('move' => 'move_to_txt', 'delete'=>'delete_txt')
 		),
 		'target' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-zA-Z0-9\.\-\_\ ]{0,100}$/',
-														'errmsg'=> 'target_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-9\.\-\_\ ]{0,100}$/',
+					'errmsg'=> 'target_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/mailuser/form/mail_user_password.tform.php b/interface/web/mailuser/form/mail_user_password.tform.php
index 193de19..65cf076 100644
--- a/interface/web/mailuser/form/mail_user_password.tform.php
+++ b/interface/web/mailuser/form/mail_user_password.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "mailbox_password_txt";
+$form["title"]    = "mailbox_password_txt";
 $form["description"]            = "";
-$form["name"] 			= "mail_user_password";
-$form["action"]			= "mail_user_password_edit.php";
-$form["db_table"]		= "mail_user";
+$form["name"]    = "mail_user_password";
+$form["action"]   = "mail_user_password_edit.php";
+$form["db_table"]  = "mail_user";
 $form["db_table_idx"]           = "mailuser_id";
-$form["db_history"]		= "yes";
+$form["db_history"]  = "yes";
 $form["tab_default"]            = "mailuser";
 $form["list_default"]           = "index.php";
-$form["auth"]			= 'no'; // yes / no
+$form["auth"]   = 'no'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,27 +51,27 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailuser'] = array (
-	'title' 	=> "password_txt",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_password_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "password_txt",
+	'width'  => 100,
+	'template'  => "templates/mail_user_password_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'    => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/form/mail_user_spamfilter.tform.php b/interface/web/mailuser/form/mail_user_spamfilter.tform.php
index cb16645..81b23a8 100644
--- a/interface/web/mailuser/form/mail_user_spamfilter.tform.php
+++ b/interface/web/mailuser/form/mail_user_spamfilter.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "mailbox_spamfilter_txt";
-$form["description"] 	= "";
-$form["name"] 			= "mail_user_spamfilter";
-$form["action"]			= "mail_user_spamfilter_edit.php";
-$form["db_table"]		= "mail_user";
-$form["db_table_idx"]	= "mailuser_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "mailuser";
-$form["list_default"]	= "index.php";
-$form["auth"]			= 'no'; // yes / no
+$form["title"]    = "mailbox_spamfilter_txt";
+$form["description"]  = "";
+$form["name"]    = "mail_user_spamfilter";
+$form["action"]   = "mail_user_spamfilter_edit.php";
+$form["db_table"]  = "mail_user";
+$form["db_table_idx"] = "mailuser_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "mailuser";
+$form["list_default"] = "index.php";
+$form["auth"]   = 'no'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,19 +51,19 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailuser'] = array (
-	'title' 	=> "spamfilter_txt",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_spamfilter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-	
-	##################################
-	# END Datatable fields
-	##################################
+	'title'  => "spamfilter_txt",
+	'width'  => 100,
+	'template'  => "templates/mail_user_spamfilter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
+
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/index.php b/interface/web/mailuser/index.php
index a67fb74..05f150b 100644
--- a/interface/web/mailuser/index.php
+++ b/interface/web/mailuser/index.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -14,7 +14,7 @@
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_index.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $sql = "SELECT * FROM mail_user WHERE mailuser_id = ".$_SESSION['s']['user']['mailuser_id'];
@@ -35,20 +35,20 @@
 
 $app->tpl->setVar($rec2);
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 if(isset($_SESSION['show_info_msg'])) {
-    $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
-    unset($_SESSION['show_info_msg']);
+	$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+	unset($_SESSION['show_info_msg']);
 }
 if(isset($_SESSION['show_error_msg'])) {
-    $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
-    unset($_SESSION['show_error_msg']);
+	$app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+	unset($_SESSION['show_error_msg']);
 }
 
 
 
 $app->tpl_defaults();
 $app->tpl->pparse();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/lib/admin.conf.php b/interface/web/mailuser/lib/admin.conf.php
index 67c94a5..acb6c35 100644
--- a/interface/web/mailuser/lib/admin.conf.php
+++ b/interface/web/mailuser/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/lib/module.conf.php b/interface/web/mailuser/lib/module.conf.php
index b6084aa..68f6392 100644
--- a/interface/web/mailuser/lib/module.conf.php
+++ b/interface/web/mailuser/lib/module.conf.php
@@ -2,8 +2,8 @@
 
 $userid=$app->auth->get_user_id();
 
-$module['name'] 		= 'mailuser';
-$module['title'] 		= 'top_menu_mailuser';
+$module['name']   = 'mailuser';
+$module['title']   = 'top_menu_mailuser';
 $module['template']             = 'module.tpl.htm';
 $module['startpage']            = 'mailuser/index.php';
 $module['tab_width']            = '';
@@ -12,41 +12,41 @@
 //**** menu
 $items = array();
 
-$items[] = array( 	'title'     => 'Overview',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/index.php',
-                        'html_id'   => 'mail_user_index');
+$items[] = array(  'title'     => 'Overview',
+	'target'    => 'content',
+	'link'      => 'mailuser/index.php',
+	'html_id'   => 'mail_user_index');
 
-$items[] = array( 	'title'     => 'Password',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_password_edit.php',
-                        'html_id'   => 'mail_user_password');
+$items[] = array(  'title'     => 'Password',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_password_edit.php',
+	'html_id'   => 'mail_user_password');
 
-$items[] = array( 	'title'     => 'Autoresponder',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_autoresponder_edit.php',
-                        'html_id'   => 'mail_user_autoresponder');
+$items[] = array(  'title'     => 'Autoresponder',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_autoresponder_edit.php',
+	'html_id'   => 'mail_user_autoresponder');
 
-$items[] = array( 	'title'     => 'Send copy',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_cc_edit.php',
-                        'html_id'   => 'mail_user_cc');
+$items[] = array(  'title'     => 'Send copy',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_cc_edit.php',
+	'html_id'   => 'mail_user_cc');
 
-$items[] = array( 	'title'     => 'Spamfilter',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_spamfilter_edit.php',
-                        'html_id'   => 'mail_user_cc');
+$items[] = array(  'title'     => 'Spamfilter',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_spamfilter_edit.php',
+	'html_id'   => 'mail_user_cc');
 
-$items[] = array( 	'title'     => 'Email Filters',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_filter_list.php',
-                        'html_id'   => 'mail_user_filter_list');
+$items[] = array(  'title'     => 'Email Filters',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_filter_list.php',
+	'html_id'   => 'mail_user_filter_list');
 
 
 if(count($items)) {
 	$module['nav'][] = array(   'title' => 'Email Account',
-                                    'open'  => 1,
-                                    'items' => $items);
+		'open'  => 1,
+		'items' => $items);
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/lib/remote.conf.php b/interface/web/mailuser/lib/remote.conf.php
index 15c5adc..62a2de0 100644
--- a/interface/web/mailuser/lib/remote.conf.php
+++ b/interface/web/mailuser/lib/remote.conf.php
@@ -1,3 +1,3 @@
 <?php
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/list/mail_user_filter.list.php b/interface/web/mailuser/list/mail_user_filter.list.php
index 445fe6f..6b71b41 100644
--- a/interface/web/mailuser/list/mail_user_filter.list.php
+++ b/interface/web/mailuser/list/mail_user_filter.list.php
@@ -13,48 +13,48 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_user_filter";
+$liste["name"]     = "mail_user_filter";
 
 // Database table
-$liste["table"] 			= "mail_user_filter";
+$liste["table"]    = "mail_user_filter";
 
 // Index index field of the database table
-$liste["table_idx"]			= "filter_id";
+$liste["table_idx"]   = "filter_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_user_list.php";
+$liste["file"]    = "mail_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_user_filter_edit.php";
+$liste["edit_file"]   = "mail_user_filter_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_filter_del.php";
+$liste["delete_file"]  = "mail_user_filter_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "no";
+$liste["auth"]    = "no";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "rulename",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "rulename",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/mail_user_autoresponder_edit.php b/interface/web/mailuser/mail_user_autoresponder_edit.php
index 5e58081..8007c0f 100644
--- a/interface/web/mailuser/mail_user_autoresponder_edit.php
+++ b/interface/web/mailuser/mail_user_autoresponder_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -49,29 +49,29 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShow() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onShow();
-		
+
 	}
-	
+
 	function onSubmit() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		//* if autoresponder checkbox not selected, do not save dates
 		if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
-			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_start_date']);
-			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_end_date']);
+			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_start_date']);
+			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_end_date']);
 		}
-		
+
 		parent::onSubmit();
-		
+
 	}
-	
+
 	function onShowEnd() {
 		global $app;
 		// Is autoresponder set?
@@ -80,17 +80,17 @@
 		} else {
 			$app->tpl->setVar("ar_active", '');
 		}
-		
+
 		if($this->dataRecord['autoresponder_subject'] == '') {
 			$app->tpl->setVar('autoresponder_subject', $app->tform->lng('autoresponder_subject'));
 		} else {
 			$app->tpl->setVar('autoresponder_subject', $this->dataRecord['autoresponder_subject']);
 		}
-        
+
 		parent::onShowEnd();
 	}
-	
-	
+
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mailuser/mail_user_cc_edit.php b/interface/web/mailuser/mail_user_cc_edit.php
index 2c001c2..39e5bdf 100644
--- a/interface/web/mailuser/mail_user_cc_edit.php
+++ b/interface/web/mailuser/mail_user_cc_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -49,38 +49,38 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShow() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onShow();
-		
+
 	}
-	
+
 	function onSubmit() {
 		global $app;
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
 		$rec = $app->tform->getDataRecord($this->id);
 		if(isset($_POST['cc']) && trim($_POST['cc']) == $rec['email']) {
 			$app->tform->errorMessage .= $app->tform->lng('email_is_cc_error');
 		}
-		
+
 		parent::onSubmit();
-		
+
 	}
-	
-function onShowEnd() {
+
+	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$rec = $app->tform->getDataRecord($this->id);
 		$app->tpl->setVar("email", $rec['email']);
-		
+
 		parent::onShowEnd();
 	}
-	
-	
+
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mailuser/mail_user_filter_del.php b/interface/web/mailuser/mail_user_filter_del.php
index f1696d9..285c34c 100644
--- a/interface/web/mailuser/mail_user_filter_del.php
+++ b/interface/web/mailuser/mail_user_filter_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -50,10 +50,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/mail_user_filter_edit.php b/interface/web/mailuser/mail_user_filter_edit.php
index 14f8dd5..9274e3d 100644
--- a/interface/web/mailuser/mail_user_filter_edit.php
+++ b/interface/web/mailuser/mail_user_filter_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -52,40 +52,40 @@
 
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check the limits only when the email address belongs to a client and not the admin
 		if($_SESSION["s"]["user"]["default_group"] > 0) {
-			if(!$app->tform->checkClientLimit('limit_mailfilter',"")) {
+			if(!$app->tform->checkClientLimit('limit_mailfilter', "")) {
 				$app->error($app->tform->lng("limit_mailfilter_txt"));
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailfilter',"")) {
+			if(!$app->tform->checkResellerLimit('limit_mailfilter', "")) {
 				$app->error('Reseller: '.$app->tform->lng("limit_mailfilter_txt"));
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
 
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent mail_user record
 		$mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".$app->functions->intval($_SESSION['s']['user']['mailuser_id'])."'");
-				
+
 		// Set the mailuser_id
 		$this->dataRecord["mailuser_id"] = $mailuser["mailuser_id"];
-		
+
 		// Remove leading dots
-		if(substr($this->dataRecord['target'],0,1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'],1);
-		
+		if(substr($this->dataRecord['target'], 0, 1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'], 1);
+
 
 		// Check the client limits if the email address is assigned to a client
 		if($_SESSION["s"]["user"]["default_group"] > 0) { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_mailfilter FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another filter
 			if($this->id == 0 && $client["limit_mailfilter"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(filter_id) as number FROM mail_user_filter WHERE sys_groupid = $client_group_id");
@@ -95,13 +95,13 @@
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/mail_user_filter_list.php b/interface/web/mailuser/mail_user_filter_list.php
index d896aa5..cda05d3 100644
--- a/interface/web/mailuser/mail_user_filter_list.php
+++ b/interface/web/mailuser/mail_user_filter_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -19,7 +19,7 @@
 
 
 class list_action extends listform_actions {
-	
+
 }
 
 $list = new list_action;
@@ -29,4 +29,4 @@
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/mail_user_password_edit.php b/interface/web/mailuser/mail_user_password_edit.php
index 22eea89..5bbcedb 100644
--- a/interface/web/mailuser/mail_user_password_edit.php
+++ b/interface/web/mailuser/mail_user_password_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -49,24 +49,24 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onSubmit() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onSubmit();
-		
+
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$rec = $app->tform->getDataRecord($_SESSION['s']['user']['mailuser_id']);
 		$app->tpl->setVar("email", $rec['email']);
-		
+
 		parent::onShowEnd();
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mailuser/mail_user_spamfilter_edit.php b/interface/web/mailuser/mail_user_spamfilter_edit.php
index 905149c..632a507 100644
--- a/interface/web/mailuser/mail_user_spamfilter_edit.php
+++ b/interface/web/mailuser/mail_user_spamfilter_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -49,32 +49,32 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShow() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onShow();
-		
+
 	}
-	
+
 	function onSubmit() {
 		global $app;
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onSubmit();
-		
+
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		$rec = $app->tform->getDataRecord($this->id);
-		$email_parts = explode('@',$rec['email']);
+		$email_parts = explode('@', $rec['email']);
 		$email_domain = $email_parts[1];
 		$domain = $app->db->queryOneRecord("SELECT sys_userid, sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($email_domain)."'");
-		
+
 		// Spamfilter policy
 		$policy_id = $app->functions->intval($this->dataRecord["policy"]);
 		$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($rec["email"])."'");
@@ -84,7 +84,7 @@
 				$app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]);
 			} else {
 				// We create a new record
-				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) 
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
 				        VALUES (".$domain["sys_userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($rec["email"])."', '".$app->db->quote($rec["email"])."', 'Y')";
 				$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
 			}
@@ -95,13 +95,13 @@
 			}
 		} // endif spamfilter policy
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$rec = $app->tform->getDataRecord($this->id);
 		$app->tpl->setVar("email", $rec['email']);
-		
+
 		// Get the spamfilter policys for the user
 		$tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = '".$rec['email']."'");
 		$sql = "SELECT id, policy_name FROM spamfilter_policy WHERE ".$app->tform->getAuthSQL('r');
@@ -113,15 +113,15 @@
 				$policy_select .= "<option value='$p[id]' $selected>$p[policy_name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("policy",$policy_select);
+		$app->tpl->setVar("policy", $policy_select);
 		unset($policys);
 		unset($policy_select);
 		unset($tmp_user);
-		
+
 		parent::onShowEnd();
 	}
-	
-	
+
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/monitor/datalog_del.php b/interface/web/monitor/datalog_del.php
index 372c0a9..7925307 100644
--- a/interface/web/monitor/datalog_del.php
+++ b/interface/web/monitor/datalog_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/datalog_list.php b/interface/web/monitor/datalog_list.php
index dd5bfb3..a67501f 100644
--- a/interface/web/monitor/datalog_list.php
+++ b/interface/web/monitor/datalog_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,7 +52,7 @@
 foreach($servers as $sv) {
 	$sql .= " (sys_datalog.datalog_id > ".$sv['updated']." AND sys_datalog.server_id = ".$sv['server_id'].") OR ";
 }
-$sql = substr($sql,0,-4);
+$sql = substr($sql, 0, -4);
 $sql .= ')';
 
 $app->listform_actions->SQLExtWhere = $sql;
@@ -61,4 +61,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/lib/admin.conf.php b/interface/web/monitor/lib/admin.conf.php
index 67c94a5..acb6c35 100644
--- a/interface/web/monitor/lib/admin.conf.php
+++ b/interface/web/monitor/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/lib/module.conf.php b/interface/web/monitor/lib/module.conf.php
index 1d4e5e1..3e63ebc 100644
--- a/interface/web/monitor/lib/module.conf.php
+++ b/interface/web/monitor/lib/module.conf.php
@@ -3,31 +3,31 @@
 /*
  Config of the Module
  */
-$module["name"] 		= "monitor";
-$module["title"] 		= "top_menu_monitor";
-$module["template"] 	= "module.tpl.htm";
+$module["name"]   = "monitor";
+$module["title"]   = "top_menu_monitor";
+$module["template"]  = "module.tpl.htm";
 $module["tab_width"]    = '';
-$module["startpage"] 	= "monitor/show_sys_state.php?state=system";
+$module["startpage"]  = "monitor/show_sys_state.php?state=system";
 
 unset($items);
-$items[] = array( 'title' 	=> "Show Overview",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_sys_state.php?state=system',
-                  'html_id' => 'system');
+$items[] = array( 'title'  => "Show Overview",
+	'target'  => 'content',
+	'link' => 'monitor/show_sys_state.php?state=system',
+	'html_id' => 'system');
 
-$items[] = array( 'title' 	=> "Show System-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/log_list.php',
-                  'html_id' => 'system_log');
+$items[] = array( 'title'  => "Show System-Log",
+	'target'  => 'content',
+	'link' => 'monitor/log_list.php',
+	'html_id' => 'system_log');
 
-$items[] = array( 'title' 	=> 'Show Jobqueue',
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/datalog_list.php',
-                  'html_id' => 'jobqueue');
+$items[] = array( 'title'  => 'Show Jobqueue',
+	'target'  => 'content',
+	'link' => 'monitor/datalog_list.php',
+	'html_id' => 'jobqueue');
 
-$module["nav"][] = array(	'title'	=> 'System State (All Servers)',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module["nav"][] = array( 'title' => 'System State (All Servers)',
+	'open'  => 1,
+	'items' => $items);
 
 
 /*
@@ -40,7 +40,7 @@
 $dropDown = "<select id='server_id' onchange=\"loadContent('monitor/show_sys_state.php?state=server&server=' + document.getElementById('server_id').value);\">";
 foreach ($servers as $server)
 {
-    $dropDown .= "<option value='" . $server['server_id'] . "|" . $server['server_name'] . "'>" . $server['server_name'] . "</option>";
+	$dropDown .= "<option value='" . $server['server_id'] . "|" . $server['server_name'] . "'>" . $server['server_name'] . "</option>";
 }
 $dropDown .= "</select>";
 
@@ -48,14 +48,14 @@
  Now add them as dropdown to the navigation
  */
 unset($items);
-$items[] = array( 'title' 	=> $dropDown,
-        'target' 	=> '', // no action!
-        'link'	=> '',     // no action!
-        'html_id' => 'select_server');
+$items[] = array( 'title'  => $dropDown,
+	'target'  => '', // no action!
+	'link' => '',     // no action!
+	'html_id' => 'select_server');
 
-$module["nav"][] = array(	'title'	=> 'Server to Monitor',
-        'open' 	=> 1,
-        'items'	=> $items);
+$module["nav"][] = array( 'title' => 'Server to Monitor',
+	'open'  => 1,
+	'items' => $items);
 
 /*
   The first Server at the list is the server first selected
@@ -68,134 +68,134 @@
  */
 unset($items);
 
-$items[] = array( 'title' 	=> "Show CPU info",
-        'target' 	=> 'content',
-        'link'	=> 'monitor/show_data.php?type=cpu_info',
-        'html_id' => 'cpu_info');
+$items[] = array( 'title'  => "Show CPU info",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=cpu_info',
+	'html_id' => 'cpu_info');
 
-$module["nav"][] = array(	'title'	=> 'Hardware-Information',
-        'open' 	=> 1,
-        'items'	=> $items);
+$module["nav"][] = array( 'title' => 'Hardware-Information',
+	'open'  => 1,
+	'items' => $items);
 
 /*
  * Clear and set the Navigation-Items
  */
 unset($items);
-$items[] = array( 'title' 	=> "Show Overview",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_sys_state.php?state=server',
-                  'html_id' => 'server');
+$items[] = array( 'title'  => "Show Overview",
+	'target'  => 'content',
+	'link' => 'monitor/show_sys_state.php?state=server',
+	'html_id' => 'server');
 
-$items[] = array( 'title' 	=> "Show Update State",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=system_update',
-                  'html_id' => 'system_update');
+$items[] = array( 'title'  => "Show Update State",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=system_update',
+	'html_id' => 'system_update');
 
-$items[] = array( 'title' 	=> "Show RAID state",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=raid_state',
-                  'html_id' => 'raid_state');
+$items[] = array( 'title'  => "Show RAID state",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=raid_state',
+	'html_id' => 'raid_state');
 
-$items[] = array( 'title' 	=> "Show Server load",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=server_load',
-                  'html_id' => 'serverload');
+$items[] = array( 'title'  => "Show Server load",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=server_load',
+	'html_id' => 'serverload');
 
-$items[] = array( 'title' 	=> "Show Disk usage",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=disk_usage',
-                  'html_id' => 'disk_usage');
+$items[] = array( 'title'  => "Show Disk usage",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=disk_usage',
+	'html_id' => 'disk_usage');
 
-$items[] = array( 'title' 	=> "Show Memory usage",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=mem_usage',
-                  'html_id' => 'mem_usage');
+$items[] = array( 'title'  => "Show Memory usage",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=mem_usage',
+	'html_id' => 'mem_usage');
 
-$items[] = array( 'title' 	=> "Show Services",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=services',
-                  'html_id' => 'services');
-				  
-$items[] = array( 'title' 	=> "Show Monit",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_monit.php',
-                  'html_id' => 'monit');
+$items[] = array( 'title'  => "Show Services",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=services',
+	'html_id' => 'services');
 
-$items[] = array( 'title' 	=> "Show OpenVz VE BeanCounter",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=openvz_beancounter',
-                  'html_id' => 'openvz_beancounter');
-				  
-$items[] = array( 'title' 	=> "Show Munin",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_munin.php',
-                  'html_id' => 'monit');
+$items[] = array( 'title'  => "Show Monit",
+	'target'  => 'content',
+	'link' => 'monitor/show_monit.php',
+	'html_id' => 'monit');
 
-$module["nav"][] = array(	'title'	=> 'Server State',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$items[] = array( 'title'  => "Show OpenVz VE BeanCounter",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=openvz_beancounter',
+	'html_id' => 'openvz_beancounter');
+
+$items[] = array( 'title'  => "Show Munin",
+	'target'  => 'content',
+	'link' => 'monitor/show_munin.php',
+	'html_id' => 'monit');
+
+$module["nav"][] = array( 'title' => 'Server State',
+	'open'  => 1,
+	'items' => $items);
 
 /*
  * Clear and set the Navigation-Items
  */
 unset($items);
 
-$items[] = array( 'title' 	=> "Show Mail-Queue",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=mailq',
-                  'html_id' => 'mailq');
+$items[] = array( 'title'  => "Show Mail-Queue",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=mailq',
+	'html_id' => 'mailq');
 
-$items[] = array( 'title' 	=> "Show Mail-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_mail',
-                  'html_id' => 'log_mail');
+$items[] = array( 'title'  => "Show Mail-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_mail',
+	'html_id' => 'log_mail');
 
-$items[] = array( 'title' 	=> "Show Mail warn-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_mail_warn',
-                  'html_id' => 'log_mail_warn');
+$items[] = array( 'title'  => "Show Mail warn-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_mail_warn',
+	'html_id' => 'log_mail_warn');
 
-$items[] = array( 'title' 	=> "Show Mail err-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_mail_err',
-                  'html_id' => 'log_mail_err');
+$items[] = array( 'title'  => "Show Mail err-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_mail_err',
+	'html_id' => 'log_mail_err');
 
-$items[] = array( 'title' 	=> "Show System-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_messages',
-                  'html_id' => 'log_messages');
+$items[] = array( 'title'  => "Show System-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_messages',
+	'html_id' => 'log_messages');
 
-$items[] = array( 'title' 	=> "Show ISPC Cron-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_ispc_cron',
-                  'html_id' => 'log_ispc_cron');
+$items[] = array( 'title'  => "Show ISPC Cron-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_ispc_cron',
+	'html_id' => 'log_ispc_cron');
 
-$items[] = array( 'title' 	=> "Show Freshclam-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_freshclam',
-                  'html_id' => 'log_freshclam');
+$items[] = array( 'title'  => "Show Freshclam-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_freshclam',
+	'html_id' => 'log_freshclam');
 
-$items[] = array( 'title' 	=> "Show Clamav-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_clamav',
-                  'html_id' => 'log_clamav');
+$items[] = array( 'title'  => "Show Clamav-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_clamav',
+	'html_id' => 'log_clamav');
 
-$items[] = array( 'title' 	=> "Show RKHunter-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=rkhunter',
-                  'html_id' => 'rkhunter');
+$items[] = array( 'title'  => "Show RKHunter-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=rkhunter',
+	'html_id' => 'rkhunter');
 
-$items[] = array( 'title' 	=> "Show fail2ban-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=fail2ban',
-                  'html_id' => 'fai2ban');
+$items[] = array( 'title'  => "Show fail2ban-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=fail2ban',
+	'html_id' => 'fai2ban');
 
-$items[] = array( 'title' 	=> "Show IPTables",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=iptables',
-                  'html_id' => 'iptables');
+$items[] = array( 'title'  => "Show IPTables",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=iptables',
+	'html_id' => 'iptables');
 
-$module["nav"][] = array(	'title'	=> 'Logfiles',
-                            'open' 	=> 1,
-                            'items'	=> $items);
-?>
\ No newline at end of file
+$module["nav"][] = array( 'title' => 'Logfiles',
+	'open'  => 1,
+	'items' => $items);
+?>
diff --git a/interface/web/monitor/list/datalog.list.php b/interface/web/monitor/list/datalog.list.php
index 01362c1..81326e3 100644
--- a/interface/web/monitor/list/datalog.list.php
+++ b/interface/web/monitor/list/datalog.list.php
@@ -10,82 +10,82 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'datalog';
+$liste['name']     = 'datalog';
 
 //* Database table
-$liste['table'] 			= 'sys_datalog';
+$liste['table']    = 'sys_datalog';
 
 //* Primary index column
-$liste['table_idx']			= 'datalog_id';
+$liste['table_idx']   = 'datalog_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'datalog_list.php';
+$liste['file']    = 'datalog_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'datalog_list.php';
+$liste['edit_file']   = 'datalog_list.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'datalog_del.php';
+$liste['delete_file']  = 'datalog_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "tstamp",
-							'datatype'	=> "DATETIME",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "tstamp",
+	'datatype' => "DATETIME",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste['item'][] = array(	'field'		=> 'server_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'server_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => '',
+	'value'  => '');
 
-$liste["item"][] = array(	'field'		=> "action",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('i' => "Insert",'u' => "Update",'d' => "Delete"));
+$liste["item"][] = array( 'field'  => "action",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('i' => "Insert", 'u' => "Update", 'd' => "Delete"));
 
 
-$liste["item"][] = array(	'field'		=> "dbtable",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
- 
+$liste["item"][] = array( 'field'  => "dbtable",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/web/monitor/list/log.list.php b/interface/web/monitor/list/log.list.php
index 9490090..49e0a08 100644
--- a/interface/web/monitor/list/log.list.php
+++ b/interface/web/monitor/list/log.list.php
@@ -10,81 +10,81 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'syslog';
+$liste['name']     = 'syslog';
 
 //* Database table
-$liste['table'] 			= 'sys_log';
+$liste['table']    = 'sys_log';
 
 //* Primary index column
-$liste['table_idx']			= 'syslog_id';
+$liste['table_idx']   = 'syslog_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'log_list.php';
+$liste['file']    = 'log_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'log_list.php';
+$liste['edit_file']   = 'log_list.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'log_del.php';
+$liste['delete_file']  = 'log_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "tstamp",
-							'datatype'	=> "DATETIME",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "tstamp",
+	'datatype' => "DATETIME",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste['item'][] = array(	'field'		=> 'server_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
+$liste['item'][] = array( 'field'  => 'server_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => '',
+	'value'  => '');
 
-$liste["item"][] = array(	'field'		=> "loglevel",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('0' => "Debug",'1' => "Warning",'2' => "Error"));
+$liste["item"][] = array( 'field'  => "loglevel",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('0' => "Debug", '1' => "Warning", '2' => "Error"));
 
 
-$liste["item"][] = array(	'field'		=> "message",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
- 
+$liste["item"][] = array( 'field'  => "message",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/web/monitor/log_del.php b/interface/web/monitor/log_del.php
index 09b339b..04d11e9 100644
--- a/interface/web/monitor/log_del.php
+++ b/interface/web/monitor/log_del.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -41,4 +41,4 @@
 exit;
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/log_list.php b/interface/web/monitor/log_list.php
index 2d5edb2..c694a41 100644
--- a/interface/web/monitor/log_list.php
+++ b/interface/web/monitor/log_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/show_data.php b/interface/web/monitor/show_data.php
index 1cd4baf..89cd63a 100644
--- a/interface/web/monitor/show_data.php
+++ b/interface/web/monitor/show_data.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -47,93 +47,93 @@
 $output = '';
 
 switch($dataType) {
-    case 'server_load':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showServerLoad();
-        $time = $app->tools_monitor->getDataTime('server_load');
-        $title = $app->lng("Server Load").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'disk_usage':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showDiskUsage();
-        $time = $app->tools_monitor->getDataTime('disk_usage');
-        $title = $app->lng("Disk usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'mem_usage':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showMemUsage();
-        $time = $app->tools_monitor->getDataTime('mem_usage');
-        $title = $app->lng("Memory usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'cpu_info':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showCpuInfo();
-        $time = $app->tools_monitor->getDataTime('cpu_info');
-        $title = $app->lng("monitor_title_cpuinfo_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'services':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showServices();
-        $time = $app->tools_monitor->getDataTime('services');
-        $title = $app->lng("Status of services").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'openvz_beancounter':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showOpenVzBeanCounter();
-        $time = $app->tools_monitor->getDataTime('openvz_beancounter');
-        $title = $app->lng("monitor_title_beancounter_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'system_update':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showSystemUpdate();
-        $time = $app->tools_monitor->getDataTime('system_update');
-        $title = $app->lng("monitor_title_updatestate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'mailq':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showMailq();
-        $time = $app->tools_monitor->getDataTime('mailq');
-        $title = $app->lng("monitor_title_mailq_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'raid_state':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showRaidState();
-        $time = $app->tools_monitor->getDataTime('raid_state');
-        $title = $app->lng("monitor_title_raidstate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'rkhunter':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showRKHunter();
-        $time = $app->tools_monitor->getDataTime('rkhunter');
-        $title = $app->lng("monitor_title_rkhunterlog_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'fail2ban':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showFail2ban();
-        $time = $app->tools_monitor->getDataTime('log_fail2ban');
-        $title = $app->lng("monitor_title_fail2ban_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'iptables':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showIPTables();
-        $time = $app->tools_monitor->getDataTime('iptables_rules');
-        $title = $app->lng("monitor_title_iptables_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    default:
-        $template = '';
-        break;
+case 'server_load':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showServerLoad();
+	$time = $app->tools_monitor->getDataTime('server_load');
+	$title = $app->lng("Server Load").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'disk_usage':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showDiskUsage();
+	$time = $app->tools_monitor->getDataTime('disk_usage');
+	$title = $app->lng("Disk usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'mem_usage':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showMemUsage();
+	$time = $app->tools_monitor->getDataTime('mem_usage');
+	$title = $app->lng("Memory usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'cpu_info':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showCpuInfo();
+	$time = $app->tools_monitor->getDataTime('cpu_info');
+	$title = $app->lng("monitor_title_cpuinfo_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'services':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showServices();
+	$time = $app->tools_monitor->getDataTime('services');
+	$title = $app->lng("Status of services").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'openvz_beancounter':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showOpenVzBeanCounter();
+	$time = $app->tools_monitor->getDataTime('openvz_beancounter');
+	$title = $app->lng("monitor_title_beancounter_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'system_update':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showSystemUpdate();
+	$time = $app->tools_monitor->getDataTime('system_update');
+	$title = $app->lng("monitor_title_updatestate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'mailq':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showMailq();
+	$time = $app->tools_monitor->getDataTime('mailq');
+	$title = $app->lng("monitor_title_mailq_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'raid_state':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showRaidState();
+	$time = $app->tools_monitor->getDataTime('raid_state');
+	$title = $app->lng("monitor_title_raidstate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'rkhunter':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showRKHunter();
+	$time = $app->tools_monitor->getDataTime('rkhunter');
+	$title = $app->lng("monitor_title_rkhunterlog_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'fail2ban':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showFail2ban();
+	$time = $app->tools_monitor->getDataTime('log_fail2ban');
+	$title = $app->lng("monitor_title_fail2ban_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'iptables':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showIPTables();
+	$time = $app->tools_monitor->getDataTime('iptables_rules');
+	$title = $app->lng("monitor_title_iptables_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+default:
+	$template = '';
+	break;
 }
 
 
diff --git a/interface/web/monitor/show_log.php b/interface/web/monitor/show_log.php
index ec10a98..78d645e 100644
--- a/interface/web/monitor/show_log.php
+++ b/interface/web/monitor/show_log.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -39,7 +39,7 @@
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/show_log.htm');
+$app->tpl->setInclude('content_tpl', 'templates/show_log.htm');
 
 // Importing the GET values
 $refresh = (isset($_GET["refresh"]))?$app->functions->intval($_GET["refresh"]):0;
@@ -54,51 +54,51 @@
  Setting the db-type and the caption
  */
 switch($logParam) {
-	case 'log_mail':
-		$logId = 'log_mail';
-		$title = $app->lng("monitor_logs_mail_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_mail_warn':
-		$logId = 'log_mail_warn';
-		$title = $app->lng("monitor_logs_mailwarn_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_mail_err':
-		$logId = 'log_mail_err';
-		$title = $app->lng("monitor_logs_mailerr_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_messages':
-		$logId = 'log_messages';
-		$title = $app->lng("monitor_logs_messages_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_ispc_cron':
-		$logId = 'log_ispc_cron';
-		$title = $app->lng("monitor_logs_ispccron_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_freshclam':
-		$logId = 'log_freshclam';
-		$title = $app->lng("monitor_logs_freshclam_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_clamav':
-		$logId = 'log_clamav';
-		$title = $app->lng("monitor_logs_clamav_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_ispconfig':
-		$logId = 'log_ispconfig';
-		$title = $app->lng("monitor_logs_ispc_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	default:
-		$logId = '???';
-		$title = '???';
-		$description = '';
-		break;
+case 'log_mail':
+	$logId = 'log_mail';
+	$title = $app->lng("monitor_logs_mail_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_mail_warn':
+	$logId = 'log_mail_warn';
+	$title = $app->lng("monitor_logs_mailwarn_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_mail_err':
+	$logId = 'log_mail_err';
+	$title = $app->lng("monitor_logs_mailerr_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_messages':
+	$logId = 'log_messages';
+	$title = $app->lng("monitor_logs_messages_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_ispc_cron':
+	$logId = 'log_ispc_cron';
+	$title = $app->lng("monitor_logs_ispccron_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_freshclam':
+	$logId = 'log_freshclam';
+	$title = $app->lng("monitor_logs_freshclam_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_clamav':
+	$logId = 'log_clamav';
+	$title = $app->lng("monitor_logs_clamav_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_ispconfig':
+	$logId = 'log_ispconfig';
+	$title = $app->lng("monitor_logs_ispc_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+default:
+	$logId = '???';
+	$title = '???';
+	$description = '';
+	break;
 }
 
 
@@ -107,7 +107,7 @@
  Attention: the core-moule ist triggered every 5 minutes,
             so reload every 2 minutes is impossible!
 */
-$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -','5' => '5 '.$app->lng("minutes"),'10' => '10 '.$app->lng("minutes"),'15' => '15 '.$app->lng("minutes"),'30' => '30 '.$app->lng("minutes"),'60' => '60 '.$app->lng("minutes"));
+$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -', '5' => '5 '.$app->lng("minutes"), '10' => '10 '.$app->lng("minutes"), '15' => '15 '.$app->lng("minutes"), '30' => '30 '.$app->lng("minutes"), '60' => '60 '.$app->lng("minutes"));
 $tmp = '';
 foreach($refresh_values as $key => $val) {
 	if($key == $refresh) {
@@ -116,7 +116,7 @@
 		$tmp .= "<option value='$key'>$val</option>";
 	}
 }
-$app->tpl->setVar("refresh",$tmp);
+$app->tpl->setVar("refresh", $tmp);
 
 
 /* fetch the Data from the DB */
@@ -133,7 +133,7 @@
 }
 
 $app->tpl->setVar("list_head_txt", $title);
-$app->tpl->setVar("log_id",$logId);
+$app->tpl->setVar("log_id", $logId);
 $app->tpl->setVar("list_desc_txt", $description);
 $app->tpl->setVar("time", $app->tools_monitor->getDataTime($logId));
 $app->tpl->setVar("monTransDate", $monTransDate);
diff --git a/interface/web/monitor/show_monit.php b/interface/web/monitor/show_monit.php
index 0121a68..7bd69df 100644
--- a/interface/web/monitor/show_monit.php
+++ b/interface/web/monitor/show_monit.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -47,9 +47,9 @@
 $app->tpl->setVar("list_head_txt", $title);
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'){
-	
+
 	$app->uses('getconf');
-	$server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'],'server');
+	$server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'], 'server');
 
 	$monit_url = trim($server_config['monit_url']);
 	if($monit_url != ''){
@@ -64,11 +64,11 @@
 			$auth_string .= ':'.rawurlencode($monit_password);
 		}
 		if($auth_string != '') $auth_string .= '@';
-	
+
 		$monit_url_parts = parse_url($monit_url);
-  
+
 		$monit_url = $monit_url_parts['scheme'].'://'.$auth_string.$monit_url_parts['host'].(isset($monit_url_parts['port']) ? ':' . $monit_url_parts['port'] : '').(isset($monit_url_parts['path']) ? $monit_url_parts['path'] : '').(isset($monit_url_parts['query']) ? '?' . $monit_url_parts['query'] : '').(isset($monit_url_parts['fragment']) ? '#' . $monit_url_parts['fragment'] : '');
-	
+
 		$app->tpl->setVar("monit_url", $monit_url);
 	} else {
 		$app->tpl->setVar("no_monit_url_defined_txt", $app->lng("no_monit_url_defined_txt"));
diff --git a/interface/web/monitor/show_munin.php b/interface/web/monitor/show_munin.php
index 5db6adf..ecc94da 100644
--- a/interface/web/monitor/show_munin.php
+++ b/interface/web/monitor/show_munin.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -47,9 +47,9 @@
 $app->tpl->setVar("list_head_txt", $title);
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'){
-	
+
 	$app->uses('getconf');
-	$server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'],'server');
+	$server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'], 'server');
 
 	$munin_url = trim($server_config['munin_url']);
 	if($munin_url != ''){
@@ -64,11 +64,11 @@
 			$auth_string .= ':'.rawurlencode($munin_password);
 		}
 		if($auth_string != '') $auth_string .= '@';
-	
+
 		$munin_url_parts = parse_url($munin_url);
-  
+
 		$munin_url = $munin_url_parts['scheme'].'://'.$auth_string.$munin_url_parts['host'].(isset($munin_url_parts['port']) ? ':' . $munin_url_parts['port'] : '').(isset($munin_url_parts['path']) ? $munin_url_parts['path'] : '').(isset($munin_url_parts['query']) ? '?' . $munin_url_parts['query'] : '').(isset($munin_url_parts['fragment']) ? '#' . $munin_url_parts['fragment'] : '');
-		
+
 		$app->tpl->setVar("munin_url", $munin_url);
 	} else {
 		$app->tpl->setVar("no_munin_url_defined_txt", $app->lng("no_munin_url_defined_txt"));
diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php
index d251cdc..aa97317 100644
--- a/interface/web/monitor/show_sys_state.php
+++ b/interface/web/monitor/show_sys_state.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /* Check permissions for module */
 $app->auth->check_module_permissions('monitor');
@@ -45,7 +45,7 @@
 */
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/show_sys_state.htm');
+$app->tpl->setInclude('content_tpl', 'templates/show_sys_state.htm');
 
 /* Get some translations */
 $monTransRefreshsq = $app->lng("monitor_settings_refreshsq_txt");
@@ -65,10 +65,10 @@
 	$stateType = 'system';
 }
 
-$app->tpl->setVar("state_data",$output);
-$app->tpl->setVar("state_type",$stateType);
-$app->tpl->setVar("list_head_txt",$title);
-$app->tpl->setVar("list_desc_txt",(isset($description) ? $description : ''));
+$app->tpl->setVar("state_data", $output);
+$app->tpl->setVar("state_type", $stateType);
+$app->tpl->setVar("list_head_txt", $title);
+$app->tpl->setVar("list_desc_txt", (isset($description) ? $description : ''));
 $app->tpl->setVar("monTransRefreshsq", $monTransRefreshsq);
 
 /*
@@ -78,7 +78,7 @@
 */
 $refresh = (isset($_GET["refresh"]))?$app->functions->intval($_GET["refresh"]):0;
 
-$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -','5' => '5 '.$app->lng("minutes"),'10' => '10 '.$app->lng("minutes"),'15' => '15 '.$app->lng("minutes"),'30' => '30 '.$app->lng("minutes"),'60' => '60 '.$app->lng("minutes"));
+$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -', '5' => '5 '.$app->lng("minutes"), '10' => '10 '.$app->lng("minutes"), '15' => '15 '.$app->lng("minutes"), '30' => '30 '.$app->lng("minutes"), '60' => '60 '.$app->lng("minutes"));
 $tmp = '';
 foreach($refresh_values as $key => $val) {
 	if($key == $refresh) {
@@ -103,6 +103,8 @@
 	global $app;
 
 	/** The data of all Servers as (sorted by name) array */
+
+
 	$serverData = array();
 
 	/*
@@ -198,7 +200,7 @@
 		$tmp = _processDbState($record['type'], $serverId, $serverState, $messages);
 		$serverState = $tmp['serverState'];
 		$messages = $tmp['messages'];
-		
+
 		/* if we have the os-info, get it */
 		if ($record['type'] == 'os_info') {
 			$osData = unserialize($record['data']);
@@ -222,12 +224,12 @@
 	 * Info of a VE inside a OpenVz-Host
 	*/
 	$html_ve  = '<div class="systemmonitor-ve state-' . $serverState . '-ve os-' . $osData['name'] . '">';
-        if ($osData != null) {
-            $html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
-        }
-        else {
-            $html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
-        }
+	if ($osData != null) {
+		$html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
+	}
+	else {
+		$html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
+	}
 	$html_ve .= '<div class="statusDevice"><p>' . $serverName;
 	if ($osData != null) {
 		$html_ve .= ' (' . $osData['name'] . ' ' . $osData['version'] . ') ';
@@ -235,9 +237,9 @@
 	if ($ispcData != null) {
 		$html_ve .= $ispcData['name'] . ' ' . $ispcData['version'] . '</p>';
 	}
-        else {
-            $html_ve .= '</p>';
-        }
+	else {
+		$html_ve .= '</p>';
+	}
 	$html_ve .= '<p>' . $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . '</p>';
 
 	/*
@@ -245,21 +247,21 @@
 	*/
 	$html_server = '<div class="systemmonitor-server state-' . $serverState . ' os-' . $osData['name'] . '">';
 	if ($osData != null) {
-            $html_server .= '<div class="icoDevice"><p class="status"></p></div>';
-        }
-        else {
-            $html_server .= '<div class="icoDevice"><p class="status"></p></div>';
-        }
+		$html_server .= '<div class="icoDevice"><p class="status"></p></div>';
+	}
+	else {
+		$html_server .= '<div class="icoDevice"><p class="status"></p></div>';
+	}
 	$html_server .= '<div class="statusDevice"><p>' . $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
 	if ($osData != null) {
-            $html_server .= ' (' . $osData['name'] . ' ' . $osData['version'] . ') ';
+		$html_server .= ' (' . $osData['name'] . ' ' . $osData['version'] . ') ';
 	}
 	if ($ispcData != null) {
-            $html_server .= $ispcData['name'] . ' ' . $ispcData['version'] . '</p>';
+		$html_server .= $ispcData['name'] . ' ' . $ispcData['version'] . '</p>';
 	}
-        else {
-            $html_server .= '</p>';
-        }
+	else {
+		$html_server .= '</p>';
+	}
 
 	$html_server .= '<p>' . $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . ' (';
 	$html_server .= sizeof((isset($messages[$app->lng("monitor_serverstate_listunknown_txt")]) ? $messages[$app->lng("monitor_serverstate_listunknown_txt")] : array())) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
@@ -270,7 +272,7 @@
 	$html_server .= ')</p>';
 
 	/*
-	 * Verbose - Info 
+	 * Verbose - Info
 	*/
 	$html_verbose = $html_server;
 	foreach($messages as $key => $state) {
@@ -336,31 +338,31 @@
 	}
 	if ($type == 'disk_usage') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_hdok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_hdgoingfull_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'warning':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_hdnearlyfull_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'critical':
-				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_hdveryfull_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_hdfull_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_hdok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_hdgoingfull_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'warning':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_hdnearlyfull_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'critical':
+			$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_hdveryfull_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_hdfull_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_hdunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_hdunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 	if ($type == 'mem_usage') {
@@ -368,180 +370,180 @@
 	}
 	if ($type == 'server_load') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_loadok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_loadheavy_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'warning':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_loadhigh_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'critical':
-				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_loadhigher_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_loadhighest_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_loadunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_loadok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_loadheavy_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'warning':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_loadhigh_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'critical':
+			$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_loadhigher_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_loadhighest_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_loadunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 	if ($type == 'services') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_servicesonline_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_servicesonline_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
 
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_servicesoffline_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_servicesunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_servicesoffline_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_servicesunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 	if ($type == 'system_update') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_updatesok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_updatesok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
 
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_updatesneeded_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'no_state':
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_updatesneeded_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'no_state':
 			/*
                  *  not debian and not Ubuntu, so the state could not be monitored...
 			*/
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_updatesunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_updatesunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
 	if ($type == 'raid_state') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_raidok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_raidresync_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'critical':
-				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_raidfault_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_raiderror_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'no_state':
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_raidok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_raidresync_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'critical':
+			$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_raidfault_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_raiderror_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'no_state':
 			/*
                  *  mdadm is not installed or the RAID is not supported...
 			*/
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_raidunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_raidunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
 	/*
 	 * ignore, until we find a better solution
 	 */
-//	if ($type == 'openvz_beancounter') {
-//		switch ($record['state']) {
-//			case 'ok':
-//				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_beancounterok_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			case 'info':
-//				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterinfo_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			case 'warning':
-//				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterwarning_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			case 'critical':
-//				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_beancountercritical_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			case 'error':
-//				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_beancountererror_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			default:
-//				break;
-//		}
-//	}
+	// if ($type == 'openvz_beancounter') {
+	//  switch ($record['state']) {
+	//   case 'ok':
+	//    $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_beancounterok_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   case 'info':
+	//    $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterinfo_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   case 'warning':
+	//    $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterwarning_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   case 'critical':
+	//    $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_beancountercritical_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   case 'error':
+	//    $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_beancountererror_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   default:
+	//    break;
+	//  }
+	// }
 
 
 	if ($type == 'mailq') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_mailqok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_mailqheavy_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'warning':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_mailqhigh_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'critical':
-				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_mailqhigher_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_mailqhighest_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_mailqunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_mailqok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_mailqheavy_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'warning':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_mailqhigh_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'critical':
+			$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_mailqhigher_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_mailqhighest_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_mailqunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
 	if ($type == 'sys_log') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_syslogok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'warning':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_syslogwarning_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_syslogerror_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_syslogunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_syslogok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'warning':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_syslogwarning_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_syslogerror_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_syslogunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
@@ -551,18 +553,18 @@
 
 	if ($type == 'log_freshclam') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_fclamok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_fclamoutdated_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_fclamunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_fclamok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_fclamoutdated_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_fclamunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
@@ -584,8 +586,8 @@
 	if ($type == 'rkhunter') {
 		/* this type has no state */
 	}
-	
-	return array('serverState' => $serverState,'messages' => $messages);
+
+	return array('serverState' => $serverState, 'messages' => $messages);
 }
 
 /*
@@ -601,39 +603,39 @@
     * Calculate the weight of the old state
 	*/
 	switch ($oldState) {
-		case 'no_state': $oldInt = 0;
-			break;
-		case 'ok': $oldInt = 1;
-			break;
-		case 'unknown': $oldInt = 2;
-			break;
-		case 'info': $oldInt = 3;
-			break;
-		case 'warning': $oldInt = 4;
-			break;
-		case 'critical': $oldInt = 5;
-			break;
-		case 'error': $oldInt = 6;
-			break;
+	case 'no_state': $oldInt = 0;
+		break;
+	case 'ok': $oldInt = 1;
+		break;
+	case 'unknown': $oldInt = 2;
+		break;
+	case 'info': $oldInt = 3;
+		break;
+	case 'warning': $oldInt = 4;
+		break;
+	case 'critical': $oldInt = 5;
+		break;
+	case 'error': $oldInt = 6;
+		break;
 	}
 	/*
          * Calculate the weight of the new state
 	*/
 	switch ($newState) {
-		case 'no_state': $newInt = 0 ;
-			break;
-		case 'ok': $newInt = 1 ;
-			break;
-		case 'unknown': $newInt = 2 ;
-			break;
-		case 'info': $newInt = 3 ;
-			break;
-		case 'warning': $newInt = 4 ;
-			break;
-		case 'critical': $newInt = 5 ;
-			break;
-		case 'error': $newInt = 6 ;
-			break;
+	case 'no_state': $newInt = 0 ;
+		break;
+	case 'ok': $newInt = 1 ;
+		break;
+	case 'unknown': $newInt = 2 ;
+		break;
+	case 'info': $newInt = 3 ;
+		break;
+	case 'warning': $newInt = 4 ;
+		break;
+	case 'critical': $newInt = 5 ;
+		break;
+	case 'error': $newInt = 6 ;
+		break;
 	}
 
 	/*
diff --git a/interface/web/nav.php b/interface/web/nav.php
index 909392f..4d8617c 100644
--- a/interface/web/nav.php
+++ b/interface/web/nav.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../lib/config.inc.php');
-require_once('../lib/app.inc.php');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
 $app->uses('tpl');
 
@@ -55,28 +55,28 @@
 			foreach($modules as $mt) {
 				if(is_file($mt.'/lib/module.conf.php')) {
 					if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
-					include_once($mt.'/lib/module.conf.php');
+					include_once $mt.'/lib/module.conf.php';
 					$language = (isset($_SESSION['s']['user']['language']))?$_SESSION['s']['user']['language']:$conf['language'];
 					$app->load_language_file('web/'.$mt.'/lib/'.$language.'.lng');
 					$active = ($module['name'] == $_SESSION['s']['module']['name']) ? 1 : 0;
-					$topnav[] = array(	'title' 	=> $app->lng($module['title']),
-							'active' 	=> $active,
-							'module'	=> $module['name']);
+					$topnav[] = array( 'title'  => $app->lng($module['title']),
+						'active'  => $active,
+						'module' => $module['name']);
 				}
 			}
 		}
 	} else {
 		//*  Loading Login Module
-		include_once('login/lib/module.conf.php');
+		include_once 'login/lib/module.conf.php';
 		$_SESSION['s']['module'] = $module;
-		$topnav[] = array(	'title' 	=> 'Login',
-				'active' 	=> 1);
+		$topnav[] = array( 'title'  => 'Login',
+			'active'  => 1);
 		$module = null;
 		unset($module);
 	}
 
 	//* Topnavigation
-	$app->tpl->setLoop('nav_top',$topnav);
+	$app->tpl->setLoop('nav_top', $topnav);
 
 }
 
@@ -84,9 +84,9 @@
 if(isset($_GET['nav']) && $_GET['nav'] == 'side') {
 
 	if(isset($_SESSION['s']['module']['name']) && is_file($_SESSION['s']['module']['name'].'/lib/custom_menu.inc.php')) {
-		include_once($_SESSION['s']['module']['name'].'/lib/custom_menu.inc.php');
+		include_once $_SESSION['s']['module']['name'].'/lib/custom_menu.inc.php';
 	} else {
-	
+
 		$app->tpl->newTemplate('sidenav.tpl.htm');
 
 		//* translating module navigation
@@ -106,8 +106,8 @@
 		} else {
 			$nav_translated = null;
 		}
-		$app->tpl->setLoop('nav_left',$nav_translated);
-	
+		$app->tpl->setLoop('nav_left', $nav_translated);
+
 	}
 
 }
@@ -115,4 +115,4 @@
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/remote/index.php b/interface/web/remote/index.php
index 1fa5e60..d60a1c9 100644
--- a/interface/web/remote/index.php
+++ b/interface/web/remote/index.php
@@ -1,8 +1,8 @@
 <?php
 
-require_once('../../lib/config.inc.php');
+require_once '../../lib/config.inc.php';
 $conf['start_session'] = false;
-require_once('../../lib/app.inc.php');
+require_once '../../lib/app.inc.php';
 
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
 
@@ -14,4 +14,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/remote/monitor.php b/interface/web/remote/monitor.php
index f49b169..9cc0084 100644
--- a/interface/web/remote/monitor.php
+++ b/interface/web/remote/monitor.php
@@ -1,7 +1,7 @@
 <?php
-require_once('../../lib/config.inc.php');
+require_once '../../lib/config.inc.php';
 $conf['start_session'] = false;
-require_once('../../lib/app.inc.php');
+require_once '../../lib/app.inc.php';
 
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
 
@@ -29,14 +29,14 @@
 	if($type == 'serverlist') {
 		$sql = 'SELECT server_id, server_name FROM server WHERE 1 ORDER BY server_id';
 		$records = $app->db->queryAllRecords($sql);
-        foreach($records as $index => $rec) {
-            $rec = $app->db->queryOneRecord("SELECT * FROM monitor_data WHERE server_id = " . $rec['server_id'] . " AND state NOT IN ('ok', 'no_state', 'info')");
-            if($rec) $records[$index]['state'] = 'warn';
-            else $records[$index]['state'] = 'ok';
-        }
+		foreach($records as $index => $rec) {
+			$rec = $app->db->queryOneRecord("SELECT * FROM monitor_data WHERE server_id = " . $rec['server_id'] . " AND state NOT IN ('ok', 'no_state', 'info')");
+			if($rec) $records[$index]['state'] = 'warn';
+			else $records[$index]['state'] = 'ok';
+		}
 		$out['state'] = 'ok';
 		$out['data'] = $records;
-		$out['time'] = date('Y-m-d H:i',$rec['created']);
+		$out['time'] = date('Y-m-d H:i', $rec['created']);
 	} else {
 		$rec = $app->db->queryOneRecord("SELECT * FROM monitor_data WHERE type = '$type' AND server_id = $server_id");
 		if(is_array($rec)) {
@@ -47,7 +47,7 @@
 					if(!$val) $out['data'][$key] = "&nbsp;";
 				}
 			}
-			$out['time'] = date('Y-m-d H:i',$rec['created']);
+			$out['time'] = date('Y-m-d H:i', $rec['created']);
 		} else {
 			$out['state'] = 'syserror';
 			$out['data'] = 'No monitor record found.';
@@ -60,66 +60,66 @@
 }
 $out['type'] = $type;
 
-function __json_encode($data) {           
-    if( is_array($data) || is_object($data) ) {
-        $islist = is_array($data) && ( empty($data) || array_keys($data) === range(0,count($data)-1) );
-       
-        if( $islist ) {
-            $json = '[' . implode(',', array_map('__json_encode', $data) ) . ']';
-        } else {
-            $items = Array();
-            foreach( $data as $key => $value ) {
-                $items[] = __json_encode("$key") . ':' . __json_encode($value);
-            }
-            $json = '{' . implode(',', $items) . '}';
-        }
-    } elseif( is_string($data) ) {
-        # Escape non-printable or Non-ASCII characters.
-        # I also put the \\ character first, as suggested in comments on the 'addcslashes' page.
-        $string = '"' . addcslashes($data, "\\\"\n\r\t/" . chr(8) . chr(12)) . '"';
-        $json    = '';
-        $len    = strlen($string);
-        # Convert UTF-8 to Hexadecimal Codepoints.
-        for( $i = 0; $i < $len; $i++ ) {
-           
-            $char = $string[$i];
-            $c1 = ord($char);
-           
-            # Single byte;
-            if( $c1 <128 ) {
-                $json .= ($c1 > 31) ? $char : sprintf("\\u%04x", $c1);
-                continue;
-            }
-           
-            # Double byte
-            $c2 = ord($string[++$i]);
-            if ( ($c1 & 32) === 0 ) {
-                $json .= sprintf("\\u%04x", ($c1 - 192) * 64 + $c2 - 128);
-                continue;
-            }
-           
-            # Triple
-            $c3 = ord($string[++$i]);
-            if( ($c1 & 16) === 0 ) {
-                $json .= sprintf("\\u%04x", (($c1 - 224) <<12) + (($c2 - 128) << 6) + ($c3 - 128));
-                continue;
-            }
-               
-            # Quadruple
-            $c4 = ord($string[++$i]);
-            if( ($c1 & 8 ) === 0 ) {
-                $u = (($c1 & 15) << 2) + (($c2>>4) & 3) - 1;
-           
-                $w1 = (54<<10) + ($u<<6) + (($c2 & 15) << 2) + (($c3>>4) & 3);
-                $w2 = (55<<10) + (($c3 & 15)<<6) + ($c4-128);
-                $json .= sprintf("\\u%04x\\u%04x", $w1, $w2);
-            }
-        }
-    } else {
-        # int, floats, bools, null
-        $json = strtolower(var_export( $data, true ));
-    }
-    return $json;
+function __json_encode($data) {
+	if( is_array($data) || is_object($data) ) {
+		$islist = is_array($data) && ( empty($data) || array_keys($data) === range(0, count($data)-1) );
+
+		if( $islist ) {
+			$json = '[' . implode(',', array_map('__json_encode', $data) ) . ']';
+		} else {
+			$items = array();
+			foreach( $data as $key => $value ) {
+				$items[] = __json_encode("$key") . ':' . __json_encode($value);
+			}
+			$json = '{' . implode(',', $items) . '}';
+		}
+	} elseif( is_string($data) ) {
+		// Escape non-printable or Non-ASCII characters.
+		// I also put the \\ character first, as suggested in comments on the 'addcslashes' page.
+		$string = '"' . addcslashes($data, "\\\"\n\r\t/" . chr(8) . chr(12)) . '"';
+		$json    = '';
+		$len    = strlen($string);
+		// Convert UTF-8 to Hexadecimal Codepoints.
+		for( $i = 0; $i < $len; $i++ ) {
+
+			$char = $string[$i];
+			$c1 = ord($char);
+
+			// Single byte;
+			if( $c1 <128 ) {
+				$json .= ($c1 > 31) ? $char : sprintf("\\u%04x", $c1);
+				continue;
+			}
+
+			// Double byte
+			$c2 = ord($string[++$i]);
+			if ( ($c1 & 32) === 0 ) {
+				$json .= sprintf("\\u%04x", ($c1 - 192) * 64 + $c2 - 128);
+				continue;
+			}
+
+			// Triple
+			$c3 = ord($string[++$i]);
+			if( ($c1 & 16) === 0 ) {
+				$json .= sprintf("\\u%04x", (($c1 - 224) <<12) + (($c2 - 128) << 6) + ($c3 - 128));
+				continue;
+			}
+
+			// Quadruple
+			$c4 = ord($string[++$i]);
+			if( ($c1 & 8 ) === 0 ) {
+				$u = (($c1 & 15) << 2) + (($c2>>4) & 3) - 1;
+
+				$w1 = (54<<10) + ($u<<6) + (($c2 & 15) << 2) + (($c3>>4) & 3);
+				$w2 = (55<<10) + (($c3 & 15)<<6) + ($c4-128);
+				$json .= sprintf("\\u%04x\\u%04x", $w1, $w2);
+			}
+		}
+	} else {
+		// int, floats, bools, null
+		$json = strtolower(var_export( $data, true ));
+	}
+	return $json;
 }
 
 if(function_exists('json_encode')) { // PHP >= 5.2
@@ -128,4 +128,4 @@
 	echo __json_encode($out);
 }
 exit;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/ajax_get_ip.php b/interface/web/sites/ajax_get_ip.php
index 34fbab8..4101a80 100644
--- a/interface/web/sites/ajax_get_ip.php
+++ b/interface/web/sites/ajax_get_ip.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -43,7 +43,7 @@
 
 	//* Get global web config
 	$web_config = $app->getconf->get_server_config($server_id, 'web');
-	
+
 	$sql = "SELECT ip_address FROM server_ip WHERE ip_type = '$ip_type' AND server_id = $server_id";
 	$ips = $app->db->queryAllRecords($sql);
 	// $ip_select = "<option value=''></option>";
@@ -62,5 +62,5 @@
 	unset($ips);
 }
 
-echo substr($ip_select,0,-1);
-?>
\ No newline at end of file
+echo substr($ip_select, 0, -1);
+?>
diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php
index 9da4513..6800897 100644
--- a/interface/web/sites/ajax_get_json.php
+++ b/interface/web/sites/ajax_get_json.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -44,154 +44,154 @@
 
 //if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-	if($type == 'getservertype'){
-		$json = '{"servertype":"';
-		$server_type = 'apache';
-		$web_config = $app->getconf->get_server_config($server_id, 'web');
-		if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
-		$json .= $server_type;
-		unset($webconfig);
-		$json .= '"}';
-	}
-	
-	if($type == 'getserverid'){
-		$json = '{"serverid":"';
-		$sql = "SELECT server_id FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
-		$server = $app->db->queryOneRecord($sql);
-		$json .= $server['server_id'];
-		unset($server);
-		$json .= '"}';
-	}
-	
-	if($type == 'getphpfastcgi'){
-		$json = '{';
-		
-		$server_type = 'apache';
-		$web_config = $app->getconf->get_server_config($server_id, 'web');
-		if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
-		if($server_type == 'nginx' && $php_type == 'fast-cgi') $php_type = 'php-fpm';
-		$sql_where = '';
-		
-		//* Client: If the logged in user is not admin and has no sub clients (no reseller)
-		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-			$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"] . ")";
-		//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
-		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $client_group_id");
-			//$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"];
-			$sql_where = " AND (client_id = 0";
-			if($app->functions->intval($client['client_id']) > 0) $sql_where .= " OR client_id = ".$app->functions->intval($client['client_id']);
-			$sql_where .= ")";
-		//* Admin: If the logged in user is admin
-		} else {
-			//$sql_where = '';
-			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $client_group_id");
-			//$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"];
-			$sql_where = " AND (client_id = 0";
-			if($app->functions->intval($client['client_id']) > 0) $sql_where .= " OR client_id = ".$app->functions->intval($client['client_id']);
-			$sql_where .= ")";
-		}
-		
-		if($php_type == 'php-fpm'){
-			$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id".$sql_where);
-		}
-		if($php_type == 'fast-cgi'){
-			$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id".$sql_where);
-		}
-		$php_select = "";
-		if(is_array($php_records) && !empty($php_records)) {
-			foreach( $php_records as $php_record) {
-				if($php_type == 'php-fpm'){
-					$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
-				} else {
-					$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
-				}
-				$json .= '"'.$php_version.'": "'.$php_record['name'].'",';
-			}
-		}
-		unset($php_records);
-		if(substr($json,-1) == ',') $json = substr($json,0,-1);
-		$json .= '}';
-	}
-	
-	if($type == 'getphptype'){
-		$json = '{"phptype":"';
-		$sql = "SELECT php FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
-		$php = $app->db->queryOneRecord($sql);
-		$json .= $php['php'];
-		unset($php);
-		$json .= '"}';
-	}
-	
-	if($type == 'getredirecttype'){
-		$json = '{"redirecttype":"';
-		$sql = "SELECT redirect_type FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
-		$redirect = $app->db->queryOneRecord($sql);
-		$json .= $redirect['redirect_type'];
-		unset($redirect);
-		$json .= '"}';
-	}
-	
-	if($type == 'get_ipv4'){		
-		$result = array();
-		
-		// ipv4
-		//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
-		$result[] = $app->functions->suggest_ips('IPv4');
+if($type == 'getservertype'){
+	$json = '{"servertype":"';
+	$server_type = 'apache';
+	$web_config = $app->getconf->get_server_config($server_id, 'web');
+	if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
+	$json .= $server_type;
+	unset($webconfig);
+	$json .= '"}';
+}
 
-		$json = $app->functions->json_encode($result);
+if($type == 'getserverid'){
+	$json = '{"serverid":"';
+	$sql = "SELECT server_id FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
+	$server = $app->db->queryOneRecord($sql);
+	$json .= $server['server_id'];
+	unset($server);
+	$json .= '"}';
+}
+
+if($type == 'getphpfastcgi'){
+	$json = '{';
+
+	$server_type = 'apache';
+	$web_config = $app->getconf->get_server_config($server_id, 'web');
+	if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
+	if($server_type == 'nginx' && $php_type == 'fast-cgi') $php_type = 'php-fpm';
+	$sql_where = '';
+
+	//* Client: If the logged in user is not admin and has no sub clients (no reseller)
+	if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+		$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"] . ")";
+		//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
+	} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+		$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $client_group_id");
+		//$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"];
+		$sql_where = " AND (client_id = 0";
+		if($app->functions->intval($client['client_id']) > 0) $sql_where .= " OR client_id = ".$app->functions->intval($client['client_id']);
+		$sql_where .= ")";
+		//* Admin: If the logged in user is admin
+	} else {
+		//$sql_where = '';
+		$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $client_group_id");
+		//$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"];
+		$sql_where = " AND (client_id = 0";
+		if($app->functions->intval($client['client_id']) > 0) $sql_where .= " OR client_id = ".$app->functions->intval($client['client_id']);
+		$sql_where .= ")";
 	}
-	
-	if($type == 'get_ipv6'){		
-		$result = array();
-		
-		// ipv6
-		//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
-		$result[] = $app->functions->suggest_ips('IPv6');
-		
-		$json = $app->functions->json_encode($result);
+
+	if($php_type == 'php-fpm'){
+		$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id".$sql_where);
 	}
-    
-    if($type == 'getdatabaseusers') {
-        $json = '{}';
-		
-		$sql = "SELECT sys_groupid FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
-        $group = $app->db->queryOneRecord($sql);
-        if($group) {
-            $sql = "SELECT database_user_id, database_user FROM web_database_user WHERE sys_groupid = '" . $group['sys_groupid'] . "'";
-            $records = $app->db->queryAllRecords($sql);
-            
-			$tmp_array = array();
-            foreach($records as $record) {
-				$tmp_array[$record['database_user_id']] = $record['database_user'];
-            }
-			$json = $app->functions->json_encode($tmp_array);
-            unset($records, $group, $tmp_array);
-        }
-    }
-	
-	if($type == 'get_use_combobox'){
-		$json = '{"usecombobox":"';
-		$use_combobox = 'y';
-		$server_config_array = $app->getconf->get_global_config();
-		if($server_config_array['misc']['use_combobox'] != 'y') $use_combobox = 'n';
-		$json .= $use_combobox;
-		unset($server_config_array);
-		$json .= '"}';
+	if($php_type == 'fast-cgi'){
+		$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id".$sql_where);
 	}
-	
-	if($type == 'get_use_loadindicator'){
-		$json = '{"useloadindicator":"';
-		$use_loadindicator = 'y';
-		$server_config_array = $app->getconf->get_global_config();
-		if($server_config_array['misc']['use_loadindicator'] != 'y') $use_loadindicator = 'n';
-		$json .= $use_loadindicator;
-		unset($server_config_array);
-		$json .= '"}';
+	$php_select = "";
+	if(is_array($php_records) && !empty($php_records)) {
+		foreach( $php_records as $php_record) {
+			if($php_type == 'php-fpm'){
+				$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
+			} else {
+				$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
+			}
+			$json .= '"'.$php_version.'": "'.$php_record['name'].'",';
+		}
 	}
+	unset($php_records);
+	if(substr($json, -1) == ',') $json = substr($json, 0, -1);
+	$json .= '}';
+}
+
+if($type == 'getphptype'){
+	$json = '{"phptype":"';
+	$sql = "SELECT php FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
+	$php = $app->db->queryOneRecord($sql);
+	$json .= $php['php'];
+	unset($php);
+	$json .= '"}';
+}
+
+if($type == 'getredirecttype'){
+	$json = '{"redirecttype":"';
+	$sql = "SELECT redirect_type FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
+	$redirect = $app->db->queryOneRecord($sql);
+	$json .= $redirect['redirect_type'];
+	unset($redirect);
+	$json .= '"}';
+}
+
+if($type == 'get_ipv4'){
+	$result = array();
+
+	// ipv4
+	//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
+	$result[] = $app->functions->suggest_ips('IPv4');
+
+	$json = $app->functions->json_encode($result);
+}
+
+if($type == 'get_ipv6'){
+	$result = array();
+
+	// ipv6
+	//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
+	$result[] = $app->functions->suggest_ips('IPv6');
+
+	$json = $app->functions->json_encode($result);
+}
+
+if($type == 'getdatabaseusers') {
+	$json = '{}';
+
+	$sql = "SELECT sys_groupid FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
+	$group = $app->db->queryOneRecord($sql);
+	if($group) {
+		$sql = "SELECT database_user_id, database_user FROM web_database_user WHERE sys_groupid = '" . $group['sys_groupid'] . "'";
+		$records = $app->db->queryAllRecords($sql);
+
+		$tmp_array = array();
+		foreach($records as $record) {
+			$tmp_array[$record['database_user_id']] = $record['database_user'];
+		}
+		$json = $app->functions->json_encode($tmp_array);
+		unset($records, $group, $tmp_array);
+	}
+}
+
+if($type == 'get_use_combobox'){
+	$json = '{"usecombobox":"';
+	$use_combobox = 'y';
+	$server_config_array = $app->getconf->get_global_config();
+	if($server_config_array['misc']['use_combobox'] != 'y') $use_combobox = 'n';
+	$json .= $use_combobox;
+	unset($server_config_array);
+	$json .= '"}';
+}
+
+if($type == 'get_use_loadindicator'){
+	$json = '{"useloadindicator":"';
+	$use_loadindicator = 'y';
+	$server_config_array = $app->getconf->get_global_config();
+	if($server_config_array['misc']['use_loadindicator'] != 'y') $use_loadindicator = 'n';
+	$json .= $use_loadindicator;
+	unset($server_config_array);
+	$json .= '"}';
+}
 
 //}
 
 header('Content-type: application/json');
 echo $json;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_availablepackages_list.php b/interface/web/sites/aps_availablepackages_list.php
index 0966df9..d883754 100644
--- a/interface/web/sites/aps_availablepackages_list.php
+++ b/interface/web/sites/aps_availablepackages_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 //require_once('classes/class.base.php'); // for constants
 $app->load('aps_base');
 
@@ -38,7 +38,7 @@
 
 // Check the module permissions
 $app->auth->check_module_permissions('sites');
-        
+
 // Load needed classes
 $app->uses('tpl,listform_actions');
 
@@ -53,4 +53,4 @@
 
 // Start the form rendering and action handling
 $app->listform_actions->onLoad();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_cron_apscrawler_if.php b/interface/web/sites/aps_cron_apscrawler_if.php
index caa9b02..fca04f2 100644
--- a/interface/web/sites/aps_cron_apscrawler_if.php
+++ b/interface/web/sites/aps_cron_apscrawler_if.php
@@ -27,8 +27,8 @@
 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //require_once('classes/class.crawler.php');
 $app->load('aps_crawler');
@@ -60,4 +60,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_do_operation.php b/interface/web/sites/aps_do_operation.php
index ada193c..b4d9493 100644
--- a/interface/web/sites/aps_do_operation.php
+++ b/interface/web/sites/aps_do_operation.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 $app->load('aps_guicontroller');
 
 // Check the module permissions
@@ -43,70 +43,70 @@
 // List of operations which can be performed
 if($_GET['action'] == 'change_status')
 {
-    // Only admins can perform this operation
-    if($_SESSION['s']['user']['typ'] != 'admin') die('For admin use only.');
-    
-    // Make sure a valid package ID is given
-    if(!$gui->isValidPackageID($_GET['id'], true)) die($app->lng('Invalid ID'));
-    
-    // Change the existing status to the opposite
-    $get_status = $app->db->queryOneRecord("SELECT package_status FROM aps_packages WHERE id = '".$app->functions->intval($_GET['id'])."';");
-    if($get_status['package_status'] == strval(PACKAGE_LOCKED))
-    {
-        $app->db->query("UPDATE aps_packages SET package_status = ".PACKAGE_ENABLED." WHERE id = '".$app->functions->intval($_GET['id'])."';");
-        echo '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>';
-    }
-    else
-    {
-        $app->db->query("UPDATE aps_packages SET Package_status = ".PACKAGE_LOCKED." WHERE id = '".$app->functions->intval($_GET['id'])."';");
-        echo '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>';
-    }
+	// Only admins can perform this operation
+	if($_SESSION['s']['user']['typ'] != 'admin') die('For admin use only.');
+
+	// Make sure a valid package ID is given
+	if(!$gui->isValidPackageID($_GET['id'], true)) die($app->lng('Invalid ID'));
+
+	// Change the existing status to the opposite
+	$get_status = $app->db->queryOneRecord("SELECT package_status FROM aps_packages WHERE id = '".$app->functions->intval($_GET['id'])."';");
+	if($get_status['package_status'] == strval(PACKAGE_LOCKED))
+	{
+		$app->db->query("UPDATE aps_packages SET package_status = ".PACKAGE_ENABLED." WHERE id = '".$app->functions->intval($_GET['id'])."';");
+		echo '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>';
+	}
+	else
+	{
+		$app->db->query("UPDATE aps_packages SET Package_status = ".PACKAGE_LOCKED." WHERE id = '".$app->functions->intval($_GET['id'])."';");
+		echo '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>';
+	}
 }
 else if($_GET['action'] == 'delete_instance')
-{
-    // Make sure a valid package ID is given (also corresponding to the calling user)
-    $client_id = 0;
-    $is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
-    if(!$is_admin)
-    {
-        $cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
-        $client_id = $cid['client_id'];
-    }
-	
-    // Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
-    if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
-    
-    // Only delete the instance if the status is "installed" or "flawed"
-    $check = $app->db->queryOneRecord("SELECT id FROM aps_instances 
-        WHERE id = ".$app->db->quote($_GET['id'])." AND 
+	{
+		// Make sure a valid package ID is given (also corresponding to the calling user)
+		$client_id = 0;
+		$is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
+		if(!$is_admin)
+		{
+			$cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
+			$client_id = $cid['client_id'];
+		}
+
+		// Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
+		if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
+
+		// Only delete the instance if the status is "installed" or "flawed"
+		$check = $app->db->queryOneRecord("SELECT id FROM aps_instances
+        WHERE id = ".$app->db->quote($_GET['id'])." AND
         (instance_status = ".INSTANCE_SUCCESS." OR instance_status = ".INSTANCE_ERROR.");");
-    if($check['id'] > 0) $gui->deleteInstance($_GET['id']);
-    //echo $app->lng('Installation_remove');
-	@header('Location:aps_installedpackages_list.php');
-}
+		if($check['id'] > 0) $gui->deleteInstance($_GET['id']);
+		//echo $app->lng('Installation_remove');
+		@header('Location:aps_installedpackages_list.php');
+	}
 else if($_GET['action'] == 'reinstall_instance')
-{
-    // Make sure a valid package ID is given (also corresponding to the calling user)
-    $client_id = 0;
-    $is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
-    if(!$is_admin)
-    {
-        $cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
-        $client_id = $cid['client_id'];
-    }
-    // Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
-    if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
-    
-    // We've an InstanceID, so make sure the package is not enabled and InstanceStatus is still "installed"
-    $check = $app->db->queryOneRecord("SELECT aps_instances.id FROM aps_instances, aps_packages 
-        WHERE aps_instances.package_id = aps_packages.id 
-        AND aps_instances.instance_status = ".INSTANCE_SUCCESS." 
-        AND aps_packages.package_status = ".PACKAGE_ENABLED." 
+	{
+		// Make sure a valid package ID is given (also corresponding to the calling user)
+		$client_id = 0;
+		$is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
+		if(!$is_admin)
+		{
+			$cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
+			$client_id = $cid['client_id'];
+		}
+		// Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
+		if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
+
+		// We've an InstanceID, so make sure the package is not enabled and InstanceStatus is still "installed"
+		$check = $app->db->queryOneRecord("SELECT aps_instances.id FROM aps_instances, aps_packages
+        WHERE aps_instances.package_id = aps_packages.id
+        AND aps_instances.instance_status = ".INSTANCE_SUCCESS."
+        AND aps_packages.package_status = ".PACKAGE_ENABLED."
         AND aps_instances.id = ".$app->db->quote($_GET['id']).";");
-    if(!$check) die('Check failed'); // normally this might not happen at all, so just die
-    
-    $gui->reinstallInstance($_GET['id']);
-    //echo $app->lng('Installation_task');
-	@header('Location:aps_installedpackages_list.php');
-}
+		if(!$check) die('Check failed'); // normally this might not happen at all, so just die
+
+		$gui->reinstallInstance($_GET['id']);
+		//echo $app->lng('Installation_task');
+		@header('Location:aps_installedpackages_list.php');
+	}
 ?>
diff --git a/interface/web/sites/aps_install_package.php b/interface/web/sites/aps_install_package.php
index ccad334..8ba04ef 100644
--- a/interface/web/sites/aps_install_package.php
+++ b/interface/web/sites/aps_install_package.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 //require_once('classes/class.guicontroller.php');
 $app->load('aps_guicontroller');
 
@@ -43,12 +43,12 @@
 
 // Load the language file
 $lngfile = 'lib/lang/'.$_SESSION['s']['language'].'_aps.lng';
-require_once($lngfile);
+require_once $lngfile;
 $app->tpl->setVar($wb);
 $app->load_language_file('web/sites/'.$lngfile);
 
 // we will check only users, not admins
-if($_SESSION["s"]["user"]["typ"] == 'user') {		
+if($_SESSION["s"]["user"]["typ"] == 'user') {
 	$app->tform->formDef['db_table_idx'] = 'client_id';
 	$app->tform->formDef['db_table'] = 'client';
 	if(!$app->tform->checkClientLimit('limit_aps')) {
@@ -56,7 +56,7 @@
 	}
 	if(!$app->tform->checkResellerLimit('limit_aps')) {
 		$app->error('Reseller: '.$wb["limit_aps_txt"]);
-	}		
+	}
 }
 
 
@@ -68,13 +68,13 @@
 // Note: It's intended that here is no strict ID check (see below)
 if(isset($pkg_id))
 {
-    $newest_pkg_id = $gui->getNewestPackageID($pkg_id);
-    if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
+	$newest_pkg_id = $gui->getNewestPackageID($pkg_id);
+	if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
 }
 
 // Make sure an integer ID is given
 if(!isset($pkg_id) || !$gui->isValidPackageID($pkg_id, $adminflag))
-    $app->error($app->lng('Invalid ID'));
+	$app->error($app->lng('Invalid ID'));
 
 // Get package details
 $details = $gui->getPackageDetails($pkg_id);
@@ -85,40 +85,40 @@
 // Get domain list
 $domains = array();
 $domain_for_user = '';
-if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' 
+if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."'
     OR sys_groupid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' )";
 $domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain') AND active = 'y' ".$domain_for_user." ORDER BY domain;");
 if(!empty($domains_assoc)) foreach($domains_assoc as $domain) $domains[] = $domain['domain'];
 
-// If data has been submitted, validate it
-$result['input'] = array();
+	// If data has been submitted, validate it
+	$result['input'] = array();
 if(count($_POST) > 1)
 {
-    $result = $gui->validateInstallerInput($_POST, $details, $domains, $settings);
-    if(empty($result['error']))
-    {
-        $gui->createPackageInstance($result['input'], $pkg_id);
-        @header('Location:aps_installedpackages_list.php');
-    }
-    else
-    {
-        $app->tpl->setVar('error', implode('<br />', $result['error']));
-        
-        // Set memorized values (license, db password, install location)
-        if(!empty($result['input']))
-            foreach($result['input'] as $key => $value) $app->tpl->setVar('inp_'.$key, $value);
-    }
+	$result = $gui->validateInstallerInput($_POST, $details, $domains, $settings);
+	if(empty($result['error']))
+	{
+		$gui->createPackageInstance($result['input'], $pkg_id);
+		@header('Location:aps_installedpackages_list.php');
+	}
+	else
+	{
+		$app->tpl->setVar('error', implode('<br />', $result['error']));
+
+		// Set memorized values (license, db password, install location)
+		if(!empty($result['input']))
+			foreach($result['input'] as $key => $value) $app->tpl->setVar('inp_'.$key, $value);
+	}
 }
 else $app->tpl->setVar('inp_main_database_password', ucfirst(substr(md5(crypt(rand(0, 10))), 0, 16)));
 
 // Pass the package details to the template
 foreach($details as $key => $value)
 {
-    if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
-    else if($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
+	if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
+	else if($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
 }
 
-// Parse the template as far as possible, then do the rest manually 
+// Parse the template as far as possible, then do the rest manually
 $app->tpl_defaults();
 $parsed_tpl = $app->tpl->grab();
 
@@ -129,20 +129,20 @@
 $domains_tpl = '';
 if(!empty($domains))
 {
-    $set = array();
-    $set[] = '<select name="main_domain" id="main_domain" class="selectInput">';
-    foreach($domains as $domain)
-    {
-        $selected = '';
-        if((count($_POST) > 1)
-        && (isset($result['input']['main_domain']))
-        && ($result['input']['main_domain'] == $domain))
-            $selected = ' selected ';
-        $set[] = '<option value="'.$domain.'" '.$selected.'>'.$domain.'</option>';
-    }
-    $set[] = '</select>';
-    
-    $domains_tpl = implode("\n", $set);
+	$set = array();
+	$set[] = '<select name="main_domain" id="main_domain" class="selectInput">';
+	foreach($domains as $domain)
+	{
+		$selected = '';
+		if((count($_POST) > 1)
+			&& (isset($result['input']['main_domain']))
+			&& ($result['input']['main_domain'] == $domain))
+			$selected = ' selected ';
+		$set[] = '<option value="'.$domain.'" '.$selected.'>'.$domain.'</option>';
+	}
+	$set[] = '</select>';
+
+	$domains_tpl = implode("\n", $set);
 }
 $parsed_tpl = str_replace('DOMAIN_LIST_SPACE', $domains_tpl, $parsed_tpl);
 
@@ -150,62 +150,62 @@
 $settings_tpl = '';
 if(!empty($settings))
 {
-    $set = array();
-    $set[] = '<legend>'.$app->lng('package_settings_txt').'</legend>';
-    foreach($settings as $setting)
-    {
-        $set[] = '<div class="ctrlHolder">';
-        $set[] = '<label for="'.$setting['SettingID'].'">'.$setting['SettingName'].'</label>';
-        if($setting['SettingInputType'] == 'string' || $setting['SettingInputType'] == 'password')
-        {
-            $input_type = ($setting['SettingInputType'] == 'string') ? 'text' : 'password';
-              
-            $input_value = '';
-            if((count($_POST) > 1) 
-            && (isset($result['input'][$setting['SettingID']]))) 
-                $input_value = $result['input'][$setting['SettingID']];
-            else $input_value = @$setting['SettingDefaultValue'];
-            
-            $set[] = '<input type="'.$input_type.'" class="textInput" name="'.$setting['SettingID'].'" maxlength="'.$setting['SettingMaxLength'].'" id="'.$setting['SettingID'].'" value="'.$input_value.'" />
+	$set = array();
+	$set[] = '<legend>'.$app->lng('package_settings_txt').'</legend>';
+	foreach($settings as $setting)
+	{
+		$set[] = '<div class="ctrlHolder">';
+		$set[] = '<label for="'.$setting['SettingID'].'">'.$setting['SettingName'].'</label>';
+		if($setting['SettingInputType'] == 'string' || $setting['SettingInputType'] == 'password')
+		{
+			$input_type = ($setting['SettingInputType'] == 'string') ? 'text' : 'password';
+
+			$input_value = '';
+			if((count($_POST) > 1)
+				&& (isset($result['input'][$setting['SettingID']])))
+				$input_value = $result['input'][$setting['SettingID']];
+			else $input_value = @$setting['SettingDefaultValue'];
+
+			$set[] = '<input type="'.$input_type.'" class="textInput" name="'.$setting['SettingID'].'" maxlength="'.$setting['SettingMaxLength'].'" id="'.$setting['SettingID'].'" value="'.$input_value.'" />
                 <p class="formHint">'.$setting['SettingDescription'].'</p>';
-        }
-        else if($setting['SettingInputType'] == 'checkbox')
-        {
-            $checked = '';
-            if((count($_POST) > 1) 
-            && (isset($result['input'][$setting['SettingID']]) 
-            && ($result['input'][$setting['SettingID']] == 'true'))) 
-                $checked = 'checked ';
-            else if($setting['SettingDefaultValue'] == '1') $checked = 'checked ';
-            
-            $set[] = '<input type="checkbox" id="'.$setting['SettingID'].'" name="'.$setting['SettingID'].'" '.$checked.'/>
+		}
+		else if($setting['SettingInputType'] == 'checkbox')
+			{
+				$checked = '';
+				if((count($_POST) > 1)
+					&& (isset($result['input'][$setting['SettingID']])
+						&& ($result['input'][$setting['SettingID']] == 'true')))
+					$checked = 'checked ';
+				else if($setting['SettingDefaultValue'] == '1') $checked = 'checked ';
+
+					$set[] = '<input type="checkbox" id="'.$setting['SettingID'].'" name="'.$setting['SettingID'].'" '.$checked.'/>
                 <p class="formHint">'.$setting['SettingDescription'].'</p>';
-        }
-        else if($setting['SettingInputType'] == 'select')
-        {
-            $set[] =  '<select size="1" class="selectInput" name="'.$setting['SettingID'].'">';
-            foreach($setting['SettingChoices'] as $choice)
-            {
-                $selected = '';
-                if((count($_POST) > 1)
-                && (isset($result['input'][$setting['SettingID']])))
-                { 
-                    if($result['input'][$setting['SettingID']] == $choice['EnumID'])
-                        $selected = 'selected ';
-                }
-                else if($setting['SettingDefaultValue'] == $choice['EnumID']) $selected = 'selected ';
-                
-                $set[] = '<option value="'.$choice['EnumID'].'" '.$selected.'>'.$choice['EnumName'].'</option>';
-            }
-            $set[] = '</select>
+			}
+		else if($setting['SettingInputType'] == 'select')
+			{
+				$set[] =  '<select size="1" class="selectInput" name="'.$setting['SettingID'].'">';
+				foreach($setting['SettingChoices'] as $choice)
+				{
+					$selected = '';
+					if((count($_POST) > 1)
+						&& (isset($result['input'][$setting['SettingID']])))
+					{
+						if($result['input'][$setting['SettingID']] == $choice['EnumID'])
+							$selected = 'selected ';
+					}
+					else if($setting['SettingDefaultValue'] == $choice['EnumID']) $selected = 'selected ';
+
+						$set[] = '<option value="'.$choice['EnumID'].'" '.$selected.'>'.$choice['EnumName'].'</option>';
+				}
+				$set[] = '</select>
                 <p class="formHint">'.$setting['SettingDescription'].'</p>';
-        }
-        
-        $set[] = '</div>';
-    }
-    $settings_tpl = implode("\n", $set);
+			}
+
+		$set[] = '</div>';
+	}
+	$settings_tpl = implode("\n", $set);
 }
 $parsed_tpl = str_replace('PKG_SETTINGS_SPACE', $settings_tpl, $parsed_tpl);
 
 echo $parsed_tpl;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_installedpackages_list.php b/interface/web/sites/aps_installedpackages_list.php
index 4f3c765..418cc43 100644
--- a/interface/web/sites/aps_installedpackages_list.php
+++ b/interface/web/sites/aps_installedpackages_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 //require_once('classes/class.base.php'); // for constants
 $app->load('aps_base');
 
@@ -38,21 +38,21 @@
 
 // Check the module permissions
 $app->auth->check_module_permissions('sites');
-        
+
 // Load needed classes
 $app->uses('tpl,tform,listform,listform_actions');
 
 // Show further information only to admins or resellers
 if($_SESSION['s']['user']['typ'] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid']))
-    $app->tpl->setVar('is_noclient', 1);
+	$app->tpl->setVar('is_noclient', 1);
 
 // Show each user the own packages (if not admin)
 $client_ext = '';
 $is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
 if(!$is_admin)
 {
-    $cid = $app->db->queryOneRecord('SELECT client_id FROM client WHERE username = "'.$app->db->quote($_SESSION['s']['user']['username']).'";');
-    //$client_ext = ' AND aps_instances.customer_id = '.$cid['client_id'];
+	$cid = $app->db->queryOneRecord('SELECT client_id FROM client WHERE username = "'.$app->db->quote($_SESSION['s']['user']['username']).'";');
+	//$client_ext = ' AND aps_instances.customer_id = '.$cid['client_id'];
 	$client_ext = ' AND '.$app->tform->getAuthSQL('r', 'aps_instances');
 }
 $app->listform_actions->SQLExtWhere = 'aps_instances.package_id = aps_packages.id'.$client_ext;
@@ -62,81 +62,81 @@
 // queries over multiple tables so we construct them ourselves
 $_SESSION['s']['form']['return_to'] = '';
 
-// Load the list template		
+// Load the list template
 $app->listform->loadListDef($list_def_file);
-if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm')) 
+if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm'))
 {
-$app->uses('listform_tpl_generator');
-$app->listform_tpl_generator->buildHTML($app->listform->listDef);
+	$app->uses('listform_tpl_generator');
+	$app->listform_tpl_generator->buildHTML($app->listform->listDef);
 }
 $app->tpl->newTemplate("listpage.tpl.htm");
 $app->tpl->setInclude('content_tpl', 'templates/'.$app->listform->listDef["name"].'_list.htm');
 
 // Build the WHERE query for search
 $sql_where = '';
-if($app->listform_actions->SQLExtWhere != '') 
-  $sql_where .= ' '.$app->listform_actions->SQLExtWhere.' and';
+if($app->listform_actions->SQLExtWhere != '')
+	$sql_where .= ' '.$app->listform_actions->SQLExtWhere.' and';
 $sql_where = $app->listform->getSearchSQL($sql_where);
 $app->tpl->setVar($app->listform->searchValues);
-		
+
 // Paging
 $limit_sql = $app->listform->getPagingSQL($sql_where);
 $app->tpl->setVar('paging', $app->listform->pagingHTML);
 
 if(!$is_admin) {
-// Our query over multiple tables
-$query = "SELECT aps_instances.id AS id, aps_instances.package_id AS package_id, 
-                 aps_instances.customer_id AS customer_id, client.username AS customer_name, 
-                 aps_instances.instance_status AS instance_status, aps_packages.name AS package_name, 
-                 aps_packages.version AS package_version, aps_packages.release AS package_release, 
-                 aps_packages.package_status AS package_status, 
-              CONCAT((SELECT value FROM aps_instances_settings WHERE name='main_domain' AND instance_id = aps_instances.id), 
-                 '/', (SELECT value FROM aps_instances_settings WHERE name='main_location' AND instance_id = aps_instances.id)) 
-                  AS install_location  
-          FROM aps_instances, aps_packages, client 
+	// Our query over multiple tables
+	$query = "SELECT aps_instances.id AS id, aps_instances.package_id AS package_id,
+                 aps_instances.customer_id AS customer_id, client.username AS customer_name,
+                 aps_instances.instance_status AS instance_status, aps_packages.name AS package_name,
+                 aps_packages.version AS package_version, aps_packages.release AS package_release,
+                 aps_packages.package_status AS package_status,
+              CONCAT((SELECT value FROM aps_instances_settings WHERE name='main_domain' AND instance_id = aps_instances.id),
+                 '/', (SELECT value FROM aps_instances_settings WHERE name='main_location' AND instance_id = aps_instances.id))
+                  AS install_location
+          FROM aps_instances, aps_packages, client
           WHERE client.client_id = aps_instances.customer_id AND ".$sql_where." ".$app->listform_actions->SQLOrderBy." ".$limit_sql;
 } else {
-$query = "SELECT aps_instances.id AS id, aps_instances.package_id AS package_id,  
+	$query = "SELECT aps_instances.id AS id, aps_instances.package_id AS package_id,
                  aps_instances.customer_id AS customer_id, sys_group.name AS customer_name,
-				 aps_instances.instance_status AS instance_status, aps_packages.name AS package_name, 
-                 aps_packages.version AS package_version, aps_packages.release AS package_release, 
-                 aps_packages.package_status AS package_status, 
-              CONCAT((SELECT value FROM aps_instances_settings WHERE name='main_domain' AND instance_id = aps_instances.id), 
-                 '/', (SELECT value FROM aps_instances_settings WHERE name='main_location' AND instance_id = aps_instances.id)) 
-                  AS install_location  
-          FROM aps_instances, aps_packages, sys_group 
+				 aps_instances.instance_status AS instance_status, aps_packages.name AS package_name,
+                 aps_packages.version AS package_version, aps_packages.release AS package_release,
+                 aps_packages.package_status AS package_status,
+              CONCAT((SELECT value FROM aps_instances_settings WHERE name='main_domain' AND instance_id = aps_instances.id),
+                 '/', (SELECT value FROM aps_instances_settings WHERE name='main_location' AND instance_id = aps_instances.id))
+                  AS install_location
+          FROM aps_instances, aps_packages, sys_group
           WHERE sys_group.client_id = aps_instances.customer_id AND ".$sql_where." ".$app->listform_actions->SQLOrderBy." ".$limit_sql;
 
-}	  
+}
 
 $records = $app->db->queryAllRecords($query);
 $app->listform_actions->DataRowColor = '#FFFFFF';
 
-// Re-form all result entries and add extra entries 
+// Re-form all result entries and add extra entries
 $records_new = '';
-if(is_array($records)) 
+if(is_array($records))
 {
-    $app->listform_actions->idx_key = $app->listform->listDef["table_idx"]; 
-    foreach($records as $rec)
-    {
-        // Set an abbreviated install location to beware the page layout
-        $ils = '';
-        if(strlen($rec['Install_location']) >= 38) $ils = substr($rec['Install_location'], 0,  35).'...';
-        else $ils = $rec['install_location'];
-        $rec['install_location_short'] = $ils; 
-        
-        // Also set a boolean-like variable for the reinstall button (vlibTemplate doesn't allow variable comparisons)
-        // For a reinstall, the package must be already installed successfully and (still be) enabled
-        if($rec['instance_status'] == INSTANCE_SUCCESS && $rec['package_status'] == PACKAGE_ENABLED) 
-            $rec['reinstall_possible'] = 'true';
-        // Of course an instance can only then be removed when it's not already tagged for removal
-        if($rec['instance_status'] != INSTANCE_REMOVE && $rec['instance_status'] != INSTANCE_INSTALL) 
-            $rec['delete_possible'] = 'true';
-        
-        $records_new[] = $app->listform_actions->prepareDataRow($rec);
-    }
+	$app->listform_actions->idx_key = $app->listform->listDef["table_idx"];
+	foreach($records as $rec)
+	{
+		// Set an abbreviated install location to beware the page layout
+		$ils = '';
+		if(strlen($rec['Install_location']) >= 38) $ils = substr($rec['Install_location'], 0,  35).'...';
+		else $ils = $rec['install_location'];
+		$rec['install_location_short'] = $ils;
+
+		// Also set a boolean-like variable for the reinstall button (vlibTemplate doesn't allow variable comparisons)
+		// For a reinstall, the package must be already installed successfully and (still be) enabled
+		if($rec['instance_status'] == INSTANCE_SUCCESS && $rec['package_status'] == PACKAGE_ENABLED)
+			$rec['reinstall_possible'] = 'true';
+		// Of course an instance can only then be removed when it's not already tagged for removal
+		if($rec['instance_status'] != INSTANCE_REMOVE && $rec['instance_status'] != INSTANCE_INSTALL)
+			$rec['delete_possible'] = 'true';
+
+		$records_new[] = $app->listform_actions->prepareDataRow($rec);
+	}
 }
 $app->tpl->setLoop('records', $records_new);
 
 $app->listform_actions->onShow();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_packagedetails_show.php b/interface/web/sites/aps_packagedetails_show.php
index 94f5eaa..7f8ca6b 100644
--- a/interface/web/sites/aps_packagedetails_show.php
+++ b/interface/web/sites/aps_packagedetails_show.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 //require_once('classes/class.guicontroller.php');
 $app->load('aps_guicontroller');
 
@@ -43,7 +43,7 @@
 
 // Load the language file
 $lngfile = 'lib/lang/'.$_SESSION['s']['language'].'_aps.lng';
-require_once($lngfile);
+require_once $lngfile;
 $app->tpl->setVar($wb);
 
 $gui = new ApsGUIController($app);
@@ -53,14 +53,14 @@
 // Note: It's intended that here is no strict ID check (see below)
 if(isset($pkg_id))
 {
-    $newest_pkg_id = $gui->getNewestPackageID($pkg_id);
-    if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
+	$newest_pkg_id = $gui->getNewestPackageID($pkg_id);
+	if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
 }
 
 // Make sure an integer ID is given
 $adminflag = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
 if(!isset($pkg_id) || !$gui->isValidPackageID($pkg_id, $adminflag))
-    $app->error($app->lng('Invalid ID'));
+	$app->error($app->lng('Invalid ID'));
 
 // Get package details
 $details = $gui->getPackageDetails($pkg_id);
@@ -70,31 +70,31 @@
 $next_tab = 'details';
 if(isset($_POST['next_tab']) || isset($_GET['next_tab']))
 {
-    $tab = (isset($_POST['next_tab']) ? $_POST['next_tab'] : $_GET['next_tab']);
-    switch($tab)
-    {
-        case 'details': $next_tab = 'details'; break;
-        case 'settings': $next_tab = 'settings'; break;
-        case 'changelog': $next_tab = 'changelog'; break;
-        case 'screenshots': $next_tab = 'screenshots'; break;
-        default: $next_tab = 'details';
-    }
+	$tab = (isset($_POST['next_tab']) ? $_POST['next_tab'] : $_GET['next_tab']);
+	switch($tab)
+	{
+	case 'details': $next_tab = 'details'; break;
+	case 'settings': $next_tab = 'settings'; break;
+	case 'changelog': $next_tab = 'changelog'; break;
+	case 'screenshots': $next_tab = 'screenshots'; break;
+	default: $next_tab = 'details';
+	}
 }
 $app->tpl->setVar('next_tab', $next_tab);
 
 // Parse the package details to the template
 foreach($details as $key => $value)
 {
-    if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
-    else // Special cases
-    {
-        if($key == 'Changelog') $app->tpl->setLoop('pkg_changelog', $details['Changelog']);
-        elseif($key == 'Screenshots') $app->tpl->setLoop('pkg_screenshots', $details['Screenshots']);
-        elseif($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
-    }
+	if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
+	else // Special cases
+		{
+		if($key == 'Changelog') $app->tpl->setLoop('pkg_changelog', $details['Changelog']);
+		elseif($key == 'Screenshots') $app->tpl->setLoop('pkg_screenshots', $details['Screenshots']);
+		elseif($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
+	}
 }
 //print_r($details['Requirements PHP settings']);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_update_packagelist.php b/interface/web/sites/aps_update_packagelist.php
index 10de873..a1278d0 100644
--- a/interface/web/sites/aps_update_packagelist.php
+++ b/interface/web/sites/aps_update_packagelist.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -42,16 +42,16 @@
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_aps_update_packagelist.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/cron_del.php b/interface/web/sites/cron_del.php
index 484e507..69864ea 100644
--- a/interface/web/sites/cron_del.php
+++ b/interface/web/sites/cron_del.php
@@ -40,8 +40,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -53,12 +53,13 @@
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php
index fea4a7b..76733ff 100644
--- a/interface/web/sites/cron_edit.php
+++ b/interface/web/sites/cron_edit.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -50,10 +50,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_cron')) {
@@ -63,35 +63,35 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_cron_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
-        if($this->id > 0) {
-            //* we are editing a existing record
-            $app->tpl->setVar("edit_disabled", 1);
-            $app->tpl->setVar("parent_domain_id_value", $this->dataRecord["parent_domain_id"]);
-        } else {
-            $app->tpl->setVar("edit_disabled", 0);
-        }
-		
+
+		if($this->id > 0) {
+			//* we are editing a existing record
+			$app->tpl->setVar("edit_disabled", 1);
+			$app->tpl->setVar("parent_domain_id_value", $this->dataRecord["parent_domain_id"]);
+		} else {
+			$app->tpl->setVar("edit_disabled", 0);
+		}
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_cron, limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-		
+
 			// When the record is updated
 			if($this->id > 0) {
-			// When the record is inserted
+				// When the record is inserted
 			} else {
 				// Check if the user may add another cron job.
 				if($client["limit_cron"] >= 0) {
@@ -102,21 +102,21 @@
 				}
 			}
 		}
-		
-        // Get the record of the parent domain
-        $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-        
-        // Set fixed values
-        $this->dataRecord["server_id"] = $parent_domain["server_id"];
 
-        //* get type of command
-        $command = $this->dataRecord["command"];
-        if(preg_match("'^http(s)?:\/\/'i", $command)) {
-            $this->dataRecord["type"] = 'url';
-        } else {
-            $domain_owner = $app->db->queryOneRecord("SELECT limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($parent_domain["sys_groupid"]));
-            //* True when the site is assigned to a client
+		// Get the record of the parent domain
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
+		// Set fixed values
+		$this->dataRecord["server_id"] = $parent_domain["server_id"];
+
+		//* get type of command
+		$command = $this->dataRecord["command"];
+		if(preg_match("'^http(s)?:\/\/'i", $command)) {
+			$this->dataRecord["type"] = 'url';
+		} else {
+			$domain_owner = $app->db->queryOneRecord("SELECT limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($parent_domain["sys_groupid"]));
+			//* True when the site is assigned to a client
 			if(isset($domain_owner["limit_cron_type"])) {
 				if($domain_owner["limit_cron_type"] == 'full') {
 					$this->dataRecord["type"] = 'full';
@@ -127,84 +127,84 @@
 				//* True when the site is assigned to the admin
 				$this->dataRecord["type"] = 'full';
 			}
-        }
-        
-        parent::onSubmit();
+		}
+
+		parent::onSubmit();
 	}
-	
-    function onUpdateSave($sql) {
-        global $app;
-        
-        $has_error = false;
-        //* last chance to stop this, so check frequency limit!
-        if($_SESSION["s"]["user"]["typ"] != 'admin') {
-            // Get the limits of the client
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-            $client = $app->db->queryOneRecord("SELECT limit_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-        
-            if($client["limit_cron_frequency"] > 1) {
-                if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
-                    $app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
-                    $has_error = true;
-                }
-            }
-        }
-        
-        if($has_error == true) {
-            parent::onError();
-            exit;
-        }
-        else parent::onUpdateSave($sql);
-    }
-    
-    function onInsertSave($sql) {
-        global $app;
-    
-        $has_error = false;
-        //* last chance to stop this, so check frequency limit!
-        if($_SESSION["s"]["user"]["typ"] != 'admin') {
-            // Get the limits of the client
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-            $client = $app->db->queryOneRecord("SELECT limit_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-        
-            if($client["limit_cron_frequency"] > 1) {
-                if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
-                    $app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
-                    $has_error = true;
-                }
-            }
-        }
-        
-        if($has_error == true) {
-            parent::onError();
-            exit;
-        } else {
+
+	function onUpdateSave($sql) {
+		global $app;
+
+		$has_error = false;
+		//* last chance to stop this, so check frequency limit!
+		if($_SESSION["s"]["user"]["typ"] != 'admin') {
+			// Get the limits of the client
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT limit_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+			if($client["limit_cron_frequency"] > 1) {
+				if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
+					$app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
+					$has_error = true;
+				}
+			}
+		}
+
+		if($has_error == true) {
+			parent::onError();
+			exit;
+		}
+		else parent::onUpdateSave($sql);
+	}
+
+	function onInsertSave($sql) {
+		global $app;
+
+		$has_error = false;
+		//* last chance to stop this, so check frequency limit!
+		if($_SESSION["s"]["user"]["typ"] != 'admin') {
+			// Get the limits of the client
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT limit_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+			if($client["limit_cron_frequency"] > 1) {
+				if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
+					$app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
+					$has_error = true;
+				}
+			}
+		}
+
+		if($has_error == true) {
+			parent::onError();
+			exit;
+		} else {
 			return parent::onInsertSave($sql);
 		}
-    }
-    
+	}
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
-        $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
-        $server_id = $web["server_id"];
-        
-        // The cron shall be owned by the same group then the website
-        $sys_groupid = $web['sys_groupid'];
-        
-        $sql = "UPDATE cron SET server_id = $server_id, sys_groupid = '$sys_groupid' WHERE id = ".$this->id;
-        $app->db->query($sql);
+
+		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
+		$server_id = $web["server_id"];
+
+		// The cron shall be owned by the same group then the website
+		$sys_groupid = $web['sys_groupid'];
+
+		$sql = "UPDATE cron SET server_id = $server_id, sys_groupid = '$sys_groupid' WHERE id = ".$this->id;
+		$app->db->query($sql);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
-		
+
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/cron_list.php b/interface/web/sites/cron_list.php
index dcd9a54..70fe68c 100644
--- a/interface/web/sites/cron_list.php
+++ b/interface/web/sites/cron_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -20,4 +20,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_del.php b/interface/web/sites/database_del.php
index d3c00cd..ba079e2 100644
--- a/interface/web/sites/database_del.php
+++ b/interface/web/sites/database_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,14 +49,15 @@
 class page_action extends tform_actions {
 	function onBeforeDelete() {
 		global $app; $conf;
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-        
-        $app->uses('sites_database_plugin');
-        //$app->sites_database_plugin->processDatabaseDelete($this->id);
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
+		$app->uses('sites_database_plugin');
+		//$app->sites_database_plugin->processDatabaseDelete($this->id);
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 99e0bbd..cdabf7a 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -77,7 +77,7 @@
 
 			// Set the webserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_dbserver]");
-			$app->tpl->setVar("server_id","<option value='$client[default_dbserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_dbserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -85,10 +85,10 @@
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.client_id, limit_web_domain, default_webserver, contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Set the webserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
-			$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_webserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 		} else {
@@ -108,19 +108,19 @@
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		
+
 		//* Get the database name and database user prefix
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
-		
+
 		if ($this->dataRecord['database_name'] != ""){
 			/* REMOVE the restriction */
 			$app->tpl->setVar("database_name", $app->tools_sites->removePrefix($this->dataRecord['database_name'], $this->dataRecord['database_name_prefix'], $dbname_prefix));
 		}
-        
-        $app->tpl->setVar("database_name_prefix", $app->tools_sites->getPrefix($this->dataRecord['database_name_prefix'], $dbname_prefix, $global_config['dbname_prefix']));
-		
+
+		$app->tpl->setVar("database_name_prefix", $app->tools_sites->getPrefix($this->dataRecord['database_name_prefix'], $dbname_prefix, $global_config['dbname_prefix']));
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -136,9 +136,9 @@
 	function onSubmit() {
 		global $app, $conf;
 
-        $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-        
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -166,21 +166,21 @@
 
 			}
 		} else {
-            // check if client of database parent domain is client of db user!
-            $web_group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'");
-            if($this->dataRecord['database_user_id']) {
-                $group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_user_id'])."'");
-                if($group['sys_groupid'] != $web_group['sys_groupid']) {
-                    $app->error($app->tform->wordbook['database_client_differs_txt']);
-                }
-            }
-            if($this->dataRecord['database_ro_user_id']) {
-                $group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_ro_user_id'])."'");
-                if($group['sys_groupid'] != $web_group['sys_groupid']) {
-                    $app->error($app->tform->wordbook['database_client_differs_txt']);
-                }
-            }
-        }
+			// check if client of database parent domain is client of db user!
+			$web_group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'");
+			if($this->dataRecord['database_user_id']) {
+				$group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_user_id'])."'");
+				if($group['sys_groupid'] != $web_group['sys_groupid']) {
+					$app->error($app->tform->wordbook['database_client_differs_txt']);
+				}
+			}
+			if($this->dataRecord['database_ro_user_id']) {
+				$group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_ro_user_id'])."'");
+				if($group['sys_groupid'] != $web_group['sys_groupid']) {
+					$app->error($app->tform->wordbook['database_client_differs_txt']);
+				}
+			}
+		}
 
 
 		parent::onSubmit();
@@ -191,31 +191,31 @@
 
 		//* Site shall not be empty
 		if($this->dataRecord['parent_domain_id'] == 0) $app->tform->errorMessage .= $app->tform->lng("database_site_error_empty").'<br />';
-		
+
 		//* Get the database name and database user prefix
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
-		
+
 		//* Prevent that the database name and charset is changed
 		$old_record = $app->tform->getDataRecord($this->id);
-        $dbname_prefix = $app->tools_sites->getPrefix($old_record['database_name_prefix'], $dbname_prefix);
-        $this->dataRecord['database_name_prefix'] = $dbname_prefix;
-        
+		$dbname_prefix = $app->tools_sites->getPrefix($old_record['database_name_prefix'], $dbname_prefix);
+		$this->dataRecord['database_name_prefix'] = $dbname_prefix;
+
 		if($old_record["database_name"] != $dbname_prefix . $this->dataRecord["database_name"]) {
 			$app->tform->errorMessage .= $app->tform->wordbook["database_name_change_txt"].'<br />';
 		}
 		if($old_record["database_charset"] != $this->dataRecord["database_charset"]) {
 			$app->tform->errorMessage .= $app->tform->wordbook["database_charset_change_txt"].'<br />';
 		}
-		
-        if(!$this->dataRecord['database_user_id']) {
-            $app->tform->errorMessage .= $app->tform->wordbook["database_user_missing_txt"].'<br />';
-        }
-        
+
+		if(!$this->dataRecord['database_user_id']) {
+			$app->tform->errorMessage .= $app->tform->wordbook["database_user_missing_txt"].'<br />';
+		}
+
 		//* Database username and database name shall not be empty
 		if($this->dataRecord['database_name'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"].'<br />';
-		
+
 		//* Check if the server has been changed
 		// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
 		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -226,31 +226,31 @@
 			}
 		}
 		unset($old_record);
-		
-		if(strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) $app->tform->errorMessage .= str_replace('{db}',$dbname_prefix . $this->dataRecord['database_name'],$app->tform->wordbook["database_name_error_len"]).'<br />';
-		
+
+		if(strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) $app->tform->errorMessage .= str_replace('{db}', $dbname_prefix . $this->dataRecord['database_name'], $app->tform->wordbook["database_name_error_len"]).'<br />';
+
 		//* Check database name and user against blacklist
-		$dbname_blacklist = array($conf['db_database'],'mysql');
-		if(in_array($dbname_prefix . $this->dataRecord['database_name'],$dbname_blacklist)) {
+		$dbname_blacklist = array($conf['db_database'], 'mysql');
+		if(in_array($dbname_prefix . $this->dataRecord['database_name'], $dbname_blacklist)) {
 			$app->tform->errorMessage .= $app->lng('Database name not allowed.').'<br />';
 		}
-		
+
 		if ($app->tform->errorMessage == ''){
 			/* restrict the names if there is no error */
-            /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+			/* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
 			$this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
 		}
-		
+
 		//* Check for duplicates
 		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$this->dataRecord['database_name']."' AND server_id = '".$this->dataRecord["server_id"]."' AND database_id != '".$this->id."'");
 		if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->lng('database_name_error_unique').'<br />';
-		
-        // get the web server ip (parent domain)
-        $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
-        if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
-            // we need remote access rights for this server, so get it's ip address
-            $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
-            if($server_config['ip_address']!='') {
+
+		// get the web server ip (parent domain)
+		$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
+		if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
+			// we need remote access rights for this server, so get it's ip address
+			$server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
+			if($server_config['ip_address']!='') {
 				/*
                 if($this->dataRecord['remote_access'] != 'y') $this->dataRecord['remote_ips'] = '';
                 $this->dataRecord['remote_access'] = 'y';
@@ -258,7 +258,7 @@
                     $this->dataRecord['remote_ips'] .= ($this->dataRecord['remote_ips'] != '' ? ',' : '') . $server_config['ip_address'];
                 }
 				*/
-				
+
 				if($this->dataRecord['remote_access'] != 'y'){
 					$this->dataRecord['remote_ips'] = $server_config['ip_address'];
 					$this->dataRecord['remote_access'] = 'y';
@@ -267,25 +267,25 @@
 						if(preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
 							$this->dataRecord['remote_ips'] .= ',' . $server_config['ip_address'];
 						}
-                        $tmp = preg_split('/\s*,\s*/', $this->dataRecord['remote_ips']);
-                        $tmp = array_unique($tmp);
-                        $this->dataRecord['remote_ips'] = implode(',', $tmp);
-                        unset($tmp);
+						$tmp = preg_split('/\s*,\s*/', $this->dataRecord['remote_ips']);
+						$tmp = array_unique($tmp);
+						$this->dataRecord['remote_ips'] = implode(',', $tmp);
+						unset($tmp);
 					}
 				}
-            }
-        }
-        
-        
+			}
+		}
+
+
 		parent::onBeforeUpdate();
 	}
 
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
-		
+
 		//* Site shell not be empty
 		if($this->dataRecord['parent_domain_id'] == 0) $app->tform->errorMessage .= $app->tform->lng("database_site_error_empty").'<br />';
-		
+
 		//* Database username and database name shall not be empty
 		if($this->dataRecord['database_name'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"].'<br />';
 
@@ -293,32 +293,32 @@
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
-        $this->dataRecord['database_name_prefix'] = $dbname_prefix;
-		
-		if(strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) $app->tform->errorMessage .= str_replace('{db}',$dbname_prefix . $this->dataRecord['database_name'],$app->tform->wordbook["database_name_error_len"]).'<br />';
-		
+		$this->dataRecord['database_name_prefix'] = $dbname_prefix;
+
+		if(strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) $app->tform->errorMessage .= str_replace('{db}', $dbname_prefix . $this->dataRecord['database_name'], $app->tform->wordbook["database_name_error_len"]).'<br />';
+
 		//* Check database name and user against blacklist
-		$dbname_blacklist = array($conf['db_database'],'mysql');
-		if(in_array($dbname_prefix . $this->dataRecord['database_name'],$dbname_blacklist)) {
+		$dbname_blacklist = array($conf['db_database'], 'mysql');
+		if(in_array($dbname_prefix . $this->dataRecord['database_name'], $dbname_blacklist)) {
 			$app->tform->errorMessage .= $app->lng('Database name not allowed.').'<br />';
 		}
-		
+
 		/* restrict the names */
-        /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+		/* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
 		if ($app->tform->errorMessage == ''){
 			$this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
 		}
-		
+
 		//* Check for duplicates
 		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$this->dataRecord['database_name']."' AND server_id = '".$this->dataRecord["server_id"]."'");
 		if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->tform->lng('database_name_error_unique').'<br />';
 
-        // get the web server ip (parent domain)
-        $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
-        if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
-            // we need remote access rights for this server, so get it's ip address
-            $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
-            if($server_config['ip_address']!='') {
+		// get the web server ip (parent domain)
+		$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
+		if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
+			// we need remote access rights for this server, so get it's ip address
+			$server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
+			if($server_config['ip_address']!='') {
 				/*
                 if($this->dataRecord['remote_access'] != 'y') $this->dataRecord['remote_ips'] = '';
                 $this->dataRecord['remote_access'] = 'y';
@@ -326,7 +326,7 @@
                     $this->dataRecord['remote_ips'] .= ($this->dataRecord['remote_ips'] != '' ? ',' : '') . $server_config['ip_address'];
                 }
 				*/
-				
+
 				if($this->dataRecord['remote_access'] != 'y'){
 					$this->dataRecord['remote_ips'] = $server_config['ip_address'];
 					$this->dataRecord['remote_access'] = 'y';
@@ -335,55 +335,55 @@
 						if(preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
 							$this->dataRecord['remote_ips'] .= ',' . $server_config['ip_address'];
 						}
-                        $tmp = preg_split('/\s*,\s*/', $this->dataRecord['remote_ips']);
-                        $tmp = array_unique($tmp);
-                        $this->dataRecord['remote_ips'] = implode(',', $tmp);
-                        unset($tmp);
+						$tmp = preg_split('/\s*,\s*/', $this->dataRecord['remote_ips']);
+						$tmp = array_unique($tmp);
+						$this->dataRecord['remote_ips'] = implode(',', $tmp);
+						unset($tmp);
 					}
 				}
-            }
-        }
-        
+			}
+		}
+
 		parent::onBeforeInsert();
 	}
 
-    function onInsertSave($sql) {
-        global $app, $conf;
-        
-        $app->uses('sites_database_plugin');
-        
-        //$app->sites_database_plugin->processDatabaseInsert($this);
-        
-        $app->db->query($sql);
-        if($app->db->errorMessage != '') die($app->db->errorMessage);
-        $new_id = $app->db->insertID();
-        
-        return $new_id;
-    }
+	function onInsertSave($sql) {
+		global $app, $conf;
 
-    function onUpdateSave($sql) {
-        global $app;
-        if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(),$this->id)) {
-            
-            $app->uses('sites_database_plugin');
-            //$app->sites_database_plugin->processDatabaseUpdate($this);
+		$app->uses('sites_database_plugin');
 
-            $app->db->query($sql);
-            if($app->db->errorMessage != '') die($app->db->errorMessage);
-        }
-    }
-    
+		//$app->sites_database_plugin->processDatabaseInsert($this);
+
+		$app->db->query($sql);
+		if($app->db->errorMessage != '') die($app->db->errorMessage);
+		$new_id = $app->db->insertID();
+
+		return $new_id;
+	}
+
+	function onUpdateSave($sql) {
+		global $app;
+		if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(), $this->id)) {
+
+			$app->uses('sites_database_plugin');
+			//$app->sites_database_plugin->processDatabaseUpdate($this);
+
+			$app->db->query($sql);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+		}
+	}
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		if($this->dataRecord["parent_domain_id"] > 0) {
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
-		
+
 			//* The Database user shall be owned by the same group then the website
 			$sys_groupid = $web['sys_groupid'];
 			$backup_interval = $web['backup_interval'];
 			$backup_copies = $web['backup_copies'];
-		
+
 			$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
 			$app->db->query($sql);
 		}
@@ -394,12 +394,12 @@
 
 		if($this->dataRecord["parent_domain_id"] > 0) {
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
-		
+
 			//* The Database user shall be owned by the same group then the website
 			$sys_groupid = $web['sys_groupid'];
 			$backup_interval = $web['backup_interval'];
 			$backup_copies = $web['backup_copies'];
-		
+
 			$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
 			$app->db->query($sql);
 		}
@@ -411,4 +411,4 @@
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_list.php b/interface/web/sites/database_list.php
index 42c2005..dd0241f 100644
--- a/interface/web/sites/database_list.php
+++ b/interface/web/sites/database_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,22 +48,22 @@
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('sites');
-		
+
 		if($global_config['dblist_phpmyadmin_link'] == 'y') {
-			$app->tpl->setVar('dblist_phpmyadmin_link',1);
+			$app->tpl->setVar('dblist_phpmyadmin_link', 1);
 		} else {
-			$app->tpl->setVar('dblist_phpmyadmin_link',0);
+			$app->tpl->setVar('dblist_phpmyadmin_link', 0);
 		}
-		
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
@@ -71,4 +71,4 @@
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_phpmyadmin.php b/interface/web/sites/database_phpmyadmin.php
index e77c5df..5e640df 100644
--- a/interface/web/sites/database_phpmyadmin.php
+++ b/interface/web/sites/database_phpmyadmin.php
@@ -28,8 +28,8 @@
 */
 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -38,7 +38,7 @@
  *  get the id of the database (must be int!)
  */
 if (!isset($_GET['id'])){
-    die ("No DB selected!");
+	die ("No DB selected!");
 }
 $databaseId = $app->functions->intval($_GET['id']);
 
@@ -48,23 +48,23 @@
 $dbData = $app->db->queryOneRecord("SELECT server_id, database_name FROM web_database WHERE database_id = " . $databaseId);
 $serverId = $app->functions->intval($dbData['server_id']);
 if ($serverId == 0){
-    die ("No DB-Server found!");
+	die ("No DB-Server found!");
 }
 $serverData = $app->db->queryOneRecord(
-    "SELECT server_name FROM server WHERE server_id = " .
-    $serverId);
-	
+	"SELECT server_name FROM server WHERE server_id = " .
+	$serverId);
+
 $app->uses('getconf');
 $global_config = $app->getconf->get_global_config('sites');
-$web_config = $app->getconf->get_server_config($serverId,'web');
+$web_config = $app->getconf->get_server_config($serverId, 'web');
 
 /*
  * We only redirect to the login-form, so there is no need, to check any rights
  */
- 
+
 if($global_config['phpmyadmin_url'] != '') {
 	$phpmyadmin_url = $global_config['phpmyadmin_url'];
-	$phpmyadmin_url = str_replace(array('[SERVERNAME]', '[DATABASENAME]'),array($serverData['server_name'], $dbData['database_name']),$phpmyadmin_url);
+	$phpmyadmin_url = str_replace(array('[SERVERNAME]', '[DATABASENAME]'), array($serverData['server_name'], $dbData['database_name']), $phpmyadmin_url);
 	header('Location: '.$phpmyadmin_url);
 } else {
 	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
@@ -75,4 +75,4 @@
 	}
 }
 exit;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_user_del.php b/interface/web/sites/database_user_del.php
index 7931fb7..3667539 100644
--- a/interface/web/sites/database_user_del.php
+++ b/interface/web/sites/database_user_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -50,34 +50,35 @@
 class page_action extends tform_actions {
 	function onBeforeDelete() {
 		global $app; $conf;
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-        
-        $old_record = $app->tform->getDataRecord($this->id);
-        
-        /* we cannot use datalogDelete here, as we need to set server_id to 0 */
-        $app->db->query("DELETE FROM `web_database_user` WHERE $index_field = '$index_value'");
-        $new_rec = array();
-        $old_record['server_id'] = 0;
-        $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $this->id, $old_record, $new_rec);
-    }
-    
-    function onAfterDelete() { // this has to be done on AFTER delete, because we need the db user still in the database when the server plugin processes the datalog
-		global $app; $conf;
-		
-		//* Update all records that belog to this user
-        $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogUpdate('web_database','database_user_id=NULL','database_id', $rec['database_id']);
-            
-        }
-        $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogUpdate('web_database','database_ro_user_id=NULL','database_id', $rec['database_id']);
-        }
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
+		$old_record = $app->tform->getDataRecord($this->id);
+
+		/* we cannot use datalogDelete here, as we need to set server_id to 0 */
+		$app->db->query("DELETE FROM `web_database_user` WHERE $index_field = '$index_value'");
+		$new_rec = array();
+		$old_record['server_id'] = 0;
+		$app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $this->id, $old_record, $new_rec);
 	}
+
+	function onAfterDelete() { // this has to be done on AFTER delete, because we need the db user still in the database when the server plugin processes the datalog
+		global $app; $conf;
+
+		//* Update all records that belog to this user
+		$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogUpdate('web_database', 'database_user_id=NULL', 'database_id', $rec['database_id']);
+
+		}
+		$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogUpdate('web_database', 'database_ro_user_id=NULL', 'database_id', $rec['database_id']);
+		}
+	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_user_edit.php b/interface/web/sites/database_user_edit.php
index 1b71196..884ef87 100644
--- a/interface/web/sites/database_user_edit.php
+++ b/interface/web/sites/database_user_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -57,31 +57,31 @@
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		
+
 		//* Get the database user prefix
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
-		
-        if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+
+		if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.company_name, client.contact_name, client.client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-            
-            // Fill the client select field
-            $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
-            $records = $app->db->queryAllRecords($sql);
-            $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
-            $client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
-            //$tmp_data_record = $app->tform->getDataRecord($this->id);
-            if(is_array($records)) {
-                foreach( $records as $rec) {
-                    $selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
-                    $client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
-                }
-            }
-            $app->tpl->setVar("client_group_id",$client_select);
-        } elseif($_SESSION["s"]["user"]["typ"] == 'admin') {
+
+			// Fill the client select field
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+			$records = $app->db->queryAllRecords($sql);
+			$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
+			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
+			//$tmp_data_record = $app->tform->getDataRecord($this->id);
+			if(is_array($records)) {
+				foreach( $records as $rec) {
+					$selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
+					$client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
+				}
+			}
+			$app->tpl->setVar("client_group_id", $client_select);
+		} elseif($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Fill the client select field
 			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 			$clients = $app->db->queryAllRecords($sql);
@@ -94,28 +94,28 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-        }
-        
-        
+			$app->tpl->setVar("client_group_id", $client_select);
+		}
+
+
 		if ($this->dataRecord['database_user'] != ""){
 			/* REMOVE the restriction */
 			$app->tpl->setVar("database_user", $app->tools_sites->removePrefix($this->dataRecord['database_user'], $this->dataRecord['database_user_prefix'], $dbuser_prefix));
 		}
-		
-    
+
+
 		$app->tpl->setVar("database_user_prefix", $app->tools_sites->getPrefix($this->dataRecord['database_user_prefix'], $dbuser_prefix, $global_config['dbuser_prefix']));
-		
+
 		parent::onShowEnd();
 	}
-    
-    function onSubmit() {
-        global $app;
-        
-        if($_SESSION['s']['user']['typ'] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
-        
-        parent::onSubmit();
-    }
+
+	function onSubmit() {
+		global $app;
+
+		if($_SESSION['s']['user']['typ'] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
+
+		parent::onSubmit();
+	}
 
 	function onBeforeUpdate() {
 		global $app, $conf, $interfaceConf;
@@ -125,36 +125,36 @@
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
 
-        $this->oldDataRecord = $app->db->queryOneRecord("SELECT * FROM web_database_user WHERE database_user_id = '".$this->id."'");
-        
-        $dbuser_prefix = $app->tools_sites->getPrefix($this->oldDataRecord['database_user_prefix'], $dbuser_prefix);
-        $this->dataRecord['database_user_prefix'] = $dbuser_prefix;
-        
+		$this->oldDataRecord = $app->db->queryOneRecord("SELECT * FROM web_database_user WHERE database_user_id = '".$this->id."'");
+
+		$dbuser_prefix = $app->tools_sites->getPrefix($this->oldDataRecord['database_user_prefix'], $dbuser_prefix);
+		$this->dataRecord['database_user_prefix'] = $dbuser_prefix;
+
 		//* Database username shall not be empty
 		if($this->dataRecord['database_user'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_user_error_empty"].'<br />';
 
-		if(strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) $app->tform->errorMessage .= str_replace('{user}',$dbuser_prefix . $this->dataRecord['database_user'],$app->tform->wordbook["database_user_error_len"]).'<br />';
-		
+		if(strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) $app->tform->errorMessage .= str_replace('{user}', $dbuser_prefix . $this->dataRecord['database_user'], $app->tform->wordbook["database_user_error_len"]).'<br />';
+
 		//* Check database user against blacklist
-		$dbuser_blacklist = array($conf['db_user'],'mysql','root');
-		if(in_array($dbuser_prefix . $this->dataRecord['database_user'],$dbuser_blacklist)) {
+		$dbuser_blacklist = array($conf['db_user'], 'mysql', 'root');
+		if(in_array($dbuser_prefix . $this->dataRecord['database_user'], $dbuser_blacklist)) {
 			$app->tform->errorMessage .= $app->lng('Database user not allowed.').'<br />';
 		}
-		
+
 		if ($app->tform->errorMessage == ''){
 			/* restrict the names if there is no error */
-            /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+			/* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
 			$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 		}
-		
-        $this->dataRecord['server_id'] = 0; // we need this on all servers
-        
+
+		$this->dataRecord['server_id'] = 0; // we need this on all servers
+
 		parent::onBeforeUpdate();
 	}
 
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
-		
+
 		//* Database username shall not be empty
 		if($this->dataRecord['database_user'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_user_error_empty"].'<br />';
 
@@ -162,31 +162,31 @@
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
-		
-        $this->dataRecord['database_user_prefix'] = $dbuser_prefix;
-        
-		if(strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) $app->tform->errorMessage .= str_replace('{user}',$dbuser_prefix . $this->dataRecord['database_user'],$app->tform->wordbook["database_user_error_len"]).'<br />';
-		
+
+		$this->dataRecord['database_user_prefix'] = $dbuser_prefix;
+
+		if(strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) $app->tform->errorMessage .= str_replace('{user}', $dbuser_prefix . $this->dataRecord['database_user'], $app->tform->wordbook["database_user_error_len"]).'<br />';
+
 		//* Check database user against blacklist
-		$dbuser_blacklist = array($conf['db_user'],'mysql','root');
-		if(is_array($dbuser_blacklist) && in_array($dbuser_prefix . $this->dataRecord['database_user'],$dbuser_blacklist)) {
+		$dbuser_blacklist = array($conf['db_user'], 'mysql', 'root');
+		if(is_array($dbuser_blacklist) && in_array($dbuser_prefix . $this->dataRecord['database_user'], $dbuser_blacklist)) {
 			$app->tform->errorMessage .= $app->lng('Database user not allowed.').'<br />';
 		}
 
 		/* restrict the names */
-        /* crop user names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+		/* crop user names if they are too long -> mysql: user: 16 chars / db: 64 chars */
 		if ($app->tform->errorMessage == ''){
 			$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 		}
-		
-        $this->dataRecord['server_id'] = 0; // we need this on all servers
-        
+
+		$this->dataRecord['server_id'] = 0; // we need this on all servers
+
 		parent::onBeforeInsert();
 	}
 
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
 			$app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$this->id);
@@ -208,9 +208,9 @@
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
 			$app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$this->id);
 		}
-		
+
 		/*$password = $app->db->queryOneRecord("SELECT database_password FROM web_database_user WHERE database_user_id = ".$this->id);
-        
+
         $records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".$app->functions->intval($this->id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($this->id)."'");
         foreach($records as $rec) {
             $new_rec = $this->dataRecord;
@@ -227,4 +227,4 @@
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_user_list.php b/interface/web/sites/database_user_list.php
index 84c9535..1dbd215 100644
--- a/interface/web/sites/database_user_list.php
+++ b/interface/web/sites/database_user_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,13 +48,13 @@
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
@@ -62,4 +62,4 @@
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/cron.tform.php b/interface/web/sites/form/cron.tform.php
index 41c2a31..4888967 100644
--- a/interface/web/sites/form/cron.tform.php
+++ b/interface/web/sites/form/cron.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Cron Job";
-$form["description"] 	= "";
-$form["name"] 			= "cron";
-$form["action"]			= "cron_edit.php";
-$form["db_table"]		= "cron";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "cron";
-$form["list_default"]	= "cron_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Cron Job";
+$form["description"]  = "";
+$form["name"]    = "cron";
+$form["action"]   = "cron_edit.php";
+$form["db_table"]  = "cron";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "cron";
+$form["list_default"] = "cron_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,139 +51,139 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['cron'] = array (
-	'title' 	=> "Cron Job",
-	'width' 	=> 100,
-	'template' 	=> "templates/cron_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Cron Job",
+	'width'  => 100,
+	'template'  => "templates/cron_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'server_id_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'server_id_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-        'parent_domain_id' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'SELECT',
-            'default'   => '',
-            'datasource'    => array (  'type'  => 'SQL',
-                                        'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-                                        'keyfield'=> 'domain_id',
-                                        'valuefield'=> 'parent_domain'
-                                     ),
-            'value'     => ''
-        ),
-        'run_min' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
-                                                        'errmsg'=> 'run_min_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'run_hour' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
-                                                        'errmsg'=> 'run_hour_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'run_mday' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
-                                                        'errmsg'=> 'run_mday_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'run_month' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_month_format',
-                                                        'errmsg'=> 'run_month_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'run_wday' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
-                                                        'errmsg'=> 'run_wday_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
+		'parent_domain_id' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'SELECT',
+			'default'   => '',
+			'datasource'    => array (  'type'  => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'     => ''
+		),
+		'run_min' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_time_format',
+					'errmsg'=> 'run_min_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
+		'run_hour' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_time_format',
+					'errmsg'=> 'run_hour_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
+		'run_mday' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_time_format',
+					'errmsg'=> 'run_mday_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
+		'run_month' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_month_format',
+					'errmsg'=> 'run_month_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
+		'run_wday' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_time_format',
+					'errmsg'=> 'run_wday_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
 		'command' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'command_error_empty'),
-                                        1 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'command_format',
-                                                        'errmsg'=> 'command_error_format'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'command_error_empty'),
+				1 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'command_format',
+					'errmsg'=> 'command_error_format'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-        'type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'default'   => 'url',
-            'valuelimit' => 'list:url,full,chrooted',
-            'value'     => array('url' => 'Url', 'full' => 'Full', 'chrooted' => 'Chrooted')
-        ),
+		'type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'default'   => 'url',
+			'valuelimit' => 'list:url,full,chrooted',
+			'value'     => array('url' => 'Url', 'full' => 'Full', 'chrooted' => 'Chrooted')
+		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/database.tform.php b/interface/web/sites/form/database.tform.php
index 58ce040..a3e8772 100644
--- a/interface/web/sites/form/database.tform.php
+++ b/interface/web/sites/form/database.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Database";
-$form["description"] 	= "";
-$form["name"] 			= "database";
-$form["action"]			= "database_edit.php";
-$form["db_table"]		= "web_database";
-$form["db_table_idx"]	= "database_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "database";
-$form["list_default"]	= "database_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Database";
+$form["description"]  = "";
+$form["name"]    = "database";
+$form["action"]   = "database_edit.php";
+$form["db_table"]  = "web_database";
+$form["db_table_idx"] = "database_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "database";
+$form["list_default"] = "database_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,122 +56,122 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['database'] = array (
-	'title' 	=> "Database",
-	'width' 	=> 100,
-	'template' 	=> "templates/database_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Database",
+	'width'  => 100,
+	'template'  => "templates/database_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} AND db_server = 1 ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} AND db_server = 1 ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> array('0' => 'select_site_txt')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => array('0' => 'select_site_txt')
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('mysql' => 'MySQL')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('mysql' => 'MySQL')
 		),
 		'database_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'database_name_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
-														'errmsg'=> 'database_name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'database_name_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
+					'errmsg'=> 'database_name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'database_name_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'database_user_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
-										'keyfield'=> 'database_user_id',
-										'valuefield'=> 'database_user'
-									 ),
-			'value'		=> array('0' => 'select_dbuser_txt')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
+				'keyfield'=> 'database_user_id',
+				'valuefield'=> 'database_user'
+			),
+			'value'  => array('0' => 'select_dbuser_txt')
 		),
 		'database_ro_user_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
-										'keyfield'=> 'database_user_id',
-										'valuefield'=> 'database_user'
-									 ),
-			'value'		=> array('0' => 'no_dbuser_txt')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
+				'keyfield'=> 'database_user_id',
+				'valuefield'=> 'database_user'
+			),
+			'value'  => array('0' => 'no_dbuser_txt')
 		),
 		'database_charset' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('' => 'DB-Default','latin1' => 'Latin 1','utf8' => 'UTF-8')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('' => 'DB-Default', 'latin1' => 'Latin 1', 'utf8' => 'UTF-8')
 		),
 		'remote_access' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	    'remote_ips' => array (
-	      'datatype'  => 'TEXT',
-	      'formtype'  => 'TEXT',
-	      'validators'  => array (  0 => array (  'type' => 'CUSTOM',
-	                                              'class' => 'validate_database',
-	                                              'function' => 'valid_ip_list',
-	                                              'errmsg' => 'database_remote_error_ips'),
-	                             ),
-	      'default' => '',
-	      'value'   => '',
-	      'width'   => '60',
-		  'searchable' => 2
-	    ),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		'remote_ips' => array (
+			'datatype'  => 'TEXT',
+			'formtype'  => 'TEXT',
+			'validators'  => array (  0 => array (  'type' => 'CUSTOM',
+					'class' => 'validate_database',
+					'function' => 'valid_ip_list',
+					'errmsg' => 'database_remote_error_ips'),
+			),
+			'default' => '',
+			'value'   => '',
+			'width'   => '60',
+			'searchable' => 2
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/database_user.tform.php b/interface/web/sites/form/database_user.tform.php
index fa2b2d3..a270fb1 100644
--- a/interface/web/sites/form/database_user.tform.php
+++ b/interface/web/sites/form/database_user.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Database User";
-$form["description"] 	= "";
-$form["name"] 			= "database_user";
-$form["action"]			= "database_user_edit.php";
-$form["db_table"]		= "web_database_user";
-$form["db_table_idx"]	= "database_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "database_user";
-$form["list_default"]	= "database_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Database User";
+$form["description"]  = "";
+$form["name"]    = "database_user";
+$form["action"]   = "database_user_edit.php";
+$form["db_table"]  = "web_database_user";
+$form["db_table_idx"] = "database_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "database_user";
+$form["list_default"] = "database_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,63 +56,63 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['database_user'] = array (
-	'title' 	=> "Database User",
-	'width' 	=> 100,
-	'template' 	=> "templates/database_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Database User",
+	'width'  => 100,
+	'template'  => "templates/database_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} AND db_server = 1 ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} AND db_server = 1 ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'database_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'database_user_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'database_user_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
-														'errmsg'=> 'database_user_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'database_user_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'database_user_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
+					'errmsg'=> 'database_user_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'database_user_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'database_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'MYSQL',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/ftp_user.tform.php b/interface/web/sites/form/ftp_user.tform.php
index 7dece14..b540ec0 100644
--- a/interface/web/sites/form/ftp_user.tform.php
+++ b/interface/web/sites/form/ftp_user.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "FTP User";
-$form["description"] 	= "";
-$form["name"] 			= "ftp_user";
-$form["action"]			= "ftp_user_edit.php";
-$form["db_table"]		= "ftp_user";
-$form["db_table_idx"]	= "ftp_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "ftp";
-$form["list_default"]	= "ftp_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "FTP User";
+$form["description"]  = "";
+$form["name"]    = "ftp_user";
+$form["action"]   = "ftp_user_edit.php";
+$form["db_table"]  = "ftp_user";
+$form["db_table_idx"] = "ftp_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "ftp";
+$form["list_default"] = "ftp_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,215 +56,215 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['ftp'] = array (
-	'title' 	=> "FTP User",
-	'width' 	=> 100,
-	'template' 	=> "templates/ftp_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "FTP User",
+	'width'  => 100,
+	'template'  => "templates/ftp_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'username_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'username_error_unique'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'username_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'quota_size' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'quota_size_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\-1|[0-9]{1,10})$/',
-														'errmsg'=> 'quota_size_error_regex'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'quota_size_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\-1|[0-9]{1,10})$/',
+					'errmsg'=> 'quota_size_error_regex'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($app->auth->is_admin()) {
 
-$form["tabs"]['advanced'] = array (
-    'title'     => "Options",
-    'width'     => 100,
-    'template'  => "templates/ftp_user_advanced.htm",
-    'fields'    => array (
-    ##################################
-    # Begin Datatable fields
-    ##################################
-        'uid' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'uid_error_empty'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'gid' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'gid_error_empty'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'dir' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'directory_error_empty'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'quota_files' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-        'ul_ratio' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-        'dl_ratio' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-        'ul_bandwidth' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-        'dl_bandwidth' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-    ##################################
-    # ENDE Datatable fields
-    ##################################
-    )
-);
+	$form["tabs"]['advanced'] = array (
+		'title'     => "Options",
+		'width'     => 100,
+		'template'  => "templates/ftp_user_advanced.htm",
+		'fields'    => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'uid' => array (
+				'datatype'  => 'VARCHAR',
+				'formtype'  => 'TEXT',
+				'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
+						'errmsg'=> 'uid_error_empty'),
+				),
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '30',
+				'maxlength' => '255'
+			),
+			'gid' => array (
+				'datatype'  => 'VARCHAR',
+				'formtype'  => 'TEXT',
+				'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
+						'errmsg'=> 'gid_error_empty'),
+				),
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '30',
+				'maxlength' => '255'
+			),
+			'dir' => array (
+				'datatype'  => 'VARCHAR',
+				'formtype'  => 'TEXT',
+				'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
+						'errmsg'=> 'directory_error_empty'),
+				),
+				'default'   => '',
+				'value'     => '',
+				'width'     => '30',
+				'maxlength' => '255'
+			),
+			'quota_files' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			'ul_ratio' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			'dl_ratio' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			'ul_bandwidth' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			'dl_bandwidth' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 } else {
 
-$form["tabs"]['advanced'] = array (
-    'title'     => "Options",
-    'width'     => 100,
-    'template'  => "templates/ftp_user_advanced_client.htm",
-    'fields'    => array (
-    ##################################
-    # Begin Datatable fields
-    ##################################
-        'dir' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'directory_error_empty'),
-                                        1 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_ftpuser',
-                                                        'function' => 'ftp_dir',
-                                                        'errmsg' => 'directory_error_notinweb'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-    ##################################
-    # ENDE Datatable fields
-    ##################################
-    )
-);
+	$form["tabs"]['advanced'] = array (
+		'title'     => "Options",
+		'width'     => 100,
+		'template'  => "templates/ftp_user_advanced_client.htm",
+		'fields'    => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'dir' => array (
+				'datatype'  => 'VARCHAR',
+				'formtype'  => 'TEXT',
+				'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
+						'errmsg'=> 'directory_error_empty'),
+					1 => array (    'type'  => 'CUSTOM',
+						'class' => 'validate_ftpuser',
+						'function' => 'ftp_dir',
+						'errmsg' => 'directory_error_notinweb'),
+				),
+				'default'   => '',
+				'value'     => '',
+				'width'     => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/shell_user.tform.php b/interface/web/sites/form/shell_user.tform.php
index 1ae077d..d9928e6 100644
--- a/interface/web/sites/form/shell_user.tform.php
+++ b/interface/web/sites/form/shell_user.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Shell User";
-$form["description"] 	= "";
-$form["name"] 			= "shell_user";
-$form["action"]			= "shell_user_edit.php";
-$form["db_table"]		= "shell_user";
-$form["db_table_idx"]	= "shell_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "shell";
-$form["list_default"]	= "shell_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Shell User";
+$form["description"]  = "";
+$form["name"]    = "shell_user";
+$form["action"]   = "shell_user_edit.php";
+$form["db_table"]  = "shell_user";
+$form["db_table_idx"] = "shell_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "shell";
+$form["list_default"] = "shell_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,160 +56,160 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['shell'] = array (
-	'title' 	=> "Shell User",
-	'width' 	=> 100,
-	'template' 	=> "templates/shell_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Shell User",
+	'width'  => 100,
+	'template'  => "templates/shell_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'username_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,32}$/',
-														'errmsg'=> 'username_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'username_error_unique'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,32}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'username_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'chroot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			'valuelimit' => 'client:ssh_chroot',
-			'value'		=> array('no' => 'None', 'jailkit' => 'Jailkit')
+			'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
 		),
 		'quota_size' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'quota_size_error_empty'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'quota_size_error_empty'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ssh_rsa' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'maxlength'	=> '600'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'maxlength' => '600'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/shell_user_advanced.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'puser' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'uid_error_empty'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'pgroup' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'uid_error_empty'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'shell' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '/bin/bash',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'dir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'directory_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/shell_user_advanced.htm",
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'puser' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'uid_error_empty'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'pgroup' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'uid_error_empty'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'shell' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'default' => '/bin/bash',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'dir' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'directory_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/web_aliasdomain.tform.php b/interface/web/sites/form/web_aliasdomain.tform.php
index 528234a..35762ef 100644
--- a/interface/web/sites/form/web_aliasdomain.tform.php
+++ b/interface/web/sites/form/web_aliasdomain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Web Aliasdomain";
-$form["description"] 	= "";
-$form["name"] 			= "web_aliasdomain";
-$form["action"]			= "web_aliasdomain_edit.php";
-$form["db_table"]		= "web_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "web_aliasdomain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Web Aliasdomain";
+$form["description"]  = "";
+$form["name"]    = "web_aliasdomain";
+$form["action"]   = "web_aliasdomain_edit.php";
+$form["db_table"]  = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_aliasdomain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,133 +56,133 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_aliasdomain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/web_aliasdomain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'alias_domain',
-                                                        'errmsg'=> 'domain_error_regex'),
-                                    ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'alias_domain',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain')
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'redirect_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
 		),
 		'redirect_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
-														'errmsg'=> 'redirect_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+					'errmsg'=> 'redirect_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'subdomain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'www',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'web_domain_autosub',
-                                                        'errmsg'=> 'domain_error_autosub'),
-                                    ),
-			'value'		=> array('none' => 'none_txt', 'www' => 'www.', '*' => '*.')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'www',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'web_domain_autosub',
+					'errmsg'=> 'domain_error_autosub'),
+			),
+			'value'  => array('none' => 'none_txt', 'www' => 'www.', '*' => '*.')
 		),
 		'seo_redirect' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_aliasdomain_advanced.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'proxy_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/web_aliasdomain_advanced.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'proxy_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php
index db022b6..9907956 100644
--- a/interface/web/sites/form/web_domain.tform.php
+++ b/interface/web/sites/form/web_domain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Web Domain";
-$form["description"] 	= "";
-$form["name"] 			= "web_domain";
-$form["action"]			= "web_domain_edit.php";
-$form["db_table"]		= "web_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "web_domain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Web Domain";
+$form["description"]  = "";
+$form["name"]    = "web_domain";
+$form["action"]   = "web_domain_edit.php";
+$form["db_table"]  = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_domain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -65,329 +65,329 @@
 $wildcard_available = true;
 $ssl_available = true;
 if(!$app->auth->is_admin()) {
-    $client_group_id = $_SESSION["s"]["user"]["default_group"];
+	$client_group_id = $_SESSION["s"]["user"]["default_group"];
 	$client = $app->db->queryOneRecord("SELECT limit_wildcard, limit_ssl FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-    
-    if($client['limit_wildcard'] != 'y') $wildcard_available = false;
-    if($client['limit_ssl'] != 'y') $ssl_available = false;
+
+	if($client['limit_wildcard'] != 'y') $wildcard_available = false;
+	if($client['limit_ssl'] != 'y') $ssl_available = false;
 }
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_edit.htm",
-	'readonly'	=> $web_domain_edit_readonly,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/web_domain_edit.htm",
+	'readonly' => $web_domain_edit_readonly,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
 			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'no_server_error'),
-                                    ),
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+					'errmsg'=> 'no_server_error'),
+			),
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> '',
+			'value'  => '',
 			'searchable' => 2
 		),
 		'ipv6_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv6' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> '',
+			'value'  => '',
 			'searchable' => 2
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'web_domain',
-                                                        'errmsg'=> 'domain_error_regex'),
-                                    ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'web_domain',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('vhost' => 'Site', 'alias' => 'Alias')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('vhost' => 'Site', 'alias' => 'Alias')
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'site' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'site' AND {AUTHSQL} ORDER BY domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'domain'
+			),
+			'value'  => ''
 		),
 		'vhost_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('name' => 'Namebased', 'ip' => 'IP-Based')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('name' => 'Namebased', 'ip' => 'IP-Based')
 		),
 		'hd_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'hd_quota_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\-1|[0-9]{1,10})$/',
-														'errmsg'=> 'hd_quota_error_regex'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'hd_quota_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\-1|[0-9]{1,10})$/',
+					'errmsg'=> 'hd_quota_error_regex'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'traffic_quota_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\-1|[0-9]{1,10})$/',
-														'errmsg'=> 'traffic_quota_error_regex'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'traffic_quota_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\-1|[0-9]{1,10})$/',
+					'errmsg'=> 'traffic_quota_error_regex'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'errordocs' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> array(0 => '0',1 => '1')
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '1',
+			'value'  => array(0 => '0', 1 => '1')
 		),
 		'subdomain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'www',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'web_domain_autosub',
-                                                        'errmsg'=> 'domain_error_autosub'),
-                                    ),
-			'value'		=> ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'www',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'web_domain_autosub',
+					'errmsg'=> 'domain_error_autosub'),
+			),
+			'value'  => ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
 		),
 		'ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'php' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'fast-cgi',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'fast-cgi',
 			'valuelimit' => 'client:web_php_options',
-			'value'		=> array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
+			'value'  => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
 			'searchable' => 2
 		),
 		'fastcgi_php_version' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> ''
+			'value'  => ''
 		),
 		'perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 $form["tabs"]['redirect'] = array (
-	'title' 	=> "Redirect",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_redirect.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Redirect",
+	'width'  => 100,
+	'template'  => "templates/web_domain_redirect.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'redirect_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
 		),
 		'redirect_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
-														'errmsg'=> 'redirect_error_regex'),
-									),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+					'errmsg'=> 'redirect_error_regex'),
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'seo_redirect' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld')
 		),
 		'rewrite_rules' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($ssl_available) {
-$form["tabs"]['ssl'] = array (
-	'title' 	=> "SSL",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_ssl.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'ssl_state' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
-														'errmsg'=> 'ssl_state_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_locality' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
-														'errmsg'=> 'ssl_locality_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_organisation' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
-														'errmsg'=> 'ssl_organisation_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_organisation_unit' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
-														'errmsg'=> 'ssl_organistaion_unit_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		/*
+	$form["tabs"]['ssl'] = array (
+		'title'  => "SSL",
+		'width'  => 100,
+		'template'  => "templates/web_domain_ssl.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'ssl_state' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'errmsg'=> 'ssl_state_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_locality' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'errmsg'=> 'ssl_locality_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_organisation' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'errmsg'=> 'ssl_organisation_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_organisation_unit' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'errmsg'=> 'ssl_organistaion_unit_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			/*
 		'ssl_country' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
@@ -401,98 +401,98 @@
 			'maxlength'	=> '2'
 		),
 		*/
-		'ssl_country' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
-										'keyfield'=> 'iso',
-										'valuefield'=> 'printable_name'
-									 ),
-			'value'		=> ''
-		),
-		'ssl_domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_key' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_request' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_cert' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_bundle' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt','del' => 'delete_certificate_txt')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+			'ssl_country' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'datasource' => array (  'type' => 'SQL',
+					'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
+					'keyfield'=> 'iso',
+					'valuefield'=> 'printable_name'
+				),
+				'value'  => ''
+			),
+			'ssl_domain' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_key' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_request' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_cert' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_bundle' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_action' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'value'  => array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt', 'del' => 'delete_certificate_txt')
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 }
 
 //* Statistics
 $form["tabs"]['stats'] = array (
-	'title' 	=> "Stats",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_stats.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Stats",
+	'width'  => 100,
+	'template'  => "templates/web_domain_stats.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'stats_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'stats_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'webalizer',
-			'value'		=> array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'webalizer',
+			'value'  => array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -500,36 +500,36 @@
 
 //* Backup
 $form["tabs"]['backup'] = array (
-	'title' 	=> "Backup",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_backup.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Backup",
+	'width'  => 100,
+	'template'  => "templates/web_domain_backup.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'backup_interval' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
 		),
 		'backup_copies' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	),
 	'plugins' => array (
-     	'backup_records' => array (
-         	'class'   => 'plugin_backuplist',
-     		'options' => array(
+		'backup_records' => array (
+			'class'   => 'plugin_backuplist',
+			'options' => array(
 			)
-        )
+		)
 	)
 );
 
@@ -537,191 +537,191 @@
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_advanced.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'document_root' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'documentroot_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'system_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'sysuser_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'system_group' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'sysgroup_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'allow_override' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'allow_override_error_empty'),
-									),
-			'default'	=> 'All',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'php_fpm_use_socket' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-		'pm' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'dynamic',
-			'value'		=> array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
-		),
-		'pm_max_children' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_max_children_error_regex'),
-									),
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_start_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_start_servers_error_regex'),
-									),
-			'default'	=> '2',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_min_spare_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_min_spare_servers_error_regex'),
-									),
-			'default'	=> '1',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_max_spare_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_max_spare_servers_error_regex'),
-									),
-			'default'	=> '5',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_process_idle_timeout' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_process_idle_timeout_error_regex'),
-									),
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '6'
-		),
-		'pm_max_requests' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([0-9]{1,11})$/',
-														'errmsg'=> 'pm_max_requests_error_regex'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '6'
-		),
-		'php_open_basedir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			/*'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/web_domain_advanced.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'document_root' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'documentroot_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'system_user' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'sysuser_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'system_group' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'sysgroup_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'allow_override' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'allow_override_error_empty'),
+				),
+				'default' => 'All',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'php_fpm_use_socket' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default' => 'n',
+				'value'  => array(0 => 'n', 1 => 'y')
+			),
+			'pm' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => 'dynamic',
+				'value'  => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
+			),
+			'pm_max_children' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_max_children_error_regex'),
+				),
+				'default' => '10',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_start_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_start_servers_error_regex'),
+				),
+				'default' => '2',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_min_spare_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_min_spare_servers_error_regex'),
+				),
+				'default' => '1',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_max_spare_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_max_spare_servers_error_regex'),
+				),
+				'default' => '5',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_process_idle_timeout' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_process_idle_timeout_error_regex'),
+				),
+				'default' => '10',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'pm_max_requests' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([0-9]{1,11})$/',
+						'errmsg'=> 'pm_max_requests_error_regex'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'php_open_basedir' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				/*'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'php_open_basedir_error_empty'),
 									),   */
-			'default'	=> 'All',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'custom_php_ini' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'apache_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-        'nginx_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'proxy_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+				'default' => 'All',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'custom_php_ini' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'apache_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'nginx_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'proxy_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/web_folder.tform.php b/interface/web/sites/form/web_folder.tform.php
index 2cef461..ab8d474 100644
--- a/interface/web/sites/form/web_folder.tform.php
+++ b/interface/web/sites/form/web_folder.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Web Folder";
-$form["description"] 	= "";
-$form["name"] 			= "web_folder";
-$form["action"]			= "web_folder_edit.php";
-$form["db_table"]		= "web_folder";
-$form["db_table_idx"]	= "web_folder_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "folder";
-$form["list_default"]	= "web_folder_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Web Folder";
+$form["description"]  = "";
+$form["name"]    = "web_folder";
+$form["action"]   = "web_folder_edit.php";
+$form["db_table"]  = "web_folder";
+$form["db_table_idx"] = "web_folder_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "folder";
+$form["list_default"] = "web_folder_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,60 +51,60 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['folder'] = array (
-	'title' 	=> "Folder",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_folder_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Folder",
+	'width'  => 100,
+	'template'  => "templates/web_folder_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE (web_domain.type = 'vhost' OR web_domain.type = 'vhostsubdomain') AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE (web_domain.type = 'vhost' OR web_domain.type = 'vhostsubdomain') AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\_\/]{0,255}$/',
-														'errmsg'=> 'path_error_regex'),
-									),
-			'default'	=> '/',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\_\/]{0,255}$/',
+					'errmsg'=> 'path_error_regex'),
+			),
+			'default' => '/',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/web_folder_user.tform.php b/interface/web/sites/form/web_folder_user.tform.php
index 1a034df..19ca71c 100644
--- a/interface/web/sites/form/web_folder_user.tform.php
+++ b/interface/web/sites/form/web_folder_user.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Web folder user";
-$form["description"] 	= "";
-$form["name"] 			= "web_folder_user";
-$form["action"]			= "web_folder_user_edit.php";
-$form["db_table"]		= "web_folder_user";
-$form["db_table_idx"]	= "web_folder_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "user";
-$form["list_default"]	= "web_folder_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Web folder user";
+$form["description"]  = "";
+$form["name"]    = "web_folder_user";
+$form["action"]   = "web_folder_user_edit.php";
+$form["db_table"]  = "web_folder_user";
+$form["db_table_idx"] = "web_folder_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "user";
+$form["list_default"] = "web_folder_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,72 +51,72 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['user'] = array (
-	'title' 	=> "Folder",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_folder_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Folder",
+	'width'  => 100,
+	'template'  => "templates/web_folder_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'web_folder_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "Select concat(web_domain.domain,' ',web_folder.path, ' :: ', server.server_name) as name, web_folder.web_folder_id from web_domain, web_folder, server WHERE web_domain.domain_id = web_folder.parent_domain_id AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'web_folder_id',
-										'valuefield'=> 'name'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'folder_error_empty'),
-									),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "Select concat(web_domain.domain,' ',web_folder.path, ' :: ', server.server_name) as name, web_folder.web_folder_id from web_domain, web_folder, server WHERE web_domain.domain_id = web_folder.parent_domain_id AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'web_folder_id',
+				'valuefield'=> 'name'
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'folder_error_empty'),
+			),
+			'value'  => ''
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/web_subdomain.tform.php b/interface/web/sites/form/web_subdomain.tform.php
index 385945c..b79c46a 100644
--- a/interface/web/sites/form/web_subdomain.tform.php
+++ b/interface/web/sites/form/web_subdomain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Subdomain";
-$form["description"] 	= "";
-$form["name"] 			= "web_subdomain";
-$form["action"]			= "web_subdomain_edit.php";
-$form["db_table"]		= "web_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "web_subdomain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Subdomain";
+$form["description"]  = "";
+$form["name"]    = "web_subdomain";
+$form["action"]   = "web_subdomain_edit.php";
+$form["db_table"]  = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_subdomain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,117 +56,117 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_subdomain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/web_subdomain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'sub_domain',
-                                                        'errmsg'=> 'domain_error_regex'),
-                                    ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'sub_domain',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain')
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> '',
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => '',
 			'searchable' => 2
 		),
 		'redirect_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
 		),
 		'redirect_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
-														'errmsg'=> 'redirect_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+					'errmsg'=> 'redirect_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_subdomain_advanced.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'proxy_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/web_subdomain_advanced.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'proxy_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/web_vhost_subdomain.tform.php b/interface/web/sites/form/web_vhost_subdomain.tform.php
index e424afa..5e507d1 100644
--- a/interface/web/sites/form/web_vhost_subdomain.tform.php
+++ b/interface/web/sites/form/web_vhost_subdomain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Subdomain";
-$form["description"] 	= "";
-$form["name"] 			= "web_vhost_subdomain";
-$form["action"]			= "web_vhost_subdomain_edit.php";
-$form["db_table"]		= "web_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "web_vhost_subdomain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Subdomain";
+$form["description"]  = "";
+$form["name"]    = "web_vhost_subdomain";
+$form["action"]   = "web_vhost_subdomain_edit.php";
+$form["db_table"]  = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_vhost_subdomain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -58,326 +58,326 @@
 $wildcard_available = false;
 $ssl_available = true;
 if(!$app->auth->is_admin()) {
-    $client_group_id = $_SESSION["s"]["user"]["default_group"];
+	$client_group_id = $_SESSION["s"]["user"]["default_group"];
 	$client = $app->db->queryOneRecord("SELECT limit_wildcard, limit_ssl FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-    
-    if($client['limit_ssl'] != 'y') $ssl_available = false;
+
+	if($client['limit_ssl'] != 'y') $ssl_available = false;
 }
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_edit.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/web_vhost_subdomain_edit.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> '',
+			'value'  => '',
 			'searchable' => 2
 		),
 		'ipv6_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv6' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> '',
+			'value'  => '',
 			'searchable' => 2
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'sub_domain',
-                                                        'errmsg'=> 'domain_error_regex'),
-                                    ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'sub_domain',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain', 'vhostsubdomain' => 'Subdomain')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain', 'vhostsubdomain' => 'Subdomain')
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'web_folder' => array (
-			'datatype'	=> 'VARCHAR',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^((?!.*\.\.)[\w/_\.\-]{1,100})$@',
-														'errmsg'=> 'web_folder_error_regex'),
-									),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^((?!.*\.\.)[\w/_\.\-]{1,100})$@',
+					'errmsg'=> 'web_folder_error_regex'),
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'vhost_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('name' => 'Namebased', 'ip' => 'IP-Based')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('name' => 'Namebased', 'ip' => 'IP-Based')
 		),
 		'hd_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'traffic_quota_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\-1|[0-9]{1,10})$/',
-														'errmsg'=> 'traffic_quota_error_regex'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'traffic_quota_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\-1|[0-9]{1,10})$/',
+					'errmsg'=> 'traffic_quota_error_regex'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'errordocs' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> array(0 => '0',1 => '1')
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '1',
+			'value'  => array(0 => '0', 1 => '1')
 		),
 		'subdomain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'www',
-			'value'		=> ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'www',
+			'value'  => ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
 		),
 		'ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'php' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'fast-cgi',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'fast-cgi',
 			'valuelimit' => 'client:web_php_options',
-			'value'		=> array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
+			'value'  => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
 			'searchable' => 2
 		),
 		'fastcgi_php_version' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> ''
+			'value'  => ''
 		),
 		'perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 $form["tabs"]['redirect'] = array (
-	'title' 	=> "Redirect",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_redirect.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Redirect",
+	'width'  => 100,
+	'template'  => "templates/web_vhost_subdomain_redirect.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'redirect_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
 		),
 		'redirect_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
-														'errmsg'=> 'redirect_error_regex'),
-									),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+					'errmsg'=> 'redirect_error_regex'),
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'seo_redirect' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld')
 		),
 		'rewrite_rules' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($ssl_available) {
-$form["tabs"]['ssl'] = array (
-	'title' 	=> "SSL",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_ssl.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'ssl_state' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
-														'errmsg'=> 'ssl_state_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_locality' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
-														'errmsg'=> 'ssl_locality_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_organisation' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
-														'errmsg'=> 'ssl_organisation_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_organisation_unit' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
-														'errmsg'=> 'ssl_organistaion_unit_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		/*
+	$form["tabs"]['ssl'] = array (
+		'title'  => "SSL",
+		'width'  => 100,
+		'template'  => "templates/web_vhost_subdomain_ssl.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'ssl_state' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
+						'errmsg'=> 'ssl_state_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_locality' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
+						'errmsg'=> 'ssl_locality_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_organisation' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
+						'errmsg'=> 'ssl_organisation_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_organisation_unit' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
+						'errmsg'=> 'ssl_organistaion_unit_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			/*
 		'ssl_country' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
@@ -391,98 +391,98 @@
 			'maxlength'	=> '2'
 		),
 		*/
-		'ssl_country' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
-										'keyfield'=> 'iso',
-										'valuefield'=> 'printable_name'
-									 ),
-			'value'		=> ''
-		),
-		'ssl_domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_key' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_request' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_cert' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_bundle' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt','del' => 'delete_certificate_txt')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+			'ssl_country' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'datasource' => array (  'type' => 'SQL',
+					'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
+					'keyfield'=> 'iso',
+					'valuefield'=> 'printable_name'
+				),
+				'value'  => ''
+			),
+			'ssl_domain' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_key' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_request' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_cert' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_bundle' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_action' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'value'  => array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt', 'del' => 'delete_certificate_txt')
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 }
 
 //* Statistics
 $form["tabs"]['stats'] = array (
-	'title' 	=> "Stats",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_stats.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Stats",
+	'width'  => 100,
+	'template'  => "templates/web_vhost_subdomain_stats.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'stats_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'stats_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'webalizer',
-			'value'		=> array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'webalizer',
+			'value'  => array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -490,36 +490,36 @@
 
 //* Backup
 $form["tabs"]['backup'] = array (
-	'title' 	=> "Backup",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_backup.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Backup",
+	'width'  => 100,
+	'template'  => "templates/web_vhost_subdomain_backup.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'backup_interval' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('none' => 'No backup', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('none' => 'No backup', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly')
 		),
 		'backup_copies' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	),
 	'plugins' => array (
-     	'backup_records' => array (
-         	'class'   => 'plugin_backuplist',
-     		'options' => array(
+		'backup_records' => array (
+			'class'   => 'plugin_backuplist',
+			'options' => array(
 			)
-        )
+		)
 	)
 );
 
@@ -527,191 +527,191 @@
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_advanced.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'document_root' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'documentroot_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'system_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'sysuser_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'system_group' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'sysgroup_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'allow_override' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'allow_override_error_empty'),
-									),
-			'default'	=> 'All',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'php_fpm_use_socket' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-		'pm' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'dynamic',
-			'value'		=> array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
-		),
-		'pm_max_children' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_max_children_error_regex'),
-									),
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_start_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_start_servers_error_regex'),
-									),
-			'default'	=> '2',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_min_spare_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_min_spare_servers_error_regex'),
-									),
-			'default'	=> '1',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_max_spare_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_max_spare_servers_error_regex'),
-									),
-			'default'	=> '5',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_process_idle_timeout' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_process_idle_timeout_error_regex'),
-									),
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '6'
-		),
-		'pm_max_requests' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([0-9]{1,11})$/',
-														'errmsg'=> 'pm_max_requests_error_regex'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '6'
-		),
-		'php_open_basedir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			/*'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/web_vhost_subdomain_advanced.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'document_root' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'documentroot_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'system_user' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'sysuser_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'system_group' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'sysgroup_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'allow_override' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'allow_override_error_empty'),
+				),
+				'default' => 'All',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'php_fpm_use_socket' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default' => 'n',
+				'value'  => array(0 => 'n', 1 => 'y')
+			),
+			'pm' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => 'dynamic',
+				'value'  => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
+			),
+			'pm_max_children' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_max_children_error_regex'),
+				),
+				'default' => '10',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_start_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_start_servers_error_regex'),
+				),
+				'default' => '2',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_min_spare_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_min_spare_servers_error_regex'),
+				),
+				'default' => '1',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_max_spare_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_max_spare_servers_error_regex'),
+				),
+				'default' => '5',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_process_idle_timeout' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_process_idle_timeout_error_regex'),
+				),
+				'default' => '10',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'pm_max_requests' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([0-9]{1,11})$/',
+						'errmsg'=> 'pm_max_requests_error_regex'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'php_open_basedir' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				/*'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'php_open_basedir_error_empty'),
 									),   */
-			'default'	=> 'All',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'custom_php_ini' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'apache_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-        'nginx_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'proxy_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+				'default' => 'All',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'custom_php_ini' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'apache_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'nginx_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'proxy_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/webdav_user.tform.php b/interface/web/sites/form/webdav_user.tform.php
index 29a52dc..d17f3ed 100644
--- a/interface/web/sites/form/webdav_user.tform.php
+++ b/interface/web/sites/form/webdav_user.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Webdav-User";
-$form["description"] 	= "";
-$form["name"] 			= "webdav_user";
-$form["action"]			= "webdav_user_edit.php";
-$form["db_table"]		= "webdav_user";
-$form["db_table_idx"]	= "webdav_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "webdav";
-$form["list_default"]	= "webdav_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Webdav-User";
+$form["description"]  = "";
+$form["name"]    = "webdav_user";
+$form["action"]   = "webdav_user_edit.php";
+$form["db_table"]  = "webdav_user";
+$form["db_table_idx"] = "webdav_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "webdav";
+$form["list_default"] = "webdav_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,85 +51,85 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['webdav'] = array (
-	'title' 	=> "Webdav User",
-	'width' 	=> 100,
-	'template' 	=> "templates/webdav_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Webdav User",
+	'width'  => 100,
+	'template'  => "templates/webdav_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'webdav_domains'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'webdav_domains'
+			),
+			'value'  => ''
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'username_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'username_error_unique'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'username_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'encryption' => 'CLEARTEXT', 
-			'formtype'	=> 'PASSWORD',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'encryption' => 'CLEARTEXT',
+			'formtype' => 'PASSWORD',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'dir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'directory_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'directory_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/ftp_user_del.php b/interface/web/sites/ftp_user_del.php
index 7663f40..32ef028 100644
--- a/interface/web/sites/ftp_user_del.php
+++ b/interface/web/sites/ftp_user_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php
index 59a3680..4f71118 100644
--- a/interface/web/sites/ftp_user_edit.php
+++ b/interface/web/sites/ftp_user_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,10 +49,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_ftp_user')) {
@@ -62,7 +62,7 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_ftp_user_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
 
@@ -72,24 +72,24 @@
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		
+
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);
-		
+
 		if ($this->dataRecord['username'] != ""){
 			/* REMOVE the restriction */
 			$app->tpl->setVar("username", $app->tools_sites->removePrefix($this->dataRecord['username'], $this->dataRecord['username_prefix'], $ftpuser_prefix));
 		}
-        
-        $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $ftpuser_prefix, $global_config['ftpuser_prefix']));
+
+		$app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $ftpuser_prefix, $global_config['ftpuser_prefix']));
 
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the record of the parent domain
 		if(isset($this->dataRecord["parent_domain_id"])) {
 			$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
@@ -100,51 +100,51 @@
 			if(!$parent_domain) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 			unset($tmp);
 		}
-		
+
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
-		
+
 		//die(print_r($this->dataRecord));
-		
+
 		if(isset($this->dataRecord['username']) && trim($this->dataRecord['username']) == '') $app->tform->errorMessage .= $app->tform->lng('username_error_empty').'<br />';
 		if(isset($this->dataRecord['username']) && empty($this->dataRecord['parent_domain_id'])) $app->tform->errorMessage .= $app->tform->lng('parent_domain_id_error_empty').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'./')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
-		
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], '..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], './')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
+
 		parent::onSubmit();
 	}
-	
+
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
-		
+
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);
 
-        $this->dataRecord['username_prefix'] = $ftpuser_prefix;
-		
+		$this->dataRecord['username_prefix'] = $ftpuser_prefix;
+
 		if ($app->tform->errorMessage == '') {
 			$this->dataRecord['username'] = $ftpuser_prefix . $this->dataRecord['username'];
 		}
-		
+
 		parent::onBeforeInsert();
 	}
 
-		function onAfterInsert() {
+	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
 		$server_id = $web["server_id"];
 		$dir = $web["document_root"];
 		$uid = $web["system_user"];
 		$gid = $web["system_group"];
-		
+
 		// The FTP user shall be owned by the same group then the website
 		$sys_groupid = $web['sys_groupid'];
-		
+
 		$sql = "UPDATE ftp_user SET server_id = $server_id, dir = '$dir', uid = '$uid', gid = '$gid', sys_groupid = '$sys_groupid' WHERE ftp_user_id = ".$this->id;
 		$app->db->query($sql);
-		}
+	}
 
 	function onBeforeUpdate() {
 		global $app, $conf, $interfaceConf;
@@ -152,24 +152,24 @@
 		/*
 		 * If the names should be restricted -> do it!
 		 */
-		
+
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);
-		
-        $old_record = $app->tform->getDataRecord($this->id);
-        $ftpuser_prefix = $app->tools_sites->getPrefix($old_record['username_prefix'], $ftpuser_prefix);
-        $this->dataRecord['username_prefix'] = $ftpuser_prefix;
-        
+
+		$old_record = $app->tform->getDataRecord($this->id);
+		$ftpuser_prefix = $app->tools_sites->getPrefix($old_record['username_prefix'], $ftpuser_prefix);
+		$this->dataRecord['username_prefix'] = $ftpuser_prefix;
+
 		/* restrict the names */
 		if ($app->tform->errorMessage == '') {
 			$this->dataRecord['username'] = $ftpuser_prefix . $this->dataRecord['username'];
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* When the site of the FTP user has been changed
 		if(isset($this->dataRecord['parent_domain_id']) && $this->oldDataRecord['parent_domain_id'] != $this->dataRecord['parent_domain_id']) {
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
@@ -177,14 +177,14 @@
 			$dir = $web["document_root"];
 			$uid = $web["system_user"];
 			$gid = $web["system_group"];
-		
+
 			// The FTP user shall be owned by the same group then the website
 			$sys_groupid = $web['sys_groupid'];
-		
+
 			$sql = "UPDATE ftp_user SET server_id = $server_id, dir = '$dir', uid = '$uid', gid = '$gid', sys_groupid = '$sys_groupid' WHERE ftp_user_id = ".$this->id;
 			$app->db->query($sql);
 		}
-		
+
 		//* 2. check to ensure that the FTP user path is not changed to a path outside of the docroot by a normal user
 		if(isset($this->dataRecord['dir']) && $this->dataRecord['dir'] != $this->oldDataRecord['dir'] && !$app->auth->is_admin()) {
 			$vd = new validate_ftpuser;
@@ -199,10 +199,11 @@
 				$app->db->query($sql);
 				$app->log("Error in FTP path settings of FTP user ".$this->dataRecord['username'], 1);
 			}
-			
+
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/sites/ftp_user_list.php b/interface/web/sites/ftp_user_list.php
index d5b648c..c9770cb 100644
--- a/interface/web/sites/ftp_user_list.php
+++ b/interface/web/sites/ftp_user_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,23 +48,23 @@
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('sites');
-		
+
 		if($global_config['webftp_url'] != '') {
-			$app->tpl->setVar('webftp_link',1);
-			$app->tpl->setVar('webftp_url',$global_config['webftp_url']);
+			$app->tpl->setVar('webftp_link', 1);
+			$app->tpl->setVar('webftp_url', $global_config['webftp_url']);
 		} else {
-			$app->tpl->setVar('webftp_link',0);
+			$app->tpl->setVar('webftp_link', 0);
 		}
-		
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
@@ -72,4 +72,4 @@
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/lib/admin.conf.php b/interface/web/sites/lib/admin.conf.php
index 67c94a5..acb6c35 100644
--- a/interface/web/sites/lib/admin.conf.php
+++ b/interface/web/sites/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php
index 1f7067e..7bb6f8e 100644
--- a/interface/web/sites/lib/module.conf.php
+++ b/interface/web/sites/lib/module.conf.php
@@ -2,182 +2,182 @@
 
 $userid=$app->auth->get_user_id();
 
-$module["name"] 	= "sites";
-$module["title"] 	= "top_menu_sites";
-$module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "sites/web_domain_list.php";
+$module["name"]  = "sites";
+$module["title"]  = "top_menu_sites";
+$module["template"]  = "module.tpl.htm";
+$module["startpage"]  = "sites/web_domain_list.php";
 $module["tab_width"]    = '';
 
 // Websites menu
 $items=array();
 
-if($app->auth->get_client_limit($userid,'web_domain') != 0)
+if($app->auth->get_client_limit($userid, 'web_domain') != 0)
 {
-$items[] = array(   'title' 	=> "Website",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/web_domain_list.php',
-                    'html_id'   => 'domain_list');
+	$items[] = array(   'title'  => "Website",
+		'target'  => 'content',
+		'link' => 'sites/web_domain_list.php',
+		'html_id'   => 'domain_list');
 }
 
-if($app->auth->get_client_limit($userid,'web_subdomain') != 0)
+if($app->auth->get_client_limit($userid, 'web_subdomain') != 0)
 {
-$items[] = array(   'title' 	=> "Subdomain",
-                    'target' 	=> 'content',
-                    'link'      => 'sites/web_subdomain_list.php',
-                    'html_id'   => 'subdomain_list');
+	$items[] = array(   'title'  => "Subdomain",
+		'target'  => 'content',
+		'link'      => 'sites/web_subdomain_list.php',
+		'html_id'   => 'subdomain_list');
 
-    // read web config
-    $app->uses('getconf');
-    $sys_config = $app->getconf->get_global_config('sites');
-    if($sys_config['vhost_subdomains'] == 'y') {
-$items[] = array(   'title' 	=> "Subdomain (Vhost)",
-                    'target' 	=> 'content',
-                    'link'      => 'sites/web_vhost_subdomain_list.php',
-                    'html_id'   => 'subdomain_list');
-    }
+	// read web config
+	$app->uses('getconf');
+	$sys_config = $app->getconf->get_global_config('sites');
+	if($sys_config['vhost_subdomains'] == 'y') {
+		$items[] = array(   'title'  => "Subdomain (Vhost)",
+			'target'  => 'content',
+			'link'      => 'sites/web_vhost_subdomain_list.php',
+			'html_id'   => 'subdomain_list');
+	}
 }
 
-if($app->auth->get_client_limit($userid,'web_aliasdomain') != 0)
+if($app->auth->get_client_limit($userid, 'web_aliasdomain') != 0)
 {
-$items[] = array(   'title'   => "Aliasdomain",
-                    'target'  => 'content',
-                    'link'    => 'sites/web_aliasdomain_list.php',
-                    'html_id' => 'aliasdomain_list');
+	$items[] = array(   'title'   => "Aliasdomain",
+		'target'  => 'content',
+		'link'    => 'sites/web_aliasdomain_list.php',
+		'html_id' => 'aliasdomain_list');
 }
 
 if(count($items))
 {
-$module["nav"][] = array(   'title' => 'Websites',
-                            'open'  => 1,
-                            'items' => $items);
+	$module["nav"][] = array(   'title' => 'Websites',
+		'open'  => 1,
+		'items' => $items);
 }
 
 // Databases menu
-if($app->auth->get_client_limit($userid,'database') != 0)
+if($app->auth->get_client_limit($userid, 'database') != 0)
 {
-$items=array();
+	$items=array();
 
-$items[] = array(   'title'     => "Database",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/database_list.php',
-                    'html_id'   => 'database_list');
+	$items[] = array(   'title'     => "Database",
+		'target'  => 'content',
+		'link' => 'sites/database_list.php',
+		'html_id'   => 'database_list');
 
 
-$items[] = array(   'title'     => "Database User",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/database_user_list.php',
-                    'html_id'   => 'database_user_list'
-);
+	$items[] = array(   'title'     => "Database User",
+		'target'  => 'content',
+		'link' => 'sites/database_user_list.php',
+		'html_id'   => 'database_user_list'
+	);
 
-$module["nav"][] = array(   'title' => 'Database',
-                            'open'  => 1,
-                            'items' => $items);
+	$module["nav"][] = array(   'title' => 'Database',
+		'open'  => 1,
+		'items' => $items);
 }
 
 // Web menu
 $items=array();
-if($app->auth->get_client_limit($userid,'ftp_user') != 0)
+if($app->auth->get_client_limit($userid, 'ftp_user') != 0)
 {
-$items[] = array(   'title'     => "FTP-User",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/ftp_user_list.php',
-                    'html_id'   => 'ftp_user_list');
+	$items[] = array(   'title'     => "FTP-User",
+		'target'  => 'content',
+		'link' => 'sites/ftp_user_list.php',
+		'html_id'   => 'ftp_user_list');
 }
 
-if($app->auth->get_client_limit($userid,'webdav_user') != 0)
+if($app->auth->get_client_limit($userid, 'webdav_user') != 0)
 {
-$items[] = array(   'title' 	=> "Webdav-User",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/webdav_user_list.php',
-                    'html_id'   => 'webdav_user_list');
+	$items[] = array(   'title'  => "Webdav-User",
+		'target'  => 'content',
+		'link' => 'sites/webdav_user_list.php',
+		'html_id'   => 'webdav_user_list');
 }
 
 $items[] = array(   'title'     => "Folder",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/web_folder_list.php',
-                    'html_id'   => 'web_folder_list');
-	
-$items[] = array(   'title' 	=> "Folder users",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/web_folder_user_list.php',
-                    'html_id'   => 'web_folder_user_list');
-	
+	'target'  => 'content',
+	'link' => 'sites/web_folder_list.php',
+	'html_id'   => 'web_folder_list');
+
+$items[] = array(   'title'  => "Folder users",
+	'target'  => 'content',
+	'link' => 'sites/web_folder_user_list.php',
+	'html_id'   => 'web_folder_user_list');
+
 $module["nav"][] = array(   'title' => 'Web Access',
-                            'open'  => 1,
-                            'items' => $items);
+	'open'  => 1,
+	'items' => $items);
 
 
 // CMD menu
-if($app->auth->get_client_limit($userid,'shell_user') != 0 OR $app->auth->get_client_limit($userid,'cron') != 0)
+if($app->auth->get_client_limit($userid, 'shell_user') != 0 or $app->auth->get_client_limit($userid, 'cron') != 0)
 {
-$items=array();
+	$items=array();
 
-if($app->auth->get_client_limit($userid,'shell_user') != 0)
-{
-$items[] = array(   'title'     => "Shell-User",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/shell_user_list.php',
-                    'html_id'   => 'shell_user_list');	
-}
-if($app->auth->get_client_limit($userid,'cron') != 0)
-{	
-$items[] = array(   'title'   => "Cron Jobs",
-                    'target'  => 'content',
-                    'link'    => 'sites/cron_list.php',
-                    'html_id' => 'cron_list');	
-}
-$module["nav"][] = array(   'title' => 'Command Line',
-                            'open'  => 1,
-                            'items' => $items);
+	if($app->auth->get_client_limit($userid, 'shell_user') != 0)
+	{
+		$items[] = array(   'title'     => "Shell-User",
+			'target'  => 'content',
+			'link' => 'sites/shell_user_list.php',
+			'html_id'   => 'shell_user_list');
+	}
+	if($app->auth->get_client_limit($userid, 'cron') != 0)
+	{
+		$items[] = array(   'title'   => "Cron Jobs",
+			'target'  => 'content',
+			'link'    => 'sites/cron_list.php',
+			'html_id' => 'cron_list');
+	}
+	$module["nav"][] = array(   'title' => 'Command Line',
+		'open'  => 1,
+		'items' => $items);
 }
 
 // APS menu
-if($app->auth->get_client_limit($userid,'aps') != 0)
+if($app->auth->get_client_limit($userid, 'aps') != 0)
 {
-$items = array();
+	$items = array();
 
-$items[] = array(   'title'   => 'Available packages',
-                    'target'  => 'content',
-                    'link'    => 'sites/aps_availablepackages_list.php',
-                    'html_id' => 'aps_availablepackages_list');
+	$items[] = array(   'title'   => 'Available packages',
+		'target'  => 'content',
+		'link'    => 'sites/aps_availablepackages_list.php',
+		'html_id' => 'aps_availablepackages_list');
 
-$items[] = array(   'title'   => 'Installed packages',
-                    'target'  => 'content',
-                    'link'    => 'sites/aps_installedpackages_list.php',
-                    'html_id' => 'aps_installedpackages_list');
-                
+	$items[] = array(   'title'   => 'Installed packages',
+		'target'  => 'content',
+		'link'    => 'sites/aps_installedpackages_list.php',
+		'html_id' => 'aps_installedpackages_list');
 
-// Second menu group, available only for admins
-if($_SESSION['s']['user']['typ'] == 'admin') 
-{
-$items[] = array(   'title'   => 'Update Packagelist',
-                    'target'  => 'content',
-                    'link'    => 'sites/aps_update_packagelist.php',
-                    'html_id' => 'aps_packagedetails_show');
-}
 
-$module['nav'][] = array(   'title' => 'APS Installer',
-                            'open'  => 1,
-                            'items' => $items);
+	// Second menu group, available only for admins
+	if($_SESSION['s']['user']['typ'] == 'admin')
+	{
+		$items[] = array(   'title'   => 'Update Packagelist',
+			'target'  => 'content',
+			'link'    => 'sites/aps_update_packagelist.php',
+			'html_id' => 'aps_packagedetails_show');
+	}
+
+	$module['nav'][] = array(   'title' => 'APS Installer',
+		'open'  => 1,
+		'items' => $items);
 }
 
 // Statistics menu
 $items = array();
 
 $items[] = array(   'title'   => 'Web traffic',
-                    'target'  => 'content',
-                    'link'    => 'sites/web_sites_stats.php',
-                    'html_id' => 'websites_stats');
+	'target'  => 'content',
+	'link'    => 'sites/web_sites_stats.php',
+	'html_id' => 'websites_stats');
 
 $items[] = array(   'title'   => 'Website quota (Harddisk)',
-                    'target'  => 'content',
-                    'link'    => 'sites/user_quota_stats.php',
-                    'html_id' => 'user_quota_stats');
+	'target'  => 'content',
+	'link'    => 'sites/user_quota_stats.php',
+	'html_id' => 'user_quota_stats');
 
 $module['nav'][] = array(   'title' => 'Statistics',
-                            'open'  => 1,
-                            'items' => $items);
+	'open'  => 1,
+	'items' => $items);
 
 // clean up
 unset($items);
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/lib/remote.conf.php b/interface/web/sites/lib/remote.conf.php
index 4cdc6fc..10a4640 100644
--- a/interface/web/sites/lib/remote.conf.php
+++ b/interface/web/sites/lib/remote.conf.php
@@ -9,4 +9,4 @@
 $function_list['sites_web_subdomain_get,sites_web_subdomain_add,sites_web_subdomain_update,sites_web_subdomain_delete'] = 'Sites Subdomain functions';
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/aps_availablepackages.list.php b/interface/web/sites/list/aps_availablepackages.list.php
index b6f52cf..812e57f 100644
--- a/interface/web/sites/list/aps_availablepackages.list.php
+++ b/interface/web/sites/list/aps_availablepackages.list.php
@@ -41,46 +41,46 @@
 
 // Search fields
 $liste["item"][] = array('field'    => 'name',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'TEXT',
-                         'op'       => 'like',
-                         'prefix'   => '%',
-                         'suffix'   => '%',
-                         'width'    => '',
-                         'value'    => '');
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'       => 'like',
+	'prefix'   => '%',
+	'suffix'   => '%',
+	'width'    => '',
+	'value'    => '');
 
 $liste["item"][] = array('field'    => 'version',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'TEXT',
-                         'op'       => 'like',
-                         'prefix'   => '%',
-                         'suffix'   => '%',
-                         'width'    => '',
-                         'value'    => '');
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'       => 'like',
+	'prefix'   => '%',
+	'suffix'   => '%',
+	'width'    => '',
+	'value'    => '');
 
 $liste["item"][] = array('field'    => 'category',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'SELECT',
-                         'op'       => '=',
-                         'prefix'   => '',
-                         'suffix'   => '',
-                         'datasource' => array('type' => 'SQL',
-                                               'querystring' => 'SELECT category FROM aps_packages ORDER BY category',
-                                               'keyfield' => 'category',
-                                               'valuefield' => 'category'),
-                         'width'    => '',
-                         'value'    => '');
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'       => '=',
+	'prefix'   => '',
+	'suffix'   => '',
+	'datasource' => array('type' => 'SQL',
+		'querystring' => 'SELECT category FROM aps_packages ORDER BY category',
+		'keyfield' => 'category',
+		'valuefield' => 'category'),
+	'width'    => '',
+	'value'    => '');
 
-if($_SESSION['s']['user']['typ'] == 'admin') 
+if($_SESSION['s']['user']['typ'] == 'admin')
 {
-$liste['item'][] = array('field'    => 'package_status',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'SELECT',
-                         'op'       => '=',
-                         'prefix'   => '',
-                         'suffix'   => '',
-                         'width'    => '',
-                         'value'    => array(PACKAGE_ENABLED => '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>',
-                                             PACKAGE_LOCKED => '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>'));
-}      
-?>
\ No newline at end of file
+	$liste['item'][] = array('field'    => 'package_status',
+		'datatype' => 'VARCHAR',
+		'formtype' => 'SELECT',
+		'op'       => '=',
+		'prefix'   => '',
+		'suffix'   => '',
+		'width'    => '',
+		'value'    => array(PACKAGE_ENABLED => '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>',
+			PACKAGE_LOCKED => '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>'));
+}
+?>
diff --git a/interface/web/sites/list/aps_installedpackages.list.php b/interface/web/sites/list/aps_installedpackages.list.php
index 0f90a73..d9a51d8 100644
--- a/interface/web/sites/list/aps_installedpackages.list.php
+++ b/interface/web/sites/list/aps_installedpackages.list.php
@@ -48,26 +48,26 @@
 
 // Search fields
 $liste["item"][] = array('field'    => 'name',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'TEXT',
-                         'op'       => 'LIKE',
-                         'prefix'   => '%',
-                         'suffix'   => '%',
-                         'width'    => '',
-                         'value'    => '',
-						 'table'	=> 'aps_packages');
- 
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'       => 'LIKE',
+	'prefix'   => '%',
+	'suffix'   => '%',
+	'width'    => '',
+	'value'    => '',
+	'table' => 'aps_packages');
+
 $liste["item"][] = array('field'    => 'version',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'TEXT',
-                         'op'       => 'like',
-                         'prefix'   => '%',
-                         'suffix'   => '%',
-                         'width'    => '',
-                         'value'    => '',
-						 'table'	=> 'aps_packages');
- 
- /*
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'       => 'like',
+	'prefix'   => '%',
+	'suffix'   => '%',
+	'width'    => '',
+	'value'    => '',
+	'table' => 'aps_packages');
+
+/*
 $liste["item"][] = array('field'    => 'customer_id',
                          'datatype' => 'INTEGER',
                          'formtype' => 'SELECT',
@@ -77,17 +77,17 @@
                          'width'    => '',
                          'value'    => '');
 */
-                         
+
 $liste["item"][] = array('field'    => 'instance_status',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'SELECT',
-                         'op'       => '=',
-                         'prefix'   => '',
-                         'suffix'   => '',
-                         'width'    => '',
-                         'value'    => array(INSTANCE_INSTALL => $app->lng('Installation_task'),
-                                             INSTANCE_ERROR => $app->lng('Installation_error'),
-                                             INSTANCE_SUCCESS => $app->lng('Installation_success'),
-                                             INSTANCE_REMOVE => $app->lng('Installation_remove')),
-						 'table'	=> 'aps_instances'); 
-?>
\ No newline at end of file
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'       => '=',
+	'prefix'   => '',
+	'suffix'   => '',
+	'width'    => '',
+	'value'    => array(INSTANCE_INSTALL => $app->lng('Installation_task'),
+		INSTANCE_ERROR => $app->lng('Installation_error'),
+		INSTANCE_SUCCESS => $app->lng('Installation_success'),
+		INSTANCE_REMOVE => $app->lng('Installation_remove')),
+	'table' => 'aps_instances');
+?>
diff --git a/interface/web/sites/list/cron.list.php b/interface/web/sites/list/cron.list.php
index 7275a06..f13beab 100644
--- a/interface/web/sites/list/cron.list.php
+++ b/interface/web/sites/list/cron.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "cron";
+$liste["name"]     = "cron";
 
 // Database table
-$liste["table"] 			= "cron";
+$liste["table"]    = "cron";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "cron_list.php";
+$liste["file"]    = "cron_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "cron_edit.php";
+$liste["edit_file"]   = "cron_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "cron_del.php";
+$liste["delete_file"]  = "cron_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,98 +48,98 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
 $liste["item"][] = array(   'field'     => "parent_domain_id",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "SELECT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'datasource'    => array (  'type'  => 'SQL',
-                                        'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-                                        'keyfield'=> 'domain_id',
-                                        'valuefield'=> 'domain'
-                                     ),
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "SELECT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'datasource'    => array (  'type'  => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_min",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_hour",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_mday",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_month",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_wday",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 
-$liste["item"][] = array(	'field'		=> "command",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "command",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
 
@@ -149,4 +149,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/database.list.php b/interface/web/sites/list/database.list.php
index 56bf15d..c1f6834 100644
--- a/interface/web/sites/list/database.list.php
+++ b/interface/web/sites/list/database.list.php
@@ -14,37 +14,37 @@
 
 // Name of the list
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$liste["name"] 				= "database_admin";
+	$liste["name"]     = "database_admin";
 } else {
-	$liste["name"] 				= "database";
+	$liste["name"]     = "database";
 }
 
 // Database table
-$liste["table"] 			= "web_database";
+$liste["table"]    = "web_database";
 
 // Index index field of the database table
-$liste["table_idx"]			= "database_id";
+$liste["table_idx"]   = "database_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "database_list.php";
+$liste["file"]    = "database_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "database_edit.php";
+$liste["edit_file"]   = "database_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "database_del.php";
+$liste["delete_file"]  = "database_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -52,92 +52,92 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste["item"][] = array(	'field'		=> "remote_access",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "remote_access",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+	$liste["item"][] = array( 'field'  => "sys_groupid",
+		'datatype' => "INTEGER",
+		'formtype' => "SELECT",
+		'op'  => "=",
+		'prefix' => "",
+		'suffix' => "",
+		'datasource' => array (  'type' => 'SQL',
+			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'keyfield'=> 'groupid',
+			'valuefield'=> 'name'
+		),
+		'width'  => "",
+		'value'  => "");
 }
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND db_server = 1 ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND db_server = 1 ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "database_user_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT database_user_id, database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user',
-														'keyfield'=> 'database_user_id',
-														'valuefield'=> 'database_user'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "database_user_id",
+	'datatype' => "INTEGER",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT database_user_id, database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user',
+		'keyfield'=> 'database_user_id',
+		'valuefield'=> 'database_user'
+	),
+	'width'  => "",
+	'value'  => "");
 
 $liste["item"][] = array(    'field'        => "database_name",
-                            'datatype'    => "VARCHAR",
-                            'formtype'    => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'        => "",
-                            'value'        => "");
+	'datatype'    => "VARCHAR",
+	'formtype'    => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'        => "",
+	'value'        => "");
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/database_user.list.php b/interface/web/sites/list/database_user.list.php
index 67796a8..202916e 100644
--- a/interface/web/sites/list/database_user.list.php
+++ b/interface/web/sites/list/database_user.list.php
@@ -14,37 +14,37 @@
 
 // Name of the list
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$liste["name"] 				= "database_user_admin";
+	$liste["name"]     = "database_user_admin";
 } else {
-	$liste["name"] 				= "database_user";
+	$liste["name"]     = "database_user";
 }
 
 // Database table
-$liste["table"] 			= "web_database_user";
+$liste["table"]    = "web_database_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "database_user_id";
+$liste["table_idx"]   = "database_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "database_user_list.php";
+$liste["file"]    = "database_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "database_user_edit.php";
+$liste["edit_file"]   = "database_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "database_user_del.php";
+$liste["delete_file"]  = "database_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -53,29 +53,29 @@
 
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+	$liste["item"][] = array( 'field'  => "sys_groupid",
+		'datatype' => "INTEGER",
+		'formtype' => "SELECT",
+		'op'  => "=",
+		'prefix' => "",
+		'suffix' => "",
+		'datasource' => array (  'type' => 'SQL',
+			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'keyfield'=> 'groupid',
+			'valuefield'=> 'name'
+		),
+		'width'  => "",
+		'value'  => "");
 }
 
-$liste["item"][] = array(	'field'		=> "database_user",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "database_user",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/ftp_user.list.php b/interface/web/sites/list/ftp_user.list.php
index 2c64a94..fc15170 100644
--- a/interface/web/sites/list/ftp_user.list.php
+++ b/interface/web/sites/list/ftp_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "ftp_user";
+$liste["name"]     = "ftp_user";
 
 // Database table
-$liste["table"] 			= "ftp_user";
+$liste["table"]    = "ftp_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "ftp_user_id";
+$liste["table_idx"]   = "ftp_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "ftp_user_list.php";
+$liste["file"]    = "ftp_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "ftp_user_edit.php";
+$liste["edit_file"]   = "ftp_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "ftp_user_del.php";
+$liste["delete_file"]  = "ftp_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,55 +48,55 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/shell_user.list.php b/interface/web/sites/list/shell_user.list.php
index 2dd2b4e..cd88eb2 100644
--- a/interface/web/sites/list/shell_user.list.php
+++ b/interface/web/sites/list/shell_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "shell_user";
+$liste["name"]     = "shell_user";
 
 // Database table
-$liste["table"] 			= "shell_user";
+$liste["table"]    = "shell_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "shell_user_id";
+$liste["table_idx"]   = "shell_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "shell_user_list.php";
+$liste["file"]    = "shell_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "shell_user_edit.php";
+$liste["edit_file"]   = "shell_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "shell_user_del.php";
+$liste["delete_file"]  = "shell_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,55 +48,55 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/user_quota_stats.list.php b/interface/web/sites/list/user_quota_stats.list.php
index 646da27..3dc904e 100644
--- a/interface/web/sites/list/user_quota_stats.list.php
+++ b/interface/web/sites/list/user_quota_stats.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "user_quota_stats";
+$liste["name"]     = "user_quota_stats";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "user_quota_stats.php";
+$liste["file"]    = "user_quota_stats.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_domain_edit.php";
+$liste["edit_file"]   = "web_domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_domain_del.php";
+$liste["delete_file"]  = "web_domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 // mark columns for php sorting (no real mySQL columns)
 $liste["phpsort"] = array('used_sort', 'files');
@@ -50,27 +50,27 @@
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "system_user",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "system_user",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/web_aliasdomain.list.php b/interface/web/sites/list/web_aliasdomain.list.php
index a692156..713cfc0 100644
--- a/interface/web/sites/list/web_aliasdomain.list.php
+++ b/interface/web/sites/list/web_aliasdomain.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_aliasdomain";
+$liste["name"]     = "web_aliasdomain";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_aliasdomain_list.php";
+$liste["file"]    = "web_aliasdomain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_aliasdomain_edit.php";
+$liste["edit_file"]   = "web_aliasdomain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_aliasdomain_del.php";
+$liste["delete_file"]  = "web_aliasdomain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,58 +48,58 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/web_domain.list.php b/interface/web/sites/list/web_domain.list.php
index 8f98f6e..a455f54 100644
--- a/interface/web/sites/list/web_domain.list.php
+++ b/interface/web/sites/list/web_domain.list.php
@@ -14,103 +14,103 @@
 
 // Name of the list
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$liste["name"] 				= "web_domain_admin";
+	$liste["name"]     = "web_domain_admin";
 } else {
-	$liste["name"] 				= "web_domain";
+	$liste["name"]     = "web_domain";
 }
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_domain_list.php";
+$liste["file"]    = "web_domain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_domain_edit.php";
+$liste["edit_file"]   = "web_domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_domain_del.php";
+$liste["delete_file"]  = "web_domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "domain_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain_id",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+	$liste["item"][] = array( 'field'  => "sys_groupid",
+		'datatype' => "INTEGER",
+		'formtype' => "SELECT",
+		'op'  => "=",
+		'prefix' => "",
+		'suffix' => "",
+		'datasource' => array (  'type' => 'SQL',
+			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'keyfield'=> 'groupid',
+			'valuefield'=> 'name'
+		),
+		'width'  => "",
+		'value'  => "");
 }
-	
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT a.server_id, a.server_name FROM server a, web_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "INTEGER",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT a.server_id, a.server_name FROM server a, web_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/web_folder.list.php b/interface/web/sites/list/web_folder.list.php
index dfcb379..aa23fac 100644
--- a/interface/web/sites/list/web_folder.list.php
+++ b/interface/web/sites/list/web_folder.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_folder";
+$liste["name"]     = "web_folder";
 
 // Database table
-$liste["table"] 			= "web_folder";
+$liste["table"]    = "web_folder";
 
 // Index index field of the database table
-$liste["table_idx"]			= "web_folder_id";
+$liste["table_idx"]   = "web_folder_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_folder_list.php";
+$liste["file"]    = "web_folder_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_folder_edit.php";
+$liste["edit_file"]   = "web_folder_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_folder_del.php";
+$liste["delete_file"]  = "web_folder_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,55 +48,55 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain') AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain') AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "path",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "path",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/web_folder_user.list.php b/interface/web/sites/list/web_folder_user.list.php
index f284366..04a8513 100644
--- a/interface/web/sites/list/web_folder_user.list.php
+++ b/interface/web/sites/list/web_folder_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_folder_user";
+$liste["name"]     = "web_folder_user";
 
 // Database table
-$liste["table"] 			= "web_folder_user";
+$liste["table"]    = "web_folder_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "web_folder_user_id";
+$liste["table_idx"]   = "web_folder_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_folder_user_list.php";
+$liste["file"]    = "web_folder_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_folder_user_edit.php";
+$liste["edit_file"]   = "web_folder_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_folder_user_del.php";
+$liste["delete_file"]  = "web_folder_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 $auth_sql = $app->tform->getAuthSQL('r', 'web_domain');
 
@@ -50,41 +50,41 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "web_folder_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "Select concat(web_domain.domain,' ',web_folder.path) as name, web_folder.web_folder_id from web_domain, web_folder WHERE web_domain.domain_id = web_folder.parent_domain_id AND ".$auth_sql." ORDER BY web_domain.domain",
-										'keyfield'=> 'web_folder_id',
-										'valuefield'=> 'name'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "web_folder_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "Select concat(web_domain.domain,' ',web_folder.path) as name, web_folder.web_folder_id from web_domain, web_folder WHERE web_domain.domain_id = web_folder.parent_domain_id AND ".$auth_sql." ORDER BY web_domain.domain",
+		'keyfield'=> 'web_folder_id',
+		'valuefield'=> 'name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/web_sites_stats.list.php b/interface/web/sites/list/web_sites_stats.list.php
index 8539c7e..25afcc4 100644
--- a/interface/web/sites/list/web_sites_stats.list.php
+++ b/interface/web/sites/list/web_sites_stats.list.php
@@ -13,51 +13,51 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_sites_stats";
+$liste["name"]     = "web_sites_stats";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_sites_stats.php";
+$liste["file"]    = "web_sites_stats.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_domain_edit.php";
+$liste["edit_file"]   = "web_domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_domain_del.php";
+$liste["delete_file"]  = "web_domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/web_subdomain.list.php b/interface/web/sites/list/web_subdomain.list.php
index 637de0e..2a47d77 100644
--- a/interface/web/sites/list/web_subdomain.list.php
+++ b/interface/web/sites/list/web_subdomain.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_subdomain";
+$liste["name"]     = "web_subdomain";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_subdomain_list.php";
+$liste["file"]    = "web_subdomain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_subdomain_edit.php";
+$liste["edit_file"]   = "web_subdomain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_subdomain_del.php";
+$liste["delete_file"]  = "web_subdomain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,58 +48,58 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/web_vhost_subdomain.list.php b/interface/web/sites/list/web_vhost_subdomain.list.php
index 192613c..975814d 100644
--- a/interface/web/sites/list/web_vhost_subdomain.list.php
+++ b/interface/web/sites/list/web_vhost_subdomain.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_vhost_subdomain";
+$liste["name"]     = "web_vhost_subdomain";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_vhost_subdomain_list.php";
+$liste["file"]    = "web_vhost_subdomain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_vhost_subdomain_edit.php";
+$liste["edit_file"]   = "web_vhost_subdomain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_vhost_subdomain_del.php";
+$liste["delete_file"]  = "web_vhost_subdomain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,58 +48,58 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/webdav_user.list.php b/interface/web/sites/list/webdav_user.list.php
index 6211a2f..339bc0d 100644
--- a/interface/web/sites/list/webdav_user.list.php
+++ b/interface/web/sites/list/webdav_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "webdav_user";
+$liste["name"]     = "webdav_user";
 
 // Database table
-$liste["table"] 			= "webdav_user";
+$liste["table"]    = "webdav_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "webdav_user_id";
+$liste["table_idx"]   = "webdav_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "webdav_user_list.php";
+$liste["file"]    = "webdav_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "webdav_user_edit.php";
+$liste["edit_file"]   = "webdav_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "webdav_user_del.php";
+$liste["delete_file"]  = "webdav_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,52 +48,52 @@
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/shell_user_del.php b/interface/web/sites/shell_user_del.php
index c6c0cdd..1df8c32 100644
--- a/interface/web/sites/shell_user_del.php
+++ b/interface/web/sites/shell_user_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php
index a18dd8e..24ef093 100644
--- a/interface/web/sites/shell_user_edit.php
+++ b/interface/web/sites/shell_user_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,10 +49,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_shell_user')) {
@@ -62,7 +62,7 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_shell_user_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
 
@@ -72,18 +72,18 @@
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		
+
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$shelluser_prefix = $app->tools_sites->replacePrefix($global_config['shelluser_prefix'], $this->dataRecord);
-		
+
 		if ($this->dataRecord['username'] != ""){
 			/* REMOVE the restriction */
 			$app->tpl->setVar("username", $app->tools_sites->removePrefix($this->dataRecord['username'], $this->dataRecord['username_prefix'], $shelluser_prefix));
 		}
-        
-        $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $shelluser_prefix, $global_config['shelluser_prefix']));
-		
+
+		$app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $shelluser_prefix, $global_config['shelluser_prefix']));
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -94,13 +94,13 @@
 
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the record of the parent domain
 		//$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        //if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+		//if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 		if(isset($this->dataRecord["parent_domain_id"])) {
 			$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
 			if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
@@ -110,20 +110,20 @@
 			if(!$parent_domain) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 			unset($tmp);
 		}
-		
+
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
-		
+
 		if(isset($this->dataRecord['username']) && trim($this->dataRecord['username']) == '') $app->tform->errorMessage .= $app->tform->lng('username_error_empty').'<br />';
 		if(isset($this->dataRecord['username']) && empty($this->dataRecord['parent_domain_id'])) $app->tform->errorMessage .= $app->tform->lng('parent_domain_id_error_empty').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'./')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
-		
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], '..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], './')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
+
 		if(isset($this->dataRecord['ssh_rsa'])) $this->dataRecord['ssh_rsa'] = trim($this->dataRecord['ssh_rsa']);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
 
@@ -135,45 +135,45 @@
 			}
 		}
 		unset($blacklist);
-		
+
 		/*
 		 * If the names should be restricted -> do it!
 		 */
 		if ($app->tform->errorMessage == ''){
-			
+
 			$app->uses('getconf,tools_sites');
 			$global_config = $app->getconf->get_global_config('sites');
 			$shelluser_prefix = $app->tools_sites->replacePrefix($global_config['shelluser_prefix'], $this->dataRecord);
-			
-            $this->dataRecord['username_prefix'] = $shelluser_prefix;
+
+			$this->dataRecord['username_prefix'] = $shelluser_prefix;
 			/* restrict the names */
 			$this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
-			
+
 			if(strlen($this->dataRecord['username']) > 32) $app->tform->errorMessage .= $app->tform->lng("username_must_not_exceed_32_chars_txt");
 		}
 		parent::onBeforeInsert();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
 		$server_id = $web["server_id"];
 		$dir = $web["document_root"];
 		$puser = $web["system_user"];
 		$pgroup = $web["system_group"];
-		
+
 		// The FTP user shall be owned by the same group then the website
 		$sys_groupid = $web['sys_groupid'];
-		
+
 		$sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', puser = '$puser', pgroup = '$pgroup', sys_groupid = '$sys_groupid' WHERE shell_user_id = ".$this->id;
 		$app->db->query($sql);
-		
+
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf, $interfaceConf;
-		
+
 		// check if the username is not blacklisted
 		$blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
 		foreach($blacklist as $line) {
@@ -193,26 +193,27 @@
 			$app->uses('getconf,tools_sites');
 			$global_config = $app->getconf->get_global_config('sites');
 			$shelluser_prefix = $app->tools_sites->replacePrefix($global_config['shelluser_prefix'], $this->dataRecord);
-			
-            $old_record = $app->tform->getDataRecord($this->id);
-            $shelluser_prefix = $app->tools_sites->getPrefix($old_record['username_prefix'], $shelluser_prefix);
-            $this->dataRecord['username_prefix'] = $shelluser_prefix;
-            
+
+			$old_record = $app->tform->getDataRecord($this->id);
+			$shelluser_prefix = $app->tools_sites->getPrefix($old_record['username_prefix'], $shelluser_prefix);
+			$this->dataRecord['username_prefix'] = $shelluser_prefix;
+
 			/* restrict the names */
 			$this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
-			
+
 			if(strlen($this->dataRecord['username']) > 32) $app->tform->errorMessage .= $app->tform->lng("username_must_not_exceed_32_chars_txt");
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
-		
+
+
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/shell_user_list.php b/interface/web/sites/shell_user_list.php
index cba130c..8a47ebc 100644
--- a/interface/web/sites/shell_user_list.php
+++ b/interface/web/sites/shell_user_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -53,4 +53,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/user_quota_stats.php b/interface/web/sites/user_quota_stats.php
index 32aa706..aed8e22 100644
--- a/interface/web/sites/user_quota_stats.php
+++ b/interface/web/sites/user_quota_stats.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,30 +23,30 @@
 $monitor_data = array();
 if(is_array($tmp_rec)) {
 	foreach ($tmp_rec as $tmp_mon) {
-		$monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
+		$monitor_data = array_merge_recursive($monitor_data, unserialize($app->db->unquote($tmp_mon['data'])));
 	}
 }
 
 
 class list_action extends listform_actions {
-	
+
 	function prepareDataRow($rec)
-    {
-		global $app,$monitor_data;
-		
+	{
+		global $app, $monitor_data;
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
 		$username = $rec['system_user'];
-		
+
 		$rec['used'] = $monitor_data['user'][$username]['used'];
 		$rec['used_sort'] = $rec['used'];
 		$rec['soft'] = $monitor_data['user'][$username]['soft'];
 		$rec['hard'] = $monitor_data['user'][$username]['hard'];
 		$rec['files'] = $monitor_data['user'][$username]['files'];
-		
+
 		if (!is_numeric($rec['used'])){
 			if ($rec['used'][0] > $rec['used'][1]){
 				$rec['used'] = $rec['used'][0];
@@ -57,42 +57,43 @@
 		if (!is_numeric($rec['soft'])) $rec['soft']=$rec['soft'][1];
 		if (!is_numeric($rec['hard'])) $rec['hard']=$rec['hard'][1];
 		if (!is_numeric($rec['files'])) $rec['files']=$rec['files'][1];
-		
+
 		if($rec['used'] > 1024) {
-			$rec['used'] = round($rec['used'] / 1024,2).' MB';
+			$rec['used'] = round($rec['used'] / 1024, 2).' MB';
 		} else {
 			if ($rec['used'] != '') $rec['used'] .= ' KB';
 		}
-		
+
 		if($rec['soft'] > 1024) {
-			$rec['soft'] = round($rec['soft'] / 1024,2).' MB';
+			$rec['soft'] = round($rec['soft'] / 1024, 2).' MB';
 		} else {
 			$rec['soft'] .= ' KB';
 		}
-		
+
 		if($rec['hard'] > 1024) {
-			$rec['hard'] = round($rec['hard'] / 1024,2).' MB';
+			$rec['hard'] = round($rec['hard'] / 1024, 2).' MB';
 		} else {
 			$rec['hard'] .= ' KB';
 		}
-		
+
 		if($rec['soft'] == " KB") $rec['soft'] = $app->lng('unlimited');
 		if($rec['hard'] == " KB") $rec['hard'] = $app->lng('unlimited');
-		
-		
+
+
 		/*
 		if(!strstr($rec['used'],'M') && !strstr($rec['used'],'K')) $rec['used'].= ' B';
 		if(!strstr($rec['soft'],'M') && !strstr($rec['soft'],'K')) $rec['soft'].= ' B';
 		if(!strstr($rec['hard'],'M') && !strstr($rec['hard'],'K')) $rec['hard'].= ' B';
 		*/
-		
+
 		if($rec['soft'] == '0 B' || $rec['soft'] == '0 KB' || $rec['soft'] == '0') $rec['soft'] = $app->lng('unlimited');
 		if($rec['hard'] == '0 B' || $rec['hard'] == '0 KB' || $rec['hard'] == '0') $rec['hard'] = $app->lng('unlimited');
-		
+
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
+
 }
 
 $list = new list_action;
@@ -101,4 +102,4 @@
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_aliasdomain_del.php b/interface/web/sites/web_aliasdomain_del.php
index bb39736..6793eba 100644
--- a/interface/web/sites/web_aliasdomain_del.php
+++ b/interface/web/sites/web_aliasdomain_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php
index 1d05a5e..5dbcb12 100644
--- a/interface/web/sites/web_aliasdomain_edit.php
+++ b/interface/web/sites/web_aliasdomain_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,28 +49,28 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	var $parent_domain_record;
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_web_aliasdomain',"type = 'alias'")) {
+			if(!$app->tform->checkClientLimit('limit_web_aliasdomain', "type = 'alias'")) {
 				$app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_web_aliasdomain',"type = 'alias'")) {
+			if(!$app->tform->checkResellerLimit('limit_web_aliasdomain', "type = 'alias'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_web_aliasdomain_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		/*
 		 * Now we have to check, if we should use the domain-module to select the domain
 		 * or not
@@ -101,11 +101,11 @@
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
+			$app->tpl->setVar("domain_option", $domain_select);
 		}
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
-			// Directive Snippets		
+			// Directive Snippets
 			$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
 			$proxy_directive_snippets_txt = '';
 			if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
@@ -114,78 +114,78 @@
 				}
 			}
 			if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-			$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+			$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
 		}
-		
+
 		parent::onShowEnd();
-		
+
 	}
 
 	function onSubmit() {
 		global $app, $conf;
-		
-        /* check if the domain module is used - and check if the selected domain can be used! */
+
+		/* check if the domain module is used - and check if the selected domain can be used! */
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
-            $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
-            if(!$domain_check) {
-                // invalid domain selected
-                $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-            } else {
-                $this->dataRecord['domain'] = $domain_check;
-            }
-        }
-		
+			$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
+			if(!$domain_check) {
+				// invalid domain selected
+				$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+			} else {
+				$this->dataRecord['domain'] = $domain_check;
+			}
+		}
+
 		// nginx: if redirect type is proxy and redirect path is no URL, display error
-		if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
+		if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'], 0, 1) == '/'){
 			$app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
 		}
-        
+
 		// Get the record of the parent domain
 		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-		
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
 		// Set a few fixed values
 		$this->dataRecord["type"] = 'alias';
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
 		//$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
-		
+
 		$this->parent_domain_record = $parent_domain;
-		
+
 		//* make sure that the domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
-		
+
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Check if parent domain has been changed
 		if($this->dataRecord['parent_domain_id'] != $this->oldDataRecord['parent_domain_id']) {
-			
+
 			//* Update the domain owner
 			$app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
-			
+
 			//* Update the old website, so that the vhost alias gets removed
 			//* We force the update by inserting a transaction record without changes manually.
 			$old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$this->oldDataRecord['domain_id']);
-            $app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
+			$app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
 		}
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_aliasdomain_list.php b/interface/web/sites/web_aliasdomain_list.php
index c5e63be..e99e0ce 100644
--- a/interface/web/sites/web_aliasdomain_list.php
+++ b/interface/web/sites/web_aliasdomain_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_domain_del.php b/interface/web/sites/web_domain_del.php
index cefb0ec..f451813 100644
--- a/interface/web/sites/web_domain_del.php
+++ b/interface/web/sites/web_domain_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -52,45 +52,45 @@
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-		
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
 		//* Delete all records that belong to this web.
 		$records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE parent_domain_id = '".$app->functions->intval($this->id)."' AND type != 'vhost'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('web_domain','domain_id',$rec['domain_id']);
+			$app->db->datalogDelete('web_domain', 'domain_id', $rec['domain_id']);
 		}
-		
+
 		//* Delete all records that belong to this web.
 		$records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('ftp_user','ftp_user_id',$rec['ftp_user_id']);
+			$app->db->datalogDelete('ftp_user', 'ftp_user_id', $rec['ftp_user_id']);
 		}
-		
+
 		//* Delete all records that belong to this web.
 		$records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('shell_user','shell_user_id',$rec['shell_user_id']);
+			$app->db->datalogDelete('shell_user', 'shell_user_id', $rec['shell_user_id']);
 		}
-        
-        //* Delete all records that belong to this web.
-        $records = $app->db->queryAllRecords("SELECT id FROM cron WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogDelete('cron','id',$rec['id']);
-        }
-		
+
+		//* Delete all records that belong to this web.
+		$records = $app->db->queryAllRecords("SELECT id FROM cron WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogDelete('cron', 'id', $rec['id']);
+		}
+
 		//* Delete all records that belong to this web
-        $records = $app->db->queryAllRecords("SELECT webdav_user_id FROM webdav_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogDelete('webdav_user','webdav_user_id',$rec['webdav_user_id']);
-        }
-		
+		$records = $app->db->queryAllRecords("SELECT webdav_user_id FROM webdav_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogDelete('webdav_user', 'webdav_user_id', $rec['webdav_user_id']);
+		}
+
 		//* Delete all records that belong to this web
-        $records = $app->db->queryAllRecords("SELECT backup_id FROM web_backup WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogDelete('web_backup','backup_id',$rec['backup_id']);
-        }
-		
+		$records = $app->db->queryAllRecords("SELECT backup_id FROM web_backup WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogDelete('web_backup', 'backup_id', $rec['backup_id']);
+		}
+
 		//* Delete all records that belog to this web.
 		$web_domain = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
 		if($web_domain['domain'] != ''){
@@ -98,27 +98,28 @@
 			if(is_array($aps_instances) && !empty($aps_instances)){
 				foreach($aps_instances as $aps_instance){
 					if($aps_instance['instance_id'] > 0){
-						$app->db->datalogDelete('aps_instances_settings','instance_id',$aps_instance['instance_id']);
-						$app->db->datalogDelete('aps_instances','id',$aps_instance['instance_id']);
+						$app->db->datalogDelete('aps_instances_settings', 'instance_id', $aps_instance['instance_id']);
+						$app->db->datalogDelete('aps_instances', 'id', $aps_instance['instance_id']);
 					}
 				}
 			}
 		}
-		
+
 		//* Delete all web folders
-        $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            //* Delete all web folder users
+		$records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			//* Delete all web folder users
 			$records2 = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$rec['web_folder_id']."'");
 			foreach($records2 as $rec2) {
-				$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec2['web_folder_user_id']);
-        }
-			$app->db->datalogDelete('web_folder','web_folder_id',$rec['web_folder_id']);
-        }
+				$app->db->datalogDelete('web_folder_user', 'web_folder_user_id', $rec2['web_folder_user_id']);
+			}
+			$app->db->datalogDelete('web_folder', 'web_folder_id', $rec['web_folder_id']);
+		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index 5e26a14..dac925f 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -51,7 +51,7 @@
 class page_action extends tform_actions {
 
 	//* Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -62,35 +62,35 @@
 		}
 		return $hash;
 	}
-	
+
 	function onShowNew() {
 		global $app, $conf;
 
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_web_domain',"type = 'vhost'")) {
+			if(!$app->tform->checkClientLimit('limit_web_domain', "type = 'vhost'")) {
 				$app->error($app->tform->wordbook["limit_web_domain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_web_domain',"type = 'vhost'")) {
+			if(!$app->tform->checkResellerLimit('limit_web_domain', "type = 'vhost'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_web_domain_txt"]);
 			}
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 			$app->tpl->setVar("server_id_value", $client['default_webserver']);
 		}
-        $app->tform->formDef['tabs']['domain']['readonly'] = false;
+		$app->tform->formDef['tabs']['domain']['readonly'] = false;
 
 		parent::onShowNew();
 	}
 
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$app->uses('ini_parser,getconf');
 
-        $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+		$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
 
 		//* Client: If the logged in user is not admin and has no sub clients (no reseller)
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -98,13 +98,13 @@
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.limit_web_domain, client.default_webserver, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			//* Get global web config
 			$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
-			
+
 			// Set the webserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".intval($client['default_webserver']));
-			$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_webserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 			//* Fill the IPv4 select field with the IP addresses that are allowed for this client
@@ -118,10 +118,10 @@
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ip_address",$ip_select);
+			$app->tpl->setVar("ip_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//* Fill the IPv6 select field with the IP addresses that are allowed for this client
 			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
 			$ips = $app->db->queryAllRecords($sql);
@@ -133,10 +133,10 @@
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ipv6_address",$ip_select);
+			$app->tpl->setVar("ipv6_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -159,26 +159,26 @@
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
 
-            // add limits to template to be able to hide settings
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-            
-            
+			// add limits to template to be able to hide settings
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
 			//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_domain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			//* Get global web config
 			$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
-			
+
 			// Set the webserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".intval($client['default_webserver']));
-			$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_webserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 			// Fill the client select field
@@ -196,7 +196,7 @@
 					$client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 			//* Fill the IPv4 select field with the IP addresses that are allowed for this client
 			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
@@ -209,10 +209,10 @@
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ip_address",$ip_select);
+			$app->tpl->setVar("ip_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//* Fill the IPv6 select field with the IP addresses that are allowed for this client
 			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
 			$ips = $app->db->queryAllRecords($sql);
@@ -224,10 +224,10 @@
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ipv6_address",$ip_select);
+			$app->tpl->setVar("ipv6_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -253,13 +253,13 @@
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
-            
-            // add limits to template to be able to hide settings
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-            
-            
+
+			// add limits to template to be able to hide settings
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
 			//* Admin: If the logged in user is admin
 		} else {
 
@@ -276,10 +276,10 @@
 				$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
 				$server_id = intval($tmp['server_id']);
 			}
-			
+
 			//* get global web config
 			$web_config = $app->getconf->get_server_config($server_id, 'web');
-		
+
 			//* Fill the IPv4 select field
 			$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND server_id = $server_id";
 			$ips = $app->db->queryAllRecords($sql);
@@ -291,10 +291,10 @@
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ip_address",$ip_select);
+			$app->tpl->setVar("ip_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//* Fill the IPv6 select field
 			$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND server_id = $server_id";
 			$ips = $app->db->queryAllRecords($sql);
@@ -306,7 +306,7 @@
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ipv6_address",$ip_select);
+			$app->tpl->setVar("ipv6_address", $ip_select);
 			unset($tmp);
 			unset($ips);
 
@@ -325,8 +325,8 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-			
+			$app->tpl->setVar("client_group_id", $client_select);
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -352,67 +352,67 @@
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
-            
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
-			
+
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
+
 			// Directive Snippets
 			$php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
 			$php_directive_snippets_txt = '';
 			if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
-					foreach($php_directive_snippets as $php_directive_snippet){
-						$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> ';
-					}
+				foreach($php_directive_snippets as $php_directive_snippet){
+					$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> ';
+				}
 			}
 			if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
-			$app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
-			
+			$app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt);
+
 			if($server_type == 'apache'){
 				$apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
 				$apache_directive_snippets_txt = '';
 				if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
-						foreach($apache_directive_snippets as $apache_directive_snippet){
-							$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> ';
-						}
+					foreach($apache_directive_snippets as $apache_directive_snippet){
+						$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> ';
+					}
 				}
 				if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
-				$app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
+				$app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt);
 			}
-			
+
 			if($server_type == 'nginx'){
 				$nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
 				$nginx_directive_snippets_txt = '';
 				if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
-						foreach($nginx_directive_snippets as $nginx_directive_snippet){
-							$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> ';
-						}
+					foreach($nginx_directive_snippets as $nginx_directive_snippet){
+						$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> ';
+					}
 				}
 				if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
-				$app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
+				$app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt);
 			}
-			
+
 			$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
 			$proxy_directive_snippets_txt = '';
 			if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
-					foreach($proxy_directive_snippets as $proxy_directive_snippet){
-						$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> ';
-					}
+				foreach($proxy_directive_snippets as $proxy_directive_snippet){
+					$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> ';
+				}
 			}
 			if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-			$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+			$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
 		}
 
 		$ssl_domain_select = '';
 		$tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
-		$ssl_domains = array($tmp["domain"],'www.'.$tmp["domain"],'*.'.$tmp["domain"]);
+		$ssl_domains = array($tmp["domain"], 'www.'.$tmp["domain"], '*.'.$tmp["domain"]);
 		if(is_array($ssl_domains)) {
 			foreach( $ssl_domains as $ssl_domain) {
 				$selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
 				$ssl_domain_select .= "<option value='$ssl_domain' $selected>$ssl_domain</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("ssl_domain",$ssl_domain_select);
+		$app->tpl->setVar("ssl_domain", $ssl_domain_select);
 		unset($ssl_domain_select);
 		unset($ssl_domains);
 		unset($ssl_domain);
@@ -457,50 +457,50 @@
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
+			$app->tpl->setVar("domain_option", $domain_select);
 		}
-		
+
 		// check for configuration errors in sys_datalog
 		if($this->id > 0) {
 			$datalog = $app->db->queryOneRecord("SELECT sys_datalog.error, sys_log.tstamp FROM sys_datalog, sys_log WHERE sys_datalog.dbtable = 'web_domain' AND sys_datalog.dbidx = 'domain_id:".$this->id."' AND sys_datalog.datalog_id = sys_log.datalog_id AND sys_log.message = CONCAT('Processed datalog_id ',sys_log.datalog_id) ORDER BY sys_datalog.tstamp DESC");
 			if(is_array($datalog) && !empty($datalog)){
 				if(trim($datalog['error']) != ''){
-					$app->tpl->setVar("config_error_msg",nl2br(htmlentities($datalog['error'])));
-					$app->tpl->setVar("config_error_tstamp",date($app->lng('conf_format_datetime'), $datalog['tstamp']));
+					$app->tpl->setVar("config_error_msg", nl2br(htmlentities($datalog['error'])));
+					$app->tpl->setVar("config_error_tstamp", date($app->lng('conf_format_datetime'), $datalog['tstamp']));
 				}
 			}
 		}
 
 		parent::onShowEnd();
 	}
-    
-    function onShowEdit() {
-        global $app;
-        if($app->tform->checkPerm($this->id, 'riud')) $app->tform->formDef['tabs']['domain']['readonly'] = false;
-        parent::onShowEdit();
-    }
+
+	function onShowEdit() {
+		global $app;
+		if($app->tform->checkPerm($this->id, 'riud')) $app->tform->formDef['tabs']['domain']['readonly'] = false;
+		parent::onShowEdit();
+	}
 
 	function onSubmit() {
 		global $app, $conf;
 
-        /* check if the domain module is used - and check if the selected domain can be used! */
+		/* check if the domain module is used - and check if the selected domain can be used! */
 		if($app->tform->getCurrentTab() == 'domain') {
-            $app->uses('ini_parser,getconf');
-            $settings = $app->getconf->get_global_config('domains');
-            if ($settings['use_domain_module'] == 'y') {
-                $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
-                if(!$domain_check) {
-                    // invalid domain selected
-                    $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-                } else {
-                    $this->dataRecord['domain'] = $domain_check;
-                }
-            }
-        }
-		
+			$app->uses('ini_parser,getconf');
+			$settings = $app->getconf->get_global_config('domains');
+			if ($settings['use_domain_module'] == 'y') {
+				$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
+				if(!$domain_check) {
+					// invalid domain selected
+					$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+				} else {
+					$this->dataRecord['domain'] = $domain_check;
+				}
+			}
+		}
+
 		// nginx: if redirect type is proxy and redirect path is no URL, display error
 		//if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
-		//	$app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
+		// $app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
 		//}
 
 		// Set a few fixed values
@@ -508,31 +508,31 @@
 		$this->dataRecord["type"] = 'vhost';
 		$this->dataRecord["vhost_type"] = 'name';
 
-        $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+		$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
 
 
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-            
-            if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
-            if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
-            if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
-            if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
-            if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
-            if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y';
-            if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
-            if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
-            if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
-			
+
+			if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
+			if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
+			if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
+			if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
+			if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
+			if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y';
+			if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
+			if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
+			if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
+
 			// only generate quota and traffic warnings if value has changed
 			if($this->id > 0) {
 				$old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
 			} else {
 				$old_web_values = $_POST;
 			}
-            
+
 			//* Check the website quota of the client
 			if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) {
 				$tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u'));
@@ -564,7 +564,7 @@
 				unset($tmp);
 				unset($tmp_quota);
 			}
-			
+
 			if($client['parent_client_id'] > 0) {
 				// Get the limits of the reseller
 				$reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
@@ -607,18 +607,18 @@
 				// restore the server ID if the user is not admin and record is edited
 				$tmp = $app->db->queryOneRecord("SELECT server_id, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
 				$this->dataRecord["server_id"] = $tmp["server_id"];
-                
-                // set the settings to current if not provided (or cleared due to limits)
-                if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
-                if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
-                if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
-                if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
-                if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
-                if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
-                if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
-                if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
-                if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
-                
+
+				// set the settings to current if not provided (or cleared due to limits)
+				if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
+				if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
+				if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
+				if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
+				if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
+				if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
+				if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
+				if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
+				if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
+
 				unset($tmp);
 				// When the record is inserted
 			} else {
@@ -638,10 +638,10 @@
 			// Clients may not set the client_group_id, so we unset them if user is not a admin and the client is not a reseller
 			if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
 		}
-		
+
 		//* make sure that the email domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-		
+
 		//* get the server config for this server
 		$app->uses("getconf");
 		if($this->id > 0){
@@ -652,26 +652,26 @@
 			$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
 			$server_id = intval($tmp['server_id']);
 		}
-		$web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : $server_id),'web');
+		$web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : $server_id), 'web');
 		//* Check for duplicate ssl certs per IP if SNI is disabled
 		if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
 			$sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
 			$tmp = $app->db->queryOneRecord($sql);
 			if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
 		}
-		
+
 		// Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0
 		if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') {
 			if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){
-		
+
 			} else {
 				$app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'<br>';
 			}
 		}
-		
+
 		// Check rewrite rules
 		$server_type = $web_config['server_type'];
-		
+
 		if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') {
 			$rewrite_rules = trim($this->dataRecord['rewrite_rules']);
 			$rewrites_are_valid = true;
@@ -684,7 +684,7 @@
 			if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
 				foreach($rewrite_rule_lines as $rewrite_rule_line){
 					// ignore comments
-					if(substr(ltrim($rewrite_rule_line),0,1) == '#') continue;
+					if(substr(ltrim($rewrite_rule_line), 0, 1) == '#') continue;
 					// empty lines
 					if(trim($rewrite_rule_line) == '') continue;
 					// rewrite
@@ -719,7 +719,7 @@
 					break;
 				}
 			}
-			
+
 			if(!$rewrites_are_valid || $if_level != 0){
 				$app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'<br>';
 			}
@@ -745,12 +745,12 @@
 		// Get configuration for the web system
 		$app->uses("getconf");
 		$web_rec = $app->tform->getDataRecord($this->id);
-		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
-		$document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
-		$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);
+		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web');
+		$document_root = str_replace("[website_id]", $this->id, $web_config["website_path"]);
+		$document_root = str_replace("[website_idhash_1]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_2]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_3]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_4]", $this->id_hash($page_form->id, 1), $document_root);
 
 		// get the ID of the client
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -766,14 +766,14 @@
 		// Set the values for document_root, system_user and system_group
 		$system_user = $app->db->quote('web'.$this->id);
 		$system_group = $app->db->quote('client'.$client_id);
-		$document_root = str_replace("[client_id]",$client_id,$document_root);
-		$document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
-		$document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
-		$document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
-		$document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
+		$document_root = str_replace("[client_id]", $client_id, $document_root);
+		$document_root = str_replace("[client_idhash_1]", $this->id_hash($client_id, 1), $document_root);
+		$document_root = str_replace("[client_idhash_2]", $this->id_hash($client_id, 2), $document_root);
+		$document_root = str_replace("[client_idhash_3]", $this->id_hash($client_id, 3), $document_root);
+		$document_root = str_replace("[client_idhash_4]", $this->id_hash($client_id, 4), $document_root);
 		$document_root = $app->db->quote($document_root);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+		$php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]);
+		$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
 		$htaccess_allow_override = $app->db->quote($web_config["htaccess_allow_override"]);
 
 		$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$this->id;
@@ -799,17 +799,17 @@
 		} else {
 			//* We do not allow users to change a domain which has been created by the admin
 			$rec = $app->db->queryOneRecord("SELECT sys_perm_group, domain, ip_address, ipv6_address from web_domain WHERE domain_id = ".$this->id);
-			if(isset($this->dataRecord["domain"]) && $rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
+			if(isset($this->dataRecord["domain"]) && $rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id, 'u')) {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
 				$this->dataRecord["domain"] = $rec['domain'];
 			}
 			if(isset($this->dataRecord["ip_address"]) && $rec['ip_address'] != $this->dataRecord["ip_address"] && $rec['sys_perm_group'] != 'riud') {
-                $this->dataRecord["ip_address"] = $rec['ip_address'];
-            }
+				$this->dataRecord["ip_address"] = $rec['ip_address'];
+			}
 			if(isset($this->dataRecord["ipv6_address"]) && $rec['ipv6_address'] != $this->dataRecord["ipv6_address"] && $rec['sys_perm_group'] != 'riud') {
-                $this->dataRecord["ipv6_address"] = $rec['ipv6_address'];
-            }
+				$this->dataRecord["ipv6_address"] = $rec['ipv6_address'];
+			}
 			unset($rec);
 		}
 
@@ -821,7 +821,7 @@
 			if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'<br />';
 			if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'<br />';
 		}
-		
+
 		if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
 			if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'<br />';
 		}
@@ -845,13 +845,13 @@
 		// Get configuration for the web system
 		$app->uses("getconf");
 		$web_rec = $app->tform->getDataRecord($this->id);
-		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
-		$document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
+		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web');
+		$document_root = str_replace("[website_id]", $this->id, $web_config["website_path"]);
 		$page_formid = isset($page_form->id) ? $page_form->id : '';
-		$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_formid,1),$document_root);
-		$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_formid,1),$document_root);
-		$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_formid,1),$document_root);
-		$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_formid,1),$document_root);
+		$document_root = str_replace("[website_idhash_1]", $this->id_hash($page_formid, 1), $document_root);
+		$document_root = str_replace("[website_idhash_2]", $this->id_hash($page_formid, 1), $document_root);
+		$document_root = str_replace("[website_idhash_3]", $this->id_hash($page_formid, 1), $document_root);
+		$document_root = str_replace("[website_idhash_4]", $this->id_hash($page_formid, 1), $document_root);
 
 		// get the ID of the client
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -872,11 +872,11 @@
 			// Set the values for document_root, system_user and system_group
 			$system_user = $app->db->quote('web'.$this->id);
 			$system_group = $app->db->quote('client'.$client_id);
-			$document_root = str_replace("[client_id]",$client_id,$document_root);
-			$document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
-			$document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
-			$document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
-			$document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
+			$document_root = str_replace("[client_id]", $client_id, $document_root);
+			$document_root = str_replace("[client_idhash_1]", $this->id_hash($client_id, 1), $document_root);
+			$document_root = str_replace("[client_idhash_2]", $this->id_hash($client_id, 2), $document_root);
+			$document_root = str_replace("[client_idhash_3]", $this->id_hash($client_id, 3), $document_root);
+			$document_root = str_replace("[client_idhash_4]", $this->id_hash($client_id, 4), $document_root);
 			$document_root = $app->db->quote($document_root);
 
 			$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root' WHERE domain_id = ".$this->id;
@@ -898,24 +898,24 @@
 			}
 			unset($records);
 			unset($rec);
-			
+
 			//* Update all subdomains and alias domains
 			$records = $app->db->queryAllRecords("SELECT domain_id, `domain`, `type`, `web_folder` FROM web_domain WHERE parent_domain_id = ".$this->id);
 			foreach($records as $rec) {
-                $update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'";
-                if($rec['type'] == 'vhostsubdomain') {
-                    $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$rec['web_folder'],$web_config["php_open_basedir"]);
-                    $php_open_basedir = str_replace("[website_domain]/web",$rec['domain'].'/'.$rec['web_folder'],$php_open_basedir);
-                    $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-                    $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$rec['domain'],$php_open_basedir));
+				$update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'";
+				if($rec['type'] == 'vhostsubdomain') {
+					$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$rec['web_folder'], $web_config["php_open_basedir"]);
+					$php_open_basedir = str_replace("[website_domain]/web", $rec['domain'].'/'.$rec['web_folder'], $php_open_basedir);
+					$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+					$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $rec['domain'], $php_open_basedir));
 
-                    $update_columns .= ", document_root = '".$document_root."', `php_open_basedir` = '".$php_open_basedir."'";
-                }
+					$update_columns .= ", document_root = '".$document_root."', `php_open_basedir` = '".$php_open_basedir."'";
+				}
 				$app->db->datalogUpdate('web_domain', $update_columns, 'domain_id', $rec['domain_id']);
 			}
 			unset($records);
 			unset($rec);
-			
+
 			//* Update all databases
 			$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id);
 			foreach($records as $rec) {
@@ -930,13 +930,13 @@
 		if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
 			$records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
 			foreach($records as $rec) {
-				$subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"],$this->dataRecord["domain"],$rec['domain']));
+				$subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"], $this->dataRecord["domain"], $rec['domain']));
 				$app->db->datalogUpdate('web_domain', "domain = '".$subdomain."'", 'domain_id', $rec['domain_id']);
 			}
 			unset($records);
 			unset($rec);
 			unset($subdomain);
-			
+
 			// Update APS instances
 			$records = $app->db->queryAllRecords("SELECT id, instance_id FROM aps_instances_settings WHERE name = 'main_domain' AND value = '".$this->oldDataRecord["domain"]."'");
 			if(is_array($records) && !empty($records)){
@@ -955,24 +955,24 @@
 			$sql = "UPDATE web_domain SET allow_override = '".$app->db->quote($web_config["htaccess_allow_override"])."' WHERE domain_id = ".$this->id;
 			$app->db->query($sql);
 		}
-		
+
 		//* Set php_open_basedir if empty or domain or client has been changed
 		if(empty($web_rec['php_open_basedir']) ||
-		(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"])) {
+			(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"])) {
 			$php_open_basedir = $web_rec['php_open_basedir'];
-			$php_open_basedir = str_replace($this->oldDataRecord['domain'],$web_rec['domain'],$php_open_basedir);
+			$php_open_basedir = str_replace($this->oldDataRecord['domain'], $web_rec['domain'], $php_open_basedir);
 			$sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
 			$app->db->query($sql);
 		}
 		if(empty($web_rec['php_open_basedir']) ||
-		(isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
-			$document_root = $app->db->quote(str_replace("[client_id]",$client_id,$document_root));
-			$php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
-			$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+			(isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
+			$document_root = $app->db->quote(str_replace("[client_id]", $client_id, $document_root));
+			$php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]);
+			$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
 			$sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
 			$app->db->query($sql);
 		}
-		
+
 		//* Change database backup options when web backup options have been changed
 		if(isset($this->dataRecord['backup_interval']) && ($this->dataRecord['backup_interval'] != $this->oldDataRecord['backup_interval'] || $this->dataRecord['backup_copies'] != $this->oldDataRecord['backup_copies'])) {
 			//* Update all databases
@@ -987,16 +987,16 @@
 			unset($backup_copies);
 			unset($backup_interval);
 		}
-        
-        //* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed
-        if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) {
+
+		//* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed
+		if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) {
 			$records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".$this->id);
 			foreach($records as $rec) {
 				$app->db->datalogUpdate('web_domain', "ip_address = '".$web_rec['ip_address']."', ipv6_address = '".$web_rec['ipv6_address']."'", 'domain_id', $rec['domain_id']);
 			}
 			unset($records);
 			unset($rec);
-        }
+		}
 	}
 
 	function onAfterDelete() {
@@ -1007,7 +1007,7 @@
 		foreach($child_domains as $d) {
 			// Saving record to datalog when db_history enabled
 			if($app->tform->formDef["db_history"] == 'yes') {
-				$app->tform->datalogSave('DELETE',$d["domain_id"],$d,array());
+				$app->tform->datalogSave('DELETE', $d["domain_id"], $d, array());
 			}
 
 			$app->db->query("DELETE FROM web_domain WHERE domain_id = ".$d["domain_id"]." LIMIT 0,1");
@@ -1022,4 +1022,4 @@
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_domain_list.php b/interface/web/sites/web_domain_list.php
index d9c5066..301ec96 100644
--- a/interface/web/sites/web_domain_list.php
+++ b/interface/web/sites/web_domain_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,7 +48,7 @@
 
 
 class list_action extends listform_actions {
-	
+
 }
 
 $list = new list_action;
@@ -56,4 +56,4 @@
 $list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_del.php b/interface/web/sites/web_folder_del.php
index 75f56f4..ec13c35 100644
--- a/interface/web/sites/web_folder_del.php
+++ b/interface/web/sites/web_folder_del.php
@@ -40,8 +40,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -52,19 +52,20 @@
 class page_action extends tform_actions {
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-		
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
 		// Delete all users that belong to this folder.
 		$records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec['web_folder_user_id']);
+			$app->db->datalogDelete('web_folder_user', 'web_folder_user_id', $rec['web_folder_user_id']);
 		}
 		unset($records);
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_edit.php b/interface/web/sites/web_folder_edit.php
index 2f888a1..d3235df 100644
--- a/interface/web/sites/web_folder_edit.php
+++ b/interface/web/sites/web_folder_edit.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -53,20 +53,20 @@
 
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the record of the parent domain
 		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-		
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_list.php b/interface/web/sites/web_folder_list.php
index 08322bc..80159be 100644
--- a/interface/web/sites/web_folder_list.php
+++ b/interface/web/sites/web_folder_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -20,4 +20,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_user_del.php b/interface/web/sites/web_folder_user_del.php
index 3ecff33..4db302e 100644
--- a/interface/web/sites/web_folder_user_del.php
+++ b/interface/web/sites/web_folder_user_del.php
@@ -40,8 +40,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -56,4 +56,4 @@
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_user_edit.php b/interface/web/sites/web_folder_user_edit.php
index c67e823..ce4663e 100644
--- a/interface/web/sites/web_folder_user_edit.php
+++ b/interface/web/sites/web_folder_user_edit.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -50,22 +50,23 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the record of the parent domain
 		$folder = $app->db->queryOneRecord("select * FROM web_folder WHERE web_folder_id = ".$app->functions->intval(@$this->dataRecord["web_folder_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$folder || $folder['web_folder_id'] != @$this->dataRecord['web_folder_id']) $app->tform->errorMessage .= $app->tform->lng("no_folder_perm");
-		
+		if(!$folder || $folder['web_folder_id'] != @$this->dataRecord['web_folder_id']) $app->tform->errorMessage .= $app->tform->lng("no_folder_perm");
+
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $folder["server_id"];
-		
+
 		parent::onSubmit();
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_user_list.php b/interface/web/sites/web_folder_user_list.php
index e5515c2..7879c70 100644
--- a/interface/web/sites/web_folder_user_list.php
+++ b/interface/web/sites/web_folder_user_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -20,4 +20,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_sites_stats.php b/interface/web/sites/web_sites_stats.php
index 6249b68..cc7d4e6 100644
--- a/interface/web/sites/web_sites_stats.php
+++ b/interface/web/sites/web_sites_stats.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -18,68 +18,68 @@
 $app->load('listform_actions');
 
 class list_action extends listform_actions {
-	
+
 	private $sum_this_month = 0;
 	private $sum_this_year = 0;
 	private $sum_last_month = 0;
 	private $sum_last_year = 0;
-	
+
 	function prepareDataRow($rec)
-    {
+	{
 		global $app;
-		
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
-		
+
 		//* Set the statistics colums
 		//** Traffic of the current month
 		$tmp_year = date('Y');
-        $tmp_month = date('m');
+		$tmp_month = date('m');
 		$tmp_rec = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$rec['domain']."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'");
 		$rec['this_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
 		$this->sum_this_month += ($tmp_rec['t']/1024/1024);
-		
+
 		//** Traffic of the current year
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$rec['domain']."' AND YEAR(traffic_date) = '$tmp_year'");
 		$rec['this_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
 		$this->sum_this_year += ($tmp_rec['t']/1024/1024);
-		
+
 		//** Traffic of the last month
-        $tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-        $tmp_month = date('m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		$tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		$tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$rec['domain']."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'");
 		$rec['last_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
 		$this->sum_last_month += ($tmp_rec['t']/1024/1024);
-		
+
 		//** Traffic of the last year
-		$tmp_year = date('Y',mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
+		$tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$rec['domain']."' AND YEAR(traffic_date) = '$tmp_year'");
 		$rec['last_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
 		$this->sum_last_year += ($tmp_rec['t']/1024/1024);
-		
+
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
-		
+
 		return $rec;
 	}
-	
+
 	function onShowEnd()
-    {
+	{
 		global $app;
-		
-		$app->tpl->setVar('sum_this_month',number_format($app->functions->intval($this->sum_this_month), 0, '.', ' '));
-		$app->tpl->setVar('sum_this_year',number_format($app->functions->intval($this->sum_this_year), 0, '.', ' '));
-		$app->tpl->setVar('sum_last_month',number_format($app->functions->intval($this->sum_last_month), 0, '.', ' '));
-		$app->tpl->setVar('sum_last_year',number_format($app->functions->intval($this->sum_last_year), 0, '.', ' '));
-		$app->tpl->setVar('sum_txt',$app->listform->lng('sum_txt'));
-		
+
+		$app->tpl->setVar('sum_this_month', number_format($app->functions->intval($this->sum_this_month), 0, '.', ' '));
+		$app->tpl->setVar('sum_this_year', number_format($app->functions->intval($this->sum_this_year), 0, '.', ' '));
+		$app->tpl->setVar('sum_last_month', number_format($app->functions->intval($this->sum_last_month), 0, '.', ' '));
+		$app->tpl->setVar('sum_last_year', number_format($app->functions->intval($this->sum_last_year), 0, '.', ' '));
+		$app->tpl->setVar('sum_txt', $app->listform->lng('sum_txt'));
+
 		$app->tpl_defaults();
 		$app->tpl->pparse();
 	}
-	
+
 	function getQueryString() {
 		global $app;
 		$sql_where = '';
@@ -89,68 +89,68 @@
 			if($_SESSION['s']['user']['typ'] == "admin") {
 				$sql_where = '';
 			} else {
-				$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and'; 
-                //$sql_where = $app->tform->getAuthSQL('r').' and';
+				$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and';
+				//$sql_where = $app->tform->getAuthSQL('r').' and';
 			}
-		}		
+		}
 		if($this->SQLExtWhere != '') {
 			$sql_where .= ' '.$this->SQLExtWhere.' and';
 		}
-		
+
 		$sql_where = $app->listform->getSearchSQL($sql_where);
 		if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql'];
 		$app->tpl->setVar($app->listform->searchValues);
-		
+
 		$order_by_sql = $this->SQLOrderBy;
 
 		//* Generate SQL for paging
 		$limit_sql = $app->listform->getPagingSQL($sql_where);
-		$app->tpl->setVar('paging',$app->listform->pagingHTML);
+		$app->tpl->setVar('paging', $app->listform->pagingHTML);
 
 		$extselect = '';
 		$join = '';
-		
+
 		if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
-		  $order = str_replace(' DESC','',$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
-		  list($tmp_table, $order) = explode('.', $order);
-		  if($order == 'web_traffic_last_month'){
-		    $tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $tmp_month = date('m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
-		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
-		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
-		    $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_month','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
-		  } elseif($order == 'web_traffic_this_month'){
-		    $tmp_year = date('Y');
-		    $tmp_month = date('m');
-		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
-		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
-		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
-		    $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_month','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
-		  } elseif($order == 'web_traffic_last_year'){
-		    $tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
-		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
-		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
-		    $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_year','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
-		  } elseif($order == 'web_traffic_this_year'){
-		    $tmp_year = date('Y');
-		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
-		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
-		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
-		    $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_year','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
-		  }
+			$order = str_replace(' DESC', '', $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
+			list($tmp_table, $order) = explode('.', $order);
+			if($order == 'web_traffic_last_month'){
+				$tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+				$tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+				$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
+				$join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+				$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
+				$order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_month', 'calctraffic', $order_by_sql);
+				$order_by_sql = "GROUP BY domain ".$order_by_sql;
+			} elseif($order == 'web_traffic_this_month'){
+				$tmp_year = date('Y');
+				$tmp_month = date('m');
+				$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
+				$join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+				$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
+				$order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_month', 'calctraffic', $order_by_sql);
+				$order_by_sql = "GROUP BY domain ".$order_by_sql;
+			} elseif($order == 'web_traffic_last_year'){
+				$tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+				$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
+				$join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+				$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
+				$order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_year', 'calctraffic', $order_by_sql);
+				$order_by_sql = "GROUP BY domain ".$order_by_sql;
+			} elseif($order == 'web_traffic_this_year'){
+				$tmp_year = date('Y');
+				$extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
+				$join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+				$sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
+				$order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_year', 'calctraffic', $order_by_sql);
+				$order_by_sql = "GROUP BY domain ".$order_by_sql;
+			}
 		}
-		
+
 		if($this->SQLExtSelect != '') {
-			if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; 
+			if(substr($this->SQLExtSelect, 0, 1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect;
 			$extselect .= $this->SQLExtSelect;
 		}
-		
+
 		$table_selects = array();
 		$table_selects[] = trim($app->listform->listDef['table']).'.*';
 		$app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']);
@@ -165,6 +165,7 @@
 		$sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql";
 		return $sql;
 	}
+
 }
 
 $list = new list_action;
@@ -173,4 +174,4 @@
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_subdomain_del.php b/interface/web/sites/web_subdomain_del.php
index be43b38..18e7e52 100644
--- a/interface/web/sites/web_subdomain_del.php
+++ b/interface/web/sites/web_subdomain_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -48,4 +48,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php
index 3475ed5..1e5bfa7 100644
--- a/interface/web/sites/web_subdomain_edit.php
+++ b/interface/web/sites/web_subdomain_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,28 +49,28 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	var $parent_domain_record;
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+			if(!$app->tform->checkClientLimit('limit_web_subdomain', "(type = 'subdomain' OR type = 'vhostsubdomain')")) {
 				$app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+			if(!$app->tform->checkResellerLimit('limit_web_subdomain', "(type = 'subdomain' OR type = 'vhostsubdomain')")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_web_subdomain_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
@@ -79,14 +79,14 @@
 			*/
 			$domains = $app->tools_sites->getDomainModuleDomains();
 			$domain_select = '';
-            $selected_domain = '';
+			$selected_domain = '';
 			if(is_array($domains) && sizeof($domains) > 0) {
 				/* We have domains in the list, so create the drop-down-list */
 				foreach( $domains as $domain) {
 					$domain_select .= "<option value=" . $domain['domain_id'] ;
 					if ('.' . $domain['domain'] == substr($this->dataRecord["domain"], -strlen($domain['domain']) - 1)) {
 						$domain_select .= " selected";
-                        $selected_domain = $domain['domain'];
+						$selected_domain = $domain['domain'];
 					}
 					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
@@ -99,20 +99,20 @@
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
-            $this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
+			$app->tpl->setVar("domain_option", $domain_select);
+			$this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
 		} else {
-        
-            // Get the record of the parent domain
-            $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
-            
-            // remove the parent domain part of the domain name before we show it in the text field.
-            $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
-        }
-        $app->tpl->setVar("domain",$this->dataRecord["domain"]);
-		
+
+			// Get the record of the parent domain
+			$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
+
+			// remove the parent domain part of the domain name before we show it in the text field.
+			$this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"], '', $this->dataRecord["domain"]);
+		}
+		$app->tpl->setVar("domain", $this->dataRecord["domain"]);
+
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
-			// Directive Snippets		
+			// Directive Snippets
 			$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
 			$proxy_directive_snippets_txt = '';
 			if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
@@ -121,78 +121,78 @@
 				}
 			}
 			if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-			$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+			$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
 		}
-		
+
 		parent::onShowEnd();
-		
+
 	}
 
 	function onSubmit() {
 		global $app, $conf;
-		
-        // Get the record of the parent domain
-        $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-        
+
+		// Get the record of the parent domain
+		$parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
-            // get the record of the domain module domain
-            $domain = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
-            if(!$domain) {
-                $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-            } else {
-                $this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain;
-            }
-        } else {
-            $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
-        }
-		
+			// get the record of the domain module domain
+			$domain = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
+			if(!$domain) {
+				$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+			} else {
+				$this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain;
+			}
+		} else {
+			$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+		}
+
 		// nginx: if redirect type is proxy and redirect path is no URL, display error
-		if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
+		if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'], 0, 1) == '/'){
 			$app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
 		}
-        
+
 		// Set a few fixed values
 		$this->dataRecord["type"] = 'subdomain';
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
-		
+
 		$this->parent_domain_record = $parent_domain;
-		
+
 		//* make sure that the domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
-		
+
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Check if parent domain has been changed
 		if($this->dataRecord['parent_domain_id'] != $this->oldDataRecord['parent_domain_id']) {
-			
+
 			//* Update the domain owner
 			$app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
-			
+
 			//* Update the old website, so that the vhost alias gets removed
 			//* We force the update by inserting a transaction record without changes manually.
 			$old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$this->oldDataRecord['domain_id']);
-            $app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
+			$app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
 		}
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_subdomain_list.php b/interface/web/sites/web_subdomain_list.php
index f14d7b3..716511e 100644
--- a/interface/web/sites/web_subdomain_list.php
+++ b/interface/web/sites/web_subdomain_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_vhost_subdomain_del.php b/interface/web/sites/web_vhost_subdomain_del.php
index 9d3609b..04987e6 100644
--- a/interface/web/sites/web_vhost_subdomain_del.php
+++ b/interface/web/sites/web_vhost_subdomain_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -51,22 +51,23 @@
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
+
 		//* Delete all web folders
-        $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            //* Delete all web folder users
+		$records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			//* Delete all web folder users
 			$records2 = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$rec['web_folder_id']."'");
 			foreach($records2 as $rec2) {
-				$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec2['web_folder_user_id']);
-        }
-			$app->db->datalogDelete('web_folder','web_folder_id',$rec['web_folder_id']);
-        }
+				$app->db->datalogDelete('web_folder_user', 'web_folder_user_id', $rec2['web_folder_user_id']);
+			}
+			$app->db->datalogDelete('web_folder', 'web_folder_id', $rec['web_folder_id']);
+		}
 
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php
index 9c1a196..7ebc6a1 100644
--- a/interface/web/sites/web_vhost_subdomain_edit.php
+++ b/interface/web/sites/web_vhost_subdomain_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -51,7 +51,7 @@
 class page_action extends tform_actions {
 
 	//* Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -62,16 +62,16 @@
 		}
 		return $hash;
 	}
-	
+
 	function onShowNew() {
 		global $app, $conf;
 
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+			if(!$app->tform->checkClientLimit('limit_web_subdomain', "(type = 'subdomain' OR type = 'vhostsubdomain')")) {
 				$app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+			if(!$app->tform->checkResellerLimit('limit_web_subdomain', "(type = 'subdomain' OR type = 'vhostsubdomain')")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_web_subdomain_txt"]);
 			}
 		}
@@ -80,20 +80,20 @@
 
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$app->uses('ini_parser,getconf');
 
-        $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-		
-        $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
-        
+		$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
+
 		//* Client: If the logged in user is not admin and has no sub clients (no reseller)
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.limit_web_subdomain, client.default_webserver, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			//* Get global web config
 			$web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web');
 
@@ -119,23 +119,23 @@
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
 
-            // add limits to template to be able to hide settings
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-            
-            
+			// add limits to template to be able to hide settings
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
 			//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_subdomain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			//* Get global web config
 			$web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web');
-			
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -158,19 +158,19 @@
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
-            
-            // add limits to template to be able to hide settings
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-            
-            
+
+			// add limits to template to be able to hide settings
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
 			//* Admin: If the logged in user is admin
 		} else {
 
 			//* get global web config
 			$web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web');
-			
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -193,76 +193,76 @@
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
 
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
-			
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
+
 			// Directive Snippets
 			$php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
 			$php_directive_snippets_txt = '';
 			if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
-					foreach($php_directive_snippets as $php_directive_snippet){
-						$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> ';
-					}
+				foreach($php_directive_snippets as $php_directive_snippet){
+					$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> ';
+				}
 			}
 			if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
-			$app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
-			
+			$app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt);
+
 			if($server_type == 'apache'){
 				$apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
 				$apache_directive_snippets_txt = '';
 				if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
-						foreach($apache_directive_snippets as $apache_directive_snippet){
-							$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> ';
-						}
+					foreach($apache_directive_snippets as $apache_directive_snippet){
+						$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> ';
+					}
 				}
 				if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
-				$app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
+				$app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt);
 			}
-			
+
 			if($server_type == 'nginx'){
 				$nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
 				$nginx_directive_snippets_txt = '';
 				if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
-						foreach($nginx_directive_snippets as $nginx_directive_snippet){
-							$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> ';
-						}
+					foreach($nginx_directive_snippets as $nginx_directive_snippet){
+						$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> ';
+					}
 				}
 				if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
-				$app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
+				$app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt);
 			}
-			
+
 			$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
 			$proxy_directive_snippets_txt = '';
 			if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
-					foreach($proxy_directive_snippets as $proxy_directive_snippet){
-						$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
-					}
+				foreach($proxy_directive_snippets as $proxy_directive_snippet){
+					$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
+				}
 			}
 			if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-			$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+			$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
 		}
 
 		$ssl_domain_select = '';
 		$tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
-		$ssl_domains = array($tmp["domain"],'www.'.$tmp["domain"]);
+		$ssl_domains = array($tmp["domain"], 'www.'.$tmp["domain"]);
 		if(is_array($ssl_domains)) {
 			foreach( $ssl_domains as $ssl_domain) {
 				$selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
 				$ssl_domain_select .= "<option value='$ssl_domain' $selected>$ssl_domain</option>\r\n";
 			}
 		}
-        
-        if($this->id > 0) {
-            $app->tpl->setVar('fixed_folder', 'y');
-            $app->tpl->setVar('server_id_value', $parent_domain['server_id']);
-        } else {
-            $app->tpl->setVar('fixed_folder', 'n');
-            $app->tpl->setVar('server_id_value', $parent_domain['server_id']);
-        }
-        
-		$app->tpl->setVar("ssl_domain",$ssl_domain_select);
+
+		if($this->id > 0) {
+			$app->tpl->setVar('fixed_folder', 'y');
+			$app->tpl->setVar('server_id_value', $parent_domain['server_id']);
+		} else {
+			$app->tpl->setVar('fixed_folder', 'n');
+			$app->tpl->setVar('server_id_value', $parent_domain['server_id']);
+		}
+
+		$app->tpl->setVar("ssl_domain", $ssl_domain_select);
 		unset($ssl_domain_select);
 		unset($ssl_domains);
 		unset($ssl_domain);
@@ -277,16 +277,16 @@
 			/*
 			 * The domain-module is in use.
 			*/
-            $domains = $app->tools_sites->getDomainModuleDomains();
+			$domains = $app->tools_sites->getDomainModuleDomains();
 			$domain_select = '';
-            $selected_domain = '';
+			$selected_domain = '';
 			if(is_array($domains) && sizeof($domains) > 0) {
 				/* We have domains in the list, so create the drop-down-list */
 				foreach( $domains as $domain) {
 					$domain_select .= "<option value=" . $domain['domain_id'] ;
 					if ('.' . $domain['domain'] == substr($this->dataRecord["domain"], -strlen($domain['domain']) - 1)) {
 						$domain_select .= " selected";
-                        $selected_domain = $domain['domain'];
+						$selected_domain = $domain['domain'];
 					}
 					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
@@ -299,30 +299,30 @@
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
-            $this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
+			$app->tpl->setVar("domain_option", $domain_select);
+			$this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
 		} else {
-        
-            // remove the parent domain part of the domain name before we show it in the text field.
-            $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
-        }
-        $app->tpl->setVar("domain",$this->dataRecord["domain"]);
+
+			// remove the parent domain part of the domain name before we show it in the text field.
+			$this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"], '', $this->dataRecord["domain"]);
+		}
+		$app->tpl->setVar("domain", $this->dataRecord["domain"]);
 
 		parent::onShowEnd();
 	}
-    
+
 	function onSubmit() {
 		global $app, $conf;
 
 		// Get the record of the parent domain
-        if(!@$this->dataRecord["parent_domain_id"] && $this->id) {
-            $tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
-            if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id'];
-            unset($tmp);
-        }
-        
+		if(!@$this->dataRecord["parent_domain_id"] && $this->id) {
+			$tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+			if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id'];
+			unset($tmp);
+		}
+
 		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 
 		// Set a few fixed values
 		$this->dataRecord["type"] = 'vhostsubdomain';
@@ -333,67 +333,67 @@
 		$this->dataRecord["vhost_type"] = 'name';
 
 		$this->parent_domain_record = $parent_domain;
-        
-        $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-        
-        if($app->tform->getCurrentTab() == 'domain') {
-            
-            /* check if the domain module is used - and check if the selected domain can be used! */
-            $app->uses('ini_parser,getconf');
-            $settings = $app->getconf->get_global_config('domains');
-            if ($settings['use_domain_module'] == 'y') {
-                $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
-                if(!$domain_check) {
-                    // invalid domain selected
-                    $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-                } else {
-                    $this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain_check;
-                }
-            } else {
-                $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
-            }
-            
-            
-            $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
+
+		$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+
+		if($app->tform->getCurrentTab() == 'domain') {
+
+			/* check if the domain module is used - and check if the selected domain can be used! */
+			$app->uses('ini_parser,getconf');
+			$settings = $app->getconf->get_global_config('domains');
+			if ($settings['use_domain_module'] == 'y') {
+				$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
+				if(!$domain_check) {
+					// invalid domain selected
+					$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+				} else {
+					$this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain_check;
+				}
+			} else {
+				$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+			}
+
+
+			$this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
 			if(substr($this->dataRecord['web_folder'], 0, 1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 1);
 			if(substr($this->dataRecord['web_folder'], -1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 0, -1);
-            $forbidden_folders = array('', 'cgi-bin', 'log', 'private', 'ssl', 'tmp', 'webdav');
-            $check_folder = strtolower($this->dataRecord['web_folder']);
-            if(substr($check_folder, 0, 1) === '/') $check_folder = substr($check_folder, 1); // strip / at beginning to check against forbidden entries
-            if(strpos($check_folder, '/') !== false) $check_folder = substr($check_folder, 0, strpos($check_folder, '/')); // get the first part of the path to check it
-            if(in_array($check_folder, $forbidden_folders)) {
-                $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."<br>";
-            }
-			
+			$forbidden_folders = array('', 'cgi-bin', 'log', 'private', 'ssl', 'tmp', 'webdav');
+			$check_folder = strtolower($this->dataRecord['web_folder']);
+			if(substr($check_folder, 0, 1) === '/') $check_folder = substr($check_folder, 1); // strip / at beginning to check against forbidden entries
+			if(strpos($check_folder, '/') !== false) $check_folder = substr($check_folder, 0, strpos($check_folder, '/')); // get the first part of the path to check it
+			if(in_array($check_folder, $forbidden_folders)) {
+				$app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."<br>";
+			}
+
 			// vhostsubdomains do not have a quota of their own
 			$this->dataRecord["hd_quota"] = 0;
-			
-            // check for duplicate folder usage
+
+			// check for duplicate folder usage
 			/*
             $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . $app->functions->intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . $app->functions->intval($this->id) . "'");
             if($check && $check['cnt'] > 0) {
                 $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."<br>";
             }
 			*/
-        } else {
-            $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
-        }
-        
+		} else {
+			$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+		}
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-            
-            if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
-            if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
-            if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
-            if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
-            if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
-            if($client['force_suexec'] != 'n') $this->dataRecord['suexec'] = 'y';
-            if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
-            if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
-            if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
-			
+
+			if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
+			if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
+			if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
+			if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
+			if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
+			if($client['force_suexec'] != 'n') $this->dataRecord['suexec'] = 'y';
+			if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
+			if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
+			if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
+
 			// only generate quota and traffic warnings if value has changed
 			if($this->id > 0) {
 				$old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
@@ -416,7 +416,7 @@
 				unset($tmp);
 				unset($tmp_quota);
 			}
-			
+
 			if($client['parent_client_id'] > 0) {
 				// Get the limits of the reseller
 				$reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
@@ -440,21 +440,21 @@
 
 			// When the record is updated
 			if($this->id > 0) {
-                // restore the server ID if the user is not admin and record is edited
+				// restore the server ID if the user is not admin and record is edited
 				$tmp = $app->db->queryOneRecord("SELECT server_id, `web_folder`, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
-                $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed!
-                
-                // set the settings to current if not provided (or cleared due to limits)
-                if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
-                if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
-                if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
-                if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
-                if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
-                if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
-                if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
-                if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
-                if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
-                
+				$this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed!
+
+				// set the settings to current if not provided (or cleared due to limits)
+				if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
+				if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
+				if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
+				if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
+				if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
+				if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
+				if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
+				if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
+				if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
+
 				unset($tmp);
 				// When the record is inserted
 			} else {
@@ -467,32 +467,32 @@
 				}
 			}
 		}
-		
+
 		//* make sure that the domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-		
+
 		//* get the server config for this server
 		$app->uses("getconf");
-		$web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web');
+		$web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0), 'web');
 		//* Check for duplicate ssl certs per IP if SNI is disabled
 		if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
 			$sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
 			$tmp = $app->db->queryOneRecord($sql);
 			if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
 		}
-		
+
 		// Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0
 		if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') {
 			if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){
-		
+
 			} else {
 				$app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'<br>';
 			}
 		}
-		
+
 		// Check rewrite rules
 		$server_type = $web_config['server_type'];
-		
+
 		if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') {
 			$rewrite_rules = trim($this->dataRecord['rewrite_rules']);
 			$rewrites_are_valid = true;
@@ -505,7 +505,7 @@
 			if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
 				foreach($rewrite_rule_lines as $rewrite_rule_line){
 					// ignore comments
-					if(substr(ltrim($rewrite_rule_line),0,1) == '#') continue;
+					if(substr(ltrim($rewrite_rule_line), 0, 1) == '#') continue;
 					// empty lines
 					if(trim($rewrite_rule_line) == '') continue;
 					// rewrite
@@ -540,7 +540,7 @@
 					break;
 				}
 			}
-			
+
 			if(!$rewrites_are_valid || $if_level != 0){
 				$app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'<br>';
 			}
@@ -555,16 +555,16 @@
 		// Get configuration for the web system
 		$app->uses("getconf");
 		$web_rec = $app->tform->getDataRecord($this->id);
-		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
-        //var_dump($this->parent_domain_record, $web_rec);
+		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web');
+		//var_dump($this->parent_domain_record, $web_rec);
 		// Set the values for document_root, system_user and system_group
 		$system_user = $app->db->quote($this->parent_domain_record['system_user']);
 		$system_group = $app->db->quote($this->parent_domain_record['system_group']);
 		$document_root = $app->db->quote($this->parent_domain_record['document_root']);
-		$php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$web_rec['web_folder'],$web_config["php_open_basedir"]);
-		$php_open_basedir = str_replace("[website_domain]/web",$web_rec['domain'].'/'.$web_rec['web_folder'],$php_open_basedir);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+		$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$web_rec['web_folder'], $web_config["php_open_basedir"]);
+		$php_open_basedir = str_replace("[website_domain]/web", $web_rec['domain'].'/'.$web_rec['web_folder'], $php_open_basedir);
+		$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+		$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
 		$htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']);
 
 		$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$this->id;
@@ -582,7 +582,7 @@
 			if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'<br />';
 			if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'<br />';
 		}
-		
+
 		if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
 			if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'<br />';
 		}
@@ -595,16 +595,16 @@
 		// Get configuration for the web system
 		$app->uses("getconf");
 		$web_rec = $app->tform->getDataRecord($this->id);
-		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
+		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web');
 
 		// Set the values for document_root, system_user and system_group
 		$system_user = $app->db->quote($this->parent_domain_record['system_user']);
 		$system_group = $app->db->quote($this->parent_domain_record['system_group']);
 		$document_root = $app->db->quote($this->parent_domain_record['document_root']);
-		$php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$web_rec['web_folder'],$web_config["php_open_basedir"]);
-		$php_open_basedir = str_replace("[website_domain]/web",$web_rec['domain'].'/'.$web_rec['web_folder'],$php_open_basedir);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+		$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$web_rec['web_folder'], $web_config["php_open_basedir"]);
+		$php_open_basedir = str_replace("[website_domain]/web", $web_rec['domain'].'/'.$web_rec['web_folder'], $php_open_basedir);
+		$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+		$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
 		$htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']);
 
 		$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$this->id;
@@ -616,4 +616,4 @@
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_vhost_subdomain_list.php b/interface/web/sites/web_vhost_subdomain_list.php
index 0677a93..6f68d7b 100644
--- a/interface/web/sites/web_vhost_subdomain_list.php
+++ b/interface/web/sites/web_vhost_subdomain_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/webdav_user_del.php b/interface/web/sites/webdav_user_del.php
index ca92412..040e7fe 100644
--- a/interface/web/sites/webdav_user_del.php
+++ b/interface/web/sites/webdav_user_del.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -47,4 +47,4 @@
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/webdav_user_edit.php b/interface/web/sites/webdav_user_edit.php
index 377b00e..97b2bcc 100644
--- a/interface/web/sites/webdav_user_edit.php
+++ b/interface/web/sites/webdav_user_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -80,9 +80,9 @@
 			/* REMOVE the restriction */
 			$app->tpl->setVar("username", $app->tools_sites->removePrefix($this->dataRecord['username'], $this->dataRecord['username_prefix'], $webdavuser_prefix));
 		}
-        
-        $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $webdavuser_prefix, $global_config['webdavuser_prefix']));
-		
+
+		$app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $webdavuser_prefix, $global_config['webdavuser_prefix']));
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -99,7 +99,7 @@
 
 		/* Get the record of the parent domain */
 		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 
 		/*
 		 * Set a few fixed values
@@ -111,9 +111,9 @@
 		 */
 		if(isset($this->dataRecord['username']) && trim($this->dataRecord['username']) == '') $app->tform->errorMessage .= $app->tform->lng('username_error_empty').'<br />';
 		if(isset($this->dataRecord['username']) && empty($this->dataRecord['parent_domain_id'])) $app->tform->errorMessage .= $app->tform->lng('parent_domain_id_error_empty').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'./')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
-		
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], '..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], './')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
+
 		parent::onSubmit();
 	}
 
@@ -129,8 +129,8 @@
 			$global_config = $app->getconf->get_global_config('sites');
 			$webdavuser_prefix = $app->tools_sites->replacePrefix($global_config['webdavuser_prefix'], $this->dataRecord);
 
-            $this->dataRecord['username_prefix'] = $webdavuser_prefix;
-            
+			$this->dataRecord['username_prefix'] = $webdavuser_prefix;
+
 			/* restrict the names */
 			$this->dataRecord['username'] = $webdavuser_prefix . $this->dataRecord['username'];
 
@@ -185,9 +185,10 @@
 	function onAfterUpdate() {
 		global $app, $conf;
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/webdav_user_list.php b/interface/web/sites/webdav_user_list.php
index b94157c..2bd94ab 100644
--- a/interface/web/sites/webdav_user_list.php
+++ b/interface/web/sites/webdav_user_list.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,4 +48,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/dns_import_tupa.php b/interface/web/tools/dns_import_tupa.php
index fe931a7..940a851 100644
--- a/interface/web/tools/dns_import_tupa.php
+++ b/interface/web/tools/dns_import_tupa.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -45,42 +45,42 @@
 
 // Resyncing dns zones
 if(isset($_POST['start']) && $_POST['start'] == 1) {
-	
+
 	//* Set variable sin template
-	$app->tpl->setVar('dbhost',$_POST['dbhost']);
-	$app->tpl->setVar('dbname',$_POST['dbname']);
-	$app->tpl->setVar('dbuser',$_POST['dbuser']);
-	$app->tpl->setVar('dbpassword',$_POST['dbpassword']);
-	
+	$app->tpl->setVar('dbhost', $_POST['dbhost']);
+	$app->tpl->setVar('dbname', $_POST['dbname']);
+	$app->tpl->setVar('dbuser', $_POST['dbuser']);
+	$app->tpl->setVar('dbpassword', $_POST['dbpassword']);
+
 	//* Establish connection to external database
 	$msg .= 'Connecting to external database...<br />';
-	
+
 	//* Backup DB login details
 	/*$conf_bak['db_host'] = $conf['db_host'];
 	$conf_bak['db_database'] = $conf['db_database'];
 	$conf_bak['db_user'] = $conf['db_user'];
 	$conf_bak['db_password'] = $conf['db_password'];*/
-	
+
 	//* Set external Login details
 	$conf['imp_db_host'] = $_POST['dbhost'];
 	$conf['imp_db_database'] = $_POST['dbname'];
 	$conf['imp_db_user'] = $_POST['dbuser'];
 	$conf['imp_db_password'] = $_POST['dbpassword'];
-    $conf['imp_db_charset'] = $conf['db_charset'];
-    $conf['imp_db_new_link'] = $conf['db_new_link'];
-    $conf['imp_db_client_flags'] = $conf['db_client_flags'];
-	
+	$conf['imp_db_charset'] = $conf['db_charset'];
+	$conf['imp_db_new_link'] = $conf['db_new_link'];
+	$conf['imp_db_client_flags'] = $conf['db_client_flags'];
+
 	//* create new db object
 	$exdb = new db('imp');
-	
+
 	$server_id = 1;
 	$sys_userid = 1;
 	$sys_groupid = 1;
-	
+
 	function addot($text) {
 		return trim($text) . '.';
 	}
-	
+
 	//* Connect to DB
 	if($exdb !== false) {
 		$domains = $exdb->queryAllRecords("SELECT * FROM domains WHERE type = 'MASTER'");
@@ -88,7 +88,7 @@
 			foreach($domains as $domain) {
 				$soa = $exdb->queryOneRecord("SELECT * FROM records WHERE type = 'SOA' AND domain_id = ".$domain['id']);
 				if(is_array($soa)) {
-					$parts = explode(' ',$soa['content']);
+					$parts = explode(' ', $soa['content']);
 					$origin = addot($soa['name']);
 					$ns = addot($parts[0]);
 					$mbox = addot($parts[1]);
@@ -98,62 +98,62 @@
 					$expire = 604800;
 					$minimum = 86400;
 					$ttl = $soa['ttl'];
-					
+
 					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`) VALUES
 					('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '')";
 					$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
 					unset($parts);
 					$msg .= 'Import Zone: '.$soa['name'].'<br />';
-					
+
 					//* Process the other records
 					$records = $exdb->queryAllRecords("SELECT * FROM records WHERE type != 'SOA' AND domain_id = ".$domain['id']);
 					if(is_array($records)) {
 						foreach($records as $rec) {
 							$rr = array();
-							
+
 							$rr['name'] = addot($rec['name']);
 							$rr['type'] = $rec['type'];
 							$rr['aux'] = $rec['prio'];
 							$rr['ttl'] = $rec['ttl'];
-							
+
 							if($rec['type'] == 'NS' || $rec['type'] == 'MX' || $rec['type'] == 'CNAME') {
 								$rr['data'] = addot($rec['content']);
 							} else {
 								$rr['data'] = $rec['content'];
 							}
-							
+
 							$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES
 							('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$rr[name]', '$rr[type]', '$rr[data]', '$rr[aux]', '$rr[ttl]', 'Y')";
 							$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
 							//$msg .= $insert_data.'<br />';
-							
+
 						}
 					}
 				}
-				
+
 			}
 		}
-		
-		
-		
+
+
+
 	} else {
 		$error .= $exdb->errorMessage;
 	}
-	
+
 	//* restore db login details
 	/*$conf['db_host'] = $conf_bak['db_host'];
 	$conf['db_database'] = $conf_bak['db_database'];
 	$conf['db_user'] = $conf_bak['db_user'];
 	$conf['db_password'] = $conf_bak['db_password'];*/
-	
+
 }
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/form/interface_settings.tform.php b/interface/web/tools/form/interface_settings.tform.php
index c93da46..f81ce2d 100644
--- a/interface/web/tools/form/interface_settings.tform.php
+++ b/interface/web/tools/form/interface_settings.tform.php
@@ -60,21 +60,21 @@
 
 */
 
-$form['title'] 		= 'interface_head_txt';
-$form['description'] 	= 'interface_desc_txt';
-$form['name'] 		= 'interface';
-$form['action']		= 'interface_settings.php';
-$form['db_table']	= 'sys_user';
-$form['db_table_idx']	= 'userid';
-$form["db_history"]	= "no";
-$form['tab_default']	= 'main';
-$form['list_default']	= 'index.php';
-$form['auth']		= 'no'; //??
+$form['title']   = 'interface_head_txt';
+$form['description']  = 'interface_desc_txt';
+$form['name']   = 'interface';
+$form['action']  = 'interface_settings.php';
+$form['db_table'] = 'sys_user';
+$form['db_table_idx'] = 'userid';
+$form["db_history"] = "no";
+$form['tab_default'] = 'main';
+$form['list_default'] = 'index.php';
+$form['auth']  = 'no'; //??
 
 //* 0 = id of the user, > 0 id must match with id of current user
-$form['auth_preset']['userid']  = 0; 
+$form['auth_preset']['userid']  = 0;
 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
-$form['auth_preset']['groupid'] = 0; 
+$form['auth_preset']['groupid'] = 0;
 
 //** Permissions are: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user']  = 'riud';
@@ -85,8 +85,8 @@
 //* TODO: limit to activated modules of the user
 $modules_list = array();
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
-	$handle = @opendir(ISPC_WEB_PATH); 
-	while ($file = @readdir ($handle)) { 
+	$handle = @opendir(ISPC_WEB_PATH);
+	while ($file = @readdir($handle)) {
 		if ($file != '.' && $file != '..') {
 			if(@is_dir(ISPC_WEB_PATH."/$file")) {
 				if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
@@ -102,7 +102,7 @@
 	if($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 		$modules .= ',client';
 	}
-	$tmp = explode(',',$modules);
+	$tmp = explode(',', $modules);
 	foreach($tmp as $m) {
 		$modules_list[$m] = $m;
 	}
@@ -110,66 +110,66 @@
 
 //* Languages
 $language_list = array();
-$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
-} 
+}
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 $form['tabs']['main'] = array (
-	'title' 	=> 'Settings',
-	'width' 	=> 80,
-	'template' 	=> 'templates/interface_settings.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
-                'startmodule' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $modules_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+	'title'  => 'Settings',
+	'width'  => 80,
+	'template'  => 'templates/interface_settings.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
+		'startmodule' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $modules_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
-                'app_theme' => array (
-                            'datatype'	=> 'VARCHAR',
-                            'formtype'	=> 'SELECT',
-                            'regex'	=> '',
-                            'errmsg'	=> '',
-                            'default'	=> 'default',
-                            'value'	=> $themes_list,
-                            'separator'	=> '',
-                            'width'	=> '30',
-                            'maxlength'	=> '255',
-                            'rows'	=> '',
-                            'cols'	=> ''
-                    )
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		'app_theme' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex' => '',
+			'errmsg' => '',
+			'default' => 'default',
+			'value' => $themes_list,
+			'separator' => '',
+			'width' => '30',
+			'maxlength' => '255',
+			'rows' => '',
+			'cols' => ''
+		)
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
diff --git a/interface/web/tools/form/tpl_default.tform.php b/interface/web/tools/form/tpl_default.tform.php
index e4d1b62..0d6cf2f 100644
--- a/interface/web/tools/form/tpl_default.tform.php
+++ b/interface/web/tools/form/tpl_default.tform.php
@@ -60,21 +60,21 @@
 
 */
 
-$form['title'] 		= 'tpl_default_head_txt';
-$form['description'] 	= 'tpl_default_desc_txt';
-$form['name'] 		= 'tpl_default';
-$form['action']		= 'tpl_default.php';
-$form['db_table']	= 'sys_user'; // needs to be 'sys_user_theme'
-$form['db_table_idx']	= 'userid'; //??
-$form["db_history"]	= "no";
-$form['tab_default']	= 'main';
-$form['list_default']	= 'index.php';
-$form['auth']		= 'no'; //?
+$form['title']   = 'tpl_default_head_txt';
+$form['description']  = 'tpl_default_desc_txt';
+$form['name']   = 'tpl_default';
+$form['action']  = 'tpl_default.php';
+$form['db_table'] = 'sys_user'; // needs to be 'sys_user_theme'
+$form['db_table_idx'] = 'userid'; //??
+$form["db_history"] = "no";
+$form['tab_default'] = 'main';
+$form['list_default'] = 'index.php';
+$form['auth']  = 'no'; //?
 
 //* 0 = id of the user, > 0 id must match with id of current user
-$form['auth_preset']['userid']  = 0; 
+$form['auth_preset']['userid']  = 0;
 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
-$form['auth_preset']['groupid'] = 0; 
+$form['auth_preset']['groupid'] = 0;
 
 //** Permissions are: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user']  = 'riud';
@@ -84,98 +84,98 @@
 //* Pick out modules
 //* TODO: limit to activated modules of the user
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
 				$modules_list[$file] = $file;
 			}
-        }
+		}
 	}
 }
 
 //* Languages
 $language_list = array();
-$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
-} 
+}
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 $form['tabs']['main'] = array (
-	'title' 	=> 'Settings',
-	'width' 	=> 80,
-	'template' 	=> 'templates/interface_settings.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
-                'startmodule' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $modules_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+	'title'  => 'Settings',
+	'width'  => 80,
+	'template'  => 'templates/interface_settings.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
+		'startmodule' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $modules_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-                        'validators'	=> array ( 0 => array (	'type'	=> 'NOTEMPTY',
-                                                                'errmsg'=> 'language_is_empty'),
-                                                   1 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-z]{2}$/i',
-                                                                'errmsg'=> 'language_regex_mismatch'),
-                                                ),
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '2',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'language_is_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-z]{2}$/i',
+					'errmsg'=> 'language_regex_mismatch'),
+			),
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '2',
+			'rows'  => '',
+			'cols'  => ''
 		),
-                'app_theme' => array (
-                            'datatype'	=> 'VARCHAR',
-                            'formtype'	=> 'SELECT',
-                            'regex'	=> '',
-                            'errmsg'	=> '',
-                            'default'	=> 'default',
-                            'value'	=> $themes_list,
-                            'separator'	=> '',
-                            'width'	=> '30',
-                            'maxlength'	=> '255',
-                            'rows'	=> '',
-                            'cols'	=> ''
-                    )
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		'app_theme' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex' => '',
+			'errmsg' => '',
+			'default' => 'default',
+			'value' => $themes_list,
+			'separator' => '',
+			'width' => '30',
+			'maxlength' => '255',
+			'rows' => '',
+			'cols' => ''
+		)
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
diff --git a/interface/web/tools/form/user_settings.tform.php b/interface/web/tools/form/user_settings.tform.php
index d3c35bf..4ceda58 100644
--- a/interface/web/tools/form/user_settings.tform.php
+++ b/interface/web/tools/form/user_settings.tform.php
@@ -60,21 +60,21 @@
 
 */
 
-$form['title'] 			= 'User Settings';
-$form['description'] 	= 'Form to edit the user password and language.';
-$form['name'] 			= 'usersettings';
-$form['action']			= 'user_settings.php';
-$form['db_table']		= 'sys_user';
-$form['db_table_idx']	= 'userid';
-$form["db_history"]		= "no";
-$form['tab_default']	= 'users';
-$form['list_default']	= 'index.php';
-$form['auth']			= 'no';
+$form['title']    = 'User Settings';
+$form['description']  = 'Form to edit the user password and language.';
+$form['name']    = 'usersettings';
+$form['action']   = 'user_settings.php';
+$form['db_table']  = 'sys_user';
+$form['db_table_idx'] = 'userid';
+$form["db_history"]  = "no";
+$form['tab_default'] = 'users';
+$form['list_default'] = 'index.php';
+$form['auth']   = 'no';
 
 //* 0 = id of the user, > 0 id must match with id of current user
-$form['auth_preset']['userid']  = 0; 
+$form['auth_preset']['userid']  = 0;
 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
-$form['auth_preset']['groupid'] = 0; 
+$form['auth_preset']['groupid'] = 0;
 
 //** Permissions are: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user']  = 'riud';
@@ -83,60 +83,60 @@
 
 //* Languages
 $language_list = array();
-$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
-} 
+}
 
 $form['tabs']['users'] = array (
-	'title' 	=> 'Settings',
-	'width' 	=> 80,
-	'template' 	=> 'templates/user_settings.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => 'Settings',
+	'width'  => 80,
+	'template'  => 'templates/user_settings.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'passwort' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CRYPT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '100',
-			'rows'		=> '',
-			'cols'		=> ''
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '100',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'language_is_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-z]{2}$/i',
-														'errmsg'=> 'language_regex_mismatch'),
-									),
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '2',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'language_is_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-z]{2}$/i',
+					'errmsg'=> 'language_regex_mismatch'),
+			),
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '2',
+			'rows'  => '',
+			'cols'  => ''
 		)
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
diff --git a/interface/web/tools/import_ispconfig.php b/interface/web/tools/import_ispconfig.php
index 432bb31..9a42510 100644
--- a/interface/web/tools/import_ispconfig.php
+++ b/interface/web/tools/import_ispconfig.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -45,7 +45,7 @@
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_import_ispconfig.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 if(isset($_POST['connected'])) {
@@ -60,11 +60,11 @@
 		if($error == '') {
 			try {
 				$client = new SoapClient(null, array('location' => $_POST['remote_server'],
-                                     'uri'      => $_POST['remote_server'].'/index.php',
-									 'trace' => 1,
-									 'exceptions' => 1));
-				
-				if($remote_session_id = $client->login($_POST['remote_user'],$_POST['remote_password'])) {
+						'uri'      => $_POST['remote_server'].'/index.php',
+						'trace' => 1,
+						'exceptions' => 1));
+
+				if($remote_session_id = $client->login($_POST['remote_user'], $_POST['remote_password'])) {
 					$connected = 1;
 					$msg .= 'Successfully connected to remote server.';
 				}
@@ -75,9 +75,9 @@
 			}
 		}
 	}
-	
+
 	if($connected == 1) {
-		
+
 		//* Fill the client select field
 		$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
 		$clients = $app->db->queryAllRecords($sql);
@@ -88,59 +88,59 @@
 				$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("client_group_id",$client_select);
-		
-		
+		$app->tpl->setVar("client_group_id", $client_select);
+
+
 		try {
 			$client = new SoapClient(null, array('location' => $_POST['remote_server'],
-                                'uri'      => $_POST['remote_server'].'/index.php',
-								'trace' => 1,
-								'exceptions' => 1));
-		
-		if(!isset($remote_session_id)) $remote_session_id = $_POST['remote_session_id'];
-		
-		//* Get all email domains
-		$mail_domains = $client->mail_domain_get($remote_session_id, array('active' => 'y'));
-		$mail_domain_select = '<option value="">-- select domain --</option>';
-		if(is_array($mail_domains)) {
-			foreach( $mail_domains as $mail_domain) {
-				$selected = @($mail_domain['domain'] == $_POST['mail_domain'])?'SELECTED':'';
-				$mail_domain_select .= "<option value='$mail_domain[domain]' $selected>$mail_domain[domain]</option>\r\n";
+					'uri'      => $_POST['remote_server'].'/index.php',
+					'trace' => 1,
+					'exceptions' => 1));
+
+			if(!isset($remote_session_id)) $remote_session_id = $_POST['remote_session_id'];
+
+			//* Get all email domains
+			$mail_domains = $client->mail_domain_get($remote_session_id, array('active' => 'y'));
+			$mail_domain_select = '<option value="">-- select domain --</option>';
+			if(is_array($mail_domains)) {
+				foreach( $mail_domains as $mail_domain) {
+					$selected = @($mail_domain['domain'] == $_POST['mail_domain'])?'SELECTED':'';
+					$mail_domain_select .= "<option value='$mail_domain[domain]' $selected>$mail_domain[domain]</option>\r\n";
+				}
 			}
-		}
-		$app->tpl->setVar("mail_domain",$mail_domain_select);
-		
-		//* Do the import
-		if($_POST['mail_domain'] != '') start_domain_import($_POST['mail_domain']);
-		
-		
-		
+			$app->tpl->setVar("mail_domain", $mail_domain_select);
+
+			//* Do the import
+			if($_POST['mail_domain'] != '') start_domain_import($_POST['mail_domain']);
+
+
+
 		} catch (SoapFault $e) {
 			//echo $client->__getLastResponse();
 			$error .= $e->getMessage();
 			$connected = 0;
 		}
-		
+
 	}
-	
+
 }
 
-$app->tpl->setVar('remote_server',$_POST['remote_server']);
-$app->tpl->setVar('remote_user',$_POST['remote_user']);
-$app->tpl->setVar('remote_password',$_POST['remote_password']);
-$app->tpl->setVar('connected',$connected);
-$app->tpl->setVar('remote_session_id',$remote_session_id);
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('remote_server', $_POST['remote_server']);
+$app->tpl->setVar('remote_user', $_POST['remote_user']);
+$app->tpl->setVar('remote_password', $_POST['remote_password']);
+$app->tpl->setVar('connected', $connected);
+$app->tpl->setVar('remote_session_id', $remote_session_id);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-###########################################################
+//##########################################################
 
 function start_domain_import($mail_domain) {
 	global $app, $conf, $client, $msg, $error, $remote_session_id;
-	
+
 	//* Get the user and groupid for the new records
 	$sys_groupid = $app->functions->intval($_POST['client_group_id']);
 	$tmp = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE default_group = $sys_groupid");
@@ -148,13 +148,13 @@
 	unset($tmp);
 	if($sys_groupid == 0) $error .= 'Inavlid groupid<br />';
 	if($sys_userid == 0) $error .= 'Inavlid Userid<br />';
-	
+
 	//* Get the mail server ID
 	$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE mail_server = 1 LIMIT 0,1");
 	$server_id = intval($tmp['server_id']);
 	unset($tmp);
 	if($server_id == 0) $server_id = 1;
-	
+
 	//* get the mail domain record
 	$mail_domain_rec = $client->mail_domain_get($remote_session_id, array('domain' => $mail_domain));
 	if(is_array($mail_domain_rec)) {
@@ -162,13 +162,13 @@
 		$tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE domain = '".$app->db->quote($mail_domain)."'");
 		if($tmp['number'] > 0) $error .= 'Domain '.$mail_domain.' exists already in local database.<br />';
 		unset($tmp);
-		
+
 		//* Change the record owner and remove the index field
 		$mail_domain_rec['sys_userid'] = $sys_userid;
 		$mail_domain_rec['sys_groupid'] = $sys_groupid;
 		$mail_domain_rec['server_id'] = $server_id;
 		unset($mail_domain_rec['domain_id']);
-		
+
 		//* Insert domain if no error occurred
 		if($error == '') {
 			$app->db->datalogInsert('mail_domain', $mail_domain_rec, 'domain_id');
@@ -176,7 +176,7 @@
 		} else {
 			return false;
 		}
-		
+
 		//* Import mailboxes
 		if(isset($_POST['import_mailbox']) && $_POST['import_mailbox'] == 1) {
 			$mail_users = $client->mail_user_get($remote_session_id, array('email' => '%@'.$mail_domain));
@@ -184,7 +184,7 @@
 				foreach($mail_users as $mail_user) {
 					$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE email = '".$app->db->quote($mail_user['email'])."'");
 					if($tmp['number'] == 0) {
-						
+
 						//* Prepare record
 						$mail_user['sys_userid'] = $sys_userid;
 						$mail_user['sys_groupid'] = $sys_groupid;
@@ -192,16 +192,16 @@
 						$remote_mailuser_id = $mail_user['mailuser_id'];
 						unset($mail_user['mailuser_id']);
 						if(!isset($_POST['import_user_filter'])) $mail_user['custom_mailfilter'] = '';
-						
+
 						//* Insert record in DB
 						$local_mailuser_id = $app->db->datalogInsert('mail_user', $mail_user, 'mailuser_id');
 						$msg .= "Imported mailbox ".$mail_user['email']."<br />";
-						
+
 						//* Import mail user filters
 						if(isset($_POST['import_user_filter']) && $_POST['import_user_filter'] == 1 && $local_mailuser_id > 0) {
-							
+
 							$mail_user_filters = $client->mail_user_filter_get($remote_session_id, array('mailuser_id' => $remote_mailuser_id));
-							
+
 							if(is_array($mail_user_filters)) {
 								foreach($mail_user_filters as $mail_user_filter) {
 									$mail_user_filter['sys_userid'] = $sys_userid;
@@ -209,7 +209,7 @@
 									$mail_user_filter['mailuser_id'] = $local_mailuser_id;
 									$mail_user_filter['server_id'] = $server_id;
 									unset($mail_user_filter['filter_id']);
-									
+
 									//* Insert record in DB
 									$app->db->datalogInsert('mail_user_filter', $mail_user_filter, 'filter_id');
 									$msg .= "Imported mailbox filter ".$mail_user['email'].": ".$mail_user_filter['rulename']."<br />";
@@ -219,11 +219,11 @@
 					} else {
 						$error .= "Mailbox ".$mail_user['email']." exists in local database. Skipped import of mailbox<br />";
 					}
-					
+
 				}
 			}
 		}
-		
+
 		//* Import email aliases
 		if(isset($_POST['import_alias']) && $_POST['import_alias'] == 1) {
 			$mail_aliases = $client->mail_alias_get($remote_session_id, array('type' => 'alias', 'destination' => '%@'.$mail_domain));
@@ -240,11 +240,11 @@
 					} else {
 						$error .= "Email alias ".$mail_alias['source']." exists in local database. Skipped import.<br />";
 					}
-					
+
 				}
 			}
 		}
-		
+
 		//* Import domain aliases
 		if(isset($_POST['import_aliasdomain']) && $_POST['import_aliasdomain'] == 1) {
 			$mail_aliases = $client->mail_alias_get($remote_session_id, array('type' => 'aliasdomain', 'destination' => '@'.$mail_domain));
@@ -261,11 +261,11 @@
 					} else {
 						$error .= "Email aliasdomain ".$mail_alias['source']." exists in local database. Skipped import.<br />";
 					}
-					
+
 				}
 			}
 		}
-		
+
 		//* Import email forward
 		if(isset($_POST['import_forward']) && $_POST['import_forward'] == 1) {
 			$mail_forwards = $client->mail_forward_get($remote_session_id, array('type' => 'forward', 'source' => '%@'.$mail_domain));
@@ -282,11 +282,11 @@
 					} else {
 						$error .= "Email forward ".$mail_forward['source']." exists in local database. Skipped import.<br />";
 					}
-					
+
 				}
 			}
 		}
-		
+
 		//* Import spamfilter
 		if(isset($_POST['import_spamfilter']) && $_POST['import_spamfilter'] == 1) {
 			$mail_spamfilters = $client->mail_spamfilter_user_get($remote_session_id, array('email' => '%@'.$mail_domain));
@@ -303,14 +303,14 @@
 					} else {
 						$error .= "Spamfilter user ".$mail_spamfilter['email']." exists in local database. Skipped import.<br />";
 					}
-					
+
 				}
 			}
 		}
 
 	}
-	
+
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/import_plesk.php b/interface/web/tools/import_plesk.php
index a06505c..0be88b5 100644
--- a/interface/web/tools/import_plesk.php
+++ b/interface/web/tools/import_plesk.php
@@ -30,25 +30,27 @@
 
 global $app, $conf;
 
-require_once('../../lib/config.inc.php');
+require_once '../../lib/config.inc.php';
 
-require_once('../../lib/app.inc.php');
+require_once '../../lib/app.inc.php';
 
 /**
  *
  * @param db $exdb
- * @return array 
+ * @return array
  */
-function read_limit_data($exdb) {
-    $limits = array();
-    // Limits
-    $limit_data = $exdb->queryAllRecords("SELECT l.id, l.limit_name, l.value FROM Limits as l");
-    foreach($limit_data as $entry) {
-        if(array_key_exists($entry['id'], $limits) == false) $limits[$entry['id']] = array();
-        $limits[$entry['id']][$entry['limit_name']] = $entry['value'];
 
-        // limits that are there:
-        /*
+
+function read_limit_data($exdb) {
+	$limits = array();
+	// Limits
+	$limit_data = $exdb->queryAllRecords("SELECT l.id, l.limit_name, l.value FROM Limits as l");
+	foreach($limit_data as $entry) {
+		if(array_key_exists($entry['id'], $limits) == false) $limits[$entry['id']] = array();
+		$limits[$entry['id']][$entry['limit_name']] = $entry['value'];
+
+		// limits that are there:
+		/*
         disk_space
         disk_space_soft
         expiration
@@ -68,10 +70,11 @@
         max_wu
         mbox_quota
         */
-    }
-    
-    return $limits;
+	}
+
+	return $limits;
 }
+
 
 /**
  *
@@ -79,47 +82,47 @@
  * @param int $id
  * @param string $limit
  * @param mixed $default
- * @return mixed 
+ * @return mixed
  */
 function get_limit($limits, $id, $limit, $default = false) {
-    $ret = $default;
-    if(isset($limits[$id][$limit])) $ret = $limits[$id][$limit];
-    
-    return $ret;
+	$ret = $default;
+	if(isset($limits[$id][$limit])) $ret = $limits[$id][$limit];
+
+	return $ret;
 }
 
 function get_option($options, $option, $default = false) {
-    $ret = $default;
-    if(isset($options[$option])) $ret = $options[$option];
-    
-    return $ret;
+	$ret = $default;
+	if(isset($options[$option])) $ret = $options[$option];
+
+	return $ret;
 }
 
 function add_dot($string) {
-    if(strlen($string) > 0 && substr($string, -1, 1) !== '.') $string .= '.';
-    return $string;
+	if(strlen($string) > 0 && substr($string, -1, 1) !== '.') $string .= '.';
+	return $string;
 }
 
 function byte_to_mbyte($byte) {
-    if($byte <= 0) return $byte; // limit = -1 -> unlimited
-    return round($byte / (1024*1024));
+	if($byte <= 0) return $byte; // limit = -1 -> unlimited
+	return round($byte / (1024*1024));
 }
 
 function yes_no($num, $reverse = false) {
-    return (($num == 1 && !$reverse) || ($num != 1 && $reverse) ? 'y' : 'n');
+	return ($num == 1 && !$reverse) || ($num != 1 && $reverse) ? 'y' : 'n';
 }
 
 // taken from the web_domain_edit.php
-function id_hash($id,$levels) {
-    $hash = "" . $id % 10 ;
-    $id /= 10 ;
-    $levels -- ;
-    while ( $levels > 0 ) {
-        $hash .= "/" . $id % 10 ;
-        $id /= 10 ;
-        $levels-- ;
-    }
-    return $hash;
+function id_hash($id, $levels) {
+	$hash = "" . $id % 10 ;
+	$id /= 10 ;
+	$levels -- ;
+	while ( $levels > 0 ) {
+		$hash .= "/" . $id % 10 ;
+		$id /= 10 ;
+		$levels-- ;
+	}
+	return $hash;
 }
 
 /* TODO: document root rewrite on ftp account and other home directories */
@@ -140,245 +143,245 @@
 
 // Start migrating plesk data
 if(isset($_POST['start']) && $_POST['start'] == 1) {
-	
+
 	//* Set variable sin template
-	$app->tpl->setVar('dbhost',$_POST['dbhost']);
-	$app->tpl->setVar('dbname',$_POST['dbname']);
-	$app->tpl->setVar('dbuser',$_POST['dbuser']);
-	$app->tpl->setVar('dbpassword',$_POST['dbpassword']);
-	$app->tpl->setVar('webcontent',$_POST['webcontent']);
-	$app->tpl->setVar('mailcontent',$_POST['mailcontent']);
-	
+	$app->tpl->setVar('dbhost', $_POST['dbhost']);
+	$app->tpl->setVar('dbname', $_POST['dbname']);
+	$app->tpl->setVar('dbuser', $_POST['dbuser']);
+	$app->tpl->setVar('dbpassword', $_POST['dbpassword']);
+	$app->tpl->setVar('webcontent', $_POST['webcontent']);
+	$app->tpl->setVar('mailcontent', $_POST['mailcontent']);
+
 	//* Establish connection to external database
 	$msg .= 'Connecting to external database...<br />';
-	
+
 	//* Backup DB login details
 	/*$conf_bak['db_host'] = $conf['db_host'];
 	$conf_bak['db_database'] = $conf['db_database'];
 	$conf_bak['db_user'] = $conf['db_user'];
 	$conf_bak['db_password'] = $conf['db_password'];*/
-	
+
 	//* Set external Login details
 	$conf['imp_db_host'] = $_POST['dbhost'];
 	$conf['imp_db_database'] = $_POST['dbname'];
 	$conf['imp_db_user'] = $_POST['dbuser'];
 	$conf['imp_db_password'] = $_POST['dbpassword'];
-    $conf['imp_db_charset'] = $conf['db_charset'];
-    $conf['imp_db_new_link'] = $conf['db_new_link'];
-    $conf['imp_db_client_flags'] = $conf['db_client_flags'];
-	
+	$conf['imp_db_charset'] = $conf['db_charset'];
+	$conf['imp_db_new_link'] = $conf['db_new_link'];
+	$conf['imp_db_client_flags'] = $conf['db_client_flags'];
+
 	//* create new db object
 	$exdb = new db('imp');
-    
-    $msg .= 'db object created...<br />';
-    
-    $importer = new importer();
-    $session_id = 'ISPC3'; // set dummy session id for remoting lib
-    $msg .= 'importer object created...<br />';
-	
-    // import on server
+
+	$msg .= 'db object created...<br />';
+
+	$importer = new importer();
+	$session_id = 'ISPC3'; // set dummy session id for remoting lib
+	$msg .= 'importer object created...<br />';
+
+	// import on server
 	$server_id = 1;
-	
+
 	//* Connect to DB
 	if($exdb !== false) {
-        $msg .= 'Connecting to external database done...<br />';
-	
-        $limits = read_limit_data($exdb);
-        
-        $msg .= 'read all limit data...<br />';
-	
-        // param_id -> cl_params table - not needed for import
-        // tpye = admin, reseller, client
-        $admins = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'admin' ORDER BY c.parent_id, c.id");
-        $resellers = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'reseller' ORDER BY c.parent_id, c.id");
-        $clients  = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'client' ORDER BY c.parent_id, c.id");
-        
-        $users = array_merge($admins, $resellers, $clients);
-        $msg .= 'read all users (' . count($users) . ')...<br />';
-	
-        
-        $plesk_ispc_ids = array(); // array with key = plesk id, value = ispc id
-        
-        $phpopts = array('no', 'fast-cgi', 'cgi', 'mod', 'suphp', 'php-fpm');
-        
-        // import admins / resellers
-        for($i = 0; $i < count($users); $i++) {
-            $entry = $users[$i];
-            
-            $old_client = $importer->client_get_by_username($session_id, $entry['login']);
-            if($old_client) {
-                if($old_client['client_id'] == 0) {
-                    $entry['login'] = 'psa_' . $entry['login'];
-                    $old_client = $importer->client_get_by_username($session_id, $entry['login']);
-                    if($old_client) {
-                        $msg .= $entry['login'] . ' existed, updating id ' . $old_client['client_id'] . '<br />';
-                    }
-                } else {
-                    $msg .= $entry['login'] . ' existed, updating id ' . $old_client['client_id'] . '<br />';                    
-                }
-            }
-            $params = array(
-                            'company_name' => $entry['cname'],
-                            'contact_name' => $entry['pname'],
-                            //'customer_no' => '',
-                            'username' => $entry['login'],
-                            'password' => $entry['password'],
-                            'language' => substr($entry['locale'], 0, 2), // plesk stores as de-DE or en-US
-                            //'usertheme' => '',
-                            'street' => $entry['address'],
-                            'zip' => $entry['pcode'],
-                            'city' => $entry['city'],
-                            'state' => $entry['state'],
-                            'country' => $entry['country'],
-                            'telephone' => $entry['phone'],
-                            //'mobile' => $entry[''],
-                            'fax' => $entry['fax'],
-                            'email' => $entry['email'],
-                            //'internet' => $entry[''],
-                            //'icq' => $entry[''],
-                            //'vat_id' => $entry[''],
-                            //'company_id' => $entry[''],
-                            //'bank_account_number' => $entry[''],
-                            //'bank_code' => $entry[''],
-                            //'bank_name' => $entry[''],
-                            //'bank_account_iban' => $entry[''],
-                            //'bank_account_swift' => $entry[''],
-                            'notes' => 'imported from Plesk id ' . $entry['id'],
-                            //'template_master' => $entry[''],
-                            //'template_additional' => $entry[''],
-                            //'default_mailserver' => $entry[''],
-                            'limit_maildomain' => get_limit($limits, $entry['id'], 'max_site', -1),
-                            'limit_mailbox' => get_limit($limits, $entry['id'], 'max_box', -1),
-                            'limit_mailalias' => get_limit($limits, $entry['id'], 'max_mn', -1),
-                            'limit_mailaliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1),
-                            'limit_mailmailinglist' => get_limit($limits, $entry['id'], 'max_maillists', -1),
-                            'limit_mailforward' => get_limit($limits, $entry['id'], 'max_mn', -1),
-                            'limit_mailcatchall' => 1,
-                            'limit_mailrouting' => 0,
-                            'limit_mailfilter' => 0,
-                            'limit_fetchmail' => 0,
-                            'limit_mailquota' => get_limit($limits, $entry['id'], 'mbox_quota', -1),
-                            'limit_spamfilter_wblist' => 0,
-                            'limit_spamfilter_user' => 0,
-                            'limit_spamfilter_policy' => 0,
-                            //'default_webserver' => '',
-                            'limit_web_domain' => get_limit($limits, $entry['id'], 'max_site', -1),
-                            'limit_web_quota' => intval(get_limit($limits, $entry['id'], 'disk_space', -1)),
-                            'web_php_options' => implode(',', $phpopts),
-                            'limit_web_aliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1),
-                            'limit_web_subdomain' => get_limit($limits, $entry['id'], 'max_subdom', -1),
-                            'limit_ftp_user' => (string)($app->functions->intval(get_limit($limits, $entry['id'], 'max_subftp_users', -2)) + 1),
-                            'limit_shell_user' => 0,
-                            'ssh_chroot' => 'no,jailkit',
-                            'limit_webdav_user' => get_limit($limits, $entry['id'], 'max_wu', 0),
-                            //'default_dnsserver' => '',
-                            'limit_dns_zone' => -1,
-                            'limit_dns_slave_zone' => -1,
-                            'limit_dns_record' => -1,
-                            'limit_client' => ($entry['type'] == 'client' ? 0 : -1),
-                            //'default_dbserver' => '',
-                            'limit_database' => get_limit($limits, $entry['id'], 'max_db', -1),
-                            'limit_cron' => 0,
-                            'limit_cron_type' => 'url',
-                            'limit_cron_frequency' => '5',
-                            'limit_traffic_quota' => intval(get_limit($limits, $entry['id'], 'max_traffic', -1)),
-                            'limit_openvz_vm' => 0,
-                            'limit_openvz_vm_template_id' => ''
-                            );
-            $reseller_id = 0;
-            if($entry['parent_id'] != 0) {
-                if(array_key_exists($entry['parent_id'], $plesk_ispc_ids)) {
-                    $reseller_id = $plesk_ispc_ids[$entry['parent_id']];
-                }
-            }
-            
-            if($old_client) {
-                $new_id = $old_client['client_id'];
-                $ok = $importer->client_update($session_id, $old_client['client_id'], $reseller_id, $params);
-                if($ok === false) {
-                    
-                }
-            } else {
-                $new_id = $importer->client_add($session_id, $reseller_id, $params);
-            }
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Client " . $entry['id'] . " (" . $entry['pname'] . ") could not be inserted/updated.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Client " . $entry['id'] . " (" . $entry['pname'] . ") inserted/updated.<br />";
-            }
-            
-            $plesk_ispc_ids[$entry['id']] = $new_id;
-        }
-        unset($users);
-        unset($clients);
-        unset($resellers);
-        unset($admins);
-        
-        $web_config = $app->getconf->get_server_config($server_id,'web');
-        
-        $domains = $exdb->queryAllRecords("SELECT d.id, d.cr_date, d.name, d.displayName, d.dns_zone_id, d.status, d.htype, d.real_size, d.cl_id, d.limits_id, d.params_id, d.guid, d.overuse, d.gl_filter, d.vendor_id, d.webspace_id, d.webspace_status, d.permissions_id, d.external_id FROM domains as d");
-        $dom_ftp_users = array();
-        $domain_ids = array();
-        $domain_roots = array();
-        $domain_owners = array();
-        $dns_domain_ids = array();
-        $maildomain_ids = array();
-        foreach($domains as $entry) {
-            $res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['id'] . "'");
-            $options = array();
-            while($opt = $exdb->nextRecord()) {
-                $options[$opt['param']] = $opt['val'];
-            }
-            
-            /* TODO: options that might be used later:
+		$msg .= 'Connecting to external database done...<br />';
+
+		$limits = read_limit_data($exdb);
+
+		$msg .= 'read all limit data...<br />';
+
+		// param_id -> cl_params table - not needed for import
+		// tpye = admin, reseller, client
+		$admins = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'admin' ORDER BY c.parent_id, c.id");
+		$resellers = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'reseller' ORDER BY c.parent_id, c.id");
+		$clients  = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'client' ORDER BY c.parent_id, c.id");
+
+		$users = array_merge($admins, $resellers, $clients);
+		$msg .= 'read all users (' . count($users) . ')...<br />';
+
+
+		$plesk_ispc_ids = array(); // array with key = plesk id, value = ispc id
+
+		$phpopts = array('no', 'fast-cgi', 'cgi', 'mod', 'suphp', 'php-fpm');
+
+		// import admins / resellers
+		for($i = 0; $i < count($users); $i++) {
+			$entry = $users[$i];
+
+			$old_client = $importer->client_get_by_username($session_id, $entry['login']);
+			if($old_client) {
+				if($old_client['client_id'] == 0) {
+					$entry['login'] = 'psa_' . $entry['login'];
+					$old_client = $importer->client_get_by_username($session_id, $entry['login']);
+					if($old_client) {
+						$msg .= $entry['login'] . ' existed, updating id ' . $old_client['client_id'] . '<br />';
+					}
+				} else {
+					$msg .= $entry['login'] . ' existed, updating id ' . $old_client['client_id'] . '<br />';
+				}
+			}
+			$params = array(
+				'company_name' => $entry['cname'],
+				'contact_name' => $entry['pname'],
+				//'customer_no' => '',
+				'username' => $entry['login'],
+				'password' => $entry['password'],
+				'language' => substr($entry['locale'], 0, 2), // plesk stores as de-DE or en-US
+				//'usertheme' => '',
+				'street' => $entry['address'],
+				'zip' => $entry['pcode'],
+				'city' => $entry['city'],
+				'state' => $entry['state'],
+				'country' => $entry['country'],
+				'telephone' => $entry['phone'],
+				//'mobile' => $entry[''],
+				'fax' => $entry['fax'],
+				'email' => $entry['email'],
+				//'internet' => $entry[''],
+				//'icq' => $entry[''],
+				//'vat_id' => $entry[''],
+				//'company_id' => $entry[''],
+				//'bank_account_number' => $entry[''],
+				//'bank_code' => $entry[''],
+				//'bank_name' => $entry[''],
+				//'bank_account_iban' => $entry[''],
+				//'bank_account_swift' => $entry[''],
+				'notes' => 'imported from Plesk id ' . $entry['id'],
+				//'template_master' => $entry[''],
+				//'template_additional' => $entry[''],
+				//'default_mailserver' => $entry[''],
+				'limit_maildomain' => get_limit($limits, $entry['id'], 'max_site', -1),
+				'limit_mailbox' => get_limit($limits, $entry['id'], 'max_box', -1),
+				'limit_mailalias' => get_limit($limits, $entry['id'], 'max_mn', -1),
+				'limit_mailaliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1),
+				'limit_mailmailinglist' => get_limit($limits, $entry['id'], 'max_maillists', -1),
+				'limit_mailforward' => get_limit($limits, $entry['id'], 'max_mn', -1),
+				'limit_mailcatchall' => 1,
+				'limit_mailrouting' => 0,
+				'limit_mailfilter' => 0,
+				'limit_fetchmail' => 0,
+				'limit_mailquota' => get_limit($limits, $entry['id'], 'mbox_quota', -1),
+				'limit_spamfilter_wblist' => 0,
+				'limit_spamfilter_user' => 0,
+				'limit_spamfilter_policy' => 0,
+				//'default_webserver' => '',
+				'limit_web_domain' => get_limit($limits, $entry['id'], 'max_site', -1),
+				'limit_web_quota' => intval(get_limit($limits, $entry['id'], 'disk_space', -1)),
+				'web_php_options' => implode(',', $phpopts),
+				'limit_web_aliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1),
+				'limit_web_subdomain' => get_limit($limits, $entry['id'], 'max_subdom', -1),
+				'limit_ftp_user' => (string)($app->functions->intval(get_limit($limits, $entry['id'], 'max_subftp_users', -2)) + 1),
+				'limit_shell_user' => 0,
+				'ssh_chroot' => 'no,jailkit',
+				'limit_webdav_user' => get_limit($limits, $entry['id'], 'max_wu', 0),
+				//'default_dnsserver' => '',
+				'limit_dns_zone' => -1,
+				'limit_dns_slave_zone' => -1,
+				'limit_dns_record' => -1,
+				'limit_client' => ($entry['type'] == 'client' ? 0 : -1),
+				//'default_dbserver' => '',
+				'limit_database' => get_limit($limits, $entry['id'], 'max_db', -1),
+				'limit_cron' => 0,
+				'limit_cron_type' => 'url',
+				'limit_cron_frequency' => '5',
+				'limit_traffic_quota' => intval(get_limit($limits, $entry['id'], 'max_traffic', -1)),
+				'limit_openvz_vm' => 0,
+				'limit_openvz_vm_template_id' => ''
+			);
+			$reseller_id = 0;
+			if($entry['parent_id'] != 0) {
+				if(array_key_exists($entry['parent_id'], $plesk_ispc_ids)) {
+					$reseller_id = $plesk_ispc_ids[$entry['parent_id']];
+				}
+			}
+
+			if($old_client) {
+				$new_id = $old_client['client_id'];
+				$ok = $importer->client_update($session_id, $old_client['client_id'], $reseller_id, $params);
+				if($ok === false) {
+
+				}
+			} else {
+				$new_id = $importer->client_add($session_id, $reseller_id, $params);
+			}
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Client " . $entry['id'] . " (" . $entry['pname'] . ") could not be inserted/updated.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Client " . $entry['id'] . " (" . $entry['pname'] . ") inserted/updated.<br />";
+			}
+
+			$plesk_ispc_ids[$entry['id']] = $new_id;
+		}
+		unset($users);
+		unset($clients);
+		unset($resellers);
+		unset($admins);
+
+		$web_config = $app->getconf->get_server_config($server_id, 'web');
+
+		$domains = $exdb->queryAllRecords("SELECT d.id, d.cr_date, d.name, d.displayName, d.dns_zone_id, d.status, d.htype, d.real_size, d.cl_id, d.limits_id, d.params_id, d.guid, d.overuse, d.gl_filter, d.vendor_id, d.webspace_id, d.webspace_status, d.permissions_id, d.external_id FROM domains as d");
+		$dom_ftp_users = array();
+		$domain_ids = array();
+		$domain_roots = array();
+		$domain_owners = array();
+		$dns_domain_ids = array();
+		$maildomain_ids = array();
+		foreach($domains as $entry) {
+			$res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['id'] . "'");
+			$options = array();
+			while($opt = $exdb->nextRecord()) {
+				$options[$opt['param']] = $opt['val'];
+			}
+
+			/* TODO: options that might be used later:
              * OveruseBlock true/false
              * OveruseNotify true/false
              * OveruseSuspend true/false
              * wu_script true/false (webusers allowed to use scripts?)
              * webmail string (webmailer used - horde)
              */
-            
-            $redir_type = '';
-            $redir_path = '';
-            
-            if($entry['htype'] === 'std_fwd') {
-                // redirection
-                $redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
-                $redir_type = 'R,L';
-                $redir_path = $redir['redirect'];
-            } elseif($entry['htype'] === 'vrt_hst') {
-                // default virtual hosting (vhost)
-            } else {
-                /* TODO: unknown type */
-            }
-            
-            $hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM hosting as h LEFT JOIN sys_users as s ON (s.id = h.sys_user_id) LEFT JOIN accounts as a ON (s.account_id = a.id) WHERE h.dom_id = '" . $entry['id'] . "'");
-            if($hosting['sys_user_id']) {
-                $dom_ftp_users[] = array('id' => 0,
-                                         'dom_id' => $hosting['dom_id'],
-                                         'sys_user_id' => $hosting['sys_user_id'],
-                                         'login' => $hosting['login'],
-                                         'account_id' => $hosting['account_id'],
-                                         'home' => $hosting['home'],
-                                         'shell' => $hosting['shell'],
-                                         'quota' => $hosting['quota'],
-                                         'mapped_to' => $hosting['mapped_to'],
-                                         'password' => $hosting['password'],
-                                         'pwtype' => $hosting['pwtype']
-                                        );
-            }
-            
-            $phpmode = 'no';
-            if(get_option($hosting, 'php', 'false') === 'true') {
-                $mode = get_option($hosting, 'php_handler_type', 'module');
-                if($mode === 'module') $phpmode = 'mod';
-                else $phpmode = 'fast-cgi';
-                /* TODO: what other options could be in "php_handler_type"? */
-            }
-            
-            /* TODO: plesk offers some more options:
+
+			$redir_type = '';
+			$redir_path = '';
+
+			if($entry['htype'] === 'std_fwd') {
+				// redirection
+				$redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
+				$redir_type = 'R,L';
+				$redir_path = $redir['redirect'];
+			} elseif($entry['htype'] === 'vrt_hst') {
+				// default virtual hosting (vhost)
+			} else {
+				/* TODO: unknown type */
+			}
+
+			$hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM hosting as h LEFT JOIN sys_users as s ON (s.id = h.sys_user_id) LEFT JOIN accounts as a ON (s.account_id = a.id) WHERE h.dom_id = '" . $entry['id'] . "'");
+			if($hosting['sys_user_id']) {
+				$dom_ftp_users[] = array('id' => 0,
+					'dom_id' => $hosting['dom_id'],
+					'sys_user_id' => $hosting['sys_user_id'],
+					'login' => $hosting['login'],
+					'account_id' => $hosting['account_id'],
+					'home' => $hosting['home'],
+					'shell' => $hosting['shell'],
+					'quota' => $hosting['quota'],
+					'mapped_to' => $hosting['mapped_to'],
+					'password' => $hosting['password'],
+					'pwtype' => $hosting['pwtype']
+				);
+			}
+
+			$phpmode = 'no';
+			if(get_option($hosting, 'php', 'false') === 'true') {
+				$mode = get_option($hosting, 'php_handler_type', 'module');
+				if($mode === 'module') $phpmode = 'mod';
+				else $phpmode = 'fast-cgi';
+				/* TODO: what other options could be in "php_handler_type"? */
+			}
+
+			/* TODO: plesk offers some more options:
              * sys_user_id -> owner of files?
              * ip_address_id - needed?
              * fp - frontpage extensions
@@ -389,212 +392,212 @@
              * traffic_bandwidth
              * max_connections
              */
-            $params = array(
-                            'server_id' => $server_id,
-                            'ip_address' => '*',
-                            //'ipv6_address' => '',
-                            'domain' => $entry['name'],
-                            'type' => 'vhost', // can be vhost or alias
-                            'parent_domain_id' => '', // only if alias
-                            'vhost_type' => 'name', // or ip (-based)
-                            'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'disk_space', -1)),
-                            'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'max_traffic', -1)),
-                            'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
-                            'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
-                            'suexec' => yes_no(1), // does plesk use this?!
-                            'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
-                            'subdomain' => 'www', // plesk always uses this option
-                            'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
-                            'php' => $phpmode,
-                            'fastcgi_php_version' => '', // plesk has no different php versions
-                            'ruby' => yes_no(0), // plesk has no ruby support
-                            'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
-                            'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
-                            'redirect_type' => $redir_type,
-                            'redirect_path' => $redir_path,
-                            'seo_redirect' => '',
-                            'ssl_state' => $entry[''],
-                            'ssl_locality' => $entry[''],
-                            'ssl_organisation' => $entry[''],
-                            'ssl_organisation_unit' => $entry[''],
-                            'ssl_country' => $entry[''],
-                            'ssl_domain' => $entry[''],
-                            'ssl_request' => $entry[''],
-                            'ssl_cert' => $entry[''],
-                            'ssl_bundle' => $entry[''],
-                            'ssl_action' => $entry[''],
-                            'stats_password' => '',
-                            'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
-                            'backup_interval' => 'none',
-                            'backup_copies' => 1,
-                            'allow_override' => 'All',
-                            'pm_process_idle_timeout' => 10,
-                            'pm_max_requests' => 0
-                            );
-            
-            // find already inserted domain
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
-            if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $msg .= "Found domain with id " . $new_id . ", updating it.<br />";
-                $params = array_merge($old_domain, $params);
-                $ok = $importer->sites_web_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->sites_web_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params, true); // read only...
-            }
-            
-            $domain_ids[$entry['id']] = $new_id;
-            $domain_roots[$entry['id']] = $entry['www_root'];
-            $domain_owners[$entry['id']] = $entry['cl_id'];
-            $dns_domain_ids[$entry['dns_zone_id']] = $entry['id'];
-            
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") inserted -> " . $new_id . ".<br />";
-            }
-            
-            // add domain to mail domains too
-            $params = array(
-                            'server_id' => $server_id,
-                            'domain' => $entry['name'],
-                            'active' => yes_no(($entry['status'] == 0 ? 1 : 0))
-                            );
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found maildomain with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->mail_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Inserting new maildomain " . $entry['name'] . ".<br />";
-                $new_id = $importer->mail_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params);
-            }
-            
-            $maildomain_ids[$entry['id']] = $new_id;
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Maildomain (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Maildomain " . $new_id . " (" . $entry['name'] . ") inserted.<br />";
-            }
+			$params = array(
+				'server_id' => $server_id,
+				'ip_address' => '*',
+				//'ipv6_address' => '',
+				'domain' => $entry['name'],
+				'type' => 'vhost', // can be vhost or alias
+				'parent_domain_id' => '', // only if alias
+				'vhost_type' => 'name', // or ip (-based)
+				'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'disk_space', -1)),
+				'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'max_traffic', -1)),
+				'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
+				'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
+				'suexec' => yes_no(1), // does plesk use this?!
+				'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
+				'subdomain' => 'www', // plesk always uses this option
+				'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
+				'php' => $phpmode,
+				'fastcgi_php_version' => '', // plesk has no different php versions
+				'ruby' => yes_no(0), // plesk has no ruby support
+				'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
+				'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
+				'redirect_type' => $redir_type,
+				'redirect_path' => $redir_path,
+				'seo_redirect' => '',
+				'ssl_state' => $entry[''],
+				'ssl_locality' => $entry[''],
+				'ssl_organisation' => $entry[''],
+				'ssl_organisation_unit' => $entry[''],
+				'ssl_country' => $entry[''],
+				'ssl_domain' => $entry[''],
+				'ssl_request' => $entry[''],
+				'ssl_cert' => $entry[''],
+				'ssl_bundle' => $entry[''],
+				'ssl_action' => $entry[''],
+				'stats_password' => '',
+				'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
+				'backup_interval' => 'none',
+				'backup_copies' => 1,
+				'allow_override' => 'All',
+				'pm_process_idle_timeout' => 10,
+				'pm_max_requests' => 0
+			);
 
-        }
-        
-        $domain_aliases = $exdb->queryAllRecords("SELECT da.id, da.name, da.displayName, da.dns, da.mail, da.web, da.dom_id, da.status FROM domainaliases as da");
-        foreach($domain_aliases as $entry) {
-            $params = array(
-                            'server_id' => $server_id,
-                            'domain' => $entry['name'],
-                            'type' => 'alias',
-                            'parent_domain_id' => $domain_ids[$entry['dom_id']],
-                            'redirect_type' => '',
-                            'redirect_path' => '',
-                            'subdomain' => 'www',
-                            'active' => yes_no(($entry['status'] == 0 && $entry['web'] === 'true') ? 1 : 0)
-                            );
-            
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
-            if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found domain with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->sites_web_aliasdomain_update($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->sites_web_aliasdomain_add($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $params);
-            }
-            
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Aliasdomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Aliasdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
-            }
-            
-            // add alias to mail domains, too
-            $params = array(
-                        'server_id' => $server_id,
-                        'domain' => $entry['name'],
-                        'active' => yes_no(($entry['status'] == 0 && $entry['mail'] === 'true') ? 1 : 0)
-                        );
+			// find already inserted domain
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
+			if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$msg .= "Found domain with id " . $new_id . ", updating it.<br />";
+				$params = array_merge($old_domain, $params);
+				$ok = $importer->sites_web_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->sites_web_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params, true); // read only...
+			}
 
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found mail domain with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->sites_web_aliasdomain_update($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->mail_domain_add($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $params);
-            }
-            
-            $maildomain_ids[$entry['id']] = $new_id;
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Aliasmaildomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Aliasmaildomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
-            }
-        }
-        
-        // subdomains in plesk are real vhosts, so we have to treat them as vhostsubdomains
-        $subdomains = $exdb->queryAllRecords("SELECT d.id, d.dom_id, d.name, d.displayName, d.sys_user_id, d.ssi, d.php, d.cgi, d.perl, d.python, d.fastcgi, d.miva, d.coldfusion, d.asp, d.asp_dot_net, d.ssl, d.same_ssl, d.php_handler_type, d.www_root, d.maintenance_mode, d.certificate_id FROM subdomains as d");
-        $subdomain_ids = array();
-        $subdomain_roots = array();
-        $subdomain_owners = array();
-        foreach($subdomains as $entry) {
-            $res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['dom_id'] . "'");
-            $options = array();
-            while($opt = $exdb->nextRecord()) {
-                $options[$opt['param']] = $opt['val'];
-            }
-            
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
-            
-            /* TODO: options that might be used later:
+			$domain_ids[$entry['id']] = $new_id;
+			$domain_roots[$entry['id']] = $entry['www_root'];
+			$domain_owners[$entry['id']] = $entry['cl_id'];
+			$dns_domain_ids[$entry['dns_zone_id']] = $entry['id'];
+
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") inserted -> " . $new_id . ".<br />";
+			}
+
+			// add domain to mail domains too
+			$params = array(
+				'server_id' => $server_id,
+				'domain' => $entry['name'],
+				'active' => yes_no(($entry['status'] == 0 ? 1 : 0))
+			);
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found maildomain with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->mail_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Inserting new maildomain " . $entry['name'] . ".<br />";
+				$new_id = $importer->mail_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params);
+			}
+
+			$maildomain_ids[$entry['id']] = $new_id;
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Maildomain (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Maildomain " . $new_id . " (" . $entry['name'] . ") inserted.<br />";
+			}
+
+		}
+
+		$domain_aliases = $exdb->queryAllRecords("SELECT da.id, da.name, da.displayName, da.dns, da.mail, da.web, da.dom_id, da.status FROM domainaliases as da");
+		foreach($domain_aliases as $entry) {
+			$params = array(
+				'server_id' => $server_id,
+				'domain' => $entry['name'],
+				'type' => 'alias',
+				'parent_domain_id' => $domain_ids[$entry['dom_id']],
+				'redirect_type' => '',
+				'redirect_path' => '',
+				'subdomain' => 'www',
+				'active' => yes_no(($entry['status'] == 0 && $entry['web'] === 'true') ? 1 : 0)
+			);
+
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
+			if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found domain with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->sites_web_aliasdomain_update($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->sites_web_aliasdomain_add($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $params);
+			}
+
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Aliasdomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Aliasdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
+			}
+
+			// add alias to mail domains, too
+			$params = array(
+				'server_id' => $server_id,
+				'domain' => $entry['name'],
+				'active' => yes_no(($entry['status'] == 0 && $entry['mail'] === 'true') ? 1 : 0)
+			);
+
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found mail domain with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->sites_web_aliasdomain_update($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->mail_domain_add($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $params);
+			}
+
+			$maildomain_ids[$entry['id']] = $new_id;
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Aliasmaildomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Aliasmaildomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
+			}
+		}
+
+		// subdomains in plesk are real vhosts, so we have to treat them as vhostsubdomains
+		$subdomains = $exdb->queryAllRecords("SELECT d.id, d.dom_id, d.name, d.displayName, d.sys_user_id, d.ssi, d.php, d.cgi, d.perl, d.python, d.fastcgi, d.miva, d.coldfusion, d.asp, d.asp_dot_net, d.ssl, d.same_ssl, d.php_handler_type, d.www_root, d.maintenance_mode, d.certificate_id FROM subdomains as d");
+		$subdomain_ids = array();
+		$subdomain_roots = array();
+		$subdomain_owners = array();
+		foreach($subdomains as $entry) {
+			$res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['dom_id'] . "'");
+			$options = array();
+			while($opt = $exdb->nextRecord()) {
+				$options[$opt['param']] = $opt['val'];
+			}
+
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
+
+			/* TODO: options that might be used later:
              * OveruseBlock true/false
              * OveruseNotify true/false
              * OveruseSuspend true/false
              * wu_script true/false (webusers allowed to use scripts?)
              * webmail string (webmailer used - horde)
              */
-            
-            $redir_type = '';
-            $redir_path = '';
-            
-            if($entry['htype'] === 'std_fwd') {
-                // redirection
-                $redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
-                $redir_type = 'R,L';
-                $redir_path = $redir['redirect'];
-            } elseif($entry['htype'] === 'vrt_hst') {
-                // default virtual hosting (vhost)
-            } else {
-                /* TODO: unknown type */
-            }
-            
-            $hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id FROM hosting as h WHERE h.dom_id = '" . $entry['dom_id'] . "'");
-            $hosting = array_merge($hosting, $entry); //settings from subdomain override parent settings
-            
-            $phpmode = 'no';
-            if(get_option($hosting, 'php', 'false') === 'true') {
-                $mode = get_option($hosting, 'php_handler_type', 'module');
-                if($mode === 'module') $phpmode = 'mod';
-                else $phpmode = 'fast-cgi';
-                /* TODO: what other options could be in "php_handler_type"? */
-            }
-            /* TODO: plesk offers some more options:
+
+			$redir_type = '';
+			$redir_path = '';
+
+			if($entry['htype'] === 'std_fwd') {
+				// redirection
+				$redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
+				$redir_type = 'R,L';
+				$redir_path = $redir['redirect'];
+			} elseif($entry['htype'] === 'vrt_hst') {
+				// default virtual hosting (vhost)
+			} else {
+				/* TODO: unknown type */
+			}
+
+			$hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id FROM hosting as h WHERE h.dom_id = '" . $entry['dom_id'] . "'");
+			$hosting = array_merge($hosting, $entry); //settings from subdomain override parent settings
+
+			$phpmode = 'no';
+			if(get_option($hosting, 'php', 'false') === 'true') {
+				$mode = get_option($hosting, 'php_handler_type', 'module');
+				if($mode === 'module') $phpmode = 'mod';
+				else $phpmode = 'fast-cgi';
+				/* TODO: what other options could be in "php_handler_type"? */
+			}
+			/* TODO: plesk offers some more options:
              * sys_user_id -> owner of files?
              * ip_address_id - needed?
              * fp - frontpage extensions
@@ -605,88 +608,88 @@
              * traffic_bandwidth
              * max_connections
              */
-            
-            $params = array(
-                            'server_id' => $server_id,
-                            'ip_address' => '*',
-                            //'ipv6_address' => '',
-                            'domain' => $entry['name'] . '.' . $parent_domain['name'],
-                            'web_folder' => $entry['www_root'],
-                            'type' => 'vhostsubdomain', // can be vhost or alias
-                            'parent_domain_id' => $domain_ids[$entry['dom_id']],
-                            'vhost_type' => 'name', // or ip (-based)
-                            'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'disk_space', -1)),
-                            'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'max_traffic', -1)),
-                            'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
-                            'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
-                            'suexec' => yes_no(1), // does plesk use this?!
-                            'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
-                            'subdomain' => '', // plesk always uses this option
-                            'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
-                            'php' => $phpmode,
-                            'fastcgi_php_version' => '', // plesk has no different php versions
-                            'ruby' => yes_no(0), // plesk has no ruby support
-                            'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
-                            'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
-                            'redirect_type' => $redir_type,
-                            'redirect_path' => $redir_path,
-                            'seo_redirect' => '',
-                            'ssl_state' => $entry[''],
-                            'ssl_locality' => $entry[''],
-                            'ssl_organisation' => $entry[''],
-                            'ssl_organisation_unit' => $entry[''],
-                            'ssl_country' => $entry[''],
-                            'ssl_domain' => $entry[''],
-                            'ssl_request' => $entry[''],
-                            'ssl_cert' => $entry[''],
-                            'ssl_bundle' => $entry[''],
-                            'ssl_action' => $entry[''],
-                            'stats_password' => '',
-                            'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
-                            'backup_interval' => 'none',
-                            'backup_copies' => 1,
-                            'allow_override' => 'All',
-                            'pm_process_idle_timeout' => 10,
-                            'pm_max_requests' => 0
-                            );
 
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . '.' . $parent_domain['name'] . "'");
-            if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found domain with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->sites_web_vhost_subdomain_update($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->sites_web_vhost_subdomain_add($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $params, true); // read only...
-            }
-            
-            $subdomain_ids[$entry['id']] = $new_id;
-            $subdomain_roots[$entry['id']] = $entry['www_root'];
-            $subdomain_owners[$entry['id']] = $entry['cl_id'];
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
-            }
-        }
-        
-        // dns have to be done AFTER domains due to missing client info
-        /*
+			$params = array(
+				'server_id' => $server_id,
+				'ip_address' => '*',
+				//'ipv6_address' => '',
+				'domain' => $entry['name'] . '.' . $parent_domain['name'],
+				'web_folder' => $entry['www_root'],
+				'type' => 'vhostsubdomain', // can be vhost or alias
+				'parent_domain_id' => $domain_ids[$entry['dom_id']],
+				'vhost_type' => 'name', // or ip (-based)
+				'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'disk_space', -1)),
+				'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'max_traffic', -1)),
+				'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
+				'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
+				'suexec' => yes_no(1), // does plesk use this?!
+				'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
+				'subdomain' => '', // plesk always uses this option
+				'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
+				'php' => $phpmode,
+				'fastcgi_php_version' => '', // plesk has no different php versions
+				'ruby' => yes_no(0), // plesk has no ruby support
+				'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
+				'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
+				'redirect_type' => $redir_type,
+				'redirect_path' => $redir_path,
+				'seo_redirect' => '',
+				'ssl_state' => $entry[''],
+				'ssl_locality' => $entry[''],
+				'ssl_organisation' => $entry[''],
+				'ssl_organisation_unit' => $entry[''],
+				'ssl_country' => $entry[''],
+				'ssl_domain' => $entry[''],
+				'ssl_request' => $entry[''],
+				'ssl_cert' => $entry[''],
+				'ssl_bundle' => $entry[''],
+				'ssl_action' => $entry[''],
+				'stats_password' => '',
+				'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
+				'backup_interval' => 'none',
+				'backup_copies' => 1,
+				'allow_override' => 'All',
+				'pm_process_idle_timeout' => 10,
+				'pm_max_requests' => 0
+			);
+
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . '.' . $parent_domain['name'] . "'");
+			if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found domain with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->sites_web_vhost_subdomain_update($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->sites_web_vhost_subdomain_add($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $params, true); // read only...
+			}
+
+			$subdomain_ids[$entry['id']] = $new_id;
+			$subdomain_roots[$entry['id']] = $entry['www_root'];
+			$subdomain_owners[$entry['id']] = $entry['cl_id'];
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
+			}
+		}
+
+		// dns have to be done AFTER domains due to missing client info
+		/*
         $dns_zone_ids = array();
         $dns_zone_serials = array();
         $dns_zones = $exdb->queryAllRecords("SELECT d.id, d.name, d.displayName, d.status, d.email, d.type, d.ttl, d.ttl_unit, d.refresh, d.refresh_unit, d.retry, d.retry_unit, d.expire, d.expire_unit, d.minimum, d.minimum_unit, d.serial_format, d.serial FROM dns_zone as d");
         foreach($dns_zones as $entry) {
             $ns = $exdb->queryOneRecord("SELECT d.id, d.val FROM dns_recs as d WHERE d.dns_zone_id = '" . $entry['id'] . "' AND d.type = 'NS'");
             if(!$ns) $ns = array('id' => 0, 'val' => 'ns.' . $entry['name']);
-            
+
             $dom_id = $dns_domain_ids[$entry['id']];
             $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
             if(!$client_id) $client_id = 0;
-            
+
             $params = array(
                             'server_id' => $server_id,
                             'origin' => add_dot($entry['name']), // what to put here?
@@ -703,7 +706,7 @@
                             'update_acl' => '',
                             'active' => yes_no(($entry['status'] == 0 ? 1 : 0))
                             );
-            
+
             $old_dns = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin = '" . add_dot($entry['name']) . "'");
             if($old_dns) $old_id = $old_dns['id'];
             if($old_id) {
@@ -730,7 +733,7 @@
         }
         unset($dns_zones);
         */
-        /* types:
+		/* types:
          * PTR, NS, A, CNAME, MX, TXT, AAAA
          *//*
         $dns_records = $exdb->queryAllRecords("SELECT d.id, d.dns_zone_id, d.type, d.displayHost, d.host, d.displayVal, d.val, d.opt, d.time_stamp FROM dns_recs as d");
@@ -740,11 +743,11 @@
                 // entry for missing dns zone...?
                 continue;
             }
-            
+
             $dom_id = $dns_domain_ids[$entry['dns_zone_id']];
             $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
             if(!$client_id) $client_id = 0;
-            
+
             $params = array(
                         'server_id' => $server_id,
                         'zone' => $dns_id,
@@ -756,14 +759,14 @@
                         'stamp' => $entry['time_stamp'],
                         //'serial' => $dns_zone_serials[$entry['id']]
                         );
-            
-            
+
+
             $record = $app->db->queryOneRecord("SELECT id FROM dns_rr WHERE zone = '" . $dns_zone_ids[$entry['dns_zone_id']] . "' AND name = '" . add_dot($entry['host']) . "' AND type = '" . $entry['type'] . "'");
             $old_id = 0;
             if($record) {
                 $old_id = $record['id'];
             }
-            
+
             $new_id = false;
             if($entry['type'] === 'MX') {
                 $params['aux'] = $entry['opt'];
@@ -823,392 +826,392 @@
             } else {
                 $msg .= "DNS " . $entry['id'] . " (" . $entry['name'] . ") inserted/updated.<br />";
             }
-            
+
         }
         unset($dns_records);
         */
-        
-        $folder_ids = array();
-        /* web_folder creation*/
-        $protected_dirs = $exdb->queryAllRecords("SELECT `id`, `non_ssl`, `ssl`, `cgi_bin`, `realm`, `path`, `dom_id` FROM protected_dirs");
-        foreach($protected_dirs as $entry) {
-            if($entry['path'] == 'plesk-stat') continue;
-            
-            $params = array('server_id' => $server_id,
-                            'parent_domain_id' => $domain_ids[$entry['dom_id']],
-                            'path' => $entry['path'],
-                            'active' => 'y');
-            $folder_id = 0;
-            $check = $app->db->queryOneRecord('SELECT * FROM `web_folder` WHERE `parent_domain_id` = \'' . $domain_ids[$entry['dom_id']] . '\' AND `path` = \'' . $app->db->quote($entry['path']) . '\'');
-            if($check) {
-                $ok = $importer->sites_web_folder_update($session_id, $client_id, $check['web_folder_id'], array_merge($check, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                $folder_id = $check['web_folder_id'];
-                $msg .= 'Updated HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
-            } else {
-                $folder_id = $importer->sites_web_folder_add($session_id, $client_id, $params);
-                $msg .= 'Created HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
-                if(!$folder_id) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
-            }
-            
-            $folder_ids[$entry['id']] = $folder_id;
-        }
-        
-        $pd_users = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.pd_id, a.password FROM pd_users as u INNER JOIN accounts as a ON (a.id = u.account_id)");
-        foreach($protected_dirs as $entry) {
-            $params = array('server_id' => $server_id,
-                            'web_folder_id' => $folder_ids[$entry['pd_id']],
-                            'username' => $entry['login'],
-                            'password' => $entry['password'],
-                            'active' => 'y');
-            
-            $check = $app->db->queryOneRecord('SELECT * FROM `web_folder_user` WHERE `web_folder_id` = ' . intval($folder_ids[$entry['pd_id']]) . ' AND `username` = \'' . $entry['login'] . '\'');
-            if($check) {
-                $ok = $importer->sites_web_folder_user_update($session_id, $client_id, $check['web_folder_user_id'], array_merge($check, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                $msg .= 'Updated HTTP AUTH folder user  (' . $fu_id . '): ' . $entry['login'] . '<br />';
-            } else {
-                $fu_id = $importer->sites_web_folder_user_add($session_id, $client_id, $params);
-                $msg .= 'Created HTTP AUTH folder user  (' . $fu_id . '): ' . $entry['login'] . '<br />';
-                if(!$fu_id) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
-            }
-        }
-        
-        /*$web_users = $exdb->queryAllRecords("SELECT id, dom_id, sys_user_id, ssi, php, cgi, perl, python, fastcgi, asp, asp_dot_net FROM web_users");
+
+		$folder_ids = array();
+		/* web_folder creation*/
+		$protected_dirs = $exdb->queryAllRecords("SELECT `id`, `non_ssl`, `ssl`, `cgi_bin`, `realm`, `path`, `dom_id` FROM protected_dirs");
+		foreach($protected_dirs as $entry) {
+			if($entry['path'] == 'plesk-stat') continue;
+
+			$params = array('server_id' => $server_id,
+				'parent_domain_id' => $domain_ids[$entry['dom_id']],
+				'path' => $entry['path'],
+				'active' => 'y');
+			$folder_id = 0;
+			$check = $app->db->queryOneRecord('SELECT * FROM `web_folder` WHERE `parent_domain_id` = \'' . $domain_ids[$entry['dom_id']] . '\' AND `path` = \'' . $app->db->quote($entry['path']) . '\'');
+			if($check) {
+				$ok = $importer->sites_web_folder_update($session_id, $client_id, $check['web_folder_id'], array_merge($check, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				$folder_id = $check['web_folder_id'];
+				$msg .= 'Updated HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
+			} else {
+				$folder_id = $importer->sites_web_folder_add($session_id, $client_id, $params);
+				$msg .= 'Created HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
+				if(!$folder_id) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
+			}
+
+			$folder_ids[$entry['id']] = $folder_id;
+		}
+
+		$pd_users = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.pd_id, a.password FROM pd_users as u INNER JOIN accounts as a ON (a.id = u.account_id)");
+		foreach($protected_dirs as $entry) {
+			$params = array('server_id' => $server_id,
+				'web_folder_id' => $folder_ids[$entry['pd_id']],
+				'username' => $entry['login'],
+				'password' => $entry['password'],
+				'active' => 'y');
+
+			$check = $app->db->queryOneRecord('SELECT * FROM `web_folder_user` WHERE `web_folder_id` = ' . intval($folder_ids[$entry['pd_id']]) . ' AND `username` = \'' . $entry['login'] . '\'');
+			if($check) {
+				$ok = $importer->sites_web_folder_user_update($session_id, $client_id, $check['web_folder_user_id'], array_merge($check, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				$msg .= 'Updated HTTP AUTH folder user  (' . $fu_id . '): ' . $entry['login'] . '<br />';
+			} else {
+				$fu_id = $importer->sites_web_folder_user_add($session_id, $client_id, $params);
+				$msg .= 'Created HTTP AUTH folder user  (' . $fu_id . '): ' . $entry['login'] . '<br />';
+				if(!$fu_id) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
+			}
+		}
+
+		/*$web_users = $exdb->queryAllRecords("SELECT id, dom_id, sys_user_id, ssi, php, cgi, perl, python, fastcgi, asp, asp_dot_net FROM web_users");
         foreach($web_users as $entry) {
-            $params = 
+            $params =
         }
         */
-        
-        
-        $ftp_users = $exdb->queryAllRecords("SELECT f.id, f.dom_id, f.sys_user_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM ftp_users as f INNER JOIN sys_users as s ON (s.id = f.sys_user_id) INNER JOIN accounts as a ON (a.id = s.account_id)");
-        $ftp_users = array_merge($ftp_users, $dom_ftp_users);
-        foreach($ftp_users as $entry) {
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
-            
-            $ispc_dom_id = $domain_ids[$entry['dom_id']];
-            $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
-            if(!$client_id) $client_id = 0;
-            
-            $document_root = str_replace("[website_id]",$ispc_dom_id,$web_config["website_path"]);
-            $document_root = str_replace("[website_idhash_1]",id_hash($ispc_dom_id,1),$document_root);
-            $document_root = str_replace("[website_idhash_2]",id_hash($ispc_dom_id,1),$document_root);
-            $document_root = str_replace("[website_idhash_3]",id_hash($ispc_dom_id,1),$document_root);
-            $document_root = str_replace("[website_idhash_4]",id_hash($ispc_dom_id,1),$document_root);
 
-            // Set the values for document_root, system_user and system_group
-            $system_user = 'web'.$ispc_dom_id;
-            $system_group = 'client'.$client_id;
-            $document_root = str_replace("[client_id]",$client_id,$document_root);
-            $document_root = str_replace("[client_idhash_1]",id_hash($client_id,1),$document_root);
-            $document_root = str_replace("[client_idhash_2]",id_hash($client_id,2),$document_root);
-            $document_root = str_replace("[client_idhash_3]",id_hash($client_id,3),$document_root);
-            $document_root = str_replace("[client_idhash_4]",id_hash($client_id,4),$document_root);
-            
-            $uid = $system_user;
-            $gid = $system_group;
-            
-            $sys_grp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = '" . $client_id . "'");
-            if(!$sys_grp) $sys_grp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = 0");
-            
-            if(!$sys_grp) $sys_groupid = 1;
-            else $sys_groupid = $sys_grp['groupid'];
-            
-            $params = array(
-                            'server_id' => $server_id,
-                            'parent_domain_id' => $domain_ids[$entry['dom_id']],
-                            'username' => $entry['login'],
-                            'password' => $entry['password'],
-                            'quota_size' => byte_to_mbyte(($entry['quota'] == 0 ? -1 : $entry['quota'])),
-                            'active' => yes_no(1),
-                            'uid' => $uid,
-                            'gid' => $gid,
-                            'dir' => $document_root . (substr($document_root, -1) !== '/' ? '/' : ''),
-                            'sys_groupid' => $sys_groupid
-                            //'quota_files' => $entry[''],
-                            //'ul_ratio' => $entry[''],
-                            //'dl_ratio' => $entry[''],
-                            //'ul_bandwidth' => $entry[''],
-                            //'dl_bandwidth' => $entry['']
-                            );
-            $new_id = false;
-            $old_ftp = $app->db->queryOneRecord("SELECT ftp_user_id, parent_domain_id FROM ftp_user WHERE username = '" . $entry['login'] ."'");
-            if($old_ftp) {
-                if($old_ftp['parent_domain_id'] != $domain_ids[$entry['dom_id']]) {
-                    $msg .= "FTP Account conflicts with other domain!<br />";
-                } else {
-                    $new_id = $old_ftp['ftp_user_id'];
-                    $ok = $importer->sites_ftp_user_update($session_id, $client_id, $new_id, $params);
-                    if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                }
-            } else {
-                $new_id = $importer->sites_ftp_user_add($session_id, $client_id, $params);
-            }
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "FTP " . $entry['id'] . " (" . $entry['login'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                $msg .= "Params: " . var_export($params, true) . "<br />";
-            } else {
-                $msg .= "FTP Account " . $entry['id'] . " (" . $entry['login'] . ") inserted.<br />";
-            }
-        }
-        
-        $mail_config = $app->getconf->get_server_config($server_id, 'mail');
-        
-        $mail_addresses = $exdb->queryAllRecords("SELECT m.id, m.mail_name, m.perm_id, m.postbox, m.account_id, m.redirect, m.redir_addr, m.mail_group, m.autoresponder, m.spamfilter, m.virusfilter, m.mbox_quota, m.dom_id, m.userId, a.password, a.type as `pwtype` FROM mail as m LEFT JOIN accounts as a ON (a.id = m.account_id) ");
-        $mail_ids = array();
-        foreach($mail_addresses as $entry) {
-            
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
-            if(!$parent_domain) {
-                $msg .= "Could not insert/update mail address " . $entry['mail_name'] . " as domain is missing.<br />";
-                continue;
-            }
-            
-            /* postbox true/false
+
+		$ftp_users = $exdb->queryAllRecords("SELECT f.id, f.dom_id, f.sys_user_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM ftp_users as f INNER JOIN sys_users as s ON (s.id = f.sys_user_id) INNER JOIN accounts as a ON (a.id = s.account_id)");
+		$ftp_users = array_merge($ftp_users, $dom_ftp_users);
+		foreach($ftp_users as $entry) {
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
+
+			$ispc_dom_id = $domain_ids[$entry['dom_id']];
+			$client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
+			if(!$client_id) $client_id = 0;
+
+			$document_root = str_replace("[website_id]", $ispc_dom_id, $web_config["website_path"]);
+			$document_root = str_replace("[website_idhash_1]", id_hash($ispc_dom_id, 1), $document_root);
+			$document_root = str_replace("[website_idhash_2]", id_hash($ispc_dom_id, 1), $document_root);
+			$document_root = str_replace("[website_idhash_3]", id_hash($ispc_dom_id, 1), $document_root);
+			$document_root = str_replace("[website_idhash_4]", id_hash($ispc_dom_id, 1), $document_root);
+
+			// Set the values for document_root, system_user and system_group
+			$system_user = 'web'.$ispc_dom_id;
+			$system_group = 'client'.$client_id;
+			$document_root = str_replace("[client_id]", $client_id, $document_root);
+			$document_root = str_replace("[client_idhash_1]", id_hash($client_id, 1), $document_root);
+			$document_root = str_replace("[client_idhash_2]", id_hash($client_id, 2), $document_root);
+			$document_root = str_replace("[client_idhash_3]", id_hash($client_id, 3), $document_root);
+			$document_root = str_replace("[client_idhash_4]", id_hash($client_id, 4), $document_root);
+
+			$uid = $system_user;
+			$gid = $system_group;
+
+			$sys_grp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = '" . $client_id . "'");
+			if(!$sys_grp) $sys_grp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = 0");
+
+			if(!$sys_grp) $sys_groupid = 1;
+			else $sys_groupid = $sys_grp['groupid'];
+
+			$params = array(
+				'server_id' => $server_id,
+				'parent_domain_id' => $domain_ids[$entry['dom_id']],
+				'username' => $entry['login'],
+				'password' => $entry['password'],
+				'quota_size' => byte_to_mbyte(($entry['quota'] == 0 ? -1 : $entry['quota'])),
+				'active' => yes_no(1),
+				'uid' => $uid,
+				'gid' => $gid,
+				'dir' => $document_root . (substr($document_root, -1) !== '/' ? '/' : ''),
+				'sys_groupid' => $sys_groupid
+				//'quota_files' => $entry[''],
+				//'ul_ratio' => $entry[''],
+				//'dl_ratio' => $entry[''],
+				//'ul_bandwidth' => $entry[''],
+				//'dl_bandwidth' => $entry['']
+			);
+			$new_id = false;
+			$old_ftp = $app->db->queryOneRecord("SELECT ftp_user_id, parent_domain_id FROM ftp_user WHERE username = '" . $entry['login'] ."'");
+			if($old_ftp) {
+				if($old_ftp['parent_domain_id'] != $domain_ids[$entry['dom_id']]) {
+					$msg .= "FTP Account conflicts with other domain!<br />";
+				} else {
+					$new_id = $old_ftp['ftp_user_id'];
+					$ok = $importer->sites_ftp_user_update($session_id, $client_id, $new_id, $params);
+					if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				}
+			} else {
+				$new_id = $importer->sites_ftp_user_add($session_id, $client_id, $params);
+			}
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "FTP " . $entry['id'] . " (" . $entry['login'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				$msg .= "Params: " . var_export($params, true) . "<br />";
+			} else {
+				$msg .= "FTP Account " . $entry['id'] . " (" . $entry['login'] . ") inserted.<br />";
+			}
+		}
+
+		$mail_config = $app->getconf->get_server_config($server_id, 'mail');
+
+		$mail_addresses = $exdb->queryAllRecords("SELECT m.id, m.mail_name, m.perm_id, m.postbox, m.account_id, m.redirect, m.redir_addr, m.mail_group, m.autoresponder, m.spamfilter, m.virusfilter, m.mbox_quota, m.dom_id, m.userId, a.password, a.type as `pwtype` FROM mail as m LEFT JOIN accounts as a ON (a.id = m.account_id) ");
+		$mail_ids = array();
+		foreach($mail_addresses as $entry) {
+
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
+			if(!$parent_domain) {
+				$msg .= "Could not insert/update mail address " . $entry['mail_name'] . " as domain is missing.<br />";
+				continue;
+			}
+
+			/* postbox true/false
              * mail_group true/false
              * spamfilter true/false
              */
-            
-            
-            $has_responder = false;
-            if($entry['autoresponder'] === 'true') {
-                $responder = $exdb->queryOneRecord("SELECT id, mn_id, resp_name, keystr, key_where, subject, reply_to, content_type, charset, text, resp_on, ans_freq, mem_limit FROM mail_resp WHERE mn_id = '" . $entry['id'] . "'");
-                if($responder) $has_responder = true;
-            }
-            
-            $maildir = str_replace("[domain]",$parent_domain["name"],$mail_config["maildir_path"]);
-			$maildir = str_replace("[localpart]",strtolower($entry["mail_name"]),$maildir);
-            
-            
-            $params = array(
-                            'server_id' => $server_id,
-                            'email' => $entry['mail_name'] . "@" . $parent_domain['name'],
-                            'login' => strtolower($entry['mail_name'] . "@" . $parent_domain['name']),
-                            'password' => $entry['password'],
-                            'name' => $entry[''],
-                            'quota' => ($entry['mbox_quota'] == -1 ? 0 : $entry['mbox_quota']), // in bytes!
-                            'cc' => $entry['redir_addr'],
-                            'maildir' => $maildir,
-                            'homedir' => $mail_config["homedir_path"],
-                            'uid' => $mail_config["mailuser_uid"],
-                            'gid' => $mail_config["mailuser_gid"],
-                            'postfix' => yes_no(1),
-                            'disableimap' => yes_no(0),
-                            'disablepop3' => yes_no(0),
-                            'autoresponder_subject' => ($has_responder ? $responder['subject'] : ''),
-                            'autoresponder_text' => ($has_responder ? $responder['text'] : ''),
-                            'autoresponder' => yes_no($has_responder ? 1 : 0),
-                            'autoresponder_start_date' => ($has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time()) : strftime('%Y-%m-%d', time() - (3600*24))),
-                            'autoresponder_end_date' => ($has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time() + (3600*24*365)) : strftime('%Y-%m-%d', time())),
-                            'move_junk' => yes_no(0)
-                            );
-            $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
-            
-            // if this is no postbox we do not need to create a mailuser
-            if($entry['postbox'] !== 'false') {
-                $old_mail = $app->db->queryOneRecord("SELECT mailuser_id FROM mail_user WHERE email = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'");
-                if($old_mail) {
-                    $new_id = $old_mail['mailuser_id'];
-                    $ok = $importer->mail_user_update($session_id, $client_id, $new_id, $params);
-                    if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                } else {
-                    $new_id = $importer->mail_user_add($session_id, $client_id, $params);
-                }
 
-                if($new_id === false) {
-                    //something went wrong here...
-                    $msg .= "Mail" . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />";
-                    $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                } else {
-                    $msg .= "Mail " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />";
-                }
-                $mail_ids[$entry['id']] = $new_id;
-            }
-            
-            // select all redirs for this address
-            $mail_redir = $exdb->queryAllRecords("SELECT id, mn_id, address FROM mail_redir WHERE mn_id = '" . $entry['id'] . "'");
-            foreach($mail_redir as $redir) {
-                $params = array(
-                                'server_id' => $server_id,
-                                'source' => $entry['mail_name'] . "@" . $parent_domain['name'],
-                                'destination' => $redir['address'],
-                                'type' => 'forward', // or forward
-                                'active' => yes_no(1)
-                                );
-                
-                $old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "' AND destination = '" . $redir['address'] . "'");
-                if($old_mail) {
-                    $new_id = $old_mail['forwarding_id'];
-                    $ok = $importer->mail_forward_update($session_id, $client_id, $new_id, $params);
-                    if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                } else {
-                    $new_id = $importer->mail_forward_add($session_id, $client_id, $params);
-                }
 
-                if($new_id === false) {
-                    //something went wrong here...
-                    $msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") could not be inserted/updated.<br />";
-                    $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                } else {
-                    $msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") inserted/updated.<br />";
-                }
-            }
-            unset($mail_redir);
-        }
-        unset($mail_addresses);
-        
-        $mail_aliases = $exdb->queryAllRecords("SELECT a.id, a.mn_id, a.alias, m.dom_id, m.mail_name FROM mail_aliases as a INNER JOIN mail as m ON (m.id = a.mn_id)");
-        foreach($mail_aliases as $entry) {
-            
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
-            if(!$parent_domain) {
-                $msg .= "Could not insert/update mail alias " . $entry['alias'] . " as domain is missing.<br />";
-                continue;
-            }
-            
-            $params = array(
-                            'server_id' => $server_id,
-                            'source' => $entry['alias'] . "@" . $parent_domain['name'],
-                            'destination' => $entry['mail_name'] . "@" . $parent_domain['name'],
-                            'type' => 'alias', // or forward
-                            'active' => yes_no(1)
-                            );
-            $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
-        
-            $old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['alias'] . "@" . $parent_domain['name'] . "' AND destination = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'");
-            if($old_mail) {
-                $new_id = $old_mail['forwarding_id'];
-                $ok = $importer->mail_alias_update($session_id, $client_id, $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->mail_alias_add($session_id, $client_id, $params);
-            }
-            
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />";
-            }
-        }
-        unset($mail_aliases);
-        
-        //spamfilter // preferences = true/false, username = email address, can be *@*
-        //id, username, preferences
-        
-        //spamfilter_preferences
-        //prefid, spamfilter_id, preference, value
-        
-        
-        
-        //$client_traffic = $exdb->queryAllRecords("SELECT t.cl_id, t.date, t.http_in, t.http_out, t.ftp_in, t.ftp_out, t.smtp_in, t.smtp_out, t.pop3_imap_in, t.pop3_imap_out FROM ClientsTraffic as t");
-        
-        $db_userids = array();
-        
-        $db_users  = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.db_id, a.password, a.type as `pwtype` FROM db_users as u LEFT JOIN accounts as a ON (a.id = u.account_id)");
-        foreach($db_users as $db_user) {
-            // database user
-            $params = array('server_id' => $server_id,
-                            'database_user' => $db_user['login'],
-                            'database_password' => $db_user['password']);
-            $check = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user` = \'' . $app->db->quote($db_user['login']) . '\'');
-            $db_user_id = 0;
-            if($check) {
-                $ok = $importer->sites_database_user_update($session_id, $client_id, $check['database_user_id'], array_merge($check, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                $db_user_id = $check['database_user_id'];
-            } else {
-                $db_user_id = $importer->sites_database_user_add($session_id, $client_id, $params);
-            }
-            
-            if(!isset($db_userids[$db_user['db_id']])) $db_userids[$db_user['db_id']] = $db_user_id;
-            $msg .= 'Created / updated database user: ' . $db_user['login'] . '<br />';
-        }
-            
-        $databases  = $exdb->queryAllRecords("SELECT d.id, d.name, d.type, d.dom_id, d.db_server_id, d.default_user_id FROM `data_bases` as d");
-        foreach($databases as $database) {
-            $params = array('server_id' => $server_id,
-                            'parent_domain_id' => $domain_ids[$database['dom_id']],
-                            'type' => 'mysql',
-                            'database_name' => $database['name'],
-                            'database_user_id' => $db_userids[$database['id']],
-                            'database_ro_user_id' => 0,
-                            'database_charset' => 'utf8',
-                            'remote_access' => 'n',
-                            'active' => 'y',
-                            'remote_ips' => '');
-            
-            $check = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_name` = \'' . $app->db->quote($database['name']) . '\'');
-            if($check) {
-                $ok = $importer->sites_database_update($session_id, $client_id, $check['database_id'], array_merge($check, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $importer->sites_database_add($session_id, $client_id, $params);
-            }
-            
-            $msg .= 'Created / updated database: ' . $database['name'] . '<br />';
-         }
-        
-        // do we need table disk_usage for import? i think we don't
-        
-        // name is domain name, displayName is including "Umlaute"
-        //$anon_ftp = $exdb->queryAllRecords("SELECT f.id, f.dom_id, f.max_conn, f.bandwidth, f.incoming, f.incoming_readable, f.incoming_subdirs, f.status, f.quota, f.display_login, f.login_text FROM anon_ftp as f");
-        
-        
-        //DomainServices
-        //id, dom_id, type, status, parameters_id, ipCollectionId
-        
-        //DomainsTraffic
-        //dom_id, date, http_in, http_out, ftp_in, ftp_out, smtp_in, smtp_out, pop3_imap_in, pop3_imap_out
-        
-        
-        //IP_Adresses
-        //id, ip_address, mask, iface, ssl_certificate_id, default_domain_id, ftps, main, status
-        
-        //ip_pool
-        //id, ip_address_id, type
+			$has_responder = false;
+			if($entry['autoresponder'] === 'true') {
+				$responder = $exdb->queryOneRecord("SELECT id, mn_id, resp_name, keystr, key_where, subject, reply_to, content_type, charset, text, resp_on, ans_freq, mem_limit FROM mail_resp WHERE mn_id = '" . $entry['id'] . "'");
+				if($responder) $has_responder = true;
+			}
 
-        /* TODO:
+			$maildir = str_replace("[domain]", $parent_domain["name"], $mail_config["maildir_path"]);
+			$maildir = str_replace("[localpart]", strtolower($entry["mail_name"]), $maildir);
+
+
+			$params = array(
+				'server_id' => $server_id,
+				'email' => $entry['mail_name'] . "@" . $parent_domain['name'],
+				'login' => strtolower($entry['mail_name'] . "@" . $parent_domain['name']),
+				'password' => $entry['password'],
+				'name' => $entry[''],
+				'quota' => ($entry['mbox_quota'] == -1 ? 0 : $entry['mbox_quota']), // in bytes!
+				'cc' => $entry['redir_addr'],
+				'maildir' => $maildir,
+				'homedir' => $mail_config["homedir_path"],
+				'uid' => $mail_config["mailuser_uid"],
+				'gid' => $mail_config["mailuser_gid"],
+				'postfix' => yes_no(1),
+				'disableimap' => yes_no(0),
+				'disablepop3' => yes_no(0),
+				'autoresponder_subject' => ($has_responder ? $responder['subject'] : ''),
+				'autoresponder_text' => ($has_responder ? $responder['text'] : ''),
+				'autoresponder' => yes_no($has_responder ? 1 : 0),
+				'autoresponder_start_date' => ($has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time()) : strftime('%Y-%m-%d', time() - (3600*24))),
+				'autoresponder_end_date' => ($has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time() + (3600*24*365)) : strftime('%Y-%m-%d', time())),
+				'move_junk' => yes_no(0)
+			);
+			$client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
+
+			// if this is no postbox we do not need to create a mailuser
+			if($entry['postbox'] !== 'false') {
+				$old_mail = $app->db->queryOneRecord("SELECT mailuser_id FROM mail_user WHERE email = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'");
+				if($old_mail) {
+					$new_id = $old_mail['mailuser_id'];
+					$ok = $importer->mail_user_update($session_id, $client_id, $new_id, $params);
+					if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				} else {
+					$new_id = $importer->mail_user_add($session_id, $client_id, $params);
+				}
+
+				if($new_id === false) {
+					//something went wrong here...
+					$msg .= "Mail" . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />";
+					$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				} else {
+					$msg .= "Mail " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />";
+				}
+				$mail_ids[$entry['id']] = $new_id;
+			}
+
+			// select all redirs for this address
+			$mail_redir = $exdb->queryAllRecords("SELECT id, mn_id, address FROM mail_redir WHERE mn_id = '" . $entry['id'] . "'");
+			foreach($mail_redir as $redir) {
+				$params = array(
+					'server_id' => $server_id,
+					'source' => $entry['mail_name'] . "@" . $parent_domain['name'],
+					'destination' => $redir['address'],
+					'type' => 'forward', // or forward
+					'active' => yes_no(1)
+				);
+
+				$old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "' AND destination = '" . $redir['address'] . "'");
+				if($old_mail) {
+					$new_id = $old_mail['forwarding_id'];
+					$ok = $importer->mail_forward_update($session_id, $client_id, $new_id, $params);
+					if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				} else {
+					$new_id = $importer->mail_forward_add($session_id, $client_id, $params);
+				}
+
+				if($new_id === false) {
+					//something went wrong here...
+					$msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") could not be inserted/updated.<br />";
+					$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				} else {
+					$msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") inserted/updated.<br />";
+				}
+			}
+			unset($mail_redir);
+		}
+		unset($mail_addresses);
+
+		$mail_aliases = $exdb->queryAllRecords("SELECT a.id, a.mn_id, a.alias, m.dom_id, m.mail_name FROM mail_aliases as a INNER JOIN mail as m ON (m.id = a.mn_id)");
+		foreach($mail_aliases as $entry) {
+
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
+			if(!$parent_domain) {
+				$msg .= "Could not insert/update mail alias " . $entry['alias'] . " as domain is missing.<br />";
+				continue;
+			}
+
+			$params = array(
+				'server_id' => $server_id,
+				'source' => $entry['alias'] . "@" . $parent_domain['name'],
+				'destination' => $entry['mail_name'] . "@" . $parent_domain['name'],
+				'type' => 'alias', // or forward
+				'active' => yes_no(1)
+			);
+			$client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
+
+			$old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['alias'] . "@" . $parent_domain['name'] . "' AND destination = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'");
+			if($old_mail) {
+				$new_id = $old_mail['forwarding_id'];
+				$ok = $importer->mail_alias_update($session_id, $client_id, $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->mail_alias_add($session_id, $client_id, $params);
+			}
+
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />";
+			}
+		}
+		unset($mail_aliases);
+
+		//spamfilter // preferences = true/false, username = email address, can be *@*
+		//id, username, preferences
+
+		//spamfilter_preferences
+		//prefid, spamfilter_id, preference, value
+
+
+
+		//$client_traffic = $exdb->queryAllRecords("SELECT t.cl_id, t.date, t.http_in, t.http_out, t.ftp_in, t.ftp_out, t.smtp_in, t.smtp_out, t.pop3_imap_in, t.pop3_imap_out FROM ClientsTraffic as t");
+
+		$db_userids = array();
+
+		$db_users  = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.db_id, a.password, a.type as `pwtype` FROM db_users as u LEFT JOIN accounts as a ON (a.id = u.account_id)");
+		foreach($db_users as $db_user) {
+			// database user
+			$params = array('server_id' => $server_id,
+				'database_user' => $db_user['login'],
+				'database_password' => $db_user['password']);
+			$check = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user` = \'' . $app->db->quote($db_user['login']) . '\'');
+			$db_user_id = 0;
+			if($check) {
+				$ok = $importer->sites_database_user_update($session_id, $client_id, $check['database_user_id'], array_merge($check, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				$db_user_id = $check['database_user_id'];
+			} else {
+				$db_user_id = $importer->sites_database_user_add($session_id, $client_id, $params);
+			}
+
+			if(!isset($db_userids[$db_user['db_id']])) $db_userids[$db_user['db_id']] = $db_user_id;
+			$msg .= 'Created / updated database user: ' . $db_user['login'] . '<br />';
+		}
+
+		$databases  = $exdb->queryAllRecords("SELECT d.id, d.name, d.type, d.dom_id, d.db_server_id, d.default_user_id FROM `data_bases` as d");
+		foreach($databases as $database) {
+			$params = array('server_id' => $server_id,
+				'parent_domain_id' => $domain_ids[$database['dom_id']],
+				'type' => 'mysql',
+				'database_name' => $database['name'],
+				'database_user_id' => $db_userids[$database['id']],
+				'database_ro_user_id' => 0,
+				'database_charset' => 'utf8',
+				'remote_access' => 'n',
+				'active' => 'y',
+				'remote_ips' => '');
+
+			$check = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_name` = \'' . $app->db->quote($database['name']) . '\'');
+			if($check) {
+				$ok = $importer->sites_database_update($session_id, $client_id, $check['database_id'], array_merge($check, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$importer->sites_database_add($session_id, $client_id, $params);
+			}
+
+			$msg .= 'Created / updated database: ' . $database['name'] . '<br />';
+		}
+
+		// do we need table disk_usage for import? i think we don't
+
+		// name is domain name, displayName is including "Umlaute"
+		//$anon_ftp = $exdb->queryAllRecords("SELECT f.id, f.dom_id, f.max_conn, f.bandwidth, f.incoming, f.incoming_readable, f.incoming_subdirs, f.status, f.quota, f.display_login, f.login_text FROM anon_ftp as f");
+
+
+		//DomainServices
+		//id, dom_id, type, status, parameters_id, ipCollectionId
+
+		//DomainsTraffic
+		//dom_id, date, http_in, http_out, ftp_in, ftp_out, smtp_in, smtp_out, pop3_imap_in, pop3_imap_out
+
+
+		//IP_Adresses
+		//id, ip_address, mask, iface, ssl_certificate_id, default_domain_id, ftps, main, status
+
+		//ip_pool
+		//id, ip_address_id, type
+
+		/* TODO:
                 */
-        //misc // needed? global settings
-        //param, val
-        
-        //Permissions
-        //id, permission, value
-        
-        //smb_users // pass is base64 encoded plaintext
-        //id, login, password, contactName, email, companyName, phone, fax, address, city, state, zip, country, creationDate, isBuiltIn, roleId, uuid, isLocked, authCookie, sessionId, externalId, ownerId, isDomainAdmin, additionalInfo, imNumber, imType, isLegacyUser
-        
-        /* TODO: 
+		//misc // needed? global settings
+		//param, val
+
+		//Permissions
+		//id, permission, value
+
+		//smb_users // pass is base64 encoded plaintext
+		//id, login, password, contactName, email, companyName, phone, fax, address, city, state, zip, country, creationDate, isBuiltIn, roleId, uuid, isLocked, authCookie, sessionId, externalId, ownerId, isDomainAdmin, additionalInfo, imNumber, imType, isLegacyUser
+
+		/* TODO:
         sys_users // mapped_to = parent_id
         id, login, account_id, home, shell, quota, mapped_to
-        
+
          */
 	} else {
-        $msg .= 'Connecting to external database failed!<br />';
-        $msg .= $exdb->connect_error;
-        $msg .= substr($exdb->errorMessage, 0, 25);
-	
+		$msg .= 'Connecting to external database failed!<br />';
+		$msg .= $exdb->connect_error;
+		$msg .= substr($exdb->errorMessage, 0, 25);
+
 		$error .= $exdb->errorMessage;
 	}
-	
+
 	//* restore db login details
 	/*$conf['db_host'] = $conf_bak['db_host'];
 	$conf['db_database'] = $conf_bak['db_database'];
 	$conf['db_user'] = $conf_bak['db_user'];
 	$conf['db_password'] = $conf_bak['db_password'];*/
-	
+
 }
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/index.php b/interface/web/tools/index.php
index b13718d..05c7f71 100644
--- a/interface/web/tools/index.php
+++ b/interface/web/tools/index.php
@@ -30,8 +30,8 @@
 
 global $app, $conf;
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('tools');
@@ -42,10 +42,10 @@
 $app->tpl->setInclude('content_tpl', 'templates/index.htm');
 
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_index.lng';
-include($lng_file);
+include $lng_file;
 
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/interface_settings.php b/interface/web/tools/interface_settings.php
index 0c17ac9..bc9c780 100644
--- a/interface/web/tools/interface_settings.php
+++ b/interface/web/tools/interface_settings.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('tools');
@@ -50,85 +50,86 @@
 
 class page_action extends tform_actions {
 	var $_theme_changed = false;
-    
+
 	function onLoad() {
-                global $app, $conf, $tform_def_file;
+		global $app, $conf, $tform_def_file;
 
-                // Loading template classes and initialize template
-                if(!is_object($app->tpl)) $app->uses('tpl');
-                if(!is_object($app->tform)) $app->uses('tform');
+		// Loading template classes and initialize template
+		if(!is_object($app->tpl)) $app->uses('tpl');
+		if(!is_object($app->tform)) $app->uses('tform');
 
-                $app->tpl->newTemplate("tabbed_form.tpl.htm");
+		$app->tpl->newTemplate("tabbed_form.tpl.htm");
 
-                // Load table definition from file
-                $app->tform->loadFormDef($tform_def_file);
-				
-				// Importing ID
-                $this->id = $_SESSION['s']['user']['userid'];
+		// Load table definition from file
+		$app->tform->loadFormDef($tform_def_file);
+
+		// Importing ID
+		$this->id = $_SESSION['s']['user']['userid'];
 		$_POST['id'] = $_SESSION['s']['user']['userid'];
 
-                if(count($_POST) > 1) {
-                        $this->dataRecord = $_POST;
-                        $this->onSubmit();
-                } else {
-                        $this->onShow();
-                }
-        }
-        
+		if(count($_POST) > 1) {
+			$this->dataRecord = $_POST;
+			$this->onSubmit();
+		} else {
+			$this->onShow();
+		}
+	}
+
 	function onBeforeInsert() {
 		global $app, $conf;
-		
-		if(!in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
+
+		if(!in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
 			$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
 		}
-        $this->updateSessionTheme();
+		$this->updateSessionTheme();
 	}
-        
+
 	function onInsert() {
 		die('No inserts allowed.');
 	}
-		
+
 	function onBeforeUpdate() {
 		global $app, $conf;
-		
+
 		if($conf['demo_mode'] == true && $this->id <= 3) $app->tform->errorMessage .= 'This function is disabled in demo mode.';
-		               
-                if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
+
+		if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
 			$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
 		}
-        $this->updateSessionTheme();
+		$this->updateSessionTheme();
 	}
-    
-    function updateSessionTheme() {
-        global $app, $conf;
-        
-        if($this->dataRecord['app_theme'] != 'default') {
-            $tmp_path = ISPC_THEMES_PATH."/".$this->dataRecord['app_theme'];
-            if(!@is_dir($tmp_path) || (@file_exists($tmp_path."/ispconfig_version") && trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION)) {
-                // fall back to default theme if this one is not compatible with current ispc version
-                $this->dataRecord['app_theme'] = 'default';
-            }
-        }
-        if($this->dataRecord['app_theme'] != $_SESSION['s']['user']['theme']) $this->_theme_changed = true;
-        $_SESSION['s']['theme'] = $this->dataRecord['app_theme'];
-        $_SESSION['s']['user']['theme'] = $_SESSION['s']['theme'];
-        $_SESSION['s']['user']['app_theme'] = $_SESSION['s']['theme'];
-    }
-	
-    function onAfterInsert() {
-        $this->onAfterUpdate();
-    }
-    function onAfterUpdate() {
-        if($this->_theme_changed == true) {
-            // not the best way, but it works
-            header('Content-Type: text/html');
-            print '<script type="text/javascript">document.location.reload();</script>';
-            exit;
-        }
-        else parent::onShow();
-    }
-    
-	
+
+	function updateSessionTheme() {
+		global $app, $conf;
+
+		if($this->dataRecord['app_theme'] != 'default') {
+			$tmp_path = ISPC_THEMES_PATH."/".$this->dataRecord['app_theme'];
+			if(!@is_dir($tmp_path) || (@file_exists($tmp_path."/ispconfig_version") && trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION)) {
+				// fall back to default theme if this one is not compatible with current ispc version
+				$this->dataRecord['app_theme'] = 'default';
+			}
+		}
+		if($this->dataRecord['app_theme'] != $_SESSION['s']['user']['theme']) $this->_theme_changed = true;
+		$_SESSION['s']['theme'] = $this->dataRecord['app_theme'];
+		$_SESSION['s']['user']['theme'] = $_SESSION['s']['theme'];
+		$_SESSION['s']['user']['app_theme'] = $_SESSION['s']['theme'];
+	}
+
+	function onAfterInsert() {
+		$this->onAfterUpdate();
+	}
+
+	function onAfterUpdate() {
+		if($this->_theme_changed == true) {
+			// not the best way, but it works
+			header('Content-Type: text/html');
+			print '<script type="text/javascript">document.location.reload();</script>';
+			exit;
+		}
+		else parent::onShow();
+	}
+
+
 }
 
 $page = new page_action;
diff --git a/interface/web/tools/lib/interface.d/tpl_default.menu.php b/interface/web/tools/lib/interface.d/tpl_default.menu.php
index f55b480..0a4f1d9 100644
--- a/interface/web/tools/lib/interface.d/tpl_default.menu.php
+++ b/interface/web/tools/lib/interface.d/tpl_default.menu.php
@@ -2,7 +2,7 @@
 
 // No settings yet
 //$items[] = array(   'title'     => 'Default Theme',
-//                    'target' 	=> 'content',
-//                    'link'	=> 'tools/tpl_default.php',
+//                    'target'  => 'content',
+//                    'link' => 'tools/tpl_default.php',
 //                    'html_id'   => 'tpl_default');
 ?>
diff --git a/interface/web/tools/lib/menu.d/import.menu.php b/interface/web/tools/lib/menu.d/import.menu.php
index 477c075..a41bb0b 100644
--- a/interface/web/tools/lib/menu.d/import.menu.php
+++ b/interface/web/tools/lib/menu.d/import.menu.php
@@ -5,27 +5,27 @@
 
 if($app->auth->is_admin()) {
 
-$items = array();
+	$items = array();
 
-$items[] = array( 'title' 	=> 'ISPConfig 3 mail',
-				  'target' 	=> 'content',
-				  'link'	=> 'tools/import_ispconfig.php');
+	$items[] = array( 'title'  => 'ISPConfig 3 mail',
+		'target'  => 'content',
+		'link' => 'tools/import_ispconfig.php');
 
-$items[] = array( 'title' 	=> 'PDNS Tupa',
-				  'target' 	=> 'content',
-				  'link'	=> 'tools/dns_import_tupa.php');
+	$items[] = array( 'title'  => 'PDNS Tupa',
+		'target'  => 'content',
+		'link' => 'tools/dns_import_tupa.php');
 
-/* not yet complete
+	/* not yet complete
 $items[] = array( 'title' 	=> 'Plesk',
 				  'target' 	=> 'content',
 				  'link'	=> 'tools/import_plesk.php');
 */
-				  
-$module['nav'][] = array(	'title'	=> 'Import',
-							'open' 	=> 1,
-							'items'	=> $items);
 
-unset($items);
+	$module['nav'][] = array( 'title' => 'Import',
+		'open'  => 1,
+		'items' => $items);
+
+	unset($items);
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/lib/menu.d/resync.menu.php b/interface/web/tools/lib/menu.d/resync.menu.php
index 3ef45fb..5de2f77 100644
--- a/interface/web/tools/lib/menu.d/resync.menu.php
+++ b/interface/web/tools/lib/menu.d/resync.menu.php
@@ -5,18 +5,18 @@
 
 if($app->auth->is_admin()) {
 
-$items = array();
+	$items = array();
 
-$items[] = array( 'title' 	=> 'Resync',
-				  'target' 	=> 'content',
-				  'link'	=> 'tools/resync.php');
+	$items[] = array( 'title'  => 'Resync',
+		'target'  => 'content',
+		'link' => 'tools/resync.php');
 
 
-$module['nav'][] = array(	'title'	=> 'Sync Tools',
-							'open' 	=> 1,
-							'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Sync Tools',
+		'open'  => 1,
+		'items' => $items);
 
-unset($items);
+	unset($items);
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/lib/menu.d/statistics.menu.php b/interface/web/tools/lib/menu.d/statistics.menu.php
index f4f9cb3..b84b8f0 100644
--- a/interface/web/tools/lib/menu.d/statistics.menu.php
+++ b/interface/web/tools/lib/menu.d/statistics.menu.php
@@ -18,4 +18,4 @@
 
 */
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/lib/module.conf.php b/interface/web/tools/lib/module.conf.php
index 274e6aa..853fd64 100644
--- a/interface/web/tools/lib/module.conf.php
+++ b/interface/web/tools/lib/module.conf.php
@@ -2,25 +2,25 @@
 
 global $conf;
 
-$module['name'] 	= 'tools';
-$module['title'] 	= 'top_menu_tools';
-$module['template'] 	= 'module.tpl.htm';
-$module['startpage'] 	= 'tools/index.php';
+$module['name']  = 'tools';
+$module['title']  = 'top_menu_tools';
+$module['template']  = 'module.tpl.htm';
+$module['startpage']  = 'tools/index.php';
 $module['tab_width']    = '60';
 
 
 //**** Change User password
 $items = array();
 
-$items[] = array(   'title' 	=> 'Password and Language',
-                    'target' 	=> 'content',
-                    'link'	=> 'tools/user_settings.php',
-                    'html_id'   => 'user_settings');
+$items[] = array(   'title'  => 'Password and Language',
+	'target'  => 'content',
+	'link' => 'tools/user_settings.php',
+	'html_id'   => 'user_settings');
 
 
 $module['nav'][] = array(   'title' => 'User Settings',
-                            'open'  => 1,
-                            'items' => $items);
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
@@ -28,18 +28,18 @@
 $items = array();
 
 $items[] = array(   'title'     => 'Interface',
-                    'target' 	=> 'content',
-                    'link'	=> 'tools/interface_settings.php',
-                    'html_id'   => 'interface_settings');
+	'target'  => 'content',
+	'link' => 'tools/interface_settings.php',
+	'html_id'   => 'interface_settings');
 
-if(file_exists(ISPC_WEB_PATH.'/tools/lib/interface.d/tpl_' . $_SESSION['s']['user']['app_theme'] . '.menu.php')) include_once(ISPC_WEB_PATH.'/tools/lib/interface.d/tpl_' . $_SESSION['s']['user']['app_theme'] . '.menu.php');
-				  
-$module['nav'][] = array(	'title'	=> 'Interface',
-                                'open' 	=> 1,
-                                'items'	=> $items);
+if(file_exists(ISPC_WEB_PATH.'/tools/lib/interface.d/tpl_' . $_SESSION['s']['user']['app_theme'] . '.menu.php')) include_once ISPC_WEB_PATH.'/tools/lib/interface.d/tpl_' . $_SESSION['s']['user']['app_theme'] . '.menu.php';
+
+$module['nav'][] = array( 'title' => 'Interface',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/resync.php b/interface/web/tools/resync.php
index 5f6bd88..a02ac9f 100644
--- a/interface/web/tools/resync.php
+++ b/interface/web/tools/resync.php
@@ -27,8 +27,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -45,7 +45,7 @@
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_resync.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 //* Resyncing websites
@@ -118,18 +118,18 @@
 	}
 }
 
-//* Resyncing Mailbox Domains 
-if(isset($_POST['resync_mailbox']) && $_POST['resync_mailbox'] == 1) { 
-    $db_table = 'mail_domain'; 
-    $index_field = 'domain_id'; 
-    $sql = "SELECT * FROM ".$db_table." WHERE active = 'y'"; 
-    $records = $app->db->queryAllRecords($sql); 
-    if(is_array($records)) { 
-        foreach($records as $rec) { 
-            $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true); 
-            $msg .= "Resynced Mail Domain: ".$rec['domain'].'<br />'; 
-        } 
-    } 
+//* Resyncing Mailbox Domains
+if(isset($_POST['resync_mailbox']) && $_POST['resync_mailbox'] == 1) {
+	$db_table = 'mail_domain';
+	$index_field = 'domain_id';
+	$sql = "SELECT * FROM ".$db_table." WHERE active = 'y'";
+	$records = $app->db->queryAllRecords($sql);
+	if(is_array($records)) {
+		foreach($records as $rec) {
+			$app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true);
+			$msg .= "Resynced Mail Domain: ".$rec['domain'].'<br />';
+		}
+	}
 }
 
 //* Resyncing Mailboxes
@@ -156,7 +156,7 @@
 				foreach($records as $rec) {
 					$new_serial = $app->validate_dns->increase_serial($rec["serial"]);
 					$app->db->datalogUpdate('dns_rr', "serial = '".$new_serial."'", 'id', $rec['id']);
-					
+
 				}
 			}
 			$new_serial = $app->validate_dns->increase_serial($zone["serial"]);
@@ -166,14 +166,14 @@
 	} else {
 		$error .= "No zones found to sync.<br />";
 	}
-	
+
 }
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/tpl_default.php b/interface/web/tools/tpl_default.php
index c5254c6..dacbeae 100644
--- a/interface/web/tools/tpl_default.php
+++ b/interface/web/tools/tpl_default.php
@@ -30,8 +30,8 @@
 
 global $app, $conf;
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('tools');
@@ -42,7 +42,7 @@
 $app->tpl->setInclude('content_tpl', 'templates/tpl_default.htm');
 
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_tpl_default.lng';
-include($lng_file);
+include $lng_file;
 
 $app->tpl->setVar($wb);
 
diff --git a/interface/web/tools/user_settings.php b/interface/web/tools/user_settings.php
index 70bbc69..42e5559 100644
--- a/interface/web/tools/user_settings.php
+++ b/interface/web/tools/user_settings.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('tools');
@@ -49,48 +49,48 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onLoad() {
-                global $app, $conf, $tform_def_file;
+		global $app, $conf, $tform_def_file;
 
-                // Loading template classes and initialize template
-                if(!is_object($app->tpl)) $app->uses('tpl');
-                if(!is_object($app->tform)) $app->uses('tform');
+		// Loading template classes and initialize template
+		if(!is_object($app->tpl)) $app->uses('tpl');
+		if(!is_object($app->tform)) $app->uses('tform');
 
-                $app->tpl->newTemplate("tabbed_form.tpl.htm");
+		$app->tpl->newTemplate("tabbed_form.tpl.htm");
 
-                // Load table definition from file
-                $app->tform->loadFormDef($tform_def_file);
-				
-				// Importing ID
-                $this->id = $_SESSION['s']['user']['userid'];
-				$_POST['id'] = $_SESSION['s']['user']['userid'];
+		// Load table definition from file
+		$app->tform->loadFormDef($tform_def_file);
 
-                if(count($_POST) > 1) {
-                        $this->dataRecord = $_POST;
-                        $this->onSubmit();
-                } else {
-                        $this->onShow();
-                }
-        }
-	
+		// Importing ID
+		$this->id = $_SESSION['s']['user']['userid'];
+		$_POST['id'] = $_SESSION['s']['user']['userid'];
+
+		if(count($_POST) > 1) {
+			$this->dataRecord = $_POST;
+			$this->onSubmit();
+		} else {
+			$this->onShow();
+		}
+	}
+
 	function onInsert() {
 		die('No inserts allowed.');
 	}
-		
+
 	function onBeforeUpdate() {
 		global $app, $conf;
-		
+
 		if($conf['demo_mode'] == true && $this->id <= 3) $app->tform->errorMessage .= 'This function is disabled in demo mode.';
-		
+
 		if($_POST['passwort'] != $_POST['repeat_password']) {
 			$app->tform->errorMessage = $app->tform->lng('password_mismatch');
 		}
 		$_SESSION['s']['user']['language'] = $_POST['language'];
 		$_SESSION['s']['language'] = $_POST['language'];
 	}
-	
-	
+
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/ajax_get_ip.php b/interface/web/vm/ajax_get_ip.php
index a7636f5..6440077 100644
--- a/interface/web/vm/ajax_get_ip.php
+++ b/interface/web/vm/ajax_get_ip.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -40,7 +40,7 @@
 
 	$sql = "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND server_id = $server_id";
 	$ips = $app->db->queryAllRecords($sql);
-		$ip_select = "";
+	$ip_select = "";
 	if(is_array($ips)) {
 		foreach( $ips as $ip) {
 			//$selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
@@ -50,6 +50,6 @@
 	unset($tmp);
 	unset($ips);
 }
-$ip_select = substr($ip_select,0,-1);
+$ip_select = substr($ip_select, 0, -1);
 echo $ip_select;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/form/openvz_ip.tform.php b/interface/web/vm/form/openvz_ip.tform.php
index ca958b3..181d641 100644
--- a/interface/web/vm/form/openvz_ip.tform.php
+++ b/interface/web/vm/form/openvz_ip.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Openvz IP address";
-$form["description"] 	= "";
-$form["name"] 			= "openvz_ip";
-$form["action"]			= "openvz_ip_edit.php";
-$form["db_table"]		= "openvz_ip";
-$form["db_table_idx"]	= "ip_address_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "main";
-$form["list_default"]	= "openvz_ip_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Openvz IP address";
+$form["description"]  = "";
+$form["name"]    = "openvz_ip";
+$form["action"]   = "openvz_ip_edit.php";
+$form["db_table"]  = "openvz_ip";
+$form["db_table_idx"] = "ip_address_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "main";
+$form["list_default"] = "openvz_ip_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,63 +56,63 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['main'] = array (
-	'title' 	=> "IP address",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_ip_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "IP address",
+	'width'  => 100,
+	'template'  => "templates/openvz_ip_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISIPV4',
-														'errmsg'=> 'ip_error_wrong'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'ip_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '15',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISIPV4',
+					'errmsg'=> 'ip_error_wrong'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'ip_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '15',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 1
 		),
 		'vm_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
-										'keyfield'=> 'vm_id',
-										'valuefield'=> 'hostname'
-									 ),
-			'value'		=> array(0 => '- Not assigned -')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
+				'keyfield'=> 'vm_id',
+				'valuefield'=> 'hostname'
+			),
+			'value'  => array(0 => '- Not assigned -')
 		),
 		'reserved' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/form/openvz_ostemplate.tform.php b/interface/web/vm/form/openvz_ostemplate.tform.php
index 0224ffa..07eeafe 100644
--- a/interface/web/vm/form/openvz_ostemplate.tform.php
+++ b/interface/web/vm/form/openvz_ostemplate.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Openvz OS-Template";
-$form["description"] 	= "";
-$form["name"] 			= "openvz_ostemplate";
-$form["action"]			= "openvz_ostemplate_edit.php";
-$form["db_table"]		= "openvz_ostemplate";
-$form["db_table_idx"]	= "ostemplate_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "main";
-$form["list_default"]	= "openvz_ostemplate_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Openvz OS-Template";
+$form["description"]  = "";
+$form["name"]    = "openvz_ostemplate";
+$form["action"]   = "openvz_ostemplate_edit.php";
+$form["db_table"]  = "openvz_ostemplate";
+$form["db_table_idx"] = "ostemplate_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "main";
+$form["list_default"] = "openvz_ostemplate_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,77 +56,77 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['main'] = array (
-	'title' 	=> "Template",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_ostemplate_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Template",
+	'width'  => 100,
+	'template'  => "templates/openvz_ostemplate_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_name_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'template_name_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'template_file' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_file_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'template_file_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'allservers' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30',
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30',
 			'searchable' => 2
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/form/openvz_template.tform.php b/interface/web/vm/form/openvz_template.tform.php
index 39cd3ae..ea49e3a 100644
--- a/interface/web/vm/form/openvz_template.tform.php
+++ b/interface/web/vm/form/openvz_template.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Openvz Template";
-$form["description"] 	= "";
-$form["name"] 			= "openvz_template";
-$form["action"]			= "openvz_template_edit.php";
-$form["db_table"]		= "openvz_template";
-$form["db_table_idx"]	= "template_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "main";
-$form["list_default"]	= "openvz_template_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Openvz Template";
+$form["description"]  = "";
+$form["name"]    = "openvz_template";
+$form["action"]   = "openvz_template_edit.php";
+$form["db_table"]  = "openvz_template";
+$form["db_table_idx"] = "template_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "main";
+$form["list_default"] = "openvz_template_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,414 +56,414 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['main'] = array (
-	'title' 	=> "Template",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_template_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Template",
+	'width'  => 100,
+	'template'  => "templates/openvz_template_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_name_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'template_name_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'diskspace' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'diskspace_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'diskspace_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'ram' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ram_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ram_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'ram_burst' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ram_burst_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ram_burst_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'cpu_units' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_units_error_empty'),
-									),
-			'default'	=> '1000',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'cpu_units_error_empty'),
+			),
+			'default' => '1000',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'cpu_num' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_num_error_empty'),
-									),
-			'default'	=> '4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'cpu_num_error_empty'),
+			),
+			'default' => '4',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'cpu_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_limit_error_empty'),
-									),
-			'default'	=> '400',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'cpu_limit_error_empty'),
+			),
+			'default' => '400',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'io_priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'io_priority_error_empty'),
-									),
-			'default'	=> '4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'io_priority_error_empty'),
+			),
+			'default' => '4',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'hostname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'create_dns' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'nameserver' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_nameserver_error_empty'),
-									),
-			'default'	=> '8.8.8.8 8.8.4.4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'template_nameserver_error_empty'),
+			),
+			'default' => '8.8.8.8 8.8.4.4',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['advanced'] = array (
-	'title' 	=> "Advanced",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_template_advanced_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Advanced",
+	'width'  => 100,
+	'template'  => "templates/openvz_template_advanced_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'numproc' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numproc_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numproc_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numtcpsock' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numtcpsock_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numtcpsock_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numothersock' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numothersock_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numothersock_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'vmguarpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'vmguarpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'vmguarpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'kmemsize' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'kmemsize_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'kmemsize_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'tcpsndbuf' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'tcpsndbuf_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'tcpsndbuf_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'tcprcvbuf' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'tcprcvbuf_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'tcprcvbuf_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'othersockbuf' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'othersockbuf_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'othersockbuf_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'dgramrcvbuf' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'dgramrcvbuf_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'dgramrcvbuf_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'oomguarpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'oomguarpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'oomguarpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'privvmpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'privvmpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'privvmpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'lockedpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'lockedpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'lockedpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'shmpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'shmpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'shmpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'physpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'physpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'physpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numfile' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numfile_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numfile_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'avnumproc' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'avnumproc_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'avnumproc_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numflock' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numflock_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numflock_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numpty' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numpty_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numpty_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numsiginfo' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numsiginfo_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numsiginfo_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'dcachesize' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'dcachesize_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'dcachesize_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numiptent' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numiptent_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numiptent_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'swappages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'swappages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'swappages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'capability' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/form/openvz_vm.tform.php b/interface/web/vm/form/openvz_vm.tform.php
index efd9c84..759ba2f 100644
--- a/interface/web/vm/form/openvz_vm.tform.php
+++ b/interface/web/vm/form/openvz_vm.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Openvz virtual server";
-$form["description"] 	= "";
-$form["name"] 			= "openvz_vm";
-$form["action"]			= "openvz_vm_edit.php";
-$form["db_table"]		= "openvz_vm";
-$form["db_table_idx"]	= "vm_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "main";
-$form["list_default"]	= "openvz_vm_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Openvz virtual server";
+$form["description"]  = "";
+$form["name"]    = "openvz_vm";
+$form["action"]   = "openvz_vm_edit.php";
+$form["db_table"]  = "openvz_vm";
+$form["db_table_idx"] = "vm_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "main";
+$form["list_default"] = "openvz_vm_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -56,39 +56,39 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['main'] = array (
-	'title' 	=> "Virtual server",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_vm_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Virtual server",
+	'width'  => 100,
+	'template'  => "templates/openvz_vm_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'ostemplate_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE 1 ORDER BY template_name',
-										'keyfield'=> 'ostemplate_id',
-										'valuefield'=> 'template_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE 1 ORDER BY template_name',
+				'keyfield'=> 'ostemplate_id',
+				'valuefield'=> 'template_name'
+			),
+			'value'  => ''
 		),
 		'template_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*
 			'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
@@ -96,15 +96,15 @@
 										'valuefield'=> 'template_name'
 									 ),
 			*/
-			'value'		=> ''
+			'value'  => ''
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ip_address_error_empty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ip_address_error_empty'),
+			),
+			'default' => '',
 			/*
 			'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND (vm_id = 0 or vm_id = '{RECORDID}') ORDER BY ip_address",
@@ -112,206 +112,206 @@
 										'valuefield'=> 'ip_address'
 									 ),
 			*/
-			'value'		=> ''
+			'value'  => ''
 		),
 		'hostname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'hostname_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'hostname_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'vm_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'vm_password_error_empty'),
-									),
-			'default'	=> $app->auth->get_random_password(10),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'vm_password_error_empty'),
+			),
+			'default' => $app->auth->get_random_password(10),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'start_boot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active_until_date' => array (
-			'datatype'	=> 'DATE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'DATE',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30',
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30',
 			'searchable' => 2
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Advanced",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_vm_advanced_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'veid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'veid_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'veid_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'create_dns' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-		'diskspace' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'diskspace_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ram' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ram_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ram_burst' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ram_burst_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'cpu_units' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_units_error_empty'),
-									),
-			'default'	=> '1000',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'cpu_num' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_num_error_empty'),
-									),
-			'default'	=> '4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'cpu_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_limit_error_empty'),
-									),
-			'default'	=> '400',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'io_priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'io_priority_error_empty'),
-									),
-			'default'	=> '4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'nameserver' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_nameserver_error_empty'),
-									),
-			'default'	=> '8.8.8.8 8.8.4.4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'capability' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Advanced",
+		'width'  => 100,
+		'template'  => "templates/openvz_vm_advanced_edit.htm",
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'veid' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'veid_error_empty'),
+					1 => array ( 'type' => 'UNIQUE',
+						'errmsg'=> 'veid_error_unique'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'create_dns' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default' => 'y',
+				'value'  => array(0 => 'n', 1 => 'y')
+			),
+			'diskspace' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'diskspace_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ram' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'ram_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ram_burst' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'ram_burst_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'cpu_units' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'cpu_units_error_empty'),
+				),
+				'default' => '1000',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'cpu_num' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'cpu_num_error_empty'),
+				),
+				'default' => '4',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'cpu_limit' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'cpu_limit_error_empty'),
+				),
+				'default' => '400',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'io_priority' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'io_priority_error_empty'),
+				),
+				'default' => '4',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'nameserver' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'template_nameserver_error_empty'),
+				),
+				'default' => '8.8.8.8 8.8.4.4',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'capability' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/lib/admin.conf.php b/interface/web/vm/lib/admin.conf.php
index 67c94a5..acb6c35 100644
--- a/interface/web/vm/lib/admin.conf.php
+++ b/interface/web/vm/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/lib/module.conf.php b/interface/web/vm/lib/module.conf.php
index 6d0ffec..a7e31bb 100644
--- a/interface/web/vm/lib/module.conf.php
+++ b/interface/web/vm/lib/module.conf.php
@@ -1,40 +1,40 @@
 <?php
 
-$module['name'] 		= 'vm';
-$module['title'] 		= 'top_menu_vm';
-$module['template'] 	= 'module.tpl.htm';
-$module['startpage'] 	= 'vm/openvz_vm_list.php';
+$module['name']   = 'vm';
+$module['title']   = 'top_menu_vm';
+$module['template']  = 'module.tpl.htm';
+$module['startpage']  = 'vm/openvz_vm_list.php';
 $module['tab_width']    = '';
 
 //**** Templates menu
 $items = array();
 
-$items[] = array( 'title' 	=> 'Virtual Servers',
-				  'target' 	=> 'content',
-				  'link'	=> 'vm/openvz_vm_list.php',
-				  'html_id' => 'openvz_vm_list');
+$items[] = array( 'title'  => 'Virtual Servers',
+	'target'  => 'content',
+	'link' => 'vm/openvz_vm_list.php',
+	'html_id' => 'openvz_vm_list');
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
-$items[] = array( 'title' 	=> 'OS Templates',
-				  'target' 	=> 'content',
-				  'link'	=> 'vm/openvz_ostemplate_list.php',
-				  'html_id' => 'openvz_ostemplate_list');
+	$items[] = array( 'title'  => 'OS Templates',
+		'target'  => 'content',
+		'link' => 'vm/openvz_ostemplate_list.php',
+		'html_id' => 'openvz_ostemplate_list');
 
-$items[] = array( 'title' 	=> 'VM Templates',
-				  'target' 	=> 'content',
-				  'link'	=> 'vm/openvz_template_list.php',
-				  'html_id' => 'openvz_template_list');
-				  
-$items[] = array( 'title' 	=> 'IP addresses',
-				  'target' 	=> 'content',
-				  'link'	=> 'vm/openvz_ip_list.php',
-				  'html_id' => 'openvz_ip_list');
+	$items[] = array( 'title'  => 'VM Templates',
+		'target'  => 'content',
+		'link' => 'vm/openvz_template_list.php',
+		'html_id' => 'openvz_template_list');
+
+	$items[] = array( 'title'  => 'IP addresses',
+		'target'  => 'content',
+		'link' => 'vm/openvz_ip_list.php',
+		'html_id' => 'openvz_ip_list');
 }
 if(count($items))
 {
-	$module['nav'][] = array(	'title'	=> 'OpenVZ',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'OpenVZ',
+		'open'  => 1,
+		'items' => $items);
 }
 
 
@@ -51,7 +51,7 @@
 				  'target' 	=> 'content',
 				  'link'	=> 'vm/traffic_stats.php',
 				  'html_id' => 'vm_traffic_stats');
-				  
+
 if(count($items))
 {
 	$module['nav'][] = array(	'title'	=> 'Statistics',
@@ -65,4 +65,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/lib/remote.conf.php b/interface/web/vm/lib/remote.conf.php
index f92f80b..77222bf 100644
--- a/interface/web/vm/lib/remote.conf.php
+++ b/interface/web/vm/lib/remote.conf.php
@@ -2,4 +2,4 @@
 
 $function_list['vm_openvz'] = 'OpenVZ VM functions';
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/list/openvz_ip.list.php b/interface/web/vm/list/openvz_ip.list.php
index 09a21fa..313c6f0 100644
--- a/interface/web/vm/list/openvz_ip.list.php
+++ b/interface/web/vm/list/openvz_ip.list.php
@@ -13,88 +13,88 @@
 
 
 // Name of the list
-$liste["name"] 				= "openvz_ip";
+$liste["name"]     = "openvz_ip";
 
 // Database table
-$liste["table"] 			= "openvz_ip";
+$liste["table"]    = "openvz_ip";
 
 // Index index field of the database table
-$liste["table_idx"]			= "ip_address_id";
+$liste["table_idx"]   = "ip_address_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "openvz_ip_list.php";
+$liste["file"]    = "openvz_ip_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "openvz_ip_edit.php";
+$liste["edit_file"]   = "openvz_ip_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "openvz_ip_del.php";
+$liste["delete_file"]  = "openvz_ip_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "vm_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
-										'keyfield'=> 'vm_id',
-										'valuefield'=> 'hostname'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "ip_address",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "vm_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
+		'keyfield'=> 'vm_id',
+		'valuefield'=> 'hostname'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "reserved",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "ip_address",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "reserved",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
- 
 
 
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/web/vm/list/openvz_ostemplate.list.php b/interface/web/vm/list/openvz_ostemplate.list.php
index 3b3dc2c..19d2afe 100644
--- a/interface/web/vm/list/openvz_ostemplate.list.php
+++ b/interface/web/vm/list/openvz_ostemplate.list.php
@@ -13,91 +13,91 @@
 
 
 // Name of the list
-$liste["name"] 				= "openvz_ostemplate";
+$liste["name"]     = "openvz_ostemplate";
 
 // Database table
-$liste["table"] 			= "openvz_ostemplate";
+$liste["table"]    = "openvz_ostemplate";
 
 // Index index field of the database table
-$liste["table_idx"]			= "ostemplate_id";
+$liste["table_idx"]   = "ostemplate_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "openvz_ostemplate_list.php";
+$liste["file"]    = "openvz_ostemplate_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "openvz_ostemplate_edit.php";
+$liste["edit_file"]   = "openvz_ostemplate_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "openvz_ostemplate_del.php";
+$liste["delete_file"]  = "openvz_ostemplate_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste["item"][] = array(	'field'		=> "ostemplate_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "ostemplate_id",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "template_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> ""); 
+$liste["item"][] = array( 'field'  => "template_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "allservers",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "allservers",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/list/openvz_template.list.php b/interface/web/vm/list/openvz_template.list.php
index 48d13ed..6ba7faf 100644
--- a/interface/web/vm/list/openvz_template.list.php
+++ b/interface/web/vm/list/openvz_template.list.php
@@ -13,58 +13,58 @@
 
 
 // Name of the list
-$liste["name"] 				= "openvz_template";
+$liste["name"]     = "openvz_template";
 
 // Database table
-$liste["table"] 			= "openvz_template";
+$liste["table"]    = "openvz_template";
 
 // Index index field of the database table
-$liste["table_idx"]			= "template_id";
+$liste["table_idx"]   = "template_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "openvz_template_list.php";
+$liste["file"]    = "openvz_template_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "openvz_template_edit.php";
+$liste["edit_file"]   = "openvz_template_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "openvz_template_del.php";
+$liste["delete_file"]  = "openvz_template_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "template_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> ""); 
+$liste["item"][] = array( 'field'  => "template_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/list/openvz_vm.list.php b/interface/web/vm/list/openvz_vm.list.php
index 81a7c8e..ce42f93 100644
--- a/interface/web/vm/list/openvz_vm.list.php
+++ b/interface/web/vm/list/openvz_vm.list.php
@@ -13,120 +13,120 @@
 
 
 // Name of the list
-$liste["name"] 				= "openvz_vm";
+$liste["name"]     = "openvz_vm";
 
 // Database table
-$liste["table"] 			= "openvz_vm";
+$liste["table"]    = "openvz_vm";
 
 // Index index field of the database table
-$liste["table_idx"]			= "vm_id";
+$liste["table_idx"]   = "vm_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "openvz_vm_list.php";
+$liste["file"]    = "openvz_vm_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "openvz_vm_edit.php";
+$liste["edit_file"]   = "openvz_vm_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "openvz_vm_del.php";
+$liste["delete_file"]  = "openvz_vm_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste["item"][] = array(	'field'		=> "veid",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "veid",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "ostemplate_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE {AUTHSQL} ORDER BY template_name',
-										'keyfield'=> 'ostemplate_id',
-										'valuefield'=> 'template_name'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "template_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE {AUTHSQL} ORDER BY template_name',
-										'keyfield'=> 'template_id',
-										'valuefield'=> 'template_name'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "hostname",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "ip_address",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "ostemplate_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE {AUTHSQL} ORDER BY template_name',
+		'keyfield'=> 'ostemplate_id',
+		'valuefield'=> 'template_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "template_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE {AUTHSQL} ORDER BY template_name',
+		'keyfield'=> 'template_id',
+		'valuefield'=> 'template_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "hostname",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "ip_address",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_action.php b/interface/web/vm/openvz_action.php
index b62ca33..31c23ac 100644
--- a/interface/web/vm/openvz_action.php
+++ b/interface/web/vm/openvz_action.php
@@ -4,8 +4,8 @@
 All rights reserved.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -26,110 +26,110 @@
 
 $app->tpl->newTemplate('form.tpl.htm');
 $app->tpl->setInclude('content_tpl', 'templates/openvz_action.htm');
-	
-//* load language file 
-$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_openvz_action.lng';
-include_once($lng_file);
-$app->tpl->setVar($wb);
-	
-$app->tpl->setVar('id',$vm_id);
-$app->tpl->setVar('veid',$veid);
 
-$options = array('start_option_enabled'=>'','stop_option_enabled'=>'','restart_option_enabled'=>'','ostemplate_option_enabled'=>'');
+//* load language file
+$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_openvz_action.lng';
+include_once $lng_file;
+$app->tpl->setVar($wb);
+
+$app->tpl->setVar('id', $vm_id);
+$app->tpl->setVar('veid', $veid);
+
+$options = array('start_option_enabled'=>'', 'stop_option_enabled'=>'', 'restart_option_enabled'=>'', 'ostemplate_option_enabled'=>'');
 
 
 //* Show the action select page
 if($action == 'show') {
 
-$options['start_option_enabled'] = 'checked="checked"';
-	
+	$options['start_option_enabled'] = 'checked="checked"';
+
 } elseif ($action == 'start') {
-	
+
 	//* Start the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_start_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_start_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['start_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['start_exec_txt']);
 	$options['start_option_enabled'] = 'checked="checked"';
-	
+
 } elseif ($action == 'stop') {
-	
+
 	//* Stop the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_stop_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_stop_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['stop_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['stop_exec_txt']);
 	$options['stop_option_enabled'] = 'checked="checked"';
 
 } elseif ($action == 'restart') {
-	
+
 	//* Restart the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_restart_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_restart_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['restart_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['restart_exec_txt']);
 	$options['restart_option_enabled'] = 'checked="checked"';
 
 } elseif ($action == 'ostemplate') {
-	
+
 	$ostemplate_name = $_POST['ostemplate_name'];
-	
+
 	if(!preg_match("/^[a-zA-Z0-9\.\-\_]{1,50}$/i", $ostemplate_name)) {
 		$error_msg .= $wb['ostemplate_name_error'].'<br />';
-		$app->tpl->setVar('ostemplate_name',$ostemplate_name);
+		$app->tpl->setVar('ostemplate_name', $ostemplate_name);
 	}
-	
+
 	//* Quote name
 	$ostemplate_name = $app->db->quote($ostemplate_name);
-	
+
 	//* Check for duplicates
 	$tmp = $app->db->queryOneRecord("SELECT count(ostemplate_id) as number FROM openvz_ostemplate WHERE template_file = '$ostemplate_name'");
 	if($tmp['number'] > 0) $error_msg .= $wb['ostemplate_name_unique_error'].'<br />';
 	unset($tmp);
-	
+
 	if($error_msg == '') {
 		//* Create ostemplate action
 		$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-				"VALUES (".
-				(int)$server_id . ", ".
-				time() . ", ".
-				"'openvz_create_ostpl', ".
-				"'".$veid.":".$ostemplate_name."', ".
-				"'pending', ".
-				"''".
-				")";
+			"VALUES (".
+			(int)$server_id . ", ".
+			time() . ", ".
+			"'openvz_create_ostpl', ".
+			"'".$veid.":".$ostemplate_name."', ".
+			"'pending', ".
+			"''".
+			")";
 		$app->db->query($sql);
-		
+
 		//* Create a record in the openvz_ostemplate table
-		$sql = "INSERT INTO `openvz_ostemplate` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) 
+		$sql = "INSERT INTO `openvz_ostemplate` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`)
 		VALUES(1, 1, 'riud', 'riud', '', '$ostemplate_name', '$ostemplate_name', $server_id, 'n', 'y', '')";
 		$app->db->query($sql);
-		
-		$app->tpl->setVar('msg',$wb['ostemplate_exec_txt']);
+
+		$app->tpl->setVar('msg', $wb['ostemplate_exec_txt']);
 		$options['ostemplate_option_enabled'] = 'checked="checked"';
 	}
 
@@ -139,11 +139,11 @@
 }
 
 $app->tpl->setVar($options);
-$app->tpl->setVar('error',$error_msg);
+$app->tpl->setVar('error', $error_msg);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_ip_del.php b/interface/web/vm/openvz_ip_del.php
index bd97041..47d5d9a 100644
--- a/interface/web/vm/openvz_ip_del.php
+++ b/interface/web/vm/openvz_ip_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,7 +50,7 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/openvz_ip_edit.php b/interface/web/vm/openvz_ip_edit.php
index 8fbd0f2..20912ee 100644
--- a/interface/web/vm/openvz_ip_edit.php
+++ b/interface/web/vm/openvz_ip_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,10 +50,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_ip_list.php b/interface/web/vm/openvz_ip_list.php
index 804d60f..229a792 100644
--- a/interface/web/vm/openvz_ip_list.php
+++ b/interface/web/vm/openvz_ip_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_ostemplate_del.php b/interface/web/vm/openvz_ostemplate_del.php
index cc54dbd..4674657 100644
--- a/interface/web/vm/openvz_ostemplate_del.php
+++ b/interface/web/vm/openvz_ostemplate_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,7 +50,7 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/openvz_ostemplate_edit.php b/interface/web/vm/openvz_ostemplate_edit.php
index 697ab4c..e19083e 100644
--- a/interface/web/vm/openvz_ostemplate_edit.php
+++ b/interface/web/vm/openvz_ostemplate_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,10 +50,10 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_ostemplate_list.php b/interface/web/vm/openvz_ostemplate_list.php
index 00d2ee4..fbce99b 100644
--- a/interface/web/vm/openvz_ostemplate_list.php
+++ b/interface/web/vm/openvz_ostemplate_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_template_del.php b/interface/web/vm/openvz_template_del.php
index 09584e3..cc5c132 100644
--- a/interface/web/vm/openvz_template_del.php
+++ b/interface/web/vm/openvz_template_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,7 +50,7 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/openvz_template_edit.php b/interface/web/vm/openvz_template_edit.php
index c074002..73d004e 100644
--- a/interface/web/vm/openvz_template_edit.php
+++ b/interface/web/vm/openvz_template_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,28 +50,28 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onAfterInsert() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$guar_ram = $this->dataRecord['ram']*256;
 		$burst_ram = $this->dataRecord['ram_burst']*256;
 		$sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id";
 		$app->db->query($sql);
 	}
-	
+
 	function onAfterUpdate() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$guar_ram = $this->dataRecord['ram']*256;
 		$burst_ram = $this->dataRecord['ram_burst']*256;
 		$sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id";
 		$app->db->query($sql);
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_template_list.php b/interface/web/vm/openvz_template_list.php
index 15bd907..49d01fe 100644
--- a/interface/web/vm/openvz_template_list.php
+++ b/interface/web/vm/openvz_template_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_vm_del.php b/interface/web/vm/openvz_vm_del.php
index c8d8e19..bd9a9d4 100644
--- a/interface/web/vm/openvz_vm_del.php
+++ b/interface/web/vm/openvz_vm_del.php
@@ -39,8 +39,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -49,7 +49,7 @@
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/openvz_vm_edit.php b/interface/web/vm/openvz_vm_edit.php
index 83d530d..c9ba892 100644
--- a/interface/web/vm/openvz_vm_edit.php
+++ b/interface/web/vm/openvz_vm_edit.php
@@ -38,8 +38,8 @@
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -52,7 +52,7 @@
 
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_openvz_vm')) {
@@ -62,20 +62,20 @@
 				$app->error('Reseller: '.$app->tform->wordbook["limit_openvz_vm_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
 
 		//* Client: If the logged in user is not admin and has no sub clients (no rseller)
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-			
+
 			//* Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.limit_openvz_vm_template_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			//* Fill the template_id field
 			if($client['limit_openvz_vm_template_id'] == 0) {
 				$sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name';
@@ -89,16 +89,16 @@
 					$template_id_select .= "<option value='$rec[template_id]' $selected>$rec[template_name]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("template_id_select",$template_id_select);
-			
+			$app->tpl->setVar("template_id_select", $template_id_select);
+
 			//* Reseller: If the logged in user is not admin and has sub clients (is a rseller)
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-			
+
 			//* Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.limit_openvz_vm_template_id, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
-			
+
+
 			//* Fill the client select field
 			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
 			$records = $app->db->queryAllRecords($sql);
@@ -111,8 +111,8 @@
 					$client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-			
+			$app->tpl->setVar("client_group_id", $client_select);
+
 			//* Fill the template_id field
 			if($client['limit_openvz_vm_template_id'] == 0) {
 				$sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name';
@@ -126,7 +126,7 @@
 					$template_id_select .= "<option value='$rec[template_id]' $selected>$rec[template_name]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("template_id_select",$template_id_select);
+			$app->tpl->setVar("template_id_select", $template_id_select);
 
 			//* Admin: If the logged in user is admin
 		} else {
@@ -142,8 +142,8 @@
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-			
+			$app->tpl->setVar("client_group_id", $client_select);
+
 			//* Fill the template_id field
 			$sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name';
 			$records = $app->db->queryAllRecords($sql);
@@ -154,10 +154,10 @@
 					$template_id_select .= "<option value='$rec[template_id]' $selected>$rec[template_name]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("template_id_select",$template_id_select);
+			$app->tpl->setVar("template_id_select", $template_id_select);
 
 		}
-		
+
 		//* Fill the IPv4 select field with the IP addresses that are allowed for this client
 		//$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".$client['default_webserver']." AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
 		if(isset($this->dataRecord["server_id"])) {
@@ -175,10 +175,10 @@
 				$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("ip_address",$ip_select);
+		$app->tpl->setVar("ip_address", $ip_select);
 		unset($tmp);
 		unset($ips);
-		
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -192,8 +192,8 @@
 		$date_format = $app->lng('conf_format_dateshort');
 		$trans = array("d" => "dd", "m" => "mm", "Y" => "yy");
 		$date_format = strtr($date_format, $trans);
-		$app->tpl->setVar("date_format", $date_format);		
-		
+		$app->tpl->setVar("date_format", $date_format);
+
 		$app->tpl->setVar("daynamesmin_su", $app->lng('daynamesmin_su'));
 		$app->tpl->setVar("daynamesmin_mo", $app->lng('daynamesmin_mo'));
 		$app->tpl->setVar("daynamesmin_tu", $app->lng('daynamesmin_tu'));
@@ -201,7 +201,7 @@
 		$app->tpl->setVar("daynamesmin_th", $app->lng('daynamesmin_th'));
 		$app->tpl->setVar("daynamesmin_fr", $app->lng('daynamesmin_fr'));
 		$app->tpl->setVar("daynamesmin_sa", $app->lng('daynamesmin_sa'));
-		
+
 		$app->tpl->setVar("daynames_sunday", $app->lng('daynames_sunday'));
 		$app->tpl->setVar("daynames_monday", $app->lng('daynames_monday'));
 		$app->tpl->setVar("daynames_tuesday", $app->lng('daynames_tuesday'));
@@ -209,7 +209,7 @@
 		$app->tpl->setVar("daynames_thursday", $app->lng('daynames_thursday'));
 		$app->tpl->setVar("daynames_friday", $app->lng('daynames_friday'));
 		$app->tpl->setVar("daynames_saturday", $app->lng('daynames_saturday'));
-		
+
 		$app->tpl->setVar("monthnamesshort_jan", $app->lng('monthnamesshort_jan'));
 		$app->tpl->setVar("monthnamesshort_feb", $app->lng('monthnamesshort_feb'));
 		$app->tpl->setVar("monthnamesshort_mar", $app->lng('monthnamesshort_mar'));
@@ -221,11 +221,11 @@
 		$app->tpl->setVar("monthnamesshort_sep", $app->lng('monthnamesshort_sep'));
 		$app->tpl->setVar("monthnamesshort_oct", $app->lng('monthnamesshort_oct'));
 		$app->tpl->setVar("monthnamesshort_nov", $app->lng('monthnamesshort_nov'));
-		$app->tpl->setVar("monthnamesshort_dec", $app->lng('monthnamesshort_dec'));		
-		
+		$app->tpl->setVar("monthnamesshort_dec", $app->lng('monthnamesshort_dec'));
+
 		$app->tpl->setVar("datepicker_nextText", $app->lng('datepicker_nextText'));
 		$app->tpl->setVar("datepicker_prevText", $app->lng('datepicker_prevText'));
-		
+
 		parent::onShowEnd();
 	}
 
@@ -243,4 +243,4 @@
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_vm_list.php b/interface/web/vm/openvz_vm_list.php
index 02d1651..c1ea907 100644
--- a/interface/web/vm/openvz_vm_list.php
+++ b/interface/web/vm/openvz_vm_list.php
@@ -28,8 +28,8 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -51,4 +51,4 @@
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/remoting_client/examples/client_add.php b/remoting_client/examples/client_add.php
index 95faffd..6d5b593 100644
--- a/remoting_client/examples/client_add.php
+++ b/remoting_client/examples/client_add.php
@@ -1,94 +1,94 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$reseller_id = 0; // this id has to be 0 if the client shall not be assigned to admin or if the client is a reseller
 	$params = array(
-			'company_name' => 'awesomecompany',
-			'contact_name' => 'name',
-			'customer_no' => '1',
-			'vat_id' => '1',
-			'street' => 'fleetstreet',
-			'zip' => '21337',
-			'city' => 'london',
-			'state' => 'bavaria',
-			'country' => 'GB',
-			'telephone' => '123456789',
-			'mobile' => '987654321',
-			'fax' => '546718293',
-			'email' => 'e@mail.int',
-			'internet' => '',
-			'icq' => '111111111',
-			'notes' => 'awesome',
-			'default_mailserver' => 1,
-			'limit_maildomain' => -1,
-			'limit_mailbox' => -1,
-			'limit_mailalias' => -1,
-			'limit_mailaliasdomain' => -1,
-			'limit_mailforward' => -1,
-			'limit_mailcatchall' => -1,
-			'limit_mailrouting' => 0,
-			'limit_mailfilter' => -1,
-			'limit_fetchmail' => -1,
-			'limit_mailquota' => -1,
-			'limit_spamfilter_wblist' => 0,
-			'limit_spamfilter_user' => 0,
-			'limit_spamfilter_policy' => 1,
-			'default_webserver' => 1,
-			'limit_web_ip' => '',
-			'limit_web_domain' => -1,
-			'limit_web_quota' => -1,
-			'web_php_options' => 'no,fast-cgi,cgi,mod,suphp',
-			'limit_web_subdomain' => -1,
-			'limit_web_aliasdomain' => -1,
-			'limit_ftp_user' => -1,
-			'limit_shell_user' => 0,
-			'ssh_chroot' => 'no,jailkit,ssh-chroot',
-			'limit_webdav_user' => 0,
-			'default_dnsserver' => 1,
-			'limit_dns_zone' => -1,
-			'limit_dns_slave_zone' => -1,
-			'limit_dns_record' => -1,
-			'default_dbserver' => 1,
-			'limit_database' => -1,
-			'limit_cron' => 0,
-			'limit_cron_type' => 'url',
-			'limit_cron_frequency' => 5,
-			'limit_traffic_quota' => -1,
-			'limit_client' => 0, // If this value is > 0, then the client is a reseller
-			'parent_client_id' => 0,
-			'username' => 'guy3',
-			'password' => 'brush',
-			'language' => 'en',
-			'usertheme' => 'default',
-			'template_master' => 0,
-			'template_additional' => '',
-			'created_at' => 0
-			);
-	
+		'company_name' => 'awesomecompany',
+		'contact_name' => 'name',
+		'customer_no' => '1',
+		'vat_id' => '1',
+		'street' => 'fleetstreet',
+		'zip' => '21337',
+		'city' => 'london',
+		'state' => 'bavaria',
+		'country' => 'GB',
+		'telephone' => '123456789',
+		'mobile' => '987654321',
+		'fax' => '546718293',
+		'email' => 'e@mail.int',
+		'internet' => '',
+		'icq' => '111111111',
+		'notes' => 'awesome',
+		'default_mailserver' => 1,
+		'limit_maildomain' => -1,
+		'limit_mailbox' => -1,
+		'limit_mailalias' => -1,
+		'limit_mailaliasdomain' => -1,
+		'limit_mailforward' => -1,
+		'limit_mailcatchall' => -1,
+		'limit_mailrouting' => 0,
+		'limit_mailfilter' => -1,
+		'limit_fetchmail' => -1,
+		'limit_mailquota' => -1,
+		'limit_spamfilter_wblist' => 0,
+		'limit_spamfilter_user' => 0,
+		'limit_spamfilter_policy' => 1,
+		'default_webserver' => 1,
+		'limit_web_ip' => '',
+		'limit_web_domain' => -1,
+		'limit_web_quota' => -1,
+		'web_php_options' => 'no,fast-cgi,cgi,mod,suphp',
+		'limit_web_subdomain' => -1,
+		'limit_web_aliasdomain' => -1,
+		'limit_ftp_user' => -1,
+		'limit_shell_user' => 0,
+		'ssh_chroot' => 'no,jailkit,ssh-chroot',
+		'limit_webdav_user' => 0,
+		'default_dnsserver' => 1,
+		'limit_dns_zone' => -1,
+		'limit_dns_slave_zone' => -1,
+		'limit_dns_record' => -1,
+		'default_dbserver' => 1,
+		'limit_database' => -1,
+		'limit_cron' => 0,
+		'limit_cron_type' => 'url',
+		'limit_cron_frequency' => 5,
+		'limit_traffic_quota' => -1,
+		'limit_client' => 0, // If this value is > 0, then the client is a reseller
+		'parent_client_id' => 0,
+		'username' => 'guy3',
+		'password' => 'brush',
+		'language' => 'en',
+		'usertheme' => 'default',
+		'template_master' => 0,
+		'template_additional' => '',
+		'created_at' => 0
+	);
+
 	$affected_rows = $client->client_add($session_id, $reseller_id, $params);
-	
+
 	echo "Client: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_change_password.php b/remoting_client/examples/client_change_password.php
index 157423b..5e20b11 100644
--- a/remoting_client/examples/client_change_password.php
+++ b/remoting_client/examples/client_change_password.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain = 'test.int';
-	
+
 	$record_record = $client->mail_domain_get_by_domain($session_id, $domain);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_delete.php b/remoting_client/examples/client_delete.php
index 367c751..2cf7e36 100644
--- a/remoting_client/examples/client_delete.php
+++ b/remoting_client/examples/client_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->client_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_delete_everything.php b/remoting_client/examples/client_delete_everything.php
index 4399f5e..d723b01 100644
--- a/remoting_client/examples/client_delete_everything.php
+++ b/remoting_client/examples/client_delete_everything.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -23,12 +23,12 @@
 
 	//echo "Client ".$client_id." has been deleted.<br>";
 	//print_r($affected_rows);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_get.php b/remoting_client/examples/client_get.php
index 095fd95..9863829 100644
--- a/remoting_client/examples/client_get.php
+++ b/remoting_client/examples/client_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$var_client_id = 1;
-	
+
 	$client_record = $client->client_get($session_id, $var_client_id);
 
 	print_r($client_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_get_by_username.php b/remoting_client/examples/client_get_by_username.php
index 93c516d..a55902d 100644
--- a/remoting_client/examples/client_get_by_username.php
+++ b/remoting_client/examples/client_get_by_username.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$username = 'guy3';
-	
+
 	$record_record = $client->client_get_by_username($session_id, $username);
 
 	print_r($record_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_get_id.php b/remoting_client/examples/client_get_id.php
index e19edde..d0e481e 100644
--- a/remoting_client/examples/client_get_id.php
+++ b/remoting_client/examples/client_get_id.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$sys_userid = 5;
-	
+
 	$client_record = $client->client_get_id($session_id, $sys_userid);
 
 	print_r($client_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_get_sites_by_user.php b/remoting_client/examples/client_get_sites_by_user.php
index ebebc55..673f530 100644
--- a/remoting_client/examples/client_get_sites_by_user.php
+++ b/remoting_client/examples/client_get_sites_by_user.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$sys_userid = 1;
 	$sys_groupid = 1;
-	
+
 	$record_record = $client->client_get_sites_by_user($session_id, $sys_userid, $sys_groupid);
 
 	print_r($record_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_templates_get_all.php b/remoting_client/examples/client_templates_get_all.php
index 003e1c7..c386852 100644
--- a/remoting_client/examples/client_templates_get_all.php
+++ b/remoting_client/examples/client_templates_get_all.php
@@ -1,30 +1,30 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
-	
+
 	$record_record = $client->client_templates_get_all($session_id);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_update.php b/remoting_client/examples/client_update.php
index e884378..15c31fc 100644
--- a/remoting_client/examples/client_update.php
+++ b/remoting_client/examples/client_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -26,19 +26,19 @@
 	$client_record['country'] = 'de';
 	$client_record['username'] = 'mguy';
 	$client_record['contact_name'] = 'brush';
-	
+
 	//* We set the client password to a empty string as we do not want to change it.
 	$client_record['password'] = '';
-	
+
 	$affected_rows = $client->client_update($session_id, $c_id, $reseller_id, $client_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_a_add.php b/remoting_client/examples/dns_a_add.php
index 9ab1288..6bcb33c 100644
--- a/remoting_client/examples/dns_a_add.php
+++ b/remoting_client/examples/dns_a_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 5,
-			'name' => 'a',
-			'type' => 'a',
-			'data' => '192.168.1.88',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 5,
+		'name' => 'a',
+		'type' => 'a',
+		'data' => '192.168.1.88',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_a_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_a_delete.php b/remoting_client/examples/dns_a_delete.php
index c092097..3c7092c 100644
--- a/remoting_client/examples/dns_a_delete.php
+++ b/remoting_client/examples/dns_a_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_a_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_a_get.php b/remoting_client/examples/dns_a_get.php
index d3e296a..7012602 100644
--- a/remoting_client/examples/dns_a_get.php
+++ b/remoting_client/examples/dns_a_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 3;
-	
+
 	$dns_record = $client->dns_a_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_a_update.php b/remoting_client/examples/dns_a_update.php
index f543b40..3a765df 100644
--- a/remoting_client/examples/dns_a_update.php
+++ b/remoting_client/examples/dns_a_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_a_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_aaaa_add.php b/remoting_client/examples/dns_aaaa_add.php
index bcd640b..4ee460b 100644
--- a/remoting_client/examples/dns_aaaa_add.php
+++ b/remoting_client/examples/dns_aaaa_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 1,
-			'name' => 'aaaa',
-			'type' => 'aaaa',
-			'data' => '3ffe:b00:c18:3::a',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 1,
+		'name' => 'aaaa',
+		'type' => 'aaaa',
+		'data' => '3ffe:b00:c18:3::a',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_aaaa_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_aaaa_delete.php b/remoting_client/examples/dns_aaaa_delete.php
index 0021b20..bcce023 100644
--- a/remoting_client/examples/dns_aaaa_delete.php
+++ b/remoting_client/examples/dns_aaaa_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_aaaa_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_aaaa_get.php b/remoting_client/examples/dns_aaaa_get.php
index d151054..dc1a473 100644
--- a/remoting_client/examples/dns_aaaa_get.php
+++ b/remoting_client/examples/dns_aaaa_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 1;
-	
+
 	$dns_record = $client->dns_aaaa_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_aaaa_update.php b/remoting_client/examples/dns_aaaa_update.php
index e0d7194..85e2235 100644
--- a/remoting_client/examples/dns_aaaa_update.php
+++ b/remoting_client/examples/dns_aaaa_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_aaaa_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_alias_add.php b/remoting_client/examples/dns_alias_add.php
index 5b81662..5b1c684 100644
--- a/remoting_client/examples/dns_alias_add.php
+++ b/remoting_client/examples/dns_alias_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 4,
-			'name' => 'alias',
-			'type' => 'alias',
-			'data' => 'hostmachine',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 4,
+		'name' => 'alias',
+		'type' => 'alias',
+		'data' => 'hostmachine',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_alias_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_alias_delete.php b/remoting_client/examples/dns_alias_delete.php
index 68c7667..36bb1db 100644
--- a/remoting_client/examples/dns_alias_delete.php
+++ b/remoting_client/examples/dns_alias_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_alias_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_alias_get.php b/remoting_client/examples/dns_alias_get.php
index d80a124..8bff518 100644
--- a/remoting_client/examples/dns_alias_get.php
+++ b/remoting_client/examples/dns_alias_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 4;
-	
+
 	$dns_record = $client->dns_alias_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_alias_update.php b/remoting_client/examples/dns_alias_update.php
index 8c9873b..179cc12 100644
--- a/remoting_client/examples/dns_alias_update.php
+++ b/remoting_client/examples/dns_alias_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_alias_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_cname_add.php b/remoting_client/examples/dns_cname_add.php
index 4c6a61f..2d70ca6 100644
--- a/remoting_client/examples/dns_cname_add.php
+++ b/remoting_client/examples/dns_cname_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 3,
-			'name' => 'cname',
-			'type' => 'cname',
-			'data' => 'hostmachine',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 3,
+		'name' => 'cname',
+		'type' => 'cname',
+		'data' => 'hostmachine',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_cname_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_cname_delete.php b/remoting_client/examples/dns_cname_delete.php
index 493e71c..0234243 100644
--- a/remoting_client/examples/dns_cname_delete.php
+++ b/remoting_client/examples/dns_cname_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_cname_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_cname_get.php b/remoting_client/examples/dns_cname_get.php
index 8ea6af1..ca0d300 100644
--- a/remoting_client/examples/dns_cname_get.php
+++ b/remoting_client/examples/dns_cname_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 5;
-	
+
 	$dns_record = $client->dns_cname_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_cname_update.php b/remoting_client/examples/dns_cname_update.php
index b689168..c7d659b 100644
--- a/remoting_client/examples/dns_cname_update.php
+++ b/remoting_client/examples/dns_cname_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_cname_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_hinfo_add.php b/remoting_client/examples/dns_hinfo_add.php
index 2c49d1e..a0a8c47 100644
--- a/remoting_client/examples/dns_hinfo_add.php
+++ b/remoting_client/examples/dns_hinfo_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 2,
-			'name' => 'info',
-			'type' => 'hinfo',
-			'data' => '"Pentium Pro" Linux',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 2,
+		'name' => 'info',
+		'type' => 'hinfo',
+		'data' => '"Pentium Pro" Linux',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_hinfo_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_hinfo_delete.php b/remoting_client/examples/dns_hinfo_delete.php
index c2fc7eb..721db1e 100644
--- a/remoting_client/examples/dns_hinfo_delete.php
+++ b/remoting_client/examples/dns_hinfo_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_hinfo_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_hinfo_get.php b/remoting_client/examples/dns_hinfo_get.php
index 23c8a4a..685893c 100644
--- a/remoting_client/examples/dns_hinfo_get.php
+++ b/remoting_client/examples/dns_hinfo_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 6;
-	
+
 	$dns_record = $client->dns_hinfo_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_hinfo_update.php b/remoting_client/examples/dns_hinfo_update.php
index b35c732..02867a6 100644
--- a/remoting_client/examples/dns_hinfo_update.php
+++ b/remoting_client/examples/dns_hinfo_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_hinfo_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_mx_add.php b/remoting_client/examples/dns_mx_add.php
index 878be47..b1e9617 100644
--- a/remoting_client/examples/dns_mx_add.php
+++ b/remoting_client/examples/dns_mx_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 6,
-			'name' => 'mailexchanger',
-			'type' => 'mx',
-			'data' => 'mail',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 6,
+		'name' => 'mailexchanger',
+		'type' => 'mx',
+		'data' => 'mail',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_mx_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_mx_delete.php b/remoting_client/examples/dns_mx_delete.php
index 857b90c..0fce772 100644
--- a/remoting_client/examples/dns_mx_delete.php
+++ b/remoting_client/examples/dns_mx_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_mx_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_mx_get.php b/remoting_client/examples/dns_mx_get.php
index 112141e..ddb1304 100644
--- a/remoting_client/examples/dns_mx_get.php
+++ b/remoting_client/examples/dns_mx_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 7;
-	
+
 	$dns_record = $client->dns_mx_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_mx_update.php b/remoting_client/examples/dns_mx_update.php
index c51221a..e5a5df7 100644
--- a/remoting_client/examples/dns_mx_update.php
+++ b/remoting_client/examples/dns_mx_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_mx_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ns_add.php b/remoting_client/examples/dns_ns_add.php
index 2dd7efd..d650d2a 100644
--- a/remoting_client/examples/dns_ns_add.php
+++ b/remoting_client/examples/dns_ns_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 7,
-			'name' => 'nameserver',
-			'type' => 'ns',
-			'data' => 'ns1',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 7,
+		'name' => 'nameserver',
+		'type' => 'ns',
+		'data' => 'ns1',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_ns_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ns_delete.php b/remoting_client/examples/dns_ns_delete.php
index e50ff7c..add17c8 100644
--- a/remoting_client/examples/dns_ns_delete.php
+++ b/remoting_client/examples/dns_ns_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_ns_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ns_get.php b/remoting_client/examples/dns_ns_get.php
index 28fcf38..e9178a7 100644
--- a/remoting_client/examples/dns_ns_get.php
+++ b/remoting_client/examples/dns_ns_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 8;
-	
+
 	$dns_record = $client->dns_ns_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ns_update.php b/remoting_client/examples/dns_ns_update.php
index 92fdb93..418a1a3 100644
--- a/remoting_client/examples/dns_ns_update.php
+++ b/remoting_client/examples/dns_ns_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_ns_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ptr_add.php b/remoting_client/examples/dns_ptr_add.php
index 55ed112..6d4ccab 100644
--- a/remoting_client/examples/dns_ptr_add.php
+++ b/remoting_client/examples/dns_ptr_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 8,
-			'name' => 'pointer',
-			'type' => 'ptr',
-			'data' => 'webmaster.test.int.',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 8,
+		'name' => 'pointer',
+		'type' => 'ptr',
+		'data' => 'webmaster.test.int.',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_ptr_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ptr_delete.php b/remoting_client/examples/dns_ptr_delete.php
index ced2684..c2ab3b9 100644
--- a/remoting_client/examples/dns_ptr_delete.php
+++ b/remoting_client/examples/dns_ptr_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_ptr_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ptr_get.php b/remoting_client/examples/dns_ptr_get.php
index 1332a30..b3cd58f 100644
--- a/remoting_client/examples/dns_ptr_get.php
+++ b/remoting_client/examples/dns_ptr_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 9;
-	
+
 	$dns_record = $client->dns_ptr_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ptr_update.php b/remoting_client/examples/dns_ptr_update.php
index a2b360a..8e2ffd7 100644
--- a/remoting_client/examples/dns_ptr_update.php
+++ b/remoting_client/examples/dns_ptr_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_ptr_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rp_add.php b/remoting_client/examples/dns_rp_add.php
index ac04cf7..a30b703 100644
--- a/remoting_client/examples/dns_rp_add.php
+++ b/remoting_client/examples/dns_rp_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 9,
-			'name' => 'responsibleperson',
-			'type' => 'rp',
-			'data' => 'webmaster.test.int. contactinfo.test.int',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 9,
+		'name' => 'responsibleperson',
+		'type' => 'rp',
+		'data' => 'webmaster.test.int. contactinfo.test.int',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_rp_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rp_delete.php b/remoting_client/examples/dns_rp_delete.php
index 3edcb7b..29bbccf 100644
--- a/remoting_client/examples/dns_rp_delete.php
+++ b/remoting_client/examples/dns_rp_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_rp_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rp_get.php b/remoting_client/examples/dns_rp_get.php
index 3f57593..296bd00 100644
--- a/remoting_client/examples/dns_rp_get.php
+++ b/remoting_client/examples/dns_rp_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 10;
-	
+
 	$dns_record = $client->dns_rp_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rp_update.php b/remoting_client/examples/dns_rp_update.php
index 7cc587d..308831d 100644
--- a/remoting_client/examples/dns_rp_update.php
+++ b/remoting_client/examples/dns_rp_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_rp_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rr_get_all_by_zone.php b/remoting_client/examples/dns_rr_get_all_by_zone.php
index 284bad4..1e790b7 100644
--- a/remoting_client/examples/dns_rr_get_all_by_zone.php
+++ b/remoting_client/examples/dns_rr_get_all_by_zone.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$zone_id = 3;
-	
+
 	$record_record = $client->dns_rr_get_all_by_zone($session_id, $zone_id);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_srv_add.php b/remoting_client/examples/dns_srv_add.php
index 9f021ac..75c7df4 100644
--- a/remoting_client/examples/dns_srv_add.php
+++ b/remoting_client/examples/dns_srv_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 10,
-			'name' => 'server',
-			'type' => 'srv',
-			'data' => '0 9 server.test.int.',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 10,
+		'name' => 'server',
+		'type' => 'srv',
+		'data' => '0 9 server.test.int.',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_srv_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_srv_delete.php b/remoting_client/examples/dns_srv_delete.php
index 6bd7661..c380ee8 100644
--- a/remoting_client/examples/dns_srv_delete.php
+++ b/remoting_client/examples/dns_srv_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->dns_srv_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_srv_get.php b/remoting_client/examples/dns_srv_get.php
index eb771a3..2db7281 100644
--- a/remoting_client/examples/dns_srv_get.php
+++ b/remoting_client/examples/dns_srv_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 11;
-	
+
 	$dns_record = $client->dns_srv_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_srv_update.php b/remoting_client/examples/dns_srv_update.php
index 569651c..74968f3 100644
--- a/remoting_client/examples/dns_srv_update.php
+++ b/remoting_client/examples/dns_srv_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_srv_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_txt_add.php b/remoting_client/examples/dns_txt_add.php
index d760d57..4ce025e 100644
--- a/remoting_client/examples/dns_txt_add.php
+++ b/remoting_client/examples/dns_txt_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 11,
-			'name' => 'stringtext',
-			'type' => 'txt',
-			'data' => 'any text can go here',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 11,
+		'name' => 'stringtext',
+		'type' => 'txt',
+		'data' => 'any text can go here',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_txt_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_txt_delete.php b/remoting_client/examples/dns_txt_delete.php
index 862c801..3724d1c 100644
--- a/remoting_client/examples/dns_txt_delete.php
+++ b/remoting_client/examples/dns_txt_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->dns_txt_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_txt_get.php b/remoting_client/examples/dns_txt_get.php
index 9c515f7..93e11ff 100644
--- a/remoting_client/examples/dns_txt_get.php
+++ b/remoting_client/examples/dns_txt_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 12;
-	
+
 	$dns_record = $client->dns_txt_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_txt_update.php b/remoting_client/examples/dns_txt_update.php
index d6466e9..34a8d35 100644
--- a/remoting_client/examples/dns_txt_update.php
+++ b/remoting_client/examples/dns_txt_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_txt_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_add.php b/remoting_client/examples/dns_zone_add.php
index 1634808..6772409 100644
--- a/remoting_client/examples/dns_zone_add.php
+++ b/remoting_client/examples/dns_zone_add.php
@@ -1,47 +1,47 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 2;
 	$params = array(
-			'server_id' => 1,
-			'origin' => 'test.intt.',
-			'ns' => 'one',
-			'mbox' => 'zonemaster.test.tld.',
-			'serial' => '1',
-			'refresh' => '28800',
-			'retry' => '7200',
-			'expire' => '604800',
-			'minimum' => '86400',
-			'ttl' => '86400',
-			'active' => 'y',
-			'xfer' => '',
-			'also_notify' => '',
-			'update_acl' => '',
-			);
-	
+		'server_id' => 1,
+		'origin' => 'test.intt.',
+		'ns' => 'one',
+		'mbox' => 'zonemaster.test.tld.',
+		'serial' => '1',
+		'refresh' => '28800',
+		'retry' => '7200',
+		'expire' => '604800',
+		'minimum' => '86400',
+		'ttl' => '86400',
+		'active' => 'y',
+		'xfer' => '',
+		'also_notify' => '',
+		'update_acl' => '',
+	);
+
 	$id = $client->dns_zone_add($session_id, $client_id, $params);
 
 	echo "DNS ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_delete.php b/remoting_client/examples/dns_zone_delete.php
index 2bfc9c4..c3e0c9a 100644
--- a/remoting_client/examples/dns_zone_delete.php
+++ b/remoting_client/examples/dns_zone_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->dns_zone_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_get.php b/remoting_client/examples/dns_zone_get.php
index 4ac8f17..f4f1f46 100644
--- a/remoting_client/examples/dns_zone_get.php
+++ b/remoting_client/examples/dns_zone_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 1;
-	
+
 	$dns_record = $client->dns_zone_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_get_by_user.php b/remoting_client/examples/dns_zone_get_by_user.php
index 38d70a2..15db9ee 100644
--- a/remoting_client/examples/dns_zone_get_by_user.php
+++ b/remoting_client/examples/dns_zone_get_by_user.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 2;
 	$server_id = 1;
-	
+
 	$record_record = $client->dns_zone_get_by_user($session_id, $client_id, $server_id);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_set_status.php b/remoting_client/examples/dns_zone_set_status.php
index e1b46c7..36a6310 100644
--- a/remoting_client/examples/dns_zone_set_status.php
+++ b/remoting_client/examples/dns_zone_set_status.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$primary_id = 3;
 	$status = 'inactive';
-	
+
 	$record_record = $client->dns_zone_set_status($session_id, $primary_id, $status);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_update.php b/remoting_client/examples/dns_zone_update.php
index 4b8e7c2..908c7b1 100644
--- a/remoting_client/examples/dns_zone_update.php
+++ b/remoting_client/examples/dns_zone_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_zone_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/domains_domain_add.php b/remoting_client/examples/domains_domain_add.php
index 30f2341..d6e3ba3 100644
--- a/remoting_client/examples/domains_domain_add.php
+++ b/remoting_client/examples/domains_domain_add.php
@@ -1,34 +1,34 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'domain' => 'cellar.door'
-			);
-	
+		'domain' => 'cellar.door'
+	);
+
 	$domain_id = $client->domains_domain_add($session_id, $client_id, $params);
 
 	echo "Domain ID: ".$domain_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/domains_domain_delete.php b/remoting_client/examples/domains_domain_delete.php
index 8582783..7db844d 100644
--- a/remoting_client/examples/domains_domain_delete.php
+++ b/remoting_client/examples/domains_domain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->domains_domain_delete($session_id, $domain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/domains_domain_get.php b/remoting_client/examples/domains_domain_get.php
index e8fcd65..81020fc 100644
--- a/remoting_client/examples/domains_domain_get.php
+++ b/remoting_client/examples/domains_domain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain_id = 1;
-	
+
 	$domain_record = $client->domains_domain_get($session_id, $domain_id);
 
 	print_r($domain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/domains_get_all_by_user.php b/remoting_client/examples/domains_get_all_by_user.php
index 647741b..ae3fdfb 100644
--- a/remoting_client/examples/domains_get_all_by_user.php
+++ b/remoting_client/examples/domains_get_all_by_user.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$group_id = 0;
-	
+
 	$record_record = $client->domains_get_all_by_user($session_id, $group_id);
 
 	print_r($record_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/get_function_list.php b/remoting_client/examples/get_function_list.php
index b4b3cbe..4a08c3c 100644
--- a/remoting_client/examples/get_function_list.php
+++ b/remoting_client/examples/get_function_list.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
-	
+
 	$record_record = $client->get_function_list($session_id);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/login.php b/remoting_client/examples/login.php
index 21b735d..085c8f2 100644
--- a/remoting_client/examples/login.php
+++ b/remoting_client/examples/login.php
@@ -1,21 +1,21 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	$session_id = $client->login($username,$password);
-		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
-		echo "Logging out: ";
+	$session_id = $client->login($username, $password);
+	echo 'Logged successfull. Session ID:'.$session_id.'<br />';
+	echo "Logging out: ";
 	$client->logout($session_id);
-		echo "Logged out.";
-		
+	echo "Logged out.";
+
 
 }catch (SoapFault $e) {
 	echo $client->__getLastResponse();
diff --git a/remoting_client/examples/logout.php b/remoting_client/examples/logout.php
index 8c7c5c1..c19b3f5 100644
--- a/remoting_client/examples/logout.php
+++ b/remoting_client/examples/logout.php
@@ -1,19 +1,19 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$session = $session_id;
 	echo "Logging out: ";
@@ -21,8 +21,8 @@
 
 	//Logged out
 	echo "Logged out.";
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_alias_add.php b/remoting_client/examples/mail_alias_add.php
index 38dbc65..5969e8a 100644
--- a/remoting_client/examples/mail_alias_add.php
+++ b/remoting_client/examples/mail_alias_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => 'hallo@test.int',
-			'destination' => 'ciao@test.int',
-			'type' => 'alias',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => 'hallo@test.int',
+		'destination' => 'ciao@test.int',
+		'type' => 'alias',
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_alias_add($session_id, $client_id, $params);
 
 	echo "Alias ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_alias_delete.php b/remoting_client/examples/mail_alias_delete.php
index 61c7ba2..ca883eb 100644
--- a/remoting_client/examples/mail_alias_delete.php
+++ b/remoting_client/examples/mail_alias_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->mail_alias_delete($session_id, $alias_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_alias_get.php b/remoting_client/examples/mail_alias_get.php
index 778dc90..5760b21 100644
--- a/remoting_client/examples/mail_alias_get.php
+++ b/remoting_client/examples/mail_alias_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$alias_id = 1;
-	
+
 	$mail_alias_record = $client->mail_alias_get($session_id, $alias_id);
 
 	print_r($mail_alias_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_alias_update.php b/remoting_client/examples/mail_alias_update.php
index 3d00d94..85165c0 100644
--- a/remoting_client/examples/mail_alias_update.php
+++ b/remoting_client/examples/mail_alias_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_alias_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_alias_update($session_id, $client_id, $alias_id, $mail_alias_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_blacklist_add.php b/remoting_client/examples/mail_blacklist_add.php
index 70dcf78..6ff8992 100644
--- a/remoting_client/examples/mail_blacklist_add.php
+++ b/remoting_client/examples/mail_blacklist_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => 'hmmnoeoe@test.int',
-			'access' => 'REJECT',
-			'type' => 'sender',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => 'hmmnoeoe@test.int',
+		'access' => 'REJECT',
+		'type' => 'sender',
+		'active' => 'y'
+	);
+
 	$blacklist_id = $client->mail_blacklist_add($session_id, $client_id, $params);
 
 	echo "Blacklist ID: ".$blacklist_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_blacklist_delete.php b/remoting_client/examples/mail_blacklist_delete.php
index 90e7d47..ce871c6 100644
--- a/remoting_client/examples/mail_blacklist_delete.php
+++ b/remoting_client/examples/mail_blacklist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->mail_blacklist_delete($session_id, $blacklist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_blacklist_get.php b/remoting_client/examples/mail_blacklist_get.php
index 7e28a20..383fad4 100644
--- a/remoting_client/examples/mail_blacklist_get.php
+++ b/remoting_client/examples/mail_blacklist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$blacklist_id = 7;
-	
+
 	$mail_blacklist_record = $client->mail_blacklist_get($session_id, $blacklist_id);
 
 	print_r($mail_blacklist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_blacklist_update.php b/remoting_client/examples/mail_blacklist_update.php
index 27778ed..4428857 100644
--- a/remoting_client/examples/mail_blacklist_update.php
+++ b/remoting_client/examples/mail_blacklist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_blacklist_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_blacklist_update($session_id, $client_id, $blacklist_id, $mail_blacklist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_catchall_add.php b/remoting_client/examples/mail_catchall_add.php
index 8b5d6f3..a3f57d2 100644
--- a/remoting_client/examples/mail_catchall_add.php
+++ b/remoting_client/examples/mail_catchall_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => '@test.int',
-			'destination' => 'ciao@test.int',
-			'type' => 'catchall',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => '@test.int',
+		'destination' => 'ciao@test.int',
+		'type' => 'catchall',
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_catchall_add($session_id, $client_id, $params);
 
 	echo "Catchall ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_catchall_delete.php b/remoting_client/examples/mail_catchall_delete.php
index b0a5146..84e8172 100644
--- a/remoting_client/examples/mail_catchall_delete.php
+++ b/remoting_client/examples/mail_catchall_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->mail_catchall_delete($session_id, $catchall_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_catchall_get.php b/remoting_client/examples/mail_catchall_get.php
index 2bce088..e1007c8 100644
--- a/remoting_client/examples/mail_catchall_get.php
+++ b/remoting_client/examples/mail_catchall_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$catchall_id = 1;
-	
+
 	$mail_catchall_record = $client->mail_catchall_get($session_id, $catchall_id);
 
 	print_r($mail_catchall_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_catchall_update.php b/remoting_client/examples/mail_catchall_update.php
index d2542dd..fe1752d 100644
--- a/remoting_client/examples/mail_catchall_update.php
+++ b/remoting_client/examples/mail_catchall_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_catchall_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_catchall_update($session_id, $client_id, $catchall_id, $mail_catchall_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_add.php b/remoting_client/examples/mail_domain_add.php
index 304ccb2..0dd9ddf 100644
--- a/remoting_client/examples/mail_domain_add.php
+++ b/remoting_client/examples/mail_domain_add.php
@@ -1,36 +1,36 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'domain' => 'test.tld',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'domain' => 'test.tld',
+		'active' => 'y'
+	);
+
 	$domain_id = $client->mail_domain_add($session_id, $client_id, $params);
 
 	echo "Domain ID: ".$domain_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_delete.php b/remoting_client/examples/mail_domain_delete.php
index e98c527..2fc6018 100644
--- a/remoting_client/examples/mail_domain_delete.php
+++ b/remoting_client/examples/mail_domain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->mail_domain_delete($session_id, $domain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_get.php b/remoting_client/examples/mail_domain_get.php
index 5c2e9f1..3d78305 100644
--- a/remoting_client/examples/mail_domain_get.php
+++ b/remoting_client/examples/mail_domain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain_id = 1;
-	
+
 	$mail_domain_record = $client->mail_domain_get($session_id, $domain_id);
 
 	print_r($mail_domain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_get_by_domain.php b/remoting_client/examples/mail_domain_get_by_domain.php
index 157423b..5e20b11 100644
--- a/remoting_client/examples/mail_domain_get_by_domain.php
+++ b/remoting_client/examples/mail_domain_get_by_domain.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain = 'test.int';
-	
+
 	$record_record = $client->mail_domain_get_by_domain($session_id, $domain);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_set_status.php b/remoting_client/examples/mail_domain_set_status.php
index 9508ad7..ced4f25 100644
--- a/remoting_client/examples/mail_domain_set_status.php
+++ b/remoting_client/examples/mail_domain_set_status.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$primary_id = 2;
 	$status = 'inactive';
-	
+
 	$record_record = $client->mail_domain_set_status($session_id, $primary_id, $status);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_update.php b/remoting_client/examples/mail_domain_update.php
index b65894b..9eb0423 100644
--- a/remoting_client/examples/mail_domain_update.php
+++ b/remoting_client/examples/mail_domain_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_domain_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_domain_update($session_id, $client_id, $domain_id, $mail_domain_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_fetchmail_add.php b/remoting_client/examples/mail_fetchmail_add.php
index 55e59c1..912ffd5 100644
--- a/remoting_client/examples/mail_fetchmail_add.php
+++ b/remoting_client/examples/mail_fetchmail_add.php
@@ -1,42 +1,42 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'type' => 'pop3',
-			'source_server' => 'webzor.ext',
-			'source_username' => 'someguy',
-			'source_password' => 'somepassword',
-			'source_delete' => 'n',
-			'destination' => 'hmmnoe@test.int',
-			'active' => 'y',
-			'source_read_all' => 'y',
-			);
-	
+		'server_id' => 1,
+		'type' => 'pop3',
+		'source_server' => 'webzor.ext',
+		'source_username' => 'someguy',
+		'source_password' => 'somepassword',
+		'source_delete' => 'n',
+		'destination' => 'hmmnoe@test.int',
+		'active' => 'y',
+		'source_read_all' => 'y',
+	);
+
 	$fetchmail_id = $client->mail_fetchmail_add($session_id, $client_id, $params);
 
 	echo "Fetchmail ID: ".$fetchmail_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_fetchmail_delete.php b/remoting_client/examples/mail_fetchmail_delete.php
index a522bc1..ec21984 100644
--- a/remoting_client/examples/mail_fetchmail_delete.php
+++ b/remoting_client/examples/mail_fetchmail_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->mail_fetchmail_delete($session_id, $fetchmail_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_fetchmail_get.php b/remoting_client/examples/mail_fetchmail_get.php
index d804867..8cdad25 100644
--- a/remoting_client/examples/mail_fetchmail_get.php
+++ b/remoting_client/examples/mail_fetchmail_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$fetchmail_id = 1;
-	
+
 	$mail_fetchmail_record = $client->mail_fetchmail_get($session_id, $fetchmail_id);
 
 	print_r($mail_fetchmail_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_fetchmail_update.php b/remoting_client/examples/mail_fetchmail_update.php
index b9dc0c8..3d508ce 100644
--- a/remoting_client/examples/mail_fetchmail_update.php
+++ b/remoting_client/examples/mail_fetchmail_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_fetchmail_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_fetchmail_update($session_id, $client_id, $fetchmail_id, $mail_fetchmail_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_filter_add.php b/remoting_client/examples/mail_filter_add.php
index 3b7e469..f6fbbcc 100644
--- a/remoting_client/examples/mail_filter_add.php
+++ b/remoting_client/examples/mail_filter_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'type' => 'header',
-			'pattern' => 'hmmnoe@test.int',
-			'data' => 'data',
-			'action' => 'DISCARD',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'type' => 'header',
+		'pattern' => 'hmmnoe@test.int',
+		'data' => 'data',
+		'action' => 'DISCARD',
+		'active' => 'y'
+	);
+
 	$filter_id = $client->mail_filter_add($session_id, $client_id, $params);
 
 	echo "Filter ID: ".$filter_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_filter_delete.php b/remoting_client/examples/mail_filter_delete.php
index 076ac0b..c201c77 100644
--- a/remoting_client/examples/mail_filter_delete.php
+++ b/remoting_client/examples/mail_filter_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->mail_filter_delete($session_id, $filter_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_filter_get.php b/remoting_client/examples/mail_filter_get.php
index 58c5ddc..fd4aca7 100644
--- a/remoting_client/examples/mail_filter_get.php
+++ b/remoting_client/examples/mail_filter_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$filter_id = 1;
-	
+
 	$mail_filter_record = $client->mail_filter_get($session_id, $filter_id);
 
 	print_r($mail_filter_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_filter_update.php b/remoting_client/examples/mail_filter_update.php
index e1c140d..3e1080d 100644
--- a/remoting_client/examples/mail_filter_update.php
+++ b/remoting_client/examples/mail_filter_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_filter_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_filter_update($session_id, $client_id, $filter_id, $mail_filter_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_forward_add.php b/remoting_client/examples/mail_forward_add.php
index 52b514e..24ae47c 100644
--- a/remoting_client/examples/mail_forward_add.php
+++ b/remoting_client/examples/mail_forward_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => 'hallo@test.int',
-			'destination' => 'ciao@test.int',
-			'type' => 'forward',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => 'hallo@test.int',
+		'destination' => 'ciao@test.int',
+		'type' => 'forward',
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_forward_add($session_id, $client_id, $params);
 
 	echo "Forwarding ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_forward_delete.php b/remoting_client/examples/mail_forward_delete.php
index eedf451..9132de0 100644
--- a/remoting_client/examples/mail_forward_delete.php
+++ b/remoting_client/examples/mail_forward_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->mail_forward_delete($session_id, $forwarding_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_forward_get.php b/remoting_client/examples/mail_forward_get.php
index 31c35ca..533749b 100644
--- a/remoting_client/examples/mail_forward_get.php
+++ b/remoting_client/examples/mail_forward_get.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$forwarding_id = 1;
-	
+
 	$mail_forwarding_record = $client->mail_forward_get($session_id, $forwarding_id);
 	// $mail_forwarding_record = $client->mail_forward_get($session_id, array('source' => '%@test.int'));
 
 	print_r($mail_forwarding_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_forward_update.php b/remoting_client/examples/mail_forward_update.php
index 47ef9f1..f62c6e6 100644
--- a/remoting_client/examples/mail_forward_update.php
+++ b/remoting_client/examples/mail_forward_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_forward_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_forward_update($session_id, $client_id, $forwarding_id, $mail_forward_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_mailinglist_add.php b/remoting_client/examples/mail_mailinglist_add.php
index c75eca3..3d6cd56 100644
--- a/remoting_client/examples/mail_mailinglist_add.php
+++ b/remoting_client/examples/mail_mailinglist_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'domain' => 'test.int',
-			'listname' => 'work',
-			'email' => 'hmmnoe@test.int',
-			'password' => 'hmmyea'
-			);
-	
+		'server_id' => 1,
+		'domain' => 'test.int',
+		'listname' => 'work',
+		'email' => 'hmmnoe@test.int',
+		'password' => 'hmmyea'
+	);
+
 	$mailinglist_id = $client->mail_mailinglist_add($session_id, $client_id, $params);
 
 	echo "Mailinglist ID: ".$mailinglist_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_mailinglist_delete.php b/remoting_client/examples/mail_mailinglist_delete.php
index 218e34c..cf76336 100644
--- a/remoting_client/examples/mail_mailinglist_delete.php
+++ b/remoting_client/examples/mail_mailinglist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->mail_mailinglist_delete($session_id, $mailinglist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_mailinglist_get.php b/remoting_client/examples/mail_mailinglist_get.php
index 81ffbfb..7affe57 100644
--- a/remoting_client/examples/mail_mailinglist_get.php
+++ b/remoting_client/examples/mail_mailinglist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$mailinglist_id = 1;
-	
+
 	$mailinglist_record = $client->mail_mailinglist_get($session_id, $mailinglist_id);
 
 	print_r($mailinglist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_mailinglist_update.php b/remoting_client/examples/mail_mailinglist_update.php
index 2940c8b..c7d6216 100644
--- a/remoting_client/examples/mail_mailinglist_update.php
+++ b/remoting_client/examples/mail_mailinglist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the listname to home
 	$mailinglist_record['listname'] = 'home';
-	
+
 	$affected_rows = $client->mail_mailinglist_update($session_id, $client_id, $mailinglist_id, $mailinglist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_policy_add.php b/remoting_client/examples/mail_policy_add.php
index a020e23..248fc1c 100644
--- a/remoting_client/examples/mail_policy_add.php
+++ b/remoting_client/examples/mail_policy_add.php
@@ -1,71 +1,71 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'policy_name' => 'numberone',
-			'virus_lover' => 'Y',
-			'spam_lover' => 'Y',
-			'banned_files_lover' => 'Y',
-			'bad_header_lover' => 'Y',
-			'bypass_virus_checks' => 'Y',
-			'bypass_spam_checks' => 'Y',
-			'bypass_banned_checks' => 'Y',
-			'bypass_header_checks' => 'Y',
-			'spam_modifies_subj' => 'Y',
-			'virus_quarantine_to' => '',
-			'spam_quarantine_to' => '',
-			'banned_quarantine_to' => '',
-			'bad_header_quarantine_to' => '',
-			'clean_quarantine_to' => '',
-			'other_quarantine_to' => '',
-			'spam_tag_level' => 1,
-			'spam_tag2_level' => 1,
-			'spam_kill_level' => 1,
-			'spam_dsn_cutoff_level' => 1,
-			'spam_quarantine_cutoff_level' => 1,
-			'addr_extension_virus' => '',
-			'addr_extension_spam' => '',
-			'addr_extension_banned' => '',
-			'addr_extension_bad_header' => '',
-			'warnvirusrecip' => 'Y',
-			'warnbannedrecip' => 'Y',
-			'warnbadhrecip' => 'Y',
-			'newvirus_admin' => '',
-			'virus_admin' => '',
-			'banned_admin' => '',
-			'bad_header_admin' => '',
-			'spam_admin' => '',
-			'spam_subject_tag' => '',
-			'spam_subject_tag2' => '',
-			'message_size_limit' => 10,
-			'banned_rulenames' => 'welt'
-			);
-	
+		'policy_name' => 'numberone',
+		'virus_lover' => 'Y',
+		'spam_lover' => 'Y',
+		'banned_files_lover' => 'Y',
+		'bad_header_lover' => 'Y',
+		'bypass_virus_checks' => 'Y',
+		'bypass_spam_checks' => 'Y',
+		'bypass_banned_checks' => 'Y',
+		'bypass_header_checks' => 'Y',
+		'spam_modifies_subj' => 'Y',
+		'virus_quarantine_to' => '',
+		'spam_quarantine_to' => '',
+		'banned_quarantine_to' => '',
+		'bad_header_quarantine_to' => '',
+		'clean_quarantine_to' => '',
+		'other_quarantine_to' => '',
+		'spam_tag_level' => 1,
+		'spam_tag2_level' => 1,
+		'spam_kill_level' => 1,
+		'spam_dsn_cutoff_level' => 1,
+		'spam_quarantine_cutoff_level' => 1,
+		'addr_extension_virus' => '',
+		'addr_extension_spam' => '',
+		'addr_extension_banned' => '',
+		'addr_extension_bad_header' => '',
+		'warnvirusrecip' => 'Y',
+		'warnbannedrecip' => 'Y',
+		'warnbadhrecip' => 'Y',
+		'newvirus_admin' => '',
+		'virus_admin' => '',
+		'banned_admin' => '',
+		'bad_header_admin' => '',
+		'spam_admin' => '',
+		'spam_subject_tag' => '',
+		'spam_subject_tag2' => '',
+		'message_size_limit' => 10,
+		'banned_rulenames' => 'welt'
+	);
+
 	$affected_rows = $client->mail_policy_add($session_id, $client_id, $params);
-	
+
 	echo "Policy ID: ".$affected_rows."<br>";
-	
-	
+
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_policy_delete.php b/remoting_client/examples/mail_policy_delete.php
index e0c0ceb..3bc619e 100644
--- a/remoting_client/examples/mail_policy_delete.php
+++ b/remoting_client/examples/mail_policy_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->mail_policy_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_policy_get.php b/remoting_client/examples/mail_policy_get.php
index 5e2005a..d40deea 100644
--- a/remoting_client/examples/mail_policy_get.php
+++ b/remoting_client/examples/mail_policy_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 1;
-	
+
 	$mail_policy_record = $client->mail_policy_get($session_id, $id);
 
 	print_r($mail_policy_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_policy_update.php b/remoting_client/examples/mail_policy_update.php
index abdab81..d90ac5c 100644
--- a/remoting_client/examples/mail_policy_update.php
+++ b/remoting_client/examples/mail_policy_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change policy_name to Hans_Werner
 	$mail_policy_record['policy_name'] = 'Hans_Werner';
-	
+
 	$affected_rows = $client->mail_policy_update($session_id, $client_id, $id, $mail_policy_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_blacklist_add.php b/remoting_client/examples/mail_spamfilter_blacklist_add.php
index 4d5515c..d5768e2 100644
--- a/remoting_client/examples/mail_spamfilter_blacklist_add.php
+++ b/remoting_client/examples/mail_spamfilter_blacklist_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'wb' => 'B',
-			'rid' => '',
-			'email' => 'hmmnoe@test.int',
-			'priority' => 1,
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'wb' => 'B',
+		'rid' => '',
+		'email' => 'hmmnoe@test.int',
+		'priority' => 1,
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_spamfilter_blacklist_add($session_id, $client_id, $params);
 
 	echo "Blacklist ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_blacklist_delete.php b/remoting_client/examples/mail_spamfilter_blacklist_delete.php
index 9c5f701..51f0162 100644
--- a/remoting_client/examples/mail_spamfilter_blacklist_delete.php
+++ b/remoting_client/examples/mail_spamfilter_blacklist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->mail_spamfilter_blacklist_delete($session_id, $wblist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_blacklist_get.php b/remoting_client/examples/mail_spamfilter_blacklist_get.php
index 723376a..359dddb 100644
--- a/remoting_client/examples/mail_spamfilter_blacklist_get.php
+++ b/remoting_client/examples/mail_spamfilter_blacklist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$wblist_id = 2;
-	
+
 	$mail_wblist_record = $client->mail_spamfilter_blacklist_get($session_id, $wblist_id);
 
 	print_r($mail_wblist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_blacklist_update.php b/remoting_client/examples/mail_spamfilter_blacklist_update.php
index 6dcf5f0..674429f 100644
--- a/remoting_client/examples/mail_spamfilter_blacklist_update.php
+++ b/remoting_client/examples/mail_spamfilter_blacklist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the priority to 2
 	$mail_wblist_record['priority'] = 2;
-	
+
 	$affected_rows = $client->mail_spamfilter_blacklist_update($session_id, $client_id, $wblist_id, $mail_wblist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_user_add.php b/remoting_client/examples/mail_spamfilter_user_add.php
index 6ecccc1..5c2c59c 100644
--- a/remoting_client/examples/mail_spamfilter_user_add.php
+++ b/remoting_client/examples/mail_spamfilter_user_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'priority' => 3,
-			'policy_id' => 1,
-			'email' => 'hmmnoe@test.int',
-			'fullname' => 'Max Mustermann',
-			'local' => ''
-			);
-	
+		'server_id' => 1,
+		'priority' => 3,
+		'policy_id' => 1,
+		'email' => 'hmmnoe@test.int',
+		'fullname' => 'Max Mustermann',
+		'local' => ''
+	);
+
 	$affected_rows = $client->mail_spamfilter_user_add($session_id, $client_id, $params);
 
 	echo "Spamfilter user ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_user_delete.php b/remoting_client/examples/mail_spamfilter_user_delete.php
index 7ff719e..e2d419c 100644
--- a/remoting_client/examples/mail_spamfilter_user_delete.php
+++ b/remoting_client/examples/mail_spamfilter_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->mail_spamfilter_user_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_user_get.php b/remoting_client/examples/mail_spamfilter_user_get.php
index 082c59d..9a5f48f 100644
--- a/remoting_client/examples/mail_spamfilter_user_get.php
+++ b/remoting_client/examples/mail_spamfilter_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 1;
-	
+
 	$mail_spamfilter_user_record = $client->mail_spamfilter_user_get($session_id, $id);
 
 	print_r($mail_spamfilter_user_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_user_update.php b/remoting_client/examples/mail_spamfilter_user_update.php
index e40415b..95fe722 100644
--- a/remoting_client/examples/mail_spamfilter_user_update.php
+++ b/remoting_client/examples/mail_spamfilter_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change fullname to Hans Werner
 	$mail_spamfilter_user_record['fullname'] = 'Hans Werner';
-	
+
 	$affected_rows = $client->mail_spamfilter_user_update($session_id, $client_id, $id, $mail_spamfilter_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_whitelist_add.php b/remoting_client/examples/mail_spamfilter_whitelist_add.php
index 8099d93..fd974ec 100644
--- a/remoting_client/examples/mail_spamfilter_whitelist_add.php
+++ b/remoting_client/examples/mail_spamfilter_whitelist_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'wb' => 'W',
-			'rid' => '',
-			'email' => 'hmmnoe@test.int',
-			'priority' => 1,
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'wb' => 'W',
+		'rid' => '',
+		'email' => 'hmmnoe@test.int',
+		'priority' => 1,
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_spamfilter_whitelist_add($session_id, $client_id, $params);
 
 	echo "Whitelist ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_whitelist_delete.php b/remoting_client/examples/mail_spamfilter_whitelist_delete.php
index a6290ce..629d183 100644
--- a/remoting_client/examples/mail_spamfilter_whitelist_delete.php
+++ b/remoting_client/examples/mail_spamfilter_whitelist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->mail_spamfilter_whitelist_delete($session_id, $wblist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_whitelist_get.php b/remoting_client/examples/mail_spamfilter_whitelist_get.php
index afef378..02597c0 100644
--- a/remoting_client/examples/mail_spamfilter_whitelist_get.php
+++ b/remoting_client/examples/mail_spamfilter_whitelist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$wblist_id = 1;
-	
+
 	$mail_wblist_record = $client->mail_spamfilter_whitelist_get($session_id, $wblist_id);
 
 	print_r($mail_wblist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_whitelist_update.php b/remoting_client/examples/mail_spamfilter_whitelist_update.php
index 910ecc7..f95b619 100644
--- a/remoting_client/examples/mail_spamfilter_whitelist_update.php
+++ b/remoting_client/examples/mail_spamfilter_whitelist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the priority to 2
 	$mail_wblist_record['priority'] = 2;
-	
+
 	$affected_rows = $client->mail_spamfilter_whitelist_update($session_id, $client_id, $wblist_id, $mail_wblist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_transport_add.php b/remoting_client/examples/mail_transport_add.php
index c0ca2d7..d296f90 100644
--- a/remoting_client/examples/mail_transport_add.php
+++ b/remoting_client/examples/mail_transport_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'domain' => 'test.int',
-			'transport' => '',
-			'sort_order' => 5,
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'domain' => 'test.int',
+		'transport' => '',
+		'sort_order' => 5,
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_transport_add($session_id, $client_id, $params);
 
 	echo "Transport ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_transport_delete.php b/remoting_client/examples/mail_transport_delete.php
index 68e4812..80dd9cc 100644
--- a/remoting_client/examples/mail_transport_delete.php
+++ b/remoting_client/examples/mail_transport_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->mail_transport_delete($session_id, $transport_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_transport_get.php b/remoting_client/examples/mail_transport_get.php
index 1ecdf6a..00a3268 100644
--- a/remoting_client/examples/mail_transport_get.php
+++ b/remoting_client/examples/mail_transport_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$transport_id = 1;
-	
+
 	$mail_transport_record = $client->mail_transport_get($session_id, $transport_id);
 
 	print_r($mail_transport_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_transport_update.php b/remoting_client/examples/mail_transport_update.php
index db4d3ba..da4f57f 100644
--- a/remoting_client/examples/mail_transport_update.php
+++ b/remoting_client/examples/mail_transport_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_transport_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_transport_update($session_id, $client_id, $transport_id, $mail_transport_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_add.php b/remoting_client/examples/mail_user_add.php
index 1351eef..25e3590 100644
--- a/remoting_client/examples/mail_user_add.php
+++ b/remoting_client/examples/mail_user_add.php
@@ -1,56 +1,56 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'email' => 'joe@test.int',
-			'login' => 'joe@test.int',
-			'password' => 'howtoforge',
-			'name' => 'joe',
-			'uid' => 5000,
-			'gid' => 5000,
-			'maildir' => '/var/vmail/test.int/joe',
-			'quota' => 5242880,
-			'cc' => '',
-			'homedir' => '/var/vmail',
-			'autoresponder' => 'n',
-			'autoresponder_start_date' => array('day' => 1,'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
-			'autoresponder_end_date' => array('day' => 20,'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
-			'autoresponder_text' => 'hallo',
-			'move_junk' => 'n',
-			'custom_mailfilter' => 'spam',
-			'postfix' => 'n',
-			'access' => 'n',
-			'disableimap' => 'n',
-			'disablepop3' => 'n',
-			'disabledeliver' => 'n',
-			'disablesmtp' => 'n'
-			);
-	
+		'server_id' => 1,
+		'email' => 'joe@test.int',
+		'login' => 'joe@test.int',
+		'password' => 'howtoforge',
+		'name' => 'joe',
+		'uid' => 5000,
+		'gid' => 5000,
+		'maildir' => '/var/vmail/test.int/joe',
+		'quota' => 5242880,
+		'cc' => '',
+		'homedir' => '/var/vmail',
+		'autoresponder' => 'n',
+		'autoresponder_start_date' => array('day' => 1, 'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
+		'autoresponder_end_date' => array('day' => 20, 'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
+		'autoresponder_text' => 'hallo',
+		'move_junk' => 'n',
+		'custom_mailfilter' => 'spam',
+		'postfix' => 'n',
+		'access' => 'n',
+		'disableimap' => 'n',
+		'disablepop3' => 'n',
+		'disabledeliver' => 'n',
+		'disablesmtp' => 'n'
+	);
+
 	$affected_rows = $client->mail_user_add($session_id, $client_id, $params);
 
 	echo "New user: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_delete.php b/remoting_client/examples/mail_user_delete.php
index ffc3826..e9be894 100644
--- a/remoting_client/examples/mail_user_delete.php
+++ b/remoting_client/examples/mail_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->mail_user_delete($session_id, $mailuser_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_filter_add.php b/remoting_client/examples/mail_user_filter_add.php
index 4e61695..1f07f73 100644
--- a/remoting_client/examples/mail_user_filter_add.php
+++ b/remoting_client/examples/mail_user_filter_add.php
@@ -1,41 +1,41 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'mailuser_id' => '0',
-			'rulename' => 'NULL',
-			'source' => '',
-			'searchterm' => 'NULL',
-			'op' => '',
-			'action' => '',
-			'target' => '',
-			'active' => 'y'
-			);
-	
+		'mailuser_id' => '0',
+		'rulename' => 'NULL',
+		'source' => '',
+		'searchterm' => 'NULL',
+		'op' => '',
+		'action' => '',
+		'target' => '',
+		'active' => 'y'
+	);
+
 	$filter_id = $client->mail_user_filter_add($session_id, $client_id, $params);
 
 	echo "Filter ID: ".$filter_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_filter_delete.php b/remoting_client/examples/mail_user_filter_delete.php
index d2eb2ed..3a2a9f8 100644
--- a/remoting_client/examples/mail_user_filter_delete.php
+++ b/remoting_client/examples/mail_user_filter_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->mail_user_filter_delete($session_id, $filter_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_filter_get.php b/remoting_client/examples/mail_user_filter_get.php
index aad3ce5..a3038a1 100644
--- a/remoting_client/examples/mail_user_filter_get.php
+++ b/remoting_client/examples/mail_user_filter_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$filter_id = 1;
-	
+
 	$mail_filter_record = $client->mail_user_filter_get($session_id, $filter_id);
 
 	print_r($mail_filter_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_filter_update.php b/remoting_client/examples/mail_user_filter_update.php
index f948620..a8b62c4 100644
--- a/remoting_client/examples/mail_user_filter_update.php
+++ b/remoting_client/examples/mail_user_filter_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_user_filter_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_user_filter_update($session_id, $client_id, $filter_id, $mail_user_filter_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_get.php b/remoting_client/examples/mail_user_get.php
index fd36d63..cdec8b7 100644
--- a/remoting_client/examples/mail_user_get.php
+++ b/remoting_client/examples/mail_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$mailuser_id = 1;
-	
+
 	$app = $client->mail_user_get($session_id, $mailuser_id);
 
 	print_r($app);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_update.php b/remoting_client/examples/mail_user_update.php
index 28fb90c..b6b92fd 100644
--- a/remoting_client/examples/mail_user_update.php
+++ b/remoting_client/examples/mail_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_user_record['name'] = 'hmmyea';
-	
+
 	$affected_rows = $client->mail_user_update($session_id, $client_id, $mailuser_id, $mail_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_whitelist_add.php b/remoting_client/examples/mail_whitelist_add.php
index 14f3298..e25dbdb 100644
--- a/remoting_client/examples/mail_whitelist_add.php
+++ b/remoting_client/examples/mail_whitelist_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => 'hmmnoeoe@test.int',
-			'access' => 'OK',
-			'type' => 'sender',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => 'hmmnoeoe@test.int',
+		'access' => 'OK',
+		'type' => 'sender',
+		'active' => 'y'
+	);
+
 	$whitelist_id = $client->mail_whitelist_add($session_id, $client_id, $params);
 
 	echo "Whitelist ID: ".$whitelist_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_whitelist_delete.php b/remoting_client/examples/mail_whitelist_delete.php
index 555a0b8..fc36f6e 100644
--- a/remoting_client/examples/mail_whitelist_delete.php
+++ b/remoting_client/examples/mail_whitelist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@
 	$affected_rows = $client->mail_whitelist_delete($session_id, $whitelist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_whitelist_get.php b/remoting_client/examples/mail_whitelist_get.php
index 5652c71..69d4bef 100644
--- a/remoting_client/examples/mail_whitelist_get.php
+++ b/remoting_client/examples/mail_whitelist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$whitelist_id = 3;
-	
+
 	$mail_whitelist_record = $client->mail_whitelist_get($session_id, $whitelist_id);
 
 	print_r($mail_whitelist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_whitelist_update.php b/remoting_client/examples/mail_whitelist_update.php
index 301e003..984519c 100644
--- a/remoting_client/examples/mail_whitelist_update.php
+++ b/remoting_client/examples/mail_whitelist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$mail_whitelist_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_whitelist_update($session_id, $client_id, $whitelist_id, $mail_whitelist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_get_free_ip.php b/remoting_client/examples/openvz_get_free_ip.php
index ef04ef5..d7ccc96 100644
--- a/remoting_client/examples/openvz_get_free_ip.php
+++ b/remoting_client/examples/openvz_get_free_ip.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 
 	$record_record = $client->openvz_get_free_ip($session_id, $server_id = 0);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ip_add.php b/remoting_client/examples/openvz_ip_add.php
index 77ec4c4..cda9fa4 100644
--- a/remoting_client/examples/openvz_ip_add.php
+++ b/remoting_client/examples/openvz_ip_add.php
@@ -1,37 +1,37 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'ip_address' => '192.168.0.111',
-			'vm_id' => 1,
-			'reserved' => 'n'
-			);
-	
+		'server_id' => 1,
+		'ip_address' => '192.168.0.111',
+		'vm_id' => 1,
+		'reserved' => 'n'
+	);
+
 	$ip_id = $client->openvz_ip_add($session_id, $client_id, $params);
 
 	echo "IP ID: ".$ip_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ip_delete.php b/remoting_client/examples/openvz_ip_delete.php
index c542645..c7b07f8 100644
--- a/remoting_client/examples/openvz_ip_delete.php
+++ b/remoting_client/examples/openvz_ip_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->openvz_ip_delete($session_id, $ip_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ip_get.php b/remoting_client/examples/openvz_ip_get.php
index 78ed061..9237ed4 100644
--- a/remoting_client/examples/openvz_ip_get.php
+++ b/remoting_client/examples/openvz_ip_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$ip_id = 2;
-	
+
 	$ip_record = $client->openvz_ip_get($session_id, $ip_id);
 
 	print_r($ip_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ip_update.php b/remoting_client/examples/openvz_ip_update.php
index f5ba0e6..9867fe0 100644
--- a/remoting_client/examples/openvz_ip_update.php
+++ b/remoting_client/examples/openvz_ip_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the reservation to yes
 	$ip_record['reserved'] = 'y';
-	
+
 	$affected_rows = $client->openvz_ip_update($session_id, $client_id, $ip_id, $ip_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ostemplate_add.php b/remoting_client/examples/openvz_ostemplate_add.php
index 923b7c1..3ad0c13 100644
--- a/remoting_client/examples/openvz_ostemplate_add.php
+++ b/remoting_client/examples/openvz_ostemplate_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'template_name' => 'tone',
-			'template_file' => 'custom',
-			'server_id' => 1,
-			'allservers' => 'y',
-			'active' => 'y',
-			'description' => 'howto',
-			);
-	
+		'template_name' => 'tone',
+		'template_file' => 'custom',
+		'server_id' => 1,
+		'allservers' => 'y',
+		'active' => 'y',
+		'description' => 'howto',
+	);
+
 	$ostemplate_id = $client->openvz_ostemplate_add($session_id, $client_id, $params);
 
 	echo "Ostemplate ID: ".$ostemplate_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ostemplate_delete.php b/remoting_client/examples/openvz_ostemplate_delete.php
index b8bf5f9..659d8af 100644
--- a/remoting_client/examples/openvz_ostemplate_delete.php
+++ b/remoting_client/examples/openvz_ostemplate_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->openvz_ostemplate_delete($session_id, $ostemplate_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ostemplate_get.php b/remoting_client/examples/openvz_ostemplate_get.php
index 6d22413..b2d940b 100644
--- a/remoting_client/examples/openvz_ostemplate_get.php
+++ b/remoting_client/examples/openvz_ostemplate_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$ostemplate_id = 2;
-	
+
 	$ostemplate_record = $client->openvz_ostemplate_get($session_id, $ostemplate_id);
 
 	print_r($ostemplate_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ostemplate_update.php b/remoting_client/examples/openvz_ostemplate_update.php
index abc076f..a95fc17 100644
--- a/remoting_client/examples/openvz_ostemplate_update.php
+++ b/remoting_client/examples/openvz_ostemplate_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$ostemplate_record['active'] = 'n';
-	
+
 	$affected_rows = $client->openvz_ostemplate_update($session_id, $client_id, $ostemplate_id, $ostemplate_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_template_add.php b/remoting_client/examples/openvz_template_add.php
index bdfc63a..74eb1b9 100644
--- a/remoting_client/examples/openvz_template_add.php
+++ b/remoting_client/examples/openvz_template_add.php
@@ -1,71 +1,71 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'template_name' => 'tone',
-			'diskspace' => 10,
-			'traffic' => -1,
-			'bandwidth' => -1,
-			'ram' => 256,
-			'ram_burst' => 512,
-			'cpu_units' => 1000,
-			'cpu_num' => 4,
-			'cpu_limit' => 400,
-			'io_priority' => 4,
-			'active' => 'y',
-			'description' => 'howto',
-			'numproc' => '999999:999999',
-			'numtcpsock' => '7999992:7999992',
-			'numothersock' => '7999992:7999992',
-			'vmguarpages' => '65536:65536',
-			'kmemsize' => '2147483646:2147483646',
-			'tcpsndbuf' => '214748160:396774400',
-			'tcprcvbuf' => '214748160:396774400',
-			'othersockbuf' => '214748160:396774400',
-			'dgramrcvbuf' => '214748160:396774400',
-			'oomguarpages' => '65536:65536',
-			'privvmpages' => '131072:131072',
-			'lockedpages' => '999999:999999',
-			'shmpages' => '65536:65536',
-			'physpages' => '0:2147483647',
-			'numfile' => '23999976:23999976',
-			'avnumproc' => '180:180',
-			'numflock' => '999999:999999',
-			'numpty' => '500000:500000',
-			'numsiginfo' => '999999:999999',
-			'dcachesize' => '2147483646:2147483646',
-			'numiptent' => '999999:999999',
-			'swappages' => '256000:256000',
-			'hostname' => 'host',
-			'nameserver' => 'ns1',
-			'create_dns' => 'n',
-			'capability' => ''
-			);
-	
+		'template_name' => 'tone',
+		'diskspace' => 10,
+		'traffic' => -1,
+		'bandwidth' => -1,
+		'ram' => 256,
+		'ram_burst' => 512,
+		'cpu_units' => 1000,
+		'cpu_num' => 4,
+		'cpu_limit' => 400,
+		'io_priority' => 4,
+		'active' => 'y',
+		'description' => 'howto',
+		'numproc' => '999999:999999',
+		'numtcpsock' => '7999992:7999992',
+		'numothersock' => '7999992:7999992',
+		'vmguarpages' => '65536:65536',
+		'kmemsize' => '2147483646:2147483646',
+		'tcpsndbuf' => '214748160:396774400',
+		'tcprcvbuf' => '214748160:396774400',
+		'othersockbuf' => '214748160:396774400',
+		'dgramrcvbuf' => '214748160:396774400',
+		'oomguarpages' => '65536:65536',
+		'privvmpages' => '131072:131072',
+		'lockedpages' => '999999:999999',
+		'shmpages' => '65536:65536',
+		'physpages' => '0:2147483647',
+		'numfile' => '23999976:23999976',
+		'avnumproc' => '180:180',
+		'numflock' => '999999:999999',
+		'numpty' => '500000:500000',
+		'numsiginfo' => '999999:999999',
+		'dcachesize' => '2147483646:2147483646',
+		'numiptent' => '999999:999999',
+		'swappages' => '256000:256000',
+		'hostname' => 'host',
+		'nameserver' => 'ns1',
+		'create_dns' => 'n',
+		'capability' => ''
+	);
+
 	$template_id = $client->openvz_template_add($session_id, $client_id, $params);
 
 	echo "Template ID: ".$template_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_template_delete.php b/remoting_client/examples/openvz_template_delete.php
index 69c68f0..128034e 100644
--- a/remoting_client/examples/openvz_template_delete.php
+++ b/remoting_client/examples/openvz_template_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->openvz_template_delete($session_id, $template_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_template_get.php b/remoting_client/examples/openvz_template_get.php
index ac8bd5d..dfe9c11 100644
--- a/remoting_client/examples/openvz_template_get.php
+++ b/remoting_client/examples/openvz_template_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$template_id = 2;
-	
+
 	$template_record = $client->openvz_template_get($session_id, $template_id);
 
 	print_r($template_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_template_update.php b/remoting_client/examples/openvz_template_update.php
index be84d1f..0425d94 100644
--- a/remoting_client/examples/openvz_template_update.php
+++ b/remoting_client/examples/openvz_template_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$template_record['active'] = 'n';
-	
+
 	$affected_rows = $client->openvz_template_update($session_id, $client_id, $template_id, $template_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_add.php b/remoting_client/examples/openvz_vm_add.php
index ce89be7..408c626 100644
--- a/remoting_client/examples/openvz_vm_add.php
+++ b/remoting_client/examples/openvz_vm_add.php
@@ -1,57 +1,57 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'veid' => 1,
-			'ostemplate_id' => 0,
-			'template_id' => 0,
-			'ip_address' => '192.168.0.111',
-			'hostname' => 'host',
-			'vm_password' => 'password',
-			'start_boot' => 'y',
-			'active' => 'y',
-			'active_until_date' => '',
-			'description' => '',
-			'diskspace' => 10,
-			'traffic' => -1,
-			'bandwidth' => -1,
-			'ram' => 256,
-			'ram_burst' => 512,
-			'cpu_units' => 1000,
-			'cpu_num' => 4,
-			'cpu_limit' => 400,
-			'io_priority' => 4,
-			'nameserver' => '8.8.8.8 8.8.4.4',
-			'create_dns' => 'n',
-			'capability' => '',
-			'config' => ''
-			);
-	
+		'server_id' => 1,
+		'veid' => 1,
+		'ostemplate_id' => 0,
+		'template_id' => 0,
+		'ip_address' => '192.168.0.111',
+		'hostname' => 'host',
+		'vm_password' => 'password',
+		'start_boot' => 'y',
+		'active' => 'y',
+		'active_until_date' => '',
+		'description' => '',
+		'diskspace' => 10,
+		'traffic' => -1,
+		'bandwidth' => -1,
+		'ram' => 256,
+		'ram_burst' => 512,
+		'cpu_units' => 1000,
+		'cpu_num' => 4,
+		'cpu_limit' => 400,
+		'io_priority' => 4,
+		'nameserver' => '8.8.8.8 8.8.4.4',
+		'create_dns' => 'n',
+		'capability' => '',
+		'config' => ''
+	);
+
 	$vm_id = $client->openvz_vm_add($session_id, $client_id, $params);
 
 	echo "VM ID: ".$vm_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_add_from_template.php b/remoting_client/examples/openvz_vm_add_from_template.php
index 2e22b99..ea7328d 100644
--- a/remoting_client/examples/openvz_vm_add_from_template.php
+++ b/remoting_client/examples/openvz_vm_add_from_template.php
@@ -8,35 +8,35 @@
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
-	//* Params are optional for this function. If params are set, 
+
+	//* Params are optional for this function. If params are set,
 	//* then they override the template settings.
 	$params = array();
-	
+
 	//* Set the function parameters.
 	$client_id = 0;
 	$ostemplate_id = 3;
 	$template_id = 3;
-	
+
 	$vm_id = $client->openvz_vm_add_from_template($session_id, $client_id, $ostemplate_id, $template_id, $params);
 
 	print_r($vm_id);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_delete.php b/remoting_client/examples/openvz_vm_delete.php
index 5edc93f..be0737c 100644
--- a/remoting_client/examples/openvz_vm_delete.php
+++ b/remoting_client/examples/openvz_vm_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->openvz_vm_delete($session_id, $vm_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_get.php b/remoting_client/examples/openvz_vm_get.php
index d645d34..78bd571 100644
--- a/remoting_client/examples/openvz_vm_get.php
+++ b/remoting_client/examples/openvz_vm_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$vm_id = 1;
-	
+
 	$vm_record = $client->openvz_vm_get($session_id, $vm_id);
 
 	print_r($vm_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_get_by_client.php b/remoting_client/examples/openvz_vm_get_by_client.php
index 1b696bf..8497185 100644
--- a/remoting_client/examples/openvz_vm_get_by_client.php
+++ b/remoting_client/examples/openvz_vm_get_by_client.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set function parameters
 	$client_id = 4;
-	
+
 	$vm_record = $client->openvz_vm_get_by_client($session_id, $client_id);
 
 	print_r($vm_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_update.php b/remoting_client/examples/openvz_vm_update.php
index 5a908b1..f15386a 100644
--- a/remoting_client/examples/openvz_vm_update.php
+++ b/remoting_client/examples/openvz_vm_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to no
 	$vm_record['active'] = 'n';
-	
+
 	$affected_rows = $client->openvz_vm_update($session_id, $client_id, $vm_id, $vm_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/server_get.php b/remoting_client/examples/server_get.php
index c33f3b9..d5f09d6 100644
--- a/remoting_client/examples/server_get.php
+++ b/remoting_client/examples/server_get.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$server_id = 1;
-	
+
 	$record_record = $client->server_get($session_id, $server_id, $section ='');
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/server_get_serverid_by_ip.php b/remoting_client/examples/server_get_serverid_by_ip.php
index 11a58b6..f3e1ec4 100644
--- a/remoting_client/examples/server_get_serverid_by_ip.php
+++ b/remoting_client/examples/server_get_serverid_by_ip.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$ipaddress = '192.168.0.112';
-	
+
 	$record_record = $client->server_get_serverid_by_ip($session_id, $ipaddress);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_cron_add.php b/remoting_client/examples/sites_cron_add.php
index cc517e9..0294a9f 100644
--- a/remoting_client/examples/sites_cron_add.php
+++ b/remoting_client/examples/sites_cron_add.php
@@ -1,44 +1,44 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
-	
+
 	$params = array(
-			'server_id' => 1,
-			'parent_domain_id' => 1,
-			'type' => 'url',
-			'command' => 'echo 1',
-			'run_min' => '1',
-			'run_hour' => '1',
-			'run_mday' => '1',
-			'run_month' => '1',
-			'run_wday' => '1',
-			'active' => 'y',
-			);
-	
+		'server_id' => 1,
+		'parent_domain_id' => 1,
+		'type' => 'url',
+		'command' => 'echo 1',
+		'run_min' => '1',
+		'run_hour' => '1',
+		'run_mday' => '1',
+		'run_month' => '1',
+		'run_wday' => '1',
+		'active' => 'y',
+	);
+
 	$affected_rows = $client->sites_cron_add($session_id, $client_id, $params);
-	
+
 	echo "Cron ID: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_cron_delete.php b/remoting_client/examples/sites_cron_delete.php
index 21aa10a..b9dbcde 100644
--- a/remoting_client/examples/sites_cron_delete.php
+++ b/remoting_client/examples/sites_cron_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->sites_cron_delete($session_id, $cron_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_cron_get.php b/remoting_client/examples/sites_cron_get.php
index 4b3a718..0b93ca0 100644
--- a/remoting_client/examples/sites_cron_get.php
+++ b/remoting_client/examples/sites_cron_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$cron_id = 1;
-	
+
 	$cron_record = $client->sites_cron_get($session_id, $cron_id);
 
 	print_r($cron_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_cron_update.php b/remoting_client/examples/sites_cron_update.php
index b888e2a..8411e65 100644
--- a/remoting_client/examples/sites_cron_update.php
+++ b/remoting_client/examples/sites_cron_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to no
 	$cron_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_cron_update($session_id, $client_id, $cron_id, $cron_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_add.php b/remoting_client/examples/sites_database_add.php
index f3ddc29..c391867 100644
--- a/remoting_client/examples/sites_database_add.php
+++ b/remoting_client/examples/sites_database_add.php
@@ -1,44 +1,44 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'type' => 'mysql',
-			'database_name' => 'db_name2',
-			'database_user_id' => '1',
-			'database_ro_user_id' => '0',
-			'database_charset' => 'UTF8',
-			'remote_access' => 'y',
-			'remote_ips' => '',
-			'backup_interval' => 'none',
-			'backup_copies' => 1,
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'type' => 'mysql',
+		'database_name' => 'db_name2',
+		'database_user_id' => '1',
+		'database_ro_user_id' => '0',
+		'database_charset' => 'UTF8',
+		'remote_access' => 'y',
+		'remote_ips' => '',
+		'backup_interval' => 'none',
+		'backup_copies' => 1,
+		'active' => 'y'
+	);
+
 	$database_id = $client->sites_database_add($session_id, $client_id, $params);
 
 	echo "Database ID: ".$database_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_delete.php b/remoting_client/examples/sites_database_delete.php
index 9d225e2..0ce5e51 100644
--- a/remoting_client/examples/sites_database_delete.php
+++ b/remoting_client/examples/sites_database_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->sites_database_delete($session_id, $database_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_get.php b/remoting_client/examples/sites_database_get.php
index fb26d04..7116657 100644
--- a/remoting_client/examples/sites_database_get.php
+++ b/remoting_client/examples/sites_database_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$database_id = 1;
-	
+
 	$database_record = $client->sites_database_get($session_id, $database_id);
 
 	print_r($database_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_get_all_by_user.php b/remoting_client/examples/sites_database_get_all_by_user.php
index 0aea522..95baf92 100644
--- a/remoting_client/examples/sites_database_get_all_by_user.php
+++ b/remoting_client/examples/sites_database_get_all_by_user.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
-	
+
 	$record_record = $client->sites_database_get_all_by_user($session_id, $client_id);
 
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_update.php b/remoting_client/examples/sites_database_update.php
index c4c8a80..9945c79 100644
--- a/remoting_client/examples/sites_database_update.php
+++ b/remoting_client/examples/sites_database_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$database_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_database_update($session_id, $client_id, $database_id, $database_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_user_add.php b/remoting_client/examples/sites_database_user_add.php
index 8dd2e79..1081633 100644
--- a/remoting_client/examples/sites_database_user_add.php
+++ b/remoting_client/examples/sites_database_user_add.php
@@ -1,36 +1,36 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'database_user' => 'db_name2',
-			'database_password' => 'db_name2'
-			);
-	
+		'server_id' => 1,
+		'database_user' => 'db_name2',
+		'database_password' => 'db_name2'
+	);
+
 	$database_id = $client->sites_database_user_add($session_id, $client_id, $params);
 
 	echo "Database ID: ".$database_user_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_user_delete.php b/remoting_client/examples/sites_database_user_delete.php
index 6c82932..ec25822 100644
--- a/remoting_client/examples/sites_database_user_delete.php
+++ b/remoting_client/examples/sites_database_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->sites_database_user_delete($session_id, $database_user_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_user_get.php b/remoting_client/examples/sites_database_user_get.php
index 759ed9f..db00f13 100644
--- a/remoting_client/examples/sites_database_user_get.php
+++ b/remoting_client/examples/sites_database_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$database_user_id = 1;
-	
+
 	$database_record = $client->sites_database_user_get($session_id, $database_user_id);
 
 	print_r($database_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_user_update.php b/remoting_client/examples/sites_database_user_update.php
index 527920d..9ce5f7b 100644
--- a/remoting_client/examples/sites_database_user_update.php
+++ b/remoting_client/examples/sites_database_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change password of the database user
 	$database_user_record['database_password'] = 'abcde';
-	
+
 	$affected_rows = $client->sites_database_user_update($session_id, $client_id, $database_user_id, $database_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_ftp_user_add.php b/remoting_client/examples/sites_ftp_user_add.php
index bea1087..b8d499b 100644
--- a/remoting_client/examples/sites_ftp_user_add.php
+++ b/remoting_client/examples/sites_ftp_user_add.php
@@ -1,49 +1,49 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
-	
+
 	$params = array(
-			'server_id' => 1,
-			'parent_domain_id' => 1,
-			'username' => 'threep',
-			'password' => 'wood',
-			'quota_size' => 10000,
-			'active' => 'y',
-			'uid' => '5000',
-			'gid' => '5000',
-			'dir' => 'maybe',
-			'quota_files' => -1,
-			'ul_ratio' => -1,
-			'dl_ratio' => -1,
-			'ul_bandwidth' => -1,
-			'dl_bandwidth' => -1
-			);
-	
+		'server_id' => 1,
+		'parent_domain_id' => 1,
+		'username' => 'threep',
+		'password' => 'wood',
+		'quota_size' => 10000,
+		'active' => 'y',
+		'uid' => '5000',
+		'gid' => '5000',
+		'dir' => 'maybe',
+		'quota_files' => -1,
+		'ul_ratio' => -1,
+		'dl_ratio' => -1,
+		'ul_bandwidth' => -1,
+		'dl_bandwidth' => -1
+	);
+
 	$affected_rows = $client->sites_ftp_user_add($session_id, $client_id, $params);
-	
+
 	echo "FTP User ID: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_ftp_user_delete.php b/remoting_client/examples/sites_ftp_user_delete.php
index 13c7449..5363462 100644
--- a/remoting_client/examples/sites_ftp_user_delete.php
+++ b/remoting_client/examples/sites_ftp_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@
 	$affected_rows = $client->sites_ftp_user_delete($session_id, $ftp_user_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_ftp_user_get.php b/remoting_client/examples/sites_ftp_user_get.php
index 018c06b..6b31590 100644
--- a/remoting_client/examples/sites_ftp_user_get.php
+++ b/remoting_client/examples/sites_ftp_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$ftp_user_id = 1;
-	
+
 	$ftp_user_record = $client->sites_ftp_user_get($session_id, $ftp_user_id);
 
 	print_r($ftp_user_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_ftp_user_update.php b/remoting_client/examples/sites_ftp_user_update.php
index b0a22be..d09b416 100644
--- a/remoting_client/examples/sites_ftp_user_update.php
+++ b/remoting_client/examples/sites_ftp_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to no
 	$ftp_user_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_ftp_user_update($session_id, $client_id, $ftp_user_id, $ftp_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_shell_user_add.php b/remoting_client/examples/sites_shell_user_add.php
index 1a75727..84d4012 100644
--- a/remoting_client/examples/sites_shell_user_add.php
+++ b/remoting_client/examples/sites_shell_user_add.php
@@ -1,46 +1,46 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 3;
-	
+
 	$params = array(
-			'server_id' => 1,
-			'parent_domain_id' => 1,
-			'username' => 'threep2',
-			'password' => 'wood',
-			'quota_size' => 10000,
-			'active' => 'y',
-			'puser' => 'null',
-			'pgroup' => 'null',
-			'shell' => '/bin/bash',
-			'dir' => 'maybe',
-			'chroot' => ''
-			);
-	
+		'server_id' => 1,
+		'parent_domain_id' => 1,
+		'username' => 'threep2',
+		'password' => 'wood',
+		'quota_size' => 10000,
+		'active' => 'y',
+		'puser' => 'null',
+		'pgroup' => 'null',
+		'shell' => '/bin/bash',
+		'dir' => 'maybe',
+		'chroot' => ''
+	);
+
 	$affected_rows = $client->sites_shell_user_add($session_id, $client_id, $params);
-	
+
 	echo "Shell User ID: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_shell_user_delete.php b/remoting_client/examples/sites_shell_user_delete.php
index b15e3dc..fbc86ae 100644
--- a/remoting_client/examples/sites_shell_user_delete.php
+++ b/remoting_client/examples/sites_shell_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->sites_shell_user_delete($session_id, $shell_user_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_shell_user_get.php b/remoting_client/examples/sites_shell_user_get.php
index ba10cc7..5e59c1a 100644
--- a/remoting_client/examples/sites_shell_user_get.php
+++ b/remoting_client/examples/sites_shell_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$shell_user_id = 1;
-	
+
 	$shell_user_record = $client->sites_shell_user_get($session_id, $shell_user_id);
 
 	print_r($shell_user_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_shell_user_update.php b/remoting_client/examples/sites_shell_user_update.php
index a8976cc..73b9013 100644
--- a/remoting_client/examples/sites_shell_user_update.php
+++ b/remoting_client/examples/sites_shell_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change active to no
 	$shell_user_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_shell_user_update($session_id, $client_id, $shell_user_id, $shell_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_aliasdomain_add.php b/remoting_client/examples/sites_web_aliasdomain_add.php
index 8ff90df..c459e47 100644
--- a/remoting_client/examples/sites_web_aliasdomain_add.php
+++ b/remoting_client/examples/sites_web_aliasdomain_add.php
@@ -1,75 +1,75 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'ip_address' => '',
-			'domain' => 'tssssst.int',
-			'type' => 'alias',
-			'parent_domain_id' => 1,
-			'vhost_type' => '',
-			'document_root' => '/web/dom',
-			'system_user' => 'benutzer',
-			'system_group' => 'gruppe',
-			'hd_quota' => 100000,
-			'traffic_quota' => -1,
-			'cgi' => 'y',
-			'ssi' => 'y',
-			'suexec' => 'y',
-			'errordocs' => 1,
-			'is_subdomainwww' => 1,
-			'subdomain' => '',
-			'php' => 'y',
-			'ruby' => 'n',
-			'redirect_type' => '',
-			'redirect_path' => '',
-			'ssl' => 'n',
-			'ssl_state' => '',
-			'ssl_locality' => '',
-			'ssl_organisation' => '',
-			'ssl_organisation_unit' => '',
-			'ssl_country' => '',
-			'ssl_domain' => '',
-			'ssl_request' => '',
-			'ssl_cert' => '',
-			'ssl_bundle' => '',
-			'ssl_action' => '',
-			'stats_password' => '',
-			'stats_type' => 'webalizer',
-			'allow_override' => 'All',
-			'apache_directives' => '',
-			'php_open_basedir' => '/php',
-			'custom_php_ini' => '',
-			'backup_interval' => '',
-			'backup_copies' => 1,
-			'active' => 'y',
-			'traffic_quota_lock' => 'n'
-			);
-	
+		'server_id' => 1,
+		'ip_address' => '',
+		'domain' => 'tssssst.int',
+		'type' => 'alias',
+		'parent_domain_id' => 1,
+		'vhost_type' => '',
+		'document_root' => '/web/dom',
+		'system_user' => 'benutzer',
+		'system_group' => 'gruppe',
+		'hd_quota' => 100000,
+		'traffic_quota' => -1,
+		'cgi' => 'y',
+		'ssi' => 'y',
+		'suexec' => 'y',
+		'errordocs' => 1,
+		'is_subdomainwww' => 1,
+		'subdomain' => '',
+		'php' => 'y',
+		'ruby' => 'n',
+		'redirect_type' => '',
+		'redirect_path' => '',
+		'ssl' => 'n',
+		'ssl_state' => '',
+		'ssl_locality' => '',
+		'ssl_organisation' => '',
+		'ssl_organisation_unit' => '',
+		'ssl_country' => '',
+		'ssl_domain' => '',
+		'ssl_request' => '',
+		'ssl_cert' => '',
+		'ssl_bundle' => '',
+		'ssl_action' => '',
+		'stats_password' => '',
+		'stats_type' => 'webalizer',
+		'allow_override' => 'All',
+		'apache_directives' => '',
+		'php_open_basedir' => '/php',
+		'custom_php_ini' => '',
+		'backup_interval' => '',
+		'backup_copies' => 1,
+		'active' => 'y',
+		'traffic_quota_lock' => 'n'
+	);
+
 	$aliasdomain_id = $client->sites_web_aliasdomain_add($session_id, $client_id, $params);
 
 	echo "Aliasdomain ID: ".$aliasdomain_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_aliasdomain_delete.php b/remoting_client/examples/sites_web_aliasdomain_delete.php
index d60acff..75c0062 100644
--- a/remoting_client/examples/sites_web_aliasdomain_delete.php
+++ b/remoting_client/examples/sites_web_aliasdomain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->sites_web_aliasdomain_delete($session_id, $aliasdomain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_aliasdomain_get.php b/remoting_client/examples/sites_web_aliasdomain_get.php
index 9278619..e2270b9 100644
--- a/remoting_client/examples/sites_web_aliasdomain_get.php
+++ b/remoting_client/examples/sites_web_aliasdomain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$aliasdomain_id = 8;
-	
+
 	$aliasdomain_record = $client->sites_web_aliasdomain_get($session_id, $aliasdomain_id);
 
 	print_r($aliasdomain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_aliasdomain_update.php b/remoting_client/examples/sites_web_aliasdomain_update.php
index cf114dc..bfd30a4 100644
--- a/remoting_client/examples/sites_web_aliasdomain_update.php
+++ b/remoting_client/examples/sites_web_aliasdomain_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$aliasdomain_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_web_aliasdomain_update($session_id, $client_id, $aliasdomain_id, $aliasdomain_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_add.php b/remoting_client/examples/sites_web_domain_add.php
index 9481cd3..fa08aa6 100644
--- a/remoting_client/examples/sites_web_domain_add.php
+++ b/remoting_client/examples/sites_web_domain_add.php
@@ -1,74 +1,74 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
-	
+
 	$params = array(
-			'server_id' => 1,
-			'ip_address' => '*',
-			'domain' => 'test2.int',
-			'type' => 'vhost',
-			'parent_domain_id' => 0,
-			'vhost_type' => 'name',
-			'hd_quota' => 100000,
-			'traffic_quota' => -1,
-			'cgi' => 'y',
-			'ssi' => 'y',
-			'suexec' => 'y',
-			'errordocs' => 1,
-			'is_subdomainwww' => 1,
-			'subdomain' => '',
-			'php' => 'y',
-			'ruby' => 'n',
-			'redirect_type' => '',
-			'redirect_path' => '',
-			'ssl' => 'n',
-			'ssl_state' => '',
-			'ssl_locality' => '',
-			'ssl_organisation' => '',
-			'ssl_organisation_unit' => '',
-			'ssl_country' => '',
-			'ssl_domain' => '',
-			'ssl_request' => '',
-			'ssl_cert' => '',
-			'ssl_bundle' => '',
-			'ssl_action' => '',
-			'stats_password' => '',
-			'stats_type' => 'webalizer',
-			'allow_override' => 'All',
-			'apache_directives' => '',
-			'php_open_basedir' => '/',
-			'custom_php_ini' => '',
-			'backup_interval' => '',
-			'backup_copies' => 1,
-			'active' => 'y',
-			'traffic_quota_lock' => 'n'
-			);
-	
+		'server_id' => 1,
+		'ip_address' => '*',
+		'domain' => 'test2.int',
+		'type' => 'vhost',
+		'parent_domain_id' => 0,
+		'vhost_type' => 'name',
+		'hd_quota' => 100000,
+		'traffic_quota' => -1,
+		'cgi' => 'y',
+		'ssi' => 'y',
+		'suexec' => 'y',
+		'errordocs' => 1,
+		'is_subdomainwww' => 1,
+		'subdomain' => '',
+		'php' => 'y',
+		'ruby' => 'n',
+		'redirect_type' => '',
+		'redirect_path' => '',
+		'ssl' => 'n',
+		'ssl_state' => '',
+		'ssl_locality' => '',
+		'ssl_organisation' => '',
+		'ssl_organisation_unit' => '',
+		'ssl_country' => '',
+		'ssl_domain' => '',
+		'ssl_request' => '',
+		'ssl_cert' => '',
+		'ssl_bundle' => '',
+		'ssl_action' => '',
+		'stats_password' => '',
+		'stats_type' => 'webalizer',
+		'allow_override' => 'All',
+		'apache_directives' => '',
+		'php_open_basedir' => '/',
+		'custom_php_ini' => '',
+		'backup_interval' => '',
+		'backup_copies' => 1,
+		'active' => 'y',
+		'traffic_quota_lock' => 'n'
+	);
+
 	$affected_rows = $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false);
-	
+
 	echo "Web Domain ID: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_delete.php b/remoting_client/examples/sites_web_domain_delete.php
index 92fa127..0f7ac23 100644
--- a/remoting_client/examples/sites_web_domain_delete.php
+++ b/remoting_client/examples/sites_web_domain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->sites_web_domain_delete($session_id, $domain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_get.php b/remoting_client/examples/sites_web_domain_get.php
index dfef84a..7f5b22f 100644
--- a/remoting_client/examples/sites_web_domain_get.php
+++ b/remoting_client/examples/sites_web_domain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain_id = 2;
-	
+
 	$domain_record = $client->sites_web_domain_get($session_id, $domain_id);
 
 	print_r($domain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_set_status.php b/remoting_client/examples/sites_web_domain_set_status.php
index 82dddfe..809e115 100644
--- a/remoting_client/examples/sites_web_domain_set_status.php
+++ b/remoting_client/examples/sites_web_domain_set_status.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$status = 'active';
 	$primary_id = 1;
-	
+
 	$record_record = $client->sites_web_domain_set_status($session_id, $primary_id, $status);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_update.php b/remoting_client/examples/sites_web_domain_update.php
index c26d8a1..c951764 100644
--- a/remoting_client/examples/sites_web_domain_update.php
+++ b/remoting_client/examples/sites_web_domain_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -27,16 +27,16 @@
 	$domain_record['document_root'] = '/web/doc';
 	$domain_record['allow_override'] = 'All';
 	$domain_record['php_open_basedir'] = '/php';
-	
+
 	$affected_rows = $client->sites_web_domain_update($session_id, $client_id, $domain_id, $domain_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_subdomain_add.php b/remoting_client/examples/sites_web_subdomain_add.php
index 344db18..ac31938 100644
--- a/remoting_client/examples/sites_web_subdomain_add.php
+++ b/remoting_client/examples/sites_web_subdomain_add.php
@@ -1,75 +1,75 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'ip_address' => '',
-			'domain' => 'tsssssubt.int',
-			'type' => 'subdomain',
-			'parent_domain_id' => 1,
-			'vhost_type' => '',
-			'document_root' => '/web/dom',
-			'system_user' => 'benutzer',
-			'system_group' => 'gruppe',
-			'hd_quota' => 100000,
-			'traffic_quota' => -1,
-			'cgi' => 'y',
-			'ssi' => 'y',
-			'suexec' => 'y',
-			'errordocs' => 1,
-			'is_subdomainwww' => 1,
-			'subdomain' => '',
-			'php' => 'y',
-			'ruby' => 'n',
-			'redirect_type' => '',
-			'redirect_path' => '',
-			'ssl' => 'n',
-			'ssl_state' => '',
-			'ssl_locality' => '',
-			'ssl_organisation' => '',
-			'ssl_organisation_unit' => '',
-			'ssl_country' => '',
-			'ssl_domain' => '',
-			'ssl_request' => '',
-			'ssl_cert' => '',
-			'ssl_bundle' => '',
-			'ssl_action' => '',
-			'stats_password' => '',
-			'stats_type' => 'webalizer',
-			'allow_override' => 'All',
-			'apache_directives' => '',
-			'php_open_basedir' => '/php',
-			'custom_php_ini' => '',
-			'backup_interval' => '',
-			'backup_copies' => 1,
-			'active' => 'y',
-			'traffic_quota_lock' => 'n'
-			);
-	
+		'server_id' => 1,
+		'ip_address' => '',
+		'domain' => 'tsssssubt.int',
+		'type' => 'subdomain',
+		'parent_domain_id' => 1,
+		'vhost_type' => '',
+		'document_root' => '/web/dom',
+		'system_user' => 'benutzer',
+		'system_group' => 'gruppe',
+		'hd_quota' => 100000,
+		'traffic_quota' => -1,
+		'cgi' => 'y',
+		'ssi' => 'y',
+		'suexec' => 'y',
+		'errordocs' => 1,
+		'is_subdomainwww' => 1,
+		'subdomain' => '',
+		'php' => 'y',
+		'ruby' => 'n',
+		'redirect_type' => '',
+		'redirect_path' => '',
+		'ssl' => 'n',
+		'ssl_state' => '',
+		'ssl_locality' => '',
+		'ssl_organisation' => '',
+		'ssl_organisation_unit' => '',
+		'ssl_country' => '',
+		'ssl_domain' => '',
+		'ssl_request' => '',
+		'ssl_cert' => '',
+		'ssl_bundle' => '',
+		'ssl_action' => '',
+		'stats_password' => '',
+		'stats_type' => 'webalizer',
+		'allow_override' => 'All',
+		'apache_directives' => '',
+		'php_open_basedir' => '/php',
+		'custom_php_ini' => '',
+		'backup_interval' => '',
+		'backup_copies' => 1,
+		'active' => 'y',
+		'traffic_quota_lock' => 'n'
+	);
+
 	$subdomain_id = $client->sites_web_subdomain_add($session_id, $client_id, $params);
 
 	echo "Subdomain ID: ".$subdomain_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_subdomain_delete.php b/remoting_client/examples/sites_web_subdomain_delete.php
index be167cc..6a06286 100644
--- a/remoting_client/examples/sites_web_subdomain_delete.php
+++ b/remoting_client/examples/sites_web_subdomain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@
 	$affected_rows = $client->sites_web_subdomain_delete($session_id, $subdomain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_subdomain_get.php b/remoting_client/examples/sites_web_subdomain_get.php
index a86ae8d..12120fc 100644
--- a/remoting_client/examples/sites_web_subdomain_get.php
+++ b/remoting_client/examples/sites_web_subdomain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$subdomain_id = 10;
-	
+
 	$subdomain_record = $client->sites_web_subdomain_get($session_id, $subdomain_id);
 
 	print_r($subdomain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_subdomain_update.php b/remoting_client/examples/sites_web_subdomain_update.php
index ee5ed35..2a9f91a 100644
--- a/remoting_client/examples/sites_web_subdomain_update.php
+++ b/remoting_client/examples/sites_web_subdomain_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@
 
 	//* Change the status to inactive
 	$subdomain_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_web_subdomain_update($session_id, $client_id, $subdomain_id, $subdomain_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/soap-database-add.php b/remoting_client/examples/soap-database-add.php
index 3f636f1..5ff7e4b 100644
--- a/remoting_client/examples/soap-database-add.php
+++ b/remoting_client/examples/soap-database-add.php
@@ -7,42 +7,41 @@
 $soap_uri = 'http://localhost:8080/remote/';
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri));
+		'uri'      => $soap_uri));
 try {
-    if($session_id = $client->login($username,$password)) {
-                    echo "Logged:".$session_id."<br />\n";
-}
+	if($session_id = $client->login($username, $password)) {
+		echo "Logged:".$session_id."<br />\n";
+	}
 
-$database_type = 'mysql'; //Only mysql type avaliable more types coming soon.
-$database_name = 'yourdbname';
-$database_username = 'yourusername';
-$database_password = 'yourpassword';
-$database_charset = ''; // blank = db default, latin1 or utf8
-$database_remoteips = ''; //remote ip´s separated by commas
+	$database_type = 'mysql'; //Only mysql type avaliable more types coming soon.
+	$database_name = 'yourdbname';
+	$database_username = 'yourusername';
+	$database_password = 'yourpassword';
+	$database_charset = ''; // blank = db default, latin1 or utf8
+	$database_remoteips = ''; //remote ip´s separated by commas
 
-$params = array(
-          'server_id' => 1,
-                'type' => $database_type,
-                'database_name' => $database_name,
-                'database_user' => $database_username,
-                'database_password' => $database_password,
-                'database_charset' =>  $database_charset,
-                'remote_access' => 'n', // n disabled - y enabled
-                'active' => 'y', // n disabled - y enabled
-                'remote_ips' => $database_remoteips
-                );
+	$params = array(
+		'server_id' => 1,
+		'type' => $database_type,
+		'database_name' => $database_name,
+		'database_user' => $database_username,
+		'database_password' => $database_password,
+		'database_charset' =>  $database_charset,
+		'remote_access' => 'n', // n disabled - y enabled
+		'active' => 'y', // n disabled - y enabled
+		'remote_ips' => $database_remoteips
+	);
 
-$client_id = 1;
-$database_id = $client->sites_database_add($session_id, $client_id, $params);
+	$client_id = 1;
+	$database_id = $client->sites_database_add($session_id, $client_id, $params);
 
-if($client->logout($session_id)) {
-    echo "Logout.<br />\n";
-}
+	if($client->logout($session_id)) {
+		echo "Logout.<br />\n";
+	}
 
 
 } catch (SoapFault $e) {
-        die('Error: '.$e->getMessage());
+	die('Error: '.$e->getMessage());
 }
 
 ?>
-
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 5dad54d..60f3c21 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -29,8 +29,8 @@
 */
 
 define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"]));
-require(SCRIPT_PATH."/lib/config.inc.php");
-require(SCRIPT_PATH."/lib/app.inc.php");
+require SCRIPT_PATH."/lib/config.inc.php";
+require SCRIPT_PATH."/lib/app.inc.php";
 
 set_time_limit(0);
 ini_set('error_reporting', E_ALL & ~E_NOTICE);
@@ -43,9 +43,9 @@
 $app->uses('ini_parser,file,services,getconf,system');
 
 
-#######################################################################################################
+//######################################################################################################
 // store the mailbox statistics in the database
-#######################################################################################################
+//######################################################################################################
 
 $parse_mail_log = false;
 $sql = "SELECT mailuser_id,maildir FROM mail_user WHERE server_id = ".$conf['server_id'];
@@ -54,10 +54,10 @@
 
 foreach($records as $rec) {
 	if(@is_file($rec['maildir'].'/ispconfig_mailsize')) {
-        $parse_mail_log = false;
-        
+		$parse_mail_log = false;
+
 		// rename file
-		rename($rec['maildir'].'/ispconfig_mailsize',$rec['maildir'].'/ispconfig_mailsize_save');
+		rename($rec['maildir'].'/ispconfig_mailsize', $rec['maildir'].'/ispconfig_mailsize_save');
 
 		// Read the file
 		$lines = file($rec['maildir'].'/ispconfig_mailsize_save');
@@ -90,163 +90,163 @@
 }
 
 if($parse_mail_log == true) {
-    $mailbox_traffic = array();
-    $mail_boxes = array();
-    $mail_rewrites = array(); // we need to read all mail aliases and forwards because the address in amavis is not always the mailbox address
-    
-    function parse_mail_log_line($line) {
-        //Oct 31 17:35:48 mx01 amavis[32014]: (32014-05) Passed CLEAN, [IPv6:xxxxx] [IPv6:xxxxx] <xxx@yyyy> -> <aaaa@bbbb>, Message-ID: <xxxx@yyyyy>, mail_id: xxxxxx, Hits: -1.89, size: 1591, queued_as: xxxxxxx, 946 ms
-        
-        if(preg_match('/^(\w+\s+\d+\s+\d+:\d+:\d+)\s+[^ ]+\s+amavis.* <([^>]+)>\s+->\s+((<[^>]+>,)+) .*Message-ID:\s+<([^>]+)>.* size:\s+(\d+),.*$/', $line, $matches) == false) return false;
-        
-        $timestamp = strtotime($matches[1]);
-        if(!$timestamp) return false;
-        
-        $to = array();
-        $recipients = explode(',', $matches[3]);
-        foreach($recipients as $recipient) {
-            $recipient = substr($recipient, 1, -1);
-            if(!$recipient || $recipient == $matches[2]) continue;
-            $to[] = $recipient;
-        }
-        
-        return array('line' => $line, 'timestamp' => $timestamp, 'size' => $matches[6], 'from' => $matches[2], 'to' => $to, 'message-id' => $matches[5]);
-    }
+	$mailbox_traffic = array();
+	$mail_boxes = array();
+	$mail_rewrites = array(); // we need to read all mail aliases and forwards because the address in amavis is not always the mailbox address
 
-    function add_mailbox_traffic(&$traffic_array, $address, $traffic) {
-        global $mail_boxes, $mail_rewrites;
-        
-        $address = strtolower($address);
-        
-        if(in_array($address, $mail_boxes) == true) {
-            if(!isset($traffic_array[$address])) $traffic_array[$address] = 0;
-            $traffic_array[$address] += $traffic;
-        } elseif(array_key_exists($address, $mail_rewrites)) {
-            foreach($mail_rewrites[$address] as $address) {
-                if(!isset($traffic_array[$address])) $traffic_array[$address] = 0;
-                $traffic_array[$address] += $traffic;
-            }
-        } else {
-            // this is not a local address - skip it
-        }
-    }
+	function parse_mail_log_line($line) {
+		//Oct 31 17:35:48 mx01 amavis[32014]: (32014-05) Passed CLEAN, [IPv6:xxxxx] [IPv6:xxxxx] <xxx@yyyy> -> <aaaa@bbbb>, Message-ID: <xxxx@yyyyy>, mail_id: xxxxxx, Hits: -1.89, size: 1591, queued_as: xxxxxxx, 946 ms
 
-    $sql = "SELECT email FROM mail_user WHERE server_id = ".$conf['server_id'];
-    $records = $app->db->queryAllRecords($sql);
-    foreach($records as $record) {
-        $mail_boxes[] = $record['email'];
-    }
-    $sql = "SELECT source, destination FROM mail_forwarding WHERE server_id = ".$conf['server_id'];
-    $records = $app->db->queryAllRecords($sql);
-    foreach($records as $record) {
-        $targets = preg_split('/[\n,]+/', $record['destination']);
-        foreach($targets as $target) {
-            if(in_array($target, $mail_boxes)) {
-                if(isset($mail_rewrites[$record['source']])) $mail_rewrites[$record['source']][] = $target;
-                else $mail_rewrites[$record['source']] = array($target);
-            }
-        }
-    }
-    
-    $state_file = dirname(__FILE__) . '/mail_log_parser.state';
-    $prev_line = false;
-    $last_line = false;
-    $cur_line = false;
-    
-    if(file_exists($state_file)) {
-        $prev_line = parse_mail_log_line(trim(file_get_contents($state_file)));
-        //if($prev_line) echo "continuing from previous run, log position: " . $prev_line['message-id'] . " at " . strftime('%d.%m.%Y %H:%M:%S', $prev_line['timestamp']) . "\n";
-    }
-    
-    if(file_exists('/var/log/mail.log')) {
-        $fp = fopen('/var/log/mail.log', 'r');
-        //echo "Parsing mail.log...\n";
-        $l = 0;
-        while($line = fgets($fp, 8192)) {
-            $l++;
-            //if($l % 1000 == 0) echo "\rline $l";
-            $cur_line = parse_mail_log_line($line);
-            if(!$cur_line) continue;
-            
-            if($prev_line) {
-                // check if this line has to be processed
-                if($cur_line['timestamp'] < $prev_line['timestamp']) {
-                    $parse_mail_log = false; // we do not need to parse the second file!
-                    continue; // already processed
-                } elseif($cur_line['timestamp'] == $prev_line['timestamp'] && $cur_line['message-id'] == $prev_line['message-id']) {
-                    $parse_mail_log = false; // we do not need to parse the second file!
-                    $prev_line = false; // this line has already been processed but the next one has to be!
-                    continue;
-                }
-            }
-            
-            add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']);
-            foreach($cur_line['to'] as $to) {
-                add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']);
-            }
-            $last_line = $line; // store for the state file
-        }
-        fclose($fp);
-        //echo "\n";
-    }
-    
-    if($parse_mail_log == true && file_exists('/var/log/mail.log.1')) {
-        $fp = fopen('/var/log/mail.log.1', 'r');
-        //echo "Parsing mail.log.1...\n";
-        $l = 0;
-        while($line = fgets($fp, 8192)) {
-            $l++;
-            //if($l % 1000 == 0) echo "\rline $l";
-            $cur_line = parse_mail_log_line($line);
-            if(!$cur_line) continue;
-            
-            if($prev_line) {
-                // check if this line has to be processed
-                if($cur_line['timestamp'] < $prev_line['timestamp']) continue; // already processed
-                if($cur_line['timestamp'] == $prev_line['timestamp'] && $cur_line['message-id'] == $prev_line['message-id']) {
-                    $prev_line = false; // this line has already been processed but the next one has to be!
-                    continue;
-                }
-            }
-            
-            add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']);
-            foreach($cur_line['to'] as $to) {
-                add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']);
-            }
-        }
-        fclose($fp);
-        //echo "\n";
-    }
-    unset($mail_rewrites);
-    unset($mail_boxes);
-    
-    // Save the traffic stats in the sql database
-    $tstamp = date('Y-m');
-    $sql = "SELECT mailuser_id,email FROM mail_user WHERE server_id = ".$conf['server_id'];
-    $records = $app->db->queryAllRecords($sql);
-    foreach($records as $rec) {
-        if(array_key_exists($rec['email'], $mailbox_traffic)) {
-            $sql = "SELECT * FROM mail_traffic WHERE month = '$tstamp' AND mailuser_id = ".$rec['mailuser_id'];
-            $tr = $app->dbmaster->queryOneRecord($sql);
+		if(preg_match('/^(\w+\s+\d+\s+\d+:\d+:\d+)\s+[^ ]+\s+amavis.* <([^>]+)>\s+->\s+((<[^>]+>,)+) .*Message-ID:\s+<([^>]+)>.* size:\s+(\d+),.*$/', $line, $matches) == false) return false;
 
-            $mail_traffic = $tr['traffic'] + $mailbox_traffic[$rec['email']];
-            if($tr['traffic_id'] > 0) {
-                $sql = "UPDATE mail_traffic SET traffic = $mail_traffic WHERE traffic_id = ".$tr['traffic_id'];
-            } else {
-                $sql = "INSERT INTO mail_traffic (month,mailuser_id,traffic) VALUES ('$tstamp',".$rec['mailuser_id'].",$mail_traffic)";
-            }
-            $app->dbmaster->query($sql);
-            //echo $sql;
-        }
-    }
-    
-    unset($mailbox_traffic);
-    if($last_line) file_put_contents($state_file, $last_line);
+		$timestamp = strtotime($matches[1]);
+		if(!$timestamp) return false;
+
+		$to = array();
+		$recipients = explode(',', $matches[3]);
+		foreach($recipients as $recipient) {
+			$recipient = substr($recipient, 1, -1);
+			if(!$recipient || $recipient == $matches[2]) continue;
+			$to[] = $recipient;
+		}
+
+		return array('line' => $line, 'timestamp' => $timestamp, 'size' => $matches[6], 'from' => $matches[2], 'to' => $to, 'message-id' => $matches[5]);
+	}
+
+	function add_mailbox_traffic(&$traffic_array, $address, $traffic) {
+		global $mail_boxes, $mail_rewrites;
+
+		$address = strtolower($address);
+
+		if(in_array($address, $mail_boxes) == true) {
+			if(!isset($traffic_array[$address])) $traffic_array[$address] = 0;
+			$traffic_array[$address] += $traffic;
+		} elseif(array_key_exists($address, $mail_rewrites)) {
+			foreach($mail_rewrites[$address] as $address) {
+				if(!isset($traffic_array[$address])) $traffic_array[$address] = 0;
+				$traffic_array[$address] += $traffic;
+			}
+		} else {
+			// this is not a local address - skip it
+		}
+	}
+
+	$sql = "SELECT email FROM mail_user WHERE server_id = ".$conf['server_id'];
+	$records = $app->db->queryAllRecords($sql);
+	foreach($records as $record) {
+		$mail_boxes[] = $record['email'];
+	}
+	$sql = "SELECT source, destination FROM mail_forwarding WHERE server_id = ".$conf['server_id'];
+	$records = $app->db->queryAllRecords($sql);
+	foreach($records as $record) {
+		$targets = preg_split('/[\n,]+/', $record['destination']);
+		foreach($targets as $target) {
+			if(in_array($target, $mail_boxes)) {
+				if(isset($mail_rewrites[$record['source']])) $mail_rewrites[$record['source']][] = $target;
+				else $mail_rewrites[$record['source']] = array($target);
+			}
+		}
+	}
+
+	$state_file = dirname(__FILE__) . '/mail_log_parser.state';
+	$prev_line = false;
+	$last_line = false;
+	$cur_line = false;
+
+	if(file_exists($state_file)) {
+		$prev_line = parse_mail_log_line(trim(file_get_contents($state_file)));
+		//if($prev_line) echo "continuing from previous run, log position: " . $prev_line['message-id'] . " at " . strftime('%d.%m.%Y %H:%M:%S', $prev_line['timestamp']) . "\n";
+	}
+
+	if(file_exists('/var/log/mail.log')) {
+		$fp = fopen('/var/log/mail.log', 'r');
+		//echo "Parsing mail.log...\n";
+		$l = 0;
+		while($line = fgets($fp, 8192)) {
+			$l++;
+			//if($l % 1000 == 0) echo "\rline $l";
+			$cur_line = parse_mail_log_line($line);
+			if(!$cur_line) continue;
+
+			if($prev_line) {
+				// check if this line has to be processed
+				if($cur_line['timestamp'] < $prev_line['timestamp']) {
+					$parse_mail_log = false; // we do not need to parse the second file!
+					continue; // already processed
+				} elseif($cur_line['timestamp'] == $prev_line['timestamp'] && $cur_line['message-id'] == $prev_line['message-id']) {
+					$parse_mail_log = false; // we do not need to parse the second file!
+					$prev_line = false; // this line has already been processed but the next one has to be!
+					continue;
+				}
+			}
+
+			add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']);
+			foreach($cur_line['to'] as $to) {
+				add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']);
+			}
+			$last_line = $line; // store for the state file
+		}
+		fclose($fp);
+		//echo "\n";
+	}
+
+	if($parse_mail_log == true && file_exists('/var/log/mail.log.1')) {
+		$fp = fopen('/var/log/mail.log.1', 'r');
+		//echo "Parsing mail.log.1...\n";
+		$l = 0;
+		while($line = fgets($fp, 8192)) {
+			$l++;
+			//if($l % 1000 == 0) echo "\rline $l";
+			$cur_line = parse_mail_log_line($line);
+			if(!$cur_line) continue;
+
+			if($prev_line) {
+				// check if this line has to be processed
+				if($cur_line['timestamp'] < $prev_line['timestamp']) continue; // already processed
+				if($cur_line['timestamp'] == $prev_line['timestamp'] && $cur_line['message-id'] == $prev_line['message-id']) {
+					$prev_line = false; // this line has already been processed but the next one has to be!
+					continue;
+				}
+			}
+
+			add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']);
+			foreach($cur_line['to'] as $to) {
+				add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']);
+			}
+		}
+		fclose($fp);
+		//echo "\n";
+	}
+	unset($mail_rewrites);
+	unset($mail_boxes);
+
+	// Save the traffic stats in the sql database
+	$tstamp = date('Y-m');
+	$sql = "SELECT mailuser_id,email FROM mail_user WHERE server_id = ".$conf['server_id'];
+	$records = $app->db->queryAllRecords($sql);
+	foreach($records as $rec) {
+		if(array_key_exists($rec['email'], $mailbox_traffic)) {
+			$sql = "SELECT * FROM mail_traffic WHERE month = '$tstamp' AND mailuser_id = ".$rec['mailuser_id'];
+			$tr = $app->dbmaster->queryOneRecord($sql);
+
+			$mail_traffic = $tr['traffic'] + $mailbox_traffic[$rec['email']];
+			if($tr['traffic_id'] > 0) {
+				$sql = "UPDATE mail_traffic SET traffic = $mail_traffic WHERE traffic_id = ".$tr['traffic_id'];
+			} else {
+				$sql = "INSERT INTO mail_traffic (month,mailuser_id,traffic) VALUES ('$tstamp',".$rec['mailuser_id'].",$mail_traffic)";
+			}
+			$app->dbmaster->query($sql);
+			//echo $sql;
+		}
+	}
+
+	unset($mailbox_traffic);
+	if($last_line) file_put_contents($state_file, $last_line);
 }
 
-#######################################################################################################
+//######################################################################################################
 // Create webalizer statistics
-#######################################################################################################
+//######################################################################################################
 
 function setConfigVar( $filename, $varName, $varValue, $append = 0 ) {
 	if($lines = @file($filename)) {
@@ -263,12 +263,12 @@
 		}
 		if($found == 0) {
 			//* add \n if the last line does not end with \n or \r
-			if(substr($out,-1) != "\n" && substr($out,-1) != "\r") $out .= "\n";
+			if(substr($out, -1) != "\n" && substr($out, -1) != "\r") $out .= "\n";
 			//* add the new line at the end of the file
 			if($append == 1) $out .= $varName.' '.$varValue."\n";
 		}
 
-		file_put_contents($filename,$out);
+		file_put_contents($filename, $out);
 	}
 }
 
@@ -278,17 +278,17 @@
 
 foreach($records as $rec) {
 	//$yesterday = date('Ymd',time() - 86400);
-	$yesterday = date('Ymd',strtotime("-1 day", time()));
-	
-    $log_folder = 'log';
-    if($rec['type'] == 'vhostsubdomain') {
-        $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
-        $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
-        if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
-        $log_folder .= '/' . $subdomain_host;
-        unset($tmp);
-    }
-    $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
+	$yesterday = date('Ymd', strtotime("-1 day", time()));
+
+	$log_folder = 'log';
+	if($rec['type'] == 'vhostsubdomain') {
+		$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
+		$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
+		if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
+		$log_folder .= '/' . $subdomain_host;
+		unset($tmp);
+	}
+	$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
 	if(!@is_file($logfile)) {
 		$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log.gz');
 		if(!@is_file($logfile)) {
@@ -305,7 +305,7 @@
 	if(is_file($statsdir.'/index.php')) unlink($statsdir.'/index.php');
 
 	if(!@is_file($webalizer_conf)) {
-		copy($webalizer_conf_main,$webalizer_conf);
+		copy($webalizer_conf_main, $webalizer_conf);
 	}
 
 	if(@is_file($webalizer_conf)) {
@@ -319,9 +319,9 @@
 	exec("$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir $logfile");
 }
 
-#######################################################################################################
+//######################################################################################################
 // Create awstats statistics
-#######################################################################################################
+//######################################################################################################
 
 $sql = "SELECT domain_id, domain, document_root, web_folder, type, system_user, system_group, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') and stats_type = 'awstats' AND server_id = ".$conf['server_id'];
 $records = $app->db->queryAllRecords($sql);
@@ -330,24 +330,24 @@
 
 foreach($records as $rec) {
 	//$yesterday = date('Ymd',time() - 86400);
-	$yesterday = date('Ymd',strtotime("-1 day", time()));
-	
-    $log_folder = 'log';
-    if($rec['type'] == 'vhostsubdomain') {
-        $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
-        $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
-        if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
-        $log_folder .= '/' . $subdomain_host;
-        unset($tmp);
-    }
-    $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
+	$yesterday = date('Ymd', strtotime("-1 day", time()));
+
+	$log_folder = 'log';
+	if($rec['type'] == 'vhostsubdomain') {
+		$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
+		$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
+		if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
+		$log_folder .= '/' . $subdomain_host;
+		unset($tmp);
+	}
+	$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
 	if(!@is_file($logfile)) {
 		$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log.gz');
 		if(!@is_file($logfile)) {
 			continue;
 		}
 	}
-    $web_folder = ($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web');
+	$web_folder = ($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web');
 	$domain = escapeshellcmd($rec['domain']);
 	$statsdir = escapeshellcmd($rec['document_root'].'/'.$web_folder.'/stats');
 	$awstats_pl = $web_config['awstats_pl'];
@@ -373,12 +373,12 @@
 LogFile="/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log"
 SiteDomain="'.$domain.'"
 HostAliases="www.'.$domain.' localhost 127.0.0.1'.$aliasdomain.'"';
-		file_put_contents($awstats_website_conf_file,$awstats_conf_file_content);
+		file_put_contents($awstats_website_conf_file, $awstats_conf_file_content);
 	}
 
 	if(!@is_dir($statsdir)) mkdir($statsdir);
 	if(is_link('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log')) unlink('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
-	symlink($logfile,'/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
+	symlink($logfile, '/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
 
 	$awmonth = date("n");
 	$awyear = date("Y");
@@ -407,7 +407,7 @@
 		mkdir($statsdirold);
 		$files = scandir($statsdir);
 		foreach ($files as $file) {
-			if (substr($file,0,1) != "." && !is_dir("$statsdir"."/"."$file") && substr($file,0,1) != "w" && substr($file,0,1) != "i") copy("$statsdir"."/"."$file","$statsdirold"."$file");
+			if (substr($file, 0, 1) != "." && !is_dir("$statsdir"."/"."$file") && substr($file, 0, 1) != "w" && substr($file, 0, 1) != "i") copy("$statsdir"."/"."$file", "$statsdirold"."$file");
 		}
 	}
 
@@ -415,55 +415,55 @@
 	if($awstats_pl != '' && $awstats_buildstaticpages_pl != '' && fileowner($awstats_pl) == 0 && fileowner($awstats_buildstaticpages_pl) == 0) {
 		exec($command);
 		if(is_file($rec['document_root'].'/'.$web_folder.'/stats/index.html')) unlink($rec['document_root'].'/'.$web_folder.'/stats/index.html');
-		rename($rec['document_root'].'/'.$web_folder.'/stats/awstats.'.$domain.'.html',$rec['document_root'].'/'.$web_folder.'/stats/awsindex.html');
+		rename($rec['document_root'].'/'.$web_folder.'/stats/awstats.'.$domain.'.html', $rec['document_root'].'/'.$web_folder.'/stats/awsindex.html');
 		if(!is_file($rec['document_root']."/".$web_folder."/stats/index.php")) {
 			if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
-				copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
+				copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $rec['document_root']."/".$web_folder."/stats/index.php");
 			} else {
-				copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
+				copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $rec['document_root']."/".$web_folder."/stats/index.php");
 			}
 		}
 
-		$app->log('Created awstats statistics with command: '.$command,LOGLEVEL_DEBUG);
+		$app->log('Created awstats statistics with command: '.$command, LOGLEVEL_DEBUG);
 	} else {
-		$app->log("No awstats statistics created. Either $awstats_pl or $awstats_buildstaticpages_pl is not owned by root user.",LOGLEVEL_WARN);
+		$app->log("No awstats statistics created. Either $awstats_pl or $awstats_buildstaticpages_pl is not owned by root user.", LOGLEVEL_WARN);
 	}
 
 	if(is_file($rec['document_root']."/".$web_folder."/stats/index.php")) {
-		chown($rec['document_root']."/".$web_folder."/stats/index.php",$rec['system_user']);
-		chgrp($rec['document_root']."/".$web_folder."/stats/index.php",$rec['system_group']);
+		chown($rec['document_root']."/".$web_folder."/stats/index.php", $rec['system_user']);
+		chgrp($rec['document_root']."/".$web_folder."/stats/index.php", $rec['system_group']);
 	}
 
 }
 
 
-#######################################################################################################
+//######################################################################################################
 // Make the web logfiles directories world readable to enable ftp access
-#######################################################################################################
+//######################################################################################################
 
 if(is_dir('/var/log/ispconfig/httpd')) exec('chmod +r /var/log/ispconfig/httpd/*');
 
-#######################################################################################################
+//######################################################################################################
 // Manage and compress web logfiles and create traffic statistics
-#######################################################################################################
+//######################################################################################################
 
 $sql = "SELECT domain_id, domain, type, document_root, web_folder, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') AND server_id = ".$conf['server_id'];
 $records = $app->db->queryAllRecords($sql);
 foreach($records as $rec) {
 
 	//* create traffic statistics based on yesterdays access log file
-	$yesterday = date('Ymd',time() - 86400);
-	
-    $log_folder = 'log';
-    if($rec['type'] == 'vhostsubdomain') {
-        $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
-        $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
-        if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
-        $log_folder .= '/' . $subdomain_host;
-        unset($tmp);
-    }
-    
-    $logfile = $rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log';
+	$yesterday = date('Ymd', time() - 86400);
+
+	$log_folder = 'log';
+	if($rec['type'] == 'vhostsubdomain') {
+		$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
+		$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
+		if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
+		$log_folder .= '/' . $subdomain_host;
+		unset($tmp);
+	}
+
+	$logfile = $rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log';
 	$total_bytes = 0;
 
 	$handle = @fopen($logfile, "r");
@@ -475,13 +475,13 @@
 		}
 
 		//* Insert / update traffic in master database
-		$traffic_date = date('Y-m-d',time() - 86400);
+		$traffic_date = date('Y-m-d', time() - 86400);
 		$tmp = $app->dbmaster->queryOneRecord("select hostname from web_traffic where hostname='".$rec['domain']."' and traffic_date='".$traffic_date."'");
 		if(is_array($tmp) && count($tmp) > 0) {
 			$sql = "update web_traffic set traffic_bytes=traffic_bytes+"
-                  . $total_bytes
-                  . " where hostname='" . $rec['domain']
-                  . "' and traffic_date='" . $traffic_date . "'";
+				. $total_bytes
+				. " where hostname='" . $rec['domain']
+				. "' and traffic_date='" . $traffic_date . "'";
 		} else {
 			$sql = "insert into web_traffic (hostname, traffic_date, traffic_bytes) values ('".$rec['domain']."', '".$traffic_date."', '".$total_bytes."')";
 		}
@@ -490,7 +490,7 @@
 		fclose($handle);
 	}
 
-	$yesterday2 = date('Ymd',time() - 86400*2);
+	$yesterday2 = date('Ymd', time() - 86400*2);
 	$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday2.'-access.log');
 
 	//* Compress logfile
@@ -508,14 +508,14 @@
 	}
 
 	// delete logfiles after 30 days
-	$month_ago = date('Ymd',time() - 86400 * 30);
+	$month_ago = date('Ymd', time() - 86400 * 30);
 	$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$month_ago.'-access.log.gz');
 	if(@is_file($logfile)) {
 		unlink($logfile);
 	}
 
 	//* Delete older Log files, in case that we missed them before due to serverdowntimes.
-	$datepart = date('Ym',time() - 86400 * 31 * 2);
+	$datepart = date('Ym', time() - 86400 * 31 * 2);
 
 	$logfile = escapeshellcmd($rec['document_root']).'/' . $log_folder . '/'.$datepart.'*-access.log.gz';
 	exec('rm -f '.$logfile);
@@ -531,9 +531,9 @@
 }
 unset($tmp_hostname);
 
-#######################################################################################################
+//######################################################################################################
 // Rotate the ispconfig.log file
-#######################################################################################################
+//######################################################################################################
 
 // rotate the ispconfig.log when it exceeds a size of 10 MB
 $logfile = $conf['ispconfig_log_dir'].'/ispconfig.log';
@@ -556,9 +556,9 @@
 	exec("cat /dev/null > $logfile");
 }
 
-#######################################################################################################
+//######################################################################################################
 // Cleanup website tmp directories
-#######################################################################################################
+//######################################################################################################
 
 $sql = "SELECT domain_id, domain, document_root, system_user FROM web_domain WHERE server_id = ".$conf['server_id'];
 $records = $app->db->queryAllRecords($sql);
@@ -572,12 +572,14 @@
 	}
 }
 
-#######################################################################################################
+//######################################################################################################
 // Cleanup logs in master database (only the "master-server")
-#######################################################################################################
+//######################################################################################################
 
 if ($app->dbmaster == $app->db) {
 	/** 7 days */
+
+
 	$tstamp = time() - (60*60*24*7);
 
 	/*
@@ -598,9 +600,9 @@
 	$res = $app->dbmaster->queryOneRecord($sql);
 	$maxId = $res['max(action_id)'];
 	$sql =  "DELETE FROM sys_remoteaction " .
-			"WHERE tstamp < " . $tstamp . " " .
-			" AND action_state = 'ok' " .
-			" AND action_id <" . intval($maxId);
+		"WHERE tstamp < " . $tstamp . " " .
+		" AND action_state = 'ok' " .
+		" AND action_id <" . intval($maxId);
 	$app->dbmaster->query($sql);
 
 	/*
@@ -631,83 +633,83 @@
 	foreach($records as $server) {
 		$tmp_server_id = intval($server['server_id']);
 		if($tmp_server_id > 0) {
-			$sql = 	"DELETE FROM sys_datalog " .
-					"WHERE tstamp < " . $tstamp .
-					" AND server_id = " . intval($server['server_id']) .
-					" AND datalog_id < " . intval($server['updated']) .
-					" AND datalog_id < " . intval($maxId);
+			$sql =  "DELETE FROM sys_datalog " .
+				"WHERE tstamp < " . $tstamp .
+				" AND server_id = " . intval($server['server_id']) .
+				" AND datalog_id < " . intval($server['updated']) .
+				" AND datalog_id < " . intval($maxId);
 		}
-//		echo $sql . "\n";
+		//  echo $sql . "\n";
 		$app->dbmaster->query($sql);
 	}
 }
 
-#########
+//########
 // function for sending notification emails
-#########
+//########
 function send_notification_email($template, $placeholders, $recipients) {
-    global $conf;
-    
-    if(!is_array($recipients) || count($recipients) < 1) return false;
-    if(!is_array($placeholders)) $placeholders = array();
-    
-    if(file_exists($conf['rootpath'].'/conf-custom/mail/' . $template . '_'.$conf['language'].'.txt')) {
-        $lines = file($conf['rootpath'].'/conf-custom/mail/' . $template . '_'.$conf['language'].'.txt');
-    } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/' . $template . '_en.txt')) {
-        $lines = file($conf['rootpath'].'/conf-custom/mail/' . $template . '_en.txt');
-    } elseif(file_exists($conf['rootpath'].'/conf/mail/' . $template . '_'.$conf['language'].'.txt')) {
-        $lines = file($conf['rootpath'].'/conf/mail/' . $template . '_'.$conf['language'].'.txt');
-    } else {
-        $lines = file($conf['rootpath'].'/conf/mail/' . $template . '_en.txt');
-    }
-    
-    //* get mail headers, subject and body
-    $mailHeaders = '';
-    $mailBody = '';
-    $mailSubject = '';
-    $inHeader = true;
-    for($l = 0; $l < count($lines); $l++) {
-        if($lines[$l] == '') {
-            $inHeader = false;
-            continue;
-        }
-        if($inHeader == true) {
-            $parts = explode(':', $lines[$l], 2);
-            if(strtolower($parts[0]) == 'subject') $mailSubject = trim($parts[1]);
-            unset($parts);
-            $mailHeaders .= trim($lines[$l]) . "\n";
-        } else {
-            $mailBody .= trim($lines[$l]) . "\n";
-        }
-    }
-    $mailBody = trim($mailBody);
-    
-    //* Replace placeholders
-    $mailHeaders = strtr($mailHeaders, $placeholders);
-    $mailSubject = strtr($mailSubject, $placeholders);
-    $mailBody = strtr($mailBody, $placeholders);
-    
-    for($r = 0; $r < count($recipients); $r++) {
-        mail($recipients[$r], $mailSubject, $mailBody, $mailHeaders);
-    }
+	global $conf;
 
-    unset($mailSubject);
-    unset($mailHeaders);
-    unset($mailBody);
-    unset($lines);
-    
-    return true;
+	if(!is_array($recipients) || count($recipients) < 1) return false;
+	if(!is_array($placeholders)) $placeholders = array();
+
+	if(file_exists($conf['rootpath'].'/conf-custom/mail/' . $template . '_'.$conf['language'].'.txt')) {
+		$lines = file($conf['rootpath'].'/conf-custom/mail/' . $template . '_'.$conf['language'].'.txt');
+	} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/' . $template . '_en.txt')) {
+		$lines = file($conf['rootpath'].'/conf-custom/mail/' . $template . '_en.txt');
+	} elseif(file_exists($conf['rootpath'].'/conf/mail/' . $template . '_'.$conf['language'].'.txt')) {
+		$lines = file($conf['rootpath'].'/conf/mail/' . $template . '_'.$conf['language'].'.txt');
+	} else {
+		$lines = file($conf['rootpath'].'/conf/mail/' . $template . '_en.txt');
+	}
+
+	//* get mail headers, subject and body
+	$mailHeaders = '';
+	$mailBody = '';
+	$mailSubject = '';
+	$inHeader = true;
+	for($l = 0; $l < count($lines); $l++) {
+		if($lines[$l] == '') {
+			$inHeader = false;
+			continue;
+		}
+		if($inHeader == true) {
+			$parts = explode(':', $lines[$l], 2);
+			if(strtolower($parts[0]) == 'subject') $mailSubject = trim($parts[1]);
+			unset($parts);
+			$mailHeaders .= trim($lines[$l]) . "\n";
+		} else {
+			$mailBody .= trim($lines[$l]) . "\n";
+		}
+	}
+	$mailBody = trim($mailBody);
+
+	//* Replace placeholders
+	$mailHeaders = strtr($mailHeaders, $placeholders);
+	$mailSubject = strtr($mailSubject, $placeholders);
+	$mailBody = strtr($mailBody, $placeholders);
+
+	for($r = 0; $r < count($recipients); $r++) {
+		mail($recipients[$r], $mailSubject, $mailBody, $mailHeaders);
+	}
+
+	unset($mailSubject);
+	unset($mailHeaders);
+	unset($mailBody);
+	unset($lines);
+
+	return true;
 }
 
 
-#######################################################################################################
+//######################################################################################################
 // enforce traffic quota (run only on the "master-server")
-#######################################################################################################
+//######################################################################################################
 
 if ($app->dbmaster == $app->db) {
 
 	$global_config = $app->getconf->get_global_config('mail');
-	
+
 	$current_month = date('Y-m');
 
 	//* Check website traffic quota
@@ -739,20 +741,20 @@
 				($reseller_traffic_quota > 0 && $web_traffic > $reseller_traffic_quota)) {*/
 			if($web_traffic_quota > 0 && $web_traffic > $web_traffic_quota) {
 				$app->dbmaster->datalogUpdate('web_domain', "traffic_quota_lock = 'y',active = 'n'", 'domain_id', $rec['domain_id']);
-				$app->log('Traffic quota for '.$rec['domain'].' exceeded. Disabling website.',LOGLEVEL_DEBUG);
-				
+				$app->log('Traffic quota for '.$rec['domain'].' exceeded. Disabling website.', LOGLEVEL_DEBUG);
+
 				//* Send traffic notifications
 				if($rec['traffic_quota_lock'] != 'y' && ($web_config['overtraffic_notify_admin'] == 'y' || $web_config['overtraffic_notify_client'] == 'y')) {
-                    
-                    $placeholders = array('{domain}' => $rec['domain'],
-                                          '{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'));
-                    
+
+					$placeholders = array('{domain}' => $rec['domain'],
+						'{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'));
+
 					$recipients = array();
-                    //* send email to admin
+					//* send email to admin
 					if($global_config['admin_mail'] != '' && $web_config['overtraffic_notify_admin'] == 'y') {
 						$recipients[] = $global_config['admin_mail'];
 					}
-					
+
 					//* Send email to client
 					if($web_config['overtraffic_notify_client'] == 'y') {
 						$client_group_id = $rec["sys_groupid"];
@@ -761,16 +763,16 @@
 							$recipients[] = $client['email'];
 						}
 					}
-                    
-                    send_notification_email('web_traffic_notification', $placeholders, $recipients);
+
+					send_notification_email('web_traffic_notification', $placeholders, $recipients);
 				}
-				
-				
+
+
 			} else {
 				//* unlock the website, if traffic is lower then quota
 				if($rec['traffic_quota_lock'] == 'y') {
 					$app->dbmaster->datalogUpdate('web_domain', "traffic_quota_lock = 'n',active = 'y'", 'domain_id', $rec['domain_id']);
-					$app->log('Traffic quota for '.$rec['domain'].' ok again. Re-enabling website.',LOGLEVEL_DEBUG);
+					$app->log('Traffic quota for '.$rec['domain'].' ok again. Re-enabling website.', LOGLEVEL_DEBUG);
 				}
 			}
 		}
@@ -780,9 +782,9 @@
 }
 
 
-#######################################################################################################
+//######################################################################################################
 // send website quota warnings by email
-#######################################################################################################
+//######################################################################################################
 
 if ($app->dbmaster == $app->db) {
 
@@ -792,26 +794,26 @@
 	$sql = "SELECT domain_id,sys_groupid,domain,system_user,last_quota_notification,DATEDIFF(CURDATE(), last_quota_notification) as `notified_before` FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain')";
 	$records = $app->db->queryAllRecords($sql);
 	if(is_array($records) && !empty($records)) {
-	
+
 		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
 		$monitor_data = array();
 		if(is_array($tmp_rec)) {
 			foreach ($tmp_rec as $tmp_mon) {
-				$monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
+				$monitor_data = array_merge_recursive($monitor_data, unserialize($app->db->unquote($tmp_mon['data'])));
 			}
 		}
-		
+
 		foreach($records as $rec) {
 
 			//$web_hd_quota = $rec['hd_quota'];
 			$domain = $rec['domain'];
-			
+
 			$username = $rec['system_user'];
 			$rec['used'] = $monitor_data['user'][$username]['used'];
 			$rec['soft'] = $monitor_data['user'][$username]['soft'];
 			$rec['hard'] = $monitor_data['user'][$username]['hard'];
 			$rec['files'] = $monitor_data['user'][$username]['files'];
-				
+
 			if (!is_numeric($rec['used'])){
 				if ($rec['used'][0] > $rec['used'][1]){
 					$rec['used'] = $rec['used'][0];
@@ -822,114 +824,114 @@
 			if (!is_numeric($rec['soft'])) $rec['soft']=$rec['soft'][1];
 			if (!is_numeric($rec['hard'])) $rec['hard']=$rec['hard'][1];
 			if (!is_numeric($rec['files'])) $rec['files']=$rec['files'][1];
-				
+
 			// used space ratio
 			if($rec['soft'] > 0){
 				$used_ratio = $rec['used']/$rec['soft'];
 			} else {
 				$used_ratio = 0;
 			}
-			
+
 			$rec['ratio'] = number_format($used_ratio * 100, 2, '.', '').'%';
-		
+
 			if($rec['used'] > 1024) {
-				$rec['used'] = round($rec['used'] / 1024,2).' MB';
+				$rec['used'] = round($rec['used'] / 1024, 2).' MB';
 			} else {
 				if ($rec['used'] != '') $rec['used'] .= ' KB';
 			}
-		
+
 			if($rec['soft'] > 1024) {
-				$rec['soft'] = round($rec['soft'] / 1024,2).' MB';
+				$rec['soft'] = round($rec['soft'] / 1024, 2).' MB';
 			} elseif($rec['soft'] == 0){
 				$rec['soft'] = '----';
 			} else {
 				$rec['soft'] .= ' KB';
 			}
-		
+
 			if($rec['hard'] > 1024) {
-				$rec['hard'] = round($rec['hard'] / 1024,2).' MB';
+				$rec['hard'] = round($rec['hard'] / 1024, 2).' MB';
 			} elseif($rec['hard'] == 0){
 				$rec['hard'] = '----';
 			} else {
 				$rec['hard'] .= ' KB';
 			}
-			
+
 			// send notifications only if 90% or more of the quota are used
 			if($used_ratio < 0.9) {
-                // reset notification date
-                if($rec['last_quota_notification']) $app->dbmaster->datalogUpdate('web_domain', "last_quota_notification = NULL", 'domain_id', $rec['domain_id']);
-                
-                // send notification - everything ok again
-                if($rec['last_quota_notification'] && $web_config['overquota_notify_onok'] == 'y' && ($web_config['overquota_notify_admin'] == 'y' || $web_config['overquota_notify_client'] == 'y')) {
-                    $placeholders = array('{domain}' => $rec['domain'],
-                                          '{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
-                                          '{used}' => $rec['used'],
-                                          '{soft}' => $rec['soft'],
-                                          '{hard}' => $rec['hard'],
-                                          '{ratio}' => $rec['ratio']);
+				// reset notification date
+				if($rec['last_quota_notification']) $app->dbmaster->datalogUpdate('web_domain', "last_quota_notification = NULL", 'domain_id', $rec['domain_id']);
 
-                    $recipients = array();
-                    
-                    //* send email to admin
-                    if($global_config['admin_mail'] != '' && $web_config['overquota_notify_admin'] == 'y') {
-                        $recipients[] = $global_config['admin_mail'];
-                    }
-                    
-                    //* Send email to client
-                    if($web_config['overquota_notify_client'] == 'y') {
-                        $client_group_id = $rec["sys_groupid"];
-                        $client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-                        if($client['email'] != '') {
-                            $recipients[] = $client['email'];
-                        }
-                    }
-                    send_notification_email('web_quota_ok_notification', $placeholders, $recipients);
-                }
-                
-                continue;
-            }
-            
-            // could a notification be sent?
-            $send_notification = false;
-            if(!$rec['last_quota_notification']) $send_notification = true; // not yet notified
-            elseif($web_config['overquota_notify_freq'] > 0 && $rec['notified_before'] >= $web_config['overquota_notify_freq']) $send_notification = true;
-            
+				// send notification - everything ok again
+				if($rec['last_quota_notification'] && $web_config['overquota_notify_onok'] == 'y' && ($web_config['overquota_notify_admin'] == 'y' || $web_config['overquota_notify_client'] == 'y')) {
+					$placeholders = array('{domain}' => $rec['domain'],
+						'{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
+						'{used}' => $rec['used'],
+						'{soft}' => $rec['soft'],
+						'{hard}' => $rec['hard'],
+						'{ratio}' => $rec['ratio']);
+
+					$recipients = array();
+
+					//* send email to admin
+					if($global_config['admin_mail'] != '' && $web_config['overquota_notify_admin'] == 'y') {
+						$recipients[] = $global_config['admin_mail'];
+					}
+
+					//* Send email to client
+					if($web_config['overquota_notify_client'] == 'y') {
+						$client_group_id = $rec["sys_groupid"];
+						$client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+						if($client['email'] != '') {
+							$recipients[] = $client['email'];
+						}
+					}
+					send_notification_email('web_quota_ok_notification', $placeholders, $recipients);
+				}
+
+				continue;
+			}
+
+			// could a notification be sent?
+			$send_notification = false;
+			if(!$rec['last_quota_notification']) $send_notification = true; // not yet notified
+			elseif($web_config['overquota_notify_freq'] > 0 && $rec['notified_before'] >= $web_config['overquota_notify_freq']) $send_notification = true;
+
 			//* Send quota notifications
 			if(($web_config['overquota_notify_admin'] == 'y' || $web_config['overquota_notify_client'] == 'y') && $send_notification == true) {
 				$app->dbmaster->datalogUpdate('web_domain', "last_quota_notification = CURDATE()", 'domain_id', $rec['domain_id']);
-                
-                $placeholders = array('{domain}' => $rec['domain'],
-                                      '{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
-                                      '{used}' => $rec['used'],
-                                      '{soft}' => $rec['soft'],
-                                      '{hard}' => $rec['hard'],
-                                      '{ratio}' => $rec['ratio']);
 
-                $recipients = array();
-                
-                //* send email to admin
-                if($global_config['admin_mail'] != '' && $web_config['overquota_notify_admin'] == 'y') {
-                    $recipients[] = $global_config['admin_mail'];
-                }
-                
-                //* Send email to client
-                if($web_config['overquota_notify_client'] == 'y') {
-                    $client_group_id = $rec["sys_groupid"];
-                    $client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-                    if($client['email'] != '') {
-                        $recipients[] = $client['email'];
-                    }
-                }
-                send_notification_email('web_quota_notification', $placeholders, $recipients);
+				$placeholders = array('{domain}' => $rec['domain'],
+					'{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
+					'{used}' => $rec['used'],
+					'{soft}' => $rec['soft'],
+					'{hard}' => $rec['hard'],
+					'{ratio}' => $rec['ratio']);
+
+				$recipients = array();
+
+				//* send email to admin
+				if($global_config['admin_mail'] != '' && $web_config['overquota_notify_admin'] == 'y') {
+					$recipients[] = $global_config['admin_mail'];
+				}
+
+				//* Send email to client
+				if($web_config['overquota_notify_client'] == 'y') {
+					$client_group_id = $rec["sys_groupid"];
+					$client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+					if($client['email'] != '') {
+						$recipients[] = $client['email'];
+					}
+				}
+				send_notification_email('web_quota_notification', $placeholders, $recipients);
 			}
 		}
 	}
 }
 
 
-#######################################################################################################
+//######################################################################################################
 // send mail quota warnings by email
-#######################################################################################################
+//######################################################################################################
 
 if ($app->dbmaster == $app->db) {
 
@@ -940,7 +942,7 @@
 	$sql = "SELECT mailuser_id,sys_groupid,email,name,quota,last_quota_notification,DATEDIFF(CURDATE(), last_quota_notification) as `notified_before` FROM mail_user";
 	$records = $app->db->queryAllRecords($sql);
 	if(is_array($records) && !empty($records)) {
-	
+
 		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'email_quota' ORDER BY created DESC");
 		$monitor_data = array();
 		if(is_array($tmp_rec)) {
@@ -954,112 +956,112 @@
 				}
 			}
 		}
-		
+
 		foreach($records as $rec) {
 
 			$email = $rec['email'];
-		
+
 			$rec['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
-		
+
 			if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1];
-				
+
 			// used space ratio
 			if($rec['quota'] > 0){
 				$used_ratio = $rec['used']/$rec['quota'];
 			} else {
 				$used_ratio = 0;
 			}
-			
+
 			$rec['ratio'] = number_format($used_ratio * 100, 2, '.', '').'%';
-			
+
 			if($rec['quota'] > 0){
-				$rec['quota'] = round($rec['quota'] / 1048576,4).' MB';
+				$rec['quota'] = round($rec['quota'] / 1048576, 4).' MB';
 			} else {
 				$rec['quota'] = '----';
 			}
 
 			if($rec['used'] < 1544000) {
-				$rec['used'] = round($rec['used'] / 1024,4).' KB';
+				$rec['used'] = round($rec['used'] / 1024, 4).' KB';
 			} else {
-				$rec['used'] = round($rec['used'] / 1048576,4).' MB';
-			} 
-			
+				$rec['used'] = round($rec['used'] / 1048576, 4).' MB';
+			}
+
 			// send notifications only if 90% or more of the quota are used
 			if($used_ratio < 0.9) {
-                // reset notification date
-                if($rec['last_quota_notification']) $app->dbmaster->datalogUpdate('mail_user', "last_quota_notification = NULL", 'mailuser_id', $rec['mailuser_id']);
+				// reset notification date
+				if($rec['last_quota_notification']) $app->dbmaster->datalogUpdate('mail_user', "last_quota_notification = NULL", 'mailuser_id', $rec['mailuser_id']);
 
-                // send notification - everything ok again
-                if($rec['last_quota_notification'] && $mail_config['overquota_notify_onok'] == 'y' && ($mail_config['overquota_notify_admin'] == 'y' || $mail_config['overquota_notify_client'] == 'y')) {
-                    $placeholders = array('{email}' => $rec['email'],
-                              '{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
-                              '{used}' => $rec['used'],
-                              '{name}' => $rec['name'],
-                              '{quota}' => $rec['quota'],
-                              '{ratio}' => $rec['ratio']);
-        
-                    $recipients = array();
-                    //* send email to admin
-                    if($global_config['admin_mail'] != '' && $mail_config['overquota_notify_admin'] == 'y') {
-                        $recipients[] = $global_config['admin_mail'];
-                    }
-                    
-                    //* Send email to client
-                    if($mail_config['overquota_notify_client'] == 'y') {
-                        $client_group_id = $rec["sys_groupid"];
-                        $client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-                        if($client['email'] != '') {
-                            $recipients[] = $client['email'];
-                        }
-                    }
-                    
-                    send_notification_email('mail_quota_ok_notification', $placeholders, $recipients);
-                }
+				// send notification - everything ok again
+				if($rec['last_quota_notification'] && $mail_config['overquota_notify_onok'] == 'y' && ($mail_config['overquota_notify_admin'] == 'y' || $mail_config['overquota_notify_client'] == 'y')) {
+					$placeholders = array('{email}' => $rec['email'],
+						'{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
+						'{used}' => $rec['used'],
+						'{name}' => $rec['name'],
+						'{quota}' => $rec['quota'],
+						'{ratio}' => $rec['ratio']);
 
-                continue;
-            }
-				
+					$recipients = array();
+					//* send email to admin
+					if($global_config['admin_mail'] != '' && $mail_config['overquota_notify_admin'] == 'y') {
+						$recipients[] = $global_config['admin_mail'];
+					}
+
+					//* Send email to client
+					if($mail_config['overquota_notify_client'] == 'y') {
+						$client_group_id = $rec["sys_groupid"];
+						$client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+						if($client['email'] != '') {
+							$recipients[] = $client['email'];
+						}
+					}
+
+					send_notification_email('mail_quota_ok_notification', $placeholders, $recipients);
+				}
+
+				continue;
+			}
+
 			//* Send quota notifications
-            // could a notification be sent?
-            $send_notification = false;
-            if(!$rec['last_quota_notification']) $send_notification = true; // not yet notified
-            elseif($mail_config['overquota_notify_freq'] > 0 && $rec['notified_before'] >= $mail_config['overquota_notify_freq']) $send_notification = true;
-            
-            if(($mail_config['overquota_notify_admin'] == 'y' || $mail_config['overquota_notify_client'] == 'y') && $send_notification == true) {
+			// could a notification be sent?
+			$send_notification = false;
+			if(!$rec['last_quota_notification']) $send_notification = true; // not yet notified
+			elseif($mail_config['overquota_notify_freq'] > 0 && $rec['notified_before'] >= $mail_config['overquota_notify_freq']) $send_notification = true;
+
+			if(($mail_config['overquota_notify_admin'] == 'y' || $mail_config['overquota_notify_client'] == 'y') && $send_notification == true) {
 				$app->dbmaster->datalogUpdate('mail_user', "last_quota_notification = CURDATE()", 'mailuser_id', $rec['mailuser_id']);
-                
-                $placeholders = array('{email}' => $rec['email'],
-                          '{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
-                          '{used}' => $rec['used'],
-                          '{name}' => $rec['name'],
-                          '{quota}' => $rec['quota'],
-                          '{ratio}' => $rec['ratio']);
-    
-                $recipients = array();
-                //* send email to admin
-                if($global_config['admin_mail'] != '' && $mail_config['overquota_notify_admin'] == 'y') {
-                    $recipients[] = $global_config['admin_mail'];
-                }
-                
-                //* Send email to client
-                if($mail_config['overquota_notify_client'] == 'y') {
-                    $client_group_id = $rec["sys_groupid"];
-                    $client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-                    if($client['email'] != '') {
-                        $recipients[] = $client['email'];
-                    }
-                }
-                
-                send_notification_email('mail_quota_notification', $placeholders, $recipients);
-			}	
+
+				$placeholders = array('{email}' => $rec['email'],
+					'{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
+					'{used}' => $rec['used'],
+					'{name}' => $rec['name'],
+					'{quota}' => $rec['quota'],
+					'{ratio}' => $rec['ratio']);
+
+				$recipients = array();
+				//* send email to admin
+				if($global_config['admin_mail'] != '' && $mail_config['overquota_notify_admin'] == 'y') {
+					$recipients[] = $global_config['admin_mail'];
+				}
+
+				//* Send email to client
+				if($mail_config['overquota_notify_client'] == 'y') {
+					$client_group_id = $rec["sys_groupid"];
+					$client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+					if($client['email'] != '') {
+						$recipients[] = $client['email'];
+					}
+				}
+
+				send_notification_email('mail_quota_notification', $placeholders, $recipients);
+			}
 		}
 	}
 }
 
 
-#######################################################################################################
+//######################################################################################################
 // deactivate virtual servers (run only on the "master-server")
-#######################################################################################################
+//######################################################################################################
 
 if ($app->dbmaster == $app->db) {
 	$current_date = date('Y-m-d');
@@ -1070,16 +1072,16 @@
 	if(is_array($records)) {
 		foreach($records as $rec) {
 			$app->dbmaster->datalogUpdate('openvz_vm', "active = 'n'", 'vm_id', $rec['vm_id']);
-			$app->log('Virtual machine active date expired. Disabling VM '.$rec['veid'],LOGLEVEL_DEBUG);
+			$app->log('Virtual machine active date expired. Disabling VM '.$rec['veid'], LOGLEVEL_DEBUG);
 		}
 	}
 
 
 }
 
-#######################################################################################################
+//######################################################################################################
 // Create website backups
-#######################################################################################################
+//######################################################################################################
 
 $server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
 $backup_dir = $server_config['backup_dir'];
@@ -1151,14 +1153,14 @@
 				} else {
 					if(is_file($web_backup_dir.'/'.$web_backup_file)) unlink($web_backup_dir.'/'.$web_backup_file);
 				}
-				
+
 				//* Remove old backups
 				$backup_copies = intval($rec['backup_copies']);
 
 				$dir_handle = dir($web_backup_dir);
 				$files = array();
 				while (false !== ($entry = $dir_handle->read())) {
-					if($entry != '.' && $entry != '..' && substr($entry,0,3) == 'web' && is_file($web_backup_dir.'/'.$entry)) {
+					if($entry != '.' && $entry != '..' && substr($entry, 0, 3) == 'web' && is_file($web_backup_dir.'/'.$entry)) {
 						$files[] = $entry;
 					}
 				}
@@ -1184,8 +1186,8 @@
 
 				//* Remove backupdir symlink and create as directory instead
 				$app->uses('system');
-				$app->system->web_folder_protection($web_path,false);
-				
+				$app->system->web_folder_protection($web_path, false);
+
 				if(is_link($web_path.'/backup')) {
 					unlink($web_path.'/backup');
 				}
@@ -1194,8 +1196,8 @@
 					chown($web_path.'/backup', $rec['system_user']);
 					chgrp($web_path.'/backup', $rec['system_group']);
 				}
-				
-				$app->system->web_folder_protection($web_path,true);
+
+				$app->system->web_folder_protection($web_path, true);
 			}
 
 			/* If backup_interval is set to none and we have a
@@ -1215,7 +1217,7 @@
 	$records = $app->db->queryAllRecords($sql);
 	if(is_array($records)) {
 
-		include('lib/mysql_clientdb.conf');
+		include 'lib/mysql_clientdb.conf';
 
 		foreach($records as $rec) {
 
@@ -1239,7 +1241,7 @@
 
 				//* Compress the backup with gzip
 				if($retval == 0) exec("gzip -c '".escapeshellcmd($db_backup_dir.'/'.$db_backup_file)."' > '".escapeshellcmd($db_backup_dir.'/'.$db_backup_file).".gz'", $tmp_output, $retval);
-				
+
 				if($retval == 0){
 					if(is_file($db_backup_dir.'/'.$db_backup_file.'.gz')){
 						chmod($db_backup_dir.'/'.$db_backup_file.'.gz', 0750);
@@ -1266,27 +1268,27 @@
 				$files = array();
 				while (false !== ($entry = $dir_handle->read())) {
 					if($entry != '.' && $entry != '..' && preg_match('/^db_(.*?)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.sql.gz$/', $entry, $matches) && is_file($db_backup_dir.'/'.$entry)) {
-                        if(array_key_exists($matches[1], $files) == false) $files[$matches[1]] = array();
+						if(array_key_exists($matches[1], $files) == false) $files[$matches[1]] = array();
 						$files[$matches[1]][] = $entry;
 					}
 				}
 				$dir_handle->close();
-                
-                reset($files);
-                foreach($files as $db_name => $filelist) {
-                    rsort($filelist);
-                    for ($n = $backup_copies; $n <= 10; $n++) {
-                        if(isset($filelist[$n]) && is_file($db_backup_dir.'/'.$filelist[$n])) {
-                            unlink($db_backup_dir.'/'.$filelist[$n]);
-                            //$sql = "SELECT backup_id FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($filelist[$n])."'";
-                            //$tmp = $app->dbmaster->queryOneRecord($sql);
-                            //$sql = "DELETE FROM web_backup WHERE backup_id = ".intval($tmp['backup_id']);
+
+				reset($files);
+				foreach($files as $db_name => $filelist) {
+					rsort($filelist);
+					for ($n = $backup_copies; $n <= 10; $n++) {
+						if(isset($filelist[$n]) && is_file($db_backup_dir.'/'.$filelist[$n])) {
+							unlink($db_backup_dir.'/'.$filelist[$n]);
+							//$sql = "SELECT backup_id FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($filelist[$n])."'";
+							//$tmp = $app->dbmaster->queryOneRecord($sql);
+							//$sql = "DELETE FROM web_backup WHERE backup_id = ".intval($tmp['backup_id']);
 							$sql = "DELETE FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($filelist[$n])."'";
-                            $app->db->query($sql);
-                            if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
-                        }
-                    }
-                }
+							$app->db->query($sql);
+							if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+						}
+					}
+				}
 
 				unset($files);
 				unset($dir_handle);
@@ -1298,7 +1300,7 @@
 		unset($clientdb_password);
 
 	}
-	
+
 	// remove non-existing backups from database
 	$backups = $app->db->queryAllRecords("SELECT * FROM web_backup WHERE server_id = ".$conf['server_id']);
 	if(is_array($backups) && !empty($backups)){
diff --git a/server/lib/app.inc.php b/server/lib/app.inc.php
index 321e5c6..a1e75af 100755
--- a/server/lib/app.inc.php
+++ b/server/lib/app.inc.php
@@ -32,155 +32,155 @@
 if(isset($conf['timezone']) && $conf['timezone'] != '') date_default_timezone_set($conf['timezone']);
 
 class app {
-		
+
 	var $loaded_modules = array();
 	var $loaded_plugins = array();
-        
+
 	function __construct() {
-
-                global $conf;
-
-                if($conf['start_db'] == true) {
-                	$this->load('db_'.$conf['db_type']);
-                	$this->db = new db;
-					
-					/*
-					Initialize the connection to the master DB, 
-					if we are in a multiserver setup
-					*/
-					
-					if($conf['dbmaster_host'] != '' && ($conf['dbmaster_host'] != $conf['db_host'] || ($conf['dbmaster_host'] == $conf['db_host'] && $conf['dbmaster_database'] != $conf['db_database']))) {
-						$this->dbmaster = new db($conf['dbmaster_host'], $conf['dbmaster_user'], $conf['dbmaster_password'], $conf['dbmaster_database']);
-					} else {
-						$this->dbmaster = $this->db;
-					}
-					
-					
-                }
-
-        }
-
-        function uses($classes) {
 
 		global $conf;
 
-		$cl = explode(',',$classes);
+		if($conf['start_db'] == true) {
+			$this->load('db_'.$conf['db_type']);
+			$this->db = new db;
+
+			/*
+					Initialize the connection to the master DB,
+					if we are in a multiserver setup
+					*/
+
+			if($conf['dbmaster_host'] != '' && ($conf['dbmaster_host'] != $conf['db_host'] || ($conf['dbmaster_host'] == $conf['db_host'] && $conf['dbmaster_database'] != $conf['db_database']))) {
+				$this->dbmaster = new db($conf['dbmaster_host'], $conf['dbmaster_user'], $conf['dbmaster_password'], $conf['dbmaster_database']);
+			} else {
+				$this->dbmaster = $this->db;
+			}
+
+
+		}
+
+	}
+
+	function uses($classes) {
+
+		global $conf;
+
+		$cl = explode(',', $classes);
 		if(is_array($cl)) {
 			foreach($cl as $classname) {
 				if(!@is_object($this->$classname)) {
 					if(is_file($conf['classpath'].'/'.$classname.'.inc.php') && (DEVSYSTEM ||  !is_link($conf['classpath'].'/'.$classname.'.inc.php'))) {
-						include_once($conf['classpath'].'/'.$classname.'.inc.php');
+						include_once $conf['classpath'].'/'.$classname.'.inc.php';
 						$this->$classname = new $classname;
 					}
 				}
 			}
 		}
-        }
+	}
 
-        function load($classes) {
+	function load($classes) {
 
 		global $conf;
 
-		$cl = explode(',',$classes);
+		$cl = explode(',', $classes);
 		if(is_array($cl)) {
 			foreach($cl as $classname) {
 				if(is_file($conf['classpath'].'/'.$classname.'.inc.php') && (DEVSYSTEM || !is_link($conf['classpath'].'/'.$classname.'.inc.php'))) {
-					include_once($conf['classpath'].'/'.$classname.'.inc.php');
+					include_once $conf['classpath'].'/'.$classname.'.inc.php';
 				} else {
 					die('Unable to load: '.$conf['classpath'].'/'.$classname.'.inc.php');
 				}
 			}
 		}
-        }
+	}
 
-        /*
+	/*
          0 = DEBUG
          1 = WARNING
          2 = ERROR
         */
 
-        function log($msg, $priority = 0) {
-				
+	function log($msg, $priority = 0) {
+
 		global $conf;
-		
+
 		switch ($priority) {
-			case 0:
-				$priority_txt = 'DEBUG';
-				break;
-			case 1:
-				$priority_txt = 'WARNING';
-				break;
-			case 2:
-				$priority_txt = 'ERROR';
-				break;
+		case 0:
+			$priority_txt = 'DEBUG';
+			break;
+		case 1:
+			$priority_txt = 'WARNING';
+			break;
+		case 2:
+			$priority_txt = 'ERROR';
+			break;
 		}
 		$log_msg = @date('d.m.Y-H:i').' - '.$priority_txt.' - '. $msg;
 
 		if($priority >= $conf['log_priority']) {
-                        //if (is_writable($conf["log_file"])) {
-                            if (!$fp = fopen ($conf['log_file'], 'a')) {
-                                die('Unable to open logfile.');
-                            }
-							
-                            if (!fwrite($fp, $log_msg."\r\n")) {
-                                die('Unable to write to logfile.');
-                            }
-				
-				echo $log_msg."\n";
-				fclose($fp);
+			//if (is_writable($conf["log_file"])) {
+			if (!$fp = fopen($conf['log_file'], 'a')) {
+				die('Unable to open logfile.');
+			}
 
-					// Log to database
-					if(isset($this->dbmaster)) {
-						$server_id = $conf['server_id'];
-						$loglevel = $priority;
-						$tstamp = time();
-						$message = $this->dbmaster->quote($msg);
-						$datalog_id = (isset($this->modules->current_datalog_id) && $this->modules->current_datalog_id > 0)?$this->modules->current_datalog_id:0;
-						if($datalog_id > 0) {
-							$tmp_rec = $this->dbmaster->queryOneRecord("SELECT count(syslog_id) as number FROM sys_log WHERE datalog_id = $datalog_id AND loglevel = ".LOGLEVEL_ERROR);
-							//* Do not insert duplicate errors into the web log.
-							if($tmp_rec['number'] == 0) {
-								$sql = "INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ('$server_id',$datalog_id,'$loglevel','$tstamp','$message')";
-								$this->dbmaster->query($sql);
-							}
-						} else {
-							$sql = "INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ('$server_id',0,'$loglevel','$tstamp','$message')";
-							$this->dbmaster->query($sql);
-						}
+			if (!fwrite($fp, $log_msg."\r\n")) {
+				die('Unable to write to logfile.');
+			}
+
+			echo $log_msg."\n";
+			fclose($fp);
+
+			// Log to database
+			if(isset($this->dbmaster)) {
+				$server_id = $conf['server_id'];
+				$loglevel = $priority;
+				$tstamp = time();
+				$message = $this->dbmaster->quote($msg);
+				$datalog_id = (isset($this->modules->current_datalog_id) && $this->modules->current_datalog_id > 0)?$this->modules->current_datalog_id:0;
+				if($datalog_id > 0) {
+					$tmp_rec = $this->dbmaster->queryOneRecord("SELECT count(syslog_id) as number FROM sys_log WHERE datalog_id = $datalog_id AND loglevel = ".LOGLEVEL_ERROR);
+					//* Do not insert duplicate errors into the web log.
+					if($tmp_rec['number'] == 0) {
+						$sql = "INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ('$server_id',$datalog_id,'$loglevel','$tstamp','$message')";
+						$this->dbmaster->query($sql);
 					}
-
-                        //} else {
-                        //    die("Unable to write to logfile.");
-                        //}
-					
-    
-                } // if
-				
-				if(isset($conf['admin_notify_priority']) && $priority >= $conf['admin_notify_priority'] && $conf['admin_mail'] != '') {
-					// send notification to admin
-					$mailBody = $log_msg;
-					$mailSubject = substr($log_msg,0,50).'...';
-					$mailHeaders      = "MIME-Version: 1.0" . "\n";
-					$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
-					$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
-					$mailHeaders     .= "From: ". $conf['admin_mail'] . "\n";
-					$mailHeaders     .= "Reply-To: ". $conf['admin_mail'] . "\n";
-
-					mail($conf['admin_mail'], $mailSubject, $mailBody, $mailHeaders);
+				} else {
+					$sql = "INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ('$server_id',0,'$loglevel','$tstamp','$message')";
+					$this->dbmaster->query($sql);
 				}
-        } // func
-		
+			}
 
-        /*
+			//} else {
+			//    die("Unable to write to logfile.");
+			//}
+
+
+		} // if
+
+		if(isset($conf['admin_notify_priority']) && $priority >= $conf['admin_notify_priority'] && $conf['admin_mail'] != '') {
+			// send notification to admin
+			$mailBody = $log_msg;
+			$mailSubject = substr($log_msg, 0, 50).'...';
+			$mailHeaders      = "MIME-Version: 1.0" . "\n";
+			$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
+			$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
+			$mailHeaders     .= "From: ". $conf['admin_mail'] . "\n";
+			$mailHeaders     .= "Reply-To: ". $conf['admin_mail'] . "\n";
+
+			mail($conf['admin_mail'], $mailSubject, $mailBody, $mailHeaders);
+		}
+	} // func
+
+
+	/*
          0 = DEBUG
          1 = WARNING
          2 = ERROR
         */
 
-        function error($msg) {
-        	$this->log($msg,3);
+	function error($msg) {
+		$this->log($msg, 3);
 		die($msg);
-        }
+	}
 
 }
 
diff --git a/server/lib/classes/aps_base.inc.php b/server/lib/classes/aps_base.inc.php
index 4c1512b..c4aaf52 100644
--- a/server/lib/classes/aps_base.inc.php
+++ b/server/lib/classes/aps_base.inc.php
@@ -43,61 +43,69 @@
 
 class ApsBase
 {
-    protected $log_prefix = '';
-    protected $fetch_url = '';
-    protected $aps_version = '';
-    protected $packages_dir = '';
-    protected $temp_pkg_dir = '';
-    protected $interface_pkg_dir = '';
-    protected $interface_mode = false; // server mode by default
+	protected $log_prefix = '';
+	protected $fetch_url = '';
+	protected $aps_version = '';
+	protected $packages_dir = '';
+	protected $temp_pkg_dir = '';
+	protected $interface_pkg_dir = '';
+	protected $interface_mode = false; // server mode by default
 
-    /**
-     * Constructor
-     *
-     * @param $app the application instance (db handle + log method)
-     * @param $interface_mode act in interface (true) or server mode (false)
-     * @param $log_prefix a prefix to set before all log entries
-     */
-    public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
-    {
-        $this->log_prefix = $log_prefix;
-        $this->interface_mode = $interface_mode;
-        $this->fetch_url = 'apscatalog.com';
-        $this->aps_version = '1';
-        $this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
-        $this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
-    }
-    
-    /**
-     * Converts a given value to it's native representation in 1024 units
-     * 
-     * @param $value the size to convert
-     * @return integer and string 
-     */
-    public function convertSize($value)
-    {
-        $unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
-        return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
-    }
-    
-    /**
-     * Determine a specific xpath from a given SimpleXMLElement handle. If the
-     * element is found, it's string representation is returned. If not,
-     * the return value will stay empty
-     *
-     * @param $xml_handle the SimpleXMLElement handle
-     * @param $query the XPath query
-     * @param $array define whether to return an array or a string
-     * @return $ret the return string
-     */
-    protected function getXPathValue($xml_handle, $query, $array = false)
-    {
-        $ret = '';
-        
-        $xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
-        if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
-        
-        return $ret;
-    }
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle + log method)
+	 * @param $interface_mode act in interface (true) or server mode (false)
+	 * @param $log_prefix a prefix to set before all log entries
+	 */
+
+
+	public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
+	{
+		$this->log_prefix = $log_prefix;
+		$this->interface_mode = $interface_mode;
+		$this->fetch_url = 'apscatalog.com';
+		$this->aps_version = '1';
+		$this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
+		$this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
+	}
+
+
+
+	/**
+	 * Converts a given value to it's native representation in 1024 units
+	 *
+	 * @param $value the size to convert
+	 * @return integer and string
+	 */
+	public function convertSize($value)
+	{
+		$unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
+		return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
+	}
+
+
+
+	/**
+	 * Determine a specific xpath from a given SimpleXMLElement handle. If the
+	 * element is found, it's string representation is returned. If not,
+	 * the return value will stay empty
+	 *
+	 * @param $xml_handle the SimpleXMLElement handle
+	 * @param $query the XPath query
+	 * @param $array define whether to return an array or a string
+	 * @return $ret the return string
+	 */
+	protected function getXPathValue($xml_handle, $query, $array = false)
+	{
+		$ret = '';
+
+		$xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
+		if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
+
+		return $ret;
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/lib/classes/aps_installer.inc.php b/server/lib/classes/aps_installer.inc.php
index f52355f..2925c7a 100644
--- a/server/lib/classes/aps_installer.inc.php
+++ b/server/lib/classes/aps_installer.inc.php
@@ -27,303 +27,317 @@
 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('aps_base.inc.php');
+require_once 'aps_base.inc.php';
 
 @set_time_limit(0);
 @ignore_user_abort(1);
 
 class ApsInstaller extends ApsBase
 {
-    private $handle_type = '';
-    private $domain = '';
-    private $document_root = '';
-    private $sublocation = '';
-    private $local_installpath = '';
-    private $dbhost = '';
-    private $newdb_name = '';
-    private $newdb_user = '';
-    private $file_owner_user = '';
-    private $file_owner_group = '';
+	private $handle_type = '';
+	private $domain = '';
+	private $document_root = '';
+	private $sublocation = '';
+	private $local_installpath = '';
+	private $dbhost = '';
+	private $newdb_name = '';
+	private $newdb_user = '';
+	private $file_owner_user = '';
+	private $file_owner_group = '';
 	private $putenv = array();
-    
-   /**
-    * Constructor
-    *
-    * @param $app the application instance (db handle + log method)
-    * @param $interface_mode act in interface (true) or server mode (false)
-    */
-    public function __construct($app, $interface_mode = false)
-    {
-        parent::__construct($app, 'APS installer: ', $interface_mode);
-    }
-    
-    /**
-     * Before the cron is executed, make sure all necessary options are set
-     * and all functions are available
-     */
-    private function checkRequirements()
-    {
-        global $app;
-        try
-        {
-            // Check if exec() is not disabled
-            $disabled_func = explode(',', @ini_get('disable_functions'));
-            if(in_array('exec', $disabled_func)) throw new Exception('the call of exec() is disabled');
-            
-            // Check if safe_mode is disabled (needed for correct putenv, chmod, chown handling)
-            if(@ini_get('safe_mode')) throw new Exception('the safe_mode restriction is on');
-            
-            return true;
-        }
-        catch(Exception $e)
-        {
-            $app->log('Aborting execution because '.$e->getMessage(), 1);
-            return false;
-        }
-    }
-    
-    /**
-     * Get a file from a ZIP archive and either return it's content or
-     * extract it to a given destination
-     * 
-     * @param $zipfile the ZIP file to work with
-     * @param $subfile the file from which to get the content
-     * @param $destfolder the optional extraction destination
-     * @param $destname the optional target file name when extracting
-     * @return string or boolean
-     */
-    private function getContentFromZIP($zipfile, $subfile, $destfolder = '', $destname = '')
-    {
-        try
-        {
-            $zip = new ZipArchive;
-            $res = $zip->open(realpath($zipfile));
-            if(!$res) throw new Exception('Cannot open ZIP file '.$zipfile);
-        
-            // If no destination is given, the content is returned, otherwise
-            // the $subfile is extracted to $destination
-            if($destfolder == '')
-            {
-                $fh = $zip->getStream($subfile);
-                if(!$fh) throw new Exception('Cannot read '.$subfile.' from '.$zipfile);
-                
-                $subfile_content = '';            
-                while(!feof($fh)) $subfile_content .= fread($fh, 8192);
-                
-                fclose($fh);
-                
-                return $subfile_content;
-            }
-            else
-            {
-                // extractTo would be suitable but has no target name parameter
-                //$ind = $zip->locateName($subfile);
-                //$ex = $zip->extractTo($destination, array($zip->getNameIndex($ind)));
-                if($destname == '') $destname = basename($subfile);
-                $ex = @copy('zip://'.$zipfile.'#'.$subfile, $destfolder.$destname);
-                if(!$ex) throw new Exception('Cannot extract '.$subfile.' to '.$destfolder);
-            }
-            
-            $zip->close();
-            
-        }
-        catch(Exception $e)
-        {
-            // The exception message is only interesting for debugging reasons
-            // echo $e->getMessage();
-            return false;
-        }
-    }    
-    
-    /**
-     * Extract the complete directory of a ZIP file
-     * 
-     * @param $filename the file to unzip
-     * @param $directory the ZIP inside directory to unzip
-     * @param $destination the place where to extract the data
-     * @return boolean
-     */
-    private function extractZip($filename, $directory, $destination)
-    {
-        if(!file_exists($filename)) return false;
-        
-        // Fix the paths
-        if(substr($directory, -1) == '/') $directory = substr($directory, 0, strlen($directory) - 1);
-        if(substr($destination, -1) != '/') $destination .= '/';
-        
-        // Read and extract the ZIP file
-        $ziphandle = zip_open(realpath($filename));
-        if(is_resource($ziphandle))
-        {
-            while($entry = zip_read($ziphandle))
-            {
-                if(substr(zip_entry_name($entry), 0, strlen($directory)) == $directory)
-                {
-                    // Modify the relative ZIP file path
-                    $new_path = substr(zip_entry_name($entry), strlen($directory));
-                    
-                    if(substr($new_path, -1) == '/') // Identifier for directories
-                    {
-                        if(!file_exists($destination.$new_path)) mkdir($destination.$new_path, 0777, true);
-                    }
-                    else // Handle files
-                    {
-                        if(zip_entry_open($ziphandle, $entry))
-                        {
-                            $new_dir = dirname($destination.$new_path);
-                            if(!file_exists($new_dir)) mkdir($new_dir, 0777, true);
-                            
-                            $file = fopen($destination.$new_path, 'wb');
-                            if($file)
-                            {
-                                while($line = zip_entry_read($entry)) fwrite($file, $line);
-                                fclose($file);
-                            }
-                            else return false;
-                        }
-                    }
-                }
-            }
-            
-            zip_close($ziphandle);
-            return true;
-        }
-        
-        return false;
-    }
 
-    /**
-     * Setup the path environment variables for the install script
-     * 
-     * @param $parent_mapping the SimpleXML instance with the current mapping position
-     * @param $url the relative path within the mapping tree
-     * @param $path the absolute path within the mapping tree
-     */
-    private function processMappings($parent_mapping, $url, $path)
-    {
-        if($parent_mapping && $parent_mapping != null)
-        {
-            $writable = parent::getXPathValue($parent_mapping, 'php:permissions/@writable');
-            $readable = parent::getXPathValue($parent_mapping, 'php:permissions/@readable');
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle + log method)
+	 * @param $interface_mode act in interface (true) or server mode (false)
+	 */
 
-            // set the write permission            
-            if($writable == 'true')
-            {
-                if(is_dir($path)) chmod($path, 0775);
-                else chmod($path, 0664);
-            }
-            
-            // set non-readable permission
-            if($readable == 'false')
-            {
-                if(is_dir($path)) chmod($path, 0333);
-                else chmod($path, 0222);
-            }
-        }
-        
-        // Set the environment variables
-        $env = str_replace('/', '_', $url);
-        $this->putenv[] = 'WEB_'.$env.'_DIR='.$path;
-        
-        // Step recursively into further mappings
-        if($parent_mapping && $parent_mapping != null)
-        {
-            foreach($parent_mapping->mapping as $mapping)
-            {
-                if($url == '/') $this->processMappings($mapping, $url.$mapping['url'], $path.$mapping['url']);
-                else $this->processMappings($mapping, $url.'/'.$mapping['url'], $path.'/'.$mapping['url']);
-            }
-        }
-    }    
-    
-    /**
-     * Setup the environment with data for the install location
-     * 
-     * @param $task an array containing all install related data
-     */
-    private function prepareLocation($task)
-    {
-        global $app;
-        
-        // Get the domain name to use for the installation
-        // Would be possible in one query too, but we use 2 for easier debugging
-        $main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings  
+
+	public function __construct($app, $interface_mode = false)
+	{
+		parent::__construct($app, 'APS installer: ', $interface_mode);
+	}
+
+
+
+	/**
+	 * Before the cron is executed, make sure all necessary options are set
+	 * and all functions are available
+	 */
+	private function checkRequirements()
+	{
+		global $app;
+		try
+		{
+			// Check if exec() is not disabled
+			$disabled_func = explode(',', @ini_get('disable_functions'));
+			if(in_array('exec', $disabled_func)) throw new Exception('the call of exec() is disabled');
+
+			// Check if safe_mode is disabled (needed for correct putenv, chmod, chown handling)
+			if(@ini_get('safe_mode')) throw new Exception('the safe_mode restriction is on');
+
+			return true;
+		}
+
+		catch(Exception $e)
+		{
+			$app->log('Aborting execution because '.$e->getMessage(), 1);
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Get a file from a ZIP archive and either return it's content or
+	 * extract it to a given destination
+	 *
+	 * @param $zipfile the ZIP file to work with
+	 * @param $subfile the file from which to get the content
+	 * @param $destfolder the optional extraction destination
+	 * @param $destname the optional target file name when extracting
+	 * @return string or boolean
+	 */
+	private function getContentFromZIP($zipfile, $subfile, $destfolder = '', $destname = '')
+	{
+		try
+		{
+			$zip = new ZipArchive;
+			$res = $zip->open(realpath($zipfile));
+			if(!$res) throw new Exception('Cannot open ZIP file '.$zipfile);
+
+			// If no destination is given, the content is returned, otherwise
+			// the $subfile is extracted to $destination
+			if($destfolder == '')
+			{
+				$fh = $zip->getStream($subfile);
+				if(!$fh) throw new Exception('Cannot read '.$subfile.' from '.$zipfile);
+
+				$subfile_content = '';
+				while(!feof($fh)) $subfile_content .= fread($fh, 8192);
+
+				fclose($fh);
+
+				return $subfile_content;
+			}
+			else
+			{
+				// extractTo would be suitable but has no target name parameter
+				//$ind = $zip->locateName($subfile);
+				//$ex = $zip->extractTo($destination, array($zip->getNameIndex($ind)));
+				if($destname == '') $destname = basename($subfile);
+				$ex = @copy('zip://'.$zipfile.'#'.$subfile, $destfolder.$destname);
+				if(!$ex) throw new Exception('Cannot extract '.$subfile.' to '.$destfolder);
+			}
+
+			$zip->close();
+
+		}
+
+		catch(Exception $e)
+		{
+			// The exception message is only interesting for debugging reasons
+			// echo $e->getMessage();
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Extract the complete directory of a ZIP file
+	 *
+	 * @param $filename the file to unzip
+	 * @param $directory the ZIP inside directory to unzip
+	 * @param $destination the place where to extract the data
+	 * @return boolean
+	 */
+	private function extractZip($filename, $directory, $destination)
+	{
+		if(!file_exists($filename)) return false;
+
+		// Fix the paths
+		if(substr($directory, -1) == '/') $directory = substr($directory, 0, strlen($directory) - 1);
+		if(substr($destination, -1) != '/') $destination .= '/';
+
+		// Read and extract the ZIP file
+		$ziphandle = zip_open(realpath($filename));
+		if(is_resource($ziphandle))
+		{
+			while($entry = zip_read($ziphandle))
+			{
+				if(substr(zip_entry_name($entry), 0, strlen($directory)) == $directory)
+				{
+					// Modify the relative ZIP file path
+					$new_path = substr(zip_entry_name($entry), strlen($directory));
+
+					if(substr($new_path, -1) == '/') // Identifier for directories
+						{
+						if(!file_exists($destination.$new_path)) mkdir($destination.$new_path, 0777, true);
+					}
+					else // Handle files
+						{
+						if(zip_entry_open($ziphandle, $entry))
+						{
+							$new_dir = dirname($destination.$new_path);
+							if(!file_exists($new_dir)) mkdir($new_dir, 0777, true);
+
+							$file = fopen($destination.$new_path, 'wb');
+							if($file)
+							{
+								while($line = zip_entry_read($entry)) fwrite($file, $line);
+								fclose($file);
+							}
+							else return false;
+						}
+					}
+				}
+			}
+
+			zip_close($ziphandle);
+			return true;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Setup the path environment variables for the install script
+	 *
+	 * @param $parent_mapping the SimpleXML instance with the current mapping position
+	 * @param $url the relative path within the mapping tree
+	 * @param $path the absolute path within the mapping tree
+	 */
+	private function processMappings($parent_mapping, $url, $path)
+	{
+		if($parent_mapping && $parent_mapping != null)
+		{
+			$writable = parent::getXPathValue($parent_mapping, 'php:permissions/@writable');
+			$readable = parent::getXPathValue($parent_mapping, 'php:permissions/@readable');
+
+			// set the write permission
+			if($writable == 'true')
+			{
+				if(is_dir($path)) chmod($path, 0775);
+				else chmod($path, 0664);
+			}
+
+			// set non-readable permission
+			if($readable == 'false')
+			{
+				if(is_dir($path)) chmod($path, 0333);
+				else chmod($path, 0222);
+			}
+		}
+
+		// Set the environment variables
+		$env = str_replace('/', '_', $url);
+		$this->putenv[] = 'WEB_'.$env.'_DIR='.$path;
+
+		// Step recursively into further mappings
+		if($parent_mapping && $parent_mapping != null)
+		{
+			foreach($parent_mapping->mapping as $mapping)
+			{
+				if($url == '/') $this->processMappings($mapping, $url.$mapping['url'], $path.$mapping['url']);
+				else $this->processMappings($mapping, $url.'/'.$mapping['url'], $path.'/'.$mapping['url']);
+			}
+		}
+	}
+
+
+
+	/**
+	 * Setup the environment with data for the install location
+	 *
+	 * @param $task an array containing all install related data
+	 */
+	private function prepareLocation($task)
+	{
+		global $app;
+
+		// Get the domain name to use for the installation
+		// Would be possible in one query too, but we use 2 for easier debugging
+		$main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings
             WHERE name = 'main_domain' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $this->domain = $main_domain['value'];
-        
-        // Get the document root
-        $domain_res = $app->db->queryOneRecord("SELECT document_root, web_folder, type FROM web_domain 
-            WHERE domain = '".$app->db->quote($this->domain)."';");
-        $this->document_root = $domain_res['document_root'];
-        
-        // Get the sub location
-        $location_res = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings 
-            WHERE name = 'main_location' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $this->sublocation = $location_res['value'];
-        
-        // Make sure the document_root ends with /
-        if(substr($this->document_root, -1) != '/') $this->document_root .= '/';
-        
-        // Attention: ISPConfig Special: web files are in subfolder 'web' -> append it:
-        if($domain_res['type'] == 'vhostsubdomain') $this->document_root .= $domain_res['web_folder'] . '/';
-        else $this->document_root .= 'web/';
+		$this->domain = $main_domain['value'];
 
-        // If a subfolder is given, make sure it's path doesn't begin with / i.e. /phpbb
-        if(substr($this->sublocation, 0, 1) == '/') $this->sublocation = substr($this->sublocation, 1);
-                
-        // If the package isn't installed to a subfolder, remove the / at the end of the document root
-        if(empty($this->sublocation)) $this->document_root = substr($this->document_root, 0, strlen($this->document_root) - 1);
-        
-        // Set environment variables, later processed by the package install script
-        $this->putenv[] = 'BASE_URL_SCHEME=http';
-        // putenv('BASE_URL_PORT') -> omitted as it's 80 by default
-        $this->putenv[] = 'BASE_URL_HOST='.$this->domain;
-        $this->putenv[] = 'BASE_URL_PATH='.$this->sublocation.'/';
-    }    
-    
-    /**
-     * Setup a database (if needed) and the appropriate environment variables
-     * 
-     * @param $task an array containing all install related data
-     * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
-     */
-    private function prepareDatabase($task, $sxe)
-    {
-        global $app;
-        
-        $db_id = parent::getXPathValue($sxe, '//db:id');
-        if(empty($db_id)) return; // No database needed
-        
+		// Get the document root
+		$domain_res = $app->db->queryOneRecord("SELECT document_root, web_folder, type FROM web_domain
+            WHERE domain = '".$app->db->quote($this->domain)."';");
+		$this->document_root = $domain_res['document_root'];
+
+		// Get the sub location
+		$location_res = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings
+            WHERE name = 'main_location' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
+		$this->sublocation = $location_res['value'];
+
+		// Make sure the document_root ends with /
+		if(substr($this->document_root, -1) != '/') $this->document_root .= '/';
+
+		// Attention: ISPConfig Special: web files are in subfolder 'web' -> append it:
+		if($domain_res['type'] == 'vhostsubdomain') $this->document_root .= $domain_res['web_folder'] . '/';
+		else $this->document_root .= 'web/';
+
+		// If a subfolder is given, make sure it's path doesn't begin with / i.e. /phpbb
+		if(substr($this->sublocation, 0, 1) == '/') $this->sublocation = substr($this->sublocation, 1);
+
+		// If the package isn't installed to a subfolder, remove the / at the end of the document root
+		if(empty($this->sublocation)) $this->document_root = substr($this->document_root, 0, strlen($this->document_root) - 1);
+
+		// Set environment variables, later processed by the package install script
+		$this->putenv[] = 'BASE_URL_SCHEME=http';
+		// putenv('BASE_URL_PORT') -> omitted as it's 80 by default
+		$this->putenv[] = 'BASE_URL_HOST='.$this->domain;
+		$this->putenv[] = 'BASE_URL_PATH='.$this->sublocation.'/';
+	}
+
+
+
+	/**
+	 * Setup a database (if needed) and the appropriate environment variables
+	 *
+	 * @param $task an array containing all install related data
+	 * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
+	 */
+	private function prepareDatabase($task, $sxe)
+	{
+		global $app;
+
+		$db_id = parent::getXPathValue($sxe, '//db:id');
+		if(empty($db_id)) return; // No database needed
+
 		/* WARNING: if this will ever be uncommented please check the updated prefix handling for user and db names!!!
-         * 
+         *
         // Set the database owner to the domain owner
         // ISPConfig identifies the owner by the sys_groupid (not sys_userid!)
         // so sys_userid can be set to any value
-        $perm = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM web_domain 
+        $perm = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM web_domain
             WHERE domain = '".$this->domain."';");
         $task['sys_groupid'] = $perm['sys_groupid'];
         $serverid = $perm['server_id'];
-                
-        // Get the database prefix and db user prefix 
+
+        // Get the database prefix and db user prefix
         $app->uses('getconf');
         $global_config = $app->getconf->get_global_config('sites');
         $dbname_prefix = str_replace('[CLIENTID]', '', $global_config['dbname_prefix']);
         $dbuser_prefix = str_replace('[CLIENTID]', '', $global_config['dbuser_prefix']);
         $this->dbhost = DB_HOST; // Taken from config.inc.php
         if(empty($this->dbhost)) $this->dbhost = 'localhost'; // Just to ensure any hostname... ;)
-        
+
         $this->newdb_name = $dbname_prefix.$task['CustomerID'].'aps'.$task['InstanceID'];
         $this->newdb_user = $dbuser_prefix.$task['CustomerID'].'aps'.$task['InstanceID'];
-        $dbpw_res = $app->db->queryOneRecord("SELECT Value FROM aps_instances_settings  
+        $dbpw_res = $app->db->queryOneRecord("SELECT Value FROM aps_instances_settings
             WHERE Name = 'main_database_password' AND InstanceID = '".$app->db->quote($task['InstanceID'])."';");
         $newdb_pw = $dbpw_res['Value'];
- 
+
         // In any case delete an existing database (install and removal procedure)
         $app->db->query('DROP DATABASE IF EXISTS `'.$app->db->quote($this->newdb_name).'`;');
         // Delete an already existing database with this name
         $app->db->query("DELETE FROM web_database WHERE database_name = '".$app->db->quote($this->newdb_name)."';");
-        
-        
+
+
         // Create the new database and assign it to a user
         if($this->handle_type == 'install')
         {
@@ -331,77 +345,79 @@
             $app->db->query('GRANT ALL PRIVILEGES ON '.$app->db->quote($this->newdb_name).'.* TO '.$app->db->quote($this->newdb_user).'@'.$app->db->quote($this->dbhost).' IDENTIFIED BY \'password\';');
             $app->db->query('SET PASSWORD FOR '.$app->db->quote($this->newdb_user).'@'.$app->db->quote($this->dbhost).' = PASSWORD(\''.$newdb_pw.'\');');
             $app->db->query('FLUSH PRIVILEGES;');
-        
+
             // Add the new database to the customer databases
             // Assumes: charset = utf8
-            $app->db->query('INSERT INTO web_database (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, 
-                type, database_name, database_user, database_password, database_charset, remote_access, remote_ips, active) 
-                VALUES ('.$task['sys_userid'].', '.$task['sys_groupid'].', "'.$task['sys_perm_user'].'", "'.$task['sys_perm_group'].'", 
-                "'.$task['sys_perm_other'].'", '.$app->db->quote($serverid).', "mysql", "'.$app->db->quote($this->newdb_name).'", 
+            $app->db->query('INSERT INTO web_database (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id,
+                type, database_name, database_user, database_password, database_charset, remote_access, remote_ips, active)
+                VALUES ('.$task['sys_userid'].', '.$task['sys_groupid'].', "'.$task['sys_perm_user'].'", "'.$task['sys_perm_group'].'",
+                "'.$task['sys_perm_other'].'", '.$app->db->quote($serverid).', "mysql", "'.$app->db->quote($this->newdb_name).'",
                 "'.$app->db->quote($this->newdb_user).'", "'.$app->db->quote($newdb_pw).'", "utf8", "n", "", "y");');
         }
 		*/
-        
-        $mysqlver_res = $app->db->queryOneRecord('SELECT VERSION() as ver;');
-        $mysqlver = $mysqlver_res['ver'];
-		
+
+		$mysqlver_res = $app->db->queryOneRecord('SELECT VERSION() as ver;');
+		$mysqlver = $mysqlver_res['ver'];
+
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_password' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $newdb_pw = $tmp['value'];
-		
+		$newdb_pw = $tmp['value'];
+
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_host' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $newdb_host = $tmp['value'];
-		
+		$newdb_host = $tmp['value'];
+
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_name' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $newdb_name = $tmp['value'];
-		
+		$newdb_name = $tmp['value'];
+
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_login' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $newdb_login = $tmp['value'];
-        
-        $this->putenv[] = 'DB_'.$db_id.'_TYPE=mysql';
-        $this->putenv[] = 'DB_'.$db_id.'_NAME='.$newdb_name;
-        $this->putenv[] = 'DB_'.$db_id.'_LOGIN='.$newdb_login;
-        $this->putenv[] = 'DB_'.$db_id.'_PASSWORD='.$newdb_pw;
-        $this->putenv[] = 'DB_'.$db_id.'_HOST='.$newdb_host;
-        $this->putenv[] = 'DB_'.$db_id.'_PORT=3306';
-        $this->putenv[] = 'DB_'.$db_id.'_VERSION='.$mysqlver;
-    }    
-    
-    /**
-     * Extract all needed files from the package
-     * 
-     * @param $task an array containing all install related data
-     * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
-     * @return boolean
-     */
-    private function prepareFiles($task, $sxe)
-    {
-        global $app;
-        
-        // Basically set the mapping for APS version 1.0, if not available -> newer way
-        $mapping = $sxe->mapping;
-        $mapping_path = $sxe->mapping['path'];
-        $mapping_url = $sxe->mapping['url'];
-        if(empty($mapping))
-        {
-            $mapping = $sxe->service->provision->{'url-mapping'}->mapping;
-            $mapping_path = $sxe->service->provision->{'url-mapping'}->mapping['path'];
-            $mapping_url = $sxe->service->provision->{'url-mapping'}->mapping['url'];
-        }
+		$newdb_login = $tmp['value'];
 
-        try
-        {
-            // Make sure we have a valid mapping path (at least /)
-            if(empty($mapping_path)) throw new Exception('Unable to determine a mapping path');
-            
-            $this->local_installpath = $this->document_root.$this->sublocation.'/';
+		$this->putenv[] = 'DB_'.$db_id.'_TYPE=mysql';
+		$this->putenv[] = 'DB_'.$db_id.'_NAME='.$newdb_name;
+		$this->putenv[] = 'DB_'.$db_id.'_LOGIN='.$newdb_login;
+		$this->putenv[] = 'DB_'.$db_id.'_PASSWORD='.$newdb_pw;
+		$this->putenv[] = 'DB_'.$db_id.'_HOST='.$newdb_host;
+		$this->putenv[] = 'DB_'.$db_id.'_PORT=3306';
+		$this->putenv[] = 'DB_'.$db_id.'_VERSION='.$mysqlver;
+	}
 
-            // Now delete an existing folder (affects install and removal in the same way)
-            @chdir($this->local_installpath);
-            if(file_exists($this->local_installpath)){
+
+
+	/**
+	 * Extract all needed files from the package
+	 *
+	 * @param $task an array containing all install related data
+	 * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
+	 * @return boolean
+	 */
+	private function prepareFiles($task, $sxe)
+	{
+		global $app;
+
+		// Basically set the mapping for APS version 1.0, if not available -> newer way
+		$mapping = $sxe->mapping;
+		$mapping_path = $sxe->mapping['path'];
+		$mapping_url = $sxe->mapping['url'];
+		if(empty($mapping))
+		{
+			$mapping = $sxe->service->provision->{'url-mapping'}->mapping;
+			$mapping_path = $sxe->service->provision->{'url-mapping'}->mapping['path'];
+			$mapping_url = $sxe->service->provision->{'url-mapping'}->mapping['url'];
+		}
+
+		try
+		{
+			// Make sure we have a valid mapping path (at least /)
+			if(empty($mapping_path)) throw new Exception('Unable to determine a mapping path');
+
+			$this->local_installpath = $this->document_root.$this->sublocation.'/';
+
+			// Now delete an existing folder (affects install and removal in the same way)
+			@chdir($this->local_installpath);
+			if(file_exists($this->local_installpath)){
 				// make sure we don't delete error and stats folders
 				if($this->local_installpath == $this->document_root.'/'){
 					if(is_dir($this->document_root)){
-						$files = array_diff(scandir($this->document_root), array('.','..','error','stats'));
+						$files = array_diff(scandir($this->document_root), array('.', '..', 'error', 'stats'));
 						foreach($files as $file){
 							if(is_dir($this->document_root.'/'.$file)){
 								$app->file->removeDirectory($this->document_root.'/'.$file);
@@ -420,301 +436,314 @@
 				mkdir($this->local_installpath, 0777, true);
 			}
 
-            if($this->handle_type == 'install')
-            {            
-                // Now check if the needed folder is there
-                if(!file_exists($this->local_installpath))
-                    throw new Exception('Unable to create a new folder for the package '.$task['path']);
-                
-                // Extract all files and assign them a new owner
-                if( ($this->extractZip($this->packages_dir.'/'.$task['path'], $mapping_path, $this->local_installpath) === false)
-                 || ($this->extractZip($this->packages_dir.'/'.$task['path'], 'scripts', $this->local_installpath.'install_scripts/') === false) )
-                {
-                    // Clean already extracted data
-                    exec("rm -Rf ".escapeshellarg($this->local_installpath).'*');
-                    throw new Exception('Unable to extract the package '.$task['path']);              
-                }
-                
-                $this->processMappings($mapping, $mapping_url, $this->local_installpath);
-            
-                // Set the appropriate file owner
-                $main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings  
-                    WHERE name = 'main_domain' AND instance_id = '".$app->db->quote($task['instance_id'])."';");        
-                $owner_res = $app->db->queryOneRecord("SELECT system_user, system_group FROM web_domain  
+			if($this->handle_type == 'install')
+			{
+				// Now check if the needed folder is there
+				if(!file_exists($this->local_installpath))
+					throw new Exception('Unable to create a new folder for the package '.$task['path']);
+
+				// Extract all files and assign them a new owner
+				if( ($this->extractZip($this->packages_dir.'/'.$task['path'], $mapping_path, $this->local_installpath) === false)
+					|| ($this->extractZip($this->packages_dir.'/'.$task['path'], 'scripts', $this->local_installpath.'install_scripts/') === false) )
+				{
+					// Clean already extracted data
+					exec("rm -Rf ".escapeshellarg($this->local_installpath).'*');
+					throw new Exception('Unable to extract the package '.$task['path']);
+				}
+
+				$this->processMappings($mapping, $mapping_url, $this->local_installpath);
+
+				// Set the appropriate file owner
+				$main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings
+                    WHERE name = 'main_domain' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
+				$owner_res = $app->db->queryOneRecord("SELECT system_user, system_group FROM web_domain
                         WHERE domain = '".$app->db->quote($main_domain['value'])."';");
-                $this->file_owner_user = $owner_res['system_user']; 
-                $this->file_owner_group = $owner_res['system_group'];
-                exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
-				
+				$this->file_owner_user = $owner_res['system_user'];
+				$this->file_owner_group = $owner_res['system_group'];
+				exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
+
 				//* Chown stats directory back
 				if(is_dir($this->local_installpath.'stats')) {
 					exec('chown -R root:root '.escapeshellarg($this->local_installpath.'stats'));
 				}
-            }
-        }
-        catch(Exception $e)
-        {
-            $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" 
+			}
+		}
+		catch(Exception $e)
+		{
+			$app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'"
                 WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            $app->log($e->getMessage(), 1);
-            return false;
-        }
-        
-        return true;
-    }
-    
-    /**
-     * Get all user config variables and set them to environment variables
-     * 
-     * @param $task an array containing all install related data
-     */    
-    private function prepareUserInputData($task)
-    {
-        global $app;
-        
-        $userdata = $app->db->queryAllRecords("SELECT name, value FROM aps_instances_settings 
-            WHERE instance_id = '".$app->db->quote($task['instance_id'])."';");
-        if(empty($userdata)) return false;
-        
-        foreach($userdata as $data)
-        {
-            // Skip unnecessary data
-            if($data['name'] == 'main_location'
-            || $data['name'] == 'main_domain'
-            || $data['name'] == 'main_database_password'
-			|| $data['name'] == 'main_database_name'
-			|| $data['name'] == 'main_database_host'
-			|| $data['name'] == 'main_database_login'
-            || $data['name'] == 'license') continue;
-            
-            $this->putenv[] = 'SETTINGS_'.$data['name'].'='.$data['value'];
-        }
-    }
-	
+			$app->log($e->getMessage(), 1);
+			return false;
+		}
+
+		return true;
+	}
+
+
+
 	/**
-     * Fetch binary data from a given array
-     * The data is retrieved in binary mode and 
-     * then directly written to an output file
-     *
-     * @param $input a specially structed array
-     * @see $this->startUpdate()
-     */
-    private function fetchFiles($input)
-    {
-        $fh = array();
-        $url = array();
-        $conn = array();
+	 * Get all user config variables and set them to environment variables
+	 *
+	 * @param $task an array containing all install related data
+	 */
+	private function prepareUserInputData($task)
+	{
+		global $app;
 
-        // Build the single cURL handles and add them to a multi handle
-        $mh = curl_multi_init();
-        
-        // Process each app 
-        for($i = 0; $i < count($input); $i++)
-        {
-            $conn[$i] = curl_init($input[$i]['url']);
-            $fh[$i] = fopen($input[$i]['localtarget'], 'wb'); 
-            
-            curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true);
-            curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]);
-            curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
-            curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
-            curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1); 
-            
-            curl_multi_add_handle($mh, $conn[$i]);
-        }
-        
-        $active = 0;
-        do curl_multi_exec($mh, $active);
-        while($active > 0);
+		$userdata = $app->db->queryAllRecords("SELECT name, value FROM aps_instances_settings
+            WHERE instance_id = '".$app->db->quote($task['instance_id'])."';");
+		if(empty($userdata)) return false;
 
-        // Close the handles
-        for($i = 0; $i < count($input); $i++)
-        {
-            fclose($fh[$i]);
-            curl_multi_remove_handle($mh, $conn[$i]);
-            curl_close($conn[$i]);
-        }
-        curl_multi_close($mh);
-    }
-    
-    /**
-     * The installation script should be executed
-     * 
-     * @param $task an array containing all install related data
-     * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
-     * @return boolean
-     */
-    private function doInstallation($task, $sxe)
-    {
-        global $app;
-        
-        try
-        {
-            // Check if the install directory exists
-            if(!is_dir($this->local_installpath.'install_scripts/'))
-                throw new Exception('The install directory '.$this->local_installpath.' is not existing');
-            
-            // Set the executable bit to the configure script
-            $cfgscript = @(string)$sxe->service->provision->{'configuration-script'}['name'];
-            if(!$cfgscript) $cfgscript = 'configure';
-            chmod($this->local_installpath.'install_scripts/'.$cfgscript, 0755);
-            
-            // Change to the install folder (import for the exec() below!)
+		foreach($userdata as $data)
+		{
+			// Skip unnecessary data
+			if($data['name'] == 'main_location'
+				|| $data['name'] == 'main_domain'
+				|| $data['name'] == 'main_database_password'
+				|| $data['name'] == 'main_database_name'
+				|| $data['name'] == 'main_database_host'
+				|| $data['name'] == 'main_database_login'
+				|| $data['name'] == 'license') continue;
+
+			$this->putenv[] = 'SETTINGS_'.$data['name'].'='.$data['value'];
+		}
+	}
+
+
+
+	/**
+	 * Fetch binary data from a given array
+	 * The data is retrieved in binary mode and
+	 * then directly written to an output file
+	 *
+	 * @param $input a specially structed array
+	 * @see $this->startUpdate()
+	 */
+	private function fetchFiles($input)
+	{
+		$fh = array();
+		$url = array();
+		$conn = array();
+
+		// Build the single cURL handles and add them to a multi handle
+		$mh = curl_multi_init();
+
+		// Process each app
+		for($i = 0; $i < count($input); $i++)
+		{
+			$conn[$i] = curl_init($input[$i]['url']);
+			$fh[$i] = fopen($input[$i]['localtarget'], 'wb');
+
+			curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true);
+			curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]);
+			curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
+			curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
+			curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1);
+
+			curl_multi_add_handle($mh, $conn[$i]);
+		}
+
+		$active = 0;
+		do curl_multi_exec($mh, $active);
+		while($active > 0);
+
+		// Close the handles
+		for($i = 0; $i < count($input); $i++)
+		{
+			fclose($fh[$i]);
+			curl_multi_remove_handle($mh, $conn[$i]);
+			curl_close($conn[$i]);
+		}
+		curl_multi_close($mh);
+	}
+
+
+
+	/**
+	 * The installation script should be executed
+	 *
+	 * @param $task an array containing all install related data
+	 * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
+	 * @return boolean
+	 */
+	private function doInstallation($task, $sxe)
+	{
+		global $app;
+
+		try
+		{
+			// Check if the install directory exists
+			if(!is_dir($this->local_installpath.'install_scripts/'))
+				throw new Exception('The install directory '.$this->local_installpath.' is not existing');
+
+			// Set the executable bit to the configure script
+			$cfgscript = @(string)$sxe->service->provision->{'configuration-script'}['name'];
+			if(!$cfgscript) $cfgscript = 'configure';
+			chmod($this->local_installpath.'install_scripts/'.$cfgscript, 0755);
+
+			// Change to the install folder (import for the exec() below!)
 			//exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
-            chdir($this->local_installpath.'install_scripts/');
-			
+			chdir($this->local_installpath.'install_scripts/');
+
 			// Set the enviroment variables
 			foreach($this->putenv as $var) {
 				putenv($var);
 			}
-			
-            $shell_retcode = true;
-            $shell_ret = array();
-			 exec('php '.escapeshellarg($this->local_installpath.'install_scripts/'.$cfgscript).' install 2>&1', $shell_ret, $shell_retcode);
-            $shell_ret = array_filter($shell_ret);
-            $shell_ret_str = implode("\n", $shell_ret);
-            
+
+			$shell_retcode = true;
+			$shell_ret = array();
+			exec('php '.escapeshellarg($this->local_installpath.'install_scripts/'.$cfgscript).' install 2>&1', $shell_ret, $shell_retcode);
+			$shell_ret = array_filter($shell_ret);
+			$shell_ret_str = implode("\n", $shell_ret);
+
 			// Although $shell_retcode might be 0, there can be PHP errors. Filter them:
-            if(substr_count($shell_ret_str, 'Warning: ') > 0) $shell_retcode = 1;
-            
-            // If an error has occurred, the return code is != 0 
-            if($shell_retcode != 0) throw new Exception($shell_ret_str);
-            else
-            {
-                // The install succeeded, chown newly created files too
-                exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
-				
+			if(substr_count($shell_ret_str, 'Warning: ') > 0) $shell_retcode = 1;
+
+			// If an error has occurred, the return code is != 0
+			if($shell_retcode != 0) throw new Exception($shell_ret_str);
+			else
+			{
+				// The install succeeded, chown newly created files too
+				exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
+
 				//* Chown stats directory back
 				if(is_dir($this->local_installpath.'stats')) {
 					exec('chown -R root:root '.escapeshellarg($this->local_installpath.'stats'));
 				}
-                
-                $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_SUCCESS.'" 
+
+				$app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_SUCCESS.'"
                     WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            }
-        }
-        catch(Exception $e)
-        {
-            $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" 
+			}
+		}
+
+		catch(Exception $e)
+		{
+			$app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'"
                 WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            $app->log($e->getMessage(), 1);
-            return false;
-        }
-        
-        return true;
-    }
-    
-    /**
-     * Cleanup: Remove install scripts, remove tasks and update the database
-     * 
-     * @param $task an array containing all install related data
-     * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
-     */
-    private function cleanup($task, $sxe)
-    {
-        chdir($this->local_installpath);
-        exec("rm -Rf ".escapeshellarg($this->local_installpath).'install_scripts');
-    }    
-    
-    /**
-     * The main method which performs the actual package installation
-     * 
-     * @param $instanceid the instanceID to install
-     * @param $type the type of task to perform (installation, removal)
-     */
-    public function installHandler($instanceid, $type)
-    {
-        global $app;
-        
-        // Set the given handle type, currently supported: install, delete
-        if($type == 'install' || $type == 'delete') $this->handle_type = $type;
-        else return false;
-        
-        // Get all instance metadata
+			$app->log($e->getMessage(), 1);
+			return false;
+		}
+
+		return true;
+	}
+
+
+
+	/**
+	 * Cleanup: Remove install scripts, remove tasks and update the database
+	 *
+	 * @param $task an array containing all install related data
+	 * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
+	 */
+	private function cleanup($task, $sxe)
+	{
+		chdir($this->local_installpath);
+		exec("rm -Rf ".escapeshellarg($this->local_installpath).'install_scripts');
+	}
+
+
+
+	/**
+	 * The main method which performs the actual package installation
+	 *
+	 * @param $instanceid the instanceID to install
+	 * @param $type the type of task to perform (installation, removal)
+	 */
+	public function installHandler($instanceid, $type)
+	{
+		global $app;
+
+		// Set the given handle type, currently supported: install, delete
+		if($type == 'install' || $type == 'delete') $this->handle_type = $type;
+		else return false;
+
+		// Get all instance metadata
 		/*
-        $task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i 
-            INNER JOIN aps_packages AS p ON i.package_id = p.id 
+        $task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i
+            INNER JOIN aps_packages AS p ON i.package_id = p.id
             INNER JOIN client AS c ON i.customer_id = c.client_id
             WHERE i.id = ".$instanceid.";");
 		*/
-		$task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i 
+		$task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i
             INNER JOIN aps_packages AS p ON i.package_id = p.id
             WHERE i.id = ".$instanceid.";");
-        if(!$task) return false;  // formerly: throw new Exception('The InstanceID doesn\'t exist.');
-        if(!isset($task['instance_id'])) $task['instance_id'] = $instanceid;
-		
+		if(!$task) return false;  // formerly: throw new Exception('The InstanceID doesn\'t exist.');
+		if(!isset($task['instance_id'])) $task['instance_id'] = $instanceid;
+
 		// Download aps package
 		if(!file_exists($this->packages_dir.'/'.$task['path']) || filesize($this->packages_dir.'/'.$task['path']) == 0) {
 			$ch = curl_init();
 			$fh = fopen($this->packages_dir.'/'.$task['path'], 'wb');
-			curl_setopt($ch, CURLOPT_FILE, $fh); 
-			//curl_setopt($ch, CURLOPT_HEADER, 0); 
+			curl_setopt($ch, CURLOPT_FILE, $fh);
+			//curl_setopt($ch, CURLOPT_HEADER, 0);
 			curl_setopt($ch, CURLOPT_URL, $task['package_url']);
 			curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
 			curl_setopt($ch, CURLOPT_TIMEOUT, 0);
 			curl_setopt($ch, CURLOPT_FAILONERROR, 1);
-			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);     
-			if(curl_exec($ch) === false) $app->log(curl_error ($ch),1);
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+			if(curl_exec($ch) === false) $app->log(curl_error($ch), 1);
 			fclose($fh);
 			curl_close($ch);
 		}
-		
+
 		/*
-		$app_to_dl[] = array('name' => $task['path'], 
-                            'url' => $task['package_url'], 
-                            'filesize' => 0, 
+		$app_to_dl[] = array('name' => $task['path'],
+                            'url' => $task['package_url'],
+                            'filesize' => 0,
                             'localtarget' => $this->packages_dir.'/'.$task['path']);
 
         $this->fetchFiles($app_to_dl);
 		*/
-		
-		// Make sure the requirements are given so that this script can execute
-        $req_ret = $this->checkRequirements();
-        if(!$req_ret) return false;
-        
-        $metafile = $this->getContentFromZIP($this->packages_dir.'/'.$task['path'], 'APP-META.xml');
-        // Check if the meta file is existing
-        if(!$metafile)
-        {
-            $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" 
-                WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            $app->log('Unable to find the meta data file of package '.$task['path'], 1);
-            return false;
-        }
-        
-        // Rename namespaces and register them 
-        $metadata = str_replace("xmlns=", "ns=", $metafile);
-        $sxe = new SimpleXMLElement($metadata);
-        $namespaces = $sxe->getDocNamespaces(true);
-        foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url); 
 
-        // Setup the environment with data for the install location
-        $this->prepareLocation($task);
-        
-        // Create the database if necessary
-        $this->prepareDatabase($task, $sxe);
-        
-        // Unpack the install scripts from the packages
-        if($this->prepareFiles($task, $sxe) && $this->handle_type == 'install')
-        {
-            // Setup the variables from the install script
-            $this->prepareUserInputData($task);
-        
-            // Do the actual installation
-            $this->doInstallation($task, $sxe);
-            
-            // Remove temporary files
-            $this->cleanup($task, $sxe);
-        }
-        
-        // Finally delete the instance entry + settings
-        if($this->handle_type == 'delete')
-        {
-            $app->db->query('DELETE FROM aps_instances WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            $app->db->query('DELETE FROM aps_instances_settings WHERE instance_id = "'.$app->db->quote($task['instance_id']).'";');
-        }
-        
-        unset($sxe);
-    }
+		// Make sure the requirements are given so that this script can execute
+		$req_ret = $this->checkRequirements();
+		if(!$req_ret) return false;
+
+		$metafile = $this->getContentFromZIP($this->packages_dir.'/'.$task['path'], 'APP-META.xml');
+		// Check if the meta file is existing
+		if(!$metafile)
+		{
+			$app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'"
+                WHERE id = "'.$app->db->quote($task['instance_id']).'";');
+			$app->log('Unable to find the meta data file of package '.$task['path'], 1);
+			return false;
+		}
+
+		// Rename namespaces and register them
+		$metadata = str_replace("xmlns=", "ns=", $metafile);
+		$sxe = new SimpleXMLElement($metadata);
+		$namespaces = $sxe->getDocNamespaces(true);
+		foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+		// Setup the environment with data for the install location
+		$this->prepareLocation($task);
+
+		// Create the database if necessary
+		$this->prepareDatabase($task, $sxe);
+
+		// Unpack the install scripts from the packages
+		if($this->prepareFiles($task, $sxe) && $this->handle_type == 'install')
+		{
+			// Setup the variables from the install script
+			$this->prepareUserInputData($task);
+
+			// Do the actual installation
+			$this->doInstallation($task, $sxe);
+
+			// Remove temporary files
+			$this->cleanup($task, $sxe);
+		}
+
+		// Finally delete the instance entry + settings
+		if($this->handle_type == 'delete')
+		{
+			$app->db->query('DELETE FROM aps_instances WHERE id = "'.$app->db->quote($task['instance_id']).'";');
+			$app->db->query('DELETE FROM aps_instances_settings WHERE instance_id = "'.$app->db->quote($task['instance_id']).'";');
+		}
+
+		unset($sxe);
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 23ba8a6..f5ce39c 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -29,69 +29,69 @@
 
 class db extends mysqli
 {
-  protected $dbHost = '';		// hostname of the MySQL server
-  private $dbName = '';		// logical database name on that server
-  private $dbUser = '';		// database authorized user
-  private $dbPass = '';		// user's password
-  private $dbCharset = 'utf8';// Database charset
-  private $dbNewLink = false; // Return a new linkID when connect is called again
-  private $dbClientFlags = 0; // MySQL Client falgs
-  private $linkId = 0;		// last result of mysqli_connect()
-  private $queryId = 0;		// last result of mysqli_query()
-  private $record	= array();	// last record fetched
-  private $autoCommit = 1;    // Autocommit Transactions
-  private $currentRow;		// current row number
-  public $errorNumber = 0;	// last error number
-  public $errorMessage = '';	// last error message
-  private $errorLocation = '';// last error location
-  public $show_error_messages = false; // false in server, true in interface
-  private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
+	protected $dbHost = '';  // hostname of the MySQL server
+	private $dbName = '';  // logical database name on that server
+	private $dbUser = '';  // database authorized user
+	private $dbPass = '';  // user's password
+	private $dbCharset = 'utf8';// Database charset
+	private $dbNewLink = false; // Return a new linkID when connect is called again
+	private $dbClientFlags = 0; // MySQL Client falgs
+	private $linkId = 0;  // last result of mysqli_connect()
+	private $queryId = 0;  // last result of mysqli_query()
+	private $record = array(); // last record fetched
+	private $autoCommit = 1;    // Autocommit Transactions
+	private $currentRow;  // current row number
+	public $errorNumber = 0; // last error number
+	public $errorMessage = ''; // last error message
+	private $errorLocation = '';// last error location
+	public $show_error_messages = false; // false in server, true in interface
+	private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
 
-  // constructor
-  public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL) {
-    global $app, $conf;
+	// constructor
+	public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL) {
+		global $app, $conf;
 
-    $this->dbHost = $host ? $host  : $conf['db_host'];
-    $this->dbName = $database ? $database : $conf['db_database'];
-    $this->dbUser = $user ? $user : $conf['db_user'];
-    $this->dbPass = $pass ? $pass : $conf['db_password'];
-    $this->dbCharset = $conf['db_charset'];
-    $this->dbNewLink = $conf['db_new_link'];
-    $this->dbClientFlags = $conf['db_client_flags'];
+		$this->dbHost = $host ? $host  : $conf['db_host'];
+		$this->dbName = $database ? $database : $conf['db_database'];
+		$this->dbUser = $user ? $user : $conf['db_user'];
+		$this->dbPass = $pass ? $pass : $conf['db_password'];
+		$this->dbCharset = $conf['db_charset'];
+		$this->dbNewLink = $conf['db_new_link'];
+		$this->dbClientFlags = $conf['db_client_flags'];
 
-    parent::__construct($this->dbHost, $this->dbUser, $this->dbPass,$this->dbName);
-    $try = 0;
-    //while(!is_null($this->connect_error) && $try < 10) {
-	while(mysqli_connect_error() && $try < 10) {
-      if($try > 8) sleep(5);
-      elseif($try > 0) sleep(1);
-      
-      $try++;
-      $this->updateError('DB::__construct');
-      
-      parent::__construct($this->dbHost, $this->dbUser, $this->dbPass,$this->dbName);
-    }
-    
-    //if(is_null($this->connect_error)) $this->isConnected = true;
-	if(!mysqli_connect_error()) $this->isConnected = true;
-    
-    $this->setCharacterEncoding();
-  }
+		parent::__construct($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
+		$try = 0;
+		//while(!is_null($this->connect_error) && $try < 10) {
+		while(mysqli_connect_error() && $try < 10) {
+			if($try > 8) sleep(5);
+			elseif($try > 0) sleep(1);
 
-  public function __destruct() {
-    $this->close(); // helps avoid memory leaks, and persitent connections that don't go away.
-  }
+			$try++;
+			$this->updateError('DB::__construct');
 
-  /* This allows our private variables to be "read" out side of the class */
-   public function __get($var) {
-	   return isset($this->$var) ? $this->$var : NULL;
-   }
+			parent::__construct($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
+		}
 
-  // error handler
-  public function updateError($location) {
-    global $app;
+		//if(is_null($this->connect_error)) $this->isConnected = true;
+		if(!mysqli_connect_error()) $this->isConnected = true;
 
-	/*
+		$this->setCharacterEncoding();
+	}
+
+	public function __destruct() {
+		$this->close(); // helps avoid memory leaks, and persitent connections that don't go away.
+	}
+
+	/* This allows our private variables to be "read" out side of the class */
+	public function __get($var) {
+		return isset($this->$var) ? $this->$var : NULL;
+	}
+
+	// error handler
+	public function updateError($location) {
+		global $app;
+
+		/*
     if(!is_null($this->connect_error)) {
       $this->errorNumber = $this->connect_errno;
       $this->errorMessage = $this->connect_error;
@@ -100,185 +100,185 @@
       $this->errorMessage = $this->error;
     }
 	*/
-	if(mysqli_connect_error()) {
-      $this->errorNumber = mysqli_connect_errno();
-      $this->errorMessage = mysqli_connect_error();
-    } else {
-      $this->errorNumber = mysqli_errno($this);
-      $this->errorMessage = mysqli_error($this);
-    }
+		if(mysqli_connect_error()) {
+			$this->errorNumber = mysqli_connect_errno();
+			$this->errorMessage = mysqli_connect_error();
+		} else {
+			$this->errorNumber = mysqli_errno($this);
+			$this->errorMessage = mysqli_error($this);
+		}
 
-    $this->errorLocation = $location;
-    if($this->errorNumber) {
-      $error_msg = $this->errorLocation .' '. $this->errorMessage;
-      // This right here will allow us to use the samefile for server & interface
-      if($this->show_error_messages) {
-	echo $error_msg;
-      } else if(is_object($app) && method_exists($app, 'log')) {
-	$app->log($error_msg, LOGLEVEL_WARN);
-      } else {
-	      /* This could be called before $app is ever declared..  In that case we should just spit out to error_log() */
-	   error_log($error_msg);
-      }
-    }
-  }
-  
-  private function setCharacterEncoding() {
-    if($this->isConnected == false) return false;
-    parent::query( 'SET NAMES '.$this->dbCharset); 
-    parent::query( "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'");
-  }
-
-  public function query($queryString) {
-    if($this->isConnected == false) return false;
-    $try = 0;
-    do {
-        $try++;
-        $ok = $this->ping();
-        if(!$ok) {
-            if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
-                if($try > 9) {
-                    $this->updateError('DB::query -> reconnect');
-                    return false;
-                } else {
-                    sleep(($try > 7 ? 5 : 1));
-                }
-            } else {
-                $this->setCharacterEncoding();
-                $ok = true;
-            }
-        }
-    } while($ok == false);
-	$this->queryId = parent::query($queryString);
-    $this->updateError('DB::query('.$queryString.') -> mysqli_query');
-    if(!$this->queryId) {
-      return false;
-    }
-    $this->currentRow = 0;
-    return $this->queryId;
-  }
-
-  // returns all records in an array
-  public function queryAllRecords($queryString) {
-    if(!$this->query($queryString))
-    {
-      return false;
-    }
-    $ret = array();
-    while($line = $this->nextRecord())
-    {
-      $ret[] = $line;
-    }
-    return $ret;
-  }
-
-  // returns one record in an array
-  public function queryOneRecord($queryString) {
-    if(!$this->query($queryString) || $this->numRows() == 0)
-    {
-      return false;
-    }
-    return $this->nextRecord();
-  }
-
-  // returns the next record in an array
-  public function nextRecord() {
-    $this->record = $this->queryId->fetch_assoc();
-    $this->updateError('DB::nextRecord()-> mysql_fetch_array');
-    if(!$this->record || !is_array($this->record))
-    {
-      return false;
-    }
-    $this->currentRow++;
-    return $this->record;
-  }
-
-  // returns number of rows returned by the last select query
-  public function numRows() {
-    return $this->queryId->num_rows;
-  }
-  
-  public function affectedRows() {
-	return $this->queryId->affected_rows;
-  }
-
-  // returns mySQL insert id
-  public function insertID() {
-    return $this->insert_id;
-  }
-
-
-  // Check der variablen
-  // Really.. using quote should be phased out in favor of using bind_param's.  Though, for legacy code..
-  // here's the equivalent
-  public function quote($formfield) {
-    return $this->escape_string($formfield);
-  }
-
-  // Check der variablen
-  public function unquote($formfield) {
-    return stripslashes($formfield);
-  }
-
-public function toLower($record) {
-    if(is_array($record)) {
-      foreach($record as $key => $val) {
-	$key = strtolower($key);
-	$out[$key] = $val;
-      }
-    }
-    return $out;
-  }
-
-  public function diffrec($record_old, $record_new) {
-    $diffrec_full = array();
-    $diff_num = 0;
-
-    if(is_array($record_old) && count($record_old) > 0) {
-      foreach($record_old as $key => $val) {
-	// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
-	if(@$record_new[$key] != $val) {
-	  // Record has changed
-	  $diffrec_full['old'][$key] = $val;
-	  $diffrec_full['new'][$key] = @$record_new[$key];
-	  $diff_num++;
-	} else {
-	  $diffrec_full['old'][$key] = $val;
-	  $diffrec_full['new'][$key] = $val;
+		$this->errorLocation = $location;
+		if($this->errorNumber) {
+			$error_msg = $this->errorLocation .' '. $this->errorMessage;
+			// This right here will allow us to use the samefile for server & interface
+			if($this->show_error_messages) {
+				echo $error_msg;
+			} else if(is_object($app) && method_exists($app, 'log')) {
+					$app->log($error_msg, LOGLEVEL_WARN);
+				} else {
+				/* This could be called before $app is ever declared..  In that case we should just spit out to error_log() */
+				error_log($error_msg);
+			}
+		}
 	}
-      }
-      } elseif(is_array($record_new)) {
-	foreach($record_new as $key => $val) {
-	  if(isset($record_new[$key]) && @$record_old[$key] != $val) {
-	    // Record has changed
-	    $diffrec_full['new'][$key] = $val;
-	    $diffrec_full['old'][$key] = @$record_old[$key];
-	    $diff_num++;
-	  } else {
-	    $diffrec_full['new'][$key] = $val;
-	    $diffrec_full['old'][$key] = $val;
-	  }
+
+	private function setCharacterEncoding() {
+		if($this->isConnected == false) return false;
+		parent::query( 'SET NAMES '.$this->dbCharset);
+		parent::query( "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'");
 	}
-      }
 
-      return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
+	public function query($queryString) {
+		if($this->isConnected == false) return false;
+		$try = 0;
+		do {
+			$try++;
+			$ok = $this->ping();
+			if(!$ok) {
+				if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
+					if($try > 9) {
+						$this->updateError('DB::query -> reconnect');
+						return false;
+					} else {
+						sleep(($try > 7 ? 5 : 1));
+					}
+				} else {
+					$this->setCharacterEncoding();
+					$ok = true;
+				}
+			}
+		} while($ok == false);
+		$this->queryId = parent::query($queryString);
+		$this->updateError('DB::query('.$queryString.') -> mysqli_query');
+		if(!$this->queryId) {
+			return false;
+		}
+		$this->currentRow = 0;
+		return $this->queryId;
+	}
 
-    }
+	// returns all records in an array
+	public function queryAllRecords($queryString) {
+		if(!$this->query($queryString))
+		{
+			return false;
+		}
+		$ret = array();
+		while($line = $this->nextRecord())
+		{
+			$ret[] = $line;
+		}
+		return $ret;
+	}
 
-    //** Function to fill the datalog with a full differential record.
-    public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
-      global $app,$conf;
+	// returns one record in an array
+	public function queryOneRecord($queryString) {
+		if(!$this->query($queryString) || $this->numRows() == 0)
+		{
+			return false;
+		}
+		return $this->nextRecord();
+	}
 
-      // Insert backticks only for incomplete table names.
-      if(stristr($db_table,'.')) {
-	$escape = '';
-      } else {
-	$escape = '`';
-      }
+	// returns the next record in an array
+	public function nextRecord() {
+		$this->record = $this->queryId->fetch_assoc();
+		$this->updateError('DB::nextRecord()-> mysql_fetch_array');
+		if(!$this->record || !is_array($this->record))
+		{
+			return false;
+		}
+		$this->currentRow++;
+		return $this->record;
+	}
+
+	// returns number of rows returned by the last select query
+	public function numRows() {
+		return $this->queryId->num_rows;
+	}
+
+	public function affectedRows() {
+		return $this->queryId->affected_rows;
+	}
+
+	// returns mySQL insert id
+	public function insertID() {
+		return $this->insert_id;
+	}
+
+
+	// Check der variablen
+	// Really.. using quote should be phased out in favor of using bind_param's.  Though, for legacy code..
+	// here's the equivalent
+	public function quote($formfield) {
+		return $this->escape_string($formfield);
+	}
+
+	// Check der variablen
+	public function unquote($formfield) {
+		return stripslashes($formfield);
+	}
+
+	public function toLower($record) {
+		if(is_array($record)) {
+			foreach($record as $key => $val) {
+				$key = strtolower($key);
+				$out[$key] = $val;
+			}
+		}
+		return $out;
+	}
+
+	public function diffrec($record_old, $record_new) {
+		$diffrec_full = array();
+		$diff_num = 0;
+
+		if(is_array($record_old) && count($record_old) > 0) {
+			foreach($record_old as $key => $val) {
+				// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
+				if(@$record_new[$key] != $val) {
+					// Record has changed
+					$diffrec_full['old'][$key] = $val;
+					$diffrec_full['new'][$key] = @$record_new[$key];
+					$diff_num++;
+				} else {
+					$diffrec_full['old'][$key] = $val;
+					$diffrec_full['new'][$key] = $val;
+				}
+			}
+		} elseif(is_array($record_new)) {
+			foreach($record_new as $key => $val) {
+				if(isset($record_new[$key]) && @$record_old[$key] != $val) {
+					// Record has changed
+					$diffrec_full['new'][$key] = $val;
+					$diffrec_full['old'][$key] = @$record_old[$key];
+					$diff_num++;
+				} else {
+					$diffrec_full['new'][$key] = $val;
+					$diffrec_full['old'][$key] = $val;
+				}
+			}
+		}
+
+		return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
+
+	}
+
+	//** Function to fill the datalog with a full differential record.
+	public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
+		global $app, $conf;
+
+		// Insert backticks only for incomplete table names.
+		if(stristr($db_table, '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
 
 		if($force_update == true) {
 			//* We force a update even if no record has changed
-			$diffrec_full = array('new' => $record_new,'old' => $record_old);
+			$diffrec_full = array('new' => $record_new, 'old' => $record_old);
 			$diff_num = count($record_new);
 		} else {
 			//* get the difference record between old and new record
@@ -288,124 +288,124 @@
 			unset($tmp);
 		}
 
-      // Insert the server_id, if the record has a server_id
-      $server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
-      if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
+		// Insert the server_id, if the record has a server_id
+		$server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
+		if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
 
 
-	if($diff_num > 0) {
-		$diffstr = $this->quote(serialize($diffrec_full));
-		if(isset($_SESSION)) {
-			$username = $this->quote($_SESSION['s']['user']['username']);
-		} else {
-			$username = 'admin';
+		if($diff_num > 0) {
+			$diffstr = $this->quote(serialize($diffrec_full));
+			if(isset($_SESSION)) {
+				$username = $this->quote($_SESSION['s']['user']['username']);
+			} else {
+				$username = 'admin';
+			}
+			$dbidx = $primary_field.':'.$primary_id;
+
+			if($action == 'INSERT') $action = 'i';
+			if($action == 'UPDATE') $action = 'u';
+			if($action == 'DELETE') $action = 'd';
+			$sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
+			$this->query($sql);
 		}
-		$dbidx = $primary_field.':'.$primary_id;
 
-		if($action == 'INSERT') $action = 'i';
-		if($action == 'UPDATE') $action = 'u';
-		if($action == 'DELETE') $action = 'd';
-		$sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
-		$this->query($sql);
+		return true;
 	}
 
-      return true;
-    }
+	//** Inserts a record and saves the changes into the datalog
+	public function datalogInsert($tablename, $insert_data, $index_field) {
+		global $app;
 
-    //** Inserts a record and saves the changes into the datalog
-    public function datalogInsert($tablename, $insert_data, $index_field) {
-      global $app;
-	  
-	  if(is_array($insert_data)) {
+		if(is_array($insert_data)) {
 			$key_str = '';
 			$val_str = '';
 			foreach($insert_data as $key => $val) {
 				$key_str .= "`".$key ."`,";
 				$val_str .= "'".$this->quote($val)."',";
 			}
-			$key_str = substr($key_str,0,-1);
-			$val_str = substr($val_str,0,-1);
+			$key_str = substr($key_str, 0, -1);
+			$val_str = substr($val_str, 0, -1);
 			$insert_data_str = '('.$key_str.') VALUES ('.$val_str.')';
 		} else {
 			$insert_data_str = $insert_data;
 		}
 
-      $old_rec = array();
-      $this->query("INSERT INTO $tablename $insert_data_str");
-      $index_value = $this->insertID();
-      $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec);
+		$old_rec = array();
+		$this->query("INSERT INTO $tablename $insert_data_str");
+		$index_value = $this->insertID();
+		$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec);
 
-      return $index_value;
-    }
+		return $index_value;
+	}
 
-    //** Updates a record and saves the changes into the datalog
-    public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
+	//** Updates a record and saves the changes into the datalog
+	public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
 		global $app;
-      
-	  $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-	  
-	  if(is_array($update_data)) {
+
+		$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+
+		if(is_array($update_data)) {
 			$update_data_str = '';
 			foreach($update_data as $key => $val) {
 				$update_data_str .= "`".$key ."` = '".$this->quote($val)."',";
 			}
-			$update_data_str = substr($update_data_str,0,-1);
+			$update_data_str = substr($update_data_str, 0, -1);
 		} else {
 			$update_data_str = $update_data;
 		}
-		
-      $this->query("UPDATE $tablename SET $update_data_str WHERE $index_field = '$index_value'");
-      $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec, $force_update);
 
-      return true;
-    }
+		$this->query("UPDATE $tablename SET $update_data_str WHERE $index_field = '$index_value'");
+		$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec, $force_update);
 
-    //** Deletes a record and saves the changes into the datalog
-    public function datalogDelete($tablename, $index_field, $index_value) {
-      global $app;
+		return true;
+	}
 
-      $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->query("DELETE FROM $tablename WHERE $index_field = '$index_value'");
-      $new_rec = array();
-      $this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
-
-      return true;
-    }
-	
 	//** Deletes a record and saves the changes into the datalog
-    public function datalogError($errormsg) {
-      global $app;
-	  
-	  if(isset($app->modules->current_datalog_id) && $app->modules->current_datalog_id > 0) $this->query("UPDATE sys_datalog set error = '".$this->quote($errormsg)."' WHERE datalog_id = ".$app->modules->current_datalog_id);
+	public function datalogDelete($tablename, $index_field, $index_value) {
+		global $app;
 
-      return true;
-    }
+		$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->query("DELETE FROM $tablename WHERE $index_field = '$index_value'");
+		$new_rec = array();
+		$this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
+
+		return true;
+	}
+
+	//** Deletes a record and saves the changes into the datalog
+	public function datalogError($errormsg) {
+		global $app;
+
+		if(isset($app->modules->current_datalog_id) && $app->modules->current_datalog_id > 0) $this->query("UPDATE sys_datalog set error = '".$this->quote($errormsg)."' WHERE datalog_id = ".$app->modules->current_datalog_id);
+
+		return true;
+	}
 
 
-    public function freeResult($query) 
-    {
-      if(is_object($query) && (get_class($query) == "mysqli_result")) {
-	$query->free();
-	return true;
-      } else {
-	return false;
-      }
-    }
+	public function freeResult($query)
+	{
+		if(is_object($query) && (get_class($query) == "mysqli_result")) {
+			$query->free();
+			return true;
+		} else {
+			return false;
+		}
+	}
 
-    /* TODO: Does anything use this? */
-    public function delete() {
+	/* TODO: Does anything use this? */
+	public function delete() {
 
-    }
+	}
 
-    /* TODO: Does anything use this? */
-    public function Transaction($action) {
-      //action = begin, commit oder rollback
+	/* TODO: Does anything use this? */
+	public function Transaction($action) {
+		//action = begin, commit oder rollback
 
-    }
+	}
 
-    /*
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -419,33 +419,33 @@
 
      */
 
-    public function createTable($table_name,$columns) {
-      $index = '';
-      $sql = "CREATE TABLE $table_name (";
-      foreach($columns as $col){
-	$sql .= $col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
+	public function createTable($table_name, $columns) {
+		$index = '';
+		$sql = "CREATE TABLE $table_name (";
+		foreach($columns as $col){
+			$sql .= $col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
 
-	if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
-	if($col['notNull'] == true) {
-	  $sql .= 'NOT NULL ';
-	} else {
-	  $sql .= 'NULL ';
+			if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
+			if($col['notNull'] == true) {
+				$sql .= 'NOT NULL ';
+			} else {
+				$sql .= 'NULL ';
+			}
+			if($col['autoInc'] == true) $sql .= 'auto_increment ';
+			$sql.= ',';
+			// key Definitionen
+			if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
+			if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
+			if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+		$sql .= ')';
+		$this->query($sql);
+		return true;
 	}
-	if($col['autoInc'] == true) $sql .= 'auto_increment ';
-	$sql.= ',';
-	// key Definitionen
-	if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
-	if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
-	if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
-      }
-      $sql .= $index;
-      $sql = substr($sql,0,-1);
-      $sql .= ')';
-      $this->query($sql);
-      return true;
-    }
 
-    /*
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -458,59 +458,59 @@
 
 
      */
-    public function alterTable($table_name,$columns) {
-      $index = '';
-      $sql = "ALTER TABLE $table_name ";
-      foreach($columns as $col){
-	if($col['action'] == 'add') {
-	  $sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-	} elseif ($col['action'] == 'alter') {
-	  $sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-	} elseif ($col['action'] == 'drop') {
-	  $sql .= 'DROP '.$col['name'].' ';
+	public function alterTable($table_name, $columns) {
+		$index = '';
+		$sql = "ALTER TABLE $table_name ";
+		foreach($columns as $col){
+			if($col['action'] == 'add') {
+				$sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+			} elseif ($col['action'] == 'alter') {
+				$sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+			} elseif ($col['action'] == 'drop') {
+				$sql .= 'DROP '.$col['name'].' ';
+			}
+			if($col['action'] != 'drop') {
+				if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
+				if($col['notNull'] == true) {
+					$sql .= 'NOT NULL ';
+				} else {
+					$sql .= 'NULL ';
+				}
+				if($col['autoInc'] == true) $sql .= 'auto_increment ';
+				$sql.= ',';
+				// Index definitions
+				if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
+				if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
+				if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+			}
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+
+		//die($sql);
+		$this->query($sql);
+		return true;
 	}
-	if($col['action'] != 'drop') {  
-	  if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
-	  if($col['notNull'] == true) {
-	    $sql .= 'NOT NULL ';
-	  } else {
-	    $sql .= 'NULL ';
-	  }
-	  if($col['autoInc'] == true) $sql .= 'auto_increment ';
-	  $sql.= ',';
-	  // Index definitions
-	  if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
-	  if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
-	  if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+
+	public function dropTable($table_name) {
+		$this->check($table_name);
+		$sql = "DROP TABLE '". $table_name."'";
+		return $this->query($sql);
 	}
-      }
-      $sql .= $index;
-      $sql = substr($sql,0,-1);
 
-      //die($sql);
-      $this->query($sql);
-      return true;
-    }
+	// gibt Array mit Tabellennamen zur�ck
+	public function getTables($database_name = '') {
+		if($this->isConnected == false) return false;
+		if($database_name == '') $database_name = $this->dbName;
+		$result = parent::query("SHOW TABLES FROM $database_name");
+		for ($i = 0; $i < $result->num_rows; $i++) {
+			$tb_names[$i] = (($result->data_seek( $i) && (($___mysqli_tmp = $result->fetch_row()) !== NULL)) ? array_shift($___mysqli_tmp) : false);
+		}
+		return $tb_names;
+	}
 
-    public function dropTable($table_name) {
-      $this->check($table_name);
-      $sql = "DROP TABLE '". $table_name."'";
-      return $this->query($sql);
-    }
-
-    // gibt Array mit Tabellennamen zur�ck
-    public function getTables($database_name = '') {
-      if($this->isConnected == false) return false;
-      if($database_name == '') $database_name = $this->dbName;
-      $result = parent::query("SHOW TABLES FROM $database_name");
-      for ($i = 0; $i < $result->num_rows; $i++) {
-	$tb_names[$i] = (($result->data_seek( $i) && (($___mysqli_tmp = $result->fetch_row()) !== NULL)) ? array_shift($___mysqli_tmp) : false);
-      }
-      return $tb_names;       
-    }
-
-    // gibt Feldinformationen zur Tabelle zur�ck
-    /*
+	// gibt Feldinformationen zur Tabelle zur�ck
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -524,67 +524,67 @@
 
      */
 
-    function tableInfo($table_name) {
+	function tableInfo($table_name) {
 
-      global $go_api,$go_info;
-      // Tabellenfelder einlesen
+		global $go_api, $go_info;
+		// Tabellenfelder einlesen
 
-      if($rows = $go_api->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
-	foreach($rows as $row) {
-	  $name = $row[0];
-	  $default = $row[4];
-	  $key = $row[3];
-	  $extra = $row[5];
-	  $isnull = $row[2];
-	  $type = $row[1];
+		if($rows = $go_api->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
+			foreach($rows as $row) {
+				$name = $row[0];
+				$default = $row[4];
+				$key = $row[3];
+				$extra = $row[5];
+				$isnull = $row[2];
+				$type = $row[1];
 
 
-	  $column = array();
+				$column = array();
 
-	  $column['name'] = $name;
-	  //$column['type'] = $type;
-	  $column['defaultValue'] = $default;
-	  if(stristr($key,'PRI')) $column['option'] = 'primary';
-	  if(stristr($isnull,'YES')) {
-	    $column['notNull'] = false;
-	  } else {
-	    $column['notNull'] = true; 
-	  }
-	  if($extra == 'auto_increment') $column['autoInc'] = true;
+				$column['name'] = $name;
+				//$column['type'] = $type;
+				$column['defaultValue'] = $default;
+				if(stristr($key, 'PRI')) $column['option'] = 'primary';
+				if(stristr($isnull, 'YES')) {
+					$column['notNull'] = false;
+				} else {
+					$column['notNull'] = true;
+				}
+				if($extra == 'auto_increment') $column['autoInc'] = true;
 
 
-	  // Type in Metatype umsetzen
+				// Type in Metatype umsetzen
 
-	  if(stristr($type,'int(')) $metaType = 'int32';
-	      if(stristr($type,'bigint')) $metaType = 'int64';
-	      if(stristr($type,'char')) {
-	      $metaType = 'char';
-	      $tmp_typeValue = explode('(',$type);
-	      $column['typeValue'] = substr($tmp_typeValue[1],0,-1);  
-	      }
-	      if(stristr($type,'varchar')) {
-	      $metaType = 'varchar';
-	      $tmp_typeValue = explode('(',$type);
-	      $column['typeValue'] = substr($tmp_typeValue[1],0,-1);  
-	      }
-	      if(stristr($type,'text')) $metaType = 'text';
-	      if(stristr($type,'double')) $metaType = 'double';
-	      if(stristr($type,'blob')) $metaType = 'blob';
+				if(stristr($type, 'int(')) $metaType = 'int32';
+				if(stristr($type, 'bigint')) $metaType = 'int64';
+				if(stristr($type, 'char')) {
+					$metaType = 'char';
+					$tmp_typeValue = explode('(', $type);
+					$column['typeValue'] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, 'varchar')) {
+					$metaType = 'varchar';
+					$tmp_typeValue = explode('(', $type);
+					$column['typeValue'] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, 'text')) $metaType = 'text';
+				if(stristr($type, 'double')) $metaType = 'double';
+				if(stristr($type, 'blob')) $metaType = 'blob';
 
 
-	      $column['type'] = $metaType;
+				$column['type'] = $metaType;
 
-	      $columns[] = $column;
-	      }
-	return $columns;
-      } else {
-	return false;
-      }
+				$columns[] = $column;
+			}
+			return $columns;
+		} else {
+			return false;
+		}
 
 
-      //$this->createTable('tester',$columns);
+		//$this->createTable('tester',$columns);
 
-      /*
+		/*
 	 $result = mysql_list_fields($go_info["server"]["db_name"],$table_name);
 	 $fields = mysql_num_fields ($result);
 	 $i = 0;
@@ -609,40 +609,40 @@
 
 
 
-    }
+	}
 
-    public function mapType($metaType,$typeValue) {
-      global $go_api;
-      $metaType = strtolower($metaType);
-      switch ($metaType) {
-	case 'int16':
-	  return 'smallint';
-	  break;
-	case 'int32':
-	  return 'int';
-	  break;
-	case 'int64':
-	  return 'bigint';
-	  break;
-	case 'double':
-	  return 'double';
-	  break;
-	case 'char':
-	  return 'char';
-	  break;
-	case 'varchar':
-	  if($typeValue < 1) die('Database failure: Lenght required for these data types.');
-	  return 'varchar('.$typeValue.')';
-	      break;
-	      case 'text':
-	      return 'text';
-	      break;
-	      case 'blob':
-	      return 'blob';
-	      break;
-	      }
-	      }
+	public function mapType($metaType, $typeValue) {
+		global $go_api;
+		$metaType = strtolower($metaType);
+		switch ($metaType) {
+		case 'int16':
+			return 'smallint';
+			break;
+		case 'int32':
+			return 'int';
+			break;
+		case 'int64':
+			return 'bigint';
+			break;
+		case 'double':
+			return 'double';
+			break;
+		case 'char':
+			return 'char';
+			break;
+		case 'varchar':
+			if($typeValue < 1) die('Database failure: Lenght required for these data types.');
+			return 'varchar('.$typeValue.')';
+			break;
+		case 'text':
+			return 'text';
+			break;
+		case 'blob':
+			return 'blob';
+			break;
+		}
+	}
 
-	      }
+}
 
-	      ?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/file.inc.php b/server/lib/classes/file.inc.php
index c1f031b..a5f4c84 100644
--- a/server/lib/classes/file.inc.php
+++ b/server/lib/classes/file.inc.php
@@ -29,250 +29,250 @@
 */
 
 class file{
-    
-    function rf($file){
-      global $app;
-      clearstatcache();
-      if(!$fp = fopen ($file, 'rb')){
-        $app->log('WARNING: Could not open file '.$file, 2);
-        return false;
-      } else {
-        if(filesize($file) > 0){
-          $content = fread($fp, filesize($file));
-        } else {
-          $content = '';
-        }
-        fclose($fp);
-        return $content;
-      }
-    }
-    
-    function wf($file, $content){
-      global $app;
-      $this->mkdirs(dirname($file));
-      if(!$fp = fopen ($file, 'wb')){
-        $app->log('WARNING: Could not open file '.$file, 2);
-        return false;
-      } else {
-        fwrite($fp,$content);
-        fclose($fp);
-        return true;
-      }
-    }
-    
-    function af($file, $content){
-      global $app;
-      $this->mkdirs(dirname($file));
-      if(!$fp = fopen ($file, 'ab')){
-        $app->log('WARNING: Could not open file '.$file, 2);
-        return false;
-      } else {
-        fwrite($fp,$content);
-        fclose($fp);
-        return true;
-      }
-    }
-    
-    function no_comments($file, $comment = '#'){
-      $content = $this->unix_nl($this->rf($file));
-      $lines = explode("\n", $content);
-      if(!empty($lines)){
-        foreach($lines as $line){
-          if(strstr($line, $comment)){
-            $pos = strpos($line, $comment);
-            if($pos != 0){
-              $new_lines[] = substr($line,0,$pos);
-            } else {
-              $new_lines[] = '';
-            }
-          } else {
-            $new_lines[] = $line;
-          }
-        }
-      }
-      if(is_array($new_lines)){
-        $content_without_comments = implode("\n", $new_lines);
-        $new_lines = NULL;
-        return $content_without_comments;
-      } else {
-        return '';
-      }
-    }
-    
-    function manual_entries($file, $separator = '#### MAKE MANUAL ENTRIES BELOW THIS LINE! ####'){
-      if(is_file($file)){
-        $content = $this->rf($file);
-        $parts = explode($separator, $content);
-        $manual = "\n".trim($parts[1]);
-        return $manual;
-      } else {
-        return '';
-      }
-    }
-    
-    function remove_blank_lines($input, $file = 1){
-      //Leerzeilen löschen
-      if($file){
-        $content = $this->unix_nl($this->rf($input));
-      } else {
-        $content = $input;
-      }
-      $lines = explode("\n", $content);
-      if(!empty($lines)){
-        foreach($lines as $line){
-          if(trim($line) != '') $new_lines[] = $line;
-        }
-      }
-      if(is_array($new_lines)){
-        $content = implode("\n", $new_lines);
-      } else {
-        $content = '';
-      }
-      if($file){
-        $this->wf($input, $content);
-      } else {
-        return $content;
-      }
-    }
-    
-    function unix_nl($input){
-      $output = str_replace("\r\n", "\n", $input);
-      $output = str_replace("\r", "\n", $output);
-      return $output;
-    }
-    
-    function fileowner($file){
-      $owner_id = fileowner($file);
-      clearstatcache();
-      return $owner_id;
-    }
-    
-    function mkdirs($strPath, $mode = '0755'){
-      // Verzeichnisse rekursiv erzeugen
-      if(is_dir($strPath)) return true;
-      $pStrPath = dirname($strPath);
-      if(!$this->mkdirs($pStrPath, $mode)) return false;
-      $old_umask = umask(0);
-      $ret_val = mkdir($strPath, octdec($mode));
-      umask($old_umask);
-      return $ret_val;
-    }
-    
-    function edit_dist($var, $val){
-      global $$var;
-      $files = array('/root/ispconfig/dist.inc.php');
-      foreach($files as $file){
-        if(is_file($file)){
-          $file_content = $this->unix_nl($this->rf($file));
-          $lines = explode("\n", $file_content);
-          for($i=0;$i<sizeof($lines);$i++){
-            $parts = explode('=', $lines[$i]);
-            if($parts[0] == $var || $parts[0] == '$'.$var.' '){
-              $parts[1] = str_replace($$var, $val, $parts[1]);
-            }
-            $lines[$i] = implode('=', $parts);
-          }
-          $file_content = implode("\n", $lines);
-          $this->wf($file, $file_content);
-        }
-      }
-    }
-    
-    function getDirectoryListing($dirname, $sortorder = 'a', $show_subdirs = 0, $show_subdirfiles = 0, $exts = '', $ext_save = 1){
-    // This function will return an array with filenames based on the criteria you can set in the variables
-    // @sortorder : a for ascending (the standard) or d for descending (you can use the "r" for reverse as well, works the same)
-    // @show_subdirs : 0 for NO, 1 for YES - meaning it will show the names of subdirectories if there are any
-    // Logically subdirnames will not be checked for the required extentions
-    // @show_subdirfiles : 0 for NO, 1 for YES - meaning it will show files from the subdirs
-    // Files from subdirs will be prefixed with the subdir name and checked for the required extentions.
-    // @exts can be either a string or an array, if not passed to the function, then the default will be a check for common image files
-    // If exts is set to "all" then all extentions are allowed
-    // @ext_save : 1 for YES, 0 for NO - meaning it will filter out system files or not (such as .htaccess)
-    
-       $dirname = realpath($dirname);
-       if (!$exts || empty($exts) || $exts == '') {
-           $exts = array('jpg', 'gif', 'jpeg', 'png');
-       }
-       if ($handle = opendir($dirname)) {
-           $filelist = array();
-           while (false !== ($file = readdir($handle))) {
-    
-               // Filter out higher directory references
-               if ($file != '.' && $file != '..') {
-                   // Only look at directories or files, filter out symbolic links
-                   if ( filetype ($dirname.'/'.$file) != 'link') {
-                       // If it's a file, check against valid extentions and add to the list
-                       if ( filetype ($dirname.'/'.$file) == 'file' ) {
-                           if ($this->checkFileExtension($file, $exts, $ext_save)) {
-                                           $filelist[] = $file;
-                           }
-                       }
-                       // If it's a directory and either subdirs should be listed or files from subdirs add relevant names to the list
-                       else if ( filetype ($dirname.'/'.$file) == 'dir' && ($show_subdirs == 1 || $show_subdirfiles == 1)) {
-                           if ($show_subdirs == 1) {
-                               $filelist[] = $file;
-                           }
-                           if ($show_subdirfiles == 1) {
-                               $subdirname = $file;
-                               $subdirfilelist = $this->getDirectoryListing($dirname.'/'.$subdirname.'/', $sortorder, $show_subdirs, $show_subdirfiles, $exts, $ext_save);
-                               for ($i = 0 ; $i < count($subdirfilelist) ; $i++) {
-                                   $subdirfilelist[$i] = $subdirname.'/'.$subdirfilelist[$i];
-                               }
-                               $filelist = array_merge($filelist, $subdirfilelist);
-                           }
-    
-                       }
-    
-                   }
-               }
-           }
-           closedir($handle);
-    
-           // Sort the results
-           if (count($filelist) > 1) {
-               natcasesort($filelist);
-               if ($sortorder == 'd' || $sortorder == 'r' ) {
-                   $filelist = array_reverse($filelist, TRUE);
-               }
-           }
-           return $filelist;
-       }
-       else {
-           return false;
-       }
-    }
-    
-    function checkFileExtension($filename, $exts, $ext_save = 1){
-       $passed = FALSE;
-       if ($ext_save == 1) {
-           if (preg_match("/^\./", $filename)) {
-               return $passed;
-           }
-       }
-       if ($exts == 'all') {
-                       $passed = TRUE;
-           return $passed;
-       }
-       if (is_string($exts)) {
-           if (preg_match("/\.". $exts ."$/i", $filename)) {
-                           $passed = TRUE;
-               return $passed;
-           }
-       } else if (is_array($exts)) {
-           foreach ($exts as $theExt) {
-               if (preg_match("/\.". $theExt ."$/i", $filename)) {
-                   $passed = TRUE;
-                   return $passed;
-               }
-           }
-       }
-       return $passed;
-    }
-	
+
+	function rf($file){
+		global $app;
+		clearstatcache();
+		if(!$fp = fopen($file, 'rb')){
+			$app->log('WARNING: Could not open file '.$file, 2);
+			return false;
+		} else {
+			if(filesize($file) > 0){
+				$content = fread($fp, filesize($file));
+			} else {
+				$content = '';
+			}
+			fclose($fp);
+			return $content;
+		}
+	}
+
+	function wf($file, $content){
+		global $app;
+		$this->mkdirs(dirname($file));
+		if(!$fp = fopen($file, 'wb')){
+			$app->log('WARNING: Could not open file '.$file, 2);
+			return false;
+		} else {
+			fwrite($fp, $content);
+			fclose($fp);
+			return true;
+		}
+	}
+
+	function af($file, $content){
+		global $app;
+		$this->mkdirs(dirname($file));
+		if(!$fp = fopen($file, 'ab')){
+			$app->log('WARNING: Could not open file '.$file, 2);
+			return false;
+		} else {
+			fwrite($fp, $content);
+			fclose($fp);
+			return true;
+		}
+	}
+
+	function no_comments($file, $comment = '#'){
+		$content = $this->unix_nl($this->rf($file));
+		$lines = explode("\n", $content);
+		if(!empty($lines)){
+			foreach($lines as $line){
+				if(strstr($line, $comment)){
+					$pos = strpos($line, $comment);
+					if($pos != 0){
+						$new_lines[] = substr($line, 0, $pos);
+					} else {
+						$new_lines[] = '';
+					}
+				} else {
+					$new_lines[] = $line;
+				}
+			}
+		}
+		if(is_array($new_lines)){
+			$content_without_comments = implode("\n", $new_lines);
+			$new_lines = NULL;
+			return $content_without_comments;
+		} else {
+			return '';
+		}
+	}
+
+	function manual_entries($file, $separator = '#### MAKE MANUAL ENTRIES BELOW THIS LINE! ####'){
+		if(is_file($file)){
+			$content = $this->rf($file);
+			$parts = explode($separator, $content);
+			$manual = "\n".trim($parts[1]);
+			return $manual;
+		} else {
+			return '';
+		}
+	}
+
+	function remove_blank_lines($input, $file = 1){
+		//Leerzeilen löschen
+		if($file){
+			$content = $this->unix_nl($this->rf($input));
+		} else {
+			$content = $input;
+		}
+		$lines = explode("\n", $content);
+		if(!empty($lines)){
+			foreach($lines as $line){
+				if(trim($line) != '') $new_lines[] = $line;
+			}
+		}
+		if(is_array($new_lines)){
+			$content = implode("\n", $new_lines);
+		} else {
+			$content = '';
+		}
+		if($file){
+			$this->wf($input, $content);
+		} else {
+			return $content;
+		}
+	}
+
+	function unix_nl($input){
+		$output = str_replace("\r\n", "\n", $input);
+		$output = str_replace("\r", "\n", $output);
+		return $output;
+	}
+
+	function fileowner($file){
+		$owner_id = fileowner($file);
+		clearstatcache();
+		return $owner_id;
+	}
+
+	function mkdirs($strPath, $mode = '0755'){
+		// Verzeichnisse rekursiv erzeugen
+		if(is_dir($strPath)) return true;
+		$pStrPath = dirname($strPath);
+		if(!$this->mkdirs($pStrPath, $mode)) return false;
+		$old_umask = umask(0);
+		$ret_val = mkdir($strPath, octdec($mode));
+		umask($old_umask);
+		return $ret_val;
+	}
+
+	function edit_dist($var, $val){
+		global $$var;
+		$files = array('/root/ispconfig/dist.inc.php');
+		foreach($files as $file){
+			if(is_file($file)){
+				$file_content = $this->unix_nl($this->rf($file));
+				$lines = explode("\n", $file_content);
+				for($i=0;$i<sizeof($lines);$i++){
+					$parts = explode('=', $lines[$i]);
+					if($parts[0] == $var || $parts[0] == '$'.$var.' '){
+						$parts[1] = str_replace($$var, $val, $parts[1]);
+					}
+					$lines[$i] = implode('=', $parts);
+				}
+				$file_content = implode("\n", $lines);
+				$this->wf($file, $file_content);
+			}
+		}
+	}
+
+	function getDirectoryListing($dirname, $sortorder = 'a', $show_subdirs = 0, $show_subdirfiles = 0, $exts = '', $ext_save = 1){
+		// This function will return an array with filenames based on the criteria you can set in the variables
+		// @sortorder : a for ascending (the standard) or d for descending (you can use the "r" for reverse as well, works the same)
+		// @show_subdirs : 0 for NO, 1 for YES - meaning it will show the names of subdirectories if there are any
+		// Logically subdirnames will not be checked for the required extentions
+		// @show_subdirfiles : 0 for NO, 1 for YES - meaning it will show files from the subdirs
+		// Files from subdirs will be prefixed with the subdir name and checked for the required extentions.
+		// @exts can be either a string or an array, if not passed to the function, then the default will be a check for common image files
+		// If exts is set to "all" then all extentions are allowed
+		// @ext_save : 1 for YES, 0 for NO - meaning it will filter out system files or not (such as .htaccess)
+
+		$dirname = realpath($dirname);
+		if (!$exts || empty($exts) || $exts == '') {
+			$exts = array('jpg', 'gif', 'jpeg', 'png');
+		}
+		if ($handle = opendir($dirname)) {
+			$filelist = array();
+			while (false !== ($file = readdir($handle))) {
+
+				// Filter out higher directory references
+				if ($file != '.' && $file != '..') {
+					// Only look at directories or files, filter out symbolic links
+					if ( filetype($dirname.'/'.$file) != 'link') {
+						// If it's a file, check against valid extentions and add to the list
+						if ( filetype($dirname.'/'.$file) == 'file' ) {
+							if ($this->checkFileExtension($file, $exts, $ext_save)) {
+								$filelist[] = $file;
+							}
+						}
+						// If it's a directory and either subdirs should be listed or files from subdirs add relevant names to the list
+						else if ( filetype($dirname.'/'.$file) == 'dir' && ($show_subdirs == 1 || $show_subdirfiles == 1)) {
+								if ($show_subdirs == 1) {
+									$filelist[] = $file;
+								}
+								if ($show_subdirfiles == 1) {
+									$subdirname = $file;
+									$subdirfilelist = $this->getDirectoryListing($dirname.'/'.$subdirname.'/', $sortorder, $show_subdirs, $show_subdirfiles, $exts, $ext_save);
+									for ($i = 0 ; $i < count($subdirfilelist) ; $i++) {
+										$subdirfilelist[$i] = $subdirname.'/'.$subdirfilelist[$i];
+									}
+									$filelist = array_merge($filelist, $subdirfilelist);
+								}
+
+							}
+
+					}
+				}
+			}
+			closedir($handle);
+
+			// Sort the results
+			if (count($filelist) > 1) {
+				natcasesort($filelist);
+				if ($sortorder == 'd' || $sortorder == 'r' ) {
+					$filelist = array_reverse($filelist, TRUE);
+				}
+			}
+			return $filelist;
+		}
+		else {
+			return false;
+		}
+	}
+
+	function checkFileExtension($filename, $exts, $ext_save = 1){
+		$passed = FALSE;
+		if ($ext_save == 1) {
+			if (preg_match("/^\./", $filename)) {
+				return $passed;
+			}
+		}
+		if ($exts == 'all') {
+			$passed = TRUE;
+			return $passed;
+		}
+		if (is_string($exts)) {
+			if (preg_match("/\.". $exts ."$/i", $filename)) {
+				$passed = TRUE;
+				return $passed;
+			}
+		} else if (is_array($exts)) {
+				foreach ($exts as $theExt) {
+					if (preg_match("/\.". $theExt ."$/i", $filename)) {
+						$passed = TRUE;
+						return $passed;
+					}
+				}
+			}
+		return $passed;
+	}
+
 	function removeDirectory($dir){
 		//TODO: implement something to delete files/directories recursively that are owned by a certain user or group
 		if(is_dir($dir)){
-			$files = array_diff(scandir($dir), array('.','..'));
+			$files = array_diff(scandir($dir), array('.', '..'));
 			if(is_array($files) && !empty($files)){
 				foreach($files as $file){
 					if(is_dir($dir.'/'.$file)){
@@ -287,4 +287,5 @@
 	}
 
 }
+
 ?>
diff --git a/server/lib/classes/getconf.inc.php b/server/lib/classes/getconf.inc.php
index b995a39..c5ca6c6 100644
--- a/server/lib/classes/getconf.inc.php
+++ b/server/lib/classes/getconf.inc.php
@@ -31,7 +31,7 @@
 class getconf {
 
 	var $config;
-	
+
 	function get_server_config($server_id, $section = '') {
 		global $app;
 
@@ -41,17 +41,17 @@
 			$server = $app->db->queryOneRecord('SELECT config FROM server WHERE server_id = '.$server_id);
 			$this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server['config']));
 		}
-		
+
 		if($section == '') {
 			return $this->config[$server_id];
 		} else {
 			return $this->config[$server_id][$section];
 		}
 	}
-	
+
 	public function get_global_config($section = '') {
 		global $app;
-		
+
 		if(!@is_array($this->config['global'])) {
 			$app->uses('ini_parser');
 			$tmp = $app->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1');
@@ -59,6 +59,7 @@
 		}
 		return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
 	}
+
 }
 
 ?>
diff --git a/server/lib/classes/ini_parser.inc.php b/server/lib/classes/ini_parser.inc.php
index 003d04c..d4c9454 100644
--- a/server/lib/classes/ini_parser.inc.php
+++ b/server/lib/classes/ini_parser.inc.php
@@ -33,9 +33,9 @@
 	var $config;
 
 	function parse_ini_string($ini) {
-		$ini = str_replace("\r\n","\n",$ini);
-		$lines = explode("\n",$ini);
-		
+		$ini = str_replace("\r\n", "\n", $ini);
+		$lines = explode("\n", $ini);
+
 		foreach($lines as $line) {
 			$line = trim($line);
 			if($line != '') {
@@ -58,8 +58,8 @@
 			$content .= "[$section]\n";
 			foreach($data as $item => $value) {
 				if($value != '') {
-					$value 	= trim($value);
-					$item 	= trim($item);
+					$value  = trim($value);
+					$item  = trim($item);
 					$content .= "$item=$value\n";
 				}
 			}
diff --git a/server/lib/classes/mod_mail_base.inc.php b/server/lib/classes/mod_mail_base.inc.php
index 01ffda5..bb25e5d 100644
--- a/server/lib/classes/mod_mail_base.inc.php
+++ b/server/lib/classes/mod_mail_base.inc.php
@@ -29,48 +29,48 @@
 */
 
 class mail_base {
-	
+
 	var $current_record = array();
-	
+
 	function write_config() {
-		
-		
-		
+
+
+
 	}
-	
+
 	/*
 		Domain Alias
 	*/
-	
+
 	function domain_add($domain) {
-		
+
 	}
-	
+
 	function domain_update($domain_old, $domain_new) {
-		
+
 	}
-	
+
 	function domain_delete($domain) {
-		
+
 	}
-	
+
 	/*
 		Domain Alias
 	*/
-	
+
 	function domain_alias_add($domain, $destination) {
-		
+
 	}
-	
+
 	function domain_alias_update($domain_old, $domain_new) {
-		
+
 	}
-	
+
 	function domain_alias_delete($domain) {
-		
+
 	}
-	
-	
+
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/modules.inc.php b/server/lib/classes/modules.inc.php
index 57ab22c..194bf4f 100644
--- a/server/lib/classes/modules.inc.php
+++ b/server/lib/classes/modules.inc.php
@@ -29,17 +29,17 @@
 */
 
 class modules {
-	
+
 	var $notification_hooks = array();
 	var $current_datalog_id = 0;
 	var $debug = false;
-	
+
 	/*
 	 This function is called to load the modules from the mods-enabled or the mods-core folder
 	*/
 	function loadModules($type) {
 		global $app, $conf;
-		
+
 		$subPath = 'mods-enabled';
 		if ($type == 'core') $subPath = 'mods-core';
 
@@ -47,41 +47,41 @@
 		if (is_dir($modules_dir)) {
 			if ($dh = opendir($modules_dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						$module_name = substr($file,0,-8);
-						include_once($modules_dir.$file);
-						if($this->debug) $app->log('Loading Module: '.$module_name,LOGLEVEL_DEBUG);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						$module_name = substr($file, 0, -8);
+						include_once $modules_dir.$file;
+						if($this->debug) $app->log('Loading Module: '.$module_name, LOGLEVEL_DEBUG);
 						$app->loaded_modules[$module_name] = new $module_name;
 						$app->loaded_modules[$module_name]->onLoad();
 					}
 				}
 			}
 		} else {
-			$app->log('Modules directory missing: '.$modules_dir,LOGLEVEL_ERROR);
+			$app->log('Modules directory missing: '.$modules_dir, LOGLEVEL_ERROR);
 		}
-		
+
 	}
-	
+
 	/*
 	 This function is called by the modules to register for a specific
 	 table change notification
 	*/
-	
-	function registerTableHook($table_name,$module_name,$function_name) {
+
+	function registerTableHook($table_name, $module_name, $function_name) {
 		global $app;
 		$this->notification_hooks[$table_name][] = array('module' => $module_name, 'function' => $function_name);
-		if($this->debug) $app->log("Registered TableHook '$table_name' in module '$module_name' for processing function '$function_name'",LOGLEVEL_DEBUG);
+		if($this->debug) $app->log("Registered TableHook '$table_name' in module '$module_name' for processing function '$function_name'", LOGLEVEL_DEBUG);
 	}
-	
+
 	/*
 	 This function goes through all new records in the
 	 sys_datalog table and and calls the function in the
 	 modules that hooked on to the table change.
 	*/
-	
+
 	function processDatalog() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		//* If its a multiserver setup
 		if($app->db->dbHost != $app->dbmaster->dbHost || ($app->db->dbHost == $app->dbmaster->dbHost && $app->db->dbName != $app->dbmaster->dbName)) {
 			if($conf['mirror_server_id'] > 0) {
@@ -89,10 +89,10 @@
 			} else {
 				$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf['server_id']." OR server_id = 0) ORDER BY datalog_id LIMIT 0,1000";
 			}
-			
+
 			$records = $app->dbmaster->queryAllRecords($sql);
 			foreach($records as $d) {
-				
+
 				//** encode data to utf-8 and unserialize it
 				if(!$data = unserialize(stripslashes($d['data']))) {
 					$data = unserialize($d['data']);
@@ -106,17 +106,17 @@
 					$data['new'][$key] = utf8_decode($val);
 				}
 				*/
-				
+
 				$replication_error = false;
 				$data['mirrored'] = false;
-				
+
 				$this->current_datalog_id = $d['datalog_id'];
-				
+
 				/*
-				* If we are in a mirror setup, rewrite the server_id of records that originally 
+				* If we are in a mirror setup, rewrite the server_id of records that originally
 				* belonged to the mirrored server to the local server_id
 				*/
-				
+
 				if($conf['mirror_server_id'] > 0 && $d['dbtable'] != 'server') {
 					if(isset($data['new']['server_id']) && $data['new']['server_id'] == $conf['mirror_server_id']) {
 						$data['new']['server_id'] = $conf['server_id'];
@@ -127,18 +127,18 @@
 						$data['mirrored'] = true;
 					}
 				}
-				
+
 				if(count($data['new']) > 0) {
 					if($d['action'] == 'i' || $d['action'] == 'u') {
-						$idx = explode(':',$d['dbidx']);
+						$idx = explode(':', $d['dbidx']);
 						$tmp_sql1 = '';
 						$tmp_sql2 = '';
 						foreach($data['new'] as $fieldname => $val) {
 							$tmp_sql1 .= "`$fieldname`,";
 							$tmp_sql2 .= "'".$app->db->quote($val)."',";
 						}
-						$tmp_sql1 = substr($tmp_sql1,0,-1);
-						$tmp_sql2 = substr($tmp_sql2,0,-1);
+						$tmp_sql1 = substr($tmp_sql1, 0, -1);
+						$tmp_sql2 = substr($tmp_sql2, 0, -1);
 						//$tmp_sql1 .= "$idx[0]";
 						//$tmp_sql2 .= "$idx[1]";
 						$sql = "REPLACE INTO $d[dbtable] ($tmp_sql1) VALUES ($tmp_sql2)";
@@ -147,9 +147,9 @@
 						$app->db->query($sql);
 						if($app->db->errorNumber > 0) {
 							$replication_error = true;
-							$app->log("Replication failed. Error: (" . $d['dbtable'] . ") in MySQL server: (".$app->db->dbHost.") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
+							$app->log("Replication failed. Error: (" . $d['dbtable'] . ") in MySQL server: (".$app->db->dbHost.") " . $app->db->errorMessage . " # SQL: " . $sql, LOGLEVEL_ERROR);
 						}
-						$app->log('Replicated from master: '.$sql,LOGLEVEL_DEBUG);
+						$app->log('Replicated from master: '.$sql, LOGLEVEL_DEBUG);
 					}
 					/*
 					if($d["action"] == 'u') {
@@ -169,29 +169,29 @@
 					}
 					*/
 					if($d['action'] == 'd') {
-						$idx = explode(':',$d['dbidx']);
+						$idx = explode(':', $d['dbidx']);
 						$sql = "DELETE FROM $d[dbtable] ";
 						$sql .= " WHERE $idx[0] = $idx[1]";
 						$app->db->query($sql);
 						if($app->db->errorNumber > 0) {
 							$replication_error = true;
-							$app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
+							$app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql, LOGLEVEL_ERROR);
 						}
-						$app->log('Replicated from master: '.$sql,LOGLEVEL_DEBUG);
+						$app->log('Replicated from master: '.$sql, LOGLEVEL_DEBUG);
 					}
-				
-				
+
+
 					if($replication_error == false) {
 						if(is_array($data['old']) || is_array($data['new'])) {
 							$app->db->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf['server_id']);
-							$this->raiseTableHook($d['dbtable'],$d['action'],$data);
+							$this->raiseTableHook($d['dbtable'], $d['action'], $data);
 						} else {
-							$app->log('Data array was empty for datalog_id '.$d['datalog_id'],LOGLEVEL_WARN);
+							$app->log('Data array was empty for datalog_id '.$d['datalog_id'], LOGLEVEL_WARN);
 						}
 						$app->dbmaster->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf['server_id']);
-						$app->log('Processed datalog_id '.$d['datalog_id'],LOGLEVEL_DEBUG);
+						$app->log('Processed datalog_id '.$d['datalog_id'], LOGLEVEL_DEBUG);
 					} else {
-						$app->log('Error in Replication, changes were not processed.',LOGLEVEL_ERROR);
+						$app->log('Error in Replication, changes were not processed.', LOGLEVEL_ERROR);
 						/*
 						 * If there is any error in processing the datalog we can't continue, because
 						 * we do not know if the newer actions require this (old) one.
@@ -199,16 +199,16 @@
 						return;
 					}
 				} else {
-					$app->log('Datalog does not contain any changes for this record '.$d['datalog_id'],LOGLEVEL_DEBUG);
+					$app->log('Datalog does not contain any changes for this record '.$d['datalog_id'], LOGLEVEL_DEBUG);
 				}
 			}
-			
-		//* if we have a single server setup
+
+			//* if we have a single server setup
 		} else {
 			$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf['server_id']." OR server_id = 0) ORDER BY datalog_id LIMIT 0,1000";
 			$records = $app->db->queryAllRecords($sql);
 			foreach($records as $d) {
-				
+
 				//** encode data to utf-8 to be able to unserialize it and then unserialize it
 				if(!$data = unserialize(stripslashes($d['data']))) {
 					$data = unserialize($d['data']);
@@ -222,51 +222,51 @@
 					$data['new'][$key] = utf8_decode($val);
 				}
 				*/
-				
+
 				//* Data on a single server is never mirrored
 				$data['mirrored'] = false;
-				
+
 				$this->current_datalog_id = $d['datalog_id'];
 				if(is_array($data['old']) || is_array($data['new'])) {
-					$this->raiseTableHook($d['dbtable'],$d['action'],$data);
+					$this->raiseTableHook($d['dbtable'], $d['action'], $data);
 				} else {
-					$app->log('Data array was empty for datalog_id '.$d['datalog_id'],LOGLEVEL_WARN);
+					$app->log('Data array was empty for datalog_id '.$d['datalog_id'], LOGLEVEL_WARN);
 				}
 				//$app->db->query("DELETE FROM sys_datalog WHERE datalog_id = ".$rec["datalog_id"]);
 				//$app->log("Deleting sys_datalog ID ".$rec["datalog_id"],LOGLEVEL_DEBUG);
 				$app->db->query("UPDATE server SET updated = ".$d['datalog_id']." WHERE server_id = ".$conf['server_id']);
-				$app->log('Processed datalog_id '.$d['datalog_id'],LOGLEVEL_DEBUG);
+				$app->log('Processed datalog_id '.$d['datalog_id'], LOGLEVEL_DEBUG);
 			}
 		}
 	}
-	
+
 	function processActions() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		//* get the server_id of the local server
 		$server_id = intval($conf["server_id"]);
-		
-		include_once (SCRIPT_PATH."/lib/remote_action.inc.php");
-		
+
+		include_once SCRIPT_PATH."/lib/remote_action.inc.php";
+
 		//* SQL query to get all pending actions
 		$sql = "SELECT action_id, action_type, action_param " .
-				"FROM sys_remoteaction " .
-				"WHERE server_id = " . $server_id . " ".
-				" AND  action_id > " . intval($maxid_remote_action) . " ".
-				"ORDER BY action_id";
-		
+			"FROM sys_remoteaction " .
+			"WHERE server_id = " . $server_id . " ".
+			" AND  action_id > " . intval($maxid_remote_action) . " ".
+			"ORDER BY action_id";
+
 		$actions = $app->dbmaster->queryAllRecords($sql);
-		
+
 		if(is_array($actions)) {
 			foreach($actions as $action) {
-				
+
 				//* Raise the action
-				$state = $app->plugins->raiseAction($action['action_type'],$action['action_param']);
-				
+				$state = $app->plugins->raiseAction($action['action_type'], $action['action_param']);
+
 				//* Update the action state
 				$sql = "UPDATE sys_remoteaction " .
-						"SET action_state = '" . $app->dbmaster->quote($state) . "' " .
-						"WHERE action_id = " . intval($action['action_id']);
+					"SET action_state = '" . $app->dbmaster->quote($state) . "' " .
+					"WHERE action_id = " . intval($action['action_id']);
 				$app->dbmaster->query($sql);
 
 				/*
@@ -278,26 +278,26 @@
 				fclose($fp);
 			}
 		}
-		
-		
-		
+
+
+
 	}
-	
-	function raiseTableHook($table_name,$action,$data) {
+
+	function raiseTableHook($table_name, $action, $data) {
 		global $app;
-		
+
 		// Get the hooks for this table
 		$hooks = (isset($this->notification_hooks[$table_name]))?$this->notification_hooks[$table_name]:'';
-		if($this->debug) $app->log("Raised TableHook for table: '$table_name'",LOGLEVEL_DEBUG);
-		
+		if($this->debug) $app->log("Raised TableHook for table: '$table_name'", LOGLEVEL_DEBUG);
+
 		if(is_array($hooks)) {
 			foreach($hooks as $hook) {
 				$module_name = $hook['module'];
 				$function_name = $hook['function'];
 				// Call the processing function of the module
-				if($this->debug) $app->log("Call function '$function_name' in module '$module_name' raised by TableHook '$table_name'.",LOGLEVEL_DEBUG);
+				if($this->debug) $app->log("Call function '$function_name' in module '$module_name' raised by TableHook '$table_name'.", LOGLEVEL_DEBUG);
 				// call_user_method($function_name,$app->loaded_modules[$module_name],$table_name,$action,$data);
-				call_user_func(array($app->loaded_modules[$module_name],$function_name),$table_name,$action,$data);
+				call_user_func(array($app->loaded_modules[$module_name], $function_name), $table_name, $action, $data);
 				unset($module_name);
 				unset($function_name);
 			}
@@ -305,7 +305,7 @@
 		unset($hook);
 		unset($hooks);
 	}
-	
+
 }
 
 ?>
diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 0b1caa6..8f00088 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -55,64 +55,64 @@
 				$distname = 'Ubuntu';
 				$distid = 'debian40';
 				$distbaseid = 'debian';
-				$ver = explode(' ',$issue);
+				$ver = explode(' ', $issue);
 				$ver = array_filter($ver);
 				$ver = next($ver);
-				$mainver = explode('.',$ver);
+				$mainver = explode('.', $ver);
 				$mainver = array_filter($mainver);
 				$mainver = current($mainver).'.'.next($mainver);
 				switch ($mainver){
 				case "12.10":
 					$relname = "(Quantal Quetzal)";
-				break;
+					break;
 				case "12.04":
 					$relname = "(Precise Pangolin)";
-				break;
+					break;
 				case "11.10":
 					$relname = "(Oneiric Ocelot)";
-				break;
+					break;
 				case "11.14":
 					$relname = "(Natty Narwhal)";
-				break;
+					break;
 				case "10.10":
 					$relname = "(Maverick Meerkat)";
-				break;
+					break;
 				case "10.04":
 					$relname = "(Lucid Lynx)";
-				break;
+					break;
 				case "9.10":
 					$relname = "(Karmic Koala)";
-				break;
+					break;
 				case "9.04":
 					$relname = "(Jaunty Jackpole)";
-				break;
+					break;
 				case "8.10":
-				$relname = "(Intrepid Ibex)";
-				break;
+					$relname = "(Intrepid Ibex)";
+					break;
 				case "8.04":
 					$relname = "(Hardy Heron)";
-				break;
+					break;
 				case "7.10":
 					$relname = "(Gutsy Gibbon)";
-				break;
+					break;
 				case "7.04":
 					$relname = "(Feisty Fawn)";
-				break;
+					break;
 				case "6.10":
 					$relname = "(Edgy Eft)";
-				break;
+					break;
 				case "6.06":
 					$relname = "(Dapper Drake)";
-				break;
+					break;
 				case "5.10":
 					$relname = "(Breezy Badger)";
-				break;
+					break;
 				case "5.04":
 					$relname = "(Hoary Hedgehog)";
-				break;
+					break;
 				case "4.10":
 					$relname = "(Warty Warthog)";
-				break;
+					break;
 				default:
 					$relname = "UNKNOWN";
 				}
@@ -226,9 +226,9 @@
 		return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid);
 	}
 
-		//** Email Quota
-		public function monitorEmailQuota() {
-				global $conf, $app;
+	//** Email Quota
+	public function monitorEmailQuota() {
+		global $conf, $app;
 
 		//* Initialize data array
 		$data = array();
@@ -246,15 +246,15 @@
 		if(is_array($mailboxes)) {
 			foreach($mailboxes as $mb) {
 				$email = $mb['email'];
-				$email_parts = explode('@',$mb['email']);
+				$email_parts = explode('@', $mb['email']);
 				$filename = $mb['maildir'].'/.quotausage';
 				if(file_exists($filename) && !is_link($filename)) {
 					$quotafile = file($filename);
 					$data[$email]['used'] = trim($quotafile['1']);
 					unset($quotafile);
 				} else {
-					exec('du -s '.escapeshellcmd($mb['maildir']),$out);
-					$parts = explode(' ',$out[0]);
+					exec('du -s '.escapeshellcmd($mb['maildir']), $out);
+					$parts = explode(' ', $out[0]);
 					$data[$email]['used'] = intval($parts[0])*1024;
 					unset($out);
 					unset($parts);
@@ -264,7 +264,7 @@
 
 		unset($mailboxes);
 
-				//* Dovecot quota check Courier in progress lathama@gmail.com
+		//* Dovecot quota check Courier in progress lathama@gmail.com
 		/*
 				if($dir = opendir("/var/vmail")){
 						while (($quotafiles = readdir($dir)) !== false){
@@ -282,10 +282,10 @@
 		$res['type'] = $type;
 		$res['data'] = $data;
 		$res['state'] = $state;
-				return $res;
-		}
+		return $res;
+	}
 
-		//** Filesystem Quota
+	//** Filesystem Quota
 	public function monitorHDQuota() {
 		global $conf;
 
@@ -370,6 +370,8 @@
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'server_load';
 
 		/*
@@ -473,7 +475,7 @@
 	}
 
 	public function monitorDiskUsage() {
-		global $app,$conf;
+		global $app, $conf;
 
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
@@ -487,8 +489,8 @@
 		/** Fetch the data of ALL devices into a array (needed for monitoring!) */
 		//$dfData = shell_exec('df -hT 2>/dev/null');
 		$app->uses('getconf');
-        $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-        $dfData = shell_exec('df -hT|grep -v "'.$web_config['website_basedir'].'/" 2>/dev/null');
+		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+		$dfData = shell_exec('df -hT|grep -v "'.$web_config['website_basedir'].'/" 2>/dev/null');
 
 		// split into array
 		$df = explode("\n", $dfData);
@@ -515,9 +517,9 @@
 				$usePercent = floatval($data[$i]['percent']);
 
 				//* get the free memsize
-				if(substr($data[$i]['available'],-1) == 'G') {
+				if(substr($data[$i]['available'], -1) == 'G') {
 					$freesize = floatval($data[$i]['available'])*1024;
-				} elseif(substr($data[$i]['available'],-1) == 'T') {
+				} elseif(substr($data[$i]['available'], -1) == 'T') {
 					$freesize = floatval($data[$i]['available'])*1024*1024;
 				} else {
 					$freesize = floatval($data[$i]['available']);
@@ -525,23 +527,23 @@
 
 				//* We don't want to check some filesystem which have no sensible filling levels
 				switch ($data[$i]['type']) {
-					case 'iso9660':
-					case 'cramfs':
-					case 'udf':
-					case 'tmpfs':
-					case 'devtmpfs':
-					case 'udev':
-						break;
-					default:
-						if ($usePercent > 75 && $freesize < 2000)
-							$state = $this->_setState($state, 'info');
-						if ($usePercent > 80 && $freesize < 1000)
-							$state = $this->_setState($state, 'warning');
-						if ($usePercent > 90 && $freesize < 500)
-							$state = $this->_setState($state, 'critical');
-						if ($usePercent > 95 && $freesize < 100)
-							$state = $this->_setState($state, 'error');
-						break;
+				case 'iso9660':
+				case 'cramfs':
+				case 'udf':
+				case 'tmpfs':
+				case 'devtmpfs':
+				case 'udev':
+					break;
+				default:
+					if ($usePercent > 75 && $freesize < 2000)
+						$state = $this->_setState($state, 'info');
+					if ($usePercent > 80 && $freesize < 1000)
+						$state = $this->_setState($state, 'warning');
+					if ($usePercent > 90 && $freesize < 500)
+						$state = $this->_setState($state, 'critical');
+					if ($usePercent > 95 && $freesize < 100)
+						$state = $this->_setState($state, 'error');
+					break;
 				}
 			}
 		}
@@ -1152,49 +1154,49 @@
 
 			$state = 'ok';
 			if(is_array($data['output'])) {
-			foreach ($data['output'] as $item) {
-				if (strpos($item, 'RAID') !== false) {
-					if (strpos($item, ' VERIFYING ') !== false) {
-						$this->_setState($state, 'info');
-					}
-					else if (strpos($item, ' MIGRATE-PAUSED ') !== false) {
-						$this->_setState($state, 'info');
-					}
-					else if (strpos($item, ' MIGRATING ') !== false) {
-						$this->_setState($state, 'ok');
-					}
-					else if (strpos($item, ' INITIALIZING ') !== false) {
-						$this->_setState($state, 'info');
-					}
-					else if (strpos($item, ' INIT-PAUSED ') !== false) {
-						$this->_setState($state, 'info');
-					}
-					else if (strpos($item, ' REBUILDING ') !== false) {
-						$this->_setState($state, 'info');
-					}
-					else if (strpos($item, ' REBUILD-PAUSED ') !== false) {
-						$this->_setState($state, 'warning');
-					}
-					else if (strpos($item, ' RECOVERY ') !== false) {
-						$this->_setState($state, 'warning');
-					}
-					else if (strpos($item, ' DEGRADED ') !== false) {
-						$this->_setState($state, 'critical');
-					}
-					else if (strpos($item, ' UNKNOWN ') !== false) {
-						$this->_setState($state, 'critical');
-					}
-					else if (strpos($item, ' OK ') !== false) {
-						$this->_setState($state, 'ok');
-					}
-					else if (strpos($item, ' OPTIMAL ') !== false) {
-						$this->_setState($state, 'ok');
-					}
-					else {
-						$this->_setState($state, 'critical');
+				foreach ($data['output'] as $item) {
+					if (strpos($item, 'RAID') !== false) {
+						if (strpos($item, ' VERIFYING ') !== false) {
+							$this->_setState($state, 'info');
+						}
+						else if (strpos($item, ' MIGRATE-PAUSED ') !== false) {
+								$this->_setState($state, 'info');
+							}
+						else if (strpos($item, ' MIGRATING ') !== false) {
+								$this->_setState($state, 'ok');
+							}
+						else if (strpos($item, ' INITIALIZING ') !== false) {
+								$this->_setState($state, 'info');
+							}
+						else if (strpos($item, ' INIT-PAUSED ') !== false) {
+								$this->_setState($state, 'info');
+							}
+						else if (strpos($item, ' REBUILDING ') !== false) {
+								$this->_setState($state, 'info');
+							}
+						else if (strpos($item, ' REBUILD-PAUSED ') !== false) {
+								$this->_setState($state, 'warning');
+							}
+						else if (strpos($item, ' RECOVERY ') !== false) {
+								$this->_setState($state, 'warning');
+							}
+						else if (strpos($item, ' DEGRADED ') !== false) {
+								$this->_setState($state, 'critical');
+							}
+						else if (strpos($item, ' UNKNOWN ') !== false) {
+								$this->_setState($state, 'critical');
+							}
+						else if (strpos($item, ' OK ') !== false) {
+								$this->_setState($state, 'ok');
+							}
+						else if (strpos($item, ' OPTIMAL ') !== false) {
+								$this->_setState($state, 'ok');
+							}
+						else {
+							$this->_setState($state, 'critical');
+						}
 					}
 				}
-			}
 			}
 		}
 
@@ -1300,54 +1302,54 @@
 	}
 
 	public function monitorIPTables() {
-				global $conf;
+		global $conf;
 
-				/* the id of the server as int */
-				$server_id = intval($conf['server_id']);
+		/* the id of the server as int */
+		$server_id = intval($conf['server_id']);
 
-				/** The type of the data */
-				$type = 'iptables_rules';
+		/** The type of the data */
+		$type = 'iptables_rules';
 
-				/* This monitoring is only available if fail2ban is installed */
-				system('which iptables', $retval); // Debian, Ubuntu, Fedora
-				if ($retval === 0) {
-						/*  Get the data of the log */
-						$data['output'] = '<h2>iptables -S (ipv4)</h2>'.shell_exec('iptables -S 2>/dev/null');
+		/* This monitoring is only available if fail2ban is installed */
+		system('which iptables', $retval); // Debian, Ubuntu, Fedora
+		if ($retval === 0) {
+			/*  Get the data of the log */
+			$data['output'] = '<h2>iptables -S (ipv4)</h2>'.shell_exec('iptables -S 2>/dev/null');
 
-						/*
+			/*
 						 * At this moment, there is no state (maybe later)
 						 */
-						$state = 'no_state';
-				} else {
-						$state = 'no_state';
-						$data = '';
-				}
+			$state = 'no_state';
+		} else {
+			$state = 'no_state';
+			$data = '';
+		}
 
 
-				/* This monitoring is only available if fail2ban is installed */
-				system('which ip6tables', $retval); // Debian, Ubuntu, Fedora
-				if ($retval === 0) {
-						/*  Get the data of the log */
-						$data['output'] .= '<br><h2>ip6tables -S (ipv6)</h2>'.shell_exec('ip6tables -S 2>/dev/null');
+		/* This monitoring is only available if fail2ban is installed */
+		system('which ip6tables', $retval); // Debian, Ubuntu, Fedora
+		if ($retval === 0) {
+			/*  Get the data of the log */
+			$data['output'] .= '<br><h2>ip6tables -S (ipv6)</h2>'.shell_exec('ip6tables -S 2>/dev/null');
 
-						/*
+			/*
 						 * At this moment, there is no state (maybe later)
 						 */
-						$state = 'no_state';
-				} else {
-						$state = 'no_state';
-						$data = '';
-				}
+			$state = 'no_state';
+		} else {
+			$state = 'no_state';
+			$data = '';
+		}
 
-				/*
+		/*
 				 * Return the Result
 				 */
-				$res['server_id'] = $server_id;
-				$res['type'] = $type;
-				$res['data'] = $data;
-				$res['state'] = $state;
-				return $res;
-		}
+		$res['server_id'] = $server_id;
+		$res['type'] = $type;
+		$res['data'] = $data;
+		$res['state'] = $state;
+		return $res;
+	}
 
 	public function monitorSysLog() {
 		global $app;
@@ -1657,108 +1659,108 @@
 		}
 
 		switch ($log) {
-			case 'log_mail':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/mail.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/maillog';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/mail.info';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/maillog';
-				}
-				break;
-			case 'log_mail_warn':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/mail.warn';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/maillog';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/mail.warn';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/maillog';
-				}
-				break;
-			case 'log_mail_err':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/mail.err';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/maillog';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/mail.err';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/maillog';
-				}
-				break;
-			case 'log_messages':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/syslog';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/messages';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/messages';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/messages';
-				}
-				break;
-			case 'log_ispc_cron':
-				if ($dist == 'debian') {
-					$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
-				} elseif ($dist == 'suse') {
-					$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/cron';
-				}
-				break;
-			case 'log_freshclam':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/clamav/freshclam.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = (is_file('/var/log/clamav/freshclam.log') ? '/var/log/clamav/freshclam.log' : '/var/log/freshclam.log');
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/freshclam.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/clamav/freshclam.log';
-				}
-				break;
-			case 'log_clamav':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/clamav/clamav.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = (is_file('/var/log/clamav/clamd.log') ? '/var/log/clamav/clamd.log' : '/var/log/maillog');
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/clamd.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/clamav/clamd.log';
-				}
-				break;
-			case 'log_fail2ban':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/fail2ban.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/fail2ban.log';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/fail2ban.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/fail2ban.log';
-				}
-				break;
-			case 'log_ispconfig':
-				if ($dist == 'debian') {
-					$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
-				} elseif ($dist == 'suse') {
-					$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
-				}
-				break;
-			default:
-				$logfile = '';
-				break;
+		case 'log_mail':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/mail.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/maillog';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/mail.info';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/maillog';
+			}
+			break;
+		case 'log_mail_warn':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/mail.warn';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/maillog';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/mail.warn';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/maillog';
+			}
+			break;
+		case 'log_mail_err':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/mail.err';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/maillog';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/mail.err';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/maillog';
+			}
+			break;
+		case 'log_messages':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/syslog';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/messages';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/messages';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/messages';
+			}
+			break;
+		case 'log_ispc_cron':
+			if ($dist == 'debian') {
+				$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
+			} elseif ($dist == 'suse') {
+				$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/cron';
+			}
+			break;
+		case 'log_freshclam':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/clamav/freshclam.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = (is_file('/var/log/clamav/freshclam.log') ? '/var/log/clamav/freshclam.log' : '/var/log/freshclam.log');
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/freshclam.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/clamav/freshclam.log';
+			}
+			break;
+		case 'log_clamav':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/clamav/clamav.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = (is_file('/var/log/clamav/clamd.log') ? '/var/log/clamav/clamd.log' : '/var/log/maillog');
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/clamd.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/clamav/clamd.log';
+			}
+			break;
+		case 'log_fail2ban':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/fail2ban.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/fail2ban.log';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/fail2ban.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/fail2ban.log';
+			}
+			break;
+		case 'log_ispconfig':
+			if ($dist == 'debian') {
+				$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
+			} elseif ($dist == 'suse') {
+				$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
+			}
+			break;
+		default:
+			$logfile = '';
+			break;
 		}
 
 		// Getting the logfile content
@@ -1865,39 +1867,39 @@
 		 * Calculate the weight of the old state
 		 */
 		switch ($oldState) {
-			case 'no_state': $oldInt = 0;
-				break;
-			case 'ok': $oldInt = 1;
-				break;
-			case 'unknown': $oldInt = 2;
-				break;
-			case 'info': $oldInt = 3;
-				break;
-			case 'warning': $oldInt = 4;
-				break;
-			case 'critical': $oldInt = 5;
-				break;
-			case 'error': $oldInt = 6;
-				break;
+		case 'no_state': $oldInt = 0;
+			break;
+		case 'ok': $oldInt = 1;
+			break;
+		case 'unknown': $oldInt = 2;
+			break;
+		case 'info': $oldInt = 3;
+			break;
+		case 'warning': $oldInt = 4;
+			break;
+		case 'critical': $oldInt = 5;
+			break;
+		case 'error': $oldInt = 6;
+			break;
 		}
 		/*
 		 * Calculate the weight of the new state
 		 */
 		switch ($newState) {
-			case 'no_state': $newInt = 0;
-				break;
-			case 'ok': $newInt = 1;
-				break;
-			case 'unknown': $newInt = 2;
-				break;
-			case 'info': $newInt = 3;
-				break;
-			case 'warning': $newInt = 4;
-				break;
-			case 'critical': $newInt = 5;
-				break;
-			case 'error': $newInt = 6;
-				break;
+		case 'no_state': $newInt = 0;
+			break;
+		case 'ok': $newInt = 1;
+			break;
+		case 'unknown': $newInt = 2;
+			break;
+		case 'info': $newInt = 3;
+			break;
+		case 'warning': $newInt = 4;
+			break;
+		case 'critical': $newInt = 5;
+			break;
+		case 'error': $newInt = 6;
+			break;
 		}
 
 		/*
@@ -1911,6 +1913,7 @@
 	}
 
 	private function _getIntArray($line) {
+
 		/** The array of float found */
 		$res = array();
 		/* First build a array from the line */
@@ -1926,4 +1929,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/openvz_tools.inc.php b/server/lib/classes/openvz_tools.inc.php
index 403613c..16dc601 100644
--- a/server/lib/classes/openvz_tools.inc.php
+++ b/server/lib/classes/openvz_tools.inc.php
@@ -31,6 +31,8 @@
 	/**
 	 * Checks, if the server ist a OpenVZ - Host
 	 */
+
+
 	public function isOpenVzHost() {
 		/*
 		 * if there is a "/proc/user_beanconters" we have OpenVz "in use"
@@ -109,7 +111,7 @@
 			$item = trim($item);
 
 			/*
-			 * Now get every token and insert it to the array 
+			 * Now get every token and insert it to the array
 			 */
 			if ($item != '') {
 				$tmp = explode(' ', $item);
@@ -145,5 +147,7 @@
 		/* ready */
 		return $res;
 	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/lib/classes/plugins.inc.php b/server/lib/classes/plugins.inc.php
index d13317e..4808a56 100644
--- a/server/lib/classes/plugins.inc.php
+++ b/server/lib/classes/plugins.inc.php
@@ -29,96 +29,96 @@
 */
 
 class plugins {
-	
+
 	var $available_events = array();
 	var $subscribed_events = array();
 	var $subscribed_actions = array();
 	var $debug = false;
-	
+
 	/*
 	 This function is called to load the plugins from the plugins-enabled or the plugins-core folder
 	*/
-	
+
 	function loadPlugins($type) {
-		global $app,$conf;
+		global $app, $conf;
 
 		$subPath = 'plugins-enabled';
 		//if ($type == 'core') $subPath = 'plugins-core';
-		
+
 		$plugins_dir = $conf['rootpath'].$conf['fs_div'].$subPath.$conf['fs_div'];
 		$tmp_plugins = array();
-		
+
 		if (is_dir($plugins_dir)) {
 			if ($dh = opendir($plugins_dir)) {
 				//** Go trough all files in the plugin dir
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						$plugin_name = substr($file, 0, -8);
 						$tmp_plugins[$plugin_name] = $file;
 					}
 				}
 				//** sort the plugins by name
 				ksort($tmp_plugins);
-				
+
 				//** load the plugins
 				foreach($tmp_plugins as $plugin_name => $file) {
-					include_once($plugins_dir.$file);
-					if($this->debug) $app->log('Loading plugin: '.$plugin_name,LOGLEVEL_DEBUG);
+					include_once $plugins_dir.$file;
+					if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
 					$app->loaded_plugins[$plugin_name] = new $plugin_name;
 					$app->loaded_plugins[$plugin_name]->onLoad();
 				}
 			} else {
-				$app->log('Unable to open the plugins directory: '.$plugins_dir,LOGLEVEL_ERROR);
+				$app->log('Unable to open the plugins directory: '.$plugins_dir, LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log('Plugins directory missing: '.$plugins_dir,LOGLEVEL_ERROR);
+			$app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR);
 		}
-		
+
 	}
-	
+
 	/*
 		This function is used by the modules to announce which events they provide
 	*/
-	
-	function announceEvents($module_name,$events) {
+
+	function announceEvents($module_name, $events) {
 		global $app;
 		foreach($events as $event_name) {
 			$this->available_events[$event_name] = $module_name;
-			if($this->debug) $app->log('Announced event: '.$event_name,LOGLEVEL_DEBUG);
+			if($this->debug) $app->log('Announced event: '.$event_name, LOGLEVEL_DEBUG);
 		}
 	}
-	
-	
+
+
 	/*
 	 This function is called by the plugin to register for an event
 	*/
-	
-	function registerEvent($event_name,$plugin_name,$function_name) {
+
+	function registerEvent($event_name, $plugin_name, $function_name) {
 		global $app;
 		if(!isset($this->available_events[$event_name])) {
-			$app->log("Unable to register function '$function_name' from plugin '$plugin_name' for event '$event_name'",LOGLEVEL_DEBUG);
+			$app->log("Unable to register function '$function_name' from plugin '$plugin_name' for event '$event_name'", LOGLEVEL_DEBUG);
 		} else {
 			$this->subscribed_events[$event_name][] = array('plugin' => $plugin_name, 'function' => $function_name);
-			if($this->debug)  $app->log("Registered function '$function_name' from plugin '$plugin_name' for event '$event_name'.",LOGLEVEL_DEBUG);
+			if($this->debug)  $app->log("Registered function '$function_name' from plugin '$plugin_name' for event '$event_name'.", LOGLEVEL_DEBUG);
 		}
 	}
-	
-	
-	function raiseEvent($event_name,$data) {
+
+
+	function raiseEvent($event_name, $data) {
 		global $app;
-		
+
 		// Get the subscriptions for this event
 		$events = (isset($this->subscribed_events[$event_name]))?$this->subscribed_events[$event_name]:'';
-		if($this->debug) $app->log('Raised event: '.$event_name,LOGLEVEL_DEBUG);
-		
+		if($this->debug) $app->log('Raised event: '.$event_name, LOGLEVEL_DEBUG);
+
 		if(is_array($events)) {
 			foreach($events as $event) {
 				$plugin_name = $event['plugin'];
 				$function_name = $event['function'];
 				// Call the processing function of the plugin
-				$app->log("Calling function '$function_name' from plugin '$plugin_name' raised by event '$event_name'.",LOGLEVEL_DEBUG);
+				$app->log("Calling function '$function_name' from plugin '$plugin_name' raised by event '$event_name'.", LOGLEVEL_DEBUG);
 				// call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data);
-				call_user_func(array($app->loaded_plugins[$plugin_name],$function_name),$event_name,$data);
+				call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data);
 				unset($plugin_name);
 				unset($function_name);
 			}
@@ -126,33 +126,33 @@
 		unset($event);
 		unset($events);
 	}
-	
+
 	/*
 	 This function is called by the plugin to register for an action
 	*/
-	
-	function registerAction($action_name,$plugin_name,$function_name) {
+
+	function registerAction($action_name, $plugin_name, $function_name) {
 		global $app;
 		$this->subscribed_actions[$action_name][] = array('plugin' => $plugin_name, 'function' => $function_name);
-		if($this->debug)  $app->log("Registered function '$function_name' from plugin '$plugin_name' for action '$event_name'.",LOGLEVEL_DEBUG);
+		if($this->debug)  $app->log("Registered function '$function_name' from plugin '$plugin_name' for action '$event_name'.", LOGLEVEL_DEBUG);
 	}
-	
-	
-	function raiseAction($action_name,$data) {
+
+
+	function raiseAction($action_name, $data) {
 		global $app;
-		
+
 		//* Get the subscriptions for this action
 		$actions = (isset($this->subscribed_actions[$action_name]))?$this->subscribed_actions[$action_name]:'';
-		if($this->debug) $app->log('Raised action: '.$action_name,LOGLEVEL_DEBUG);
-		
+		if($this->debug) $app->log('Raised action: '.$action_name, LOGLEVEL_DEBUG);
+
 		if(is_array($actions)) {
 			foreach($actions as $action) {
 				$plugin_name = $action['plugin'];
 				$function_name = $action['function'];
 				$state_out = 'ok';
 				//* Call the processing function of the plugin
-				$app->log("Calling function '$function_name' from plugin '$plugin_name' raised by action '$action_name'.",LOGLEVEL_DEBUG);
-				$state = call_user_func(array($app->loaded_plugins[$plugin_name],$function_name),$action_name,$data);
+				$app->log("Calling function '$function_name' from plugin '$plugin_name' raised by action '$action_name'.", LOGLEVEL_DEBUG);
+				$state = call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $action_name, $data);
 				//* ensure that we return the highest warning / error level if a error occured in one of the functions
 				if($state == 'warning' && $state_out != 'error') $state_out = 'warning';
 				if($state == 'error') $state_out = 'error';
@@ -162,10 +162,10 @@
 		}
 		unset($action);
 		unset($actions);
-		
+
 		return $state_out;
 	}
-	
+
 }
 
 ?>
diff --git a/server/lib/classes/services.inc.php b/server/lib/classes/services.inc.php
index cd53433..7a8841e 100644
--- a/server/lib/classes/services.inc.php
+++ b/server/lib/classes/services.inc.php
@@ -33,50 +33,51 @@
 	var $registered_services = array();
 	var $delayed_restarts = array();
 	var $debug = false;
-	
-	// This function adds a request for restarting 
+
+	// This function adds a request for restarting
 	// a service at the end of the configuration run.
-	function restartServiceDelayed($service_name,$action = 'restart') {
+	function restartServiceDelayed($service_name, $action = 'restart') {
 		global $app;
 		if(is_array($this->registered_services[$service_name])) {
 			$this->delayed_restarts[$service_name] = $action;
 		} else {
-			$app->log("Unable to add a delayed restart for '$service_name'. Service not registered.",LOGLEVEL_WARNING);
+			$app->log("Unable to add a delayed restart for '$service_name'. Service not registered.", LOGLEVEL_WARNING);
 		}
-		
+
 	}
-	
+
 	// This function restarts a service when the function is called
-	function restartService($service_name,$action = 'restart') {
+	function restartService($service_name, $action = 'restart') {
 		global $app;
-		
+
 		if(is_array($this->registered_services[$service_name])) {
 			$module_name = $this->registered_services[$service_name]['module'];
 			$function_name = $this->registered_services[$service_name]['function'];
-			$app->log("Calling function '$function_name' from module '$module_name'.",LOGLEVEL_DEBUG);
+			$app->log("Calling function '$function_name' from module '$module_name'.", LOGLEVEL_DEBUG);
 			// call_user_method($function_name,$app->loaded_modules[$module_name],$action);
-			return call_user_func(array($app->loaded_modules[$module_name],$function_name),$action);
+			return call_user_func(array($app->loaded_modules[$module_name], $function_name), $action);
 		} else {
-			$app->log("Unable to restart $service_name. Service not registered.",LOGLEVEL_WARNING);
+			$app->log("Unable to restart $service_name. Service not registered.", LOGLEVEL_WARNING);
 			return array('output' => '', 'retval' => 0);
 		}
-		
+
 	}
-	
+
 	// This function is used to register callback functions for services that can be restarted
-	function registerService($service_name,$module_name, $function_name) {
+	function registerService($service_name, $module_name, $function_name) {
 		global $app;
 		$this->registered_services[$service_name] = array('module' => $module_name, 'function' => $function_name);
-		if($this->debug) $app->log("Registered Service '$service_name' in module '$module_name' for processing function '$function_name'",LOGLEVEL_DEBUG);
+		if($this->debug) $app->log("Registered Service '$service_name' in module '$module_name' for processing function '$function_name'", LOGLEVEL_DEBUG);
 	}
-	
+
 	// This function is called at the end of the server script to restart services.
 	function processDelayedActions() {
 		global $app;
 		foreach($this->delayed_restarts as $service_name => $action) {
-			$this->restartService($service_name,$action);
+			$this->restartService($service_name, $action);
 		}
 	}
 
 }
+
 ?>
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index a1e7c00..a393384 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -34,21 +34,25 @@
 	var $server_id;
 	var $server_conf;
 	var $data;
-	
+
 	/**
 	 * Construct for this class
 	 *
 	 * @return system
 	 */
+
+
 	public function system(){
 		//global $go_info;
-	  	//$this->server_id = $go_info['isp']['server_id'];
-	  	//$this->server_conf = $go_info['isp']['server_conf'];
-	  	$this->server_conf['passwd_datei'] = '/etc/passwd';
-	  	$this->server_conf['shadow_datei'] = '/etc/shadow';
-	  	$this->server_conf['group_datei'] = '/etc/group';
+		//$this->server_id = $go_info['isp']['server_id'];
+		//$this->server_conf = $go_info['isp']['server_conf'];
+		$this->server_conf['passwd_datei'] = '/etc/passwd';
+		$this->server_conf['shadow_datei'] = '/etc/shadow';
+		$this->server_conf['group_datei'] = '/etc/group';
 	}
-	
+
+
+
 	/**
 	 * Get the hostname from the server
 	 *
@@ -56,68 +60,74 @@
 	 */
 	public function hostname(){
 		$dist = $this->server_conf['dist'];
-	
-	 	ob_start();
-	  	passthru('hostname');
-	  	$hostname = ob_get_contents();
-	  	ob_end_clean();
+
+		ob_start();
+		passthru('hostname');
+		$hostname = ob_get_contents();
+		ob_end_clean();
 		$hostname = trim($hostname);
-	  	ob_start();
-	  	if(!strstr($dist, 'freebsd')){
-	    	passthru('dnsdomainname');
-	  	} else {
-	    	passthru('domainname');
-	  	}
-	  	$domainname = ob_get_contents();
-	  	ob_end_clean();
-	  	$domainname = trim($domainname);
-	  	if($domainname != ""){
-		    if(!strstr($hostname, $domainname)) $hostname .= ".".$domainname;
-	  	}
-	  	return $hostname;
+		ob_start();
+		if(!strstr($dist, 'freebsd')){
+			passthru('dnsdomainname');
+		} else {
+			passthru('domainname');
+		}
+		$domainname = ob_get_contents();
+		ob_end_clean();
+		$domainname = trim($domainname);
+		if($domainname != ""){
+			if(!strstr($hostname, $domainname)) $hostname .= ".".$domainname;
+		}
+		return $hostname;
 	}
-	
+
+
+
 	/**
 	 * Add an user to the system
-	 * 
+	 *
 	 */
 	public function adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort = '*'){
 		global $app;
-	  	if($this->is_user($user_username)){
-	    	return false;
-	  	} else {
-	    	if(trim($user_username) != '') {
-	        	$user_datei = $this->server_conf['passwd_datei'];
-	            $shadow_datei = $this->server_conf['shadow_datei'];
-	            $shell = realpath($shell);
-	            if(trim($passwort) == '') $passwort = '*';
-	            $new_user = "\n$user_username:x:$uid:$gid:$username:$homedir:$shell\n";
-	            $app->log->msg('USER: '.$new_user);
-	            $app->file->af($user_datei, $new_user);
-	            if($shadow_datei == '/etc/shadow'){
-	            	$datum = time();
-	                $tage = floor($datum/86400);
-	                $new_passwd = "\n$user_username:$passwort:$tage:0:99999:7:::\n";
-	            } else {
-	                $new_passwd = "\n$user_username:$passwort:$uid:$gid::0:0:$username:$homedir:$shell\n";
-	            }
-	            $app->file->af($shadow_datei, $new_passwd);
+		if($this->is_user($user_username)){
+			return false;
+		} else {
+			if(trim($user_username) != '') {
+				$user_datei = $this->server_conf['passwd_datei'];
+				$shadow_datei = $this->server_conf['shadow_datei'];
+				$shell = realpath($shell);
+				if(trim($passwort) == '') $passwort = '*';
+				$new_user = "\n$user_username:x:$uid:$gid:$username:$homedir:$shell\n";
+				$app->log->msg('USER: '.$new_user);
+				$app->file->af($user_datei, $new_user);
+				if($shadow_datei == '/etc/shadow'){
+					$datum = time();
+					$tage = floor($datum/86400);
+					$new_passwd = "\n$user_username:$passwort:$tage:0:99999:7:::\n";
+				} else {
+					$new_passwd = "\n$user_username:$passwort:$uid:$gid::0:0:$username:$homedir:$shell\n";
+				}
+				$app->file->af($shadow_datei, $new_passwd);
 				// TB: leere Zeilen entfernen
-	            $app->file->remove_blank_lines($shadow_datei);
-	            $app->file->remove_blank_lines($user_datei);
-	            // TB: user Sortierung deaktiviert
-	            //$this->order_users_groups();
-	            if($shadow_datei != '/etc/shadow'){
-	            	$app->file->af($shadow_datei, "\n");
+				$app->file->remove_blank_lines($shadow_datei);
+				$app->file->remove_blank_lines($user_datei);
+				// TB: user Sortierung deaktiviert
+				//$this->order_users_groups();
+				if($shadow_datei != '/etc/shadow'){
+					$app->file->af($shadow_datei, "\n");
 					// TB: leere Zeilen entfernen
-	                $app->file->remove_blank_lines($shadow_datei);
+					$app->file->remove_blank_lines($shadow_datei);
 					$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
-	            }
-	            return true;
-	        }
-	  }
+				}
+				return true;
+			}
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Update users when someone edit it
 	 *
@@ -126,344 +136,376 @@
 		//* First delete the users
 		$this->deluser($user_username);
 		//* Add the user again
-	  	$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
+		$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
 	}
-	
+
+
+
+
+
 	/**
 	 * Lock the user
 	 *
 	 */
 	function deactivateuser($user_username){
 		$passwort = str_rot13($this->getpasswd($user_username));
-	  	$user_attr = $this->get_user_attributes($user_username);
-	  	$uid = $user_attr['uid'];
-	  	$gid = $user_attr['gid'];
-	  	$username = $user_attr['name'];
-	  	$homedir = $user_attr['homedir'];
-	  	$shell = '/dev/null';
-	  	$this->deluser($user_username);
-	  	$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
+		$user_attr = $this->get_user_attributes($user_username);
+		$uid = $user_attr['uid'];
+		$gid = $user_attr['gid'];
+		$username = $user_attr['name'];
+		$homedir = $user_attr['homedir'];
+		$shell = '/dev/null';
+		$this->deluser($user_username);
+		$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
 	}
+
+
 	/**
 	 * Delete a user from the system
 	 *
 	 */
 	function deluser($user_username){
 		global $app;
-	  	if($this->is_user($user_username)){
-	    	$user_datei = $this->server_conf['passwd_datei'];
-	    	$shadow_datei = $this->server_conf['shadow_datei'];
-	    	$users = $app->file->rf($user_datei);
-	    	$lines = explode("\n", $users);
-	    	if(is_array($lines)){
-	      		$num_lines = sizeof($lines);
-	      		for($i=0;$i<$num_lines;$i++){
-	        		if(trim($lines[$i]) != ''){
-	          			list($f1,) = explode(':', $lines[$i]);
-	          			if($f1 != $user_username) $new_lines[] = $lines[$i];
-	        		}
-	      		}
-	      		$new_users = implode("\n", $new_lines);
-	      		$app->file->wf($user_datei, $new_users);
-	      		unset($new_lines);
-	      		unset($lines);
-	      		unset($new_users);
-	    	}
-	    	$app->file->remove_blank_lines($user_datei);
-	
-	    	$passwds = $app->file->rf($shadow_datei);
-	    	$lines = explode("\n", $passwds);
-	    	if(is_array($lines)){
-	      		$num_lines = sizeof($lines);
-	      		for($i=0;$i<$num_lines;$i++){
-	        		if(trim($lines[$i]) != ''){
-	          			list($f1,) = explode(':', $lines[$i]);
-	          			if($f1 != $user_username) $new_lines[] = $lines[$i];
-	        		}
-	      		}
-	      		$new_passwds = implode("\n", $new_lines);
-	      		$app->file->wf($shadow_datei, $new_passwds);
-	      		unset($new_lines);
-	      		unset($lines);
-	      		unset($new_passwds);
-	    	}
-	    	$app->file->remove_blank_lines($shadow_datei);
-	
-	    	$group_file = $app->file->rf($this->server_conf['group_datei']);
-	    	$group_file_lines = explode("\n", $group_file);
-	    	foreach($group_file_lines as $group_file_line){
-	      		if(trim($group_file_line) != ''){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $group_file_line);
-	        		$group_users = explode(',', str_replace(' ', '', $f4));
-	        		if(in_array($user_username, $group_users)){
-	          			$g_users = array();
-	          			foreach($group_users as $group_user){
-	            			if($group_user != $user_username) $g_users[] = $group_user;
-	          			}
-	          			$f4 = implode(',', $g_users);
-	        		}
-	        		$new_group_file[] = $f1.':'.$f2.':'.$f3.':'.$f4;
-	      		}
-	    	}
-	    	$new_group_file = implode("\n", $new_group_file);
-	    	$app->file->wf($this->server_conf['group_datei'], $new_group_file);
-	    	// TB: auskommentiert
-	        //$this->order_users_groups();
-	
-	    	if($shadow_datei != '/etc/shadow'){
-	      		$app->file->af($shadow_datei, "\n");
-	      		$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
-	    	}
-	    	return true;
-	  	} else {
-	    	return false;
-	  	}
+		if($this->is_user($user_username)){
+			$user_datei = $this->server_conf['passwd_datei'];
+			$shadow_datei = $this->server_conf['shadow_datei'];
+			$users = $app->file->rf($user_datei);
+			$lines = explode("\n", $users);
+			if(is_array($lines)){
+				$num_lines = sizeof($lines);
+				for($i=0;$i<$num_lines;$i++){
+					if(trim($lines[$i]) != ''){
+						list($f1, ) = explode(':', $lines[$i]);
+						if($f1 != $user_username) $new_lines[] = $lines[$i];
+					}
+				}
+				$new_users = implode("\n", $new_lines);
+				$app->file->wf($user_datei, $new_users);
+				unset($new_lines);
+				unset($lines);
+				unset($new_users);
+			}
+			$app->file->remove_blank_lines($user_datei);
+
+			$passwds = $app->file->rf($shadow_datei);
+			$lines = explode("\n", $passwds);
+			if(is_array($lines)){
+				$num_lines = sizeof($lines);
+				for($i=0;$i<$num_lines;$i++){
+					if(trim($lines[$i]) != ''){
+						list($f1, ) = explode(':', $lines[$i]);
+						if($f1 != $user_username) $new_lines[] = $lines[$i];
+					}
+				}
+				$new_passwds = implode("\n", $new_lines);
+				$app->file->wf($shadow_datei, $new_passwds);
+				unset($new_lines);
+				unset($lines);
+				unset($new_passwds);
+			}
+			$app->file->remove_blank_lines($shadow_datei);
+
+			$group_file = $app->file->rf($this->server_conf['group_datei']);
+			$group_file_lines = explode("\n", $group_file);
+			foreach($group_file_lines as $group_file_line){
+				if(trim($group_file_line) != ''){
+					list($f1, $f2, $f3, $f4) = explode(':', $group_file_line);
+					$group_users = explode(',', str_replace(' ', '', $f4));
+					if(in_array($user_username, $group_users)){
+						$g_users = array();
+						foreach($group_users as $group_user){
+							if($group_user != $user_username) $g_users[] = $group_user;
+						}
+						$f4 = implode(',', $g_users);
+					}
+					$new_group_file[] = $f1.':'.$f2.':'.$f3.':'.$f4;
+				}
+			}
+			$new_group_file = implode("\n", $new_group_file);
+			$app->file->wf($this->server_conf['group_datei'], $new_group_file);
+			// TB: auskommentiert
+			//$this->order_users_groups();
+
+			if($shadow_datei != '/etc/shadow'){
+				$app->file->af($shadow_datei, "\n");
+				$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
+			}
+			return true;
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Add a usergroup to the system
 	 *
 	 */
 	function addgroup($group, $gid, $members = ''){
 		global $app;
-	  	if($this->is_group($group)){
-		    return false;
-	  	} else {
-	    	$group_datei = $this->server_conf['group_datei'];
-	    	$shadow_datei = $this->server_conf['shadow_datei'];
-	    	$new_group = "\n$group:x:$gid:$members\n";
-	    	$app->file->af($group_datei, $new_group);
-	
-	        // TB: auskommentiert
-	        //$this->order_users_groups();
-	    	if($shadow_datei != '/etc/shadow'){
-	      		$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
-	    	}
-	    	return true;
-	  	}
+		if($this->is_group($group)){
+			return false;
+		} else {
+			$group_datei = $this->server_conf['group_datei'];
+			$shadow_datei = $this->server_conf['shadow_datei'];
+			$new_group = "\n$group:x:$gid:$members\n";
+			$app->file->af($group_datei, $new_group);
+
+			// TB: auskommentiert
+			//$this->order_users_groups();
+			if($shadow_datei != '/etc/shadow'){
+				$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
+			}
+			return true;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Update usersgroup in way to delete and add it again
 	 *
 	 */
 	function updategroup($group, $gid, $members = ''){
 		$this->delgroup($group);
-	  	$this->addgroup($group, $gid, $members);
+		$this->addgroup($group, $gid, $members);
 	}
-	
+
+
+
+
+
 	/**
 	 * Delete a usergroup from the system
 	 *
 	 */
 	function delgroup($group){
 		global $app;
-	  	if($this->is_group($group)){
-	    	$group_datei = $this->server_conf['group_datei'];
-	    	$shadow_datei = $this->server_conf['shadow_datei'];
-	    	$groups = $app->file->rf($group_datei);
-	    	$lines = explode("\n", $groups);
-	    	if(is_array($lines)){
-	      		$num_lines = sizeof($lines);
-	      		for($i=0;$i<$num_lines;$i++){
-	        		if(trim($lines[$i]) != ''){
-	          			list($f1,) = explode(':', $lines[$i]);
-	          			if($f1 != $group) $new_lines[] = $lines[$i];
-	        		}
-	      		}
-	      		$new_groups = implode("\n", $new_lines);
-	      		$app->file->wf($group_datei, $new_groups);
-	      		unset($new_lines);
-	      		unset($lines);
-	      		unset($new_groups);
-	    	}
-	        // TB: auskommentiert
-	    	//$this->order_users_groups();
-	    	if($shadow_datei != '/etc/shadow'){
-	      		$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
-	    	}
-	    	return true;
-	  	} else {
-	    	return false;
-	  	}
+		if($this->is_group($group)){
+			$group_datei = $this->server_conf['group_datei'];
+			$shadow_datei = $this->server_conf['shadow_datei'];
+			$groups = $app->file->rf($group_datei);
+			$lines = explode("\n", $groups);
+			if(is_array($lines)){
+				$num_lines = sizeof($lines);
+				for($i=0;$i<$num_lines;$i++){
+					if(trim($lines[$i]) != ''){
+						list($f1, ) = explode(':', $lines[$i]);
+						if($f1 != $group) $new_lines[] = $lines[$i];
+					}
+				}
+				$new_groups = implode("\n", $new_lines);
+				$app->file->wf($group_datei, $new_groups);
+				unset($new_lines);
+				unset($lines);
+				unset($new_groups);
+			}
+			// TB: auskommentiert
+			//$this->order_users_groups();
+			if($shadow_datei != '/etc/shadow'){
+				$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
+			}
+			return true;
+		} else {
+			return false;
+		}
 	}
+
+
 	/**
 	 * Order usergroups
 	 *
 	 */
 	function order_users_groups(){
 		global $app;
-	  	$user_datei = $this->server_conf['passwd_datei'];
-	  	$shadow_datei = $this->server_conf['shadow_datei'];
-	  	$group_datei = $this->server_conf['group_datei'];
-	
-	  	$groups = $app->file->no_comments($group_datei);
-	  	$lines = explode("\n", $groups);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	      		if(trim($line) != ''){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $line);
-	        		$arr[$f3] = $line;
-	      		}
-	    	}
-	  	}
-	  	ksort($arr);
-	  	reset($arr);
-	  	if($shadow_datei != '/etc/shadow'){
-	    	$app->file->wf($group_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0)."\n");
-	  	}else {
-		    $app->file->wf($group_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
-	  	}
-	  	unset($arr);
-	
-	  	$users = $app->file->no_comments($user_datei);
-	  	$lines = explode("\n", $users);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	      		if(trim($line) != ""){
-	        		list($f1, $f2, $f3,) = explode(':', $line);
-	        		if($f1 != 'toor'){
-	          			$arr[$f3] = $line;
-	        		} else {
-	          			$arr[70000] = $line;
-	        		}
-	      		}
-	    	}
-	  	}
-	  	ksort($arr);
-	  	reset($arr);
-	  	$app->file->wf($user_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
-	  	unset($arr);
-	
-	  	$passwds = $app->file->no_comments($shadow_datei);
-	  	$lines = explode("\n", $passwds);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	    		if(trim($line) != ''){
-	        		list($f1, $f2, $f3,) = explode(':', $line);
-	        		if($f1 != 'toor'){
-	          			$uid = $this->getuid($f1);
-	          			if(!is_bool($uid)) $arr[$uid] = $line;
-	        		} else {
-	          			$arr[70000] = $line;
-	        		}
-	      		}
-	    	}
-	  	}
-	  	ksort($arr);
-	  	reset($arr);
-	  	$app->file->wf($shadow_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
-	  	unset($arr);
+		$user_datei = $this->server_conf['passwd_datei'];
+		$shadow_datei = $this->server_conf['shadow_datei'];
+		$group_datei = $this->server_conf['group_datei'];
+
+		$groups = $app->file->no_comments($group_datei);
+		$lines = explode("\n", $groups);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, $f4) = explode(':', $line);
+					$arr[$f3] = $line;
+				}
+			}
+		}
+		ksort($arr);
+		reset($arr);
+		if($shadow_datei != '/etc/shadow'){
+			$app->file->wf($group_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0)."\n");
+		}else {
+			$app->file->wf($group_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
+		}
+		unset($arr);
+
+		$users = $app->file->no_comments($user_datei);
+		$lines = explode("\n", $users);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ""){
+					list($f1, $f2, $f3, ) = explode(':', $line);
+					if($f1 != 'toor'){
+						$arr[$f3] = $line;
+					} else {
+						$arr[70000] = $line;
+					}
+				}
+			}
+		}
+		ksort($arr);
+		reset($arr);
+		$app->file->wf($user_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
+		unset($arr);
+
+		$passwds = $app->file->no_comments($shadow_datei);
+		$lines = explode("\n", $passwds);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, ) = explode(':', $line);
+					if($f1 != 'toor'){
+						$uid = $this->getuid($f1);
+						if(!is_bool($uid)) $arr[$uid] = $line;
+					} else {
+						$arr[70000] = $line;
+					}
+				}
+			}
+		}
+		ksort($arr);
+		reset($arr);
+		$app->file->wf($shadow_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
+		unset($arr);
 	}
-	
+
+
+
+
+
 	/**
 	 * Find a user / group id
 	 *
 	 */
 	function find_uid_gid($min, $max){
 		global $app;
-	  	if($min < $max && $min >= 0 && $max >= 0 && $min <= 65536 && $max <= 65536 && is_int($min) && is_int($max)){
-	    	for($i=$min;$i<=$max;$i++){
-	      		$uid_arr[$i] = $gid_arr[$i] = 1;
-	    	}
-	    	$user_datei = $this->server_conf['passwd_datei'];
-	    	$group_datei = $this->server_conf['group_datei'];
-	
-	    	$users = $app->file->no_comments($user_datei);
-	    	$lines = explode("\n", $users);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
-	          			if($f3 >= $min && $f3 <= $max) unset($uid_arr[$f3]);
-	        		}
-	      		}
-	      		if(!empty($uid_arr)){
-	        		foreach($uid_arr as $key => $val){
-	          			$uids[] = $key;
-	        		}
-	        		$min_uid = min($uids);
-	        		unset($uid_arr);
-	      		} else {
-	        		return false;
-	      		}
-	    	}
-	
-	    	$groups = $app->file->no_comments($group_datei);
-	    	$lines = explode("\n", $groups);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2, $f3, $f4) = explode(':', $line);
-	          			if($f3 >= $min && $f3 <= $max) unset($gid_arr[$f3]);
-	        		}
-	      		}
-	      		if(!empty($gid_arr)){
-	        		foreach($gid_arr as $key => $val){
-	          			$gids[] = $key;
-	        		}
-	        		$min_gid = min($gids);
-	        		unset($gid_arr);
-	      		} else {
-	        		return false;
-	      		}
-	    	}
-	
-	    	$result = array_intersect($uids, $gids);
-	    	$new_id = (max($result));
-	    	unset($uids);
-	    	unset($gids);
-	    	unset($result);
-	    	if($new_id <= $max){
-	      		return $new_id;
-	    	} else {
-	      		return false;
-	    	}
-	  	} else {
-	    	return false;
-	  	}
+		if($min < $max && $min >= 0 && $max >= 0 && $min <= 65536 && $max <= 65536 && is_int($min) && is_int($max)){
+			for($i=$min;$i<=$max;$i++){
+				$uid_arr[$i] = $gid_arr[$i] = 1;
+			}
+			$user_datei = $this->server_conf['passwd_datei'];
+			$group_datei = $this->server_conf['group_datei'];
+
+			$users = $app->file->no_comments($user_datei);
+			$lines = explode("\n", $users);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
+						if($f3 >= $min && $f3 <= $max) unset($uid_arr[$f3]);
+					}
+				}
+				if(!empty($uid_arr)){
+					foreach($uid_arr as $key => $val){
+						$uids[] = $key;
+					}
+					$min_uid = min($uids);
+					unset($uid_arr);
+				} else {
+					return false;
+				}
+			}
+
+			$groups = $app->file->no_comments($group_datei);
+			$lines = explode("\n", $groups);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, $f3, $f4) = explode(':', $line);
+						if($f3 >= $min && $f3 <= $max) unset($gid_arr[$f3]);
+					}
+				}
+				if(!empty($gid_arr)){
+					foreach($gid_arr as $key => $val){
+						$gids[] = $key;
+					}
+					$min_gid = min($gids);
+					unset($gid_arr);
+				} else {
+					return false;
+				}
+			}
+
+			$result = array_intersect($uids, $gids);
+			$new_id = (max($result));
+			unset($uids);
+			unset($gids);
+			unset($result);
+			if($new_id <= $max){
+				return $new_id;
+			} else {
+				return false;
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Check if the users is really a user into the system
 	 *
 	 */
 	function is_user($user){
 		global $app;
-	  	$user_datei = $this->server_conf['passwd_datei'];
-	  	$users = $app->file->no_comments($user_datei);
-	  	$lines = explode("\n", $users);
-	  	if(is_array($lines)){
+		$user_datei = $this->server_conf['passwd_datei'];
+		$users = $app->file->no_comments($user_datei);
+		$lines = explode("\n", $users);
+		if(is_array($lines)){
 			foreach($lines as $line){
-	      		if(trim($line) != ''){
-	        		list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
-	        		if($f1 == $user) return true;
-	      		}
-	    	}
-	  	}
-	  	return false;
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
+					if($f1 == $user) return true;
+				}
+			}
+		}
+		return false;
 	}
-	
+
+
+
+
+
 	/**
 	 * Check if the group is on this system
 	 *
 	 */
 	function is_group($group){
 		global $app;
-	  	$group_datei = $this->server_conf['group_datei'];
-	  	$groups = $app->file->no_comments($group_datei);
-	  	$lines = explode("\n", $groups);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	      		if(trim($line) != ""){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $line);
-	        		if($f1 == $group) return true;
-	      		}
-	    	}
-	  	}
-	  	return false;
+		$group_datei = $this->server_conf['group_datei'];
+		$groups = $app->file->no_comments($group_datei);
+		$lines = explode("\n", $groups);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ""){
+					list($f1, $f2, $f3, $f4) = explode(':', $line);
+					if($f1 == $group) return true;
+				}
+			}
+		}
+		return false;
 	}
-	
+
 	/*
 	// Alternative implementation of the is_group function. Should be faster then the old one To be tested.
 	function is_group($group) {
@@ -485,122 +527,142 @@
 	return false;
 	}
 	*/
-	
+
 	function root_group(){
 		global $app;
-	  	$group_datei = $this->server_conf['group_datei'];
-	  	$groups = $app->file->no_comments($group_datei);
-	  	$lines = explode("\n", $groups);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	      		if(trim($line) != ''){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $line);
-	        		if($f3 == 0) return $f1;
-	      		}
-	    	}
-	  	}
-	  	return false;
+		$group_datei = $this->server_conf['group_datei'];
+		$groups = $app->file->no_comments($group_datei);
+		$lines = explode("\n", $groups);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, $f4) = explode(':', $line);
+					if($f3 == 0) return $f1;
+				}
+			}
+		}
+		return false;
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the groups of an user
 	 *
 	 */
 	function get_user_groups($username){
 		global $app;
-	  	$user_groups = array();
-	  	$group_datei = $this->server_conf['group_datei'];
-	  	$groups = $app->file->no_comments($group_datei);
-	  	$lines = explode("\n", $groups);
-	  	if(is_array($lines)){
-	    	foreach($lines as $line){
-	      		if(trim($line) != ''){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $line);
-	        		if(intval($f3) < intval($this->server_conf['groupid_von']) && trim($f1) != 'users'){
-	          			$tmp_group_users = explode(',', str_replace(' ', '', $f4));
-	          			if(in_array($username, $tmp_group_users) && trim($f1) != '') $user_groups[] = $f1;
-	          			unset($tmp_group_users);
-	        		}
-	      		}
-	    	}
-	  	}
-	  	if(!empty($user_groups)) return implode(',', $user_groups);
-	  	return '';
+		$user_groups = array();
+		$group_datei = $this->server_conf['group_datei'];
+		$groups = $app->file->no_comments($group_datei);
+		$lines = explode("\n", $groups);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, $f4) = explode(':', $line);
+					if(intval($f3) < intval($this->server_conf['groupid_von']) && trim($f1) != 'users'){
+						$tmp_group_users = explode(',', str_replace(' ', '', $f4));
+						if(in_array($username, $tmp_group_users) && trim($f1) != '') $user_groups[] = $f1;
+						unset($tmp_group_users);
+					}
+				}
+			}
+		}
+		if(!empty($user_groups)) return implode(',', $user_groups);
+		return '';
 	}
-	
+
+
+
+
+
 	/**
 	 * Get a user password
 	 *
 	 */
 	function getpasswd($user){
 		global $app;
-	  	if($this->is_user($user)){
-		    $shadow_datei = $this->server_conf['shadow_datei'];
-	    	$passwds = $app->file->no_comments($shadow_datei);
-	    	$lines = explode("\n", $passwds);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2,) = explode(':', $line);
-	          			if($f1 == $user) return $f2;
-	        		}
-	      		}
-	    	}
-	  	} else {
-		    return false;
-	  	}
+		if($this->is_user($user)){
+			$shadow_datei = $this->server_conf['shadow_datei'];
+			$passwds = $app->file->no_comments($shadow_datei);
+			$lines = explode("\n", $passwds);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, ) = explode(':', $line);
+						if($f1 == $user) return $f2;
+					}
+				}
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the user id from an user
 	 *
 	 */
 	function getuid($user){
 		global $app;
-	  	if($this->is_user($user)){
-		    $user_datei = $this->server_conf['passwd_datei'];
-	    	$users = $app->file->no_comments($user_datei);
-	    	$lines = explode("\n", $users);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2, $f3,) = explode(':', $line);
-	          			if($f1 == $user) return $f3;
-	        		}
-	      		}
-	    	}
-	  	} else {
-		    return false;
-	  	}
+		if($this->is_user($user)){
+			$user_datei = $this->server_conf['passwd_datei'];
+			$users = $app->file->no_comments($user_datei);
+			$lines = explode("\n", $users);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, $f3, ) = explode(':', $line);
+						if($f1 == $user) return $f3;
+					}
+				}
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the group id from an group
 	 *
 	 */
 	function getgid($group){
 		global $app;
-	  	if($this->is_group($group)){
-		    $group_datei = $this->server_conf['group_datei'];
+		if($this->is_group($group)){
+			$group_datei = $this->server_conf['group_datei'];
 			$groups = $app->file->no_comments($group_datei);
 			$lines = explode("\n", $groups);
 			if(is_array($lines)){
-		    foreach($lines as $line){
+				foreach($lines as $line){
 					if(trim($line) != ""){
 						list($f1, $f2, $f3, $f4) = explode(':', $line);
 						if($f1 == $group) return $f3;
 					}
 				}
 			}
-	  	} else {
-		    return false;
-	  	}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
-	* Return info about a group by name
-	*
-	*/
+	 * Return info about a group by name
+	 *
+	 */
 	function posix_getgrnam($group) {
 		if(!function_exists('posix_getgrnam')){
 			$group_datei = $this->server_conf['group_datei'];
@@ -616,213 +678,225 @@
 			} else {
 				$members = array();
 			}
-			$group_details = array(	'name' => $group,
-									'passwd' => $f2,
-									'members' => $members,
-									'gid' => $f3);
-			return $group_details;	
+			$group_details = array( 'name' => $group,
+				'passwd' => $f2,
+				'members' => $members,
+				'gid' => $f3);
+			return $group_details;
 		} else {
 			return posix_getgrnam($group);
 		}
-    }
-	
+	}
+
+
+
+
+
 	/**
 	 * Get all information from a user
 	 *
 	 */
 	function get_user_attributes($user){
 		global $app;
-	  	if($this->is_user($user)){
-	    	$user_datei = $this->server_conf['passwd_datei'];
-	    	$users = $app->file->no_comments($user_datei);
-	    	$lines = explode("\n", $users);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
-	          			if($f1 == $user){
-	            			$user_attr['username'] = $f1;
-	            			$user_attr['x'] = $f2;
-	            			$user_attr['uid'] = $f3;
-	            			$user_attr['gid'] = $f4;
-	            			$user_attr['name'] = $f5;
-	            			$user_attr['homedir'] = $f6;
-	            			$user_attr['shell'] = $f7;
-	            			return $user_attr;
-	          			}
-	        		}
-	      		}
-	    	}
-	  	} else {
-	    	return false;
-	  	}
+		if($this->is_user($user)){
+			$user_datei = $this->server_conf['passwd_datei'];
+			$users = $app->file->no_comments($user_datei);
+			$lines = explode("\n", $users);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
+						if($f1 == $user){
+							$user_attr['username'] = $f1;
+							$user_attr['x'] = $f2;
+							$user_attr['uid'] = $f3;
+							$user_attr['gid'] = $f4;
+							$user_attr['name'] = $f5;
+							$user_attr['homedir'] = $f6;
+							$user_attr['shell'] = $f7;
+							return $user_attr;
+						}
+					}
+				}
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Edit the owner of a file
 	 *
 	 */
 	function chown($file, $owner, $allow_symlink = false){
-	  global $app;
-	  if($allow_symlink == false && $this->checkpath($file) == false) {
-		$app->log("Action aborted, file is a symlink: $file",LOGLEVEL_WARN);
-		return false;
-	  }
-	  if(file_exists($file)) {
-		if(@chown($file, $owner)) {
-			return true;
-		} else {
-			$app->log("chown failed: $file : $owner",LOGLEVEL_DEBUG);
+		global $app;
+		if($allow_symlink == false && $this->checkpath($file) == false) {
+			$app->log("Action aborted, file is a symlink: $file", LOGLEVEL_WARN);
 			return false;
 		}
-	  }
+		if(file_exists($file)) {
+			if(@chown($file, $owner)) {
+				return true;
+			} else {
+				$app->log("chown failed: $file : $owner", LOGLEVEL_DEBUG);
+				return false;
+			}
+		}
 	}
-	
+
 	function chgrp($file, $group = '', $allow_symlink = false){
-	  global $app;
-	  if($allow_symlink == false && $this->checkpath($file) == false) {
-		$app->log("Action aborted, file is a symlink: $file",LOGLEVEL_WARN);
-		return false;
-	  }
-	  if(file_exists($file)) {
-		if(@chgrp($file, $group)) {
-			return true;
-		} else {
-			$app->log("chgrp failed: $file : $group",LOGLEVEL_DEBUG);
+		global $app;
+		if($allow_symlink == false && $this->checkpath($file) == false) {
+			$app->log("Action aborted, file is a symlink: $file", LOGLEVEL_WARN);
 			return false;
 		}
-	  }
+		if(file_exists($file)) {
+			if(@chgrp($file, $group)) {
+				return true;
+			} else {
+				$app->log("chgrp failed: $file : $group", LOGLEVEL_DEBUG);
+				return false;
+			}
+		}
 	}
-	
+
 	//* Change the mode of a file
 	function chmod($file, $mode, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($file) == false) {
-			$app->log("Action aborted, file is a symlink: $file",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $file", LOGLEVEL_WARN);
 			return false;
 		}
 		if(@chmod($file, $mode)) {
 			return true;
 		} else {
-			$app->log("chmod failed: $file : $mode",LOGLEVEL_DEBUG);
+			$app->log("chmod failed: $file : $mode", LOGLEVEL_DEBUG);
 			return false;
 		}
 	}
-	
+
 	function file_put_contents($filename, $data, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($filename) == false) {
-			$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
 			return false;
 		}
 		if(file_exists($filename)) unlink($filename);
 		return file_put_contents($filename, $data);
 	}
-	
+
 	function file_get_contents($filename, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($filename) == false) {
-			$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
 			return false;
 		}
 		return file_get_contents($filename, $data);
 	}
-	
+
 	function rename($filename, $new_filename, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($filename) == false) {
-			$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
 			return false;
 		}
 		return rename($filename, $new_filename);
 	}
-	
+
 	function mkdir($dirname, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($dirname) == false) {
-			$app->log("Action aborted, file is a symlink: $dirname",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $dirname", LOGLEVEL_WARN);
 			return false;
 		}
 		if(@mkdir($dirname)) {
 			return true;
 		} else {
-			$app->log("mkdir failed: $dirname",LOGLEVEL_DEBUG);
+			$app->log("mkdir failed: $dirname", LOGLEVEL_DEBUG);
 			return false;
 		}
 	}
-	
+
 	function unlink($filename) {
 		if(file_exists($filename) || is_link($filename)) {
 			return unlink($filename);
 		}
 	}
-	
-	function copy($file1,$file2) {
-		return copy($file1,$file2);
+
+	function copy($file1, $file2) {
+		return copy($file1, $file2);
 	}
-	
+
 	function touch($file, $allow_symlink = false){
-	  global $app;
-	  if($allow_symlink == false && @file_exists($file) && $this->checkpath($file) == false) {
-		$this->unlink($file);
-	  }
-	  if(@touch($file)) {
+		global $app;
+		if($allow_symlink == false && @file_exists($file) && $this->checkpath($file) == false) {
+			$this->unlink($file);
+		}
+		if(@touch($file)) {
 			return true;
-	  } else {
-			$app->log("touch failed: $file",LOGLEVEL_DEBUG);
+		} else {
+			$app->log("touch failed: $file", LOGLEVEL_DEBUG);
 			return false;
-	  }
+		}
 	}
-	
+
 	function checkpath($path) {
 		$path = trim($path);
 		//* We allow only absolute paths
-		if(substr($path,0,1) != '/') return false;
-		
+		if(substr($path, 0, 1) != '/') return false;
+
 		//* We allow only some characters in the path
 		// * is allowed, for example it is part of wildcard certificates/keys: *.example.com.crt
-		if(!preg_match('@^/[-a-zA-Z0-9_/.*~]{1,}$@',$path)) return false;
-		
+		if(!preg_match('@^/[-a-zA-Z0-9_/.*~]{1,}$@', $path)) return false;
+
 		//* Check path for symlinks
-		$path_parts = explode('/',$path);
+		$path_parts = explode('/', $path);
 		$testpath = '';
 		foreach($path_parts as $p) {
 			$testpath .= '/'.$p;
 			if(is_link($testpath)) return false;
 		}
-		
+
 		return true;
 	}
-	
+
+
+
+
+
 	/**
 	 * Add an user to a specific group
 	 *
 	 */
 	function add_user_to_group($group, $user = 'admispconfig'){
 		global $app;
-	  	$group_file = $app->file->rf($this->server_conf['group_datei']);
-	  	$group_file_lines = explode("\n", $group_file);
-	  	foreach($group_file_lines as $group_file_line){
-		    list($group_name,$group_x,$group_id,$group_users) = explode(':',$group_file_line);
-	    	if($group_name == $group){
-	      		$group_users = explode(',', str_replace(' ', '', $group_users));
-	      		if(!in_array($user, $group_users)){
-	        		$group_users[] = $user;
-	      		}
-	      		$group_users = implode(',', $group_users);
-	      		if(substr($group_users,0,1) == ',') $group_users = substr($group_users,1);
-	      		$group_file_line = $group_name.':'.$group_x.':'.$group_id.':'.$group_users;
-	    	}
-	    	$new_group_file[] = $group_file_line;
-	  	}
-	  	$new_group_file = implode("\n", $new_group_file);
-	  	$app->file->wf($this->server_conf['group_datei'], $new_group_file);
-	  	$app->file->remove_blank_lines($this->server_conf['group_datei']);
-	  	if($this->server_conf['shadow_datei'] != '/etc/shadow'){
-		    $app->log->caselog('pwd_mkdb '.$this->server_conf['shadow_datei'].' &> /dev/null', $this->FILE, __LINE__);
-	  	}
+		$group_file = $app->file->rf($this->server_conf['group_datei']);
+		$group_file_lines = explode("\n", $group_file);
+		foreach($group_file_lines as $group_file_line){
+			list($group_name, $group_x, $group_id, $group_users) = explode(':', $group_file_line);
+			if($group_name == $group){
+				$group_users = explode(',', str_replace(' ', '', $group_users));
+				if(!in_array($user, $group_users)){
+					$group_users[] = $user;
+				}
+				$group_users = implode(',', $group_users);
+				if(substr($group_users, 0, 1) == ',') $group_users = substr($group_users, 1);
+				$group_file_line = $group_name.':'.$group_x.':'.$group_id.':'.$group_users;
+			}
+			$new_group_file[] = $group_file_line;
+		}
+		$new_group_file = implode("\n", $new_group_file);
+		$app->file->wf($this->server_conf['group_datei'], $new_group_file);
+		$app->file->remove_blank_lines($this->server_conf['group_datei']);
+		if($this->server_conf['shadow_datei'] != '/etc/shadow'){
+			$app->log->caselog('pwd_mkdb '.$this->server_conf['shadow_datei'].' &> /dev/null', $this->FILE, __LINE__);
+		}
 	}
-	
+
 	/*
 	function usermod($user, $groups){
 		global $app;
@@ -864,449 +938,485 @@
 	  	}
 	}
 	*/
-	
+
 	/**boot autostart etc
 	 *
 	 */
 	function rc_edit($service, $rl, $action){
 		// $action = "on|off";
-	  	global $app;
-	  	$dist_init_scripts = $app->system->server_conf['dist_init_scripts'];
-	  	$dist_runlevel = $app->system->server_conf['dist_runlevel'];
-	  	$dist = $app->system->server_conf['dist'];
-	  	if(trim($dist_runlevel) == ''){ // falls es keine runlevel gibt (FreeBSD)
-		    if($action == 'on'){
-	    		@symlink($dist_init_scripts.'/'.$service, $dist_init_scripts.'/'.$service.'.sh');
-	    	}
-	    	if($action == 'off'){
-	      		if(is_link($dist_init_scripts.'/'.$service.'.sh')){
-	        		unlink($dist_init_scripts.'/'.$service.'.sh');
-	      		} else {
-	        		rename($dist_init_scripts.'/'.$service.'.sh',$dist_init_scripts.'/'.$service);
-	      		}
-	    	}
-	  	} else { // Linux
-	    	if(substr($dist, 0,4) == 'suse'){
-	      		if($action == 'on'){
-	        		exec("chkconfig --add $service &> /dev/null");
-	      		}
-	      		if($action == 'off'){
-	        		exec("chkconfig --del $service &> /dev/null");
-	      		}
-	    	} else {
-	      		$runlevels = explode(',', $rl);
-	      		foreach($runlevels as $runlevel){
-	        		$runlevel = trim($runlevel);
-	        		if($runlevel != '' && is_dir($dist_runlevel.'/rc'.$runlevel.'.d')){
-	          			$handle=opendir($dist_runlevel.'/rc'.$runlevel.'.d');
-	          			while($file = readdir($handle)){
-	            			if($file != '.' && $file != '..'){
-	              				$target = @readlink($dist_runlevel.'/rc'.$runlevel.'.d/'.$file);
-	              				if(strstr($file, $service) && strstr($target, $service) && substr($file,0,1) == 'S') $ln_arr[$runlevel][] = $dist_runlevel.'/rc'.$runlevel.'.d/'.$file;
-	            			}
-	          			}
-	          			closedir($handle);
-	        		}
-	        		if($action == 'on'){
-	          			if(!is_array($ln_arr[$runlevel])) @symlink($dist_init_scripts.'/'.$service, $dist_runlevel.'/rc'.$runlevel.'.d/S99'.$service);
-	        		}
-	        		if($action == 'off'){
-	          			if(is_array($ln_arr[$runlevel])){
-	            			foreach($ln_arr[$runlevel] as $link){
-	              				unlink($link);
-	            			}
-	          			}
-	        		}
-	      		}
-	    	}
-	  	}
+		global $app;
+		$dist_init_scripts = $app->system->server_conf['dist_init_scripts'];
+		$dist_runlevel = $app->system->server_conf['dist_runlevel'];
+		$dist = $app->system->server_conf['dist'];
+		if(trim($dist_runlevel) == ''){ // falls es keine runlevel gibt (FreeBSD)
+			if($action == 'on'){
+				@symlink($dist_init_scripts.'/'.$service, $dist_init_scripts.'/'.$service.'.sh');
+			}
+			if($action == 'off'){
+				if(is_link($dist_init_scripts.'/'.$service.'.sh')){
+					unlink($dist_init_scripts.'/'.$service.'.sh');
+				} else {
+					rename($dist_init_scripts.'/'.$service.'.sh', $dist_init_scripts.'/'.$service);
+				}
+			}
+		} else { // Linux
+			if(substr($dist, 0, 4) == 'suse'){
+				if($action == 'on'){
+					exec("chkconfig --add $service &> /dev/null");
+				}
+				if($action == 'off'){
+					exec("chkconfig --del $service &> /dev/null");
+				}
+			} else {
+				$runlevels = explode(',', $rl);
+				foreach($runlevels as $runlevel){
+					$runlevel = trim($runlevel);
+					if($runlevel != '' && is_dir($dist_runlevel.'/rc'.$runlevel.'.d')){
+						$handle=opendir($dist_runlevel.'/rc'.$runlevel.'.d');
+						while($file = readdir($handle)){
+							if($file != '.' && $file != '..'){
+								$target = @readlink($dist_runlevel.'/rc'.$runlevel.'.d/'.$file);
+								if(strstr($file, $service) && strstr($target, $service) && substr($file, 0, 1) == 'S') $ln_arr[$runlevel][] = $dist_runlevel.'/rc'.$runlevel.'.d/'.$file;
+							}
+						}
+						closedir($handle);
+					}
+					if($action == 'on'){
+						if(!is_array($ln_arr[$runlevel])) @symlink($dist_init_scripts.'/'.$service, $dist_runlevel.'/rc'.$runlevel.'.d/S99'.$service);
+					}
+					if($action == 'off'){
+						if(is_array($ln_arr[$runlevel])){
+							foreach($ln_arr[$runlevel] as $link){
+								unlink($link);
+							}
+						}
+					}
+				}
+			}
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Filter information from the commands
 	 *
 	 */
 	function grep($content, $string, $params = ''){
 		global $app;
-	  	// params: i, v, w
-	  	$content = $app->file->unix_nl($content);
-	  	$lines = explode("\n", $content);
-	  	foreach($lines as $line){
-	    	if(!strstr($params, 'w')){
-	      		if(strstr($params, 'i')){
-	        		if(strstr($params, 'v')){
-	          			if(!stristr($line, $string)) $find[] = $line;
-	        		} else {
-	          			if(stristr($line, $string)) $find[] = $line;
-	        		}
-	      		} else {
-	        		if(strstr($params, 'v')){
-	          			if(!strstr($line, $string)) $find[] = $line;
-	        		} else {
-	          			if(strstr($line, $string)) $find[] = $line;
-	        		}
-	      		}
-	    	} else {
-	      		if(strstr($params, 'i')){
-	        		if(strstr($params, 'v')){
-	          			if(!$app->string->is_word($string, $line, 'i')) $find[] = $line;
-	        		} else {
-	          			if($app->string->is_word($string, $line, 'i')) $find[] = $line;
-	        		}
-	      		} else {
-	        		if(strstr($params, 'v')){
-	          			if(!$app->string->is_word($string, $line)) $find[] = $line;
-	        		} else {
-	          			if($app->string->is_word($string, $line)) $find[] = $line;
-	        		}
-	      		}
-	    	}
-	  	}
-	  	if(is_array($find)){
-		    $ret_val = implode("\n", $find);
-	    	if(substr($ret_val,-1) != "\n") $ret_val .= "\n";
-	    	$find = NULL;
-	    	return $ret_val;
-	  	} else {
-		    return false;
-	  	}
+		// params: i, v, w
+		$content = $app->file->unix_nl($content);
+		$lines = explode("\n", $content);
+		foreach($lines as $line){
+			if(!strstr($params, 'w')){
+				if(strstr($params, 'i')){
+					if(strstr($params, 'v')){
+						if(!stristr($line, $string)) $find[] = $line;
+					} else {
+						if(stristr($line, $string)) $find[] = $line;
+					}
+				} else {
+					if(strstr($params, 'v')){
+						if(!strstr($line, $string)) $find[] = $line;
+					} else {
+						if(strstr($line, $string)) $find[] = $line;
+					}
+				}
+			} else {
+				if(strstr($params, 'i')){
+					if(strstr($params, 'v')){
+						if(!$app->string->is_word($string, $line, 'i')) $find[] = $line;
+					} else {
+						if($app->string->is_word($string, $line, 'i')) $find[] = $line;
+					}
+				} else {
+					if(strstr($params, 'v')){
+						if(!$app->string->is_word($string, $line)) $find[] = $line;
+					} else {
+						if($app->string->is_word($string, $line)) $find[] = $line;
+					}
+				}
+			}
+		}
+		if(is_array($find)){
+			$ret_val = implode("\n", $find);
+			if(substr($ret_val, -1) != "\n") $ret_val .= "\n";
+			$find = NULL;
+			return $ret_val;
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Strip content from fields
 	 *
 	 */
 	function cut($content, $field, $delimiter = ':'){
 		global $app;
-	  	$content = $app->file->unix_nl($content);
-	  	$lines = explode("\n", $content);
-	  	foreach($lines as $line){
-	    	$elms = explode($delimiter, $line);
-	    	$find[] = $elms[($field-1)];
-	  	}
-	  	if(is_array($find)){
-		    $ret_val = implode("\n", $find);
-		    if(substr($ret_val,-1) != "\n") $ret_val .= "\n";
-		    $find = NULL;
-	    	return $ret_val;
-	  	} else {
-		    return false;
-	  	}
+		$content = $app->file->unix_nl($content);
+		$lines = explode("\n", $content);
+		foreach($lines as $line){
+			$elms = explode($delimiter, $line);
+			$find[] = $elms[($field-1)];
+		}
+		if(is_array($find)){
+			$ret_val = implode("\n", $find);
+			if(substr($ret_val, -1) != "\n") $ret_val .= "\n";
+			$find = NULL;
+			return $ret_val;
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the content off a file
 	 *
 	 */
 	function cat($file){
 		global $app;
-	  	return $app->file->rf($file);
+		return $app->file->rf($file);
 	}
-	
+
+
+
+
+
 	/**
 	 * Control services to restart etc
 	 *
 	 */
 	function daemon_init($daemon, $action){
 		//* $action = start|stop|restart|reload
-	  	global $app;
-	  	$dist = $this->server_conf['dist'];
-	  	$dist_init_scripts = $this->server_conf['dist_init_scripts'];
-	  	if(!strstr($dist, 'freebsd')){
-		    $app->log->caselog("$dist_init_scripts/$daemon $action &> /dev/null", $this->FILE, __LINE__);
-	  	} else {
-		    if(is_file($dist_init_scripts.'/'.$daemon.'.sh') || is_link($dist_init_scripts.'/'.$daemon.'.sh')){
-	      		if($action == 'start' || $action == 'stop'){
-	        		$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh '.$action.' &> /dev/null', $this->FILE, __LINE__);
-	      		} else {
-	        		$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh stop &> /dev/null', $this->FILE, __LINE__);
-	        		sleep(3);
-	        		$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh start &> /dev/null', $this->FILE, __LINE__);
-	      		}
-	    	} else {
-	      		if(is_file($dist_init_scripts.'/'.$daemon) || is_link($dist_init_scripts.'/'.$daemon)){
-	        		if($action == 'start' || $action == 'stop'){
-	          			$app->log->caselog($dist_init_scripts.'/'.$daemon.' '.$action.' &> /dev/null', $this->FILE, __LINE__);
-	        		} else {
-	          			$app->log->caselog($dist_init_scripts.'/'.$daemon.' stop &> /dev/null', $this->FILE, __LINE__);
-	          			sleep(3);
-	          			$app->log->caselog($dist_init_scripts.'/'.$daemon.' start &> /dev/null', $this->FILE, __LINE__);
-	        		}
-	      		} else {
-	        		if(is_file('/etc/rc.d/'.$daemon) || is_link('/etc/rc.d/'.$daemon)){
-	          			if($action == 'start' || $action == 'stop'){
-	            			$app->log->caselog('/etc/rc.d/'.$daemon.' '.$action.' &> /dev/null', $this->FILE, __LINE__);
-	          			} else {
-	            			$app->log->caselog('/etc/rc.d/'.$daemon.' stop &> /dev/null', $this->FILE, __LINE__);
-	            			sleep(3);
-	            			$app->log->caselog('/etc/rc.d/'.$daemon.' start &> /dev/null', $this->FILE, __LINE__);
-	          			}
-	        		}
-		      	}
-	    	}
-	  	}
+		global $app;
+		$dist = $this->server_conf['dist'];
+		$dist_init_scripts = $this->server_conf['dist_init_scripts'];
+		if(!strstr($dist, 'freebsd')){
+			$app->log->caselog("$dist_init_scripts/$daemon $action &> /dev/null", $this->FILE, __LINE__);
+		} else {
+			if(is_file($dist_init_scripts.'/'.$daemon.'.sh') || is_link($dist_init_scripts.'/'.$daemon.'.sh')){
+				if($action == 'start' || $action == 'stop'){
+					$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh '.$action.' &> /dev/null', $this->FILE, __LINE__);
+				} else {
+					$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh stop &> /dev/null', $this->FILE, __LINE__);
+					sleep(3);
+					$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh start &> /dev/null', $this->FILE, __LINE__);
+				}
+			} else {
+				if(is_file($dist_init_scripts.'/'.$daemon) || is_link($dist_init_scripts.'/'.$daemon)){
+					if($action == 'start' || $action == 'stop'){
+						$app->log->caselog($dist_init_scripts.'/'.$daemon.' '.$action.' &> /dev/null', $this->FILE, __LINE__);
+					} else {
+						$app->log->caselog($dist_init_scripts.'/'.$daemon.' stop &> /dev/null', $this->FILE, __LINE__);
+						sleep(3);
+						$app->log->caselog($dist_init_scripts.'/'.$daemon.' start &> /dev/null', $this->FILE, __LINE__);
+					}
+				} else {
+					if(is_file('/etc/rc.d/'.$daemon) || is_link('/etc/rc.d/'.$daemon)){
+						if($action == 'start' || $action == 'stop'){
+							$app->log->caselog('/etc/rc.d/'.$daemon.' '.$action.' &> /dev/null', $this->FILE, __LINE__);
+						} else {
+							$app->log->caselog('/etc/rc.d/'.$daemon.' stop &> /dev/null', $this->FILE, __LINE__);
+							sleep(3);
+							$app->log->caselog('/etc/rc.d/'.$daemon.' start &> /dev/null', $this->FILE, __LINE__);
+						}
+					}
+				}
+			}
+		}
 	}
-	
+
 	function netmask($netmask){
-	  list($f1,$f2,$f3,$f4) = explode('.', trim($netmask));
-	  $bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  $parts = explode('0', $bin);
-	  $bin = str_pad($parts[0], 32, '0', STR_PAD_RIGHT);
-	  $bin = wordwrap($bin, 8, '.', 1);
-	  list($f1,$f2,$f3,$f4) = explode('.', trim($bin));
-	  return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($netmask));
+		$bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		$parts = explode('0', $bin);
+		$bin = str_pad($parts[0], 32, '0', STR_PAD_RIGHT);
+		$bin = wordwrap($bin, 8, '.', 1);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($bin));
+		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
-	
+
 	function binary_netmask($netmask){
-	  list($f1,$f2,$f3,$f4) = explode('.', trim($netmask));
-	  $bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  $parts = explode('0', $bin);
-	  return substr_count($parts[0], '1');
+		list($f1, $f2, $f3, $f4) = explode('.', trim($netmask));
+		$bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		$parts = explode('0', $bin);
+		return substr_count($parts[0], '1');
 	}
-	
+
 	function network($ip, $netmask){
-	  $netmask = $this->netmask($netmask);
-	  list($f1,$f2,$f3,$f4) = explode('.', $netmask);
-	  $netmask_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  list($f1,$f2,$f3,$f4) = explode('.', $ip);
-	  $ip_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  for($i=0;$i<32;$i++){
-	    $network_bin .= substr($netmask_bin,$i,1) * substr($ip_bin,$i,1);
-	  }
-	  $network_bin = wordwrap($network_bin, 8, '.', 1);
-	  list($f1,$f2,$f3,$f4) = explode('.', trim($network_bin));
-	  return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
+		$netmask = $this->netmask($netmask);
+		list($f1, $f2, $f3, $f4) = explode('.', $netmask);
+		$netmask_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', $ip);
+		$ip_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		for($i=0;$i<32;$i++){
+			$network_bin .= substr($netmask_bin, $i, 1) * substr($ip_bin, $i, 1);
+		}
+		$network_bin = wordwrap($network_bin, 8, '.', 1);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($network_bin));
+		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
-	
+
+
+
+
+
 	/**
 	 * Make a broadcast address from an IP number in combination with netmask
 	 *
 	 */
 	function broadcast($ip, $netmask){
 		$netmask = $this->netmask($netmask);
-	  	$binary_netmask = $this->binary_netmask($netmask);
-	  	list($f1,$f2,$f3,$f4) = explode('.', $ip);
-	  	$ip_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  	$broadcast_bin = str_pad(substr($ip_bin, 0, $binary_netmask),32,'1',STR_PAD_RIGHT);
-	  	$broadcast_bin = wordwrap($broadcast_bin, 8, '.', 1);
-	  	list($f1,$f2,$f3,$f4) = explode('.', trim($broadcast_bin));
-	  	return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
+		$binary_netmask = $this->binary_netmask($netmask);
+		list($f1, $f2, $f3, $f4) = explode('.', $ip);
+		$ip_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		$broadcast_bin = str_pad(substr($ip_bin, 0, $binary_netmask), 32, '1', STR_PAD_RIGHT);
+		$broadcast_bin = wordwrap($broadcast_bin, 8, '.', 1);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($broadcast_bin));
+		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the network address information
 	 *
 	 */
 	function network_info(){
 		$dist = $this->server_conf['dist'];
-	  	ob_start();
-	  	passthru('ifconfig');
-	  	$output = ob_get_contents();
-	  	ob_end_clean();
-	  	$lines = explode("\n", $output);
-	  	foreach($lines as $line){
-		    $elms = explode(' ', $line);
-	    	if(trim($elms[0]) != '' && substr($elms[0],0,1) != "\t"){
-	      		$elms[0] = trim($elms[0]);
-	      		if(strstr($dist, 'freebsd')) $elms[0] = substr($elms[0],0,-1);
-	      		$interfaces[] = $elms[0];
-	    	}
-	  	}
-	  	if(!empty($interfaces)){
-		    foreach($interfaces as $interface){
-	    		ob_start();
-	      		if(!strstr($dist, 'freebsd')){
-	        		passthru('ifconfig '.$interface." | grep -iw 'inet' | cut -f2 -d: | cut -f1 -d' '");
-	      		} else {
-	        		passthru('ifconfig '.$interface." | grep -iw 'inet' | grep -iv 'inet6' | cut -f2 -d' '");
-	      		}
-	      		$output = trim(ob_get_contents());
-	      		ob_end_clean();
-	      		if($output != ''){
-	        		$ifconfig['INTERFACE'][$interface] = $output;
-	        		$ifconfig['IP'][$output] = $interface;
-	      		}
-	    	}
-	    	if(!empty($ifconfig)){
-	      		return $ifconfig;
-	    	} else {
-	      		return false;
-	    	}
-	  	} else {
-	    	return false;
-	  	}
+		ob_start();
+		passthru('ifconfig');
+		$output = ob_get_contents();
+		ob_end_clean();
+		$lines = explode("\n", $output);
+		foreach($lines as $line){
+			$elms = explode(' ', $line);
+			if(trim($elms[0]) != '' && substr($elms[0], 0, 1) != "\t"){
+				$elms[0] = trim($elms[0]);
+				if(strstr($dist, 'freebsd')) $elms[0] = substr($elms[0], 0, -1);
+				$interfaces[] = $elms[0];
+			}
+		}
+		if(!empty($interfaces)){
+			foreach($interfaces as $interface){
+				ob_start();
+				if(!strstr($dist, 'freebsd')){
+					passthru('ifconfig '.$interface." | grep -iw 'inet' | cut -f2 -d: | cut -f1 -d' '");
+				} else {
+					passthru('ifconfig '.$interface." | grep -iw 'inet' | grep -iv 'inet6' | cut -f2 -d' '");
+				}
+				$output = trim(ob_get_contents());
+				ob_end_clean();
+				if($output != ''){
+					$ifconfig['INTERFACE'][$interface] = $output;
+					$ifconfig['IP'][$output] = $interface;
+				}
+			}
+			if(!empty($ifconfig)){
+				return $ifconfig;
+			} else {
+				return false;
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Configure the network settings from the system
 	 *
 	 */
 	function network_config(){
 		$ifconfig = $this->network_info();
-	  	if($ifconfig){
-	    	$main_interface = $ifconfig['IP'][$this->server_conf['server_ip']];
-	    	if(strstr($main_interface, ':')){
-	      		$parts = explode(':', $main_interface);
-	      		$main_interface = trim($parts[0]);
-	    	}
-	    	if($main_interface != ''){
-	      		$ips = $this->data['isp_server_ip'];
-	      		if(!empty($ips)){
-	        		foreach($ips as $ip){
-	          			if(!isset($ifconfig['IP'][$ip['server_ip']])){
-	            			$to_set[] = $ip['server_ip'];
-	          			} else {
-	            			unset($ifconfig['IP'][$ip['server_ip']]);
-	          			}
-	        		}
-	        		if(!empty($ifconfig['IP'])){
-	          			foreach($ifconfig['IP'] as $key => $val){
-	            			if(!strstr($val, 'lo') && !strstr($val, 'lp') && strstr($val, $main_interface)){
-	              				exec('ifconfig '.$val.' down &> /dev/null');
-	              				unset($ifconfig['INTERFACE'][$val]);
-	            			}
-	          			}
-	        		}
-	        		if(!empty($to_set)){
-	         			foreach($to_set as $to){
-	           				$i = 0;
-	           				while($i >= 0){
-	             				if(isset($ifconfig['INTERFACE'][$main_interface.':'.$i])){
-	               					$i++;
-					             } else {
-	               					$new_interface = $main_interface.':'.$i;
-	               					$i = -1;
-	             				}
-	           				}
-	           				exec('ifconfig '.$new_interface.' '.$to.' netmask '.$this->server_conf['server_netzmaske'].' up &> /dev/null');
-	           				$ifconfig['INTERFACE'][$new_interface] = $to;
-	          			}
-	        		}
-	      		}
-	    	}
-	  	}
+		if($ifconfig){
+			$main_interface = $ifconfig['IP'][$this->server_conf['server_ip']];
+			if(strstr($main_interface, ':')){
+				$parts = explode(':', $main_interface);
+				$main_interface = trim($parts[0]);
+			}
+			if($main_interface != ''){
+				$ips = $this->data['isp_server_ip'];
+				if(!empty($ips)){
+					foreach($ips as $ip){
+						if(!isset($ifconfig['IP'][$ip['server_ip']])){
+							$to_set[] = $ip['server_ip'];
+						} else {
+							unset($ifconfig['IP'][$ip['server_ip']]);
+						}
+					}
+					if(!empty($ifconfig['IP'])){
+						foreach($ifconfig['IP'] as $key => $val){
+							if(!strstr($val, 'lo') && !strstr($val, 'lp') && strstr($val, $main_interface)){
+								exec('ifconfig '.$val.' down &> /dev/null');
+								unset($ifconfig['INTERFACE'][$val]);
+							}
+						}
+					}
+					if(!empty($to_set)){
+						foreach($to_set as $to){
+							$i = 0;
+							while($i >= 0){
+								if(isset($ifconfig['INTERFACE'][$main_interface.':'.$i])){
+									$i++;
+								} else {
+									$new_interface = $main_interface.':'.$i;
+									$i = -1;
+								}
+							}
+							exec('ifconfig '.$new_interface.' '.$to.' netmask '.$this->server_conf['server_netzmaske'].' up &> /dev/null');
+							$ifconfig['INTERFACE'][$new_interface] = $to;
+						}
+					}
+				}
+			}
+		}
 	}
-	
+
 	function quota_dirs(){
-	  global $app;
-	  $content = $app->file->unix_nl($app->file->no_comments('/etc/fstab'));
-	  $lines = explode("\n", $content);
-	  foreach($lines as $line){
-	    $line = trim($line);
-	    if($line != ''){
-	      $elms = explode("\t", $line);
-	      foreach($elms as $elm){
-	        if(trim($elm) != '') $f[] = $elm;
-	      }
-	      if(!empty($f) && stristr($f[3], 'userquota') && stristr($f[3], 'groupquota')){
-	        $q_dirs[] = trim($f[1]);
-	      }
-	      unset($f);
-	    }
-	  }
-	  if(!empty($q_dirs)){
-	    return $q_dirs;
-	  } else {
-	    return false;
-	  }
+		global $app;
+		$content = $app->file->unix_nl($app->file->no_comments('/etc/fstab'));
+		$lines = explode("\n", $content);
+		foreach($lines as $line){
+			$line = trim($line);
+			if($line != ''){
+				$elms = explode("\t", $line);
+				foreach($elms as $elm){
+					if(trim($elm) != '') $f[] = $elm;
+				}
+				if(!empty($f) && stristr($f[3], 'userquota') && stristr($f[3], 'groupquota')){
+					$q_dirs[] = trim($f[1]);
+				}
+				unset($f);
+			}
+		}
+		if(!empty($q_dirs)){
+			return $q_dirs;
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Scan the trash for virusses infection
 	 *
 	 */
 	function make_trashscan(){
 		global $app;
-	  	//trashscan erstellen
-	  	// Template Öffnen
-	  	$app->tpl->clear_all();
-	  	$app->tpl->define( array(table    => 'trashscan.master'));
-	
-	  	if(!isset($this->server_conf['virusadmin']) || trim($this->server_conf['virusadmin']) == '') $this->server_conf['virusadmin'] = 'admispconfig@localhost';
-	  	if(substr($this->server_conf['virusadmin'],0,1) == '#'){
-		    $notify = 'no';
-	  	} else {
-		    $notify = 'yes';
-	  	}
-	
-	  	// Variablen zuweisen
-	  	$app->tpl->assign( array(VIRUSADMIN => $this->server_conf['virusadmin'],
-	                           NOTIFICATION => $notify));
-	
-	  	$app->tpl->parse(TABLE, table);
-	
-	  	$trashscan_text = $app->tpl->fetch();
-	
-	  	$datei = '/home/admispconfig/ispconfig/tools/clamav/bin/trashscan';
-	  	$app->file->wf($datei, $trashscan_text);
-	
-	  	chmod($datei, 0755);
-	  	chown($datei,'admispconfig');
-	  	chgrp($datei,'admispconfig');
+		//trashscan erstellen
+		// Template Öffnen
+		$app->tpl->clear_all();
+		$app->tpl->define( array(table    => 'trashscan.master'));
+
+		if(!isset($this->server_conf['virusadmin']) || trim($this->server_conf['virusadmin']) == '') $this->server_conf['virusadmin'] = 'admispconfig@localhost';
+		if(substr($this->server_conf['virusadmin'], 0, 1) == '#'){
+			$notify = 'no';
+		} else {
+			$notify = 'yes';
+		}
+
+		// Variablen zuweisen
+		$app->tpl->assign( array(VIRUSADMIN => $this->server_conf['virusadmin'],
+				NOTIFICATION => $notify));
+
+		$app->tpl->parse(TABLE, table);
+
+		$trashscan_text = $app->tpl->fetch();
+
+		$datei = '/home/admispconfig/ispconfig/tools/clamav/bin/trashscan';
+		$app->file->wf($datei, $trashscan_text);
+
+		chmod($datei, 0755);
+		chown($datei, 'admispconfig');
+		chgrp($datei, 'admispconfig');
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the current time
 	 *
 	 */
 	function get_time(){
-	  $addr = 'http://www.ispconfig.org/';
-	  $timeout = 1;
-	  $url_parts = parse_url($addr);
-	  $path = $url_parts['path'];
-	  $port = 80;
-	  $urlHandle = @fsockopen($url_parts['host'], $port, $errno, $errstr, $timeout);
-	  if ($urlHandle){
-	    socket_set_timeout($urlHandle, $timeout);
-	
-	    $urlString = 'GET '.$path." HTTP/1.0\r\nHost: ".$url_parts['host']."\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
-	    if ($user) $urlString .= 'Authorization: Basic '.base64_encode($user.':'.$pass)."\r\n";
-	    $urlString .= "\r\n";
-	    fputs($urlHandle, $urlString);
-	
-	    $month['Jan'] = '01';
-	    $month['Feb'] = '02';
-	    $month['Mar'] = '03';
-	    $month['Apr'] = '04';
-	    $month['May'] = '05';
-	    $month['Jun'] = '06';
-	    $month['Jul'] = '07';
-	    $month['Aug'] = '08';
-	    $month['Sep'] = '09';
-	    $month['Oct'] = '10';
-	    $month['Nov'] = '11';
-	    $month['Dec'] = '12';
-	    $c = 0;
-	    $l = 0;
-	    $startzeit = time();
-	    while(!feof($urlHandle) && $c < 2 && $l == 0){
-	      $line = trim(fgets($urlHandle,128));
-	      $response .= $line;
-	      $c = time() - $startzeit;
-	      if($line == '' || substr($line, 0, 5) == 'Date:') $l += 1; // nur den Header auslesen
-	      if(substr($line, 0, 5) == 'Date:'){
-	        $parts = explode(' ', $line);
-	        $tag = $parts[2];
-	        $monat = $month[$parts[3]];
-	        $jahr = $parts[4];
-	        list($stunde, $minute, $sekunde) = explode(':', $parts[5]);
-	        $timestamp = mktime($stunde,$minute,$sekunde,$monat,$tag,$jahr);
-	      }
-	    }
-	
-	    @fclose($urlHandle);
-	
-	    return $timestamp;
-	  } else {
-	    @fclose($urlHandle);
-	    return false;
-	  }
+		$addr = 'http://www.ispconfig.org/';
+		$timeout = 1;
+		$url_parts = parse_url($addr);
+		$path = $url_parts['path'];
+		$port = 80;
+		$urlHandle = @fsockopen($url_parts['host'], $port, $errno, $errstr, $timeout);
+		if ($urlHandle){
+			socket_set_timeout($urlHandle, $timeout);
+
+			$urlString = 'GET '.$path." HTTP/1.0\r\nHost: ".$url_parts['host']."\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
+			if ($user) $urlString .= 'Authorization: Basic '.base64_encode($user.':'.$pass)."\r\n";
+			$urlString .= "\r\n";
+			fputs($urlHandle, $urlString);
+
+			$month['Jan'] = '01';
+			$month['Feb'] = '02';
+			$month['Mar'] = '03';
+			$month['Apr'] = '04';
+			$month['May'] = '05';
+			$month['Jun'] = '06';
+			$month['Jul'] = '07';
+			$month['Aug'] = '08';
+			$month['Sep'] = '09';
+			$month['Oct'] = '10';
+			$month['Nov'] = '11';
+			$month['Dec'] = '12';
+			$c = 0;
+			$l = 0;
+			$startzeit = time();
+			while(!feof($urlHandle) && $c < 2 && $l == 0){
+				$line = trim(fgets($urlHandle, 128));
+				$response .= $line;
+				$c = time() - $startzeit;
+				if($line == '' || substr($line, 0, 5) == 'Date:') $l += 1; // nur den Header auslesen
+				if(substr($line, 0, 5) == 'Date:'){
+					$parts = explode(' ', $line);
+					$tag = $parts[2];
+					$monat = $month[$parts[3]];
+					$jahr = $parts[4];
+					list($stunde, $minute, $sekunde) = explode(':', $parts[5]);
+					$timestamp = mktime($stunde, $minute, $sekunde, $monat, $tag, $jahr);
+				}
+			}
+
+			@fclose($urlHandle);
+
+			return $timestamp;
+		} else {
+			@fclose($urlHandle);
+			return false;
+		}
 	}
-	
-	function replaceLine($filename,$search_pattern,$new_line,$strict = 0,$append = 1) {
+
+	function replaceLine($filename, $search_pattern, $new_line, $strict = 0, $append = 1) {
 		global $app;
 		if($this->checkpath($filename) == false) {
-			$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
 			return false;
 		}
 		$lines = @file($filename);
@@ -1315,7 +1425,7 @@
 		if(is_array($lines)) {
 			foreach($lines as $line) {
 				if($strict == 0) {
-					if(stristr($line,$search_pattern)) {
+					if(stristr($line, $search_pattern)) {
 						$out .= $new_line."\n";
 						$found = 1;
 					} else {
@@ -1331,64 +1441,64 @@
 				}
 			}
 		}
-		
+
 		if($found == 0) {
 			//* add \n if the last line does not end with \n or \r
-			if(substr($out,-1) != "\n" && substr($out,-1) != "\r" && filesize($filename) > 0) $out .= "\n";
+			if(substr($out, -1) != "\n" && substr($out, -1) != "\r" && filesize($filename) > 0) $out .= "\n";
 			//* add the new line at the end of the file
 			if($append == 1) {
 				$out .= $new_line."\n";
 			}
 		}
-		file_put_contents($filename,$out);
+		file_put_contents($filename, $out);
 	}
-	
-	function removeLine($filename,$search_pattern,$strict = 0) {
-	global $app;
-	if($this->checkpath($filename) == false) {
-		$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
-		return false;
-	}
-	if($lines = @file($filename)) {
-		$out = '';
-		foreach($lines as $line) {
-			if($strict == 0) {
-				if(!stristr($line,$search_pattern)) {
-					$out .= $line;
-				}
-			} else {
-				if(!trim($line) == $search_pattern) {
-					$out .= $line;
+
+	function removeLine($filename, $search_pattern, $strict = 0) {
+		global $app;
+		if($this->checkpath($filename) == false) {
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
+			return false;
+		}
+		if($lines = @file($filename)) {
+			$out = '';
+			foreach($lines as $line) {
+				if($strict == 0) {
+					if(!stristr($line, $search_pattern)) {
+						$out .= $line;
+					}
+				} else {
+					if(!trim($line) == $search_pattern) {
+						$out .= $line;
+					}
 				}
 			}
+			file_put_contents($filename, $out);
 		}
-		file_put_contents($filename,$out);
 	}
-	}
-	
+
 	function maildirmake($maildir_path, $user = '', $subfolder = '') {
-		
+
 		global $app;
-		
+
 		if($subfolder != '') {
 			$dir = escapeshellcmd($maildir_path.'/.'.$subfolder);
 		} else {
 			$dir = escapeshellcmd($maildir_path);
 		}
-		
+
 		if(!is_dir($dir)) mkdir($dir, 0700, true);
 
 		if($user != '' && $user != 'root' && $this->is_user($user)) {
 			$user = escapeshellcmd($user);
 			// I assume that the name of the (vmail group) is the same as the name of the mail user in ISPConfig 3
 			$group = $user;
-			if(is_dir($dir)) $this->chown($dir,$user);
-			if(is_dir($dir)) $this->chgrp($dir,$group);
+			if(is_dir($dir)) $this->chown($dir, $user);
+			if(is_dir($dir)) $this->chgrp($dir, $group);
 
 			$chown_mdsub = true;
 		}
-		
-		$maildirsubs = array('cur','new','tmp');
+
+		$maildirsubs = array('cur', 'new', 'tmp');
 
 		foreach ($maildirsubs as $mdsub) {
 			if(!is_dir($dir.'/'.$mdsub)) mkdir($dir.'/'.$mdsub, 0700, true);
@@ -1399,7 +1509,7 @@
 		}
 
 		chmod($dir, 0700);
-		
+
 		/*
 		if($user != '' && $this->is_user($user) && $user != 'root') {
 			$user = escapeshellcmd($user);
@@ -1408,7 +1518,7 @@
 			exec("chown $user:$group $dir $dir_cur $dir_new $dir_tmp");
 		}
 		*/
-		
+
 		//* Add the subfolder to the subscriptions and courierimapsubscribed files
 		if($subfolder != '') {
 			// Courier
@@ -1416,188 +1526,188 @@
 				$tmp_file = escapeshellcmd($maildir_path.'/courierimapsubscribed');
 				touch($tmp_file);
 				chmod($tmp_file, 0744);
-				chown($tmp_file,'vmail');
-				chgrp($tmp_file,'vmail');
+				chown($tmp_file, 'vmail');
+				chgrp($tmp_file, 'vmail');
 			}
-			$this->replaceLine($maildir_path.'/courierimapsubscribed','INBOX.'.$subfolder,'INBOX.'.$subfolder,1,1);
-			
+			$this->replaceLine($maildir_path.'/courierimapsubscribed', 'INBOX.'.$subfolder, 'INBOX.'.$subfolder, 1, 1);
+
 			// Dovecot
 			if(!is_file($maildir_path.'/subscriptions')) {
 				$tmp_file = escapeshellcmd($maildir_path.'/subscriptions');
 				touch($tmp_file);
 				chmod($tmp_file, 0744);
-				chown($tmp_file,'vmail');
-				chgrp($tmp_file,'vmail');
+				chown($tmp_file, 'vmail');
+				chgrp($tmp_file, 'vmail');
 			}
-			$this->replaceLine($maildir_path.'/subscriptions',$subfolder,$subfolder,1,1);
+			$this->replaceLine($maildir_path.'/subscriptions', $subfolder, $subfolder, 1, 1);
 		}
-		
-		$app->log('Created Maildir '.$maildir_path.' with subfolder: '.$subfolder,LOGLEVEL_DEBUG);
-		
+
+		$app->log('Created Maildir '.$maildir_path.' with subfolder: '.$subfolder, LOGLEVEL_DEBUG);
+
 	}
-	
+
 	//* Function to create directory paths and chown them to a user and group
 	function mkdirpath($path, $mode = 0755, $user = '', $group = '') {
-		$path_parts = explode('/',$path);
+		$path_parts = explode('/', $path);
 		$new_path = '';
 		if(is_array($path_parts)) {
 			foreach($path_parts as $part) {
 				$new_path .= '/'.$part;
 				if(!@is_dir($new_path)) {
 					$this->mkdir($new_path);
-					$this->chmod($new_path,$mode);
-					if($user != '') $this->chown($new_path,$user);
-					if($group != '') $this->chgrp($new_path,$group);
+					$this->chmod($new_path, $mode);
+					if($user != '') $this->chown($new_path, $user);
+					if($group != '') $this->chgrp($new_path, $group);
 				}
 			}
 		}
-		
+
 	}
-	
+
 	//* Check if a application is installed
 	function is_installed($appname) {
-		exec('which '.escapeshellcmd($appname).' 2> /dev/null',$out,$returncode);
-		if(isset($out[0]) && stristr($out[0],$appname) && $returncode == 0) {
+		exec('which '.escapeshellcmd($appname).' 2> /dev/null', $out, $returncode);
+		if(isset($out[0]) && stristr($out[0], $appname) && $returncode == 0) {
 			return true;
 		} else {
 			return false;
 		}
 	}
-	
-	function web_folder_protection($document_root,$protect) {
-		global $app,$conf;
-		
+
+	function web_folder_protection($document_root, $protect) {
+		global $app, $conf;
+
 		if($this->checkpath($document_root) == false) {
-			$app->log("Action aborted, target is a symlink: $document_root",LOGLEVEL_DEBUG);
+			$app->log("Action aborted, target is a symlink: $document_root", LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* load the server configuration options
 		$app->uses('getconf');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
+
 		if($protect == true && $web_config['web_folder_protection'] == 'y') {
 			//* Add protection
-			if($document_root != '' && $document_root != '/' && strlen($document_root) > 6 && !stristr($document_root,'..')) exec('chattr +i '.escapeshellcmd($document_root));
+			if($document_root != '' && $document_root != '/' && strlen($document_root) > 6 && !stristr($document_root, '..')) exec('chattr +i '.escapeshellcmd($document_root));
 		} else {
 			//* Remove protection
-			if($document_root != '' && $document_root != '/' && strlen($document_root) > 6 && !stristr($document_root,'..')) exec('chattr -i '.escapeshellcmd($document_root));
+			if($document_root != '' && $document_root != '/' && strlen($document_root) > 6 && !stristr($document_root, '..')) exec('chattr -i '.escapeshellcmd($document_root));
 		}
 	}
-	
+
 	function usermod($username, $uid = 0, $gid = 0, $home = '', $shell = '', $password = '', $login = '') {
 		global $app;
-		
+
 		if($login == '') $login = $username;
-		
+
 		//* Change values in /etc/passwd
 		$passwd_file_array = file('/etc/passwd');
 		if(is_array($passwd_file_array)) {
 			foreach($passwd_file_array as $line) {
 				$line = trim($line);
-				$parts = explode(':',$line);
+				$parts = explode(':', $line);
 				if($parts[0] == $username) {
 					if(trim($login) != '' && trim($login) != trim($username)) $parts[0] = trim($login);
 					if(!empty($uid)) $parts[2] = trim($uid);
 					if(!empty($gid)) $parts[3] = trim($gid);
 					if(trim($home) != '') $parts[5] = trim($home);
 					if(trim($shell) != '') $parts[6] = trim($shell);
-					$new_line = implode(':',$parts);
-					copy('/etc/passwd','/etc/passwd~');
-					chmod('/etc/passwd~',0600);
+					$new_line = implode(':', $parts);
+					copy('/etc/passwd', '/etc/passwd~');
+					chmod('/etc/passwd~', 0600);
 					$app->uses('system');
-					$app->system->replaceLine('/etc/passwd',$line,$new_line,1,0);
+					$app->system->replaceLine('/etc/passwd', $line, $new_line, 1, 0);
 				}
 			}
 			unset($passwd_file_array);
 		}
-		
+
 		//* If username != login, change username in group and gshadow file
 		if($username  != $login) {
 			$group_file_array = file('/etc/group');
 			if(is_array($group_file_array)) {
 				foreach($group_file_array as $line) {
 					$line = trim($line);
-					$parts = explode(':',$line);
-					if(strstr($parts[3],$username)) {
-						$uparts = explode(',',$parts[3]);
+					$parts = explode(':', $line);
+					if(strstr($parts[3], $username)) {
+						$uparts = explode(',', $parts[3]);
 						if(is_array($uparts)) {
 							foreach($uparts as $key => $val) {
 								if($val == $username) $uparts[$key] = $login;
 							}
 						}
-						$parts[3] = implode(',',$uparts);
-						$new_line = implode(':',$parts);
-						copy('/etc/group','/etc/group~');
-						chmod('/etc/group~',0600);
-						$app->system->replaceLine('/etc/group',$line,$new_line,1,0);
+						$parts[3] = implode(',', $uparts);
+						$new_line = implode(':', $parts);
+						copy('/etc/group', '/etc/group~');
+						chmod('/etc/group~', 0600);
+						$app->system->replaceLine('/etc/group', $line, $new_line, 1, 0);
 					}
 				}
 			}
 			unset($group_file_array);
-			
+
 			$gshadow_file_array = file('/etc/gshadow');
 			if(is_array($gshadow_file_array)) {
 				foreach($gshadow_file_array as $line) {
 					$line = trim($line);
-					$parts = explode(':',$line);
-					if(strstr($parts[3],$username)) {
-						$uparts = explode(',',$parts[3]);
+					$parts = explode(':', $line);
+					if(strstr($parts[3], $username)) {
+						$uparts = explode(',', $parts[3]);
 						if(is_array($uparts)) {
 							foreach($uparts as $key => $val) {
 								if($val == $username) $uparts[$key] = $login;
 							}
 						}
-						$parts[3] = implode(',',$uparts);
-						$new_line = implode(':',$parts);
-						copy('/etc/gshadow','/etc/gshadow~');
-						chmod('/etc/gshadow~',0600);
-						$app->system->replaceLine('/etc/gshadow',$line,$new_line,1,0);
+						$parts[3] = implode(',', $uparts);
+						$new_line = implode(':', $parts);
+						copy('/etc/gshadow', '/etc/gshadow~');
+						chmod('/etc/gshadow~', 0600);
+						$app->system->replaceLine('/etc/gshadow', $line, $new_line, 1, 0);
 					}
 				}
 			}
 			unset($group_file_array);
 		}
-		
-		
+
+
 		//* When password or login name has been changed
 		if($password != '' || $username  != $login) {
 			$shadow_file_array = file('/etc/shadow');
 			if(is_array($shadow_file_array)) {
 				foreach($shadow_file_array as $line) {
 					$line = trim($line);
-					$parts = explode(':',$line);
+					$parts = explode(':', $line);
 					if($parts[0] == $username) {
 						if(trim($login) != '' && trim($login) != trim($username)) $parts[0] = trim($login);
 						if(trim($password) != '') $parts[1] = trim($password);
-						$new_line = implode(':',$parts);
-						copy('/etc/shadow','/etc/shadow~');
-						chmod('/etc/shadow~',0600);
-						$app->system->replaceLine('/etc/shadow',$line,$new_line,1,0);
+						$new_line = implode(':', $parts);
+						copy('/etc/shadow', '/etc/shadow~');
+						chmod('/etc/shadow~', 0600);
+						$app->system->replaceLine('/etc/shadow', $line, $new_line, 1, 0);
 					}
 				}
 			}
 			unset($shadow_file_array);
 		}
 	}
-	
+
 	function intval($string, $force_numeric = false) {
-        if(intval($string) == 2147483647) {
-            if($force_numeric == true) return floatval($string);
-            elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
-            else return 0;
-        } else {
-            return intval($string);
-        }
-    }
-	
+		if(intval($string) == 2147483647) {
+			if($force_numeric == true) return floatval($string);
+			elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
+			else return 0;
+		} else {
+			return intval($string);
+		}
+	}
+
 	function is_mounted($mountpoint){
 		//$cmd = 'df 2>/dev/null | grep " '.$mountpoint.'$"';
 		$cmd = 'mount 2>/dev/null | grep " on '.$mountpoint.' type "';
 		exec($cmd, $output, $return_var);
-		return $return_var == 0 ? true : false; 
+		return $return_var == 0 ? true : false;
 	}
-	
+
 	function getinitcommand($servicename, $action, $init_script_directory = ''){
 		global $conf;
 		// systemd
@@ -1616,4 +1726,5 @@
 	}
 
 }
+
 ?>
diff --git a/server/lib/classes/tpl.inc.php b/server/lib/classes/tpl.inc.php
index c3c16c9..deb9ca1 100644
--- a/server/lib/classes/tpl.inc.php
+++ b/server/lib/classes/tpl.inc.php
@@ -12,356 +12,375 @@
 
 // check to avoid multiple including of class
 if (!defined('vlibTemplateClassLoaded')) {
-    define('vlibTemplateClassLoaded', 1);
+	define('vlibTemplateClassLoaded', 1);
 
-   	include_once ($conf['classpath'].'/tpl_error.inc.php');
-   	include_once ($conf['classpath'].'/tpl_ini.inc.php');
+	include_once $conf['classpath'].'/tpl_error.inc.php';
+	include_once $conf['classpath'].'/tpl_ini.inc.php';
 
-    /**
-     * vlibTemplate is a class used to seperate PHP and HTML.
-     * For instructions on how to use vlibTemplate, see the
-     * vlibTemplate.html file, located in the 'docs' directory.
-     *
-     * @since 07/03/2002
-     * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
-     * @package vLIB
-     * @access public
-     * @see vlibTemplate.html
-     */
+	/**
+	 * vlibTemplate is a class used to seperate PHP and HTML.
+	 * For instructions on how to use vlibTemplate, see the
+	 * vlibTemplate.html file, located in the 'docs' directory.
+	 *
+	 * @since 07/03/2002
+	 * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
+	 * @package vLIB
+	 * @access public
+	 * @see vlibTemplate.html
+	 */
 
-    class tpl {
 
-    /*-----------------------------------------------------------------------------\
+	class tpl {
+
+		/*-----------------------------------------------------------------------------\
     |                                 ATTENTION                                    |
     |  Do not touch the following variables. vlibTemplate will not work otherwise. |
     \-----------------------------------------------------------------------------*/
 
-        var $OPTIONS = array(
-                        'MAX_INCLUDES'          =>   10,
-                        'TEMPLATE_DIR'          => null,
-                        'GLOBAL_VARS'           => null,
-                        'GLOBAL_CONTEXT_VARS'   => null,
-                        'LOOP_CONTEXT_VARS'     => null,
-                        'SET_LOOP_VAR'          => null,
-                        'DEFAULT_ESCAPE'        => null,
-                        'STRICT'                => null,
-                        'CASELESS'              => null,
-                        'UNKNOWNS'              => null,
-                        'TIME_PARSE'            => null,
-                        'ENABLE_PHPINCLUDE'     => null,
-                        'INCLUDE_PATHS'         => array(),
-                        'CACHE_DIRECTORY'       => null,
-                        'CACHE_LIFETIME'        => null,
-                        'CACHE_EXTENSION'       => null
-                             );
+		var $OPTIONS = array(
+			'MAX_INCLUDES'          =>   10,
+			'TEMPLATE_DIR'          => null,
+			'GLOBAL_VARS'           => null,
+			'GLOBAL_CONTEXT_VARS'   => null,
+			'LOOP_CONTEXT_VARS'     => null,
+			'SET_LOOP_VAR'          => null,
+			'DEFAULT_ESCAPE'        => null,
+			'STRICT'                => null,
+			'CASELESS'              => null,
+			'UNKNOWNS'              => null,
+			'TIME_PARSE'            => null,
+			'ENABLE_PHPINCLUDE'     => null,
+			'INCLUDE_PATHS'         => array(),
+			'CACHE_DIRECTORY'       => null,
+			'CACHE_LIFETIME'        => null,
+			'CACHE_EXTENSION'       => null
+		);
 
-        /** open and close tags used for escaping */
-        var $ESCAPE_TAGS = array(
-                            'html' => array('open' => 'htmlspecialchars('
-                                            ,'close'=> ', ENT_QUOTES)'),
-                            'url' => array('open' => 'urlencode('
-                                            ,'close'=> ')'),
-                            'rawurl'=>array('open' => 'rawurlencode('
-                                            ,'close'=> ')'),
-                            'sq' => array('open' => 'addcslashes('
-                                            ,'close'=> ", \"'\")"),
-                            'dq' => array('open' => 'addcslashes('
-                                            ,'close'=> ", '\"')"),
-                            '1' => array('open' => 'htmlspecialchars('
-                                            ,'close'=> ', ENT_QUOTES)'),
-                            '0' => array('open' => ''
-                                            ,'close'=> ''),
-                            'none' => array('open' => ''
-                                            ,'close'=> ''),
-                            'hex'        => array('open' => '$this->_escape_hex(',
-                                            'close'=> ', false)'),
-                            'hexentity'  => array('open' => '$this->_escape_hex(',
-                                            'close'=> ', true)')
-                                );
+		/** open and close tags used for escaping */
+		var $ESCAPE_TAGS = array(
+			'html' => array('open' => 'htmlspecialchars('
+				, 'close'=> ', ENT_QUOTES)'),
+			'url' => array('open' => 'urlencode('
+				, 'close'=> ')'),
+			'rawurl'=>array('open' => 'rawurlencode('
+				, 'close'=> ')'),
+			'sq' => array('open' => 'addcslashes('
+				, 'close'=> ", \"'\")"),
+			'dq' => array('open' => 'addcslashes('
+				, 'close'=> ", '\"')"),
+			'1' => array('open' => 'htmlspecialchars('
+				, 'close'=> ', ENT_QUOTES)'),
+			'0' => array('open' => ''
+				, 'close'=> ''),
+			'none' => array('open' => ''
+				, 'close'=> ''),
+			'hex'        => array('open' => '$this->_escape_hex(',
+				'close'=> ', false)'),
+			'hexentity'  => array('open' => '$this->_escape_hex(',
+				'close'=> ', true)')
+		);
 
-        /** open and close tags used for formatting */
-        var $FORMAT_TAGS = array(
-                            'strtoupper' => array('open' => 'strtoupper(',
-                                            'close'=> ')'),
-                            'uc'         => array('open' => 'strtoupper(',
-                                            'close'=> ')'),
-                            'strtolower' => array('open' => 'strtolower(',
-                                            'close'=> ')'),
-                            'lc'         => array('open' => 'strtolower(',
-                                            'close'=> ')'),
-                            'ucfirst'    => array('open' => 'ucfirst(',
-                                            'close'=> ')'),
-                            'lcucfirst'  => array('open' => 'ucfirst(strtolower(',
-                                            'close'=> '))'),
-                            'ucwords'    => array('open' => 'ucwords(',
-                                            'close'=> ')'),
-                            'lcucwords'  => array('open' => 'ucwords(strtolower(',
-                                            'close'=> '))')
-                                );
+		/** open and close tags used for formatting */
+		var $FORMAT_TAGS = array(
+			'strtoupper' => array('open' => 'strtoupper(',
+				'close'=> ')'),
+			'uc'         => array('open' => 'strtoupper(',
+				'close'=> ')'),
+			'strtolower' => array('open' => 'strtolower(',
+				'close'=> ')'),
+			'lc'         => array('open' => 'strtolower(',
+				'close'=> ')'),
+			'ucfirst'    => array('open' => 'ucfirst(',
+				'close'=> ')'),
+			'lcucfirst'  => array('open' => 'ucfirst(strtolower(',
+				'close'=> '))'),
+			'ucwords'    => array('open' => 'ucwords(',
+				'close'=> ')'),
+			'lcucwords'  => array('open' => 'ucwords(strtolower(',
+				'close'=> '))')
+		);
 
-        /** operators allowed when using extended TMPL_IF syntax */
-        var $allowed_if_ops = array('==','!=','<>','<','>','<=','>=');
+		/** operators allowed when using extended TMPL_IF syntax */
+		var $allowed_if_ops = array('==', '!=', '<>', '<', '>', '<=', '>=');
 
-        /** dbs allowed by vlibTemplate::setDbLoop(). */
-        var $allowed_loop_dbs = array('MYSQL','POSTGRESQL','INFORMIX','INTERBASE','INGRES',
-                                      'MSSQL','MSQL','OCI8','ORACLE','OVRIMOS','SYBASE');
+		/** dbs allowed by vlibTemplate::setDbLoop(). */
+		var $allowed_loop_dbs = array('MYSQL', 'POSTGRESQL', 'INFORMIX', 'INTERBASE', 'INGRES',
+			'MSSQL', 'MSQL', 'OCI8', 'ORACLE', 'OVRIMOS', 'SYBASE');
 
-        /** root directory of vlibTemplate automagically filled in */
-        var $VLIBTEMPLATE_ROOT = null;
+		/** root directory of vlibTemplate automagically filled in */
+		var $VLIBTEMPLATE_ROOT = null;
 
-        /** contains current directory used when doing recursive include */
-        var $_currentincludedir = array();
+		/** contains current directory used when doing recursive include */
+		var $_currentincludedir = array();
 
-        /** current depth of includes */
-        var $_includedepth = 0;
+		/** current depth of includes */
+		var $_includedepth = 0;
 
-        /** full path to tmpl file */
-        var $_tmplfilename = null;
+		/** full path to tmpl file */
+		var $_tmplfilename = null;
 
-        /** file data before it's parsed */
-        var $_tmplfile = null;
+		/** file data before it's parsed */
+		var $_tmplfile = null;
 
-        /** parsed version of file, ready for eval()ing */
-        var $_tmplfilep = null;
+		/** parsed version of file, ready for eval()ing */
+		var $_tmplfilep = null;
 
-        /** eval()ed version ready for printing or whatever */
-        var $_tmploutput = null;
+		/** eval()ed version ready for printing or whatever */
+		var $_tmploutput = null;
 
-        /** array for variables to be kept */
-        var $_vars = array();
+		/** array for variables to be kept */
+		var $_vars = array();
 
-        /** array where loop variables are kept */
-        var $_arrvars = array();
+		/** array where loop variables are kept */
+		var $_arrvars = array();
 
-        /** array which holds the current namespace during parse */
-        var $_namespace = array();
+		/** array which holds the current namespace during parse */
+		var $_namespace = array();
 
-        /** variable is set to true once the template is parsed, to save re-parsing everything */
-        var $_parsed = false;
+		/** variable is set to true once the template is parsed, to save re-parsing everything */
+		var $_parsed = false;
 
-        /** array holds all unknowns vars */
-        var $_unknowns = array();
+		/** array holds all unknowns vars */
+		var $_unknowns = array();
 
-        /** microtime when template parsing began */
-        var $_firstparsetime = null;
+		/** microtime when template parsing began */
+		var $_firstparsetime = null;
 
-        /** total time taken to parse template */
-        var $_totalparsetime = null;
+		/** total time taken to parse template */
+		var $_totalparsetime = null;
 
-        /** name of current loop being passed in */
-        var $_currloopname = null;
+		/** name of current loop being passed in */
+		var $_currloopname = null;
 
-        /** rows with the above loop */
-        var $_currloop = array();
+		/** rows with the above loop */
+		var $_currloop = array();
 
-        /** define vars to avoid warnings */
-        var $_debug = null;
-        var $_cache = null;
-        
-        /** array which holds the dynamic Includes */
-        var $_dyninclude = array();
-    /*-----------------------------------------------------------------------------\
+		/** define vars to avoid warnings */
+		var $_debug = null;
+		var $_cache = null;
+
+
+
+		/** array which holds the dynamic Includes */
+		var $_dyninclude = array();
+		/*-----------------------------------------------------------------------------\
     |                           public functions                                   |
     \-----------------------------------------------------------------------------*/
-		
-		
-        /**
-         * FUNCTION: newTemplate
-         *
-         * Usually called by the class constructor.
-         * Stores the filename in $this->_tmplfilename.
-         * Raises an error if the template file is not found.
-         *
-         * @param string $tmplfile full path to template file
-         * @return boolean true
-         * @access public
-         */
-        function newTemplate ($tmplfile) {
-            if (!$tfile = $this->_fileSearch($tmplfile)) vlibTemplateError::raiseError('VT_ERROR_NOFILE',KILL,$tmplfile);
 
-            // make sure that any parsing vars are cleared for the new template
-            $this->_tmplfile = null;
-            $this->_tmplfilep = null;
-            $this->_tmploutput = null;
-            $this->_parsed = false;
-            $this->_unknowns = array();
-            $this->_firstparsetime = null;
-            $this->_totalparsetime = null;
 
-            // reset debug module
-            if ($this->_debug) $this->_debugReset();
 
-            $this->_tmplfilename = $tfile;
-            return true;
-        }
 
-        /**
-         * FUNCTION: setVar
-         *
-         * Sets variables to be used by the template
-         * If $k is an array, then it will treat it as an associative array
-         * using the keys as variable names and the values as variable values.
-         *
-         * @param mixed $k key to define variable name
-         * @param mixed $v variable to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        function setVar ($k,$v=null) {
-            if (is_array($k)) {
-                foreach($k as $key => $value){
-                    $key = ($this->OPTIONS['CASELESS']) ? strtolower(trim($key)) : trim($key);
-                    if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $key) && $value !== null ) {
-                        $this->_vars[$key] = $value;
-                    }
-                }
-            }
-            else {
-                if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k) && $v !== null) {
-                    if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
-                    $this->_vars[trim($k)] = $v;
-                }
-                else {
-                    return false;
-                }
-            }
-            return true;
-        }
-        
-        /**
-         * FUNCTION: setInclude
-         *
-         * Sets dynamic includes to be used by the template
-         * If $k is an array, then it will treat it as an associative array
-         * using the keys as variable names and the values as variable values.
-         *
-         * @param mixed $k key to define variable name
-         * @param mixed $v variable to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        
-        function setInclude($k, $v = null) {
-        	if(is_array($k)) {
+
+
+
+
+		/**
+		 * FUNCTION: newTemplate
+		 *
+		 * Usually called by the class constructor.
+		 * Stores the filename in $this->_tmplfilename.
+		 * Raises an error if the template file is not found.
+		 *
+		 * @param string $tmplfile full path to template file
+		 * @return boolean true
+		 * @access public
+		 */
+		function newTemplate ($tmplfile) {
+			if (!$tfile = $this->_fileSearch($tmplfile)) vlibTemplateError::raiseError('VT_ERROR_NOFILE', KILL, $tmplfile);
+
+			// make sure that any parsing vars are cleared for the new template
+			$this->_tmplfile = null;
+			$this->_tmplfilep = null;
+			$this->_tmploutput = null;
+			$this->_parsed = false;
+			$this->_unknowns = array();
+			$this->_firstparsetime = null;
+			$this->_totalparsetime = null;
+
+			// reset debug module
+			if ($this->_debug) $this->_debugReset();
+
+			$this->_tmplfilename = $tfile;
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: setVar
+		 *
+		 * Sets variables to be used by the template
+		 * If $k is an array, then it will treat it as an associative array
+		 * using the keys as variable names and the values as variable values.
+		 *
+		 * @param mixed $k key to define variable name
+		 * @param mixed $v variable to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function setVar ($k, $v=null) {
+			if (is_array($k)) {
+				foreach($k as $key => $value){
+					$key = ($this->OPTIONS['CASELESS']) ? strtolower(trim($key)) : trim($key);
+					if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $key) && $value !== null ) {
+						$this->_vars[$key] = $value;
+					}
+				}
+			}
+			else {
+				if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k) && $v !== null) {
+					if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
+					$this->_vars[trim($k)] = $v;
+				}
+				else {
+					return false;
+				}
+			}
+			return true;
+		}
+
+
+
+
+
+		/**
+		 * FUNCTION: setInclude
+		 *
+		 * Sets dynamic includes to be used by the template
+		 * If $k is an array, then it will treat it as an associative array
+		 * using the keys as variable names and the values as variable values.
+		 *
+		 * @param mixed $k key to define variable name
+		 * @param mixed $v variable to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function setInclude($k, $v = null) {
+			if(is_array($k)) {
 				foreach($k as $key => $val) {
 					$this->_dyninclude[$key] = $val;
 				}
 			} else {
 				$this->_dyninclude[$k] = $v;
 			}
-			
+
 			return true;
 		}
 
-        /**
-         * FUNCTION: unsetVar
-         *
-         * Unsets a variable which has already been set
-         * Parse in all vars wanted for deletion in seperate parametres
-         *
-         * @param string var name to remove use: vlibTemplate::unsetVar(var[, var..])
-         * @return boolean true/false returns true unless called with 0 params
-         * @access public
-         */
-        function unsetVar () {
-            $num_args = func_num_args();
-            if ($num_args < 1)  return false;
 
-            for ($i = 0; $i < $num_args; $i++) {
-                $var = func_get_arg($i);
-                if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-                if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;
-                unset($this->_vars[$var]);
-            }
-            return true;
-        }
+		/**
+		 * FUNCTION: unsetVar
+		 *
+		 * Unsets a variable which has already been set
+		 * Parse in all vars wanted for deletion in seperate parametres
+		 *
+		 * @param string var name to remove use: vlibTemplate::unsetVar(var[, var..])
+		 * @return boolean true/false returns true unless called with 0 params
+		 * @access public
+		 */
+		function unsetVar () {
+			$num_args = func_num_args();
+			if ($num_args < 1)  return false;
 
-        /**
-         * FUNCTION: getVars
-         *
-         * Gets all vars currently set in global namespace.
-         *
-         * @return array
-         * @access public
-         */
-        function getVars () {
-            if (empty($this->_vars)) return false;
-            return $this->_vars;
-        }
+			for ($i = 0; $i < $num_args; $i++) {
+				$var = func_get_arg($i);
+				if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
+				if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;
+				unset($this->_vars[$var]);
+			}
+			return true;
+		}
 
-        /**
-         * FUNCTION: getVar
-         *
-         * Gets a single var from the global namespace
-         *
-         * @return var
-         * @access public
-         */
-        function getVar ($var) {
-            if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-            if (empty($var) || !isset($this->_vars[$var])) return false;
-            return $this->_vars[$var];
-        }
 
-        /**
-         * FUNCTION: setContextVars
-         *
-         * sets the GLOBAL_CONTEXT_VARS
-         *
-         * @return true
-         * @access public
-         */
-        function setContextVars () {
-            $_phpself = @$GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'];
-            $_pathinfo = @$GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'];
-            $_request_uri = @$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
-            $_qs   = @$GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
+		/**
+		 * FUNCTION: getVars
+		 *
+		 * Gets all vars currently set in global namespace.
+		 *
+		 * @return array
+		 * @access public
+		 */
+		function getVars () {
+			if (empty($this->_vars)) return false;
+			return $this->_vars;
+		}
 
-            // the following fixes bug of $PHP_SELF on Win32 CGI and IIS.
-            $_self = (!empty($_pathinfo)) ? $_pathinfo : $_phpself;
-            $_uri  = (!empty($_request_uri)) ? $_request_uri : $_self.'?'.$_qs;
 
-            $this->setvar('__SELF__', $_self);
-            $this->setvar('__REQUEST_URI__', $_uri);
-            return true;
-        }
+		/**
+		 * FUNCTION: getVar
+		 *
+		 * Gets a single var from the global namespace
+		 *
+		 * @return var
+		 * @access public
+		 */
+		function getVar ($var) {
+			if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
+			if (empty($var) || !isset($this->_vars[$var])) return false;
+			return $this->_vars[$var];
+		}
 
-        /**
-         * FUNCTION: setLoop
-         *
-         * Builds the loop construct for use with <TMPL_LOOP>.
-         *
-         * @param string $k string to define loop name
-         * @param array $v array to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        function setLoop ($k,$v) {
-            if (is_array($v) && preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k)) {
-                $k = ($this->OPTIONS['CASELESS']) ? strtolower(trim($k)) : trim($k);
-                $this->_arrvars[$k] = array();
-                if ($this->OPTIONS['SET_LOOP_VAR'] && !empty($v)) $this->setvar($k, 1);
-                if (($this->_arrvars[$k] = $this->_arrayBuild($v)) == false) {
-                    vlibTemplateError::raiseError('VT_WARNING_INVALID_ARR',WARNING,$k);
-                }
-            }
-            return true;
-        }
 
-        /**
-         * FUNCTION: setDbLoop [** EXPERIMENTAL **]
-         *
-         * Function to create a loop from a Db result resource link.
-         *
-         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
-         * @param string $result link to a Db result resource
-         * @param string $db_type, type of db that the result resource belongs to.
-         * @return boolean true/false
-         * @access public
-         */
-        function setDbLoop ($loopname, $result, $db_type='MYSQL') {
-		
-		/*
+		/**
+		 * FUNCTION: setContextVars
+		 *
+		 * sets the GLOBAL_CONTEXT_VARS
+		 *
+		 * @return true
+		 * @access public
+		 */
+		function setContextVars () {
+			$_phpself = @$GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'];
+			$_pathinfo = @$GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'];
+			$_request_uri = @$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
+			$_qs   = @$GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
+
+			// the following fixes bug of $PHP_SELF on Win32 CGI and IIS.
+			$_self = (!empty($_pathinfo)) ? $_pathinfo : $_phpself;
+			$_uri  = (!empty($_request_uri)) ? $_request_uri : $_self.'?'.$_qs;
+
+			$this->setvar('__SELF__', $_self);
+			$this->setvar('__REQUEST_URI__', $_uri);
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: setLoop
+		 *
+		 * Builds the loop construct for use with <TMPL_LOOP>.
+		 *
+		 * @param string $k string to define loop name
+		 * @param array $v array to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function setLoop ($k, $v) {
+			if (is_array($v) && preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k)) {
+				$k = ($this->OPTIONS['CASELESS']) ? strtolower(trim($k)) : trim($k);
+				$this->_arrvars[$k] = array();
+				if ($this->OPTIONS['SET_LOOP_VAR'] && !empty($v)) $this->setvar($k, 1);
+				if (($this->_arrvars[$k] = $this->_arrayBuild($v)) == false) {
+					vlibTemplateError::raiseError('VT_WARNING_INVALID_ARR', WARNING, $k);
+				}
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: setDbLoop [** EXPERIMENTAL **]
+		 *
+		 * Function to create a loop from a Db result resource link.
+		 *
+		 * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
+		 * @param string $result link to a Db result resource
+		 * @param string $db_type, type of db that the result resource belongs to.
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function setDbLoop ($loopname, $result, $db_type='MYSQL') {
+
+			/*
             $db_type = strtoupper($db_type);
             if (!in_array($db_type, $this->allowed_loop_dbs)) {
                 vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB',WARNING, $db_type);
@@ -488,1022 +507,1053 @@
             $this->setLoop($loopname, $loop_arr);
             return true;
 			*/
-        }
-
-        /**
-         * FUNCTION: newLoop
-         *
-         * Sets the name for the curent loop in the 3 step loop process.
-         *
-         * @param string $name string to define loop name
-         * @return boolean true/false
-         * @access public
-         */
-        function newLoop ($loopname) {
-            if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {
-                $this->_currloopname[$loopname] = $loopname;
-                $this->_currloop[$loopname] = array();
-                return true;
-            }
-            else {
-                return false;
-            }
-        }
-
-        /**
-         * FUNCTION: addRow
-         *
-         * Adds a row to the current loop in the 3 step loop process.
-         *
-         * @param array $row loop row to add to current loop
-         * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().
-         * @return boolean true/false
-         * @access public
-         */
-        function addRow ($row, $loopname=null) {
-            if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
-
-            if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
-                vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET',WARNING);
-                return false;
-            }
-            if (is_array($row)) {
-                $this->_currloop[$loopname][] = $row;
-                return true;
-            }
-            else {
-                return false;
-            }
-        }
-
-        /**
-         * FUNCTION: addLoop
-         *
-         * Completes the 3 step loop process. This assigns the rows and resets
-         * the variables used.
-         *
-         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
-         * @return boolean true/false
-         * @access public
-         */
-        function addLoop ($loopname=null) {
-            if ($loopname == null) { // add last loop used
-                if (!empty($this->_currloop)) {
-                    foreach ($this->_currloop as $k => $v) {
-                        $this->setLoop($k, $v);
-                        unset($this->_currloop[$k]);
-                    }
-                    $this->_currloopname = array();
-                    return true;
-                }
-                else {
-                    return false;
-                }
-            }
-            elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked
-                    vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET',WARNING);
-                    return false;
-            }
-            else { // add a specific loop
-                $this->setLoop($loopname, $this->_currloop[$loopname]);
-                unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);
-            }
-            return true;
-        }
-
-        /**
-         * FUNCTION: unsetLoop
-         *
-         * Unsets a loop which has already been set.
-         * Can only unset top level loops.
-         *
-         * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])
-         * @return boolean true/false returns true unless called with 0 params
-         * @access public
-         */
-        function unsetLoop () {
-            $num_args = func_num_args();
-            if ($num_args < 1) return false;
-
-            for ($i = 0; $i < $num_args; $i++) {
-                $var = func_get_arg($i);
-                if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-                if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;
-                unset($this->_arrvars[$var]);
-            }
-            return true;
-        }
+		}
 
 
-        /**
-         * FUNCTION: reset
-         *
-         * Resets the vlibTemplate object. After using vlibTemplate::reset() you must
-         * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.
-         *
-         * @return boolean true
-         * @access public
-         */
-        function reset () {
-            $this->clearVars();
-            $this->clearLoops();
-            $this->_tmplfilename = null;
-            $this->_tmplfile = null;
-            $this->_tmplfilep = null;
-            $this->_tmploutput = null;
-            $this->_parsed = false;
-            $this->_unknowns = array();
-            $this->_firstparsetime = null;
-            $this->_totalparsetime = null;
-            $this->_currloopname = null;
-            $this->_currloop = array();
-            return true;
-        }
-
-        /**
-         * FUNCTION: clearVars
-         *
-         * Unsets all variables in the template
-         *
-         * @return boolean true
-         * @access public
-         */
-        function clearVars () {
-            $this->_vars = array();
-            return true;
-        }
-
-        /**
-         * FUNCTION: clearLoops
-         *
-         * Unsets all loops in the template
-         *
-         * @return boolean true
-         * @access public
-         */
-        function clearLoops () {
-            $this->_arrvars = array();
-            $this->_currloopname = null;
-            $this->_currloop = array();
-            return true;
-        }
-
-        /**
-         * FUNCTION: clearAll
-         *
-         * Unsets all variables and loops set using setVar/Loop()
-         *
-         * @return boolean true
-         * @access public
-         */
-        function clearAll () {
-            $this->clearVars();
-            $this->clearLoops();
-            return true;
-        }
-
-        /**
-         * FUNCTION: unknownsExist
-         *
-         * Returns true if unknowns were found after parsing.
-         * Function MUST be called AFTER one of the parsing functions to have any relevance.
-         *
-         * @return boolean true/false
-         * @access public
-         */
-        function unknownsExist () {
-            return (!empty($this->_unknowns));
-        }
-
-        /**
-         * FUNCTION: unknowns
-         *
-         * Alias for unknownsExist.
-         *
-         * @access public
-         */
-        function unknowns () {
-            return $this->unknownsExist();
-        }
-
-        /**
-         * FUNCTION: getUnknowns
-         *
-         * Returns an array of all unknown vars found when parsing.
-         * This function is only relevant after parsing a document.
-         *
-         * @return array
-         * @access public
-         */
-        function getUnknowns () {
-            return $this->_unknowns;
-        }
-
-        /**
-         * FUNCTION: setUnknowns
-         *
-         * Sets how you want to handle variables that were found in the
-         * template but not set in vlibTemplate using vlibTemplate::setVar().
-         *
-         * @param  string $arg ignore, remove, print, leave or comment
-         * @return boolean
-         * @access public
-         */
-        function setUnknowns ($arg) {
-            $arg = strtolower(trim($arg));
-            if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {
-                $this->OPTIONS['UNKNOWNS'] = $arg;
-                return true;
-            }
-            return false;
-        }
-
-        /**
-         * FUNCTION: setPath
-         *
-         * function sets the paths to use when including files.
-         * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);
-         * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');
-         * with as many paths as you like.
-         * if this function is called without any arguments, it will just delete any previously set paths.
-         *
-         * @param string path (mulitple)
-         * @return bool success
-         * @access public
-         */
-        function setPath () {
-            $num_args = func_num_args();
-            if ($num_args < 1) {
-                $this->OPTIONS['INCLUDE_PATHS'] = array();
-                return true;
-            }
-            for ($i = 0; $i < $num_args; $i++) {
-                $thispath = func_get_arg($i);
-                array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));
-            }
-            return true;
-        }
-
-        /**
-         * FUNCTION: getParseTime
-         *
-         * After using one of the parse functions, this will allow you
-         * access the time taken to parse the template.
-         * see OPTION 'TIME_PARSE'.
-         *
-         * @return float time taken to parse template
-         * @access public
-         */
-        function getParseTime () {
-            if ($this->OPTIONS['TIME_PARSE'] && $this->_parsed) {
-                return $this->_totalparsetime;
-            }
-            return false;
-        }
+		/**
+		 * FUNCTION: newLoop
+		 *
+		 * Sets the name for the curent loop in the 3 step loop process.
+		 *
+		 * @param string $name string to define loop name
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function newLoop ($loopname) {
+			if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {
+				$this->_currloopname[$loopname] = $loopname;
+				$this->_currloop[$loopname] = array();
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
 
 
-        /**
-         * FUNCTION: fastPrint
-         *
-         * Identical to pparse() except that it uses output buffering w/ gz compression thus
-         * printing the output directly and compressed if poss.
-         * Will possibly if parsing a huge template.
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        function fastPrint () {
-            $ret = $this->_parse('ob_gzhandler');
-            print($this->_tmploutput);
-            return $ret;
-        }
+		/**
+		 * FUNCTION: addRow
+		 *
+		 * Adds a row to the current loop in the 3 step loop process.
+		 *
+		 * @param array $row loop row to add to current loop
+		 * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function addRow ($row, $loopname=null) {
+			if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
+
+			if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
+				vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
+				return false;
+			}
+			if (is_array($row)) {
+				$this->_currloop[$loopname][] = $row;
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
 
 
-        /**
-         * FUNCTION: pparse
-         *
-         * Calls parse, and then prints out $this->_tmploutput
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        function pparse () {
-            if (!$this->_parsed) $this->_parse();
-            print($this->_tmploutput);
-            return true;
-        }
-
-        /**
-         * FUNCTION: pprint
-         *
-         * Alias for pparse()
-         *
-         * @access public
-         */
-        function pprint () {
-            return $this->pparse();
-        }
+		/**
+		 * FUNCTION: addLoop
+		 *
+		 * Completes the 3 step loop process. This assigns the rows and resets
+		 * the variables used.
+		 *
+		 * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function addLoop ($loopname=null) {
+			if ($loopname == null) { // add last loop used
+				if (!empty($this->_currloop)) {
+					foreach ($this->_currloop as $k => $v) {
+						$this->setLoop($k, $v);
+						unset($this->_currloop[$k]);
+					}
+					$this->_currloopname = array();
+					return true;
+				}
+				else {
+					return false;
+				}
+			}
+			elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked
+				vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
+				return false;
+			}
+			else { // add a specific loop
+				$this->setLoop($loopname, $this->_currloop[$loopname]);
+				unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);
+			}
+			return true;
+		}
 
 
-        /**
-         * FUNCTION: grab
-         *
-         * Returns the parsed output, ready for printing, passing to mail() ...etc.
-         * Invokes $this->_parse() if template has not yet been parsed.
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        function grab () {
-            if (!$this->_parsed) $this->_parse();
-            return $this->_tmploutput;
-        }
+		/**
+		 * FUNCTION: unsetLoop
+		 *
+		 * Unsets a loop which has already been set.
+		 * Can only unset top level loops.
+		 *
+		 * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])
+		 * @return boolean true/false returns true unless called with 0 params
+		 * @access public
+		 */
+		function unsetLoop () {
+			$num_args = func_num_args();
+			if ($num_args < 1) return false;
 
-    /*-----------------------------------------------------------------------------\
+			for ($i = 0; $i < $num_args; $i++) {
+				$var = func_get_arg($i);
+				if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
+				if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;
+				unset($this->_arrvars[$var]);
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: reset
+		 *
+		 * Resets the vlibTemplate object. After using vlibTemplate::reset() you must
+		 * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.
+		 *
+		 * @return boolean true
+		 * @access public
+		 */
+		function reset() {
+			$this->clearVars();
+			$this->clearLoops();
+			$this->_tmplfilename = null;
+			$this->_tmplfile = null;
+			$this->_tmplfilep = null;
+			$this->_tmploutput = null;
+			$this->_parsed = false;
+			$this->_unknowns = array();
+			$this->_firstparsetime = null;
+			$this->_totalparsetime = null;
+			$this->_currloopname = null;
+			$this->_currloop = array();
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: clearVars
+		 *
+		 * Unsets all variables in the template
+		 *
+		 * @return boolean true
+		 * @access public
+		 */
+		function clearVars () {
+			$this->_vars = array();
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: clearLoops
+		 *
+		 * Unsets all loops in the template
+		 *
+		 * @return boolean true
+		 * @access public
+		 */
+		function clearLoops () {
+			$this->_arrvars = array();
+			$this->_currloopname = null;
+			$this->_currloop = array();
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: clearAll
+		 *
+		 * Unsets all variables and loops set using setVar/Loop()
+		 *
+		 * @return boolean true
+		 * @access public
+		 */
+		function clearAll () {
+			$this->clearVars();
+			$this->clearLoops();
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: unknownsExist
+		 *
+		 * Returns true if unknowns were found after parsing.
+		 * Function MUST be called AFTER one of the parsing functions to have any relevance.
+		 *
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function unknownsExist () {
+			return !empty($this->_unknowns);
+		}
+
+
+		/**
+		 * FUNCTION: unknowns
+		 *
+		 * Alias for unknownsExist.
+		 *
+		 * @access public
+		 */
+		function unknowns () {
+			return $this->unknownsExist();
+		}
+
+
+		/**
+		 * FUNCTION: getUnknowns
+		 *
+		 * Returns an array of all unknown vars found when parsing.
+		 * This function is only relevant after parsing a document.
+		 *
+		 * @return array
+		 * @access public
+		 */
+		function getUnknowns () {
+			return $this->_unknowns;
+		}
+
+
+		/**
+		 * FUNCTION: setUnknowns
+		 *
+		 * Sets how you want to handle variables that were found in the
+		 * template but not set in vlibTemplate using vlibTemplate::setVar().
+		 *
+		 * @param  string $arg ignore, remove, print, leave or comment
+		 * @return boolean
+		 * @access public
+		 */
+		function setUnknowns ($arg) {
+			$arg = strtolower(trim($arg));
+			if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {
+				$this->OPTIONS['UNKNOWNS'] = $arg;
+				return true;
+			}
+			return false;
+		}
+
+
+		/**
+		 * FUNCTION: setPath
+		 *
+		 * function sets the paths to use when including files.
+		 * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);
+		 * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');
+		 * with as many paths as you like.
+		 * if this function is called without any arguments, it will just delete any previously set paths.
+		 *
+		 * @param string path (mulitple)
+		 * @return bool success
+		 * @access public
+		 */
+		function setPath () {
+			$num_args = func_num_args();
+			if ($num_args < 1) {
+				$this->OPTIONS['INCLUDE_PATHS'] = array();
+				return true;
+			}
+			for ($i = 0; $i < $num_args; $i++) {
+				$thispath = func_get_arg($i);
+				array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: getParseTime
+		 *
+		 * After using one of the parse functions, this will allow you
+		 * access the time taken to parse the template.
+		 * see OPTION 'TIME_PARSE'.
+		 *
+		 * @return float time taken to parse template
+		 * @access public
+		 */
+		function getParseTime () {
+			if ($this->OPTIONS['TIME_PARSE'] && $this->_parsed) {
+				return $this->_totalparsetime;
+			}
+			return false;
+		}
+
+
+		/**
+		 * FUNCTION: fastPrint
+		 *
+		 * Identical to pparse() except that it uses output buffering w/ gz compression thus
+		 * printing the output directly and compressed if poss.
+		 * Will possibly if parsing a huge template.
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		function fastPrint () {
+			$ret = $this->_parse('ob_gzhandler');
+			print($this->_tmploutput);
+			return $ret;
+		}
+
+
+		/**
+		 * FUNCTION: pparse
+		 *
+		 * Calls parse, and then prints out $this->_tmploutput
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		function pparse () {
+			if (!$this->_parsed) $this->_parse();
+			print($this->_tmploutput);
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: pprint
+		 *
+		 * Alias for pparse()
+		 *
+		 * @access public
+		 */
+		function pprint () {
+			return $this->pparse();
+		}
+
+
+		/**
+		 * FUNCTION: grab
+		 *
+		 * Returns the parsed output, ready for printing, passing to mail() ...etc.
+		 * Invokes $this->_parse() if template has not yet been parsed.
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		function grab () {
+			if (!$this->_parsed) $this->_parse();
+			return $this->_tmploutput;
+		}
+
+		/*-----------------------------------------------------------------------------\
     |                           private functions                                  |
     \-----------------------------------------------------------------------------*/
 
-        /**
-         * FUNCTION: vlibTemplate
-         *
-         * vlibTemplate constructor.
-         * if $tmplfile has been passed to it, it will send to $this->newTemplate()
-         *
-         * @param string $tmplfile full path to template file
-         * @param array $options see above
-         * @return boolean true/false
-         * @access private
-         */
-        function tpl ($tmplfile=null, $options=null) {
-            if (is_array($tmplfile) && $options == null) {
-                $options = $tmplfile;
-                unset($tmplfile);
-            }
 
-            $this->VLIBTEMPLATE_ROOT = dirname(realpath(__FILE__));
+		/**
+		 * FUNCTION: vlibTemplate
+		 *
+		 * vlibTemplate constructor.
+		 * if $tmplfile has been passed to it, it will send to $this->newTemplate()
+		 *
+		 * @param string $tmplfile full path to template file
+		 * @param array $options see above
+		 * @return boolean true/false
+		 * @access private
+		 */
+		function tpl ($tmplfile=null, $options=null) {
+			if (is_array($tmplfile) && $options == null) {
+				$options = $tmplfile;
+				unset($tmplfile);
+			}
 
-            if (is_array(vlibIni::vlibTemplate())) {
-                foreach (vlibIni::vlibTemplate() as $name => $val) {
-                    $this->OPTIONS[$name] = $val;
-                }
-            }
+			$this->VLIBTEMPLATE_ROOT = dirname(realpath(__FILE__));
 
-            if (is_array($options)) {
-                foreach($options as $key => $val) {
-                    $key = strtoupper($key);
-                    if ($key == 'PATH') {
-                        $this->setPath($val);
-                    }
-                    else {
-                        $this->_setOption($key, strtolower($val));
-                    }
-                }
-            }
-            if($tmplfile) $this->newTemplate($tmplfile);
-            if ($this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setContextVars();
-            return true;
-        }
+			if (is_array(vlibIni::vlibTemplate())) {
+				foreach (vlibIni::vlibTemplate() as $name => $val) {
+					$this->OPTIONS[$name] = $val;
+				}
+			}
 
-        /** FUNCTION: _getData
-         *
-         * function returns the text from the file, or if we're using cache, the text
-         * from the cache file. MUST RETURN DATA.
-         * @param string tmplfile contains path to template file
-         * @param do_eval used for included files. If set then this function must do the eval()'ing.
-         * @access private
-         * @return mixed data/string or boolean
-         */
-        function _getData ($tmplfile, $do_eval=false) {
-            //check the current file depth
-            if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
-                return;
-            }
-            else {
-                if ($this->_debug) array_push ($this->_debugIncludedfiles, $tmplfile);
-                if ($do_eval) {
-                    array_push($this->_currentincludedir, dirname($tmplfile));
-                    $this->_includedepth++;
-                }
-            }
+			if (is_array($options)) {
+				foreach($options as $key => $val) {
+					$key = strtoupper($key);
+					if ($key == 'PATH') {
+						$this->setPath($val);
+					}
+					else {
+						$this->_setOption($key, strtolower($val));
+					}
+				}
+			}
+			if($tmplfile) $this->newTemplate($tmplfile);
+			if ($this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setContextVars();
+			return true;
+		}
 
 
-            if($this->_cache && $this->_checkCache($tmplfile)) { // cache exists so lets use it
-                $data = fread($fp = fopen($this->_cachefile, 'r'), filesize($this->_cachefile));
-                fclose($fp);
-            }
-            else { // no cache lets parse the file
-                $data = fread($fp = fopen($tmplfile, 'r'), filesize($tmplfile));
-                fclose($fp);
+		/** FUNCTION: _getData
+		 *
+		 * function returns the text from the file, or if we're using cache, the text
+		 * from the cache file. MUST RETURN DATA.
+		 * @param string tmplfile contains path to template file
+		 * @param do_eval used for included files. If set then this function must do the eval()'ing.
+		 * @access private
+		 * @return mixed data/string or boolean
+		 */
+		function _getData ($tmplfile, $do_eval=false) {
+			//check the current file depth
+			if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
+				return;
+			}
+			else {
+				if ($this->_debug) array_push($this->_debugIncludedfiles, $tmplfile);
+				if ($do_eval) {
+					array_push($this->_currentincludedir, dirname($tmplfile));
+					$this->_includedepth++;
+				}
+			}
 
-                $regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*';
-                $regex.= 'tmpl_([\w]+)\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value|file)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')?';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:>|\/>|}|-->){1}';
+
+			if($this->_cache && $this->_checkCache($tmplfile)) { // cache exists so lets use it
+				$data = fread($fp = fopen($this->_cachefile, 'r'), filesize($this->_cachefile));
+				fclose($fp);
+			}
+			else { // no cache lets parse the file
+				$data = fread($fp = fopen($tmplfile, 'r'), filesize($tmplfile));
+				fclose($fp);
+
+				$regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*';
+				$regex.= 'tmpl_([\w]+)\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value|file)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')?';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:>|\/>|}|-->){1}';
 				$regex.= '/i';
-                //$regex.= '([\r\n|\n|\r])?/ie';
-                $data = preg_replace_callback($regex, array($this, '_parseTag'), $data);
+				//$regex.= '([\r\n|\n|\r])?/ie';
+				$data = preg_replace_callback($regex, array($this, '_parseTag'), $data);
 
-                if ($this->_cache) { // add cache if need be
-                    $this->_createCache($data);
-                }
-            }
+				if ($this->_cache) { // add cache if need be
+					$this->_createCache($data);
+				}
+			}
 
-            // now we must parse the $data and check for any <tmpl_include>'s
-            if ($this->_debug) $this->doDebugWarnings(file($tmplfile), $tmplfile);
+			// now we must parse the $data and check for any <tmpl_include>'s
+			if ($this->_debug) $this->doDebugWarnings(file($tmplfile), $tmplfile);
 
-            if ($do_eval) {
-                $success = @eval('?>'.$data.'<?php return 1;');
-                $this->_includedepth--;
-                array_pop($this->_currentincludedir);
-                return $success;
-            }
-            else {
-                return $data;
-            }
+			if ($do_eval) {
+				$success = @eval('?>'.$data.'<?php return 1;');
+				$this->_includedepth--;
+				array_pop($this->_currentincludedir);
+				return $success;
+			}
+			else {
+				return $data;
+			}
 
-        }
+		}
 
-        /**
-         * FUNCTION: _fileSearch
-         *
-         * Searches for all possible instances of file { $file }
-         *
-         * @param string $file path of file we're looking for
-         * @access private
-         * @return mixed fullpath to file or boolean false
-         */
-        function _fileSearch ($file) {
-            $filename = basename($file);
-            $filepath = dirname($file);
 
-            // check fullpath first..
-            $fullpath = $filepath.'/'.$filename;
-            if (is_file($fullpath)) {
+		/**
+		 * FUNCTION: _fileSearch
+		 *
+		 * Searches for all possible instances of file { $file }
+		 *
+		 * @param string $file path of file we're looking for
+		 * @access private
+		 * @return mixed fullpath to file or boolean false
+		 */
+		function _fileSearch ($file) {
+			$filename = basename($file);
+			$filepath = dirname($file);
+
+			// check fullpath first..
+			$fullpath = $filepath.'/'.$filename;
+			if (is_file($fullpath)) {
 				return $fullpath;
 			}
 
-            // ..then check for relative path for current directory..
-            if (!empty($this->_currentincludedir)) {
-                $currdir = $this->_currentincludedir[(count($this->_currentincludedir) -1)];
-                $relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
-                if (is_file($relativepath)) {
-                    array_push ($this->_currentincludedir, dirname($relativepath));
-                    return $relativepath;
-                }
-            }
+			// ..then check for relative path for current directory..
+			if (!empty($this->_currentincludedir)) {
+				$currdir = $this->_currentincludedir[(count($this->_currentincludedir) -1)];
+				$relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
+				if (is_file($relativepath)) {
+					array_push($this->_currentincludedir, dirname($relativepath));
+					return $relativepath;
+				}
+			}
 
-            // ..then check for relative path for all additional given paths..
-            if (!empty($this->OPTIONS['INCLUDE_PATHS'])) {
-                foreach ($this->OPTIONS['INCLUDE_PATHS'] as $currdir) {
-                    $relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
-                    if (is_file($relativepath)) {
-                        return $relativepath;
-                    }
-                }
-            }
+			// ..then check for relative path for all additional given paths..
+			if (!empty($this->OPTIONS['INCLUDE_PATHS'])) {
+				foreach ($this->OPTIONS['INCLUDE_PATHS'] as $currdir) {
+					$relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
+					if (is_file($relativepath)) {
+						return $relativepath;
+					}
+				}
+			}
 
-            // ..then check path from TEMPLATE_DIR..
-            if (!empty($this->OPTIONS['TEMPLATE_DIR'])) {
-                $fullpath = realpath($this->OPTIONS['TEMPLATE_DIR'].'/'.$filepath.'/'.$filename);
-                if (is_file($fullpath)) {
+			// ..then check path from TEMPLATE_DIR..
+			if (!empty($this->OPTIONS['TEMPLATE_DIR'])) {
+				$fullpath = realpath($this->OPTIONS['TEMPLATE_DIR'].'/'.$filepath.'/'.$filename);
+				if (is_file($fullpath)) {
 					return $fullpath;
 				}
-            }
+			}
 
-            // ..then check relative path from executing php script..
-            $fullpath = realpath($filepath.'/'.$filename);
-            if (is_file($fullpath)) {
+			// ..then check relative path from executing php script..
+			$fullpath = realpath($filepath.'/'.$filename);
+			if (is_file($fullpath)) {
 				return $fullpath;
 			}
 
-            // ..then check path from template file.
-            if (!empty($this->VLIBTEMPLATE_ROOT)) {
-                $fullpath = realpath($this->VLIBTEMPLATE_ROOT.'/'.$filepath.'/'.$filename);
-                if (is_file($fullpath)) {
+			// ..then check path from template file.
+			if (!empty($this->VLIBTEMPLATE_ROOT)) {
+				$fullpath = realpath($this->VLIBTEMPLATE_ROOT.'/'.$filepath.'/'.$filename);
+				if (is_file($fullpath)) {
 					return $fullpath;
 				}
-            }
+			}
 
-            return false; // uh oh, file not found
-        }
-
-        /**
-         * FUNCTION: _arrayBuild
-         *
-         * Modifies the array $arr to add Template variables, __FIRST__, __LAST__ ..etc
-         * if $this->OPTIONS['LOOP_CONTEXT_VARS'] is true.
-         * Used by $this->setloop().
-         *
-         * @param array $arr
-         * @return array new look array
-         * @access private
-         */
-        function _arrayBuild ($arr) {
-            if (is_array($arr) && !empty($arr)) {
-                $arr = array_values($arr); // to prevent problems w/ non sequential arrays
-                for ($i = 0; $i < count($arr); $i++) {
-                    if(!is_array($arr[$i]))  return false;
-                    foreach ($arr[$i] as $k => $v) {
-                        unset($arr[$i][$k]);
-                        if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
-                        if (preg_match('/^[0-9]+$/', $k)) $k = '_'.$k;
-
-                        if (is_array($v)) {
-                            if (($arr[$i][$k] = $this->_arrayBuild($v)) == false) return false;
-                        }
-                        else { // reinsert the var
-                            $arr[$i][$k] = $v;
-                        }
-                    }
-                    if ($this->OPTIONS['LOOP_CONTEXT_VARS']) {
-                        if ($i == 0) $arr[$i]['__FIRST__'] = true;
-                        if (($i + 1) == count($arr)) $arr[$i]['__LAST__'] = true;
-                        if ($i != 0 && (($i + 1) < count($arr))) $arr[$i]['__INNER__'] = true;
-                        if (is_int(($i+1) / 2))  $arr[$i]['__EVEN__'] = true;
-                        if (!is_int(($i+1) / 2))  $arr[$i]['__ODD__'] = true;
-                        $arr[$i]['__ROWNUM__'] = ($i + 1);
-                    }
-                }
-                return $arr;
-            }
-            elseif (empty($arr)) {
-                return true;
-            }
-        }
-
-        /**
-         * FUNCTION: _parseIf
-         * returns a string used for parsing in tmpl_if statements.
-         *
-         * @param string $varname
-         * @param string $value
-         * @param string $op
-         * @param string $namespace current namespace
-         * @access private
-         * @return string used for eval'ing
-         */
-        function _parseIf ($varname, $value=null, $op=null, $namespace=null) {
-            if (isset($namespace)) $namespace = substr($namespace, 0, -1);
-            $comp_str = ''; // used for extended if statements
-
-            // work out what to put on the end id value="whatever" is used
-            if (isset($value)) {
-
-                // add the correct operator depending on whether it's been specified or not
-                if (!empty($op)) {
-                    if (in_array($op, $this->allowed_if_ops)) {
-                        $comp_str .= $op;
-                    }
-                    else {
-                        vlibTemplateError::raiseError('VT_WARNING_INVALID_IF_OP', WARNING, $op);
-                    }
-                }
-                else {
-                    $comp_str .= '==';
-                }
-
-                // now we add the value, if it's numeric, then we leave the quotes off
-                if (is_numeric($value)) {
-                    $comp_str .= $value;
-                }
-                else {
-                    $comp_str .= '\''.$value.'\'';
-                }
-            }
-
-            if (count($this->_namespace) == 0 || $namespace == 'global') return '$this->_vars[\''.$varname.'\']'.$comp_str;
-            $retstr = '$this->_arrvars';
-            $numnamespaces = count($this->_namespace);
-            for ($i=0; $i < $numnamespaces; $i++) {
-                if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
-                    $retstr .= "['".$namespace."'][\$_".$i."]";
-                    break 1;
-                }
-                else {
-                    $retstr .= "['".$this->_namespace[$i]."'][\$_".$i."]";
-                }
-            }
-            if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
-                return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
-            }
-            else {
-                return $retstr."['".$varname."']".$comp_str;
-            }
-        }
+			return false; // uh oh, file not found
+		}
 
 
-        /**
-         * FUNCTION: _parseLoop
-         * returns a string used for parsing in tmpl_loop statements.
-         *
-         * @param string $varname
-         * @access private
-         * @return string used for eval'ing
-         */
-        function _parseLoop ($varname) {
-            array_push($this->_namespace, $varname);
-            $tempvar = count($this->_namespace) - 1;
-            $retstr = "for (\$_".$tempvar."=0 ; \$_".$tempvar." < count(\$this->_arrvars";
-            for ($i=0; $i < count($this->_namespace); $i++) {
-                $retstr .= "['".$this->_namespace[$i]."']";
-                if ($this->_namespace[$i] != $varname) $retstr .= "[\$_".$i."]";
-            }
-            return $retstr."); \$_".$tempvar."++) {";
-        }
+		/**
+		 * FUNCTION: _arrayBuild
+		 *
+		 * Modifies the array $arr to add Template variables, __FIRST__, __LAST__ ..etc
+		 * if $this->OPTIONS['LOOP_CONTEXT_VARS'] is true.
+		 * Used by $this->setloop().
+		 *
+		 * @param array $arr
+		 * @return array new look array
+		 * @access private
+		 */
+		function _arrayBuild ($arr) {
+			if (is_array($arr) && !empty($arr)) {
+				$arr = array_values($arr); // to prevent problems w/ non sequential arrays
+				for ($i = 0; $i < count($arr); $i++) {
+					if(!is_array($arr[$i]))  return false;
+					foreach ($arr[$i] as $k => $v) {
+						unset($arr[$i][$k]);
+						if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
+						if (preg_match('/^[0-9]+$/', $k)) $k = '_'.$k;
 
-        /**
-         * FUNCTION: _parseVar
-         *
-         * returns a string used for parsing in tmpl_var statements.
-         *
-         * @param string $wholetag
-         * @param string $tag
-         * @param string $varname
-         * @param string $escape
-         * @param string $format
-         * @param string $namespace
-         * @access private
-         * @return string used for eval'ing
-         */
-        function _parseVar ($wholetag, $tag, $varname, $escape, $format, $namespace) {
-            if (!empty($namespace)) $namespace = substr($namespace, 0, -1);
-            $wholetag = stripslashes($wholetag);
+						if (is_array($v)) {
+							if (($arr[$i][$k] = $this->_arrayBuild($v)) == false) return false;
+						}
+						else { // reinsert the var
+							$arr[$i][$k] = $v;
+						}
+					}
+					if ($this->OPTIONS['LOOP_CONTEXT_VARS']) {
+						if ($i == 0) $arr[$i]['__FIRST__'] = true;
+						if (($i + 1) == count($arr)) $arr[$i]['__LAST__'] = true;
+						if ($i != 0 && (($i + 1) < count($arr))) $arr[$i]['__INNER__'] = true;
+						if (is_int(($i+1) / 2))  $arr[$i]['__EVEN__'] = true;
+						if (!is_int(($i+1) / 2))  $arr[$i]['__ODD__'] = true;
+						$arr[$i]['__ROWNUM__'] = ($i + 1);
+					}
+				}
+				return $arr;
+			}
+			elseif (empty($arr)) {
+				return true;
+			}
+		}
 
-            if (count($this->_namespace) == 0 || $namespace == 'global') {
-                $var1 = '$this->_vars[\''.$varname.'\']';
-            }
-            else {
-                $var1build = "\$this->_arrvars";
-                $numnamespaces = count($this->_namespace);
-                for ($i=0; $i < $numnamespaces; $i++) {
-                    if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
-                        $var1build .= "['".$namespace."'][\$_".$i."]";
-                        break 1;
-                    }
-                    else {
-                        $var1build .= "['".$this->_namespace[$i]."'][\$_".$i."]";
-                    }
-                }
-                $var1 = $var1build . "['$varname']";
-                if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
-                    $var2 = '$this->_vars[\''.$varname.'\']';
-                }
-            }
 
-            $beforevar = '';
-            $aftervar  = '';
-            if (!empty($escape)&& isset($this->ESCAPE_TAGS[$escape])) {
-                $beforevar .= $this->ESCAPE_TAGS[$escape]['open'];
-                $aftervar   = $this->ESCAPE_TAGS[$escape]['close'] . $aftervar;
-            }
+		/**
+		 * FUNCTION: _parseIf
+		 * returns a string used for parsing in tmpl_if statements.
+		 *
+		 * @param string $varname
+		 * @param string $value
+		 * @param string $op
+		 * @param string $namespace current namespace
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		function _parseIf ($varname, $value=null, $op=null, $namespace=null) {
+			if (isset($namespace)) $namespace = substr($namespace, 0, -1);
+			$comp_str = ''; // used for extended if statements
 
-            if (!empty($format)&& isset($this->FORMAT_TAGS[$format])) {
-                $beforevar .= $this->FORMAT_TAGS[$format]['open'];
-                $aftervar   = $this->FORMAT_TAGS[$format]['close'] . $aftervar;
-            }
+			// work out what to put on the end id value="whatever" is used
+			if (isset($value)) {
 
-            // build return values
-            $retstr  = 'if ('.$var1.' !== null) { ';
-            $retstr .= 'print('.$beforevar.$var1.$aftervar.'); ';
-            $retstr .= '}';
+				// add the correct operator depending on whether it's been specified or not
+				if (!empty($op)) {
+					if (in_array($op, $this->allowed_if_ops)) {
+						$comp_str .= $op;
+					}
+					else {
+						vlibTemplateError::raiseError('VT_WARNING_INVALID_IF_OP', WARNING, $op);
+					}
+				}
+				else {
+					$comp_str .= '==';
+				}
 
-            if (@$var2) {
-                $retstr .= ' elseif ('.$var2.' !== null) { ';
-                $retstr .= 'print('.$beforevar.$var2.$aftervar.'); ';
-                $retstr .= '}';
-            }
+				// now we add the value, if it's numeric, then we leave the quotes off
+				if (is_numeric($value)) {
+					$comp_str .= $value;
+				}
+				else {
+					$comp_str .= '\''.$value.'\'';
+				}
+			}
 
-            switch (strtolower($this->OPTIONS['UNKNOWNS'])) {
-                case 'comment':
-                    $comment = addcslashes('<!-- unknown variable '.preg_replace('/<!--|-->/', '', $wholetag).'//-->', '"');
-                    $retstr .= ' else { print("'.$comment.'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
-                break;
-                case 'leave':
-                    $retstr .= ' else { print("'.addcslashes($wholetag, '"').'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
-                break;
-                case 'print':
-                    $retstr .= ' else { print("'.htmlspecialchars($wholetag, ENT_QUOTES).'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
-                break;
+			if (count($this->_namespace) == 0 || $namespace == 'global') return '$this->_vars[\''.$varname.'\']'.$comp_str;
+			$retstr = '$this->_arrvars';
+			$numnamespaces = count($this->_namespace);
+			for ($i=0; $i < $numnamespaces; $i++) {
+				if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
+					$retstr .= "['".$namespace."'][\$_".$i."]";
+					break 1;
+				}
+				else {
+					$retstr .= "['".$this->_namespace[$i]."'][\$_".$i."]";
+				}
+			}
+			if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
+				return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
+			}
+			else {
+				return $retstr."['".$varname."']".$comp_str;
+			}
+		}
 
-                case 'ignore':
-                    return $retstr;
-                break;
-                case 'remove':
-                default:
-                    $retstr .= ' else { $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
-                break;
-            }
-        }
 
-        /**
-         * FUNCTION: _parseTag
-         * takes values from preg_replace in $this->_intparse() and determines
-         * the replace string.
-         *
-         * @param array $args array of all matches found by preg_replace
-         * @access private
-         * @return string replace values
-         */
-        function _parseTag ($args) {
-            $wholetag = $args[0];
-            $openclose = $args[1];
-            $tag = strtolower($args[2]);
-            $newline = $args[9];
+		/**
+		 * FUNCTION: _parseLoop
+		 * returns a string used for parsing in tmpl_loop statements.
+		 *
+		 * @param string $varname
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		function _parseLoop ($varname) {
+			array_push($this->_namespace, $varname);
+			$tempvar = count($this->_namespace) - 1;
+			$retstr = "for (\$_".$tempvar."=0 ; \$_".$tempvar." < count(\$this->_arrvars";
+			for ($i=0; $i < count($this->_namespace); $i++) {
+				$retstr .= "['".$this->_namespace[$i]."']";
+				if ($this->_namespace[$i] != $varname) $retstr .= "[\$_".$i."]";
+			}
+			return $retstr."); \$_".$tempvar."++) {";
+		}
+
+
+		/**
+		 * FUNCTION: _parseVar
+		 *
+		 * returns a string used for parsing in tmpl_var statements.
+		 *
+		 * @param string $wholetag
+		 * @param string $tag
+		 * @param string $varname
+		 * @param string $escape
+		 * @param string $format
+		 * @param string $namespace
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		function _parseVar ($wholetag, $tag, $varname, $escape, $format, $namespace) {
+			if (!empty($namespace)) $namespace = substr($namespace, 0, -1);
+			$wholetag = stripslashes($wholetag);
+
+			if (count($this->_namespace) == 0 || $namespace == 'global') {
+				$var1 = '$this->_vars[\''.$varname.'\']';
+			}
+			else {
+				$var1build = "\$this->_arrvars";
+				$numnamespaces = count($this->_namespace);
+				for ($i=0; $i < $numnamespaces; $i++) {
+					if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
+						$var1build .= "['".$namespace."'][\$_".$i."]";
+						break 1;
+					}
+					else {
+						$var1build .= "['".$this->_namespace[$i]."'][\$_".$i."]";
+					}
+				}
+				$var1 = $var1build . "['$varname']";
+				if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
+					$var2 = '$this->_vars[\''.$varname.'\']';
+				}
+			}
+
+			$beforevar = '';
+			$aftervar  = '';
+			if (!empty($escape)&& isset($this->ESCAPE_TAGS[$escape])) {
+				$beforevar .= $this->ESCAPE_TAGS[$escape]['open'];
+				$aftervar   = $this->ESCAPE_TAGS[$escape]['close'] . $aftervar;
+			}
+
+			if (!empty($format)&& isset($this->FORMAT_TAGS[$format])) {
+				$beforevar .= $this->FORMAT_TAGS[$format]['open'];
+				$aftervar   = $this->FORMAT_TAGS[$format]['close'] . $aftervar;
+			}
+
+			// build return values
+			$retstr  = 'if ('.$var1.' !== null) { ';
+			$retstr .= 'print('.$beforevar.$var1.$aftervar.'); ';
+			$retstr .= '}';
+
+			if (@$var2) {
+				$retstr .= ' elseif ('.$var2.' !== null) { ';
+				$retstr .= 'print('.$beforevar.$var2.$aftervar.'); ';
+				$retstr .= '}';
+			}
+
+			switch (strtolower($this->OPTIONS['UNKNOWNS'])) {
+			case 'comment':
+				$comment = addcslashes('<!-- unknown variable '.preg_replace('/<!--|-->/', '', $wholetag).'//-->', '"');
+				$retstr .= ' else { print("'.$comment.'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
+				break;
+			case 'leave':
+				$retstr .= ' else { print("'.addcslashes($wholetag, '"').'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
+				break;
+			case 'print':
+				$retstr .= ' else { print("'.htmlspecialchars($wholetag, ENT_QUOTES).'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
+				break;
+
+			case 'ignore':
+				return $retstr;
+				break;
+			case 'remove':
+			default:
+				$retstr .= ' else { $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
+				break;
+			}
+		}
+
+
+		/**
+		 * FUNCTION: _parseTag
+		 * takes values from preg_replace in $this->_intparse() and determines
+		 * the replace string.
+		 *
+		 * @param array $args array of all matches found by preg_replace
+		 * @access private
+		 * @return string replace values
+		 */
+		function _parseTag ($args) {
+			$wholetag = $args[0];
+			$openclose = $args[1];
+			$tag = strtolower($args[2]);
+			$newline = $args[9];
 			//echo "1#$newline#2";
 
-            if ($tag == 'else') return '<?php } else { ?>'.$newline;
-            if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags
+			if ($tag == 'else') return '<?php } else { ?>'.$newline;
+			if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags
 
-            if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) {
-                if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
-                if ($tag == 'comment' || $tag == 'endcomment') {
-                    return '<?php */ ?>'.$newline;
-                }
-                else {
-                    return '<?php } ?>'.$newline;
-                }
-            }
+			if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) {
+				if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
+				if ($tag == 'comment' || $tag == 'endcomment') {
+					return '<?php */ ?>'.$newline;
+				}
+				else {
+					return '<?php } ?>'.$newline;
+				}
+			}
 
-            // arrange attributes
-            for ($i=3; $i < 8; $i=($i+2)) {
-                if (empty($args[$i]) && empty($args[($i+1)])) break;
-                $key = (empty($args[$i])) ? 'name' : strtolower($args[$i]);
-                if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file';
-                $$key = $args[($i+1)];
-            }
+			// arrange attributes
+			for ($i=3; $i < 8; $i=($i+2)) {
+				if (empty($args[$i]) && empty($args[($i+1)])) break;
+				$key = (empty($args[$i])) ? 'name' : strtolower($args[$i]);
+				if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file';
+				$$key = $args[($i+1)];
+			}
 
-            $var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
+			$var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
 
-            if ($this->_debug && !empty($var)) {
-                if (preg_match("/^global\.([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) $var2 = $matches[1];
-                if (empty($this->_debugTemplatevars[$tag])) $this->_debugTemplatevars[$tag] = array();
-                if (!isset($var2)) $var2 = $var;
-                if (!in_array($var2, $this->_debugTemplatevars[$tag])) array_push($this->_debugTemplatevars[$tag], $var2);
-            }
+			if ($this->_debug && !empty($var)) {
+				if (preg_match("/^global\.([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) $var2 = $matches[1];
+				if (empty($this->_debugTemplatevars[$tag])) $this->_debugTemplatevars[$tag] = array();
+				if (!isset($var2)) $var2 = $var;
+				if (!in_array($var2, $this->_debugTemplatevars[$tag])) array_push($this->_debugTemplatevars[$tag], $var2);
+			}
 
-            if (preg_match("/^([A-Za-z_]+[_A-Za-z0-9]*(\.)+)?([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) {
-                $var = $matches[3];
-                $namespace = $matches[1];
-            }
+			if (preg_match("/^([A-Za-z_]+[_A-Za-z0-9]*(\.)+)?([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) {
+				$var = $matches[3];
+				$namespace = $matches[1];
+			}
 
 
-            // return correct string (tag dependent)
-            switch ($tag) {
-                case 'var':
-                    if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
-                        $escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
-                    }
-                    return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace).' ?>'.$newline."\n";
-                break;
+			// return correct string (tag dependent)
+			switch ($tag) {
+			case 'var':
+				if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
+					$escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
+				}
+				return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace).' ?>'.$newline."\n";
+				break;
 
-                case 'if':
-                    return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
-                break;
+			case 'if':
+				return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+				break;
 
-                case 'unless':
-                      return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
-                break;
+			case 'unless':
+				return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+				break;
 
-                case 'elseif':
-                      return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
-                break;
+			case 'elseif':
+				return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+				break;
 
-                case 'loop':
-                      return '<?php '. $this->_parseLoop($var) .'?>'.$newline;
-                break;
+			case 'loop':
+				return '<?php '. $this->_parseLoop($var) .'?>'.$newline;
+				break;
 
-                case 'comment':
-                    if (empty($var)) { // full open/close style comment
-                        return '<?php /* ?>'.$newline;
-                    }
-                    else { // just ignore tag if it was a one line comment
-                        return;
-                    }
-                break;
+			case 'comment':
+				if (empty($var)) { // full open/close style comment
+					return '<?php /* ?>'.$newline;
+				}
+				else { // just ignore tag if it was a one line comment
+					return;
+				}
+				break;
 
-                case 'phpinclude':
-                	if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
-                    	return '<?php include(\''.$file.'\'); ?>'.$newline;
-                    }
-                break;
+			case 'phpinclude':
+				if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
+					return '<?php include(\''.$file.'\'); ?>'.$newline;
+				}
+				break;
 
-                case 'include':
-                    return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
-                break;
-                
-                case 'dyninclude':
-                    return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
-                break;
+			case 'include':
+				return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
+				break;
 
-                default:
-                    if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));
-                break;
-            }
+			case 'dyninclude':
+				return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
+				break;
 
-        }
+			default:
+				if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));
+				break;
+			}
 
-        /**
-         * FUNCTION: _intParse
-         *
-         * Parses $this->_tmplfile into correct format for eval() to work
-         * Called by $this->_parse(), or $this->fastPrint, this replaces all <tmpl_*> references
-         * with their correct php representation, i.e. <tmpl_var title> becomes $this->vars['title']
-         * Sets final parsed file to $this->_tmplfilep.
-         *
-         * @access private
-         * @return boolean true/false
-         */
-        function _intParse () {
-            //$mqrt = get_magic_quotes_runtime();
-            //set_magic_quotes_runtime(0);
-            $this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
-            //set_magic_quotes_runtime($mqrt);
-            return true;
-        }
+		}
 
-        /**
-         * FUNCTION: _parse
-         *
-         * Calls _intParse, and eval()s $this->tmplfilep
-         * and outputs the results to $this->tmploutput
-         *
-         * @param bool compress whether to compress contents
-         * @access private
-         * @return boolean true/false
-         */
-        function _parse ($compress='') {
-            if (!$this->_parsed) {
-                if ($this->OPTIONS['TIME_PARSE']) $this->_firstparsetime = $this->_getMicroTime();
 
-                $this->_intParse();
-                $this->_parsed = true;
+		/**
+		 * FUNCTION: _intParse
+		 *
+		 * Parses $this->_tmplfile into correct format for eval() to work
+		 * Called by $this->_parse(), or $this->fastPrint, this replaces all <tmpl_*> references
+		 * with their correct php representation, i.e. <tmpl_var title> becomes $this->vars['title']
+		 * Sets final parsed file to $this->_tmplfilep.
+		 *
+		 * @access private
+		 * @return boolean true/false
+		 */
+		function _intParse () {
+			//$mqrt = get_magic_quotes_runtime();
+			//set_magic_quotes_runtime(0);
+			$this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
+			//set_magic_quotes_runtime($mqrt);
+			return true;
+		}
 
-                if ($this->OPTIONS['TIME_PARSE']) $this->_totalparsetime = ($this->_getMicroTime() - $this->_firstparsetime);
-                if ($this->OPTIONS['TIME_PARSE'] && $this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setVar('__PARSE_TIME__', $this->getParseTime());
-            }
-			
+
+		/**
+		 * FUNCTION: _parse
+		 *
+		 * Calls _intParse, and eval()s $this->tmplfilep
+		 * and outputs the results to $this->tmploutput
+		 *
+		 * @param bool compress whether to compress contents
+		 * @access private
+		 * @return boolean true/false
+		 */
+		function _parse ($compress='') {
+			if (!$this->_parsed) {
+				if ($this->OPTIONS['TIME_PARSE']) $this->_firstparsetime = $this->_getMicroTime();
+
+				$this->_intParse();
+				$this->_parsed = true;
+
+				if ($this->OPTIONS['TIME_PARSE']) $this->_totalparsetime = ($this->_getMicroTime() - $this->_firstparsetime);
+				if ($this->OPTIONS['TIME_PARSE'] && $this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setVar('__PARSE_TIME__', $this->getParseTime());
+			}
+
 			// ob_start($compress);
-            ob_start();
+			ob_start();
 
-                array_push($this->_currentincludedir, dirname($this->_tmplfilename));
-                $this->_includedepth++;
-                $success = @eval($this->_tmplfilep);
-                $this->_includedepth--;
-                array_pop($this->_currentincludedir);
+			array_push($this->_currentincludedir, dirname($this->_tmplfilename));
+			$this->_includedepth++;
+			$success = @eval($this->_tmplfilep);
+			$this->_includedepth--;
+			array_pop($this->_currentincludedir);
 
-                if ($this->_debug) $this->doDebug();
-                if (!$success) vlibTemplateError::raiseError('VT_ERROR_PARSE', FATAL);
-                $this->_tmploutput .= ob_get_contents();
-            ob_end_clean();
-			
-			
-			
-            return true;
-        }
+			if ($this->_debug) $this->doDebug();
+			if (!$success) vlibTemplateError::raiseError('VT_ERROR_PARSE', FATAL);
+			$this->_tmploutput .= ob_get_contents();
+			ob_end_clean();
 
-        /**
-         * FUNCTION: _setOption
-         *
-         * Sets one or more of the boolean options 1/0, that control certain actions in the template.
-         * Use of this function:
-         * either: vlibTemplate::_setOptions(string option_name, bool option_val [, string option_name, bool option_val ..]);
-         * or      vlibTemplate::_setOptions(array);
-         *          with an associative array where the key is the option_name
-         *          and the value is the option_value.
-         *
-         * @param mixed (mulitple)
-         * @return bool true/false
-         * @access private
-         */
-        function _setOption () {
-            $numargs = func_num_args();
-            if ($numargs < 1) {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                return false;
-            }
 
-            if ($numargs == 1) {
-                $options = func_get_arg(1);
-                if (is_array($options)) {
-                    foreach ($options as $k => $v) {
-                        if ($v != null) {
-                            if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
-                        }
-                        else {
-                            continue;
-                        }
-                    }
-                }
-                else {
-                    vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                    return false;
-                }
-            }
-            elseif (is_int($numargs / 2)) {
-                for ($i = 0; $i < $numargs; $i=($i+2)) {
-                    $k  = func_get_arg($i);
-                    $v = func_get_arg(($i+1));
-                    if ($v != null) {
-                        if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
-                    }
-                }
-            }
-            else {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                return false;
-            }
-            return true;
-        }
 
-        /**
-         * FUNCTION: _setUnknown
-         *
-         * Used during parsing, this function sets an unknown var checking to see if it
-         * has been previously set.
-         *
-         * @param string var
-         * @access private
-         */
-        function _setUnknown ($var) {
-            if (!in_array($var, $this->_unknowns)) array_push($this->_unknowns, $var);
-        }
+			return true;
+		}
 
-        /**
-         * FUNCTION: _getMicrotime
-         * Returns microtime as a float number
-         *
-         * @return float microtime
-         * @access private
-         */
-        function _getMicrotime () {
-            list($msec, $sec) = explode(" ",microtime());
-            return ((float)$msec + (float)$sec);
-        }
 
-        /**
-         * FUNCTION: _escape_hex
-         * Returns str encoded to hex code.
-         *
-         * @param string str to be encoded
-         * @param bool true/false specify whether to use hex_entity
-         * @return string encoded in hex
-         * @access private
-         */
-        function _escape_hex($str="", $entity=false) {
-            $prestr = $entity ? '&#x' : '%';
-            $poststr= $entity ? ';' : '';
-            for ($i=0; $i < strlen($str); $i++) {
-                $return .= $prestr.bin2hex($str[$i]).$poststr;
-            }
-            return $return;
-        }
+		/**
+		 * FUNCTION: _setOption
+		 *
+		 * Sets one or more of the boolean options 1/0, that control certain actions in the template.
+		 * Use of this function:
+		 * either: vlibTemplate::_setOptions(string option_name, bool option_val [, string option_name, bool option_val ..]);
+		 * or      vlibTemplate::_setOptions(array);
+		 *          with an associative array where the key is the option_name
+		 *          and the value is the option_value.
+		 *
+		 * @param mixed (mulitple)
+		 * @return bool true/false
+		 * @access private
+		 */
+		function _setOption () {
+			$numargs = func_num_args();
+			if ($numargs < 1) {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+				return false;
+			}
 
-    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+			if ($numargs == 1) {
+				$options = func_get_arg(1);
+				if (is_array($options)) {
+					foreach ($options as $k => $v) {
+						if ($v != null) {
+							if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
+						}
+						else {
+							continue;
+						}
+					}
+				}
+				else {
+					vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+					return false;
+				}
+			}
+			elseif (is_int($numargs / 2)) {
+				for ($i = 0; $i < $numargs; $i=($i+2)) {
+					$k  = func_get_arg($i);
+					$v = func_get_arg(($i+1));
+					if ($v != null) {
+						if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
+					}
+				}
+			}
+			else {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+				return false;
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: _setUnknown
+		 *
+		 * Used during parsing, this function sets an unknown var checking to see if it
+		 * has been previously set.
+		 *
+		 * @param string var
+		 * @access private
+		 */
+		function _setUnknown ($var) {
+			if (!in_array($var, $this->_unknowns)) array_push($this->_unknowns, $var);
+		}
+
+
+		/**
+		 * FUNCTION: _getMicrotime
+		 * Returns microtime as a float number
+		 *
+		 * @return float microtime
+		 * @access private
+		 */
+		function _getMicrotime () {
+			list($msec, $sec) = explode(" ", microtime());
+			return (float)$msec + (float)$sec;
+		}
+
+
+		/**
+		 * FUNCTION: _escape_hex
+		 * Returns str encoded to hex code.
+		 *
+		 * @param string str to be encoded
+		 * @param bool true/false specify whether to use hex_entity
+		 * @return string encoded in hex
+		 * @access private
+		 */
+		function _escape_hex($str="", $entity=false) {
+			$prestr = $entity ? '&#x' : '%';
+			$poststr= $entity ? ';' : '';
+			for ($i=0; $i < strlen($str); $i++) {
+				$return .= $prestr.bin2hex($str[$i]).$poststr;
+			}
+			return $return;
+		}
+
+		/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     The following functions have no use and are included just so that if the user
     is making use of vlibTemplateCache functions, this doesn't crash when changed to
     vlibTemplate if the user is quickly bypassing the vlibTemplateCache class.
     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-        function clearCache()        {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'clearCache()');}
-        function recache()           {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'recache()');}
-        function setCacheLifeTime()  {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheLifeTime()');}
-        function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');}
-    }
+		function clearCache()        {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'clearCache()');}
 
-    //include_once ($conf['classpath'].'/vlibTemplate/debug.php');
-    include_once ($conf['classpath'].'/tpl_cache.inc.php');
+		function recache()           {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'recache()');}
+
+		function setCacheLifeTime()  {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheLifeTime()');}
+
+		function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');}
+
+	}
+
+	//include_once ($conf['classpath'].'/vlibTemplate/debug.php');
+	include_once $conf['classpath'].'/tpl_cache.inc.php';
 
 } // << end if(!defined())..
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/tpl_cache.inc.php b/server/lib/classes/tpl_cache.inc.php
index a399946..4bf75fa 100644
--- a/server/lib/classes/tpl_cache.inc.php
+++ b/server/lib/classes/tpl_cache.inc.php
@@ -20,167 +20,174 @@
  * @access public
  */
 
+
 class tplc extends tpl {
 
-/*-----------------------------------------------------------------------------\
+	/*-----------------------------------------------------------------------------\
 |     DO NOT TOUCH ANYTHING IN THIS CLASS, IT MAY NOT WORK OTHERWISE           |
 \-----------------------------------------------------------------------------*/
 
-    var $_cache = 1;     // tells vlibTemplate that we're caching
-    var $_cachefile;     // full path to current cache file (even if it doesn't yet exist)
-    var $_cacheexists;   // has this file been cached before
-    var $_cachefilelocked; // is this file currently locked whilst writing
-    var $_cachefiledir;  // dir of current cache file
-    var $_clearcache = 0;
+	var $_cache = 1;     // tells vlibTemplate that we're caching
+	var $_cachefile;     // full path to current cache file (even if it doesn't yet exist)
+	var $_cacheexists;   // has this file been cached before
+	var $_cachefilelocked; // is this file currently locked whilst writing
+	var $_cachefiledir;  // dir of current cache file
+	var $_clearcache = 0;
 
 
-    /**
-     * FUNCTION: clearCache
-     * will unset a file, and set $this->_cacheexists to 0.
-     *
-     * @access public
-     * @return boolean
-     */
-    function clearCache() {
-        $this->_clearcache = 1;
-        return true;
-    }
-
-    /**
-     * FUNCTION: recache
-     * alias for clearCache().
-     *
-     * @access public
-     * @return boolean
-     */
-    function recache() {
-        return $this->clearCache();
-    }
-
-    /**
-     * FUNCTION: setCacheLifeTime
-     * sets the lifetime of the cached file
-     *
-     * @param int $int number of seconds to set lifetime to
-     * @access public
-     * @return boolean
-     */
-    function setCacheLifeTime($int = null) {
-        if ($int == null || !is_int($int)) return false;
-        if ($int == 0) $int = 60;
-        if ($int == -1) $int = 157680000; // set to 5 yrs time
-        $this->OPTIONS['CACHE_LIFETIME'] = $int;
-        return true;
-    }
-
-    /**
-     * FUNCTION: setCacheExtension
-     * sets the extention of the cache file
-     *
-     * @param str $str name of new cache extention
-     * @access public
-     * @return boolean
-     */
-    function setCacheExtension($str = null) {
-        if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
-        $this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
-        return true;
-    }
+	/**
+	 * FUNCTION: clearCache
+	 * will unset a file, and set $this->_cacheexists to 0.
+	 *
+	 * @access public
+	 * @return boolean
+	 */
+	function clearCache() {
+		$this->_clearcache = 1;
+		return true;
+	}
 
 
-/*----------------------------------------\
+	/**
+	 * FUNCTION: recache
+	 * alias for clearCache().
+	 *
+	 * @access public
+	 * @return boolean
+	 */
+	function recache() {
+		return $this->clearCache();
+	}
+
+
+	/**
+	 * FUNCTION: setCacheLifeTime
+	 * sets the lifetime of the cached file
+	 *
+	 * @param int $int number of seconds to set lifetime to
+	 * @access public
+	 * @return boolean
+	 */
+	function setCacheLifeTime($int = null) {
+		if ($int == null || !is_int($int)) return false;
+		if ($int == 0) $int = 60;
+		if ($int == -1) $int = 157680000; // set to 5 yrs time
+		$this->OPTIONS['CACHE_LIFETIME'] = $int;
+		return true;
+	}
+
+
+	/**
+	 * FUNCTION: setCacheExtension
+	 * sets the extention of the cache file
+	 *
+	 * @param str $str name of new cache extention
+	 * @access public
+	 * @return boolean
+	 */
+	function setCacheExtension($str = null) {
+		if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
+		$this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
+		return true;
+	}
+
+
+	/*----------------------------------------\
           Private Functions
 -----------------------------------------*/
 
-    /**
-     * FUNCTION: _checkCache
-     * checks if there's a cache, if there is then it will read the cache file as the template.
-     */
-    function _checkCache ($tmplfile) {
-        $this->_cachefile = $this->_getFilename($tmplfile);
-        if ($this->_clearcache) {
-            if (file_exists($this->_cachefile)) unlink($this->_cachefile);
-            return false;
-        }
 
-        if (file_exists($this->_cachefile)) {
-            $this->_cacheexists = 1;
+	/**
+	 * FUNCTION: _checkCache
+	 * checks if there's a cache, if there is then it will read the cache file as the template.
+	 */
+	function _checkCache ($tmplfile) {
+		$this->_cachefile = $this->_getFilename($tmplfile);
+		if ($this->_clearcache) {
+			if (file_exists($this->_cachefile)) unlink($this->_cachefile);
+			return false;
+		}
 
-            // if it's expired
-            if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date ('U')
-                  || filectime($this->_cachefile) < filemtime($tmplfile)) {
-                $this->_cacheexists = 0;
-                return false; // so that we know to recache
-            }
-            else {
-                return true;
-            }
+		if (file_exists($this->_cachefile)) {
+			$this->_cacheexists = 1;
 
-        } else {
-            $this->_cacheexists = 0;
-            return false;
-        }
-    }
+			// if it's expired
+			if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date('U')
+				|| filectime($this->_cachefile) < filemtime($tmplfile)) {
+				$this->_cacheexists = 0;
+				return false; // so that we know to recache
+			}
+			else {
+				return true;
+			}
+
+		} else {
+			$this->_cacheexists = 0;
+			return false;
+		}
+	}
 
 
-    /**
-     * FUNCTION: _getFilename
-     * gets the full pathname for the cached file
-     *
-     */
-    function _getFilename($tmplfile) {
-        return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
-    }
+	/**
+	 * FUNCTION: _getFilename
+	 * gets the full pathname for the cached file
+	 *
+	 */
+	function _getFilename($tmplfile) {
+		return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
+	}
 
-    /**
-     * FUNCTION: _createCache
-     * creates the cached file
-     *
-     */
-    function _createCache($data) {
-        $cache_file = $this->_cachefile;
-        if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
 
-        $f = fopen ($cache_file, "w");
-        flock($f, 2); // set an EXclusive lock
-        if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE',KILL,$cache_file);
-        fputs ($f, $data); // write the parsed string from vlibTemplate
-        flock($f, 3); // UNlock file
-        fclose ($f);
-        touch ($cache_file);
-        return true;
-    }
+	/**
+	 * FUNCTION: _createCache
+	 * creates the cached file
+	 *
+	 */
+	function _createCache($data) {
+		$cache_file = $this->_cachefile;
+		if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
 
-    /**
-     * FUNCTION: _prepareDirs
-     * prepares the directory structure
-     *
-     */
-    function _prepareDirs($file) {
-        if (empty($file)) die('no filename'); //do error in future
-        $filepath = dirname($file);
-        if (is_dir($filepath)) return true;
+		$f = fopen($cache_file, "w");
+		flock($f, 2); // set an EXclusive lock
+		if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE', KILL, $cache_file);
+		fputs($f, $data); // write the parsed string from vlibTemplate
+		flock($f, 3); // UNlock file
+		fclose($f);
+		touch($cache_file);
+		return true;
+	}
 
-        $dirs = preg_split('/[\\/]/', $filepath);
-        $currpath;
-        foreach ($dirs as $dir) {
-            $currpath .= $dir .'/';
-            $type = @filetype($currpath);
 
-            ($type=='link') and $type = 'dir';
-            if ($type != 'dir' && $type != false && !empty($type)) {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE',KILL,'directory: '.$currpath.', type: '.$type);
-            }
-            if ($type == 'dir') {
-                continue;
-            }
-            else {
-                $s = @mkdir($currpath, 0775);
-                if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE',KILL,'directory: '.$currpath);
-            }
-        }
-        return true;
-    }
+	/**
+	 * FUNCTION: _prepareDirs
+	 * prepares the directory structure
+	 *
+	 */
+	function _prepareDirs($file) {
+		if (empty($file)) die('no filename'); //do error in future
+		$filepath = dirname($file);
+		if (is_dir($filepath)) return true;
+
+		$dirs = preg_split('/[\\/]/', $filepath);
+		$currpath;
+		foreach ($dirs as $dir) {
+			$currpath .= $dir .'/';
+			$type = @filetype($currpath);
+
+			($type=='link') and $type = 'dir';
+			if ($type != 'dir' && $type != false && !empty($type)) {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE', KILL, 'directory: '.$currpath.', type: '.$type);
+			}
+			if ($type == 'dir') {
+				continue;
+			}
+			else {
+				$s = @mkdir($currpath, 0775);
+				if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE', KILL, 'directory: '.$currpath);
+			}
+		}
+		return true;
+	}
 
 } // -- end vlibTemplateCache class
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/tpl_error.inc.php b/server/lib/classes/tpl_error.inc.php
index 171a04f..c2badaa 100644
--- a/server/lib/classes/tpl_error.inc.php
+++ b/server/lib/classes/tpl_error.inc.php
@@ -25,68 +25,71 @@
  * @access private
  */
 
+
 class vlibTemplateError {
 
-/*-----------------------------------------------------------------------------\
+	/*-----------------------------------------------------------------------------\
 |     DO NOT TOUCH ANYTHING IN THIS CLASS IT MAY NOT WORK OTHERWISE            |
 \-----------------------------------------------------------------------------*/
 
-    public static function raiseError ($code, $level = null, $extra=null) {
-        if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
+	public static function raiseError ($code, $level = null, $extra=null) {
+		if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
 
-        $error_codes = array(
-                        'VT_ERROR_NOFILE'               => 'vlibTemplate Error: Template ('.$extra.') file not found.',
-                        'VT_ERROR_PARSE'                => 'vlibTemplate Error: Parse error!<br>To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
-                        'VT_NOTICE_INVALID_TAG'         => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
-                        'VT_ERROR_INVALID_TAG'          => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
-                        'VT_NOTICE_INVALID_ATT'         => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
-                        'VT_WARNING_INVALID_ARR'        => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
-                        'VT_ERROR_INVALID_ERROR_CODE'   => 'vlibTemplate Error: Invalid error raised.',
-                        'VT_ERROR_WRONG_NO_PARAMS'      => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
-                        'VT_ERROR_UNKNOWN_VAR'          => 'vlibTemplate Error: template var not found.',
-                        'VT_ERROR_NO_CACHE_WRITE'       => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
-                        'VT_ERROR_WRONG_CACHE_TYPE'     => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
-                        'VT_ERROR_CACHE_MKDIR_FAILURE'  => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
-                        'VT_WARNING_NOT_CACHE_OBJ'      => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
-                        'VT_WARNING_LOOP_NOT_SET'       => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
-                        'VT_WARNING_INVALID_RESOURCE'   => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
-                        'VT_WARNING_INVALID_LOOP_DB'    => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
-                        'VT_WARNING_INVALID_IF_OP'      => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
-                            );
+		$error_codes = array(
+			'VT_ERROR_NOFILE'               => 'vlibTemplate Error: Template ('.$extra.') file not found.',
+			'VT_ERROR_PARSE'                => 'vlibTemplate Error: Parse error!<br>To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
+			'VT_NOTICE_INVALID_TAG'         => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
+			'VT_ERROR_INVALID_TAG'          => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
+			'VT_NOTICE_INVALID_ATT'         => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
+			'VT_WARNING_INVALID_ARR'        => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
+			'VT_ERROR_INVALID_ERROR_CODE'   => 'vlibTemplate Error: Invalid error raised.',
+			'VT_ERROR_WRONG_NO_PARAMS'      => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
+			'VT_ERROR_UNKNOWN_VAR'          => 'vlibTemplate Error: template var not found.',
+			'VT_ERROR_NO_CACHE_WRITE'       => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
+			'VT_ERROR_WRONG_CACHE_TYPE'     => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
+			'VT_ERROR_CACHE_MKDIR_FAILURE'  => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
+			'VT_WARNING_NOT_CACHE_OBJ'      => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
+			'VT_WARNING_LOOP_NOT_SET'       => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
+			'VT_WARNING_INVALID_RESOURCE'   => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
+			'VT_WARNING_INVALID_LOOP_DB'    => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
+			'VT_WARNING_INVALID_IF_OP'      => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
+		);
 
-        $error_levels = array(
-                        'VT_ERROR_NOFILE'               => FATAL,
-                        'VT_ERROR_PARSE'                => FATAL,
-                        'VT_NOTICE_INVALID_TAG'         => NOTICE,
-                        'VT_ERROR_INVALID_TAG'          => FATAL,
-                        'VT_NOTICE_INVALID_ATT'         => NOTICE,
-                        'VT_WARNING_INVALID_ARR'        => WARNING,
-                        'VT_ERROR_INVALID_ERROR_CODE'   => FATAL,
-                        'VT_ERROR_WRONG_NO_PARAMS'      => WARNING,
-                        'VT_ERROR_UNKNOWN_VAR'          => WARNING,
-                        'VT_ERROR_NO_CACHE_WRITE'       => KILL,
-                        'VT_ERROR_WRONG_CACHE_TYPE'     => KILL,
-                        'VT_ERROR_CACHE_MKDIR_FAILURE'  => KILL,
-                        'VT_WARNING_NOT_CACHE_OBJ'      => WARNING,
-                        'VT_WARNING_LOOP_NOT_SET'       => WARNING,
-                        'VT_WARNING_INVALID_RESOURCE'   => WARNING,
-                        'VT_WARNING_INVALID_LOOP_DB'    => WARNING,
-                        'VT_WARNING_INVALID_IF_OP'      => WARNING
-                            );
+		$error_levels = array(
+			'VT_ERROR_NOFILE'               => FATAL,
+			'VT_ERROR_PARSE'                => FATAL,
+			'VT_NOTICE_INVALID_TAG'         => NOTICE,
+			'VT_ERROR_INVALID_TAG'          => FATAL,
+			'VT_NOTICE_INVALID_ATT'         => NOTICE,
+			'VT_WARNING_INVALID_ARR'        => WARNING,
+			'VT_ERROR_INVALID_ERROR_CODE'   => FATAL,
+			'VT_ERROR_WRONG_NO_PARAMS'      => WARNING,
+			'VT_ERROR_UNKNOWN_VAR'          => WARNING,
+			'VT_ERROR_NO_CACHE_WRITE'       => KILL,
+			'VT_ERROR_WRONG_CACHE_TYPE'     => KILL,
+			'VT_ERROR_CACHE_MKDIR_FAILURE'  => KILL,
+			'VT_WARNING_NOT_CACHE_OBJ'      => WARNING,
+			'VT_WARNING_LOOP_NOT_SET'       => WARNING,
+			'VT_WARNING_INVALID_RESOURCE'   => WARNING,
+			'VT_WARNING_INVALID_LOOP_DB'    => WARNING,
+			'VT_WARNING_INVALID_IF_OP'      => WARNING
+		);
 
-        ($level === null) and $level = $error_levels[$code];
-        if ($level == KILL) {
-            die ($error_codes[$code]);
-        }
+		($level === null) and $level = $error_levels[$code];
+		if ($level == KILL) {
+			die ($error_codes[$code]);
+		}
 
-        if ($msg = $error_codes[$code]) {
-            trigger_error($msg, $level);
-        } else {
-            $level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
-            $msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
-            trigger_error($msg, $level);
-        }
-        return;
-    }
+		if ($msg = $error_codes[$code]) {
+			trigger_error($msg, $level);
+		} else {
+			$level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
+			$msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
+			trigger_error($msg, $level);
+		}
+		return;
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/lib/classes/tpl_ini.inc.php b/server/lib/classes/tpl_ini.inc.php
index 7302daa..792dacb 100644
--- a/server/lib/classes/tpl_ini.inc.php
+++ b/server/lib/classes/tpl_ini.inc.php
@@ -28,91 +28,92 @@
 */
 
 if (!defined('vlibIniClassLoaded')) {
-    define('vlibIniClassLoaded', 1);
+	define('vlibIniClassLoaded', 1);
 
-    /**
-     * vlibIni is a class used to store configuration parameters
-     * for the vLIB library.
-     *
-     * @since 21/07/2002
-     * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
-     * @package vLIB
-     * @access private
-     */
+	/**
+	 * vlibIni is a class used to store configuration parameters
+	 * for the vLIB library.
+	 *
+	 * @since 21/07/2002
+	 * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
+	 * @package vLIB
+	 * @access private
+	 */
 
-    class vlibIni {
 
-        /** config vars for vlibTemplate */
-        public static function vlibTemplate () {
-        	
-        	global $conf;
-			
+	class vlibIni {
+
+		/** config vars for vlibTemplate */
+		public static function vlibTemplate () {
+
+			global $conf;
+
 			$tpl_dir = $conf["rootpath"]."/conf";
 			$include_paths = array($conf["rootpath"].'/conf-custom');
-			
-            return array(
 
-                        'TEMPLATE_DIR' => $tpl_dir,   // Default directory for your template files (full path)
-                                                                   // leave the '/' or '\' off the end of the directory.
-						'INCLUDE_PATHS' => $include_paths, // The include path is always searched first for a template file before the template_dir is checked
-						
-                        'MAX_INCLUDES' => 10,                      // Drill depth for tmpl_include's
+			return array(
 
-                        'GLOBAL_VARS' => 1,                        // if set to 1, any variables not found in a
-                                                                   // loop will search for a global var as well
+				'TEMPLATE_DIR' => $tpl_dir,   // Default directory for your template files (full path)
+				// leave the '/' or '\' off the end of the directory.
+				'INCLUDE_PATHS' => $include_paths, // The include path is always searched first for a template file before the template_dir is checked
 
-                        'GLOBAL_CONTEXT_VARS' => 1,                // if set to 1, vlibTemplate will add global vars
-                                                                   // reflecting the environment.
+				'MAX_INCLUDES' => 10,                      // Drill depth for tmpl_include's
 
-                        'LOOP_CONTEXT_VARS' => 1,                  // if set to 1, vlibTemplate will add loop specific vars
-                                                                   // on each row of the loop.
+				'GLOBAL_VARS' => 1,                        // if set to 1, any variables not found in a
+				// loop will search for a global var as well
 
-                        'SET_LOOP_VAR' => 1,                       // Sets a global variable for each top level loops
+				'GLOBAL_CONTEXT_VARS' => 1,                // if set to 1, vlibTemplate will add global vars
+				// reflecting the environment.
 
-                        'DEFAULT_ESCAPE' => 'none',                // 1 of the following: html, url, sq, dq, none
+				'LOOP_CONTEXT_VARS' => 1,                  // if set to 1, vlibTemplate will add loop specific vars
+				// on each row of the loop.
 
-                        'STRICT' => 0,                             // Dies when encountering an incorrect tmpl_*
-                                                                   // style tags i.e. tmpl_vae
+				'SET_LOOP_VAR' => 1,                       // Sets a global variable for each top level loops
 
-                        'CASELESS' => 0,                           // Removes case sensitivity on all variables
+				'DEFAULT_ESCAPE' => 'none',                // 1 of the following: html, url, sq, dq, none
 
-                        'UNKNOWNS' => 'ignore',                    // How to handle unknown variables.
-                                                                   // 1 of the following: ignore, remove, leave,print, comment
-                                                                   // 1 of the following: ignore, remove, leave, print, comment
+				'STRICT' => 0,                             // Dies when encountering an incorrect tmpl_*
+				// style tags i.e. tmpl_vae
 
-                        'TIME_PARSE' => '0',                       // Will enable you to time how long vlibTemplate takes to parse
-                                                                   // your template. You then use the function: getParseTime().
+				'CASELESS' => 0,                           // Removes case sensitivity on all variables
 
-                        'ENABLE_PHPINCLUDE' => '1',                // Will allow template to include a php file using <TMPL_PHPINCLUDE>
+				'UNKNOWNS' => 'ignore',                    // How to handle unknown variables.
+				// 1 of the following: ignore, remove, leave,print, comment
+				// 1 of the following: ignore, remove, leave, print, comment
+
+				'TIME_PARSE' => '0',                       // Will enable you to time how long vlibTemplate takes to parse
+				// your template. You then use the function: getParseTime().
+
+				'ENABLE_PHPINCLUDE' => '1',                // Will allow template to include a php file using <TMPL_PHPINCLUDE>
 
 
-                        /* the following are only used by the vlibTemplateCache class. */
+				/* the following are only used by the vlibTemplateCache class. */
 
-                        'CACHE_DIRECTORY' => $conf["template"]["cache_dir"],
-                                                                   // Directory where the cached filesystem
-                                                                   // will be set up (full path, and must be writable)
-                                                                   // '/' or '\' off the end of the directory.
+				'CACHE_DIRECTORY' => $conf["template"]["cache_dir"],
+				// Directory where the cached filesystem
+				// will be set up (full path, and must be writable)
+				// '/' or '\' off the end of the directory.
 
-                        'CACHE_LIFETIME' => 604800,                // Duration until file is re-cached in seconds (604800 = 1 week)
+				'CACHE_LIFETIME' => 604800,                // Duration until file is re-cached in seconds (604800 = 1 week)
 
-                        'CACHE_EXTENSION' => 'vtc'                  // extention to be used by the cached file i.e. index.php will become
-                                                                   // index.vtc (vlibTemplate Compiled)
-                    );
+				'CACHE_EXTENSION' => 'vtc'                  // extention to be used by the cached file i.e. index.php will become
+				// index.vtc (vlibTemplate Compiled)
+			);
 
-        } // << end function vlibTemplate
+		} // << end function vlibTemplate
 
 
 
-        /** config vars for vlibDate */
-        public function vlibDate () {
+		/** config vars for vlibDate */
+		public function vlibDate () {
 
-            return array(
-                        'DEFAULT_LANG' => 'de'                     // default language for the date displays
-                    );
+			return array(
+				'DEFAULT_LANG' => 'de'                     // default language for the date displays
+			);
 
-        }// << end function vlibDate
+		}// << end function vlibDate
 
 
-    }// << end class vlibIni
+	}// << end class vlibIni
 }
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/client_module.inc.php b/server/mods-available/client_module.inc.php
index 4aaccf9..7882d74 100644
--- a/server/mods-available/client_module.inc.php
+++ b/server/mods-available/client_module.inc.php
@@ -29,68 +29,68 @@
 */
 
 class client_module {
-	
+
 	var $module_name = 'client_module';
 	var $class_name = 'client_module';
-	var $actions_available = array(	'client_insert',
-									'client_update',
-									'client_delete');
-	
+	var $actions_available = array( 'client_insert',
+		'client_update',
+		'client_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('client',$this->module_name,'process');
-		
+
+		$app->modules->registerTableHook('client', $this->module_name, 'process');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'client':
-				if($action == 'i') $app->plugins->raiseEvent('client_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('client_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('client_delete',$data);
+		case 'client':
+			if($action == 'i') $app->plugins->raiseEvent('client_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('client_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('client_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/cron_module.inc.php b/server/mods-available/cron_module.inc.php
index 778585c..a8c14cc 100644
--- a/server/mods-available/cron_module.inc.php
+++ b/server/mods-available/cron_module.inc.php
@@ -30,68 +30,68 @@
 */
 
 class cron_module {
-	
+
 	var $module_name = 'cron_module';
 	var $class_name = 'cron_module';
-	var $actions_available = array(	'cron_insert',
-									'cron_update',
-									'cron_delete');
-	
+	var $actions_available = array( 'cron_insert',
+		'cron_update',
+		'cron_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('cron',$this->module_name,'process');
-		
+
+		$app->modules->registerTableHook('cron', $this->module_name, 'process');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'cron':
-				if($action == 'i') $app->plugins->raiseEvent('cron_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('cron_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('cron_delete',$data);
+		case 'cron':
+			if($action == 'i') $app->plugins->raiseEvent('cron_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('cron_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('cron_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/database_module.inc.php b/server/mods-available/database_module.inc.php
index c3a99b6..a427677 100644
--- a/server/mods-available/database_module.inc.php
+++ b/server/mods-available/database_module.inc.php
@@ -29,86 +29,86 @@
 */
 
 class database_module {
-	
+
 	var $module_name = 'database_module';
 	var $class_name = 'database_module';
-	var $actions_available = array(	'database_insert',
-									'database_update',
-									'database_delete',
-									'database_user_insert',
-									'database_user_update',
-									'database_user_delete'
-									);
-	
+	var $actions_available = array( 'database_insert',
+		'database_update',
+		'database_delete',
+		'database_user_insert',
+		'database_user_update',
+		'database_user_delete'
+	);
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['db'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('web_database','database_module','process');
-		$app->modules->registerTableHook('web_database_user','database_module','process');
-		
+
+		$app->modules->registerTableHook('web_database', 'database_module', 'process');
+		$app->modules->registerTableHook('web_database_user', 'database_module', 'process');
+
 		// Register service
 		//$app->services->registerService('httpd','web_module','restartHttpd');
-		
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'web_database':
-				if($action == 'i') $app->plugins->raiseEvent('database_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('database_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('database_delete',$data);
+		case 'web_database':
+			if($action == 'i') $app->plugins->raiseEvent('database_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('database_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('database_delete', $data);
 			break;
-			
-			case 'web_database_user':
-				if($action == 'i') $app->plugins->raiseEvent('database_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('database_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('database_user_delete',$data);
+
+		case 'web_database_user':
+			if($action == 'i') $app->plugins->raiseEvent('database_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('database_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('database_user_delete', $data);
 			break;
-			
+
 		} // end switch
 	} // end function
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/dns_module.inc.php b/server/mods-available/dns_module.inc.php
index 9bab96e..d3c1303 100644
--- a/server/mods-available/dns_module.inc.php
+++ b/server/mods-available/dns_module.inc.php
@@ -29,107 +29,107 @@
 */
 
 class dns_module {
-	
+
 	var $module_name = 'dns_module';
 	var $class_name = 'dns_module';
-	var $actions_available = array(	'dns_soa_insert',
-									'dns_soa_update',
-									'dns_soa_delete',
-									'dns_slave_insert',
-									'dns_slave_update',
-									'dns_slave_delete',
-									'dns_rr_insert',
-									'dns_rr_update',
-									'dns_rr_delete');
-	
+	var $actions_available = array( 'dns_soa_insert',
+		'dns_soa_update',
+		'dns_soa_delete',
+		'dns_slave_insert',
+		'dns_slave_update',
+		'dns_slave_delete',
+		'dns_rr_insert',
+		'dns_rr_update',
+		'dns_rr_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['dns'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('dns_soa',$this->module_name,'process');
-		$app->modules->registerTableHook('dns_slave',$this->module_name,'process');
-		$app->modules->registerTableHook('dns_rr',$this->module_name,'process');
-		
-		
+
+		$app->modules->registerTableHook('dns_soa', $this->module_name, 'process');
+		$app->modules->registerTableHook('dns_slave', $this->module_name, 'process');
+		$app->modules->registerTableHook('dns_rr', $this->module_name, 'process');
+
+
 		// Register service
-		$app->services->registerService('bind','dns_module','restartBind');
-		$app->services->registerService('powerdns','dns_module','restartPowerDNS');
-		
+		$app->services->registerService('bind', 'dns_module', 'restartBind');
+		$app->services->registerService('powerdns', 'dns_module', 'restartPowerDNS');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'dns_soa':
-				if($action == 'i') $app->plugins->raiseEvent('dns_soa_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('dns_soa_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('dns_soa_delete',$data);
+		case 'dns_soa':
+			if($action == 'i') $app->plugins->raiseEvent('dns_soa_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('dns_soa_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('dns_soa_delete', $data);
 			break;
-			case 'dns_slave':
-				if($action == 'i') $app->plugins->raiseEvent('dns_slave_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('dns_slave_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('dns_slave_delete',$data);
+		case 'dns_slave':
+			if($action == 'i') $app->plugins->raiseEvent('dns_slave_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('dns_slave_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('dns_slave_delete', $data);
 			break;
-			case 'dns_rr':
-				if($action == 'i') $app->plugins->raiseEvent('dns_rr_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('dns_rr_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('dns_rr_delete',$data);
+		case 'dns_rr':
+			if($action == 'i') $app->plugins->raiseEvent('dns_rr_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('dns_rr_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('dns_rr_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
-	
+
+
 	function restartBind($action = 'restart') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('system');
-		
+
 		$daemon = '';
 		if(is_file($conf['init_scripts'] . '/' . 'bind9')) {
 			$daemon = 'bind9';
 		} else {
 			$daemon = 'named';
 		}
-		
+
 		$retval = array('output' => '', 'retval' => 0);
 		if($action == 'restart') {
 			exec($app->system->getinitcommand($daemon, 'restart').' 2>&1', $retval['output'], $retval['retval']);
@@ -140,39 +140,43 @@
 	}
 
 	function restartPowerDNS($action = 'restart') {
-		global $app,$conf;
-	
-		$app->uses('system');
-		$app->log("restartPDNS called.",LOGLEVEL_DEBUG);
+		global $app, $conf;
 
-/**     Since PowerDNS does not currently allow to limit AXFR for specific zones to specific
-*		IP addresses, we create a list of IPs allowed of AXFR transfers from our PowerDNS,
-*		however any of these IPs is allowed to AXFR transfer any of the zones we are masters
-*		for.
-*/
-        $tmps = $app->db->queryAllRecords("SELECT DISTINCT xfer FROM dns_soa WHERE active = 'Y' UNION SELECT DISTINCT xfer FROM dns_slave WHERE active = 'Y' ");
+		$app->uses('system');
+		$app->log("restartPDNS called.", LOGLEVEL_DEBUG);
+
+		/**     Since PowerDNS does not currently allow to limit AXFR for specific zones to specific
+		 *  IP addresses, we create a list of IPs allowed of AXFR transfers from our PowerDNS,
+		 *  however any of these IPs is allowed to AXFR transfer any of the zones we are masters
+		 *  for.
+		 */
+
+
+		$tmps = $app->db->queryAllRecords("SELECT DISTINCT xfer FROM dns_soa WHERE active = 'Y' UNION SELECT DISTINCT xfer FROM dns_slave WHERE active = 'Y' ");
 
 		//* Make sure the list is never empty
-        $options='127.0.0.1';
-        foreach($tmps as $tmp) {
-        	if (trim($tmp['xfer'])!='') {
-	        	if ($options=='') {
+		$options='127.0.0.1';
+		foreach($tmps as $tmp) {
+			if (trim($tmp['xfer'])!='') {
+				if ($options=='') {
 					$options.=$tmp['xfer'];
-	        	} else {
-    	    		$options=$options.",".$tmp['xfer'];
-        		}
-        	}
-        }
+				} else {
+					$options=$options.",".$tmp['xfer'];
+				}
+			}
+		}
 
 		//* Remove duplicate IPs from the array
-		$options = "allow-axfr-ips=".implode(",",array_unique(explode(",",$options)));
-        $app->log("".$options,LOGLEVEL_DEBUG);
-	
-/**		Not an ideal way to use a hardcoded path like that, but currently
-*		we have no way to find out where powerdns' configuration files are 
-*		located, so we have to work on assumption. 
-*/
-		file_put_contents('/etc/powerdns/pdns.d/pdns.ispconfig-axfr',$options."\n");
+		$options = "allow-axfr-ips=".implode(",", array_unique(explode(",", $options)));
+		$app->log("".$options, LOGLEVEL_DEBUG);
+
+
+
+		/**  Not an ideal way to use a hardcoded path like that, but currently
+		 *  we have no way to find out where powerdns' configuration files are
+		 *  located, so we have to work on assumption.
+		 */
+		file_put_contents('/etc/powerdns/pdns.d/pdns.ispconfig-axfr', $options."\n");
 
 		$daemon= '';
 		if (is_file($conf['init_scripts'] . '/' . 'powerdns')) {
@@ -184,11 +188,11 @@
 		$retval = array('output' => '', 'retval' => 0);
 		exec($app->system->getinitcommand($daemon, 'restart').' 2>&1', $retval['output'], $retval['retval']);
 
-//     unset $tmps;
+		//     unset $tmps;
 		return $retval;
 
 	}
-	
+
 
 } // end class
 
diff --git a/server/mods-available/mail_module.inc.php b/server/mods-available/mail_module.inc.php
index 23e0b8d..bc6d290 100644
--- a/server/mods-available/mail_module.inc.php
+++ b/server/mods-available/mail_module.inc.php
@@ -29,134 +29,134 @@
 */
 
 class mail_module {
-	
+
 	var $module_name = 'mail_module';
 	var $class_name = 'mail_module';
-	var $actions_available = array(	'mail_domain_insert',
-									'mail_domain_update',
-									'mail_domain_delete',
-									'mail_user_insert',
-									'mail_user_update',
-									'mail_user_delete',
-									'mail_access_insert',
-									'mail_access_update',
-									'mail_access_delete',
-									'mail_forwarding_insert',
-									'mail_forwarding_update',
-									'mail_forwarding_delete',
-									'mail_transport_insert',
-									'mail_transport_update',
-									'mail_transport_delete',
-									'mail_get_insert',
-									'mail_get_update',
-									'mail_get_delete',
-									'mail_content_filter_insert',
-									'mail_content_filter_update',
-									'mail_content_filter_delete',
-									'mail_mailinglist_insert',
-									'mail_mailinglist_update',
-									'mail_mailinglist_delete');
-	
+	var $actions_available = array( 'mail_domain_insert',
+		'mail_domain_update',
+		'mail_domain_delete',
+		'mail_user_insert',
+		'mail_user_update',
+		'mail_user_delete',
+		'mail_access_insert',
+		'mail_access_update',
+		'mail_access_delete',
+		'mail_forwarding_insert',
+		'mail_forwarding_update',
+		'mail_forwarding_delete',
+		'mail_transport_insert',
+		'mail_transport_update',
+		'mail_transport_delete',
+		'mail_get_insert',
+		'mail_get_update',
+		'mail_get_delete',
+		'mail_content_filter_insert',
+		'mail_content_filter_update',
+		'mail_content_filter_delete',
+		'mail_mailinglist_insert',
+		'mail_mailinglist_update',
+		'mail_mailinglist_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('mail_access','mail_module','process');
-		$app->modules->registerTableHook('mail_domain','mail_module','process');
-		$app->modules->registerTableHook('mail_forwarding','mail_module','process');
-		$app->modules->registerTableHook('mail_transport','mail_module','process');
-		$app->modules->registerTableHook('mail_user','mail_module','process');
-		$app->modules->registerTableHook('mail_get','mail_module','process');
-		$app->modules->registerTableHook('mail_content_filter','mail_module','process');
-		$app->modules->registerTableHook('mail_mailinglist','mail_module','process');
-		
+
+		$app->modules->registerTableHook('mail_access', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_domain', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_forwarding', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_transport', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_user', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_get', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_content_filter', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_mailinglist', 'mail_module', 'process');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'mail_access':
-				if($action == 'i') $app->plugins->raiseEvent('mail_access_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_access_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_access_delete',$data);
+		case 'mail_access':
+			if($action == 'i') $app->plugins->raiseEvent('mail_access_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_access_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_access_delete', $data);
 			break;
-			case 'mail_domain':
-				if($action == 'i') $app->plugins->raiseEvent('mail_domain_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_domain_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_domain_delete',$data);
+		case 'mail_domain':
+			if($action == 'i') $app->plugins->raiseEvent('mail_domain_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_domain_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_domain_delete', $data);
 			break;
-			case 'mail_forwarding':
-				if($action == 'i') $app->plugins->raiseEvent('mail_forwarding_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_forwarding_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_forwarding_delete',$data);
+		case 'mail_forwarding':
+			if($action == 'i') $app->plugins->raiseEvent('mail_forwarding_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_forwarding_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_forwarding_delete', $data);
 			break;
-			case 'mail_transport':
-				if($action == 'i') $app->plugins->raiseEvent('mail_transport_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_transport_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_transport_delete',$data);
+		case 'mail_transport':
+			if($action == 'i') $app->plugins->raiseEvent('mail_transport_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_transport_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_transport_delete', $data);
 			break;
-			case 'mail_user':
-				if($action == 'i') $app->plugins->raiseEvent('mail_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_user_delete',$data);
+		case 'mail_user':
+			if($action == 'i') $app->plugins->raiseEvent('mail_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_user_delete', $data);
 			break;
-			case 'mail_get':
-				if($action == 'i') $app->plugins->raiseEvent('mail_get_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_get_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_get_delete',$data);
+		case 'mail_get':
+			if($action == 'i') $app->plugins->raiseEvent('mail_get_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_get_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_get_delete', $data);
 			break;
-			case 'mail_content_filter':
-				if($action == 'i') $app->plugins->raiseEvent('mail_content_filter_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete',$data);
+		case 'mail_content_filter':
+			if($action == 'i') $app->plugins->raiseEvent('mail_content_filter_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete', $data);
 			break;
-			case 'mail_mailinglist':
-				if($action == 'i') $app->plugins->raiseEvent('mail_mailinglist_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete',$data);
+		case 'mail_mailinglist':
+			if($action == 'i') $app->plugins->raiseEvent('mail_mailinglist_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete', $data);
 			break;
 		} // end switch
 	} // end function
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php
index 2e66d64..e83ccf7 100644
--- a/server/mods-available/monitor_core_module.inc.php
+++ b/server/mods-available/monitor_core_module.inc.php
@@ -36,9 +36,11 @@
 	/* No actions at this time. maybe later... */
 	var $actions_available = array();
 	/** The Tools */
+
+
 	private $_tools = null;
-    //** time the script was called
-    private $_run_time = null;
+	//** time the script was called
+	private $_run_time = null;
 
 	/**
 	 * This function is called during ispconfig installation to determine
@@ -54,10 +56,10 @@
 	 */
 	public function onLoad() {
 		global $app;
-        
-        //* store the running time
-        $this->_run_time = time();
-        
+
+		//* store the running time
+		$this->_run_time = time();
+
 		/*
 		 * Do the monitor every n minutes and write the result to the db
 		 */
@@ -89,7 +91,7 @@
 		$this->_tools = new monitor_tools();
 
 		/*
-		 * Calls the single Monitoring steps 
+		 * Calls the single Monitoring steps
 		 */
 		$this->_monitorEmailQuota();
 		$this->_monitorHDQuota();
@@ -121,41 +123,41 @@
 		$this->_monitorSysLog();
 	}
 
-    private function _monitorEmailQuota() {
-        global $app, $conf;
+	private function _monitorEmailQuota() {
+		global $app, $conf;
 
-        /*
+		/*
 		 *  This monitoring is expensive, so do it only every 15 minutes
 		 */
 		$min = @date('i', $this->_run_time);
 		if ($min % 15 != 0) return;
-		
+
 		$app->uses('getconf');
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
 		if($mail_config['mailbox_quota_stats'] == 'n') return;
-		
-		
+
+
 		/*
          * First we get the Monitoring-data from the tools
          */
-        $res = $this->_tools->monitorEmailQuota();
+		$res = $this->_tools->monitorEmailQuota();
 
-        /*
+		/*
          * Insert the data into the database
          */
-        $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-                'VALUES (' .
-                $res['server_id'] . ', ' .
-                "'" . $app->dbmaster->quote($res['type']) . "', " .
-                'UNIX_TIMESTAMP(), ' .
-                "'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-                "'" . $res['state'] . "'" .
-                ')';
-        $app->dbmaster->query($sql);
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
+		$app->dbmaster->query($sql);
 
-        /* The new data is written, now we can delete the old one */
-        $this->_delOldRecords($res['type'], $res['server_id']);
-    }
+		/* The new data is written, now we can delete the old one */
+		$this->_delOldRecords($res['type'], $res['server_id']);
+	}
 
 	private function _monitorHDQuota() {
 		global $app;
@@ -169,13 +171,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -194,13 +196,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -219,13 +221,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -244,13 +246,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -269,13 +271,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -293,13 +295,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -317,13 +319,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -342,13 +344,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -367,13 +369,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -392,13 +394,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -422,22 +424,22 @@
 		 * First we get the Monitoring-data from the tools
 		 */
 		$res = $this->_tools->monitorSystemUpdate();
-		
+
 		//* Ensure that output is encoded so that it does not break the serialize
 		//$res['data']['output'] = htmlentities($res['data']['output']);
-		$res['data']['output'] = htmlentities($res['data']['output'],ENT_QUOTES,'UTF-8');
+		$res['data']['output'] = htmlentities($res['data']['output'], ENT_QUOTES, 'UTF-8');
 
 		/*
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -456,13 +458,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -481,13 +483,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -516,13 +518,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -530,29 +532,29 @@
 	}
 
 	private function _monitorFail2ban() {
-        global $app;
+		global $app;
 
-        /*
+		/*
          * First we get the Monitoring-data from the tools
          */
-        $res = $this->_tools->monitorFail2ban();
+		$res = $this->_tools->monitorFail2ban();
 
-        /*
+		/*
          * Insert the data into the database
          */
-        $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-                'VALUES (' .
-                $res['server_id'] . ', ' .
-                "'" . $app->dbmaster->quote($res['type']) . "', " .
-                'UNIX_TIMESTAMP(), ' .
-                "'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-                "'" . $res['state'] . "'" .
-                ')';
-        $app->dbmaster->query($sql);
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
+		$app->dbmaster->query($sql);
 
-        /* The new data is written, now we can delete the old one */
-        $this->_delOldRecords($res['type'], $res['server_id']);
-    }
+		/* The new data is written, now we can delete the old one */
+		$this->_delOldRecords($res['type'], $res['server_id']);
+	}
 
 
 	private function _monitorIPTables() {
@@ -567,13 +569,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -592,13 +594,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -617,13 +619,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -642,13 +644,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -667,13 +669,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -692,13 +694,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -712,7 +714,7 @@
 		 * First we get the Monitoring-data from the tools
 		 */
 		$res = $this->_tools->monitorISPCCronLog();
-		
+
 		//* Ensure that output is encoded so that it does not break the serialize
 		if(is_array($res) && isset($res['data'])) $res['data'] = htmlentities($res['data']);
 
@@ -720,13 +722,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -745,13 +747,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -770,13 +772,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -795,13 +797,13 @@
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -820,25 +822,25 @@
 		// $now = time();
 		// $old = $now - (4 * 60); // 4 minutes
 		$old = 'UNIX_TIMESTAMP() - 240';
-		
+
 		/*
 		 * ATTENTION if i do NOT pay attention of the server id, i delete all data (of the type)
-		 * of ALL servers. This means, if i have a multiserver-environment and a server has a 
+		 * of ALL servers. This means, if i have a multiserver-environment and a server has a
 		 * time not synced with the others (for example, all server has 11:00 and ONE server has
 		 * 10:45) then the actual data of this server (with the time-stamp 10:45) get lost
 		 * even though it is the NEWEST data of this server. To avoid this i HAVE to include
 		 * the server-id!
 		 */
 		$sql = 'DELETE FROM monitor_data ' .
-				'WHERE ' .
-				'  type =' . "'" . $app->dbmaster->quote($type) . "' " .
-				'AND ' .
-				'  created < ' . $old . ' ' .
-				'AND ' .
-				'  server_id = ' . $serverId;
+			'WHERE ' .
+			'  type =' . "'" . $app->dbmaster->quote($type) . "' " .
+			'AND ' .
+			'  created < ' . $old . ' ' .
+			'AND ' .
+			'  server_id = ' . $serverId;
 		$app->dbmaster->query($sql);
 	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/remoteaction_core_module.inc.php b/server/mods-available/remoteaction_core_module.inc.php
index 5ee3fc6..0864953 100644
--- a/server/mods-available/remoteaction_core_module.inc.php
+++ b/server/mods-available/remoteaction_core_module.inc.php
@@ -63,8 +63,8 @@
 		 */
 		global $app;
 		$sql = "UPDATE sys_remoteaction " .
-				"SET action_state = '" . $app->dbmaster->quote($state) . "' " .
-				"WHERE action_id = " . intval($id);
+			"SET action_state = '" . $app->dbmaster->quote($state) . "' " .
+			"WHERE action_id = " . intval($id);
 		$app->dbmaster->query($sql);
 
 		/*
@@ -80,6 +80,8 @@
 	/**
 	 * This method searches for scheduled actions and exec then
 	 */
+
+
 	private function _execActions() {
 		global $app;
 		global $conf;
@@ -96,16 +98,16 @@
 		 * stop a service, a admin stopped some days before! To avoid this, we ignore
 		 * the status (it is only for the interface to show) and use our own maxid
 		*/
-		include_once (SCRIPT_PATH."/lib/remote_action.inc.php");
+		include_once SCRIPT_PATH."/lib/remote_action.inc.php";
 
 		/*
 		 * Get all actions this server should execute
 		*/
 		$sql = "SELECT action_id, action_type, action_param " .
-				"FROM sys_remoteaction " .
-				"WHERE server_id = " . $server_id . " ".
-				" AND  action_id > " . intval($maxid_remote_action) . " ".
-				"ORDER BY action_id";
+			"FROM sys_remoteaction " .
+			"WHERE server_id = " . $server_id . " ".
+			" AND  action_id > " . intval($maxid_remote_action) . " ".
+			"ORDER BY action_id";
 		$actions = $app->dbmaster->queryAllRecords($sql);
 
 		/*
@@ -120,7 +122,7 @@
 					* we stop executing the actions not to waste more time */
 					return;
 				}
-				
+
 				if ($action['action_type'] == 'ispc_update') {
 					/* do the update */
 					// Update function has been removed
@@ -151,7 +153,7 @@
 					$this->_actionDone($action['action_id'], 'ok');
 				}
 				if ($action['action_type'] == 'openvz_create_ostpl') {
-					$parts = explode(':',$action['action_param']);
+					$parts = explode(':', $action['action_param']);
 					$veid = intval($parts[0]);
 					$template_cache_dir = '/vz/template/cache/';
 					$template_name = escapeshellcmd($parts[1]);
@@ -166,8 +168,8 @@
 					* we stop executing the actions not to waste more time */
 					return;
 				}
-				
-				
+
+
 			}
 		}
 	}
@@ -187,7 +189,7 @@
 			exec("aptitude update");
 			exec("aptitude safe-upgrade -y");
 		}
-		
+
 		/*
 		 * All well done!
 		 */
@@ -195,12 +197,12 @@
 	}
 
 	private function _doIspCUpdate($action) {
-		
+
 		// Ensure that this code is not executed twice as this would cause a loop in case of a failure
 		$this->_actionDone($action['action_id'], 'ok');
-		
+
 		/*
-		 * Get the version-number of the newest version 
+		 * Get the version-number of the newest version
 		 */
 		$new_version = @file_get_contents('http://www.ispconfig.org/downloads/ispconfig3_version.txt');
 		$new_version = trim($new_version);
@@ -216,10 +218,10 @@
 		/* delete the old files (if there are any...) */
 		exec("rm /tmp/ISPConfig-" . $new_version . ".tar.gz");
 		exec("rm /tmp/ispconfig3_install -R");
-		
+
 		/* get the newest version */
 		exec("wget http://www.ispconfig.org/downloads/ISPConfig-" . $new_version . ".tar.gz");
-		
+
 		/* extract the files */
 		exec("tar xvfz ISPConfig-" . $new_version . ".tar.gz");
 
@@ -229,7 +231,7 @@
 		 */
 		chdir("/tmp/ispconfig3_install/install");
 		exec("touch autoupdate");
-		
+
 		/*
 		 * do some clean-up
 		 */
@@ -245,5 +247,7 @@
 		 */
 		//$this->_actionDone($action['action_id'], 'ok');
 	}
+
 }
+
 ?>
diff --git a/server/mods-available/rescue_core_module.inc.php b/server/mods-available/rescue_core_module.inc.php
index 15abd54..a3a5ad7 100644
--- a/server/mods-available/rescue_core_module.inc.php
+++ b/server/mods-available/rescue_core_module.inc.php
@@ -35,12 +35,16 @@
 	/* No actions at this time. maybe later... */
 	var $actions_available = array();
 	/**
-	 * The monitoring-Data of this module. 
+	 * The monitoring-Data of this module.
 	 * [0] are the actual data, [1] are the data 1 minnute ago [2] are teh data 2 minuntes...
 	 */
+
+
 	private $_monitoringData = array();
+
 	/** The rescue-Data of this module. */
 	private $_rescueData = array();
+
 
 	/**
 	 *  This function is called during ispconfig installation to determine
@@ -50,12 +54,14 @@
 		return true;
 	}
 
+
 	/**
 	 * This function is called when the module is loaded
 	 */
 	function onLoad() {
 		$this->_doRescue();
 	}
+
 
 	/**
 	 * This function is called when a change in one of the registered tables is detected.
@@ -73,8 +79,8 @@
 		 * do nothing, if the rescue-system is not enabled
 		 */
 		global $conf;
-		if ((!isset($conf['serverconfig']['rescue']['try_rescue'])) || 
-				((isset($conf['serverconfig']['rescue']['try_rescue'])) && ($conf['serverconfig']['rescue']['try_rescue'] !='y'))){
+		if ((!isset($conf['serverconfig']['rescue']['try_rescue'])) ||
+			((isset($conf['serverconfig']['rescue']['try_rescue'])) && ($conf['serverconfig']['rescue']['try_rescue'] !='y'))){
 			return;
 		}
 
@@ -87,17 +93,17 @@
 		 * Next we get the rescue data needed for rescuing the system
 		 */
 		$this->_rescueData = $this->_getRescueData();
-		
+
 		/*
 		 * rescue mysql if needed (maybe httpd depends on mysql, so try this first!)
 		 */
 		$this->_rescueMySql();
-		
+
 		/*
 		 * rescue httpd if needed
 		 */
 		$this->_rescueHttpd();
-		
+
 		/*
 		 * The last step is to save the rescue-data
 		 */
@@ -112,12 +118,12 @@
 	 */
 	private function _getMonitoringData() {
 		global $app;
-		
+
 		$dataFilename = dirname(__FILE__) . "/../temp/rescue_module_monitoringdata.ser.txt";
-		
+
 		/*
 		 * If the file containing the data is too old (older than 5 minutes) it is better to
-		 * delete it, because it could be, that the server was down for some times and so the data 
+		 * delete it, because it could be, that the server was down for some times and so the data
 		 * are outdated
 		 */
 		if (file_exists($dataFilename) && (filemtime($dataFilename) < (time() - 5 * 60))) {
@@ -132,7 +138,7 @@
 		} else {
 			$data = array();
 		}
-		
+
 		/*
 		 * $temp[0] was the data of the last monitoring (means 1 minute ago), $temp[1] is the data
 		 * 2 minutes ago and so on. Now we have make place for the newest data...
@@ -144,32 +150,34 @@
 		for ($i = $max; $i > 0; $i--){
 			$data[$i] = $data[$i -1];
 		}
-		
+
 		/*
 		 * we need the monitoring tools
 		 */
 		$app->load('monitor_tools');
 		$tools = new monitor_tools();
-		
+
 		/*
 		 * Call the needed Monitoring-step and get the data
 		 */
 		$tmp[0] = $tools->monitorServices();
-		
+
 		/* Add the data at the FIRST position of the history */
 		$data[0] = $tmp;
-		
+
 		/*
 		 * We have the newest monitoring data. Save it!
 		 * (and protect it, because there may be sensible data in it)
 		 */
 		file_put_contents($dataFilename, serialize($data));
 		chmod($dataFilename, 0600);
-						
+
 		/* Thats it */
 		return $data;
 	}
-	
+
+
+
 	/**
 	 * This gets the rescue-Data, needed for rescuing the system.
 	 * Because we can not be 100% sure, that the mysql-DB is up and running, so we use the
@@ -181,7 +189,7 @@
 
 		/*
 		 * If the file containing the data is too old (older than 5 minutes) it is better to
-		 * delete it, because it could be, that the server was down for some times and so the data 
+		 * delete it, because it could be, that the server was down for some times and so the data
 		 * are outdated
 		 */
 		if (file_exists($dataFilename) && (filemtime($dataFilename) < (time() - 5 * 60))) {
@@ -196,7 +204,7 @@
 		} else {
 			$data = array();
 		}
-		
+
 		/* Thats it */
 		return $data;
 	}
@@ -222,14 +230,14 @@
 	 */
 	private function _rescueHttpd(){
 		global $app, $conf;
-		
+
 		/*
 		 * do nothing, if it is not allowed to rescue httpd
 		 */
 		if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_httpd']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_httpd']) == 'y')){
 			return;
 		}
-		
+
 		/*
 		 * if the service is up and running, or the service is not installed there is nothing to do...
 		 */
@@ -238,42 +246,42 @@
 			$this->_rescueData['webserver']['try_counter'] = 0;
 			return;
 		}
-		
+
 		/*
 		 * OK, the service is installed and down.
 		 * Maybe this is because of a restart of the service by the admin.
 		 * This means, we check the data 1 minute ago
 		 */
-		if ((!isset($this->_monitoringData[1][0]['data']['webserver'])) || 
-				((isset($this->_monitoringData[1][0]['data']['webserver'])) && ($this->_monitoringData[1][0]['data']['webserver'] != 0))){
-			/* 
-			 * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago. 
-			 * This means, it could be, that the admin is restarting the server. 
+		if ((!isset($this->_monitoringData[1][0]['data']['webserver'])) ||
+			((isset($this->_monitoringData[1][0]['data']['webserver'])) && ($this->_monitoringData[1][0]['data']['webserver'] != 0))){
+			/*
+			 * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago.
+			 * This means, it could be, that the admin is restarting the server.
 			 * We wait one more minute...
 			 */
 			return;
 		}
-		
+
 		/*#####
 		 * The service is down and it was down 1 minute ago.
 		 * We try to rescue it
 		 *#####*/
-		
+
 		/* Get the try counter */
 		$tryCount = (!isset($this->_rescueData['webserver']['try_counter']))? 1 : $this->_rescueData['webserver']['try_counter'] + 1;
-		
+
 		/* Set the new try counter */
 		$this->_rescueData['webserver']['try_counter'] = $tryCount;
-		
+
 		/* if 5 times will not work, we have to give up... */
 		if ($tryCount > 5){
 			$app->log('httpd is down! Rescue will not help!', LOGLEVEL_ERROR);
 			return;
 		}
-		
-		
+
+
 		$app->log('httpd is down! Try rescue httpd (try:' . $tryCount . ')...', LOGLEVEL_WARN);
-		
+
 		if($conf['serverconfig']['web']['server_type'] == 'nginx'){
 			$daemon = 'nginx';
 		} else {
@@ -285,23 +293,25 @@
 				$daemon = 'apache2';
 			}
 		}
-		
+
 		$this->_rescueDaemon($daemon);
 	}
-	
+
+
+
 	/**
 	 * restarts mysql, if needed
 	 */
 	private function _rescueMySql(){
 		global $app, $conf;
-		
+
 		/*
 		 * do nothing, if it is not allowed to rescue mysql
 		 */
 		if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_mysql']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_mysql']) == 'y')){
 			return;
 		}
-		
+
 		/*
 		 * if the service is up and running, or the service is not installed there is nothing to do...
 		 */
@@ -310,40 +320,40 @@
 			$this->_rescueData['mysqlserver']['try_counter'] = 0;
 			return;
 		}
-		
+
 		/*
 		 * OK, the service is installed and down.
 		 * Maybe this is because of a restart of the service by the admin.
 		 * This means, we check the data 1 minute ago
 		 */
-		if ((!isset($this->_monitoringData[1][0]['data']['mysqlserver'])) || 
-				((isset($this->_monitoringData[1][0]['data']['mysqlserver'])) && ($this->_monitoringData[1][0]['data']['mysqlserver'] != 0))){
-			/* 
-			 * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago. 
-			 * This means, it could be, that the admin is restarting the server. 
+		if ((!isset($this->_monitoringData[1][0]['data']['mysqlserver'])) ||
+			((isset($this->_monitoringData[1][0]['data']['mysqlserver'])) && ($this->_monitoringData[1][0]['data']['mysqlserver'] != 0))){
+			/*
+			 * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago.
+			 * This means, it could be, that the admin is restarting the server.
 			 * We wait one more minute...
 			 */
 			return;
 		}
-		
+
 		/*#####
 		 * The service is down and it was down 1 minute ago.
 		 * We try to rescue it
 		 *#####*/
-		
+
 		/* Get the try counter */
 		$tryCount = (!isset($this->_rescueData['mysqlserver']['try_counter']))? 1 : $this->_rescueData['mysqlserver']['try_counter'] + 1;
-		
+
 		/* Set the new try counter */
 		$this->_rescueData['mysqlserver']['try_counter'] = $tryCount;
-		
+
 		/* if 5 times will not work, we have to give up... */
 		if ($tryCount > 5){
 			$app->log('MySQL is down! Rescue will not help!', LOGLEVEL_ERROR);
 			return;
 		}
-		
-		
+
+
 		$app->log('MySQL is down! Try rescue mysql (try:' . $tryCount . ')...', LOGLEVEL_WARN);
 
 		if(is_file($conf['init_scripts'] . '/' . 'mysqld')) {
@@ -351,24 +361,24 @@
 		} else {
 			$daemon = 'mysql';
 		}
-		
+
 		$this->_rescueDaemon($daemon);
 	}
 
 	/**
 	 * Tries to stop and then restart the daemon
-	 * 
+	 *
 	 * @param type $daemon the name of the daemon
 	 */
 	private function _rescueDaemon($daemon){
 		global $conf;
-		
+
 		$app->uses('system');
 		// if you need to find all restarts search for "['init_scripts']"
 		/*
 		 * First we stop the running service "normally"
 		 */
-		
+
 		/*
 		 * ATTENTION!
 		 * The service hangs. this means it could be, that "stop" will hang also.
@@ -376,17 +386,19 @@
 		 * of the service
 		 */
 		exec($app->system->getinitcommand($daemon, 'stop').' && (sleep 3; kill $!; sleep 2; kill -9 $!) &> /dev/null');
-		
+
 		/*
 		 * OK, we tryed to stop it normally, maybe this worked maybe not. So we have to look
 		 * if the service is already running or not. If so, we have to kill them hard
 		 */
 		exec("kill -9 `ps -A | grep " . $daemon . "| grep -v grep | awk '{print $1}'` &> /dev/null");
-		
+
 		/*
 		 * There are no more zombies left. Lets start the service..
 		 */
 		exec($app->system->getinitcommand($daemon, 'start'));
 	}
+
 }
+
 ?>
diff --git a/server/mods-available/server_module.inc.php b/server/mods-available/server_module.inc.php
index fb7042f..bc846cf 100644
--- a/server/mods-available/server_module.inc.php
+++ b/server/mods-available/server_module.inc.php
@@ -29,97 +29,97 @@
 */
 
 class server_module {
-	
+
 	var $module_name = 'server_module';
 	var $class_name = 'server_module';
-	var $actions_available = array(	'server_insert',
-									'server_update',
-									'server_delete',
-									'server_ip_insert',
-									'server_ip_update',
-									'server_ip_delete',
-									'firewall_insert',
-									'firewall_update',
-									'firewall_delete',
-									'software_update_inst_insert',
-									'software_update_inst_update',
-									'software_update_inst_delete');
-	
+	var $actions_available = array( 'server_insert',
+		'server_update',
+		'server_delete',
+		'server_ip_insert',
+		'server_ip_update',
+		'server_ip_delete',
+		'firewall_insert',
+		'firewall_update',
+		'firewall_delete',
+		'software_update_inst_insert',
+		'software_update_inst_update',
+		'software_update_inst_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('server','server_module','process');
-		$app->modules->registerTableHook('server_ip','server_module','process');
-		$app->modules->registerTableHook('firewall','server_module','process');
-		$app->modules->registerTableHook('software_update_inst','server_module','process');
-		
+
+		$app->modules->registerTableHook('server', 'server_module', 'process');
+		$app->modules->registerTableHook('server_ip', 'server_module', 'process');
+		$app->modules->registerTableHook('firewall', 'server_module', 'process');
+		$app->modules->registerTableHook('software_update_inst', 'server_module', 'process');
+
 		// Register service
 		//$app->services->registerService('httpd','web_module','restartHttpd');
-		
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'server':
-				if($action == 'i') $app->plugins->raiseEvent('server_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('server_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('server_delete',$data);
+		case 'server':
+			if($action == 'i') $app->plugins->raiseEvent('server_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('server_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('server_delete', $data);
 			break;
-			case 'server_ip':
-				if($action == 'i') $app->plugins->raiseEvent('server_ip_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('server_ip_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('server_ip_delete',$data);
+		case 'server_ip':
+			if($action == 'i') $app->plugins->raiseEvent('server_ip_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('server_ip_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('server_ip_delete', $data);
 			break;
-			case 'firewall':
-				if($action == 'i') $app->plugins->raiseEvent('firewall_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('firewall_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('firewall_delete',$data);
+		case 'firewall':
+			if($action == 'i') $app->plugins->raiseEvent('firewall_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('firewall_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('firewall_delete', $data);
 			break;
-			case 'software_update_inst':
-				if($action == 'i') $app->plugins->raiseEvent('software_update_inst_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('software_update_inst_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('software_update_inst_delete',$data);
+		case 'software_update_inst':
+			if($action == 'i') $app->plugins->raiseEvent('software_update_inst_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('software_update_inst_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('software_update_inst_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
+
 	/*
 	// This function is used
 	function restartHttpd($action = 'restart') {
@@ -134,4 +134,4 @@
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/vm_module.inc.php b/server/mods-available/vm_module.inc.php
index 9a7fc37..b3c636d 100644
--- a/server/mods-available/vm_module.inc.php
+++ b/server/mods-available/vm_module.inc.php
@@ -29,89 +29,89 @@
 */
 
 class vm_module {
-	
+
 	var $module_name = 'vm_module';
 	var $class_name = 'vm_module';
-	var $actions_available = array(	'openvz_vm_insert',
-									'openvz_vm_update',
-									'openvz_vm_delete',
-									'openvz_ip_insert',
-									'openvz_ip_update',
-									'openvz_ip_delete',
-									'openvz_ostemplate_insert',
-									'openvz_ostemplate_update',
-									'openvz_ostemplate_delete');
-	
+	var $actions_available = array( 'openvz_vm_insert',
+		'openvz_vm_update',
+		'openvz_vm_delete',
+		'openvz_ip_insert',
+		'openvz_ip_update',
+		'openvz_ip_delete',
+		'openvz_ostemplate_insert',
+		'openvz_ostemplate_update',
+		'openvz_ostemplate_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['vserver'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('openvz_vm',$this->module_name,'process');
-		$app->modules->registerTableHook('openvz_ip',$this->module_name,'process');
-		$app->modules->registerTableHook('openvz_ostemplate',$this->module_name,'process');
-		
+
+		$app->modules->registerTableHook('openvz_vm', $this->module_name, 'process');
+		$app->modules->registerTableHook('openvz_ip', $this->module_name, 'process');
+		$app->modules->registerTableHook('openvz_ostemplate', $this->module_name, 'process');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'openvz_vm':
-				if($action == 'i') $app->plugins->raiseEvent('openvz_vm_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('openvz_vm_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('openvz_vm_delete',$data);
+		case 'openvz_vm':
+			if($action == 'i') $app->plugins->raiseEvent('openvz_vm_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('openvz_vm_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('openvz_vm_delete', $data);
 			break;
-			case 'openvz_ip':
-				if($action == 'i') $app->plugins->raiseEvent('openvz_ip_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('openvz_ip_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('openvz_ip_delete',$data);
+		case 'openvz_ip':
+			if($action == 'i') $app->plugins->raiseEvent('openvz_ip_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('openvz_ip_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('openvz_ip_delete', $data);
 			break;
-			case 'openvz_ostemplate':
-				if($action == 'i') $app->plugins->raiseEvent('openvz_ostemplate_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('openvz_ostemplate_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('openvz_ostemplate_delete',$data);
+		case 'openvz_ostemplate':
+			if($action == 'i') $app->plugins->raiseEvent('openvz_ostemplate_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('openvz_ostemplate_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('openvz_ostemplate_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
+
 
 } // end class
 
diff --git a/server/mods-available/web_module.inc.php b/server/mods-available/web_module.inc.php
index 5d7fe66..680b592 100644
--- a/server/mods-available/web_module.inc.php
+++ b/server/mods-available/web_module.inc.php
@@ -29,206 +29,206 @@
 */
 
 class web_module {
-	
+
 	var $module_name = 'web_module';
 	var $class_name = 'web_module';
-	var $actions_available = array(	'web_domain_insert',
-									'web_domain_update',
-									'web_domain_delete',
-									'ftp_user_insert',
-									'ftp_user_update',
-									'ftp_user_delete',
-									'shell_user_insert',
-									'shell_user_update',
-									'shell_user_delete',
-									'webdav_user_insert',
-									'webdav_user_update',
-									'webdav_user_delete',
-									'web_folder_insert',
-									'web_folder_update',
-									'web_folder_delete',
-									'web_folder_user_insert',
-									'web_folder_user_update',
-									'web_folder_user_delete',
-									'web_backup_insert',
-									'web_backup_update',
-									'web_backup_delete',
-									'aps_instance_insert',
-									'aps_instance_update',
-									'aps_instance_delete',
-									'aps_instance_setting_insert',
-									'aps_instance_setting_update',
-									'aps_instance_setting_delete',
-									'aps_package_insert',
-									'aps_package_update',
-									'aps_package_delete',
-									'aps_setting_insert',
-									'aps_setting_update',
-									'aps_setting_delete');
-	
+	var $actions_available = array( 'web_domain_insert',
+		'web_domain_update',
+		'web_domain_delete',
+		'ftp_user_insert',
+		'ftp_user_update',
+		'ftp_user_delete',
+		'shell_user_insert',
+		'shell_user_update',
+		'shell_user_delete',
+		'webdav_user_insert',
+		'webdav_user_update',
+		'webdav_user_delete',
+		'web_folder_insert',
+		'web_folder_update',
+		'web_folder_delete',
+		'web_folder_user_insert',
+		'web_folder_user_update',
+		'web_folder_user_delete',
+		'web_backup_insert',
+		'web_backup_update',
+		'web_backup_delete',
+		'aps_instance_insert',
+		'aps_instance_update',
+		'aps_instance_delete',
+		'aps_instance_setting_insert',
+		'aps_instance_setting_update',
+		'aps_instance_setting_delete',
+		'aps_package_insert',
+		'aps_package_update',
+		'aps_package_delete',
+		'aps_setting_insert',
+		'aps_setting_update',
+		'aps_setting_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('web_domain','web_module','process');
-		$app->modules->registerTableHook('ftp_user','web_module','process');
-		$app->modules->registerTableHook('shell_user','web_module','process');
-		$app->modules->registerTableHook('webdav_user','web_module','process');
-		$app->modules->registerTableHook('web_folder','web_module','process');
-		$app->modules->registerTableHook('web_folder_user','web_module','process');
-		$app->modules->registerTableHook('web_backup','web_module','process');
-		$app->modules->registerTableHook('aps_instances','web_module','process');
-		$app->modules->registerTableHook('aps_instances_settings','web_module','process');
-		$app->modules->registerTableHook('aps_packages','web_module','process');
-		$app->modules->registerTableHook('aps_settings','web_module','process');
-		
+
+		$app->modules->registerTableHook('web_domain', 'web_module', 'process');
+		$app->modules->registerTableHook('ftp_user', 'web_module', 'process');
+		$app->modules->registerTableHook('shell_user', 'web_module', 'process');
+		$app->modules->registerTableHook('webdav_user', 'web_module', 'process');
+		$app->modules->registerTableHook('web_folder', 'web_module', 'process');
+		$app->modules->registerTableHook('web_folder_user', 'web_module', 'process');
+		$app->modules->registerTableHook('web_backup', 'web_module', 'process');
+		$app->modules->registerTableHook('aps_instances', 'web_module', 'process');
+		$app->modules->registerTableHook('aps_instances_settings', 'web_module', 'process');
+		$app->modules->registerTableHook('aps_packages', 'web_module', 'process');
+		$app->modules->registerTableHook('aps_settings', 'web_module', 'process');
+
 		// Register service
-		$app->services->registerService('httpd','web_module','restartHttpd');
-		$app->services->registerService('php-fpm','web_module','restartPHP_FPM');
-		
+		$app->services->registerService('httpd', 'web_module', 'restartHttpd');
+		$app->services->registerService('php-fpm', 'web_module', 'restartPHP_FPM');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'web_domain':
-				if($action == 'i') $app->plugins->raiseEvent('web_domain_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('web_domain_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('web_domain_delete',$data);
+		case 'web_domain':
+			if($action == 'i') $app->plugins->raiseEvent('web_domain_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('web_domain_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('web_domain_delete', $data);
 			break;
-			case 'ftp_user':
-				if($action == 'i') $app->plugins->raiseEvent('ftp_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('ftp_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('ftp_user_delete',$data);
+		case 'ftp_user':
+			if($action == 'i') $app->plugins->raiseEvent('ftp_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('ftp_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('ftp_user_delete', $data);
 			break;
-			case 'shell_user':
-				if($action == 'i') $app->plugins->raiseEvent('shell_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('shell_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('shell_user_delete',$data);
+		case 'shell_user':
+			if($action == 'i') $app->plugins->raiseEvent('shell_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('shell_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('shell_user_delete', $data);
 			break;
-			case 'webdav_user':
-				if($action == 'i') $app->plugins->raiseEvent('webdav_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('webdav_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('webdav_user_delete',$data);
+		case 'webdav_user':
+			if($action == 'i') $app->plugins->raiseEvent('webdav_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('webdav_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('webdav_user_delete', $data);
 			break;
-			case 'web_folder':
-				if($action == 'i') $app->plugins->raiseEvent('web_folder_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('web_folder_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('web_folder_delete',$data);
+		case 'web_folder':
+			if($action == 'i') $app->plugins->raiseEvent('web_folder_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('web_folder_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('web_folder_delete', $data);
 			break;
-			case 'web_folder_user':
-				if($action == 'i') $app->plugins->raiseEvent('web_folder_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('web_folder_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('web_folder_user_delete',$data);
+		case 'web_folder_user':
+			if($action == 'i') $app->plugins->raiseEvent('web_folder_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('web_folder_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('web_folder_user_delete', $data);
 			break;
-			case 'web_backup':
-				if($action == 'i') $app->plugins->raiseEvent('web_backup_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('web_backup_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('web_backup_delete',$data);
+		case 'web_backup':
+			if($action == 'i') $app->plugins->raiseEvent('web_backup_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('web_backup_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('web_backup_delete', $data);
 			break;
-			case 'aps_instances':
-				if($action == 'i') $app->plugins->raiseEvent('aps_instance_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('aps_instance_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('aps_instance_delete',$data);
+		case 'aps_instances':
+			if($action == 'i') $app->plugins->raiseEvent('aps_instance_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('aps_instance_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('aps_instance_delete', $data);
 			break;
-			case 'aps_instances_settings':
-				if($action == 'i') $app->plugins->raiseEvent('aps_instance_setting_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('aps_instance_setting_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('aps_instance_setting_delete',$data);
+		case 'aps_instances_settings':
+			if($action == 'i') $app->plugins->raiseEvent('aps_instance_setting_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('aps_instance_setting_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('aps_instance_setting_delete', $data);
 			break;
-			case 'aps_packages':
-				if($action == 'i') $app->plugins->raiseEvent('aps_package_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('aps_package_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('aps_package_delete',$data);
+		case 'aps_packages':
+			if($action == 'i') $app->plugins->raiseEvent('aps_package_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('aps_package_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('aps_package_delete', $data);
 			break;
-			case 'aps_settings':
-				if($action == 'i') $app->plugins->raiseEvent('aps_setting_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('aps_setting_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('aps_setting_delete',$data);
+		case 'aps_settings':
+			if($action == 'i') $app->plugins->raiseEvent('aps_setting_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('aps_setting_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('aps_setting_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
-	
+
+
 	// This function is used
 	function restartHttpd($action = 'restart') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		// load the server configuration options
 		$app->uses('getconf,system');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
+
 		$daemon = '';
 		switch ($web_config['server_type']) {
-			case 'nginx':
-				$daemon = $web_config['server_type'];
-				break;
-			default:
-				if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
-					$daemon = 'httpd';
-				} else {
-					$daemon = 'apache2';
-				}
+		case 'nginx':
+			$daemon = $web_config['server_type'];
+			break;
+		default:
+			if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
+				$daemon = 'httpd';
+			} else {
+				$daemon = 'apache2';
+			}
 		}
 
 		$retval = array('output' => '', 'retval' => 0);
 		if($action == 'restart') {
 			exec($app->system->getinitcommand($daemon, 'restart').' 2>&1', $retval['output'], $retval['retval']);
-			
+
 		} else {
 			exec($app->system->getinitcommand($daemon, 'reload').' 2>&1', $retval['output'], $retval['retval']);
 		}
 		return $retval;
 	}
-	
+
 	function restartPHP_FPM($action = 'restart') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		// load the server configuration options
 		$app->uses('getconf,system');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
+
 		list($action, $init_script) = explode(':', $action);
-		
+
 		if(!$init_script){
 			//$init_script = $conf['init_scripts'].'/'.$web_config['php_fpm_init_script'];
 			$initcommand = $app->system->getinitcommand($web_config['php_fpm_init_script'], $action);
@@ -236,7 +236,7 @@
 			$path_parts = pathinfo($init_script);
 			$initcommand = $app->system->getinitcommand($path_parts['basename'], $action, $path_parts['dirname']);
 		}
-		
+
 		$retval = array('output' => '', 'retval' => 0);
 		exec($initcommand.' 2>&1', $retval['output'], $retval['retval']);
 		return $retval;
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index d99eb44..4007a7d 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -61,53 +61,53 @@
 		/*
 		Register for the events
 		*/
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'ssl');
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl');
 
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
 
-		$app->plugins->registerEvent('server_ip_insert',$this->plugin_name,'server_ip');
-		$app->plugins->registerEvent('server_ip_update',$this->plugin_name,'server_ip');
-		$app->plugins->registerEvent('server_ip_delete',$this->plugin_name,'server_ip');
+		$app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip');
+		$app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip');
+		$app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip');
 
-		$app->plugins->registerEvent('webdav_user_insert',$this->plugin_name,'webdav');
-		$app->plugins->registerEvent('webdav_user_update',$this->plugin_name,'webdav');
-		$app->plugins->registerEvent('webdav_user_delete',$this->plugin_name,'webdav');
-		
-		$app->plugins->registerEvent('client_delete',$this->plugin_name,'client_delete');
-		
-		$app->plugins->registerEvent('web_folder_user_insert',$this->plugin_name,'web_folder_user');
-		$app->plugins->registerEvent('web_folder_user_update',$this->plugin_name,'web_folder_user');
-		$app->plugins->registerEvent('web_folder_user_delete',$this->plugin_name,'web_folder_user');
-		
-		$app->plugins->registerEvent('web_folder_update',$this->plugin_name,'web_folder_update');
-		$app->plugins->registerEvent('web_folder_delete',$this->plugin_name,'web_folder_delete');
-		
-		$app->plugins->registerEvent('ftp_user_delete',$this->plugin_name,'ftp_user_delete');
-		
+		$app->plugins->registerEvent('webdav_user_insert', $this->plugin_name, 'webdav');
+		$app->plugins->registerEvent('webdav_user_update', $this->plugin_name, 'webdav');
+		$app->plugins->registerEvent('webdav_user_delete', $this->plugin_name, 'webdav');
+
+		$app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete');
+
+		$app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user');
+		$app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user');
+		$app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user');
+
+		$app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update');
+		$app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete');
+
+		$app->plugins->registerEvent('ftp_user_delete', $this->plugin_name, 'ftp_user_delete');
+
 	}
 
 	// Handle the creation of SSL certificates
-	function ssl($event_name,$data) {
+	function ssl($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
 
 		// load the server configuration options
 		$app->uses('getconf');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
 		if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf'))
-			$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf',LOGLEVEL_ERROR);	
-		
+			$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR);
+
 		//* Only vhosts can have a ssl cert
 		if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain") return;
 
 		// if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl');
 		if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
-		
+
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key.org';
@@ -117,32 +117,32 @@
 
 		//* Create a SSL Certificate, but only if this is not a mirror server.
 		if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) {
-			
+
 			$this->ssl_certificate_changed = true;
-			
+
 			//* Rename files if they exist
 			if(file_exists($key_file)){
-				$app->system->rename($key_file,$key_file.'.bak');
-				$app->system->chmod($key_file.'.bak',0400);
+				$app->system->rename($key_file, $key_file.'.bak');
+				$app->system->chmod($key_file.'.bak', 0400);
 			}
 			if(file_exists($key_file2)){
-				$app->system->rename($key_file2,$key_file2.'.bak');
-				$app->system->chmod($key_file2.'.bak',0400);
+				$app->system->rename($key_file2, $key_file2.'.bak');
+				$app->system->chmod($key_file2.'.bak', 0400);
 			}
-			if(file_exists($csr_file)) $app->system->rename($csr_file,$csr_file.'.bak');
-			if(file_exists($crt_file)) $app->system->rename($crt_file,$crt_file.'.bak');
-			
+			if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak');
+			if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak');
+
 			$rand_file = $ssl_dir.'/random_file';
-			$rand_data = md5(uniqid(microtime(),1));
+			$rand_data = md5(uniqid(microtime(), 1));
 			for($i=0; $i<1000; $i++) {
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
 			}
 			$app->system->file_put_contents($rand_file, $rand_data);
 
-			$ssl_password = substr(md5(uniqid(microtime(),1)), 0, 15);
+			$ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15);
 
 			$ssl_cnf = "        RANDFILE               = $rand_file
 
@@ -167,7 +167,7 @@
         challengePassword              = A challenge password";
 
 			$ssl_cnf_file = $ssl_dir.'/openssl.conf';
-			$app->system->file_put_contents($ssl_cnf_file,$ssl_cnf);
+			$app->system->file_put_contents($ssl_cnf_file, $ssl_cnf);
 
 			$rand_file = escapeshellcmd($rand_file);
 			$key_file = escapeshellcmd($key_file);
@@ -182,7 +182,7 @@
 			if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate
 
 			if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) {
-				
+
 				exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $key_file 2048");
 				exec("openssl req -new -passin pass:$ssl_password -passout pass:$ssl_password -key $key_file -out $csr_file -days $ssl_days -config $config_file");
 				exec("openssl rsa -passin pass:$ssl_password -in $key_file -out $key_file2");
@@ -190,18 +190,18 @@
 				if(file_exists($web_config['CA_path'].'/openssl.cnf'))
 				{
 					exec("openssl ca -batch -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file");
-					$app->log("Creating CA-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
-					if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed.  openssl ca -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file",LOGLEVEL_ERROR);
+					$app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+					if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed.  openssl ca -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file", LOGLEVEL_ERROR);
 				};
 				if (@filesize($crt_file)==0 || !file_exists($crt_file)){
 					exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $key_file -in $csr_file -out $crt_file -days $ssl_days -config $config_file ");
-					$app->log("Creating self-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
+					$app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
 				};
-			
+
 			}
 
-			$app->system->chmod($key_file,0400);
-			$app->system->chmod($key_file2,0400);
+			$app->system->chmod($key_file, 0400);
+			$app->system->chmod($key_file2, 0400);
 			@$app->system->unlink($config_file);
 			@$app->system->unlink($rand_file);
 			$ssl_request = $app->db->quote($app->system->file_get_contents($csr_file));
@@ -225,29 +225,29 @@
 			$csr_file = $ssl_dir.'/'.$domain.".csr";
 			$crt_file = $ssl_dir.'/'.$domain.".crt";
 			$bundle_file = $ssl_dir.'/'.$domain.".bundle";
-			
+
 			//* Backup files
 			if(file_exists($key_file)){
-				$app->system->copy($key_file,$key_file.'~');
-				$app->system->chmod($key_file.'~',0400);
+				$app->system->copy($key_file, $key_file.'~');
+				$app->system->chmod($key_file.'~', 0400);
 			}
 			if(file_exists($key_file2)){
-				$app->system->copy($key_file2,$key_file2.'~');
-				$app->system->chmod($key_file2.'~',0400);
+				$app->system->copy($key_file2, $key_file2.'~');
+				$app->system->chmod($key_file2.'~', 0400);
 			}
-			if(file_exists($csr_file)) $app->system->copy($csr_file,$csr_file.'~');
-			if(file_exists($crt_file)) $app->system->copy($crt_file,$crt_file.'~');
-			if(file_exists($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'~');
-			
+			if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~');
+			if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~');
+			if(file_exists($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'~');
+
 			//* Write new ssl files
-			if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file,$data["new"]["ssl_request"]);
-			if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file,$data["new"]["ssl_cert"]);
-			if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file,$data["new"]["ssl_bundle"]);
-			
+			if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]);
+			if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]);
+			if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file, $data["new"]["ssl_bundle"]);
+
 			//* Write the key file, if field is empty then import the key into the db
 			if(trim($data["new"]["ssl_key"]) != '') {
-				$app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]);
-				$app->system->chmod($key_file2,0400);
+				$app->system->file_put_contents($key_file2, $data["new"]["ssl_key"]);
+				$app->system->chmod($key_file2, 0400);
 			} else {
 				$ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2));
 				/* Update the DB of the (local) Server */
@@ -255,13 +255,13 @@
 				/* Update also the master-DB of the Server-Farm */
 				$app->dbmaster->query("UPDATE web_domain SET ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
 			}
-			
+
 			/* Update the DB of the (local) Server */
 			$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			
+
 			/* Update also the master-DB of the Server-Farm */
 			$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			$app->log('Saving SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		//* Delete a SSL certificate
@@ -272,10 +272,10 @@
 			$crt_file = $ssl_dir.'/'.$domain.'.crt';
 			$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
 			if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf'))
-				{
-					exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke $crt_file");
-					$app->log("Revoking CA-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
-				};
+			{
+				exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke $crt_file");
+				$app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+			};
 			$app->system->unlink($csr_file);
 			$app->system->unlink($crt_file);
 			$app->system->unlink($bundle_file);
@@ -285,24 +285,24 @@
 			/* Update also the master-DB of the Server-Farm */
 			$app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data['new']['domain']."'");
 			$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			$app->log('Deleting SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 	}
 
 
-	function insert($event_name,$data) {
+	function insert($event_name, $data) {
 		global $app, $conf;
 
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 
 
 	}
 
 
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
 
 		if($this->action != 'insert') $this->action = 'update';
@@ -318,7 +318,7 @@
 				$data['new'] = $tmp;
 				$data['old'] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
 
 			// This is not a vhost, so we need to update the parent record instead.
@@ -335,45 +335,45 @@
 		//* Check if this is a chrooted setup
 		if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
 			$apache_chrooted = true;
-			$app->log('Info: Apache is chrooted.',LOGLEVEL_DEBUG);
+			$app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG);
 		} else {
 			$apache_chrooted = false;
 		}
 
 		if($data['new']['document_root'] == '') {
-			if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set',LOGLEVEL_WARN);
+			if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set', LOGLEVEL_WARN);
 			return 0;
 		}
 		if($data['new']['system_user'] == 'root' or $data['new']['system_group'] == 'root') {
-			$app->log('Websites cannot be owned by the root user or group.',LOGLEVEL_WARN);
+			$app->log('Websites cannot be owned by the root user or group.', LOGLEVEL_WARN);
 			return 0;
 		}
 		if(trim($data['new']['domain']) == '') {
-			$app->log('domain is empty',LOGLEVEL_WARN);
+			$app->log('domain is empty', LOGLEVEL_WARN);
 			return 0;
 		}
-		
-        $web_folder = 'web';
-        $log_folder = 'log';
-        if($data['new']['type'] == 'vhostsubdomain') {
-            $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
-            $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
-            if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
-            $web_folder = $data['new']['web_folder'];
-            $log_folder .= '/' . $subdomain_host;
-            unset($tmp);
-        }
+
+		$web_folder = 'web';
+		$log_folder = 'log';
+		if($data['new']['type'] == 'vhostsubdomain') {
+			$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+			$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+			if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
+			$web_folder = $data['new']['web_folder'];
+			$log_folder .= '/' . $subdomain_host;
+			unset($tmp);
+		}
 
 		// Create group and user, if not exist
 		$app->uses('system');
-		
+
 		if($web_config['connect_userid_to_webid'] == 'y') {
 			//* Calculate the uid and gid
 			$connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']);
 			$fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']);
 			$fixed_uid_param = '--uid '.$fixed_uid_gid;
 			$fixed_gid_param = '--gid '.$fixed_uid_gid;
-			
+
 			//* Check if a ispconfigend user and group exists and create them
 			if(!$app->system->is_group('ispconfigend')) {
 				exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend');
@@ -390,7 +390,7 @@
 		if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) {
 			exec('groupadd '.$fixed_gid_param.' '.$groupname);
 			if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname);
-			$app->log('Adding the group: '.$groupname,LOGLEVEL_DEBUG);
+			$app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG);
 		}
 
 		$username = escapeshellcmd($data['new']['system_user']);
@@ -402,7 +402,7 @@
 				exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
 				if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
 			}
-			$app->log('Adding the user: '.$username,LOGLEVEL_DEBUG);
+			$app->log('Adding the user: '.$username, LOGLEVEL_DEBUG);
 		}
 
 		//* If the client of the site has been changed, we have a change of the document root
@@ -414,77 +414,77 @@
 			unset($old_client);
 
 			//* Remove the old symlinks
-			$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+			$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 			if(is_array($tmp_symlinks_array)) {
 				foreach($tmp_symlinks_array as $tmp_symlink) {
-					$tmp_symlink = str_replace('[client_id]',$old_client_id,$tmp_symlink);
-					$tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
+					$tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink);
+					$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
 					// Remove trailing slash
 					if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 					// create the symlinks, if not exist
 					if(is_link($tmp_symlink)) {
 						exec('rm -f '.escapeshellcmd($tmp_symlink));
-						$app->log('Removed symlink: rm -f '.$tmp_symlink,LOGLEVEL_DEBUG);
+						$app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
 					}
 				}
 			}
-			
+
 			//* Remove protection of old folders
-			$app->system->web_folder_protection($data['old']['document_root'],false);
-            
-            if($data["new"]["type"] != "vhostsubdomain") {
-                //* Move the site data
-                $tmp_docroot = explode('/',$data['new']['document_root']);
-                unset($tmp_docroot[count($tmp_docroot)-1]);
-                $new_dir = implode('/',$tmp_docroot);
+			$app->system->web_folder_protection($data['old']['document_root'], false);
 
-                $tmp_docroot = explode('/',$data['old']['document_root']);
-                unset($tmp_docroot[count($tmp_docroot)-1]);
-                $old_dir = implode('/',$tmp_docroot);
+			if($data["new"]["type"] != "vhostsubdomain") {
+				//* Move the site data
+				$tmp_docroot = explode('/', $data['new']['document_root']);
+				unset($tmp_docroot[count($tmp_docroot)-1]);
+				$new_dir = implode('/', $tmp_docroot);
 
-                //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
-                if(@is_dir($data['new']['document_root'])) {
-                    $app->system->web_folder_protection($data['new']['document_root'],false);
-                    $app->system->rename($data['new']['document_root'],$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
-                    $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'),LOGLEVEL_DEBUG);
-                }
-                
-                //* Create new base directory, if it does not exist yet
-                if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
-                $app->system->web_folder_protection($data['old']['document_root'],false);
-                exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir));
-                //$app->system->rename($data['old']['document_root'],$new_dir);
-                $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir,LOGLEVEL_DEBUG);
+				$tmp_docroot = explode('/', $data['old']['document_root']);
+				unset($tmp_docroot[count($tmp_docroot)-1]);
+				$old_dir = implode('/', $tmp_docroot);
 
-                // Handle the change in php_open_basedir
-                $data['new']['php_open_basedir'] = str_replace($data['old']['document_root'],$data['new']['document_root'],$data['old']['php_open_basedir']);
+				//* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
+				if(@is_dir($data['new']['document_root'])) {
+					$app->system->web_folder_protection($data['new']['document_root'], false);
+					$app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
+					$app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG);
+				}
 
-                //* Change the owner of the website files to the new website owner
-                exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
+				//* Create new base directory, if it does not exist yet
+				if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
+				$app->system->web_folder_protection($data['old']['document_root'], false);
+				exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir));
+				//$app->system->rename($data['old']['document_root'],$new_dir);
+				$app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG);
 
-                //* Change the home directory and group of the website user
-                $command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod';
-                $command .= ' --home '.escapeshellcmd($data['new']['document_root']);
-                $command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
-                $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
-                exec($command);
-            }
-            
+				// Handle the change in php_open_basedir
+				$data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']);
+
+				//* Change the owner of the website files to the new website owner
+				exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
+
+				//* Change the home directory and group of the website user
+				$command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod';
+				$command .= ' --home '.escapeshellcmd($data['new']['document_root']);
+				$command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
+				$command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
+				exec($command);
+			}
+
 			if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
-			
+
 			//* Change the log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
+			$app->system->removeLine('/etc/fstab', $fstab_line);
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
-			$app->system->replaceLine('/etc/fstab',$fstab_line,$fstab_line,1,1);
+			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 
 		}
 
 		//print_r($data);
 
 		// Check if the directories are there and create them if necessary.
-		$app->system->web_folder_protection($data['new']['document_root'],false);
-		
+		$app->system->web_folder_protection($data['new']['document_root'], false);
+
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder);
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error');
 		//if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder);
@@ -492,44 +492,44 @@
 		if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
 		if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp');
 		if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav');
-		
+
 		//* Create the new private directory
 		if(!is_dir($data['new']['document_root'].'/private')) {
 			$app->system->mkdirpath($data['new']['document_root'].'/private');
-			$app->system->chmod($data['new']['document_root'].'/private',0710);
-			$app->system->chown($data['new']['document_root'].'/private',$username);
-			$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
+			$app->system->chmod($data['new']['document_root'].'/private', 0710);
+			$app->system->chown($data['new']['document_root'].'/private', $username);
+			$app->system->chgrp($data['new']['document_root'].'/private', $groupname);
 		}
-		
-		
+
+
 		// Remove the symlink for the site, if site is renamed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
 			if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']);
 			if(is_link($data['old']['document_root'].'/'.$log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$log_folder);
-			
+
 			//* remove old log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
-			
+			$app->system->removeLine('/etc/fstab', $fstab_line);
+
 			//* Unmount log directory
 			exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
 		}
-		
+
 		//* Create the log dir if nescessary and mount it
 		if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) {
 			if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
 			if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
 			$app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
-			$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root');
-			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root');
-			$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+			$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root');
+			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root');
+			$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 			exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
 			//* add mountpoint to fstab
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
-			$app->system->replaceLine('/etc/fstab',$fstab_line,$fstab_line,1,1);
+			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 		}
-		
-		$app->system->web_folder_protection($data['new']['document_root'],true);
+
+		$app->system->web_folder_protection($data['new']['document_root'], true);
 
 		// Get the client ID
 		$client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['new']['sys_groupid']));
@@ -538,28 +538,28 @@
 
 		// Remove old symlinks, if site is renamed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
-			$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+			$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 			if(is_array($tmp_symlinks_array)) {
 				foreach($tmp_symlinks_array as $tmp_symlink) {
-					$tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-					$tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
+					$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+					$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
 					// Remove trailing slash
 					if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 					// remove the symlinks, if not exist
 					if(is_link($tmp_symlink)) {
 						exec('rm -f '.escapeshellcmd($tmp_symlink));
-						$app->log('Removed symlink: rm -f '.$tmp_symlink,LOGLEVEL_DEBUG);
+						$app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
 					}
 				}
 			}
 		}
 
 		// Create the symlinks for the sites
-		$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+		$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 		if(is_array($tmp_symlinks_array)) {
 			foreach($tmp_symlinks_array as $tmp_symlink) {
-				$tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-				$tmp_symlink = str_replace('[website_domain]',$data['new']['domain'],$tmp_symlink);
+				$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+				$tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink);
 				// Remove trailing slash
 				if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 				//* Remove symlink if target folder has been changed.
@@ -568,64 +568,64 @@
 				}
 				// create the symlinks, if not exist
 				if(!is_link($tmp_symlink)) {
-//					exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
+					//     exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
 					if ($web_config["website_symlinks_rel"] == 'y') {
 						$this->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink));
 					} else {
 						exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
 					}
 
-					$app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink,LOGLEVEL_DEBUG);
+					$app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG);
 				}
 			}
 		}
 
 
 
-        // Install the Standard or Custom Error, Index and other related files
-        // /usr/local/ispconfig/server/conf is for the standard files
-        // /usr/local/ispconfig/server/conf-custom is for the custom files
-        // setting a local var here
-           
-        // normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
+		// Install the Standard or Custom Error, Index and other related files
+		// /usr/local/ispconfig/server/conf is for the standard files
+		// /usr/local/ispconfig/server/conf-custom is for the custom files
+		// setting a local var here
+
+		// normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
 		if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
-            
-            // Copy the error pages
+
+			// Copy the error pages
 			if($data['new']['errordocs']) {
 				$error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
-				if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
-					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+				if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 				}
 				else {
 					if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
 						exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
 					}
 					else {
-						exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+						exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 					}
 				}
 				exec('chmod -R a+r '.$error_page_path);
 			}
 
-			if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) {
-				exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
-            
-			if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
-                exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-            }
-			if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
-                exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-                }
-                if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
-                    exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-                }
-            }
+			if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+				exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+
+				if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+				if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+				if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+			}
 			else {
 				if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) {
 					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
 				}
 				else {
-					exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+					exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
 					if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
 					if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
 					if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
@@ -635,17 +635,17 @@
 
 			//** Copy the error documents on update when the error document checkbox has been activated and was deactivated before
 		} elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) {
-            
+
 			$error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
-			if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
-				exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+			if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+				exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 			}
 			else {
 				if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
 					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
 				}
 				else {
-					exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+					exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 				}
 			}
 			exec('chmod -R a+r '.$error_page_path);
@@ -674,34 +674,34 @@
 				$this->_exec('chown root:root '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder);
 			}
 		}
-		
+
 		//* add the Apache user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update
 		if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['user']));
 
 		//* If the security level is set to high
 		if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost')) {
-			
-			$app->system->web_folder_protection($data['new']['document_root'],false);
-			
+
+			$app->system->web_folder_protection($data['new']['document_root'], false);
+
 			//* Check if we have the new private folder and create it if nescessary
 			if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private');
-			
+
 			if($web_config['security_level'] == 20) {
-				
-				$app->system->chmod($data['new']['document_root'],0755);
-				$app->system->chmod($data['new']['document_root'].'/web',0710);
-				$app->system->chmod($data['new']['document_root'].'/webdav',0710);
-				$app->system->chmod($data['new']['document_root'].'/private',0710);
-				$app->system->chmod($data['new']['document_root'].'/ssl',0755);
+
+				$app->system->chmod($data['new']['document_root'], 0755);
+				$app->system->chmod($data['new']['document_root'].'/web', 0710);
+				$app->system->chmod($data['new']['document_root'].'/webdav', 0710);
+				$app->system->chmod($data['new']['document_root'].'/private', 0710);
+				$app->system->chmod($data['new']['document_root'].'/ssl', 0755);
 
 				// make tmp directory writable for Apache and the website users
-				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
-			
+				$app->system->chmod($data['new']['document_root'].'/tmp', 0777);
+
 				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+					$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 				}
-				
+
 				if($web_config['add_web_users_to_sshusers_group'] == 'y') {
 					$command = 'usermod';
 					$command .= ' --groups sshusers';
@@ -720,116 +720,116 @@
 					$app->system->server_conf['group_datei'] = $tmp_groupfile;
 					unset($tmp_groupfile);
 				}
-				
+
 				//* Chown all default directories
-				$app->system->chown($data['new']['document_root'],'root');
-				$app->system->chgrp($data['new']['document_root'],'root');
-				$app->system->chown($data['new']['document_root'].'/cgi-bin',$username);
-				$app->system->chgrp($data['new']['document_root'].'/cgi-bin',$groupname);
+				$app->system->chown($data['new']['document_root'], 'root');
+				$app->system->chgrp($data['new']['document_root'], 'root');
+				$app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+				$app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root',false);
-					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,$groupname,false);
+					$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
 				}
-				$app->system->chown($data['new']['document_root'].'/ssl','root');
-				$app->system->chgrp($data['new']['document_root'].'/ssl','root');
-				$app->system->chown($data['new']['document_root'].'/tmp',$username);
-				$app->system->chgrp($data['new']['document_root'].'/tmp',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/stats',$groupname);
-				$app->system->chown($data['new']['document_root'].'/webdav',$username);
-				$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
-				$app->system->chown($data['new']['document_root'].'/private',$username);
-				$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
+				$app->system->chown($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chown($data['new']['document_root'].'/tmp', $username);
+				$app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
+				$app->system->chown($data['new']['document_root'].'/webdav', $username);
+				$app->system->chgrp($data['new']['document_root'].'/webdav', $groupname);
+				$app->system->chown($data['new']['document_root'].'/private', $username);
+				$app->system->chgrp($data['new']['document_root'].'/private', $groupname);
 
 				// If the security Level is set to medium
 			} else {
 
-				$app->system->chmod($data['new']['document_root'],0755);
-				$app->system->chmod($data['new']['document_root'].'/web',0755);
-				$app->system->chmod($data['new']['document_root'].'/webdav',0755);
-				$app->system->chmod($data['new']['document_root'].'/ssl',0755);
-				$app->system->chmod($data['new']['document_root'].'/cgi-bin',0755);
-				
+				$app->system->chmod($data['new']['document_root'], 0755);
+				$app->system->chmod($data['new']['document_root'].'/web', 0755);
+				$app->system->chmod($data['new']['document_root'].'/webdav', 0755);
+				$app->system->chmod($data['new']['document_root'].'/ssl', 0755);
+				$app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755);
+
 				// make temp directory writable for Apache and the website users
-				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
-				
+				$app->system->chmod($data['new']['document_root'].'/tmp', 0777);
+
 				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+					$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 				}
-                
-				$app->system->chown($data['new']['document_root'],'root');
-				$app->system->chgrp($data['new']['document_root'],'root');
-				$app->system->chown($data['new']['document_root'].'/cgi-bin',$username);
-				$app->system->chgrp($data['new']['document_root'].'/cgi-bin',$groupname);
+
+				$app->system->chown($data['new']['document_root'], 'root');
+				$app->system->chgrp($data['new']['document_root'], 'root');
+				$app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+				$app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root',false);
-					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,$groupname,false);
+					$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
 				}
-				
-                $app->system->chown($data['new']['document_root'].'/ssl','root');
-				$app->system->chgrp($data['new']['document_root'].'/ssl','root');
-				$app->system->chown($data['new']['document_root'].'/tmp',$username);
-				$app->system->chgrp($data['new']['document_root'].'/tmp',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/stats',$groupname);
-				$app->system->chown($data['new']['document_root'].'/webdav',$username);
-				$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
+
+				$app->system->chown($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chown($data['new']['document_root'].'/tmp', $username);
+				$app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
+				$app->system->chown($data['new']['document_root'].'/webdav', $username);
+				$app->system->chgrp($data['new']['document_root'].'/webdav', $groupname);
 			}
 		} elseif(($this->action == 'insert' && $data['new']['type'] == 'vhostsubdomain') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhostsubdomain')) {
 			if($web_config['security_level'] == 20) {
-				$app->system->chmod($data['new']['document_root'].'/' . $web_folder,0710);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder,$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder,$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats',$groupname);
-            } else {
-				$app->system->chmod($data['new']['document_root'].'/' . $web_folder,0755);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder,$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder,$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats',$groupname);
-            }
-        }
-		
+				$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+			} else {
+				$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+			}
+		}
+
 		//* Protect web folders
-		$app->system->web_folder_protection($data['new']['document_root'],true);
+		$app->system->web_folder_protection($data['new']['document_root'], true);
 
 		if($data['new']['type'] == 'vhost') {
-            // Change the ownership of the error log to the root user
-            if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
-            $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log','root');
-            $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log','root');
-        }
+			// Change the ownership of the error log to the root user
+			if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
+			$app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+			$app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+		}
 
 		//* Write the custom php.ini file, if custom_php_ini fieled is not empty
 		$custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data['new']['system_user'];
-        if($data['new']['type'] == 'vhostsubdomain') $custom_php_ini_dir .= '_' . $web_folder;
+		if($data['new']['type'] == 'vhostsubdomain') $custom_php_ini_dir .= '_' . $web_folder;
 		if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf');
-		
+
 		//* add open_basedir restriction to custom php.ini content, required for suphp only
-		if(!stristr($data['new']['custom_php_ini'],'open_basedir') && $data['new']['php'] == 'suphp') {
+		if(!stristr($data['new']['custom_php_ini'], 'open_basedir') && $data['new']['php'] == 'suphp') {
 			$data['new']['custom_php_ini'] .= "\nopen_basedir = '".$data['new']['php_open_basedir']."'\n";
 		}
-		
+
 		$fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
-		
+
 		if(trim($data['new']['fastcgi_php_version']) != ''){
 			list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
 			if(is_file($custom_fastcgi_php_ini_dir)) $custom_fastcgi_php_ini_dir = dirname($custom_fastcgi_php_ini_dir);
-			if(substr($custom_fastcgi_php_ini_dir,-1) == '/') $custom_fastcgi_php_ini_dir = substr($custom_fastcgi_php_ini_dir,0,-1);
+			if(substr($custom_fastcgi_php_ini_dir, -1) == '/') $custom_fastcgi_php_ini_dir = substr($custom_fastcgi_php_ini_dir, 0, -1);
 		}
 
 		//* Create custom php.ini
@@ -852,18 +852,18 @@
 					$master_php_ini_path = $web_config['php_ini_path_cgi'];
 				}
 			}
-			
+
 			//* Add php.ini to the path in case that the master_php_ini_path is a directory
 			if($master_php_ini_path != '' && is_dir($master_php_ini_path) && is_file($master_php_ini_path.'/php.ini')) {
-				if(substr($master_php_ini_path,-1) == '/') $master_php_ini_path = substr($master_php_ini_path,0,-1);
+				if(substr($master_php_ini_path, -1) == '/') $master_php_ini_path = substr($master_php_ini_path, 0, -1);
 				$master_php_ini_path .= '/php.ini';
 			}
-			
-			if($master_php_ini_path != '' && substr($master_php_ini_path,-7) == 'php.ini' && is_file($master_php_ini_path)) {
+
+			if($master_php_ini_path != '' && substr($master_php_ini_path, -7) == 'php.ini' && is_file($master_php_ini_path)) {
 				$php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n";
 			}
-			$php_ini_content .= str_replace("\r",'',trim($data['new']['custom_php_ini']));
-			$app->system->file_put_contents($custom_php_ini_dir.'/php.ini',$php_ini_content);
+			$php_ini_content .= str_replace("\r", '', trim($data['new']['custom_php_ini']));
+			$app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content);
 		} else {
 			$has_custom_php_ini = false;
 			if(is_file($custom_php_ini_dir.'/php.ini')) $app->system->unlink($custom_php_ini_dir.'/php.ini');
@@ -887,7 +887,7 @@
 		$vhost_data['ssl_domain'] = $data['new']['ssl_domain'];
 		$vhost_data['has_custom_php_ini'] = $has_custom_php_ini;
 		$vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir);
-		
+
 		// Custom Apache directives
 		// Make sure we only have Unix linebreaks
 		$vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']);
@@ -913,7 +913,7 @@
 		if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1;
 
 		//$vhost_data['document_root'] = $data['new']['document_root'].'/' . $web_folder;
-		
+
 		// Set SEO Redirect
 		if($data['new']['seo_redirect'] != ''){
 			$vhost_data['seo_redirect_enabled'] = 1;
@@ -928,16 +928,16 @@
 		} else {
 			$vhost_data['seo_redirect_enabled'] = 0;
 		}
-		
+
 		$tpl->setVar($vhost_data);
 
 		// Rewrite rules
 		$rewrite_rules = array();
 		if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') {
-			if(substr($data['new']['redirect_path'],-1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $data['new']['redirect_path'])) $data['new']['redirect_path'] .= '/';
-			if(substr($data['new']['redirect_path'],0,8) == '[scheme]'){
-				$rewrite_target = 'http'.substr($data['new']['redirect_path'],8);
-				$rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'],8);
+			if(substr($data['new']['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $data['new']['redirect_path'])) $data['new']['redirect_path'] .= '/';
+			if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){
+				$rewrite_target = 'http'.substr($data['new']['redirect_path'], 8);
+				$rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'], 8);
 			} else {
 				$rewrite_target = $data['new']['redirect_path'];
 				$rewrite_target_ssl = $data['new']['redirect_path'];
@@ -949,40 +949,40 @@
 			*/
 
 			switch($data['new']['subdomain']) {
-				case 'www':
-					$rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
-						'rewrite_target' 	=> $rewrite_target,
-						'rewrite_target_ssl' => $rewrite_target_ssl,
-                        'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                        'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-					$rewrite_rules[] = array(	'rewrite_domain' 	=> '^' . $this->_rewrite_quote('www.'.$data['new']['domain']),
-							'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
-							'rewrite_target' 	=> $rewrite_target,
-							'rewrite_target_ssl' => $rewrite_target_ssl,
-                            'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                            'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-					break;
-				case '*':
-					$rewrite_rules[] = array(	'rewrite_domain' 	=> '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
-						'rewrite_target' 	=> $rewrite_target,
-						'rewrite_target_ssl' => $rewrite_target_ssl,
-                        'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                        'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-					break;
-				default:
-					$rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
-						'rewrite_target' 	=> $rewrite_target,
-						'rewrite_target_ssl' => $rewrite_target_ssl,
-                        'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                        'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+			case 'www':
+				$rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+					'rewrite_target'  => $rewrite_target,
+					'rewrite_target_ssl' => $rewrite_target_ssl,
+					'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+					'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+				$rewrite_rules[] = array( 'rewrite_domain'  => '^' . $this->_rewrite_quote('www.'.$data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+					'rewrite_target'  => $rewrite_target,
+					'rewrite_target_ssl' => $rewrite_target_ssl,
+					'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+					'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+				break;
+			case '*':
+				$rewrite_rules[] = array( 'rewrite_domain'  => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+					'rewrite_target'  => $rewrite_target,
+					'rewrite_target_ssl' => $rewrite_target_ssl,
+					'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+					'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+				break;
+			default:
+				$rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+					'rewrite_target'  => $rewrite_target,
+					'rewrite_target_ssl' => $rewrite_target_ssl,
+					'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+					'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
 			}
 		}
-		
+
 		$server_alias = array();
-		
+
 		// get autoalias
 		$auto_alias = $web_config['website_autoalias'];
 		if($auto_alias != '') {
@@ -996,33 +996,33 @@
 			unset($aa_replace);
 			$server_alias[] .= $auto_alias.' ';
 		}
-		
+
 		// get alias domains (co-domains and subdomains)
 		$aliases = $app->db->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND active = 'y' AND type != 'vhostsubdomain'");
 		$alias_seo_redirects = array();
 		switch($data['new']['subdomain']) {
-			case 'www':
-				$server_alias[] .= 'www.'.$data['new']['domain'].' ';
-				break;
-			case '*':
-				$server_alias[] .= '*.'.$data['new']['domain'].' ';
-				break;
+		case 'www':
+			$server_alias[] .= 'www.'.$data['new']['domain'].' ';
+			break;
+		case '*':
+			$server_alias[] .= '*.'.$data['new']['domain'].' ';
+			break;
 		}
 		if(is_array($aliases)) {
 			foreach($aliases as $alias) {
 				switch($alias['subdomain']) {
-					case 'www':
-						$server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
-						break;
-					case '*':
-						$server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
-						break;
-					default:
-						$server_alias[] .= $alias['domain'].' ';
-						break;
+				case 'www':
+					$server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
+					break;
+				case '*':
+					$server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
+					break;
+				default:
+					$server_alias[] .= $alias['domain'].' ';
+					break;
 				}
-				$app->log('Add server alias: '.$alias['domain'],LOGLEVEL_DEBUG);
-				
+				$app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG);
+
 				// Add SEO redirects for alias domains
 				if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){
 					$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
@@ -1030,13 +1030,13 @@
 						$alias_seo_redirects[] = $tmp_seo_redirects;
 					}
 				}
-					
+
 				// Rewriting
 				if($alias['redirect_type'] != '' && $alias['redirect_path'] != '') {
-					if(substr($alias['redirect_path'],-1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $alias['redirect_path'])) $alias['redirect_path'] .= '/';
-					if(substr($alias['redirect_path'],0,8) == '[scheme]'){
-						$rewrite_target = 'http'.substr($alias['redirect_path'],8);
-						$rewrite_target_ssl = 'https'.substr($alias['redirect_path'],8);
+					if(substr($alias['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $alias['redirect_path'])) $alias['redirect_path'] .= '/';
+					if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){
+						$rewrite_target = 'http'.substr($alias['redirect_path'], 8);
+						$rewrite_target_ssl = 'https'.substr($alias['redirect_path'], 8);
 					} else {
 						$rewrite_target = $alias['redirect_path'];
 						$rewrite_target_ssl = $alias['redirect_path'];
@@ -1046,39 +1046,39 @@
 						$data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/';
 					}
 					*/
-					
+
 					switch($alias['subdomain']) {
-						case 'www':
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($alias['domain']),
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
-								'rewrite_target' 	=> $rewrite_target,
-								'rewrite_target_ssl' => $rewrite_target_ssl,
-                                'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                                'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> '^' . $this->_rewrite_quote('www.'.$alias['domain']),
-									'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
-									'rewrite_target' 	=> $rewrite_target,
-									'rewrite_target_ssl' => $rewrite_target_ssl,
-                                    'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                                    'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-							break;
-						case '*':
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> '(^|\.)'.$this->_rewrite_quote($alias['domain']),
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
-								'rewrite_target' 	=> $rewrite_target,
-								'rewrite_target_ssl' => $rewrite_target_ssl,
-                                'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                                'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-							break;
-						default:
-                            if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '(^|\.)'.$this->_rewrite_quote(substr($alias['domain'], 2));
-                            else $domain_rule = '^'.$this->_rewrite_quote($alias['domain']);
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> $domain_rule,
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
-								'rewrite_target' 	=> $rewrite_target,
-								'rewrite_target_ssl' => $rewrite_target_ssl,
-                                'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                                'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+					case 'www':
+						$rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($alias['domain']),
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+							'rewrite_target'  => $rewrite_target,
+							'rewrite_target_ssl' => $rewrite_target_ssl,
+							'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+							'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+						$rewrite_rules[] = array( 'rewrite_domain'  => '^' . $this->_rewrite_quote('www.'.$alias['domain']),
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+							'rewrite_target'  => $rewrite_target,
+							'rewrite_target_ssl' => $rewrite_target_ssl,
+							'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+							'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+						break;
+					case '*':
+						$rewrite_rules[] = array( 'rewrite_domain'  => '(^|\.)'.$this->_rewrite_quote($alias['domain']),
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+							'rewrite_target'  => $rewrite_target,
+							'rewrite_target_ssl' => $rewrite_target_ssl,
+							'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+							'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+						break;
+					default:
+						if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '(^|\.)'.$this->_rewrite_quote(substr($alias['domain'], 2));
+						else $domain_rule = '^'.$this->_rewrite_quote($alias['domain']);
+						$rewrite_rules[] = array( 'rewrite_domain'  => $domain_rule,
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+							'rewrite_target'  => $rewrite_target,
+							'rewrite_target_ssl' => $rewrite_target_ssl,
+							'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+							'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
 					}
 				}
 			}
@@ -1096,15 +1096,15 @@
 			}
 			unset($tmp_alias);
 
-			$tpl->setVar('alias',trim($server_alias_str));
+			$tpl->setVar('alias', trim($server_alias_str));
 		} else {
-			$tpl->setVar('alias','');
+			$tpl->setVar('alias', '');
 		}
 
 		if(count($rewrite_rules) > 0 || $vhost_data['seo_redirect_enabled'] > 0 || count($alias_seo_redirects) > 0) {
-			$tpl->setVar('rewrite_enabled',1);
+			$tpl->setVar('rewrite_enabled', 1);
 		} else {
-			$tpl->setVar('rewrite_enabled',0);
+			$tpl->setVar('rewrite_enabled', 0);
 		}
 
 		//$tpl->setLoop('redirects',$rewrite_rules);
@@ -1116,99 +1116,102 @@
 		 * TODO: Create form for fastcgi configs per site.
 		 */
 
+
 		if ($data['new']['php'] == 'fast-cgi') {
 
-			$fastcgi_starter_path = str_replace('[system_user]',$data['new']['system_user'],$fastcgi_config['fastcgi_starter_path']);
-			$fastcgi_starter_path = str_replace('[client_id]',$client_id,$fastcgi_starter_path);
+			$fastcgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+			$fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path);
 
 			if (!is_dir($fastcgi_starter_path)) {
 				$app->system->mkdirpath($fastcgi_starter_path);
 				//exec('chown '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.escapeshellcmd($fastcgi_starter_path));
 
 
-				$app->log('Creating fastcgi starter script directory: '.$fastcgi_starter_path,LOGLEVEL_DEBUG);
+				$app->log('Creating fastcgi starter script directory: '.$fastcgi_starter_path, LOGLEVEL_DEBUG);
 			}
 
 			//exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.escapeshellcmd($fastcgi_starter_path));
-			$app->system->chown($fastcgi_starter_path,$data['new']['system_user']);
-			$app->system->chgrp($fastcgi_starter_path,$data['new']['system_group']);
-			
+			$app->system->chown($fastcgi_starter_path, $data['new']['system_user']);
+			$app->system->chgrp($fastcgi_starter_path, $data['new']['system_group']);
+
 			$fcgi_tpl = new tpl();
 			$fcgi_tpl->newTemplate('php-fcgi-starter.master');
-			
+
 			// Support for multiple PHP versions (FastCGI)
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_fastcgi_php = false;
-				if(substr($custom_fastcgi_php_ini_dir,-1) != '/') $custom_fastcgi_php_ini_dir .= '/';
+				if(substr($custom_fastcgi_php_ini_dir, -1) != '/') $custom_fastcgi_php_ini_dir .= '/';
 			} else {
 				$default_fastcgi_php = true;
 			}
-			
+
 			if($has_custom_php_ini) {
-				$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir));
+				$fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir));
 			} else {
 				if($default_fastcgi_php){
-					$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
+					$fcgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
 				} else {
-					$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_fastcgi_php_ini_dir));
+					$fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_fastcgi_php_ini_dir));
 				}
 			}
-			$fcgi_tpl->setVar('document_root',escapeshellcmd($data['new']['document_root']));
-			$fcgi_tpl->setVar('php_fcgi_children',escapeshellcmd($fastcgi_config['fastcgi_children']));
-			$fcgi_tpl->setVar('php_fcgi_max_requests',escapeshellcmd($fastcgi_config['fastcgi_max_requests']));
+			$fcgi_tpl->setVar('document_root', escapeshellcmd($data['new']['document_root']));
+			$fcgi_tpl->setVar('php_fcgi_children', escapeshellcmd($fastcgi_config['fastcgi_children']));
+			$fcgi_tpl->setVar('php_fcgi_max_requests', escapeshellcmd($fastcgi_config['fastcgi_max_requests']));
 			if($default_fastcgi_php){
-				$fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($fastcgi_config['fastcgi_bin']));
+				$fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($fastcgi_config['fastcgi_bin']));
 			} else {
-				$fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($custom_fastcgi_php_executable));
+				$fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($custom_fastcgi_php_executable));
 			}
-			$fcgi_tpl->setVar('security_level',intval($web_config['security_level']));
+			$fcgi_tpl->setVar('security_level', intval($web_config['security_level']));
 
 			$php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];
 			$fcgi_tpl->setVar('open_basedir', escapeshellcmd($php_open_basedir));
 
 			$fcgi_starter_script = escapeshellcmd($fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
-			$app->system->file_put_contents($fcgi_starter_script,$fcgi_tpl->grab());
+			$app->system->file_put_contents($fcgi_starter_script, $fcgi_tpl->grab());
 			unset($fcgi_tpl);
 
-			$app->log('Creating fastcgi starter script: '.$fcgi_starter_script,LOGLEVEL_DEBUG);
+			$app->log('Creating fastcgi starter script: '.$fcgi_starter_script, LOGLEVEL_DEBUG);
 
-			$app->system->chmod($fcgi_starter_script,0755);
-			$app->system->chown($fcgi_starter_script,$data['new']['system_user']);
-			$app->system->chgrp($fcgi_starter_script,$data['new']['system_group']);
-						
-			$tpl->setVar('fastcgi_alias',$fastcgi_config['fastcgi_alias']);
-			$tpl->setVar('fastcgi_starter_path',$fastcgi_starter_path);
-			$tpl->setVar('fastcgi_starter_script',$fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
-			$tpl->setVar('fastcgi_config_syntax',$fastcgi_config['fastcgi_config_syntax']);
-			$tpl->setVar('fastcgi_max_requests',$fastcgi_config['fastcgi_max_requests']);
+			$app->system->chmod($fcgi_starter_script, 0755);
+			$app->system->chown($fcgi_starter_script, $data['new']['system_user']);
+			$app->system->chgrp($fcgi_starter_script, $data['new']['system_group']);
+
+			$tpl->setVar('fastcgi_alias', $fastcgi_config['fastcgi_alias']);
+			$tpl->setVar('fastcgi_starter_path', $fastcgi_starter_path);
+			$tpl->setVar('fastcgi_starter_script', $fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
+			$tpl->setVar('fastcgi_config_syntax', $fastcgi_config['fastcgi_config_syntax']);
+			$tpl->setVar('fastcgi_max_requests', $fastcgi_config['fastcgi_max_requests']);
 
 		} else {
 			//remove the php fastgi starter script if available
 			if ($data['old']['php'] == 'fast-cgi') {
-                $fastcgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$fastcgi_config['fastcgi_starter_path']);
-                $fastcgi_starter_path = str_replace('[client_id]',$client_id,$fastcgi_starter_path);
-                if($data['old']['type'] == 'vhost') {
-                    if (is_dir($fastcgi_starter_path)) {
-                        exec('rm -rf '.$fastcgi_starter_path);
-                    }
-                } else {
-                    $fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web' . $data['old']['domain_id'];
-                    if (file_exists($fcgi_starter_script)) {
-                        exec('rm -f '.$fcgi_starter_script);
-                    }
-                }
+				$fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+				$fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path);
+				if($data['old']['type'] == 'vhost') {
+					if (is_dir($fastcgi_starter_path)) {
+						exec('rm -rf '.$fastcgi_starter_path);
+					}
+				} else {
+					$fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web' . $data['old']['domain_id'];
+					if (file_exists($fcgi_starter_script)) {
+						exec('rm -f '.$fcgi_starter_script);
+					}
+				}
 			}
 		}
-		
+
+
+
 		/**
-		* PHP-FPM
-		*/
+		 * PHP-FPM
+		 */
 		// Support for multiple PHP versions
 		if($data['new']['php'] == 'php-fpm'){
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
@@ -1216,22 +1219,22 @@
 			if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
 		}
-		
+
 		if($default_php_fpm){
 			$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
 		} else {
 			$pool_dir = $custom_php_fpm_pool_dir;
 		}
-		if(substr($pool_dir,-1) != '/') $pool_dir .= '/';
+		if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
 		$pool_name = 'web'.$data['new']['domain_id'];
 		$socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']);
-		if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
-		
+		if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
+
 		if($data['new']['php_fpm_use_socket'] == 'y'){
 			$use_tcp = 0;
 			$use_socket = 1;
@@ -1251,7 +1254,6 @@
 		 * first we create the script directory if not already created, then copy over the starter script.
 		 * TODO: we have to fetch the data from the server-settings.
 		 */
-
 		if ($data['new']['php'] == 'cgi') {
 			//$cgi_config = $app->getconf->get_server_config($conf['server_id'], 'cgi');
 
@@ -1259,16 +1261,16 @@
 			$cgi_config['cgi_starter_script'] = 'php-cgi-starter'.($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : '');
 			$cgi_config['cgi_bin'] = '/usr/bin/php-cgi';
 
-			$cgi_starter_path = str_replace('[system_user]',$data['new']['system_user'],$cgi_config['cgi_starter_path']);
-			$cgi_starter_path = str_replace('[client_id]',$client_id,$cgi_starter_path);
+			$cgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $cgi_config['cgi_starter_path']);
+			$cgi_starter_path = str_replace('[client_id]', $client_id, $cgi_starter_path);
 
 			if (!is_dir($cgi_starter_path)) {
 				$app->system->mkdirpath($cgi_starter_path);
-				$app->system->chown($cgi_starter_path,$data['new']['system_user']);
-				$app->system->chgrp($cgi_starter_path,$data['new']['system_group']);
-				$app->system->chmod($cgi_starter_path,0755);
+				$app->system->chown($cgi_starter_path, $data['new']['system_user']);
+				$app->system->chgrp($cgi_starter_path, $data['new']['system_group']);
+				$app->system->chmod($cgi_starter_path, 0755);
 
-				$app->log('Creating cgi starter script directory: '.$cgi_starter_path,LOGLEVEL_DEBUG);
+				$app->log('Creating cgi starter script directory: '.$cgi_starter_path, LOGLEVEL_DEBUG);
 			}
 
 			$cgi_tpl = new tpl();
@@ -1281,52 +1283,52 @@
 
 			// This will NOT work!
 			//$cgi_tpl->setVar('open_basedir', '/var/www/' . $data['new']['domain']);
-			$cgi_tpl->setVar('php_cgi_bin',$cgi_config['cgi_bin']);
-			$cgi_tpl->setVar('security_level',$web_config['security_level']);
-			
-			$cgi_tpl->setVar('has_custom_php_ini',$has_custom_php_ini);
+			$cgi_tpl->setVar('php_cgi_bin', $cgi_config['cgi_bin']);
+			$cgi_tpl->setVar('security_level', $web_config['security_level']);
+
+			$cgi_tpl->setVar('has_custom_php_ini', $has_custom_php_ini);
 			if($has_custom_php_ini) {
-				$cgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir));
+				$cgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir));
 			} else {
-				$cgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
+				$cgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
 			}
 
 			$cgi_starter_script = escapeshellcmd($cgi_starter_path.$cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
-			$app->system->file_put_contents($cgi_starter_script,$cgi_tpl->grab());
+			$app->system->file_put_contents($cgi_starter_script, $cgi_tpl->grab());
 			unset($cgi_tpl);
 
-			$app->log('Creating cgi starter script: '.$cgi_starter_script,LOGLEVEL_DEBUG);
+			$app->log('Creating cgi starter script: '.$cgi_starter_script, LOGLEVEL_DEBUG);
 
 
-			$app->system->chmod($cgi_starter_script,0755);
-			$app->system->chown($cgi_starter_script,$data['new']['system_user']);
-			$app->system->chgrp($cgi_starter_script,$data['new']['system_group']);
+			$app->system->chmod($cgi_starter_script, 0755);
+			$app->system->chown($cgi_starter_script, $data['new']['system_user']);
+			$app->system->chgrp($cgi_starter_script, $data['new']['system_group']);
 
-			$tpl->setVar('cgi_starter_path',$cgi_starter_path);
-			$tpl->setVar('cgi_starter_script',$cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
+			$tpl->setVar('cgi_starter_path', $cgi_starter_path);
+			$tpl->setVar('cgi_starter_script', $cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
 
 		}
 
 		$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost');
 		//* Make a backup copy of vhost file
-		if(file_exists($vhost_file)) $app->system->copy($vhost_file,$vhost_file.'~');
-		
+		if(file_exists($vhost_file)) $app->system->copy($vhost_file, $vhost_file.'~');
+
 		//* create empty vhost array
 		$vhosts = array();
-		
+
 		//* Add vhost for ipv4 IP
 		$tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80);
 		if(count($rewrite_rules) > 0)  $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
 		if(count($alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $alias_seo_redirects);
 		$vhosts[] = $tmp_vhost_arr;
 		unset($tmp_vhost_arr);
-		
+
 		//* Add vhost for ipv4 IP with SSL
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key';
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
-		
+
 		if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
 			$tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443');
 			if(count($rewrite_rules) > 0)  $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
@@ -1339,29 +1341,29 @@
 			if(count($ipv4_ssl_alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv4_ssl_alias_seo_redirects);
 			$vhosts[] = $tmp_vhost_arr;
 			unset($tmp_vhost_arr, $ipv4_ssl_alias_seo_redirects);
-			$app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG);
 		}
-		
-	//* Add vhost for IPv6 IP
-	if($data['new']['ipv6_address'] != '') {
-		if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
-			if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
-				$explode_v6prefix=explode(':',$conf['serverconfig']['server']['v6_prefix']);
-				$explode_v6=explode(':',$data['new']['ipv6_address']);
 
-				for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
-				        $explode_v6[$i] = $explode_v6prefix[$i];
+		//* Add vhost for IPv6 IP
+		if($data['new']['ipv6_address'] != '') {
+			if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
+				if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
+					$explode_v6prefix=explode(':', $conf['serverconfig']['server']['v6_prefix']);
+					$explode_v6=explode(':', $data['new']['ipv6_address']);
+
+					for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
+						$explode_v6[$i] = $explode_v6prefix[$i];
+					}
+					$data['new']['ipv6_address'] = implode(':', $explode_v6);
 				}
-				$data['new']['ipv6_address'] = implode(':',$explode_v6);
 			}
-		}
-			
+
 			$tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80);
 			if(count($rewrite_rules) > 0)  $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
 			if(count($alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $alias_seo_redirects);
 			$vhosts[] = $tmp_vhost_arr;
 			unset($tmp_vhost_arr);
-		
+
 			//* Add vhost for ipv6 IP with SSL
 			if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
 				$tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 1, 'port' => '443');
@@ -1375,16 +1377,16 @@
 				if(count($ipv6_ssl_alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv6_ssl_alias_seo_redirects);
 				$vhosts[] = $tmp_vhost_arr;
 				unset($tmp_vhost_arr, $ipv6_ssl_alias_seo_redirects);
-				$app->log('Enable SSL for IPv6: '.$domain,LOGLEVEL_DEBUG);
+				$app->log('Enable SSL for IPv6: '.$domain, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		//* Set the vhost loop
-		$tpl->setLoop('vhosts',$vhosts);
-		
+		$tpl->setLoop('vhosts', $vhosts);
+
 		//* Write vhost file
-		$app->system->file_put_contents($vhost_file,$tpl->grab());
-		$app->log('Writing the vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
+		$app->system->file_put_contents($vhost_file, $tpl->grab());
+		$app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 		/*
@@ -1396,21 +1398,21 @@
 		//* First we check if there is a old type of symlink and remove it
 		$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost');
 		if(is_link($vhost_symlink)) $app->system->unlink($vhost_symlink);
-		
+
 		//* Remove old or changed symlinks
 		if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') {
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		//* New symlink
 		if($data['new']['subdomain'] == '*') {
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
@@ -1418,8 +1420,8 @@
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
 		}
 		if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) {
-			symlink($vhost_file,$vhost_symlink);
-			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			symlink($vhost_file, $vhost_symlink);
+			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 		}
 
 		// remove old symlink and vhost file, if domain name of the site has changed
@@ -1427,72 +1429,72 @@
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
 			$app->system->unlink($vhost_file);
-			$app->log('Removing file: '.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG);
 		}
 
 		//* Create .htaccess and .htpasswd file for website statistics
 		//if(!is_file($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess') or $data['old']['document_root'] != $data['new']['document_root']) {
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats');
 		$ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user";
-		$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess',$ht_file);
-		$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess',0755);
+		$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file);
+		$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755);
 		unset($ht_file);
 		//}
 
 		if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
 			if(trim($data['new']['stats_password']) != '') {
 				$htp_file = 'admin:'.trim($data['new']['stats_password']);
-				$app->system->web_folder_protection($data['new']['document_root'],false);
-				$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats',$htp_file);
-				$app->system->web_folder_protection($data['new']['document_root'],true);
-				$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats',0755);
+				$app->system->web_folder_protection($data['new']['document_root'], false);
+				$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
+				$app->system->web_folder_protection($data['new']['document_root'], true);
+				$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
 				unset($htp_file);
 			}
 		}
-		
+
 		//* Create awstats configuration
 		if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
-			$this->awstats_update($data,$web_config);
+			$this->awstats_update($data, $web_config);
 		}
-		
-		$this->php_fpm_pool_update($data,$web_config,$pool_dir,$pool_name,$socket_dir);
-		
+
+		$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir);
+
 		if($web_config['check_apache_config'] == 'y') {
 			//* Test if apache starts with the new configuration file
-			$apache_online_status_before_restart = $this->_checkTcp('localhost',80);
-			$app->log('Apache status is: '.($apache_online_status_before_restart === true? 'running' : 'down'),LOGLEVEL_DEBUG);
+			$apache_online_status_before_restart = $this->_checkTcp('localhost', 80);
+			$app->log('Apache status is: '.($apache_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
 
-			$retval = $app->services->restartService('httpd','restart'); // $retval['retval'] is 0 on success and > 0 on failure
-			$app->log('Apache restart return value is: '.$retval['retval'],LOGLEVEL_DEBUG);
-			
+			$retval = $app->services->restartService('httpd', 'restart'); // $retval['retval'] is 0 on success and > 0 on failure
+			$app->log('Apache restart return value is: '.$retval['retval'], LOGLEVEL_DEBUG);
+
 			// wait a few seconds, before we test the apache status again
 			$apache_online_status_after_restart = false;
 			sleep(2);
 			for($i = 0; $i < 5; $i++) {
-				$apache_online_status_after_restart = $this->_checkTcp('localhost',80);
+				$apache_online_status_after_restart = $this->_checkTcp('localhost', 80);
 				if($apache_online_status_after_restart) break;
 				sleep(1);
 			}
 			//* Check if apache restarted successfully if it was online before
-			$app->log('Apache online status after restart is: '.($apache_online_status_after_restart === true? 'running' : 'down'),LOGLEVEL_DEBUG);
+			$app->log('Apache online status after restart is: '.($apache_online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
 			if($apache_online_status_before_restart && !$apache_online_status_after_restart || $retval['retval'] > 0) {
-				$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err',LOGLEVEL_WARN);
+				$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err', LOGLEVEL_WARN);
 				if(is_array($retval['output']) && !empty($retval['output'])){
-					$app->log('Reason for Apache restart failure: '.implode("\n", $retval['output']),LOGLEVEL_WARN);
+					$app->log('Reason for Apache restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN);
 					$app->dbmaster->datalogError(implode("\n", $retval['output']));
 				} else {
 					// if no output is given, check again
@@ -1528,19 +1530,19 @@
 					if($webserver_binary != ''){
 						exec($webserver_binary.' -t 2>&1', $tmp_output, $tmp_retval);
 						if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)){
-							$app->log('Reason for Apache restart failure: '.implode("\n", $tmp_output),LOGLEVEL_WARN);
+							$app->log('Reason for Apache restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN);
 							$app->dbmaster->datalogError(implode("\n", $tmp_output));
 						}
 						unset($tmp_output, $tmp_retval);
 					}
 				}
-				$app->system->copy($vhost_file,$vhost_file.'.err');
+				$app->system->copy($vhost_file, $vhost_file.'.err');
 				if(is_file($vhost_file.'~')) {
 					//* Copy back the last backup file
-					$app->system->copy($vhost_file.'~',$vhost_file);
+					$app->system->copy($vhost_file.'~', $vhost_file);
 				} else {
 					//* There is no backup file, so we create a empty vhost file with a warning message inside
-					$app->system->file_put_contents($vhost_file,"# Apache did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
+					$app->system->file_put_contents($vhost_file, "# Apache did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
 				}
 				if($this->ssl_certificate_changed === true) {
 
@@ -1551,46 +1553,46 @@
 					$csr_file = $ssl_dir.'/'.$domain.'.csr';
 					$crt_file = $ssl_dir.'/'.$domain.'.crt';
 					$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-					
+
 					//* Backup the files that might have caused the error
 					if(is_file($key_file)){
-						$app->system->copy($key_file,$key_file.'.err');
-						$app->system->chmod($key_file.'.err',0400);
+						$app->system->copy($key_file, $key_file.'.err');
+						$app->system->chmod($key_file.'.err', 0400);
 					}
 					if(is_file($key_file2)){
-						$app->system->copy($key_file2,$key_file2.'.err');
-						$app->system->chmod($key_file2.'.err',0400);
+						$app->system->copy($key_file2, $key_file2.'.err');
+						$app->system->chmod($key_file2.'.err', 0400);
 					}
-					if(is_file($csr_file)) $app->system->copy($csr_file,$csr_file.'.err');
-					if(is_file($crt_file)) $app->system->copy($crt_file,$crt_file.'.err');
-					if(is_file($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'.err');
-					
+					if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err');
+					if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err');
+					if(is_file($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'.err');
+
 					//* Restore the ~ backup files
-					if(is_file($key_file.'~')) $app->system->copy($key_file.'~',$key_file);
-					if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~',$key_file2);
-					if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~',$crt_file);
-					if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~',$csr_file);
-					if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~',$bundle_file);
-					
-					$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.',LOGLEVEL_WARN);
+					if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file);
+					if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2);
+					if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file);
+					if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file);
+					if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~', $bundle_file);
+
+					$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN);
 				}
-				
-				$app->services->restartService('httpd','restart');
+
+				$app->services->restartService('httpd', 'restart');
 			}
 		} else {
 			//* We do not check the apache config after changes (is faster)
 			if($apache_chrooted) {
-				$app->services->restartServiceDelayed('httpd','restart');
+				$app->services->restartServiceDelayed('httpd', 'restart');
 			} else {
 				// request a httpd reload when all records have been processed
-				$app->services->restartServiceDelayed('httpd','reload');
+				$app->services->restartServiceDelayed('httpd', 'reload');
 			}
 		}
-		
-		//* The vhost is written and apache has been restarted, so we 
+
+		//* The vhost is written and apache has been restarted, so we
 		// can reset the ssl changed var to false and cleanup some files
 		$this->ssl_certificate_changed = false;
-		
+
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key.org';
@@ -1598,13 +1600,13 @@
 		$csr_file = $ssl_dir.'/'.$domain.'.csr';
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
 		$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-		
+
 		if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~');
 		if(@is_file($key2_file.'~')) $app->system->unlink($key2_file.'~');
 		if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~');
 		if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~');
 		if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~');
-		
+
 		// Remove the backup copy of the config file.
 		if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~');
 
@@ -1613,7 +1615,7 @@
 
 	}
 
-	function delete($event_name,$data) {
+	function delete($event_name, $data) {
 		global $app, $conf;
 
 		// load the server configuration options
@@ -1621,8 +1623,8 @@
 		$app->uses('system');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
 		$fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
-		
-		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'],false);
+
+		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'], false);
 
 		//* Check if this is a chrooted setup
 		if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
@@ -1630,12 +1632,12 @@
 		} else {
 			$apache_chrooted = false;
 		}
-		
+
 		//* Remove the mounts
 		$log_folder = 'log';
-        $web_folder = '';
-        if($data['old']['type'] == 'vhostsubdomain') {
-            $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
+		$web_folder = '';
+		if($data['old']['type'] == 'vhostsubdomain') {
+			$tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
 			if($tmp['domain'] != ''){
 				$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
 			} else {
@@ -1657,7 +1659,7 @@
 				*/
 				// we are deleting the parent domain, so we can delete everything in the log directory
 				$subdomain_hosts = array();
-				$files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.','..'));
+				$files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..'));
 				if(is_array($files) && !empty($files)){
 					foreach($files as $file){
 						if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){
@@ -1666,7 +1668,7 @@
 					}
 				}
 			}
-            if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){
+			if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){
 				$log_folders = array();
 				foreach($subdomain_hosts as $subdomain_host){
 					$log_folders[] = $log_folder.'/'.$subdomain_host;
@@ -1676,10 +1678,10 @@
 				$log_folder .= '/' . $subdomain_host;
 			}
 			$web_folder = $data['old']['web_folder'];
-            unset($tmp);
+			unset($tmp);
 			unset($subdomain_hosts);
 		}
-        
+
 		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain'){
 			if(is_array($log_folders) && !empty($log_folders)){
 				foreach($log_folders as $log_folder){
@@ -1691,16 +1693,16 @@
 				exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
 			}
 		}
-		
+
 		//* remove mountpoint from fstab
 		if(is_array($log_folders) && !empty($log_folders)){
 			foreach($log_folders as $log_folder){
 				$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-				$app->system->removeLine('/etc/fstab',$fstab_line);
+				$app->system->removeLine('/etc/fstab', $fstab_line);
 			}
 		} else {
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
+			$app->system->removeLine('/etc/fstab', $fstab_line);
 		}
 		unset($log_folders);
 
@@ -1712,191 +1714,191 @@
 			$data['old'] = $tmp;
 			$this->action = 'update';
 			// just run the update function
-			$this->update($event_name,$data);
+			$this->update($event_name, $data);
 
 		} else {
 			//* This is a website
 			// Deleting the vhost file, symlink and the data directory
 			$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
-			
+
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
-			
+
 			$app->system->unlink($vhost_file);
-			$app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
-            
-            if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
-                $docroot = escapeshellcmd($data['old']['document_root']);
-                if($docroot != '' && !stristr($docroot,'..')) {
-                    if($data['old']['type'] == 'vhost') {
-                        // this is a vhost - we delete everything in here.
-                        exec('rm -rf '.$docroot);
-                    } elseif(!stristr($data['old']['web_folder'], '..')) {
-                        // this is a vhost subdomain
-                        // IMPORTANT: do some folder checks before we delete this!
-                        $do_delete = true;
-                        $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
-                        if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
-                        if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
-                        
-                        $path_elements = explode('/', $delete_folder);
-                        
-                        if($path_elements[0] == 'web' || $path_elements[0] === '') {
-                            // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
-                            // we use strict check as otherwise directories named '0' may not be deleted
-                            $do_delete = false;
-                        } else {
-                            // read all vhost subdomains with same parent domain
-                            $used_paths = array();
-                            $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
-                            foreach($tmp as $tmprec) {
-                                // we normalize the folder entries because we need to compare them
-                                $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
-                                if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
-                                if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
-                                
-                                // add this path and it's parent paths to used_paths array
-                                while(strpos($tmp_folder, '/') !== false) {
-                                    if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
-                                    $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
-                                }
-                                if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
-                            }
-                            unset($tmp);
-                            
-                            // loop and check if the path is still used and stop at first used one
-                            // set do_delete to false so nothing gets deleted if the web_folder itself is still used
-                            $do_delete = false;
-                            while(count($path_elements) > 0) {
-                                $tmp_folder = implode('/', $path_elements);
-                                if(in_array($tmp_folder, $used_paths) == true) break;
-                                
-                                // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
-                                $delete_folder = $tmp_folder;
-                                $do_delete = true;
-                                array_pop($path_elements);
-                            }
-                            unset($tmp_folder);
-                            unset($used_paths);
-                        }
-                        
-                        if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
-                        
-                        unset($delete_folder);
-                        unset($path_elements);
-                    }
-                }
-			
-                //remove the php fastgi starter script if available
-                if ($data['old']['php'] == 'fast-cgi') {
-                    $fastcgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$fastcgi_config['fastcgi_starter_path']);
-                    if($data['old']['type'] == 'vhost') {
-                        if (is_dir($fastcgi_starter_path)) {
-                            exec('rm -rf '.$fastcgi_starter_path);
-                        }
-                    } else {
-                        $fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
-                        if (file_exists($fcgi_starter_script)) {
-                            exec('rm -f '.$fcgi_starter_script);
-                        }
-                    }
-                }
-                
-                // remove PHP-FPM pool
-                if ($data['old']['php'] == 'php-fpm') {
-                    $this->php_fpm_pool_delete($data,$web_config);
-                }
+			$app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
 
-                //remove the php cgi starter script if available
-                if ($data['old']['php'] == 'cgi') {
-                    // TODO: fetch the date from the server-settings
-                    $web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+			if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
+				$docroot = escapeshellcmd($data['old']['document_root']);
+				if($docroot != '' && !stristr($docroot, '..')) {
+					if($data['old']['type'] == 'vhost') {
+						// this is a vhost - we delete everything in here.
+						exec('rm -rf '.$docroot);
+					} elseif(!stristr($data['old']['web_folder'], '..')) {
+						// this is a vhost subdomain
+						// IMPORTANT: do some folder checks before we delete this!
+						$do_delete = true;
+						$delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
+						if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
+						if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
 
-                    $cgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$web_config['cgi_starter_path']);
-                    if($data['old']['type'] == 'vhost') {
-                        if (is_dir($cgi_starter_path)) {
-                            exec('rm -rf '.$cgi_starter_path);
-                        }
-                    } else {
-                        $cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
-                        if (file_exists($cgi_starter_script)) {
-                            exec('rm -f '.$cgi_starter_script);
-                        }
-                    }
-                }
-            
-                $app->log('Removing website: '.$docroot,LOGLEVEL_DEBUG);
+						$path_elements = explode('/', $delete_folder);
 
-                // Delete the symlinks for the sites
-                $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
-                $client_id = intval($client['client_id']);
-                unset($client);
-                $tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
-                if(is_array($tmp_symlinks_array)) {
-                    foreach($tmp_symlinks_array as $tmp_symlink) {
-                        $tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-                        $tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
-                        // Remove trailing slash
-                        if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
-                        // delete the symlink
-                        if(is_link($tmp_symlink)) {
-                            $app->system->unlink($tmp_symlink);
-                            $app->log('Removing symlink: '.$tmp_symlink,LOGLEVEL_DEBUG);
-                        }
-                    }
-                }
-                // end removing symlinks
-            }
+						if($path_elements[0] == 'web' || $path_elements[0] === '') {
+							// paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
+							// we use strict check as otherwise directories named '0' may not be deleted
+							$do_delete = false;
+						} else {
+							// read all vhost subdomains with same parent domain
+							$used_paths = array();
+							$tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
+							foreach($tmp as $tmprec) {
+								// we normalize the folder entries because we need to compare them
+								$tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
+								if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
+								if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
 
-            // Delete the log file directory
-            $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
-            if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir,'..')) exec('rm -rf '.$vhost_logfile_dir);
-            $app->log('Removing website logfile directory: '.$vhost_logfile_dir,LOGLEVEL_DEBUG);
-            
-            if($data['old']['type'] == 'vhost') {
-                //delete the web user
-                $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
-                $command .= ' '.escapeshellcmd($data['old']['system_user']);
-                exec($command);
-                if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
-                
-            }
-            
-            //* Remove the awstats configuration file
-            if($data['old']['stats_type'] == 'awstats') {
-                $this->awstats_delete($data,$web_config);
-            }
-			
-			if($data['old']['type'] == 'vhostsubdomain') {
-				$app->system->web_folder_protection($parent_web_document_root,true);
+								// add this path and it's parent paths to used_paths array
+								while(strpos($tmp_folder, '/') !== false) {
+									if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+									$tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
+								}
+								if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+							}
+							unset($tmp);
+
+							// loop and check if the path is still used and stop at first used one
+							// set do_delete to false so nothing gets deleted if the web_folder itself is still used
+							$do_delete = false;
+							while(count($path_elements) > 0) {
+								$tmp_folder = implode('/', $path_elements);
+								if(in_array($tmp_folder, $used_paths) == true) break;
+
+								// this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
+								$delete_folder = $tmp_folder;
+								$do_delete = true;
+								array_pop($path_elements);
+							}
+							unset($tmp_folder);
+							unset($used_paths);
+						}
+
+						if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
+
+						unset($delete_folder);
+						unset($path_elements);
+					}
+				}
+
+				//remove the php fastgi starter script if available
+				if ($data['old']['php'] == 'fast-cgi') {
+					$fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+					if($data['old']['type'] == 'vhost') {
+						if (is_dir($fastcgi_starter_path)) {
+							exec('rm -rf '.$fastcgi_starter_path);
+						}
+					} else {
+						$fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
+						if (file_exists($fcgi_starter_script)) {
+							exec('rm -f '.$fcgi_starter_script);
+						}
+					}
+				}
+
+				// remove PHP-FPM pool
+				if ($data['old']['php'] == 'php-fpm') {
+					$this->php_fpm_pool_delete($data, $web_config);
+				}
+
+				//remove the php cgi starter script if available
+				if ($data['old']['php'] == 'cgi') {
+					// TODO: fetch the date from the server-settings
+					$web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+
+					$cgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['cgi_starter_path']);
+					if($data['old']['type'] == 'vhost') {
+						if (is_dir($cgi_starter_path)) {
+							exec('rm -rf '.$cgi_starter_path);
+						}
+					} else {
+						$cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
+						if (file_exists($cgi_starter_script)) {
+							exec('rm -f '.$cgi_starter_script);
+						}
+					}
+				}
+
+				$app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG);
+
+				// Delete the symlinks for the sites
+				$client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
+				$client_id = intval($client['client_id']);
+				unset($client);
+				$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+				if(is_array($tmp_symlinks_array)) {
+					foreach($tmp_symlinks_array as $tmp_symlink) {
+						$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+						$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+						// Remove trailing slash
+						if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+						// delete the symlink
+						if(is_link($tmp_symlink)) {
+							$app->system->unlink($tmp_symlink);
+							$app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG);
+						}
+					}
+				}
+				// end removing symlinks
 			}
-			
+
+			// Delete the log file directory
+			$vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
+			if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir);
+			$app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG);
+
+			if($data['old']['type'] == 'vhost') {
+				//delete the web user
+				$command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
+				$command .= ' '.escapeshellcmd($data['old']['system_user']);
+				exec($command);
+				if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+			}
+
+			//* Remove the awstats configuration file
+			if($data['old']['stats_type'] == 'awstats') {
+				$this->awstats_delete($data, $web_config);
+			}
+
+			if($data['old']['type'] == 'vhostsubdomain') {
+				$app->system->web_folder_protection($parent_web_document_root, true);
+			}
+
 			if($apache_chrooted) {
-				$app->services->restartServiceDelayed('httpd','restart');
+				$app->services->restartServiceDelayed('httpd', 'restart');
 			} else {
 				// request a httpd reload when all records have been processed
-				$app->services->restartServiceDelayed('httpd','reload');
+				$app->services->restartServiceDelayed('httpd', 'reload');
 			}
 
 		}
-        if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'],true);
+		if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true);
 	}
 
 	//* This function is called when a IP on the server is inserted, updated or deleted
-	function server_ip($event_name,$data) {
+	function server_ip($event_name, $data) {
 		global $app, $conf;
 
 		// load the server configuration options
@@ -1908,7 +1910,7 @@
 		$tpl = new tpl();
 		$tpl->newTemplate('apache_ispconfig.conf.master');
 		$records = $app->db->queryAllRecords('SELECT * FROM server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
-		
+
 		$records_out= array();
 		if(is_array($records)) {
 			foreach($records as $rec) {
@@ -1917,7 +1919,7 @@
 				} else {
 					$ip_address = $rec['ip_address'];
 				}
-				$ports = explode(',',$rec['virtualhost_port']);
+				$ports = explode(',', $rec['virtualhost_port']);
 				if(is_array($ports)) {
 					foreach($ports as $port) {
 						$port = intval($port);
@@ -1928,70 +1930,70 @@
 				}
 			}
 		}
-		
-		
+
+
 		if(count($records_out) > 0) {
-			$tpl->setLoop('ip_adresses',$records_out);
+			$tpl->setLoop('ip_adresses', $records_out);
 		}
 
 		$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/ispconfig.conf');
-		$app->system->file_put_contents($vhost_file,$tpl->grab());
-		$app->log('Writing the conf file: '.$vhost_file,LOGLEVEL_DEBUG);
+		$app->system->file_put_contents($vhost_file, $tpl->grab());
+		$app->log('Writing the conf file: '.$vhost_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 	}
-	
+
 	//* Create or update the .htaccess folder protection
-	function web_folder_user($event_name,$data) {
+	function web_folder_user($event_name, $data) {
 		global $app, $conf;
 
 		$app->uses('system');
-		
+
 		if($event_name == 'web_folder_user_delete') {
 			$folder_id = $data['old']['web_folder_id'];
 		} else {
 			$folder_id = $data['new']['web_folder_id'];
 		}
-		
+
 		$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".intval($folder_id));
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
-		
+
 		if(!is_array($folder) or !is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($folder['path'],0,1) == '/') $folder['path'] = substr($folder['path'],1);
-		if(substr($folder['path'],-1) == '/') $folder['path'] = substr($folder['path'],0,-1);
+		if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+		if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
 		$folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
-		if(substr($folder_path,-1) != '/') $folder_path .= '/';
-		
+		if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(stristr($folder_path,'..') || stristr($folder_path,'./') || stristr($folder_path,'\\')) {
-			$app->log('Folder path "'.$folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) {
+			$app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Create the folder path, if it does not exist
 		if(!is_dir($folder_path)) {
 			$app->system->mkdirpath($folder_path);
-			$app->system->chown($folder_path,$website['system_user']);
-			$app->system->chgrp($folder_path,$website['system_group']);
+			$app->system->chown($folder_path, $website['system_user']);
+			$app->system->chgrp($folder_path, $website['system_group']);
 		}
-		
+
 		//* Create empty .htpasswd file, if it does not exist
 		if(!is_file($folder_path.'.htpasswd')) {
 			$app->system->touch($folder_path.'.htpasswd');
-			$app->system->chmod($folder_path.'.htpasswd',0750);
-			$app->system->chown($folder_path.'.htpasswd',$website['system_user']);
-			$app->system->chgrp($folder_path.'.htpasswd',$website['system_group']);
-			$app->log('Created file '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+			$app->system->chmod($folder_path.'.htpasswd', 0750);
+			$app->system->chown($folder_path.'.htpasswd', $website['system_user']);
+			$app->system->chgrp($folder_path.'.htpasswd', $website['system_group']);
+			$app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 		}
-		
+
 		/*
 		$auth_users = $app->db->queryAllRecords("SELECT * FROM web_folder_user WHERE active = 'y' AND web_folder_id = ".intval($folder_id));
 		$htpasswd_content = '';
@@ -2004,241 +2006,241 @@
 		@file_put_contents($folder_path.'.htpasswd', $htpasswd_content);
 		$app->log('Changed .htpasswd file: '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
 		*/
-		
+
 		if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') {
-			$app->system->removeLine($folder_path.'.htpasswd',$data['old']['username'].':');
-			$app->log('Removed user: '.$data['old']['username'],LOGLEVEL_DEBUG);
+			$app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+			$app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Add or remove the user from .htpasswd file
 		if($event_name == 'web_folder_user_delete') {
-			$app->system->removeLine($folder_path.'.htpasswd',$data['old']['username'].':');
-			$app->log('Removed user: '.$data['old']['username'],LOGLEVEL_DEBUG);
+			$app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+			$app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
 		} else {
 			if($data['new']['active'] == 'y') {
-				$app->system->replaceLine($folder_path.'.htpasswd',$data['new']['username'].':',$data['new']['username'].':'.$data['new']['password'],0,1);
-				$app->log('Added or updated user: '.$data['new']['username'],LOGLEVEL_DEBUG);
+				$app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1);
+				$app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG);
 			}
 		}
-		
-		
+
+
 		//* Create the .htaccess file
 		//if(!is_file($folder_path.'.htaccess')) {
-			$begin_marker = '### ISPConfig folder protection begin ###';
-            $end_marker = "### ISPConfig folder protection end ###\n\n";
-            $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
-			
-            if(file_exists($folder_path.'.htaccess')) {
-                $old_content = $app->system->file_get_contents($folder_path.'.htaccess');
-                
-                if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
-                    $ht_file = str_replace($matches[0], $ht_file, $old_content);
-                } else {
-                    $ht_file .= $old_content;
-                }
-            }
-            unset($old_content);
-            
-            $app->system->file_put_contents($folder_path.'.htaccess',$ht_file);
-			$app->system->chmod($folder_path.'.htaccess',0750);
-			$app->system->chown($folder_path.'.htaccess',$website['system_user']);
-			$app->system->chgrp($folder_path.'.htaccess',$website['system_group']);
-			$app->log('Created/modified file '.$folder_path.'.htaccess',LOGLEVEL_DEBUG);
+		$begin_marker = '### ISPConfig folder protection begin ###';
+		$end_marker = "### ISPConfig folder protection end ###\n\n";
+		$ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
+
+		if(file_exists($folder_path.'.htaccess')) {
+			$old_content = $app->system->file_get_contents($folder_path.'.htaccess');
+
+			if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
+				$ht_file = str_replace($matches[0], $ht_file, $old_content);
+			} else {
+				$ht_file .= $old_content;
+			}
+		}
+		unset($old_content);
+
+		$app->system->file_put_contents($folder_path.'.htaccess', $ht_file);
+		$app->system->chmod($folder_path.'.htaccess', 0750);
+		$app->system->chown($folder_path.'.htaccess', $website['system_user']);
+		$app->system->chgrp($folder_path.'.htaccess', $website['system_group']);
+		$app->log('Created/modified file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
 		//}
-		
+
 	}
-	
+
 	//* Remove .htaccess and .htpasswd file, when folder protection is removed
-	function web_folder_delete($event_name,$data) {
+	function web_folder_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$folder_id = $data['old']['web_folder_id'];
-		
+
 		$folder = $data['old'];
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
-		
+
 		if(!is_array($folder) or !is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($folder['path'],0,1) == '/') $folder['path'] = substr($folder['path'],1);
-		if(substr($folder['path'],-1) == '/') $folder['path'] = substr($folder['path'],0,-1);
+		if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+		if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
 		$folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
-		if(substr($folder_path,-1) != '/') $folder_path .= '/';
-		
+		if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(substr($folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('Folder path is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Remove .htpasswd file
 		if(is_file($folder_path.'.htpasswd')) {
 			$app->system->unlink($folder_path.'.htpasswd');
-			$app->log('Removed file '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+			$app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Remove .htaccess file
 		if(is_file($folder_path.'.htaccess')) {
-            $begin_marker = '### ISPConfig folder protection begin ###';
-            $end_marker = "### ISPConfig folder protection end ###\n\n";
-            
-            $ht_file = $app->system->file_get_contents($folder_path.'.htaccess');
-            
-            if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
-                $ht_file = str_replace($matches[0], '', $ht_file);
-            } else {
-                $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
-            }
-            
-            if(trim($ht_file) == '') {
-                $app->system->unlink($folder_path.'.htaccess');
-                $app->log('Removed file '.$folder_path.'.htaccess',LOGLEVEL_DEBUG);
-            } else {
-                $app->system->file_put_contents($folder_path.'.htaccess', $ht_file);
-                $app->log('Removed protection content from file '.$folder_path.'.htaccess',LOGLEVEL_DEBUG);
-            }
+			$begin_marker = '### ISPConfig folder protection begin ###';
+			$end_marker = "### ISPConfig folder protection end ###\n\n";
+
+			$ht_file = $app->system->file_get_contents($folder_path.'.htaccess');
+
+			if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+				$ht_file = str_replace($matches[0], '', $ht_file);
+			} else {
+				$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+			}
+
+			if(trim($ht_file) == '') {
+				$app->system->unlink($folder_path.'.htaccess');
+				$app->log('Removed file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			} else {
+				$app->system->file_put_contents($folder_path.'.htaccess', $ht_file);
+				$app->log('Removed protection content from file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			}
 		}
 	}
-	
+
 	//* Update folder protection, when path has been changed
-	function web_folder_update($event_name,$data) {
+	function web_folder_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-	
+
 		if(!is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($data['old']['path'],0,1) == '/') $data['old']['path'] = substr($data['old']['path'],1);
-		if(substr($data['old']['path'],-1) == '/') $data['old']['path'] = substr($data['old']['path'],0,-1);
+		if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1);
+		if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1);
 		$old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']);
-		if(substr($old_folder_path,-1) != '/') $old_folder_path .= '/';
-			
-		if(substr($data['new']['path'],0,1) == '/') $data['new']['path'] = substr($data['new']['path'],1);
-		if(substr($data['new']['path'],-1) == '/') $data['new']['path'] = substr($data['new']['path'],0,-1);
+		if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/';
+
+		if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1);
+		if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1);
 		$new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']);
-		if(substr($new_folder_path,-1) != '/') $new_folder_path .= '/';
-		
+		if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(stristr($new_folder_path,'..') || stristr($new_folder_path,'./') || stristr($new_folder_path,'\\')) {
-			$app->log('Folder path "'.$new_folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) {
+			$app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		if(stristr($old_folder_path,'..') || stristr($old_folder_path,'./') || stristr($old_folder_path,'\\')) {
-			$app->log('Folder path "'.$old_folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) {
+			$app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Check if the resulting path is inside the docroot
-		if(substr($old_folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('Old folder path '.$old_folder_path.' is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		if(substr($new_folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('New folder path '.$new_folder_path.' is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-			
+
 		//* Create the folder path, if it does not exist
 		if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path);
-		
-        $begin_marker = '### ISPConfig folder protection begin ###';
-        $end_marker = "### ISPConfig folder protection end ###\n\n";
-        
+
+		$begin_marker = '### ISPConfig folder protection begin ###';
+		$end_marker = "### ISPConfig folder protection end ###\n\n";
+
 		if($data['old']['path'] != $data['new']['path']) {
 
-		
+
 			//* move .htpasswd file
 			if(is_file($old_folder_path.'.htpasswd')) {
-				$app->system->rename($old_folder_path.'.htpasswd',$new_folder_path.'.htpasswd');
-				$app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+				$app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd');
+				$app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 			}
-			
+
 			//* delete old .htaccess file
 			if(is_file($old_folder_path.'.htaccess')) {
-                $ht_file = $app->system->file_get_contents($old_folder_path.'.htaccess');
-                
-                if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
-                    $ht_file = str_replace($matches[0], '', $ht_file);
-                } else {
-                    $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$old_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
-                }
-                
-                if(trim($ht_file) == '') {
-                    $app->system->unlink($old_folder_path.'.htaccess');
-                    $app->log('Removed file '.$old_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-                } else {
-                    $app->system->file_put_contents($old_folder_path.'.htaccess', $ht_file);
-                    $app->log('Removed protection content from file '.$old_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-                }
+				$ht_file = $app->system->file_get_contents($old_folder_path.'.htaccess');
+
+				if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+					$ht_file = str_replace($matches[0], '', $ht_file);
+				} else {
+					$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$old_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+				}
+
+				if(trim($ht_file) == '') {
+					$app->system->unlink($old_folder_path.'.htaccess');
+					$app->log('Removed file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+				} else {
+					$app->system->file_put_contents($old_folder_path.'.htaccess', $ht_file);
+					$app->log('Removed protection content from file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+				}
 			}
-		
+
 		}
-		
+
 		//* Create the .htaccess file
 		if($data['new']['active'] == 'y') {
-            $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
-			
-            if(file_exists($new_folder_path.'.htaccess')) {
-                $old_content = $app->system->file_get_contents($new_folder_path.'.htaccess');
-                
-                if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
-                    $ht_file = str_replace($matches[0], $ht_file, $old_content);
-                } else {
-                    $ht_file .= $old_content;
-                }
-            }
-            
-            $app->system->file_put_contents($new_folder_path.'.htaccess',$ht_file);
-			$app->system->chmod($new_folder_path.'.htaccess',0750);
-			$app->system->chown($new_folder_path.'.htaccess',$website['system_user']);
-			$app->system->chgrp($new_folder_path.'.htaccess',$website['system_group']);
-			$app->log('Created/modified file '.$new_folder_path.'.htaccess',LOGLEVEL_DEBUG);
+			$ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
+
+			if(file_exists($new_folder_path.'.htaccess')) {
+				$old_content = $app->system->file_get_contents($new_folder_path.'.htaccess');
+
+				if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
+					$ht_file = str_replace($matches[0], $ht_file, $old_content);
+				} else {
+					$ht_file .= $old_content;
+				}
+			}
+
+			$app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file);
+			$app->system->chmod($new_folder_path.'.htaccess', 0750);
+			$app->system->chown($new_folder_path.'.htaccess', $website['system_user']);
+			$app->system->chgrp($new_folder_path.'.htaccess', $website['system_group']);
+			$app->log('Created/modified file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Remove .htaccess file
 		if($data['new']['active'] == 'n' && is_file($new_folder_path.'.htaccess')) {
-            $ht_file = $app->system->file_get_contents($new_folder_path.'.htaccess');
-            
-            if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
-                $ht_file = str_replace($matches[0], '', $ht_file);
-            } else {
-                $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
-            }
-            
-            if(trim($ht_file) == '') {
-                $app->system->unlink($new_folder_path.'.htaccess');
-                $app->log('Removed file '.$new_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-            } else {
-                $app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file);
-                $app->log('Removed protection content from file '.$new_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-            }
+			$ht_file = $app->system->file_get_contents($new_folder_path.'.htaccess');
+
+			if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+				$ht_file = str_replace($matches[0], '', $ht_file);
+			} else {
+				$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+			}
+
+			if(trim($ht_file) == '') {
+				$app->system->unlink($new_folder_path.'.htaccess');
+				$app->log('Removed file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			} else {
+				$app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file);
+				$app->log('Removed protection content from file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			}
 		}
-		
-		
+
+
 	}
-	
-	public function ftp_user_delete($event_name,$data) {
+
+	public function ftp_user_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$ftpquota_file = $data['old']['dir'].'/.ftpquota';
 		if(file_exists($ftpquota_file)) $app->system->unlink($ftpquota_file);
-		
+
 	}
-	
-	
+
+
 
 	/**
 	 * This function is called when a Webdav-User is inserted, updated or deleted.
@@ -2247,9 +2249,9 @@
 	 * @param string $event_name
 	 * @param array $data
 	 */
-	public function webdav($event_name,$data) {
+	public function webdav($event_name, $data) {
 		global $app, $conf;
-		
+
 		/*
 		 * load the server configuration options
 		*/
@@ -2271,20 +2273,20 @@
 			/* Check if this is a chrooted setup */
 			if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
 				$apache_chrooted = true;
-				$app->log('Info: Apache is chrooted.',LOGLEVEL_DEBUG);
+				$app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG);
 			} else {
 				$apache_chrooted = false;
 			}
-			
+
 			//* We dont want to have relative paths here
-			if(stristr($webdav_user_dir,'..')  || stristr($webdav_user_dir,'./')) {
-				$app->log('Folder path '.$webdav_user_dir.' contains ./ or .. '.$documentRoot,LOGLEVEL_WARN);
+			if(stristr($webdav_user_dir, '..')  || stristr($webdav_user_dir, './')) {
+				$app->log('Folder path '.$webdav_user_dir.' contains ./ or .. '.$documentRoot, LOGLEVEL_WARN);
 				return false;
 			}
-			
+
 			//* Check if the resulting path exists if yes, if it is inside the docroot
-			if(is_dir($webdav_user_dir) && substr(realpath($webdav_user_dir),0,strlen($documentRoot)) != $documentRoot) {
-				$app->log('Folder path '.$webdav_user_dir.' is outside of docroot '.$documentRoot,LOGLEVEL_WARN);
+			if(is_dir($webdav_user_dir) && substr(realpath($webdav_user_dir), 0, strlen($documentRoot)) != $documentRoot) {
+				$app->log('Folder path '.$webdav_user_dir.' is outside of docroot '.$documentRoot, LOGLEVEL_WARN);
 				return false;
 			}
 
@@ -2292,7 +2294,7 @@
 			 * First the webdav-root - folder has to exist
 			*/
 			if(!is_dir($webdav_user_dir)) {
-				$app->log('Webdav User directory '.$webdav_user_dir.' does not exist. Creating it now.',LOGLEVEL_DEBUG);
+				$app->log('Webdav User directory '.$webdav_user_dir.' does not exist. Creating it now.', LOGLEVEL_DEBUG);
 				$app->system->mkdirpath($webdav_user_dir);
 			}
 
@@ -2301,9 +2303,9 @@
 			*/
 			//$this->_exec('chown ' . $user . ':' . $group . ' ' . escapeshellcmd($documentRoot . '/webdav/'));
 			//$this->_exec('chmod 770 ' . escapeshellcmd($documentRoot . '/webdav/'));
-			$app->system->chown($documentRoot . '/webdav',$user);
-			$app->system->chgrp($documentRoot . '/webdav',$group);
-			$app->system->chmod($documentRoot . '/webdav',0770);
+			$app->system->chown($documentRoot . '/webdav', $user);
+			$app->system->chgrp($documentRoot . '/webdav', $group);
+			$app->system->chmod($documentRoot . '/webdav', 0770);
 
 			/*
 			 * The webdav folder (not the webdav-root!) needs the same (not in ONE step, because the
@@ -2311,9 +2313,9 @@
 			*/
 			//$this->_exec('chown ' . $user . ':' . $group . ' ' . escapeshellcmd($webdav_user_dir.' -R'));
 			//$this->_exec('chmod 770 ' . escapeshellcmd($webdav_user_dir.' -R'));
-			$app->system->chown($webdav_user_dir,$user);
-			$app->system->chgrp($webdav_user_dir,$group);
-			$app->system->chmod($webdav_user_dir,0770);
+			$app->system->chown($webdav_user_dir, $user);
+			$app->system->chgrp($webdav_user_dir, $group);
+			$app->system->chmod($webdav_user_dir, 0770);
 
 			/*
 			 * if the user is active, we have to write/update the password - file
@@ -2337,10 +2339,10 @@
 			 * Last, restart apache
 			*/
 			if($apache_chrooted) {
-				$app->services->restartServiceDelayed('httpd','restart');
+				$app->services->restartServiceDelayed('httpd', 'restart');
 			} else {
 				// request a httpd reload when all records have been processed
-				$app->services->restartServiceDelayed('httpd','reload');
+				$app->services->restartServiceDelayed('httpd', 'reload');
 			}
 
 		}
@@ -2358,21 +2360,21 @@
 			 * So the only thing, we have to do, is to delete the user from the password-file
 			*/
 			$this->_writeHtDigestFile( $documentRoot . '/webdav/' . $data['old']['dir'] . '.htdigest', $data['old']['username'], $data['old']['dir'], '');
-			
+
 			/*
 			 * Next step, patch the vhost - file
 			*/
 			$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'] . '/' . $domain . '.vhost');
 			$this->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav');
-			
+
 			/*
 			 * Last, restart apache
 			*/
 			if($apache_chrooted) {
-				$app->services->restartServiceDelayed('httpd','restart');
+				$app->services->restartServiceDelayed('httpd', 'restart');
 			} else {
 				// request a httpd reload when all records have been processed
-				$app->services->restartServiceDelayed('httpd','reload');
+				$app->services->restartServiceDelayed('httpd', 'reload');
 			}
 		}
 	}
@@ -2389,7 +2391,7 @@
 	 */
 	private function _writeHtDigestFile($filename, $username, $authname, $pwdhash ) {
 		global $app;
-		
+
 		$changed = false;
 		if(is_file($filename) && !is_link($filename)) {
 			$in = fopen($filename, 'r');
@@ -2406,7 +2408,7 @@
 					*/
 					if ($pwdhash != '') {
 						$output .= $tmp[0] . ':' . $tmp[1] . ':' . $pwdhash . "\n";
-						}
+					}
 					$changed = true;
 				}
 				else {
@@ -2421,7 +2423,7 @@
 		if (!$changed) {
 			$output .= $username . ':' . $authname . ':' . $pwdhash . "\n";
 		}
-		
+
 
 		/*
 		 * Now lets write the new file
@@ -2467,29 +2469,29 @@
 				*/
 				$files = @scandir($webdavRoot);
 				if(is_array($files)) {
-				foreach($files as $file) {
-					if (substr($file, strlen($file) - strlen('.htdigest')) == '.htdigest' && preg_match("/^[a-zA-Z0-9\-_\.]*$/",$file)) {
-						/*
+					foreach($files as $file) {
+						if (substr($file, strlen($file) - strlen('.htdigest')) == '.htdigest' && preg_match("/^[a-zA-Z0-9\-_\.]*$/", $file)) {
+							/*
 						 * found a htdigest - file, so add it to webdav
 						*/
-						$fn = substr($file, 0, strlen($file) - strlen('.htdigest'));
-						$output .= "\n";
-						// $output .= "      Alias /" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
-						// $output .= "      <Location /" . $fn . ">\n";
-						$output .= "      Alias /webdav/" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
-						$output .= "      <Location /webdav/" . $fn . ">\n";
-						$output .= "        DAV On\n";
-						$output .= '        BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On'."\n";
-						$output .= "        AuthType Digest\n";
-						$output .= "        AuthName \"" . $fn . "\"\n";
-						$output .= "        AuthUserFile " . $webdavRoot . '/' . $file . "\n";
-						$output .= "        Require valid-user \n";
-						$output .= "        Options +Indexes \n";
-						$output .= "        Order allow,deny \n";
-						$output .= "        Allow from all \n";
-						$output .= "      </Location> \n";
+							$fn = substr($file, 0, strlen($file) - strlen('.htdigest'));
+							$output .= "\n";
+							// $output .= "      Alias /" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
+							// $output .= "      <Location /" . $fn . ">\n";
+							$output .= "      Alias /webdav/" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
+							$output .= "      <Location /webdav/" . $fn . ">\n";
+							$output .= "        DAV On\n";
+							$output .= '        BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On'."\n";
+							$output .= "        AuthType Digest\n";
+							$output .= "        AuthName \"" . $fn . "\"\n";
+							$output .= "        AuthUserFile " . $webdavRoot . '/' . $file . "\n";
+							$output .= "        Require valid-user \n";
+							$output .= "        Options +Indexes \n";
+							$output .= "        Order allow,deny \n";
+							$output .= "        Allow from all \n";
+							$output .= "      </Location> \n";
+						}
 					}
-				}
 				}
 			}
 			/*
@@ -2517,61 +2519,61 @@
 		$app->system->file_put_contents($fileName, $output);
 
 	}
-	
+
 	//* Update the awstats configuration file
-	private function awstats_update ($data,$web_config) {
+	private function awstats_update ($data, $web_config) {
 		global $app;
-		
-        $web_folder = $data['new']['web_folder'];
-        if($data['new']['type'] == 'vhost') $web_folder = 'web';
+
+		$web_folder = $data['new']['web_folder'];
+		if($data['new']['type'] == 'vhost') $web_folder = 'web';
 		$awstats_conf_dir = $web_config['awstats_conf_dir'];
-		
+
 		if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats");
 		if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
 			if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
 				$app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
 			}
-			
+
 			$content = '';
 			$content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
 			$content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n";
 			$content .= "SiteDomain=\"".$data['new']['domain']."\"\n";
 			$content .= "HostAliases=\"www.".$data['new']['domain']."  localhost 127.0.0.1\"\n";
-			
-			$app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',$content);
-			$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);
+
+			$app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content);
+			$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG);
 		}
-		
+
 		if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
 		if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
-			$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+			$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
 		} else {
-			$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+			$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
 		}
 	}
-	
+
 	//* Delete the awstats configuration file
-	private function awstats_delete ($data,$web_config) {
+	private function awstats_delete ($data, $web_config) {
 		global $app;
-		
+
 		$awstats_conf_dir = $web_config['awstats_conf_dir'];
-		
+
 		if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
 			$app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
-			$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf',LOGLEVEL_DEBUG);
+			$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG);
 		}
 	}
-	
+
 	//* Update the PHP-FPM pool configuration file
-	private function php_fpm_pool_update ($data,$web_config,$pool_dir,$pool_name,$socket_dir) {
+	private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir) {
 		global $app, $conf;
 		//$reload = false;
-		
+
 		if($data['new']['php'] == 'php-fpm'){
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
@@ -2579,15 +2581,15 @@
 			if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
 		}
-		
+
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		if($data['new']['php'] != 'php-fpm'){
 			if(@is_file($pool_dir.$pool_name.'.conf')){
 				$app->system->unlink($pool_dir.$pool_name.'.conf');
@@ -2595,15 +2597,15 @@
 			}
 			if($data['old']['php'] == 'php-fpm'){
 				if(!$default_php_fpm){
-					$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+					$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 				} else {
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+					$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 				}
 			}
 			//if($reload == true) $app->services->restartService('php-fpm','reload');
 			return;
 		}
-				
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate('php_fpm_pool.conf.master');
@@ -2618,10 +2620,10 @@
 		}
 		$tpl->setVar('use_tcp', $use_tcp);
 		$tpl->setVar('use_socket', $use_socket);
-			
+
 		$fpm_socket = $socket_dir.$pool_name.'.sock';
 		$tpl->setVar('fpm_socket', $fpm_socket);
-			
+
 		$tpl->setVar('fpm_pool', $pool_name);
 		$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
 		$tpl->setVar('fpm_user', $data['new']['system_user']);
@@ -2634,7 +2636,7 @@
 		$tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']);
 		$tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']);
 		$tpl->setVar('document_root', $data['new']['document_root']);
-		$tpl->setVar('security_level',$web_config['security_level']);
+		$tpl->setVar('security_level', $web_config['security_level']);
 		$php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);
 		$tpl->setVar('php_open_basedir', $php_open_basedir);
 		if($php_open_basedir != ''){
@@ -2642,7 +2644,7 @@
 		} else {
 			$tpl->setVar('enable_php_open_basedir', ';');
 		}
-			
+
 		// Custom php.ini settings
 		$final_php_ini_settings = array();
 		$custom_php_ini_settings = trim($data['new']['custom_php_ini']);
@@ -2654,59 +2656,59 @@
 			if(is_array($ini_settings) && !empty($ini_settings)){
 				foreach($ini_settings as $ini_setting){
 					$ini_setting = trim($ini_setting);
-					if(substr($ini_setting,0,1) == ';') continue;
-					if(substr($ini_setting,0,1) == '#') continue;
-					if(substr($ini_setting,0,2) == '//') continue;
+					if(substr($ini_setting, 0, 1) == ';') continue;
+					if(substr($ini_setting, 0, 1) == '#') continue;
+					if(substr($ini_setting, 0, 2) == '//') continue;
 					list($key, $value) = explode('=', $ini_setting);
 					if($value){
 						$value = trim($value);
 						$key = trim($key);
 						switch (strtolower($value)) {
-							case '0':
-								// PHP-FPM might complain about invalid boolean value if you use 0
-								$value = 'off';
-							case '1':
-							case 'on':
-							case 'off':
-							case 'true':
-							case 'false':
-							case 'yes':
-							case 'no':
-								$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
-								break;
-							default:
-								$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
+						case '0':
+							// PHP-FPM might complain about invalid boolean value if you use 0
+							$value = 'off';
+						case '1':
+						case 'on':
+						case 'off':
+						case 'true':
+						case 'false':
+						case 'yes':
+						case 'no':
+							$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
+							break;
+						default:
+							$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
 						}
 					}
 				}
 			}
 		}
-			
+
 		$tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
-			
-		$app->system->file_put_contents($pool_dir.$pool_name.'.conf',$tpl->grab());
-		$app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
+
+		$app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab());
+		$app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
 		unset($tpl);
-		
+
 		// delete pool in all other PHP versions
 		$default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
-		if(substr($default_pool_dir,-1) != '/') $default_pool_dir .= '/';
+		if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
 		if($default_pool_dir != $pool_dir){
 			if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
-					$app->system->unlink($default_pool_dir.$pool_name.'.conf');
-					$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+				$app->system->unlink($default_pool_dir.$pool_name.'.conf');
+				$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+				$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 			}
 		}
 		$php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$conf["server_id"]);
 		if(is_array($php_versions) && !empty($php_versions)){
 			foreach($php_versions as $php_version){
-				if(substr($php_version['php_fpm_pool_dir'],-1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+				if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
 				if($php_version['php_fpm_pool_dir'] != $pool_dir){
 					if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
 						$app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
-						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf',LOGLEVEL_DEBUG);
-						$app->services->restartService('php-fpm','reload:'.$php_version['php_fpm_init_script']);
+						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+						$app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
 					}
 				}
 			}
@@ -2714,121 +2716,121 @@
 		// Reload current PHP-FPM after all others
 		sleep(1);
 		if(!$default_php_fpm){
-			$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+			$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 		} else {
-			$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+			$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 		}
-		
+
 		//$reload = true;
 
 		//if($reload == true) $app->services->restartService('php-fpm','reload');
 	}
-	
+
 	//* Delete the PHP-FPM pool configuration file
-	private function php_fpm_pool_delete ($data,$web_config) {
+	private function php_fpm_pool_delete ($data, $web_config) {
 		global $app, $conf;
-		
+
 		if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
 			$default_php_fpm = false;
 			list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-			if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+			if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 		} else {
 			$default_php_fpm = true;
 		}
-		
+
 		if($default_php_fpm){
 			$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
 		} else {
 			$pool_dir = $custom_php_fpm_pool_dir;
 		}
-		
-		if(substr($pool_dir,-1) != '/') $pool_dir .= '/';
+
+		if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
 		$pool_name = 'web'.$data['old']['domain_id'];
-		
+
 		if ( @is_file($pool_dir.$pool_name.'.conf') ) {
 			$app->system->unlink($pool_dir.$pool_name.'.conf');
-			$app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-			
+			$app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+
 			//$app->services->restartService('php-fpm','reload');
 		}
-		
+
 		// delete pool in all other PHP versions
 		$default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
-		if(substr($default_pool_dir,-1) != '/') $default_pool_dir .= '/';
+		if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
 		if($default_pool_dir != $pool_dir){
 			if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
-					$app->system->unlink($default_pool_dir.$pool_name.'.conf');
-					$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+				$app->system->unlink($default_pool_dir.$pool_name.'.conf');
+				$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+				$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 			}
-		}	
+		}
 		$php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$data['old']['server_id']);
 		if(is_array($php_versions) && !empty($php_versions)){
 			foreach($php_versions as $php_version){
-				if(substr($php_version['php_fpm_pool_dir'],-1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+				if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
 				if($php_version['php_fpm_pool_dir'] != $pool_dir){
 					if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
 						$app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
-						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf',LOGLEVEL_DEBUG);
-						$app->services->restartService('php-fpm','reload:'.$php_version['php_fpm_init_script']);
+						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+						$app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
 					}
 				}
 			}
 		}
-		
+
 		// Reload current PHP-FPM after all others
 		sleep(1);
 		if(!$default_php_fpm){
-			$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+			$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 		} else {
-			$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+			$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 		}
 	}
-	
-	function client_delete($event_name,$data) {
+
+	function client_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		$client_id = intval($data['old']['client_id']);
 		if($client_id > 0) {
-			
+
 			$client_dir = $web_config['website_basedir'].'/clients/client'.$client_id;
-			if(is_dir($client_dir) && !stristr($client_dir,'..')) {
+			if(is_dir($client_dir) && !stristr($client_dir, '..')) {
 				// remove symlinks from $client_dir
-				$files = array_diff(scandir($client_dir), array('.','..'));
+				$files = array_diff(scandir($client_dir), array('.', '..'));
 				if(is_array($files) && !empty($files)){
 					foreach($files as $file){
 						if(is_link($client_dir.'/'.$file)){
 							unlink($client_dir.'/'.$file);
-							$app->log('Removed symlink: '.$client_dir.'/'.$file,LOGLEVEL_DEBUG);
+							$app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG);
 						}
 					}
 				}
-				
+
 				@rmdir($client_dir);
-				$app->log('Removed client directory: '.$client_dir,LOGLEVEL_DEBUG);
+				$app->log('Removed client directory: '.$client_dir, LOGLEVEL_DEBUG);
 			}
-			
+
 			if($app->system->is_group('client'.$client_id)){
 				$this->_exec('groupdel client'.$client_id);
-				$app->log('Removed group client'.$client_id,LOGLEVEL_DEBUG);
+				$app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 	}
 
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
-	
-	private function _checkTcp ($host,$port) {
 
-		$fp = @fsockopen ($host, $port, $errno, $errstr, 2);
+	private function _checkTcp ($host, $port) {
+
+		$fp = @fsockopen($host, $port, $errno, $errstr, 2);
 
 		if ($fp) {
 			fclose($fp);
@@ -2840,7 +2842,7 @@
 
 	public function create_relative_link($f, $t) {
 		global $app;
-		
+
 		// $from already exists
 		$from = realpath($f);
 
@@ -2866,19 +2868,19 @@
 		return symlink($cfrom, $to);
 	}
 
-    private function _rewrite_quote($string) {
-        return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
-    }
-    
-    private function _is_url($string) {
-        return preg_match('/^(f|ht)tp(s)?:\/\//i', $string);
-    }
-	
+	private function _rewrite_quote($string) {
+		return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
+	}
+
+	private function _is_url($string) {
+		return preg_match('/^(f|ht)tp(s)?:\/\//i', $string);
+	}
+
 	private function get_seo_redirects($web, $prefix = ''){
 		$seo_redirects = array();
-		
+
 		if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*';
-		
+
 		if($web['subdomain'] == 'www' || $web['subdomain'] == '*'){
 			if($web['seo_redirect'] == 'non_www_to_www'){
 				$seo_redirects[$prefix.'seo_redirect_origin_domain'] = str_replace('.', '\.', $web['domain']);
@@ -2916,7 +2918,7 @@
 		}
 		return $seo_redirects;
 	}
-    
+
 } // end class
 
 ?>
diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php
index 3cec452..8251863 100644
--- a/server/plugins-available/apps_vhost_plugin.inc.php
+++ b/server/plugins-available/apps_vhost_plugin.inc.php
@@ -29,56 +29,56 @@
 */
 
 class apps_vhost_plugin {
-	
+
 	var $plugin_name = 'apps_vhost_plugin';
 	var $class_name = 'apps_vhost_plugin';
-	
-	
+
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('server_insert','apps_vhost_plugin','insert');
-		$app->plugins->registerEvent('server_update','apps_vhost_plugin','update');		
-		
-		
+
+		$app->plugins->registerEvent('server_insert', 'apps_vhost_plugin', 'insert');
+		$app->plugins->registerEvent('server_update', 'apps_vhost_plugin', 'update');
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
+
 	// The purpose of this plugin is to rewrite the main.cf file
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-				
+
 		// get the config
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-				
+
 		if($web_config['server_type'] == 'apache'){
 			// Dont just copy over the virtualhost template but add some custom settings
 			if(file_exists($conf["rootpath"]."/conf-custom/apache_apps.vhost.master")) {
@@ -86,33 +86,33 @@
 			} else {
 				$content = file_get_contents($conf["rootpath"]."/conf/apache_apps.vhost.master");
 			}
-			
-		
+
+
 			$vhost_conf_dir = $web_config['vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $web_config['vhost_conf_enabled_dir'];
 			$apps_vhost_servername = ($web_config['apps_vhost_servername'] == '')?'':'ServerName '.$web_config['apps_vhost_servername'];
-		
+
 			$web_config['apps_vhost_port'] = (empty($web_config['apps_vhost_port']))?8081:$web_config['apps_vhost_port'];
 			$web_config['apps_vhost_ip'] = (empty($web_config['apps_vhost_ip']))?'_default_':$web_config['apps_vhost_ip'];
-		
+
 			$content = str_replace('{apps_vhost_ip}', $web_config['apps_vhost_ip'], $content);
 			$content = str_replace('{apps_vhost_port}', $web_config['apps_vhost_port'], $content);
 			$content = str_replace('{apps_vhost_dir}', $web_config['website_basedir'].'/apps', $content);
 			$content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content);
 			$content = str_replace('{apps_vhost_basedir}', $web_config['website_basedir'], $content);
-		
-		
+
+
 			// comment out the listen directive if port is 80 or 443
 			if($web_config['apps_vhost_port'] == 80 or $web_config['apps_vhost_port'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-			
+
 			file_put_contents("$vhost_conf_dir/apps.vhost", $content);
-			$app->services->restartServiceDelayed('httpd','restart');
+			$app->services->restartServiceDelayed('httpd', 'restart');
 		}
-		
+
 		if($web_config['server_type'] == 'nginx'){
 			// Dont just copy over the virtualhost template but add some custom settings
 			if(file_exists($conf["rootpath"]."/conf-custom/nginx_apps.vhost.master")) {
@@ -120,29 +120,29 @@
 			} else {
 				$content = file_get_contents($conf["rootpath"]."/conf/nginx_apps.vhost.master");
 			}
-		
+
 			$vhost_conf_dir = $web_config['nginx_vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $web_config['nginx_vhost_conf_enabled_dir'];
 			$apps_vhost_servername = ($web_config['apps_vhost_servername'] == '')?'_':$web_config['apps_vhost_servername'];
-			
+
 			$apps_vhost_user = 'ispapps';
 			$apps_vhost_group = 'ispapps';
-		
+
 			$web_config['apps_vhost_port'] = (empty($web_config['apps_vhost_port']))?8081:$web_config['apps_vhost_port'];
 			$web_config['apps_vhost_ip'] = (empty($web_config['apps_vhost_ip']))?'_default_':$web_config['apps_vhost_ip'];
-			
+
 			if($web_config['apps_vhost_ip'] == '_default_'){
 				$apps_vhost_ip = '';
 			} else {
 				$apps_vhost_ip = $web_config['apps_vhost_ip'].':';
 			}
-			
+
 			$socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'apps.sock';
 			$cgi_socket = escapeshellcmd($web_config['nginx_cgi_socket']);
-		
+
 			$content = str_replace('{apps_vhost_ip}', $apps_vhost_ip, $content);
 			$content = str_replace('{apps_vhost_port}', $web_config['apps_vhost_port'], $content);
 			$content = str_replace('{apps_vhost_dir}', $web_config['website_basedir'].'/apps', $content);
@@ -159,7 +159,7 @@
 			}
 			$content = str_replace('{use_tcp}', $use_tcp, $content);
 			$content = str_replace('{use_socket}', $use_socket, $content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			if(file_exists($conf["rootpath"]."/conf-custom/apps_php_fpm_pool.conf.master")) {
@@ -167,22 +167,22 @@
 			} else {
 				$fpm_content = file_get_contents($conf["rootpath"]."/conf/apps_php_fpm_pool.conf.master");
 			}
-			
+
 			$fpm_content = str_replace('{fpm_pool}', 'apps', $fpm_content);
 			//$fpm_content = str_replace('{fpm_port}', $web_config['php_fpm_start_port']+1, $fpm_content);
 			$fpm_content = str_replace('{fpm_socket}', $fpm_socket, $fpm_content);
 			$fpm_content = str_replace('{fpm_user}', $apps_vhost_user, $fpm_content);
 			$fpm_content = str_replace('{fpm_group}', $apps_vhost_group, $fpm_content);
 			file_put_contents($web_config['php_fpm_pool_dir'].'/apps.conf', $fpm_content);
-			
+
 			file_put_contents("$vhost_conf_dir/apps.vhost", $content);
-			$app->services->restartServiceDelayed('httpd','reload');
+			$app->services->restartServiceDelayed('httpd', 'reload');
 		}
 	}
-	
+
 
 } // end class
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/server/plugins-available/aps_plugin.inc.php b/server/plugins-available/aps_plugin.inc.php
index e529b12..00eb6b7 100644
--- a/server/plugins-available/aps_plugin.inc.php
+++ b/server/plugins-available/aps_plugin.inc.php
@@ -28,14 +28,14 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-if(defined('ISPC_ROOT_PATH')) include_once(ISPC_ROOT_PATH.'/lib/classes/aps_installer.inc.php');
+if(defined('ISPC_ROOT_PATH')) include_once ISPC_ROOT_PATH.'/lib/classes/aps_installer.inc.php';
 //require_once(ISPC_ROOT_PATH.'/lib/classes/class.installer.php');
 
 class aps_plugin
 {
-    public $plugin_name = 'aps_plugin';
-    public $class_name = 'aps_plugin';
-	
+	public $plugin_name = 'aps_plugin';
+	public $class_name = 'aps_plugin';
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
@@ -48,71 +48,81 @@
 		}
 
 	}
-    
-    /**
-     * This method gets called when the plugin is loaded
-     */
-    public function onLoad()
-    {
-        global $app;
-        
-        // Register the available events
-        $app->plugins->registerEvent('aps_instance_insert', $this->plugin_name, 'install');
-        $app->plugins->registerEvent('aps_instance_update', $this->plugin_name, 'install');
-        $app->plugins->registerEvent('aps_instance_delete', $this->plugin_name, 'delete');
-    }
-    
-    /**
-     * (Re-)install a package
-     */
-    public function install($event_name, $data)
-    {
-        global $app, $conf;
-        
+
+	/**
+	 * This method gets called when the plugin is loaded
+	 */
+
+
+	public function onLoad()
+	{
+		global $app;
+
+		// Register the available events
+		$app->plugins->registerEvent('aps_instance_insert', $this->plugin_name, 'install');
+		$app->plugins->registerEvent('aps_instance_update', $this->plugin_name, 'install');
+		$app->plugins->registerEvent('aps_instance_delete', $this->plugin_name, 'delete');
+	}
+
+
+
+	/**
+	 * (Re-)install a package
+	 */
+	public function install($event_name, $data)
+	{
+		global $app, $conf;
+
 		//* dont run the installer on a mirror server to prevent
 		//  that the pplication gets installed twice.
 		if($conf['mirror_server_id'] > 0) return true;
-		
-		$app->log("Starting APS install",LOGLEVEL_DEBUG);
-        if(!isset($data['new']['id'])) return false;
-        $instanceid = $data['new']['id'];
-		
+
+		$app->log("Starting APS install", LOGLEVEL_DEBUG);
+		if(!isset($data['new']['id'])) return false;
+		$instanceid = $data['new']['id'];
+
 		if($data['new']['instance_status'] == INSTANCE_INSTALL) {
 			$aps = new ApsInstaller($app);
-			$app->log("Running installHandler",LOGLEVEL_DEBUG);
+			$app->log("Running installHandler", LOGLEVEL_DEBUG);
 			$aps->installHandler($instanceid, 'install');
 		}
-		
+
 		if($data['new']['instance_status'] == INSTANCE_REMOVE) {
 			$aps = new ApsInstaller($app);
-			$app->log("Running installHandler",LOGLEVEL_DEBUG);
+			$app->log("Running installHandler", LOGLEVEL_DEBUG);
 			$aps->installHandler($instanceid, 'delete');
 		}
-    }
-    
-    /**
-     * Update an existing instance (currently unused)
-     */
-	 /*
+	}
+
+
+
+	/**
+	 * Update an existing instance (currently unused)
+	 */
+	/*
     public function update($event_name, $data)
     {
     }
 	*/
-    
-    /**
-     * Uninstall an instance
-     */
-    public function delete($event_name, $data)
-    {
-        global $app, $conf;
-        
-        if(!isset($data['new']['id'])) return false;
-        $instanceid = $data['new']['id'];
-		
+
+
+
+	/**
+	 * Uninstall an instance
+	 */
+	public function delete($event_name, $data)
+	{
+		global $app, $conf;
+
+		if(!isset($data['new']['id'])) return false;
+		$instanceid = $data['new']['id'];
+
 		if($data['new']['instance_status'] == INSTANCE_REMOVE) {
 			$aps = new ApsInstaller($app);
 			$aps->installHandler($instanceid, 'install');
-		}        
-    }
+		}
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/plugins-available/backup_plugin.inc.php b/server/plugins-available/backup_plugin.inc.php
index 78be959..7fe2aea 100644
--- a/server/plugins-available/backup_plugin.inc.php
+++ b/server/plugins-available/backup_plugin.inc.php
@@ -29,63 +29,63 @@
 */
 
 class backup_plugin {
-	
+
 	var $plugin_name = 'backup_plugin';
 	var $class_name  = 'backup_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	public function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	public function onLoad() {
 		global $app;
-		
+
 		//* Register for actions
-		$app->plugins->registerAction('backup_download',$this->plugin_name,'backup_action');
-		$app->plugins->registerAction('backup_restore',$this->plugin_name,'backup_action');
-		
+		$app->plugins->registerAction('backup_download', $this->plugin_name, 'backup_action');
+		$app->plugins->registerAction('backup_restore', $this->plugin_name, 'backup_action');
+
 	}
-	
+
 	//* Do a backup action
-	public function backup_action($action_name,$data) {
-		global $app,$conf;
-		
+	public function backup_action($action_name, $data) {
+		global $app, $conf;
+
 		$backup_id = intval($data);
 		$backup = $app->dbmaster->queryOneRecord("SELECT * FROM web_backup WHERE backup_id = $backup_id");
-		
+
 		if(is_array($backup)) {
-		
+
 			$app->uses('ini_parser,file,getconf');
-			
+
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$backup['parent_domain_id']);
 			$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
 			$backup_dir = $server_config['backup_dir'].'/web'.$web['domain_id'];
-			
+
 			//* Make backup available for download
 			if($action_name == 'backup_download') {
 				//* Copy the backup file to the backup folder of the website
-				if(file_exists($backup_dir.'/'.$backup['filename']) && !stristr($backup_dir.'/'.$backup['filename'],'..') && !stristr($backup_dir.'/'.$backup['filename'],'etc')) {
-					copy($backup_dir.'/'.$backup['filename'],$web['document_root'].'/backup/'.$backup['filename']);
-					chgrp($web['document_root'].'/backup/'.$backup['filename'],$web['system_group']);
-					$app->log('cp '.$backup_dir.'/'.$backup['filename'].' '.$web['document_root'].'/backup/'.$backup['filename'],LOGLEVEL_DEBUG);
+				if(file_exists($backup_dir.'/'.$backup['filename']) && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
+					copy($backup_dir.'/'.$backup['filename'], $web['document_root'].'/backup/'.$backup['filename']);
+					chgrp($web['document_root'].'/backup/'.$backup['filename'], $web['system_group']);
+					$app->log('cp '.$backup_dir.'/'.$backup['filename'].' '.$web['document_root'].'/backup/'.$backup['filename'], LOGLEVEL_DEBUG);
 				}
 			}
-			
+
 			//* Restore a mysql backup
 			if($action_name == 'backup_restore' && $backup['backup_type'] == 'mysql') {
 				//* Load sql dump into db
-				include('lib/mysql_clientdb.conf');
-				
+				include 'lib/mysql_clientdb.conf';
+
 				if(file_exists($backup_dir.'/'.$backup['filename'])) {
 					//$parts = explode('_',$backup['filename']);
 					//$db_name = $parts[1];
@@ -97,37 +97,37 @@
 				unset($clientdb_host);
 				unset($clientdb_user);
 				unset($clientdb_password);
-				$app->log('Restored MySQL backup '.$backup_dir.'/'.$backup['filename'],LOGLEVEL_DEBUG);
+				$app->log('Restored MySQL backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
 			}
-			
+
 			//* Restore a web backup
 			if($action_name == 'backup_restore' && $backup['backup_type'] == 'web') {
 				if($backup['backup_mode'] == 'userzip') {
-					if(file_exists($backup_dir.'/'.$backup['filename']) && $web['document_root'] != '' && $web['document_root'] != '/' && !stristr($backup_dir.'/'.$backup['filename'],'..') && !stristr($backup_dir.'/'.$backup['filename'],'etc')) {
-						if(file_exists($web['document_root'].'/backup/'.$backup['filename'])) rename($web['document_root'].'/backup/'.$backup['filename'],$web['document_root'].'/backup/'.$backup['filename'].'.bak');
-						copy($backup_dir.'/'.$backup['filename'],$web['document_root'].'/backup/'.$backup['filename']);
-						chgrp($web['document_root'].'/backup/'.$backup['filename'],$web['system_group']);
+					if(file_exists($backup_dir.'/'.$backup['filename']) && $web['document_root'] != '' && $web['document_root'] != '/' && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
+						if(file_exists($web['document_root'].'/backup/'.$backup['filename'])) rename($web['document_root'].'/backup/'.$backup['filename'], $web['document_root'].'/backup/'.$backup['filename'].'.bak');
+						copy($backup_dir.'/'.$backup['filename'], $web['document_root'].'/backup/'.$backup['filename']);
+						chgrp($web['document_root'].'/backup/'.$backup['filename'], $web['system_group']);
 						//chown($web['document_root'].'/backup/'.$backup['filename'],$web['system_user']);
 						$command = 'sudo -u '.escapeshellarg($web['system_user']).' unzip -qq -o  '.escapeshellarg($web['document_root'].'/backup/'.$backup['filename']).' -d '.escapeshellarg($web['document_root']).' 2> /dev/null';
 						exec($command);
 						unlink($web['document_root'].'/backup/'.$backup['filename']);
-						if(file_exists($web['document_root'].'/backup/'.$backup['filename'].'.bak')) rename($web['document_root'].'/backup/'.$backup['filename'].'.bak',$web['document_root'].'/backup/'.$backup['filename']);
-						$app->log('Restored Web backup '.$backup_dir.'/'.$backup['filename'],LOGLEVEL_DEBUG);
+						if(file_exists($web['document_root'].'/backup/'.$backup['filename'].'.bak')) rename($web['document_root'].'/backup/'.$backup['filename'].'.bak', $web['document_root'].'/backup/'.$backup['filename']);
+						$app->log('Restored Web backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
 					}
 				}
 				if($backup['backup_mode'] == 'rootgz') {
-					if(file_exists($backup_dir.'/'.$backup['filename']) && $web['document_root'] != '' && $web['document_root'] != '/' && !stristr($backup_dir.'/'.$backup['filename'],'..') && !stristr($backup_dir.'/'.$backup['filename'],'etc')) {
+					if(file_exists($backup_dir.'/'.$backup['filename']) && $web['document_root'] != '' && $web['document_root'] != '/' && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
 						$command = 'tar xzf '.escapeshellarg($backup_dir.'/'.$backup['filename']).' --directory '.escapeshellarg($web['document_root']);
 						exec($command);
-						$app->log('Restored Web backup '.$backup_dir.'/'.$backup['filename'],LOGLEVEL_DEBUG);
+						$app->log('Restored Web backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
 					}
 				}
 			}
-			
+
 		} else {
-			$app->log('No backup with ID '.$backup_id.' found.',LOGLEVEL_DEBUG);
+			$app->log('No backup with ID '.$backup_id.' found.', LOGLEVEL_DEBUG);
 		}
-		
+
 		return 'ok';
 	}
 
diff --git a/server/plugins-available/bind_dlz_plugin.inc.php b/server/plugins-available/bind_dlz_plugin.inc.php
index 28aff94..f6d367f 100644
--- a/server/plugins-available/bind_dlz_plugin.inc.php
+++ b/server/plugins-available/bind_dlz_plugin.inc.php
@@ -66,19 +66,19 @@
 */
 
 class bind_dlz_plugin {
-	
+
 	var $plugin_name = 'bind_dlz_plugin';
 	var $class_name  = 'bind_dlz_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall()
 	{
 		global $conf;
-		
+
 		if(isset($conf['bind']['installed']) && $conf['bind']['installed'] == true) {
-			// Temporarily disabled until the installer supports the automatic creation of the necessary 
-			// database or at least to select between filebased nd db based bind, as not all bind versions 
+			// Temporarily disabled until the installer supports the automatic creation of the necessary
+			// database or at least to select between filebased nd db based bind, as not all bind versions
 			// support dlz out of the box. To enable this plugin manually, create a symlink from the plugins-enabled
 			// directory to this file in the plugins-available directory.
 			return false;
@@ -86,64 +86,64 @@
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
-	function onLoad() 
+
+	function onLoad()
 	{
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* SOA
-		$app->plugins->registerEvent('dns_soa_insert',$this->plugin_name,'soa_insert');
-		$app->plugins->registerEvent('dns_soa_update',$this->plugin_name,'soa_update');
-		$app->plugins->registerEvent('dns_soa_delete',$this->plugin_name,'soa_delete');
-		
+		$app->plugins->registerEvent('dns_soa_insert', $this->plugin_name, 'soa_insert');
+		$app->plugins->registerEvent('dns_soa_update', $this->plugin_name, 'soa_update');
+		$app->plugins->registerEvent('dns_soa_delete', $this->plugin_name, 'soa_delete');
+
 		//* RR
-		$app->plugins->registerEvent('dns_rr_insert',$this->plugin_name,'rr_insert');
-		$app->plugins->registerEvent('dns_rr_update',$this->plugin_name,'rr_update');
-		$app->plugins->registerEvent('dns_rr_delete',$this->plugin_name,'rr_delete');
+		$app->plugins->registerEvent('dns_rr_insert', $this->plugin_name, 'rr_insert');
+		$app->plugins->registerEvent('dns_rr_update', $this->plugin_name, 'rr_update');
+		$app->plugins->registerEvent('dns_rr_delete', $this->plugin_name, 'rr_delete');
 	}
-	
-	
-	function soa_insert($event_name,$data) 
+
+
+	function soa_insert($event_name, $data)
 	{
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$origin = substr($data["new"]["origin"], 0, -1);
 		$ispconfig_id = $data["new"]["id"];
 		$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
 
 		$ttl = $data["new"]["ttl"];
-		
+
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
-		
+
 		$app->db->query("INSERT INTO named.records (zone, ttl, type, primary_ns, resp_contact, serial, refresh, retry, expire, minimum, ispconfig_id) VALUES ".
-						"('$origin', $ttl, 'SOA', '{$data["new"]["ns"]}', '{$data["new"]["mbox"]}', '{$serial["serial"]}', '{$serial["refresh"]}'," . 
-						"'{$serial["retry"]}', '{$serial["expire"]}', '{$serial["minimum"]}', $ispconfig_id)");
-		//unset($_db);	
+			"('$origin', $ttl, 'SOA', '{$data["new"]["ns"]}', '{$data["new"]["mbox"]}', '{$serial["serial"]}', '{$serial["refresh"]}'," .
+			"'{$serial["retry"]}', '{$serial["expire"]}', '{$serial["minimum"]}', $ispconfig_id)");
+		//unset($_db);
 	}
-	
-	function soa_update($event_name,$data)
+
+	function soa_update($event_name, $data)
 	{
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y')
 		{
 			if($data["old"]["active"] != 'Y') return;
-			$this->soa_delete($event_name,$data);
-		} 
-		else 
+			$this->soa_delete($event_name, $data);
+		}
+		else
 		{
 			if($data["old"]["active"] == 'Y')
 			{
@@ -152,23 +152,23 @@
 				$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
 
 				$ttl = $data["new"]["ttl"];
-				
+
 				//$_db = clone $app->db;
 				//$_db->dbName = 'named';
-		
+
 				$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, primary_ns = '{$data["new"]["ns"]}', resp_contact = '{$data["new"]["mbox"]}', ".
-								"serial = '{$serial["serial"]}', refresh = '{$serial["refresh"]}', retry = '{$serial["retry"]}', expire = '{$serial["expire"]}', ".
-								"minimum = '{$serial["minimum"]}' WHERE ispconfig_id = ".$data["new"]["id"]." AND type = 'SOA'");
+					"serial = '{$serial["serial"]}', refresh = '{$serial["refresh"]}', retry = '{$serial["retry"]}', expire = '{$serial["expire"]}', ".
+					"minimum = '{$serial["minimum"]}' WHERE ispconfig_id = ".$data["new"]["id"]." AND type = 'SOA'");
 				//unset($_db);
-			} 
-			else 
+			}
+			else
 			{
-				$this->soa_insert($event_name,$data);
+				$this->soa_insert($event_name, $data);
 				$ispconfig_id = $data["new"]["id"];
-				
+
 				if ($records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = $ispconfig_id AND active = 'Y'"))
 				{
-					foreach($records as $record) 
+					foreach($records as $record)
 					{
 						foreach ($record as $key => $val) {
 							$data["new"][$key] = $val;
@@ -178,96 +178,96 @@
 				}
 			}
 		}
-			
+
 	}
-	
-	function soa_delete($event_name,$data)
+
+	function soa_delete($event_name, $data)
 	{
 		global $app, $conf;
-		
+
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
-		
+
 		$app->db->query("DELETE FROM named.records WHERE ispconfig_id = {$data["old"]["id"]}");
-		//unset($_db);	
+		//unset($_db);
 	}
-	
-	function rr_insert($event_name,$data)
+
+	function rr_insert($event_name, $data)
 	{
 		global $app, $conf;
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
 		$origin = substr($zone["origin"], 0, -1);
 		$ispconfig_id = $data["new"]["id"];
-		
+
 		$type = $data["new"]["type"];
-		
+
 		if (substr($data["new"]["name"], -1) == '.') {
 			$name = substr($data["new"]["name"], 0, -1);
 		} else {
 			$name = ($data["new"]["name"] == "") ? $name = '@' : $data["new"]["name"];
 		}
-		
+
 		if ($name == $origin || $name == '') {
 			$name = '@';
 		}
-		
-		switch ($type) 
+
+		switch ($type)
 		{
-			case "CNAME":
-			case "MX":
-			case "NS":
-			case "ALIAS":
-			case "PTR":
-			case "SRV":
-				if(substr($data["new"]["data"], -1) != '.'){
-					$content = $data["new"]["data"] . '.';
-				} else {
-					$content = $data["new"]["data"];
-				}
-				break;
-			case "HINFO":
-			    $content = $data["new"]["data"];
-				$quote1 = strpos($content, '"');
-				
-				if($quote1 !== FALSE) {
-					$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
-				}
-				
-				if ($quote1 !== FALSE && $quote2 !== FALSE) {
-					$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
-					$content = $text_between_quotes.substr($content, ($quote2 + 2));
-				}
-				break;
-    		default:
+		case "CNAME":
+		case "MX":
+		case "NS":
+		case "ALIAS":
+		case "PTR":
+		case "SRV":
+			if(substr($data["new"]["data"], -1) != '.'){
+				$content = $data["new"]["data"] . '.';
+			} else {
 				$content = $data["new"]["data"];
+			}
+			break;
+		case "HINFO":
+			$content = $data["new"]["data"];
+			$quote1 = strpos($content, '"');
+
+			if($quote1 !== FALSE) {
+				$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
+			}
+
+			if ($quote1 !== FALSE && $quote2 !== FALSE) {
+				$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
+				$content = $text_between_quotes.substr($content, ($quote2 + 2));
+			}
+			break;
+		default:
+			$content = $data["new"]["data"];
 		}
-		
+
 		$ttl = $data["new"]["ttl"];
-		
+
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
-		
+
 		if ($type == 'MX') {
 			$app->db->query("INSERT INTO named.records (zone, ttl, type, host, mx_priority, data, ispconfig_id)".
-			" VALUES ('$origin', $ttl, '$type', '$name', {$data["new"]["aux"]}, '$content', $ispconfig_id)");
+				" VALUES ('$origin', $ttl, '$type', '$name', {$data["new"]["aux"]}, '$content', $ispconfig_id)");
 		} else {
 			$app->db->query("INSERT INTO named.records (zone, ttl, type, host, data, ispconfig_id)".
-			" VALUES ('$origin', $ttl, '$type', '$name', '$content', $ispconfig_id)");
+				" VALUES ('$origin', $ttl, '$type', '$name', '$content', $ispconfig_id)");
 		}
 
 		//unset($_db);
 	}
-	
-	function rr_update($event_name,$data)
+
+	function rr_update($event_name, $data)
 	{
 		global $app, $conf;
-		
+
 		if ($data["new"]["active"] != 'Y')
 		{
 			if($data["old"]["active"] != 'Y') return;
-			$this->rr_delete($event_name,$data);
+			$this->rr_delete($event_name, $data);
 		}
 		else
 		{
@@ -276,77 +276,78 @@
 				$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
 				$origin = substr($zone["origin"], 0, -1);
 				$ispconfig_id = $data["new"]["id"];
-				
-				$type = $data["new"]["type"];	
-		
+
+				$type = $data["new"]["type"];
+
 				if (substr($data["new"]["name"], -1) == '.') {
 					$name = substr($data["new"]["name"], 0, -1);
 				} else {
 					$name = ($data["new"]["name"] == "") ? $name = '@' : $data["new"]["name"];
 				}
-				
+
 				if ($name == $origin || $name == '') {
 					$name = '@';
 				}
 
-				switch ($type) 
+				switch ($type)
 				{
-					case "CNAME":
-					case "MX":
-					case "NS":
-					case "ALIAS":
-					case "PTR":
-					case "SRV":
-						if(substr($data["new"]["data"], -1) != '.'){
-							$content = $data["new"]["data"] . '.';
-						} else {
-							$content = $data["new"]["data"];
-						}
-						break;
-					case "HINFO":
-			    		$content = $data["new"]["data"];
-						$quote1 = strpos($content, '"');
-						if($quote1 !== FALSE){
-							$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
-						}
-						if($quote1 !== FALSE && $quote2 !== FALSE){
-							$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
-							$content = $text_between_quotes.substr($content, ($quote2 + 2));
-						}
-						break;
-    				default:
+				case "CNAME":
+				case "MX":
+				case "NS":
+				case "ALIAS":
+				case "PTR":
+				case "SRV":
+					if(substr($data["new"]["data"], -1) != '.'){
+						$content = $data["new"]["data"] . '.';
+					} else {
 						$content = $data["new"]["data"];
+					}
+					break;
+				case "HINFO":
+					$content = $data["new"]["data"];
+					$quote1 = strpos($content, '"');
+					if($quote1 !== FALSE){
+						$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
+					}
+					if($quote1 !== FALSE && $quote2 !== FALSE){
+						$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
+						$content = $text_between_quotes.substr($content, ($quote2 + 2));
+					}
+					break;
+				default:
+					$content = $data["new"]["data"];
 				}
-		
+
 				$ttl = $data["new"]["ttl"];
 				$prio = (int)$data["new"]["aux"];
-				
+
 				//$_db = clone $app->db;
 				//$_db->dbName = 'named';
-				
+
 				if ($type == 'MX') {
 					$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, type = '$type', host = '$name', mx_priority = $prio, ".
-					"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
+						"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
 				} else {
 					$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, type = '$type', host = '$name', ".
-					"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
+						"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
 				}
-				
+
 				//unset($_db);
 			} else {
-				$this->rr_insert($event_name,$data);
+				$this->rr_insert($event_name, $data);
 			}
 		}
 	}
-	
-	function rr_delete($event_name,$data) {
+
+	function rr_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
-				
+
 		$app->db->query("DELETE FROM named.records WHERE ispconfig_id = {$data["old"]["id"]} AND type != 'SOA'");
 		//unset($_db);
 	}
+
 } // end class
 ?>
diff --git a/server/plugins-available/bind_plugin.inc.php b/server/plugins-available/bind_plugin.inc.php
index fd7f516..4823cf3 100644
--- a/server/plugins-available/bind_plugin.inc.php
+++ b/server/plugins-available/bind_plugin.inc.php
@@ -29,290 +29,290 @@
 */
 
 class bind_plugin {
-	
+
 	var $plugin_name = 'bind_plugin';
 	var $class_name  = 'bind_plugin';
 	var $action = 'update';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if(isset($conf['bind']['installed']) && $conf['bind']['installed'] == true && @is_link('/usr/local/ispconfig/server/mods-enabled/dns_module.inc.php')) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		//* SOA
-		$app->plugins->registerEvent('dns_soa_insert',$this->plugin_name,'soa_insert');
-		$app->plugins->registerEvent('dns_soa_update',$this->plugin_name,'soa_update');
-		$app->plugins->registerEvent('dns_soa_delete',$this->plugin_name,'soa_delete');
 
-    //* SLAVE
-		$app->plugins->registerEvent('dns_slave_insert',$this->plugin_name,'slave_insert');
-		$app->plugins->registerEvent('dns_slave_update',$this->plugin_name,'slave_update');
-		$app->plugins->registerEvent('dns_slave_delete',$this->plugin_name,'slave_delete');
-		
+		//* SOA
+		$app->plugins->registerEvent('dns_soa_insert', $this->plugin_name, 'soa_insert');
+		$app->plugins->registerEvent('dns_soa_update', $this->plugin_name, 'soa_update');
+		$app->plugins->registerEvent('dns_soa_delete', $this->plugin_name, 'soa_delete');
+
+		//* SLAVE
+		$app->plugins->registerEvent('dns_slave_insert', $this->plugin_name, 'slave_insert');
+		$app->plugins->registerEvent('dns_slave_update', $this->plugin_name, 'slave_update');
+		$app->plugins->registerEvent('dns_slave_delete', $this->plugin_name, 'slave_delete');
+
 		//* RR
-		$app->plugins->registerEvent('dns_rr_insert',$this->plugin_name,'rr_insert');
-		$app->plugins->registerEvent('dns_rr_update',$this->plugin_name,'rr_update');
-		$app->plugins->registerEvent('dns_rr_delete',$this->plugin_name,'rr_delete');
-		
+		$app->plugins->registerEvent('dns_rr_insert', $this->plugin_name, 'rr_insert');
+		$app->plugins->registerEvent('dns_rr_update', $this->plugin_name, 'rr_update');
+		$app->plugins->registerEvent('dns_rr_delete', $this->plugin_name, 'rr_delete');
+
 	}
-	
-	
-	function soa_insert($event_name,$data) {
+
+
+	function soa_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
-		$this->soa_update($event_name,$data);
-		
+		$this->soa_update($event_name, $data);
+
 	}
-	
-	function soa_update($event_name,$data) {
+
+	function soa_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Load libraries
 		$app->uses("getconf,tpl");
-		
+
 		//* load the server configuration options
 		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
+
 		//* Write the domain file
 		if(!empty($data['new']['id'])) {
 			$tpl = new tpl();
 			$tpl->newTemplate("bind_pri.domain.master");
-		
+
 			$zone = $data['new'];
 			$tpl->setVar($zone);
-		
+
 			$records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$zone['id']." AND active = 'Y'");
 			if(is_array($records) && !empty($records)){
 				for($i=0;$i<sizeof($records);$i++){
 					if($records[$i]['ttl'] == 0) $records[$i]['ttl'] = '';
 				}
 			}
-			$tpl->setLoop('zones',$records);
-			
+			$tpl->setLoop('zones', $records);
+
 			//TODO : change this when distribution information has been integrated into server record
-        	if (file_exists('/etc/gentoo-release')) {
-				$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'],0,-1)));
-        	}
-        	else {
-        		$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'],0,-1)));
-        	}
-        	
-			file_put_contents($filename,$tpl->grab());
+			if (file_exists('/etc/gentoo-release')) {
+				$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'], 0, -1)));
+			}
+			else {
+				$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'], 0, -1)));
+			}
+
+			file_put_contents($filename, $tpl->grab());
 			chown($filename, escapeshellcmd($dns_config['bind_user']));
 			chgrp($filename, escapeshellcmd($dns_config['bind_group']));
-			
+
 			//* Check the zonefile
 			if(is_file($filename.'.err')) unlink($filename.'.err');
-			exec('named-checkzone '.escapeshellarg($zone['origin']).' '.escapeshellarg($filename),$out,$return_status);
+			exec('named-checkzone '.escapeshellarg($zone['origin']).' '.escapeshellarg($filename), $out, $return_status);
 			if($return_status === 0) {
-				$app->log("Writing BIND domain file: ".$filename,LOGLEVEL_DEBUG);
+				$app->log("Writing BIND domain file: ".$filename, LOGLEVEL_DEBUG);
 			} else {
-				$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ',$out),LOGLEVEL_WARN);
-				rename($filename,$filename.'.err');
+				$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), LOGLEVEL_WARN);
+				rename($filename, $filename.'.err');
 			}
 			unset($tpl);
 			unset($records);
 			unset($records_out);
 			unset($zone);
 		}
-		
+
 		//* rebuild the named.conf file if the origin has changed or when the origin is inserted.
 		//if($this->action == 'insert' || $data['old']['origin'] != $data['new']['origin']) {
-		$this->write_named_conf($data,$dns_config);
+		$this->write_named_conf($data, $dns_config);
 		//}
-		
+
 		//* Delete old domain file, if domain name has been changed
 		if($data['old']['origin'] != $data['new']['origin']) {
 			//TODO : change this when distribution information has been integrated into server record
-        	if (file_exists('/etc/gentoo-release')) {
-        		$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'],0,-1));
-        	}
-        	else {
-        		$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'],0,-1));
-        	}
-			
+			if (file_exists('/etc/gentoo-release')) {
+				$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+			}
+			else {
+				$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+			}
+
 			if(is_file($filename)) unlink($filename);
 			if(is_file($filename.'.err')) unlink($filename.'.err');
 		}
-		
+
 		//* Reload bind nameserver
-		$app->services->restartServiceDelayed('bind','reload');
-		
-	}
-	
-	function soa_delete($event_name,$data) {
-		global $app, $conf;
-		
-		//* load the server configuration options
-		$app->uses("getconf,tpl");
-		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
-		//* rebuild the named.conf file
-		$this->write_named_conf($data,$dns_config);
-		
-		//* Delete the domain file
-		//TODO : change this when distribution information has been integrated into server record
-        if (file_exists('/etc/gentoo-release')) {
-        	$zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri/'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-        }
-        else {
-        	$zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-        }
-		
-		if(is_file($zone_file_name)) unlink($zone_file_name);
-		if(is_file($zone_file_name.'.err')) unlink($zone_file_name.'.err');
-		$app->log("Deleting BIND domain file: ".$zone_file_name,LOGLEVEL_DEBUG);
-		
-		//* Reload bind nameserver
-		$app->services->restartServiceDelayed('bind','reload');
-			
+		$app->services->restartServiceDelayed('bind', 'reload');
+
 	}
 
-	function slave_insert($event_name,$data) {
+	function soa_delete($event_name, $data) {
 		global $app, $conf;
-		
-		$this->action = 'insert';
-		$this->slave_update($event_name,$data);
-		
+
+		//* load the server configuration options
+		$app->uses("getconf,tpl");
+		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
+
+		//* rebuild the named.conf file
+		$this->write_named_conf($data, $dns_config);
+
+		//* Delete the domain file
+		//TODO : change this when distribution information has been integrated into server record
+		if (file_exists('/etc/gentoo-release')) {
+			$zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri/'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+		}
+		else {
+			$zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+		}
+
+		if(is_file($zone_file_name)) unlink($zone_file_name);
+		if(is_file($zone_file_name.'.err')) unlink($zone_file_name.'.err');
+		$app->log("Deleting BIND domain file: ".$zone_file_name, LOGLEVEL_DEBUG);
+
+		//* Reload bind nameserver
+		$app->services->restartServiceDelayed('bind', 'reload');
+
 	}
-	
-	function slave_update($event_name,$data) {
+
+	function slave_insert($event_name, $data) {
 		global $app, $conf;
-		
+
+		$this->action = 'insert';
+		$this->slave_update($event_name, $data);
+
+	}
+
+	function slave_update($event_name, $data) {
+		global $app, $conf;
+
 		//* Load libraries
 		$app->uses("getconf,tpl");
-		
+
 		//* load the server configuration options
 		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
+
 		//* rebuild the named.conf file if the origin has changed or when the origin is inserted.
 		//if($this->action == 'insert' || $data['old']['origin'] != $data['new']['origin']) {
-		$this->write_named_conf($data,$dns_config);
+		$this->write_named_conf($data, $dns_config);
 		//}
-		
+
 		//* Delete old domain file, if domain name has been changed
 		if($data['old']['origin'] != $data['new']['origin']) {
 			//TODO : change this when distribution information has been integrated into server record
-	        if (file_exists('/etc/gentoo-release')) {
-	        	$filename = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-	        }
-	        else {
-	        	$filename = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-	        }
-			
+			if (file_exists('/etc/gentoo-release')) {
+				$filename = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+			}
+			else {
+				$filename = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+			}
+
 			if(is_file($filename)) unset($filename);
 		}
-		
+
 		//* Ensure that the named slave directory is writable by the named user
 		if (file_exists('/etc/gentoo-release')) {
 			$slave_record_dir = $dns_config['bind_zonefiles_dir'].'/sec';
 		} else {
 			$slave_record_dir = $dns_config['bind_zonefiles_dir'].'/slave';
 		}
-		if(!@is_dir($slave_record_dir)) mkdir($slave_record_dir,0770);
-		chown($slave_record_dir,$dns_config['bind_user']);
-		chgrp($slave_record_dir,$dns_config['bind_group']);
-		
+		if(!@is_dir($slave_record_dir)) mkdir($slave_record_dir, 0770);
+		chown($slave_record_dir, $dns_config['bind_user']);
+		chgrp($slave_record_dir, $dns_config['bind_group']);
+
 		//* Reload bind nameserver
-		$app->services->restartServiceDelayed('bind','reload');
-     		
+		$app->services->restartServiceDelayed('bind', 'reload');
+
 	}
-	
-	function slave_delete($event_name,$data) {
+
+	function slave_delete($event_name, $data) {
 		global $app, $conf;
-		
-		
+
+
 		//* load the server configuration options
 		$app->uses("getconf,tpl");
 		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
+
 		//* rebuild the named.conf file
-		$this->write_named_conf($data,$dns_config);
-		
+		$this->write_named_conf($data, $dns_config);
+
 		//* Delete the domain file
 		//TODO : change this when distribution information has been integrated into server record
-	    if (file_exists('/etc/gentoo-release')) {
-	    	$zone_file_name = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-	    }
-	    else {
-	    	$zone_file_name = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-	    }
-		
+		if (file_exists('/etc/gentoo-release')) {
+			$zone_file_name = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+		}
+		else {
+			$zone_file_name = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+		}
+
 		if(is_file($zone_file_name)) unlink($zone_file_name);
-		$app->log("Deleting BIND domain file for secondary zone: ".$zone_file_name,LOGLEVEL_DEBUG);
-		
+		$app->log("Deleting BIND domain file for secondary zone: ".$zone_file_name, LOGLEVEL_DEBUG);
+
 		//* Reload bind nameserver
-		$app->services->restartServiceDelayed('bind','reload');
-			
-		
-	}
-	
-	function rr_insert($event_name,$data) {
-		global $app, $conf;
-		
-		//* Get the data of the soa and call soa_update
-		$tmp = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data['new']['zone']);
-		$data["new"] = $tmp;
-		$data["old"] = $tmp;
-		$this->action = 'update';
-		$this->soa_update($event_name,$data);
+		$app->services->restartServiceDelayed('bind', 'reload');
+
 
 	}
-	
-	function rr_update($event_name,$data) {
+
+	function rr_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Get the data of the soa and call soa_update
 		$tmp = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data['new']['zone']);
 		$data["new"] = $tmp;
 		$data["old"] = $tmp;
 		$this->action = 'update';
-		$this->soa_update($event_name,$data);
-		
+		$this->soa_update($event_name, $data);
+
 	}
-	
-	function rr_delete($event_name,$data) {
+
+	function rr_update($event_name, $data) {
 		global $app, $conf;
-		
+
+		//* Get the data of the soa and call soa_update
+		$tmp = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data['new']['zone']);
+		$data["new"] = $tmp;
+		$data["old"] = $tmp;
+		$this->action = 'update';
+		$this->soa_update($event_name, $data);
+
+	}
+
+	function rr_delete($event_name, $data) {
+		global $app, $conf;
+
 		//* Get the data of the soa and call soa_update
 		$tmp = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".intval($data['old']['zone']));
 		$data["new"] = $tmp;
 		$data["old"] = $tmp;
 		$this->action = 'update';
-		$this->soa_update($event_name,$data);
-		
+		$this->soa_update($event_name, $data);
+
 	}
-	
-	###################################################################
-	
+
+	//##################################################################
+
 	function write_named_conf($data, $dns_config) {
 		global $app, $conf;
-	
-		//* Only write the master file for the current server	
+
+		//* Only write the master file for the current server
 		$tmps = $app->db->queryAllRecords("SELECT origin, xfer, also_notify, update_acl FROM dns_soa WHERE active = 'Y' AND server_id=".$conf["server_id"]);
 		$zones = array();
-		
+
 		//* Check if the current zone that triggered this function has at least one NS record
 		/* Has been replaced by a better zone check
 		$rec_num = $app->db->queryOneRecord("SELECT count(id) as ns FROM dns_rr WHERE type = 'NS' AND zone = ".intval($data['new']['id'])." AND active = 'Y'");
@@ -322,87 +322,87 @@
 			$exclude_zone = '';
 		}
 		*/
-		
+
 		//TODO : change this when distribution information has been integrated into server record
-	    if (file_exists('/etc/gentoo-release')) {
-	    	$pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri/';
-	    	$sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/sec/';
-	    	
-	    }
-	    else {
-	    	$pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri.';
-	    	$sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/slave/sec.';
-	    }
+		if (file_exists('/etc/gentoo-release')) {
+			$pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri/';
+			$sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/sec/';
+
+		}
+		else {
+			$pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri.';
+			$sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/slave/sec.';
+		}
 
 		//* Loop trough zones
 		foreach($tmps as $tmp) {
-			
-			$zone_file = $pri_zonefiles_path.str_replace("/", "_",substr($tmp['origin'],0,-1));
-			
+
+			$zone_file = $pri_zonefiles_path.str_replace("/", "_", substr($tmp['origin'], 0, -1));
+
 			$options = '';
 			if(trim($tmp['xfer']) != '') {
-				$options .= "        allow-transfer {".str_replace(',',';',$tmp['xfer']).";};\n";
+				$options .= "        allow-transfer {".str_replace(',', ';', $tmp['xfer']).";};\n";
 			} else {
 				$options .= "        allow-transfer {none;};\n";
 			}
-			if(trim($tmp['also_notify']) != '') $options .= '        also-notify {'.str_replace(',',';',$tmp['also_notify']).";};\n";
-			if(trim($tmp['update_acl']) != '') $options .= "        allow-update {".str_replace(',',';',$tmp['update_acl']).";};\n";
-			
+			if(trim($tmp['also_notify']) != '') $options .= '        also-notify {'.str_replace(',', ';', $tmp['also_notify']).";};\n";
+			if(trim($tmp['update_acl']) != '') $options .= "        allow-update {".str_replace(',', ';', $tmp['update_acl']).";};\n";
+
 			if(file_exists($zone_file)) {
-				$zones[] = array(	'zone' => substr($tmp['origin'],0,-1),
-									'zonefile_path' => $zone_file,
-									'options' => $options
-								);
+				$zones[] = array( 'zone' => substr($tmp['origin'], 0, -1),
+					'zonefile_path' => $zone_file,
+					'options' => $options
+				);
 			}
 		}
 
 		$tpl = new tpl();
 		$tpl->newTemplate("bind_named.conf.local.master");
-		$tpl->setLoop('zones',$zones);
-		
+		$tpl->setLoop('zones', $zones);
+
 		//* And loop through the secondary zones, but only for the current server
 		$tmps_sec = $app->db->queryAllRecords("SELECT origin, xfer, ns FROM dns_slave WHERE active = 'Y' AND server_id=".$conf["server_id"]);
 		$zones_sec = array();
 
 		foreach($tmps_sec as $tmp) {
-			
+
 			$options = "        masters {".$tmp['ns'].";};\n";
-            if(trim($tmp['xfer']) != '') {
-                $options .= "        allow-transfer {".str_replace(',',';',$tmp['xfer']).";};\n";
-            } else {
-                $options .= "        allow-transfer {none;};\n";
-            }
+			if(trim($tmp['xfer']) != '') {
+				$options .= "        allow-transfer {".str_replace(',', ';', $tmp['xfer']).";};\n";
+			} else {
+				$options .= "        allow-transfer {none;};\n";
+			}
 
-			
-			$zones_sec[] = array(	'zone' => substr($tmp['origin'],0,-1),
-									'zonefile_path' => $sec_zonefiles_path.str_replace("/", "_",substr($tmp['origin'],0,-1)),
-									'options' => $options
-								);
 
-//			$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($tmp['origin'],0,-1));
-//			$app->log("Writing BIND domain file: ".$filename,LOGLEVEL_DEBUG);
+			$zones_sec[] = array( 'zone' => substr($tmp['origin'], 0, -1),
+				'zonefile_path' => $sec_zonefiles_path.str_replace("/", "_", substr($tmp['origin'], 0, -1)),
+				'options' => $options
+			);
 
-					
+			//   $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($tmp['origin'],0,-1));
+			//   $app->log("Writing BIND domain file: ".$filename,LOGLEVEL_DEBUG);
+
+
 		}
-		
+
 		$tpl_sec = new tpl();
 		$tpl_sec->newTemplate("bind_named.conf.local.slave");
-		$tpl_sec->setLoop('zones',$zones_sec); 
-    		
-		file_put_contents($dns_config['named_conf_local_path'],$tpl->grab()."\n".$tpl_sec->grab()); 
-		$app->log("Writing BIND named.conf.local file: ".$dns_config['named_conf_local_path'],LOGLEVEL_DEBUG);
+		$tpl_sec->setLoop('zones', $zones_sec);
 
- 		unset($tpl_sec); 
-		unset($zones_sec); 
-		unset($tmps_sec);  
+		file_put_contents($dns_config['named_conf_local_path'], $tpl->grab()."\n".$tpl_sec->grab());
+		$app->log("Writing BIND named.conf.local file: ".$dns_config['named_conf_local_path'], LOGLEVEL_DEBUG);
+
+		unset($tpl_sec);
+		unset($zones_sec);
+		unset($tmps_sec);
 		unset($tpl);
 		unset($zones);
 		unset($tmps);
-		
+
 	}
-	
-	
-	
+
+
+
 
 } // end class
 
diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php
index 963d71e..c3bd5b7 100644
--- a/server/plugins-available/cron_jailkit_plugin.inc.php
+++ b/server/plugins-available/cron_jailkit_plugin.inc.php
@@ -30,70 +30,72 @@
 */
 
 class cron_jailkit_plugin {
-	
+
 	//* $plugin_name and $class_name have to be the same then the name of this class
 	var $plugin_name = 'cron_jailkit_plugin';
 	var $class_name = 'cron_jailkit_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-        $app->plugins->registerEvent('cron_insert', $this->plugin_name, 'insert');
-        $app->plugins->registerEvent('cron_update', $this->plugin_name, 'update');
-        $app->plugins->registerEvent('cron_delete', $this->plugin_name, 'delete');
-		
+
+		$app->plugins->registerEvent('cron_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('cron_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('cron_delete', $this->plugin_name, 'delete');
+
 	}
-	
+
 	//* This function is called, when a cron job is inserted in the database
-	function insert($event_name,$data) {
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-        if($data["new"]["parent_domain_id"] == '') {
-            $app->log("Parent domain not set",LOGLEVEL_WARN);
-            return 0;
-        }
-        
-        //* get data from web
-        $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `domain` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
-        if(!$parent_domain["domain_id"]) {
-            $app->log("Parent domain not found",LOGLEVEL_WARN);
-            return 0;
-        } elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
-            $app->log("Websites (and Crons) cannot be owned by the root user or group.",LOGLEVEL_WARN);
-            return 0;
-        }
-		
+
+		if($data["new"]["parent_domain_id"] == '') {
+			$app->log("Parent domain not set", LOGLEVEL_WARN);
+			return 0;
+		}
+
+		//* get data from web
+		$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `domain` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
+		if(!$parent_domain["domain_id"]) {
+			$app->log("Parent domain not found", LOGLEVEL_WARN);
+			return 0;
+		} elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
+			$app->log("Websites (and Crons) cannot be owned by the root user or group.", LOGLEVEL_WARN);
+			return 0;
+		}
+
 		$this->parent_domain = $parent_domain;
-		
-        $app->uses('system');
-		
+
+		$app->uses('system');
+
 		if($app->system->is_user($parent_domain['system_user'])) {
-		
+
 			/**
-		 	* Setup Jailkit Chroot System If Enabled 
-		 	*/
+			 * Setup Jailkit Chroot System If Enabled
+			 */
+
+
 			if ($data['new']['type'] == "chrooted")
 			{
 				// load the server configuration options
@@ -103,73 +105,75 @@
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
                 $this->parent_domain = $parent_domain;
-			
+
 				$this->_setup_jailkit_chroot();
-				
+
 				//$command .= 'usermod -U '.escapeshellcmd($parent_domain['system_user']);
 				//exec($command);
-				
+
 				$this->_add_jailkit_user();
 				*/
 				$app->uses("getconf");
 				$this->data = $data;
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($parent_domain['document_root'],false);
-			
+
+				$app->system->web_folder_protection($parent_domain['document_root'], false);
+
 				$this->_setup_jailkit_chroot();
-				
+
 				$this->_add_jailkit_user();
-				
+
 				$command .= 'usermod -U '.escapeshellcmd($parent_domain["system_user"]).' 2>/dev/null';
 				exec($command);
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($parent_domain['document_root'],true);
+
+				$app->system->web_folder_protection($parent_domain['document_root'], true);
 			}
-		
-			$app->log("Jailkit Plugin (Cron) -> insert username:".$parent_domain['system_user'],LOGLEVEL_DEBUG);
-			
+
+			$app->log("Jailkit Plugin (Cron) -> insert username:".$parent_domain['system_user'], LOGLEVEL_DEBUG);
+
 		} else {
-			$app->log("Jailkit Plugin (Cron) -> insert username:".$parent_domain['system_user']." skipped, the user does not exist.",LOGLEVEL_WARN);
+			$app->log("Jailkit Plugin (Cron) -> insert username:".$parent_domain['system_user']." skipped, the user does not exist.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	//* This function is called, when a cron job is updated in the database
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
-        if($data["new"]["parent_domain_id"] == '') {
-            $app->log("Parent domain not set",LOGLEVEL_WARN);
-            return 0;
-        }
-        //* get data from web
-        $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `domain` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
-        if(!$parent_domain["domain_id"]) {
-            $app->log("Parent domain not found",LOGLEVEL_WARN);
-            return 0;
-        } elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
-            $app->log("Websites (and Crons) cannot be owned by the root user or group.",LOGLEVEL_WARN);
-            return 0;
-        }
-		
-        $app->uses('system');
-		
+
+		if($data["new"]["parent_domain_id"] == '') {
+			$app->log("Parent domain not set", LOGLEVEL_WARN);
+			return 0;
+		}
+		//* get data from web
+		$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `domain` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
+		if(!$parent_domain["domain_id"]) {
+			$app->log("Parent domain not found", LOGLEVEL_WARN);
+			return 0;
+		} elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
+			$app->log("Websites (and Crons) cannot be owned by the root user or group.", LOGLEVEL_WARN);
+			return 0;
+		}
+
+		$app->uses('system');
+
 		$this->parent_domain = $parent_domain;
-		
+
 		if($app->system->is_user($parent_domain['system_user'])) {
-        
+
+
+
 			/**
-		 	* Setup Jailkit Chroot System If Enabled 
-		 	*/
+			 * Setup Jailkit Chroot System If Enabled
+			 */
 			if ($data['new']['type'] == "chrooted")
 			{
-                $app->log("Jailkit Plugin (Cron) -> setting up jail", LOGLEVEL_DEBUG);
+				$app->log("Jailkit Plugin (Cron) -> setting up jail", LOGLEVEL_DEBUG);
 				// load the server configuration options
 				/*
 				$app->uses("getconf");
@@ -177,7 +181,7 @@
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
                 $this->parent_domain = $parent_domain;
-			
+
 				$this->_setup_jailkit_chroot();
 				$this->_add_jailkit_user();
 				*/
@@ -187,162 +191,162 @@
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
 
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($parent_domain['document_root'],false);
-			
+
+				$app->system->web_folder_protection($parent_domain['document_root'], false);
+
 				$this->_setup_jailkit_chroot();
 				$this->_add_jailkit_user();
-				
+
 				$this->_update_website_security_level();
-				$app->system->web_folder_protection($parent_domain['document_root'],true);
+				$app->system->web_folder_protection($parent_domain['document_root'], true);
 			}
-		
-			$app->log("Jailkit Plugin (Cron) -> update username:".$parent_domain['system_user'],LOGLEVEL_DEBUG);
-			
+
+			$app->log("Jailkit Plugin (Cron) -> update username:".$parent_domain['system_user'], LOGLEVEL_DEBUG);
+
 		} else {
-			$app->log("Jailkit Plugin (Cron) -> update username:".$parent_domain['system_user']." skipped, the user does not exist.",LOGLEVEL_WARN);
+			$app->log("Jailkit Plugin (Cron) -> update username:".$parent_domain['system_user']." skipped, the user does not exist.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	//* This function is called, when a cron job is deleted in the database
-	function delete($event_name,$data) {
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* nothing to do here!
-		
+
 	}
-	
+
 	function _setup_jailkit_chroot()
 	{
-		global $app;	
-			
-			//check if the chroot environment is created yet if not create it with a list of program sections from the config
-			if (!is_dir($this->parent_domain['document_root'].'/etc/jailkit'))
-			{
-				$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
-				$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
-				$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
-				exec($command.' 2>/dev/null');
-				
-				$this->app->log("Added jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
-				
-				//$this->_add_jailkit_programs(); // done later on
-				
-				$this->app->load('tpl');
-		
-				$tpl = new tpl();
-				$tpl->newTemplate("bash.bashrc.master");
-				
-				$tpl->setVar('jailkit_chroot',true);
-				$tpl->setVar('domain',$this->parent_domain['domain']);
-                $tpl->setVar('home_dir',$this->_get_home_dir(""));
-				
-				$bashrc = escapeshellcmd($this->parent_domain['document_root']).'/etc/bash.bashrc';
-				if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
-				
-				$app->system->file_put_contents($bashrc,$tpl->grab());
-				unset($tpl);
-				
-				$this->app->log('Added bashrc script: '.$bashrc,LOGLEVEL_DEBUG);
-				
-				$tpl = new tpl();
-				$tpl->newTemplate('motd.master');
-				
-				$tpl->setVar('domain',$this->parent_domain['domain']);
-				
-				$motd = escapeshellcmd($this->parent_domain['document_root']).'/var/run/motd';
-				if(@is_file($motd) || @is_link($motd)) unlink($motd);
-				
-				$app->system->file_put_contents($motd,$tpl->grab());
-				
-			}
-            $this->_add_jailkit_programs();
+		global $app;
+
+		//check if the chroot environment is created yet if not create it with a list of program sections from the config
+		if (!is_dir($this->parent_domain['document_root'].'/etc/jailkit'))
+		{
+			$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
+			$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
+			$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
+			exec($command.' 2>/dev/null');
+
+			$this->app->log("Added jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+			//$this->_add_jailkit_programs(); // done later on
+
+			$this->app->load('tpl');
+
+			$tpl = new tpl();
+			$tpl->newTemplate("bash.bashrc.master");
+
+			$tpl->setVar('jailkit_chroot', true);
+			$tpl->setVar('domain', $this->parent_domain['domain']);
+			$tpl->setVar('home_dir', $this->_get_home_dir(""));
+
+			$bashrc = escapeshellcmd($this->parent_domain['document_root']).'/etc/bash.bashrc';
+			if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
+
+			$app->system->file_put_contents($bashrc, $tpl->grab());
+			unset($tpl);
+
+			$this->app->log('Added bashrc script: '.$bashrc, LOGLEVEL_DEBUG);
+
+			$tpl = new tpl();
+			$tpl->newTemplate('motd.master');
+
+			$tpl->setVar('domain', $this->parent_domain['domain']);
+
+			$motd = escapeshellcmd($this->parent_domain['document_root']).'/var/run/motd';
+			if(@is_file($motd) || @is_link($motd)) unlink($motd);
+
+			$app->system->file_put_contents($motd, $tpl->grab());
+
+		}
+		$this->_add_jailkit_programs();
 	}
-	
+
 	function _add_jailkit_programs()
 	{
 		global $app;
-		
+
 		//copy over further programs and its libraries
 		$command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
 		$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
 		$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_programs'].'\'';
 		exec($command.' 2>/dev/null');
-		
-		$this->app->log("Added programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
-        
-        $command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
-        $command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
-        $command .= ' \''.$this->jailkit_config['jailkit_chroot_cron_programs'].'\'';
-        exec($command.' 2>/dev/null');
-        
-        $this->app->log("Added cron programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
+
+		$this->app->log("Added programs to jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+		$command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
+		$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
+		$command .= ' \''.$this->jailkit_config['jailkit_chroot_cron_programs'].'\'';
+		exec($command.' 2>/dev/null');
+
+		$this->app->log("Added cron programs to jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
 	}
-	
+
 	function _add_jailkit_user()
 	{
-			global $app;
-			
-			//add the user to the chroot
-            $jailkit_chroot_userhome = $this->_get_home_dir($this->parent_domain['system_user']);
-			
-			if(!is_dir($this->parent_domain['document_root'].'/etc')) mkdir($this->parent_domain['document_root'].'/etc');
-			if(!is_file($this->parent_domain['document_root'].'/etc/passwd')) exec('touch '.$this->parent_domain['document_root'].'/etc/passwd');
-			
-			// IMPORTANT!
-			// ALWAYS create the user. Even if the user was created before
-			// if we check if the user exists, then a update (no shell -> jailkit) will not work
-			// and the user has FULL ACCESS to the root of the server!
-			$command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh';
-			$command .= ' '.escapeshellcmd($this->parent_domain['system_user']);
-			$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
-			$command .= ' '.$jailkit_chroot_userhome;
-			$command .= ' '.escapeshellcmd("/bin/bash");
-			exec($command.' 2>/dev/null');
-				
-			$this->app->log("Added jailkit user to chroot with command: ".$command,LOGLEVEL_DEBUG);
-				
-			$app->system->mkdir(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), 0755, true);
-			$app->system->chown(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), escapeshellcmd($this->parent_domain['system_user']));
-			$app->system->chgrp(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), escapeshellcmd($this->parent_domain['system_group']));
-			
+		global $app;
+
+		//add the user to the chroot
+		$jailkit_chroot_userhome = $this->_get_home_dir($this->parent_domain['system_user']);
+
+		if(!is_dir($this->parent_domain['document_root'].'/etc')) mkdir($this->parent_domain['document_root'].'/etc');
+		if(!is_file($this->parent_domain['document_root'].'/etc/passwd')) exec('touch '.$this->parent_domain['document_root'].'/etc/passwd');
+
+		// IMPORTANT!
+		// ALWAYS create the user. Even if the user was created before
+		// if we check if the user exists, then a update (no shell -> jailkit) will not work
+		// and the user has FULL ACCESS to the root of the server!
+		$command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh';
+		$command .= ' '.escapeshellcmd($this->parent_domain['system_user']);
+		$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
+		$command .= ' '.$jailkit_chroot_userhome;
+		$command .= ' '.escapeshellcmd("/bin/bash");
+		exec($command.' 2>/dev/null');
+
+		$this->app->log("Added jailkit user to chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+		$app->system->mkdir(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), 0755, true);
+		$app->system->chown(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), escapeshellcmd($this->parent_domain['system_user']));
+		$app->system->chgrp(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), escapeshellcmd($this->parent_domain['system_group']));
+
 	}
-	
-    function _get_home_dir($username)
-    {
-        return str_replace("[username]",escapeshellcmd($username),$this->jailkit_config["jailkit_chroot_home"]);
-    }
-	
+
+	function _get_home_dir($username)
+	{
+		return str_replace("[username]", escapeshellcmd($username), $this->jailkit_config["jailkit_chroot_home"]);
+	}
+
 	//* Update the website root directory permissions depending on the security level
 	function _update_website_security_level() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		// Get the parent website of this shell user
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['new']['parent_domain_id']);
-		
+
 		//* If the security level is set to high
 		if($web_config['security_level'] == 20 && is_array($web)) {
-			$app->system->web_folder_protection($web["document_root"],false);
-			$app->system->chmod($web["document_root"],0755);
-			$app->system->chown($web["document_root"],'root');
-			$app->system->chgrp($web["document_root"],'root');
-			$app->system->web_folder_protection($web["document_root"],true);
+			$app->system->web_folder_protection($web["document_root"], false);
+			$app->system->chmod($web["document_root"], 0755);
+			$app->system->chown($web["document_root"], 'root');
+			$app->system->chgrp($web["document_root"], 'root');
+			$app->system->web_folder_protection($web["document_root"], true);
 		}
 	}
-	
+
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
-    
-	
+
+
 
 } // end class
 
diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php
index cf9baa8..21d72e6 100644
--- a/server/plugins-available/cron_plugin.inc.php
+++ b/server/plugins-available/cron_plugin.inc.php
@@ -30,228 +30,229 @@
 */
 
 class cron_plugin {
-	
+
 	var $plugin_name = 'cron_plugin';
 	var $class_name = 'cron_plugin';
-	
+
 	// private variables
 	var $action = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('cron_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('cron_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('cron_delete',$this->plugin_name,'delete');
-		
+
+		$app->plugins->registerEvent('cron_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('cron_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('cron_delete', $this->plugin_name, 'delete');
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
-		
+		$this->update($event_name, $data);
+
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($this->action != 'insert') $this->action = 'update';
-		
+
 		// load the server configuration options
 		$app->uses("getconf");
-		
+
 		if($data["new"]["parent_domain_id"] == '') {
-			$app->log("Parent domain not set",LOGLEVEL_WARN);
+			$app->log("Parent domain not set", LOGLEVEL_WARN);
 			return 0;
 		}
-        
-        //* get data from web
-        $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
-        if(!$parent_domain["domain_id"]) {
-            $app->log("Parent domain not found",LOGLEVEL_WARN);
-            return 0;
-        } elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
-			$app->log("Websites (and Crons) cannot be owned by the root user or group.",LOGLEVEL_WARN);
+
+		//* get data from web
+		$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
+		if(!$parent_domain["domain_id"]) {
+			$app->log("Parent domain not found", LOGLEVEL_WARN);
+			return 0;
+		} elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
+			$app->log("Websites (and Crons) cannot be owned by the root user or group.", LOGLEVEL_WARN);
 			return 0;
 		}
-		
+
 		// Get the client ID
 		$client = $app->dbmaster->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($data["new"]["sys_groupid"]));
 		$client_id = intval($client["client_id"]);
 		unset($client);
-		
+
 		// Create group and user, if not exist
 		$app->uses("system");
-		
+
 		$groupname = escapeshellcmd($parent_domain["system_group"]);
 		if($parent_domain["system_group"] != '' && !$app->system->is_group($parent_domain["system_group"])) {
 			exec("groupadd $groupname");
-			$app->log("Adding the group: $groupname",LOGLEVEL_DEBUG);
+			$app->log("Adding the group: $groupname", LOGLEVEL_DEBUG);
 		}
-		
+
 		$username = escapeshellcmd($parent_domain["system_user"]);
 		if($parent_domain["system_user"] != '' && !$app->system->is_user($parent_domain["system_user"])) {
 			exec("useradd -d ".escapeshellcmd($parent_domain["document_root"])." -g $groupname $username -s /bin/false");
-			$app->log("Adding the user: $username",LOGLEVEL_DEBUG);
+			$app->log("Adding the user: $username", LOGLEVEL_DEBUG);
 		}
-		
+
 		// Set the quota for the user
 		if($username != '' && $app->system->is_user($username)) {
 			if($parent_domain["hd_quota"] > 0){
-    			$blocks_soft = $parent_domain["hd_quota"] * 1024;
-    			$blocks_hard = $blocks_soft + 1024;
-  			} else {
-    			$blocks_soft = $blocks_hard = 0;
-  			}
+				$blocks_soft = $parent_domain["hd_quota"] * 1024;
+				$blocks_hard = $blocks_soft + 1024;
+			} else {
+				$blocks_soft = $blocks_hard = 0;
+			}
 			exec("setquota -u $username $blocks_soft $blocks_hard 0 0 -a &> /dev/null");
 			exec("setquota -T -u $username 604800 604800 -a &> /dev/null");
 		}
-		
+
 		//TODO : change this when distribution information has been integrated into server record
-        //* Gentoo requires a user to be part of the crontab group.
-        if (file_exists('/etc/gentoo-release')) {
-        	if (strpos($app->system->get_user_groups($username), 'crontab') === false) {
-        		$app->system->add_user_to_group('crontab', $username);
-        	}
-        }
-		
+		//* Gentoo requires a user to be part of the crontab group.
+		if (file_exists('/etc/gentoo-release')) {
+			if (strpos($app->system->get_user_groups($username), 'crontab') === false) {
+				$app->system->add_user_to_group('crontab', $username);
+			}
+		}
+
 		// make temp directory writable for the apache and website users
 		$app->system->chmod(escapeshellcmd($parent_domain["document_root"].'/tmp'), 0777);
-		
-        /** TODO READ CRON MASTER **/
-        
-        $this->parent_domain = $parent_domain;
+
+		/** TODO READ CRON MASTER **/
+
+
+		$this->parent_domain = $parent_domain;
 		$this->_write_crontab();
-		
+
 		$this->action = '';
-        
+
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
-        //* get data from web
-        $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ".intval($data["old"]["parent_domain_id"]));
-        if(!$parent_domain["domain_id"]) {
-            $app->log("Parent domain not found",LOGLEVEL_WARN);
-            return 0;
-        }
-        
-        // Get the client ID
-        $client = $app->dbmaster->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($data["old"]["sys_groupid"]));
-        $client_id = intval($client["client_id"]);
-        unset($client);
-        
-        $this->parent_domain = $parent_domain;
-        $this->_write_crontab();
+
+		//* get data from web
+		$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ".intval($data["old"]["parent_domain_id"]));
+		if(!$parent_domain["domain_id"]) {
+			$app->log("Parent domain not found", LOGLEVEL_WARN);
+			return 0;
+		}
+
+		// Get the client ID
+		$client = $app->dbmaster->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($data["old"]["sys_groupid"]));
+		$client_id = intval($client["client_id"]);
+		unset($client);
+
+		$this->parent_domain = $parent_domain;
+		$this->_write_crontab();
 	}
-    
-    function _write_crontab() {
-        global $app, $conf;
-        
-        //* load the server configuration options
-        $app->uses("getconf");
-        
-        $cron_config = $app->getconf->get_server_config($conf["server_id"], 'cron');
-        
-        //* try to find customer's mail address
-        
-        /** TODO: add possibility for client to choose mail notification! **/
-        $cron_content = "MAILTO=''\n";
+
+	function _write_crontab() {
+		global $app, $conf;
+
+		//* load the server configuration options
+		$app->uses("getconf");
+
+		$cron_config = $app->getconf->get_server_config($conf["server_id"], 'cron');
+
+		//* try to find customer's mail address
+
+		/** TODO: add possibility for client to choose mail notification! **/
+		$cron_content = "MAILTO=''\n";
 		$cron_content .= "SHELL='/bin/sh'\n\n";
-        $chr_cron_content = "MAILTO=''\n";
-        $chr_cron_content .= "SHELL='/usr/sbin/jk_chrootsh'\n\n";
-        
-        $cmd_count = 0;
-        $chr_cmd_count = 0;
-        
-        //* read all active cron jobs from database and write them to file
-        $cron_jobs = $app->db->queryAllRecords("SELECT c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ".intval($this->parent_domain["domain_id"]) . " AND c.`active` = 'y'");
-        if($cron_jobs && count($cron_jobs) > 0) {
-            foreach($cron_jobs as $job) {
+		$chr_cron_content = "MAILTO=''\n";
+		$chr_cron_content .= "SHELL='/usr/sbin/jk_chrootsh'\n\n";
+
+		$cmd_count = 0;
+		$chr_cmd_count = 0;
+
+		//* read all active cron jobs from database and write them to file
+		$cron_jobs = $app->db->queryAllRecords("SELECT c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ".intval($this->parent_domain["domain_id"]) . " AND c.`active` = 'y'");
+		if($cron_jobs && count($cron_jobs) > 0) {
+			foreach($cron_jobs as $job) {
 				if($job['run_month'] == '@reboot') {
 					$command = "@reboot";
 				} else {
 					$command = str_replace(" ", "", $job['run_min']) . "\t" . str_replace(" ", "", $job['run_hour']) . "\t" . str_replace(" ", "", $job['run_mday']) . "\t" . str_replace(" ", "", $job['run_month']) . "\t" . str_replace(" ", "", $job['run_wday']);
-                }
+				}
 				$command .= "\t{$this->parent_domain['system_user']}"; //* running as user
-                if($job['type'] == 'url') {
-                    $command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O /dev/null " . escapeshellarg($job['command']) . " >/dev/null 2>&1";
-                } else {
-                    if($job['type'] == 'chrooted') {
-                        if(substr($job['command'], 0, strlen($this->parent_domain['document_root'])) == $this->parent_domain['document_root']) {
-                            //* delete the unneeded path part
-                            $job['command'] = substr($job['command'], strlen($this->parent_domain['document_root']));
-                        }
-                    }
-                    
-                    $command .= "\t";
-                    if($job['type'] == 'chrooted' && substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
-                    $command .= $job['command'];
-                }
-                
-                if($job['type'] == 'chrooted') {
-                    $chr_cron_content .= $command . " #{$job['domain']}\n";
-                    $chr_cmd_count++;
-                } else {
-                    $cron_content .= $command . " #{$job['domain']}\n";
-                    $cmd_count++;
-                }
-            }
-        }
-        
-        $cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_'.$this->parent_domain["system_user"]);
-        //TODO : change this when distribution information has been integrated into server record
-        //* Gentoo vixie-cron requires files to end with .cron in the cron.d directory
-        if (file_exists('/etc/gentoo-release')) {
-        	$cron_file .= '.cron';
-        }
-        
-        if($cmd_count > 0) {
-            $app->system->file_put_contents($cron_file, $cron_content);
-            $app->log("Wrote Cron file $cron_file with content:\n$cron_content",LOGLEVEL_DEBUG);
-        } else {
-            $app->system->unlink($cron_file);
-            $app->log("Deleted Cron file $cron_file",LOGLEVEL_DEBUG);
-        }
-        
-        $cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_chrooted_'.$this->parent_domain["system_user"]);
-        if($chr_cmd_count > 0) {
-            $app->system->file_put_contents($cron_file, $chr_cron_content);
-            $app->log("Wrote Cron file $cron_file with content:\n$chr_cron_content",LOGLEVEL_DEBUG);
-        } else {
-            $app->system->unlink($cron_file);
-            $app->log("Deleted Cron file $cron_file",LOGLEVEL_DEBUG);
-        }
-        
-        return 0;
-    }
+				if($job['type'] == 'url') {
+					$command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O /dev/null " . escapeshellarg($job['command']) . " >/dev/null 2>&1";
+				} else {
+					if($job['type'] == 'chrooted') {
+						if(substr($job['command'], 0, strlen($this->parent_domain['document_root'])) == $this->parent_domain['document_root']) {
+							//* delete the unneeded path part
+							$job['command'] = substr($job['command'], strlen($this->parent_domain['document_root']));
+						}
+					}
+
+					$command .= "\t";
+					if($job['type'] == 'chrooted' && substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
+					$command .= $job['command'];
+				}
+
+				if($job['type'] == 'chrooted') {
+					$chr_cron_content .= $command . " #{$job['domain']}\n";
+					$chr_cmd_count++;
+				} else {
+					$cron_content .= $command . " #{$job['domain']}\n";
+					$cmd_count++;
+				}
+			}
+		}
+
+		$cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_'.$this->parent_domain["system_user"]);
+		//TODO : change this when distribution information has been integrated into server record
+		//* Gentoo vixie-cron requires files to end with .cron in the cron.d directory
+		if (file_exists('/etc/gentoo-release')) {
+			$cron_file .= '.cron';
+		}
+
+		if($cmd_count > 0) {
+			$app->system->file_put_contents($cron_file, $cron_content);
+			$app->log("Wrote Cron file $cron_file with content:\n$cron_content", LOGLEVEL_DEBUG);
+		} else {
+			$app->system->unlink($cron_file);
+			$app->log("Deleted Cron file $cron_file", LOGLEVEL_DEBUG);
+		}
+
+		$cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_chrooted_'.$this->parent_domain["system_user"]);
+		if($chr_cmd_count > 0) {
+			$app->system->file_put_contents($cron_file, $chr_cron_content);
+			$app->log("Wrote Cron file $cron_file with content:\n$chr_cron_content", LOGLEVEL_DEBUG);
+		} else {
+			$app->system->unlink($cron_file);
+			$app->log("Deleted Cron file $cron_file", LOGLEVEL_DEBUG);
+		}
+
+		return 0;
+	}
 
 } // end class
 
diff --git a/server/plugins-available/firewall_plugin.inc.php b/server/plugins-available/firewall_plugin.inc.php
index 7197ccc..498c9c6 100644
--- a/server/plugins-available/firewall_plugin.inc.php
+++ b/server/plugins-available/firewall_plugin.inc.php
@@ -29,99 +29,99 @@
 */
 
 class firewall_plugin {
-	
+
 	private $plugin_name = 'firewall_plugin';
 	private $class_name  = 'firewall_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	public function onInstall() {
 		global $conf;
-		
+
 		if($conf['bastille']['installed'] = true && $conf['services']['firewall'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	public function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* Mailboxes
-		$app->plugins->registerEvent('firewall_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('firewall_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('firewall_delete',$this->plugin_name,'delete');
+		$app->plugins->registerEvent('firewall_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('firewall_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('firewall_delete', $this->plugin_name, 'delete');
 	}
-	
-	
-	public function insert($event_name,$data) {
+
+
+	public function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
-	public function update($event_name,$data) {
+
+	public function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* load the server configuration options
 		$app->uses('getconf');
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
 		if($server_config['firewall'] == 'ufw') {
-			$this->ufw_update($event_name,$data);
+			$this->ufw_update($event_name, $data);
 		} else {
-			$this->bastille_update($event_name,$data);
+			$this->bastille_update($event_name, $data);
 		}
-		
+
 	}
-	
-	public function delete($event_name,$data) {
+
+	public function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* load the server configuration options
 		$app->uses('getconf');
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-		
+
 		if($server_config['firewall'] == 'ufw') {
-			$this->ufw_delete($event_name,$data);
+			$this->ufw_delete($event_name, $data);
 		} else {
-			$this->bastille_delete($event_name,$data);
+			$this->bastille_delete($event_name, $data);
 		}
-		
+
 	}
-	
-	private function ufw_update($event_name,$data) {
+
+	private function ufw_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		if(!$app->system->is_installed('ufw')) {
-			$app->log('UFW Firewall is not installed',LOGLEVEL_WARN);
+			$app->log('UFW Firewall is not installed', LOGLEVEL_WARN);
 			return false;
 		}
-		
-		exec('ufw --version',$out);
-		$parts = explode(' ',$out[0]);
+
+		exec('ufw --version', $out);
+		$parts = explode(' ', $out[0]);
 		$ufwversion = $parts[1];
 		unset($parts);
 		unset($out);
 
-		if(version_compare ( $ufwversion , '0.30') < 0) {
-			$app->log('The installed UFW Firewall version is too old. Minimum required version 0.30',LOGLEVEL_WARN);
+		if(version_compare( $ufwversion , '0.30') < 0) {
+			$app->log('The installed UFW Firewall version is too old. Minimum required version 0.30', LOGLEVEL_WARN);
 			return false;
 		}
-		
+
 		//* Basic firewall setup when the firewall is added the first time
 		if($event_name == 'firewall_insert') {
 			exec('ufw --force disable');
@@ -129,53 +129,53 @@
 			exec('ufw default deny incoming');
 			exec('ufw default allow outgoing');
 		}
-		
-		$tcp_ports_new = $this->clean_ports($data['new']['tcp_port'],',');
-		$tcp_ports_old = $this->clean_ports($data['old']['tcp_port'],',');
-		$udp_ports_new = $this->clean_ports($data['new']['udp_port'],',');
-		$udp_ports_old = $this->clean_ports($data['old']['udp_port'],',');
-		
-		$tcp_ports_new_array = explode(',',$tcp_ports_new);
-		$tcp_ports_old_array = explode(',',$tcp_ports_old);
-		$udp_ports_new_array = explode(',',$udp_ports_new);
-		$udp_ports_old_array = explode(',',$udp_ports_old);
-		
+
+		$tcp_ports_new = $this->clean_ports($data['new']['tcp_port'], ',');
+		$tcp_ports_old = $this->clean_ports($data['old']['tcp_port'], ',');
+		$udp_ports_new = $this->clean_ports($data['new']['udp_port'], ',');
+		$udp_ports_old = $this->clean_ports($data['old']['udp_port'], ',');
+
+		$tcp_ports_new_array = explode(',', $tcp_ports_new);
+		$tcp_ports_old_array = explode(',', $tcp_ports_old);
+		$udp_ports_new_array = explode(',', $udp_ports_new);
+		$udp_ports_old_array = explode(',', $udp_ports_old);
+
 		//* add tcp ports
 		foreach($tcp_ports_new_array as $port) {
-			if(!in_array($port,$tcp_ports_old_array) && $port > 0) {
+			if(!in_array($port, $tcp_ports_old_array) && $port > 0) {
 				exec('ufw allow '.$port.'/tcp');
-				$app->log('ufw allow '.$port.'/tcp',LOGLEVEL_DEBUG);
+				$app->log('ufw allow '.$port.'/tcp', LOGLEVEL_DEBUG);
 				sleep(1);
 			}
 		}
-		
+
 		//* remove tcp ports
 		foreach($tcp_ports_old_array as $port) {
-			if(!in_array($port,$tcp_ports_new_array) && $port > 0) {
+			if(!in_array($port, $tcp_ports_new_array) && $port > 0) {
 				exec('ufw delete allow '.$port.'/tcp');
-				$app->log('ufw delete allow '.$port.'/tcp',LOGLEVEL_DEBUG);
+				$app->log('ufw delete allow '.$port.'/tcp', LOGLEVEL_DEBUG);
 				sleep(1);
 			}
 		}
-		
+
 		//* add udp ports
 		foreach($udp_ports_new_array as $port) {
-			if(!in_array($port,$udp_ports_old_array) && $port > 0) {
+			if(!in_array($port, $udp_ports_old_array) && $port > 0) {
 				exec('ufw allow '.$port.'/udp');
-				$app->log('ufw allow '.$port.'/udp',LOGLEVEL_DEBUG);
+				$app->log('ufw allow '.$port.'/udp', LOGLEVEL_DEBUG);
 				sleep(1);
 			}
 		}
-		
+
 		//* remove udp ports
 		foreach($udp_ports_old_array as $port) {
-			if(!in_array($port,$udp_ports_new_array) && $port > 0) {
+			if(!in_array($port, $udp_ports_new_array) && $port > 0) {
 				exec('ufw delete allow '.$port.'/udp');
-				$app->log('ufw delete allow '.$port.'/udp',LOGLEVEL_DEBUG);
+				$app->log('ufw delete allow '.$port.'/udp', LOGLEVEL_DEBUG);
 				sleep(1);
 			}
 		}
-		
+
 		/*
 		if($tcp_ports_new != $tcp_ports_old) {
 			exec('ufw allow to any proto tcp port '.$tcp_ports_new);
@@ -185,7 +185,7 @@
 				$app->log('ufw delete allow to any proto tcp port '.$tcp_ports_old,LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		if($udp_ports_new != $udp_ports_old) {
 			exec('ufw allow to any proto udp port '.$udp_ports_new);
 			$app->log('ufw allow to any proto udp port '.$udp_ports_new,LOGLEVEL_DEBUG);
@@ -195,61 +195,61 @@
 			}
 		}
 		*/
-		
+
 		if($data['new']['active'] == 'y') {
 			if($data['new']['active'] == $data['old']['active']) {
 				exec('ufw reload');
-				$app->log('Reloading the firewall',LOGLEVEL_DEBUG);
+				$app->log('Reloading the firewall', LOGLEVEL_DEBUG);
 			} else {
 				//* Ensure that bastille firewall is stopped
 				exec($conf['init_scripts'] . '/' . 'bastille-firewall stop 2>/dev/null');
 				if(@is_file('/etc/debian_version')) exec('update-rc.d -f bastille-firewall remove');
-			
+
 				//* Start ufw firewall
 				exec('ufw --force enable');
-				$app->log('Starting the firewall',LOGLEVEL_DEBUG);
+				$app->log('Starting the firewall', LOGLEVEL_DEBUG);
 			}
 		} else {
 			exec('ufw disable');
-			$app->log('Stopping the firewall',LOGLEVEL_DEBUG);
+			$app->log('Stopping the firewall', LOGLEVEL_DEBUG);
 		}
 	}
-	
-	private function ufw_delete($event_name,$data) {
+
+	private function ufw_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		if(!$app->system->is_installed('ufw')) {
-			$app->log('UFW Firewall is not installed',LOGLEVEL_DEBUG);
+			$app->log('UFW Firewall is not installed', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		exec('ufw --force reset');
 		exec('ufw disable');
-		$app->log('Stopping the firewall',LOGLEVEL_DEBUG);
-		
+		$app->log('Stopping the firewall', LOGLEVEL_DEBUG);
+
 	}
-	
-	private function bastille_update($event_name,$data) {
+
+	private function bastille_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
-		$tcp_ports = $this->clean_ports($data['new']['tcp_port'],' ');
-		$udp_ports = $this->clean_ports($data['new']['udp_port'],' ');
-		
+
+		$tcp_ports = $this->clean_ports($data['new']['tcp_port'], ' ');
+		$udp_ports = $this->clean_ports($data['new']['udp_port'], ' ');
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate('bastille-firewall.cfg.master');
-		
-		$tpl->setVar('TCP_PUBLIC_SERVICES',$tcp_ports);
-		$tpl->setVar('UDP_PUBLIC_SERVICES',$udp_ports);
-		
-		file_put_contents('/etc/Bastille/bastille-firewall.cfg',$tpl->grab());
-		$app->log('Writing firewall configuration /etc/Bastille/bastille-firewall.cfg',LOGLEVEL_DEBUG);
+
+		$tpl->setVar('TCP_PUBLIC_SERVICES', $tcp_ports);
+		$tpl->setVar('UDP_PUBLIC_SERVICES', $udp_ports);
+
+		file_put_contents('/etc/Bastille/bastille-firewall.cfg', $tpl->grab());
+		$app->log('Writing firewall configuration /etc/Bastille/bastille-firewall.cfg', LOGLEVEL_DEBUG);
 		unset($tpl);
-		
+
 		if($data['new']['active'] == 'y') {
 			//* ensure that ufw firewall is disabled in case both firewalls are installed
 			if($app->system->is_installed('ufw')) {
@@ -257,36 +257,36 @@
 			}
 			exec($conf['init_scripts'] . '/' . 'bastille-firewall restart 2>/dev/null');
 			if(@is_file('/etc/debian_version')) exec('update-rc.d bastille-firewall defaults');
-			$app->log('Restarting the firewall',LOGLEVEL_DEBUG);
+			$app->log('Restarting the firewall', LOGLEVEL_DEBUG);
 		} else {
 			exec($conf['init_scripts'] . '/' . 'bastille-firewall stop 2>/dev/null');
 			if(@is_file('/etc/debian_version')) exec('update-rc.d -f bastille-firewall remove');
-			$app->log('Stopping the firewall',LOGLEVEL_DEBUG);
+			$app->log('Stopping the firewall', LOGLEVEL_DEBUG);
 		}
-		
-		
+
+
 	}
-	
-	private function bastille_delete($event_name,$data) {
+
+	private function bastille_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		exec($conf['init_scripts'] . '/' . 'bastille-firewall stop 2>/dev/null');
 		if(@is_file('/etc/debian_version')) exec('update-rc.d -f bastille-firewall remove');
-		$app->log('Stopping the firewall',LOGLEVEL_DEBUG);
-		
+		$app->log('Stopping the firewall', LOGLEVEL_DEBUG);
+
 	}
-	
-	
-	private function clean_ports($portlist,$spacer) {
-		
-		$ports = explode(',',$portlist);
+
+
+	private function clean_ports($portlist, $spacer) {
+
+		$ports = explode(',', $portlist);
 		$ports_out = '';
-		
+
 		if(is_array($ports)) {
 			foreach($ports as $p) {
 				$p_clean = '';
-				if(strstr($p,':')) {
-					$p_parts = explode(':',$p);
+				if(strstr($p, ':')) {
+					$p_parts = explode(':', $p);
 					$tmp_lower = intval($p_parts[0]);
 					$tmp_higher = intval($p_parts[1]);
 					if($tmp_lower > 0 && $tmp_lower <= 65535 && $tmp_higher > 0 && $tmp_higher <= 65535 && $tmp_lower < $tmp_higher) {
@@ -299,13 +299,13 @@
 					}
 				}
 				if($p_clean != '') $ports_out .= $p_clean . $spacer;
-				
+
 			}
 		}
-		return substr($ports_out,0,strlen($spacer)*-1);
+		return substr($ports_out, 0, strlen($spacer)*-1);
 	}
-	
-	
+
+
 
 } // end class
 
diff --git a/server/plugins-available/ftpuser_base_plugin.inc.php b/server/plugins-available/ftpuser_base_plugin.inc.php
index 66723d2..af33e93 100644
--- a/server/plugins-available/ftpuser_base_plugin.inc.php
+++ b/server/plugins-available/ftpuser_base_plugin.inc.php
@@ -29,104 +29,104 @@
 */
 
 class ftpuser_base_plugin {
-	
+
 	var $plugin_name = 'ftpuser_base_plugin';
 	var $class_name = 'ftpuser_base_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('ftp_user_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('ftp_user_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('ftp_user_delete',$this->plugin_name,'delete');
 
-		
-	}
-	
-	
-	function insert($event_name,$data) {
-		global $app, $conf;
-		
-        $app->uses('system');
-        
-    if(!is_dir($data['new']['dir'])) {
-      $app->log("FTP User directory '".$data['new']['dir']."' does not exist. Creating it now.",LOGLEVEL_DEBUG);
-      
-      $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-      
-	  //* Check if the resulting path is inside the docroot
-	  if(substr($data['new']['dir'],0,strlen($web['document_root'])) != $web['document_root']) {
-		$app->log('User dir is outside of docroot.',LOGLEVEL_WARN);
-		return false;
-	  }
-	  
-      $app->system->web_folder_protection($web['document_root'],false);
-      exec('mkdir -p '.escapeshellcmd($data['new']['dir']));
-      exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']);
-	  $app->system->web_folder_protection($web['document_root'],true);
-      
-	  $app->log("Added ftpuser_dir: ".$data['new']['dir'],LOGLEVEL_DEBUG);
-    }
-    
-	}
-	
-	function update($event_name,$data) {
-		global $app, $conf;
-		
-        $app->uses('system');
-        
-    if(!is_dir($data['new']['dir'])) {
-      $app->log("FTP User directory '".$data['new']['dir']."' does not exist. Creating it now.",LOGLEVEL_DEBUG);
-      
-      $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-      
-	  //* Check if the resulting path is inside the docroot
-	  if(substr($data['new']['dir'],0,strlen($web['document_root'])) != $web['document_root']) {
-		$app->log('User dir is outside of docroot.',LOGLEVEL_WARN);
-		return false;
-	  }
+		$app->plugins->registerEvent('ftp_user_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('ftp_user_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('ftp_user_delete', $this->plugin_name, 'delete');
 
-      $app->system->web_folder_protection($web['document_root'],false);
-      exec('mkdir -p '.escapeshellcmd($data['new']['dir']));
-      exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']);
-	  $app->system->web_folder_protection($web['document_root'],true);
-      
-      $app->log("Added ftpuser_dir: ".$data['new']['dir'],LOGLEVEL_DEBUG);
-    }
+
 	}
-	
-	function delete($event_name,$data) {
+
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-    $app->log("Ftpuser:".$data['new']['username']." deleted.",LOGLEVEL_DEBUG);
-		
+
+		$app->uses('system');
+
+		if(!is_dir($data['new']['dir'])) {
+			$app->log("FTP User directory '".$data['new']['dir']."' does not exist. Creating it now.", LOGLEVEL_DEBUG);
+
+			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
+
+			//* Check if the resulting path is inside the docroot
+			if(substr($data['new']['dir'], 0, strlen($web['document_root'])) != $web['document_root']) {
+				$app->log('User dir is outside of docroot.', LOGLEVEL_WARN);
+				return false;
+			}
+
+			$app->system->web_folder_protection($web['document_root'], false);
+			exec('mkdir -p '.escapeshellcmd($data['new']['dir']));
+			exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']);
+			$app->system->web_folder_protection($web['document_root'], true);
+
+			$app->log("Added ftpuser_dir: ".$data['new']['dir'], LOGLEVEL_DEBUG);
+		}
+
 	}
-	
-	
-	
+
+	function update($event_name, $data) {
+		global $app, $conf;
+
+		$app->uses('system');
+
+		if(!is_dir($data['new']['dir'])) {
+			$app->log("FTP User directory '".$data['new']['dir']."' does not exist. Creating it now.", LOGLEVEL_DEBUG);
+
+			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
+
+			//* Check if the resulting path is inside the docroot
+			if(substr($data['new']['dir'], 0, strlen($web['document_root'])) != $web['document_root']) {
+				$app->log('User dir is outside of docroot.', LOGLEVEL_WARN);
+				return false;
+			}
+
+			$app->system->web_folder_protection($web['document_root'], false);
+			exec('mkdir -p '.escapeshellcmd($data['new']['dir']));
+			exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']);
+			$app->system->web_folder_protection($web['document_root'], true);
+
+			$app->log("Added ftpuser_dir: ".$data['new']['dir'], LOGLEVEL_DEBUG);
+		}
+	}
+
+	function delete($event_name, $data) {
+		global $app, $conf;
+
+		$app->log("Ftpuser:".$data['new']['username']." deleted.", LOGLEVEL_DEBUG);
+
+	}
+
+
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/plugins-available/getmail_plugin.inc.php b/server/plugins-available/getmail_plugin.inc.php
index eb2da0e..80424ad 100644
--- a/server/plugins-available/getmail_plugin.inc.php
+++ b/server/plugins-available/getmail_plugin.inc.php
@@ -29,84 +29,84 @@
 */
 
 class getmail_plugin {
-	
+
 	var $plugin_name = 'getmail_plugin';
 	var $class_name = 'getmail_plugin';
-	
+
 	var $getmail_config_dir = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_get_insert','getmail_plugin','insert');
-		$app->plugins->registerEvent('mail_get_update','getmail_plugin','update');
-		$app->plugins->registerEvent('mail_get_delete','getmail_plugin','delete');
-		
-		
-		
+
+		$app->plugins->registerEvent('mail_get_insert', 'getmail_plugin', 'insert');
+		$app->plugins->registerEvent('mail_get_update', 'getmail_plugin', 'update');
+		$app->plugins->registerEvent('mail_get_delete', 'getmail_plugin', 'delete');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server specific configuration options for getmail
 		$app->uses("getconf");
 		$getmail_config = $app->getconf->get_server_config($conf["server_id"], 'getmail');
 		$this->getmail_config_dir = $getmail_config["getmail_config_dir"];
-		
+
 		// Check if the config directory exists.
 		if(!is_dir($this->getmail_config_dir)) {
-			$app->log("Getmail config directory '".$this->getmail_config_dir."' does not exist.",LOGLEVEL_ERROR);
+			$app->log("Getmail config directory '".$this->getmail_config_dir."' does not exist.", LOGLEVEL_ERROR);
 		} else {
-			
+
 			// Delete the config file first, if it exists
-			$this->delete($event_name,$data);
-			
+			$this->delete($event_name, $data);
+
 			// Get the new config file path
 			$config_file_path = escapeshellcmd($this->getmail_config_dir.'/'.$this->_clean_path($data["new"]["source_server"]).'_'.$this->_clean_path($data["new"]["source_username"]).'.conf');
-			if(stristr($config_file_path, "..") or stristr($config_file_path, "|") or stristr($config_file_path,";") or stristr($config_file_path,'$')) {
-				$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.",LOGLEVEL_ERROR);
+			if(stristr($config_file_path, "..") or stristr($config_file_path, "|") or stristr($config_file_path, ";") or stristr($config_file_path, '$')) {
+				$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.", LOGLEVEL_ERROR);
 				return false;
 			}
 
-			
+
 			if($data["new"]["active"] == 'y') {
 				// Open master template
 				$tpl = file_get_contents($conf["rootpath"].'/conf/getmail.conf.master');
-			
+
 				// Shall emails be deleted after retrieval
 				if($data["new"]["source_delete"] == 'y') {
-					$tpl = str_replace('{DELETE}','true',$tpl);
+					$tpl = str_replace('{DELETE}', 'true', $tpl);
 				} else {
-					$tpl = str_replace('{DELETE}','false',$tpl);
+					$tpl = str_replace('{DELETE}', 'false', $tpl);
 				}
 
 				if($data["new"]["read_all"] == 'y') {
@@ -114,59 +114,59 @@
 				} else {
 					$tpl = str_replace('{READ_ALL}', 'false', $tpl);
 				}
-				
+
 				// Set the data retriever
 				if($data["new"]["type"] == 'pop3') {
-					$tpl = str_replace('{TYPE}','SimplePOP3Retriever',$tpl);
+					$tpl = str_replace('{TYPE}', 'SimplePOP3Retriever', $tpl);
 				} elseif ($data["new"]["type"] == 'imap') {
-					$tpl = str_replace('{TYPE}','SimpleIMAPRetriever',$tpl);
+					$tpl = str_replace('{TYPE}', 'SimpleIMAPRetriever', $tpl);
 				} elseif ($data["new"]["type"] == 'pop3ssl') {
-					$tpl = str_replace('{TYPE}','SimplePOP3SSLRetriever',$tpl);
+					$tpl = str_replace('{TYPE}', 'SimplePOP3SSLRetriever', $tpl);
 				} elseif ($data["new"]["type"] == 'imapssl') {
-					$tpl = str_replace('{TYPE}','SimpleIMAPSSLRetriever',$tpl);
+					$tpl = str_replace('{TYPE}', 'SimpleIMAPSSLRetriever', $tpl);
 				}
-			
+
 				// Set server, username, password and destination.
-				$tpl = str_replace('{SERVER}',$data["new"]["source_server"],$tpl);
-				$tpl = str_replace('{USERNAME}',$data["new"]["source_username"],$tpl);
-				$tpl = str_replace('{PASSWORD}',$data["new"]["source_password"],$tpl);
-				$tpl = str_replace('{DESTINATION}',$data["new"]["destination"],$tpl);
-				
+				$tpl = str_replace('{SERVER}', $data["new"]["source_server"], $tpl);
+				$tpl = str_replace('{USERNAME}', $data["new"]["source_username"], $tpl);
+				$tpl = str_replace('{PASSWORD}', $data["new"]["source_password"], $tpl);
+				$tpl = str_replace('{DESTINATION}', $data["new"]["destination"], $tpl);
+
 				// Write the config file.
-				file_put_contents($config_file_path,$tpl);
-				$app->log("Writing Getmail config file: $config_file_path",LOGLEVEL_DEBUG);
+				file_put_contents($config_file_path, $tpl);
+				$app->log("Writing Getmail config file: $config_file_path", LOGLEVEL_DEBUG);
 				chmod($config_file_path, 0400);
 				chown($config_file_path, 'getmail');
 				unset($tpl);
 				unset($config_file_path);
-				
+
 			} else {
 				// If record is set to inactive, we will delete the file
 				if(is_file($config_file_path)) unlink($config_file_path);
 			}
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server specific configuration options for getmail
 		$app->uses("getconf");
 		$getmail_config = $app->getconf->get_server_config($conf["server_id"], 'getmail');
 		$this->getmail_config_dir = $getmail_config["getmail_config_dir"];
-		
+
 		$config_file_path = escapeshellcmd($this->getmail_config_dir.'/'.$this->_clean_path($data["old"]["source_server"]).'_'.$this->_clean_path($data["old"]["source_username"]).'.conf');
-		if(stristr($config_file_path,"..") || stristr($config_file_path,"|") || stristr($config_file_path,";") || stristr($config_file_path,'$')) {
-			$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.",LOGLEVEL_ERROR);
+		if(stristr($config_file_path, "..") || stristr($config_file_path, "|") || stristr($config_file_path, ";") || stristr($config_file_path, '$')) {
+			$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.", LOGLEVEL_ERROR);
 			return false;
 		}
 		if(is_file($config_file_path)) unlink($config_file_path);
 	}
-	
+
 	function _clean_path($input) {
 		return preg_replace('/[^A-Za-z0-9\-_]/', '_', $input);
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/iptables_plugin.inc.php b/server/plugins-available/iptables_plugin.inc.php
index 247eb7b..92083bb 100644
--- a/server/plugins-available/iptables_plugin.inc.php
+++ b/server/plugins-available/iptables_plugin.inc.php
@@ -2,43 +2,43 @@
 
 class iptables_plugin
 {
- var $plugin_name = 'iptables_plugin';
- var $class_name  = 'iptables_plugin';
+	var $plugin_name = 'iptables_plugin';
+	var $class_name  = 'iptables_plugin';
 
- function onInstall()
- {
-  global $conf;
-  /*
+	function onInstall()
+	{
+		global $conf;
+		/*
   if($conf['iptables']['installed'] = true) return true;
   else return false;
   */
-  return false;
- }
+		return false;
+	}
 
- function onLoad()
- {
-  global $app;
-  $app->plugins->registerEvent('iptables_insert',$this->plugin_name,'insert');
-  $app->plugins->registerEvent('iptables_update',$this->plugin_name,'update');
-  $app->plugins->registerEvent('iptables_delete',$this->plugin_name,'delete');
- }
+	function onLoad()
+	{
+		global $app;
+		$app->plugins->registerEvent('iptables_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('iptables_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('iptables_delete', $this->plugin_name, 'delete');
+	}
 
- function insert($event_name,$data)
- {
-  global $app, $conf;
-  $this->update($event_name,$data);
- }
+	function insert($event_name, $data)
+	{
+		global $app, $conf;
+		$this->update($event_name, $data);
+	}
 
- function update($event_name,$data)
- {
-  global $app, $conf;
-/*
+	function update($event_name, $data)
+	{
+		global $app, $conf;
+		/*
 ok, here is where we do some fun stuff.  First off we need to see the currently
 running iptables (sans the fail2ban) and compare with the database.  This is
 the method that is good for multi servers and keeping the firewall read only so
 a comromised box will not corrupt the master server.
 
-If the running iptables and the new iptables don't match, lets send a note to 
+If the running iptables and the new iptables don't match, lets send a note to
 the monitoring data to say that there is a difference.  Maybe we can have the
 iptables gui inteface check the data field for changes and post a warning and
 or the changes as disabled rules.  If an admin adds a rule on the comand line
@@ -70,12 +70,14 @@
 $data['new'] should have lots of fun stuff
 exec('iptables -I XYZ');
 */
- }
-	
- function delete($event_name,$data)
- {
-  global $app, $conf;
-  exec('iptables -D xyz');
- }
+	}
+
+	function delete($event_name, $data)
+	{
+		global $app, $conf;
+		exec('iptables -D xyz');
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php
index 5d4fd98..5bf37d1 100644
--- a/server/plugins-available/mail_plugin.inc.php
+++ b/server/plugins-available/mail_plugin.inc.php
@@ -29,135 +29,135 @@
 */
 
 class mail_plugin {
-	
+
 	var $plugin_name = 'mail_plugin';
 	var $class_name  = 'mail_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* Mailboxes
-		$app->plugins->registerEvent('mail_user_insert',$this->plugin_name,'user_insert');
-		$app->plugins->registerEvent('mail_user_update',$this->plugin_name,'user_update');
-		$app->plugins->registerEvent('mail_user_delete',$this->plugin_name,'user_delete');
-		
+		$app->plugins->registerEvent('mail_user_insert', $this->plugin_name, 'user_insert');
+		$app->plugins->registerEvent('mail_user_update', $this->plugin_name, 'user_update');
+		$app->plugins->registerEvent('mail_user_delete', $this->plugin_name, 'user_delete');
+
 		//* Mail Domains
 		//$app->plugins->registerEvent('mail_domain_insert',$this->plugin_name,'domain_insert');
 		//$app->plugins->registerEvent('mail_domain_update',$this->plugin_name,'domain_update');
-		$app->plugins->registerEvent('mail_domain_delete',$this->plugin_name,'domain_delete');
-		
+		$app->plugins->registerEvent('mail_domain_delete', $this->plugin_name, 'domain_delete');
+
 		//* Mail transports
-		$app->plugins->registerEvent('mail_transport_insert',$this->plugin_name,'transport_update');
-		$app->plugins->registerEvent('mail_transport_update',$this->plugin_name,'transport_update');
-		$app->plugins->registerEvent('mail_transport_delete',$this->plugin_name,'transport_update');
-		
+		$app->plugins->registerEvent('mail_transport_insert', $this->plugin_name, 'transport_update');
+		$app->plugins->registerEvent('mail_transport_update', $this->plugin_name, 'transport_update');
+		$app->plugins->registerEvent('mail_transport_delete', $this->plugin_name, 'transport_update');
+
 	}
-	
-	
-	function user_insert($event_name,$data) {
+
+
+	function user_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* get the config
 		$app->uses('getconf,system');
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
 
 		// convert to lower case - it could cause problems if some directory above has upper case name
-//		$data['new']['maildir'] = strtolower($data['new']['maildir']);
-		
+		//  $data['new']['maildir'] = strtolower($data['new']['maildir']);
+
 		$maildomain_path = $data['new']['maildir'];
 		$tmp_basepath = $data['new']['maildir'];
-		$tmp_basepath_parts = explode('/',$tmp_basepath);
+		$tmp_basepath_parts = explode('/', $tmp_basepath);
 		unset($tmp_basepath_parts[count($tmp_basepath_parts)-1]);
-		$base_path = implode('/',$tmp_basepath_parts);
+		$base_path = implode('/', $tmp_basepath_parts);
 
 		//* Create the mail domain directory, if it does not exist
 		if(!empty($base_path) && !is_dir($base_path)) {
 			//exec("su -c 'mkdir -p ".escapeshellcmd($base_path)."' ".$mail_config['mailuser_name']);
 			$app->system->mkdirpath($base_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
-			$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
+			$app->log('Created Directory: '.$base_path, LOGLEVEL_DEBUG);
 		}
-		
+
 		// Dovecot uses a different mail layout with a separate 'Maildir' subdirectory.
 		if($mail_config['pop3_imap_daemon'] == 'dovecot') {
 			//exec("su -c 'mkdir -p ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			$app->system->mkdirpath($maildomain_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
-			$app->log('Created Directory: '.$maildomain_path,LOGLEVEL_DEBUG);
+			$app->log('Created Directory: '.$maildomain_path, LOGLEVEL_DEBUG);
 			$maildomain_path .= '/Maildir';
 		}
-	
+
 		//* When the mail user dir exists but it is not a valid maildir, remove it
 		if(!empty($maildomain_path) && is_dir($maildomain_path) && !is_dir($maildomain_path.'/new') && !is_dir($maildomain_path.'/cur')) {
 			exec("su -c 'rm -rf ".escapeshellcmd($data['new']['maildir'])."' vmail");
-			$app->log('Removed invalid maildir and rebuild it: '.escapeshellcmd($data['new']['maildir']),LOGLEVEL_WARN);
+			$app->log('Removed invalid maildir and rebuild it: '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_WARN);
 		}
 
 		//* Create the maildir, if it doesn not exist, set permissions, set quota.
 		if(!empty($maildomain_path) && !is_dir($maildomain_path)) {
 
 			//exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name']);
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name']);
 
 			exec('chown -R '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
-			$app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']),LOGLEVEL_DEBUG);
+			$app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_DEBUG);
 
 			//* This is to fix the maildrop quota not being rebuilt after the quota is changed.
 			if($mail_config['pop3_imap_daemon'] != 'dovecot') {
 				if(is_dir($maildomain_path)) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
-				$app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
+				$app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'], LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		if(!is_dir($data['new']['maildir'].'/.Sent')) {
 			//exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Sent');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Sent');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Drafts')) {
 			//exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Drafts');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Drafts');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Trash')) {
 			//exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Trash');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Trash');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Junk')) {
 			//exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Junk');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Junk');
 		}
-		
+
 		//* Set the maildir quota
 		if(is_dir($data['new']['maildir'].'/new') && $mail_config['pop3_imap_daemon'] != 'dovecot') {
 			if($data['new']['quota'] > 0) {
 				if(is_dir($data['new']['maildir'])) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']);
-				$app->log('Set Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
+				$app->log('Set Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'], LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		//* Send the welcome email message
 		if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) {
 			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
@@ -168,23 +168,23 @@
 		} else {
 			$lines = file($conf['rootpath'].'/conf/mail/welcome_email_en.txt');
 		}
-		
+
 		//* Get from address
-		$parts = explode(':',trim($lines[0]));
+		$parts = explode(':', trim($lines[0]));
 		unset($parts[0]);
-		$welcome_mail_from  = implode(':',$parts);
+		$welcome_mail_from  = implode(':', $parts);
 		unset($lines[0]);
-		
+
 		//* Get subject
-		$parts = explode(':',trim($lines[1]));
+		$parts = explode(':', trim($lines[1]));
 		unset($parts[0]);
-		$welcome_mail_subject  = implode(':',$parts);
+		$welcome_mail_subject  = implode(':', $parts);
 		unset($lines[1]);
-		
+
 		//* Get message
 		$welcome_mail_message = trim(implode($lines));
 		unset($tmp);
-		
+
 		$mailHeaders      = "MIME-Version: 1.0" . "\n";
 		$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
 		$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
@@ -195,19 +195,19 @@
 
 		//* Send the welcome email only on the "master" mail server to avoid duplicate emails
 		if($conf['mirror_server_id'] == 0) mail($mailTarget, $mailSubject, $welcome_mail_message, $mailHeaders);
-		
+
 	}
-	
-	function user_update($event_name,$data) {
+
+	function user_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses('getconf,system');
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
 
 		// convert to lower case - it could cause problems if some directory above has upper case name
 		// $data['new']['maildir'] = strtolower($data['new']['maildir']);
-		
+
 		// Create the maildir, if it does not exist
 		/*
 		if(!is_dir($data['new']['maildir'])) {
@@ -217,74 +217,74 @@
 			$app->log('Created Maildir: '.$data['new']['maildir'],LOGLEVEL_DEBUG);
 		}
 		*/
-		
+
 		$maildomain_path = $data['new']['maildir'];
 		$tmp_basepath = $data['new']['maildir'];
-		$tmp_basepath_parts = explode('/',$tmp_basepath);
+		$tmp_basepath_parts = explode('/', $tmp_basepath);
 		unset($tmp_basepath_parts[count($tmp_basepath_parts)-1]);
-		$base_path = implode('/',$tmp_basepath_parts);
+		$base_path = implode('/', $tmp_basepath_parts);
 
 		//* Create the mail domain directory, if it does not exist
 		if(!empty($base_path) && !is_dir($base_path)) {
 			//exec("su -c 'mkdir -p ".escapeshellcmd($base_path)."' ".$mail_config['mailuser_name']);
 			$app->system->mkdirpath($base_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
-			$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
+			$app->log('Created Directory: '.$base_path, LOGLEVEL_DEBUG);
 		}
-		
+
 		// Dovecot uses a different mail layout with a separate 'Maildir' subdirectory.
 		if($mail_config['pop3_imap_daemon'] == 'dovecot') {
 			$app->system->mkdirpath($maildomain_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
-			$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
+			$app->log('Created Directory: '.$base_path, LOGLEVEL_DEBUG);
 			$maildomain_path .= '/Maildir';
 		}
-		
+
 		//* When the mail user dir exists but it is not a valid maildir, remove it
 		if(!empty($maildomain_path) && is_dir($maildomain_path) && !is_dir($maildomain_path.'/new') && !is_dir($maildomain_path.'/cur')) {
 			exec("su -c 'rm -rf ".escapeshellcmd($data['new']['maildir'])."' vmail");
-			$app->log('Removed invalid maildir and rebuild it: '.escapeshellcmd($data['new']['maildir']),LOGLEVEL_WARN);
+			$app->log('Removed invalid maildir and rebuild it: '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_WARN);
 		}
 
 		//* Create the maildir, if it doesn not exist, set permissions, set quota.
 		if(!empty($maildomain_path) && !is_dir($maildomain_path.'/new')) {
 			//exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log("Created Maildir "."su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name']);
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name']);
 
 			exec('chown -R '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
-			$app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']),LOGLEVEL_DEBUG);
+			$app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_DEBUG);
 			//* This is to fix the maildrop quota not being rebuilt after the quota is changed.
 			if($mail_config['pop3_imap_daemon'] != 'dovecot') {
 				if($data['new']['quota'] > 0) {
 					if(is_dir($maildomain_path)) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
-					$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
+					$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'], LOGLEVEL_DEBUG);
 				} else {
 					if(file_exists($data['new']['maildir'].'/maildirsize')) unlink($data['new']['maildir'].'/maildirsize');
-					$app->log('Set Maildir quota to unlimited.',LOGLEVEL_DEBUG);
+					$app->log('Set Maildir quota to unlimited.', LOGLEVEL_DEBUG);
 				}
 			}
 		}
-		
+
 		if(!is_dir($data['new']['maildir'].'/.Sent')) {
 			//exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Sent');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Sent');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Drafts')) {
 			//exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Drafts');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Drafts');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Trash')) {
 			//exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Trash');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Trash');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Junk')) {
 			//exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Junk');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Junk');
 		}
-		
+
 		// Move mailbox, if domain has changed and delete old mailbox
 		if($data['new']['maildir'] != $data['old']['maildir'] && is_dir($data['old']['maildir'])) {
 			if(is_dir($data['new']['maildir'])) {
@@ -295,73 +295,73 @@
 			// exec('mv -f '.escapeshellcmd($data['old']['maildir']).'/* '.escapeshellcmd($data['new']['maildir']));
 			// if(is_file($data['old']['maildir'].'.ispconfig_mailsize'))exec('mv -f '.escapeshellcmd($data['old']['maildir']).'.ispconfig_mailsize '.escapeshellcmd($data['new']['maildir']));
 			// rmdir($data['old']['maildir']);
-			$app->log('Moved Maildir from: '.$data['old']['maildir'].' to '.$data['new']['maildir'],LOGLEVEL_DEBUG);
+			$app->log('Moved Maildir from: '.$data['old']['maildir'].' to '.$data['new']['maildir'], LOGLEVEL_DEBUG);
 		}
 		//This is to fix the maildrop quota not being rebuilt after the quota is changed.
 		// Courier Layout
 		if(is_dir($data['new']['maildir'].'/new') && $mail_config['pop3_imap_daemon'] != 'dovecot') {
 			if($data['new']['quota'] > 0) {
 				if(is_dir($data['new']['maildir'])) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']);
-				$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
+				$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'], LOGLEVEL_DEBUG);
 			} else {
 				if(file_exists($data['new']['maildir'].'/maildirsize')) unlink($data['new']['maildir'].'/maildirsize');
-				$app->log('Set Maildir quota to unlimited.',LOGLEVEL_DEBUG);
+				$app->log('Set Maildir quota to unlimited.', LOGLEVEL_DEBUG);
 			}
 		}
 	}
-	
-	function user_delete($event_name,$data) {
+
+	function user_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
-		
+
 		$old_maildir_path = escapeshellcmd($data['old']['maildir']);
-		if($old_maildir_path != $mail_config['homedir_path'] && strlen($old_maildir_path) > strlen($mail_config['homedir_path']) && !stristr($old_maildir_path,'//') && !stristr($old_maildir_path,'..') && !stristr($old_maildir_path,'*') && strlen($old_maildir_path) >= 10) {
+		if($old_maildir_path != $mail_config['homedir_path'] && strlen($old_maildir_path) > strlen($mail_config['homedir_path']) && !stristr($old_maildir_path, '//') && !stristr($old_maildir_path, '..') && !stristr($old_maildir_path, '*') && strlen($old_maildir_path) >= 10) {
 			exec('rm -rf '.escapeshellcmd($old_maildir_path));
-			$app->log('Deleted the Maildir: '.$data['old']['maildir'],LOGLEVEL_DEBUG);
+			$app->log('Deleted the Maildir: '.$data['old']['maildir'], LOGLEVEL_DEBUG);
 		} else {
-			$app->log('Possible security violation when deleting the maildir: '.$data['old']['maildir'],LOGLEVEL_ERROR);
+			$app->log('Possible security violation when deleting the maildir: '.$data['old']['maildir'], LOGLEVEL_ERROR);
 		}
 	}
-	
-	function domain_delete($event_name,$data) {
+
+	function domain_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
-		
+
 		//* Delete maildomain path
 		$old_maildomain_path = escapeshellcmd($mail_config['homedir_path'].'/'.$data['old']['domain']);
-		if($old_maildomain_path != $mail_config['homedir_path'] && !stristr($old_maildomain_path,'//') && !stristr($old_maildomain_path,'..') && !stristr($old_maildomain_path,'*') && !stristr($old_maildomain_path,'&') && strlen($old_maildomain_path) >= 10  && !empty($data['old']['domain'])) {
+		if($old_maildomain_path != $mail_config['homedir_path'] && !stristr($old_maildomain_path, '//') && !stristr($old_maildomain_path, '..') && !stristr($old_maildomain_path, '*') && !stristr($old_maildomain_path, '&') && strlen($old_maildomain_path) >= 10  && !empty($data['old']['domain'])) {
 			exec('rm -rf '.escapeshellcmd($old_maildomain_path));
-			$app->log('Deleted the mail domain directory: '.$old_maildomain_path,LOGLEVEL_DEBUG);
+			$app->log('Deleted the mail domain directory: '.$old_maildomain_path, LOGLEVEL_DEBUG);
 		} else {
-			$app->log('Possible security violation when deleting the mail domain directory: '.$old_maildomain_path,LOGLEVEL_ERROR);
+			$app->log('Possible security violation when deleting the mail domain directory: '.$old_maildomain_path, LOGLEVEL_ERROR);
 		}
-		
+
 		//* Delete mailfilter path
 		$old_maildomain_path = escapeshellcmd($mail_config['homedir_path'].'/mailfilters/'.$data['old']['domain']);
-		if($old_maildomain_path != $mail_config['homedir_path'].'/mailfilters/' && !stristr($old_maildomain_path,'//') && !stristr($old_maildomain_path,'..') && !stristr($old_maildomain_path,'*') && !stristr($old_maildomain_path,'&') && strlen($old_maildomain_path) >= 10 && !empty($data['old']['domain'])) {
+		if($old_maildomain_path != $mail_config['homedir_path'].'/mailfilters/' && !stristr($old_maildomain_path, '//') && !stristr($old_maildomain_path, '..') && !stristr($old_maildomain_path, '*') && !stristr($old_maildomain_path, '&') && strlen($old_maildomain_path) >= 10 && !empty($data['old']['domain'])) {
 			exec('rm -rf '.escapeshellcmd($old_maildomain_path));
-			$app->log('Deleted the mail domain mailfilter directory: '.$old_maildomain_path,LOGLEVEL_DEBUG);
+			$app->log('Deleted the mail domain mailfilter directory: '.$old_maildomain_path, LOGLEVEL_DEBUG);
 		} else {
-			$app->log('Possible security violation when deleting the mail domain mailfilter directory: '.$old_maildomain_path,LOGLEVEL_ERROR);
+			$app->log('Possible security violation when deleting the mail domain mailfilter directory: '.$old_maildomain_path, LOGLEVEL_ERROR);
 		}
 	}
-	
-	function transport_update($event_name,$data) {
+
+	function transport_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		exec($conf['init_scripts'] . '/' . 'postfix reload &> /dev/null');
-		$app->log('Postfix config reloaded ',LOGLEVEL_DEBUG);
-		
+		$app->log('Postfix config reloaded ', LOGLEVEL_DEBUG);
+
 	}
-	
-	
-	
+
+
+
 
 } // end class
 
diff --git a/server/plugins-available/maildeliver_plugin.inc.php b/server/plugins-available/maildeliver_plugin.inc.php
index 6d55dd3..08a4998 100644
--- a/server/plugins-available/maildeliver_plugin.inc.php
+++ b/server/plugins-available/maildeliver_plugin.inc.php
@@ -29,136 +29,136 @@
 */
 
 class maildeliver_plugin {
-	
+
 	var $plugin_name = 'maildeliver_plugin';
 	var $class_name = 'maildeliver_plugin';
-	
-	
+
+
 	var $mailfilter_config_dir = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true && isset($conf['dovecot']['installed']) && $conf['dovecot']['installed'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_user_insert','maildeliver_plugin','update');
-		$app->plugins->registerEvent('mail_user_update','maildeliver_plugin','update');
-		$app->plugins->registerEvent('mail_user_delete','maildeliver_plugin','delete');
-		
+
+		$app->plugins->registerEvent('mail_user_insert', 'maildeliver_plugin', 'update');
+		$app->plugins->registerEvent('mail_user_update', 'maildeliver_plugin', 'update');
+		$app->plugins->registerEvent('mail_user_delete', 'maildeliver_plugin', 'delete');
+
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail');
-		if(substr($mail_config["homedir_path"],-1) == '/') {
-			$mail_config["homedir_path"] = substr($mail_config["homedir_path"],0,-1);
+		if(substr($mail_config["homedir_path"], -1) == '/') {
+			$mail_config["homedir_path"] = substr($mail_config["homedir_path"], 0, -1);
 		}
-		
+
 		if(isset($data["new"]["email"])) {
-			$email_parts = explode("@",$data["new"]["email"]);
+			$email_parts = explode("@", $data["new"]["email"]);
 		} else {
-			$email_parts = explode("@",$data["old"]["email"]);
+			$email_parts = explode("@", $data["old"]["email"]);
 		}
-			
+
 		// Write the custom mailfilter script, if mailfilter recipe has changed
 		if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]
-			   or $data["old"]["move_junk"] != $data["new"]["move_junk"]
-			   or $data["old"]["autoresponder_subject"] != $data["new"]["autoresponder_subject"] 
-			   or $data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"] 
-			   or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
-			   or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
-			   or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
-			   or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]
-			   or $data["old"]["cc"] != $data["new"]["cc"]
-			   ) {
-				
-			$app->log("Mailfilter config has been changed",LOGLEVEL_DEBUG);
-				
+			or $data["old"]["move_junk"] != $data["new"]["move_junk"]
+			or $data["old"]["autoresponder_subject"] != $data["new"]["autoresponder_subject"]
+			or $data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"]
+			or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
+			or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
+			or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
+			or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]
+			or $data["old"]["cc"] != $data["new"]["cc"]
+		) {
+
+			$app->log("Mailfilter config has been changed", LOGLEVEL_DEBUG);
+
 			$sieve_file = $data["new"]["maildir"].'/.sieve';
-			if(is_file($sieve_file)) unlink($sieve_file)  or $app->log("Unable to delete file: $sieve_file",LOGLEVEL_WARN);
-				
+			if(is_file($sieve_file)) unlink($sieve_file)  or $app->log("Unable to delete file: $sieve_file", LOGLEVEL_WARN);
+
 			$app->load('tpl');
-			
+
 			//* Select sieve filter file for dovecot version
-			exec('dovecot --version',$tmp);
-			if(substr($tmp[0],0,3) == '1.0') {
+			exec('dovecot --version', $tmp);
+			if(substr($tmp[0], 0, 3) == '1.0') {
 				$filter_file_template = "sieve_filter.master";
-			} elseif(substr($tmp[0],0,3) == '1.2') {
+			} elseif(substr($tmp[0], 0, 3) == '1.2') {
 				$filter_file_template = "sieve_filter_1.2.master";
-			} elseif(substr($tmp[0],0,1) == '2') {
+			} elseif(substr($tmp[0], 0, 1) == '2') {
 				$filter_file_template = "sieve_filter_1.2.master";
 			} else {
 				$filter_file_template = "sieve_filter.master";
 			}
 			unset($tmp);
-			
+
 			//* Create new filter file based on template
 			$tpl = new tpl();
 			$tpl->newTemplate($filter_file_template);
-			
+
 			// cc Field
-			$tpl->setVar('cc',$data["new"]["cc"]);
-				
+			$tpl->setVar('cc', $data["new"]["cc"]);
+
 			// Custom filters
-			$tpl->setVar('custom_mailfilter',$data["new"]["custom_mailfilter"]);
-				
+			$tpl->setVar('custom_mailfilter', $data["new"]["custom_mailfilter"]);
+
 			// Move junk
-			$tpl->setVar('move_junk',$data["new"]["move_junk"]);
-			
+			$tpl->setVar('move_junk', $data["new"]["move_junk"]);
+
 			// Check autoresponder dates
 			if($data["new"]["autoresponder_start_date"] == '0000-00-00 00:00:00' && $data["new"]["autoresponder_end_date"] == '0000-00-00 00:00:00') {
-				$tpl->setVar('autoresponder_date_limit',0);
+				$tpl->setVar('autoresponder_date_limit', 0);
 			} else {
-				$tpl->setVar('autoresponder_date_limit',1);
+				$tpl->setVar('autoresponder_date_limit', 1);
 			}
-			
+
 
 			// Set autoresponder start date
-			$data["new"]["autoresponder_start_date"] = str_replace (" ", "T", $data["new"]["autoresponder_start_date"]);
-			$tpl->setVar('start_date',$data["new"]["autoresponder_start_date"]);
+			$data["new"]["autoresponder_start_date"] = str_replace(" ", "T", $data["new"]["autoresponder_start_date"]);
+			$tpl->setVar('start_date', $data["new"]["autoresponder_start_date"]);
 
 			// Set autoresponder end date
-			$data["new"]["autoresponder_end_date"] = str_replace (" ", "T", $data["new"]["autoresponder_end_date"]);
-			$tpl->setVar('end_date',$data["new"]["autoresponder_end_date"]);
+			$data["new"]["autoresponder_end_date"] = str_replace(" ", "T", $data["new"]["autoresponder_end_date"]);
+			$tpl->setVar('end_date', $data["new"]["autoresponder_end_date"]);
 
 			// Autoresponder
-			$tpl->setVar('autoresponder',$data["new"]["autoresponder"]);
+			$tpl->setVar('autoresponder', $data["new"]["autoresponder"]);
 
-			// Autoresponder Subject			
-			$data["new"]["autoresponder_subject"] = str_replace("\"","'",$data["new"]["autoresponder_subject"]); 
-			$tpl->setVar('autoresponder_subject',$data["new"]["autoresponder_subject"]);
+			// Autoresponder Subject
+			$data["new"]["autoresponder_subject"] = str_replace("\"", "'", $data["new"]["autoresponder_subject"]);
+			$tpl->setVar('autoresponder_subject', $data["new"]["autoresponder_subject"]);
 
 			// Autoresponder Text
-			$data["new"]["autoresponder_text"] = str_replace("\"","'",$data["new"]["autoresponder_text"]); 
-			$tpl->setVar('autoresponder_text',$data["new"]["autoresponder_text"]);
-			
+			$data["new"]["autoresponder_text"] = str_replace("\"", "'", $data["new"]["autoresponder_text"]);
+			$tpl->setVar('autoresponder_text', $data["new"]["autoresponder_text"]);
+
 			//* Set alias addresses for autoresponder
 			$sql = "SELECT * FROM mail_forwarding WHERE type = 'alias' AND destination = '".$app->db->quote($data["new"]["email"])."'";
 			$records = $app->db->queryAllRecords($sql);
-			
+
 			$addresses = array();
 			$addresses[] = $data["new"]["email"];
 			if(is_array($records) && count($records) > 0) {
@@ -166,59 +166,59 @@
 					$addresses[] = $rec['source'];
 				}
 			}
-			
-            $app->log("Found " . count($addresses) . " addresses.",LOGLEVEL_DEBUG);
-            
-            $alias_addresses = array();
-            
-			$email_parts = explode('@',$data["new"]["email"]);
+
+			$app->log("Found " . count($addresses) . " addresses.", LOGLEVEL_DEBUG);
+
+			$alias_addresses = array();
+
+			$email_parts = explode('@', $data["new"]["email"]);
 			$sql = "SELECT * FROM mail_forwarding WHERE type = 'aliasdomain' AND destination = '@".$app->db->quote($email_parts[1])."'";
 			$records = $app->db->queryAllRecords($sql);
 			if(is_array($records) && count($records) > 0) {
-                $app->log("Found " . count($records) . " records (aliasdomains).",LOGLEVEL_DEBUG);
+				$app->log("Found " . count($records) . " records (aliasdomains).", LOGLEVEL_DEBUG);
 				foreach($records as $rec) {
-					$aliasdomain = substr($rec['source'],1);
+					$aliasdomain = substr($rec['source'], 1);
 					foreach($addresses as $email) {
-						$email_parts = explode('@',$email);
+						$email_parts = explode('@', $email);
 						$alias_addresses[] = $email_parts[0].'@'.$aliasdomain;
 					}
 				}
 			}
-			
-            $app->log("Found " . count($addresses) . " addresses at all.",LOGLEVEL_DEBUG);
-            
-            $addresses = array_unique(array_merge($addresses, $alias_addresses));
-            
-            $app->log("Found " . count($addresses) . " unique addresses at all.",LOGLEVEL_DEBUG);
-            
+
+			$app->log("Found " . count($addresses) . " addresses at all.", LOGLEVEL_DEBUG);
+
+			$addresses = array_unique(array_merge($addresses, $alias_addresses));
+
+			$app->log("Found " . count($addresses) . " unique addresses at all.", LOGLEVEL_DEBUG);
+
 			$address_str = '';
 			if(is_array($addresses) && count($addresses) > 0) {
 				$address_str .= ':addresses [';
 				foreach($addresses as $rec) {
 					$address_str .= '"'.$rec.'",';
 				}
-				$address_str = substr($address_str,0,-1);
+				$address_str = substr($address_str, 0, -1);
 				$address_str .= ']';
 			}
-			
-			
-			$tpl->setVar('addresses',$address_str);
-			
-			file_put_contents($sieve_file,$tpl->grab());
-			
+
+
+			$tpl->setVar('addresses', $address_str);
+
+			file_put_contents($sieve_file, $tpl->grab());
+
 			unset($tpl);
-				
+
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$sieve_file = $data["old"]["maildir"].'/.sieve';
-		if(is_file($sieve_file)) unlink($sieve_file)  or $app->log("Unable to delete file: $sieve_file",LOGLEVEL_WARN);
+		if(is_file($sieve_file)) unlink($sieve_file)  or $app->log("Unable to delete file: $sieve_file", LOGLEVEL_WARN);
 	}
-	
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/plugins-available/maildrop_plugin.inc.php b/server/plugins-available/maildrop_plugin.inc.php
index 085a992..73bace8 100644
--- a/server/plugins-available/maildrop_plugin.inc.php
+++ b/server/plugins-available/maildrop_plugin.inc.php
@@ -29,70 +29,70 @@
 */
 
 class maildrop_plugin {
-	
+
 	var $plugin_name = 'maildrop_plugin';
 	var $class_name = 'maildrop_plugin';
-	
-	
+
+
 	var $mailfilter_config_dir = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true && isset($conf['courier']['installed']) && $conf['courier']['installed'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_user_insert','maildrop_plugin','update');
-		$app->plugins->registerEvent('mail_user_update','maildrop_plugin','update');
-		$app->plugins->registerEvent('mail_user_delete','maildrop_plugin','delete');
-		
+
+		$app->plugins->registerEvent('mail_user_insert', 'maildrop_plugin', 'update');
+		$app->plugins->registerEvent('mail_user_update', 'maildrop_plugin', 'update');
+		$app->plugins->registerEvent('mail_user_delete', 'maildrop_plugin', 'delete');
+
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail');
-		if(substr($mail_config["homedir_path"],-1) == '/') {
-			$mail_config["homedir_path"] = substr($mail_config["homedir_path"],0,-1);
+		if(substr($mail_config["homedir_path"], -1) == '/') {
+			$mail_config["homedir_path"] = substr($mail_config["homedir_path"], 0, -1);
 		}
 		$this->mailfilter_config_dir = $mail_config["homedir_path"].'/mailfilters';
-		
-		
+
+
 		// Check if the config directory exists.
 		if(!is_dir($this->mailfilter_config_dir)) {
-			$app->log("Mailfilter config directory '".$this->mailfilter_config_dir."' does not exist. Creating it now.",LOGLEVEL_WARN);
+			$app->log("Mailfilter config directory '".$this->mailfilter_config_dir."' does not exist. Creating it now.", LOGLEVEL_WARN);
 			mkdir($this->mailfilter_config_dir);
 			chown($this->mailfilter_config_dir, 'vmail');
 			chmod($this->mailfilter_config_dir, 0770);
 		}
-		
+
 		if(isset($data["new"]["email"])) {
-			$email_parts = explode("@",$data["new"]["email"]);
+			$email_parts = explode("@", $data["new"]["email"]);
 		} else {
-			$email_parts = explode("@",$data["old"]["email"]);
+			$email_parts = explode("@", $data["old"]["email"]);
 		}
-		
+
 		// make sure that the config directories exist
 		if(!is_dir($this->mailfilter_config_dir.'/'.$email_parts[1])) {
 			mkdir($this->mailfilter_config_dir.'/'.$email_parts[1]);
@@ -104,154 +104,154 @@
 			chown($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0], 'vmail');
 			chmod($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0], 0770);
 		}
-		
+
 		// Check if something has been changed regarding the autoresponders
-		if($data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"] 
-			    or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
-			    or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
-			    or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
-			    or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]) {
-			   		
+		if($data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"]
+			or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
+			or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
+			or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
+			or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]) {
+
 			// We delete the old autoresponder, if it exists
-			$email_parts = explode("@",$data["old"]["email"]);
+			$email_parts = explode("@", $data["old"]["email"]);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lock';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.gdbm';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.lock';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
-			
-			
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
+
+
 			//Now we create the new autoresponder, if it is enabled
 			if($data["new"]["autoresponder"] == 'y') {
 				if(isset($data["new"]["email"])) {
-					$email_parts = explode("@",$data["new"]["email"]);
+					$email_parts = explode("@", $data["new"]["email"]);
 				} else {
-					$email_parts = explode("@",$data["old"]["email"]);
+					$email_parts = explode("@", $data["old"]["email"]);
 				}
-						
+
 				// Load the master template
 				$tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master');
-				$tpl = str_replace('{vmail_mailbox_base}',$mail_config["homedir_path"],$tpl);
-				
+				$tpl = str_replace('{vmail_mailbox_base}', $mail_config["homedir_path"], $tpl);
+
 				if ($data["new"]["autoresponder_start_date"] != '0000-00-00 00:00:00') { // Dates have been set
-					$tpl = str_replace('{start_date}',strtotime($data["new"]["autoresponder_start_date"]),$tpl);
-					$tpl = str_replace('{end_date}',strtotime($data["new"]["autoresponder_end_date"]),$tpl);
+					$tpl = str_replace('{start_date}', strtotime($data["new"]["autoresponder_start_date"]), $tpl);
+					$tpl = str_replace('{end_date}', strtotime($data["new"]["autoresponder_end_date"]), $tpl);
 				} else {
-					$tpl = str_replace('{start_date}',-7200,$tpl);
-					$tpl = str_replace('{end_date}',2147464800,$tpl);
+					$tpl = str_replace('{start_date}', -7200, $tpl);
+					$tpl = str_replace('{end_date}', 2147464800, $tpl);
 				}
-				
+
 				// Write the config file.
 				$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder';
-				file_put_contents($config_file_path,$tpl);
-				$app->log("Writing Autoresponder mailfilter file: $config_file_path",LOGLEVEL_DEBUG);
+				file_put_contents($config_file_path, $tpl);
+				$app->log("Writing Autoresponder mailfilter file: $config_file_path", LOGLEVEL_DEBUG);
 				chmod($config_file_path, 0770);
 				chown($config_file_path, 'vmail');
 				unset($tpl);
 				unset($config_file_path);
-						
+
 				// Write the autoresponder message file
 				$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg';
-				file_put_contents($config_file_path,$data["new"]["autoresponder_text"]);
+				file_put_contents($config_file_path, $data["new"]["autoresponder_text"]);
 				chmod($config_file_path, 0770);
 				chown($config_file_path, 'vmail');
-				$app->log("Writing Autoresponder message file: $config_file_path",LOGLEVEL_DEBUG);
+				$app->log("Writing Autoresponder message file: $config_file_path", LOGLEVEL_DEBUG);
 			}
 		}
-			
+
 		// Write the custom mailfilter script, if mailfilter recipe has changed
 		if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]
 			or $data["old"]["move_junk"] != $data["new"]["move_junk"]
 			or $data["old"]["cc"] != $data["new"]["cc"]) {
-			   
-				$app->log("Mailfilter config has been changed",LOGLEVEL_DEBUG);
-				if(trim($data["new"]["custom_mailfilter"]) != '' 
-					or $data["new"]["move_junk"] != 'n' 
-					or $data["new"]["cc"] != '') {
-					
-					// Delete the old filter recipe
-					$email_parts = explode("@",$data["old"]["email"]);
-					$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
-					if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
-					
-					// write the new recipe
-					if(isset($data["new"]["email"])) {
-						$email_parts = explode("@",$data["new"]["email"]);
-					} else {
-						$email_parts = explode("@",$data["old"]["email"]);
-					}
-					$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
-					
-					$mailfilter_content = '';
-					
-					if($data["new"]["cc"] != '') {
-						$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
-						$app->log("Added CC address ".$data["new"]["cc"].' to mailfilter file.',LOGLEVEL_DEBUG);
-					}
-					
-					if($data["new"]["move_junk"] == 'y') {
-						$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
-					}
-					$mailfilter_content .= $data["new"]["custom_mailfilter"];
-					
-					// Replace windows linebreaks in mailfilter file
-					$mailfilter_content = str_replace("\r\n","\n",$mailfilter_content);
-					
-					file_put_contents($config_file_path,$mailfilter_content);
-					$app->log("Writing new custom Mailfiter".$config_file_path,LOGLEVEL_DEBUG);
-					chmod($config_file_path, 0770);
-					chown($config_file_path, 'vmail');
-					unset($config_file_path);
+
+			$app->log("Mailfilter config has been changed", LOGLEVEL_DEBUG);
+			if(trim($data["new"]["custom_mailfilter"]) != ''
+				or $data["new"]["move_junk"] != 'n'
+				or $data["new"]["cc"] != '') {
+
+				// Delete the old filter recipe
+				$email_parts = explode("@", $data["old"]["email"]);
+				$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
+				if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
+
+				// write the new recipe
+				if(isset($data["new"]["email"])) {
+					$email_parts = explode("@", $data["new"]["email"]);
 				} else {
-					// Delete the mailfilter recipe
-					if(isset($data["old"]["email"])) {
-						$email_parts = explode("@",$data["old"]["email"]);
-						$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
-						if(is_file($file)) {
-							unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
-							$app->log("Deleting custom Mailfiter".$file,LOGLEVEL_DEBUG);
-						}
+					$email_parts = explode("@", $data["old"]["email"]);
+				}
+				$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
+
+				$mailfilter_content = '';
+
+				if($data["new"]["cc"] != '') {
+					$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
+					$app->log("Added CC address ".$data["new"]["cc"].' to mailfilter file.', LOGLEVEL_DEBUG);
+				}
+
+				if($data["new"]["move_junk"] == 'y') {
+					$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
+				}
+				$mailfilter_content .= $data["new"]["custom_mailfilter"];
+
+				// Replace windows linebreaks in mailfilter file
+				$mailfilter_content = str_replace("\r\n", "\n", $mailfilter_content);
+
+				file_put_contents($config_file_path, $mailfilter_content);
+				$app->log("Writing new custom Mailfiter".$config_file_path, LOGLEVEL_DEBUG);
+				chmod($config_file_path, 0770);
+				chown($config_file_path, 'vmail');
+				unset($config_file_path);
+			} else {
+				// Delete the mailfilter recipe
+				if(isset($data["old"]["email"])) {
+					$email_parts = explode("@", $data["old"]["email"]);
+					$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
+					if(is_file($file)) {
+						unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
+						$app->log("Deleting custom Mailfiter".$file, LOGLEVEL_DEBUG);
 					}
 				}
+			}
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail');
 		$this->mailfilter_config_dir = $mail_config["homedir_path"].'/mailfilters';
-		
-		$email_parts = explode("@",$data["old"]["email"]);
+
+		$email_parts = explode("@", $data["old"]["email"]);
 		$dir = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0];
 		if(is_dir($dir)) {
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lock';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.gdbm';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.lock';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
-			rmdir($dir) or $app->log("Unable to delete directory: $dir",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
+			rmdir($dir) or $app->log("Unable to delete directory: $dir", LOGLEVEL_WARN);
 		}
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/mailman_plugin.inc.php b/server/plugins-available/mailman_plugin.inc.php
index c302806..e2bd36a 100644
--- a/server/plugins-available/mailman_plugin.inc.php
+++ b/server/plugins-available/mailman_plugin.inc.php
@@ -29,89 +29,89 @@
 */
 
 class mailman_plugin {
-	
+
 	var $plugin_name = 'mailman_plugin';
 	var $class_name = 'mailman_plugin';
-	
-	
+
+
 	var $mailman_config_dir = '/etc/mailman/';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_mailinglist_insert','mailman_plugin','insert');
-		$app->plugins->registerEvent('mail_mailinglist_update','mailman_plugin','update');
-		$app->plugins->registerEvent('mail_mailinglist_delete','mailman_plugin','delete');
-		
-		
-		
+
+		$app->plugins->registerEvent('mail_mailinglist_insert', 'mailman_plugin', 'insert');
+		$app->plugins->registerEvent('mail_mailinglist_update', 'mailman_plugin', 'update');
+		$app->plugins->registerEvent('mail_mailinglist_delete', 'mailman_plugin', 'delete');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->update_config();
-		
+
 		exec("nohup /usr/lib/mailman/bin/newlist -u ".escapeshellcmd($data["new"]["domain"])." -e ".escapeshellcmd($data["new"]["domain"])." ".escapeshellcmd($data["new"]["listname"])." ".escapeshellcmd($data["new"]["email"])." ".escapeshellcmd($data["new"]["password"])." >/dev/null 2>&1 &");
 		if(is_file('/var/lib/mailman/data/virtual-mailman')) exec('postmap /var/lib/mailman/data/virtual-mailman');
 		exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &');
-		
+
 		$app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ".$app->db->quote($data["new"]['mailinglist_id']));
-		
+
 	}
-	
+
 	// The purpose of this plugin is to rewrite the main.cf file
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["password"] != $data["old"]["password"] && $data["new"]["password"] != '') {
 			exec("nohup /usr/lib/mailman/bin/change_pw -l ".escapeshellcmd($data["new"]["listname"])." -p ".escapeshellcmd($data["new"]["password"])." >/dev/null 2>&1 &");
 			exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &');
 			$app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ".$app->db->quote($data["new"]['mailinglist_id']));
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->update_config();
-		
+
 		exec("nohup /usr/lib/mailman/bin/rmlist -a ".escapeshellcmd($data["old"]["listname"])." >/dev/null 2>&1 &");
-		
+
 		exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &');
-		
+
 	}
-	
+
 	function update_config() {
 		global $app, $conf;
-		
-		copy($this->mailman_config_dir.'mm_cfg.py',$this->mailman_config_dir.'mm_cfg.py');
-		
+
+		copy($this->mailman_config_dir.'mm_cfg.py', $this->mailman_config_dir.'mm_cfg.py');
+
 		// load the server configuration options
 		$app->uses('getconf');
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-		
+
 		// load files
 		if(file_exists($conf["rootpath"]."/conf-custom/mm_cfg.py.master")) {
 			$content = file_get_contents($conf["rootpath"]."/conf-custom/mm_cfg.py.master");
@@ -119,9 +119,9 @@
 			$content = file_get_contents($conf["rootpath"]."/conf/mm_cfg.py.master");
 		}
 		$old_file = file_get_contents($this->mailman_config_dir."/mm_cfg.py");
-		
+
 		$old_options = array();
-		$lines = explode("\n", $old_file); 
+		$lines = explode("\n", $old_file);
 		foreach ($lines as $line)
 		{
 			if (strlen($line) && substr($line, 0, 1) != '#')
@@ -134,7 +134,7 @@
 				}
 			}
 		}
-		
+
 		// create virtual_domains list
 		$domainAll = $app->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 		$virtual_domains = '';
@@ -145,11 +145,11 @@
 			else
 				$virtual_domains .= ", '".$domain['domain']."'";
 		}
-		
+
 		$content = str_replace('{hostname}', $server_config['hostname'], $content);
 		$content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content);
 		$content = str_replace('{virtual_domains}', $virtual_domains, $content);
-		
+
 		file_put_contents($this->mailman_config_dir."/mm_cfg.py", $content);
 	}
 
diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php
index b4fa6d3..cba977c 100644
--- a/server/plugins-available/mysql_clientdb_plugin.inc.php
+++ b/server/plugins-available/mysql_clientdb_plugin.inc.php
@@ -29,106 +29,106 @@
 */
 
 class mysql_clientdb_plugin {
-	
+
 	var $plugin_name = 'mysql_clientdb_plugin';
 	var $class_name  = 'mysql_clientdb_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['db'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* Databases
-		$app->plugins->registerEvent('database_insert',$this->plugin_name,'db_insert');
-		$app->plugins->registerEvent('database_update',$this->plugin_name,'db_update');
-		$app->plugins->registerEvent('database_delete',$this->plugin_name,'db_delete');
-		
+		$app->plugins->registerEvent('database_insert', $this->plugin_name, 'db_insert');
+		$app->plugins->registerEvent('database_update', $this->plugin_name, 'db_update');
+		$app->plugins->registerEvent('database_delete', $this->plugin_name, 'db_delete');
+
 		//* Database users
-		$app->plugins->registerEvent('database_user_insert',$this->plugin_name,'db_user_insert');
-		$app->plugins->registerEvent('database_user_update',$this->plugin_name,'db_user_update');
-		$app->plugins->registerEvent('database_user_delete',$this->plugin_name,'db_user_delete');
-		
-		
+		$app->plugins->registerEvent('database_user_insert', $this->plugin_name, 'db_user_insert');
+		$app->plugins->registerEvent('database_user_update', $this->plugin_name, 'db_user_update');
+		$app->plugins->registerEvent('database_user_delete', $this->plugin_name, 'db_user_delete');
+
+
 	}
-	
-  function process_host_list($action, $database_name, $database_user, $database_password, $host_list, $link, $database_rename_user = '', $user_read_only = false) {
-      global $app;
-      
-      $action = strtoupper($action);
-      
-      // set to all hosts if none given
-      if(trim($host_list) == '') $host_list = '%';
-      
-      // process arrays and comma separated strings
-      if(!is_array($host_list)) $host_list = explode(',', $host_list);
-      
-      $success = true;
-      
-      // loop through hostlist
-      foreach($host_list as $db_host) {
-          $db_host = trim($db_host);
-          
-          $app->log($action . ' for user ' . $database_user . ' at host ' . $db_host, LOGLEVEL_DEBUG);
-          
-          // check if entry is valid ip address
-          $valid = true;
-		  if($db_host == '%' || $db_host == 'localhost') {
-		  	$valid = true;
-		  } elseif(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $db_host)) {
-              $groups = explode('.', $db_host);
-              foreach($groups as $group){
-                if($group<0 OR $group>255)
-                $valid=false;
-              }
-          } else {
-              $valid = false;
-          }
-          
-          if($valid == false) continue;
-          
-          if($action == 'GRANT') {
-              if(!$link->query("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
-              $app->log("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."'; success? " . ($success ? 'yes' : 'no'), LOGLEVEL_DEBUG);
-          } elseif($action == 'REVOKE') {
-              if(!$link->query("REVOKE ALL PRIVILEGES ON ".$link->escape_string($database_name).".* FROM '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
-          } elseif($action == 'DROP') {
-              if(!$link->query("DROP USER '".$link->escape_string($database_user)."'@'$db_host';")) $success = false;
-          } elseif($action == 'RENAME') {
-              if(!$link->query("RENAME USER '".$link->escape_string($database_user)."'@'$db_host' TO '".$link->escape_string($database_rename_user)."'@'$db_host'")) $success = false;
-          } elseif($action == 'PASSWORD') {
-              if(!$link->query("SET PASSWORD FOR '".$link->escape_string($database_user)."'@'$db_host' = '".$link->escape_string($database_password)."';")) $success = false;
-          }
-      }
-      
-      return $success;
-  }
-  
-	function drop_or_revoke_user($database_id, $user_id, $host_list){
+
+	function process_host_list($action, $database_name, $database_user, $database_password, $host_list, $link, $database_rename_user = '', $user_read_only = false) {
 		global $app;
-		
+
+		$action = strtoupper($action);
+
 		// set to all hosts if none given
 		if(trim($host_list) == '') $host_list = '%';
-		
+
+		// process arrays and comma separated strings
+		if(!is_array($host_list)) $host_list = explode(',', $host_list);
+
+		$success = true;
+
+		// loop through hostlist
+		foreach($host_list as $db_host) {
+			$db_host = trim($db_host);
+
+			$app->log($action . ' for user ' . $database_user . ' at host ' . $db_host, LOGLEVEL_DEBUG);
+
+			// check if entry is valid ip address
+			$valid = true;
+			if($db_host == '%' || $db_host == 'localhost') {
+				$valid = true;
+			} elseif(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $db_host)) {
+				$groups = explode('.', $db_host);
+				foreach($groups as $group){
+					if($group<0 or $group>255)
+						$valid=false;
+				}
+			} else {
+				$valid = false;
+			}
+
+			if($valid == false) continue;
+
+			if($action == 'GRANT') {
+				if(!$link->query("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
+				$app->log("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."'; success? " . ($success ? 'yes' : 'no'), LOGLEVEL_DEBUG);
+			} elseif($action == 'REVOKE') {
+				if(!$link->query("REVOKE ALL PRIVILEGES ON ".$link->escape_string($database_name).".* FROM '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
+			} elseif($action == 'DROP') {
+				if(!$link->query("DROP USER '".$link->escape_string($database_user)."'@'$db_host';")) $success = false;
+			} elseif($action == 'RENAME') {
+				if(!$link->query("RENAME USER '".$link->escape_string($database_user)."'@'$db_host' TO '".$link->escape_string($database_rename_user)."'@'$db_host'")) $success = false;
+			} elseif($action == 'PASSWORD') {
+				if(!$link->query("SET PASSWORD FOR '".$link->escape_string($database_user)."'@'$db_host' = '".$link->escape_string($database_password)."';")) $success = false;
+			}
+		}
+
+		return $success;
+	}
+
+	function drop_or_revoke_user($database_id, $user_id, $host_list){
+		global $app;
+
+		// set to all hosts if none given
+		if(trim($host_list) == '') $host_list = '%';
+
 		$db_user_databases = $app->db->queryAllRecords("SELECT * FROM web_database WHERE (database_user_id = ".$user_id." OR database_ro_user_id = ".$user_id.") AND active = 'y' AND database_id != ".$database_id);
 		$db_user_host_list = array();
 		if(is_array($db_user_databases) && !empty($db_user_databases)){
@@ -156,448 +156,449 @@
 		//print_r($drop_hosts);
 		$revoke_hosts = array_diff($host_list_arr, $drop_hosts);
 		//print_r($revoke_hosts);
-						
+
 		$drop_host_list = implode(',', $drop_hosts);
 		$revoke_host_list = implode(',', $revoke_hosts);
 		//echo $drop_host_list."\n";
 		//echo $revoke_host_list."\n";
 		return array('revoke_hosts' => $revoke_host_list, 'drop_hosts' => $drop_host_list);
 	}
-	
-	function db_insert($event_name,$data) {
+
+	function db_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data['new']['type'] == 'mysql') {
-			if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
+			if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
 				return;
 			}
-			
+
 			//* Connect to the database
 			$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
 			if ($link->connect_error) {
-				$app->log('Unable to connect to mysql'.$link->connect_error,LOGLEVEL_ERROR);
+				$app->log('Unable to connect to mysql'.$link->connect_error, LOGLEVEL_ERROR);
 				return;
 			}
 
 			// Charset for the new table
 			if($data['new']['database_charset'] != '') {
-        $query_charset_table = ' DEFAULT CHARACTER SET '.$data['new']['database_charset'];
+				$query_charset_table = ' DEFAULT CHARACTER SET '.$data['new']['database_charset'];
 			} else {
-        $query_charset_table = '';
+				$query_charset_table = '';
 			}
 
 			//* Create the new database
 			if ($link->query('CREATE DATABASE '.$link->escape_string($data['new']['database_name']).$query_charset_table)) {
-				$app->log('Created MySQL database: '.$data['new']['database_name'],LOGLEVEL_DEBUG);
+				$app->log('Created MySQL database: '.$data['new']['database_name'], LOGLEVEL_DEBUG);
 			} else {
-				$app->log('Unable to create the database: '.$link->error,LOGLEVEL_WARNING);
+				$app->log('Unable to create the database: '.$link->error, LOGLEVEL_WARNING);
 			}
-			
+
 			// Create the database user if database is active
 			if($data['new']['active'] == 'y') {
-				
-                // get the users for this database
-                $db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_user_id']) . "'");
-                
-                $db_ro_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_ro_user_id']) . "'");
-                
-                $host_list = '';
-                if($data['new']['remote_access'] == 'y') {
-                    $host_list = $data['new']['remote_ips'];
-                    if($host_list == '') $host_list = '%';
-                }
-                if($host_list != '') $host_list .= ',';
-                $host_list .= 'localhost';
-                
-                if($db_user) {
-                    if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
-                }
-                if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                    if($db_ro_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
-                }
-				
+
+				// get the users for this database
+				$db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_user_id']) . "'");
+
+				$db_ro_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_ro_user_id']) . "'");
+
+				$host_list = '';
+				if($data['new']['remote_access'] == 'y') {
+					$host_list = $data['new']['remote_ips'];
+					if($host_list == '') $host_list = '%';
+				}
+				if($host_list != '') $host_list .= ',';
+				$host_list .= 'localhost';
+
+				if($db_user) {
+					if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
+				}
+				if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
+					if($db_ro_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
+				}
+
 			}
-			
+
 			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
 	}
-	
-	function db_update($event_name,$data) {
+
+	function db_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// skip processing if database was and is inactive
 		if($data['new']['active'] == 'n' && $data['old']['active'] == 'n') return;
-		
+
 		if($data['new']['type'] == 'mysql') {
-			if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
+			if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
 				return;
 			}
-			
+
 			//* Connect to the database
 			$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
 			if ($link->connect_error) {
-				$app->log('Unable to connect to the database: '.$link->connect_error,LOGLEVEL_ERROR);
+				$app->log('Unable to connect to the database: '.$link->connect_error, LOGLEVEL_ERROR);
 				return;
 			}
-			
-            // get the users for this database
-            $db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_user_id']) . "'");
-            $old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
-            
-            $db_ro_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_ro_user_id']) . "'");
-            $old_db_ro_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_ro_user_id']) . "'");
-            
-            $host_list = '';
-            if($data['new']['remote_access'] == 'y') {
-                $host_list = $data['new']['remote_ips'];
-                if($host_list == '') $host_list = '%';
-            }
-            if($host_list != '') $host_list .= ',';
-            $host_list .= 'localhost';
-			
+
+			// get the users for this database
+			$db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_user_id']) . "'");
+			$old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
+
+			$db_ro_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_ro_user_id']) . "'");
+			$old_db_ro_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_ro_user_id']) . "'");
+
+			$host_list = '';
+			if($data['new']['remote_access'] == 'y') {
+				$host_list = $data['new']['remote_ips'];
+				if($host_list == '') $host_list = '%';
+			}
+			if($host_list != '') $host_list .= ',';
+			$host_list .= 'localhost';
+
 			// REVOKES and DROPS have to be done on old host list, not new host list
 			$old_host_list = '';
-            if($data['old']['remote_access'] == 'y') {
-                $old_host_list = $data['old']['remote_ips'];
-                if($old_host_list == '') $old_host_list = '%';
-            }
-            if($old_host_list != '') $old_host_list .= ',';
-            $old_host_list .= 'localhost';
-            
-            // Create the database user if database was disabled before
-			if($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
-                if($db_user) {
-                    if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
-                }
-                if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                    if($db_ro_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
-                }
-			} else if($data['new']['active'] == 'n' && $data['old']['active'] == 'y') { // revoke database user, if inactive
-                if($old_db_user) {
-                    if($old_db_user['database_user'] == 'root'){
-						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    } else {
-						// Find out users to drop and users to revoke
-						$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
-						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-						
-						
-						//$this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $old_host_list, $link);
-						//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $old_host_list, $link);
-					}
-                }
-                if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
-                    if($old_db_ro_user['database_user'] == 'root'){
-						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    } else {
-						// Find out users to drop and users to revoke
-						$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_ro_user_id'], $old_host_list);
-						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-						
-						//$this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $old_host_list, $link);
-						//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $old_host_list, $link);
-					}
-                }
-				// Database is not active, so stop processing here
-				$link->query('FLUSH PRIVILEGES;');
-				$link->close();
-				return;
+			if($data['old']['remote_access'] == 'y') {
+				$old_host_list = $data['old']['remote_ips'];
+				if($old_host_list == '') $old_host_list = '%';
 			}
-            
-            //* selected Users have changed
-            if($data['new']['database_user_id'] != $data['old']['database_user_id']) {
-                if($data['old']['database_user_id'] && $data['old']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                    if($old_db_user) {
-                        if($old_db_user['database_user'] == 'root'){
-							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        } else {
+			if($old_host_list != '') $old_host_list .= ',';
+			$old_host_list .= 'localhost';
+
+			// Create the database user if database was disabled before
+			if($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
+				if($db_user) {
+					if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
+				}
+				if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
+					if($db_ro_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
+				}
+			} else if($data['new']['active'] == 'n' && $data['old']['active'] == 'y') { // revoke database user, if inactive
+					if($old_db_user) {
+						if($old_db_user['database_user'] == 'root'){
+							$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						} else {
 							// Find out users to drop and users to revoke
 							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
 							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
 							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-						
+
+
+							//$this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $old_host_list, $link);
+							//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $old_host_list, $link);
+						}
+					}
+					if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
+						if($old_db_ro_user['database_user'] == 'root'){
+							$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						} else {
+							// Find out users to drop and users to revoke
+							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_ro_user_id'], $old_host_list);
+							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+
+							//$this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $old_host_list, $link);
+							//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $old_host_list, $link);
+						}
+					}
+					// Database is not active, so stop processing here
+					$link->query('FLUSH PRIVILEGES;');
+					$link->close();
+					return;
+				}
+
+			//* selected Users have changed
+			if($data['new']['database_user_id'] != $data['old']['database_user_id']) {
+				if($data['old']['database_user_id'] && $data['old']['database_user_id'] != $data['new']['database_ro_user_id']) {
+					if($old_db_user) {
+						if($old_db_user['database_user'] == 'root'){
+							$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						} else {
+							// Find out users to drop and users to revoke
+							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
+							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+
 							//$this->process_host_list('DROP', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $old_host_list, $link);
 							//$this->process_host_list('REVOKE', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $old_host_list, $link);
 						}
-                    }
-                }
-                if($db_user) {
-                    if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
-                }
-            }
-            if($data['new']['database_ro_user_id'] != $data['old']['database_ro_user_id']) {
-                if($data['old']['database_ro_user_id'] && $data['old']['database_ro_user_id'] != $data['new']['database_user_id']) {
-                    if($old_db_ro_user) {
-                        if($old_db_ro_user['database_user'] == 'root'){
-							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        } else {
+					}
+				}
+				if($db_user) {
+					if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
+				}
+			}
+			if($data['new']['database_ro_user_id'] != $data['old']['database_ro_user_id']) {
+				if($data['old']['database_ro_user_id'] && $data['old']['database_ro_user_id'] != $data['new']['database_user_id']) {
+					if($old_db_ro_user) {
+						if($old_db_ro_user['database_user'] == 'root'){
+							$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						} else {
 							// Find out users to drop and users to revoke
 							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
 							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
 							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-							
+
 							//$this->process_host_list('DROP', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $old_host_list, $link);
 							//$this->process_host_list('REVOKE', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $old_host_list, $link);
 						}
-                    }
-                }
-                if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                    if($db_ro_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
-                }
-            }
-			
+					}
+				}
+				if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
+					if($db_ro_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
+				}
+			}
+
 			//* Remote access option has changed.
 			if($data['new']['remote_access'] != $data['old']['remote_access']) {
-				
+
 				//* revoke old priveliges
 				//mysql_query("REVOKE ALL PRIVILEGES ON ".mysql_real_escape_string($data["new"]["database_name"],$link).".* FROM '".mysql_real_escape_string($data["new"]["database_user"],$link)."';",$link);
-				
+
 				//* set new priveliges
-				if($data['new']['remote_access'] == 'y') { 		
-                    if($db_user) {
-                        if($db_user['database_user'] == 'root'){
-							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        } else {
+				if($data['new']['remote_access'] == 'y') {
+					if($db_user) {
+						if($db_user['database_user'] == 'root'){
+							$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						} else {
 							$this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['new']['remote_ips'], $link);
 						}
-                    }
-                    if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                        if($db_ro_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['new']['remote_ips'], $link, '', true);
-                    }
+					}
+					if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
+						if($db_ro_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['new']['remote_ips'], $link, '', true);
+					}
 				} else {
-                    if($old_db_user) {
-                        if($old_db_user['database_user'] == 'root'){
-							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        } else {
+					if($old_db_user) {
+						if($old_db_user['database_user'] == 'root'){
+							$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						} else {
 							// Find out users to drop and users to revoke
 							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $data['old']['remote_ips']);
 							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
 							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-							
+
 							//$this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['old']['remote_ips'], $link);
 							//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['old']['remote_ips'], $link);
 						}
-                    }
-                    if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
-                        if($old_db_ro_user['database_user'] == 'root'){
-							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        } else {
+					}
+					if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
+						if($old_db_ro_user['database_user'] == 'root'){
+							$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						} else {
 							// Find out users to drop and users to revoke
 							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_ro_user_id'], $data['old']['remote_ips']);
 							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
 							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-							
+
 							//$this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['old']['remote_ips'], $link);
 							//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['old']['remote_ips'], $link);
 						}
-                    }
+					}
 				}
-				$app->log('Changing MySQL remote access privileges for database: '.$data['new']['database_name'],LOGLEVEL_DEBUG);
+				$app->log('Changing MySQL remote access privileges for database: '.$data['new']['database_name'], LOGLEVEL_DEBUG);
 			} elseif($data['new']['remote_access'] == 'y' && $data['new']['remote_ips'] != $data['old']['remote_ips']) {
-                //* Change remote access list
-                if($old_db_user) {
-                    if($old_db_user['database_user'] == 'root'){
-						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    } else {
+				//* Change remote access list
+				if($old_db_user) {
+					if($old_db_user['database_user'] == 'root'){
+						$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					} else {
 						// Find out users to drop and users to revoke
 						$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $data['old']['remote_ips']);
 						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
 						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-                    }
-                }
-                if($db_user) {
-                    if($db_user['database_user'] == 'root'){
-						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    } else {
-                        $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['new']['remote_ips'], $link);
-                    }
-                }
-                
-                if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
-                    if($old_db_ro_user['database_user'] == 'root'){
-						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    } else {
+					}
+				}
+				if($db_user) {
+					if($db_user['database_user'] == 'root'){
+						$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					} else {
+						$this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['new']['remote_ips'], $link);
+					}
+				}
+
+				if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
+					if($old_db_ro_user['database_user'] == 'root'){
+						$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					} else {
 						// Find out users to drop and users to revoke
 						$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $data['old']['remote_ips']);
 						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
 						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-                    }
-                }
-                
-                if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                    if($db_ro_user['database_user'] == 'root'){
-						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    } else {
-                        $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['new']['remote_ips'], $link, '', true);
-                    }
-                }
+					}
+				}
+
+				if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
+					if($db_ro_user['database_user'] == 'root'){
+						$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					} else {
+						$this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['new']['remote_ips'], $link, '', true);
+					}
+				}
 			}
-      
-			
+
+
 			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
-		
+
 	}
-	
-	function db_delete($event_name,$data) {
+
+	function db_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data['old']['type'] == 'mysql') {
-			if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
+			if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
 				return;
 			}
-		
+
 			//* Connect to the database
 			$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
 			if ($link->connect_error) {
-				$app->log('Unable to connect to mysql: '.$link->connect_error,LOGLEVEL_ERROR);
+				$app->log('Unable to connect to mysql: '.$link->connect_error, LOGLEVEL_ERROR);
 				return;
 			}
-			
+
 			$old_host_list = '';
-            if($data['old']['remote_access'] == 'y') {
-                $old_host_list = $data['old']['remote_ips'];
-                if($old_host_list == '') $old_host_list = '%';
-            }
-            if($old_host_list != '') $old_host_list .= ',';
-            $old_host_list .= 'localhost';
-            
-            if($data['old']['database_user_id']) {
-                $old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");            
-                $drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
-                if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-                if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-            }
-            if($data['old']['database_ro_user_id']) {
-                $old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_ro_user_id']) . "'");            
-                $drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_ro_user_id'], $old_host_list);
-                if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-                if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-            }
-            
-            
-			if($link->query('DROP DATABASE '.$link->escape_string($data['old']['database_name']))) {
-				$app->log('Dropping MySQL database: '.$data['old']['database_name'],LOGLEVEL_DEBUG);
-			} else {
-				$app->log('Error while dropping MySQL database: '.$data['old']['database_name'].' '.$link->error,LOGLEVEL_WARNING);
+			if($data['old']['remote_access'] == 'y') {
+				$old_host_list = $data['old']['remote_ips'];
+				if($old_host_list == '') $old_host_list = '%';
 			}
-			
+			if($old_host_list != '') $old_host_list .= ',';
+			$old_host_list .= 'localhost';
+
+			if($data['old']['database_user_id']) {
+				$old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
+				$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
+				if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+				if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+			}
+			if($data['old']['database_ro_user_id']) {
+				$old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_ro_user_id']) . "'");
+				$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_ro_user_id'], $old_host_list);
+				if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+				if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+			}
+
+
+			if($link->query('DROP DATABASE '.$link->escape_string($data['old']['database_name']))) {
+				$app->log('Dropping MySQL database: '.$data['old']['database_name'], LOGLEVEL_DEBUG);
+			} else {
+				$app->log('Error while dropping MySQL database: '.$data['old']['database_name'].' '.$link->error, LOGLEVEL_WARNING);
+			}
+
 			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
-		
-		
+
+
 	}
-	
-	 
-	function db_user_insert($event_name,$data) {
+
+
+	function db_user_insert($event_name, $data) {
 		global $app, $conf;
 		// we have nothing to do here, stale user accounts are useless ;)
 	}
-	
-	function db_user_update($event_name,$data) {
+
+	function db_user_update($event_name, $data) {
 		global $app, $conf;
-		
-        if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-            $app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
-            return;
-        }
-        
-        //* Connect to the database
-        $link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
-        if ($link->connect_error) {
-            $app->log('Unable to connect to mysql'.$link->connect_error,LOGLEVEL_ERROR);
-            return;
-        }
-        
-        
-        if($data['old']['database_user'] == $data['new']['database_user'] && ($data['old']['database_password'] == $data['new']['database_password'] || $data['new']['database_password'] == '')) {
-            return;
-        }
-        
-        
-        $host_list = array('localhost');
-        // get all databases this user was active for
-        $db_list = $app->db->queryAllRecords("SELECT `remote_access`, `remote_ips` FROM `web_database` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
-        if(count($db_list) < 1) return; // nothing to do on this server for this db user
-        
-        foreach($db_list as $database) {
-            if($database['remote_access'] != 'y') continue;
-            
-            if($database['remote_ips'] != '') $ips = explode(',', $database['remote_ips']);
-            else $ips = array('%');
-            
-            foreach($ips as $ip) {
-                $ip = trim($ip);
-                if(!in_array($ip, $host_list)) $host_list[] = $ip;
-            }
-        }
-        
-        foreach($host_list as $db_host) {
-            if($data['new']['database_user'] != $data['old']['database_user']) {
+
+		if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+			$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
+			return;
+		}
+
+		//* Connect to the database
+		$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
+		if ($link->connect_error) {
+			$app->log('Unable to connect to mysql'.$link->connect_error, LOGLEVEL_ERROR);
+			return;
+		}
+
+
+		if($data['old']['database_user'] == $data['new']['database_user'] && ($data['old']['database_password'] == $data['new']['database_password'] || $data['new']['database_password'] == '')) {
+			return;
+		}
+
+
+		$host_list = array('localhost');
+		// get all databases this user was active for
+		$db_list = $app->db->queryAllRecords("SELECT `remote_access`, `remote_ips` FROM `web_database` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
+		if(count($db_list) < 1) return; // nothing to do on this server for this db user
+
+		foreach($db_list as $database) {
+			if($database['remote_access'] != 'y') continue;
+
+			if($database['remote_ips'] != '') $ips = explode(',', $database['remote_ips']);
+			else $ips = array('%');
+
+			foreach($ips as $ip) {
+				$ip = trim($ip);
+				if(!in_array($ip, $host_list)) $host_list[] = $ip;
+			}
+		}
+
+		foreach($host_list as $db_host) {
+			if($data['new']['database_user'] != $data['old']['database_user']) {
 				$link->query("RENAME USER '".$link->escape_string($data['old']['database_user'])."'@'$db_host' TO '".$link->escape_string($data['new']['database_user'])."'@'$db_host'");
-				$app->log('Renaming MySQL user: '.$data['old']['database_user'].' to '.$data['new']['database_user'],LOGLEVEL_DEBUG);
+				$app->log('Renaming MySQL user: '.$data['old']['database_user'].' to '.$data['new']['database_user'], LOGLEVEL_DEBUG);
 			}
 
 			if($data['new']['database_password'] != $data['old']['database_password'] && $data['new']['database_password'] != '') {
 				$link->query("SET PASSWORD FOR '".$link->escape_string($data['new']['database_user'])."'@'$db_host' = '".$link->escape_string($data['new']['database_password'])."';");
-				$app->log('Changing MySQL user password for: '.$data['new']['database_user'].'@'.$db_host,LOGLEVEL_DEBUG);
+				$app->log('Changing MySQL user password for: '.$data['new']['database_user'].'@'.$db_host, LOGLEVEL_DEBUG);
 			}
-        }
-        
-        $link->query('FLUSH PRIVILEGES;');
-        $link->close();
-        
+		}
+
+		$link->query('FLUSH PRIVILEGES;');
+		$link->close();
+
 	}
-	
-	function db_user_delete($event_name,$data) {
+
+	function db_user_delete($event_name, $data) {
 		global $app, $conf;
-		
-        if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-            $app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
-            return;
-        }
-        
-        //* Connect to the database
-        $link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
-        if ($link->connect_error) {
-            $app->log('Unable to connect to mysql'.$link->connect_error,LOGLEVEL_ERROR);
-            return;
-        }
-        
-        $host_list = array();
-        // read all mysql users with this username
-        $result = $link->query("SELECT `User`, `Host` FROM `mysql`.`user` WHERE `User` = '" . $link->escape_string($data['old']['database_user']) . "' AND `Create_user_priv` = 'N'"); // basic protection against accidently deleting system users like debian-sys-maint
-        if($result) {
-            while($row = $result->fetch_assoc()) {
-                $host_list[] = $row['Host'];
-            }
-            $result->free();
-        }
-        
-        foreach($host_list as $db_host) {
-            if($link->query("DROP USER '".$link->escape_string($data['old']['database_user'])."'@'$db_host';")) {
-				$app->log('Dropping MySQL user: '.$data['old']['database_user'],LOGLEVEL_DEBUG);
-            }
-        }
-        
-        $link->query('FLUSH PRIVILEGES;');
-        $link->close();
+
+		if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+			$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
+			return;
+		}
+
+		//* Connect to the database
+		$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
+		if ($link->connect_error) {
+			$app->log('Unable to connect to mysql'.$link->connect_error, LOGLEVEL_ERROR);
+			return;
+		}
+
+		$host_list = array();
+		// read all mysql users with this username
+		$result = $link->query("SELECT `User`, `Host` FROM `mysql`.`user` WHERE `User` = '" . $link->escape_string($data['old']['database_user']) . "' AND `Create_user_priv` = 'N'"); // basic protection against accidently deleting system users like debian-sys-maint
+		if($result) {
+			while($row = $result->fetch_assoc()) {
+				$host_list[] = $row['Host'];
+			}
+			$result->free();
+		}
+
+		foreach($host_list as $db_host) {
+			if($link->query("DROP USER '".$link->escape_string($data['old']['database_user'])."'@'$db_host';")) {
+				$app->log('Dropping MySQL user: '.$data['old']['database_user'], LOGLEVEL_DEBUG);
+			}
+		}
+
+		$link->query('FLUSH PRIVILEGES;');
+		$link->close();
 	}
+
 } // end class
 
 ?>
diff --git a/server/plugins-available/network_settings_plugin.inc.php b/server/plugins-available/network_settings_plugin.inc.php
index 8355d9e..56e4980 100644
--- a/server/plugins-available/network_settings_plugin.inc.php
+++ b/server/plugins-available/network_settings_plugin.inc.php
@@ -29,78 +29,78 @@
 */
 
 class network_settings_plugin {
-	
+
 	var $plugin_name = 'network_settings_plugin';
 	var $class_name = 'network_settings_plugin';
-	
-	
+
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('server_insert','network_settings_plugin','insert');
-		$app->plugins->registerEvent('server_update','network_settings_plugin','update');
-		
-		$app->plugins->registerEvent('server_ip_insert','network_settings_plugin','insert');
-		$app->plugins->registerEvent('server_ip_update','network_settings_plugin','update');
-		
-		
-		
+
+		$app->plugins->registerEvent('server_insert', 'network_settings_plugin', 'insert');
+		$app->plugins->registerEvent('server_update', 'network_settings_plugin', 'update');
+
+		$app->plugins->registerEvent('server_ip_insert', 'network_settings_plugin', 'insert');
+		$app->plugins->registerEvent('server_ip_update', 'network_settings_plugin', 'update');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
+
 	// The purpose of this plugin is to rewrite the main.cf file
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses('getconf');
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-		
+
 		//* Configure the debian network card settings.
 		//* Dont configure
-		if($server_config['auto_network_configuration'] == 'y' && 
-		   $data['mirrored'] == false &&
-		   $server_config['ip_address'] != '0.0.0.0' && 
-		   $server_config['gateway'] != '0.0.0.0') {
-			
-			if (is_file('/etc/debian_version')) 
+		if($server_config['auto_network_configuration'] == 'y' &&
+			$data['mirrored'] == false &&
+			$server_config['ip_address'] != '0.0.0.0' &&
+			$server_config['gateway'] != '0.0.0.0') {
+
+			if (is_file('/etc/debian_version'))
 			{
-				copy('/etc/network/interfaces','/etc/network/interfaces~');
-			
+				copy('/etc/network/interfaces', '/etc/network/interfaces~');
+
 				$app->load('tpl');
-				
+
 				$network_tpl = new tpl();
 				$network_tpl->newTemplate('debian_network_interfaces.master');
-					
-				$network_tpl->setVar('ip_address',$server_config['ip_address']);
-				$network_tpl->setVar('netmask',$server_config['netmask']);
-				$network_tpl->setVar('gateway',$server_config['gateway']);
-				$network_tpl->setVar('broadcast',$this->broadcast($server_config['ip_address'],$server_config['netmask']));
-				$network_tpl->setVar('network',$this->network($server_config['ip_address'],$server_config['netmask']));
-				
+
+				$network_tpl->setVar('ip_address', $server_config['ip_address']);
+				$network_tpl->setVar('netmask', $server_config['netmask']);
+				$network_tpl->setVar('gateway', $server_config['gateway']);
+				$network_tpl->setVar('broadcast', $this->broadcast($server_config['ip_address'], $server_config['netmask']));
+				$network_tpl->setVar('network', $this->network($server_config['ip_address'], $server_config['netmask']));
+
 				$records = $app->db->queryAllRecords("SELECT ip_address FROM server_ip WHERE server_id = ".intval($conf['server_id']) . ' ORDER BY server_ip_id ASC');
 				$ip_records = array();
 				$additionl_ip_records = 0;
@@ -117,15 +117,15 @@
 								'ip_address' => $rec['ip_address'],
 								'netmask' => $server_config['netmask'],
 								'gateway' => $server_config['gateway'],
-								'broadcast' => $this->broadcast($rec['ip_address'],$server_config['netmask']),
-								'network' => $this->network($rec['ip_address'],$server_config['netmask'])
+								'broadcast' => $this->broadcast($rec['ip_address'], $server_config['netmask']),
+								'network' => $this->network($rec['ip_address'], $server_config['netmask'])
 							);
 							$additionl_ip_records = 1;
 							$n++;
 						}
 					}
 				}
-				
+
 				/*
 				 * If we have more than 1 IP we have to add the main-ip at the end
 				 * of the network-ip-list. If we don't do so, there may be problems
@@ -140,7 +140,7 @@
 					$swap['ip_address'] = $ip_records[$n-1]['ip_address'];
 					$swap['netmask'] = $ip_records[$n-1]['netmask'];
 					$swap['gateway'] = $ip_records[$n-1]['gateway'];
-					
+
 					$ip_records[$n-1] = array(
 						'id' => $n-1,
 						'ip_address' => $server_config['ip_address'],
@@ -156,29 +156,29 @@
 					$network_tpl->setVar('network',$this->network($swap['ip_address'],$swap['netmask']));
 				}
 				*/
-				
-				$network_tpl->setVar('additionl_ip_records',$additionl_ip_records);
-				$network_tpl->setLoop('interfaces',$ip_records);
-				file_put_contents('/etc/network/interfaces',$network_tpl->grab());
+
+				$network_tpl->setVar('additionl_ip_records', $additionl_ip_records);
+				$network_tpl->setLoop('interfaces', $ip_records);
+				file_put_contents('/etc/network/interfaces', $network_tpl->grab());
 				unset($network_tpl);
-				
-				$app->log('Changed Network settings',LOGLEVEL_DEBUG);
+
+				$app->log('Changed Network settings', LOGLEVEL_DEBUG);
 				exec($conf['init_scripts'] . '/' . 'networking force-reload');
-			} 
-			elseif (is_file('/etc/gentoo-release')) 
+			}
+			elseif (is_file('/etc/gentoo-release'))
 			{
-				copy('/etc/conf.d/net','/etc/conf.d/net~');
-				
+				copy('/etc/conf.d/net', '/etc/conf.d/net~');
+
 				$app->load('tpl');
-				
+
 				$network_tpl = new tpl();
 				$network_tpl->newTemplate('gentoo_network_interfaces.master');
-				
-				$network_tpl->setVar('ip_address',$server_config['ip_address']);
-				$network_tpl->setVar('netmask',$server_config['netmask']);
-				$network_tpl->setVar('gateway',$server_config['gateway']);
-				$network_tpl->setVar('broadcast',$this->broadcast($server_config['ip_address'],$server_config['netmask']));
-				
+
+				$network_tpl->setVar('ip_address', $server_config['ip_address']);
+				$network_tpl->setVar('netmask', $server_config['netmask']);
+				$network_tpl->setVar('gateway', $server_config['gateway']);
+				$network_tpl->setVar('broadcast', $this->broadcast($server_config['ip_address'], $server_config['netmask']));
+
 				$records = $app->db->queryAllRecords("SELECT ip_address FROM server_ip WHERE server_id = ".intval($conf['server_id']) . " order by ip_address");
 				$ip_records = array();
 				$additionl_ip_records = 0;
@@ -195,14 +195,14 @@
 								'ip_address' => $rec['ip_address'],
 								'netmask' => $server_config['netmask'],
 								'gateway' => $server_config['gateway'],
-								'broadcast' => $this->broadcast($rec['ip_address'],$server_config['netmask'])
+								'broadcast' => $this->broadcast($rec['ip_address'], $server_config['netmask'])
 							);
 							$additionl_ip_records = 1;
 							$n++;
 						}
 					}
 				}
-				
+
 				/*
 				 * If we have more than 1 IP we have to add the main-ip at the end
 				 * of the network-ip-list. If we don't do so, there may be problems
@@ -215,81 +215,81 @@
 					$swap['ip_address'] = $ip_records[$n-1]['ip_address'];
 					$swap['netmask'] = $ip_records[$n-1]['netmask'];
 					$swap['gateway'] = $ip_records[$n-1]['gateway'];
-					
+
 					$ip_records[$n-1] = array(
 						'id' => $n-1,
 						'ip_address' => $server_config['ip_address'],
 						'netmask' => $server_config['netmask'],
 						'gateway' => $server_config['gateway'],
-						'broadcast' => $this->broadcast($server_config['ip_address'],$server_config['netmask'])
+						'broadcast' => $this->broadcast($server_config['ip_address'], $server_config['netmask'])
 					);
-					$network_tpl->setVar('ip_address',$swap['ip_address']);
-					$network_tpl->setVar('netmask',$swap['netmask']);
-					$network_tpl->setVar('gateway',$swap['gateway']);
-					$network_tpl->setVar('broadcast',$this->broadcast($swap['ip_address'],$swap['netmask']));
+					$network_tpl->setVar('ip_address', $swap['ip_address']);
+					$network_tpl->setVar('netmask', $swap['netmask']);
+					$network_tpl->setVar('gateway', $swap['gateway']);
+					$network_tpl->setVar('broadcast', $this->broadcast($swap['ip_address'], $swap['netmask']));
 				}
-				
-				$network_tpl->setVar('additionl_ip_records',$additionl_ip_records);
-				$network_tpl->setLoop('interfaces',$ip_records);
-				file_put_contents('/etc/conf.d/net',$network_tpl->grab());
+
+				$network_tpl->setVar('additionl_ip_records', $additionl_ip_records);
+				$network_tpl->setLoop('interfaces', $ip_records);
+				file_put_contents('/etc/conf.d/net', $network_tpl->grab());
 				unset($network_tpl);
-				
-				$app->log('Changed Network settings',LOGLEVEL_DEBUG);
+
+				$app->log('Changed Network settings', LOGLEVEL_DEBUG);
 				exec($conf['init_scripts'] . '/' . 'net.eth0 restart');
-			} 
-			else {
-				$app->log('Network configuration not available for this Linux distribution.',LOGLEVEL_DEBUG);
 			}
-			
+			else {
+				$app->log('Network configuration not available for this Linux distribution.', LOGLEVEL_DEBUG);
+			}
+
 		} else {
 			if($data['mirrored'] == true) {
-				$app->log('Skipping network config request. IP addresses from amster are not configured on the mirror.',LOGLEVEL_DEBUG);
-			} 
+				$app->log('Skipping network config request. IP addresses from amster are not configured on the mirror.', LOGLEVEL_DEBUG);
+			}
 			if($server_config['auto_network_configuration'] == 'n') {
-				$app->log('Network configuration disabled in server settings.',LOGLEVEL_DEBUG);
+				$app->log('Network configuration disabled in server settings.', LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 	}
-	
+
 	function network($ip, $netmask){
 		$netmask = $this->netmask($netmask);
-		list($f1,$f2,$f3,$f4) = explode('.', $netmask);
-		$netmask_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-		list($f1,$f2,$f3,$f4) = explode('.', $ip);
-		$ip_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', $netmask);
+		$netmask_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', $ip);
+		$ip_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
 		for($i=0;$i<32;$i++){
-			$network_bin .= substr($netmask_bin,$i,1) * substr($ip_bin,$i,1);
+			$network_bin .= substr($netmask_bin, $i, 1) * substr($ip_bin, $i, 1);
 		}
 		$network_bin = wordwrap($network_bin, 8, '.', 1);
-		list($f1,$f2,$f3,$f4) = explode('.', trim($network_bin));
+		list($f1, $f2, $f3, $f4) = explode('.', trim($network_bin));
 		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
 
 	function broadcast($ip, $netmask){
 		$netmask = $this->netmask($netmask);
 		$binary_netmask = $this->binary_netmask($netmask);
-		list($f1,$f2,$f3,$f4) = explode('.', $ip);
-		$ip_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-		$broadcast_bin = str_pad(substr($ip_bin, 0, $binary_netmask),32,'1',STR_PAD_RIGHT);
+		list($f1, $f2, $f3, $f4) = explode('.', $ip);
+		$ip_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		$broadcast_bin = str_pad(substr($ip_bin, 0, $binary_netmask), 32, '1', STR_PAD_RIGHT);
 		$broadcast_bin = wordwrap($broadcast_bin, 8, '.', 1);
-		list($f1,$f2,$f3,$f4) = explode('.', trim($broadcast_bin));
+		list($f1, $f2, $f3, $f4) = explode('.', trim($broadcast_bin));
 		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
-	
+
 	function netmask($netmask){
-		list($f1,$f2,$f3,$f4) = explode('.', trim($netmask));
-		$bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($netmask));
+		$bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
 		$parts = explode('0', $bin);
 		$bin = str_pad($parts[0], 32, '0', STR_PAD_RIGHT);
 		$bin = wordwrap($bin, 8, '.', 1);
-		list($f1,$f2,$f3,$f4) = explode('.', trim($bin));
+		list($f1, $f2, $f3, $f4) = explode('.', trim($bin));
 		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
 
 	function binary_netmask($netmask){
-		list($f1,$f2,$f3,$f4) = explode('.', trim($netmask));
-		$bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($netmask));
+		$bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
 		$parts = explode('0', $bin);
 		return substr_count($parts[0], '1');
 	}
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 3cd3663..2e93944 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -61,52 +61,52 @@
 		/*
 		Register for the events
 		*/
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'ssl');
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl');
 
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
 
-		$app->plugins->registerEvent('server_ip_insert',$this->plugin_name,'server_ip');
-		$app->plugins->registerEvent('server_ip_update',$this->plugin_name,'server_ip');
-		$app->plugins->registerEvent('server_ip_delete',$this->plugin_name,'server_ip');
+		$app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip');
+		$app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip');
+		$app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip');
 
 		/*
 		$app->plugins->registerEvent('webdav_user_insert',$this->plugin_name,'webdav');
 		$app->plugins->registerEvent('webdav_user_update',$this->plugin_name,'webdav');
 		$app->plugins->registerEvent('webdav_user_delete',$this->plugin_name,'webdav');
 		*/
-		
-		$app->plugins->registerEvent('client_delete',$this->plugin_name,'client_delete');
-		
-		$app->plugins->registerEvent('web_folder_user_insert',$this->plugin_name,'web_folder_user');
-		$app->plugins->registerEvent('web_folder_user_update',$this->plugin_name,'web_folder_user');
-		$app->plugins->registerEvent('web_folder_user_delete',$this->plugin_name,'web_folder_user');
-		
-		$app->plugins->registerEvent('web_folder_update',$this->plugin_name,'web_folder_update');
-		$app->plugins->registerEvent('web_folder_delete',$this->plugin_name,'web_folder_delete');
+
+		$app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete');
+
+		$app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user');
+		$app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user');
+		$app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user');
+
+		$app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update');
+		$app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete');
 	}
 
 	// Handle the creation of SSL certificates
-	function ssl($event_name,$data) {
+	function ssl($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
 
 		// load the server configuration options
 		$app->uses('getconf');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
 		if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf'))
-			$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf',LOGLEVEL_ERROR);	
-		
+			$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR);
+
 		//* Only vhosts can have a ssl cert
 		if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain") return;
 
 		// if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl');
 		if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
-		
+
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key.org';
@@ -116,32 +116,32 @@
 
 		//* Create a SSL Certificate
 		if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) {
-		
+
 			$this->ssl_certificate_changed = true;
-			
+
 			//* Rename files if they exist
 			if(file_exists($key_file)){
-				$app->system->rename($key_file,$key_file.'.bak');
-				$app->system->chmod($key_file.'.bak',0400);
+				$app->system->rename($key_file, $key_file.'.bak');
+				$app->system->chmod($key_file.'.bak', 0400);
 			}
 			if(file_exists($key_file2)){
-				$app->system->rename($key_file2,$key_file2.'.bak');
-				$app->system->chmod($key_file2.'.bak',0400);
+				$app->system->rename($key_file2, $key_file2.'.bak');
+				$app->system->chmod($key_file2.'.bak', 0400);
 			}
-			if(file_exists($csr_file)) $app->system->rename($csr_file,$csr_file.'.bak');
-			if(file_exists($crt_file)) $app->system->rename($crt_file,$crt_file.'.bak');
-			
+			if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak');
+			if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak');
+
 			$rand_file = $ssl_dir.'/random_file';
-			$rand_data = md5(uniqid(microtime(),1));
+			$rand_data = md5(uniqid(microtime(), 1));
 			for($i=0; $i<1000; $i++) {
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
 			}
 			$app->system->file_put_contents($rand_file, $rand_data);
 
-			$ssl_password = substr(md5(uniqid(microtime(),1)), 0, 15);
+			$ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15);
 
 			$ssl_cnf = "        RANDFILE               = $rand_file
 
@@ -166,7 +166,7 @@
         challengePassword              = A challenge password";
 
 			$ssl_cnf_file = $ssl_dir.'/openssl.conf';
-			$app->system->file_put_contents($ssl_cnf_file,$ssl_cnf);
+			$app->system->file_put_contents($ssl_cnf_file, $ssl_cnf);
 
 			$rand_file = escapeshellcmd($rand_file);
 			$key_file = escapeshellcmd($key_file);
@@ -181,7 +181,7 @@
 			if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate
 
 			if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) {
-				
+
 				exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $key_file 2048");
 				exec("openssl req -new -passin pass:$ssl_password -passout pass:$ssl_password -key $key_file -out $csr_file -days $ssl_days -config $config_file");
 				exec("openssl rsa -passin pass:$ssl_password -in $key_file -out $key_file2");
@@ -189,18 +189,18 @@
 				if(file_exists($web_config['CA_path'].'/openssl.cnf'))
 				{
 					exec("openssl ca -batch -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file");
-					$app->log("Creating CA-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
-					if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed.  openssl ca -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file",LOGLEVEL_ERROR);
+					$app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+					if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed.  openssl ca -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file", LOGLEVEL_ERROR);
 				};
 				if (@filesize($crt_file)==0 || !file_exists($crt_file)){
 					exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $key_file -in $csr_file -out $crt_file -days $ssl_days -config $config_file ");
-					$app->log("Creating self-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
+					$app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
 				};
-			
+
 			}
 
-			$app->system->chmod($key_file,0400);
-			$app->system->chmod($key_file2,0400);
+			$app->system->chmod($key_file, 0400);
+			$app->system->chmod($key_file2, 0400);
 			@$app->system->unlink($config_file);
 			@$app->system->unlink($rand_file);
 			$ssl_request = $app->db->quote($app->system->file_get_contents($csr_file));
@@ -224,29 +224,29 @@
 			$csr_file = $ssl_dir.'/'.$domain.".csr";
 			$crt_file = $ssl_dir.'/'.$domain.".crt";
 			//$bundle_file = $ssl_dir.'/'.$domain.".bundle";
-			
+
 			//* Backup files
 			if(file_exists($key_file)){
-				$app->system->copy($key_file,$key_file.'~');
-				$app->system->chmod($key_file.'~',0400);
+				$app->system->copy($key_file, $key_file.'~');
+				$app->system->chmod($key_file.'~', 0400);
 			}
 			if(file_exists($key_file2)){
-				$app->system->copy($key_file2,$key_file2.'~');
-				$app->system->chmod($key_file2.'~',0400);
+				$app->system->copy($key_file2, $key_file2.'~');
+				$app->system->chmod($key_file2.'~', 0400);
 			}
-			if(file_exists($csr_file)) $app->system->copy($csr_file,$csr_file.'~');
-			if(file_exists($crt_file)) $app->system->copy($crt_file,$crt_file.'~');
+			if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~');
+			if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~');
 			//if(file_exists($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'~');
-			
+
 			//* Write new ssl files
-			if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file,$data["new"]["ssl_request"]);
-			if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file,$data["new"]["ssl_cert"]);
+			if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]);
+			if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]);
 			//if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file,$data["new"]["ssl_bundle"]);
-			if(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]);
-			$app->system->chmod($key_file2,0400);
-			
+			if(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file2, $data["new"]["ssl_key"]);
+			$app->system->chmod($key_file2, 0400);
+
 			// for nginx, bundle files have to be appended to the certificate file
-			if(trim($data["new"]["ssl_bundle"]) != ''){				
+			if(trim($data["new"]["ssl_bundle"]) != ''){
 				if(file_exists($crt_file)){
 					$crt_file_contents = trim($app->system->file_get_contents($crt_file));
 				} else {
@@ -254,15 +254,15 @@
 				}
 				if($crt_file_contents != '') $crt_file_contents .= "\n";
 				$crt_file_contents .= $data["new"]["ssl_bundle"];
-				$app->system->file_put_contents($crt_file,$app->file->unix_nl($crt_file_contents));
+				$app->system->file_put_contents($crt_file, $app->file->unix_nl($crt_file_contents));
 				unset($crt_file_contents);
 			}
 			/* Update the DB of the (local) Server */
 			$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			
+
 			/* Update also the master-DB of the Server-Farm */
 			$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			$app->log('Saving SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		//* Delete a SSL certificate
@@ -273,10 +273,10 @@
 			$crt_file = $ssl_dir.'/'.$domain.'.crt';
 			//$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
 			if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf'))
-				{
-					exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke $crt_file");
-					$app->log("Revoking CA-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
-				};
+			{
+				exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke $crt_file");
+				$app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+			};
 			$app->system->unlink($csr_file);
 			$app->system->unlink($crt_file);
 			//$app->system->unlink($bundle_file);
@@ -286,32 +286,32 @@
 			/* Update also the master-DB of the Server-Farm */
 			$app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data['new']['domain']."'");
 			$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			$app->log('Deleting SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 	}
 
 
-	function insert($event_name,$data) {
+	function insert($event_name, $data) {
 		global $app, $conf;
 
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 
 
 	}
 
 
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Check if the apache plugin is enabled
 		if(@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) {
-			$app->log('The nginx plugin cannot be used together with the apache2 plugin.',LOGLEVEL_WARN);
+			$app->log('The nginx plugin cannot be used together with the apache2 plugin.', LOGLEVEL_WARN);
 			return 0;
 		}
-		
+
 		if($this->action != 'insert') $this->action = 'update';
 
 		if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['parent_domain_id'] > 0) {
@@ -325,7 +325,7 @@
 				$data['new'] = $tmp;
 				$data['old'] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
 
 			// This is not a vhost, so we need to update the parent record instead.
@@ -342,45 +342,45 @@
 		//* Check if this is a chrooted setup
 		if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
 			$nginx_chrooted = true;
-			$app->log('Info: nginx is chrooted.',LOGLEVEL_DEBUG);
+			$app->log('Info: nginx is chrooted.', LOGLEVEL_DEBUG);
 		} else {
 			$nginx_chrooted = false;
 		}
 
 		if($data['new']['document_root'] == '') {
-			if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set',LOGLEVEL_WARN);
+			if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set', LOGLEVEL_WARN);
 			return 0;
 		}
 		if($data['new']['system_user'] == 'root' or $data['new']['system_group'] == 'root') {
-			$app->log('Websites cannot be owned by the root user or group.',LOGLEVEL_WARN);
+			$app->log('Websites cannot be owned by the root user or group.', LOGLEVEL_WARN);
 			return 0;
 		}
 		if(trim($data['new']['domain']) == '') {
-			$app->log('domain is empty',LOGLEVEL_WARN);
+			$app->log('domain is empty', LOGLEVEL_WARN);
 			return 0;
 		}
-		
-        $web_folder = 'web';
-        $log_folder = 'log';
-        if($data['new']['type'] == 'vhostsubdomain') {
-            $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
-            $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
-            if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
-            $web_folder = $data['new']['web_folder'];
-            $log_folder .= '/' . $subdomain_host;
-            unset($tmp);
-        }
+
+		$web_folder = 'web';
+		$log_folder = 'log';
+		if($data['new']['type'] == 'vhostsubdomain') {
+			$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+			$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+			if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
+			$web_folder = $data['new']['web_folder'];
+			$log_folder .= '/' . $subdomain_host;
+			unset($tmp);
+		}
 
 		// Create group and user, if not exist
 		$app->uses('system');
-		
+
 		if($web_config['connect_userid_to_webid'] == 'y') {
 			//* Calculate the uid and gid
 			$connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']);
 			$fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']);
 			$fixed_uid_param = '--uid '.$fixed_uid_gid;
 			$fixed_gid_param = '--gid '.$fixed_uid_gid;
-			
+
 			//* Check if a ispconfigend user and group exists and create them
 			if(!$app->system->is_group('ispconfigend')) {
 				exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend');
@@ -397,7 +397,7 @@
 		if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) {
 			exec('groupadd '.$fixed_gid_param.' '.$groupname);
 			if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname);
-			$app->log('Adding the group: '.$groupname,LOGLEVEL_DEBUG);
+			$app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG);
 		}
 
 		$username = escapeshellcmd($data['new']['system_user']);
@@ -409,7 +409,7 @@
 				exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
 				if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
 			}
-			$app->log('Adding the user: '.$username,LOGLEVEL_DEBUG);
+			$app->log('Adding the user: '.$username, LOGLEVEL_DEBUG);
 		}
 
 		//* If the client of the site has been changed, we have a change of the document root
@@ -421,47 +421,47 @@
 			unset($old_client);
 
 			//* Remove the old symlinks
-			$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+			$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 			if(is_array($tmp_symlinks_array)) {
 				foreach($tmp_symlinks_array as $tmp_symlink) {
-					$tmp_symlink = str_replace('[client_id]',$old_client_id,$tmp_symlink);
-					$tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
+					$tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink);
+					$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
 					// Remove trailing slash
 					if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 					// create the symlinks, if not exist
 					if(is_link($tmp_symlink)) {
 						exec('rm -f '.escapeshellcmd($tmp_symlink));
-						$app->log('Removed symlink: rm -f '.$tmp_symlink,LOGLEVEL_DEBUG);
+						$app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
 					}
 				}
 			}
 
 			if($data["new"]["type"] != "vhostsubdomain") {
 				//* Move the site data
-				$tmp_docroot = explode('/',$data['new']['document_root']);
+				$tmp_docroot = explode('/', $data['new']['document_root']);
 				unset($tmp_docroot[count($tmp_docroot)-1]);
-				$new_dir = implode('/',$tmp_docroot);
+				$new_dir = implode('/', $tmp_docroot);
 
-				$tmp_docroot = explode('/',$data['old']['document_root']);
+				$tmp_docroot = explode('/', $data['old']['document_root']);
 				unset($tmp_docroot[count($tmp_docroot)-1]);
-				$old_dir = implode('/',$tmp_docroot);
+				$old_dir = implode('/', $tmp_docroot);
 
 				//* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
 				if(@is_dir($data['new']['document_root'])) {
-					$app->system->web_folder_protection($data['new']['document_root'],false);
-					$app->system->rename($data['new']['document_root'],$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
-					$app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'),LOGLEVEL_DEBUG);
+					$app->system->web_folder_protection($data['new']['document_root'], false);
+					$app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
+					$app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG);
 				}
-			
+
 				//* Create new base directory, if it does not exist yet
 				if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
-				$app->system->web_folder_protection($data['old']['document_root'],false);
+				$app->system->web_folder_protection($data['old']['document_root'], false);
 				exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir));
 				//$app->system->rename($data['old']['document_root'],$new_dir);
-				$app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir,LOGLEVEL_DEBUG);
+				$app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG);
 
 				// Handle the change in php_open_basedir
-				$data['new']['php_open_basedir'] = str_replace($data['old']['document_root'],$data['new']['document_root'],$data['old']['php_open_basedir']);
+				$data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']);
 
 				//* Change the owner of the website files to the new website owner
 				exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
@@ -475,20 +475,20 @@
 			}
 
 			if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
-			
+
 			//* Change the log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
+			$app->system->removeLine('/etc/fstab', $fstab_line);
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
-			$app->system->replaceLine('/etc/fstab',$fstab_line,$fstab_line,1,1);
+			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 
 		}
 
 		//print_r($data);
 
 		// Check if the directories are there and create them if necessary.
-		$app->system->web_folder_protection($data['new']['document_root'],false);
-		
+		$app->system->web_folder_protection($data['new']['document_root'], false);
+
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder);
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error');
 		//if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder);
@@ -496,44 +496,44 @@
 		if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
 		if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp');
 		//if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav');
-		
+
 		//* Create the new private directory
 		if(!is_dir($data['new']['document_root'].'/private')) {
 			$app->system->mkdirpath($data['new']['document_root'].'/private');
-			$app->system->chmod($data['new']['document_root'].'/private',0710);
-			$app->system->chown($data['new']['document_root'].'/private',$username);
-			$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
+			$app->system->chmod($data['new']['document_root'].'/private', 0710);
+			$app->system->chown($data['new']['document_root'].'/private', $username);
+			$app->system->chgrp($data['new']['document_root'].'/private', $groupname);
 		}
-		
-		
+
+
 		// Remove the symlink for the site, if site is renamed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
 			if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']);
 			if(is_link($data['old']['document_root'].'/'.$log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$log_folder);
-		
+
 			//* remove old log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
-			
+			$app->system->removeLine('/etc/fstab', $fstab_line);
+
 			//* Unmount log directory
 			exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
 		}
-		
+
 		//* Create the log dir if nescessary and mount it
 		if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) {
 			if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
 			if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
 			$app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
-			$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root');
-			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root');
-			$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+			$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root');
+			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root');
+			$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 			exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
 			//* add mountpoint to fstab
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
-			$app->system->replaceLine('/etc/fstab',$fstab_line,$fstab_line,1,1);
+			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 		}
-		
-		$app->system->web_folder_protection($data['new']['document_root'],true);
+
+		$app->system->web_folder_protection($data['new']['document_root'], true);
 
 		// Get the client ID
 		$client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['new']['sys_groupid']));
@@ -542,28 +542,28 @@
 
 		// Remove old symlinks, if site is renamed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
-			$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+			$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 			if(is_array($tmp_symlinks_array)) {
 				foreach($tmp_symlinks_array as $tmp_symlink) {
-					$tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-					$tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
+					$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+					$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
 					// Remove trailing slash
 					if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 					// remove the symlinks, if not exist
 					if(is_link($tmp_symlink)) {
 						exec('rm -f '.escapeshellcmd($tmp_symlink));
-						$app->log('Removed symlink: rm -f '.$tmp_symlink,LOGLEVEL_DEBUG);
+						$app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
 					}
 				}
 			}
 		}
 
 		// Create the symlinks for the sites
-		$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+		$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 		if(is_array($tmp_symlinks_array)) {
 			foreach($tmp_symlinks_array as $tmp_symlink) {
-				$tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-				$tmp_symlink = str_replace('[website_domain]',$data['new']['domain'],$tmp_symlink);
+				$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+				$tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink);
 				// Remove trailing slash
 				if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 				//* Remove symlink if target folder has been changed.
@@ -572,64 +572,64 @@
 				}
 				// create the symlinks, if not exist
 				if(!is_link($tmp_symlink)) {
-//					exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
+					//     exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
 					if ($web_config["website_symlinks_rel"] == 'y') {
 						$this->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink));
 					} else {
 						exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
 					}
 
-					$app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink,LOGLEVEL_DEBUG);
+					$app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG);
 				}
 			}
 		}
 
 
 
-        // Install the Standard or Custom Error, Index and other related files
-        // /usr/local/ispconfig/server/conf is for the standard files
-        // /usr/local/ispconfig/server/conf-custom is for the custom files
-        // setting a local var here
-           
-        // normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
+		// Install the Standard or Custom Error, Index and other related files
+		// /usr/local/ispconfig/server/conf is for the standard files
+		// /usr/local/ispconfig/server/conf-custom is for the custom files
+		// setting a local var here
+
+		// normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
 		if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
-            
-            // Copy the error pages
+
+			// Copy the error pages
 			if($data['new']['errordocs']) {
 				$error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
-				if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
-					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+				if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 				}
 				else {
 					if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
 						exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
 					}
 					else {
-						exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+						exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 					}
 				}
 				exec('chmod -R a+r '.$error_page_path);
 			}
 
-			if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) {
-				exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
-            
-			if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
-                exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-            }
-			if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
-                exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-                }
-                if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
-                    exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-                }
-            }
+			if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+				exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+
+				if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+				if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+				if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+			}
 			else {
 				if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) {
 					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
 				}
 				else {
-					exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+					exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
 					if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
 					if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
 					if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
@@ -639,17 +639,17 @@
 
 			//** Copy the error documents on update when the error document checkbox has been activated and was deactivated before
 		} elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) {
-            
+
 			$error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
-			if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
-				exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+			if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+				exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 			}
 			else {
 				if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
 					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
 				}
 				else {
-					exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+					exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 				}
 			}
 			exec('chmod -R a+r '.$error_page_path);
@@ -681,31 +681,31 @@
 
 		//* add the nginx user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update
 		if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user']));
-		
+
 		//* If the security level is set to high
 		if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost')) {
-		
-			$app->system->web_folder_protection($data['new']['document_root'],false);
-			
+
+			$app->system->web_folder_protection($data['new']['document_root'], false);
+
 			//* Check if we have the new private folder and create it if nescessary
 			if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private');
-			
+
 			if($web_config['security_level'] == 20) {
-				
-				$app->system->chmod($data['new']['document_root'],0755);
-				$app->system->chmod($data['new']['document_root'].'/web',0710);
+
+				$app->system->chmod($data['new']['document_root'], 0755);
+				$app->system->chmod($data['new']['document_root'].'/web', 0710);
 				//$app->system->chmod($data['new']['document_root'].'/webdav',0710);
-				$app->system->chmod($data['new']['document_root'].'/private',0710);
-				$app->system->chmod($data['new']['document_root'].'/ssl',0755);
+				$app->system->chmod($data['new']['document_root'].'/private', 0710);
+				$app->system->chmod($data['new']['document_root'].'/ssl', 0755);
 
 				// make tmp directory writable for nginx and the website users
-				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
-			
+				$app->system->chmod($data['new']['document_root'].'/tmp', 0777);
+
 				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+					$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 				}
-				
+
 				if($web_config['add_web_users_to_sshusers_group'] == 'y') {
 					$command = 'usermod';
 					$command .= ' --groups sshusers';
@@ -724,99 +724,99 @@
 					$app->system->server_conf['group_datei'] = $tmp_groupfile;
 					unset($tmp_groupfile);
 				}
-				
+
 				//* Chown all default directories
-				$app->system->chown($data['new']['document_root'],'root');
-				$app->system->chgrp($data['new']['document_root'],'root');
-				$app->system->chown($data['new']['document_root'].'/cgi-bin',$username);
-				$app->system->chgrp($data['new']['document_root'].'/cgi-bin',$groupname);
+				$app->system->chown($data['new']['document_root'], 'root');
+				$app->system->chgrp($data['new']['document_root'], 'root');
+				$app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+				$app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root',false);
-					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,$groupname,false);
+					$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
 				}
-				$app->system->chown($data['new']['document_root'].'/ssl','root');
-				$app->system->chgrp($data['new']['document_root'].'/ssl','root');
-				$app->system->chown($data['new']['document_root'].'/tmp',$username);
-				$app->system->chgrp($data['new']['document_root'].'/tmp',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/stats',$groupname);
+				$app->system->chown($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chown($data['new']['document_root'].'/tmp', $username);
+				$app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
 				//$app->system->chown($data['new']['document_root'].'/webdav',$username);
 				//$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
-				$app->system->chown($data['new']['document_root'].'/private',$username);
-				$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
+				$app->system->chown($data['new']['document_root'].'/private', $username);
+				$app->system->chgrp($data['new']['document_root'].'/private', $groupname);
 
 				// If the security Level is set to medium
 			} else {
 
-				$app->system->chmod($data['new']['document_root'],0755);
-				$app->system->chmod($data['new']['document_root'].'/web',0755);
+				$app->system->chmod($data['new']['document_root'], 0755);
+				$app->system->chmod($data['new']['document_root'].'/web', 0755);
 				//$app->system->chmod($data['new']['document_root'].'/webdav',0755);
-				$app->system->chmod($data['new']['document_root'].'/ssl',0755);
-				$app->system->chmod($data['new']['document_root'].'/cgi-bin',0755);
-				
+				$app->system->chmod($data['new']['document_root'].'/ssl', 0755);
+				$app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755);
+
 				// make temp directory writable for nginx and the website users
-				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
-				
+				$app->system->chmod($data['new']['document_root'].'/tmp', 0777);
+
 				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+					$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 				}
-				
-				$app->system->chown($data['new']['document_root'],'root');
-				$app->system->chgrp($data['new']['document_root'],'root');
-				$app->system->chown($data['new']['document_root'].'/cgi-bin',$username);
-				$app->system->chgrp($data['new']['document_root'].'/cgi-bin',$groupname);
+
+				$app->system->chown($data['new']['document_root'], 'root');
+				$app->system->chgrp($data['new']['document_root'], 'root');
+				$app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+				$app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root',false);
-					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,$groupname,false);
+					$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
 				}
-				
-                $app->system->chown($data['new']['document_root'].'/ssl','root');
-				$app->system->chgrp($data['new']['document_root'].'/ssl','root');
-				$app->system->chown($data['new']['document_root'].'/tmp',$username);
-				$app->system->chgrp($data['new']['document_root'].'/tmp',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/stats',$groupname);
+
+				$app->system->chown($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chown($data['new']['document_root'].'/tmp', $username);
+				$app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
 				//$app->system->chown($data['new']['document_root'].'/webdav',$username);
 				//$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
 			}
 		} elseif(($this->action == 'insert' && $data['new']['type'] == 'vhostsubdomain') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhostsubdomain')) {
 			if($web_config['security_level'] == 20) {
-				$app->system->chmod($data['new']['document_root'].'/' . $web_folder,0710);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder,$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder,$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats',$groupname);
-            } else {
-				$app->system->chmod($data['new']['document_root'].'/' . $web_folder,0755);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder,$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder,$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats',$groupname);
-            }
-        }
-		
+				$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+			} else {
+				$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+			}
+		}
+
 		//* Protect web folders
-		$app->system->web_folder_protection($data['new']['document_root'],true);
-		
+		$app->system->web_folder_protection($data['new']['document_root'], true);
+
 		if($data['new']['type'] == 'vhost') {
-            // Change the ownership of the error log to the root user
-            if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
-            $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log','root');
-            $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log','root');
-        }
+			// Change the ownership of the error log to the root user
+			if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
+			$app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+			$app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+		}
 
 		// Change the ownership of the error log to the owner of the website
 		/*
@@ -865,24 +865,24 @@
 		$vhost_data['web_document_root'] = $data['new']['document_root'].'/' . $web_folder;
 		$vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/' . $web_folder;
 		$vhost_data['web_basedir'] = $web_config['website_basedir'];
-		
+
 		// IPv6
 		if($data['new']['ipv6_address'] != ''){
 			$tpl->setVar('ipv6_enabled', 1);
 			if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
 				if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
-					$explode_v6prefix=explode(':',$conf['serverconfig']['server']['v6_prefix']);
-					$explode_v6=explode(':',$data['new']['ipv6_address']);
+					$explode_v6prefix=explode(':', $conf['serverconfig']['server']['v6_prefix']);
+					$explode_v6=explode(':', $data['new']['ipv6_address']);
 
 					for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
-				        $explode_v6[$i] = $explode_v6prefix[$i];
+						$explode_v6[$i] = $explode_v6prefix[$i];
 					}
-					$data['new']['ipv6_address'] = implode(':',$explode_v6);
+					$data['new']['ipv6_address'] = implode(':', $explode_v6);
 					$vhost_data['ipv6_address'] = $data['new']['ipv6_address'];
 				}
 			}
 		}
-		
+
 		// PHP-FPM
 		// Support for multiple PHP versions
 		/*
@@ -898,7 +898,7 @@
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
@@ -906,22 +906,22 @@
 			if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
 		}
-		
+
 		if($default_php_fpm){
 			$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
 		} else {
 			$pool_dir = $custom_php_fpm_pool_dir;
 		}
-		if(substr($pool_dir,-1) != '/') $pool_dir .= '/';
+		if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
 		$pool_name = 'web'.$data['new']['domain_id'];
 		$socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']);
-		if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
-		
+		if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
+
 		if($data['new']['php_fpm_use_socket'] == 'y'){
 			$use_tcp = 0;
 			$use_socket = 1;
@@ -933,12 +933,12 @@
 		$tpl->setVar('use_socket', $use_socket);
 		$fpm_socket = $socket_dir.$pool_name.'.sock';
 		$tpl->setVar('fpm_socket', $fpm_socket);
-		$tpl->setVar('rnd_php_dummy_file', '/'.md5(uniqid(microtime(),1)).'.htm');
+		$tpl->setVar('rnd_php_dummy_file', '/'.md5(uniqid(microtime(), 1)).'.htm');
 		$vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1;
-		
+
 		// backwards compatibility; since ISPConfig 3.0.5, the PHP mode for nginx is called 'php-fpm' instead of 'fast-cgi'. The following line makes sure that old web sites that have 'fast-cgi' in the database still get PHP-FPM support.
 		if($vhost_data['php'] == 'fast-cgi') $vhost_data['php'] = 'php-fpm';
-		
+
 		// Custom rewrite rules
 		/*
 		$final_rewrite_rules = array();
@@ -954,10 +954,10 @@
 		}
 		$tpl->setLoop('rewrite_rules', $final_rewrite_rules);
 		*/
-		
+
 		// Custom rewrite rules
 		$final_rewrite_rules = array();
-		
+
 		if(isset($data['new']['rewrite_rules']) && trim($data['new']['rewrite_rules']) != '') {
 			$custom_rewrite_rules = trim($data['new']['rewrite_rules']);
 			$custom_rewrites_are_valid = true;
@@ -970,7 +970,7 @@
 			if(is_array($custom_rewrite_rule_lines) && !empty($custom_rewrite_rule_lines)){
 				foreach($custom_rewrite_rule_lines as $custom_rewrite_rule_line){
 					// ignore comments
-					if(substr(ltrim($custom_rewrite_rule_line),0,1) == '#'){
+					if(substr(ltrim($custom_rewrite_rule_line), 0, 1) == '#'){
 						$final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
 						continue;
 					}
@@ -1032,7 +1032,7 @@
 			}
 		}
 		$tpl->setLoop('rewrite_rules', $final_rewrite_rules);
-		
+
 		// Custom nginx directives
 		$final_nginx_directives = array();
 		$nginx_directives = $data['new']['nginx_directives'];
@@ -1055,10 +1055,10 @@
 
 		if($domain!='' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
 			$vhost_data['ssl_enabled'] = 1;
-			$app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG);
 		} else {
 			$vhost_data['ssl_enabled'] = 0;
-			$app->log('SSL Disabled. '.$domain,LOGLEVEL_DEBUG);
+			$app->log('SSL Disabled. '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		// Set SEO Redirect
@@ -1075,23 +1075,23 @@
 		} else {
 			$vhost_data['seo_redirect_enabled'] = 0;
 		}
-		
-		
+
+
 
 		// Rewrite rules
 		$own_rewrite_rules = array();
 		$rewrite_rules = array();
 		$local_rewrite_rules = array();
 		if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') {
-			if(substr($data['new']['redirect_path'],-1) != '/') $data['new']['redirect_path'] .= '/';
-			if(substr($data['new']['redirect_path'],0,8) == '[scheme]'){
+			if(substr($data['new']['redirect_path'], -1) != '/') $data['new']['redirect_path'] .= '/';
+			if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){
 				if($data['new']['redirect_type'] != 'proxy'){
-					$data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'],8);
+					$data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'], 8);
 				} else {
-					$data['new']['redirect_path'] = 'http'.substr($data['new']['redirect_path'],8);
+					$data['new']['redirect_path'] = 'http'.substr($data['new']['redirect_path'], 8);
 				}
 			}
-			
+
 			// Custom proxy directives
 			if($data['new']['redirect_type'] == 'proxy' && trim($data['new']['proxy_directives'] != '')){
 				$final_proxy_directives = array();
@@ -1110,164 +1110,164 @@
 			}
 
 			switch($data['new']['subdomain']) {
-				case 'www':
+			case 'www':
+				$exclude_own_hostname = '';
+				if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
+					if($data['new']['redirect_type'] == 'proxy'){
+						$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+						$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+						break;
+					}
+					$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+				} else { // URL - check if URL is local
+					$tmp_redirect_path = $data['new']['redirect_path'];
+					if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+					$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+					if(($tmp_redirect_path_parts['host'] == $data['new']['domain'] || $tmp_redirect_path_parts['host'] == 'www.'.$data['new']['domain']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+						// URL is local
+						if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+						if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+						//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
+						if($data['new']['redirect_type'] == 'proxy'){
+							$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+							$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
+							break;
+						} else {
+							$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+							$exclude_own_hostname = $tmp_redirect_path_parts['host'];
+						}
+					} else {
+						// external URL
+						$rewrite_exclude = '(.?)/';
+						if($data['new']['redirect_type'] == 'proxy'){
+							$vhost_data['use_proxy'] = 'y';
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+					}
+					unset($tmp_redirect_path);
+					unset($tmp_redirect_path_parts);
+				}
+				$own_rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+					'rewrite_target'  => $data['new']['redirect_path'],
+					'rewrite_exclude' => $rewrite_exclude,
+					'rewrite_subdir' => $rewrite_subdir,
+					'exclude_own_hostname' => $exclude_own_hostname,
+					'proxy_directives' => $final_proxy_directives,
+					'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+					'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
+				break;
+			case '*':
+				$exclude_own_hostname = '';
+				if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
+					if($data['new']['redirect_type'] == 'proxy'){
+						$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+						$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+						break;
+					}
+					$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+				} else { // URL - check if URL is local
+					$tmp_redirect_path = $data['new']['redirect_path'];
+					if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+					$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+
+					//if($is_serveralias && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+					if($this->url_is_local($tmp_redirect_path_parts['host'], $data['new']['domain_id']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+						// URL is local
+						if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+						if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+						//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
+						if($data['new']['redirect_type'] == 'proxy'){
+							$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+							$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
+							break;
+						} else {
+							$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+							$exclude_own_hostname = $tmp_redirect_path_parts['host'];
+						}
+					} else {
+						// external URL
+						$rewrite_exclude = '(.?)/';
+						if($data['new']['redirect_type'] == 'proxy'){
+							$vhost_data['use_proxy'] = 'y';
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+					}
+					unset($tmp_redirect_path);
+					unset($tmp_redirect_path_parts);
+				}
+				$own_rewrite_rules[] = array( 'rewrite_domain'  => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+					'rewrite_target'  => $data['new']['redirect_path'],
+					'rewrite_exclude' => $rewrite_exclude,
+					'rewrite_subdir' => $rewrite_subdir,
+					'exclude_own_hostname' => $exclude_own_hostname,
+					'proxy_directives' => $final_proxy_directives,
+					'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+					'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
+				break;
+			default:
+				if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
 					$exclude_own_hostname = '';
-					if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path
+					if($data['new']['redirect_type'] == 'proxy'){
+						$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+						$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+						break;
+					}
+					$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+				} else { // URL - check if URL is local
+					$tmp_redirect_path = $data['new']['redirect_path'];
+					if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+					$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+					if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+						// URL is local
+						if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+						if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+						//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
 						if($data['new']['redirect_type'] == 'proxy'){
 							$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-							$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'],0,-1);
+							$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
 							break;
-						}
-						$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'],1,-1).(substr($data['new']['redirect_path'],1,-1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-					} else { // URL - check if URL is local
-						$tmp_redirect_path = $data['new']['redirect_path'];
-						if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7);
-						$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-						if(($tmp_redirect_path_parts['host'] == $data['new']['domain'] || $tmp_redirect_path_parts['host'] == 'www.'.$data['new']['domain']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
-							// URL is local
-							if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1);
-							if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
-							//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-								$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
-								break;
-							} else {
-								$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'],1).(substr($tmp_redirect_path_parts['path'],1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-								$exclude_own_hostname = $tmp_redirect_path_parts['host'];
-							}
 						} else {
-							// external URL
-							$rewrite_exclude = '(.?)/';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['use_proxy'] = 'y';
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
+							$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+							$exclude_own_hostname = $tmp_redirect_path_parts['host'];
 						}
-						unset($tmp_redirect_path);
-						unset($tmp_redirect_path_parts);
-					}
-					$own_rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
-						'rewrite_target' 	=> $data['new']['redirect_path'],
-						'rewrite_exclude'	=> $rewrite_exclude,
-						'rewrite_subdir'	=> $rewrite_subdir,
-						'exclude_own_hostname' => $exclude_own_hostname,
-						'proxy_directives'	=> $final_proxy_directives,
-						'use_rewrite'	=> ($data['new']['redirect_type'] == 'proxy' ? false:true),
-						'use_proxy'	=> ($data['new']['redirect_type'] == 'proxy' ? true:false));
-					break;
-				case '*':
-					$exclude_own_hostname = '';
-					if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path
+					} else {
+						// external URL
+						$rewrite_exclude = '(.?)/';
 						if($data['new']['redirect_type'] == 'proxy'){
-							$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-							$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'],0,-1);
-							break;
+							$vhost_data['use_proxy'] = 'y';
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
 						}
-						$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'],1,-1).(substr($data['new']['redirect_path'],1,-1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-					} else { // URL - check if URL is local
-						$tmp_redirect_path = $data['new']['redirect_path'];
-						if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7);
-						$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-												
-						//if($is_serveralias && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
-						if($this->url_is_local($tmp_redirect_path_parts['host'], $data['new']['domain_id']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
-							// URL is local
-							if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1);
-							if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
-							//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-								$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
-								break;
-							} else {
-								$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'],1).(substr($tmp_redirect_path_parts['path'],1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-								$exclude_own_hostname = $tmp_redirect_path_parts['host'];
-							}
-						} else {
-							// external URL
-							$rewrite_exclude = '(.?)/';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['use_proxy'] = 'y';
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
-						}
-						unset($tmp_redirect_path);
-						unset($tmp_redirect_path_parts);
 					}
-					$own_rewrite_rules[] = array(	'rewrite_domain' 	=> '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
-						'rewrite_target' 	=> $data['new']['redirect_path'],
-						'rewrite_exclude'	=> $rewrite_exclude,
-						'rewrite_subdir'	=> $rewrite_subdir,
-						'exclude_own_hostname' => $exclude_own_hostname,
-						'proxy_directives'	=> $final_proxy_directives,
-						'use_rewrite'	=> ($data['new']['redirect_type'] == 'proxy' ? false:true),
-						'use_proxy'	=> ($data['new']['redirect_type'] == 'proxy' ? true:false));
-					break;
-				default:
-					if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path
-						$exclude_own_hostname = '';
-						if($data['new']['redirect_type'] == 'proxy'){
-							$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-							$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'],0,-1);
-							break;
-						}
-						$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'],1,-1).(substr($data['new']['redirect_path'],1,-1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-					} else { // URL - check if URL is local
-						$tmp_redirect_path = $data['new']['redirect_path'];
-						if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7);
-						$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-						if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
-							// URL is local
-							if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1);
-							if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
-							//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-								$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
-								break;
-							} else {
-								$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'],1).(substr($tmp_redirect_path_parts['path'],1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-								$exclude_own_hostname = $tmp_redirect_path_parts['host'];
-							}
-						} else {
-							// external URL
-							$rewrite_exclude = '(.?)/';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['use_proxy'] = 'y';
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
-						}
-						unset($tmp_redirect_path);
-						unset($tmp_redirect_path_parts);
-					}
-					$own_rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
-						'rewrite_target' 	=> $data['new']['redirect_path'],
-						'rewrite_exclude'	=> $rewrite_exclude,
-						'rewrite_subdir'	=> $rewrite_subdir,
-						'exclude_own_hostname' => $exclude_own_hostname,
-						'proxy_directives'	=> $final_proxy_directives,
-						'use_rewrite'	=> ($data['new']['redirect_type'] == 'proxy' ? false:true),
-						'use_proxy'	=> ($data['new']['redirect_type'] == 'proxy' ? true:false));
+					unset($tmp_redirect_path);
+					unset($tmp_redirect_path_parts);
+				}
+				$own_rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+					'rewrite_target'  => $data['new']['redirect_path'],
+					'rewrite_exclude' => $rewrite_exclude,
+					'rewrite_subdir' => $rewrite_subdir,
+					'exclude_own_hostname' => $exclude_own_hostname,
+					'proxy_directives' => $final_proxy_directives,
+					'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+					'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
 			}
 		}
 
 		$tpl->setVar($vhost_data);
-		
+
 		$server_alias = array();
-		
+
 		// get autoalias
 		$auto_alias = $web_config['website_autoalias'];
 		if($auto_alias != '') {
@@ -1281,14 +1281,14 @@
 			unset($aa_replace);
 			$server_alias[] .= $auto_alias.' ';
 		}
-		
+
 		switch($data['new']['subdomain']) {
-			case 'www':
-				$server_alias[] = 'www.'.$data['new']['domain'].' ';
-				break;
-			case '*':
-				$server_alias[] = '*.'.$data['new']['domain'].' ';
-				break;
+		case 'www':
+			$server_alias[] = 'www.'.$data['new']['domain'].' ';
+			break;
+		case '*':
+			$server_alias[] = '*.'.$data['new']['domain'].' ';
+			break;
 		}
 
 		// get alias domains (co-domains and subdomains)
@@ -1296,7 +1296,7 @@
 		$alias_seo_redirects = array();
 		if(is_array($aliases)) {
 			foreach($aliases as $alias) {
-			
+
 				// Custom proxy directives
 				if($alias['redirect_type'] == 'proxy' && trim($alias['proxy_directives'] != '')){
 					$final_proxy_directives = array();
@@ -1313,21 +1313,21 @@
 				} else {
 					$final_proxy_directives = false;
 				}
-			
-				if($alias['redirect_type'] == '' || $alias['redirect_path'] == '' || substr($alias['redirect_path'],0,1) == '/') {
+
+				if($alias['redirect_type'] == '' || $alias['redirect_path'] == '' || substr($alias['redirect_path'], 0, 1) == '/') {
 					switch($alias['subdomain']) {
-						case 'www':
-							$server_alias[] = 'www.'.$alias['domain'].' '.$alias['domain'].' ';
-							break;
-						case '*':
-							$server_alias[] = '*.'.$alias['domain'].' '.$alias['domain'].' ';
-							break;
-						default:
-							$server_alias[] = $alias['domain'].' ';
-							break;
+					case 'www':
+						$server_alias[] = 'www.'.$alias['domain'].' '.$alias['domain'].' ';
+						break;
+					case '*':
+						$server_alias[] = '*.'.$alias['domain'].' '.$alias['domain'].' ';
+						break;
+					default:
+						$server_alias[] = $alias['domain'].' ';
+						break;
 					}
-					$app->log('Add server alias: '.$alias['domain'],LOGLEVEL_DEBUG);
-					
+					$app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG);
+
 					// Add SEO redirects for alias domains
 					if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){
 						$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
@@ -1336,167 +1336,167 @@
 						}
 					}
 				}
-				
-				// Local Rewriting (inside vhost server {} container)
-				if($alias['redirect_type'] != '' && substr($alias['redirect_path'],0,1) == '/' && $alias['redirect_type'] != 'proxy') {  // proxy makes no sense with local path
-					if(substr($alias['redirect_path'],-1) != '/') $alias['redirect_path'] .= '/';
-					$rewrite_exclude = '(?!/\b('.substr($alias['redirect_path'],1,-1).(substr($alias['redirect_path'],1,-1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-					switch($alias['subdomain']) {
-						case 'www':
-							// example.com
-							$local_rewrite_rules[] = array(	'local_redirect_origin_domain' 	=> $alias['domain'],
-								'local_redirect_operator'	=> '=',
-								'local_redirect_exclude' => $rewrite_exclude,
-								'local_redirect_target' => $alias['redirect_path'],
-								'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
 
-							// www.example.com
-							$local_rewrite_rules[] = array(	'local_redirect_origin_domain' 	=> 'www.'.$alias['domain'],
-								'local_redirect_operator'	=> '=',
-								'local_redirect_exclude' => $rewrite_exclude,
-								'local_redirect_target' => $alias['redirect_path'],
-								'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
-							break;
-						case '*':
-							$local_rewrite_rules[] = array(	'local_redirect_origin_domain' 	=> '^('.str_replace('.', '\.', $alias['domain']).'|.+\.'.str_replace('.', '\.', $alias['domain']).')$',
-								'local_redirect_operator'	=> '~*',
-								'local_redirect_exclude' => $rewrite_exclude,
-								'local_redirect_target' => $alias['redirect_path'],
-								'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
-							break;
-						default:
-							$local_rewrite_rules[] = array(	'local_redirect_origin_domain' 	=> $alias['domain'],
-								'local_redirect_operator'	=> '=',
-								'local_redirect_exclude' => $rewrite_exclude,
-								'local_redirect_target' => $alias['redirect_path'],
-								'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+				// Local Rewriting (inside vhost server {} container)
+				if($alias['redirect_type'] != '' && substr($alias['redirect_path'], 0, 1) == '/' && $alias['redirect_type'] != 'proxy') {  // proxy makes no sense with local path
+					if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/';
+					$rewrite_exclude = '(?!/\b('.substr($alias['redirect_path'], 1, -1).(substr($alias['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+					switch($alias['subdomain']) {
+					case 'www':
+						// example.com
+						$local_rewrite_rules[] = array( 'local_redirect_origin_domain'  => $alias['domain'],
+							'local_redirect_operator' => '=',
+							'local_redirect_exclude' => $rewrite_exclude,
+							'local_redirect_target' => $alias['redirect_path'],
+							'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+
+						// www.example.com
+						$local_rewrite_rules[] = array( 'local_redirect_origin_domain'  => 'www.'.$alias['domain'],
+							'local_redirect_operator' => '=',
+							'local_redirect_exclude' => $rewrite_exclude,
+							'local_redirect_target' => $alias['redirect_path'],
+							'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+						break;
+					case '*':
+						$local_rewrite_rules[] = array( 'local_redirect_origin_domain'  => '^('.str_replace('.', '\.', $alias['domain']).'|.+\.'.str_replace('.', '\.', $alias['domain']).')$',
+							'local_redirect_operator' => '~*',
+							'local_redirect_exclude' => $rewrite_exclude,
+							'local_redirect_target' => $alias['redirect_path'],
+							'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+						break;
+					default:
+						$local_rewrite_rules[] = array( 'local_redirect_origin_domain'  => $alias['domain'],
+							'local_redirect_operator' => '=',
+							'local_redirect_exclude' => $rewrite_exclude,
+							'local_redirect_target' => $alias['redirect_path'],
+							'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
 					}
 				}
-				
+
 				// External Rewriting (extra server {} containers)
-				if($alias['redirect_type'] != '' && $alias['redirect_path'] != '' && substr($alias['redirect_path'],0,1) != '/') {
-					if(substr($alias['redirect_path'],-1) != '/') $alias['redirect_path'] .= '/';
-					if(substr($alias['redirect_path'],0,8) == '[scheme]'){
+				if($alias['redirect_type'] != '' && $alias['redirect_path'] != '' && substr($alias['redirect_path'], 0, 1) != '/') {
+					if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/';
+					if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){
 						if($alias['redirect_type'] != 'proxy'){
-							$alias['redirect_path'] = '$scheme'.substr($alias['redirect_path'],8);
+							$alias['redirect_path'] = '$scheme'.substr($alias['redirect_path'], 8);
 						} else {
-							$alias['redirect_path'] = 'http'.substr($alias['redirect_path'],8);
+							$alias['redirect_path'] = 'http'.substr($alias['redirect_path'], 8);
 						}
 					}
-					
-					switch($alias['subdomain']) {
-						case 'www':
-							if($alias['redirect_type'] == 'proxy'){
-								$tmp_redirect_path = $alias['redirect_path'];
-								$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
-							
-							if($alias['redirect_type'] != 'proxy'){
-								if(substr($alias['redirect_path'],-1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'],0,-1);
-							}
-							// Add SEO redirects for alias domains
-							$alias_seo_redirects2 = array();
-							if($alias['seo_redirect'] != ''){
-								$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
-								if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
-									$alias_seo_redirects2[] = $tmp_seo_redirects;
-								}
-							}
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> $alias['domain'],
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
-								'rewrite_target' 	=> $alias['redirect_path'],
-								'rewrite_subdir'	=> $rewrite_subdir,
-								'proxy_directives'	=> $final_proxy_directives,
-								'use_rewrite'	=> ($alias['redirect_type'] == 'proxy' ? false:true),
-								'use_proxy'	=> ($alias['redirect_type'] == 'proxy' ? true:false),
-								'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
 
-							// Add SEO redirects for alias domains
-							$alias_seo_redirects2 = array();
-							if($alias['seo_redirect'] != ''){
-								$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'www');
-								if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
-									$alias_seo_redirects2[] = $tmp_seo_redirects;
-								}
+					switch($alias['subdomain']) {
+					case 'www':
+						if($alias['redirect_type'] == 'proxy'){
+							$tmp_redirect_path = $alias['redirect_path'];
+							$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+
+						if($alias['redirect_type'] != 'proxy'){
+							if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+						}
+						// Add SEO redirects for alias domains
+						$alias_seo_redirects2 = array();
+						if($alias['seo_redirect'] != ''){
+							$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
+							if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+								$alias_seo_redirects2[] = $tmp_seo_redirects;
 							}
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> 'www.'.$alias['domain'],
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
-								'rewrite_target' 	=> $alias['redirect_path'],
-								'rewrite_subdir'	=> $rewrite_subdir,
-								'proxy_directives'	=> $final_proxy_directives,
-								'use_rewrite'	=> ($alias['redirect_type'] == 'proxy' ? false:true),
-								'use_proxy'	=> ($alias['redirect_type'] == 'proxy' ? true:false),
-								'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
-							break;
-						case '*':
-							if($alias['redirect_type'] == 'proxy'){
-								$tmp_redirect_path = $alias['redirect_path'];
-								$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+						$rewrite_rules[] = array( 'rewrite_domain'  => $alias['domain'],
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+							'rewrite_target'  => $alias['redirect_path'],
+							'rewrite_subdir' => $rewrite_subdir,
+							'proxy_directives' => $final_proxy_directives,
+							'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+							'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+							'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+
+						// Add SEO redirects for alias domains
+						$alias_seo_redirects2 = array();
+						if($alias['seo_redirect'] != ''){
+							$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'www');
+							if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+								$alias_seo_redirects2[] = $tmp_seo_redirects;
 							}
-							
-							if($alias['redirect_type'] != 'proxy'){
-								if(substr($alias['redirect_path'],-1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'],0,-1);
+						}
+						$rewrite_rules[] = array( 'rewrite_domain'  => 'www.'.$alias['domain'],
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+							'rewrite_target'  => $alias['redirect_path'],
+							'rewrite_subdir' => $rewrite_subdir,
+							'proxy_directives' => $final_proxy_directives,
+							'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+							'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+							'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+						break;
+					case '*':
+						if($alias['redirect_type'] == 'proxy'){
+							$tmp_redirect_path = $alias['redirect_path'];
+							$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+
+						if($alias['redirect_type'] != 'proxy'){
+							if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+						}
+						// Add SEO redirects for alias domains
+						$alias_seo_redirects2 = array();
+						if($alias['seo_redirect'] != ''){
+							$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
+							if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+								$alias_seo_redirects2[] = $tmp_seo_redirects;
 							}
-							// Add SEO redirects for alias domains
-							$alias_seo_redirects2 = array();
-							if($alias['seo_redirect'] != ''){
+						}
+						$rewrite_rules[] = array( 'rewrite_domain'  => $alias['domain'].' *.'.$alias['domain'],
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+							'rewrite_target'  => $alias['redirect_path'],
+							'rewrite_subdir' => $rewrite_subdir,
+							'proxy_directives' => $final_proxy_directives,
+							'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+							'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+							'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+						break;
+					default:
+						if($alias['redirect_type'] == 'proxy'){
+							$tmp_redirect_path = $alias['redirect_path'];
+							$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+
+						if($alias['redirect_type'] != 'proxy'){
+							if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+						}
+						if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '*.'.substr($alias['domain'], 2);
+						else $domain_rule = $alias['domain'];
+						// Add SEO redirects for alias domains
+						$alias_seo_redirects2 = array();
+						if($alias['seo_redirect'] != ''){
+							if(substr($alias['domain'], 0, 2) === '*.'){
 								$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
-								if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
-									$alias_seo_redirects2[] = $tmp_seo_redirects;
-								}
+							} else {
+								$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
 							}
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> $alias['domain'].' *.'.$alias['domain'],
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
-								'rewrite_target' 	=> $alias['redirect_path'],
-								'rewrite_subdir'	=> $rewrite_subdir,
-								'proxy_directives'	=> $final_proxy_directives,
-								'use_rewrite'	=> ($alias['redirect_type'] == 'proxy' ? false:true),
-								'use_proxy'	=> ($alias['redirect_type'] == 'proxy' ? true:false),
-								'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
-							break;
-						default:
-							if($alias['redirect_type'] == 'proxy'){
-								$tmp_redirect_path = $alias['redirect_path'];
-								$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
+							if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+								$alias_seo_redirects2[] = $tmp_seo_redirects;
 							}
-							
-							if($alias['redirect_type'] != 'proxy'){
-								if(substr($alias['redirect_path'],-1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'],0,-1);
-							}
-                            if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '*.'.substr($alias['domain'], 2);
-                            else $domain_rule = $alias['domain'];
-							// Add SEO redirects for alias domains
-							$alias_seo_redirects2 = array();
-							if($alias['seo_redirect'] != ''){
-								if(substr($alias['domain'], 0, 2) === '*.'){
-									$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
-								} else {
-									$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
-								}
-								if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
-									$alias_seo_redirects2[] = $tmp_seo_redirects;
-								}
-							}
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> $domain_rule,
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
-								'rewrite_target' 	=> $alias['redirect_path'],
-								'rewrite_subdir'	=> $rewrite_subdir,
-								'proxy_directives'	=> $final_proxy_directives,
-								'use_rewrite'	=> ($alias['redirect_type'] == 'proxy' ? false:true),
-								'use_proxy'	=> ($alias['redirect_type'] == 'proxy' ? true:false),
-								'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+						}
+						$rewrite_rules[] = array( 'rewrite_domain'  => $domain_rule,
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+							'rewrite_target'  => $alias['redirect_path'],
+							'rewrite_subdir' => $rewrite_subdir,
+							'proxy_directives' => $final_proxy_directives,
+							'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+							'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+							'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
 					}
 				}
 			}
@@ -1512,59 +1512,59 @@
 			}
 			unset($tmp_alias);
 
-			$tpl->setVar('alias',trim($server_alias_str));
+			$tpl->setVar('alias', trim($server_alias_str));
 		} else {
-			$tpl->setVar('alias','');
+			$tpl->setVar('alias', '');
 		}
 
 		if(count($rewrite_rules) > 0) {
-			$tpl->setLoop('redirects',$rewrite_rules);
+			$tpl->setLoop('redirects', $rewrite_rules);
 		}
 		if(count($own_rewrite_rules) > 0) {
-			$tpl->setLoop('own_redirects',$own_rewrite_rules);
+			$tpl->setLoop('own_redirects', $own_rewrite_rules);
 		}
 		if(count($local_rewrite_rules) > 0) {
-			$tpl->setLoop('local_redirects',$local_rewrite_rules);
+			$tpl->setLoop('local_redirects', $local_rewrite_rules);
 		}
 		if(count($alias_seo_redirects) > 0) {
-			$tpl->setLoop('alias_seo_redirects',$alias_seo_redirects);
+			$tpl->setLoop('alias_seo_redirects', $alias_seo_redirects);
 		}
-		
+
 		//* Create basic http auth for website statistics
 		$tpl->setVar('stats_auth_passwd_file', $data['new']['document_root']."/web/stats/.htpasswd_stats");
-		
+
 		// Create basic http auth for other directories
 		$basic_auth_locations = $this->_create_web_folder_auth_configuration($data['new']);
 		if(is_array($basic_auth_locations) && !empty($basic_auth_locations)) $tpl->setLoop('basic_auth_locations', $basic_auth_locations);
 
 		$vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost');
 		//* Make a backup copy of vhost file
-		if(file_exists($vhost_file)) copy($vhost_file,$vhost_file.'~');
-		
+		if(file_exists($vhost_file)) copy($vhost_file, $vhost_file.'~');
+
 		//* Write vhost file
-		$app->system->file_put_contents($vhost_file,$this->nginx_merge_locations($tpl->grab()));
-		$app->log('Writing the vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
+		$app->system->file_put_contents($vhost_file, $this->nginx_merge_locations($tpl->grab()));
+		$app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 		//* Set the symlink to enable the vhost
 		//* First we check if there is a old type of symlink and remove it
 		$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost');
 		if(is_link($vhost_symlink)) unlink($vhost_symlink);
-		
+
 		//* Remove old or changed symlinks
 		if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') {
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		//* New symlink
 		if($data['new']['subdomain'] == '*') {
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
@@ -1572,8 +1572,8 @@
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
 		}
 		if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) {
-			symlink($vhost_file,$vhost_symlink);
-			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			symlink($vhost_file, $vhost_symlink);
+			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 		}
 
 		// remove old symlink and vhost file, if domain name of the site has changed
@@ -1581,78 +1581,78 @@
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
 			$app->system->unlink($vhost_file);
-			$app->log('Removing file: '.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG);
 		}
-		
+
 		// create password file for stats directory
 		if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
 			if(trim($data['new']['stats_password']) != '') {
 				$htp_file = 'admin:'.trim($data['new']['stats_password']);
-				$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats',$htp_file);
-				$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats',0755);
+				$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
+				$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
 				unset($htp_file);
 			}
 		}
-		
+
 		//* Create awstats configuration
 		if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
-			$this->awstats_update($data,$web_config);
+			$this->awstats_update($data, $web_config);
 		}
-		
-		$this->php_fpm_pool_update($data,$web_config,$pool_dir,$pool_name,$socket_dir);
-		
+
+		$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir);
+
 		if($web_config['check_apache_config'] == 'y') {
 			//* Test if nginx starts with the new configuration file
-			$nginx_online_status_before_restart = $this->_checkTcp('localhost',80);
-			$app->log('nginx status is: '.($nginx_online_status_before_restart === true? 'running' : 'down'),LOGLEVEL_DEBUG);
+			$nginx_online_status_before_restart = $this->_checkTcp('localhost', 80);
+			$app->log('nginx status is: '.($nginx_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
 
-			$retval = $app->services->restartService('httpd','restart'); // $retval['retval'] is 0 on success and > 0 on failure
-			$app->log('nginx restart return value is: '.$retval['retval'],LOGLEVEL_DEBUG);
-			
+			$retval = $app->services->restartService('httpd', 'restart'); // $retval['retval'] is 0 on success and > 0 on failure
+			$app->log('nginx restart return value is: '.$retval['retval'], LOGLEVEL_DEBUG);
+
 			// wait a few seconds, before we test the apache status again
 			sleep(2);
-		
+
 			//* Check if nginx restarted successfully if it was online before
-			$nginx_online_status_after_restart = $this->_checkTcp('localhost',80);
-			$app->log('nginx online status after restart is: '.($nginx_online_status_after_restart === true? 'running' : 'down'),LOGLEVEL_DEBUG);
-			if($nginx_online_status_before_restart && !$nginx_online_status_after_restart || $retval['retval'] > 0) { 
-				$app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err',LOGLEVEL_WARN);
+			$nginx_online_status_after_restart = $this->_checkTcp('localhost', 80);
+			$app->log('nginx online status after restart is: '.($nginx_online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
+			if($nginx_online_status_before_restart && !$nginx_online_status_after_restart || $retval['retval'] > 0) {
+				$app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err', LOGLEVEL_WARN);
 				if(is_array($retval['output']) && !empty($retval['output'])){
-					$app->log('Reason for nginx restart failure: '.implode("\n", $retval['output']),LOGLEVEL_WARN);
+					$app->log('Reason for nginx restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN);
 					$app->dbmaster->datalogError(implode("\n", $retval['output']));
 				} else {
 					// if no output is given, check again
 					exec('nginx -t 2>&1', $tmp_output, $tmp_retval);
 					if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)){
-						$app->log('Reason for nginx restart failure: '.implode("\n", $tmp_output),LOGLEVEL_WARN);
+						$app->log('Reason for nginx restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN);
 						$app->dbmaster->datalogError(implode("\n", $tmp_output));
 					}
 					unset($tmp_output, $tmp_retval);
 				}
-				$app->system->copy($vhost_file,$vhost_file.'.err');
-				
+				$app->system->copy($vhost_file, $vhost_file.'.err');
+
 				if(is_file($vhost_file.'~')) {
 					//* Copy back the last backup file
-					$app->system->copy($vhost_file.'~',$vhost_file);
+					$app->system->copy($vhost_file.'~', $vhost_file);
 				} else {
 					//* There is no backup file, so we create a empty vhost file with a warning message inside
-					$app->system->file_put_contents($vhost_file,"# nginx did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
+					$app->system->file_put_contents($vhost_file, "# nginx did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
 				}
-				
+
 				if($this->ssl_certificate_changed === true) {
 
 					$ssl_dir = $data['new']['document_root'].'/ssl';
@@ -1662,41 +1662,41 @@
 					$csr_file = $ssl_dir.'/'.$domain.'.csr';
 					$crt_file = $ssl_dir.'/'.$domain.'.crt';
 					//$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-					
+
 					//* Backup the files that might have caused the error
 					if(is_file($key_file)){
-						$app->system->copy($key_file,$key_file.'.err');
-						$app->system->chmod($key_file.'.err',0400);
+						$app->system->copy($key_file, $key_file.'.err');
+						$app->system->chmod($key_file.'.err', 0400);
 					}
 					if(is_file($key_file2)){
-						$app->system->copy($key_file2,$key_file2.'.err');
-						$app->system->chmod($key_file2.'.err',0400);
+						$app->system->copy($key_file2, $key_file2.'.err');
+						$app->system->chmod($key_file2.'.err', 0400);
 					}
-					if(is_file($csr_file)) $app->system->copy($csr_file,$csr_file.'.err');
-					if(is_file($crt_file)) $app->system->copy($crt_file,$crt_file.'.err');
+					if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err');
+					if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err');
 					//if(is_file($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'.err');
-					
+
 					//* Restore the ~ backup files
-					if(is_file($key_file.'~')) $app->system->copy($key_file.'~',$key_file);
-					if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~',$key_file2);
-					if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~',$crt_file);
-					if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~',$csr_file);
+					if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file);
+					if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2);
+					if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file);
+					if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file);
 					//if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~',$bundle_file);
-					
-					$app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.',LOGLEVEL_WARN);
+
+					$app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN);
 				}
-				
-				$app->services->restartService('httpd','restart');
+
+				$app->services->restartService('httpd', 'restart');
 			}
 		} else {
 			//* We do not check the nginx config after changes (is faster)
-			$app->services->restartServiceDelayed('httpd','reload');
+			$app->services->restartServiceDelayed('httpd', 'reload');
 		}
-		
-		//* The vhost is written and apache has been restarted, so we 
+
+		//* The vhost is written and apache has been restarted, so we
 		// can reset the ssl changed var to false and cleanup some files
 		$this->ssl_certificate_changed = false;
-		
+
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key.org';
@@ -1704,13 +1704,13 @@
 		$csr_file = $ssl_dir.'/'.$domain.'.csr';
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
 		//$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-		
+
 		if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~');
 		if(@is_file($key2_file.'~')) $app->system->unlink($key2_file.'~');
 		if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~');
 		if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~');
 		//if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~');
-		
+
 		// Remove the backup copy of the config file.
 		if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~');
 
@@ -1719,15 +1719,15 @@
 
 	}
 
-	function delete($event_name,$data) {
+	function delete($event_name, $data) {
 		global $app, $conf;
 
 		// load the server configuration options
 		$app->uses('getconf');
 		$app->uses('system');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
-		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'],false);
+
+		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'], false);
 
 		//* Check if this is a chrooted setup
 		if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
@@ -1735,12 +1735,12 @@
 		} else {
 			$nginx_chrooted = false;
 		}
-		
+
 		//* Remove the mounts
 		$log_folder = 'log';
-        $web_folder = '';
-        if($data['old']['type'] == 'vhostsubdomain') {
-            $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
+		$web_folder = '';
+		if($data['old']['type'] == 'vhostsubdomain') {
+			$tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
 			if($tmp['domain'] != ''){
 				$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
 			} else {
@@ -1762,7 +1762,7 @@
 				*/
 				// we are deleting the parent domain, so we can delete everything in the log directory
 				$subdomain_hosts = array();
-				$files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.','..'));
+				$files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..'));
 				if(is_array($files) && !empty($files)){
 					foreach($files as $file){
 						if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){
@@ -1781,10 +1781,10 @@
 				$log_folder .= '/' . $subdomain_host;
 			}
 			$web_folder = $data['old']['web_folder'];
-            unset($tmp);
+			unset($tmp);
 			unset($subdomain_hosts);
 		}
-        
+
 		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain'){
 			if(is_array($log_folders) && !empty($log_folders)){
 				foreach($log_folders as $log_folder){
@@ -1796,16 +1796,16 @@
 				exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
 			}
 		}
-		
+
 		//* remove mountpoint from fstab
 		if(is_array($log_folders) && !empty($log_folders)){
 			foreach($log_folders as $log_folder){
 				$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-				$app->system->removeLine('/etc/fstab',$fstab_line);
+				$app->system->removeLine('/etc/fstab', $fstab_line);
 			}
 		} else {
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
+			$app->system->removeLine('/etc/fstab', $fstab_line);
 		}
 		unset($log_folders);
 
@@ -1817,241 +1817,241 @@
 			$data['old'] = $tmp;
 			$this->action = 'update';
 			// just run the update function
-			$this->update($event_name,$data);
+			$this->update($event_name, $data);
 
 		} else {
 			//* This is a website
-			// Deleting the vhost file, symlink and the data directory			
+			// Deleting the vhost file, symlink and the data directory
 			$vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
-			
+
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
-			
+
 			$app->system->unlink($vhost_file);
-			$app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
-            
-            if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
-                $docroot = escapeshellcmd($data['old']['document_root']);
-                if($docroot != '' && !stristr($docroot,'..')) {
-                    if($data['old']['type'] == 'vhost') {
-                        // this is a vhost - we delete everything in here.
-                        exec('rm -rf '.$docroot);
-                    } elseif(!stristr($data['old']['web_folder'], '..')) {
-                        // this is a vhost subdomain
-                        // IMPORTANT: do some folder checks before we delete this!
-                        $do_delete = true;
-                        $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
-                        if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
-                        if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
-                        
-                        $path_elements = explode('/', $delete_folder);
-                        
-                        if($path_elements[0] == 'web' || $path_elements[0] === '') {
-                            // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
-                            // we use strict check as otherwise directories named '0' may not be deleted
-                            $do_delete = false;
-                        } else {
-                            // read all vhost subdomains with same parent domain
-                            $used_paths = array();
-                            $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
-                            foreach($tmp as $tmprec) {
-                                // we normalize the folder entries because we need to compare them
-                                $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
-                                if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
-                                if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
-                                
-                                // add this path and it's parent paths to used_paths array
-                                while(strpos($tmp_folder, '/') !== false) {
-                                    if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
-                                    $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
-                                }
-                                if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
-                            }
-                            unset($tmp);
-                            
-                            // loop and check if the path is still used and stop at first used one
-                            // set do_delete to false so nothing gets deleted if the web_folder itself is still used
-                            $do_delete = false;
-                            while(count($path_elements) > 0) {
-                                $tmp_folder = implode('/', $path_elements);
-                                if(in_array($tmp_folder, $used_paths) == true) break;
-                                
-                                // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
-                                $delete_folder = $tmp_folder;
-                                $do_delete = true;
-                                array_pop($path_elements);
-                            }
-                            unset($tmp_folder);
-                            unset($used_paths);
-                        }
-                        
-                        if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
-                        
-                        unset($delete_folder);
-                        unset($path_elements);
-                    }
-                }
-			
-                //remove the php fastgi starter script if available
-                if ($data['old']['php'] == 'fast-cgi') {
-					$this->php_fpm_pool_delete($data,$web_config);
-                    $fastcgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$web_config['fastcgi_starter_path']);
-                    if($data['old']['type'] == 'vhost') {
-                        if (is_dir($fastcgi_starter_path)) {
-                            exec('rm -rf '.$fastcgi_starter_path);
-                        }
-                    } else {
-                        $fcgi_starter_script = $fastcgi_starter_path.$web_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
-                        if (file_exists($fcgi_starter_script)) {
-                            exec('rm -f '.$fcgi_starter_script);
-                        }
-                    }
-                }
-                
-                // remove PHP-FPM pool
-                if ($data['old']['php'] == 'php-fpm') {
-                    $this->php_fpm_pool_delete($data,$web_config);
-                }
+			$app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
 
-                //remove the php cgi starter script if available
-                if ($data['old']['php'] == 'cgi') {
-                    // TODO: fetch the date from the server-settings
-                    $web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+			if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
+				$docroot = escapeshellcmd($data['old']['document_root']);
+				if($docroot != '' && !stristr($docroot, '..')) {
+					if($data['old']['type'] == 'vhost') {
+						// this is a vhost - we delete everything in here.
+						exec('rm -rf '.$docroot);
+					} elseif(!stristr($data['old']['web_folder'], '..')) {
+						// this is a vhost subdomain
+						// IMPORTANT: do some folder checks before we delete this!
+						$do_delete = true;
+						$delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
+						if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
+						if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
 
-                    $cgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$web_config['cgi_starter_path']);
-                    if($data['old']['type'] == 'vhost') {
-                        if (is_dir($cgi_starter_path)) {
-                            exec('rm -rf '.$cgi_starter_path);
-                        }
-                    } else {
-                        $cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
-                        if (file_exists($cgi_starter_script)) {
-                            exec('rm -f '.$cgi_starter_script);
-                        }
-                    }
-                }
-            
-                $app->log('Removing website: '.$docroot,LOGLEVEL_DEBUG);
+						$path_elements = explode('/', $delete_folder);
 
-                // Delete the symlinks for the sites
-                $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
-                $client_id = intval($client['client_id']);
-                unset($client);
-                $tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
-                if(is_array($tmp_symlinks_array)) {
-                    foreach($tmp_symlinks_array as $tmp_symlink) {
-                        $tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-                        $tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
-                        // Remove trailing slash
-                        if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
-                        // create the symlinks, if not exist
-                        if(is_link($tmp_symlink)) {
-                            $app->system->unlink($tmp_symlink);
-                            $app->log('Removing symlink: '.$tmp_symlink,LOGLEVEL_DEBUG);
-                        }
-                    }
-                }
-                // end removing symlinks
-            } else {
-                // vhost subdomain
-            }
+						if($path_elements[0] == 'web' || $path_elements[0] === '') {
+							// paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
+							// we use strict check as otherwise directories named '0' may not be deleted
+							$do_delete = false;
+						} else {
+							// read all vhost subdomains with same parent domain
+							$used_paths = array();
+							$tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
+							foreach($tmp as $tmprec) {
+								// we normalize the folder entries because we need to compare them
+								$tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
+								if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
+								if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
 
-            // Delete the log file directory
-            $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
-            if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir,'..')) exec('rm -rf '.$vhost_logfile_dir);
-            $app->log('Removing website logfile directory: '.$vhost_logfile_dir,LOGLEVEL_DEBUG);
+								// add this path and it's parent paths to used_paths array
+								while(strpos($tmp_folder, '/') !== false) {
+									if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+									$tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
+								}
+								if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+							}
+							unset($tmp);
 
-            if($data['old']['type'] == 'vhost') {
-                //delete the web user
-                $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
-                $command .= ' '.escapeshellcmd($data['old']['system_user']);
-                exec($command);
-                if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
-                
-            }
-            
-            //* Remove the awstats configuration file
-            if($data['old']['stats_type'] == 'awstats') {
-                $this->awstats_delete($data,$web_config);
+							// loop and check if the path is still used and stop at first used one
+							// set do_delete to false so nothing gets deleted if the web_folder itself is still used
+							$do_delete = false;
+							while(count($path_elements) > 0) {
+								$tmp_folder = implode('/', $path_elements);
+								if(in_array($tmp_folder, $used_paths) == true) break;
+
+								// this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
+								$delete_folder = $tmp_folder;
+								$do_delete = true;
+								array_pop($path_elements);
+							}
+							unset($tmp_folder);
+							unset($used_paths);
+						}
+
+						if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
+
+						unset($delete_folder);
+						unset($path_elements);
+					}
+				}
+
+				//remove the php fastgi starter script if available
+				if ($data['old']['php'] == 'fast-cgi') {
+					$this->php_fpm_pool_delete($data, $web_config);
+					$fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['fastcgi_starter_path']);
+					if($data['old']['type'] == 'vhost') {
+						if (is_dir($fastcgi_starter_path)) {
+							exec('rm -rf '.$fastcgi_starter_path);
+						}
+					} else {
+						$fcgi_starter_script = $fastcgi_starter_path.$web_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
+						if (file_exists($fcgi_starter_script)) {
+							exec('rm -f '.$fcgi_starter_script);
+						}
+					}
+				}
+
+				// remove PHP-FPM pool
+				if ($data['old']['php'] == 'php-fpm') {
+					$this->php_fpm_pool_delete($data, $web_config);
+				}
+
+				//remove the php cgi starter script if available
+				if ($data['old']['php'] == 'cgi') {
+					// TODO: fetch the date from the server-settings
+					$web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+
+					$cgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['cgi_starter_path']);
+					if($data['old']['type'] == 'vhost') {
+						if (is_dir($cgi_starter_path)) {
+							exec('rm -rf '.$cgi_starter_path);
+						}
+					} else {
+						$cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
+						if (file_exists($cgi_starter_script)) {
+							exec('rm -f '.$cgi_starter_script);
+						}
+					}
+				}
+
+				$app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG);
+
+				// Delete the symlinks for the sites
+				$client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
+				$client_id = intval($client['client_id']);
+				unset($client);
+				$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+				if(is_array($tmp_symlinks_array)) {
+					foreach($tmp_symlinks_array as $tmp_symlink) {
+						$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+						$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+						// Remove trailing slash
+						if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+						// create the symlinks, if not exist
+						if(is_link($tmp_symlink)) {
+							$app->system->unlink($tmp_symlink);
+							$app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG);
+						}
+					}
+				}
+				// end removing symlinks
+			} else {
+				// vhost subdomain
 			}
-			
-			$app->services->restartServiceDelayed('httpd','reload');
+
+			// Delete the log file directory
+			$vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
+			if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir);
+			$app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG);
+
+			if($data['old']['type'] == 'vhost') {
+				//delete the web user
+				$command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
+				$command .= ' '.escapeshellcmd($data['old']['system_user']);
+				exec($command);
+				if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+			}
+
+			//* Remove the awstats configuration file
+			if($data['old']['stats_type'] == 'awstats') {
+				$this->awstats_delete($data, $web_config);
+			}
+
+			$app->services->restartServiceDelayed('httpd', 'reload');
 
 		}
-		
-		
-		if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'],true);
+
+
+		if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true);
 	}
 
 	//* This function is called when a IP on the server is inserted, updated or deleted
-	function server_ip($event_name,$data) {
+	function server_ip($event_name, $data) {
 		return;
 	}
-	
+
 	//* Create or update the .htaccess folder protection
-	function web_folder_user($event_name,$data) {
+	function web_folder_user($event_name, $data) {
 		global $app, $conf;
 
 		$app->uses('system');
-		
+
 		if($event_name == 'web_folder_user_delete') {
 			$folder_id = $data['old']['web_folder_id'];
 		} else {
 			$folder_id = $data['new']['web_folder_id'];
 		}
-		
+
 		$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".intval($folder_id));
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
-		
+
 		if(!is_array($folder) or !is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($folder['path'],0,1) == '/') $folder['path'] = substr($folder['path'],1);
-		if(substr($folder['path'],-1) == '/') $folder['path'] = substr($folder['path'],0,-1);
+		if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+		if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
 		$folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
-		if(substr($folder_path,-1) != '/') $folder_path .= '/';
-		
+		if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(stristr($folder_path,'..') || stristr($folder_path,'./') || stristr($folder_path,'\\')) {
-			$app->log('Folder path "'.$folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) {
+			$app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Create the folder path, if it does not exist
 		if(!is_dir($folder_path)) {
 			$app->system->mkdirpath($folder_path);
-			$app->system->chown($folder_path,$website['system_user']);
-			$app->system->chgrp($folder_path,$website['system_group']);
+			$app->system->chown($folder_path, $website['system_user']);
+			$app->system->chgrp($folder_path, $website['system_group']);
 		}
-		
+
 		//* Create empty .htpasswd file, if it does not exist
 		if(!is_file($folder_path.'.htpasswd')) {
 			touch($folder_path.'.htpasswd');
-			$app->system->chmod($folder_path.'.htpasswd',0755);
-			$app->system->chown($folder_path.'.htpasswd',$website['system_user']);
-			$app->system->chgrp($folder_path.'.htpasswd',$website['system_group']);
-			$app->log('Created file '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+			$app->system->chmod($folder_path.'.htpasswd', 0755);
+			$app->system->chown($folder_path.'.htpasswd', $website['system_user']);
+			$app->system->chgrp($folder_path.'.htpasswd', $website['system_group']);
+			$app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 		}
-		
+
 		/*
 		$auth_users = $app->db->queryAllRecords("SELECT * FROM web_folder_user WHERE active = 'y' AND web_folder_id = ".intval($folder_id));
 		$htpasswd_content = '';
@@ -2064,132 +2064,132 @@
 		@file_put_contents($folder_path.'.htpasswd', $htpasswd_content);
 		$app->log('Changed .htpasswd file: '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
 		*/
-		
+
 		if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') {
-			$app->system->removeLine($folder_path.'.htpasswd',$data['old']['username'].':');
-			$app->log('Removed user: '.$data['old']['username'],LOGLEVEL_DEBUG);
+			$app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+			$app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Add or remove the user from .htpasswd file
 		if($event_name == 'web_folder_user_delete') {
-			$app->system->removeLine($folder_path.'.htpasswd',$data['old']['username'].':');
-			$app->log('Removed user: '.$data['old']['username'],LOGLEVEL_DEBUG);
+			$app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+			$app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
 		} else {
 			if($data['new']['active'] == 'y') {
-				$app->system->replaceLine($folder_path.'.htpasswd',$data['new']['username'].':',$data['new']['username'].':'.$data['new']['password'],0,1);
-				$app->log('Added or updated user: '.$data['new']['username'],LOGLEVEL_DEBUG);
+				$app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1);
+				$app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		// write basic auth configuration to vhost file because nginx does not support .htaccess
 		$webdata['new'] = $webdata['old'] = $website;
 		$this->update('web_domain_update', $webdata);
 	}
-	
+
 	//* Remove .htpasswd file, when folder protection is removed
-	function web_folder_delete($event_name,$data) {
+	function web_folder_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$folder_id = $data['old']['web_folder_id'];
-		
+
 		$folder = $data['old'];
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
-		
+
 		if(!is_array($folder) or !is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($folder['path'],0,1) == '/') $folder['path'] = substr($folder['path'],1);
-		if(substr($folder['path'],-1) == '/') $folder['path'] = substr($folder['path'],0,-1);
+		if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+		if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
 		$folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
-		if(substr($folder_path,-1) != '/') $folder_path .= '/';
-		
+		if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(substr($folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('Folder path is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Remove .htpasswd file
 		if(is_file($folder_path.'.htpasswd')) {
 			$app->system->unlink($folder_path.'.htpasswd');
-			$app->log('Removed file '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+			$app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 		}
-		
+
 		// write basic auth configuration to vhost file because nginx does not support .htaccess
 		$webdata['new'] = $webdata['old'] = $website;
 		$this->update('web_domain_update', $webdata);
 	}
-	
+
 	//* Update folder protection, when path has been changed
-	function web_folder_update($event_name,$data) {
+	function web_folder_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-	
+
 		if(!is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($data['old']['path'],0,1) == '/') $data['old']['path'] = substr($data['old']['path'],1);
-		if(substr($data['old']['path'],-1) == '/') $data['old']['path'] = substr($data['old']['path'],0,-1);
+		if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1);
+		if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1);
 		$old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']);
-		if(substr($old_folder_path,-1) != '/') $old_folder_path .= '/';
-			
-		if(substr($data['new']['path'],0,1) == '/') $data['new']['path'] = substr($data['new']['path'],1);
-		if(substr($data['new']['path'],-1) == '/') $data['new']['path'] = substr($data['new']['path'],0,-1);
+		if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/';
+
+		if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1);
+		if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1);
 		$new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']);
-		if(substr($new_folder_path,-1) != '/') $new_folder_path .= '/';
-		
+		if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(stristr($new_folder_path,'..') || stristr($new_folder_path,'./') || stristr($new_folder_path,'\\')) {
-			$app->log('Folder path "'.$new_folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) {
+			$app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		if(stristr($old_folder_path,'..') || stristr($old_folder_path,'./') || stristr($old_folder_path,'\\')) {
-			$app->log('Folder path "'.$old_folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) {
+			$app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Check if the resulting path is inside the docroot
-		if(substr($old_folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('Old folder path '.$old_folder_path.' is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		if(substr($new_folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('New folder path '.$new_folder_path.' is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-			
+
 		//* Create the folder path, if it does not exist
 		if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path);
-		
+
 		if($data['old']['path'] != $data['new']['path']) {
 
-		
+
 			//* move .htpasswd file
 			if(is_file($old_folder_path.'.htpasswd')) {
-				$app->system->rename($old_folder_path.'.htpasswd',$new_folder_path.'.htpasswd');
-				$app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+				$app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd');
+				$app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 			}
-		
+
 		}
 
 		// write basic auth configuration to vhost file because nginx does not support .htaccess
 		$webdata['new'] = $webdata['old'] = $website;
 		$this->update('web_domain_update', $webdata);
 	}
-	
+
 	function _create_web_folder_auth_configuration($website){
 		global $app, $conf;
 		//* Create the domain.auth file which is included in the vhost configuration file
@@ -2203,13 +2203,13 @@
 		$basic_auth_locations = array();
 		if(is_array($website_auth_locations) && !empty($website_auth_locations)){
 			foreach($website_auth_locations as $website_auth_location){
-				if(substr($website_auth_location['path'],0,1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'],1);
-				if(substr($website_auth_location['path'],-1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'],0,-1);
+				if(substr($website_auth_location['path'], 0, 1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 1);
+				if(substr($website_auth_location['path'], -1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 0, -1);
 				if($website_auth_location['path'] != ''){
 					$website_auth_location['path'] .= '/';
 				}
 				$basic_auth_locations[] = array('htpasswd_location' => '/'.$website_auth_location['path'],
-												'htpasswd_path' => $website['document_root'].'/' . ($website['type'] == 'vhostsubdomain' ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']);
+					'htpasswd_path' => $website['document_root'].'/' . ($website['type'] == 'vhostsubdomain' ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']);
 			}
 		}
 		return $basic_auth_locations;
@@ -2219,53 +2219,53 @@
 		//unset($tpl);
 		//$app->services->restartServiceDelayed('httpd','reload');
 	}
-	
+
 	//* Update the awstats configuration file
-	private function awstats_update ($data,$web_config) {
+	private function awstats_update ($data, $web_config) {
 		global $app;
-		
-        $web_folder = $data['new']['web_folder'];
-        if($data['new']['type'] == 'vhost') $web_folder = 'web';
+
+		$web_folder = $data['new']['web_folder'];
+		if($data['new']['type'] == 'vhost') $web_folder = 'web';
 		$awstats_conf_dir = $web_config['awstats_conf_dir'];
-		
+
 		if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats");
 		if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
 			if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
 				$app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
 			}
-			
+
 			$content = '';
 			$content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
 			$content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n";
 			$content .= "SiteDomain=\"".$data['new']['domain']."\"\n";
 			$content .= "HostAliases=\"www.".$data['new']['domain']."  localhost 127.0.0.1\"\n";
-			
-			$app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',$content);
-			$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);
+
+			$app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content);
+			$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG);
 		}
-		
+
 		if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
 		if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
-			$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+			$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
 		} else {
-			$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+			$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
 		}
 	}
-	
+
 	//* Delete the awstats configuration file
-	private function awstats_delete ($data,$web_config) {
+	private function awstats_delete ($data, $web_config) {
 		global $app;
-		
+
 		$awstats_conf_dir = $web_config['awstats_conf_dir'];
-		
+
 		if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
 			$app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
-			$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf',LOGLEVEL_DEBUG);
+			$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG);
 		}
 	}
-	
+
 	//* Update the PHP-FPM pool configuration file
-	private function php_fpm_pool_update ($data,$web_config,$pool_dir,$pool_name,$socket_dir) {
+	private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir) {
 		global $app, $conf;
 		/*
 		if(trim($data['new']['fastcgi_php_version']) != ''){
@@ -2280,7 +2280,7 @@
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
@@ -2288,15 +2288,15 @@
 			if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
 		}
-		
+
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		if($data['new']['php'] == 'no'){
 			if(@is_file($pool_dir.$pool_name.'.conf')){
 				$app->system->unlink($pool_dir.$pool_name.'.conf');
@@ -2304,14 +2304,14 @@
 			}
 			if($data['old']['php'] != 'no'){
 				if(!$default_php_fpm){
-					$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+					$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 				} else {
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+					$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 				}
 			}
 			return;
 		}
-				
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate('php_fpm_pool.conf.master');
@@ -2326,10 +2326,10 @@
 		}
 		$tpl->setVar('use_tcp', $use_tcp);
 		$tpl->setVar('use_socket', $use_socket);
-			
+
 		$fpm_socket = $socket_dir.$pool_name.'.sock';
 		$tpl->setVar('fpm_socket', $fpm_socket);
-			
+
 		$tpl->setVar('fpm_pool', $pool_name);
 		$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
 		$tpl->setVar('fpm_user', $data['new']['system_user']);
@@ -2342,7 +2342,7 @@
 		$tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']);
 		$tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']);
 		$tpl->setVar('document_root', $data['new']['document_root']);
-		$tpl->setVar('security_level',$web_config['security_level']);
+		$tpl->setVar('security_level', $web_config['security_level']);
 		$php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);
 		$tpl->setVar('php_open_basedir', $php_open_basedir);
 		if($php_open_basedir != ''){
@@ -2350,7 +2350,7 @@
 		} else {
 			$tpl->setVar('enable_php_open_basedir', ';');
 		}
-			
+
 		// Custom php.ini settings
 		$final_php_ini_settings = array();
 		$custom_php_ini_settings = trim($data['new']['custom_php_ini']);
@@ -2362,59 +2362,59 @@
 			if(is_array($ini_settings) && !empty($ini_settings)){
 				foreach($ini_settings as $ini_setting){
 					$ini_setting = trim($ini_setting);
-					if(substr($ini_setting,0,1) == ';') continue;
-					if(substr($ini_setting,0,1) == '#') continue;
-					if(substr($ini_setting,0,2) == '//') continue;
+					if(substr($ini_setting, 0, 1) == ';') continue;
+					if(substr($ini_setting, 0, 1) == '#') continue;
+					if(substr($ini_setting, 0, 2) == '//') continue;
 					list($key, $value) = explode('=', $ini_setting);
 					if($value){
 						$value = trim($value);
 						$key = trim($key);
 						switch (strtolower($value)) {
-							case '0':
-								// PHP-FPM might complain about invalid boolean value if you use 0
-								$value = 'off';
-							case '1':
-							case 'on':
-							case 'off':
-							case 'true':
-							case 'false':
-							case 'yes':
-							case 'no':
-								$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
-								break;
-							default:
-								$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
+						case '0':
+							// PHP-FPM might complain about invalid boolean value if you use 0
+							$value = 'off';
+						case '1':
+						case 'on':
+						case 'off':
+						case 'true':
+						case 'false':
+						case 'yes':
+						case 'no':
+							$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
+							break;
+						default:
+							$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
 						}
 					}
 				}
 			}
 		}
-			
+
 		$tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
-			
-		$app->system->file_put_contents($pool_dir.$pool_name.'.conf',$tpl->grab());
-		$app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
+
+		$app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab());
+		$app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
 		unset($tpl);
-		
+
 		// delete pool in all other PHP versions
 		$default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
-		if(substr($default_pool_dir,-1) != '/') $default_pool_dir .= '/';
+		if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
 		if($default_pool_dir != $pool_dir){
 			if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
-					$app->system->unlink($default_pool_dir.$pool_name.'.conf');
-					$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+				$app->system->unlink($default_pool_dir.$pool_name.'.conf');
+				$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+				$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 			}
 		}
 		$php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$conf["server_id"]);
 		if(is_array($php_versions) && !empty($php_versions)){
 			foreach($php_versions as $php_version){
-				if(substr($php_version['php_fpm_pool_dir'],-1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+				if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
 				if($php_version['php_fpm_pool_dir'] != $pool_dir){
 					if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
 						$app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
-						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf',LOGLEVEL_DEBUG);
-						$app->services->restartService('php-fpm','reload:'.$php_version['php_fpm_init_script']);
+						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+						$app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
 					}
 				}
 			}
@@ -2422,71 +2422,71 @@
 		// Reload current PHP-FPM after all others
 		sleep(1);
 		if(!$default_php_fpm){
-			$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+			$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 		} else {
-			$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+			$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 		}
 	}
-	
+
 	//* Delete the PHP-FPM pool configuration file
-	private function php_fpm_pool_delete ($data,$web_config) {
+	private function php_fpm_pool_delete ($data, $web_config) {
 		global $app, $conf;
-		
+
 		if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
 			$default_php_fpm = false;
 			list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-			if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+			if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 		} else {
 			$default_php_fpm = true;
 		}
-		
+
 		if($default_php_fpm){
 			$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
 		} else {
 			$pool_dir = $custom_php_fpm_pool_dir;
 		}
-		
-		if(substr($pool_dir,-1) != '/') $pool_dir .= '/';
+
+		if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
 		$pool_name = 'web'.$data['old']['domain_id'];
-		
+
 		if ( @is_file($pool_dir.$pool_name.'.conf') ) {
 			$app->system->unlink($pool_dir.$pool_name.'.conf');
-			$app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
+			$app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
 		}
-		
+
 		// delete pool in all other PHP versions
 		$default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
-		if(substr($default_pool_dir,-1) != '/') $default_pool_dir .= '/';
+		if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
 		if($default_pool_dir != $pool_dir){
 			if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
-					$app->system->unlink($default_pool_dir.$pool_name.'.conf');
-					$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+				$app->system->unlink($default_pool_dir.$pool_name.'.conf');
+				$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+				$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 			}
-		}	
+		}
 		$php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$data['old']['server_id']);
 		if(is_array($php_versions) && !empty($php_versions)){
 			foreach($php_versions as $php_version){
-				if(substr($php_version['php_fpm_pool_dir'],-1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+				if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
 				if($php_version['php_fpm_pool_dir'] != $pool_dir){
 					if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
 						$app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
-						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf',LOGLEVEL_DEBUG);
-						$app->services->restartService('php-fpm','reload:'.$php_version['php_fpm_init_script']);
+						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+						$app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
 					}
 				}
 			}
 		}
-		
+
 		// Reload current PHP-FPM after all others
 		sleep(1);
 		if(!$default_php_fpm){
-			$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+			$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 		} else {
-			$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+			$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 		}
 	}
-	
+
 	private function nginx_replace($matches){
 		$location = 'location'.($matches[1] != '' ? ' '.$matches[1] : '').' '.$matches[2].' '.$matches[3];
 		if($matches[4] == '##merge##' || $matches[7] == '##merge##') $location .= ' ##merge##';
@@ -2496,21 +2496,21 @@
 		$location .= $matches[6];
 		return $location;
 	}
-	
+
 	private function nginx_merge_locations($vhost_conf){
 
 		$lines = explode("\n", $vhost_conf);
-		
+
 		// if whole location block is in one line, split it up into multiple lines
 		if(is_array($lines) && !empty($lines)){
 			$linecount = sizeof($lines);
 			for($h=0;$h<$linecount;$h++){
 				// remove comments
-				if(substr(trim($lines[$h]),0,1) == '#'){
+				if(substr(trim($lines[$h]), 0, 1) == '#'){
 					unset($lines[$h]);
 					continue;
 				}
-				
+
 				$lines[$h] = rtrim($lines[$h]);
 				/*
 				if(substr(ltrim($lines[$h]), 0, 8) == 'location' && strpos($lines[$h], '{') !== false && strpos($lines[$h], ';') !== false){
@@ -2530,16 +2530,16 @@
 				}
 				*/
 				$pattern = '/^[^\S\n]*location[^\S\n]+(?:(.+)[^\S\n]+)?(.+)[^\S\n]*(\{)[^\S\n]*(##merge##|##delete##)?[^\S\n]*(.+)[^\S\n]*(\})[^\S\n]*(##merge##|##delete##)?[^\S\n]*$/';
-				$lines[$h] = preg_replace_callback($pattern, array($this, 'nginx_replace') ,$lines[$h]);
+				$lines[$h] = preg_replace_callback($pattern, array($this, 'nginx_replace') , $lines[$h]);
 			}
 		}
 		$vhost_conf = implode("\n", $lines);
 		unset($lines);
 		unset($linecount);
-		
+
 		$lines = explode("\n", $vhost_conf);
-			
-		if(is_array($lines) && !empty($lines)){	
+
+		if(is_array($lines) && !empty($lines)){
 			$locations = array();
 			$locations_to_delete = array();
 			$islocation = false;
@@ -2551,13 +2551,13 @@
 				if(substr($l, 0, 8) == 'server {') $server_count += 1;
 				if($server_count > 1) break;
 				if(substr($l, 0, 8) == 'location' && !$islocation){
-				
+
 					$islocation = true;
 					$level = 0;
-					
+
 					// Remove unnecessary whitespace
 					$l = preg_replace('/\s\s+/', ' ', $l);
-					
+
 					$loc_parts = explode(' ', $l);
 					// see http://wiki.nginx.org/HttpCoreModule#location
 					if($loc_parts[1] == '=' || $loc_parts[1] == '~' || $loc_parts[1] == '~*' || $loc_parts[1] == '^~'){
@@ -2566,11 +2566,11 @@
 						$location = $loc_parts[1];
 					}
 					unset($loc_parts);
-					
+
 					if(!isset($locations[$location]['action'])) $locations[$location]['action'] = 'replace';
 					if(substr($l, -9) == '##merge##') $locations[$location]['action'] = 'merge';
 					if(substr($l, -10) == '##delete##') $locations[$location]['action'] = 'delete';
-					
+
 					if(!isset($locations[$location]['open_tag'])) $locations[$location]['open_tag'] = '        location '.$location.' {';
 					if(!isset($locations[$location]['location']) || $locations[$location]['action'] == 'replace') $locations[$location]['location'] = '';
 					if($locations[$location]['action'] == 'delete') $locations_to_delete[] = $location;
@@ -2578,9 +2578,9 @@
 					if(!isset($locations[$location]['start_line'])) $locations[$location]['start_line'] = $i;
 
 					unset($lines[$i]);
-					
+
 				} else {
-				
+
 					if($islocation){
 						if(strpos($l, '{') !== false){
 							$level += 1;
@@ -2595,17 +2595,17 @@
 						}
 						unset($lines[$i]);
 					}
-					
+
 				}
 			}
-			
+
 			if(is_array($locations) && !empty($locations)){
 				if(is_array($locations_to_delete) && !empty($locations_to_delete)){
 					foreach($locations_to_delete as $location_to_delete){
 						if(isset($locations[$location_to_delete])) unset($locations[$location_to_delete]);
 					}
 				}
-			
+
 				foreach($locations as $key => $val){
 					$new_location = $val['open_tag']."\n".$val['location'].$val['end_tag'];
 					$lines[$val['start_line']] = $new_location;
@@ -2614,54 +2614,54 @@
 			ksort($lines);
 			$vhost_conf = implode("\n", $lines);
 		}
-		
+
 		return trim($vhost_conf);
 	}
-	
-	function client_delete($event_name,$data) {
+
+	function client_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		$client_id = intval($data['old']['client_id']);
 		if($client_id > 0) {
-			
+
 			$client_dir = $web_config['website_basedir'].'/clients/client'.$client_id;
-			if(is_dir($client_dir) && !stristr($client_dir,'..')) {
+			if(is_dir($client_dir) && !stristr($client_dir, '..')) {
 				// remove symlinks from $client_dir
-				$files = array_diff(scandir($client_dir), array('.','..'));
+				$files = array_diff(scandir($client_dir), array('.', '..'));
 				if(is_array($files) && !empty($files)){
 					foreach($files as $file){
 						if(is_link($client_dir.'/'.$file)){
 							unlink($client_dir.'/'.$file);
-							$app->log('Removed symlink: '.$client_dir.'/'.$file,LOGLEVEL_DEBUG);
+							$app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG);
 						}
 					}
 				}
-				
+
 				@rmdir($client_dir);
-				$app->log('Removed client directory: '.$client_dir,LOGLEVEL_DEBUG);
+				$app->log('Removed client directory: '.$client_dir, LOGLEVEL_DEBUG);
 			}
-			
+
 			if($app->system->is_group('client'.$client_id)){
 				$this->_exec('groupdel client'.$client_id);
-				$app->log('Removed group client'.$client_id,LOGLEVEL_DEBUG);
+				$app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 	}
 
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
-	
-	private function _checkTcp ($host,$port) {
 
-		$fp = @fsockopen ($host, $port, $errno, $errstr, 2);
+	private function _checkTcp ($host, $port) {
+
+		$fp = @fsockopen($host, $port, $errno, $errstr, 2);
 
 		if ($fp) {
 			fclose($fp);
@@ -2670,7 +2670,7 @@
 			return false;
 		}
 	}
-	
+
 	public function create_relative_link($f, $t) {
 		global $app;
 		// $from already exists
@@ -2697,11 +2697,11 @@
 
 		return symlink($cfrom, $to);
 	}
-    
-    private function _rewrite_quote($string) {
-        return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
-    }
-	
+
+	private function _rewrite_quote($string) {
+		return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
+	}
+
 	private function url_is_local($hostname, $domain_id){
 		global $app;
 
@@ -2710,12 +2710,12 @@
 		if(is_array($webs) && !empty($webs)){
 			foreach($webs as $web){
 				// web domain doesn't match hostname
-				if(substr($hostname,-strlen($web['domain'])) != $web['domain']) continue;
+				if(substr($hostname, -strlen($web['domain'])) != $web['domain']) continue;
 				// own vhost and therefore server {} container of its own
 				//if($web['type'] == 'vhostsubdomain') continue;
 				// alias domains/subdomains using rewrites and therefore a server {} container of their own
 				//if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') continue;
-				
+
 				if($web['subdomain'] == '*'){
 					$pattern = '/\.?'.str_replace('.', '\.', $web['domain']).'$/i';
 				}
@@ -2760,16 +2760,16 @@
 				}
 			}
 		}
-		
+
 		return false;
 	}
-	
+
 	private function get_seo_redirects($web, $prefix = '', $force_subdomain = false){
 		// $force_subdomain = 'none|www'
 		$seo_redirects = array();
-		
+
 		if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*';
-		
+
 		if(($web['subdomain'] == 'www' || $web['subdomain'] == '*') && $force_subdomain != 'www'){
 			if($web['seo_redirect'] == 'non_www_to_www'){
 				$seo_redirects[$prefix.'seo_redirect_origin_domain'] = $web['domain'];
diff --git a/server/plugins-available/nginx_reverseproxy_plugin.inc.php b/server/plugins-available/nginx_reverseproxy_plugin.inc.php
index ae4ffe9..a17c5ba 100644
--- a/server/plugins-available/nginx_reverseproxy_plugin.inc.php
+++ b/server/plugins-available/nginx_reverseproxy_plugin.inc.php
@@ -32,33 +32,33 @@
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'ssl');
 
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
-		
-	//	$app->plugins->registerEvent('proxy_reverse_insert',$this->plugin_name,'rewrite_insert');
-	//	$app->plugins->registerEvent('proxy_reverse_update',$this->plugin_name,'rewrite_update');
-	//	$app->plugins->registerEvent('proxy_reverse_delete',$this->plugin_name,'rewrite_delete');
-	
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
+
+		// $app->plugins->registerEvent('proxy_reverse_insert',$this->plugin_name,'rewrite_insert');
+		// $app->plugins->registerEvent('proxy_reverse_update',$this->plugin_name,'rewrite_update');
+		// $app->plugins->registerEvent('proxy_reverse_delete',$this->plugin_name,'rewrite_delete');
+
 
 
 	}
-	
-	
-	function insert($event_name,$data) {
+
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-	
+
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
 
 		if($this->action != 'insert') $this->action = 'update';
@@ -74,7 +74,7 @@
 				$data['new'] = $tmp;
 				$data['old'] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
 
 			// This is not a vhost, so we need to update the parent record instead.
@@ -83,10 +83,10 @@
 			$data['old'] = $tmp;
 			$this->action = 'update';
 		}
-		
-		
-		
-		
+
+
+
+
 		// load the server configuration options
 		$app->uses('getconf');
 		$nginx_config = $app->getconf->get_server_config($conf['server_id'], 'web');
@@ -102,7 +102,7 @@
 
 		$vhost_data = $data['new'];
 		$vhost_data['config_dir'] = $config['nginx']['config_dir'];
-	
+
 		$vhost_data['ssl_domain'] = $data['new']['ssl_domain'];
 		// Check if a SSL cert exists
 		$ssl_dir = $config['nginx']['config_dir'].'/ssl';
@@ -111,15 +111,15 @@
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
 		$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
 
-        $vhost_data['nginx_directives'] = preg_replace("/\[IP\]/", $vhost_data['ip_address'], $vhost_data['nginx_directives']);
+		$vhost_data['nginx_directives'] = preg_replace("/\[IP\]/", $vhost_data['ip_address'], $vhost_data['nginx_directives']);
 
 
 		if($data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file)) {
 			$vhost_data['ssl_enabled'] = 1;
-			$app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG);
 		} else {
 			$vhost_data['ssl_enabled'] = 0;
-			$app->log('Disable SSL for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Disable SSL for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1;
@@ -127,34 +127,34 @@
 
 		$tpl->setVar($vhost_data);
 
-		
+
 
 		// get alias domains (co-domains and subdomains)
 		$aliases = $app->dbmaster->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND type != 'vhostsubdomain' AND active = 'y'");
 		$server_alias = array();
 		switch($data['new']['subdomain']) {
-			case 'www':
-				$server_alias[] .= 'www.'.$data['new']['domain'].' ';
-				break;
-			case '*':
-				$server_alias[] .= '*.'.$data['new']['domain'].' ';
-				break;
+		case 'www':
+			$server_alias[] .= 'www.'.$data['new']['domain'].' ';
+			break;
+		case '*':
+			$server_alias[] .= '*.'.$data['new']['domain'].' ';
+			break;
 		}
 		if(is_array($aliases)) {
 			foreach($aliases as $alias) {
 				switch($alias['subdomain']) {
-					case 'www':
-						$server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
-						break;
-					case '*':
-						$server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
-						break;
-					default:
-						$server_alias[] .= $alias['domain'].' ';
-						break;
+				case 'www':
+					$server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
+					break;
+				case '*':
+					$server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
+					break;
+				default:
+					$server_alias[] .= $alias['domain'].' ';
+					break;
 				}
-				$app->log('Add server alias: '.$alias['domain'],LOGLEVEL_DEBUG);
-				
+				$app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG);
+
 			}
 		}
 
@@ -170,66 +170,66 @@
 			}
 			unset($tmp_alias);
 
-			$tpl->setVar('alias',trim($server_alias_str));
+			$tpl->setVar('alias', trim($server_alias_str));
 		} else {
-			$tpl->setVar('alias','');
+			$tpl->setVar('alias', '');
 		}
-		
+
 
 		$vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost');
 		//* Make a backup copy of vhost file
-		copy($vhost_file,$vhost_file.'~');
-		
+		copy($vhost_file, $vhost_file.'~');
+
 		//* Write vhost file
-		file_put_contents($vhost_file,$tpl->grab());
-		$app->log('Writing the vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
+		file_put_contents($vhost_file, $tpl->grab());
+		$app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 
 		// Set the symlink to enable the vhost
 		$vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost');
 		if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) {
-			symlink($vhost_file,$vhost_symlink);
-			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			symlink($vhost_file, $vhost_symlink);
+			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 		}
 
 		// Remove the symlink, if site is inactive
 		if($data['new']['active'] == 'n' && is_link($vhost_symlink)) {
 			unlink($vhost_symlink);
-			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 		}
-		
+
 		if(!is_dir('/var/log/ispconfig/nginx/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/nginx/'.$data['new']['domain']);
 
 		// remove old symlink and vhost file, if domain name of the site has changed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
 			$vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			unlink($vhost_symlink);
-			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			$vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
 			unlink($vhost_file);
-			$app->log('Removing file: '.$vhost_file,LOGLEVEL_DEBUG);
-			
+			$app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG);
+
 			if(is_dir('/var/log/ispconfig/nginx/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/nginx/'.$data['old']['domain']);
 		}
-		
+
 		// request a httpd reload when all records have been processed
-		$app->services->restartServiceDelayed('nginx','restart');
-			
+		$app->services->restartServiceDelayed('nginx', 'restart');
+
 		// Remove the backup copy of the config file.
 		if(@is_file($vhost_file.'~')) unlink($vhost_file.'~');
-		
+
 
 		//* Unset action to clean it for next processed vhost.
 		$this->action = '';
 
 	}
-	
-	
-	
+
+
+
 
 	// Handle the creation of SSL certificates
-	function ssl($event_name,$data) {
+	function ssl($event_name, $data) {
 		global $app, $conf;
 
 		if(!is_dir($conf['nginx']['config_dir'].'/ssl')) exec('mkdir -p '.$conf['nginx']['config_dir'].'/ssl');
@@ -240,19 +240,19 @@
 		$csr_file = $ssl_dir.'/'.$domain.'.csr';
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
 
-		
+
 		//* Save a SSL certificate to disk
 		if($data["new"]["ssl_action"] == 'save') {
 			$web = $app->masterdb->queryOneRecord("select wd.document_root, sp.ip_address from web_domain wd INNER JOIN server_ip sp USING(server_id) WHERE domain = '".$data['new']['domain']."'");
-			
+
 			$src_ssl_dir = $web["document_root"]."/ssl";
 			//$domain = $data["new"]["ssl_domain"];
 			//$csr_file = $ssl_dir.'/'.$domain.".csr";
 			//$crt_file = $ssl_dir.'/'.$domain.".crt";
 			//$bundle_file = $ssl_dir.'/'.$domain.".bundle";
 			$this->_exec('rsync -v -e ssh root@'.$web['ip_address'].':~/$src_ssl_dir '.$ssl_dir);
-			
-			$app->log('Syncing SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+
+			$app->log('Syncing SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		//* Delete a SSL certificate
@@ -265,14 +265,14 @@
 			unlink($csr_file);
 			unlink($crt_file);
 			unlink($bundle_file);
-			$app->log('Deleting SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 
 	}
 
 
-	function delete($event_name,$data) {
+	function delete($event_name, $data) {
 		global $app, $conf;
 
 		// load the server configuration options
@@ -286,80 +286,80 @@
 			// Deleting the vhost file, symlink and the data directory
 			$vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			unlink($vhost_symlink);
-			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 
 			$vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
 			unlink($vhost_file);
-			$app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
-			
-			
+			$app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
+
+
 
 			// Delete the log file directory
 			$vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/nginx/'.$data['old']['domain']);
-			if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir,'..')) exec('rm -rf '.$vhost_logfile_dir);
-			$app->log('Removing website logfile directory: '.$vhost_logfile_dir,LOGLEVEL_DEBUG);
+			if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir);
+			$app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG);
 
 		}
 	}
-	
+
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
-	
-	function rewrite_insert($event_name,$data) {
+
+	function rewrite_insert($event_name, $data) {
 		global $app, $conf;
 
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 	}
-	
-	function rewrite_update($event_name,$data) {
+
+	function rewrite_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$rules = $this->_getRewriteRules($app);
-		
+
 		$app->uses('getconf');
 		$nginx_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate("nginx_reverseproxy_rewrites.conf.master");
-		if (!empty($rules))$tpl->setLoop('nginx_rewrite_rules',$rules);
-		
+		if (!empty($rules))$tpl->setLoop('nginx_rewrite_rules', $rules);
+
 		$rewrites_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/default.rewrites.conf');
 		//* Make a backup copy of vhost file
-		copy($rewrites_file,$rewrites_file.'~');
-		
+		copy($rewrites_file, $rewrites_file.'~');
+
 		//* Write vhost file
-		file_put_contents($rewrites_file,$tpl->grab());
-		$app->log('Writing the nginx rewrites file: '.$rewrites_file,LOGLEVEL_DEBUG);
+		file_put_contents($rewrites_file, $tpl->grab());
+		$app->log('Writing the nginx rewrites file: '.$rewrites_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 
 		// Set the symlink to enable the vhost
 		$rewrite_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/default.rewrites.conf');
-		
+
 		if(!is_link($rewrite_symlink)) {
-			symlink($rewrites_file,$rewrite_symlink);
-			$app->log('Creating symlink for nginx rewrites: '.$rewrite_symlink.'->'.$rewrites_file,LOGLEVEL_DEBUG);
-		}	
+			symlink($rewrites_file, $rewrite_symlink);
+			$app->log('Creating symlink for nginx rewrites: '.$rewrite_symlink.'->'.$rewrites_file, LOGLEVEL_DEBUG);
+		}
 	}
-	
-	function rewrite_delete($event_name,$data) {
+
+	function rewrite_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// just run the update function
-		$this->rewrite_update($event_name,$data);	
+		$this->rewrite_update($event_name, $data);
 	}
-	
+
 
 	function _getRewriteRules($app)
 	{
 		$rules = array();
-		$rules = $app->db->queryAllRecords("SELECT rewrite_url_src, rewrite_url_dst FROM proxy_reverse ORDER BY rewrite_id ASC");		
+		$rules = $app->db->queryAllRecords("SELECT rewrite_url_src, rewrite_url_dst FROM proxy_reverse ORDER BY rewrite_id ASC");
 		return $rules;
 	}
 
diff --git a/server/plugins-available/openvz_plugin.inc.php b/server/plugins-available/openvz_plugin.inc.php
index 9e0d75d..a50c3de 100644
--- a/server/plugins-available/openvz_plugin.inc.php
+++ b/server/plugins-available/openvz_plugin.inc.php
@@ -29,142 +29,142 @@
 */
 
 class openvz_plugin {
-	
+
 	var $plugin_name = 'openvz_plugin';
 	var $class_name  = 'openvz_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		//* this is only true on openvz host servers, not in openvz guests
 		if(@file_exists('/proc/vz/version')) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* Virtual machine
-		$app->plugins->registerEvent('openvz_vm_insert',$this->plugin_name,'vm_insert');
-		$app->plugins->registerEvent('openvz_vm_update',$this->plugin_name,'vm_update');
-		$app->plugins->registerEvent('openvz_vm_delete',$this->plugin_name,'vm_delete');
-		
+		$app->plugins->registerEvent('openvz_vm_insert', $this->plugin_name, 'vm_insert');
+		$app->plugins->registerEvent('openvz_vm_update', $this->plugin_name, 'vm_update');
+		$app->plugins->registerEvent('openvz_vm_delete', $this->plugin_name, 'vm_delete');
+
 		//* Register for actions
-		$app->plugins->registerAction('openvz_start_vm',$this->plugin_name,'actions');
-		$app->plugins->registerAction('openvz_stop_vm',$this->plugin_name,'actions');
-		$app->plugins->registerAction('openvz_restart_vm',$this->plugin_name,'actions');
-		$app->plugins->registerAction('openvz_create_ostpl',$this->plugin_name,'actions');
-		
-		
-		
+		$app->plugins->registerAction('openvz_start_vm', $this->plugin_name, 'actions');
+		$app->plugins->registerAction('openvz_stop_vm', $this->plugin_name, 'actions');
+		$app->plugins->registerAction('openvz_restart_vm', $this->plugin_name, 'actions');
+		$app->plugins->registerAction('openvz_create_ostpl', $this->plugin_name, 'actions');
+
+
+
 	}
-	
-	
-	function vm_insert($event_name,$data) {
+
+
+	function vm_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$veid = intval($data['new']['veid']);
-		
+
 		if($veid == 0) {
-			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			$app->log("VEID = 0, we stop here.", LOGLEVEL_WARN);
 			return;
 		}
-		
+
 		$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ".$data['new']['ostemplate_id']);
 		$ostemplate = escapeshellcmd($tmp['template_file']);
 		unset($tmp);
-		
+
 		//* Create the virtual machine
 		exec("vzctl create $veid --ostemplate $ostemplate");
-		$app->log("Create OpenVZ VM: vzctl create $veid --ostemplate $ostemplate",LOGLEVEL_DEBUG);
-		
+		$app->log("Create OpenVZ VM: vzctl create $veid --ostemplate $ostemplate", LOGLEVEL_DEBUG);
+
 		//* Write the configuration of the VM
-		file_put_contents('/etc/vz/conf/'.$veid.'.conf',$data['new']['config']);
-		
+		file_put_contents('/etc/vz/conf/'.$veid.'.conf', $data['new']['config']);
+
 		//* Start the VM
 		if($data['new']['active'] == 'y') {
 			exec("vzctl start $veid");
-			$app->log("Starting OpenVZ VM: vzctl start $veid",LOGLEVEL_DEBUG);
+			$app->log("Starting OpenVZ VM: vzctl start $veid", LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Set the root password in the virtual machine
 		exec("vzctl set $veid --userpasswd root:".escapeshellcmd($data['new']['vm_password']));
-		
+
 	}
-	
-	function vm_update($event_name,$data) {
+
+	function vm_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$veid = intval($data['new']['veid']);
-		
+
 		if($veid == 0) {
-			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			$app->log("VEID = 0, we stop here.", LOGLEVEL_WARN);
 			return;
 		}
-		
+
 		//* Write the configuration of the VM
-		file_put_contents('/etc/vz/conf/'.$veid.'.conf',$data['new']['config']);
-		$app->log("Writing new configuration for $veid",LOGLEVEL_DEBUG);
-		
+		file_put_contents('/etc/vz/conf/'.$veid.'.conf', $data['new']['config']);
+		$app->log("Writing new configuration for $veid", LOGLEVEL_DEBUG);
+
 		//* Apply config changes to the VM
 		if($data['new']['active'] == 'y' && $data['old']['active'] == 'y') {
 			exec("vzctl restart $veid");
-			$app->log("Restarting OpenVZ VM: vzctl restart $veid",LOGLEVEL_DEBUG);
+			$app->log("Restarting OpenVZ VM: vzctl restart $veid", LOGLEVEL_DEBUG);
 		} elseif ($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
 			exec("vzctl start $veid");
-			$app->log("Starting OpenVZ VM: vzctl start $veid",LOGLEVEL_DEBUG);
+			$app->log("Starting OpenVZ VM: vzctl start $veid", LOGLEVEL_DEBUG);
 		} elseif ($data['new']['active'] == 'n' && $data['old']['active'] == 'y') {
 			exec("vzctl stop $veid");
-			$app->log("Stopping OpenVZ VM: vzctl stop $veid",LOGLEVEL_DEBUG);
+			$app->log("Stopping OpenVZ VM: vzctl stop $veid", LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Set the root password in the virtual machine
 		if($data['new']['vm_password'] != $data['old']['vm_password']) {
 			exec("vzctl set $veid --userpasswd root:".escapeshellcmd($data['new']['vm_password']));
 		}
-		
-		
+
+
 	}
-	
-	function vm_delete($event_name,$data) {
+
+	function vm_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$veid = intval($data['old']['veid']);
-		
+
 		if($veid == 0) {
-			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			$app->log("VEID = 0, we stop here.", LOGLEVEL_WARN);
 			return;
 		}
-		
+
 		exec("vzctl stop $veid");
 		exec("vzctl destroy $veid");
-		$app->log("Destroying OpenVZ VM: vzctl destroy $veid",LOGLEVEL_DEBUG);
-			
+		$app->log("Destroying OpenVZ VM: vzctl destroy $veid", LOGLEVEL_DEBUG);
+
 	}
-	
-	function actions($action_name,$data) {
+
+	function actions($action_name, $data) {
 		global $app, $conf;
-		
+
 		if ($action_name == 'openvz_start_vm') {
 			$veid = intval($data);
 			if($veid > 0) {
 				exec("vzctl start $veid");
-				$app->log("Start VM: vzctl start $veid",LOGLEVEL_DEBUG);
+				$app->log("Start VM: vzctl start $veid", LOGLEVEL_DEBUG);
 			}
 			return 'ok';
 		}
@@ -172,7 +172,7 @@
 			$veid = intval($data);
 			if($veid > 0) {
 				exec("vzctl stop $veid");
-				$app->log("Stop VM: vzctl stop $veid",LOGLEVEL_DEBUG);
+				$app->log("Stop VM: vzctl stop $veid", LOGLEVEL_DEBUG);
 			}
 			return 'ok';
 		}
@@ -180,12 +180,12 @@
 			$veid = intval($data);
 			if($veid > 0) {
 				exec("vzctl restart $veid");
-				$app->log("Restart VM: vzctl restart $veid",LOGLEVEL_DEBUG);
+				$app->log("Restart VM: vzctl restart $veid", LOGLEVEL_DEBUG);
 			}
 			return 'ok';
 		}
 		if ($action_name == 'openvz_create_ostpl') {
-			$parts = explode(':',$data);
+			$parts = explode(':', $data);
 			$veid = intval($parts[0]);
 			$template_cache_dir = '/vz/template/cache/';
 			$template_name = escapeshellcmd($parts[1]);
@@ -195,12 +195,12 @@
 				exec("mv ".$template_cache_dir."vzdump-openvz-".$veid."*.tgz ".$template_cache_dir.$template_name.".tar.gz");
 				exec("rm -f ".$template_cache_dir."vzdump-openvz-".$veid."*.log");
 			}
-			$app->log("Created OpenVZ OStemplate $template_name from VM $veid",LOGLEVEL_DEBUG);
+			$app->log("Created OpenVZ OStemplate $template_name from VM $veid", LOGLEVEL_DEBUG);
 			return 'ok';
 		}
-			
+
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/pma_symlink_plugin.inc.php b/server/plugins-available/pma_symlink_plugin.inc.php
index e2cb3a3..db9b6f7 100644
--- a/server/plugins-available/pma_symlink_plugin.inc.php
+++ b/server/plugins-available/pma_symlink_plugin.inc.php
@@ -3,7 +3,7 @@
 /*
 Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh
 All rights reserved.
-Modification (c) 2009, Marius Cramer, pixcept KG 
+Modification (c) 2009, Marius Cramer, pixcept KG
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -30,91 +30,91 @@
 */
 
 class pma_symlink_plugin {
-	
+
 	var $plugin_name = 'pma_symlink_plugin';
 	var $class_name = 'pma_symlink_plugin';
-	
-    var $action;
-    
+
+	var $action;
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
-			return false;
-		
+
+		return false;
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($this->action != 'insert') $this->action = 'update';
-		
+
 		if($data["new"]["type"] != "vhost" && $data["new"]["parent_domain_id"] > 0) {
-			
+
 			$old_parent_domain_id = intval($data["old"]["parent_domain_id"]);
 			$new_parent_domain_id = intval($data["new"]["parent_domain_id"]);
-			
+
 			// If the parent_domain_id has been chenged, we will have to update the old site as well.
 			if($this->action == 'update' && $data["new"]["parent_domain_id"] != $data["old"]["parent_domain_id"]) {
 				$tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$old_parent_domain_id." AND active = 'y'");
 				$data["new"] = $tmp;
 				$data["old"] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
-			
+
 			// This is not a vhost, so we need to update the parent record instead.
 			$tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$new_parent_domain_id." AND active = 'y'");
 			$data["new"] = $tmp;
 			$data["old"] = $tmp;
 			$this->action = 'update';
 		}
-		
+
 		if($data["new"]["document_root"] == '') {
-			$app->log("document_root not set",LOGLEVEL_WARN);
+			$app->log("document_root not set", LOGLEVEL_WARN);
 			return 0;
 		}
-		
-        $symlink = true;
-        if($data["new"]["php"] == "suphp") $symlink = false;
-        elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
-        elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
-        
-        
-        if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true);
-        if($symlink == false) {
-            if(is_link($data["new"]["document_root"].'/web/phpmyadmin')) unlink($data["new"]["document_root"].'/web/phpmyadmin');
-        } else {
-            if(!is_link($data["new"]["document_root"].'/web/phpmyadmin')) symlink('/var/www/phpmyadmin',$data["new"]["document_root"].'/web/phpmyadmin');
-            else symlink('/var/www/phpmyadmin',$data["new"]["document_root"].'/web/phpmyadmin');
-        }
+
+		$symlink = true;
+		if($data["new"]["php"] == "suphp") $symlink = false;
+		elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
+		elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
+
+
+		if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true);
+		if($symlink == false) {
+			if(is_link($data["new"]["document_root"].'/web/phpmyadmin')) unlink($data["new"]["document_root"].'/web/phpmyadmin');
+		} else {
+			if(!is_link($data["new"]["document_root"].'/web/phpmyadmin')) symlink('/var/www/phpmyadmin', $data["new"]["document_root"].'/web/phpmyadmin');
+			else symlink('/var/www/phpmyadmin', $data["new"]["document_root"].'/web/phpmyadmin');
+		}
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/postfix_filter_plugin.inc.php b/server/plugins-available/postfix_filter_plugin.inc.php
index db647d7..867df25 100644
--- a/server/plugins-available/postfix_filter_plugin.inc.php
+++ b/server/plugins-available/postfix_filter_plugin.inc.php
@@ -29,55 +29,55 @@
 */
 
 class postfix_filter_plugin {
-	
+
 	var $plugin_name = 'postfix_filter_plugin';
 	var $class_name = 'postfix_filter_plugin';
-	
-	
+
+
 	var $postfix_config_dir = '/etc/postfix';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_content_filter_insert','postfix_filter_plugin','insert');
-		$app->plugins->registerEvent('mail_content_filter_update','postfix_filter_plugin','update');
-		$app->plugins->registerEvent('mail_content_filter_delete','postfix_filter_plugin','delete');
-		
-		
-		
+
+		$app->plugins->registerEvent('mail_content_filter_insert', 'postfix_filter_plugin', 'insert');
+		$app->plugins->registerEvent('mail_content_filter_update', 'postfix_filter_plugin', 'update');
+		$app->plugins->registerEvent('mail_content_filter_delete', 'postfix_filter_plugin', 'delete');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$type = $data["new"]["type"];
 		if($type != '') {
 			$sql = "SELECT * FROM mail_content_filter WHERE server_id = ".intval($conf["server_id"])." AND type = '".$app->db->quote($type)."' AND active = 'y'";
@@ -87,28 +87,28 @@
 				$content .= $rule["pattern"];
 				$content .= "  ".$rule["action"]." ".$rule["data"]."\n";
 			}
-		
+
 			if($type == 'header') {
-				file_put_contents('/etc/postfix/header_checks',$content);
-				$app->log("Writing /etc/postfix/header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/header_checks', $content);
+				$app->log("Writing /etc/postfix/header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'mime_header') {
-				file_put_contents('/etc/postfix/mime_header_checks',$content);
-				$app->log("Writing /etc/postfix/mime_header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/mime_header_checks', $content);
+				$app->log("Writing /etc/postfix/mime_header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'nested_header') {
-				file_put_contents('/etc/postfix/nested_header_checks',$content);
-				$app->log("Writing /etc/postfix/nested_header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/nested_header_checks', $content);
+				$app->log("Writing /etc/postfix/nested_header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'body') {
-				file_put_contents('/etc/postfix/body_checks',$content);
-				$app->log("Writing /etc/postfix/body_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/body_checks', $content);
+				$app->log("Writing /etc/postfix/body_checks", LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		$type = $data["old"]["type"];
 		if($type != '') {
 			$sql = "SELECT * FROM mail_content_filter WHERE server_id = ".intval($conf["server_id"])." AND type = '".$app->db->quote($type)."' AND active = 'y'";
@@ -118,36 +118,36 @@
 				$content .= $rule["pattern"];
 				$content .= "  ".$rule["action"]." ".$rule["data"]."\n";
 			}
-		
+
 			if($type == 'header') {
-				file_put_contents('/etc/postfix/header_checks',$content);
-				$app->log("Writing /etc/postfix/header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/header_checks', $content);
+				$app->log("Writing /etc/postfix/header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'mime_header') {
-				file_put_contents('/etc/postfix/mime_header_checks',$content);
-				$app->log("Writing /etc/postfix/mime_header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/mime_header_checks', $content);
+				$app->log("Writing /etc/postfix/mime_header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'nested_header') {
-				file_put_contents('/etc/postfix/nested_header_checks',$content);
-				$app->log("Writing /etc/postfix/nested_header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/nested_header_checks', $content);
+				$app->log("Writing /etc/postfix/nested_header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'body') {
-				file_put_contents('/etc/postfix/body_checks',$content);
-				$app->log("Writing /etc/postfix/body_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/body_checks', $content);
+				$app->log("Writing /etc/postfix/body_checks", LOGLEVEL_DEBUG);
 			}
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
+
+		$this->update($event_name, $data);
 	}
-	
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php
index 8d00e31..ad92dec 100644
--- a/server/plugins-available/postfix_server_plugin.inc.php
+++ b/server/plugins-available/postfix_server_plugin.inc.php
@@ -29,62 +29,62 @@
 */
 
 class postfix_server_plugin {
-	
+
 	var $plugin_name = 'postfix_server_plugin';
 	var $class_name = 'postfix_server_plugin';
-	
-	
+
+
 	var $postfix_config_dir = '/etc/postfix';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('server_insert','postfix_server_plugin','insert');
-		$app->plugins->registerEvent('server_update','postfix_server_plugin','update');
-		
-		
-		
+
+		$app->plugins->registerEvent('server_insert', 'postfix_server_plugin', 'insert');
+		$app->plugins->registerEvent('server_update', 'postfix_server_plugin', 'update');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
+
 	// The purpose of this plugin is to rewrite the main.cf file
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses("getconf");
 		$old_ini_data = $app->ini_parser->parse_ini_string($data['old']['config']);
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
-		
-		copy('/etc/postfix/main.cf','/etc/postfix/main.cf~');
-		
+
+		copy('/etc/postfix/main.cf', '/etc/postfix/main.cf~');
+
 		if($mail_config['relayhost'] != '') {
 			exec("postconf -e 'relayhost = ".$mail_config['relayhost']."'");
 			if($mail_config['relayhost_user'] != '' && $mail_config['relayhost_password'] != '') {
@@ -94,16 +94,16 @@
 			}
 			exec("postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'");
 			exec("postconf -e 'smtp_sasl_security_options ='");
-			
+
 			// Store the sasl passwd
 			$content = $mail_config['relayhost'].'   '.$mail_config['relayhost_user'].':'.$mail_config['relayhost_password'];
-			file_put_contents('/etc/postfix/sasl_passwd',$content);
+			file_put_contents('/etc/postfix/sasl_passwd', $content);
 			chmod('/etc/postfix/sasl_passwd', 0600);
 			chown('/etc/postfix/sasl_passwd', 'root');
 			chgrp('/etc/postfix/sasl_passwd', 'root');
 			exec('postmap /etc/postfix/sasl_passwd');
 			exec($conf['init_scripts'] . '/' . 'postfix restart');
-			
+
 		} else {
 			exec("postconf -e 'relayhost ='");
 		}
@@ -130,7 +130,7 @@
 
 		exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'");
 		exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'");
-		
+
 	}
 
 } // end class
diff --git a/server/plugins-available/powerdns_plugin.inc.php b/server/plugins-available/powerdns_plugin.inc.php
index 0141968..335371c 100644
--- a/server/plugins-available/powerdns_plugin.inc.php
+++ b/server/plugins-available/powerdns_plugin.inc.php
@@ -78,58 +78,58 @@
 */
 
 class powerdns_plugin {
-	
+
 	var $plugin_name = 'powerdns_plugin';
 	var $class_name  = 'powerdns_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if(isset($conf['powerdns']['installed']) && $conf['powerdns']['installed'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* SOA
-		$app->plugins->registerEvent('dns_soa_insert',$this->plugin_name,'soa_insert');
-		$app->plugins->registerEvent('dns_soa_update',$this->plugin_name,'soa_update');
-		$app->plugins->registerEvent('dns_soa_delete',$this->plugin_name,'soa_delete');
+		$app->plugins->registerEvent('dns_soa_insert', $this->plugin_name, 'soa_insert');
+		$app->plugins->registerEvent('dns_soa_update', $this->plugin_name, 'soa_update');
+		$app->plugins->registerEvent('dns_soa_delete', $this->plugin_name, 'soa_delete');
 
 		//* SLAVE
-		$app->plugins->registerEvent('dns_slave_insert',$this->plugin_name,'slave_insert');
-		$app->plugins->registerEvent('dns_slave_update',$this->plugin_name,'slave_update');
-		$app->plugins->registerEvent('dns_slave_delete',$this->plugin_name,'slave_delete');
-		
+		$app->plugins->registerEvent('dns_slave_insert', $this->plugin_name, 'slave_insert');
+		$app->plugins->registerEvent('dns_slave_update', $this->plugin_name, 'slave_update');
+		$app->plugins->registerEvent('dns_slave_delete', $this->plugin_name, 'slave_delete');
+
 		//* RR
-		$app->plugins->registerEvent('dns_rr_insert',$this->plugin_name,'rr_insert');
-		$app->plugins->registerEvent('dns_rr_update',$this->plugin_name,'rr_update');
-		$app->plugins->registerEvent('dns_rr_delete',$this->plugin_name,'rr_delete');
-		
+		$app->plugins->registerEvent('dns_rr_insert', $this->plugin_name, 'rr_insert');
+		$app->plugins->registerEvent('dns_rr_update', $this->plugin_name, 'rr_update');
+		$app->plugins->registerEvent('dns_rr_delete', $this->plugin_name, 'rr_delete');
+
 	}
-	
-	
-	function soa_insert($event_name,$data) {
+
+
+	function soa_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$origin = substr($data["new"]["origin"], 0, -1);
 		$ispconfig_id = $data["new"]["id"];
 		$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
@@ -142,24 +142,24 @@
 			$ns = $data["new"]["ns"].'.'.$origin;
 		}
 		if($ns == '') $ns = $origin;
-		
+
 		$hostmaster = substr($data["new"]["mbox"], 0, -1);
 		$content = $ns.' '.$hostmaster.' 0';
 		$ttl = $data["new"]["ttl"];
-		
+
 		$app->db->query("INSERT INTO powerdns.records (domain_id, name, type, content, ttl, prio, change_date, ispconfig_id) VALUES ($zone_id, '$origin', 'SOA', '$content', $ttl, 0, ".time().", $ispconfig_id)");
-	
-        //* Reload powerdns nameserver
-        $app->services->restartServiceDelayed('powerdns','reload');
-	
+
+		//* Reload powerdns nameserver
+		$app->services->restartServiceDelayed('powerdns', 'reload');
+
 	}
-	
-	function soa_update($event_name,$data) {
+
+	function soa_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y'){
 			if($data["old"]["active"] != 'Y') return;
-			$this->soa_delete($event_name,$data);
+			$this->soa_delete($event_name, $data);
 		} else {
 			if($data["old"]["active"] == 'Y'){
 				$origin = substr($data["new"]["origin"], 0, -1);
@@ -167,27 +167,27 @@
 				$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
 				$serial_id = $serial["serial"];
 				//$app->db->query("UPDATE powerdns.domains SET name = '$origin', notified_serial = $serial_id WHERE ispconfig_id = $ispconfig_idi AND type = 'MASTER'");
-				//$app->db->query("UPDATE powerdns.domains SET name = '$origin' WHERE ispconfig_id = $ispconfig_id AND type = 'MASTER'");		
-		
+				//$app->db->query("UPDATE powerdns.domains SET name = '$origin' WHERE ispconfig_id = $ispconfig_id AND type = 'MASTER'");
+
 				if(substr($data["new"]["ns"], -1) == '.'){
 					$ns = substr($data["new"]["ns"], 0, -1);
 				} else {
 					$ns = $data["new"]["ns"].'.'.$origin;
 				}
 				if($ns == '') $ns = $origin;
-				
+
 				$hostmaster = substr($data["new"]["mbox"], 0, -1);
 				//$content = $ns.' '.$hostmaster.' 0';
 				$content = $ns.' '.$hostmaster.' '.$serial_id.'';
 				$ttl = $data["new"]["ttl"];
 				$app->db->query("UPDATE powerdns.records SET name = '$origin', content = '$content', ttl = $ttl, change_date = ".time()." WHERE ispconfig_id = ".$data["new"]["id"]." AND type = 'SOA'");
 
-		        //* Reload powerdns nameserver
-				$app->services->restartServiceDelayed('powerdns','reload');
+				//* Reload powerdns nameserver
+				$app->services->restartServiceDelayed('powerdns', 'reload');
 
 
 			} else {
-				$this->soa_insert($event_name,$data);
+				$this->soa_insert($event_name, $data);
 				$ispconfig_id = $data["new"]["id"];
 				if($records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = $ispconfig_id AND active = 'Y'")){
 					foreach($records as $record){
@@ -200,97 +200,97 @@
 
 			}
 		}
-			
+
 	}
-	
-	function soa_delete($event_name,$data) {
+
+	function soa_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["old"]["id"]." AND type = 'MASTER'");
 		$zone_id = $zone["id"];
 		$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id");
 		$app->db->query("DELETE FROM powerdns.domains WHERE id = $zone_id");
 
-        //* Reload powerdns nameserver
-        $app->services->restartServiceDelayed('powerdns','reload');
-			
+		//* Reload powerdns nameserver
+		$app->services->restartServiceDelayed('powerdns', 'reload');
+
 	}
 
-	function slave_insert($event_name,$data) {
+	function slave_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$origin = substr($data["new"]["origin"], 0, -1);
 		$ispconfig_id = $data["new"]["id"];
 		$master_ns = $data["new"]["ns"];
-		
+
 		$app->db->query("INSERT INTO powerdns.domains (name, type, master, ispconfig_id) VALUES ('$origin', 'SLAVE', '$master_ns', $ispconfig_id)");
 
 		//$app->db->query("INSERT INTO powerdns.domains (name, type, ispconfig_id) VALUES ('$origin', 'NATIVE', $ispconfig_id)");
 		$zone_id = $app->db->insertID();
 
-        //* Reload powerdns nameserver
-        $app->services->restartServiceDelayed('powerdns','reload');
+		//* Reload powerdns nameserver
+		$app->services->restartServiceDelayed('powerdns', 'reload');
 
 	}
-	
-	function slave_update($event_name,$data) {
+
+	function slave_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y'){
 			if($data["old"]["active"] != 'Y') return;
-			$this->slave_delete($event_name,$data);
+			$this->slave_delete($event_name, $data);
 		} else {
 			if($data["old"]["active"] == 'Y'){
-		
-     			$origin = substr($data["new"]["origin"], 0, -1);
-      			$ispconfig_id = $data["new"]["id"];
-		    	$master_ns = $data["new"]["ns"];
-		
-		    	$app->db->query("UPDATE powerdns.domains SET name = '$origin', type = 'SLAVE', master = '$master_ns' WHERE ispconfig_id=$ispconfig_id AND type = 'SLAVE'");
+
+				$origin = substr($data["new"]["origin"], 0, -1);
+				$ispconfig_id = $data["new"]["id"];
+				$master_ns = $data["new"]["ns"];
+
+				$app->db->query("UPDATE powerdns.domains SET name = '$origin', type = 'SLAVE', master = '$master_ns' WHERE ispconfig_id=$ispconfig_id AND type = 'SLAVE'");
 				//$app->db->query("INSERT INTO powerdns.domains (name, type, ispconfig_id) VALUES ('$origin', 'NATIVE', $ispconfig_id)");
-		    	$zone_id = $app->db->insertID();
+				$zone_id = $app->db->insertID();
 
-    			$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$ispconfig_id." AND type = 'SLAVE'");
-    			$zone_id = $zone["id"];
-    			$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id AND ispconfig_id = 0");
+				$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$ispconfig_id." AND type = 'SLAVE'");
+				$zone_id = $zone["id"];
+				$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id AND ispconfig_id = 0");
 
-		        //* Reload powerdns nameserver
-     		   $app->services->restartServiceDelayed('powerdns','reload');
-				
+				//* Reload powerdns nameserver
+				$app->services->restartServiceDelayed('powerdns', 'reload');
+
 			} else {
-				$this->slave_insert($event_name,$data);
+				$this->slave_insert($event_name, $data);
 
 			}
 		}
-			
+
 	}
-	
-	function slave_delete($event_name,$data) {
+
+	function slave_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["old"]["id"]." AND type = 'SLAVE'");
 		$zone_id = $zone["id"];
 		$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id");
 		$app->db->query("DELETE FROM powerdns.domains WHERE id = $zone_id");
 
-        //* Reload powerdns nameserver
-        $app->services->restartServiceDelayed('powerdns','reload');
-    			
+		//* Reload powerdns nameserver
+		$app->services->restartServiceDelayed('powerdns', 'reload');
+
 	}
-	
-	function rr_insert($event_name,$data) {
+
+	function rr_insert($event_name, $data) {
 		global $app, $conf;
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
 		$origin = substr($zone["origin"], 0, -1);
 		$powerdns_zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["zone"]." AND type = 'MASTER'");
 		$zone_id = $powerdns_zone["id"];
-		
+
 		$type = $data["new"]["type"];
-		
+
 		if(substr($data["new"]["name"], -1) == '.'){
 			$name = substr($data["new"]["name"], 0, -1);
 		} else {
@@ -301,59 +301,59 @@
 			}
 		}
 		if($name == '') $name = $origin;
-		
+
 		switch ($type) {
-			case "CNAME":
-			case "MX":
-			case "NS":
-			case "ALIAS":
-			case "PTR":
-			case "SRV":
-				if(substr($data["new"]["data"], -1) == '.'){
-					$content = substr($data["new"]["data"], 0, -1);
-				} else {
-					$content = $data["new"]["data"].'.'.$origin;
-				}
-				break;
-			case "HINFO":
-			    $content = $data["new"]["data"];
-				$quote1 = strpos($content, '"');
-				if($quote1 !== FALSE){
-					$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
-				}
-				if($quote1 !== FALSE && $quote2 !== FALSE){
-					$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
-					$content = $text_between_quotes.substr($content, ($quote2 + 2));
-				}
-				break;
-    		default:
-				$content = $data["new"]["data"];
+		case "CNAME":
+		case "MX":
+		case "NS":
+		case "ALIAS":
+		case "PTR":
+		case "SRV":
+			if(substr($data["new"]["data"], -1) == '.'){
+				$content = substr($data["new"]["data"], 0, -1);
+			} else {
+				$content = $data["new"]["data"].'.'.$origin;
+			}
+			break;
+		case "HINFO":
+			$content = $data["new"]["data"];
+			$quote1 = strpos($content, '"');
+			if($quote1 !== FALSE){
+				$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
+			}
+			if($quote1 !== FALSE && $quote2 !== FALSE){
+				$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
+				$content = $text_between_quotes.substr($content, ($quote2 + 2));
+			}
+			break;
+		default:
+			$content = $data["new"]["data"];
 		}
-		
+
 		$ttl = $data["new"]["ttl"];
 		$prio = $data["new"]["aux"];
 		$change_date = time();
 		$ispconfig_id = $data["new"]["id"];
-		
+
 		$app->db->query("INSERT INTO powerdns.records (domain_id, name, type, content, ttl, prio, change_date, ispconfig_id) VALUES ($zone_id, '$name', '$type', '$content', $ttl, $prio, $change_date, $ispconfig_id)");
-		
+
 	}
-	
-	function rr_update($event_name,$data) {
+
+	function rr_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y'){
 			if($data["old"]["active"] != 'Y') return;
-			$this->rr_delete($event_name,$data);
+			$this->rr_delete($event_name, $data);
 		} else {
 			if($data["old"]["active"] == 'Y'){
 				$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
 				$origin = substr($zone["origin"], 0, -1);
 				$powerdns_zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["zone"]." AND type = 'MASTER'");
 				$zone_id = $powerdns_zone["id"];
-				
-				$type = $data["new"]["type"];	
-		
+
+				$type = $data["new"]["type"];
+
 				if(substr($data["new"]["name"], -1) == '.'){
 					$name = substr($data["new"]["name"], 0, -1);
 				} else {
@@ -366,56 +366,56 @@
 				if($name == '') $name = $origin;
 
 				switch ($type) {
-					case "CNAME":
-					case "MX":
-					case "NS":
-					case "ALIAS":
-					case "PTR":
-					case "SRV":
-						if(substr($data["new"]["data"], -1) == '.'){
-							$content = substr($data["new"]["data"], 0, -1);
-						} else {
-							$content = $data["new"]["data"].'.'.$origin;
-						}
-						break;
-					case "HINFO":
-			    		$content = $data["new"]["data"];
-						$quote1 = strpos($content, '"');
-						if($quote1 !== FALSE){
-							$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
-						}
-						if($quote1 !== FALSE && $quote2 !== FALSE){
-							$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
-							$content = $text_between_quotes.substr($content, ($quote2 + 2));
-						}
-						break;
-    				default:
-						$content = $data["new"]["data"];
+				case "CNAME":
+				case "MX":
+				case "NS":
+				case "ALIAS":
+				case "PTR":
+				case "SRV":
+					if(substr($data["new"]["data"], -1) == '.'){
+						$content = substr($data["new"]["data"], 0, -1);
+					} else {
+						$content = $data["new"]["data"].'.'.$origin;
+					}
+					break;
+				case "HINFO":
+					$content = $data["new"]["data"];
+					$quote1 = strpos($content, '"');
+					if($quote1 !== FALSE){
+						$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
+					}
+					if($quote1 !== FALSE && $quote2 !== FALSE){
+						$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
+						$content = $text_between_quotes.substr($content, ($quote2 + 2));
+					}
+					break;
+				default:
+					$content = $data["new"]["data"];
 				}
-		
+
 				$ttl = $data["new"]["ttl"];
 				$prio = $data["new"]["aux"];
 				$change_date = time();
 				$ispconfig_id = $data["new"]["id"];
 				//echo "UPDATE powerdns.records SET name = '$name', type = '$type', content = '$content', ttl = $ttl, prio = $prio, change_date = ".time()." WHERE id = $record_id";
 				$app->db->query("UPDATE powerdns.records SET name = '$name', type = '$type', content = '$content', ttl = $ttl, prio = $prio, change_date = ".time()." WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
-				
+
 			} else {
-				$this->rr_insert($event_name,$data);
+				$this->rr_insert($event_name, $data);
 			}
 		}
-		
+
 	}
-	
-	function rr_delete($event_name,$data) {
+
+	function rr_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$ispconfig_id = $data["old"]["id"];
 		$app->db->query("DELETE FROM powerdns.records WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
-		
+
 	}
-	
-	
+
+
 } // end class
 
 ?>
diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php
index 2924d49..33d8875 100755
--- a/server/plugins-available/shelluser_base_plugin.inc.php
+++ b/server/plugins-available/shelluser_base_plugin.inc.php
@@ -29,61 +29,61 @@
 */
 
 class shelluser_base_plugin {
-	
+
 	var $plugin_name = 'shelluser_base_plugin';
 	var $class_name = 'shelluser_base_plugin';
 	var $min_uid = 499;
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('shell_user_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('shell_user_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('shell_user_delete',$this->plugin_name,'delete');
 
-		
+		$app->plugins->registerEvent('shell_user_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('shell_user_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('shell_user_delete', $this->plugin_name, 'delete');
+
+
 	}
-	
-	
-	function insert($event_name,$data) {
+
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		//* Check if the resulting path is inside the docroot
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-		if(substr(realpath($data['new']['dir']),0,strlen($web['document_root'])) != $web['document_root']) {
-			$app->log('Directory of the shell user is outside of website docroot.',LOGLEVEL_WARN);
+		if(substr(realpath($data['new']['dir']), 0, strlen($web['document_root'])) != $web['document_root']) {
+			$app->log('Directory of the shell user is outside of website docroot.', LOGLEVEL_WARN);
 			return false;
 		}
-		
+
 		if($app->system->is_user($data['new']['puser'])) {
-			
+
 			//* Remove webfolder protection
-			$app->system->web_folder_protection($web['document_root'],false);
-			
+			$app->system->web_folder_protection($web['document_root'], false);
+
 			// Get the UID of the parent user
 			$uid = intval($app->system->getuid($data['new']['puser']));
 			if($uid > $this->min_uid) {
@@ -95,53 +95,53 @@
 				$command .= ' -s '.escapeshellcmd($data['new']['shell']);
 				$command .= ' -u '.escapeshellcmd($uid);
 				$command .= ' '.escapeshellcmd($data['new']['username']);
-			
+
 				exec($command);
-				$app->log("Executed command: ".$command,LOGLEVEL_DEBUG);
-				$app->log("Added shelluser: ".$data['new']['username'],LOGLEVEL_DEBUG);
-								
+				$app->log("Executed command: ".$command, LOGLEVEL_DEBUG);
+				$app->log("Added shelluser: ".$data['new']['username'], LOGLEVEL_DEBUG);
+
 				// call the ssh-rsa update function
 				$app->uses("getconf");
 				$this->data = $data;
 				$this->app = $app;
 				$this->_setup_ssh_rsa();
-				
+
 				//* Create .bash_history file
 				$app->system->touch(escapeshellcmd($data['new']['dir']).'/.bash_history');
 				$app->system->chmod(escapeshellcmd($data['new']['dir']).'/.bash_history', 0755);
 				$app->system->chown(escapeshellcmd($data['new']['dir']).'/.bash_history', $data['new']['username']);
 				$app->system->chgrp(escapeshellcmd($data['new']['dir']).'/.bash_history', $data['new']['pgroup']);
-				
+
 				//* Disable shell user temporarily if we use jailkit
 				if($data['new']['chroot'] == 'jailkit') {
 					$command = 'usermod -s /bin/false -L '.escapeshellcmd($data['new']['username']).' 2>/dev/null';
 					exec($command);
-					$app->log("Disabling shelluser temporarily: ".$command,LOGLEVEL_DEBUG);
+					$app->log("Disabling shelluser temporarily: ".$command, LOGLEVEL_DEBUG);
 				}
-				
+
 				//* Add webfolder protection again
-				$app->system->web_folder_protection($web['document_root'],true);
-			
+				$app->system->web_folder_protection($web['document_root'], true);
+
 			} else {
-				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.",LOGLEVEL_ERROR);
+				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.", LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log("Skipping insertion of user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.",LOGLEVEL_WARN);
+			$app->log("Skipping insertion of user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.", LOGLEVEL_WARN);
 		}
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		//* Check if the resulting path is inside the docroot
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-		if(substr(realpath($data['new']['dir']),0,strlen($web['document_root'])) != $web['document_root']) {
-			$app->log('Directory of the shell user is outside of website docroot.',LOGLEVEL_WARN);
+		if(substr(realpath($data['new']['dir']), 0, strlen($web['document_root'])) != $web['document_root']) {
+			$app->log('Directory of the shell user is outside of website docroot.', LOGLEVEL_WARN);
 			return false;
 		}
-		
+
 		if($app->system->is_user($data['new']['puser'])) {
 			// Get the UID of the parent user
 			$uid = intval($app->system->getuid($data['new']['puser']));
@@ -158,45 +158,45 @@
 					// $command .= ' --uid '.escapeshellcmd($uid);
 					$command .= ' --login '.escapeshellcmd($data['new']['username']);
 					$command .= ' '.escapeshellcmd($data['old']['username']);
-			
+
 					exec($command);
 					$app->log("Executed command: $command ",LOGLEVEL_DEBUG);
 					*/
 					//$groupinfo = $app->system->posix_getgrnam($data['new']['pgroup']);
-					$app->system->usermod($data['old']['username'],0, $app->system->getgid($data['new']['pgroup']), $data['new']['dir'], $data['new']['shell'], $data['new']['password'], $data['new']['username']);
-					$app->log("Updated shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
-									
+					$app->system->usermod($data['old']['username'], 0, $app->system->getgid($data['new']['pgroup']), $data['new']['dir'], $data['new']['shell'], $data['new']['password'], $data['new']['username']);
+					$app->log("Updated shelluser: ".$data['old']['username'], LOGLEVEL_DEBUG);
+
 					// call the ssh-rsa update function
 					$app->uses("getconf");
 					$this->data = $data;
 					$this->app = $app;
 					$this->_setup_ssh_rsa();
-					
+
 					//* Create .bash_history file
 					if(!is_file($data['new']['dir']).'/.bash_history') {
 						$app->system->touch(escapeshellcmd($data['new']['dir']).'/.bash_history');
 						$app->system->chmod(escapeshellcmd($data['new']['dir']).'/.bash_history', 0755);
-						$app->system->chown(escapeshellcmd($data['new']['dir']).'/.bash_history',escapeshellcmd($data['new']['username']));
-						$app->system->chgrp(escapeshellcmd($data['new']['dir']).'/.bash_history',escapeshellcmd($data['new']['pgroup']));
+						$app->system->chown(escapeshellcmd($data['new']['dir']).'/.bash_history', escapeshellcmd($data['new']['username']));
+						$app->system->chgrp(escapeshellcmd($data['new']['dir']).'/.bash_history', escapeshellcmd($data['new']['pgroup']));
 					}
-					
+
 				} else {
 					// The user does not exist, so we insert it now
-					$this->insert($event_name,$data);
+					$this->insert($event_name, $data);
 				}
 			} else {
-				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.",LOGLEVEL_ERROR);
+				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.", LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log("Skipping update for user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.",LOGLEVEL_WARN);
+			$app->log("Skipping update for user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.", LOGLEVEL_WARN);
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		if($app->system->is_user($data['old']['username'])) {
 			// Get the UID of the user
 			$userid = intval($app->system->getuid($data['old']['username']));
@@ -206,21 +206,21 @@
 					$command = 'userdel -f';
 					$command .= ' '.escapeshellcmd($data['old']['username']).' &> /dev/null';
 					exec($command);
-					$app->log("Deleted shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
+					$app->log("Deleted shelluser: ".$data['old']['username'], LOGLEVEL_DEBUG);
 				}
-			
+
 			} else {
-				$app->log("UID = $userid for shelluser:".$data['old']['username']." not allowed.",LOGLEVEL_ERROR);
+				$app->log("UID = $userid for shelluser:".$data['old']['username']." not allowed.", LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log("User:".$data['new']['username']." does not exist in in /etc/passwd, skipping delete.",LOGLEVEL_WARN);
+			$app->log("User:".$data['new']['username']." does not exist in in /etc/passwd, skipping delete.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	private function _setup_ssh_rsa() {
 		global $app;
-		$this->app->log("ssh-rsa setup shelluser_base",LOGLEVEL_DEBUG);
+		$this->app->log("ssh-rsa setup shelluser_base", LOGLEVEL_DEBUG);
 		// Get the client ID, username, and the key
 		$domain_data = $this->app->db->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = '.intval($this->data['new']['parent_domain_id']));
 		$sys_group_data = $this->app->db->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = '.intval($domain_data['sys_groupid']));
@@ -230,38 +230,38 @@
 		$userkey = $client_data['ssh_rsa'];
 		unset($domain_data);
 		unset($client_data);
-		
+
 		// ssh-rsa authentication variables
 		$sshrsa = $this->data['new']['ssh_rsa'];
 		$usrdir = escapeshellcmd($this->data['new']['dir']);
 		$sshdir = $usrdir.'/.ssh';
 		$sshkeys= $usrdir.'/.ssh/authorized_keys';
-		
+
 		$app->uses('file');
 		$sshrsa = $app->file->unix_nl($sshrsa);
-		$sshrsa = $app->file->remove_blank_lines($sshrsa,0);
-		
+		$sshrsa = $app->file->remove_blank_lines($sshrsa, 0);
+
 		// If this user has no key yet, generate a pair
 		if ($userkey == '' && $id > 0){
 			//Generate ssh-rsa-keys
 			exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
-			
+
 			// use the public key that has been generated
 			$userkey = $app->system->file_get_contents('/tmp/id_rsa.pub');
-			
+
 			// save keypair in client table
 			$this->app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote($app->system->file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote($userkey)."' WHERE client_id = ".$id);
-			
+
 			$app->system->unlink('/tmp/id_rsa');
 			$app->system->unlink('/tmp/id_rsa.pub');
-			$this->app->log("ssh-rsa keypair generated for ".$username,LOGLEVEL_DEBUG);
+			$this->app->log("ssh-rsa keypair generated for ".$username, LOGLEVEL_DEBUG);
 		};
 
 		if (!file_exists($sshkeys)){
 			// add root's key
 			$app->file->mkdirs($sshdir, '0700');
 			if(is_file('/root/.ssh/authorized_keys')) $app->system->file_put_contents($sshkeys, $app->system->file_get_contents('/root/.ssh/authorized_keys'));
-		
+
 			// Remove duplicate keys
 			$existing_keys = @file($sshkeys);
 			$new_keys = explode("\n", $userkey);
@@ -273,33 +273,33 @@
 				}
 			}
 			$final_keys = implode("\n", array_flip(array_flip($new_final_keys_arr)));
-			
+
 			// add the user's key
 			$app->system->file_put_contents($sshkeys, $final_keys);
 			$app->file->remove_blank_lines($sshkeys);
-			$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys,LOGLEVEL_DEBUG);
+			$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys, LOGLEVEL_DEBUG);
 		}
-			
+
 		//* Get the keys
 		$existing_keys = file($sshkeys);
 		$new_keys = explode("\n", $sshrsa);
-		$old_keys = explode("\n",$this->data['old']['ssh_rsa']);
-			
+		$old_keys = explode("\n", $this->data['old']['ssh_rsa']);
+
 		//* Remove all old keys
 		if(is_array($old_keys)) {
 			foreach($old_keys as $key => $val) {
-				$k = array_search(trim($val),$existing_keys);
+				$k = array_search(trim($val), $existing_keys);
 				unset($existing_keys[$k]);
 			}
 		}
-			
+
 		//* merge the remaining keys and the ones fom the ispconfig database.
 		if(is_array($new_keys)) {
 			$final_keys_arr = array_merge($existing_keys, $new_keys);
 		} else {
 			$final_keys_arr = $existing_keys;
 		}
-			
+
 		$new_final_keys_arr = array();
 		if(is_array($final_keys_arr) && !empty($final_keys_arr)){
 			foreach($final_keys_arr as $key => $val){
@@ -307,18 +307,18 @@
 			}
 		}
 		$final_keys = implode("\n", array_flip(array_flip($new_final_keys_arr)));
-			
-		// add the custom key 
+
+		// add the custom key
 		$app->system->file_put_contents($sshkeys, $final_keys);
 		$app->file->remove_blank_lines($sshkeys);
-		$this->app->log("ssh-rsa key updated in ".$sshkeys,LOGLEVEL_DEBUG);
-		
+		$this->app->log("ssh-rsa key updated in ".$sshkeys, LOGLEVEL_DEBUG);
+
 		// set proper file permissions
 		exec("chown -R ".escapeshellcmd($this->data['new']['puser']).":".escapeshellcmd($this->data['new']['pgroup'])." ".$sshdir);
 		exec("chmod 600 '$sshkeys'");
-		
+
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php
index 268df9c..9816b70 100755
--- a/server/plugins-available/shelluser_jailkit_plugin.inc.php
+++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php
@@ -29,229 +29,233 @@
 */
 
 class shelluser_jailkit_plugin {
-	
+
 	//* $plugin_name and $class_name have to be the same then the name of this class
 	var $plugin_name = 'shelluser_jailkit_plugin';
 	var $class_name = 'shelluser_jailkit_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('shell_user_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('shell_user_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('shell_user_delete',$this->plugin_name,'delete');
 
-		
+		$app->plugins->registerEvent('shell_user_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('shell_user_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('shell_user_delete', $this->plugin_name, 'delete');
+
+
 	}
-	
+
 	//* This function is called, when a shell user is inserted in the database
-	function insert($event_name,$data) {
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['new']['parent_domain_id']);
-		
+
 		if($app->system->is_user($data['new']['username'])) {
-		
+
 			/**
-		 	* Setup Jailkit Chroot System If Enabled 
-		 	*/
+			 * Setup Jailkit Chroot System If Enabled
+			 */
+
+
 			if ($data['new']['chroot'] == "jailkit")
 			{
-				
-				
+
+
 				// load the server configuration options
 				$app->uses("getconf");
 				$this->data = $data;
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($web['document_root'],false);
-			
+
+				$app->system->web_folder_protection($web['document_root'], false);
+
 				$this->_setup_jailkit_chroot();
-				
+
 				$this->_add_jailkit_user();
-				
+
 				//* call the ssh-rsa update function
 				$this->_setup_ssh_rsa();
-				
+
 				//$command .= 'usermod -s /usr/sbin/jk_chrootsh -U '.escapeshellcmd($data['new']['username']);
 				//exec($command);
 				$app->system->usermod($data['new']['username'], 0, 0, '', '/usr/sbin/jk_chrootsh', '', '');
-				
+
 				//* Unlock user
 				$command = 'usermod -U '.escapeshellcmd($data['new']['username']).' 2>/dev/null';
 				exec($command);
-				
+
 				$this->_update_website_security_level();
-				$app->system->web_folder_protection($web['document_root'],true);
+				$app->system->web_folder_protection($web['document_root'], true);
 			}
-		
-			$app->log("Jailkit Plugin -> insert username:".$data['new']['username'],LOGLEVEL_DEBUG);
-			
+
+			$app->log("Jailkit Plugin -> insert username:".$data['new']['username'], LOGLEVEL_DEBUG);
+
 		} else {
-			$app->log("Jailkit Plugin -> insert username:".$data['new']['username']." skipped, the user does not exist.",LOGLEVEL_WARN);
+			$app->log("Jailkit Plugin -> insert username:".$data['new']['username']." skipped, the user does not exist.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	//* This function is called, when a shell user is updated in the database
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['new']['parent_domain_id']);
-		
+
 		if($app->system->is_user($data['new']['username'])) {
-		
+
+
+
 			/**
-		 	* Setup Jailkit Chroot System If Enabled 
-		 	*/
+			 * Setup Jailkit Chroot System If Enabled
+			 */
 			if ($data['new']['chroot'] == "jailkit")
 			{
-				
+
 				// load the server configuration options
 				$app->uses("getconf");
 				$this->data = $data;
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($web['document_root'],false);
-			
+
+				$app->system->web_folder_protection($web['document_root'], false);
+
 				$this->_setup_jailkit_chroot();
 				$this->_add_jailkit_user();
-				
+
 				//* call the ssh-rsa update function
 				$this->_setup_ssh_rsa();
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($web['document_root'],true);
+
+				$app->system->web_folder_protection($web['document_root'], true);
 			}
-		
-			$app->log("Jailkit Plugin -> update username:".$data['new']['username'],LOGLEVEL_DEBUG);
-			
+
+			$app->log("Jailkit Plugin -> update username:".$data['new']['username'], LOGLEVEL_DEBUG);
+
 		} else {
-			$app->log("Jailkit Plugin -> update username:".$data['new']['username']." skipped, the user does not exist.",LOGLEVEL_WARN);
+			$app->log("Jailkit Plugin -> update username:".$data['new']['username']." skipped, the user does not exist.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	//* This function is called, when a shell user is deleted in the database
 	/**
 	 * TODO: Remove chroot user home and from the chroot passwd file
-	 */ 
-	function delete($event_name,$data) {
+	 */
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['old']['parent_domain_id']);
-		
+
 		if ($data['old']['chroot'] == "jailkit")
 		{
 			$app->uses("getconf");
 			$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
-			
+
 			$jailkit_chroot_userhome = $this->_get_home_dir($data['old']['username']);
-			
+
 			//commented out proved to be dangerous on config errors
 			//exec('rm -rf '.$data['old']['dir'].$jailkit_chroot_userhome);
-			
-			$app->system->web_folder_protection($web['document_root'],false);
-			
+
+			$app->system->web_folder_protection($web['document_root'], false);
+
 			if(@is_dir($data['old']['dir'].$jailkit_chroot_userhome)) {
 				$command = 'userdel -f';
 				$command .= ' '.escapeshellcmd($data['old']['username']).' &> /dev/null';
 				exec($command);
-				$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG);
+				$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
 			}
-			
-			$app->system->web_folder_protection($web['document_root'],true);
-			
+
+			$app->system->web_folder_protection($web['document_root'], true);
+
 		}
-		
-		$app->log("Jailkit Plugin -> delete username:".$data['old']['username'],LOGLEVEL_DEBUG);
-		
-		
+
+		$app->log("Jailkit Plugin -> delete username:".$data['old']['username'], LOGLEVEL_DEBUG);
+
+
 	}
-	
+
 	function _setup_jailkit_chroot()
 	{
-			global $app;
-			
-			//check if the chroot environment is created yet if not create it with a list of program sections from the config
-			if (!is_dir($this->data['new']['dir'].'/etc/jailkit'))
-			{
-				$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
-				$command .= ' '.escapeshellcmd($this->data['new']['dir']);
-				$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
-				exec($command.' 2>/dev/null');
-				
-				$this->app->log("Added jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
-				
-				$this->_add_jailkit_programs();
-				
-				//add bash.bashrc script
-				//we need to collect the domain name to be used as the HOSTNAME in the bashrc script
-				$web = $this->app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".intval($this->data['new']["parent_domain_id"]));
-				
-				$this->app->load('tpl');
-		
-				$tpl = new tpl();
-				$tpl->newTemplate("bash.bashrc.master");
-				
-				$tpl->setVar('jailkit_chroot',true);
-				$tpl->setVar('domain',$web['domain']);
-				$tpl->setVar('home_dir',$this->_get_home_dir(""));
-				
-				$bashrc = escapeshellcmd($this->data['new']['dir']).'/etc/bash.bashrc';
-				if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
-				
-				file_put_contents($bashrc,$tpl->grab());
-				unset($tpl);
-				
-				$this->app->log("Added bashrc script : ".$bashrc,LOGLEVEL_DEBUG);
-				
-				$tpl = new tpl();
-				$tpl->newTemplate("motd.master");
-				
-				$tpl->setVar('domain',$web['domain']);
-				
-				$motd = escapeshellcmd($this->data['new']['dir']).'/var/run/motd';
-				if(@is_file($motd) || @is_link($motd)) unlink($motd);
-				
-				$app->system->file_put_contents($motd,$tpl->grab());
-				
-			}
+		global $app;
+
+		//check if the chroot environment is created yet if not create it with a list of program sections from the config
+		if (!is_dir($this->data['new']['dir'].'/etc/jailkit'))
+		{
+			$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
+			$command .= ' '.escapeshellcmd($this->data['new']['dir']);
+			$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
+			exec($command.' 2>/dev/null');
+
+			$this->app->log("Added jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+			$this->_add_jailkit_programs();
+
+			//add bash.bashrc script
+			//we need to collect the domain name to be used as the HOSTNAME in the bashrc script
+			$web = $this->app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".intval($this->data['new']["parent_domain_id"]));
+
+			$this->app->load('tpl');
+
+			$tpl = new tpl();
+			$tpl->newTemplate("bash.bashrc.master");
+
+			$tpl->setVar('jailkit_chroot', true);
+			$tpl->setVar('domain', $web['domain']);
+			$tpl->setVar('home_dir', $this->_get_home_dir(""));
+
+			$bashrc = escapeshellcmd($this->data['new']['dir']).'/etc/bash.bashrc';
+			if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
+
+			file_put_contents($bashrc, $tpl->grab());
+			unset($tpl);
+
+			$this->app->log("Added bashrc script : ".$bashrc, LOGLEVEL_DEBUG);
+
+			$tpl = new tpl();
+			$tpl->newTemplate("motd.master");
+
+			$tpl->setVar('domain', $web['domain']);
+
+			$motd = escapeshellcmd($this->data['new']['dir']).'/var/run/motd';
+			if(@is_file($motd) || @is_link($motd)) unlink($motd);
+
+			$app->system->file_put_contents($motd, $tpl->grab());
+
+		}
 	}
-	
+
 	function _add_jailkit_programs()
 	{
 		//copy over further programs and its libraries
@@ -259,43 +263,43 @@
 		$command .= ' '.escapeshellcmd($this->data['new']['dir']);
 		$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_programs'].'\'';
 		exec($command.' 2>/dev/null');
-		
-		$this->app->log("Added programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
+
+		$this->app->log("Added programs to jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
 	}
-	
+
 	function _get_home_dir($username)
 	{
-		return str_replace("[username]",escapeshellcmd($username),$this->jailkit_config['jailkit_chroot_home']);
+		return str_replace("[username]", escapeshellcmd($username), $this->jailkit_config['jailkit_chroot_home']);
 	}
-	
+
 	function _add_jailkit_user()
 	{
-			global $app;
-			
-			//add the user to the chroot
-			$jailkit_chroot_userhome = $this->_get_home_dir($this->data['new']['username']);
-			$jailkit_chroot_puserhome = $this->_get_home_dir($this->data['new']['puser']);
-			
-			if(!is_dir($this->data['new']['dir'].'/etc')) mkdir($this->data['new']['dir'].'/etc', 0755);
-			if(!is_file($this->data['new']['dir'].'/etc/passwd')) touch($this->data['new']['dir'].'/etc/passwd', 0755);
-			
-			// IMPORTANT!
-			// ALWAYS create the user. Even if the user was created before
-			// if we check if the user exists, then a update (no shell -> jailkit) will not work
-			// and the user has FULL ACCESS to the root of the server!
-			$command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh';
-			$command .= ' '.escapeshellcmd($this->data['new']['username']);
-			$command .= ' '.escapeshellcmd($this->data['new']['dir']);
-			$command .= ' '.$jailkit_chroot_userhome;
-			$command .= ' '.escapeshellcmd($this->data['new']['shell']);
-			$command .= ' '.$this->data['new']['puser'];
-			$command .= ' '.$jailkit_chroot_puserhome;
-			exec($command.' 2>/dev/null');
-			
-			//* Change the homedir of the shell user and parent user
-			//* We have to do this manually as the usermod command fails 
-			//* when the user is logged in or a command is running under that user
-			/*
+		global $app;
+
+		//add the user to the chroot
+		$jailkit_chroot_userhome = $this->_get_home_dir($this->data['new']['username']);
+		$jailkit_chroot_puserhome = $this->_get_home_dir($this->data['new']['puser']);
+
+		if(!is_dir($this->data['new']['dir'].'/etc')) mkdir($this->data['new']['dir'].'/etc', 0755);
+		if(!is_file($this->data['new']['dir'].'/etc/passwd')) touch($this->data['new']['dir'].'/etc/passwd', 0755);
+
+		// IMPORTANT!
+		// ALWAYS create the user. Even if the user was created before
+		// if we check if the user exists, then a update (no shell -> jailkit) will not work
+		// and the user has FULL ACCESS to the root of the server!
+		$command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh';
+		$command .= ' '.escapeshellcmd($this->data['new']['username']);
+		$command .= ' '.escapeshellcmd($this->data['new']['dir']);
+		$command .= ' '.$jailkit_chroot_userhome;
+		$command .= ' '.escapeshellcmd($this->data['new']['shell']);
+		$command .= ' '.$this->data['new']['puser'];
+		$command .= ' '.$jailkit_chroot_puserhome;
+		exec($command.' 2>/dev/null');
+
+		//* Change the homedir of the shell user and parent user
+		//* We have to do this manually as the usermod command fails
+		//* when the user is logged in or a command is running under that user
+		/*
 			$passwd_file_array = file('/etc/passwd');
 			$passwd_out = '';
 			if(is_array($passwd_file_array)) {
@@ -313,59 +317,59 @@
 					}
 				}
 			}*/
-			
-			$app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
-			$app->system->usermod($this->data['new']['puser'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
-				
-			$this->app->log("Added jailkit user to chroot with command: ".$command,LOGLEVEL_DEBUG);
-						
-			if(!is_dir($this->data['new']['dir'].$jailkit_chroot_userhome)) mkdir(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), 0755, true);
-			$app->system->chown(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), $this->data['new']['username']);
-			$app->system->chgrp(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), $this->data['new']['pgroup']);
-				
-			$this->app->log("Added created jailkit user home in : ".$this->data['new']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG);
-			
-			if(!is_dir($this->data['new']['dir'].$jailkit_chroot_puserhome)) mkdir(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), 0755, true);
-			$app->system->chown(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), $this->data['new']['puser']);
-			$app->system->chgrp(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), $this->data['new']['pgroup']);
-				
-			$this->app->log("Added jailkit parent user home in : ".$this->data['new']['dir'].$jailkit_chroot_puserhome,LOGLEVEL_DEBUG);
-			
+
+		$app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
+		$app->system->usermod($this->data['new']['puser'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
+
+		$this->app->log("Added jailkit user to chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+		if(!is_dir($this->data['new']['dir'].$jailkit_chroot_userhome)) mkdir(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), 0755, true);
+		$app->system->chown(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), $this->data['new']['username']);
+		$app->system->chgrp(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), $this->data['new']['pgroup']);
+
+		$this->app->log("Added created jailkit user home in : ".$this->data['new']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
+
+		if(!is_dir($this->data['new']['dir'].$jailkit_chroot_puserhome)) mkdir(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), 0755, true);
+		$app->system->chown(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), $this->data['new']['puser']);
+		$app->system->chgrp(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), $this->data['new']['pgroup']);
+
+		$this->app->log("Added jailkit parent user home in : ".$this->data['new']['dir'].$jailkit_chroot_puserhome, LOGLEVEL_DEBUG);
+
 
 	}
-	
+
 	//* Update the website root directory permissions depending on the security level
 	function _update_website_security_level() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		// Get the parent website of this shell user
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['new']['parent_domain_id']);
-		
+
 		//* If the security level is set to high
 		if($web_config['security_level'] == 20 && is_array($web)) {
-			$app->system->web_folder_protection($web["document_root"],false);
-			$app->system->chmod($web["document_root"],0755);
-			$app->system->chown($web["document_root"],'root');
-			$app->system->chgrp($web["document_root"],'root');
-			$app->system->web_folder_protection($web["document_root"],true);
+			$app->system->web_folder_protection($web["document_root"], false);
+			$app->system->chmod($web["document_root"], 0755);
+			$app->system->chown($web["document_root"], 'root');
+			$app->system->chgrp($web["document_root"], 'root');
+			$app->system->web_folder_protection($web["document_root"], true);
 		}
-		
+
 	}
-	
+
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
 
 	private function _setup_ssh_rsa() {
 		global $app;
-		$this->app->log("ssh-rsa setup shelluser_jailkit",LOGLEVEL_DEBUG); 
+		$this->app->log("ssh-rsa setup shelluser_jailkit", LOGLEVEL_DEBUG);
 		// Get the client ID, username, and the key
 		$domain_data = $this->app->db->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = '.intval($this->data['new']['parent_domain_id']));
 		$sys_group_data = $this->app->db->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = '.intval($domain_data['sys_groupid']));
@@ -375,38 +379,38 @@
 		$userkey = $client_data['ssh_rsa'];
 		unset($domain_data);
 		unset($client_data);
-		
+
 		// ssh-rsa authentication variables
 		$sshrsa = $this->data['new']['ssh_rsa'];
 		$usrdir = escapeshellcmd($this->data['new']['dir']).'/'.$this->_get_home_dir($this->data['new']['username']);
 		$sshdir = $usrdir.'/.ssh';
 		$sshkeys= $usrdir.'/.ssh/authorized_keys';
-			
+
 		$app->uses('file');
 		$sshrsa = $app->file->unix_nl($sshrsa);
-		$sshrsa = $app->file->remove_blank_lines($sshrsa,0);
-		
+		$sshrsa = $app->file->remove_blank_lines($sshrsa, 0);
+
 		// If this user has no key yet, generate a pair
 		if ($userkey == '' && $id > 0){
 			//Generate ssh-rsa-keys
 			exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
-			
+
 			// use the public key that has been generated
 			$userkey = $app->system->file_get_contents('/tmp/id_rsa.pub');
-			
+
 			// save keypair in client table
 			$this->app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote($app->system->file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote($userkey)."' WHERE client_id = ".$id);
 
 			$app->system->unlink('/tmp/id_rsa');
 			$app->system->unlink('/tmp/id_rsa.pub');
-			$this->app->log("ssh-rsa keypair generated for ".$username,LOGLEVEL_DEBUG);
+			$this->app->log("ssh-rsa keypair generated for ".$username, LOGLEVEL_DEBUG);
 		};
-		
+
 		if (!file_exists($sshkeys)){
 			// add root's key
 			$app->file->mkdirs($sshdir, '0755');
 			if(is_file('/root/.ssh/authorized_keys')) $app->system->file_put_contents($sshkeys, $app->system->file_get_contents('/root/.ssh/authorized_keys'));
-		
+
 			// Remove duplicate keys
 			$existing_keys = @file($sshkeys);
 			$new_keys = explode("\n", $userkey);
@@ -418,32 +422,32 @@
 				}
 			}
 			$final_keys = implode("\n", array_flip(array_flip($new_final_keys_arr)));
-			
+
 			// add the user's key
 			file_put_contents($sshkeys, $final_keys);
 			$app->file->remove_blank_lines($sshkeys);
-			$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys,LOGLEVEL_DEBUG);
+			$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys, LOGLEVEL_DEBUG);
 		}
 		//* Get the keys
 		$existing_keys = file($sshkeys);
 		$new_keys = explode("\n", $sshrsa);
-		$old_keys = explode("\n",$this->data['old']['ssh_rsa']);
-			
+		$old_keys = explode("\n", $this->data['old']['ssh_rsa']);
+
 		//* Remove all old keys
 		if(is_array($old_keys)) {
 			foreach($old_keys as $key => $val) {
-				$k = array_search(trim($val),$existing_keys);
+				$k = array_search(trim($val), $existing_keys);
 				unset($existing_keys[$k]);
 			}
 		}
-			
+
 		//* merge the remaining keys and the ones fom the ispconfig database.
 		if(is_array($new_keys)) {
 			$final_keys_arr = array_merge($existing_keys, $new_keys);
 		} else {
 			$final_keys_arr = $existing_keys;
 		}
-			
+
 		$new_final_keys_arr = array();
 		if(is_array($final_keys_arr) && !empty($final_keys_arr)){
 			foreach($final_keys_arr as $key => $val){
@@ -451,18 +455,19 @@
 			}
 		}
 		$final_keys = implode("\n", array_flip(array_flip($new_final_keys_arr)));
-			
-		// add the custom key 
+
+		// add the custom key
 		$app->system->file_put_contents($sshkeys, $final_keys);
 		$app->file->remove_blank_lines($sshkeys);
-		$this->app->log("ssh-rsa key updated in ".$sshkeys,LOGLEVEL_DEBUG);
-		
+		$this->app->log("ssh-rsa key updated in ".$sshkeys, LOGLEVEL_DEBUG);
+
 		// set proper file permissions
 		exec("chown -R ".escapeshellcmd($this->data['new']['puser']).":".escapeshellcmd($this->data['new']['pgroup'])." ".$sshdir);
 		exec("chmod 700 ".$sshdir);
 		exec("chmod 600 '$sshkeys'");
-		
+
 	}
+
 } // end class
 
 ?>
diff --git a/server/plugins-available/software_update_plugin.inc.php b/server/plugins-available/software_update_plugin.inc.php
index a6b7162..6f12bf8 100644
--- a/server/plugins-available/software_update_plugin.inc.php
+++ b/server/plugins-available/software_update_plugin.inc.php
@@ -29,87 +29,87 @@
 */
 
 class software_update_plugin {
-	
+
 	var $plugin_name = 'software_update_plugin';
 	var $class_name  = 'software_update_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	public function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	public function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('software_update_inst_insert',$this->plugin_name,'process');
+
+		$app->plugins->registerEvent('software_update_inst_insert', $this->plugin_name, 'process');
 		//$app->plugins->registerEvent('software_update_inst_update',$this->plugin_name,'process');
 		//$app->plugins->registerEvent('software_update_inst_delete',$this->plugin_name,'process');
-		
+
 		//* Register for actions
-		$app->plugins->registerAction('os_update',$this->plugin_name,'os_update');
-		
-		
+		$app->plugins->registerAction('os_update', $this->plugin_name, 'os_update');
+
+
 	}
-	
+
 	private function set_install_status($inst_id, $status) {
-        global $app;
-        
-        $app->db->query("UPDATE software_update_inst SET status = '{$status}' WHERE software_update_inst_id = '{$inst_id}'");
-        $app->dbmaster->query("UPDATE software_update_inst SET status = '{$status}' WHERE software_update_inst_id = '{$inst_id}'");
-    }
-    
-	public function process($event_name,$data) {
+		global $app;
+
+		$app->db->query("UPDATE software_update_inst SET status = '{$status}' WHERE software_update_inst_id = '{$inst_id}'");
+		$app->dbmaster->query("UPDATE software_update_inst SET status = '{$status}' WHERE software_update_inst_id = '{$inst_id}'");
+	}
+
+	public function process($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Get the info of the package:
 		$software_update_id = intval($data["new"]["software_update_id"]);
 		$software_update = $app->db->queryOneRecord("SELECT * FROM software_update WHERE software_update_id = '$software_update_id'");
 		$software_package = $app->db->queryOneRecord("SELECT * FROM software_package WHERE package_name = '".$app->db->quote($software_update['package_name'])."'");
-		
+
 		if($software_package['package_type'] == 'ispconfig' && !$conf['software_updates_enabled'] == true) {
-			$app->log('Software Updates not enabled on this server. To enable updates, set $conf["software_updates_enabled"] = true; in config.inc.php',LOGLEVEL_WARN);
-            $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+			$app->log('Software Updates not enabled on this server. To enable updates, set $conf["software_updates_enabled"] = true; in config.inc.php', LOGLEVEL_WARN);
+			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			return false;
 		}
-		
+
 		$installuser = '';
 		if($software_package['package_type'] == 'ispconfig') {
 			$installuser = '';
 		} elseif ($software_package['package_type'] == 'app') {
 			$installuser = 'ispapps';
 		} else {
-			$app->log('package_type not supported',LOGLEVEL_WARN);
-            $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+			$app->log('package_type not supported', LOGLEVEL_WARN);
+			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			return false;
 		}
-		
-		$temp_dir = '/tmp/'.md5 (uniqid (rand()));
-		$app->log("The temp dir is $temp_dir",LOGLEVEL_DEBUG);
+
+		$temp_dir = '/tmp/'.md5(uniqid(rand()));
+		$app->log("The temp dir is $temp_dir", LOGLEVEL_DEBUG);
 		mkdir($temp_dir);
 		if($installuser != '') chown($temp_dir, $installuser);
-		
+
 		if(!is_dir($temp_dir)) {
-			$app->log("Unable to create temp directory.",LOGLEVEL_WARN);
-            $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+			$app->log("Unable to create temp directory.", LOGLEVEL_WARN);
+			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			return false;
 		}
-		
+
 		//* Replace placeholders in download URL
-		$software_update["update_url"] = str_replace('{key}',$software_package['package_key'],$software_update["update_url"]);
-		
+		$software_update["update_url"] = str_replace('{key}', $software_package['package_key'], $software_update["update_url"]);
+
 		//* Download the update package
 		$cmd = "cd $temp_dir && wget ".$software_update["update_url"];
 		if($installuser == '') {
@@ -117,46 +117,46 @@
 		} else {
 			exec("su -c ".escapeshellarg($cmd)." $installuser");
 		}
-		$app->log("Downloading the update file from: ".$software_update["update_url"],LOGLEVEL_DEBUG);
-		
+		$app->log("Downloading the update file from: ".$software_update["update_url"], LOGLEVEL_DEBUG);
+
 		//$url_parts = parse_url($software_update["update_url"]);
 		//$update_filename = basename($url_parts["path"]);
 		//* Find the name of the zip file which contains the app.
 		$tmp_dir_handle = dir($temp_dir);
 		$update_filename = '';
 		while (false !== ($t = $tmp_dir_handle->read())) {
-			if($t != '.' && $t != '..' && is_file($temp_dir.'/'.$t) && substr($t,-4) == '.zip') {
+			if($t != '.' && $t != '..' && is_file($temp_dir.'/'.$t) && substr($t, -4) == '.zip') {
 				$update_filename = $t;
 			}
 		}
 		$tmp_dir_handle->close();
 		unset($tmp_dir_handle);
 		unset($t);
-		
+
 		if($update_filename == '') {
-			$app->log("No package file found. Download failed? Installation aborted.",LOGLEVEL_WARN);
+			$app->log("No package file found. Download failed? Installation aborted.", LOGLEVEL_WARN);
 			exec("rm -rf $temp_dir");
-			$app->log("Deleting the temp directory $temp_dir",LOGLEVEL_DEBUG);
+			$app->log("Deleting the temp directory $temp_dir", LOGLEVEL_DEBUG);
 			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			return false;
 		}
 
-		$app->log("The update filename is $update_filename",LOGLEVEL_DEBUG);
-		
+		$app->log("The update filename is $update_filename", LOGLEVEL_DEBUG);
+
 		if(is_file($temp_dir.'/'.$update_filename)) {
-			
+
 			//* Checking the md5sum
 			if(md5_file($temp_dir.'/'.$update_filename) != $software_update["update_md5"]) {
-				$app->log("The md5 sum of the downloaded file is incorrect. Update aborted.",LOGLEVEL_WARN);
+				$app->log("The md5 sum of the downloaded file is incorrect. Update aborted.", LOGLEVEL_WARN);
 				exec("rm -rf $temp_dir");
-				$app->log("Deleting the temp directory $temp_dir",LOGLEVEL_DEBUG);
+				$app->log("Deleting the temp directory $temp_dir", LOGLEVEL_DEBUG);
 				$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 				return false;
 			} else {
-				$app->log("MD5 checksum of the downloaded file verified.",LOGLEVEL_DEBUG);
+				$app->log("MD5 checksum of the downloaded file verified.", LOGLEVEL_DEBUG);
 			}
-			
-			
+
+
 			//* unpacking the update
 			$cmd = "cd $temp_dir && unzip $update_filename";
 			if($installuser == '') {
@@ -164,133 +164,133 @@
 			} else {
 				exec("su -c ".escapeshellarg($cmd)." $installuser");
 			}
-			
+
 			//* Create a database, if the package requires one
 			if($software_package['package_type'] == 'app' && $software_package['package_requires_db'] == 'mysql') {
-				
+
 				$app->uses('ini_parser');
 				$package_config = $app->ini_parser->parse_ini_string(stripslashes($software_package['package_config']));
-				
+
 				$this->create_app_db($package_config['mysql']);
-				$app->log("Creating the app DB.",LOGLEVEL_DEBUG);
-				
+				$app->log("Creating the app DB.", LOGLEVEL_DEBUG);
+
 				//* Load the sql dump into the database
 				if(is_file($temp_dir.'/setup.sql')) {
 					$db_config = $package_config['mysql'];
-					if(	$db_config['database_user'] != '' &&
+					if( $db_config['database_user'] != '' &&
 						$db_config['database_password'] != '' &&
 						$db_config['database_name'] != '' &&
 						$db_config['database_host'] != '') {
 						system("mysql --default-character-set=utf8 --force -h '".$db_config['database_host']."' -u '".$db_config['database_user']."' ".$db_config['database_name']." < ".escapeshellcmd($temp_dir.'/setup.sql'));
-						$app->log("Loading setup.sql dump into the app db.",LOGLEVEL_DEBUG);
+						$app->log("Loading setup.sql dump into the app db.", LOGLEVEL_DEBUG);
 					}
 				}
-				
+
 			}
-			
+
 			//* Save the package config file as app.ini
 			if($software_package['package_config'] != '') {
-				file_put_contents($temp_dir.'/app.ini',$software_package['package_config']);
-				$app->log("Writing ".$temp_dir.'/app.ini',LOGLEVEL_DEBUG);
+				file_put_contents($temp_dir.'/app.ini', $software_package['package_config']);
+				$app->log("Writing ".$temp_dir.'/app.ini', LOGLEVEL_DEBUG);
 			}
-			
+
 			if(is_file($temp_dir.'/setup.sh')) {
 				// Execute the setup script
 				exec('chmod +x '.$temp_dir.'/setup.sh');
-				$app->log("Executing setup.sh file in directory $temp_dir",LOGLEVEL_DEBUG);
+				$app->log("Executing setup.sh file in directory $temp_dir", LOGLEVEL_DEBUG);
 				$cmd = 'cd '.$temp_dir.' && ./setup.sh > package_install.log';
 				if($installuser == '') {
 					exec($cmd);
 				} else {
 					exec("su -c ".escapeshellarg($cmd)." $installuser");
 				}
-                
-                $log_data = @file_get_contents("{$temp_dir}/package_install.log");
-                if(preg_match("'.*\[OK\]\s*$'is", $log_data)) {
-                    $app->log("Installation successful",LOGLEVEL_DEBUG);
-                    $app->log($log_data,LOGLEVEL_DEBUG);
-                    $this->set_install_status($data["new"]["software_update_inst_id"], "installed");
-                } else {
-                    $app->log("Installation failed:\n\n" . $log_data,LOGLEVEL_WARN);
-                    $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
-                }
+
+				$log_data = @file_get_contents("{$temp_dir}/package_install.log");
+				if(preg_match("'.*\[OK\]\s*$'is", $log_data)) {
+					$app->log("Installation successful", LOGLEVEL_DEBUG);
+					$app->log($log_data, LOGLEVEL_DEBUG);
+					$this->set_install_status($data["new"]["software_update_inst_id"], "installed");
+				} else {
+					$app->log("Installation failed:\n\n" . $log_data, LOGLEVEL_WARN);
+					$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+				}
 			} else {
-				$app->log("setup.sh file not found",LOGLEVEL_ERROR);
-                $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+				$app->log("setup.sh file not found", LOGLEVEL_ERROR);
+				$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			}
 		} else {
-			$app->log("Download of the update file failed",LOGLEVEL_WARN);
-            $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+			$app->log("Download of the update file failed", LOGLEVEL_WARN);
+			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 		}
-		
+
 		if($temp_dir != '' && $temp_dir != '/') exec("rm -rf $temp_dir");
-		$app->log("Deleting the temp directory $temp_dir",LOGLEVEL_DEBUG);
+		$app->log("Deleting the temp directory $temp_dir", LOGLEVEL_DEBUG);
 	}
-	
+
 	private function create_app_db($db_config) {
 		global $app, $conf;
-		
-		if(	$db_config['database_user'] != '' &&
+
+		if( $db_config['database_user'] != '' &&
 			$db_config['database_password'] != '' &&
 			$db_config['database_name'] != '' &&
 			$db_config['database_host'] != '') {
-			
-			if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
+
+			if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
 				return;
 			}
-			
+
 			if($db_config['database_user'] == 'root') {
-				$app->log('User root not allowed for App databases',LOGLEVEL_WARNING);
+				$app->log('User root not allowed for App databases', LOGLEVEL_WARNING);
 				return;
 			}
-		
+
 			//* Connect to the database
 			$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
 			if (!$link) {
-				$app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_ERROR);
+				$app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_ERROR);
 				return;
 			}
 
 			$query_charset_table = '';
 
 			//* Create the new database
-			if (mysql_query('CREATE DATABASE '.mysql_real_escape_string($db_config['database_name']).$query_charset_table,$link)) {
-				$app->log('Created MySQL database: '.$db_config['database_name'],LOGLEVEL_DEBUG);
+			if (mysql_query('CREATE DATABASE '.mysql_real_escape_string($db_config['database_name']).$query_charset_table, $link)) {
+				$app->log('Created MySQL database: '.$db_config['database_name'], LOGLEVEL_DEBUG);
 			} else {
-				$app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_ERROR);
-			}
-			
-			if(mysql_query("GRANT ALL ON ".mysql_real_escape_string($db_config['database_name'],$link).".* TO '".mysql_real_escape_string($db_config['database_user'],$link)."'@'".$db_config['database_host']."' IDENTIFIED BY '".mysql_real_escape_string($db_config['database_password'],$link)."';",$link)) {
-			$app->log('Created MySQL user: '.$db_config['database_user'],LOGLEVEL_DEBUG);
-			} else {
-				$app->log('Unable to create database user'.$db_config['database_user'].' '.mysql_error($link),LOGLEVEL_ERROR);
+				$app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_ERROR);
 			}
 
-			mysql_query("FLUSH PRIVILEGES;",$link);
+			if(mysql_query("GRANT ALL ON ".mysql_real_escape_string($db_config['database_name'], $link).".* TO '".mysql_real_escape_string($db_config['database_user'], $link)."'@'".$db_config['database_host']."' IDENTIFIED BY '".mysql_real_escape_string($db_config['database_password'], $link)."';", $link)) {
+				$app->log('Created MySQL user: '.$db_config['database_user'], LOGLEVEL_DEBUG);
+			} else {
+				$app->log('Unable to create database user'.$db_config['database_user'].' '.mysql_error($link), LOGLEVEL_ERROR);
+			}
+
+			mysql_query("FLUSH PRIVILEGES;", $link);
 			mysql_close($link);
-			
+
 		}
-		
+
 	}
-	
+
 	//* Operating system update
-	public function os_update($action_name,$data) {
+	public function os_update($action_name, $data) {
 		global $app;
-		 
+
 		//** Debian and compatible Linux distributions
 		if(file_exists('/etc/debian_version')) {
 			exec("aptitude update");
 			exec("aptitude safe-upgrade -y");
-			$app->log('Execeuted Debian / Ubuntu update',LOGLEVEL_DEBUG);
+			$app->log('Execeuted Debian / Ubuntu update', LOGLEVEL_DEBUG);
 		}
 
 		//** Gentoo Linux
 		if(file_exists('/etc/gentoo-release')) {
 			exec("glsa-check -f --nocolor affected");
-			$app->log('Execeuted Gentoo update',LOGLEVEL_DEBUG);
+			$app->log('Execeuted Gentoo update', LOGLEVEL_DEBUG);
 		}
-		
+
 		return 'ok';
 	}
 
diff --git a/server/plugins-available/squid_plugin.inc.php b/server/plugins-available/squid_plugin.inc.php
index 7e65b29..ef77512 100644
--- a/server/plugins-available/squid_plugin.inc.php
+++ b/server/plugins-available/squid_plugin.inc.php
@@ -29,110 +29,110 @@
 */
 
 class squid_plugin {
-	
+
 	var $plugin_name = 'squid_plugin';
 	var $class_name = 'squid_plugin';
-	
+
 	// private variables
 	var $action = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if(isset($conf['services']['proxy']) &&$conf['services']['proxy'] == true && isset($conf['squid']['installed']) && $conf['squid']['installed'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		
-		$app->plugins->registerEvent('proxy_reverse_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('proxy_reverse_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('proxy_reverse_delete',$this->plugin_name,'delete');
-		
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
-		
 
-		
+
+		$app->plugins->registerEvent('proxy_reverse_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('proxy_reverse_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('proxy_reverse_delete', $this->plugin_name, 'delete');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
+
+
+
 	}
-	
-	
-	
-	
-	function insert($event_name,$data) {
+
+
+
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		
+
+
 		// just run the update function
-		$this->update($event_name,$data);
-		
-		
+		$this->update($event_name, $data);
+
+
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$domains = $this->_getSquidDomains($app);
 		$rules = $this->_getSquidRewriteRules($app);
-		
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate("squidRewriteRules.py.master");
-		if (!empty($rules))$tpl->setLoop('squid_rewrite_rules',$rules);
-		file_put_contents('/etc/squid/squidRewriteRules.py',$tpl->grab());
+		if (!empty($rules))$tpl->setLoop('squid_rewrite_rules', $rules);
+		file_put_contents('/etc/squid/squidRewriteRules.py', $tpl->grab());
 		unset($tpl);
-		$app->log('Writing squid rewrite configuration to /etc/squid/squidRewriteRules.py',LOGLEVEL_DEBUG);
-		
-		
+		$app->log('Writing squid rewrite configuration to /etc/squid/squidRewriteRules.py', LOGLEVEL_DEBUG);
+
+
 		$tpl = new tpl();
 		$tpl->newTemplate("domains.txt.master");
-		$tpl->setLoop('squid_domains',$domains);
-		file_put_contents('/etc/squid/domains.txt',$tpl->grab());
+		$tpl->setLoop('squid_domains', $domains);
+		file_put_contents('/etc/squid/domains.txt', $tpl->grab());
 		unset($tpl);
-		$app->log('Writing squid domains configuration to /etc/squid/domains.txt',LOGLEVEL_DEBUG);
-		
-		
+		$app->log('Writing squid domains configuration to /etc/squid/domains.txt', LOGLEVEL_DEBUG);
+
+
 		// request a httpd reload when all records have been processed
-		$app->services->restartServiceDelayed('squid','restart');
-		
+		$app->services->restartServiceDelayed('squid', 'restart');
+
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server configuration options
 
 		// just run the update function
-		$this->update($event_name,$data);
-		
+		$this->update($event_name, $data);
+
 	}
-	
+
 	function _getSquidDomains($app)
 	{
 		$records = $app->dbmaster->queryAllRecords("SELECT ds.origin, dr.name, IF(origin=name,true,false) AS isRoot FROM dns_soa ds inner join dns_rr dr ON ds.id=dr.zone WHERE ds.active='Y' AND dr.type IN ('A','CNAME') AND dr.name NOT IN ('mail','ns1')");
 		$domains = array();
 		foreach ($records as $record) {
-			
-			$origin = substr($record["origin"],0,-1);
+
+			$origin = substr($record["origin"], 0, -1);
 			if ($record["isRoot"])
 			{
 				array_push($domains, array("domain" => $origin));
@@ -141,30 +141,30 @@
 			}
 
 		}
-		
+
 		return $domains;
-		
+
 	}
-	
+
 	function _getSquidRewriteRules($app)
 	{
 		$rules = array();
-		
-		$rules = $app->db->queryAllRecords("SELECT rewrite_url_src, rewrite_url_dest FROM squid_reverse ORDER BY rewrite_id ASC");		
+
+		$rules = $app->db->queryAllRecords("SELECT rewrite_url_src, rewrite_url_dest FROM squid_reverse ORDER BY rewrite_id ASC");
 		$web_domains = $app->db->queryAllRecords("SELECT wd.subdomain, wd.domain, si.ip_address  FROM web_domain wd INNER JOIN server s USING(server_id) INNER JOIN server_ip si USING(server_id)");
-		
+
 		foreach ($web_domains as $domain) {
 			if ($domain["subdomain"] == "www") {
-				array_push($rules,array("rewrite_url_src"=>"^http://www.".$domain["domain"]."/(.*)","rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
-				array_push($rules,array("rewrite_url_src"=>"^http://".$domain["domain"]."/(.*)","rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));		
+				array_push($rules, array("rewrite_url_src"=>"^http://www.".$domain["domain"]."/(.*)", "rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
+				array_push($rules, array("rewrite_url_src"=>"^http://".$domain["domain"]."/(.*)", "rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
 			}  else {
-				array_push($rules,array("rewrite_url_src"=>"^http://www.".$domain["domain"]."/(.*)","rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
-			}	
+				array_push($rules, array("rewrite_url_src"=>"^http://www.".$domain["domain"]."/(.*)", "rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
+			}
 		}
 		return $rules;
 	}
 
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/webmail_symlink_plugin.inc.php b/server/plugins-available/webmail_symlink_plugin.inc.php
index 8530fc4..43cca9b 100644
--- a/server/plugins-available/webmail_symlink_plugin.inc.php
+++ b/server/plugins-available/webmail_symlink_plugin.inc.php
@@ -3,7 +3,7 @@
 /*
 Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh
 All rights reserved.
-Modification (c) 2009, Marius Cramer, pixcept KG 
+Modification (c) 2009, Marius Cramer, pixcept KG
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -30,91 +30,91 @@
 */
 
 class webmail_symlink_plugin {
-	
+
 	var $plugin_name = 'webmail_symlink_plugin';
 	var $class_name = 'webmail_symlink_plugin';
-	
-    var $action;
-    
+
+	var $action;
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
-        return false;
-		
+
+		return false;
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($this->action != 'insert') $this->action = 'update';
-		
+
 		if($data["new"]["type"] != "vhost" && $data["new"]["parent_domain_id"] > 0) {
-			
+
 			$old_parent_domain_id = intval($data["old"]["parent_domain_id"]);
 			$new_parent_domain_id = intval($data["new"]["parent_domain_id"]);
-			
+
 			// If the parent_domain_id has been chenged, we will have to update the old site as well.
 			if($this->action == 'update' && $data["new"]["parent_domain_id"] != $data["old"]["parent_domain_id"]) {
 				$tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$old_parent_domain_id." AND active = 'y'");
 				$data["new"] = $tmp;
 				$data["old"] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
-			
+
 			// This is not a vhost, so we need to update the parent record instead.
 			$tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$new_parent_domain_id." AND active = 'y'");
 			$data["new"] = $tmp;
 			$data["old"] = $tmp;
 			$this->action = 'update';
 		}
-		
+
 		if($data["new"]["document_root"] == '') {
-			$app->log("document_root not set",LOGLEVEL_WARN);
+			$app->log("document_root not set", LOGLEVEL_WARN);
 			return 0;
 		}
-		
-        $symlink = true;
-        if($data["new"]["php"] == "suphp") $symlink = false;
-        elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
-        elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
-        
-        
-        if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true);
-        if($symlink == false) {
-            if(is_link($data["new"]["document_root"].'/web/webmail')) unlink($data["new"]["document_root"].'/web/webmail');
-        } else {
-            if(!is_link($data["new"]["document_root"]."/web/webmail")) symlink('/var/www/webmail',$data["new"]["document_root"].'/web/webmail');
-            else symlink('/var/www/webmail',$data["new"]["document_root"].'/web/webmail');
-        }
+
+		$symlink = true;
+		if($data["new"]["php"] == "suphp") $symlink = false;
+		elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
+		elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
+
+
+		if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true);
+		if($symlink == false) {
+			if(is_link($data["new"]["document_root"].'/web/webmail')) unlink($data["new"]["document_root"].'/web/webmail');
+		} else {
+			if(!is_link($data["new"]["document_root"]."/web/webmail")) symlink('/var/www/webmail', $data["new"]["document_root"].'/web/webmail');
+			else symlink('/var/www/webmail', $data["new"]["document_root"].'/web/webmail');
+		}
 	}
-	
+
 
 } // end class
 
diff --git a/server/scripts/ispconfig_update.php b/server/scripts/ispconfig_update.php
index 58d8ef5..6843e7b 100644
--- a/server/scripts/ispconfig_update.php
+++ b/server/scripts/ispconfig_update.php
@@ -29,8 +29,8 @@
 */
 
 function sread() {
-    $input = fgets(STDIN);
-    return rtrim($input);
+	$input = fgets(STDIN);
+	return rtrim($input);
 }
 
 function swrite($text = '') {
@@ -42,53 +42,53 @@
 }
 
 function simple_query($query, $answers, $default)
-{		
-		$finished = false;
-		do {
-			$answers_str = implode(',', $answers);
-			swrite($query.' ('.$answers_str.') ['.$default.']: ');
-			$input = sread();
-			
-			//* Stop the installation
-			if($input == 'quit') {
-				swriteln("Installation terminated by user.\n");
-				die();
-			}
-			
-			//* Select the default
-			if($input == '') {
-				$answer = $default;
-				$finished = true;
-			}
-			
-            //* Set answer id valid
-			if(in_array($input, $answers)) {
-				$answer = $input;
-				$finished = true;
-			}
-			
-		} while ($finished == false);
-		swriteln();
-		return $answer;
+{
+	$finished = false;
+	do {
+		$answers_str = implode(',', $answers);
+		swrite($query.' ('.$answers_str.') ['.$default.']: ');
+		$input = sread();
+
+		//* Stop the installation
+		if($input == 'quit') {
+			swriteln("Installation terminated by user.\n");
+			die();
+		}
+
+		//* Select the default
+		if($input == '') {
+			$answer = $default;
+			$finished = true;
+		}
+
+		//* Set answer id valid
+		if(in_array($input, $answers)) {
+			$answer = $input;
+			$finished = true;
+		}
+
+	} while ($finished == false);
+	swriteln();
+	return $answer;
 }
 
-require_once('/usr/local/ispconfig/server/lib/config.inc.php');
+require_once '/usr/local/ispconfig/server/lib/config.inc.php';
 
 
-echo "\n\n".str_repeat('-',80)."\n";
-echo " _____ ___________   _____              __ _       
-|_   _/  ___| ___ \ /  __ \            / _(_)      
-  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _ 
+echo "\n\n".str_repeat('-', 80)."\n";
+echo " _____ ___________   _____              __ _
+|_   _/  ___| ___ \ /  __ \            / _(_)
+  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _
   | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |
  _| |_/\__/ / |     | \__/\ (_) | | | | | | | (_| |
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, |
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Update  \n\n";
 echo "Please choose the update method. For production systems select 'stable'. \nThe update from svn is only for development systems and may break your current setup.\nNote: Update all slave server, before you update master server.\n\n";
 
-$method = simple_query('Select update method', array('stable','svn'), 'stable');
+$method = simple_query('Select update method', array('stable', 'svn'), 'stable');
 
 if($method == 'stable') {
 	$new_version = @file_get_contents('http://www.ispconfig.org/downloads/ispconfig3_version.txt') or die('Unable to retrieve version file.');
@@ -106,4 +106,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/server/server.php b/server/server.php
index 3415f6e..e4ebb5b 100644
--- a/server/server.php
+++ b/server/server.php
@@ -28,8 +28,8 @@
  */
 
 define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"]));
-require(SCRIPT_PATH."/lib/config.inc.php");
-require(SCRIPT_PATH."/lib/app.inc.php");
+require SCRIPT_PATH."/lib/config.inc.php";
+require SCRIPT_PATH."/lib/app.inc.php";
 
 set_time_limit(0);
 ini_set('error_reporting', E_ALL & ~E_NOTICE);
@@ -42,16 +42,16 @@
  */
 if ($app->dbmaster->connect_error == NULL) {
 	$server_db_record = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = " . $conf['server_id']);
-	
+
 	if(!is_array($server_db_record)) die('Unable to load the server configuration from database.');
-	
-	//* Get the number of the last processed datalog_id, if the id of the local server 
+
+	//* Get the number of the last processed datalog_id, if the id of the local server
 	//* is > then the one of the remote system, then use the local ID as we might not have
 	//* reached the remote server during the last run then.
 	$local_server_db_record = $app->db->queryOneRecord("SELECT * FROM server WHERE server_id = " . $conf['server_id']);
-	$conf['last_datalog_id'] = (int) max($server_db_record['updated'],$local_server_db_record['updated']);
+	$conf['last_datalog_id'] = (int) max($server_db_record['updated'], $local_server_db_record['updated']);
 	unset($local_server_db_record);
-	
+
 	$conf['mirror_server_id'] = (int) $server_db_record['mirror_server_id'];
 
 	// Load the ini_parser
@@ -62,21 +62,21 @@
 
 	// Set the loglevel
 	$conf['log_priority'] = intval($conf['serverconfig']['server']['loglevel']);
-	
+
 	// Set level from which admin should be notified by email
 	if(!isset($conf['serverconfig']['server']['admin_notify_events']) || $conf['serverconfig']['server']['admin_notify_events'] == '') $conf['serverconfig']['server']['admin_notify_events'] = 3;
 	$conf['admin_notify_priority'] = intval($conf['serverconfig']['server']['admin_notify_events']);
 
 	// we do not need this variable anymore
 	unset($server_db_record);
-	
+
 	// retrieve admin email address for notifications
 	//$sys_ini = $app->dbmaster->queryOneRecord("SELECT * FROM sys_ini WHERE sysini_id = 1");
 	$sys_ini = $app->db->queryOneRecord("SELECT * FROM sys_ini WHERE sysini_id = 1");
 	$conf['sys_ini'] = $app->ini_parser->parse_ini_string(stripslashes($sys_ini['config']));
 	$conf['admin_mail'] = $conf['sys_ini']['mail']['admin_mail'];
 	unset($sys_ini);
-	
+
 	/*
 	 * Save the rescue-config, maybe we need it (because the database is down)
 	 */
@@ -87,14 +87,14 @@
 
 	// protect the file
 	chmod(dirname(__FILE__) . "/temp/rescue_module_serverconfig.ser.txt", 0600);
-	
+
 } else {
 	/*
 	 * The master-db is not available.
 	 * Problem: because we need to start the rescue-module (to rescue the DB if this IS the
 	 * server, the master-db is running at) we have to initialize some config...
 	 */
-	
+
 	/*
 	 * If there is a temp-file with the data we could get from the database, then we use it
 	 */
@@ -102,14 +102,14 @@
 	if (file_exists(dirname(__FILE__) . "/temp/rescue_module_serverconfig.ser.txt")){
 		$tmp = unserialize(file_get_contents(dirname(__FILE__) . "/temp/rescue_module_serverconfig.ser.txt"));
 	}
-	
+
 	// maxint at 32 and 64 bit systems
-	$conf['last_datalog_id'] = intval('9223372036854775807'); 
+	$conf['last_datalog_id'] = intval('9223372036854775807');
 
 	// no mirror
-	$conf['mirror_server_id'] = 0; 
+	$conf['mirror_server_id'] = 0;
 
-	// Set the loglevel 
+	// Set the loglevel
 	$conf['log_priority'] = (isset($tmp['serverconfig']['server']['loglevel']))? $tmp['serverconfig']['server']['loglevel'] : LOGLEVEL_ERROR;
 	/*
 	 * Set the configuration to rescue the database
@@ -147,6 +147,8 @@
 $app->log('Set Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock', LOGLEVEL_DEBUG);
 
 /** Do we need to start the core-modules */
+
+
 $needStartCore = true;
 
 /*
@@ -163,7 +165,7 @@
 
 	$tmp_num_records = $tmp_rec['number'];
 	unset($tmp_rec);
-	
+
 	//** Load required base-classes
 	$app->uses('modules,plugins,file,services,system');
 	//** Load the modules that are in the mods-enabled folder
@@ -182,7 +184,7 @@
 	$app->services->processDelayedActions();
 	//** All modules are already loaded and processed, so there is NO NEED to load the core once again...
 	$needStartCore = false;
-	
+
 } else {
 	if ($app->db->connect->connect_error == NULL) {
 		$app->log('Unable to connect to local server.' . $app->db->errorMessage, LOGLEVEL_WARN);

--
Gitblit v1.9.1