Merge branch 'master' into logformat-awstats
This commit is contained in:
17
README.md
17
README.md
@@ -53,14 +53,21 @@ https://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](https://files.fro
|
||||
|
||||
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-debian)
|
||||
|
||||
/etc/apt/sources.list.d/froxlor.list
|
||||
> deb http://debian.froxlor.org {stretch|buster} main
|
||||
```
|
||||
apt-get -y install apt-transport-https lsb-release ca-certificates
|
||||
wget -O - https://deb.froxlor.org/froxlor.gpg | apt-key add -
|
||||
echo "deb https://deb.froxlor.org/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/froxlor.list
|
||||
```
|
||||
|
||||
### Gentoo repository
|
||||
### Ubuntu repository
|
||||
|
||||
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-gentoo)
|
||||
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-ubuntu)
|
||||
|
||||
https://files.froxlor.org/gentoo/repositories.xml
|
||||
```
|
||||
apt-get -y install apt-transport-https lsb-release ca-certificates
|
||||
wget -O - https://deb.froxlor.org/froxlor.gpg | apt-key add -
|
||||
echo "deb https://deb.froxlor.org/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/froxlor.list
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"phpmailer/phpmailer": "~6.0",
|
||||
"monolog/monolog": "^1.24",
|
||||
"robthree/twofactorauth": "^1.6",
|
||||
"algo26-matthias/idna-convert": "^2.1"
|
||||
"froxlor/idna-convert-legacy": "^2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "8.4.1",
|
||||
|
||||
21
composer.lock
generated
21
composer.lock
generated
@@ -4,20 +4,20 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5699c65bbdcd2a61a9ced0ac7be84d64",
|
||||
"content-hash": "a7ba15333ffb4a758ea65039b589545b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "algo26-matthias/idna-convert",
|
||||
"version": "v2.1.0",
|
||||
"name": "froxlor/idna-convert-legacy",
|
||||
"version": "v2.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/algo26-matthias/idna-convert.git",
|
||||
"reference": "2717d05713454991936bc581d068c6cea0d84e3b"
|
||||
"url": "https://github.com/Froxlor/idna-convert-legacy.git",
|
||||
"reference": "09c1db623ba19e1ed8f2f9dabc15eeda9dc713b7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/algo26-matthias/idna-convert/zipball/2717d05713454991936bc581d068c6cea0d84e3b",
|
||||
"reference": "2717d05713454991936bc581d068c6cea0d84e3b",
|
||||
"url": "https://api.github.com/repos/Froxlor/idna-convert-legacy/zipball/09c1db623ba19e1ed8f2f9dabc15eeda9dc713b7",
|
||||
"reference": "09c1db623ba19e1ed8f2f9dabc15eeda9dc713b7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -43,6 +43,11 @@
|
||||
"name": "Matthias Sommerfeld",
|
||||
"email": "matthias.sommerfeld@algo26.de",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Michael Kaufmann (d00p)",
|
||||
"email": "d00p@froxlor.org",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A library for encoding and decoding internationalized domain names",
|
||||
@@ -52,7 +57,7 @@
|
||||
"idna",
|
||||
"php"
|
||||
],
|
||||
"time": "2019-03-04T17:07:46+00:00"
|
||||
"time": "2019-12-31T12:16:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
|
||||
@@ -703,7 +703,7 @@ opcache.interned_strings_buffer'),
|
||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||
('panel', 'customer_hide_options', ''),
|
||||
('panel', 'is_configured', '0'),
|
||||
('panel', 'version', '0.10.10'),
|
||||
('panel', 'version', '0.10.11'),
|
||||
('panel', 'db_version', '201912313');
|
||||
|
||||
|
||||
|
||||
@@ -538,6 +538,23 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201912310')) {
|
||||
\Froxlor\Froxlor::updateToDbVersion('201912311');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.10')) {
|
||||
showUpdateStep("Updating from 0.10.10 to 0.10.11", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.11');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201912311')) {
|
||||
showUpdateStep("Migrate logfiles_format setting");
|
||||
$current_format = Settings::Set('system.logfiles_format');
|
||||
if (!empty($current_format)) {
|
||||
Settings::Set('system.logfiles_format', '"' . Settings::Get('system.logfiles_format') . '"');
|
||||
lastStepStatus(0);
|
||||
} else {
|
||||
lastStepStatus(0, 'not needed');
|
||||
}
|
||||
\Froxlor\Froxlor::updateToDbVersion('201912312');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201912312')) {
|
||||
showUpdateStep("Adding option change awstats LogFormat");
|
||||
Settings::AddNew("system.awstats_logformat", '1');
|
||||
|
||||
@@ -106,10 +106,12 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
);
|
||||
$email_check = Database::pexecute_first($stmt, $params, true, true);
|
||||
|
||||
if (strtolower($email_check['email_full']) == strtolower($email_full)) {
|
||||
\Froxlor\UI\Response::standard_error('emailexistalready', $email_full, true);
|
||||
} elseif ($email_check['email'] == $email) {
|
||||
\Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true);
|
||||
if ($email_check) {
|
||||
if (strtolower($email_check['email_full']) == strtolower($email_full)) {
|
||||
\Froxlor\UI\Response::standard_error('emailexistalready', $email_full, true);
|
||||
} elseif ($email_check['email'] == $email) {
|
||||
\Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true);
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = Database::prepare("
|
||||
@@ -233,6 +235,19 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
$iscatchall = '1';
|
||||
$email_parts = explode('@', $result['email_full']);
|
||||
$email = '@' . $email_parts[1];
|
||||
// catchall check
|
||||
$stmt = Database::prepare("
|
||||
SELECT `email_full` FROM `" . TABLE_MAIL_VIRTUAL . "`
|
||||
WHERE `email` = :email AND `customerid` = :cid AND `iscatchall` = '1'
|
||||
");
|
||||
$params = array(
|
||||
"email" => $email,
|
||||
"cid" => $customer['customerid']
|
||||
);
|
||||
$email_check = Database::pexecute_first($stmt, $params, true, true);
|
||||
if ($email_check) {
|
||||
\Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true);
|
||||
}
|
||||
} else {
|
||||
$iscatchall = '0';
|
||||
$email = $result['email_full'];
|
||||
@@ -273,7 +288,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
* optional specify offset for resultset
|
||||
* @param array $sql_orderby
|
||||
* optional array with index = fieldname and value = ASC|DESC to order the resultset by one or more fields
|
||||
*
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
* @return string json-encoded array count|list
|
||||
|
||||
@@ -760,7 +760,7 @@ class Apache extends HttpConfigBase
|
||||
$logtype = 'combined';
|
||||
if (Settings::Get('system.logfiles_format') != '') {
|
||||
$logtype = 'frx_custom';
|
||||
$logfiles_text .= ' LogFormat "' . Settings::Get('system.logfiles_format') . '" ' . $logtype . "\n";
|
||||
$logfiles_text .= ' LogFormat ' . Settings::Get('system.logfiles_format') . ' ' . $logtype . "\n";
|
||||
}
|
||||
if (Settings::Get('system.logfiles_type') == '2' && Settings::Get('system.logfiles_format') == '') {
|
||||
$logtype = 'vhost_combined';
|
||||
|
||||
@@ -71,7 +71,7 @@ class Nginx extends HttpConfigBase
|
||||
}
|
||||
|
||||
$logtype = 'frx_custom';
|
||||
$this->nginx_data[$vhosts_filename] = 'log_format ' . $logtype . ' "' . Settings::Get('system.logfiles_format') . '";' . "\n";
|
||||
$this->nginx_data[$vhosts_filename] = 'log_format ' . $logtype . ' ' . Settings::Get('system.logfiles_format') . ';' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ final class Froxlor
|
||||
{
|
||||
|
||||
// Main version variable
|
||||
const VERSION = '0.10.10';
|
||||
const VERSION = '0.10.11';
|
||||
|
||||
// Database version (YYYYMMDDC where C is a daily counter)
|
||||
const DBVERSION = '201912313';
|
||||
|
||||
@@ -87,10 +87,13 @@ class FroxlorLogger
|
||||
self::$ml->pushHandler(new SyslogHandler('froxlor', LOG_USER, Logger::DEBUG));
|
||||
break;
|
||||
case 'file':
|
||||
if (empty(Settings::Get('logger.logfile')) || ! is_writeable(Settings::Get('logger.logfile'))) {
|
||||
$logger_logfile = Settings::Get('logger.logfile');
|
||||
// is_writable needs an existing file to check if it's actually writable
|
||||
@touch($logger_logfile);
|
||||
if (empty($logger_logfile) || ! is_writable($logger_logfile)) {
|
||||
Settings::Set('logger.logfile', '/tmp/froxlor.log');
|
||||
}
|
||||
self::$ml->pushHandler(new StreamHandler(Settings::Get('logger.logfile'), Logger::DEBUG));
|
||||
self::$ml->pushHandler(new StreamHandler($logger_logfile, Logger::DEBUG));
|
||||
break;
|
||||
case 'mysql':
|
||||
self::$ml->pushHandler(new MysqlHandler(Logger::DEBUG));
|
||||
|
||||
@@ -374,7 +374,7 @@ class PhpHelper
|
||||
$returnval = array();
|
||||
if (is_array($source)) {
|
||||
$source = array_map('trim', $source);
|
||||
$source = array_filter($source, function ($value) {
|
||||
$returnval = array_filter($source, function ($value) {
|
||||
return $value !== '';
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -242,8 +242,8 @@ class Store
|
||||
$mysql_access_host_array = array_map('trim', explode(',', Settings::Get('system.mysql_access_host')));
|
||||
$mysql_access_host_array[] = $newfieldvalue;
|
||||
$mysql_access_host_array = array_unique(\Froxlor\PhpHelper::arrayTrim($mysql_access_host_array));
|
||||
$mysql_access_host = implode(',', $mysql_access_host_array);
|
||||
\Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array);
|
||||
$mysql_access_host = implode(',', $mysql_access_host_array);
|
||||
Settings::Set('system.mysql_access_host', $mysql_access_host);
|
||||
}
|
||||
|
||||
@@ -293,9 +293,11 @@ class Store
|
||||
'cleanMySQLAccessHost'
|
||||
), $mysql_access_host_array);
|
||||
|
||||
$mysql_access_host_array = array_unique($mysql_access_host_array);
|
||||
$mysql_access_host_array = array_unique(\Froxlor\PhpHelper::arrayTrim($mysql_access_host_array));
|
||||
$newfieldvalue = implode(',', $mysql_access_host_array);
|
||||
\Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array);
|
||||
$mysql_access_host = implode(',', $mysql_access_host_array);
|
||||
Settings::Set('system.mysql_access_host', $mysql_access_host);
|
||||
}
|
||||
|
||||
return $returnvalue;
|
||||
|
||||
@@ -339,7 +339,7 @@ $lng['serversettings']['logfiles_directory']['description'] = 'Where should all
|
||||
$lng['serversettings']['logfiles_script']['title'] = 'Custom script to pipe log-files to';
|
||||
$lng['serversettings']['logfiles_script']['description'] = 'You can specify a script here and use the placeholders <strong>{LOGFILE}, {DOMAIN} and {CUSTOMER}</strong> if needed. In case you want to use it you will need to activate the <strong>Pipe webserver logfiles</strong> option too. No prefixed pipe-character is needed.';
|
||||
$lng['serversettings']['logfiles_format']['title'] = 'Access-log format';
|
||||
$lng['serversettings']['logfiles_format']['description'] = 'Enter a custom log-format here according to your webservers specifications, leave empty for default';
|
||||
$lng['serversettings']['logfiles_format']['description'] = 'Enter a custom log-format here according to your webservers specifications, leave empty for default. Depending on your format the string must be quoted.<br/>If used with nginx, it will look like <i>log_format frx_custom {CONFIGURED_VALUE}</i>.<br/>If used with Apache, it will look like <i>LogFormat {CONFIGURED_VALUE} frx_custom</i>.<br/><strong>Attention</strong>: The code won\'t be checked for any errors. If it contains errors, webserver might not start again!';
|
||||
$lng['serversettings']['logfiles_type']['title'] = 'Access-log type';
|
||||
$lng['serversettings']['logfiles_type']['description'] = 'Choose between <strong>combined</strong> or <strong>vhost_combined</strong> here.';
|
||||
$lng['serversettings']['logfiles_piped']['title'] = 'Pipe webserver logfiles to specified script (see above)';
|
||||
|
||||
@@ -335,7 +335,7 @@ $lng['serversettings']['logfiles_directory']['description'] = 'Wo sollen die Log
|
||||
$lng['serversettings']['logfiles_script']['title'] = 'Eigenes Script zu dem Log-Files übergeben werden';
|
||||
$lng['serversettings']['logfiles_script']['description'] = 'Hier kann ein Script an das die Loginhalte übergeben werden hinterlegt und die Platzhalter <strong>{LOGFILE}, {DOMAIN} und {CUSTOMER}</strong> genutzt werden, sofern nötig. Falls ein Script angegeben wird, muss die Option <strong>Webserver Logdateien umleiten</strong> gesetzt werden';
|
||||
$lng['serversettings']['logfiles_format']['title'] = 'Access-Log Format';
|
||||
$lng['serversettings']['logfiles_format']['description'] = 'Hier kann ein angepasstes Log-format entsprechend der Webserver-Dokumentation angegeben werden, leer lassen für Standard';
|
||||
$lng['serversettings']['logfiles_format']['description'] = 'Hier kann ein angepasstes Log-format entsprechend der Webserver-Dokumentation angegeben werden, leer lassen für Standard. Abhängig vom LogFormat muss die Angabe unter Anführungszeichen stehen.<br/>Wenn verwendet mit nginx, so kann es wie folgt aussehen: <i>log_format frx_custom {EINGESTELLTES_FORMAT}</i>.<br/>Wenn verwendet mit Apache, so kann es wie folgt aussehen: <i>LogFormat {EINGESTELLTES_FORMAT} frx_custom</i>.<br /><strong>ACHTUNG:</strong> Der Code wird nicht auf Fehler geprüft. Etwaige Fehler werden auch übernommen und der Webserver könnte nicht mehr starten!';
|
||||
$lng['serversettings']['logfiles_type']['title'] = 'Access-Log Typ';
|
||||
$lng['serversettings']['logfiles_type']['description'] = 'Wähle zwischen <strong>combined</strong> oder <strong>vhost_combined</strong>.';
|
||||
$lng['serversettings']['logfiles_piped']['title'] = 'Webserver Logdateien zu eigenem Script umleiten (siehe oben)';
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Admins;
|
||||
use Froxlor\Api\Commands\Customers;
|
||||
use Froxlor\Api\Commands\Mysqls;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings\Store;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -15,6 +17,7 @@ use Froxlor\Database\Database;
|
||||
* @covers \Froxlor\Api\Commands\Admins
|
||||
* @covers \Froxlor\Database\DbManager
|
||||
* @covers \Froxlor\Database\Manager\DbManagerMySQL
|
||||
* @covers \Froxlor\Settings\Store
|
||||
*/
|
||||
class MysqlsTest extends TestCase
|
||||
{
|
||||
@@ -183,6 +186,24 @@ class MysqlsTest extends TestCase
|
||||
*
|
||||
* @depends testCustomerMysqlsAdd
|
||||
*/
|
||||
public function testStoreSettingIpAddress()
|
||||
{
|
||||
// this settings test is here because it directly changes mysql users / privileges
|
||||
$fielddata = array(
|
||||
'label' => 'serversettings.ipaddress',
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ipaddress'
|
||||
);
|
||||
Store::storeSettingIpAddress('system_system_ipaddress', $fielddata, '82.149.225.47');
|
||||
|
||||
$mysql_access_hosts = Settings::Get('system.mysql_access_host');
|
||||
$this->assertTrue(strpos($mysql_access_hosts, '82.149.225.47') !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @depends testStoreSettingIpAddress
|
||||
*/
|
||||
public function testGetAllSqlUsers()
|
||||
{
|
||||
\Froxlor\Database\Database::needRoot(true);
|
||||
|
||||
Reference in New Issue
Block a user