From 6de0aab86c64d68578258139bea75cc6221882f7 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Wed, 07 Mar 2012 09:48:47 -0500
Subject: [PATCH] - Improved support for multiple PHP versions. Additional PHP versions have now their own form and database table.

---
 interface/web/admin/templates/server_php_fastcgi_edit.htm    |   26 ++
 interface/web/admin/templates/server_php_name_edit.htm       |   34 ++
 interface/web/admin/lib/lang/de_server_php.lng               |   16 +
 interface/web/admin/lib/lang/en_server_php_list.lng          |    7 
 install/tpl/server.ini.master                                |    1 
 interface/web/admin/form/server_config.tform.php             |    8 
 install/sql/incremental/upd_0031.sql                         |   17 +
 interface/web/admin/lib/lang/de_server_config.lng            |    2 
 install/sql/ispconfig3.sql                                   |   25 +
 server/plugins-available/apache2_plugin.inc.php              |    2 
 interface/web/admin/templates/server_php_list.htm            |   55 ++++
 interface/web/admin/lib/lang/en.lng                          |    1 
 interface/web/admin/form/server_php.tform.php                |  194 ++++++++++++++
 interface/web/admin/list/server_php.list.php                 |   82 ++++++
 interface/web/admin/server_php_del.php                       |   37 +-
 interface/web/admin/templates/server_config_fastcgi_edit.htm |    4 
 interface/web/sites/ajax_get_json.php                        |   16 +
 interface/web/admin/lib/lang/en_server_config.lng            |    2 
 interface/web/sites/web_domain_edit.php                      |   41 +-
 interface/web/admin/lib/lang/en_server_php.lng               |   16 +
 interface/web/admin/server_php_list.php                      |   34 +-
 interface/web/admin/lib/lang/de.lng                          |    1 
 interface/web/admin/lib/lang/de_server_ip.lng                |    6 
 interface/web/admin/server_php_edit.php                      |   73 +++++
 interface/web/admin/templates/server_php_fpm_edit.htm        |   30 ++
 interface/web/admin/lib/lang/de_server_php_list.lng          |    7 
 interface/web/admin/lib/lang/de_server_ip_list.lng           |    2 
 interface/web/admin/lib/module.conf.php                      |    5 
 interface/web/sites/templates/web_domain_edit.htm            |   24 +
 29 files changed, 683 insertions(+), 85 deletions(-)

diff --git a/install/sql/incremental/upd_0031.sql b/install/sql/incremental/upd_0031.sql
index f14e126..0fb25a5 100644
--- a/install/sql/incremental/upd_0031.sql
+++ b/install/sql/incremental/upd_0031.sql
@@ -1 +1,18 @@
+CREATE TABLE `server_php` (
+  `server_php_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `server_id` int(11) unsigned NOT NULL DEFAULT '0',
+  `client_id` int(11) unsigned NOT NULL DEFAULT '0',
+  `name` varchar(255) DEFAULT NULL,
+  `php_fastcgi_binary` varchar(255) DEFAULT NULL,
+  `php_fastcgi_ini_dir` varchar(255) DEFAULT NULL,
+  `php_fpm_init_script` varchar(255) DEFAULT NULL,
+  `php_fpm_ini_dir` varchar(255) DEFAULT NULL,
+  `php_fpm_pool_dir` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`server_php_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 ALTER TABLE `web_domain` ADD `fastcgi_php_version` VARCHAR( 255 ) NULL DEFAULT NULL;
\ No newline at end of file
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index a755adf..2612d7e 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -1010,6 +1010,31 @@
 
 -- --------------------------------------------------------
 
+
+--
+-- Table structure for table  `server_php`
+--
+
+CREATE TABLE `server_php` (
+  `server_php_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `server_id` int(11) unsigned NOT NULL DEFAULT '0',
+  `client_id` int(11) unsigned NOT NULL DEFAULT '0',
+  `name` varchar(255) DEFAULT NULL,
+  `php_fastcgi_binary` varchar(255) DEFAULT NULL,
+  `php_fastcgi_ini_dir` varchar(255) DEFAULT NULL,
+  `php_fpm_init_script` varchar(255) DEFAULT NULL,
+  `php_fpm_ini_dir` varchar(255) DEFAULT NULL,
+  `php_fpm_pool_dir` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`server_php_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+-- --------------------------------------------------------
+
 --
 -- Table structure for table `shell_user`
 --
diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master
index 9f6f30c..275fa7a 100644
--- a/install/tpl/server.ini.master
+++ b/install/tpl/server.ini.master
@@ -90,7 +90,6 @@
 fastcgi_max_requests=5000
 fastcgi_bin=/usr/bin/php-cgi
 fastcgi_config_syntax=1
-fastcgi_additional_php_versions=
 
 [jailkit]
 jailkit_chroot_home=/home/[username]
diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php
index facc193..24f3f18 100644
--- a/interface/web/admin/form/server_config.tform.php
+++ b/interface/web/admin/form/server_config.tform.php
@@ -867,14 +867,6 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
-		'fastcgi_additional_php_versions' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
 	##################################
 	# ENDE Datatable fields
 	##################################
diff --git a/interface/web/admin/form/server_php.tform.php b/interface/web/admin/form/server_php.tform.php
new file mode 100644
index 0000000..e5fcb7b
--- /dev/null
+++ b/interface/web/admin/form/server_php.tform.php
@@ -0,0 +1,194 @@
+<?php
+
+/*
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*
+	Form Definition
+
+	Tabellendefinition
+
+	Datentypen:
+	- INTEGER (Wandelt Ausdr�cke in Int um)
+	- DOUBLE
+	- CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
+	- VARCHAR (kein weiterer Format Check)
+	- TEXT (kein weiterer Format Check)
+	- DATE (Datumsformat, Timestamp Umwandlung)
+
+	Formtype:
+	- TEXT (normales Textfeld)
+	- TEXTAREA (normales Textfeld)
+	- PASSWORD (Feldinhalt wird nicht angezeigt)
+	- SELECT (Gibt Werte als option Feld aus)
+	- RADIO
+	- CHECKBOX
+	- FILE
+
+	VALUE:
+	- Wert oder Array
+
+	Hinweis:
+	Das ID-Feld ist nicht bei den Table Values einzuf�gen.
+
+
+*/
+
+$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
+$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+
+$form["tabs"]['php_name'] = array (
+	'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'		=> ''
+		),
+		'client_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => "SELECT client_id,CONCAT(contact_name,' :: ',username) as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
+										'keyfield'=> 'client_id',
+										'valuefield'=> 'name'
+									 ),
+			'value'		=> array(0 => ' ')
+		),
+		'name' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators' => array(0 => array('type' => 'NOTEMPTY',
+											 'errmsg' => 'server_php_name_error_empty'),
+			),
+			'default'	=> '',
+			'value'		=> '',
+			'separator'	=> '',
+			'width'		=> '40',
+			'maxlength'	=> '255'
+		),
+	##################################
+	# ENDE Datenbankfelder
+	##################################
+	)
+);
+
+$form["tabs"]['php_fastcgi'] = array(
+	'title' => "FastCGI Settings",
+	'width' => 80,
+	'template' => "templates/server_php_fastcgi_edit.htm",
+	'fields' => array(
+		##################################
+		# Begin Datatable fields
+		##################################
+		'php_fastcgi_binary' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'php_fastcgi_ini_dir' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+$form["tabs"]['php_fpm'] = array(
+	'title' => "PHP-FPM Settings",
+	'width' => 80,
+	'template' => "templates/server_php_fpm_edit.htm",
+	'fields' => array(
+		##################################
+		# Begin Datatable fields
+		##################################
+		'php_fpm_init_script' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'php_fpm_ini_dir' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'php_fpm_pool_dir' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/lang/de.lng b/interface/web/admin/lib/lang/de.lng
index 3cea352..d638c99 100644
--- a/interface/web/admin/lib/lang/de.lng
+++ b/interface/web/admin/lib/lang/de.lng
@@ -40,4 +40,5 @@
 $wb['Do ISPConfig-Update'] = 'Do ISPConfig-Update';
 $wb['1001'] = 'Username or password is empty.';
 $wb['1002'] = 'Username or password is wrong.';
+$wb['Additional PHP Versions'] = 'Zusätzliche PHP-Versionen';
 ?>
diff --git a/interface/web/admin/lib/lang/de_server_config.lng b/interface/web/admin/lib/lang/de_server_config.lng
index 7911e94..fd78f1b 100644
--- a/interface/web/admin/lib/lang/de_server_config.lng
+++ b/interface/web/admin/lib/lang/de_server_config.lng
@@ -153,6 +153,4 @@
 $wb['add_web_users_to_sshusers_group_txt'] = 'Add web users to -sshusers- group';
 $wb['connect_userid_to_webid_txt'] = 'Connect Linux userid to webid';
 $wb['connect_userid_to_webid_start_txt'] = 'Start ID for userid/webid connect';
-$wb["fastcgi_additional_php_versions_txt"] = 'Zusätzliche PHP-Versionen';
-$wb["fastcgi_additional_php_versions_hint_txt"] = 'Format:<br>&lt;name&gt;;&lt;path_to_executable&gt;;&lt;path_to_php.ini_dir&gt;<br>z.B.:<br>PHP 5.2.17;/opt/php52/bin/php-cgi;/opt/php52/etc/';
 ?>
diff --git a/interface/web/admin/lib/lang/de_server_ip.lng b/interface/web/admin/lib/lang/de_server_ip.lng
index ba94772..c432cbb 100644
--- a/interface/web/admin/lib/lang/de_server_ip.lng
+++ b/interface/web/admin/lib/lang/de_server_ip.lng
@@ -4,8 +4,8 @@
 $wb['virtualhost_txt'] = 'HTTP NameVirtualHost';
 $wb['ip_error_wrong'] = 'Das IP Adresse ist ungültig';
 $wb['ip_error_unique'] = 'Das IP Adresse müss einzigartig sein';
-$wb['client_id_txt'] = 'Client';
-$wb['ip_type_txt'] = 'Type';
+$wb['client_id_txt'] = 'Kunde';
+$wb['ip_type_txt'] = 'Typ';
 $wb['virtualhost_port_txt'] = 'HTTP Ports';
-$wb['error_port_syntax'] = 'Invalid chars in port field, please enter only comma separated numbers. Example: 80,443';
+$wb['error_port_syntax'] = 'Ungültige Zeichen im Ports-Feld. Bitte geben Sie nur komma-separierte Nummern an. Beispiel: 80,443';
 ?>
diff --git a/interface/web/admin/lib/lang/de_server_ip_list.lng b/interface/web/admin/lib/lang/de_server_ip_list.lng
index 54deb76..1d792df 100644
--- a/interface/web/admin/lib/lang/de_server_ip_list.lng
+++ b/interface/web/admin/lib/lang/de_server_ip_list.lng
@@ -3,7 +3,7 @@
 $wb['server_id_txt'] = 'Server';
 $wb['ip_address_txt'] = 'IP Adresse';
 $wb['add_new_record_txt'] = 'Neue IP Adresse hinzufügen';
-$wb['client_id_txt'] = 'Client';
+$wb['client_id_txt'] = 'Kunde';
 $wb['virtualhost_txt'] = 'HTTP Vhost';
 $wb['virtualhost_port_txt'] = 'HTTP Ports';
 $wb['ip_type_txt'] = 'Type';
diff --git a/interface/web/admin/lib/lang/de_server_php.lng b/interface/web/admin/lib/lang/de_server_php.lng
new file mode 100644
index 0000000..d28c534
--- /dev/null
+++ b/interface/web/admin/lib/lang/de_server_php.lng
@@ -0,0 +1,16 @@
+<?php
+$wb['server_id_txt'] = 'Server';
+$wb['client_id_txt'] = 'Kunde';
+$wb['name_txt'] = 'PHP-Name';
+$wb['Name'] = 'Name';
+$wb['FastCGI Settings'] = 'FastCGI-Einstellungen';
+$wb['PHP-FPM Settings'] = 'PHP-FPM-Einstellungen';
+$wb['Additional PHP Versions'] = 'Zusätzliche PHP-Versionen';
+$wb['Form to edit additional PHP versions'] = 'Formular, um zusätzliche PHP-Versionen hinzuzufügen';
+$wb['server_php_name_error_empty'] = 'Das Name-Feld darf nicht leer sein.';
+$wb['php_fastcgi_binary_txt'] = 'Pfad zum PHP-FastCGI-Binary';
+$wb['php_fastcgi_ini_dir_txt'] = 'Pfad zum php.ini-Verzeichnis';
+$wb['php_fpm_init_script_txt'] = 'Pfad zum PHP-FPM-Init-Skript';
+$wb['php_fpm_ini_dir_txt'] = 'Pfad zum php.ini-Verzeichnis';
+$wb['php_fpm_pool_dir_txt'] = 'Pfad zum PHP-FPM-Pool-Verzeichnis';
+?>
diff --git a/interface/web/admin/lib/lang/de_server_php_list.lng b/interface/web/admin/lib/lang/de_server_php_list.lng
new file mode 100644
index 0000000..0176bf8
--- /dev/null
+++ b/interface/web/admin/lib/lang/de_server_php_list.lng
@@ -0,0 +1,7 @@
+<?php
+$wb['list_head_txt'] = 'Zusätzliche PHP-Versionen';
+$wb['server_id_txt'] = 'Server';
+$wb['add_new_record_txt'] = 'Neue PHP-Version hinzufügen';
+$wb['client_id_txt'] = 'Kunde';
+$wb['name_txt'] = 'PHP-Name';
+?>
diff --git a/interface/web/admin/lib/lang/en.lng b/interface/web/admin/lib/lang/en.lng
index b07214e..2fb4dee 100644
--- a/interface/web/admin/lib/lang/en.lng
+++ b/interface/web/admin/lib/lang/en.lng
@@ -42,4 +42,5 @@
 $wb['Remote Actions'] = 'Remote Actions';
 $wb['Do OS-Update'] = 'Do OS-Update';
 $wb['Do ISPConfig-Update'] = 'Do ISPConfig-Update';
+$wb['Additional PHP Versions'] = 'Additional PHP Versions';
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng
index c6a80f2..4cce275 100644
--- a/interface/web/admin/lib/lang/en_server_config.lng
+++ b/interface/web/admin/lib/lang/en_server_config.lng
@@ -157,6 +157,4 @@
 $wb["connect_userid_to_webid_start_txt"] = 'Start ID for userid/webid connect';
 $wb["realtime_blackhole_list_txt"] = 'Real-time Blackhole List';
 $wb["realtime_blackhole_list_note_txt"] = '(Separate RBL\'s with commas)';
-$wb["fastcgi_additional_php_versions_txt"] = 'Additional PHP Versions';
-$wb["fastcgi_additional_php_versions_hint_txt"] = 'Format:<br>&lt;name&gt;;&lt;path_to_executable&gt;;&lt;path_to_php.ini_dir&gt;<br>e.g.:<br>PHP 5.2.17;/opt/php52/bin/php-cgi;/opt/php52/etc/';
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/lang/en_server_php.lng b/interface/web/admin/lib/lang/en_server_php.lng
new file mode 100644
index 0000000..addbfa4
--- /dev/null
+++ b/interface/web/admin/lib/lang/en_server_php.lng
@@ -0,0 +1,16 @@
+<?php
+$wb['server_id_txt'] = 'Server';
+$wb['client_id_txt'] = 'Client';
+$wb['name_txt'] = 'PHP Name';
+$wb['Name'] = 'Name';
+$wb['FastCGI Settings'] = 'FastCGI Settings';
+$wb['PHP-FPM Settings'] = 'PHP-FPM Settings';
+$wb['Additional PHP Versions'] = 'Additional PHP Versions';
+$wb['Form to edit additional PHP versions'] = 'Form to edit additional PHP versions';
+$wb['server_php_name_error_empty'] = 'The Name field must not be empty.';
+$wb['php_fastcgi_binary_txt'] = 'Path to the PHP FastCGI binary';
+$wb['php_fastcgi_ini_dir_txt'] = 'Path to the php.ini directory';
+$wb['php_fpm_init_script_txt'] = 'Path to the PHP-FPM init script';
+$wb['php_fpm_ini_dir_txt'] = 'Path to the php.ini directory';
+$wb['php_fpm_pool_dir_txt'] = 'Path to the PHP-FPM pool directory';
+?>
diff --git a/interface/web/admin/lib/lang/en_server_php_list.lng b/interface/web/admin/lib/lang/en_server_php_list.lng
new file mode 100644
index 0000000..b402fd1
--- /dev/null
+++ b/interface/web/admin/lib/lang/en_server_php_list.lng
@@ -0,0 +1,7 @@
+<?php
+$wb['list_head_txt'] = 'Additional PHP Versions';
+$wb['server_id_txt'] = 'Server';
+$wb['add_new_record_txt'] = 'Add new PHP version';
+$wb['client_id_txt'] = 'Client';
+$wb['name_txt'] = 'PHP Name';
+?>
diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php
index 84959d6..833c8c5 100644
--- a/interface/web/admin/lib/module.conf.php
+++ b/interface/web/admin/lib/module.conf.php
@@ -78,6 +78,11 @@
 $items[] = array( 'title' 	=> 'Interface Config',
 				  'target' 	=> 'content',
 				  'link'	=> 'admin/system_config_edit.php?id=1');
+				  
+$items[] = array( 'title' 	=> 'Additional PHP Versions',
+				  'target' 	=> 'content',
+				  'link'	=> 'admin/server_php_list.php',
+				  'html_id'=> 'server_php_list');
 
 $module['nav'][] = array(	'title'	=> 'System',
 							'open' 	=> 1,
diff --git a/interface/web/admin/list/server_php.list.php b/interface/web/admin/list/server_php.list.php
new file mode 100644
index 0000000..1464d16
--- /dev/null
+++ b/interface/web/admin/list/server_php.list.php
@@ -0,0 +1,82 @@
+<?php
+/*
+    Datatypes:
+    - INTEGER
+    - DOUBLE
+    - CURRENCY
+    - VARCHAR
+    - TEXT
+    - DATE
+*/
+
+//* Name of list
+$liste['name'] 				= 'server_php';
+
+//* Database table
+$liste['table'] 			= 'server_php';
+
+//* Primary index column
+$liste['table_idx']			= 'server_php_id';
+
+//* Search Field Prefix
+$liste['search_prefix'] 	= 'search_';
+
+//* Records per page
+$liste['records_per_page'] 	= "15";
+
+//* Script file for listing
+$liste['file']				= 'server_php_list.php';
+
+//* Script file to edit
+$liste['edit_file']			= 'server_php_edit.php';
+
+//* Script file to delete
+$liste['delete_file']		= 'server_php_del.php';
+
+//* Paging template
+$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+
+//* Enable auth
+$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'		=> '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'		=> '');
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/ajax_get_fastcgi_php_versions.php b/interface/web/admin/server_php_del.php
similarity index 70%
copy from interface/web/sites/ajax_get_fastcgi_php_versions.php
copy to interface/web/admin/server_php_del.php
index 41d2536..9b6a6fe 100644
--- a/interface/web/sites/ajax_get_fastcgi_php_versions.php
+++ b/interface/web/admin/server_php_del.php
@@ -1,7 +1,7 @@
 <?php
 
 /*
-Copyright (c) 2005, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification,
@@ -28,31 +28,24 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/server_php.list.php";
+$tform_def_file = "form/server_php.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
 //* Check permissions for module
-$app->auth->check_module_permissions('sites');
+$app->auth->check_module_permissions('admin');
 
-$server_id = intval($_GET["server_id"]);
-$client_group_id = intval($_GET["client_group_id"]);
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
 
-if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-
-	$app->uses('ini_parser,getconf');
-	$fastcgi = $app->getconf->get_server_config($server_id,'fastcgi');
-	$php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']);
-
-	$php_select = "";
-
-	if(is_array($php_versions)) {
-		foreach( $php_versions as $php_version) {
-			$php_select .= "#$php_version";
-		}
-	}
-
-	unset($php_versions);
-}
-
-echo $php_select;
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/server_php_edit.php b/interface/web/admin/server_php_edit.php
new file mode 100644
index 0000000..aeac621
--- /dev/null
+++ b/interface/web/admin/server_php_edit.php
@@ -0,0 +1,73 @@
+<?php
+/*
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/server_php.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+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);
+		}
+	}
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/ajax_get_fastcgi_php_versions.php b/interface/web/admin/server_php_list.php
similarity index 70%
rename from interface/web/sites/ajax_get_fastcgi_php_versions.php
rename to interface/web/admin/server_php_list.php
index 41d2536..86a7050 100644
--- a/interface/web/sites/ajax_get_fastcgi_php_versions.php
+++ b/interface/web/admin/server_php_list.php
@@ -1,7 +1,7 @@
 <?php
 
 /*
-Copyright (c) 2005, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification,
@@ -31,28 +31,24 @@
 require_once('../../lib/config.inc.php');
 require_once('../../lib/app.inc.php');
 
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/server_php.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
 //* Check permissions for module
-$app->auth->check_module_permissions('sites');
+$app->auth->check_module_permissions('admin');
 
-$server_id = intval($_GET["server_id"]);
-$client_group_id = intval($_GET["client_group_id"]);
+$app->uses('listform_actions');
 
-if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+$app->listform_actions->SQLOrderBy = "ORDER BY server_id, name";
 
-	$app->uses('ini_parser,getconf');
-	$fastcgi = $app->getconf->get_server_config($server_id,'fastcgi');
-	$php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']);
+$app->listform_actions->onLoad();
 
-	$php_select = "";
 
-	if(is_array($php_versions)) {
-		foreach( $php_versions as $php_version) {
-			$php_select .= "#$php_version";
-		}
-	}
-
-	unset($php_versions);
-}
-
-echo $php_select;
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/templates/server_config_fastcgi_edit.htm b/interface/web/admin/templates/server_config_fastcgi_edit.htm
index 0f051f5..3ca49c5 100644
--- a/interface/web/admin/templates/server_config_fastcgi_edit.htm
+++ b/interface/web/admin/templates/server_config_fastcgi_edit.htm
@@ -39,10 +39,6 @@
 					{tmpl_var name='fastcgi_config_syntax'}
 				</select>
       </div>
-	  <div class="ctrlHolder">
-      	<label for="fastcgi_additional_php_versions">{tmpl_var name='fastcgi_additional_php_versions_txt'}</label>
-        <textarea rows="10" cols="40" name="fastcgi_additional_php_versions" id="fastcgi_additional_php_versions" type="text" class="textInput">{tmpl_var name='fastcgi_additional_php_versions'}</textarea> {tmpl_var name='fastcgi_additional_php_versions_hint_txt'}
-			</div>
     </fieldset>
 
     <input type="hidden" name="id" value="{tmpl_var name='id'}">
diff --git a/interface/web/admin/templates/server_php_fastcgi_edit.htm b/interface/web/admin/templates/server_php_fastcgi_edit.htm
new file mode 100644
index 0000000..37e6946
--- /dev/null
+++ b/interface/web/admin/templates/server_php_fastcgi_edit.htm
@@ -0,0 +1,26 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_server_php">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels">
+      <div class="ctrlHolder">
+      	<label for="php_fastcgi_binary">{tmpl_var name='php_fastcgi_binary_txt'}</label>
+        <input name="php_fastcgi_binary" id="php_fastcgi_binary" value="{tmpl_var name='php_fastcgi_binary'}" size="40" maxlength="255" type="text" class="textInput" />
+			</div>
+		<div class="ctrlHolder">
+      	<label for="php_fastcgi_ini_dir">{tmpl_var name='php_fastcgi_ini_dir_txt'}</label>
+        <input name="php_fastcgi_ini_dir" id="php_fastcgi_ini_dir" value="{tmpl_var name='php_fastcgi_ini_dir'}" size="40" maxlength="255" type="text" class="textInput" />
+			</div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/server_php_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_php_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/admin/templates/server_php_fpm_edit.htm b/interface/web/admin/templates/server_php_fpm_edit.htm
new file mode 100644
index 0000000..47760a8
--- /dev/null
+++ b/interface/web/admin/templates/server_php_fpm_edit.htm
@@ -0,0 +1,30 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_server_php">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels">
+      <div class="ctrlHolder">
+      	<label for="php_fpm_init_script">{tmpl_var name='php_fpm_init_script_txt'}</label>
+        <input name="php_fpm_init_script" id="php_fpm_init_script" value="{tmpl_var name='php_fpm_init_script'}" size="40" maxlength="255" type="text" class="textInput" />
+			</div>
+		<div class="ctrlHolder">
+      	<label for="php_fpm_ini_dir">{tmpl_var name='php_fpm_ini_dir_txt'}</label>
+        <input name="php_fpm_ini_dir" id="php_fpm_ini_dir" value="{tmpl_var name='php_fpm_ini_dir'}" size="40" maxlength="255" type="text" class="textInput" />
+			</div>
+		<div class="ctrlHolder">
+      	<label for="php_fpm_pool_dir">{tmpl_var name='php_fpm_pool_dir_txt'}</label>
+        <input name="php_fpm_pool_dir" id="php_fpm_pool_dir" value="{tmpl_var name='php_fpm_pool_dir'}" size="40" maxlength="255" type="text" class="textInput" />
+			</div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/server_php_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_php_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/admin/templates/server_php_list.htm b/interface/web/admin/templates/server_php_list.htm
new file mode 100644
index 0000000..b64840e
--- /dev/null
+++ b/interface/web/admin/templates/server_php_list.htm
@@ -0,0 +1,55 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+
+<div class="panel panel_list_server_ip">
+
+  <div class="pnl_toolsarea">
+    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
+      <div class="buttons">
+        <button class="iconstxt icoAdd" type="button" onClick="loadContent('admin/server_php_edit.php');">
+          <span>{tmpl_var name="add_new_record_txt"}</span>
+        </button>
+      </div>
+    </fieldset>
+  </div>
+
+  <div class="pnl_listarea">
+    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
+      <table class="list">
+        <thead>
+          <tr>
+            <th class="tbl_col_server_id" scope="col"><tmpl_var name="server_id_txt"></th>
+            <th class="tbl_col_client_id" scope="col"><tmpl_var name="client_id_txt"></th>
+            <th class="tbl_col_ip_address" scope="col"><tmpl_var name="name_txt"></th>
+            <th class="tbl_col_buttons" scope="col">{tmpl_var name='search_limit'}</th>
+          </tr>
+          <tr>
+            <td class="tbl_col_server_id"><select name="search_server_id">{tmpl_var name='search_server_id'}</select></td>
+            <td class="tbl_col_client_id"><select name="search_client_id">{tmpl_var name='search_client_id'}</select></td>
+            <td class="tbl_col_ip_address"><input type="text" name="search_name" value="{tmpl_var name='search_name'}" /></td>
+            <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','admin/server_php_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
+          </tr>
+        </thead>
+        <tbody>
+          <tmpl_loop name="records">
+          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+            <td class="tbl_col_server_id"><a href="#" onClick="loadContent('admin/server_php_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a></td>
+            <td class="tbl_col_client_id"><a href="#" onClick="loadContent('admin/server_php_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="client_id"}</a></td>
+            <td class="tbl_col_name"><a href="#" onClick="loadContent('admin/server_php_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="name"}</a></td>
+            <td class="tbl_col_buttons">
+              <div class="buttons icons16">    
+                <a class="icons16 icoDelete" href="javascript: del_record('admin/server_php_del.php?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>
+          </tr>
+          </tmpl_loop>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td class="tbl_footer tbl_paging" colspan="4"><tmpl_var name="paging"></td>
+          </tr>
+        </tfoot>
+      </table>
+    </fieldset>
+  </div>
+
+</div>
diff --git a/interface/web/admin/templates/server_php_name_edit.htm b/interface/web/admin/templates/server_php_name_edit.htm
new file mode 100644
index 0000000..bb68668
--- /dev/null
+++ b/interface/web/admin/templates/server_php_name_edit.htm
@@ -0,0 +1,34 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_server_php">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels">
+      <div class="ctrlHolder">
+      	<label for="server_id">{tmpl_var name='server_id_txt'}</label>
+        <select name="server_id" id="server_id" class="selectInput">
+					{tmpl_var name='server_id'}
+				</select>
+      </div>
+      <div class="ctrlHolder">
+      	<label for="client_id">{tmpl_var name='client_id_txt'}</label>
+        <select name="client_id" id="client_id" class="selectInput">
+					{tmpl_var name='client_id'}
+				</select>
+      </div>
+      <div class="ctrlHolder">
+      	<label for="name">{tmpl_var name='name_txt'}</label>
+        <input name="name" id="name" value="{tmpl_var name='name'}" size="40" maxlength="255" type="text" class="textInput" />
+			</div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/server_php_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_php_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+  </div>
+  
+</div>
diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php
index ebaa9f7..3ad1463 100644
--- a/interface/web/sites/ajax_get_json.php
+++ b/interface/web/sites/ajax_get_json.php
@@ -59,6 +59,22 @@
 		unset($server);
 		$json .= '"}';
 	}
+	
+	if($type == 'getphpfastcgi'){
+		$json = '{';
+		$sql = "SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id";
+		$php_records = $app->db->queryAllRecords($sql);
+		$php_select = "";
+		if(is_array($php_records) && !empty($php_records)) {
+			foreach( $php_records as $php_record) {
+				$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 .= '}';
+	}
 
 //}
 
diff --git a/interface/web/sites/templates/web_domain_edit.htm b/interface/web/sites/templates/web_domain_edit.htm
index 064cf27..b15036f 100644
--- a/interface/web/sites/templates/web_domain_edit.htm
+++ b/interface/web/sites/templates/web_domain_edit.htm
@@ -167,11 +167,17 @@
 			reloadWebIP();
 		});
 		
+		if(jQuery('#php').val() == 'fast-cgi'){
+			jQuery('.fastcgi_php_version:hidden').show();
+		} else {
+			jQuery('.fastcgi_php_version:visible').hide();
+		}
 		jQuery('#php').change(function(){
+		reloadFastcgiPHPVersions();
 			if(jQuery(this).val() == 'fast-cgi'){
-				jQuery('.fastcgi_php_version').show();
+				jQuery('.fastcgi_php_version:hidden').show();
 			} else {
-				jQuery('.fastcgi_php_version').hide();
+				jQuery('.fastcgi_php_version:visible').hide();
 			}
 		});
 		
@@ -201,7 +207,19 @@
 		}
 		
 		function reloadFastcgiPHPVersions() {
-			loadOptionInto('fastcgi_php_version','sites/ajax_get_fastcgi_php_versions.php?server_id='+serverId+'&client_group_id='+clientGroupId);
+			jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getphpfastcgi"}, function(data) {
+				var options = '<option value="">Default</option>';
+				var phpfastcgiselected = '';
+				$.each(data, function(key, val) {
+					if($('#fastcgi_php_version').val() == key){
+						phpfastcgiselected = ' selected="selected"';
+					} else {
+						phpfastcgiselected = '';
+					}
+					options += '<option value="'+key+'"'+phpfastcgiselected+'>'+val+'</option>';
+				});
+				$('#fastcgi_php_version').html(options);
+			});
 		}
 			
 </script>
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index d861cdb..4d70e89 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -45,7 +45,7 @@
 $app->auth->check_module_permissions('sites');
 
 // Loading classes
-$app->uses('tpl,tform,tform_actions,ini_parser,getconf');
+$app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
@@ -130,17 +130,18 @@
 			unset($ips);
 			
 			//PHP Version Selection (FastCGI)
-			$fastcgi = $app->getconf->get_server_config($client['default_webserver'],'fastcgi');
-			$php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']);
+			$sql = "SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
+			$php_records = $app->db->queryAllRecords($sql);
 			$php_select = "<option value=''>Default</option>";
-			if(is_array($php_versions)) {
-				foreach( $php_versions as $php_version) {
+			if(is_array($php_records) && !empty($php_records)) {
+				foreach( $php_records as $php_record) {
+					$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
 					$selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
-					$php_select .= "<option value='$php_version' $selected>$php_version</option>\r\n";
+					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("fastcgi_php_version",$php_select);
-			unset($php_versions);
+			unset($php_records);
 
 			//* 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'])) {
@@ -199,17 +200,18 @@
 			unset($ips);
 			
 			//PHP Version Selection (FastCGI)
-			$fastcgi = $app->getconf->get_server_config($client['default_webserver'],'fastcgi');
-			$php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']);
+			$sql = "SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
+			$php_records = $app->db->queryAllRecords($sql);
 			$php_select = "<option value=''>Default</option>";
-			if(is_array($php_versions)) {
-				foreach( $php_versions as $php_version) {
+			if(is_array($php_records) && !empty($php_records)) {
+				foreach( $php_records as $php_record) {
+					$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
 					$selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
-					$php_select .= "<option value='$php_version' $selected>$php_version</option>\r\n";
+					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("fastcgi_php_version",$php_select);
-			unset($php_versions);
+			unset($php_records);
 
 			//* Admin: If the logged in user is admin
 		} else {
@@ -254,17 +256,18 @@
 			unset($ips);
 			
 			//PHP Version Selection (FastCGI)
-			$fastcgi = $app->getconf->get_server_config($server_id,'fastcgi');
-			$php_versions = explode('\n',$fastcgi['fastcgi_additional_php_versions']);
+			$sql = "SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id";
+			$php_records = $app->db->queryAllRecords($sql);
 			$php_select = "<option value=''>Default</option>";
-			if(is_array($php_versions)) {
-				foreach( $php_versions as $php_version) {
+			if(is_array($php_records) && !empty($php_records)) {
+				foreach( $php_records as $php_record) {
+					$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
 					$selected = ($php_version == $this->dataRecord["fastcgi_php_version"])?'SELECTED':'';
-					$php_select .= "<option value='$php_version' $selected>$php_version</option>\r\n";
+					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("fastcgi_php_version",$php_select);
-			unset($php_versions);
+			unset($php_records);
 
 			// Fill the client select field
 			$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index e9a66c4..47b889c 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -912,7 +912,7 @@
 			// Support for multiple PHP versions (FastCGI)
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_fastcgi_php = false;
-				list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(';', 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(substr($custom_fastcgi_php_ini_dir,-1) != '/') $custom_fastcgi_php_ini_dir .= '/';
 			} else {
 				$default_fastcgi_php = true;

--
Gitblit v1.9.1