Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c8bdfbbbc | ||
|
|
bbe82286aa | ||
|
|
13571f1f16 | ||
|
|
d6b34cc8f8 | ||
|
|
cfda35a36b | ||
|
|
57ae625d38 | ||
|
|
65ab064289 | ||
|
|
e6a6f6f9de | ||
|
|
a7b91eb1ed | ||
|
|
a2342ad1d2 | ||
|
|
add1818723 | ||
|
|
51c1d648b2 | ||
|
|
0fca98c652 |
20
api_keys.php
20
api_keys.php
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
if (! defined('AREA')) {
|
if (!defined('AREA')) {
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@@ -27,12 +27,13 @@ use Froxlor\Database\Database;
|
|||||||
|
|
||||||
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_API_KEYS . "` WHERE id = :id");
|
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_API_KEYS . "` WHERE id = :id");
|
||||||
$success_message = "";
|
$success_message = "";
|
||||||
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
$id = isset($_POST['id']) ? (int) $_POST['id'] : (isset($_GET['id']) ? (int) $_GET['id'] : 0);
|
||||||
$area = AREA;
|
$area = AREA;
|
||||||
|
|
||||||
// do the delete and then just show a success-message and the apikeys list again
|
// do the delete and then just show a success-message and the apikeys list again
|
||||||
if ($action == 'delete') {
|
if ($action == 'delete') {
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
|
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||||
$chk = (AREA == 'admin' && $userinfo['customers_see_all'] == '1') ? true : false;
|
$chk = (AREA == 'admin' && $userinfo['customers_see_all'] == '1') ? true : false;
|
||||||
if (AREA == 'customer') {
|
if (AREA == 'customer') {
|
||||||
$chk_stmt = Database::prepare("
|
$chk_stmt = Database::prepare("
|
||||||
@@ -61,6 +62,13 @@ if ($action == 'delete') {
|
|||||||
));
|
));
|
||||||
$success_message = sprintf($lng['apikeys']['apikey_removed'], $id);
|
$success_message = sprintf($lng['apikeys']['apikey_removed'], $id);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
\Froxlor\UI\HTML::askYesNo('api_reallydelete', $filename, array(
|
||||||
|
'page' => $page,
|
||||||
|
'action' => $action,
|
||||||
|
'id' => $id
|
||||||
|
), $id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} elseif ($action == 'add') {
|
} elseif ($action == 'add') {
|
||||||
$ins_stmt = Database::prepare("
|
$ins_stmt = Database::prepare("
|
||||||
@@ -85,10 +93,10 @@ if ($action == 'delete') {
|
|||||||
} elseif ($action == 'jqEditApiKey') {
|
} elseif ($action == 'jqEditApiKey') {
|
||||||
$keyid = isset($_POST['id']) ? (int) $_POST['id'] : 0;
|
$keyid = isset($_POST['id']) ? (int) $_POST['id'] : 0;
|
||||||
$allowed_from = isset($_POST['allowed_from']) ? $_POST['allowed_from'] : "";
|
$allowed_from = isset($_POST['allowed_from']) ? $_POST['allowed_from'] : "";
|
||||||
$valid_until = isset($_POST['valid_until']) ? (int) $_POST['valid_until'] : - 1;
|
$valid_until = isset($_POST['valid_until']) ? (int) $_POST['valid_until'] : -1;
|
||||||
|
|
||||||
// validate allowed_from
|
// validate allowed_from
|
||||||
if (! empty($allowed_from)) {
|
if (!empty($allowed_from)) {
|
||||||
$ip_list = array_map('trim', explode(",", $allowed_from));
|
$ip_list = array_map('trim', explode(",", $allowed_from));
|
||||||
$_check_list = $ip_list;
|
$_check_list = $ip_list;
|
||||||
foreach ($_check_list as $idx => $ip) {
|
foreach ($_check_list as $idx => $ip) {
|
||||||
@@ -100,8 +108,8 @@ if ($action == 'delete') {
|
|||||||
$allowed_from = implode(",", array_unique($ip_list));
|
$allowed_from = implode(",", array_unique($ip_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid_until <= 0 || ! is_numeric($valid_until)) {
|
if ($valid_until <= 0 || !is_numeric($valid_until)) {
|
||||||
$valid_until = - 1;
|
$valid_until = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$upd_stmt = Database::prepare("
|
$upd_stmt = Database::prepare("
|
||||||
|
|||||||
@@ -723,7 +723,7 @@ opcache.validate_timestamps'),
|
|||||||
('panel', 'logo_image_login', ''),
|
('panel', 'logo_image_login', ''),
|
||||||
('panel', 'logo_overridetheme', '0'),
|
('panel', 'logo_overridetheme', '0'),
|
||||||
('panel', 'logo_overridecustom', '0'),
|
('panel', 'logo_overridecustom', '0'),
|
||||||
('panel', 'version', '0.10.35.1'),
|
('panel', 'version', '0.10.38'),
|
||||||
('panel', 'db_version', '202112310');
|
('panel', 'db_version', '202112310');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -991,3 +991,18 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.10.35')) {
|
|||||||
showUpdateStep("Updating from 0.10.35 to 0.10.35.1", false);
|
showUpdateStep("Updating from 0.10.35 to 0.10.35.1", false);
|
||||||
\Froxlor\Froxlor::updateToVersion('0.10.35.1');
|
\Froxlor\Froxlor::updateToVersion('0.10.35.1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.35.1')) {
|
||||||
|
showUpdateStep("Updating from 0.10.35.1 to 0.10.36", false);
|
||||||
|
\Froxlor\Froxlor::updateToVersion('0.10.36');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.36')) {
|
||||||
|
showUpdateStep("Updating from 0.10.36 to 0.10.37", false);
|
||||||
|
\Froxlor\Froxlor::updateToVersion('0.10.37');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.37')) {
|
||||||
|
showUpdateStep("Updating from 0.10.37 to 0.10.38", false);
|
||||||
|
\Froxlor\Froxlor::updateToVersion('0.10.38');
|
||||||
|
}
|
||||||
|
|||||||
@@ -180,12 +180,18 @@ abstract class ApiParameter
|
|||||||
*/
|
*/
|
||||||
private function trimArray($input)
|
private function trimArray($input)
|
||||||
{
|
{
|
||||||
if (! is_array($input)) {
|
if ($input === '') {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (is_numeric($input) || is_null($input)) {
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
if (!is_array($input)) {
|
||||||
return trim($input);
|
return trim($input);
|
||||||
}
|
}
|
||||||
return array_map(array(
|
return array_map([
|
||||||
$this,
|
$this,
|
||||||
'trimArray'
|
'trimArray'
|
||||||
), $input);
|
], $input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ class Admins extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
|||||||
$email = $this->getParam('email', true, $idna_convert->decode($result['email'] ?? ''));
|
$email = $this->getParam('email', true, $idna_convert->decode($result['email'] ?? ''));
|
||||||
$password = $this->getParam('admin_password', true, '');
|
$password = $this->getParam('admin_password', true, '');
|
||||||
$def_language = $this->getParam('def_language', true, $result['def_language']);
|
$def_language = $this->getParam('def_language', true, $result['def_language']);
|
||||||
$custom_notes = $this->getParam('custom_notes', true, $result['custom_notes']);
|
$custom_notes = $this->getParam('custom_notes', true, ($result['custom_notes'] ?? ""));
|
||||||
$custom_notes_show = $this->getBoolParam('custom_notes_show', true, $result['custom_notes_show']);
|
$custom_notes_show = $this->getBoolParam('custom_notes_show', true, $result['custom_notes_show']);
|
||||||
$theme = $this->getParam('theme', true, $result['theme']);
|
$theme = $this->getParam('theme', true, $result['theme']);
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class EmailForwarders extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Re
|
|||||||
$id = $result['id'];
|
$id = $result['id'];
|
||||||
|
|
||||||
// current destination array
|
// current destination array
|
||||||
$result['destination_array'] = explode(' ', $result['destination']);
|
$result['destination_array'] = explode(' ', ($result['destination'] ?? ''));
|
||||||
|
|
||||||
// prepare destination
|
// prepare destination
|
||||||
$destination = trim($destination);
|
$destination = trim($destination);
|
||||||
|
|||||||
@@ -378,9 +378,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
|||||||
$listen_statement = $this->getBoolParam('listen_statement', true, $result['listen_statement']);
|
$listen_statement = $this->getBoolParam('listen_statement', true, $result['listen_statement']);
|
||||||
$namevirtualhost_statement = $this->getBoolParam('namevirtualhost_statement', true, $result['namevirtualhost_statement']);
|
$namevirtualhost_statement = $this->getBoolParam('namevirtualhost_statement', true, $result['namevirtualhost_statement']);
|
||||||
$vhostcontainer = $this->getBoolParam('vhostcontainer', true, $result['vhostcontainer']);
|
$vhostcontainer = $this->getBoolParam('vhostcontainer', true, $result['vhostcontainer']);
|
||||||
$specialsettings = \Froxlor\Validate\Validate::validate(str_replace("\r\n", "\n", $this->getParam('specialsettings', true, $result['specialsettings'])), 'specialsettings', \Froxlor\Validate\Validate::REGEX_CONF_TEXT, '', array(), true);
|
$specialsettings = \Froxlor\Validate\Validate::validate(str_replace("\r\n", "\n", $this->getParam('specialsettings', true, ($result['specialsettings'] ?? ""))), 'specialsettings', \Froxlor\Validate\Validate::REGEX_CONF_TEXT, '', array(), true);
|
||||||
$vhostcontainer_servername_statement = $this->getParam('vhostcontainer_servername_statement', true, $result['vhostcontainer_servername_statement']);
|
$vhostcontainer_servername_statement = $this->getParam('vhostcontainer_servername_statement', true, $result['vhostcontainer_servername_statement']);
|
||||||
$default_vhostconf_domain = \Froxlor\Validate\Validate::validate(str_replace("\r\n", "\n", $this->getParam('default_vhostconf_domain', true, $result['default_vhostconf_domain'])), 'default_vhostconf_domain', \Froxlor\Validate\Validate::REGEX_CONF_TEXT, '', array(), true);
|
$default_vhostconf_domain = \Froxlor\Validate\Validate::validate(str_replace("\r\n", "\n", $this->getParam('default_vhostconf_domain', true, ($result['default_vhostconf_domain'] ?? ""))), 'default_vhostconf_domain', \Froxlor\Validate\Validate::REGEX_CONF_TEXT, '', array(), true);
|
||||||
$docroot = \Froxlor\Validate\Validate::validate($this->getParam('docroot', true, $result['docroot']), 'docroot', \Froxlor\Validate\Validate::REGEX_DIR, '', array(), true);
|
$docroot = \Froxlor\Validate\Validate::validate($this->getParam('docroot', true, $result['docroot']), 'docroot', \Froxlor\Validate\Validate::REGEX_DIR, '', array(), true);
|
||||||
|
|
||||||
if ((int) Settings::Get('system.use_ssl') == 1) {
|
if ((int) Settings::Get('system.use_ssl') == 1) {
|
||||||
@@ -389,9 +389,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
|||||||
$ssl_key_file = \Froxlor\Validate\Validate::validate($this->getParam('ssl_key_file', $ssl, $result['ssl_key_file']), 'ssl_key_file', '', '', array(), true);
|
$ssl_key_file = \Froxlor\Validate\Validate::validate($this->getParam('ssl_key_file', $ssl, $result['ssl_key_file']), 'ssl_key_file', '', '', array(), true);
|
||||||
$ssl_ca_file = \Froxlor\Validate\Validate::validate($this->getParam('ssl_ca_file', true, $result['ssl_ca_file']), 'ssl_ca_file', '', '', array(), true);
|
$ssl_ca_file = \Froxlor\Validate\Validate::validate($this->getParam('ssl_ca_file', true, $result['ssl_ca_file']), 'ssl_ca_file', '', '', array(), true);
|
||||||
$ssl_cert_chainfile = \Froxlor\Validate\Validate::validate($this->getParam('ssl_cert_chainfile', true, $result['ssl_cert_chainfile']), 'ssl_cert_chainfile', '', '', array(), true);
|
$ssl_cert_chainfile = \Froxlor\Validate\Validate::validate($this->getParam('ssl_cert_chainfile', true, $result['ssl_cert_chainfile']), 'ssl_cert_chainfile', '', '', array(), true);
|
||||||
$ssl_specialsettings = \Froxlor\Validate\Validate::validate(str_replace("\r\n", "\n", $this->getParam('ssl_specialsettings', true, $result['ssl_specialsettings'])), 'ssl_specialsettings', \Froxlor\Validate\Validate::REGEX_CONF_TEXT, '', array(), true);
|
$ssl_specialsettings = \Froxlor\Validate\Validate::validate(str_replace("\r\n", "\n", $this->getParam('ssl_specialsettings', true, ($result['ssl_specialsettings'] ?? ""))), 'ssl_specialsettings', \Froxlor\Validate\Validate::REGEX_CONF_TEXT, '', array(), true);
|
||||||
$include_specialsettings = $this->getBoolParam('include_specialsettings', true, $result['include_specialsettings']);
|
$include_specialsettings = $this->getBoolParam('include_specialsettings', true, $result['include_specialsettings']);
|
||||||
$ssl_default_vhostconf_domain = \Froxlor\Validate\Validate::validate(str_replace("\r\n", "\n", $this->getParam('ssl_default_vhostconf_domain', true, $result['ssl_default_vhostconf_domain'])), 'ssl_default_vhostconf_domain', \Froxlor\Validate\Validate::REGEX_CONF_TEXT, '', array(), true);
|
$ssl_default_vhostconf_domain = \Froxlor\Validate\Validate::validate(str_replace("\r\n", "\n", $this->getParam('ssl_default_vhostconf_domain', true, ($result['ssl_default_vhostconf_domain'] ?? ""))), 'ssl_default_vhostconf_domain', \Froxlor\Validate\Validate::REGEX_CONF_TEXT, '', array(), true);
|
||||||
$include_default_vhostconf_domain = $this->getBoolParam('include_default_vhostconf_domain', true, $result['include_default_vhostconf_domain']);
|
$include_default_vhostconf_domain = $this->getBoolParam('include_default_vhostconf_domain', true, $result['include_default_vhostconf_domain']);
|
||||||
} else {
|
} else {
|
||||||
$ssl = 0;
|
$ssl = 0;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check whether we use that config as froxor-vhost config
|
// check whether we use that config as froxor-vhost config
|
||||||
if (Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $row['id'] || Settings::Get('phpfpm.vhost_defaultini') == $row['id']) {
|
if ((Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $row['id']) || (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.vhost_defaultini') == $row['id'])) {
|
||||||
$domains[] = Settings::Get('system.hostname');
|
$domains[] = Settings::Get('system.hostname');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace Froxlor\Cron\System;
|
|||||||
use Froxlor\Database\Database;
|
use Froxlor\Database\Database;
|
||||||
use Froxlor\Settings;
|
use Froxlor\Settings;
|
||||||
use Froxlor\FroxlorLogger;
|
use Froxlor\FroxlorLogger;
|
||||||
|
use Froxlor\FileDir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is part of the Froxlor project.
|
* This file is part of the Froxlor project.
|
||||||
@@ -150,13 +151,17 @@ class BackupCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
$sql_root = Database::getSqlData();
|
$sql_root = Database::getSqlData();
|
||||||
Database::needRoot(false);
|
Database::needRoot(false);
|
||||||
|
|
||||||
|
$mysqlcnf_file = tempnam("/tmp", "frx");
|
||||||
|
$mysqlcnf = "[mysqldump]\npassword=".$sql_root['passwd']."\n";
|
||||||
|
file_put_contents($mysqlcnf_file, $mysqlcnf);
|
||||||
|
|
||||||
$has_dbs = false;
|
$has_dbs = false;
|
||||||
while ($row = $sel_stmt->fetch()) {
|
while ($row = $sel_stmt->fetch()) {
|
||||||
$cronlog->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'shell> mysqldump -u ' . escapeshellarg($sql_root['user']) . ' -pXXXXX ' . $row['databasename'] . ' > ' . \Froxlor\FileDir::makeCorrectFile($tmpdir . '/mysql/' . $row['databasename'] . '_' . date('YmdHi', time()) . '.sql'));
|
$cronlog->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'shell> mysqldump -u ' . escapeshellarg($sql_root['user']) . ' -pXXXXX ' . $row['databasename'] . ' > ' . \Froxlor\FileDir::makeCorrectFile($tmpdir . '/mysql/' . $row['databasename'] . '_' . date('YmdHi', time()) . '.sql'));
|
||||||
$bool_false = false;
|
$bool_false = false;
|
||||||
\Froxlor\FileDir::safe_exec('mysqldump -u ' . escapeshellarg($sql_root['user']) . ' -p' . $sql_root['passwd'] . ' ' . $row['databasename'] . ' > ' . \Froxlor\FileDir::makeCorrectFile($tmpdir . '/mysql/' . $row['databasename'] . '_' . date('YmdHi', time()) . '.sql'), $bool_false, array(
|
\Froxlor\FileDir::safe_exec('mysqldump --defaults-file=' . escapeshellarg($mysqlcnf_file) .' -u ' . escapeshellarg($sql_root['user']) . ' ' . $row['databasename'] . ' > ' . FileDir::makeCorrectFile($tmpdir . '/mysql/' . $row['databasename'] . '_' . date('YmdHi', time()) . '.sql'), $bool_false, [
|
||||||
'>'
|
'>'
|
||||||
));
|
]);
|
||||||
$has_dbs = true;
|
$has_dbs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,6 +169,8 @@ class BackupCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
$create_backup_tar_data .= './mysql ';
|
$create_backup_tar_data .= './mysql ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlink($mysqlcnf_file);
|
||||||
|
|
||||||
unset($sql_root);
|
unset($sql_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
'name' => $row['name'],
|
'name' => $row['name'],
|
||||||
'firstname' => $row['firstname'],
|
'firstname' => $row['firstname'],
|
||||||
'company' => $row['company'],
|
'company' => $row['company'],
|
||||||
|
'loginname' => $row['loginname'],
|
||||||
'customernumber' => $row['customernumber']
|
'customernumber' => $row['customernumber']
|
||||||
);
|
);
|
||||||
$replace_arr = array(
|
$replace_arr = array(
|
||||||
@@ -374,6 +375,7 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
'name' => $row['name'],
|
'name' => $row['name'],
|
||||||
'firstname' => $row['firstname'],
|
'firstname' => $row['firstname'],
|
||||||
'company' => $row['company'],
|
'company' => $row['company'],
|
||||||
|
'loginname' => $row['loginname'],
|
||||||
'customernumber' => $row['customernumber']
|
'customernumber' => $row['customernumber']
|
||||||
);
|
);
|
||||||
$replace_arr = array(
|
$replace_arr = array(
|
||||||
|
|||||||
@@ -173,7 +173,10 @@ class DbManager
|
|||||||
|
|
||||||
if (isset($users[$username]) && is_array($users[$username]) && isset($users[$username]['hosts']) && is_array($users[$username]['hosts'])) {
|
if (isset($users[$username]) && is_array($users[$username]) && isset($users[$username]['hosts']) && is_array($users[$username]['hosts'])) {
|
||||||
|
|
||||||
$password = $users[$username]['password'];
|
$password = [
|
||||||
|
'password' => $users[$username]['password'],
|
||||||
|
'plugin' => $users[$username]['plugin']
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($mysql_access_host_array as $mysql_access_host) {
|
foreach ($mysql_access_host_array as $mysql_access_host) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Froxlor\Database\Manager;
|
namespace Froxlor\Database\Manager;
|
||||||
|
|
||||||
use Froxlor\Database\Database;
|
use Froxlor\Database\Database;
|
||||||
@@ -68,7 +69,7 @@ class DbManagerMySQL
|
|||||||
* username and sets the password for that user the given access_host
|
* username and sets the password for that user the given access_host
|
||||||
*
|
*
|
||||||
* @param string $username
|
* @param string $username
|
||||||
* @param string $password
|
* @param string|array $password
|
||||||
* @param string $access_host
|
* @param string $access_host
|
||||||
* @param bool $p_encrypted
|
* @param bool $p_encrypted
|
||||||
* optional, whether the password is encrypted or not, default false
|
* optional, whether the password is encrypted or not, default false
|
||||||
@@ -77,7 +78,13 @@ class DbManagerMySQL
|
|||||||
*/
|
*/
|
||||||
public function grantPrivilegesTo($username = null, $password = null, $access_host = null, $p_encrypted = false, $update = false)
|
public function grantPrivilegesTo($username = null, $password = null, $access_host = null, $p_encrypted = false, $update = false)
|
||||||
{
|
{
|
||||||
if (! $update) {
|
$pwd_plugin = 'mysql_native_password';
|
||||||
|
if (is_array($password) && count($password) == 2) {
|
||||||
|
$pwd_plugin = $password['plugin'];
|
||||||
|
$password = $password['password'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
// create user
|
// create user
|
||||||
if ($p_encrypted) {
|
if ($p_encrypted) {
|
||||||
if (version_compare(Database::getAttribute(\PDO::ATTR_SERVER_VERSION), '5.7.0', '<')) {
|
if (version_compare(Database::getAttribute(\PDO::ATTR_SERVER_VERSION), '5.7.0', '<')) {
|
||||||
@@ -86,7 +93,7 @@ class DbManagerMySQL
|
|||||||
");
|
");
|
||||||
} else {
|
} else {
|
||||||
$stmt = Database::prepare("
|
$stmt = Database::prepare("
|
||||||
CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED WITH mysql_native_password AS :password
|
CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED WITH " . $pwd_plugin . " AS :password
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -115,7 +122,7 @@ class DbManagerMySQL
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($p_encrypted) {
|
if ($p_encrypted) {
|
||||||
$stmt = Database::prepare("ALTER USER :username@:host IDENTIFIED WITH mysql_native_password AS :password");
|
$stmt = Database::prepare("ALTER USER :username@:host IDENTIFIED WITH " . $pwd_plugin . " AS :password");
|
||||||
} else {
|
} else {
|
||||||
$stmt = Database::prepare("ALTER USER :username@:host IDENTIFIED BY :password");
|
$stmt = Database::prepare("ALTER USER :username@:host IDENTIFIED BY :password");
|
||||||
}
|
}
|
||||||
@@ -136,7 +143,7 @@ class DbManagerMySQL
|
|||||||
*/
|
*/
|
||||||
public function deleteDatabase($dbname = null)
|
public function deleteDatabase($dbname = null)
|
||||||
{
|
{
|
||||||
if (Database::getAttribute(\PDO::ATTR_SERVER_VERSION) < '5.0.2') {
|
if (version_compare(Database::getAttribute(\PDO::ATTR_SERVER_VERSION), '5.0.2', '<')) {
|
||||||
// failsafe if user has been deleted manually (requires MySQL 4.1.2+)
|
// failsafe if user has been deleted manually (requires MySQL 4.1.2+)
|
||||||
$stmt = Database::prepare("REVOKE ALL PRIVILEGES, GRANT OPTION FROM `" . $dbname . "`");
|
$stmt = Database::prepare("REVOKE ALL PRIVILEGES, GRANT OPTION FROM `" . $dbname . "`");
|
||||||
Database::pexecute($stmt, array(), false);
|
Database::pexecute($stmt, array(), false);
|
||||||
@@ -247,9 +254,10 @@ class DbManagerMySQL
|
|||||||
$allsqlusers = array();
|
$allsqlusers = array();
|
||||||
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||||
if ($user_only == false) {
|
if ($user_only == false) {
|
||||||
if (! isset($allsqlusers[$row['User']]) || ! is_array($allsqlusers[$row['User']])) {
|
if (!isset($allsqlusers[$row['User']]) || !is_array($allsqlusers[$row['User']])) {
|
||||||
$allsqlusers[$row['User']] = array(
|
$allsqlusers[$row['User']] = array(
|
||||||
'password' => $row['Password'] ?? $row['authentication_string'],
|
'password' => $row['Password'] ?? $row['authentication_string'],
|
||||||
|
'plugin' => $row['plugin'] ?? 'mysql_native_password',
|
||||||
'hosts' => array()
|
'hosts' => array()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Froxlor;
|
namespace Froxlor;
|
||||||
|
|
||||||
use Froxlor\Database\Database;
|
use Froxlor\Database\Database;
|
||||||
@@ -96,14 +97,14 @@ class FileDir
|
|||||||
$subdir = self::makeCorrectDir($subdir);
|
$subdir = self::makeCorrectDir($subdir);
|
||||||
$subdirs = array();
|
$subdirs = array();
|
||||||
|
|
||||||
if ($within_homedir || ! $allow_notwithinhomedir) {
|
if ($within_homedir || !$allow_notwithinhomedir) {
|
||||||
$subdirlen = strlen($subdir);
|
$subdirlen = strlen($subdir);
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
|
|
||||||
while ($offset < $subdirlen) {
|
while ($offset < $subdirlen) {
|
||||||
$offset = strpos($subdir, '/', $offset);
|
$offset = strpos($subdir, '/', $offset);
|
||||||
$subdirelem = substr($subdir, 0, $offset);
|
$subdirelem = substr($subdir, 0, $offset);
|
||||||
$offset ++;
|
$offset++;
|
||||||
array_push($subdirs, self::makeCorrectDir($homeDir . $subdirelem));
|
array_push($subdirs, self::makeCorrectDir($homeDir . $subdirelem));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -113,7 +114,7 @@ class FileDir
|
|||||||
$subdirs = array_unique($subdirs);
|
$subdirs = array_unique($subdirs);
|
||||||
sort($subdirs);
|
sort($subdirs);
|
||||||
foreach ($subdirs as $sdir) {
|
foreach ($subdirs as $sdir) {
|
||||||
if (! is_dir($sdir)) {
|
if (!is_dir($sdir)) {
|
||||||
$sdir = self::makeCorrectDir($sdir);
|
$sdir = self::makeCorrectDir($sdir);
|
||||||
self::safe_exec('mkdir -p ' . escapeshellarg($sdir));
|
self::safe_exec('mkdir -p ' . escapeshellarg($sdir));
|
||||||
// place index
|
// place index
|
||||||
@@ -247,7 +248,7 @@ class FileDir
|
|||||||
*/
|
*/
|
||||||
public static function makeCorrectFile($filename)
|
public static function makeCorrectFile($filename)
|
||||||
{
|
{
|
||||||
if (! isset($filename) || trim($filename) == '') {
|
if (!isset($filename) || trim($filename) == '') {
|
||||||
$error = 'Given filename for function ' . __FUNCTION__ . ' is empty.' . "\n";
|
$error = 'Given filename for function ' . __FUNCTION__ . ' is empty.' . "\n";
|
||||||
$error .= 'This is very dangerous and should not happen.' . "\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.';
|
$error .= 'Please inform the Froxlor team about this issue so they can fix it.';
|
||||||
@@ -278,7 +279,7 @@ class FileDir
|
|||||||
{
|
{
|
||||||
if (is_string($dir) && strlen($dir) > 0) {
|
if (is_string($dir) && strlen($dir) > 0) {
|
||||||
$dir = trim($dir);
|
$dir = trim($dir);
|
||||||
if (substr($dir, - 1, 1) != '/') {
|
if (substr($dir, -1, 1) != '/') {
|
||||||
$dir .= '/';
|
$dir .= '/';
|
||||||
}
|
}
|
||||||
if (substr($dir, 0, 1) != '/') {
|
if (substr($dir, 0, 1) != '/') {
|
||||||
@@ -355,7 +356,7 @@ class FileDir
|
|||||||
$destination = substr($destination, 1);
|
$destination = substr($destination, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (substr($destination, - 1, 1) == ' ') {
|
if (substr($destination, -1, 1) == ' ') {
|
||||||
$destination = substr($destination, 0, strlen($destination) - 1);
|
$destination = substr($destination, 0, strlen($destination) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +391,7 @@ class FileDir
|
|||||||
// but dirList holds the paths with starting slash
|
// but dirList holds the paths with starting slash
|
||||||
// so we just add one here to get the correct
|
// so we just add one here to get the correct
|
||||||
// default path selected, #225
|
// default path selected, #225
|
||||||
if (substr($value, 0, 1) != '/' && ! $dom) {
|
if (substr($value, 0, 1) != '/' && !$dom) {
|
||||||
$value = '/' . $value;
|
$value = '/' . $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +409,6 @@ class FileDir
|
|||||||
natcasesort($dirList);
|
natcasesort($dirList);
|
||||||
|
|
||||||
if (sizeof($dirList) > 0) {
|
if (sizeof($dirList) > 0) {
|
||||||
if (sizeof($dirList) <= 100) {
|
|
||||||
$_field = '';
|
$_field = '';
|
||||||
foreach ($dirList as $dir) {
|
foreach ($dirList as $dir) {
|
||||||
if (strpos($dir, $path) === 0) {
|
if (strpos($dir, $path) === 0) {
|
||||||
@@ -425,17 +425,6 @@ class FileDir
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'value' => $_field
|
'value' => $_field
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
// remove starting slash we added
|
|
||||||
// for the Dropdown, #225
|
|
||||||
$value = substr($value, 1);
|
|
||||||
// $field = $lng['panel']['toomanydirs'];
|
|
||||||
$field = array(
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => htmlspecialchars($value),
|
|
||||||
'note' => $lng['panel']['toomanydirs']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// $field = $lng['panel']['dirsmissing'];
|
// $field = $lng['panel']['dirsmissing'];
|
||||||
// $field = '<input type="hidden" name="path" value="/" />';
|
// $field = '<input type="hidden" name="path" value="/" />';
|
||||||
@@ -489,22 +478,31 @@ class FileDir
|
|||||||
$filter = function ($file, $key, $iterator) use ($exclude) {
|
$filter = function ($file, $key, $iterator) use ($exclude) {
|
||||||
if (in_array($file->getFilename(), $exclude)) {
|
if (in_array($file->getFilename(), $exclude)) {
|
||||||
return false;
|
return false;
|
||||||
|
} elseif (substr($file->getFilename(), 0, 1) == '.') {
|
||||||
|
// also hide hidden folders
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// create RecursiveIteratorIterator
|
// create RecursiveIteratorIterator
|
||||||
$its = new \RecursiveIteratorIterator(new \RecursiveCallbackFilterIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), $filter));
|
$its = new \RecursiveIteratorIterator(
|
||||||
|
new \RecursiveCallbackFilterIterator(
|
||||||
|
new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||||
|
$filter
|
||||||
|
),
|
||||||
|
\RecursiveIteratorIterator::SELF_FIRST,
|
||||||
|
\RecursiveIteratorIterator::CATCH_GET_CHILD
|
||||||
|
);
|
||||||
// we can limit the recursion-depth, but will it be helpful or
|
// we can limit the recursion-depth, but will it be helpful or
|
||||||
// will people start asking "why do I only see 2 subdirectories, i want to use /a/b/c"
|
// will people start asking "why do I only see 2 subdirectories, i want to use /a/b/c"
|
||||||
// let's keep this in mind and see whether it will be useful
|
// let's keep this in mind and see whether it will be useful
|
||||||
// @TODO
|
$its->setMaxDepth(2);
|
||||||
// $its->setMaxDepth(2);
|
|
||||||
|
|
||||||
// check every file
|
// check every file
|
||||||
foreach ($its as $fullFileName => $it) {
|
foreach ($its as $fullFileName => $it) {
|
||||||
if ($it->isDir() && (fileowner($fullFileName) == $uid || filegroup($fullFileName) == $gid)) {
|
if ($it->isDir() && (fileowner($fullFileName) == $uid || filegroup($fullFileName) == $gid)) {
|
||||||
$_fileList[] = self::makeCorrectDir(dirname($fullFileName));
|
$_fileList[] = self::makeCorrectDir($fullFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_fileList[] = $path;
|
$_fileList[] = $path;
|
||||||
@@ -525,7 +523,7 @@ class FileDir
|
|||||||
*/
|
*/
|
||||||
public static function isFreeBSD($exact = false)
|
public static function isFreeBSD($exact = false)
|
||||||
{
|
{
|
||||||
if (($exact && PHP_OS == 'FreeBSD') || (! $exact && stristr(PHP_OS, 'BSD'))) {
|
if (($exact && PHP_OS == 'FreeBSD') || (!$exact && stristr(PHP_OS, 'BSD'))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ final class Froxlor
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Main version variable
|
// Main version variable
|
||||||
const VERSION = '0.10.35.1';
|
const VERSION = '0.10.38';
|
||||||
|
|
||||||
// Database version (YYYYMMDDC where C is a daily counter)
|
// Database version (YYYYMMDDC where C is a daily counter)
|
||||||
const DBVERSION = '202112310';
|
const DBVERSION = '202112310';
|
||||||
|
|||||||
@@ -3561,7 +3561,7 @@ postmaster_address = postmaster@<SERVERNAME>
|
|||||||
|
|
||||||
protocol lda {
|
protocol lda {
|
||||||
# Space separated list of plugins to load (default is global mail_plugins).
|
# Space separated list of plugins to load (default is global mail_plugins).
|
||||||
#mail_plugins = $mail_plugins
|
mail_plugins = $mail_plugins quota sieve
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
</content>
|
</content>
|
||||||
|
|||||||
@@ -3557,7 +3557,7 @@ postmaster_address = postmaster@<SERVERNAME>
|
|||||||
|
|
||||||
protocol lda {
|
protocol lda {
|
||||||
# Space separated list of plugins to load (default is global mail_plugins).
|
# Space separated list of plugins to load (default is global mail_plugins).
|
||||||
#mail_plugins = $mail_plugins
|
mail_plugins = $mail_plugins quota sieve
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
</content>
|
</content>
|
||||||
|
|||||||
@@ -2138,3 +2138,5 @@ $lng['serversettings']['phpfpm_settings']['allow_all_customers']['description']
|
|||||||
$lng['error']['pathmustberelative'] = 'The user does not have the permission to specify directories outside the customers home-directory. Please specify a relative path (no leading /).';
|
$lng['error']['pathmustberelative'] = 'The user does not have the permission to specify directories outside the customers home-directory. Please specify a relative path (no leading /).';
|
||||||
$lng['serversettings']['acmeshpath']['title'] = 'Path to acme.sh';
|
$lng['serversettings']['acmeshpath']['title'] = 'Path to acme.sh';
|
||||||
$lng['serversettings']['acmeshpath']['description'] = 'Set this to where acme.sh is installed to, including the acme.sh script<br>Default is <b>/root/.acme.sh/acme.sh</b>';
|
$lng['serversettings']['acmeshpath']['description'] = 'Set this to where acme.sh is installed to, including the acme.sh script<br>Default is <b>/root/.acme.sh/acme.sh</b>';
|
||||||
|
|
||||||
|
$lng['question']['api_reallydelete'] = 'Do you really want to delete the api-key #%d?';
|
||||||
@@ -1784,3 +1784,5 @@ $lng['serversettings']['phpfpm_settings']['allow_all_customers']['description']
|
|||||||
$lng['error']['pathmustberelative'] = 'Der Benutzer hat nicht die benötigten Berechtigungen, um Pfade außerhalb des Kunden-Heimatverzeichnisses anzugeben. Bitte einen relativen Pfad angeben (kein führendes /).';
|
$lng['error']['pathmustberelative'] = 'Der Benutzer hat nicht die benötigten Berechtigungen, um Pfade außerhalb des Kunden-Heimatverzeichnisses anzugeben. Bitte einen relativen Pfad angeben (kein führendes /).';
|
||||||
$lng['serversettings']['acmeshpath']['title'] = 'Pfad zu acme.sh';
|
$lng['serversettings']['acmeshpath']['title'] = 'Pfad zu acme.sh';
|
||||||
$lng['serversettings']['acmeshpath']['description'] = 'Installationspfad zu acme.sh, inklusive acme.sh Script<br>Standard ist <b>/root/.acme.sh/acme.sh</b>';
|
$lng['serversettings']['acmeshpath']['description'] = 'Installationspfad zu acme.sh, inklusive acme.sh Script<br>Standard ist <b>/root/.acme.sh/acme.sh</b>';
|
||||||
|
|
||||||
|
$lng['question']['api_reallydelete'] = 'Api-Key #%d wirklich löschen?';
|
||||||
|
|||||||
1
templates/Sparkle/assets/css/main.css
vendored
1
templates/Sparkle/assets/css/main.css
vendored
@@ -82,6 +82,7 @@ header img {
|
|||||||
.login header img {
|
.login header img {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
display: block;
|
display: block;
|
||||||
|
max-width: calc(100% - 20px);
|
||||||
}
|
}
|
||||||
|
|
||||||
img.small {
|
img.small {
|
||||||
|
|||||||
@@ -286,8 +286,8 @@ class MysqlsTest extends TestCase
|
|||||||
$dbm = new \Froxlor\Database\DbManager(\Froxlor\FroxlorLogger::getInstanceOf());
|
$dbm = new \Froxlor\Database\DbManager(\Froxlor\FroxlorLogger::getInstanceOf());
|
||||||
$users = $dbm->getManager()->getAllSqlUsers(false);
|
$users = $dbm->getManager()->getAllSqlUsers(false);
|
||||||
foreach ($users as $user => $data) {
|
foreach ($users as $user => $data) {
|
||||||
if (TRAVIS_CI == 1 && strtolower($user) == 'mariadb.sys') {
|
if (strtolower($user) == 'mariadb.sys') {
|
||||||
// travis seems to have a user for mariadb on version 10.4
|
// some systems seem to have a user for mariadb on version 10.4
|
||||||
// we do not want to test that one
|
// we do not want to test that one
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -302,7 +302,11 @@ class MysqlsTest extends TestCase
|
|||||||
|
|
||||||
// grant privileges to another host
|
// grant privileges to another host
|
||||||
$testdata = $users['froxlor010'];
|
$testdata = $users['froxlor010'];
|
||||||
$dbm->getManager()->grantPrivilegesTo('froxlor010', $testdata['password'], '10.0.0.10', true);
|
$password = [
|
||||||
|
'password' => $testdata['password'],
|
||||||
|
'plugin' => $testdata['plugin']
|
||||||
|
];
|
||||||
|
$dbm->getManager()->grantPrivilegesTo('froxlor010', $password, '10.0.0.10', true);
|
||||||
|
|
||||||
// select all entries from mysql.user for froxlor010 to compare password-hashes
|
// select all entries from mysql.user for froxlor010 to compare password-hashes
|
||||||
$sel_stmt = Database::prepare("SELECT * FROM mysql.user WHERE `User` = :usr");
|
$sel_stmt = Database::prepare("SELECT * FROM mysql.user WHERE `User` = :usr");
|
||||||
|
|||||||
Reference in New Issue
Block a user