seedproject-web/api/app/Controllers/AppController.php
Carlos Arias 1559ce017d chore: scaffold SeedProject base (Phase 1)
Clean-room copy of the reusable engines from comiida, with all
instance data, secrets, dependencies, and build output excluded:
- app/         Astro theme skeleton (no comiida blog posts; hero image -> placeholder)
- api/         SeedProject PHP framework (no vendor/.env/config.php)
- content-pipeline/  engine only (scripts/admin/prompts; empty runtime state)
- astroagent.config.json + app/.astroagent/skills

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SYHWLHihq3v9nxNwoPCKSn
2026-07-04 22:53:10 +00:00

31 lines
1.2 KiB
PHP

<?php
use App\Components\User;
/**
* AppController — SaaS-level base controller.
*
* All UI controllers extend this instead of the core Controller directly.
* Owns app-wide concerns: session user profile injection, shared view data, etc.
* Core framework files (core/Controller.php) are never modified.
*/
class AppController extends Controller {
function __construct() {
parent::__construct();
// Inject the authenticated user's full profile into every view
if (!empty($_SESSION['login']['userid'])) {
$profile = User::profile($_SESSION['login']['userid']);
$this->view->UserProfile = $profile;
// Build tokenized slug for account settings link: "first-last.encryptedId"
if ($profile) {
$namePart = strtolower(trim(($profile['fname'] ?? '') . '-' . ($profile['lname'] ?? ''), '-'));
$namePart = preg_replace('/[^a-z0-9\-]/', '', $namePart);
$token = Functions::encryptData((string)$profile['userid'], HASH_PASSWORD_KEY);
$this->view->UserSlug = $namePart . '.' . $token;
}
}
}
}