'; } // --------------------------------------------------------------------------- // CONTENT // --------------------------------------------------------------------------- function scn01_content() { if (function_exists('head_add_css')) { head_add_css('/addon/scn01/view/css/scn01.css'); } if (function_exists('head_add_js')) { head_add_js('/addon/scn01/view/js/scn01.js'); } $association_slug = argv(1) ?? ''; $access = scn01_access_state($association_slug); // scn01 is public — access wall only gates submission, not reading if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($access === 'public') { return scn01_access_wall($association_slug); } // TODO: handle POST submission return scn01_access_wall($association_slug); } return scn01_render_main($access); } // --------------------------------------------------------------------------- // RENDER // --------------------------------------------------------------------------- function scn01_render_main($access) { $out = '
'; $out .= '
'; $out .= '

Scenarios

'; $out .= '

Browse diagnostic scenarios. When you find one close to your situation, submit your account in your own words.

'; $out .= '
'; // TODO: render scenarios $out .= '
Content forthcoming.
'; $out .= '
'; return $out; } // --------------------------------------------------------------------------- // CONFIG // --------------------------------------------------------------------------- function scn01_load_config() { $path = 'addon/scn01/config.json'; $raw = @file_get_contents($path); if ($raw === false) return []; $data = json_decode($raw, true); return (json_last_error() === JSON_ERROR_NONE) ? $data : []; } // --------------------------------------------------------------------------- // CSRF // --------------------------------------------------------------------------- function scn01_csrf_token() { if (empty($_SESSION['scn01_csrf'])) { $_SESSION['scn01_csrf'] = bin2hex(random_bytes(16)); } return ''; } function scn01_verify_csrf() { return isset($_POST['scn01_csrf'], $_SESSION['scn01_csrf']) && hash_equals($_SESSION['scn01_csrf'], $_POST['scn01_csrf']); }