- Created separate MoneyFlix project directory - Copied Node.js redirector from production server - Added CRM PHP code (Redirects module, Core classes, Config, Routes, Views) - Created comprehensive documentation (README_MONEYFLIX.md) - Added sync script to keep CRM code updated (sync-from-crm.sh) - Configured .gitignore for Node.js and PHP - Set up proper project structure for multi-client isolation This separates MoneyFlix from the main CRM to avoid confusion between different client systems and provides a dedicated environment for MoneyFlix-specific development and maintenance.
60 lines
1.2 KiB
PHP
60 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Core;
|
|
|
|
class SessionManager
|
|
{
|
|
private static ?SessionManager $instance = null;
|
|
private bool $started = false;
|
|
|
|
private function __construct()
|
|
{
|
|
// Private constructor for singleton
|
|
}
|
|
|
|
public static function getInstance(): SessionManager
|
|
{
|
|
if (self::$instance === null) {
|
|
self::$instance = new self();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
|
|
public function start(): void
|
|
{
|
|
if (!$this->started && session_status() === PHP_SESSION_NONE) {
|
|
session_start();
|
|
$this->started = true;
|
|
}
|
|
}
|
|
|
|
public function set(string $key, mixed $value): void
|
|
{
|
|
$_SESSION[$key] = $value;
|
|
}
|
|
|
|
public function get(string $key, mixed $default = null): mixed
|
|
{
|
|
return $_SESSION[$key] ?? $default;
|
|
}
|
|
|
|
public function has(string $key): bool
|
|
{
|
|
return isset($_SESSION[$key]);
|
|
}
|
|
|
|
public function remove(string $key): void
|
|
{
|
|
unset($_SESSION[$key]);
|
|
}
|
|
|
|
public function destroy(): void
|
|
{
|
|
if ($this->started) {
|
|
session_destroy();
|
|
$this->started = false;
|
|
}
|
|
}
|
|
}
|