diff --git a/src/Core/System/Configs/SSHConf.php b/src/Core/System/Configs/SSHConf.php index 49bf68e1f..ee22044ef 100644 --- a/src/Core/System/Configs/SSHConf.php +++ b/src/Core/System/Configs/SSHConf.php @@ -145,6 +145,14 @@ private function getCreateSshUser(): string shell_exec("$bbPath addgroup -S '$sshLogin' $sshLogin"); // Adding a user to the group 'root' shell_exec("$bbPath addgroup -S '$sshLogin' root"); + + $cat = Util::which('cat'); + $cut = Util::which('cut'); + $sed = Util::which('sed'); + $chown = Util::which('chown'); + $currentGroupId = trim(shell_exec("$cat /etc/passwd | grep '^$sshLogin:' | $cut -f 3 -d ':'")); + shell_exec("$sed -i 's/$sshLogin:x:$currentGroupId:/$sshLogin:x:0:/g' /etc/passwd"); + shell_exec("$chown -R $sshLogin:$sshLogin $homeDir"); } return $sshLogin; } diff --git a/src/Core/System/Notifications.php b/src/Core/System/Notifications.php index 4f819fd95..6a13112cc 100644 --- a/src/Core/System/Notifications.php +++ b/src/Core/System/Notifications.php @@ -86,6 +86,9 @@ public static function sendAdminNotification(string $subject, array $messages, b { // Prevent sending the same message twice. $di = Di::getDefault(); + if(!$di){ + return; + } $managedCache = $di->getShared(ManagedCacheProvider::SERVICE_NAME); $cacheKey = 'sendAdminNotification:' . md5($subject . implode('', $messages)); $cacheTime = 3600 * 24; // 1 day @@ -96,7 +99,7 @@ public static function sendAdminNotification(string $subject, array $messages, b } // Check if the notification system is available (e.g., PHP Mailer is configured and working). - if (!Notifications::checkConnection(Notifications::TYPE_PHP_MAILER)) { + if (!self::checkConnection(self::TYPE_PHP_MAILER)) { return; } @@ -106,7 +109,8 @@ public static function sendAdminNotification(string $subject, array $messages, b foreach ($messages as $message) { $text .= '
' . Util::translate($message, false); } - $text = $text . '

' . SystemMessages::getInfoMessage("The MikoPBX connection information"); + $text .= '

' . SystemMessages::getInfoMessage("The MikoPBX connection information"); + $text = str_replace(PHP_EOL, '
', $text); // Get the admin email address from PbxSettings. $adminMail = PbxSettings::getValueByKey(PbxSettingsConstants::SYSTEM_NOTIFICATIONS_EMAIL);