diff --git a/admin_updates.php b/admin_updates.php index 24b56666..282ff757 100644 --- a/admin_updates.php +++ b/admin_updates.php @@ -57,30 +57,54 @@ if($page == 'overview') if(hasUpdates($version)) { + $successful_update = false; + $message = ''; + if(isset($_POST['send']) && $_POST['send'] == 'send') { - - eval("echo \"" . getTemplate("update/update_start") . "\";"); - - include_once('./install/updatesql.php'); - - $redirect_url = 'admin_index.php'; - eval("echo \"" . getTemplate("update/update_end") . "\";"); - - updateCounters(); - inserttask('1'); - @chmod('./lib/userdata.inc.php', 0440); + if((isset($_POST['update_preconfig']) + && isset($_POST['update_changesagreed']) + && intval($_POST['update_changesagreed']) != 0) + || !isset($_POST['update_preconfig']) + ) { + eval("echo \"" . getTemplate("update/update_start") . "\";"); + + include_once './install/updatesql.php'; + + $redirect_url = 'admin_index.php'; + eval("echo \"" . getTemplate("update/update_end") . "\";"); + + updateCounters(); + inserttask('1'); + @chmod('./lib/userdata.inc.php', 0440); + + $successful_update = true; + } + else + { + $message = '
You have to agree that you have read the update notifications.'; + } } - else + + if(!$successful_update) { $current_version = $settings['panel']['version']; $new_version = $version; - $ui_text = $lng['update']['update_information']; + $ui_text = $lng['update']['update_information']['part_a']; $ui_text = str_replace('%curversion', $current_version, $ui_text); $ui_text = str_replace('%newversion', $new_version, $ui_text); $update_information = $ui_text; + + include_once './install/updates/preconfig.php'; + $preconfig = getPreConfig($new_version); + if($preconfig != '') + { + $update_information .= '
'.$preconfig.$message; + } + + $update_information .= $lng['update']['update_information']['part_b']; eval("echo \"" . getTemplate("update/index") . "\";"); } diff --git a/customer_domains.php b/customer_domains.php index 2b01b267..22cd9dbf 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -335,7 +335,7 @@ elseif($page == 'domains') } else { - $result = $db->query("SELECT `id`, `domain`, `documentroot`, `ssl_redirect`,`isemaildomain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `email_only`='0' AND `iswildcarddomain`='0' AND `caneditdomain`='1' ORDER BY `domain` ASC"); + $result = $db->query("SELECT `id`, `domain`, `documentroot`, `ssl_redirect`,`isemaildomain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `email_only`='0' AND `caneditdomain`='1' ORDER BY `domain` ASC"); $domains = ''; while($row = $db->fetch_array($result)) @@ -394,16 +394,7 @@ elseif($page == 'domains') if(isset($_POST['iswildcarddomain']) && $_POST['iswildcarddomain'] == '1' && $result['parentdomainid'] == '0' - && $userinfo['subdomains'] != '0') - { - $wildcarddomaincheck = $db->query("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `parentdomainid` = '" . (int)$result['id'] . "'"); - - if($db->num_rows($wildcarddomaincheck) != '0') - { - standard_error('firstdeleteallsubdomains'); - exit; - } - + ){ $iswildcarddomain = '1'; } else diff --git a/install/froxlor.sql b/install/froxlor.sql index d8833b79..ea93c175 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -274,7 +274,7 @@ CREATE TABLE `panel_domains` ( `isbinddomain` tinyint(1) NOT NULL default '0', `isemaildomain` tinyint(1) NOT NULL default '0', `email_only` tinyint(1) NOT NULL default '0', - `iswildcarddomain` tinyint(1) NOT NULL default '0', + `iswildcarddomain` tinyint(1) NOT NULL default '1', `subcanemaildomain` tinyint(1) NOT NULL default '0', `caneditdomain` tinyint(1) NOT NULL default '1', `zonefile` varchar(255) NOT NULL default '', 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 c67ee3b9..75669bd8 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -430,4 +430,40 @@ if(isFroxlorVersion('0.9.4')) updateToVersion('0.9.4-svn1'); } +if(isFroxlorVersion('0.9.4-svn1')) +{ + showUpdateStep("Updating from 0.9.4-svn1 to 0.9.4-svn2", false); + + $update_domains = isset($_POST['update_domainwildcardentry']) ? intval($_POST['update_domainwildcardentry']) : 0; + + if($update_domains != 1) + { + $update_domains = 0; + } + + 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`"; + $result = $db->query($query); + $updated_domains = 0; + while($domain = $db->fetch_array($result)) + { + $db->query("UPDATE `".TABLE_PANEL_DOMAINS."` SET `iswildcarddomain` = '1' WHERE `id` ='".(int)$domain['id']."'"); + $updated_domains++; + } + lastStepStatus(0, 'Updated '.$updated_domains.' domain(s)'); + } else { + showUpdateStep("Won't update domains with iswildcarddomain=yes as requested"); + lastStepStatus(1); + } + + showUpdateStep("Updating database table definition for panel_domains"); + $db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` MODIFY `iswildcarddomain` tinyint(1) NOT NULL default '1';"); + lastStepStatus(0); + + updateToVersion('0.9.4-svn2'); +} + ?> diff --git a/install/updates/preconfig.php b/install/updates/preconfig.php new file mode 100644 index 00000000..163d22d0 --- /dev/null +++ b/install/updates/preconfig.php @@ -0,0 +1,52 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Language + * @version $Id$ + */ + +/** + * Function getPreConfig + * + * outputs various content before the update process + * can be continued (askes for agreement whatever is being asked) + * + * @param string version + * + * @return string + */ +function getPreConfig($version) +{ + $has_preconfig = false; + $return = '

PLEASE NOTE - Important update notifications

'; + + if($version == '0.9.4-svn2') + { + $has_preconfig = true; + $return .= 'Froxlor-0.9.4-svn2 now enabled the usage of a domain-wildcard entry and subdomains for this domain at once (subdomains are parsed before the main vhost container). '; + $return .= 'This makes it possible to catch all non-existing subdomains with the main vhost but also have the ability to use subdomains for that domain.
'; + $return .= 'If you would like Froxlor to do so with your domains, the update script can set the correct values for existing domains for you. Note: future domains will have wildcard-entries enabled by default no matter how you decide here.

'; + $return .= 'Do you want to use wildcard-entries for existing domains?: '; + $return .= makeyesno('update_domainwildcardentry', '1', '0', '1'); + } + + $return .= '

'.makecheckbox('update_changesagreed', 'I have read the update notifications and I am aware of the changes made to my system.', '1', true, '0', true); + $return .= '
'; + $return .= ''; + + if($has_preconfig) { + return $return; + } else { + return ''; + } +} diff --git a/lib/functions/aps/function.domainHasApsInstances.php b/lib/functions/aps/function.domainHasApsInstances.php index 7b00d50b..a1510a68 100644 --- a/lib/functions/aps/function.domainHasApsInstances.php +++ b/lib/functions/aps/function.domainHasApsInstances.php @@ -26,7 +26,6 @@ * * @return boolean */ - function domainHasApsInstances($domainid = 0) { global $db, $settings; diff --git a/lng/english.lng.php b/lng/english.lng.php index 5815e7ea..ff9bc336 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1258,7 +1258,8 @@ $lng['panel']['off'] = 'off'; $lng['update']['updateinprogress_onlyadmincanlogin'] = 'A newer version of Froxlor has been installed but not yet set up.
Only the administrator can log in and finish the update.'; $lng['update']['update'] = 'Froxlor Update'; $lng['update']['proceed'] = 'Proceed'; -$lng['update']['update_information'] = 'The Froxlor files have been updated to version %newversion. The installed version is %curversion.

Customers will not be able to log in until the update has been finished.
Proceed?'; +$lng['update']['update_information']['part_a'] = 'The Froxlor files have been updated to version %newversion. The installed version is %curversion.'; +$lng['update']['update_information']['part_b'] = '

Customers will not be able to log in until the update has been finished.
Proceed?'; $lng['update']['noupdatesavail'] = 'You already have the latest Froxlor version.'; $lng['admin']['specialsettingsforsubdomains'] = 'Apply specialsettings to all subdomains (*.example.com)'; $lng['serversettings']['specialsettingsforsubdomains']['description'] = 'If yes these custom vhost-settings will be added to all subdomains; if no subdomain-specialsettings are being removed.'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 06a671a1..3b6188e6 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1238,7 +1238,8 @@ $lng['panel']['off'] = 'aus'; $lng['update']['updateinprogress_onlyadmincanlogin'] = 'Eine neuere Version von Froxlor wurde installiert, aber noch nicht eingerichtet.
Nur der Administrator kann sich anmelden und die Aktualisierung abschließen.'; $lng['update']['update'] = 'Froxlor Aktualisierung'; $lng['update']['proceed'] = 'Ausführen'; -$lng['update']['update_information'] = 'Die Froxlor Dateien wurden aktualisiert. Neue Version ist %newversion. Die bisher installierte Version ist %curversion

Ein Kunden-Login ist vor Abschluss des Aktualisierungsvorganges nicht m&oouml;glich.
Aktualisierung ausführen?'; +$lng['update']['update_information']['part_a'] = 'Die Froxlor Dateien wurden aktualisiert. Neue Version ist %newversion. Die bisher installierte Version ist %curversion'; +$lng['update']['update_information']['part_b'] = '

Ein Kunden-Login ist vor Abschluss des Aktualisierungsvorganges nicht m&oouml;glich.
Aktualisierung ausführen?'; $lng['update']['noupdatesavail'] = 'Ihre Froxlor-Version ist aktuell.'; $lng['admin']['specialsettingsforsubdomains'] = 'Übernehme Einstellungen für alle Subdomains (*.beispiel.de)'; $lng['serversettings']['specialsettingsforsubdomains']['description'] = 'Wenn ja, werden die individuellen Einstellungen für alle Subdomains übernommen; wenn nein, werden Subdomain-Specialsettings entfernt.'; diff --git a/lng/polish.lng.php b/lng/polish.lng.php index 33e593e1..a5121910 100644 --- a/lng/polish.lng.php +++ b/lng/polish.lng.php @@ -1258,7 +1258,8 @@ $lng['panel']['off'] = 'off'; $lng['update']['updateinprogress_onlyadmincanlogin'] = 'A newer version of Froxlor has been installed but not yet set up.
Only the administrator can log in and finish the update.'; $lng['update']['update'] = 'Aktualizacja Froxlora'; $lng['update']['proceed'] = 'Proceed'; -$lng['update']['update_information'] = 'The Froxlor files have been updated to version %newversion. The installed version is %curversion.

Customers will not be able to log in until the update has been finished.
Proceed?'; +$lng['update']['update_information']['part_a'] = 'The Froxlor files have been updated to version %newversion. The installed version is %curversion.'; +$lng['update']['update_information']['part_b'] = '

Customers will not be able to log in until the update has been finished.
Proceed?'; $lng['update']['noupdatesavail'] = 'You already have the latest Froxlor version.'; $lng['admin']['cron']['cronsettings'] = 'ustawienia Cronjob'; $lng['cron']['cronname'] = 'cronjob-name'; diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index 8fa4470e..c8a20f34 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -493,13 +493,22 @@ class apache protected function getVhostFilename($domain, $ssl_vhost = false) { - if($ssl_vhost === true) + if((int)$domain['parentdomainid'] == 0) { - $vhost_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/20_froxlor_ssl_vhost_' . $domain['domain'] . '.conf'); + $vhost_no = '21'; } else { - $vhost_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/20_froxlor_normal_vhost_' . $domain['domain'] . '.conf'); + $vhost_no = '20'; + } + + if($ssl_vhost === true) + { + $vhost_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/'.$vhost_no.'_froxlor_ssl_vhost_' . $domain['domain'] . '.conf'); + } + else + { + $vhost_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/'.$vhost_no.'_froxlor_normal_vhost_' . $domain['domain'] . '.conf'); } return $vhost_filename; @@ -627,7 +636,7 @@ class apache public function createVirtualHosts() { - $result_domains = $this->db->query("SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`, `d`.`phpsettingid`, `c`.`adminid`, `c`.`guid`, `c`.`email`, `c`.`documentroot` AS `customerroot`, `c`.`deactivated`, `c`.`phpenabled` AS `phpenabled`, `d`.`mod_fcgid_starter`, `d`.`mod_fcgid_maxrequests` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) " . "LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`) " . "WHERE `d`.`aliasdomain` IS NULL ORDER BY `d`.`iswildcarddomain`, `d`.`domain` ASC"); + $result_domains = $this->db->query("SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`, `d`.`phpsettingid`, `c`.`adminid`, `c`.`guid`, `c`.`email`, `c`.`documentroot` AS `customerroot`, `c`.`deactivated`, `c`.`phpenabled` AS `phpenabled`, `d`.`mod_fcgid_starter`, `d`.`mod_fcgid_maxrequests` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) " . "LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`) " . "WHERE `d`.`aliasdomain` IS NULL ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC"); while($domain = $this->db->fetch_array($result_domains)) { @@ -950,7 +959,7 @@ class apache if($vhost_filename != '.' && $vhost_filename != '..' && !in_array($vhost_filename, $this->known_vhostfilenames) - && preg_match('/^(05|10|20|30)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename) + && preg_match('/^(05|10|20|21|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename) && file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename))) { fwrite($this->debugHandler, ' apache::wipeOutOldVhostConfigs: unlinking ' . $vhost_filename . "\n"); diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index 918d3853..81dc5041 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -141,6 +141,9 @@ class lighttpd $vhosts = $this->createLighttpdHosts($row_ipsandports['ip'], $row_ipsandports['port'], $row_ipsandports['ssl'], $vhost_filename); if($vhosts !== null && is_array($vhosts) && isset($vhosts[0])) { + // sort vhosts by number (subdomains first!) + sort($vhosts); + foreach($vhosts as $vhost) { $this->lighttpd_data[$vhost_filename].= ' include "'.$vhost.'"'."\n"; } @@ -230,11 +233,11 @@ class lighttpd if($ssl == '0') { - $query2 = "SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`, `c`.`guid`, `c`.`email`, `c`.`documentroot` AS `customerroot`, `c`.`deactivated`, `c`.`phpenabled` AS `phpenabled` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`) WHERE `d`.`ipandport`='" . $ipandport['id'] . "' AND `d`.`aliasdomain` IS NULL ORDER BY `d`.`iswildcarddomain`, `d`.`domain` ASC"; + $query2 = "SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`, `c`.`guid`, `c`.`email`, `c`.`documentroot` AS `customerroot`, `c`.`deactivated`, `c`.`phpenabled` AS `phpenabled` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`) WHERE `d`.`ipandport`='" . $ipandport['id'] . "' AND `d`.`aliasdomain` IS NULL ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC"; } else { - $query2 = "SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`, `c`.`guid`, `c`.`email`, `c`.`documentroot` AS `customerroot`, `c`.`deactivated`, `c`.`phpenabled` AS `phpenabled` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`) WHERE `d`.`ssl_ipandport`='" . $ipandport['id'] . "' AND `d`.`aliasdomain` IS NULL ORDER BY `d`.`iswildcarddomain`, `d`.`domain` ASC"; + $query2 = "SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`, `c`.`guid`, `c`.`email`, `c`.`documentroot` AS `customerroot`, `c`.`deactivated`, `c`.`phpenabled` AS `phpenabled` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`) WHERE `d`.`ssl_ipandport`='" . $ipandport['id'] . "' AND `d`.`aliasdomain` IS NULL ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC"; } $included_vhosts = array(); @@ -252,8 +255,18 @@ class lighttpd $_tmp_path = substr(makeCorrectDir($this->settings['system']['apacheconf_vhost']), 0, -1); $_pos = strrpos($_tmp_path, '/'); $_inc_path = substr($_tmp_path, $_pos+1); - $vhost_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'].'/vhosts/50_'.$domain['domain'].'.conf'); - $included_vhosts[] = $_inc_path.'/vhosts/50_'.$domain['domain'].'.conf'; + + if((int)$domain['parentdomainid'] == 0) + { + $vhost_no = '51'; + } + else + { + $vhost_no = '50'; + } + + $vhost_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'].'/vhosts/'.$vhost_no.'_'.$domain['domain'].'.conf'); + $included_vhosts[] = $_inc_path.'/vhosts/'.$vhost_no.'_'.$domain['domain'].'.conf'; } if(!isset($this->lighttpd_data[$vhost_filename])) { @@ -805,7 +818,7 @@ class lighttpd if($vhost_filename != '.' && $vhost_filename != '..' && !in_array($vhost_filename, $this->known_filenames) - && preg_match('/^(05|10|20|30)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename) + && preg_match('/^(05|10|20|21|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename) && file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename))) { fwrite($this->debugHandler, ' lighttpd::wipeOutOldConfigs: unlinking ' . $vhost_filename . "\n"); diff --git a/templates/main.css b/templates/main.css index 1477ce00..df22892f 100644 --- a/templates/main.css +++ b/templates/main.css @@ -449,3 +449,12 @@ TR.RowOverSelected { text-align: left; } +.preconfig +{ + text-align: left; + margin-top: 20px; + margin-bottom: 5px; + margin-right: 15px; + margin-left: 15px; +} +