- merged wildcardsubdomain-branch to trunk, refs #123, refs #150

This commit is contained in:
Michael Kaufmann (d00p)
2010-04-14 06:42:14 +00:00
parent 9013062ae9
commit 1159bde3eb
12 changed files with 175 additions and 39 deletions

View File

@@ -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 = '<br /><strong style="color:#ff0000;">You have to agree that you have read the update notifications.</strong>';
}
}
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 .= '<br />'.$preconfig.$message;
}
$update_information .= $lng['update']['update_information']['part_b'];
eval("echo \"" . getTemplate("update/index") . "\";");
}

View File

@@ -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

View File

@@ -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 '',

View File

@@ -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');
}
?>

View File

@@ -0,0 +1,52 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package 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 = '<div class="preconfig"><h3 style="color:#ff0000;">PLEASE NOTE - Important update notifications</h3>';
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.<br />';
$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.<br /><br />';
$return .= '<strong>Do you want to use wildcard-entries for existing domains?:</strong>&nbsp;';
$return .= makeyesno('update_domainwildcardentry', '1', '0', '1');
}
$return .= '<br /><br />'.makecheckbox('update_changesagreed', '<strong>I have read the update notifications and I am aware of the changes made to my system.</strong>', '1', true, '0', true);
$return .= '</div>';
$return .= '<input type="hidden" name="update_preconfig" value="1" />';
if($has_preconfig) {
return $return;
} else {
return '';
}
}

View File

@@ -26,7 +26,6 @@
*
* @return boolean
*/
function domainHasApsInstances($domainid = 0)
{
global $db, $settings;

View File

@@ -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.<br />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 <strong>%newversion</strong>. The installed version is <strong>%curversion</strong>.<br /><br />Customers will not be able to log in until the update has been finished.<br /><strong>Proceed?</strong>';
$lng['update']['update_information']['part_a'] = 'The Froxlor files have been updated to version <strong>%newversion</strong>. The installed version is <strong>%curversion</strong>.';
$lng['update']['update_information']['part_b'] = '<br /><br />Customers will not be able to log in until the update has been finished.<br /><strong>Proceed?</strong>';
$lng['update']['noupdatesavail'] = '<strong>You already have the latest Froxlor version.</strong>';
$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.';

View File

@@ -1238,7 +1238,8 @@ $lng['panel']['off'] = 'aus';
$lng['update']['updateinprogress_onlyadmincanlogin'] = 'Eine neuere Version von Froxlor wurde installiert, aber noch nicht eingerichtet.<br />Nur der Administrator kann sich anmelden und die Aktualisierung abschlie&szlig;en.';
$lng['update']['update'] = 'Froxlor Aktualisierung';
$lng['update']['proceed'] = 'Ausf&uuml;hren';
$lng['update']['update_information'] = 'Die Froxlor Dateien wurden aktualisiert. Neue Version ist <strong>%newversion</strong>. Die bisher installierte Version ist <strong>%curversion</strong><br /><br />Ein Kunden-Login ist vor Abschluss des Aktualisierungsvorganges nicht m&oouml;glich.<br /><strong>Aktualisierung ausf&uuml;hren?</strong>';
$lng['update']['update_information']['part_a'] = 'Die Froxlor Dateien wurden aktualisiert. Neue Version ist <strong>%newversion</strong>. Die bisher installierte Version ist <strong>%curversion</strong>';
$lng['update']['update_information']['part_b'] = '<br /><br />Ein Kunden-Login ist vor Abschluss des Aktualisierungsvorganges nicht m&oouml;glich.<br /><strong>Aktualisierung ausf&uuml;hren?</strong>';
$lng['update']['noupdatesavail'] = '<strong>Ihre Froxlor-Version ist aktuell.</strong>';
$lng['admin']['specialsettingsforsubdomains'] = '&Uuml;bernehme Einstellungen f&uuml;r alle Subdomains (*.beispiel.de)';
$lng['serversettings']['specialsettingsforsubdomains']['description'] = 'Wenn ja, werden die individuellen Einstellungen f&uuml;r alle Subdomains &uuml;bernommen; wenn nein, werden Subdomain-Specialsettings entfernt.';

View File

@@ -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.<br />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 <strong>%newversion</strong>. The installed version is <strong>%curversion</strong>.<br /><br />Customers will not be able to log in until the update has been finished.<br /><strong>Proceed?</strong>';
$lng['update']['update_information']['part_a'] = 'The Froxlor files have been updated to version <strong>%newversion</strong>. The installed version is <strong>%curversion</strong>.';
$lng['update']['update_information']['part_b'] = '<br /><br />Customers will not be able to log in until the update has been finished.<br /><strong>Proceed?</strong>';
$lng['update']['noupdatesavail'] = '<strong>You already have the latest Froxlor version.</strong>';
$lng['admin']['cron']['cronsettings'] = 'ustawienia Cronjob';
$lng['cron']['cronname'] = 'cronjob-name';

View File

@@ -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");

View File

@@ -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");

View File

@@ -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;
}