only show 'move to another admin' if current admin can see other admin-resources; append domainid to pagination of email-domain adresses list; check for invalid lockfile in cron management

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2025-03-06 09:08:51 +01:00
parent f90dc5854d
commit 0a221d0479
7 changed files with 47 additions and 35 deletions

View File

@@ -15,7 +15,8 @@ assignees: ''
A clear and concise description of what the bug is. A clear and concise description of what the bug is.
**System information** **System information**
* Froxlor version: $version/$gitSHA1 * Froxlor version: \$version/\$gitSHA1
* PHP sapi & version: php-fpm 8.3 / fcgid 8.0 / etc.
* Web server: apache2/nginx/lighttpd * Web server: apache2/nginx/lighttpd
* DNS server: Bind/PowerDNS (standalone)/PowerDNS (Bind-backend) * DNS server: Bind/PowerDNS (standalone)/PowerDNS (Bind-backend)
* POP/IMAP server: Courier/Dovecot * POP/IMAP server: Courier/Dovecot

View File

@@ -307,17 +307,20 @@ if (($page == 'customers' || $page == 'overview') && $userinfo['customers'] != '
$hosting_plans[$row['id']] = $row['name']; $hosting_plans[$row['id']] = $row['name'];
} }
$available_admins_stmt = Database::prepare(" $admin_select = [];
SELECT * FROM `" . TABLE_PANEL_ADMINS . "` if ($userinfo['customers_see_all'] == '1') {
WHERE (`customers` = '-1' OR `customers` > `customers_used`) $available_admins_stmt = Database::prepare("
AND adminid <> :currentadmin SELECT * FROM `" . TABLE_PANEL_ADMINS . "`
"); WHERE (`customers` = '-1' OR `customers` > `customers_used`)
Database::pexecute($available_admins_stmt, ['currentadmin' => $result['adminid']]); AND adminid <> :currentadmin
$admin_select = [ ");
0 => "---" Database::pexecute($available_admins_stmt, ['currentadmin' => $result['adminid']]);
]; $admin_select = [
while ($available_admin = $available_admins_stmt->fetch()) { 0 => "---"
$admin_select[$available_admin['adminid']] = $available_admin['name'] . " (" . $available_admin['loginname'] . ")"; ];
while ($available_admin = $available_admins_stmt->fetch()) {
$admin_select[$available_admin['adminid']] = $available_admin['name'] . " (" . $available_admin['loginname'] . ")";
}
} }
$customer_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php'; $customer_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';

36
composer.lock generated
View File

@@ -2561,16 +2561,16 @@
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.12.1", "version": "1.13.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" "reference": "024473a478be9df5fdaca2c793f2232fe788e414"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414",
"reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "reference": "024473a478be9df5fdaca2c793f2232fe788e414",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2609,7 +2609,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/myclabs/DeepCopy/issues", "issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0"
}, },
"funding": [ "funding": [
{ {
@@ -2617,7 +2617,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-11-08T17:47:46+00:00" "time": "2025-02-12T12:17:51+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
@@ -3066,16 +3066,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.12.15", "version": "1.12.20",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "c91d4e8bc056f46cf653656e6f71004b254574d1" "reference": "3240b1972042c7f73cf1045e879ea5bd5f761bb7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/c91d4e8bc056f46cf653656e6f71004b254574d1", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3240b1972042c7f73cf1045e879ea5bd5f761bb7",
"reference": "c91d4e8bc056f46cf653656e6f71004b254574d1", "reference": "3240b1972042c7f73cf1045e879ea5bd5f761bb7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -3120,7 +3120,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-01-05T16:40:22+00:00" "time": "2025-03-05T13:37:43+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@@ -4571,16 +4571,16 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "3.11.2", "version": "3.11.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "1368f4a58c3c52114b86b1abe8f4098869cb0079" "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/1368f4a58c3c52114b86b1abe8f4098869cb0079", "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10",
"reference": "1368f4a58c3c52114b86b1abe8f4098869cb0079", "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -4645,9 +4645,13 @@
{ {
"url": "https://opencollective.com/php_codesniffer", "url": "https://opencollective.com/php_codesniffer",
"type": "open_collective" "type": "open_collective"
},
{
"url": "https://thanks.dev/phpcsstandards",
"type": "thanks_dev"
} }
], ],
"time": "2024-12-11T16:04:26+00:00" "time": "2025-01-23T17:04:15+00:00"
}, },
{ {
"name": "symfony/config", "name": "symfony/config",

View File

@@ -30,7 +30,6 @@ use Froxlor\Api\Commands\EmailAccounts;
use Froxlor\Api\Commands\EmailDomains; use Froxlor\Api\Commands\EmailDomains;
use Froxlor\Api\Commands\EmailForwarders; use Froxlor\Api\Commands\EmailForwarders;
use Froxlor\Api\Commands\Emails; use Froxlor\Api\Commands\Emails;
use Froxlor\Cron\Mail\Rspamd;
use Froxlor\CurrentUser; use Froxlor\CurrentUser;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger; use Froxlor\FroxlorLogger;
@@ -105,7 +104,7 @@ if ($page == 'email_domain') {
$email_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.emails.php'; $email_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.emails.php';
$collection = (new Collection(Emails::class, $userinfo, $sql_search)) $collection = (new Collection(Emails::class, $userinfo, $sql_search))
->withPagination($email_list_data['email_list']['columns'], ->withPagination($email_list_data['email_list']['columns'],
$email_list_data['email_list']['default_sorting']); $email_list_data['email_list']['default_sorting'], ['domainid=' . $email_domainid]);
} catch (Exception $e) { } catch (Exception $e) {
Response::dynamicError($e->getMessage()); Response::dynamicError($e->getMessage());
} }

View File

@@ -215,9 +215,14 @@ final class MasterCron extends CliCommand
if (file_exists($this->lockFile)) { if (file_exists($this->lockFile)) {
$jobinfo = json_decode(file_get_contents($this->lockFile), true); $jobinfo = json_decode(file_get_contents($this->lockFile), true);
$check_pid_return = null; if ($jobinfo === false || !is_array($jobinfo)) {
// get status of process // looks like an invalid lockfile
system("kill -CHLD " . (int)$jobinfo['pid'] . " 1> /dev/null 2> /dev/null", $check_pid_return); $check_pid_return = 1;
} else {
$check_pid_return = null;
// get status of process
system("kill -CHLD " . (int)$jobinfo['pid'] . " 1> /dev/null 2> /dev/null", $check_pid_return);
}
if ($check_pid_return == 1) { if ($check_pid_return == 1) {
// Process does not seem to run, most likely it has died // Process does not seem to run, most likely it has died
$this->unlockJob(); $this->unlockJob();

View File

@@ -316,7 +316,7 @@ final class Froxlor
* @param array|null $arr * @param array|null $arr
* @return void * @return void
*/ */
private static function parseVersionArray(array &$arr = null) private static function parseVersionArray(?array &$arr)
{ {
// -dev or -beta or -rc ? // -dev or -beta or -rc ?
if (stripos($arr[count($arr) - 1], '-') !== false) { if (stripos($arr[count($arr) - 1], '-') !== false) {

View File

@@ -61,7 +61,7 @@ function lng(string $identifier, array $arguments = [])
* @param string|null $session * @param string|null $session
* @return mixed|string|null * @return mixed|string|null
*/ */
function old(string $identifier, string $default = null, string $session = null) function old(string $identifier, ?string $default, ?string $session = null)
{ {
if ($session && isset($_SESSION[$session])) { if ($session && isset($_SESSION[$session])) {
return $_SESSION[$session][$identifier] ?? $default; return $_SESSION[$session][$identifier] ?? $default;