Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
448e7f5c99 | ||
|
|
e5cd9ad727 | ||
|
|
cc5c30cc69 | ||
|
|
cf2104e989 | ||
|
|
14b7be0a4f | ||
|
|
e6c385da10 | ||
|
|
57124d040d | ||
|
|
67c55c5a25 | ||
|
|
f86e4f39d3 | ||
|
|
5e162b018d | ||
|
|
9851ac53cc | ||
|
|
794c4d3b55 | ||
|
|
530b6da6e8 | ||
|
|
6986ffefbe | ||
|
|
e6eefc9913 | ||
|
|
3cd66a9fc4 | ||
|
|
a1c98e4012 | ||
|
|
cc7610d436 | ||
|
|
36efb04f86 | ||
|
|
dcc5859eb8 | ||
|
|
1557e5b7a3 | ||
|
|
9a41d35f98 | ||
|
|
65a7983edc | ||
|
|
7b4a34ee69 | ||
|
|
fb63dac2d1 | ||
|
|
f9b014f640 | ||
|
|
fe15ff4913 |
@@ -58,6 +58,14 @@ return array(
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingHostname',
|
||||
),
|
||||
'system_froxlordirectlyviahostname' => array(
|
||||
'label' => $lng['serversettings']['froxlordirectlyviahostname'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'froxlordirectlyviahostname',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_stdsubdomain' => array(
|
||||
'label' => $lng['serversettings']['stdsubdomainhost'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -101,18 +109,6 @@ return array(
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_httpuser' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpuser',
|
||||
'type' => 'hidden',
|
||||
'default' => 'www-data',
|
||||
),
|
||||
'system_httpgroup' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpgroup',
|
||||
'type' => 'hidden',
|
||||
'default' => 'www-data',
|
||||
),
|
||||
'system_debug_cron' => array(
|
||||
'label' => $lng['serversettings']['cron']['debug'],
|
||||
'settinggroup' => 'system',
|
||||
|
||||
@@ -33,6 +33,22 @@ return array(
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_httpuser' => array(
|
||||
'label' => $lng['admin']['webserver_user'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpuser',
|
||||
'type' => 'string',
|
||||
'default' => 'www-data',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_httpgroup' => array(
|
||||
'label' => $lng['admin']['webserver_group'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpgroup',
|
||||
'type' => 'string',
|
||||
'default' => 'www-data',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_apacheconf_vhost' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_vhost'],
|
||||
'settinggroup' => 'system',
|
||||
|
||||
@@ -194,6 +194,10 @@ if($page == 'customers'
|
||||
$db->query("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$id . "'");
|
||||
$db->query("DELETE FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid`='" . (int)$id . "'");
|
||||
|
||||
// Delete all waiting "create user" -tasks for this user, #276
|
||||
// Note: the WHERE selects part of a serialized array, but it should be safe this way
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_TASKS . "` WHERE `type` = '2' AND `data` LIKE '%:\"" . $db->escape($result['loginname']) . "\";%';");
|
||||
|
||||
// remove everything APS-related, #216
|
||||
$apsresult = $db->query("SELECT `ID` FROM `".TABLE_APS_INSTANCES."` WHERE `CustomerID`='".(int)$id."'");
|
||||
while($apsrow = $db->fetch_array($apsresult))
|
||||
|
||||
@@ -342,7 +342,7 @@ elseif($page == 'htaccess')
|
||||
else
|
||||
{
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||
$options_indexes = makeyesno('options_indexes', '1', '0', '1');
|
||||
$options_indexes = makeyesno('options_indexes', '1', '0', '0');
|
||||
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ elseif($page == 'mysqls')
|
||||
'description' => $lng['mysql']['databasedescription']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_DATABASES, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
|
||||
@@ -248,6 +248,7 @@ CREATE TABLE `panel_databases` (
|
||||
`databasename` varchar(255) NOT NULL default '',
|
||||
`description` varchar(255) NOT NULL default '',
|
||||
`dbserver` int(11) unsigned NOT NULL default '0',
|
||||
`apsdb` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`)
|
||||
) TYPE=MyISAM ;
|
||||
@@ -451,7 +452,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.9');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.10');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');
|
||||
@@ -571,6 +572,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (140, 'customredirect', 'enabled', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (141, 'customredirect', 'default', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (142, 'system', 'dns_createmailentry', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (143, 'system', 'froxlordirectlyviahostname', '0');
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
@@ -795,4 +795,92 @@ if(isFroxlorVersion('0.9.9-svn1'))
|
||||
updateToVersion('0.9.9');
|
||||
}
|
||||
|
||||
?>
|
||||
if(isFroxlorVersion('0.9.9'))
|
||||
{
|
||||
showUpdateStep("Updating from 0.9.9 to 0.9.10-svn1", false);
|
||||
|
||||
showUpdateStep("Checking whether you are missing any settings", false);
|
||||
$nonefound = true;
|
||||
|
||||
$update_httpuser = isset($_POST['update_httpuser']) ? $_POST['update_httpuser'] : false;
|
||||
$update_httpgroup = isset($_POST['update_httpgroup']) ? $_POST['update_httpgroup'] : false;
|
||||
|
||||
if($update_httpuser !== false)
|
||||
{
|
||||
$nonefound = false;
|
||||
showUpdateStep("Adding missing setting 'httpuser'");
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'httpuser', '".$update_httpuser."');");
|
||||
lastStepStatus(0);
|
||||
}
|
||||
|
||||
if($update_httpgroup !== false)
|
||||
{
|
||||
$nonefound = false;
|
||||
showUpdateStep("Adding missing setting 'httpgroup'");
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'httpgroup', '".$update_httpgroup."');");
|
||||
lastStepStatus(0);
|
||||
}
|
||||
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'debug_cron'");
|
||||
if(!isset($result) || !isset($result['value']))
|
||||
{
|
||||
$nonefound = false;
|
||||
showUpdateStep("Adding missing setting 'debug_cron'");
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'debug_cron', '0');");
|
||||
lastStepStatus(0);
|
||||
}
|
||||
|
||||
if($nonefound) {
|
||||
showUpdateStep("No missing settings found");
|
||||
lastStepStatus(0);
|
||||
}
|
||||
|
||||
updateToVersion('0.9.10-svn1');
|
||||
}
|
||||
|
||||
if(isFroxlorVersion('0.9.10-svn1'))
|
||||
{
|
||||
showUpdateStep("Updating from 0.9.10-svn1 to 0.9.10-svn2", false);
|
||||
|
||||
showUpdateStep("Updating database table definition for panel_databases");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DATABASES . "` ADD `apsdb` tinyint(1) NOT NULL default '0' AFTER `dbserver`;");
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Adding APS databases to customers overview");
|
||||
$count_dbupdates = 0;
|
||||
$db_root = null;
|
||||
openRootDB();
|
||||
$result = $db_root->query("SHOW DATABASES;");
|
||||
while($row = $db_root->fetch_array($result))
|
||||
{
|
||||
if(preg_match('/^web([0-9]+)aps([0-9]+)$/', $row['Database'], $matches))
|
||||
{
|
||||
$cid = $matches[1];
|
||||
$databasedescription = 'APS DB';
|
||||
$result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`, `apsdb`) VALUES ("' . (int)$cid . '", "' . $db->escape($row['Database']) . '", "' . $db->escape($databasedescription) . '", "0", "1")');
|
||||
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1 WHERE `customerid`="' . (int)$cid . '"');
|
||||
$count_dbupdates++;
|
||||
}
|
||||
}
|
||||
closeRootDB();
|
||||
if($count_dbupdates > 0) {
|
||||
lastStepStatus(0, "Found ".$count_dbupdates." customer APS databases");
|
||||
} else {
|
||||
lastStepStatus(0, "None found");
|
||||
}
|
||||
|
||||
updateToVersion('0.9.10-svn2');
|
||||
}
|
||||
|
||||
if(isFroxlorVersion('0.9.10-svn2'))
|
||||
{
|
||||
showUpdateStep("Updating from 0.9.10-svn2 to 0.9.10", false);
|
||||
|
||||
$update_directlyviahostname = isset($_POST['update_directlyviahostname']) ? '1' : '0';
|
||||
|
||||
showUpdateStep("Adding new settings");
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'froxlordirectlyviahostname', '".(int)$update_directlyviahostname."');");
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToVersion('0.9.10');
|
||||
}
|
||||
|
||||
@@ -158,4 +158,66 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
|
||||
$question.= makeyesno('update_defdns_mailentry', '1', '0', '0');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.10-svn1'))
|
||||
{
|
||||
$has_nouser = false;
|
||||
$has_nogroup = false;
|
||||
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'httpuser'");
|
||||
if(!isset($result) || !isset($result['value']))
|
||||
{
|
||||
$has_preconfig = true;
|
||||
$has_nouser = true;
|
||||
$guessed_user = 'www-data';
|
||||
if(function_exists('posix_getuid')
|
||||
&& function_exists('posix_getpwuid')
|
||||
) {
|
||||
$_httpuser = posix_getpwuid(posix_getuid());
|
||||
$guessed_user = $_httpuser['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'");
|
||||
if(!isset($result) || !isset($result['value']))
|
||||
{
|
||||
$has_preconfig = true;
|
||||
$has_nogroup = true;
|
||||
$guessed_group = 'www-data';
|
||||
if(function_exists('posix_getgid')
|
||||
&& function_exists('posix_getgrgid')
|
||||
) {
|
||||
$_httpgroup = posix_getgrgid(posix_getgid());
|
||||
$guessed_group = $_httpgroup['name'];
|
||||
}
|
||||
}
|
||||
|
||||
if($has_nouser || $has_nogroup)
|
||||
{
|
||||
$description = 'Please enter the correct username/groupname of the webserver on your system We\'re guessing the user but it might not be correct, so please check.';
|
||||
if($has_nouser)
|
||||
{
|
||||
$question = '<strong>Please enter the webservers username:</strong> <input type="text" class="text" name="update_httpuser" value="'.$guessed_user.'" />';
|
||||
}
|
||||
elseif($has_nogroup)
|
||||
{
|
||||
$question2 = '<strong>Please enter the webservers groupname:</strong> <input type="text" class="text" name="update_httpgroup" value="'.$guessed_group.'" />';
|
||||
if($has_nouser) {
|
||||
$question .= '<br /><br />'.$question2;
|
||||
} else {
|
||||
$question = $question2;
|
||||
}
|
||||
}
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if(versionInUpdate($current_version, '0.9.10'))
|
||||
{
|
||||
$has_preconfig = true;
|
||||
$description = 'you can now decide whether Froxlor should be reached via hostname/froxlor or directly via the hostname.';
|
||||
$question = '<strong>Do you want Froxlor to be reached directly via the hostname?:</strong> ';
|
||||
$question.= makeyesno('update_directlyviahostname', '1', '0', '0');
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,11 +219,7 @@ class ApsInstaller extends ApsParser
|
||||
}
|
||||
elseif($Task == TASK_REMOVE)
|
||||
{
|
||||
//FIXME cleanup installation
|
||||
//remove files from: $this->RealPath . $this->DomainPath . '/'
|
||||
//remove permissions
|
||||
//drop database
|
||||
|
||||
// check for database
|
||||
if ($this->aps_version == '1.0')
|
||||
{
|
||||
// the good ole way
|
||||
@@ -240,7 +236,7 @@ class ApsInstaller extends ApsParser
|
||||
|
||||
if($XmlDb->db->id)
|
||||
{
|
||||
//database management
|
||||
//drop database permissions
|
||||
|
||||
$Database = 'web' . $Row['CustomerID'] . 'aps' . $Row['InstanceID'];
|
||||
foreach(array_map('trim', explode(',', $this->Hosts)) as $DatabaseHost)
|
||||
@@ -250,8 +246,15 @@ class ApsInstaller extends ApsParser
|
||||
$this->db_root->query('DELETE FROM `mysql`.`user` WHERE `User` = "' . $this->db->escape($Database) . '" AND `Host` = "' . $this->db->escape($DatabaseHost) . '"');
|
||||
}
|
||||
|
||||
//drop database
|
||||
$this->db_root->query('DROP DATABASE IF EXISTS `' . $this->db->escape($Database) . '`');
|
||||
$this->db_root->query('FLUSH PRIVILEGES');
|
||||
|
||||
/*
|
||||
* remove database from customer-mysql overview, #272
|
||||
*/
|
||||
$this->db->query('DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$Row['CustomerID'] . '" AND `databasename`="' . $this->db->escape($Database) . '" AND `apsdb`="1"');
|
||||
$result = $this->db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`-1 WHERE `customerid`="' . (int)$Row['CustomerID'] . '"');
|
||||
}
|
||||
|
||||
//remove task & delete package instance + settings
|
||||
@@ -259,6 +262,20 @@ class ApsInstaller extends ApsParser
|
||||
$this->db->query('DELETE FROM `' . TABLE_APS_TASKS . '` WHERE `Task` = ' . TASK_REMOVE . ' AND `InstanceID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
$this->db->query('DELETE FROM `' . TABLE_APS_INSTANCES . '` WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
$this->db->query('DELETE FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
|
||||
//remove data, #273
|
||||
if($this->DomainPath != '' && $this->DomainPath != '/') {
|
||||
self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/');
|
||||
} else {
|
||||
// save awstats/webalizer folder if it's the docroot
|
||||
self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/', true);
|
||||
// place standard-index file
|
||||
$loginname = getLoginNameByUid($Row['CustomerID']);
|
||||
if($loginname !== false)
|
||||
{
|
||||
storeDefaultIndex($loginname, $this->RealPath . $this->DomainPath . '/');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,8 +490,6 @@ class ApsInstaller extends ApsParser
|
||||
|
||||
private function PrepareDatabase($Xml, $Row, $Task)
|
||||
{
|
||||
global $db_root;
|
||||
|
||||
$XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db');
|
||||
|
||||
if ($this->aps_version == '1.0')
|
||||
@@ -511,6 +526,13 @@ class ApsInstaller extends ApsParser
|
||||
}
|
||||
|
||||
$this->db_root->query('FLUSH PRIVILEGES');
|
||||
|
||||
/*
|
||||
* add database to customers databases, #272
|
||||
*/
|
||||
$databasedescription = $Xml->name.' '.$Xml->version.' (Release ' . $Xml->release . ')';
|
||||
$result = $this->db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`, `apsdb`) VALUES ("' . (int)$Row['CustomerID'] . '", "' . $this->db->escape($NewDatabase) . '", "' . $this->db->escape($databasedescription) . '", "0", "1")');
|
||||
$result = $this->db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1 WHERE `customerid`="' . (int)$Row['CustomerID'] . '"');
|
||||
}
|
||||
|
||||
//get first mysql access host
|
||||
@@ -631,5 +653,3 @@ class ApsInstaller extends ApsParser
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -400,9 +400,9 @@ class ApsParser
|
||||
* unlink files recursively
|
||||
*
|
||||
* @param dir directory to delete recursive
|
||||
* @param boolean whether the base-directory should be kept or not
|
||||
*/
|
||||
|
||||
protected function UnlinkRecursive($Dir)
|
||||
protected function UnlinkRecursive($Dir, $save_base = false)
|
||||
{
|
||||
if(!$DirHandle = @opendir($Dir))return;
|
||||
|
||||
@@ -411,6 +411,12 @@ class ApsParser
|
||||
if($Object == '.'
|
||||
|| $Object == '..')continue;
|
||||
|
||||
if($save_base
|
||||
&& (strtoupper($Object) == 'AWSTATS' || strtoupper($Object) == 'WEBALIZER')
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!@unlink($Dir . '/' . $Object))
|
||||
{
|
||||
self::UnlinkRecursive($Dir . '/' . $Object);
|
||||
@@ -418,7 +424,10 @@ class ApsParser
|
||||
}
|
||||
|
||||
closedir($DirHandle);
|
||||
@rmdir($Dir);
|
||||
if(!$save_base)
|
||||
{
|
||||
@rmdir($Dir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1351,7 +1360,7 @@ class ApsParser
|
||||
|
||||
private function InstallNewPackage($Filename)
|
||||
{
|
||||
global $lng;
|
||||
global $lng, $userinfo;
|
||||
|
||||
if(file_exists($Filename)
|
||||
&& $Xml = self::GetXmlFromZip($Filename))
|
||||
@@ -1831,7 +1840,7 @@ class ApsParser
|
||||
|
||||
public function MainHandler($Action)
|
||||
{
|
||||
global $lng, $filename, $s, $page, $action, $Id;
|
||||
global $lng, $filename, $s, $page, $action, $Id, $userinfo;
|
||||
|
||||
//check for basic functions, classes and permissions
|
||||
|
||||
@@ -2182,6 +2191,13 @@ class ApsParser
|
||||
return;
|
||||
}
|
||||
|
||||
// no more contingent, #278
|
||||
if($userinfo['aps_packages'] == $userinfo['aps_packages_used']
|
||||
&& $userinfo['aps_packages'] != '-1'
|
||||
){
|
||||
self::InfoBox($lng['aps']['nocontingent']);
|
||||
}
|
||||
|
||||
//show packages
|
||||
|
||||
while($Row3 = $this->db->fetch_array($result2))
|
||||
@@ -3488,6 +3504,41 @@ class ApsParser
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check if packages needs a database
|
||||
* and if the customer has contingent for that, #272
|
||||
*/
|
||||
if ($this->aps_version == '1.0')
|
||||
{
|
||||
// the good ole way
|
||||
$XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db');
|
||||
}
|
||||
else
|
||||
{
|
||||
// since 1.1
|
||||
$Xml->registerXPathNamespace('db', 'http://apstandard.com/ns/1/db');
|
||||
|
||||
$XmlDb = new DynamicProperties;
|
||||
$XmlDb->db->id = getXPathValue($Xml, '//db:id');
|
||||
}
|
||||
|
||||
if($XmlDb->db->id)
|
||||
{
|
||||
if($userinfo['mysqls_used'] < $userinfo['mysqls']
|
||||
|| $userinfo['mysqls'] == '-1'
|
||||
){
|
||||
$can_use_db = true;
|
||||
} else {
|
||||
$can_use_db = false;
|
||||
}
|
||||
} else { $can_use_db = true; }
|
||||
|
||||
$db_info = '';
|
||||
if(!$can_use_db)
|
||||
{
|
||||
$db_info = $lng['aps']['packageneedsdb'];
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("aps/package") . "\";");
|
||||
unset($Xml);
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ return Array(
|
||||
'label' => 'Awstats',
|
||||
'commands' => Array(
|
||||
'apt-get install awstats',
|
||||
'cp /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl /usr/lib/cgi-bin/',
|
||||
'cp /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl '.makeCorrectDir($settings['system']['awstats_path']),
|
||||
'mv '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf').' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
|
||||
'sed -i.bak \'s/^DirData/# DirData/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf')
|
||||
),
|
||||
|
||||
@@ -297,7 +297,7 @@ return Array(
|
||||
'label' => 'Awstats',
|
||||
'commands' => Array(
|
||||
'apt-get install awstats',
|
||||
'cp /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl /usr/lib/cgi-bin/',
|
||||
'cp /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl '.makeCorrectDir($settings['system']['awstats_path']),
|
||||
'mv '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf').' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
|
||||
'sed -i.bak \'s/^DirData/# DirData/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf')
|
||||
),
|
||||
|
||||
@@ -305,7 +305,7 @@ return Array(
|
||||
'label' => 'Awstats',
|
||||
'commands' => Array(
|
||||
'apt-get install awstats',
|
||||
'cp /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl /usr/lib/cgi-bin/',
|
||||
'cp /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl '.makeCorrectDir($settings['system']['awstats_path']),
|
||||
'mv '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf').' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
|
||||
'sed -i.bak \'s/^DirData/# DirData/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf')
|
||||
),
|
||||
|
||||
@@ -306,7 +306,7 @@ return Array(
|
||||
'label' => 'Awstats',
|
||||
'commands' => Array(
|
||||
'apt-get install awstats',
|
||||
'cp /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl /usr/lib/cgi-bin/',
|
||||
'cp /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl '.makeCorrectDir($settings['system']['awstats_path']),
|
||||
'mv '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf').' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
|
||||
'sed -i.bak \'s/^DirData/# DirData/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf')
|
||||
),
|
||||
|
||||
@@ -29,6 +29,15 @@
|
||||
|
||||
function makeCorrectFile($filename)
|
||||
{
|
||||
if (!isset($filename)
|
||||
|| trim($filename) == ''
|
||||
) {
|
||||
$error = 'Given filename for function '.__FUNCTION__.' is empty.'."\n";
|
||||
$error.= 'This is very dangerous and should not happen.'."\n";
|
||||
$error.= 'Please inform the Froxlor team about this issue so they can fix it.';
|
||||
die($error);
|
||||
}
|
||||
|
||||
if(substr($filename, 0, 1) != '/')
|
||||
{
|
||||
$filename = '/' . $filename;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function openRootDB($debugHandler, $lockfile)
|
||||
function openRootDB($debugHandler = false, $lockfile = false)
|
||||
{
|
||||
global $db_root;
|
||||
|
||||
@@ -47,14 +47,22 @@ function openRootDB($debugHandler, $lockfile)
|
||||
/**
|
||||
* Do not proceed further if no database connection could be established
|
||||
*/
|
||||
|
||||
fclose($debugHandler);
|
||||
unlink($lockfile);
|
||||
if(isset($debugHandler) && $debugHandler !== false)
|
||||
{
|
||||
fclose($debugHandler);
|
||||
}
|
||||
if(isset($lockfile) && $lockfile !== false)
|
||||
{
|
||||
unlink($lockfile);
|
||||
}
|
||||
die('root can\'t connect to mysqlserver. Please check userdata.inc.php! Exiting...');
|
||||
}
|
||||
|
||||
unset($db_root->password);
|
||||
fwrite($debugHandler, 'Database-rootconnection established' . "\n");
|
||||
if(isset($debugHandler) && $debugHandler !== false)
|
||||
{
|
||||
fwrite($debugHandler, 'Database-rootconnection established' . "\n");
|
||||
}
|
||||
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
32
lib/init.php
32
lib/init.php
@@ -265,22 +265,30 @@ foreach($langs as $key => $value)
|
||||
$languages[$key] = $key;
|
||||
}
|
||||
|
||||
if(!isset($userinfo['def_language'])
|
||||
|| !isset($languages[$userinfo['def_language']]))
|
||||
if (isset($userinfo['language']) && isset($languages[$userinfo['language']]))
|
||||
{
|
||||
if(isset($_GET['language'])
|
||||
&& isset($languages[$_GET['language']]))
|
||||
{
|
||||
$language = $_GET['language'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$language = $settings['panel']['standardlanguage'];
|
||||
}
|
||||
// default: use language from session, #277
|
||||
$language = $userinfo['language'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$language = $userinfo['def_language'];
|
||||
if(!isset($userinfo['def_language'])
|
||||
|| !isset($languages[$userinfo['def_language']]))
|
||||
{
|
||||
if(isset($_GET['language'])
|
||||
&& isset($languages[$_GET['language']]))
|
||||
{
|
||||
$language = $_GET['language'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$language = $settings['panel']['standardlanguage'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$language = $userinfo['def_language'];
|
||||
}
|
||||
}
|
||||
|
||||
// include every english language file we can get
|
||||
|
||||
@@ -72,7 +72,7 @@ define('PACKAGE_ENABLED', 2);
|
||||
|
||||
// VERSION INFO
|
||||
|
||||
$version = '0.9.9';
|
||||
$version = '0.9.10';
|
||||
$dbversion = '2';
|
||||
$branding = '';
|
||||
|
||||
|
||||
@@ -1427,4 +1427,14 @@ $lng['error']['exception'] = '%s';
|
||||
// ADDED IN FROXLOR 0.9.9-svn1
|
||||
$lng['serversettings']['mail_also_with_mxservers'] = 'Create mail-, imap-, pop3- and smtp-"A record" also with MX-Servers set';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.10-svn1
|
||||
$lng['aps']['nocontingent'] = 'Your APS contingent is insufficient. You cannot install any package.';
|
||||
$lng['aps']['packageneedsdb'] = 'This package needs a database but your contingent is used up';
|
||||
$lng['aps']['cannoteditordeleteapsdb'] = 'APS databases cannot be edited or removed here';
|
||||
$lng['admin']['webserver_user'] = 'Webserver user-name';
|
||||
$lng['admin']['webserver_group'] = 'Webserver group-name';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.10
|
||||
$lng['serversettings']['froxlordirectlyviahostname'] = 'Access Froxlor directly via the hostname';
|
||||
|
||||
?>
|
||||
|
||||
@@ -933,7 +933,7 @@ $lng['customer']['email_pop3'] = 'E-Mail POP3';
|
||||
$lng['customer']['mail_quota'] = 'E-Mail Kontingent';
|
||||
$lng['panel']['megabyte'] = 'MegaByte';
|
||||
$lng['emails']['quota_edit'] = 'E-Mail Kontingent ändern';
|
||||
$lng['panel']['not_supported'] = 'Nicht ünterstüzt in: ';
|
||||
$lng['panel']['not_supported'] = 'Nicht unterstüzt in: ';
|
||||
$lng['error']['allocatetoomuchquota'] = 'Sie versuchen %s MB ' . $lng['emails']['quota'] . ' zu zuweisen, haben aber nicht genug übrig.';
|
||||
|
||||
// Autoresponder module
|
||||
@@ -1407,8 +1407,17 @@ $lng['tasks']['aps_task_upgrade'] = 'Upgrade eines oder mehrerer APS Pakete';
|
||||
$lng['tasks']['aps_task_sysupdate'] = 'Aktualisiere alle APS Pakete';
|
||||
$lng['tasks']['aps_task_sysdownload'] = 'Herunterladen neuer APS Pakete';
|
||||
|
||||
|
||||
// ADDED IN FROXLOR 0.9.9-svn1
|
||||
$lng['serversettings']['mail_also_with_mxservers'] = 'Erstelle mail-, imap-, pop3- and smtp-"A Record" auch wenn MX-Server angegeben sind';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.10-svn1
|
||||
$lng['aps']['nocontingent'] = 'Sie haben kein ausreichendes APS-Kontingent und können daher keine Pakete installieren.';
|
||||
$lng['aps']['packageneedsdb'] = 'Dieses Paket benötigt eine Datenbank, Sie haben allerdings keine mehr frei';
|
||||
$lng['aps']['cannoteditordeleteapsdb'] = 'APS-Datenbanken können hier nicht bearbeitet oder gelöscht werden';
|
||||
$lng['admin']['webserver_user'] = 'Benutzername Webserver';
|
||||
$lng['admin']['webserver_group'] = 'Gruppenname Webserver';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.10
|
||||
$lng['serversettings']['froxlordirectlyviahostname'] = 'Froxlor direkt über den Hostnamen erreichbar machen';
|
||||
|
||||
?>
|
||||
|
||||
@@ -80,7 +80,7 @@ if($db->num_rows($result) > 0)
|
||||
|
||||
$path = $row['homedir'] . $row['maildir'] . "new/";
|
||||
|
||||
if(!is_dir($path) || !is_readable($path))
|
||||
if(!is_dir($path))
|
||||
{
|
||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Error accessing maildir: " . $path);
|
||||
continue;
|
||||
|
||||
@@ -81,9 +81,9 @@ class apache
|
||||
// if we use fcgid we don't need this file
|
||||
if(file_exists($vhosts_filename))
|
||||
{
|
||||
fwrite($this->debugHandler, ' apache::_createStandardDirectoryEntry: unlinking ' . basename($vhost_filename) . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . basename($vhost_filename));
|
||||
unlink(makeCorrectFile($vhost_filename));
|
||||
fwrite($this->debugHandler, ' apache::_createStandardDirectoryEntry: unlinking ' . basename($vhosts_filename) . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . basename($vhosts_filename));
|
||||
unlink(makeCorrectFile($vhosts_filename));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -192,7 +192,14 @@ class apache
|
||||
/**
|
||||
* add 'real'-vhost content here, like doc-root :)
|
||||
*/
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
if($this->settings['system']['froxlordirectlyviahostname'])
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
}
|
||||
$this->virtualhosts_data[$vhosts_filename].= 'DocumentRoot "'.$mypath.'"'."\n";
|
||||
|
||||
if($row_ipsandports['vhostcontainer_servername_statement'] == '1')
|
||||
|
||||
@@ -107,7 +107,14 @@ class lighttpd
|
||||
$this->lighttpd_data[$vhost_filename].= '# Froxlor default vhost' . "\n";
|
||||
$this->lighttpd_data[$vhost_filename].= '$HTTP["host"] =~ "^(?:www\.|)' . $myhost . '$" {' . "\n";
|
||||
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
if($this->settings['system']['froxlordirectlyviahostname'])
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
}
|
||||
$this->lighttpd_data[$vhost_filename].= ' server.document-root = "'.$mypath.'"'."\n";
|
||||
|
||||
/**
|
||||
@@ -193,23 +200,6 @@ class lighttpd
|
||||
|
||||
if(!in_array($row_htpasswds['path'], $needed_htpasswds))
|
||||
{
|
||||
if(empty($needed_htpasswds))
|
||||
{
|
||||
$auth_backend_loaded[$domain['ipandport']] = 'yes';
|
||||
|
||||
if(!$this->auth_backend_loaded)
|
||||
{
|
||||
$htaccess_text.= ' auth.backend = "htpasswd"' . "\n";
|
||||
}
|
||||
|
||||
$htaccess_text.= ' auth.backend.htpasswd.userfile = "' . makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $filename) . '"' . "\n";
|
||||
$htaccess_text.= ' auth.require = ( ' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$htaccess_text.= ' ,' . "\n";
|
||||
}
|
||||
|
||||
if(!isset($this->needed_htpasswds[$filename])) {
|
||||
$this->needed_htpasswds[$filename] = '';
|
||||
}
|
||||
@@ -219,20 +209,24 @@ class lighttpd
|
||||
$this->needed_htpasswds[$filename].= $row_htpasswds['username'] . ':' . $row_htpasswds['password'] . "\n";
|
||||
}
|
||||
|
||||
$needed_htpasswds[] = $row_htpasswds['path'];
|
||||
$htaccess_path = substr($row_htpasswds['path'], strlen($domain['documentroot']) - 1);
|
||||
$htaccess_text.= ' "' . makeCorrectDir($htaccess_path) . '" =>' . "\n";
|
||||
$htaccess_text.= ' (' . "\n";
|
||||
$htaccess_text.= ' "method" => "basic",' . "\n";
|
||||
$htaccess_text.= ' "realm" => "Restricted Area",' . "\n";
|
||||
$htaccess_text.= ' "require" => "user=' . $row_htpasswds['username'] . '"' . "\n";
|
||||
$htaccess_text.= ' )' . "\n";
|
||||
}
|
||||
}
|
||||
$htaccess_path = makeCorrectDir($htaccess_path);
|
||||
|
||||
if(strlen(trim($htaccess_text)) > 0)
|
||||
{
|
||||
$htaccess_text.= ' )' . "\n";
|
||||
$htaccess_text.= ' $HTTP["url"] =~ "^'.$htaccess_path.'" {' . "\n";
|
||||
$htaccess_text.= ' auth.backend = "htpasswd"' . "\n";
|
||||
$htaccess_text.= ' auth.backend.htpasswd.userfile = "' . makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $filename) . '"' . "\n";
|
||||
$htaccess_text.= ' auth.require = ( ' . "\n";
|
||||
$htaccess_text.= ' "' . $htaccess_path . '" =>' . "\n";
|
||||
$htaccess_text.= ' (' . "\n";
|
||||
$htaccess_text.= ' "method" => "basic",' . "\n";
|
||||
$htaccess_text.= ' "realm" => "Restricted Area",' . "\n";
|
||||
$htaccess_text.= ' "require" => "valid-user"' . "\n";
|
||||
$htaccess_text.= ' )' . "\n";
|
||||
$htaccess_text.= ' )' . "\n";
|
||||
$htaccess_text.= ' }' . "\n";
|
||||
|
||||
$needed_htpasswds[] = $row_htpasswds['path'];
|
||||
}
|
||||
}
|
||||
|
||||
return $htaccess_text;
|
||||
@@ -578,7 +572,7 @@ class lighttpd
|
||||
$diroption_text.= '(' . "\n";
|
||||
$diroption_text.= ' "method" => "basic",' . "\n";
|
||||
$diroption_text.= ' "realm" => "Restricted Area",' . "\n";
|
||||
$diroption_text.= ' "require" => "user=' . $row_htpasswds['username'] . '"' . "\n";
|
||||
$diroption_text.= ' "require" => "valid-user"' . "\n";
|
||||
$diroption_text.= ')' . "\n";
|
||||
|
||||
if($this->auth_backend_loaded[$domain['ssl_ipandport']] == 'yes')
|
||||
|
||||
@@ -35,7 +35,7 @@ while($row_ticket = $db->fetch_array($result_tickets))
|
||||
if($days >= $settings['ticket']['archiving_days'])
|
||||
{
|
||||
fwrite($debugHandler, 'archiving ticket "' . $row_ticket['subject'] . '" (ID #' . $row_ticket['id'] . ')' . "\n");
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row_ticket['id']);
|
||||
$mainticket = ticket::getInstanceOf(null, $db, $settings, (int)$row_ticket['id']);
|
||||
$mainticket->Set('lastchange', $now, true, true);
|
||||
$mainticket->Set('lastreplier', '1', true, true);
|
||||
$mainticket->Set('status', '3', true, true);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<input class="bottom" type="submit" value="{$lng['aps']['back']}" />
|
||||
</form>
|
||||
</if>
|
||||
<if $action != 'customerstatus' && ( $userinfo['aps_packages'] != $userinfo['aps_packages_used'] )>
|
||||
<if $action != 'customerstatus' && ( $userinfo['aps_packages'] != $userinfo['aps_packages_used'] ) && $db_info == ''>
|
||||
<form method="get" action="$filename" style="float:left; padding-left: 5px;">
|
||||
<input type="hidden" name="s" value="$s" />
|
||||
<input type="hidden" name="page" value="$page" />
|
||||
@@ -38,6 +38,9 @@
|
||||
<input class="bottom" type="submit" value="{$lng['aps']['install']}" />
|
||||
</form>
|
||||
</if>
|
||||
<if $db_info != ''>
|
||||
<span style="padding-left: 5px;">{$db_info}</span>
|
||||
</if>
|
||||
<if ($action == 'customerstatus') && ($Row['Status'] == 2 || $Row['Status'] == 3)>
|
||||
<form method="get" action="$filename" style="float:left;">
|
||||
<input type="hidden" name="s" value="$s" />
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
<td class="field_name_border_left">{$row['databasename']}</td>
|
||||
<td class="field_name">{$row['description']}</td>
|
||||
<if 1 < count($sql_root)><td class="field_name">{$sql_root[$row['dbserver']]['caption']}</td></if>
|
||||
<td class="field_name"><a href="$filename?page=mysqls&action=edit&id={$row['id']}&s=$s">{$lng['panel']['edit']}</a></td>
|
||||
<td class="field_name"><a href="$filename?page=mysqls&action=delete&id={$row['id']}&s=$s">{$lng['panel']['delete']}</a></td>
|
||||
<if $row['apsdb'] != '1'>
|
||||
<td class="field_name"><a href="$filename?page=mysqls&action=edit&id={$row['id']}&s=$s">{$lng['panel']['edit']}</a></td>
|
||||
<td class="field_name"><a href="$filename?page=mysqls&action=delete&id={$row['id']}&s=$s">{$lng['panel']['delete']}</a></td>
|
||||
<else>
|
||||
<td class="field_name" colspan="2">{$lng['aps']['cannoteditordeleteapsdb']}</td>
|
||||
</if>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user