mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-21 10:27:29 +00:00
- first commit for upcoming multiserver-support :)
This commit is contained in:
parent
9fe6db8cd9
commit
3aff47d983
@ -84,15 +84,6 @@ return array(
|
||||
'plausibility_check_method' => 'checkMysqlAccessHost',
|
||||
'save_method' => 'storeSettingMysqlAccessHost',
|
||||
),
|
||||
'system_realtime_port' => array(
|
||||
'label' => $lng['serversettings']['system_realtime_port'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'realtime_port',
|
||||
'type' => (function_exists('socket_create') ? 'int' : 'hidden'),
|
||||
'int_max' => 65535,
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_index_file_extension' => array(
|
||||
'label' => $lng['serversettings']['index_file_extension'],
|
||||
'settinggroup' => 'system',
|
||||
|
36
actions/admin/settings/125.multiserver.php
Normal file
36
actions/admin/settings/125.multiserver.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'multiserver' => array(
|
||||
'title' => $lng['admin']['multiserver'],
|
||||
'fields' => array(
|
||||
'multiserver_enabled' => array(
|
||||
'label' => $lng['multiserver']['enabled'],
|
||||
'settinggroup' => 'multiserver',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true,
|
||||
'disabled' => true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
@ -45,6 +45,7 @@ CREATE TABLE `ftp_users` (
|
||||
`down_count` int(15) NOT NULL default '0',
|
||||
`down_bytes` bigint(30) NOT NULL default '0',
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
`sid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `username` (`username`),
|
||||
KEY `customerid` (`customerid`)
|
||||
@ -103,6 +104,7 @@ CREATE TABLE `mail_virtual` (
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
`popaccountid` int(11) NOT NULL default '0',
|
||||
`iscatchall` tinyint(1) unsigned NOT NULL default '0',
|
||||
`sid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `email` (`email`)
|
||||
) TYPE=MyISAM ;
|
||||
@ -232,6 +234,7 @@ CREATE TABLE `panel_customers` (
|
||||
`perlenabled` tinyint(1) NOT NULL default '0',
|
||||
`email_autoresponder` int(5) NOT NULL default '0',
|
||||
`email_autoresponder_used` int(5) NOT NULL default '0',
|
||||
`sid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`customerid`),
|
||||
UNIQUE KEY `loginname` (`loginname`)
|
||||
) TYPE=MyISAM ;
|
||||
@ -434,6 +437,7 @@ CREATE TABLE `panel_settings` (
|
||||
`settinggroup` varchar(255) NOT NULL default '',
|
||||
`varname` varchar(255) NOT NULL default '',
|
||||
`value` text NOT NULL,
|
||||
`sid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`settingid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
@ -462,7 +466,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.14-svn6');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.14-svn7');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');
|
||||
@ -546,7 +550,6 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (104, 'aps', 'webserver-htaccess', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (105, 'aps', 'php-function', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (106, 'aps', 'webserver-module', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (107, 'system', 'realtime_port', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (108, 'session', 'allow_multiple_login', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (109, 'panel', 'allow_domain_change_admin', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (110, 'panel', 'allow_domain_change_customer', '0');
|
||||
@ -607,6 +610,7 @@ CREATE TABLE `panel_tasks` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`type` int(11) NOT NULL default '0',
|
||||
`data` text NOT NULL,
|
||||
`sid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
@ -795,7 +799,7 @@ CREATE TABLE `panel_tickets` (
|
||||
`message` text NOT NULL,
|
||||
`dt` int(15) NOT NULL,
|
||||
`lastchange` int(15) NOT NULL,
|
||||
`ip` varchar(20) NOT NULL,
|
||||
`ip` varchar(39) NOT NULL default '',
|
||||
`status` enum('0','1','2','3') NOT NULL default '1',
|
||||
`lastreplier` enum('0','1') NOT NULL default '0',
|
||||
`answerto` int(11) unsigned NOT NULL,
|
||||
@ -840,6 +844,7 @@ CREATE TABLE IF NOT EXISTS `panel_syslog` (
|
||||
`date` int(15) NOT NULL,
|
||||
`user` varchar(50) NOT NULL,
|
||||
`text` text NOT NULL,
|
||||
`sid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`logid`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
@ -888,6 +893,7 @@ CREATE TABLE `panel_phpconfigs` (
|
||||
`mod_fcgid_starter` int(4) NOT NULL DEFAULT '-1',
|
||||
`mod_fcgid_maxrequests` int(4) NOT NULL DEFAULT '-1',
|
||||
`phpsettings` text NOT NULL,
|
||||
`sid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
@ -955,6 +961,7 @@ CREATE TABLE IF NOT EXISTS `aps_tasks` (
|
||||
`ID` int(4) NOT NULL auto_increment,
|
||||
`InstanceID` int(4) NOT NULL,
|
||||
`Task` int(4) NOT NULL,
|
||||
`sid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
@ -1086,3 +1093,17 @@ CREATE TABLE IF NOT EXISTS `domain_redirect_codes` (
|
||||
`did` int(11) unsigned NOT NULL,
|
||||
UNIQUE KEY `rc` (`rid`, `did`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
|
||||
#
|
||||
# Tabellenstruktur fuer Tabelle `froxlor_clients`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `froxlor_clients`;
|
||||
CREATE TABLE IF NOT EXISTS `froxlor_clients` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`ip` varchar(39) NOT NULL default '',
|
||||
`enabled` tinyint(1) DEFAULT '1',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
@ -255,6 +255,17 @@ function requirement_checks()
|
||||
status_message('green', 'OK');
|
||||
}
|
||||
|
||||
// check for ssh2 (multiserver-mode)
|
||||
status_message('begin', $lng['install']['phpssh2']);
|
||||
if(!extension_loaded('ssh2'))
|
||||
{
|
||||
status_message('orange', $lng['install']['ssh2neededformultiserver']);
|
||||
}
|
||||
else
|
||||
{
|
||||
status_message('green', 'OK');
|
||||
}
|
||||
|
||||
if($_die)
|
||||
{
|
||||
?>
|
||||
@ -753,8 +764,10 @@ if(isset($_POST['installstep'])
|
||||
$userdata.= "\$sql_root[0]['caption']='Default';\n";
|
||||
$userdata.= "\$sql_root[0]['host']='" . addcslashes($mysql_host, "'\\") . "';\n";
|
||||
$userdata.= "\$sql_root[0]['user']='" . addcslashes($mysql_root_user, "'\\") . "';\n";
|
||||
$userdata.= "\$sql_root[0]['password']='" . addcslashes($mysql_root_pass, "'\\") . "';\n";
|
||||
$userdata.= "?>";
|
||||
$userdata.= "\$sql_root[0]['password']='" . addcslashes($mysql_root_pass, "'\\") . "';\n\n";
|
||||
$userdata.= "// Define our system id (multiserver support, default is '0')\n";
|
||||
$userdata.= "\$server_id = 0;\n";
|
||||
$userdata.= "?>\n";
|
||||
|
||||
//we test now if we can store the userdata.inc.php in ../lib
|
||||
|
||||
|
@ -98,4 +98,8 @@ $lng['install']['phpmagic_quotes_runtime'] = 'Checking whether magic_quotes_runt
|
||||
$lng['install']['active'] = 'no';
|
||||
$lng['install']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off" in order to avoid strange behavior of Froxlor. Disabling it for now (this is only temporary, please fix our php.ini).';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.14-svn7
|
||||
$lng['install']['phpssh2'] = 'Testing if PHP ssh2-extension is installed...';
|
||||
$lng['install']['ssh2neededformultiserver'] = 'not found. If you plan to use the multiserver mode you have to recompile PHP with the ssh2-extenstion.'
|
||||
|
||||
?>
|
||||
|
@ -98,4 +98,8 @@ $lng['install']['phpmagic_quotes_runtime'] = 'Prüfe ob magic_quotes_runtime
|
||||
$lng['install']['active'] = 'nein';
|
||||
$lng['install']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"), um merkwürdige Verhalten von Froxlor zu umgehen. Sie wurde deaktiviert (nur temporär, bitte php.ini anpassen).';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.14-svn7
|
||||
$lng['install']['phpssh2'] = 'Teste, ob die PHP ssh2-Erweiterung installiert ist...';
|
||||
$lng['install']['ssh2neededformultiserver'] = 'nicht gefunden. Falls Multiserver Modus genutzt werden soll, muss PHP mit der ssh2-Extenstion neu kompiliert werden.'
|
||||
|
||||
?>
|
||||
|
@ -1168,3 +1168,109 @@ if(isFroxlorVersion('0.9.14-svn5'))
|
||||
|
||||
updateToVersion('0.9.14-svn6');
|
||||
}
|
||||
|
||||
if(isFroxlorVersion('0.9.14-svn6'))
|
||||
{
|
||||
showUpdateStep("Updating from 0.9.14-svn6 to 0.9.14-svn7", false);
|
||||
|
||||
// remove deprecated realtime-feature
|
||||
showUpdateStep("Removing realtime-feature (deprecated)");
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'realtime_port';");
|
||||
lastStepStatus(0);
|
||||
|
||||
// remove deprecated panel_navigation
|
||||
showUpdateStep("Removing table `panel_navigation` (deprecated)");
|
||||
$db->query("DROP TABLE IF EXISTS `panel_navigation`;");
|
||||
lastStepStatus(0);
|
||||
|
||||
// remove deprecated panel_cronscript
|
||||
showUpdateStep("Removing table `panel_cronscript` (deprecated)");
|
||||
$db->query("DROP TABLE IF EXISTS `panel_cronscript`;");
|
||||
lastStepStatus(0);
|
||||
|
||||
// make ticket-system ipv6 compatible
|
||||
showUpdateStep("Altering IP field in panel_tickets (IPv6 compatibility)");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_TICKETS . "` MODIFY `ip` varchar(39) NOT NULL default '';");
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Preparing database tables for upcoming multi-server support");
|
||||
$db->query("ALTER TABLE `".TABLE_PANEL_SETTINGS."` ADD `sid` int(11) NOT NULL default '0' AFTER `value`;");
|
||||
|
||||
showUpdateStep(".");
|
||||
$db->query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `sid` int(11) NOT NULL default '0' AFTER `email_autoresponder_used`;");
|
||||
|
||||
showUpdateStep(".");
|
||||
$db->query("ALTER TABLE `".TABLE_MAIL_VIRTUAL."` ADD `sid` int(11) NOT NULL default '0' AFTER `iscatchall`;");
|
||||
|
||||
showUpdateStep(".");
|
||||
$db->query("ALTER TABLE `".TABLE_FTP_USERS."` ADD `sid` int(11) NOT NULL default '0' AFTER `customerid`;");
|
||||
|
||||
showUpdateStep(".");
|
||||
$db->query("ALTER TABLE `".TABLE_PANEL_TASKS."` ADD `sid` int(11) NOT NULL default '0' AFTER `data`;");
|
||||
|
||||
showUpdateStep(".");
|
||||
$db->query("ALTER TABLE `".TABLE_APS_TASKS."` ADD `sid` int(11) NOT NULL default '0' AFTER `Task`;");
|
||||
|
||||
showUpdateStep(".");
|
||||
$db->query("ALTER TABLE `".TABLE_PANEL_LOG."` ADD `sid` int(11) NOT NULL default '0' AFTER `text`;");
|
||||
|
||||
showUpdateStep(".");
|
||||
$db->query("ALTER TABLE `".TABLE_PANEL_PHPCONFIGS."` ADD `sid` int(11) NOT NULL default '0' AFTER `phpsettings`;");
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Adding new table `".TABLE_FROXLOR_CLIENTS."`");
|
||||
$db->query("DROP TABLE IF EXISTS `".TABLE_FROXLOR_CLIENTS."`;)");
|
||||
$db->query("CREATE TABLE IF NOT EXISTS `".TABLE_FROXLOR_CLIENTS."` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`ip` varchar(39) NOT NULL default '',
|
||||
`enabled` tinyint(1) DEFAULT '1',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;");
|
||||
lastStepStatus(0);
|
||||
|
||||
// add $server_id to userdata.inc.php for upcoming multi-server-support
|
||||
showUpdateStep("Adding server-id setting for upcoming multi-server support to userdata.inc.php");
|
||||
$mypath = dirname(dirname(dirname(dirname(dirname(__FILE__))))); // froxlor-rootdir
|
||||
$userdatafile = makeCorrectFile($mypath.'/lib/userdata.inc.php');
|
||||
$userdata = @file_get_contents($userdatafile);
|
||||
$newcontent = '';
|
||||
if($userdata !== false)
|
||||
{
|
||||
$ud = explode("\n", $userdata);
|
||||
// add server_id lines at the end
|
||||
$lastidx = count($ud) -1;
|
||||
while($ud[$lastidx] != "?>")
|
||||
{
|
||||
$lastidx--;
|
||||
}
|
||||
$ud[$lastidx] = "\n";
|
||||
$ud[$lastidx++] = "// Define our system id (multiserver support, default is '0')\n";
|
||||
$ud[$lastidx++] = "\$server_id = 0;\n";
|
||||
$ud[$lastidx++] = "?>\n";
|
||||
|
||||
@copy($userdatafile, $userdatafile.'.bak');
|
||||
@unlink($userdatafile);
|
||||
$writesuccess = @fopen($userdatafile, 'w');
|
||||
|
||||
if($writesuccess !== false)
|
||||
{
|
||||
@fwrite($writesuccess, implode("\n", $ud));
|
||||
@fclose($writesucsess);
|
||||
@unlink($userdatafile.'.bak');
|
||||
lastStepStatus(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@copy($userdatafile.'.bak', $userdatafile);
|
||||
@unlink($userdatafile.'.bak');
|
||||
lastStepStatus(2, 'Failed to append server-id to userdata.inc.php file. Please put <strong>\$server_id = 0;</strong> to your userdata.inc.php file manually.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lastStepStatus(2, 'Failed to read userdata.inc.php file. Please put <strong>\$server_id = 0;</strong> to your userdata.inc.php file manually.');
|
||||
}
|
||||
|
||||
updateToVersion('0.9.14-svn7');
|
||||
}
|
||||
|
@ -43,20 +43,3 @@ function getPreConfig($current_version)
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function versionInUpdate($current_version, $version_to_check)
|
||||
{
|
||||
if (!isFroxlor()) {
|
||||
return true;
|
||||
}
|
||||
$pos_a = strpos($current_version, '-svn');
|
||||
$pos_b = strpos($version_to_check, '-svn');
|
||||
// if we compare svn-versions, we have to add -svn0 to the version
|
||||
// to compare it correctly
|
||||
if($pos_a === false && $pos_b !== false)
|
||||
{
|
||||
$current_version.= '-svn9999';
|
||||
}
|
||||
|
||||
return version_compare($current_version, $version_to_check, '<');
|
||||
}
|
||||
|
@ -63,8 +63,18 @@ function getFormOverviewGroupOutput($groupname, $groupdetails)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($fielddetails['disabled']) && $fielddetails['disabled'] == true)
|
||||
{
|
||||
$d = true;
|
||||
$option.='<span class="strikethrough">';
|
||||
} else {
|
||||
$d = false;
|
||||
}
|
||||
$option.= $lng['admin']['activated'].': ';
|
||||
$option.= makeyesno($fieldname, '1', '0', $settings[$fielddetails['settinggroup']][$fielddetails['varname']]);
|
||||
$option.= makeyesno($fieldname, '1', '0', $settings[$fielddetails['settinggroup']][$fielddetails['varname']], $d);
|
||||
if($d) {
|
||||
$option.='</span>';
|
||||
}
|
||||
$activated = (int)$settings[$fielddetails['settinggroup']][$fielddetails['varname']];
|
||||
}
|
||||
}
|
||||
|
38
lib/functions/froxlor/function.getServerId.php
Normal file
38
lib/functions/froxlor/function.getServerId.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* this function checks whether $server_id (multi-server) is set
|
||||
* in userdata.inc.php and returns the value. If not set or invalid,
|
||||
* always return the id of the master (which is '0')
|
||||
*
|
||||
* @return int server_id of current server
|
||||
* @since 0.9.14-svn7
|
||||
*/
|
||||
function getServerId() {
|
||||
|
||||
global $server_id;
|
||||
|
||||
if(isset($server_id)
|
||||
&& is_numeric($server_id)
|
||||
&& $server_id > 0
|
||||
) {
|
||||
return $server_id;
|
||||
}
|
||||
// return default (master)
|
||||
return 0;
|
||||
}
|
@ -24,12 +24,18 @@
|
||||
* @param string Parameter 1
|
||||
* @param string Parameter 2
|
||||
* @param string Parameter 3
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @param string Parameter 4
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
*/
|
||||
|
||||
function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '')
|
||||
{
|
||||
global $db, $settings;
|
||||
|
||||
// check for $server_id, if it's not set default to "master"
|
||||
$server_id = getServerId();
|
||||
|
||||
if($type == '1'
|
||||
|| $type == '3'
|
||||
@ -37,8 +43,7 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
|| $type == '5')
|
||||
{
|
||||
$db->query('DELETE FROM `' . TABLE_PANEL_TASKS . '` WHERE `type`="' . $type . '"');
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`) VALUES ("' . $type . '")');
|
||||
$doupdate = true;
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `sid`) VALUES ("' . $type . '", "'.$server_id.'")');
|
||||
}
|
||||
elseif($type == '2'
|
||||
&& $param1 != ''
|
||||
@ -52,8 +57,7 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
$data['gid'] = $param3;
|
||||
$data['store_defaultindex'] = $param4;
|
||||
$data = serialize($data);
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("2", "' . $db->escape($data) . '")');
|
||||
$doupdate = true;
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`, `sid`) VALUES ("2", "' . $db->escape($data) . '", "'.$server_id.'")');
|
||||
}
|
||||
elseif($type == '6'
|
||||
&& $param1 != '')
|
||||
@ -61,8 +65,7 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
$data = Array();
|
||||
$data['loginname'] = $param1;
|
||||
$data = serialize($data);
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("6", "' . $db->escape($data) . '")');
|
||||
$doupdate = true;
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`, `sid`) VALUES ("6", "' . $db->escape($data) . '", "'.$server_id.'")');
|
||||
}
|
||||
elseif($type == '7'
|
||||
&& $param1 != ''
|
||||
@ -72,8 +75,7 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
$data['loginname'] = $param1;
|
||||
$data['email'] = $param2;
|
||||
$data = serialize($data);
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("7", "' . $db->escape($data) . '")');
|
||||
$doupdate = true;
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`, `sid`) VALUES ("7", "' . $db->escape($data) . '", "'.$server_id.'")');
|
||||
}
|
||||
elseif($type == '8'
|
||||
&& $param1 != ''
|
||||
@ -83,50 +85,6 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
$data['loginname'] = $param1;
|
||||
$data['homedir'] = $param2;
|
||||
$data = serialize($data);
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`) VALUES ("8", "' . $db->escape($data) . '")');
|
||||
$doupdate = true;
|
||||
}
|
||||
|
||||
if($doupdate === true
|
||||
&& (int)$settings['system']['realtime_port'] !== 0
|
||||
&& function_exists('socket_create'))
|
||||
{
|
||||
$timeout = 15;
|
||||
//$socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||
$socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||
|
||||
if($socket !== false)
|
||||
{
|
||||
// create the request packet
|
||||
$packet = chr(0) . chr(1) . 'RUN' . chr(0);
|
||||
// UDP is connectionless, so we just send on it.
|
||||
//@socket_sendto($socket, $packet, strlen($packet), 0x100, '127.0.0.1', (int)$settings['system']['realtime_port']);
|
||||
|
||||
/*
|
||||
* this is for TCP-Connections
|
||||
*/
|
||||
$time = time();
|
||||
|
||||
while(!@socket_connect($socket, '127.0.0.1', (int)$settings['system']['realtime_port']))
|
||||
{
|
||||
$err = socket_last_error($socket);
|
||||
|
||||
if($err == 115
|
||||
|| $err == 114)
|
||||
{
|
||||
if((time() - $time) >= $timeout)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* close socket
|
||||
*/
|
||||
@socket_close($socket);
|
||||
}
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`, `data`, `sid`) VALUES ("8", "' . $db->escape($data) . '", "'.$server_id.'")');
|
||||
}
|
||||
}
|
||||
|
69
lib/functions/froxlor/function.versionInUpdate.php
Normal file
69
lib/functions/froxlor/function.versionInUpdate.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* check whether the current version is
|
||||
* lower than the given version
|
||||
*
|
||||
* @param string $current_version current installed version of froxlor
|
||||
* @param string $version_to_check version to check for update
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function versionInUpdate($current_version, $version_to_check)
|
||||
{
|
||||
if (!isFroxlor()) {
|
||||
return true;
|
||||
}
|
||||
$pos_a = strpos($current_version, '-svn');
|
||||
$pos_b = strpos($version_to_check, '-svn');
|
||||
// if we compare svn-versions, we have to add -svn0 to the version
|
||||
// to compare it correctly
|
||||
if($pos_a === false && $pos_b !== false)
|
||||
{
|
||||
$current_version.= '-svn9999';
|
||||
}
|
||||
|
||||
return version_compare($current_version, $version_to_check, '<');
|
||||
}
|
||||
|
||||
/**
|
||||
* check whether the current version is
|
||||
* lower than the given version
|
||||
* - without checking if this is Froxlor
|
||||
* because we need this in our loadSettings
|
||||
* functions and isFroxlor() needs settings
|
||||
* already
|
||||
*
|
||||
* @param string $current_version current installed version of froxlor
|
||||
* @param string $version_to_check version to check for update
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function compareFroxlorVersion($current_version, $version_to_check)
|
||||
{
|
||||
$pos_a = strpos($current_version, '-svn');
|
||||
$pos_b = strpos($version_to_check, '-svn');
|
||||
// if we compare svn-versions, we have to add -svn0 to the version
|
||||
// to compare it correctly
|
||||
if($pos_a === false && $pos_b !== false)
|
||||
{
|
||||
$current_version.= '-svn9999';
|
||||
}
|
||||
|
||||
return version_compare($current_version, $version_to_check, '<');
|
||||
}
|
@ -24,12 +24,18 @@
|
||||
* @param string Value which will be returned if user chooses yes
|
||||
* @param string Value which will be returned if user chooses no
|
||||
* @param string Value which is chosen by default
|
||||
* @param bool Whether this element is disabled or not (default: false)
|
||||
* @return string HTML Code
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
*/
|
||||
|
||||
function makeyesno($name, $yesvalue, $novalue = '', $yesselected = '')
|
||||
function makeyesno($name, $yesvalue, $novalue = '', $yesselected = '', $disabled = false)
|
||||
{
|
||||
global $lng;
|
||||
return '<select class="dropdown_noborder" name="' . $name . '"><option value="' . $yesvalue . '"' . ($yesselected ? ' selected="selected"' : '') . '>' . $lng['panel']['yes'] . '</option><option value="' . $novalue . '"' . ($yesselected ? '' : ' selected="selected"') . '>' . $lng['panel']['no'] . '</option></select>';
|
||||
|
||||
if($disabled) {
|
||||
$d = ' disabled="disabled"';
|
||||
}
|
||||
return '<select class="dropdown_noborder" name="' . $name . '"'.$d.'><option value="' . $yesvalue . '"' . ($yesselected ? ' selected="selected"' : '') . '>' . $lng['panel']['yes'] . '</option><option value="' . $novalue . '"' . ($yesselected ? '' : ' selected="selected"') . '>' . $lng['panel']['no'] . '</option></select>';
|
||||
}
|
||||
|
@ -19,6 +19,11 @@
|
||||
|
||||
function loadSettings(&$settings_data, $db)
|
||||
{
|
||||
global $version;
|
||||
|
||||
// multi-server-support, get the destination server id (master = 0)
|
||||
$server_id = getServerId();
|
||||
|
||||
$settings = array();
|
||||
|
||||
if(is_array($settings_data) && isset($settings_data['groups']) && is_array($settings_data['groups']))
|
||||
@ -31,11 +36,49 @@ function loadSettings(&$settings_data, $db)
|
||||
{
|
||||
if(isset($field_details['settinggroup']) && isset($field_details['varname']) && isset($field_details['default']))
|
||||
{
|
||||
$row = $db->query_first('SELECT `settinggroup`, `varname`, `value` FROM `' . TABLE_PANEL_SETTINGS . '` WHERE `settinggroup` = \'' . $db->escape($field_details['settinggroup']) . '\' AND `varname` = \'' . $db->escape($field_details['varname']) . '\' ');
|
||||
$sql_query = 'SELECT
|
||||
`settinggroup`, `varname`, `value`
|
||||
FROM
|
||||
`' . TABLE_PANEL_SETTINGS . '`
|
||||
WHERE
|
||||
`settinggroup` = \'' . $db->escape($field_details['settinggroup']) . '\'
|
||||
AND
|
||||
`varname` = \'' . $db->escape($field_details['varname']) . '\' ';
|
||||
|
||||
// since 0.9.14-svn7 we have $server_id for multi-server-support
|
||||
// but versions before 0.9.14-svn7 don't have the `sid` field
|
||||
// in panel_settings, so only append the condition if we're on
|
||||
// 0.9.14-svn7 or higher
|
||||
if(compareFroxlorVersion('0.9.14-svn7', $version))
|
||||
{
|
||||
$sql_query_sid = 'AND `sid` = \''. (int)$server_id . '\' ';
|
||||
} else {
|
||||
$sql_query_sid = '';
|
||||
}
|
||||
|
||||
$row = $db->query_first($sql_query.$sql_query_sid);
|
||||
if(!empty($row))
|
||||
{
|
||||
$varvalue = $row['value'];
|
||||
}
|
||||
elseif($server_id > 0)
|
||||
{
|
||||
// if we're a client (server_id > 0)
|
||||
// and a setting is not found or not
|
||||
// needed for clients, we get it from
|
||||
// the master (server_id = 0)
|
||||
$sql_query_sid = 'AND `sid` = \'0\' ';
|
||||
$row = $db->query_first($sql_query.$sql_query_sid);
|
||||
if(!empty($row))
|
||||
{
|
||||
$varvalue = $row['value'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// default to array-default-value
|
||||
$varvalue = $field_details['default'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$varvalue = $field_details['default'];
|
||||
|
@ -20,8 +20,19 @@
|
||||
function saveSetting($settinggroup, $varname, $newvalue)
|
||||
{
|
||||
global $db;
|
||||
$query = 'UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = \'' . $db->escape($newvalue) . '\' WHERE `settinggroup` = \'' . $db->escape($settinggroup) . '\' AND `varname`=\'' . $db->escape($varname) . '\'';
|
||||
|
||||
// multi-server-support, get the destination server id (master = 0)
|
||||
$server_id = getServerId();
|
||||
|
||||
$query = 'UPDATE
|
||||
`' . TABLE_PANEL_SETTINGS . '`
|
||||
SET
|
||||
`value` = \'' . $db->escape($newvalue) . '\'
|
||||
WHERE
|
||||
`settinggroup` = \'' . $db->escape($settinggroup) . '\'
|
||||
AND
|
||||
`varname`=\'' . $db->escape($varname) . '\'
|
||||
AND
|
||||
`sid`=\''. (int)$server_id . '\' ';
|
||||
return $db->query($query);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -38,7 +38,6 @@ define('TABLE_PANEL_TRAFFIC_ADMINS', 'panel_traffic_admins');
|
||||
define('TABLE_PANEL_DISKSPACE', 'panel_diskspace');
|
||||
define('TABLE_PANEL_DISKSPACE_ADMINS', 'panel_diskspace_admins');
|
||||
define('TABLE_PANEL_LANGUAGE', 'panel_languages');
|
||||
define('TABLE_PANEL_CRONSCRIPT', 'panel_cronscript');
|
||||
define('TABLE_PANEL_IPSANDPORTS', 'panel_ipsandports');
|
||||
define('TABLE_PANEL_TICKETS', 'panel_tickets');
|
||||
define('TABLE_PANEL_TICKET_CATS', 'panel_ticket_categories');
|
||||
@ -53,6 +52,7 @@ define('TABLE_APS_TEMP_SETTINGS', 'aps_temp_settings');
|
||||
define('TABLE_PANEL_CRONRUNS', 'cronjobs_run');
|
||||
define('TABLE_PANEL_REDIRECTCODES', 'redirect_codes');
|
||||
define('TABLE_PANEL_DOMAINREDIRECTS', 'domain_redirect_codes');
|
||||
define('TABLE_FROXLOR_CLIENTS', 'froxlor_clients');
|
||||
|
||||
// APS constants
|
||||
|
||||
@ -72,7 +72,7 @@ define('PACKAGE_ENABLED', 2);
|
||||
|
||||
// VERSION INFO
|
||||
|
||||
$version = '0.9.14-svn6';
|
||||
$version = '0.9.14-svn7';
|
||||
$dbversion = '2';
|
||||
$branding = '';
|
||||
|
||||
|
@ -1187,8 +1187,6 @@ $lng['error']['admindoesntexist'] = 'The admin you have chosen doesn\'t exist.';
|
||||
|
||||
// ADDED IN 1.2.19-svn37
|
||||
|
||||
$lng['serversettings']['system_realtime_port']['title'] = 'Port for realtime Froxlor';
|
||||
$lng['serversettings']['system_realtime_port']['description'] = 'Froxlor connects to this port at localhost everytime a new cron task is scheduled. If value is 0 (zero), this feature is disabled.<br />See also: <a href="http://wiki.froxlor.org/doc/realtime">Make Froxlor work in realtime (Froxlor Wiki)</a>';
|
||||
$lng['serversettings']['session_allow_multiple_login']['title'] = 'Allow multiple login';
|
||||
$lng['serversettings']['session_allow_multiple_login']['description'] = 'If activated a user could login multiple times.';
|
||||
$lng['serversettings']['panel_allow_domain_change_admin']['title'] = 'Allow moving domains between admins';
|
||||
@ -1513,4 +1511,8 @@ $lng['admin']['ipsandports']['docroot']['description'] = 'You can define a custo
|
||||
// ADDED IN FROXLOR 0.9.14-svn6
|
||||
$lng['serversettings']['login_domain_login'] = 'Allow login with domains';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.14-svn7
|
||||
$lng['admin']['multiserver'] = 'Multiserver settings';
|
||||
$lng['multiserver']['enabled']['title'] = 'Enable multiserver mode';
|
||||
|
||||
?>
|
||||
|
@ -1191,8 +1191,6 @@ $lng['error']['admindoesntexist'] = 'Der ausgewählte Admin existiert nicht.
|
||||
|
||||
// ADDED IN 1.2.19-svn37
|
||||
|
||||
$lng['serversettings']['system_realtime_port']['title'] = 'Port für Realtime Froxlor';
|
||||
$lng['serversettings']['system_realtime_port']['description'] = 'Dieser Port auf localhost wird bei jedem neuen Cron-Task kontaktiert. Wenn der Wert 0 (Null) ist, dann ist dieses Feature deaktiviert.<br />Siehe dazu auch: <a href="http://wiki.froxlor.org/doc/realtime">Make Froxlor work in realtime (Froxlor Wiki)</a>';
|
||||
$lng['serversettings']['session_allow_multiple_login']['title'] = 'Erlaube gleichzeitigen Login';
|
||||
$lng['serversettings']['session_allow_multiple_login']['description'] = 'Wenn diese Option aktiviert ist, können sich Nutzer mehrmals gleichzeitig anmelden.';
|
||||
$lng['serversettings']['panel_allow_domain_change_admin']['title'] = 'Erlaube Verschieben von Domains unter Admins';
|
||||
@ -1496,4 +1494,8 @@ $lng['admin']['ipsandports']['docroot']['description'] = 'Hier kann ein benutzer
|
||||
// ADDED IN FROXLOR 0.9.14-svn6
|
||||
$lng['serversettings']['login_domain_login'] = 'Erlaube Anmeldung mit Domains';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.14-svn7
|
||||
$lng['admin']['multiserver'] = 'Multiserver Einstellungen';
|
||||
$lng['multiserver']['enabled']['title'] = 'Aktiviere den Multiserver Modus';
|
||||
|
||||
?>
|
||||
|
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Cron
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
openRootDB($debugHandler, $lockfile);
|
||||
|
||||
/**
|
||||
* Check if table exists, otherwise create it
|
||||
*/
|
||||
|
||||
$tables = getTables($db);
|
||||
|
||||
if(!isset($tables[TABLE_PANEL_CRONSCRIPT])
|
||||
|| !is_array($tables[TABLE_PANEL_CRONSCRIPT]))
|
||||
{
|
||||
$db->query('CREATE TABLE `' . TABLE_PANEL_CRONSCRIPT . '` ( `id` int(11) unsigned NOT NULL auto_increment, `file` varchar(255) NOT NULL default \'\', PRIMARY KEY (`id`) ) TYPE=MyISAM ; ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Backend Wrapper
|
||||
*/
|
||||
|
||||
$query = 'SELECT * FROM `' . TABLE_PANEL_CRONSCRIPT . '` ';
|
||||
$cronFileIncludeResult = $db->query($query);
|
||||
|
||||
while($cronFileIncludeRow = $db->fetch_array($cronFileIncludeResult))
|
||||
{
|
||||
$cronFileIncludeFullPath = makeSecurePath($pathtophpfiles . '/scripts/' . $cronFileIncludeRow['file']);
|
||||
|
||||
if(fileowner($cronFileIncludeFullPath) == fileowner($pathtophpfiles . '/scripts/' . $filename)
|
||||
&& filegroup($cronFileIncludeFullPath) == filegroup($pathtophpfiles . '/scripts/' . $filename))
|
||||
{
|
||||
fwrite($debugHandler, 'Processing ...' . $cronFileIncludeFullPath . "\n");
|
||||
include_once $cronFileIncludeFullPath;
|
||||
fwrite($debugHandler, 'Processing done!' . "\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite($debugHandler, 'WARNING! uid and/or gid of "' . $cronFileIncludeFullPath . '" and "' . $pathtophpfiles . '/scripts/' . $filename . '" don\'t match! Execution aborted!' . "\n");
|
||||
$keepLockFile = true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -470,3 +470,8 @@ TR.RowOverSelected {
|
||||
margin-bottom: 0.5em;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
.strikethrough {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user