Commit 6de0aab8 authored by Falko Timme's avatar Falko Timme
Browse files

- Improved support for multiple PHP versions. Additional PHP versions have now...

- Improved support for multiple PHP versions. Additional PHP versions have now their own form and database table.
parent c0f39a4d
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
......@@ -1010,6 +1010,31 @@ CREATE TABLE `server_ip` (
-- --------------------------------------------------------
--
-- 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`
--
......
......@@ -90,7 +90,6 @@ fastcgi_children=8
fastcgi_max_requests=5000
fastcgi_bin=/usr/bin/php-cgi
fastcgi_config_syntax=1
fastcgi_additional_php_versions=
[jailkit]
jailkit_chroot_home=/home/[username]
......
......@@ -867,14 +867,6 @@ $form["tabs"]['fastcgi'] = array(
'width' => '40',
'maxlength' => '255'
),
'fastcgi_additional_php_versions' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
##################################
# ENDE Datatable fields
##################################
......
<?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 Ausdrcke in Int um)
- DOUBLE
- CURRENCY (Formatiert Zahlen nach Whrungsnotation)
- 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 einzufgen.
*/
$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
......@@ -40,4 +40,5 @@ $wb['Do OS-Update'] = 'Do OS-Update';
$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';
?>
......@@ -153,6 +153,4 @@ $wb['set_folder_permissions_on_update_txt'] = 'Set folder permissions on update'
$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/';
?>
......@@ -4,8 +4,8 @@ $wb['ip_address_txt'] = 'IP Adresse';
$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';
?>
......@@ -3,7 +3,7 @@ $wb['list_head_txt'] = 'IP Adressen';
$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';
......
<?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';
?>
<?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';
?>
......@@ -42,4 +42,5 @@ $wb['Remote Users'] = 'Remote Users';
$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
......@@ -157,6 +157,4 @@ $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["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
<?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';
?>
<?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';
?>
......@@ -78,6 +78,11 @@ $items[] = array( 'title' => 'Edit Server IP',
$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,
......
<?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
<?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
******************************************/
$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('admin');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
?>
\ No newline at end of file
<?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();