Update cron.php

the default hosting page is generated with site_name and address from the common.php
This commit is contained in:
Lin
2026-02-25 20:08:29 +01:00
committed by GitHub
parent 608dd188dd
commit 900d65c4f0

View File

@@ -36,7 +36,36 @@ while($account=$stmt->fetch(PDO::FETCH_ASSOC)){
$reload[$account['instance']] = true; $reload[$account['instance']] = true;
//add and manage rights of system user //add and manage rights of system user
$shell = ENABLE_SHELL_ACCESS ? '/bin/bash' : '/usr/sbin/nologin'; $shell = ENABLE_SHELL_ACCESS ? '/bin/bash' : '/usr/sbin/nologin';
exec('useradd -l -g www-data -k /var/www/skel -m -s ' . escapeshellarg($shell) . ' ' . escapeshellarg($system_account)); exec('useradd -l -g www-data -m -s ' . escapeshellarg($shell) . ' ' . escapeshellarg($system_account));
//generate default hosting page
$home = "/home/$system_account";
$dir = "$home/www";
$file = "$dir/index.hosting.html";
if (!is_dir($dir)) {
mkdir($dir, 0755, true);
}
$content = sprintf(
'<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Site hosted by %s service</title>
<meta name="robots" content="noindex">
</head>
<body>
<p>This site is hosted by <a href="http://%s" target="_blank" rel="noopener">%s service</a>.</p>
</body>
</html>',
htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8'),
htmlspecialchars(ADDRESS, ENT_QUOTES, 'UTF-8'),
htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8')
);
file_put_contents($file, $content);
chown($dir, $system_account);
chgrp($dir, 'www-data');
chown($file, $system_account);
chgrp($file, 'www-data');
////////
update_system_user_password($system_account, $account['password']); update_system_user_password($system_account, $account['password']);
setup_chroot($system_account, $last_account); setup_chroot($system_account, $last_account);
$last_account = $system_account; $last_account = $system_account;