feat: add privacy policy, terms, and animated landing page
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace ServerManager\Controllers;
|
||||
|
||||
use ServerManager\Core\App;
|
||||
use ServerManager\Core\Database;
|
||||
use ServerManager\Core\Session;
|
||||
use ServerManager\Models\Server;
|
||||
use ServerManager\Models\Notification;
|
||||
@@ -24,6 +25,28 @@ class DashboardController
|
||||
$this->auditService = new AuditService();
|
||||
}
|
||||
|
||||
public function landing(): void
|
||||
{
|
||||
if (Session::has('user_id')) {
|
||||
$this->view->redirect('/dashboard');
|
||||
}
|
||||
|
||||
$stats = [];
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
$stats['servers'] = $db->fetch('SELECT COUNT(*) as count FROM servers')['count'] ?? 0;
|
||||
$stats['users'] = $db->fetch('SELECT COUNT(*) as count FROM users')['count'] ?? 0;
|
||||
$stats['online_servers'] = $db->fetch("SELECT COUNT(*) as count FROM servers WHERE current_status = 'online'")['count'] ?? 0;
|
||||
} catch (\Throwable) {
|
||||
$stats = ['servers' => 0, 'users' => 0, 'online_servers' => 0];
|
||||
}
|
||||
|
||||
$this->view->setLayout('auth')->display('pages.landing', [
|
||||
'title' => 'ServerManager - Linux Server Management Platform',
|
||||
'stats' => $stats,
|
||||
]);
|
||||
}
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
$serverModel = new Server();
|
||||
@@ -82,6 +105,30 @@ class DashboardController
|
||||
]);
|
||||
}
|
||||
|
||||
public function privacy(): void
|
||||
{
|
||||
$db = Database::getInstance();
|
||||
$row = $db->fetch('SELECT `value` FROM app_config WHERE `key` = ?', ['privacy_policy']);
|
||||
$content = $row ? $row['value'] : '';
|
||||
|
||||
$this->view->setLayout('auth')->display('pages.privacy', [
|
||||
'title' => 'Privacy Policy - ServerManager',
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
|
||||
public function terms(): void
|
||||
{
|
||||
$db = Database::getInstance();
|
||||
$row = $db->fetch('SELECT `value` FROM app_config WHERE `key` = ?', ['terms_conditions']);
|
||||
$content = $row ? $row['value'] : '';
|
||||
|
||||
$this->view->setLayout('auth')->display('pages.terms', [
|
||||
'title' => 'Terms & Conditions - ServerManager',
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
|
||||
public function notifications(): void
|
||||
{
|
||||
$userId = (int) Session::get('user_id');
|
||||
|
||||
Reference in New Issue
Block a user