finally removed super-old syscp-update-procedures, we now require the last available syscp for upgrading; migrate some functions to PDO database class, refs #1287
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -1,82 +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 Install
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* We need those defines, because the tables.inc.php doesn't have them.
|
||||
*/
|
||||
|
||||
define('TABLE_POSTFIX_TRANSPORT', 'postfix_transport');
|
||||
define('TABLE_POSTFIX_USERS', 'postfix_users');
|
||||
define('TABLE_POSTFIX_VIRTUAL', 'postfix_virtual');
|
||||
define('TABLE_PROFTPD_GROUPS', 'proftpd_groups');
|
||||
define('TABLE_PROFTPD_USERS', 'proftpd_users');
|
||||
|
||||
if($settings['panel']['version'] == '1.0.10')
|
||||
{
|
||||
// Drop/Rename postfix_ tables
|
||||
|
||||
$db->query("DROP TABLE IF EXISTS `" . TABLE_POSTFIX_TRANSPORT . "`");
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_USERS . "` RENAME `" . TABLE_MAIL_USERS . "` ");
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_VIRTUAL . "` RENAME `" . TABLE_MAIL_VIRTUAL . "` ");
|
||||
|
||||
// Rename proftpd_ tables
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PROFTPD_USERS . "` RENAME `" . TABLE_FTP_USERS . "` ");
|
||||
$db->query("ALTER TABLE `" . TABLE_PROFTPD_GROUPS . "` RENAME `" . TABLE_FTP_GROUPS . "` ");
|
||||
|
||||
// Adding tables
|
||||
|
||||
$db->query("DROP TABLE IF EXISTS `" . TABLE_PANEL_HTACCESS . "`;");
|
||||
$db->query("CREATE TABLE `" . TABLE_PANEL_HTACCESS . "` (" . " `id` int(11) unsigned NOT NULL auto_increment," . " `customerid` int(11) unsigned NOT NULL default '0'," . " `path` varchar(255) NOT NULL default ''," . " `options_indexes` tinyint(1) NOT NULL default '0'," . " PRIMARY KEY (`id`)" . ") ENGINE=MyISAM ;");
|
||||
$db->query("DROP TABLE IF EXISTS `" . TABLE_PANEL_ADMINS . "`;");
|
||||
$db->query("CREATE TABLE `" . TABLE_PANEL_ADMINS . "` (" . " `adminid` int(11) unsigned NOT NULL auto_increment," . " `loginname` varchar(50) NOT NULL default ''," . " `password` varchar(50) NOT NULL default ''," . " `name` varchar(255) NOT NULL default ''," . " `email` varchar(255) NOT NULL default ''," . " `customers` int(15) NOT NULL default '0'," . " `customers_used` int(15) NOT NULL default '0'," . " `customers_see_all` tinyint(1) NOT NULL default '0'," . " `domains` int(15) NOT NULL default '0'," . " `domains_used` int(15) NOT NULL default '0'," . " `domains_see_all` tinyint(1) NOT NULL default '0'," . " `change_serversettings` tinyint(1) NOT NULL default '0'," . " `diskspace` int(15) NOT NULL default '0'," . " `diskspace_used` int(15) NOT NULL default '0'," . " `mysqls` int(15) NOT NULL default '0'," . " `mysqls_used` int(15) NOT NULL default '0'," . " `emails` int(15) NOT NULL default '0'," . " `emails_used` int(15) NOT NULL default '0'," . " `email_forwarders` int(15) NOT NULL default '0'," . " `email_forwarders_used` int(15) NOT NULL default '0'," . " `ftps` int(15) NOT NULL default '0'," . " `ftps_used` int(15) NOT NULL default '0'," . " `subdomains` int(15) NOT NULL default '0'," . " `subdomains_used` int(15) NOT NULL default '0'," . " `traffic` int(15) NOT NULL default '0'," . " `traffic_used` int(15) NOT NULL default '0'," . " `deactivated` tinyint(1) NOT NULL default '0'," . " `lastlogin_succ` int(11) unsigned NOT NULL default '0'," . " `lastlogin_fail` int(11) unsigned NOT NULL default '0'," . " `loginfail_count` int(11) unsigned NOT NULL default '0'," . " PRIMARY KEY (`adminid`)" . ") ENGINE=MyISAM ;");
|
||||
|
||||
// Insert Admin user
|
||||
|
||||
if(!isset($adminusername)
|
||||
|| $adminusername == '')
|
||||
{
|
||||
$adminusername = 'admin';
|
||||
$adminpassword = 'admin';
|
||||
}
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` (`loginname`, `password`, `name`, `email`, `customers`, `customers_used`, `customers_see_all`, `domains`, `domains_used`, `domains_see_all`, `change_serversettings`, `diskspace`, `diskspace_used`, `mysqls`, `mysqls_used`, `emails`, `emails_used`, `email_forwarders`, `email_forwarders_used`, `ftps`, `ftps_used`, `subdomains`, `subdomains_used`, `traffic`, `traffic_used`, `deactivated`) VALUES ('" . $db->escape($adminusername) . "', '" . md5($adminpassword) . "', 'Siteadmin', 'admin@servername', -1, 0, 1, -1, 0, 1, 1, -1024, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1048576, 0, 0);");
|
||||
|
||||
// Alter Tables
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `adminid` INT( 11 ) UNSIGNED NOT NULL ," . "ADD `lastlogin_succ` INT( 11 ) UNSIGNED NOT NULL ," . "ADD `lastlogin_fail` INT( 11 ) UNSIGNED NOT NULL ," . "ADD `loginfail_count` INT( 11 ) UNSIGNED NOT NULL ;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD INDEX ( `adminid` ) ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `adminid` = '1'");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `adminid` INT( 11 ) UNSIGNED NOT NULL ," . "ADD `iswildcarddomain` TINYINT( 1 ) NOT NULL ," . "ADD `speciallogfile` TINYINT( 1 ) NOT NULL ;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD INDEX ( `adminid` ) ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `adminid` = '1'");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_SESSIONS . "` CHANGE `customerid` `userid` INT( 11 ) UNSIGNED DEFAULT '0' NOT NULL ");
|
||||
$db->query("ALTER TABLE `" . TABLE_MAIL_USERS . "` CHANGE `password` `password_enc` VARCHAR( 128 ) NOT NULL ");
|
||||
$db->query("ALTER TABLE `" . TABLE_MAIL_USERS . "` ADD `password` VARCHAR( 128 ) NOT NULL AFTER `email` ;");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (26, 'panel', 'webmail_url', '');");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (27, 'panel', 'webftp_url', '');");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (28, 'panel', 'standardlanguage', 'german');");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `varname`='ipaddress' WHERE `settinggroup`='system' AND `varname`='ipadress'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.2.0' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.2.0';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,132 +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 Install
|
||||
*
|
||||
*/
|
||||
|
||||
define('TABLE_POSTFIX_TRANSPORT', 'postfix_transport');
|
||||
define('TABLE_POSTFIX_USERS', 'postfix_users');
|
||||
define('TABLE_POSTFIX_VIRTUAL', 'postfix_virtual');
|
||||
define('TABLE_PROFTPD_GROUPS', 'proftpd_groups');
|
||||
define('TABLE_PROFTPD_USERS', 'proftpd_users');
|
||||
|
||||
if(!isset($settings['panel']['version']))
|
||||
{
|
||||
$settings['panel']['version'] = '1.0.0';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.0')
|
||||
{
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '1.0.1')");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `openbasedir` TINYINT( 1 ) NOT NULL , ADD `safemode` TINYINT( 1 ) NOT NULL");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `openbasedir`='1', `safemode`='1'");
|
||||
$settings['panel']['version'] = '1.0.1';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.1')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_USERS . "` ADD `domainid` INT( 11 ) NOT NULL AFTER `postfix`");
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_VIRTUAL . "` ADD `domainid` INT( 11 ) NOT NULL AFTER `destination`");
|
||||
$result = $db->query("SELECT `id`, `domain` FROM `" . TABLE_PANEL_DOMAINS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_POSTFIX_USERS . "` SET `domainid`='" . (int)$row['id'] . "' WHERE `email` LIKE '%@" . $db->escape($row['domain']) . "'");
|
||||
$db->query("UPDATE `" . TABLE_POSTFIX_VIRTUAL . "` SET `domainid`='" . (int)$row['id'] . "' WHERE `email` LIKE '%@" . $db->escape($row['domain']) . "'");
|
||||
}
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `createstdsubdomain` TINYINT( 1 ) NOT NULL AFTER `documentroot`");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
$hostname = explode('@', $settings['panel']['adminmail']);
|
||||
$hostname = $hostname[1];
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', '" . $db->escape($hostname) . "')");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.2' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.2';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.2')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_SESSIONS . "` ADD `language` VARCHAR( 64 ) NOT NULL AFTER `lastactivity` ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.3' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.3';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.3')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.4' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.4';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.4')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.5' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.5';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.5')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `deactivated` TINYINT( 1 ) NOT NULL ;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `deactivated` TINYINT( 1 ) NOT NULL ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.6' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.6';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.6')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_VIRTUAL . "` ADD `popaccountid` INT( 11 ) NOT NULL ;");
|
||||
$result = $db->query("SELECT `id`, `email` FROM `" . TABLE_POSTFIX_USERS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_POSTFIX_VIRTUAL . "` SET `popaccountid`='" . (int)$row['id'] . "' WHERE `email` = '" . $db->escape(str_replace($settings['email']['catchallkeyword'], '', $row['email'])) . "' AND `destination` = '" . $db->escape($row['email']) . "'");
|
||||
}
|
||||
|
||||
$result = $db->query("SELECT `id`, `email`, `destination` FROM `" . TABLE_POSTFIX_VIRTUAL . "` WHERE `popaccountid` = '0'");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(str_replace($settings['email']['catchallkeyword'], '', $row['email']) != $row['email'])
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_POSTFIX_VIRTUAL . "` SET `email` = '" . $db->escape(str_replace($settings['email']['catchallkeyword'], '', $row['email'])) . "' WHERE `id` = '" . (int)$row['id'] . "'");
|
||||
}
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.7' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.7';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.7')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.8' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.8';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.8')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DATABASES . "` DROP `password` ;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `specialsettings` TEXT NOT NULL AFTER `safemode` ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.9' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.9';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.9')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.10' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.10';
|
||||
}
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,120 +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 Install
|
||||
*
|
||||
*/
|
||||
|
||||
if($settings['panel']['version'] == '1.4')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.4 to 1.4-svn1");
|
||||
|
||||
// Going to fix the stuff the update 1.2.19-svn42 to 1.2.19-svn43 broke
|
||||
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `documentroot` LIKE 'http%';");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(preg_match("#(https?)://?(.*)#i", $row['documentroot'], $matches))
|
||||
{
|
||||
$row['documentroot'] = $matches[1] . "://" . $matches[2];
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `documentroot` = '" . $db->escape($row['documentroot']) . "' WHERE `id` = '" . $row['id'] . "';");
|
||||
}
|
||||
}
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'1.4-svn1\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '1.4-svn1';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4-svn1')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.4-svn1 to 1.4.1");
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'1.4.1\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '1.4.1';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4.1')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.4.1 to 1.4.1-svn1");
|
||||
|
||||
// give at least ONE admin the permission to edit phpsettings, bug #1031
|
||||
|
||||
$cntCanEditPHP = $db->query_first("SELECT COUNT(`caneditphpsettings`) as `cnt` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `caneditphpsettings` = '1'");
|
||||
|
||||
if($cntCanEditPHP['cnt'] <= 0)
|
||||
{
|
||||
// none of the admins can edit php-settings,
|
||||
//so we give those who can edit serversettings the right to edit php-settings
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `caneditphpsettings` = '1' WHERE `change_serversettings` = '1'");
|
||||
}
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'1.4.1-svn1\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '1.4.1-svn1';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4.1-svn1')
|
||||
{
|
||||
$updateto = '1.4.1-svn2';
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from " . $settings['panel']['version'] . " to " . $updateto);
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'' . $updateto . '\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $updateto;
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4.1-svn2')
|
||||
{
|
||||
$updateto = '1.4.1-svn3';
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from " . $settings['panel']['version'] . " to " . $updateto);
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'' . $updateto . '\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $updateto;
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4.1-svn3')
|
||||
{
|
||||
$updateto = '1.4.2';
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from " . $settings['panel']['version'] . " to " . $updateto);
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'' . $updateto . '\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $updateto;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,122 +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 Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns an array with all tables with keys which are in the currently selected database
|
||||
*
|
||||
* @param db A valid DB-object
|
||||
* @return array Array with tables and keys
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function getTables(&$db)
|
||||
{
|
||||
// This variable is our return-value
|
||||
|
||||
$tables = array();
|
||||
|
||||
// The fieldname in the associative array which we get by fetch_array()
|
||||
|
||||
$tablefieldname = 'Tables_in_' . $db->database;
|
||||
|
||||
// Query for a list of tables in the currently selected database
|
||||
|
||||
$tables_result = $db->query('SHOW TABLES');
|
||||
|
||||
while($tables_row = $db->fetch_array($tables_result))
|
||||
{
|
||||
// Extract tablename
|
||||
|
||||
$tablename = $tables_row[$tablefieldname];
|
||||
|
||||
// Create sub-array with key tablename
|
||||
|
||||
$tables[$tablename] = array();
|
||||
|
||||
// Query for a list of indexes of the currently selected table
|
||||
|
||||
$keys_result = $db->query('SHOW INDEX FROM ' . $tablename);
|
||||
|
||||
while($keys_row = $db->fetch_array($keys_result))
|
||||
{
|
||||
// Extract keyname
|
||||
|
||||
$keyname = $keys_row['Key_name'];
|
||||
|
||||
// If there is aleady a key in our tablename-sub-array with has the same name as our key
|
||||
// OR if the sequence is not one
|
||||
// then we have more then index-columns for our keyname
|
||||
|
||||
if((isset($tables[$tablename][$keyname]) && $tables[$tablename][$keyname] != '')
|
||||
|| $keys_row['Seq_in_index'] != '1')
|
||||
{
|
||||
// If there is no keyname in the tablename-sub-array set ...
|
||||
|
||||
if(!isset($tables[$tablename][$keyname]))
|
||||
{
|
||||
// ... then create one
|
||||
|
||||
$tables[$tablename][$keyname] = array();
|
||||
}
|
||||
|
||||
// If the keyname-sub-array isn't an array ...
|
||||
|
||||
elseif (!is_array($tables[$tablename][$keyname]))
|
||||
{
|
||||
// temporary move columname
|
||||
|
||||
$tmpkeyvalue = $tables[$tablename][$keyname];
|
||||
|
||||
// unset keyname-key
|
||||
|
||||
unset($tables[$tablename][$keyname]);
|
||||
|
||||
// create new array for keyname-key
|
||||
|
||||
$tables[$tablename][$keyname] = array();
|
||||
|
||||
// keyindex will be 1 by default, if seq is also 1 we'd better use 0 (this case shouldn't ever occur)
|
||||
|
||||
$keyindex = ($keys_row['Seq_in_index'] == '1') ? '0' : '1';
|
||||
|
||||
// then move back our tmp columname from above
|
||||
|
||||
$tables[$tablename][$keyname][$keyindex] = $tmpkeyvalue;
|
||||
|
||||
// end unset the variable afterwards
|
||||
|
||||
unset($tmpkeyvalue);
|
||||
}
|
||||
|
||||
// set columname
|
||||
|
||||
$tables[$tablename][$keyname][$keys_row['Seq_in_index']] = $keys_row['Column_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// set columname
|
||||
|
||||
$tables[$tablename][$keyname] = $keys_row['Column_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tables;
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
function maildirExists($result = null)
|
||||
{
|
||||
global $settings, $theme;
|
||||
global $settings;
|
||||
|
||||
if(is_array($result))
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
function makeChownWithNewStats($row)
|
||||
{
|
||||
global $settings, $theme;
|
||||
global $settings;
|
||||
|
||||
// get correct user
|
||||
if($settings['system']['mod_fcgid'] == '1' && isset($row['deactivated']) && $row['deactivated'] == '0')
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
function makePathfield($path, $uid, $gid, $fieldType, $value = '', $dom = false)
|
||||
{
|
||||
global $lng, $theme;
|
||||
global $lng;
|
||||
|
||||
$value = str_replace($path, '', $value);
|
||||
$field = array();
|
||||
|
||||
@@ -20,101 +20,33 @@
|
||||
/**
|
||||
* Wrapper around the exec command.
|
||||
*
|
||||
* @author Martin Burchert <eremit@adm1n.de>
|
||||
* @version 1.2
|
||||
* @param string exec_string String to be executed
|
||||
* @return string The result of the exec()
|
||||
*
|
||||
* History:
|
||||
* 1.0 : Initial Version
|
||||
* 1.1 : Added |,&,>,<,`,*,$,~,? as security breaks.
|
||||
* 1.2 : Removed * as security break
|
||||
* @return string The result of the exec()
|
||||
*/
|
||||
function safe_exec($exec_string, &$return_value = false) {
|
||||
|
||||
function safe_exec($exec_string, &$return_value = false)
|
||||
{
|
||||
global $settings, $theme;
|
||||
|
||||
//
|
||||
// define allowed system commands
|
||||
//
|
||||
|
||||
$allowed_commands = array(
|
||||
'touch',
|
||||
'chown',
|
||||
'mkdir',
|
||||
'webalizer',
|
||||
'cp',
|
||||
'du',
|
||||
'chmod',
|
||||
'chattr',
|
||||
'chflags', /* freebsd equivalent to linux' chattr */
|
||||
$settings['system']['apachereload_command'],
|
||||
$settings['system']['bindreload_command'],
|
||||
$settings['dkim']['dkimrestart_command'],
|
||||
'openssl',
|
||||
'unzip',
|
||||
'php',
|
||||
'rm',
|
||||
'awstats_buildstaticpages.pl',
|
||||
'ln'
|
||||
);
|
||||
|
||||
//
|
||||
// check for ; in execute command
|
||||
//
|
||||
|
||||
// check for bad signs in execute command
|
||||
if ((stristr($exec_string, ';'))
|
||||
or (stristr($exec_string, '|'))
|
||||
or (stristr($exec_string, '&'))
|
||||
or (stristr($exec_string, '>'))
|
||||
or (stristr($exec_string, '<'))
|
||||
or (stristr($exec_string, '`'))
|
||||
or (stristr($exec_string, '$'))
|
||||
or (stristr($exec_string, '~'))
|
||||
or (stristr($exec_string, '?')))
|
||||
{
|
||||
|| (stristr($exec_string, '|'))
|
||||
|| (stristr($exec_string, '&'))
|
||||
|| (stristr($exec_string, '>'))
|
||||
|| (stristr($exec_string, '<'))
|
||||
|| (stristr($exec_string, '`'))
|
||||
|| (stristr($exec_string, '$'))
|
||||
|| (stristr($exec_string, '~'))
|
||||
|| (stristr($exec_string, '?'))
|
||||
) {
|
||||
die('SECURITY CHECK FAILED!' . "\n" . 'The execute string "' . htmlspecialchars($exec_string) . '" is a possible security risk!' . "\n" . 'Please check your whole server for security problems by hand!' . "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* This is not needed anymore, we allow all commands and just check for pipes and stuff
|
||||
//
|
||||
// check if command is allowed here
|
||||
//
|
||||
|
||||
$ok = false;
|
||||
foreach($allowed_commands as $allowed_command)
|
||||
{
|
||||
if(strpos($exec_string, $allowed_command) === 0
|
||||
&& (strlen($exec_string) === ($allowed_command_pos = strlen($allowed_command)) || substr($exec_string, $allowed_command_pos, 1) === ' '))
|
||||
{
|
||||
$ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$ok)
|
||||
{
|
||||
die('SECURITY CHECK FAILED!' . "\n" . 'Your command "' . htmlspecialchars($exec_string) . '" is not allowed!' . "\n" . 'Please check your whole server for security problems by hand!' . "\n");
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// execute the command and return output
|
||||
//
|
||||
// --- martin @ 08.08.2005 -------------------------------------------------------
|
||||
// fixing usage of uninitialised variable
|
||||
|
||||
$return = '';
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
if($return_value == false)
|
||||
{
|
||||
if ($return_value == false) {
|
||||
exec($exec_string, $return);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
exec($exec_string, $return, $return_value);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,18 +25,26 @@
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false)
|
||||
{
|
||||
global $db, $settings, $pathtophpfiles, $theme;
|
||||
function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false) {
|
||||
|
||||
global $settings;
|
||||
|
||||
if ($force
|
||||
|| (int)$settings['system']['store_index_file_subs'] == 1
|
||||
) {
|
||||
$result = $db->query("SELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login` FROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c` INNER JOIN `" . TABLE_PANEL_ADMINS . "` AS `a` ON `c`.`adminid` = `a`.`adminid` INNER JOIN `" . TABLE_PANEL_TEMPLATES . "` AS `t` ON `a`.`adminid` = `t`.`adminid` WHERE `varname` = 'index_html' AND `c`.`loginname` = '" . $db->escape($loginname) . "'");
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login`
|
||||
FROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c` INNER JOIN `" . TABLE_PANEL_ADMINS . "` AS `a`
|
||||
ON `c`.`adminid` = `a`.`adminid`
|
||||
INNER JOIN `" . TABLE_PANEL_TEMPLATES . "` AS `t`
|
||||
ON `a`.`adminid` = `t`.`adminid`
|
||||
WHERE `varname` = 'index_html' AND `c`.`loginname` = :loginname");
|
||||
Database::pexecute($result_stmt, array('loginname' => $loginname));
|
||||
|
||||
if (Database::num_rows() > 0) {
|
||||
|
||||
$template = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($db->num_rows($result) > 0)
|
||||
{
|
||||
$template = $db->fetch_array($result);
|
||||
$replace_arr = array(
|
||||
'SERVERNAME' => $settings['system']['hostname'],
|
||||
'CUSTOMER' => $template['customer_login'],
|
||||
@@ -44,6 +52,7 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul
|
||||
'CUSTOMER_EMAIL' => $template['customer_email'],
|
||||
'ADMIN_EMAIL' => $template['admin_email']
|
||||
);
|
||||
|
||||
$htmlcontent = replace_variables($template['value'], $replace_arr);
|
||||
$indexhtmlpath = makeCorrectFile($destination . '/index.' . $settings['system']['index_file_extension']);
|
||||
$index_html_handler = fopen($indexhtmlpath, 'w');
|
||||
@@ -52,14 +61,13 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul
|
||||
if ($logger !== null) {
|
||||
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Creating \'index.' . $settings['system']['index_file_extension'] . '\' for Customer \'' . $template['customer_login'] . '\' based on template in directory ' . escapeshellarg($indexhtmlpath));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
$destination = makeCorrectDir($destination);
|
||||
if ($logger !== null) {
|
||||
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Running: cp -a ' . $pathtophpfiles . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
|
||||
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Running: cp -a ' . FROXLOR_INSTALL_DIR . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
|
||||
}
|
||||
safe_exec('cp -a ' . $pathtophpfiles . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
|
||||
safe_exec('cp -a ' . FROXLOR_INSTALL_DIR . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/**
|
||||
* this functions validates a given value as ErrorDocument
|
||||
* refs #267
|
||||
*
|
||||
@@ -24,20 +24,18 @@
|
||||
* @return string error-document-string
|
||||
*
|
||||
*/
|
||||
function correctErrorDocument($errdoc = null)
|
||||
{
|
||||
global $settings, $idna_convert, $theme;
|
||||
function correctErrorDocument($errdoc = null) {
|
||||
|
||||
if($errdoc !== null && $errdoc != '')
|
||||
{
|
||||
global $settings, $idna_convert;
|
||||
|
||||
if ($errdoc !== null && $errdoc != '') {
|
||||
// not a URL
|
||||
if ((strtoupper(substr($errdoc, 0, 5)) != 'HTTP:'
|
||||
&& strtoupper(substr($errdoc, 0, 6)) != 'HTTPS:')
|
||||
|| !validateUrl($idna_convert->encode($errdoc)))
|
||||
{
|
||||
|| !validateUrl($idna_convert->encode($errdoc))
|
||||
) {
|
||||
// a file
|
||||
if(substr($errdoc, 0, 1) != '"')
|
||||
{
|
||||
if (substr($errdoc, 0, 1) != '"') {
|
||||
$errdoc = makeCorrectFile($errdoc);
|
||||
// apache needs a starting-slash (starting at the domains-docroot)
|
||||
if (!substr($errdoc, 0, 1) == '/') {
|
||||
@@ -45,23 +43,17 @@
|
||||
}
|
||||
}
|
||||
// a string (check for ending ")
|
||||
else
|
||||
{
|
||||
else {
|
||||
// string won't work for lighty
|
||||
if($settings['system']['webserver'] == 'lighttpd')
|
||||
{
|
||||
if ($settings['system']['webserver'] == 'lighttpd') {
|
||||
standard_error('stringerrordocumentnotvalidforlighty');
|
||||
}
|
||||
elseif(substr($errdoc, -1) != '"')
|
||||
{
|
||||
|
||||
} elseif(substr($errdoc, -1) != '"') {
|
||||
$errdoc .= '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($settings['system']['webserver'] == 'lighttpd')
|
||||
{
|
||||
} else {
|
||||
if ($settings['system']['webserver'] == 'lighttpd') {
|
||||
standard_error('urlerrordocumentnotvalidforlighty');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,50 +22,49 @@
|
||||
*
|
||||
* @return array array of cron-files which are to be executed
|
||||
*/
|
||||
function getNextCronjobs()
|
||||
{
|
||||
global $db, $theme;
|
||||
function getNextCronjobs() {
|
||||
|
||||
$query = "SELECT `id`, `cronfile` FROM `".TABLE_PANEL_CRONRUNS."` WHERE `interval` <> '0' AND `isactive` = '1' AND (";
|
||||
|
||||
$intervals = getIntervalOptions();
|
||||
|
||||
$x = 0;
|
||||
foreach($intervals as $name => $ival)
|
||||
{
|
||||
|
||||
foreach($intervals as $name => $ival) {
|
||||
|
||||
if($name == '0') continue;
|
||||
|
||||
if($x == 0) {
|
||||
$query.= '(UNIX_TIMESTAMP(DATE_ADD(FROM_UNIXTIME(`lastrun`), INTERVAL '.$ival.')) <= UNIX_TIMESTAMP() AND `interval`=\''.$ival.'\')';
|
||||
$query.= "(UNIX_TIMESTAMP(DATE_ADD(FROM_UNIXTIME(`lastrun`), INTERVAL ".$ival.")) <= UNIX_TIMESTAMP() AND `interval` = '".$ival."')";
|
||||
} else {
|
||||
$query.= ' OR (UNIX_TIMESTAMP(DATE_ADD(FROM_UNIXTIME(`lastrun`), INTERVAL '.$ival.')) <= UNIX_TIMESTAMP() AND `interval`=\''.$ival.'\')';
|
||||
$query.= " OR (UNIX_TIMESTAMP(DATE_ADD(FROM_UNIXTIME(`lastrun`), INTERVAL ".$ival.")) <= UNIX_TIMESTAMP() AND `interval` = '".$ival."')";
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
|
||||
$query.= ');';
|
||||
|
||||
$result = $db->query($query);
|
||||
$result = Database::query($query);
|
||||
|
||||
$cron_files = array();
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
// Update lastrun-timestamp
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$cron_files[] = $row['cronfile'];
|
||||
$db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = UNIX_TIMESTAMP() WHERE `id` ='".(int)$row['id']."';");
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = UNIX_TIMESTAMP() WHERE `id` = :id;"
|
||||
);
|
||||
Database::pexecute($upd_stmt, array('id' => $row['id']));
|
||||
}
|
||||
|
||||
return $cron_files;
|
||||
}
|
||||
|
||||
function includeCronjobs($debugHandler) {
|
||||
|
||||
function includeCronjobs($debugHandler, $pathtophpfiles)
|
||||
{
|
||||
global $settings, $theme, $cronlog;
|
||||
global $cronlog;
|
||||
|
||||
$cronjobs = getNextCronjobs();
|
||||
|
||||
$jobs_to_run = array();
|
||||
$cron_path = makeCorrectDir($pathtophpfiles.'/scripts/jobs/');
|
||||
$cron_path = makeCorrectDir(FROXLOR_INSTALL_DIR.'/scripts/jobs/');
|
||||
|
||||
if ($cronjobs !== false
|
||||
&& is_array($cronjobs)
|
||||
@@ -85,24 +84,21 @@ function includeCronjobs($debugHandler, $pathtophpfiles)
|
||||
}
|
||||
|
||||
|
||||
function getIntervalOptions()
|
||||
{
|
||||
global $db, $lng, $cronlog, $theme;
|
||||
function getIntervalOptions() {
|
||||
|
||||
global $lng, $cronlog;
|
||||
|
||||
$query = "SELECT DISTINCT `interval` FROM `" . TABLE_PANEL_CRONRUNS . "` ORDER BY `interval` ASC;";
|
||||
$result = $db->query($query);
|
||||
$cron_intervals = array();
|
||||
$result = Database::query($query);
|
||||
|
||||
$cron_intervals = array();
|
||||
$cron_intervals['0'] = $lng['panel']['off'];
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(validateSqlInterval($row['interval']))
|
||||
{
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (validateSqlInterval($row['interval'])) {
|
||||
$cron_intervals[$row['interval']] = $row['interval'];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$cronlog->logAction(CRON_ACTION, LOG_ERROR, "Invalid SQL-Interval ".$row['interval']." detected. Please fix this in the database.");
|
||||
}
|
||||
}
|
||||
@@ -111,17 +107,16 @@ function getIntervalOptions()
|
||||
}
|
||||
|
||||
|
||||
function getCronjobsLastRun()
|
||||
{
|
||||
global $db, $lng, $theme;
|
||||
function getCronjobsLastRun() {
|
||||
|
||||
global $lng;
|
||||
|
||||
$query = "SELECT `lastrun`, `desc_lng_key` FROM `".TABLE_PANEL_CRONRUNS."` WHERE `isactive` = '1' ORDER BY `cronfile` ASC";
|
||||
$result = $db->query($query);
|
||||
$result = Database::query($query);
|
||||
|
||||
$cronjobs_last_run = '';
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$lastrun = $lng['cronjobs']['notyetrun'];
|
||||
if ($row['lastrun'] > 0) {
|
||||
$lastrun = date('d.m.Y H:i:s', $row['lastrun']);
|
||||
@@ -136,97 +131,74 @@ function getCronjobsLastRun()
|
||||
return $cronjobs_last_run;
|
||||
}
|
||||
|
||||
function toggleCronStatus($module = null, $isactive = 0)
|
||||
{
|
||||
global $db, $theme;
|
||||
function toggleCronStatus($module = null, $isactive = 0) {
|
||||
|
||||
if($isactive != 1) {
|
||||
$isactive = 0;
|
||||
}
|
||||
|
||||
$query = "UPDATE `".TABLE_PANEL_CRONRUNS."` SET `isactive` = '".(int)$isactive."' WHERE `module` = '".$module."'";
|
||||
$db->query($query);
|
||||
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `".TABLE_PANEL_CRONRUNS."` SET `isactive` = :active WHERE `module` = :module"
|
||||
);
|
||||
Database::pexecute($upd_stmt, array('active' => $isactive, 'module' => $module));
|
||||
}
|
||||
|
||||
function getOutstandingTasks()
|
||||
{
|
||||
global $db, $lng, $theme;
|
||||
function getOutstandingTasks() {
|
||||
|
||||
global $lng;
|
||||
|
||||
$query = "SELECT * FROM `".TABLE_PANEL_TASKS."` ORDER BY `type` ASC";
|
||||
$result = $db->query($query);
|
||||
$result = Database::query($query);
|
||||
|
||||
$value = '<ul class="cronjobtask">';
|
||||
$tasks = '';
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($row['data'] != '')
|
||||
{
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if ($row['data'] != '') {
|
||||
$row['data'] = unserialize($row['data']);
|
||||
}
|
||||
|
||||
/*
|
||||
* rebuilding webserver-configuration
|
||||
*/
|
||||
if($row['type'] == '1')
|
||||
{
|
||||
// rebuilding webserver-configuration
|
||||
if ($row['type'] == '1') {
|
||||
$task_desc = $lng['tasks']['rebuild_webserverconfig'];
|
||||
}
|
||||
/*
|
||||
* adding new user
|
||||
*/
|
||||
elseif($row['type'] == '2')
|
||||
{
|
||||
// adding new user/
|
||||
elseif ($row['type'] == '2') {
|
||||
$loginname = '';
|
||||
if(is_array($row['data']))
|
||||
{
|
||||
if (is_array($row['data'])) {
|
||||
$loginname = $row['data']['loginname'];
|
||||
}
|
||||
$task_desc = $lng['tasks']['adding_customer'];
|
||||
$task_desc = str_replace('%loginname%', $loginname, $task_desc);
|
||||
}
|
||||
/*
|
||||
* rebuilding bind-configuration
|
||||
*/
|
||||
elseif($row['type'] == '4')
|
||||
{
|
||||
// rebuilding bind-configuration
|
||||
elseif ($row['type'] == '4') {
|
||||
$task_desc = $lng['tasks']['rebuild_bindconfig'];
|
||||
}
|
||||
/*
|
||||
* creating ftp-user directory
|
||||
*/
|
||||
elseif($row['type'] == '5')
|
||||
{
|
||||
// creating ftp-user directory
|
||||
elseif ($row['type'] == '5') {
|
||||
$task_desc = $lng['tasks']['creating_ftpdir'];
|
||||
}
|
||||
/*
|
||||
* deleting user-files
|
||||
*/
|
||||
elseif($row['type'] == '6')
|
||||
{
|
||||
// deleting user-files
|
||||
elseif ($row['type'] == '6') {
|
||||
$loginname = '';
|
||||
if(is_array($row['data']))
|
||||
{
|
||||
if (is_array($row['data'])) {
|
||||
$loginname = $row['data']['loginname'];
|
||||
}
|
||||
$task_desc = $lng['tasks']['deleting_customerfiles'];
|
||||
$task_desc = str_replace('%loginname%', $loginname, $task_desc);
|
||||
}
|
||||
elseif($row['type'] == '7')
|
||||
{
|
||||
// deleteing email-account
|
||||
elseif ($row['type'] == '7') {
|
||||
$task_desc = $lng['tasks']['remove_emailacc_files'];
|
||||
}
|
||||
/*
|
||||
* Set FS - quota
|
||||
*/
|
||||
elseif($row['type'] == '10')
|
||||
{
|
||||
// Set FS - quota
|
||||
elseif ($row['type'] == '10') {
|
||||
$task_desc = $lng['tasks']['diskspace_set_quota'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$task_desc = "ERROR: Unknown task type '".$row['type'].
|
||||
"'";
|
||||
// unknown
|
||||
else {
|
||||
$task_desc = "ERROR: Unknown task type '".$row['type']."'";
|
||||
}
|
||||
|
||||
if($task_desc != '') {
|
||||
@@ -235,50 +207,31 @@ function getOutstandingTasks()
|
||||
}
|
||||
|
||||
$query2 = "SELECT DISTINCT `Task` FROM `".TABLE_APS_TASKS."` ORDER BY `Task` ASC";
|
||||
$result2 = $db->query($query2);
|
||||
$result2 = Database::query($query2);
|
||||
|
||||
while($row2 = $db->fetch_array($result2))
|
||||
{
|
||||
/*
|
||||
* install
|
||||
*/
|
||||
if($row2['Task'] == '1')
|
||||
{
|
||||
while ($row2 = $result2->fetch(PDO::FETCH_ASSOC)) {
|
||||
// install
|
||||
if ($row2['Task'] == '1') {
|
||||
$task_desc = $lng['tasks']['aps_task_install'];
|
||||
}
|
||||
/*
|
||||
* remove
|
||||
*/
|
||||
elseif($row2['Task'] == '2')
|
||||
{
|
||||
// remove
|
||||
elseif ($row2['Task'] == '2') {
|
||||
$task_desc = $lng['tasks']['aps_task_remove'];
|
||||
}
|
||||
/*
|
||||
* reconfigure
|
||||
*/
|
||||
elseif($row2['Task'] == '3')
|
||||
{
|
||||
// reconfigure
|
||||
elseif ($row2['Task'] == '3') {
|
||||
$task_desc = $lng['tasks']['aps_task_reconfigure'];
|
||||
}
|
||||
/*
|
||||
* upgrade
|
||||
*/
|
||||
elseif($row2['Task'] == '4')
|
||||
{
|
||||
// upgrade
|
||||
elseif ($row2['Task'] == '4') {
|
||||
$task_desc = $lng['tasks']['aps_task_upgrade'];
|
||||
}
|
||||
/*
|
||||
* system update
|
||||
*/
|
||||
elseif($row2['Task'] == '5')
|
||||
{
|
||||
// system update
|
||||
elseif ($row2['Task'] == '5') {
|
||||
$task_desc = $lng['tasks']['aps_task_sysupdate'];
|
||||
}
|
||||
/*
|
||||
* system download
|
||||
*/
|
||||
elseif($row2['Task'] == '6')
|
||||
{
|
||||
// system download
|
||||
elseif ($row2['Task'] == '6') {
|
||||
$task_desc = $lng['tasks']['aps_task_sysdownload'];
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,11 @@
|
||||
* @param hostAliases
|
||||
* @return null
|
||||
*/
|
||||
function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot, $awstats_params = array()) {
|
||||
|
||||
function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot, $awstats_params = array())
|
||||
{
|
||||
global $pathtophpfiles, $settings, $theme;
|
||||
global $settings;
|
||||
|
||||
// Generation header
|
||||
|
||||
$header = "## GENERATED BY FROXLOR\n";
|
||||
$header2 = "## Do not remove the line above! This tells Froxlor to update this configuration\n## If you wish to manually change this configuration file, remove the first line to make sure Froxlor won't rebuild this file\n## Generated for domain {SITE_DOMAIN} on " . date('l dS \of F Y h:i:s A') . "\n";
|
||||
|
||||
@@ -49,7 +47,6 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot
|
||||
}
|
||||
|
||||
// These are the variables we will replace
|
||||
|
||||
$regex = array(
|
||||
'/\{LOG_FILE\}/',
|
||||
'/\{SITE_DOMAIN\}/',
|
||||
@@ -67,9 +64,7 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot
|
||||
|
||||
// File names
|
||||
$domain_file = makeCorrectFile($settings['system']['awstats_conf'].'/awstats.' . $siteDomain . '.conf');
|
||||
$model_file = dirname(dirname(dirname(dirname(__FILE__))));
|
||||
$model_file.= '/templates/misc/awstatsmodel/awstats.froxlor.model.conf';
|
||||
|
||||
$model_file = FROXLOR_INSTALL_DIR.'/templates/misc/awstatsmodel/awstats.froxlor.model.conf';
|
||||
$model_file = makeCorrectFile($model_file);
|
||||
|
||||
// Test if the file exists
|
||||
|
||||
@@ -20,27 +20,29 @@
|
||||
/**
|
||||
* This function generates the VHost configuration for AWStats
|
||||
* This will enable the /awstats url and enable security on these folders
|
||||
* @param siteDomain Name of the domain we want stats for
|
||||
* @return String with configuration for use in vhost file
|
||||
* @author Berend Dekens
|
||||
*
|
||||
* @param siteDomain Name of the domain we want stats for
|
||||
*
|
||||
* @return String with configuration for use in vhost file
|
||||
*/
|
||||
function createAWStatsVhost($siteDomain, $settings = null) {
|
||||
|
||||
if ($settings['system']['mod_fcgid'] != '1') {
|
||||
|
||||
function createAWStatsVhost($siteDomain, $settings = null)
|
||||
{
|
||||
if($settings['system']['mod_fcgid'] != '1')
|
||||
{
|
||||
$vhosts_file = ' # AWStats statistics' . "\n";
|
||||
$vhosts_file.= ' RewriteEngine On' . "\n";
|
||||
$vhosts_file.= ' RewriteRule ^/awstats(/.*)?$ /awstats/awstats.pl?config=' . $siteDomain . ' [L,PT]' . "\n";
|
||||
$vhosts_file.= ' RewriteRule ^/awstats.pl(.*)$ /awstats/awstats.pl$1 [QSA,L,PT]' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
|
||||
$vhosts_file = ' <IfModule mod_proxy.c>' . "\n";
|
||||
$vhosts_file.= ' RewriteEngine On' . "\n";
|
||||
$vhosts_file.= ' RewriteRule awstats.pl(.*)$ http://' . $settings['system']['hostname'] . '/cgi-bin/awstats.pl$1 [R,P]' . "\n";
|
||||
$vhosts_file.= ' RewriteRule awstats$ http://' . $settings['system']['hostname'] . '/cgi-bin/awstats.pl?config=' . $siteDomain . ' [R,P]' . "\n";
|
||||
$vhosts_file.= ' </IfModule>' . "\n";
|
||||
|
||||
}
|
||||
|
||||
return $vhosts_file;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function customerHasPerlEnabled
|
||||
*
|
||||
* returns true or false whether perl is
|
||||
@@ -25,13 +25,15 @@
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function customerHasPerlEnabled($cid = 0)
|
||||
{
|
||||
global $db, $theme;
|
||||
function customerHasPerlEnabled($cid = 0) {
|
||||
|
||||
if ($cid > 0) {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `perlenabled` FROM `".TABLE_PANEL_CUSTOMERS."` WHERE `customerid` = :cid"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('cid' => $cid));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($cid > 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `perlenabled` FROM `".TABLE_PANEL_CUSTOMERS."` WHERE `customerid` = '".(int)$cid."'");
|
||||
if (is_array($result)
|
||||
&& isset($result['perlenabled'])
|
||||
) {
|
||||
|
||||
@@ -23,12 +23,15 @@
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function domainHasMainSubDomains($id = 0)
|
||||
{
|
||||
global $db, $theme;
|
||||
function domainHasMainSubDomains($id = 0) {
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT COUNT(`id`) as `mainsubs` FROM `".TABLE_PANEL_DOMAINS."`
|
||||
WHERE `ismainbutsubto` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $id));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$sql = "SELECT COUNT(`id`) as `mainsubs` FROM `".TABLE_PANEL_DOMAINS."` WHERE `ismainbutsubto` = '".(int)$id."'";
|
||||
$result = $db->query_first($sql);
|
||||
if (isset($result['mainsubs'])
|
||||
&& $result['mainsubs'] > 0
|
||||
) {
|
||||
@@ -45,12 +48,14 @@ function domainHasMainSubDomains($id = 0)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function domainMainToSubExists($id = 0)
|
||||
{
|
||||
global $db, $theme;
|
||||
function domainMainToSubExists($id = 0) {
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id` FROM `".TABLE_PANEL_DOMAINS."` WHERE `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $id));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$sql = "SELECT `id` FROM `".TABLE_PANEL_DOMAINS."` WHERE `id` = '".(int)$id."'";
|
||||
$result = $db->query_first($sql);
|
||||
if (isset($result['id'])
|
||||
&& $result['id'] > 0
|
||||
) {
|
||||
|
||||
@@ -18,15 +18,25 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check whether a given domain has an ssl-ip/port assigned
|
||||
*
|
||||
* @param int $domainid
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function domainHasSslIpPort($domainid = 0) {
|
||||
global $db;
|
||||
|
||||
$result = $db->query_first("
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `dt`.* FROM `".TABLE_DOMAINTOIP."` `dt`, `".TABLE_PANEL_IPSANDPORTS."` `iap`
|
||||
WHERE `dt`.`id_ipandports` = `iap`.`id` AND `iap`.`ssl` = '1' AND `dt`.`id_domain` = '".(int)$domainid."';
|
||||
");
|
||||
WHERE `dt`.`id_ipandports` = `iap`.`id` AND `iap`.`ssl` = '1' AND `dt`.`id_domain` = :domainid;"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('domainid' => $domainid));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (is_array($result) && isset($result['id_ipandports'])) {
|
||||
if (is_array($result)
|
||||
&& isset($result['id_ipandports'])
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getAdmins($limit_resource = '')
|
||||
{
|
||||
function getAdmins($limit_resource = '') {
|
||||
|
||||
global $db, $theme;
|
||||
|
||||
$additional_conditions = '';
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michal Wojcik <m.wojcik@sonet3.pl>
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
@@ -21,6 +23,8 @@
|
||||
* @return string encrypted password
|
||||
*
|
||||
* @author Michal Wojcik <m.wojcik@sonet3.pl>
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
*
|
||||
* 0 - default crypt (depenend on system configuration)
|
||||
* 1 - MD5 $1$
|
||||
|
||||
@@ -19,7 +19,7 @@ define('MASTER_CRONJOB', 1);
|
||||
|
||||
include_once(dirname(__FILE__) . '/../lib/cron_init.php');
|
||||
|
||||
$jobs_to_run = includeCronjobs($debugHandler, $pathtophpfiles);
|
||||
$jobs_to_run = includeCronjobs($debugHandler);
|
||||
|
||||
/**
|
||||
* check for --help
|
||||
|
||||
Reference in New Issue
Block a user