diff --git a/install/froxlor.sql b/install/froxlor.sql index fb16e4af..26750025 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -555,7 +555,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'password_numeric', '0'), ('panel', 'password_special_char_required', '0'), ('panel', 'password_special_char', '!?<>ยง$%+#=@'), - ('panel', 'version', '0.9.35-rc1'), + ('panel', 'version', '0.9.35'), ('panel', 'db_version', '201603150'); diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index 6ebc6c81..3d3be715 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -14,14 +14,9 @@ * @package Install * */ - -if (!defined('AREA') - || (defined('AREA') && AREA != 'admin') - || !isset($userinfo['loginname']) - || (isset($userinfo['loginname']) && $userinfo['loginname'] == '') -) { +if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) { header('Location: ../../../../index.php'); - exit; + exit(); } if (isFroxlorVersion('0.9-r0')) { @@ -30,12 +25,11 @@ if (isFroxlorVersion('0.9-r0')) { showUpdateStep("Performing database updates"); // add missing database-updates if necessary (old: update/update_database.php) - if (Settings::Get('system.dbversion') !== null && (int)Settings::Get('system.dbversion') < 1) { + if (Settings::Get('system.dbversion') !== null && (int) Settings::Get('system.dbversion') < 1) { Database::query(" - ALTER TABLE `panel_databases` ADD `dbserver` INT( 11 ) UNSIGNED NOT NULL default '0';" - ); + ALTER TABLE `panel_databases` ADD `dbserver` INT( 11 ) UNSIGNED NOT NULL default '0';"); } - if (Settings::Get('system.dbversion') !== null && (int)Settings::Get('system.dbversion') < 2) { + if (Settings::Get('system.dbversion') !== null && (int) Settings::Get('system.dbversion') < 2) { Database::query("ALTER TABLE `panel_ipsandports` CHANGE `ssl_cert` `ssl_cert_file` VARCHAR( 255 ) NOT NULL, ADD `ssl_key_file` VARCHAR( 255 ) NOT NULL, ADD `ssl_ca_file` VARCHAR( 255 ) NOT NULL, @@ -46,7 +40,7 @@ if (isFroxlorVersion('0.9-r0')) { } // eof(lostuff) - //remove billing tables in database + // remove billing tables in database define('TABLE_BILLING_INVOICES', 'billing_invoices'); define('TABLE_BILLING_INVOICES_ADMINS', 'billing_invoices_admins'); define('TABLE_BILLING_INVOICE_CHANGES', 'billing_invoice_changes'); @@ -195,9 +189,7 @@ if (isFroxlorVersion('0.9-r1')) { Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('spf', 'spf_entry', '@ IN TXT \"v=spf1 a mx -all\"');"); Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `varname` = 'froxlor_graphic' WHERE `varname` = 'syscp_graphic'"); - if (Settings::Get('admin.syscp_graphic') !== null - && Settings::Get('admin.syscp_graphic') != '' - ){ + if (Settings::Get('admin.syscp_graphic') !== null && Settings::Get('admin.syscp_graphic') != '') { Settings::Set('admin.froxlor_graphic', Settings::Get('admin.syscp_graphic')); } else { Settings::Set('admin.froxlor_graphic', 'images/header.gif'); @@ -241,30 +233,30 @@ if (isFroxlorVersion('0.9-r3')) { // checking for active ticket-module $ticket_active = 0; - if ((int)Settings::Get('ticket.enabled') == 1) { + if ((int) Settings::Get('ticket.enabled') == 1) { $ticket_active = 1; } // checking for active aps-module $aps_active = 0; - if ((int)Settings::Get('aps.aps_active') == 1) { + if ((int) Settings::Get('aps.aps_active') == 1) { $aps_active = 1; } // checking for active autoresponder-module $ar_active = 0; - if ((int)Settings::Get('autoresponder.autoresponder_active') == 1) { + if ((int) Settings::Get('autoresponder.autoresponder_active') == 1) { $ar_active = 1; } Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/core', 'cron_tasks.php', '5 MINUTE', '1', 'cron_tasks');"); Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/core', 'cron_legacy.php', '5 MINUTE', '1', 'cron_legacy');"); - Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/aps', 'cron_apsinstaller.php', '5 MINUTE', ".$aps_active.", 'cron_apsinstaller');"); - Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/autoresponder', 'cron_autoresponder.php', '5 MINUTE', ".$ar_active.", 'cron_autoresponder');"); - Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/aps', 'cron_apsupdater.php', '1 HOUR', ".$aps_active.", 'cron_apsupdater');"); + Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/aps', 'cron_apsinstaller.php', '5 MINUTE', " . $aps_active . ", 'cron_apsinstaller');"); + Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/autoresponder', 'cron_autoresponder.php', '5 MINUTE', " . $ar_active . ", 'cron_autoresponder');"); + Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/aps', 'cron_apsupdater.php', '1 HOUR', " . $aps_active . ", 'cron_apsupdater');"); Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/core', 'cron_traffic.php', '1 DAY', '1', 'cron_traffic');"); - Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/ticket', 'cron_used_tickets_reset.php', '1 MONTH', '".$ticket_active."', 'cron_ticketsreset');"); - Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/ticket', 'cron_ticketarchive.php', '1 MONTH', '".$ticket_active."', 'cron_ticketarchive');"); + Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/ticket', 'cron_used_tickets_reset.php', '1 MONTH', '" . $ticket_active . "', 'cron_ticketsreset');"); + Database::query("INSERT INTO `cronjobs_run` (`module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES ('froxlor/ticket', 'cron_ticketarchive.php', '1 MONTH', '" . $ticket_active . "', 'cron_ticketarchive');"); lastStepStatus(0); showUpdateStep("Updating old settings values"); @@ -297,13 +289,10 @@ if (isFroxlorVersion('0.9.1')) { showUpdateStep("Updating from 0.9.1 to 0.9.2", false); showUpdateStep("Checking whether last-system-guid is sane"); - $result_stmt = Database::query("SELECT MAX(`guid`) as `latestguid` FROM `".TABLE_PANEL_CUSTOMERS."`"); + $result_stmt = Database::query("SELECT MAX(`guid`) as `latestguid` FROM `" . TABLE_PANEL_CUSTOMERS . "`"); $result = $result_stmt->fetch(PDO::FETCH_ASSOC); - if (isset($result['latestguid']) - && (int)$result['latestguid'] > 0 - && $result['latestguid'] != Settings::Get('system.lastguid') - ) { + if (isset($result['latestguid']) && (int) $result['latestguid'] > 0 && $result['latestguid'] != Settings::Get('system.lastguid')) { checkLastGuid(); lastStepStatus(1, 'fixed'); } else { @@ -349,14 +338,14 @@ if (isFroxlorVersion('0.9.3-svn2')) { showUpdateStep("Correcting cron start-times"); // set specific times for some crons (traffic only at night, etc.) $ts = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time())); - Database::query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_traffic.php';"); + Database::query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = '" . $ts . "' WHERE `cronfile` ='cron_traffic.php';"); $ts = mktime(1, 0, 0, date('m', time()), date('d', time()), date('Y', time())); - Database::query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_used_tickets_reset.php';"); - Database::query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_ticketarchive.php';"); + Database::query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = '" . $ts . "' WHERE `cronfile` ='cron_used_tickets_reset.php';"); + Database::query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = '" . $ts . "' WHERE `cronfile` ='cron_ticketarchive.php';"); lastStepStatus(0); showUpdateStep("Adding new language: Polish"); - Database::query("INSERT INTO `".TABLE_PANEL_LANGUAGE."` SET `language` = 'Polski', `file` = 'lng/polish.lng.php'"); + Database::query("INSERT INTO `" . TABLE_PANEL_LANGUAGE . "` SET `language` = 'Polski', `file` = 'lng/polish.lng.php'"); lastStepStatus(0); updateToVersion('0.9.3-svn3'); @@ -403,29 +392,21 @@ if (isFroxlorVersion('0.9.4')) { * some users might still have the setting in their database * because we already had this back in older versions. * To not confuse Froxlor, we just update old settings. - */ - if(Settings::Get('system.awstats_path') !== null - && Settings::Get('system.awstats_path') != '' - ) { + */ + if (Settings::Get('system.awstats_path') !== null && Settings::Get('system.awstats_path') != '') { showUpdateStep("Updating awstats path setting"); Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/usr/bin/' WHERE `settinggroup` = 'system' AND `varname` = 'awstats_path';"); lastStepStatus(0); - } - elseif(Settings::Get('system.awstats_path') == null) - { + } elseif (Settings::Get('system.awstats_path') == null) { showUpdateStep("Adding new awstats path setting"); Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'awstats_path', '/usr/bin/');"); lastStepStatus(0); } - if(Settings::Get('system.awstats_domain_file') !== null - && Settings::Get('system.awstats_domain_file') != '' - ) { + if (Settings::Get('system.awstats_domain_file') !== null && Settings::Get('system.awstats_domain_file') != '') { showUpdateStep("Updating awstats configuration path setting"); Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `varname` = 'awstats_conf' WHERE `varname` = 'awstats_domain_file';"); - } - else - { + } else { showUpdateStep("Adding awstats configuration path settings"); Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'awstats_conf', '/etc/awstats/');"); } @@ -446,15 +427,15 @@ if (isFroxlorVersion('0.9.4-svn1')) { if ($update_domains == 1) { showUpdateStep("Updating domains with iswildcarddomain=yes"); - $query = "SELECT `d`.`id` FROM `".TABLE_PANEL_DOMAINS."` `d`, `".TABLE_PANEL_CUSTOMERS."` `c` "; - $query.= "WHERE `parentdomainid`='0' AND `email_only` = '0' AND `d`.`customerid` = `c`.`customerid` AND `d`.`id` <> `c`.`standardsubdomain`"; + $query = "SELECT `d`.`id` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` "; + $query .= "WHERE `parentdomainid`='0' AND `email_only` = '0' AND `d`.`customerid` = `c`.`customerid` AND `d`.`id` <> `c`.`standardsubdomain`"; $result = Database::query($query); $updated_domains = 0; while ($domain = $result->fetch(PDO::FETCH_ASSOC)) { - Database::query("UPDATE `".TABLE_PANEL_DOMAINS."` SET `iswildcarddomain` = '1' WHERE `id` ='".(int)$domain['id']."'"); - $updated_domains++; + Database::query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `iswildcarddomain` = '1' WHERE `id` ='" . (int) $domain['id'] . "'"); + $updated_domains ++; } - lastStepStatus(0, 'Updated '.$updated_domains.' domain(s)'); + lastStepStatus(0, 'Updated ' . $updated_domains . ' domain(s)'); } else { showUpdateStep("Won't update domains with iswildcarddomain=yes as requested"); lastStepStatus(1); @@ -497,15 +478,16 @@ if (isFroxlorVersion('0.9.6-svn1')) { if ($update_adminmail !== false) { showUpdateStep("Checking newly entered admin-mail"); - if (!PHPMailer::ValidateAddress($update_adminmail)) { + if (! PHPMailer::ValidateAddress($update_adminmail)) { $do_update = false; lastStepStatus(2, 'E-Mail still not valid, go back and try again'); } else { $stmt = Database::prepare(" UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :adminmail - WHERE `settinggroup` = 'panel' AND `varname` = 'adminmail';" - ); - Database::pexecute($stmt, array('adminmail' => $update_adminmail)); + WHERE `settinggroup` = 'panel' AND `varname` = 'adminmail';"); + Database::pexecute($stmt, array( + 'adminmail' => $update_adminmail + )); lastStepStatus(0); } } @@ -534,51 +516,54 @@ if (isFroxlorVersion('0.9.6-svn2')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'defaultwebsrverrhandler', `varname` = :varname, - `value` = :err" - ); + `value` = :err"); - if (isset($_POST['update_deferr_500']) - && trim($_POST['update_deferr_500']) != '' - ) { - Database::pexecute($stmt, array('varname' => 'err500', 'err' => $_POST['update_deferr_500'])); + if (isset($_POST['update_deferr_500']) && trim($_POST['update_deferr_500']) != '') { + Database::pexecute($stmt, array( + 'varname' => 'err500', + 'err' => $_POST['update_deferr_500'] + )); $err500 = true; } - if(isset($_POST['update_deferr_401']) - && trim($_POST['update_deferr_401']) != '' - ) { - Database::pexecute($stmt, array('varname' => 'err401', 'err' => $_POST['update_deferr_401'])); + if (isset($_POST['update_deferr_401']) && trim($_POST['update_deferr_401']) != '') { + Database::pexecute($stmt, array( + 'varname' => 'err401', + 'err' => $_POST['update_deferr_401'] + )); $err401 = true; } - if(isset($_POST['update_deferr_403']) - && trim($_POST['update_deferr_403']) != '' - ) { - Database::pexecute($stmt, array('varname' => 'err403', 'err' => $_POST['update_deferr_403'])); + if (isset($_POST['update_deferr_403']) && trim($_POST['update_deferr_403']) != '') { + Database::pexecute($stmt, array( + 'varname' => 'err403', + 'err' => $_POST['update_deferr_403'] + )); $err403 = true; } - if(isset($_POST['update_deferr_404']) - && trim($_POST['update_deferr_404']) != '' - ) { - Database::pexecute($stmt, array('varname' => 'err404', 'err' => $_POST['update_deferr_404'])); + if (isset($_POST['update_deferr_404']) && trim($_POST['update_deferr_404']) != '') { + Database::pexecute($stmt, array( + 'varname' => 'err404', + 'err' => $_POST['update_deferr_404'] + )); $err404 = true; } } - if(!$update_deferr_enable) { + if (! $update_deferr_enable) { Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'enabled', '0');"); } - if(!$err401) { + if (! $err401) { Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'err401', '');"); } - if(!$err403) { + if (! $err403) { Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'err403', '');"); } - if(!$err404) { + if (! $err404) { Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'err404', '');"); } - if(!$err500) { + if (! $err500) { Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'err500', '');"); } @@ -594,7 +579,7 @@ if (isFroxlorVersion('0.9.6-svn3')) { $update_deftic_priority = isset($_POST['update_deftic_priority']) ? intval($_POST['update_deftic_priority']) : 2; showUpdateStep("Setting default support-ticket priority"); - Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('ticket', 'default_priority', '".(int)$update_deftic_priority."');"); + Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('ticket', 'default_priority', '" . (int) $update_deftic_priority . "');"); lastStepStatus(0); updateToVersion('0.9.6-svn4'); @@ -606,13 +591,13 @@ if (isFroxlorVersion('0.9.6-svn4')) { $update_defsys_phpconfig = isset($_POST['update_defsys_phpconfig']) ? intval($_POST['update_defsys_phpconfig']) : 1; - if($update_defsys_phpconfig != 1) { - showUpdateStep("Setting default php-configuration to user defined config #".$update_defsys_phpconfig); + if ($update_defsys_phpconfig != 1) { + showUpdateStep("Setting default php-configuration to user defined config #" . $update_defsys_phpconfig); } else { showUpdateStep("Adding default php-configuration setting to the database"); } - Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_defaultini', '".(int)$update_defsys_phpconfig."');"); + Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_defaultini', '" . (int) $update_defsys_phpconfig . "');"); lastStepStatus(0); updateToVersion('0.9.6-svn5'); @@ -627,7 +612,9 @@ if (isFroxlorVersion('0.9.6-svn5')) { // add ftp server setting $stmt = Database::prepare("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ftpserver', `value` = :value;"); - Database::pexecute($stmt, array('value' => $update_defsys_ftpserver)); + Database::pexecute($stmt, array( + 'value' => $update_defsys_ftpserver + )); // add proftpd quota Database::query("CREATE TABLE `ftp_quotalimits` (`name` varchar(30) default NULL, `quota_type` enum('user','group','class','all') NOT NULL default 'user', `per_session` enum('false','true') NOT NULL default 'false', `limit_type` enum('soft','hard') NOT NULL default 'hard', `bytes_in_avail` float NOT NULL, `bytes_out_avail` float NOT NULL, `bytes_xfer_avail` float NOT NULL, `files_in_avail` int(10) unsigned NOT NULL, `files_out_avail` int(10) unsigned NOT NULL, `files_xfer_avail` int(10) unsigned NOT NULL) ENGINE=MyISAM;"); @@ -640,8 +627,7 @@ if (isFroxlorVersion('0.9.6-svn5')) { while ($row_ftp_users = $result_ftp_users_stmt->fetch(PDO::FETCH_ASSOC)) { $result_ftp_quota_stmt = Database::query(" SELECT diskspace_used FROM `" . TABLE_PANEL_CUSTOMERS . "` - WHERE loginname = SUBSTRING_INDEX('" . $row_ftp_users['username'] . "', '" . Settings::Get('customer.ftpprefix') . "', 1);" - ); + WHERE loginname = SUBSTRING_INDEX('" . $row_ftp_users['username'] . "', '" . Settings::Get('customer.ftpprefix') . "', 1);"); $row_ftp_quota = $result_ftp_quota_stmt->fetch(PDO::FETCH_ASSOC); Database::query("INSERT INTO `ftp_quotatallies` (`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`) VALUES ('" . $row_ftp_users['username'] . "', 'user', '" . $row_ftp_quota['diskspace_used'] . "'*1024, '0', '0', '0', '0', '0');"); } @@ -661,7 +647,7 @@ if (isFroxlorVersion('0.9.6')) { showUpdateStep("Updating from 0.9.6 to 0.9.7-svn1", false); $update_customredirect_enable = isset($_POST['update_customredirect_enable']) ? 1 : 0; - $update_customredirect_default = isset($_POST['update_customredirect_default']) ? (int)$_POST['update_customredirect_default'] : 1; + $update_customredirect_default = isset($_POST['update_customredirect_default']) ? (int) $_POST['update_customredirect_default'] : 1; showUpdateStep("Adding new tables to database"); Database::query("CREATE TABLE IF NOT EXISTS `redirect_codes` ( @@ -687,17 +673,17 @@ if (isFroxlorVersion('0.9.6')) { lastStepStatus(0); showUpdateStep("Updating domains"); - $res = Database::query("SELECT `id` FROM `".TABLE_PANEL_DOMAINS."` ORDER BY `id` ASC"); + $res = Database::query("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` ORDER BY `id` ASC"); $updated_domains = 0; while ($d = $res->fetch(PDO::FETCH_ASSOC)) { - Database::query("INSERT INTO `domain_redirect_codes` (`rid`, `did`) VALUES ('".(int)$update_customredirect_default."', '".(int)$d['id']."');"); - $updated_domains++; + Database::query("INSERT INTO `domain_redirect_codes` (`rid`, `did`) VALUES ('" . (int) $update_customredirect_default . "', '" . (int) $d['id'] . "');"); + $updated_domains ++; } - lastStepStatus(0, 'Updated '.$updated_domains.' domain(s)'); + lastStepStatus(0, 'Updated ' . $updated_domains . ' domain(s)'); showUpdateStep("Adding new settings"); - Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('customredirect', 'enabled', '".(int)$update_customredirect_enable."');"); - Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('customredirect', 'default', '".(int)$update_customredirect_default."');"); + Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('customredirect', 'enabled', '" . (int) $update_customredirect_enable . "');"); + Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('customredirect', 'default', '" . (int) $update_customredirect_default . "');"); lastStepStatus(0); // need to fix default-error-copy-and-paste-shizzle @@ -723,7 +709,7 @@ if (isFroxlorVersion('0.9.7-svn1')) { showUpdateStep("Updating open_basedir due to security - issue"); $result = Database::query("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `documentroot` LIKE '%:%' AND `documentroot` NOT LIKE 'http://%' AND `openbasedir_path` = '0' AND `openbasedir` = '1'"); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - Database::query("UPDATE `".TABLE_PANEL_DOMAINS."` SET `openbasedir_path` = '1' WHERE `id` = '" . (int)$row['id']."'"); + Database::query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `openbasedir_path` = '1' WHERE `id` = '" . (int) $row['id'] . "'"); } lastStepStatus(0); @@ -767,7 +753,7 @@ if (isFroxlorVersion('0.9.8')) { $update_defdns_mailentry = isset($_POST['update_defdns_mailentry']) ? '1' : '0'; showUpdateStep("Adding new settings"); - Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'dns_createmailentry', '".(int)$update_defdns_mailentry."');"); + Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'dns_createmailentry', '" . (int) $update_defdns_mailentry . "');"); lastStepStatus(0); updateToVersion('0.9.9-svn1'); @@ -796,9 +782,10 @@ if (isFroxlorVersion('0.9.9')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'httpuser', - `value` = :user" - ); - Database::pexecute($stmt, array(':user' => $update_httpuser)); + `value` = :user"); + Database::pexecute($stmt, array( + ':user' => $update_httpuser + )); lastStepStatus(0); Settings::Set('system.httpuser', $update_httpuser); } @@ -810,9 +797,10 @@ if (isFroxlorVersion('0.9.9')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'httpgroup', - `value` = :grp" - ); - Database::pexecute($stmt, array(':grp' => $update_httpgroup)); + `value` = :grp"); + Database::pexecute($stmt, array( + ':grp' => $update_httpgroup + )); lastStepStatus(0); Settings::Set('system.httpgroup', $update_httpgroup); } @@ -820,7 +808,7 @@ if (isFroxlorVersion('0.9.9')) { $result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'debug_cron'"); $result = $result_stmt->fetch(PDO::FETCH_ASSOC); - if (!isset($result) || !isset($result['value'])) { + if (! isset($result) || ! isset($result['value'])) { $nonefound = false; showUpdateStep("Adding missing setting 'debug_cron'"); Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'debug_cron', '0');"); @@ -860,20 +848,19 @@ if (isFroxlorVersion('0.9.10-svn1')) { `databasename` = :dbname, `description` = :dbdesc, `dbserver` = '0', - `apsdb` = '1'" - ); + `apsdb` = '1'"); Database::pexecute($result, array( 'cid' => $cid, 'dbname' => $row['Database'], - 'dbdesc' => $databasedescription, + 'dbdesc' => $databasedescription )); - Database::query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1 WHERE `customerid`="' . (int)$cid . '"'); - $count_dbupdates++; + Database::query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1 WHERE `customerid`="' . (int) $cid . '"'); + $count_dbupdates ++; } } if ($count_dbupdates > 0) { - lastStepStatus(0, "Found ".$count_dbupdates." customer APS databases"); + lastStepStatus(0, "Found " . $count_dbupdates . " customer APS databases"); } else { lastStepStatus(0, "None found"); } @@ -885,10 +872,10 @@ if (isFroxlorVersion('0.9.10-svn2')) { showUpdateStep("Updating from 0.9.10-svn2 to 0.9.10", false); - $update_directlyviahostname = isset($_POST['update_directlyviahostname']) ? (int)$_POST['update_directlyviahostname'] : '0'; + $update_directlyviahostname = isset($_POST['update_directlyviahostname']) ? (int) $_POST['update_directlyviahostname'] : '0'; showUpdateStep("Adding new settings"); - Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'froxlordirectlyviahostname', '".(int)$update_directlyviahostname."');"); + Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'froxlordirectlyviahostname', '" . (int) $update_directlyviahostname . "');"); lastStepStatus(0); updateToVersion('0.9.10'); @@ -904,9 +891,10 @@ if (isFroxlorVersion('0.9.10')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'panel', `varname` = 'password_regex', - `value` = :regex" - ); - Database::pexecute($stmt, array('regex' => $update_pwdregex)); + `value` = :regex"); + Database::pexecute($stmt, array( + 'regex' => $update_pwdregex + )); lastStepStatus(0); updateToVersion('0.9.11-svn1'); @@ -916,8 +904,8 @@ if (isFroxlorVersion('0.9.11-svn1')) { showUpdateStep("Updating from 0.9.11-svn1 to 0.9.11-svn2", false); showUpdateStep("Adding perl/CGI directory fields"); - Database::query("ALTER TABLE `".TABLE_PANEL_HTACCESS."` ADD `options_cgi` tinyint(1) NOT NULL default '0' AFTER `error401path`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `perlenabled` tinyint(1) NOT NULL default '0' AFTER `aps_packages_used`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_HTACCESS . "` ADD `options_cgi` tinyint(1) NOT NULL default '0' AFTER `error401path`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `perlenabled` tinyint(1) NOT NULL default '0' AFTER `aps_packages_used`;"); lastStepStatus(0); updateToVersion('0.9.11-svn2'); @@ -933,9 +921,10 @@ if (isFroxlorVersion('0.9.11-svn2')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'perl_path', - `value` = :path" - ); - Database::pexecute($stmt, array('path' => $update_perlpath)); + `value` = :path"); + Database::pexecute($stmt, array( + 'path' => $update_perlpath + )); lastStepStatus(0); updateToVersion('0.9.11-svn3'); @@ -950,14 +939,14 @@ if (isFroxlorVersion('0.9.11-svn3')) { if (isFroxlorVersion('0.9.11')) { showUpdateStep("Updating from 0.9.11 to 0.9.12-svn1", false); - $update_fcgid_ownvhost = isset($_POST['update_fcgid_ownvhost']) ? (int)$_POST['update_fcgid_ownvhost'] : '0'; + $update_fcgid_ownvhost = isset($_POST['update_fcgid_ownvhost']) ? (int) $_POST['update_fcgid_ownvhost'] : '0'; $update_fcgid_httpuser = isset($_POST['update_fcgid_httpuser']) ? $_POST['update_fcgid_httpuser'] : 'froxlorlocal'; $update_fcgid_httpgroup = isset($_POST['update_fcgid_httpgroup']) ? $_POST['update_fcgid_httpgroup'] : 'froxlorlocal'; - if($update_fcgid_httpuser == '') { + if ($update_fcgid_httpuser == '') { $update_fcgid_httpuser = 'froxlorlocal'; } - if($update_fcgid_httpgroup == '') { + if ($update_fcgid_httpgroup == '') { $update_fcgid_httpgroup = 'froxlorlocal'; } @@ -966,11 +955,19 @@ if (isFroxlorVersion('0.9.11')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = :varname, - `value` = :value" - ); - Database::pexecute($stmt, array('varname' => 'mod_fcgid_ownvhost', 'value' => $update_fcgid_ownvhost)); - Database::pexecute($stmt, array('varname' => 'mod_fcgid_httpuser', 'value' => $update_fcgid_httpuser)); - Database::pexecute($stmt, array('varname' => 'mod_fcgid_httpgroup', 'value' => $update_fcgid_httpgroup)); + `value` = :value"); + Database::pexecute($stmt, array( + 'varname' => 'mod_fcgid_ownvhost', + 'value' => $update_fcgid_ownvhost + )); + Database::pexecute($stmt, array( + 'varname' => 'mod_fcgid_httpuser', + 'value' => $update_fcgid_httpuser + )); + Database::pexecute($stmt, array( + 'varname' => 'mod_fcgid_httpgroup', + 'value' => $update_fcgid_httpgroup + )); lastStepStatus(0); updateToVersion('0.9.12-svn1'); @@ -980,10 +977,10 @@ if (isFroxlorVersion('0.9.12-svn1')) { showUpdateStep("Updating from 0.9.12-svn1 to 0.9.12-svn2", false); - $update_perl_suexecworkaround = isset($_POST['update_perl_suexecworkaround']) ? (int)$_POST['update_perl_suexecworkaround'] : '0'; + $update_perl_suexecworkaround = isset($_POST['update_perl_suexecworkaround']) ? (int) $_POST['update_perl_suexecworkaround'] : '0'; $update_perl_suexecpath = isset($_POST['update_perl_suexecpath']) ? makeCorrectDir($_POST['update_perl_suexecpath']) : '/var/www/cgi-bin/'; - if($update_perl_suexecpath == '') { + if ($update_perl_suexecpath == '') { $update_perl_suexecpath = '/var/www/cgi-bin/'; } @@ -992,10 +989,15 @@ if (isFroxlorVersion('0.9.12-svn1')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'perl', `varname` = :varname, - `value` = :value" - ); - Database::pexecute($stmt, array('varname' => 'suexecworkaround', 'value' => $update_perl_suexecworkaround)); - Database::pexecute($stmt, array('varname' => 'suexecpath', 'value' => $update_perl_suexecpath)); + `value` = :value"); + Database::pexecute($stmt, array( + 'varname' => 'suexecworkaround', + 'value' => $update_perl_suexecworkaround + )); + Database::pexecute($stmt, array( + 'varname' => 'suexecpath', + 'value' => $update_perl_suexecpath + )); lastStepStatus(0); updateToVersion('0.9.12-svn2'); @@ -1006,7 +1008,7 @@ if (isFroxlorVersion('0.9.12-svn2')) { showUpdateStep("Updating from 0.9.12-svn2 to 0.9.12-svn3", false); showUpdateStep("Adding new field to domain table"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `ismainbutsubto` int(11) unsigned NOT NULL default '0' AFTER `mod_fcgid_maxrequests`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `ismainbutsubto` int(11) unsigned NOT NULL default '0' AFTER `mod_fcgid_maxrequests`;"); lastStepStatus(0); updateToVersion('0.9.12-svn3'); @@ -1023,9 +1025,10 @@ if (isFroxlorVersion('0.9.12-svn3')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'awstats_awstatspath', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $update_awstats_awstatspath)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $update_awstats_awstatspath + )); lastStepStatus(0); updateToVersion('0.9.12-svn4'); @@ -1047,7 +1050,7 @@ if (isFroxlorVersion('0.9.12-svn5')) { showUpdateStep("Updating from 0.9.12-svn5 to 0.9.12-svn6", false); showUpdateStep("Adding new field to table 'panel_htpasswds'"); - Database::query("ALTER TABLE `".TABLE_PANEL_HTPASSWDS."` ADD `authname` varchar(255) NOT NULL default 'Restricted Area' AFTER `password`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_HTPASSWDS . "` ADD `authname` varchar(255) NOT NULL default 'Restricted Area' AFTER `password`;"); lastStepStatus(0); updateToVersion('0.9.12-svn6'); @@ -1064,19 +1067,19 @@ if (isFroxlorVersion('0.9.12')) { showUpdateStep("Updating from 0.9.12 to 0.9.13-svn1", false); showUpdateStep("Adding new fields to admin-table"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` ADD `email_autoresponder` int(5) NOT NULL default '0' AFTER `aps_packages_used`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` ADD `email_autoresponder_used` int(5) NOT NULL default '0' AFTER `email_autoresponder`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` ADD `email_autoresponder` int(5) NOT NULL default '0' AFTER `aps_packages_used`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` ADD `email_autoresponder_used` int(5) NOT NULL default '0' AFTER `email_autoresponder`;"); lastStepStatus(0); showUpdateStep("Adding new fields to customer-table"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `email_autoresponder` int(5) NOT NULL default '0' AFTER `perlenabled`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `email_autoresponder_used` int(5) NOT NULL default '0' AFTER `email_autoresponder`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `email_autoresponder` int(5) NOT NULL default '0' AFTER `perlenabled`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `email_autoresponder_used` int(5) NOT NULL default '0' AFTER `email_autoresponder`;"); lastStepStatus(0); - if ((int)Settings::Get('autoresponder.autoresponder_active') == 1) { + if ((int) Settings::Get('autoresponder.autoresponder_active') == 1) { $update_autoresponder_default = isset($_POST['update_autoresponder_default']) ? intval_ressource($_POST['update_autoresponder_default']) : 0; if (isset($_POST['update_autoresponder_default_ul'])) { - $update_autoresponder_default = -1; + $update_autoresponder_default = - 1; } } else { $update_autoresponder_default = 0; @@ -1084,9 +1087,9 @@ if (isFroxlorVersion('0.9.12')) { showUpdateStep("Setting default amount of autoresponders"); // admin gets unlimited - Database::query("UPDATE `".TABLE_PANEL_ADMINS."` SET `email_autoresponder`='-1' WHERE `adminid` = '".(int)$userinfo['adminid']."'"); + Database::query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `email_autoresponder`='-1' WHERE `adminid` = '" . (int) $userinfo['adminid'] . "'"); // customers - Database::query("UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `email_autoresponder`='".(int)$update_autoresponder_default."' WHERE `deactivated` = '0'"); + Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_autoresponder`='" . (int) $update_autoresponder_default . "' WHERE `deactivated` = '0'"); lastStepStatus(0); updateToVersion('0.9.13-svn1'); @@ -1101,16 +1104,17 @@ if (isFroxlorVersion('0.9.13-svn1')) { if (isFroxlorVersion('0.9.13')) { showUpdateStep("Updating from 0.9.13 to 0.9.13.1 final", false); - $update_defaultini_ownvhost = isset($_POST['update_defaultini_ownvhost']) ? (int)$_POST['update_defaultini_ownvhost'] : 1; + $update_defaultini_ownvhost = isset($_POST['update_defaultini_ownvhost']) ? (int) $_POST['update_defaultini_ownvhost'] : 1; showUpdateStep("Adding settings for Froxlor-vhost's PHP-configuration"); $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'mod_fcgid_defaultini_ownvhost', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $update_defaultini_ownvhost)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $update_defaultini_ownvhost + )); lastStepStatus(0); updateToVersion('0.9.13.1'); @@ -1146,9 +1150,10 @@ if (isFroxlorVersion('0.9.14-svn2')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'awstats_icons', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $update_awstats_icons)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $update_awstats_icons + )); lastStepStatus(0); updateToVersion('0.9.14-svn3'); @@ -1169,13 +1174,14 @@ if (isFroxlorVersion('0.9.14-svn3')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'ssl_cert_chainfile', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $update_ssl_cert_chainfile)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $update_ssl_cert_chainfile + )); lastStepStatus(0); showUpdateStep("Adding new field to IPs and ports for SSLCertificateChainFile"); - Database::query("ALTER TABLE `".TABLE_PANEL_IPSANDPORTS."` ADD `ssl_cert_chainfile` varchar(255) NOT NULL AFTER `default_vhostconf_domain`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_IPSANDPORTS . "` ADD `ssl_cert_chainfile` varchar(255) NOT NULL AFTER `default_vhostconf_domain`;"); lastStepStatus(0); updateToVersion('0.9.14-svn4'); @@ -1185,7 +1191,7 @@ if (isFroxlorVersion('0.9.14-svn4')) { showUpdateStep("Updating from 0.9.14-svn4 to 0.9.14-svn5", false); showUpdateStep("Adding docroot-field to IPs and ports for custom-docroot settings"); - Database::query("ALTER TABLE `".TABLE_PANEL_IPSANDPORTS."` ADD `docroot` varchar(255) NOT NULL default '' AFTER `ssl_cert_chainfile`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_IPSANDPORTS . "` ADD `docroot` varchar(255) NOT NULL default '' AFTER `ssl_cert_chainfile`;"); lastStepStatus(0); updateToVersion('0.9.14-svn5'); @@ -1195,16 +1201,17 @@ if (isFroxlorVersion('0.9.14-svn5')) { showUpdateStep("Updating from 0.9.14-svn5 to 0.9.14-svn6", false); - $update_allow_domain_login = isset($_POST['update_allow_domain_login']) ? (int)$_POST['update_allow_domain_login'] : '0'; + $update_allow_domain_login = isset($_POST['update_allow_domain_login']) ? (int) $_POST['update_allow_domain_login'] : '0'; showUpdateStep("Adding domain-login switch to the settings"); $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'login', `varname` = 'domain_login', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $update_allow_domain_login)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $update_allow_domain_login + )); lastStepStatus(0); updateToVersion('0.9.14-svn6'); @@ -1234,7 +1241,7 @@ if (isFroxlorVersion('0.9.14-svn6')) { lastStepStatus(0); showUpdateStep("Removing deprecated legacy-cronjob from database"); - Database::query("DELETE FROM `".TABLE_PANEL_CRONRUNS."` WHERE `cronfile` ='cron_legacy.php';"); + Database::query("DELETE FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `cronfile` ='cron_legacy.php';"); lastStepStatus(0); updateToVersion('0.9.14-svn10'); @@ -1242,36 +1249,36 @@ if (isFroxlorVersion('0.9.14-svn6')) { /* * revert database changes we did for multiserver-support -* before branching - sorry guys :/ -*/ + * before branching - sorry guys :/ + */ if (isFroxlorVersion('0.9.14-svn9')) { showUpdateStep("Reverting multiserver-patches (svn)", false); - $update_allow_domain_login = isset($_POST['update_allow_domain_login']) ? (int)$_POST['update_allow_domain_login'] : '0'; + $update_allow_domain_login = isset($_POST['update_allow_domain_login']) ? (int) $_POST['update_allow_domain_login'] : '0'; showUpdateStep("Reverting database table-changes"); - Database::query("ALTER TABLE `".TABLE_PANEL_SETTINGS."` DROP `sid`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_SETTINGS . "` DROP `sid`;"); showUpdateStep("."); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `sid`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `sid`;"); showUpdateStep("."); - Database::query("ALTER TABLE `".TABLE_MAIL_VIRTUAL."` DROP `sid`;"); + Database::query("ALTER TABLE `" . TABLE_MAIL_VIRTUAL . "` DROP `sid`;"); showUpdateStep("."); - Database::query("ALTER TABLE `".TABLE_FTP_USERS."` DROP `sid`;"); + Database::query("ALTER TABLE `" . TABLE_FTP_USERS . "` DROP `sid`;"); showUpdateStep("."); - Database::query("ALTER TABLE `".TABLE_PANEL_TASKS."` DROP `sid`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_TASKS . "` DROP `sid`;"); showUpdateStep("."); - Database::query("ALTER TABLE `".TABLE_APS_TASKS."` DROP `sid`;"); + Database::query("ALTER TABLE `" . TABLE_APS_TASKS . "` DROP `sid`;"); showUpdateStep("."); - Database::query("ALTER TABLE `".TABLE_PANEL_LOG."` DROP `sid`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_LOG . "` DROP `sid`;"); showUpdateStep("."); - Database::query("ALTER TABLE `".TABLE_PANEL_PHPCONFIGS."` DROP `sid`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` DROP `sid`;"); lastStepStatus(0); showUpdateStep("Removing froxlor-clients table"); @@ -1295,11 +1302,19 @@ if (isFroxlorVersion('0.9.14')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = :varname, - `value` = :value" - ); - Database::pexecute($stmt, array('varname' => 'nginx_php_backend', 'value' => '127.0.0.1:8888')); - Database::pexecute($stmt, array('varname' => 'perl_server', 'value' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock')); - Database::pexecute($stmt, array('varname' => 'phpreload_command', 'value' => '')); + `value` = :value"); + Database::pexecute($stmt, array( + 'varname' => 'nginx_php_backend', + 'value' => '127.0.0.1:8888' + )); + Database::pexecute($stmt, array( + 'varname' => 'perl_server', + 'value' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock' + )); + Database::pexecute($stmt, array( + 'varname' => 'phpreload_command', + 'value' => '' + )); lastStepStatus(0); updateToVersion('0.9.15-svn1'); @@ -1314,20 +1329,20 @@ if (isFroxlorVersion('0.9.15-svn1')) { if (isFroxlorVersion('0.9.15')) { showUpdateStep("Updating from 0.9.15 to 0.9.16-svn1", false); - $update_phpfpm_enabled = isset($_POST['update_phpfpm_enabled']) ? (int)$_POST['update_phpfpm_enabled'] : '0'; + $update_phpfpm_enabled = isset($_POST['update_phpfpm_enabled']) ? (int) $_POST['update_phpfpm_enabled'] : '0'; $update_phpfpm_configdir = isset($_POST['update_phpfpm_configdir']) ? makeCorrectDir($_POST['update_phpfpm_configdir']) : '/etc/php-fpm.d/'; $update_phpfpm_tmpdir = isset($_POST['update_phpfpm_tmpdir']) ? makeCorrectDir($_POST['update_phpfpm_tmpdir']) : '/var/customers/tmp'; $update_phpfpm_peardir = isset($_POST['update_phpfpm_peardir']) ? makeCorrectDir($_POST['update_phpfpm_peardir']) : '/usr/share/php/:/usr/share/php5/'; $update_phpfpm_reload = isset($_POST['update_phpfpm_reload']) ? $_POST['update_phpfpm_reload'] : '/etc/init.d/php-fpm restart'; $update_phpfpm_pm = isset($_POST['update_phpfpm_pm']) ? $_POST['update_phpfpm_pm'] : 'static'; - $update_phpfpm_max_children = isset($_POST['update_phpfpm_max_children']) ? (int)$_POST['update_phpfpm_max_children'] : '1'; - $update_phpfpm_max_requests = isset($_POST['update_phpfpm_max_requests']) ? (int)$_POST['update_phpfpm_max_requests'] : '0'; + $update_phpfpm_max_children = isset($_POST['update_phpfpm_max_children']) ? (int) $_POST['update_phpfpm_max_children'] : '1'; + $update_phpfpm_max_requests = isset($_POST['update_phpfpm_max_requests']) ? (int) $_POST['update_phpfpm_max_requests'] : '0'; if ($update_phpfpm_pm == 'dynamic') { - $update_phpfpm_start_servers = isset($_POST['update_phpfpm_start_servers']) ? (int)$_POST['update_phpfpm_start_servers'] : '20'; - $update_phpfpm_min_spare_servers = isset($_POST['update_phpfpm_min_spare_servers']) ? (int)$_POST['update_phpfpm_min_spare_servers'] : '5'; - $update_phpfpm_max_spare_servers = isset($_POST['update_phpfpm_max_spare_servers']) ? (int)$_POST['update_phpfpm_max_spare_servers'] : '35'; + $update_phpfpm_start_servers = isset($_POST['update_phpfpm_start_servers']) ? (int) $_POST['update_phpfpm_start_servers'] : '20'; + $update_phpfpm_min_spare_servers = isset($_POST['update_phpfpm_min_spare_servers']) ? (int) $_POST['update_phpfpm_min_spare_servers'] : '5'; + $update_phpfpm_max_spare_servers = isset($_POST['update_phpfpm_max_spare_servers']) ? (int) $_POST['update_phpfpm_max_spare_servers'] : '35'; } else { $update_phpfpm_start_servers = 20; $update_phpfpm_min_spare_servers = 5; @@ -1346,19 +1361,51 @@ if (isFroxlorVersion('0.9.15')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'phpfpm', `varname` = :varname, - `value` = :value" - ); - Database::pexecute($stmt, array('varname' => 'enabled', 'value' => $update_phpfpm_enabled)); - Database::pexecute($stmt, array('varname' => 'configdir', 'value' => $update_phpfpm_configdir)); - Database::pexecute($stmt, array('varname' => 'reload', 'value' => $update_phpfpm_reload)); - Database::pexecute($stmt, array('varname' => 'pm', 'value' => $update_phpfpm_pm)); - Database::pexecute($stmt, array('varname' => 'max_children', 'value' => $update_phpfpm_max_children)); - Database::pexecute($stmt, array('varname' => 'max_requests', 'value' => $update_phpfpm_max_requests)); - Database::pexecute($stmt, array('varname' => 'start_servers', 'value' => $update_phpfpm_start_servers)); - Database::pexecute($stmt, array('varname' => 'min_spare_servers', 'value' => $update_phpfpm_min_spare_servers)); - Database::pexecute($stmt, array('varname' => 'max_spare_servers', 'value' => $update_phpfpm_max_spare_servers)); - Database::pexecute($stmt, array('varname' => 'tmpdir', 'value' => $update_phpfpm_tmpdir)); - Database::pexecute($stmt, array('varname' => 'peardir', 'value' => $update_phpfpm_peardir)); + `value` = :value"); + Database::pexecute($stmt, array( + 'varname' => 'enabled', + 'value' => $update_phpfpm_enabled + )); + Database::pexecute($stmt, array( + 'varname' => 'configdir', + 'value' => $update_phpfpm_configdir + )); + Database::pexecute($stmt, array( + 'varname' => 'reload', + 'value' => $update_phpfpm_reload + )); + Database::pexecute($stmt, array( + 'varname' => 'pm', + 'value' => $update_phpfpm_pm + )); + Database::pexecute($stmt, array( + 'varname' => 'max_children', + 'value' => $update_phpfpm_max_children + )); + Database::pexecute($stmt, array( + 'varname' => 'max_requests', + 'value' => $update_phpfpm_max_requests + )); + Database::pexecute($stmt, array( + 'varname' => 'start_servers', + 'value' => $update_phpfpm_start_servers + )); + Database::pexecute($stmt, array( + 'varname' => 'min_spare_servers', + 'value' => $update_phpfpm_min_spare_servers + )); + Database::pexecute($stmt, array( + 'varname' => 'max_spare_servers', + 'value' => $update_phpfpm_max_spare_servers + )); + Database::pexecute($stmt, array( + 'varname' => 'tmpdir', + 'value' => $update_phpfpm_tmpdir + )); + Database::pexecute($stmt, array( + 'varname' => 'peardir', + 'value' => $update_phpfpm_peardir + )); lastStepStatus(0); updateToVersion('0.9.16-svn1'); @@ -1367,7 +1414,7 @@ if (isFroxlorVersion('0.9.15')) { if (isFroxlorVersion('0.9.16-svn1')) { showUpdateStep("Updating from 0.9.16-svn1 to 0.9.16-svn2", false); - $update_phpfpm_enabled_ownvhost = isset($_POST['update_phpfpm_enabled_ownvhost']) ? (int)$_POST['update_phpfpm_enabled_ownvhost'] : '0'; + $update_phpfpm_enabled_ownvhost = isset($_POST['update_phpfpm_enabled_ownvhost']) ? (int) $_POST['update_phpfpm_enabled_ownvhost'] : '0'; $update_phpfpm_httpuser = isset($_POST['update_phpfpm_httpuser']) ? $_POST['update_phpfpm_httpuser'] : 'froxlorlocal'; $update_phpfpm_httpgroup = isset($_POST['update_phpfpm_httpgroup']) ? $_POST['update_phpfpm_httpgroup'] : 'froxlorlocal'; @@ -1383,11 +1430,19 @@ if (isFroxlorVersion('0.9.16-svn1')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'phpfpm', `varname` = :varname, - `value` = :value" - ); - Database::pexecute($stmt, array('varname' => 'enabled_ownvhost', 'value' => $update_phpfpm_enabled_ownvhost)); - Database::pexecute($stmt, array('varname' => 'vhost_httpuser', 'value' => $update_phpfpm_httpuser)); - Database::pexecute($stmt, array('varname' => 'vhost_httpgroup', 'value' => $update_phpfpm_httpgroup)); + `value` = :value"); + Database::pexecute($stmt, array( + 'varname' => 'enabled_ownvhost', + 'value' => $update_phpfpm_enabled_ownvhost + )); + Database::pexecute($stmt, array( + 'varname' => 'vhost_httpuser', + 'value' => $update_phpfpm_httpuser + )); + Database::pexecute($stmt, array( + 'varname' => 'vhost_httpgroup', + 'value' => $update_phpfpm_httpgroup + )); lastStepStatus(0); updateToVersion('0.9.16-svn2'); @@ -1403,20 +1458,28 @@ if (isFroxlorVersion('0.9.16')) { showUpdateStep("Updating from 0.9.16 to 0.9.17-svn1", false); - $update_system_report_enable = isset($_POST['update_system_report_enable']) ? (int)$_POST['update_system_report_enable'] : '1'; - $update_system_report_webmax = isset($_POST['update_system_report_webmax']) ? (int)$_POST['update_system_report_webmax'] : '90'; - $update_system_report_trafficmax = isset($_POST['update_system_report_trafficmax']) ? (int)$_POST['update_system_report_trafficmax'] : '90'; + $update_system_report_enable = isset($_POST['update_system_report_enable']) ? (int) $_POST['update_system_report_enable'] : '1'; + $update_system_report_webmax = isset($_POST['update_system_report_webmax']) ? (int) $_POST['update_system_report_webmax'] : '90'; + $update_system_report_trafficmax = isset($_POST['update_system_report_trafficmax']) ? (int) $_POST['update_system_report_trafficmax'] : '90'; showUpdateStep("Adding new settings for web- and traffic-reporting"); $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = :varname, - `value` = :value" - ); - Database::pexecute($stmt, array('varname' => 'report_enable', 'value' => $update_system_report_enable)); - Database::pexecute($stmt, array('varname' => 'report_webmax', 'value' => $update_system_report_webmax)); - Database::pexecute($stmt, array('varname' => 'report_trafficmax', 'value' => $update_system_report_trafficmax)); + `value` = :value"); + Database::pexecute($stmt, array( + 'varname' => 'report_enable', + 'value' => $update_system_report_enable + )); + Database::pexecute($stmt, array( + 'varname' => 'report_webmax', + 'value' => $update_system_report_webmax + )); + Database::pexecute($stmt, array( + 'varname' => 'report_trafficmax', + 'value' => $update_system_report_trafficmax + )); lastStepStatus(0); showUpdateStep("Adding new cron-module for web- and traffic-reporting"); @@ -1428,35 +1491,31 @@ if (isFroxlorVersion('0.9.16')) { `interval` = '1 DAY', `desc_lng_key` = 'cron_usage_report', `lastrun` = :lastrun, - `isactive` = :isactive" - ); - Database::pexecute($stmt, array('lastrun' => $clastrun, 'isactive' => $update_system_report_enable)); + `isactive` = :isactive"); + Database::pexecute($stmt, array( + 'lastrun' => $clastrun, + 'isactive' => $update_system_report_enable + )); lastStepStatus(0); showUpdateStep("Updating various database-fields"); Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'last_traffic_report_run';"); $check_stmt = Database::query(" - SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `varname` = 'trafficninetypercent_subject';" - ); + SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `varname` = 'trafficninetypercent_subject';"); Database::pexecute($check_stmt); $check = $check_stmt->fetch(PDO::FETCH_ASSOC); - if (isset($check['varname']) - && $check['varname'] == 'trafficninetypercent_subject' - ) { + if (isset($check['varname']) && $check['varname'] == 'trafficninetypercent_subject') { Database::query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `varname` = 'trafficmaxpercent_subject' WHERE `varname` = 'trafficninetypercent_subject';"); } $check_stmt = Database::query(" - SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `varname` = 'trafficninetypercent_mailbody';" - ); + SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `varname` = 'trafficninetypercent_mailbody';"); Database::pexecute($check_stmt); $check = $check_stmt->fetch(PDO::FETCH_ASSOC); - if (isset($check['varname']) - && $check['varname'] == 'trafficninetypercent_mailbody' - ) { + if (isset($check['varname']) && $check['varname'] == 'trafficninetypercent_mailbody') { Database::query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `varname` = 'trafficmaxpercent_mailbody' WHERE `varname` = 'trafficninetypercent_mailbody';"); } lastStepStatus(0); @@ -1502,16 +1561,17 @@ if (isFroxlorVersion('0.9.17')) { $result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'"); $result = $result_stmt->fetch(PDO::FETCH_ASSOC); - if (!isset($result) || !isset($result['value'])) { + if (! isset($result) || ! isset($result['value'])) { $nonefound = false; showUpdateStep("Adding missing setting 'httpgroup'"); $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'httpgroup', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => Settings::Get('system.httpuser'))); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => Settings::Get('system.httpuser') + )); lastStepStatus(0); } @@ -1534,9 +1594,10 @@ if (isFroxlorVersion('0.9.18-svn1')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'panel', `varname` = 'default_theme', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $update_default_theme)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $update_default_theme + )); lastStepStatus(0); showUpdateStep("Delete old setting for header-graphic"); @@ -1544,9 +1605,9 @@ if (isFroxlorVersion('0.9.18-svn1')) { lastStepStatus(0); showUpdateStep("Updating table layouts"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` ADD `theme` varchar(255) NOT NULL default 'Froxlor' AFTER `email_autoresponder_used`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `theme` varchar(255) NOT NULL default 'Froxlor' AFTER `email_autoresponder_used`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_SESSIONS."` ADD `theme` varchar(255) NOT NULL default '' AFTER `adminsession`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` ADD `theme` varchar(255) NOT NULL default 'Froxlor' AFTER `email_autoresponder_used`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `theme` varchar(255) NOT NULL default 'Froxlor' AFTER `email_autoresponder_used`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_SESSIONS . "` ADD `theme` varchar(255) NOT NULL default '' AFTER `adminsession`;"); lastStepStatus(0); updateToVersion('0.9.18-svn2'); @@ -1579,8 +1640,7 @@ if (isFroxlorVersion('0.9.19')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'validate_domain', - `value` = '1'" - ); + `value` = '1'"); lastStepStatus(0); updateToVersion('0.9.20-svn1'); @@ -1635,7 +1695,7 @@ if (isFroxlorVersion('0.9.20.1')) { $columnfound = 1; } } - if (!$columnfound) { + if (! $columnfound) { Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `backup_allowed` TINYINT( 1 ) NOT NULL DEFAULT '1'"); Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `backup_enabled` TINYINT( 1 ) NOT NULL DEFAULT '0'"); } @@ -1827,9 +1887,10 @@ if (isFroxlorVersion('0.9.26')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'backup_ftp_enabled', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $state)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $state + )); } updateToVersion('0.9.27-svn1'); @@ -1951,7 +2012,7 @@ if (isFroxlorVersion('0.9.28-svn1')) { Database::query("UPDATE `panel_languages` SET `iso`='pl' WHERE `language` = 'Polski'"); break; default: - showUpdateStep("Sorry, but I don't know the ISO-639 language code for ".$language.". Please update the entry in `panel_languages` manually.\n"); + showUpdateStep("Sorry, but I don't know the ISO-639 language code for " . $language . ". Please update the entry in `panel_languages` manually.\n"); } } @@ -1981,9 +2042,7 @@ if (isFroxlorVersion('0.9.28-svn3')) { showUpdateStep("Updating from 0.9.28-svn3 to 0.9.28-svn4", true); lastStepStatus(0); - if (isset($_POST['classic_theme_replacement']) - && $_POST['classic_theme_replacement'] != '' - ) { + if (isset($_POST['classic_theme_replacement']) && $_POST['classic_theme_replacement'] != '') { $classic_theme_replacement = $_POST['classic_theme_replacement']; } else { $classic_theme_replacement = 'Froxlor'; @@ -1995,34 +2054,38 @@ if (isFroxlorVersion('0.9.28-svn3')) { $upd_stmt = Database::prepare(" UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :theme - WHERE `varname` = 'default_theme';" - ); - Database::pexecute($upd_stmt, array('theme' => $classic_theme_replacement)); + WHERE `varname` = 'default_theme';"); + Database::pexecute($upd_stmt, array( + 'theme' => $classic_theme_replacement + )); } // Updating admin's theme setting $upd_stmt = Database::prepare(" UPDATE `" . TABLE_PANEL_ADMINS . "` SET `theme` = :theme - WHERE `theme` = 'Classic';" - ); - Database::pexecute($upd_stmt, array('theme' => $classic_theme_replacement)); + WHERE `theme` = 'Classic';"); + Database::pexecute($upd_stmt, array( + 'theme' => $classic_theme_replacement + )); // Updating customer's theme setting $upd_stmt = Database::prepare(" UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `theme` = :theme - WHERE `theme` = 'Classic';" - ); - Database::pexecute($upd_stmt, array('theme' => $classic_theme_replacement)); + WHERE `theme` = 'Classic';"); + Database::pexecute($upd_stmt, array( + 'theme' => $classic_theme_replacement + )); // Updating theme setting of active sessions $upd_stmt = Database::prepare(" UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `theme` = :theme - WHERE `theme` = 'Classic';" - ); - Database::pexecute($upd_stmt, array('theme' => $classic_theme_replacement)); + WHERE `theme` = 'Classic';"); + Database::pexecute($upd_stmt, array( + 'theme' => $classic_theme_replacement + )); lastStepStatus(0); @@ -2059,16 +2122,17 @@ if (isFroxlorVersion('0.9.28-svn5')) { showUpdateStep("Updating from 0.9.28-svn5 to 0.9.28-svn6", true); lastStepStatus(0); - $update_system_apache24 = isset($_POST['update_system_apache24']) ? (int)$_POST['update_system_apache24'] : '0'; + $update_system_apache24 = isset($_POST['update_system_apache24']) ? (int) $_POST['update_system_apache24'] : '0'; showUpdateStep('Setting value for apache-2.4 modification', true); // support for Apache-2.4 $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'apache24', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $update_system_apache24)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $update_system_apache24 + )); lastStepStatus(0); showUpdateStep("Inserting new tickets-see-all field to panel_admins", true); @@ -2079,9 +2143,10 @@ if (isFroxlorVersion('0.9.28-svn5')) { $stmt = Database::prepare(" UPDATE `" . TABLE_PANEL_ADMINS . "` SET `tickets_see_all` = '1' - WHERE `adminid` = :adminid" - ); - Database::pexecute($stmt, array('adminid' => $userinfo['adminid'])); + WHERE `adminid` = :adminid"); + Database::pexecute($stmt, array( + 'adminid' => $userinfo['adminid'] + )); lastStepStatus(0); showUpdateStep("Inserting new panel webfont-settings (default: off)", true); @@ -2098,9 +2163,10 @@ if (isFroxlorVersion('0.9.28-svn5')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'nginx', `varname` = 'fastcgiparams', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $fastcgiparams)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $fastcgiparams + )); lastStepStatus(0); updateToVersion('0.9.28-svn6'); @@ -2117,15 +2183,16 @@ if (isFroxlorVersion('0.9.28-rc1')) { showUpdateStep("Updating from 0.9.28-rc1 to 0.9.28-rc2", true); lastStepStatus(0); - $update_system_documentroot_use_default_value = isset($_POST['update_system_documentroot_use_default_value']) ? (int)$_POST['update_system_documentroot_use_default_value'] : '0'; + $update_system_documentroot_use_default_value = isset($_POST['update_system_documentroot_use_default_value']) ? (int) $_POST['update_system_documentroot_use_default_value'] : '0'; showUpdateStep("Adding new settings for using domain name as default value for DocumentRoot path", true); $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'documentroot_use_default_value', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $update_system_documentroot_use_default_value)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $update_system_documentroot_use_default_value + )); lastStepStatus(0); updateToVersion('0.9.28-rc2'); @@ -2152,15 +2219,16 @@ if (isFroxlorVersion('0.9.28.1')) { showUpdateStep("Updating from 0.9.28.1 to 0.9.29-dev1", true); lastStepStatus(0); - $hide_stdsubdomains = isset($_POST['hide_stdsubdomains']) ? (int)$_POST['hide_stdsubdomains'] : '0'; + $hide_stdsubdomains = isset($_POST['hide_stdsubdomains']) ? (int) $_POST['hide_stdsubdomains'] : '0'; showUpdateStep('Setting value for "hide standard subdomains"', true); $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'panel', `varname` = 'phpconfigs_hidestdsubdomain', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $hide_stdsubdomains)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $hide_stdsubdomains + )); lastStepStatus(0); // don't advertise security questions - just set a default silently @@ -2169,13 +2237,14 @@ if (isFroxlorVersion('0.9.28.1')) { $fastcgiparams = Settings::Get('nginx.fastcgiparams'); // check the faulty value explicitly if ($fastcgiparams == '/etc/nginx/fastcgi_params/') { - $fastcgiparams = makeCorrectFile(substr($fastcgiparams,0,-1)); + $fastcgiparams = makeCorrectFile(substr($fastcgiparams, 0, - 1)); $stmt = Database::prepare(" UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :value - WHERE `varname` = 'fastcgiparams'" - ); - Database::pexecute($stmt, array('value' => $fastcgiparams)); + WHERE `varname` = 'fastcgiparams'"); + Database::pexecute($stmt, array( + 'value' => $fastcgiparams + )); } updateToVersion('0.9.29-dev1'); } @@ -2185,17 +2254,22 @@ if (isFroxlorVersion('0.9.29-dev1')) { showUpdateStep("Updating from 0.9.29-dev1 to 0.9.29-dev2", true); lastStepStatus(0); - $allow_themechange_c = isset($_POST['allow_themechange_c']) ? (int)$_POST['allow_themechange_c'] : '1'; - $allow_themechange_a = isset($_POST['allow_themechange_a']) ? (int)$_POST['allow_themechange_a'] : '1'; + $allow_themechange_c = isset($_POST['allow_themechange_c']) ? (int) $_POST['allow_themechange_c'] : '1'; + $allow_themechange_a = isset($_POST['allow_themechange_a']) ? (int) $_POST['allow_themechange_a'] : '1'; showUpdateStep("Inserting new setting to allow/disallow theme changes (default: on)", true); $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'panel', `varname` = :varname, - `value` = :value" - ); - Database::pexecute($stmt, array('varname' => 'allow_theme_change_admin', 'value' => $allow_themechange_a)); - Database::pexecute($stmt, array('varname' => 'allow_theme_change_customer', 'value' => $allow_themechange_c)); + `value` = :value"); + Database::pexecute($stmt, array( + 'varname' => 'allow_theme_change_admin', + 'value' => $allow_themechange_a + )); + Database::pexecute($stmt, array( + 'varname' => 'allow_theme_change_customer', + 'value' => $allow_themechange_c + )); lastStepStatus(0); updateToVersion('0.9.29-dev2'); @@ -2222,9 +2296,10 @@ if (isFroxlorVersion('0.9.29-dev2')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'axfrservers', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $system_axfrservers)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $system_axfrservers + )); lastStepStatus(0); updateToVersion('0.9.29-dev3'); @@ -2256,9 +2331,10 @@ if (isFroxlorVersion('0.9.29-dev3')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = 'customer_ssl_path', - `value` = :value" - ); - Database::pexecute($stmt, array('value' => $system_customersslpath)); + `value` = :value"); + Database::pexecute($stmt, array( + 'value' => $system_customersslpath + )); updateToVersion('0.9.29-dev4'); } @@ -2277,12 +2353,17 @@ if (isFroxlorVersion('0.9.29-dev4')) { INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'phpfpm', `varname` = :varname, - `value` = :value" - ); + `value` = :value"); $dval = (Settings::Get('system.mod_fcgid_defaultini') !== null ? Settings::Get('system.mod_fcgid_defaultini') : '1'); - Database::pexecute($stmt, array('varname' => 'defaultini', 'value' => $dval)); + Database::pexecute($stmt, array( + 'varname' => 'defaultini', + 'value' => $dval + )); $dval = (Settings::Get('system.mod_fcgid_ownvhost') !== null ? Settings::Get('system.mod_fcgid_ownvhost') : '1'); - Database::pexecute($stmt, array('varname' => 'vhost_defaultini', 'value' => $dval)); + Database::pexecute($stmt, array( + 'varname' => 'vhost_defaultini', + 'value' => $dval + )); lastStepStatus(0); updateToVersion('0.9.29-rc1'); @@ -2301,7 +2382,7 @@ if (isFroxlorVersion('0.9.29')) { showUpdateStep("Adding new ip to domain - mapping-table"); Database::query("DROP TABLE IF EXISTS `panel_domaintoip`;"); - $sql = "CREATE TABLE `".TABLE_DOMAINTOIP."` ( + $sql = "CREATE TABLE `" . TABLE_DOMAINTOIP . "` ( `id_domain` int(11) unsigned NOT NULL, `id_ipandports` int(11) unsigned NOT NULL, PRIMARY KEY (`id_domain`, `id_ipandports`) @@ -2314,35 +2395,30 @@ if (isFroxlorVersion('0.9.29')) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - if ((int)$row['ipandport'] != 0) { - Database::query("INSERT INTO `".TABLE_DOMAINTOIP."` SET - `id_domain` = " . (int)$row['id'] . ", - `id_ipandports` = " . (int)$row['ipandport']); + if ((int) $row['ipandport'] != 0) { + Database::query("INSERT INTO `" . TABLE_DOMAINTOIP . "` SET + `id_domain` = " . (int) $row['id'] . ", + `id_ipandports` = " . (int) $row['ipandport']); } - if ((int)$row['ssl_ipandport'] != 0) { - Database::query("INSERT INTO `".TABLE_DOMAINTOIP."` SET - `id_domain` = " . (int)$row['id'] . ", - `id_ipandports` = " . (int)$row['ssl_ipandport']); - } - // Subdomains also have ssl ports if the parent has - elseif ((int)$row['ssl_ipandport'] == 0 - && (int)$row['ssl_redirect'] != 0 - && (int)$row['parentdomainid'] != 0 - ) { - Database::query("INSERT INTO `".TABLE_DOMAINTOIP."` SET - `id_domain` = " . (int)$row['id'] . ", + if ((int) $row['ssl_ipandport'] != 0) { + Database::query("INSERT INTO `" . TABLE_DOMAINTOIP . "` SET + `id_domain` = " . (int) $row['id'] . ", + `id_ipandports` = " . (int) $row['ssl_ipandport']); + } // Subdomains also have ssl ports if the parent has + elseif ((int) $row['ssl_ipandport'] == 0 && (int) $row['ssl_redirect'] != 0 && (int) $row['parentdomainid'] != 0) { + Database::query("INSERT INTO `" . TABLE_DOMAINTOIP . "` SET + `id_domain` = " . (int) $row['id'] . ", `id_ipandports` = ( SELECT `ssl_ipandport` FROM `" . TABLE_PANEL_DOMAINS . "` - WHERE `id` = '".(int)$row['parentdomainid']."');" - ); + WHERE `id` = '" . (int) $row['parentdomainid'] . "');"); } } lastStepStatus(0); showUpdateStep("Updating table layouts"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` DROP `ipandport`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` DROP `ssl`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` DROP `ssl_ipandport`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` DROP `ipandport`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` DROP `ssl`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` DROP `ssl_ipandport`;"); lastStepStatus(0); updateToVersion('0.9.29.1-dev1'); @@ -2354,7 +2430,7 @@ if (isFroxlorVersion('0.9.29.1-dev1')) { lastStepStatus(0); showUpdateStep("Updating table layouts and contents"); - Database::query("ALTER TABLE `".TABLE_MAIL_USERS."` ADD `mboxsize` bigint(30) NOT NULL default '0' AFTER `imap`;"); + Database::query("ALTER TABLE `" . TABLE_MAIL_USERS . "` ADD `mboxsize` bigint(30) NOT NULL default '0' AFTER `imap`;"); Database::query("INSERT INTO `cronjobs_run` SET `module` = 'froxlor/core', `cronfile` = 'cron_mailboxsize.php', `interval` = '6 HOUR', `isactive` = '1', `desc_lng_key` = 'cron_mailboxsize';"); lastStepStatus(0); @@ -2383,11 +2459,11 @@ if (isFroxlorVersion('0.9.29.1-dev3')) { // If you upgraded from SysCP the edit_billingdata field has been // removed in one of the first upgrades to froxlor. Sadly, one field - // remained in the install.sql so we remove it now if it exists - $bd_exists = Database::query("SHOW COLUMNS FROM `".TABLE_PANEL_ADMINS."` LIKE 'edit_billingdata';"); + // remained in the install.sql so we remove it now if it exists + $bd_exists = Database::query("SHOW COLUMNS FROM `" . TABLE_PANEL_ADMINS . "` LIKE 'edit_billingdata';"); if (Database::num_rows() > 0) { showUpdateStep("Removing old billing-field from admin-users"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `edit_billingdata`"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `edit_billingdata`"); lastStepStatus(0); } @@ -2438,7 +2514,7 @@ if (isFroxlorVersion('0.9.31-dev1')) { showUpdateStep("Adding new phpfpm-ipcdir setting"); $ins_stmt = Database::prepare(" - INSERT INTO `".TABLE_PANEL_SETTINGS."` SET `settinggroup` = 'phpfpm', `varname` = 'fastcgi_ipcdir', `value` = :value + INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'phpfpm', `varname` = 'fastcgi_ipcdir', `value` = :value "); $params = array(); // set default for apache (which will suite in most cases) @@ -2485,12 +2561,12 @@ if (isFroxlorVersion('0.9.31-dev4')) { showUpdateStep("Updating from 0.9.31-dev4 to 0.9.31-dev5", true); lastStepStatus(0); - $update_error_report_admin = isset($_POST['update_error_report_admin']) ? (int)$_POST['update_error_report_admin'] : '1'; - $update_error_report_customer = isset($_POST['update_error_report_customer']) ? (int)$_POST['update_error_report_customer'] : '0'; + $update_error_report_admin = isset($_POST['update_error_report_admin']) ? (int) $_POST['update_error_report_admin'] : '1'; + $update_error_report_customer = isset($_POST['update_error_report_customer']) ? (int) $_POST['update_error_report_customer'] : '0'; showUpdateStep("Adding new error-reporting options"); $ins_stmt = Database::prepare(" - INSERT INTO `".TABLE_PANEL_SETTINGS."` SET `settinggroup` = 'system', `varname` = :varname, `value` = :value + INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = :varname, `value` = :value "); $params = array(); // admins @@ -2513,9 +2589,9 @@ if (isFroxlorVersion('0.9.31-dev5')) { lastStepStatus(0); showUpdateStep("Adding new fpm-configuration options (slowlog)"); - Database::query("ALTER TABLE `".TABLE_PANEL_PHPCONFIGS."` ADD `fpm_slowlog` tinyint(1) NOT NULL default '0' AFTER `mod_fcgid_maxrequests`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_PHPCONFIGS."` ADD `fpm_reqterm` varchar(15) NOT NULL default '60s' AFTER `fpm_slowlog`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_PHPCONFIGS."` ADD `fpm_reqslow` varchar(15) NOT NULL default '5s' AFTER `fpm_reqterm`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `fpm_slowlog` tinyint(1) NOT NULL default '0' AFTER `mod_fcgid_maxrequests`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `fpm_reqterm` varchar(15) NOT NULL default '60s' AFTER `fpm_slowlog`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `fpm_reqslow` varchar(15) NOT NULL default '5s' AFTER `fpm_reqterm`;"); lastStepStatus(0); updateToVersion('0.9.31-dev6'); @@ -2531,12 +2607,14 @@ if (isFroxlorVersion('0.9.31-rc1')) { showUpdateStep("Updating from 0.9.31-rc1 to 0.9.31-rc2"); lastStepStatus(0); - $update_admin_news_feed = isset($_POST['update_admin_news_feed']) ? (int)$_POST['update_admin_news_feed'] : '1'; + $update_admin_news_feed = isset($_POST['update_admin_news_feed']) ? (int) $_POST['update_admin_news_feed'] : '1'; showUpdateStep("Adding new news-feed option"); $ins_stmt = Database::prepare(" - INSERT INTO `".TABLE_PANEL_SETTINGS."` SET `settinggroup` = 'admin', `varname` = 'show_news_feed', `value` = :value + INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'admin', `varname` = 'show_news_feed', `value` = :value "); - Database::pexecute($ins_stmt, array('value' => $update_admin_news_feed)); + Database::pexecute($ins_stmt, array( + 'value' => $update_admin_news_feed + )); lastStepStatus(0); updateToVersion('0.9.31-rc2'); @@ -2557,15 +2635,19 @@ if (isFroxlorVersion('0.9.31-rc2')) { // update default vhosts-config for froxlor if they are on the system-default if (Settings::Get('system.mod_fcgid_defaultini_ownvhost') == '1') { $upd_stmt = Database::prepare(" - UPDATE `".TABLE_PANEL_SETTINGS."` SET `value` = :value WHERE `settinggroup` = 'system' AND `varname` = 'mod_fcgid_defaultini_ownvhost' + UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :value WHERE `settinggroup` = 'system' AND `varname` = 'mod_fcgid_defaultini_ownvhost' "); - Database::pexecute($upd_stmt, array('value' => $frxvhostconfid)); + Database::pexecute($upd_stmt, array( + 'value' => $frxvhostconfid + )); } if (Settings::Get('phpfpm.vhost_defaultini') == '1') { $upd_stmt = Database::prepare(" - UPDATE `".TABLE_PANEL_SETTINGS."` SET `value` = :value WHERE `settinggroup` = 'phpfpm' AND `varname` = 'vhost_defaultini' + UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :value WHERE `settinggroup` = 'phpfpm' AND `varname` = 'vhost_defaultini' "); - Database::pexecute($upd_stmt, array('value' => $frxvhostconfid)); + Database::pexecute($upd_stmt, array( + 'value' => $frxvhostconfid + )); } lastStepStatus(0); @@ -2573,9 +2655,9 @@ if (isFroxlorVersion('0.9.31-rc2')) { } if (isFroxlorVersion('0.9.31-rc3')) { - showUpdateStep("Updating from 0.9.31-rc3 to 0.9.31 final", true); - lastStepStatus(0); - updateToVersion('0.9.31'); + showUpdateStep("Updating from 0.9.31-rc3 to 0.9.31 final", true); + lastStepStatus(0); + updateToVersion('0.9.31'); } if (isFroxlorVersion('0.9.31')) { @@ -2585,9 +2667,9 @@ if (isFroxlorVersion('0.9.31')) { } if (isFroxlorVersion('0.9.31.1')) { - showUpdateStep("Updating from 0.9.31.1 to 0.9.31.2 final", true); - lastStepStatus(0); - updateToVersion('0.9.31.2'); + showUpdateStep("Updating from 0.9.31.1 to 0.9.31.2 final", true); + lastStepStatus(0); + updateToVersion('0.9.31.2'); } if (isFroxlorVersion('0.9.31.2')) { @@ -2596,48 +2678,48 @@ if (isFroxlorVersion('0.9.31.2')) { lastStepStatus(0); showUpdateStep("Removing APS-module (deprecated)"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'aps';"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `can_manage_aps_packages`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `aps_packages`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `aps_packages_used`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `aps_packages`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `aps_packages_used`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_DATABASES."` DROP `apsdb`;"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'aps';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `can_manage_aps_packages`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `aps_packages`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `aps_packages_used`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `aps_packages`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `aps_packages_used`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DATABASES . "` DROP `apsdb`;"); Database::query("DROP TABLE IF EXISTS `aps_packages`;"); Database::query("DROP TABLE IF EXISTS `aps_instances`;"); Database::query("DROP TABLE IF EXISTS `aps_settings`;"); Database::query("DROP TABLE IF EXISTS `aps_tasks`;"); Database::query("DROP TABLE IF EXISTS `aps_temp_settings`;"); - Database::query("DELETE FROM `".TABLE_PANEL_CRONRUNS."` WHERE `module` = 'froxlor/aps';"); + Database::query("DELETE FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `module` = 'froxlor/aps';"); lastStepStatus(0); showUpdateStep("Removing backup-module (deprecated)"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_enabled';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_dir';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_mysqldump_path';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_count';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_bigfile';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_enabled';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_server';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_user';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_pass';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_passive';"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `backup_allowed`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `backup_enabled`;"); - Database::query("DELETE FROM `".TABLE_PANEL_CRONRUNS."` WHERE `module` = 'froxlor/backup';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_enabled';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_dir';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_mysqldump_path';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_count';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_bigfile';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_ftp_enabled';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_ftp_server';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_ftp_user';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_ftp_pass';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'backup_ftp_passive';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `backup_allowed`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `backup_enabled`;"); + Database::query("DELETE FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `module` = 'froxlor/backup';"); lastStepStatus(0); showUpdateStep("Removing autoresponder-module (deprecated)"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'autoresponder';"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `email_autoresponder`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `email_autoresponder_used`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `email_autoresponder`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `email_autoresponder_used`;"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'autoresponder';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `email_autoresponder`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `email_autoresponder_used`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `email_autoresponder`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `email_autoresponder_used`;"); Database::query("DROP TABLE IF EXISTS `mail_autoresponder`;"); lastStepStatus(0); showUpdateStep("Updating ftp-groups entries"); - Database::query("UPDATE `".TABLE_FTP_GROUPS."` SET `members` = CONCAT(`members`, ',".Settings::Get('system.httpuser')."');"); + Database::query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members` = CONCAT(`members`, '," . Settings::Get('system.httpuser') . "');"); lastStepStatus(0); updateToVersion('0.9.32-dev1'); @@ -2650,14 +2732,29 @@ if (isFroxlorVersion('0.9.32-dev1')) { showUpdateStep("Adding mailserver - settings for traffic analysis"); $ins_stmt = Database::prepare(" - INSERT INTO `".TABLE_PANEL_SETTINGS."` SET `settinggroup` = 'system', `varname` = :varname, `value` = :value + INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET `settinggroup` = 'system', `varname` = :varname, `value` = :value "); - Database::pexecute($ins_stmt, array('varname' => 'mailtraffic_enabled', 'value' => isset($_POST['mailtraffic_enabled']) ? (int)$_POST['mailtraffic_enabled'] : '1')); - Database::pexecute($ins_stmt, array('varname' => 'mdalog', 'value' => isset($_POST['mdalog']) ? $_POST['mdalog'] : '/var/log/mail.log')); - Database::pexecute($ins_stmt, array('varname' => 'mtalog', 'value' => isset($_POST['mtalog']) ? $_POST['mtalog'] : '/var/log/mail.log')); - Database::pexecute($ins_stmt, array('varname' => 'mdaserver', 'value' => isset($_POST['mdaserver']) ? $_POST['mdaserver'] : 'dovecot')); - Database::pexecute($ins_stmt, array('varname' => 'mtaserver', 'value' => isset($_POST['mtaserver']) ? $_POST['mtaserver'] : 'postfix')); + Database::pexecute($ins_stmt, array( + 'varname' => 'mailtraffic_enabled', + 'value' => isset($_POST['mailtraffic_enabled']) ? (int) $_POST['mailtraffic_enabled'] : '1' + )); + Database::pexecute($ins_stmt, array( + 'varname' => 'mdalog', + 'value' => isset($_POST['mdalog']) ? $_POST['mdalog'] : '/var/log/mail.log' + )); + Database::pexecute($ins_stmt, array( + 'varname' => 'mtalog', + 'value' => isset($_POST['mtalog']) ? $_POST['mtalog'] : '/var/log/mail.log' + )); + Database::pexecute($ins_stmt, array( + 'varname' => 'mdaserver', + 'value' => isset($_POST['mdaserver']) ? $_POST['mdaserver'] : 'dovecot' + )); + Database::pexecute($ins_stmt, array( + 'varname' => 'mtaserver', + 'value' => isset($_POST['mtaserver']) ? $_POST['mtaserver'] : 'postfix' + )); lastStepStatus(0); updateToVersion('0.9.32-dev2'); @@ -2669,9 +2766,9 @@ if (isFroxlorVersion('0.9.32-dev2')) { lastStepStatus(0); showUpdateStep("Updating froxlor - theme"); - Database::query("UPDATE `".TABLE_PANEL_ADMINS."` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';"); - Database::query("UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';"); - Database::query("UPDATE `".TABLE_PANEL_SESSIONS."` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';"); + Database::query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';"); + Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';"); + Database::query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `theme` = 'Sparkle_froxlor' WHERE `theme` = 'Froxlor';"); if (Settings::Get('panel.default_theme') == 'Froxlor') { Settings::Set('panel.default_theme', 'Sparkle_froxlor'); } @@ -2686,7 +2783,7 @@ if (isFroxlorVersion('0.9.32-dev3')) { lastStepStatus(0); showUpdateStep("Adding new FTP-description field"); - Database::query("ALTER TABLE `".TABLE_FTP_USERS."` ADD `description` varchar(255) NOT NULL DEFAULT '' AFTER `customerid`;"); + Database::query("ALTER TABLE `" . TABLE_FTP_USERS . "` ADD `description` varchar(255) NOT NULL DEFAULT '' AFTER `customerid`;"); lastStepStatus(0); updateToVersion('0.9.32-dev4'); @@ -2698,7 +2795,7 @@ if (isFroxlorVersion('0.9.32-dev4')) { lastStepStatus(0); showUpdateStep("Updating cronjob table"); - Database::query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `cronfile` = REPLACE( REPLACE(`cronfile`, 'cron_', ''), '.php', '')"); + Database::query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `cronfile` = REPLACE( REPLACE(`cronfile`, 'cron_', ''), '.php', '')"); lastStepStatus(0); showUpdateStep("Adding new settings for cron"); @@ -2733,7 +2830,7 @@ if (isFroxlorVersion('0.9.32-dev6')) { showUpdateStep("Updating from 0.9.32-dev6 to 0.9.32-rc1", false); showUpdateStep("Enhancing tasks-table"); - Database::query("ALTER TABLE `".TABLE_PANEL_TASKS."` MODIFY `data` text NOT NULL default ''"); + Database::query("ALTER TABLE `" . TABLE_PANEL_TASKS . "` MODIFY `data` text NOT NULL default ''"); lastStepStatus(0); updateToVersion('0.9.32-rc1'); @@ -2744,7 +2841,7 @@ if (isFroxlorVersion('0.9.32-rc1')) { showUpdateStep("Updating from 0.9.32-rc1 to 0.9.32-rc2", false); showUpdateStep("Removing autoresponder-cronjob (deprecated)"); - Database::query("DELETE FROM `".TABLE_PANEL_CRONRUNS."` WHERE `module` = 'froxlor/autoresponder';"); + Database::query("DELETE FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `module` = 'froxlor/autoresponder';"); lastStepStatus(0); showUpdateStep("Adding new settings for cron"); @@ -2759,7 +2856,7 @@ if (isFroxlorVersion('0.9.32-rc1')) { lastStepStatus(0); showUpdateStep("Removing backup-module ftp-users (deprecated)"); - Database::query("DELETE FROM `".TABLE_FTP_USERS."` WHERE `username` LIKE '%_backup';"); + Database::query("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `username` LIKE '%_backup';"); lastStepStatus(0); updateToVersion('0.9.32-rc2'); @@ -2786,7 +2883,7 @@ if (isFroxlorVersion('0.9.32')) { showUpdateStep("Updating from 0.9.32 to 0.9.33-dev1", false); showUpdateStep("Adding settings for custom newsfeed on customer-dashboard"); - Settings::AddNew("customer.show_news_feed", isset($_POST['customer_show_news_feed']) ? (int)$_POST['customer_show_news_feed'] : '0'); + Settings::AddNew("customer.show_news_feed", isset($_POST['customer_show_news_feed']) ? (int) $_POST['customer_show_news_feed'] : '0'); Settings::AddNew("customer.news_feed_url", isset($_POST['customer_news_feed_url']) ? $_POST['customer_news_feed_url'] : ''); lastStepStatus(0); @@ -2797,7 +2894,7 @@ if (isFroxlorVersion('0.9.33-dev1')) { showUpdateStep("Updating from 0.9.33-dev1 to 0.9.33-dev2", false); showUpdateStep("Adding settings for hostname-dns-entry"); - Settings::AddNew("system.dns_createhostnameentry", isset($_POST['dns_createhostnameentry']) ? (int)$_POST['dns_createhostnameentry'] : '0'); + Settings::AddNew("system.dns_createhostnameentry", isset($_POST['dns_createhostnameentry']) ? (int) $_POST['dns_createhostnameentry'] : '0'); lastStepStatus(0); updateToVersion('0.9.33-dev2'); @@ -2825,28 +2922,28 @@ if (isFroxlorVersion('0.9.33-dev3')) { showUpdateStep("Updating from 0.9.33-dev3 to 0.9.33-rc1", false); showUpdateStep("Updating database-scheme"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` MODIFY `dkim_privkey` text"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` MODIFY `dkim_pubkey` text"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` MODIFY `specialsettings` text"); - Database::query("ALTER TABLE `".TABLE_PANEL_IPSANDPORTS."` MODIFY `specialsettings` text"); - Database::query("ALTER TABLE `".TABLE_PANEL_IPSANDPORTS."` MODIFY `default_vhostconf_domain` text"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` MODIFY `ssl_ca_file` text"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` MODIFY `ssl_cert_chainfile` text"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` MODIFY `dkim_privkey` text"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` MODIFY `dkim_pubkey` text"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` MODIFY `specialsettings` text"); + Database::query("ALTER TABLE `" . TABLE_PANEL_IPSANDPORTS . "` MODIFY `specialsettings` text"); + Database::query("ALTER TABLE `" . TABLE_PANEL_IPSANDPORTS . "` MODIFY `default_vhostconf_domain` text"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_ca_file` text"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_cert_chainfile` text"); lastStepStatus(0); showUpdateStep("Removing old settings"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup`='panel' AND `varname` = 'use_webfonts';"); - Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup`='panel' AND `varname` = 'webfont';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup`='panel' AND `varname` = 'use_webfonts';"); + Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup`='panel' AND `varname` = 'webfont';"); lastStepStatus(0); showUpdateStep("Adding local froxlor group to customer groups"); - if ((int)Settings::Get('system.mod_fcgid_ownvhost') == 1 || (int)Settings::Get('phpfpm.enabled_ownvhost') == 1) { - if ((int)Settings::Get('system.mod_fcgid') == 1) { + if ((int) Settings::Get('system.mod_fcgid_ownvhost') == 1 || (int) Settings::Get('phpfpm.enabled_ownvhost') == 1) { + if ((int) Settings::Get('system.mod_fcgid') == 1) { $local_user = Settings::Get('system.mod_fcgid_httpuser'); } else { $local_user = Settings::Get('phpfpm.vhost_httpuser'); } - Database::query("UPDATE `".TABLE_FTP_GROUPS."` SET `members` = CONCAT(`members`, ',".$local_user."');"); + Database::query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members` = CONCAT(`members`, '," . $local_user . "');"); lastStepStatus(0); } else { lastStepStatus(1, "not needed"); @@ -2859,21 +2956,21 @@ if (isFroxlorVersion('0.9.33-rc1')) { showUpdateStep("Updating from 0.9.33-rc1 to 0.9.33-rc2", false); showUpdateStep("Add new setting for sending cron-errors via mail"); - $sendcronerrors = isset($_POST['system_send_cron_errors']) ? (int)$_POST['system_send_cron_errors'] : "0"; + $sendcronerrors = isset($_POST['system_send_cron_errors']) ? (int) $_POST['system_send_cron_errors'] : "0"; Settings::addNew('system.send_cron_errors', $sendcronerrors); lastStepStatus(0); showUpdateStep("Add new custom-notes field for admins and customer"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` ADD `custom_notes` text AFTER `theme`"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` ADD `custom_notes_show` tinyint(1) NOT NULL default '0' AFTER `custom_notes`"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `custom_notes` text AFTER `theme`"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `custom_notes_show` tinyint(1) NOT NULL default '0' AFTER `custom_notes`"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` ADD `custom_notes` text AFTER `theme`"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` ADD `custom_notes_show` tinyint(1) NOT NULL default '0' AFTER `custom_notes`"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `custom_notes` text AFTER `theme`"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `custom_notes_show` tinyint(1) NOT NULL default '0' AFTER `custom_notes`"); lastStepStatus(0); // go from varchar(50) to varchar(255) because of some hashes that are longer than that showUpdateStep("Updating table structure of admins and customers"); - Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` MODIFY `password` varchar(255) NOT NULL default ''"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` MODIFY `password` varchar(255) NOT NULL default ''"); + Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` MODIFY `password` varchar(255) NOT NULL default ''"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` MODIFY `password` varchar(255) NOT NULL default ''"); lastStepStatus(0); updateToVersion('0.9.33-rc2'); @@ -2884,197 +2981,207 @@ if (isFroxlorVersion('0.9.33-rc2')) { showUpdateStep("Updating from 0.9.33-rc2 to 0.9.33-rc3"); lastStepStatus(0); updateToVersion('0.9.33-rc3'); - } if (isFroxlorVersion('0.9.33-rc3')) { - showUpdateStep("Updating from 0.9.33-rc3 to 0.9.33 final"); - lastStepStatus(0); - updateToVersion('0.9.33'); - + showUpdateStep("Updating from 0.9.33-rc3 to 0.9.33 final"); + lastStepStatus(0); + updateToVersion('0.9.33'); } if (isFroxlorVersion('0.9.33')) { - showUpdateStep("Updating from 0.9.33 to 0.9.33.1"); - lastStepStatus(0); - updateToVersion('0.9.33.1'); - + showUpdateStep("Updating from 0.9.33 to 0.9.33.1"); + lastStepStatus(0); + updateToVersion('0.9.33.1'); } if (isFroxlorVersion('0.9.33.1')) { - showUpdateStep("Updating from 0.9.33.1 to 0.9.33.2"); - lastStepStatus(0); - updateToVersion('0.9.33.2'); - + showUpdateStep("Updating from 0.9.33.1 to 0.9.33.2"); + lastStepStatus(0); + updateToVersion('0.9.33.2'); } if (isFroxlorVersion('0.9.33.2')) { - showUpdateStep("Updating from 0.9.33.2 to 0.9.34-dev1", false); + showUpdateStep("Updating from 0.9.33.2 to 0.9.34-dev1", false); - showUpdateStep("Updating table structure of domains"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` MODIFY `parentdomainid` int(11) NOT NULL default '0'"); - lastStepStatus(0); + showUpdateStep("Updating table structure of domains"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` MODIFY `parentdomainid` int(11) NOT NULL default '0'"); + lastStepStatus(0); - showUpdateStep("Updating stored email-templates"); - $chk_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_TEMPLATES."` WHERE `templategroup` = 'mails'"); - Database::pexecute($chk_stmt); - // do we have any? - if ($chk_stmt->rowCount() > 0) { - // prepare update-statement - $upd_stmt = Database::prepare("UPDATE `".TABLE_PANEL_TEMPLATES."` SET `language` = :lang WHERE `id` = :id"); - // get each row - while ($row = $chk_stmt->fetch()) { - // let htmlentities run over the language name and update the entry - Database::pexecute($upd_stmt, array('lang' => htmlentities($row['language'])), false); - } - lastStepStatus(0); - } else { - lastStepStatus(1, "not needed"); - } + showUpdateStep("Updating stored email-templates"); + $chk_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `templategroup` = 'mails'"); + Database::pexecute($chk_stmt); + // do we have any? + if ($chk_stmt->rowCount() > 0) { + // prepare update-statement + $upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `language` = :lang WHERE `id` = :id"); + // get each row + while ($row = $chk_stmt->fetch()) { + // let htmlentities run over the language name and update the entry + Database::pexecute($upd_stmt, array( + 'lang' => htmlentities($row['language']) + ), false); + } + lastStepStatus(0); + } else { + lastStepStatus(1, "not needed"); + } - showUpdateStep("Updating language descriptions to be in the native language"); - $upd_stmt = Database::prepare("UPDATE `".TABLE_PANEL_LANGUAGE."` SET `language` = :lang WHERE `iso` = :iso"); - Database::pexecute($upd_stmt, array('lang' => 'Français', 'iso' => 'fr'), false); - Database::pexecute($upd_stmt, array('lang' => 'Português', 'iso' => 'pt'), false); - Database::pexecute($upd_stmt, array('lang' => 'Italiano', 'iso' => 'it'), false); - Database::pexecute($upd_stmt, array('lang' => 'Nederlands', 'iso' => 'nl'), false); - Database::pexecute($upd_stmt, array('lang' => 'Svenska', 'iso' => 'sv'), false); - lastStepStatus(0); + showUpdateStep("Updating language descriptions to be in the native language"); + $upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_LANGUAGE . "` SET `language` = :lang WHERE `iso` = :iso"); + Database::pexecute($upd_stmt, array( + 'lang' => 'Français', + 'iso' => 'fr' + ), false); + Database::pexecute($upd_stmt, array( + 'lang' => 'Português', + 'iso' => 'pt' + ), false); + Database::pexecute($upd_stmt, array( + 'lang' => 'Italiano', + 'iso' => 'it' + ), false); + Database::pexecute($upd_stmt, array( + 'lang' => 'Nederlands', + 'iso' => 'nl' + ), false); + Database::pexecute($upd_stmt, array( + 'lang' => 'Svenska', + 'iso' => 'sv' + ), false); + lastStepStatus(0); - updateToVersion('0.9.34-dev1'); + updateToVersion('0.9.34-dev1'); } if (isFroxlorVersion('0.9.34-dev1')) { - showUpdateStep("Updating from 0.9.34-dev1 to 0.9.34-dev2", false); + showUpdateStep("Updating from 0.9.34-dev1 to 0.9.34-dev2", false); - showUpdateStep("Adding new settings for apache-itk-mpm"); - Settings::AddNew("system.apacheitksupport", '0'); - lastStepStatus(0); + showUpdateStep("Adding new settings for apache-itk-mpm"); + Settings::AddNew("system.apacheitksupport", '0'); + lastStepStatus(0); - showUpdateStep("Increase text-field size of domain-ssl table"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` MODIFY `ssl_cert_file` mediumtext NOT NULL"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` MODIFY `ssl_key_file` mediumtext NOT NULL"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` MODIFY `ssl_ca_file` mediumtext NOT NULL"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` MODIFY `ssl_cert_chainfile` mediumtext NOT NULL"); - lastStepStatus(0); - - updateToVersion('0.9.34-dev2'); + showUpdateStep("Increase text-field size of domain-ssl table"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_cert_file` mediumtext NOT NULL"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_key_file` mediumtext NOT NULL"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_ca_file` mediumtext NOT NULL"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` MODIFY `ssl_cert_chainfile` mediumtext NOT NULL"); + lastStepStatus(0); + updateToVersion('0.9.34-dev2'); } if (isFroxlorVersion('0.9.34-dev2')) { - showUpdateStep("Updating from 0.9.34-dev2 to 0.9.34-dev3", false); + showUpdateStep("Updating from 0.9.34-dev2 to 0.9.34-dev3", false); - $do_update = true; - showUpdateStep("Checking for required PHP mbstring-extension"); - if (!extension_loaded('mbstring')) { - $do_update = false; - lastStepStatus(2, 'not installed'); - } else { - lastStepStatus(0); - } + $do_update = true; + showUpdateStep("Checking for required PHP mbstring-extension"); + if (! extension_loaded('mbstring')) { + $do_update = false; + lastStepStatus(2, 'not installed'); + } else { + lastStepStatus(0); + } - if ($do_update) { - updateToVersion('0.9.34-dev3'); - } + if ($do_update) { + updateToVersion('0.9.34-dev3'); + } } - if (isFroxlorVersion('0.9.34-dev3')) { - showUpdateStep("Updating from 0.9.34-dev3 to 0.9.34-dev4", false); + showUpdateStep("Updating from 0.9.34-dev3 to 0.9.34-dev4", false); - showUpdateStep("Adding field umask to phpconfig table"); - Database::query("ALTER TABLE `".TABLE_PANEL_PHPCONFIGS."` ADD `mod_fcgid_umask` varchar(15) NOT NULL DEFAULT '022' AFTER `mod_fcgid_maxrequests`"); - lastStepStatus(0); + showUpdateStep("Adding field umask to phpconfig table"); + Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `mod_fcgid_umask` varchar(15) NOT NULL DEFAULT '022' AFTER `mod_fcgid_maxrequests`"); + lastStepStatus(0); - updateToVersion('0.9.34-dev4'); + updateToVersion('0.9.34-dev4'); } if (isFroxlorVersion('0.9.34-dev4')) { - showUpdateStep("Updating from 0.9.34-dev4 to 0.9.34 final"); - lastStepStatus(0); + showUpdateStep("Updating from 0.9.34-dev4 to 0.9.34 final"); + lastStepStatus(0); - updateToVersion('0.9.34'); + updateToVersion('0.9.34'); } if (isFroxlorVersion('0.9.34')) { - showUpdateStep("Updating from 0.9.34 to 0.9.34.1"); - lastStepStatus(0); + showUpdateStep("Updating from 0.9.34 to 0.9.34.1"); + lastStepStatus(0); - updateToVersion('0.9.34.1'); + updateToVersion('0.9.34.1'); } if (isFroxlorVersion('0.9.34.1')) { - showUpdateStep("Updating from 0.9.34.1 to 0.9.34.2"); - lastStepStatus(0); + showUpdateStep("Updating from 0.9.34.1 to 0.9.34.2"); + lastStepStatus(0); - updateToVersion('0.9.34.2'); + updateToVersion('0.9.34.2'); } if (isFroxlorVersion('0.9.34.2')) { - showUpdateStep("Updating from 0.9.34.2 to 0.9.35-dev1", false); + showUpdateStep("Updating from 0.9.34.2 to 0.9.35-dev1", false); - showUpdateStep("Adding Let's Encrypt - certificate fields"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` ADD `expirationdate` DATETIME NULL AFTER `ssl_cert_chainfile`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `lepublickey` MEDIUMTEXT DEFAULT NULL AFTER `custom_notes_show`"); - Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `leprivatekey` MEDIUMTEXT DEFAULT NULL AFTER `lepublickey`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `letsencrypt` TINYINT(1) NOT NULL DEFAULT '0' AFTER `ismainbutsubto`;"); - Settings::AddNew("system.leprivatekey", 'unset'); - Settings::AddNew("system.lepublickey", 'unset'); - showUpdateStep("Adding new cron-module for Let's encrypt"); - $stmt = Database::prepare(" + showUpdateStep("Adding Let's Encrypt - certificate fields"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` ADD `expirationdate` DATETIME NULL AFTER `ssl_cert_chainfile`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `lepublickey` MEDIUMTEXT DEFAULT NULL AFTER `custom_notes_show`"); + Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `leprivatekey` MEDIUMTEXT DEFAULT NULL AFTER `lepublickey`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `letsencrypt` TINYINT(1) NOT NULL DEFAULT '0' AFTER `ismainbutsubto`;"); + Settings::AddNew("system.leprivatekey", 'unset'); + Settings::AddNew("system.lepublickey", 'unset'); + showUpdateStep("Adding new cron-module for Let's encrypt"); + $stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_CRONRUNS . "` SET `module` = 'froxlor/letsencrypt', `cronfile` = 'letsencrypt', `interval` = '5 MINUTE', `desc_lng_key` = 'cron_letsencrypt', `lastrun` = UNIX_TIMESTAMP(), - `isactive` = 0" - ); - Database::pexecute($stmt); - lastStepStatus(0); + `isactive` = 0"); + Database::pexecute($stmt); + lastStepStatus(0); - updateToVersion('0.9.35-dev1'); + updateToVersion('0.9.35-dev1'); } if (isFroxlorVersion('0.9.35-dev1')) { - showUpdateStep("Updating from 0.9.35-dev1 to 0.9.35-dev2", false); + showUpdateStep("Updating from 0.9.35-dev1 to 0.9.35-dev2", false); - showUpdateStep("Adding Let's Encrypt - settings"); - Settings::AddNew("system.letsencryptca", 'production'); - Settings::AddNew("system.letsencryptcountrycode", 'DE'); - Settings::AddNew("system.letsencryptstate", 'Germany'); - lastStepStatus(0); + showUpdateStep("Adding Let's Encrypt - settings"); + Settings::AddNew("system.letsencryptca", 'production'); + Settings::AddNew("system.letsencryptcountrycode", 'DE'); + Settings::AddNew("system.letsencryptstate", 'Germany'); + lastStepStatus(0); - updateToVersion('0.9.35-dev2'); + updateToVersion('0.9.35-dev2'); } if (isFroxlorVersion('0.9.35-dev2')) { - showUpdateStep("Updating from 0.9.35-dev2 to 0.9.35-dev3", false); + showUpdateStep("Updating from 0.9.35-dev2 to 0.9.35-dev3", false); - showUpdateStep("Adding new domain fields for Let's Encrypt"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `termination_date` date NOT NULL AFTER `registration_date`"); - lastStepStatus(0); + showUpdateStep("Adding new domain fields for Let's Encrypt"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `termination_date` date NOT NULL AFTER `registration_date`"); + lastStepStatus(0); - updateToVersion('0.9.35-dev3'); + updateToVersion('0.9.35-dev3'); } if (isFroxlorVersion('0.9.35-dev3')) { - showUpdateStep("Updating from 0.9.35-dev3 to 0.9.35-dev4", false); + showUpdateStep("Updating from 0.9.35-dev3 to 0.9.35-dev4", false); // remove unused setting showUpdateStep("Removing unused setting "Send cron-errors to froxlor-admin via e-mail""); @@ -3084,19 +3191,18 @@ if (isFroxlorVersion('0.9.35-dev3')) { updateToVersion('0.9.35-dev4'); } - if (isFroxlorVersion('0.9.35-dev4')) { - showUpdateStep("Updating from 0.9.35-dev4 to 0.9.35-dev5", false); + showUpdateStep("Updating from 0.9.35-dev4 to 0.9.35-dev5", false); showUpdateStep("Adding more Let's Encrypt settings"); - Settings::AddNew("system.letsencryptchallengepath", FROXLOR_INSTALL_DIR); - Settings::AddNew("system.letsencryptkeysize", '4096'); - Settings::AddNew("system.letsencryptreuseold", 0); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` ADD `ssl_csr_file` MEDIUMTEXT AFTER `ssl_cert_chainfile`;"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `hsts` VARCHAR(10) NOT NULL DEFAULT '0' AFTER `letsencrypt`"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `hsts_sub` TINYINT(1) NOT NULL DEFAULT '0' AFTER `hsts`"); - Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `hsts_preload` TINYINT(1) NOT NULL DEFAULT '1' AFTER `hsts_sub`"); + Settings::AddNew("system.letsencryptchallengepath", FROXLOR_INSTALL_DIR); + Settings::AddNew("system.letsencryptkeysize", '4096'); + Settings::AddNew("system.letsencryptreuseold", 0); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` ADD `ssl_csr_file` MEDIUMTEXT AFTER `ssl_cert_chainfile`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `hsts` VARCHAR(10) NOT NULL DEFAULT '0' AFTER `letsencrypt`"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `hsts_sub` TINYINT(1) NOT NULL DEFAULT '0' AFTER `hsts`"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `hsts_preload` TINYINT(1) NOT NULL DEFAULT '1' AFTER `hsts_sub`"); lastStepStatus(0); updateToVersion('0.9.35-dev5'); @@ -3118,8 +3224,8 @@ if (isFroxlorVersion('0.9.35-dev5')) { lastStepStatus(0); showUpdateStep("Adding new fields to panel_domains table"); - Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS ."` ADD `vhost_usedefaultlocation` tinyint(1) NOT NULL default '1' AFTER `ssl_redirect`;"); - Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS ."` ADD `vhostsettingid` tinyint(11) NOT NULL default '0' AFTER `vhost_usedefaultlocation`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `vhost_usedefaultlocation` tinyint(1) NOT NULL default '1' AFTER `ssl_redirect`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `vhostsettingid` tinyint(11) NOT NULL default '0' AFTER `vhost_usedefaultlocation`;"); lastStepStatus(0); updateToVersion('0.9.35-dev6'); @@ -3139,35 +3245,42 @@ if (isFroxlorVersion('0.9.35-dev6')) { if (isFroxlorVersion('0.9.35-dev7')) { - showUpdateStep("Updating from 0.9.35-dev7 to 0.9.35-rc1"); - lastStepStatus(0); + showUpdateStep("Updating from 0.9.35-dev7 to 0.9.35-rc1"); + lastStepStatus(0); - updateToVersion('0.9.35-rc1'); + updateToVersion('0.9.35-rc1'); } if (isFroxlorVersion('0.9.35-rc1') && isDatabaseVersion(null)) { - Settings::AddNew("panel.db_version", "201603070"); + Settings::AddNew("panel.db_version", "201603070"); - showUpdateStep("Removing unused table and fields from database"); - Database::query("DROP TABLE IF EXISTS `panel_vhostconfigs`;"); - Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS ."` DROP `vhost_usedefaultlocation`;"); - Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS ."` DROP `vhostsettingid`;"); - lastStepStatus(0); - - showUpdateStep("Adding new setting to enable/disable Let's Encrypt"); - $enable_letsencrypt = isset($_POST['enable_letsencrypt']) ? (int)$_POST['enable_letsencrypt'] : "1"; - Settings::AddNew("system.leenabled", $enable_letsencrypt); - Database::query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `isactive` = '".$enable_letsencrypt."' WHERE `cronfile` = 'letsencrypt'"); - lastStepStatus(0); + showUpdateStep("Removing unused table and fields from database"); + Database::query("DROP TABLE IF EXISTS `panel_vhostconfigs`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` DROP `vhost_usedefaultlocation`;"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` DROP `vhostsettingid`;"); + lastStepStatus(0); + showUpdateStep("Adding new setting to enable/disable Let's Encrypt"); + $enable_letsencrypt = isset($_POST['enable_letsencrypt']) ? (int) $_POST['enable_letsencrypt'] : "1"; + Settings::AddNew("system.leenabled", $enable_letsencrypt); + Database::query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `isactive` = '" . $enable_letsencrypt . "' WHERE `cronfile` = 'letsencrypt'"); + lastStepStatus(0); } if (isDatabaseVersion('201603070')) { showUpdateStep("Adding new php.ini directive to php-configurations: opcache.restrict_api"); - Database::query("UPDATE `" . TABLE_PANEL_PHPCONFIGS ."` SET `phpsettings` = CONCAT(`phpsettings`, '\r\nopcache.restrict_api = \"{DOCUMENT_ROOT}\"\r\n');"); + Database::query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `phpsettings` = CONCAT(`phpsettings`, '\r\nopcache.restrict_api = \"{DOCUMENT_ROOT}\"\r\n');"); lastStepStatus(0); updateToDbVersion('201603150'); } + +if (isFroxlorVersion('0.9.35-rc1')) { + + showUpdateStep("Updating from 0.9.35-rc1 to 0.9.35 final"); + lastStepStatus(0); + + updateToVersion('0.9.35'); +} diff --git a/lib/version.inc.php b/lib/version.inc.php index 654974fd..ea86f687 100644 --- a/lib/version.inc.php +++ b/lib/version.inc.php @@ -16,7 +16,7 @@ */ // Main version variable -$version = '0.9.35-rc1'; +$version = '0.9.35'; // Database version (YYYYMMDDC where C is a daily counter) $dbversion = '201603150';