From 3ccbd69cbe42705e4ad85f81487bbb7d2755563e Mon Sep 17 00:00:00 2001 From: TheRON Date: Fri, 5 Jun 2026 14:52:59 -0400 Subject: [PATCH] Initial push --- hubzilla/addon/vs01/config.json.template | 6 + hubzilla/addon/vs01/mod_vs01.pdl | 14 ++ hubzilla/addon/vs01/vs01.apd | 7 + hubzilla/addon/vs01/vs01.php | 155 +++++++++++++++++++++++ 4 files changed, 182 insertions(+) create mode 100644 hubzilla/addon/vs01/config.json.template create mode 100644 hubzilla/addon/vs01/mod_vs01.pdl create mode 100644 hubzilla/addon/vs01/vs01.apd create mode 100644 hubzilla/addon/vs01/vs01.php diff --git a/hubzilla/addon/vs01/config.json.template b/hubzilla/addon/vs01/config.json.template new file mode 100644 index 0000000..328897e --- /dev/null +++ b/hubzilla/addon/vs01/config.json.template @@ -0,0 +1,6 @@ +{ + "_note": "Copy to config.json. Do not commit config.json — it contains secrets and installation-specific values.", + "corpus_builder_group_id": 0, + "listings_file": "REPLACE — absolute path to listings.json on the host", + "directory_default_tab": "core" +} diff --git a/hubzilla/addon/vs01/mod_vs01.pdl b/hubzilla/addon/vs01/mod_vs01.pdl new file mode 100644 index 0000000..2bb989c --- /dev/null +++ b/hubzilla/addon/vs01/mod_vs01.pdl @@ -0,0 +1,14 @@ +[template]default[/template] + +[region=aside] +[widget=vs01][/widget] +[/region] + +[region=content] +$content +[/region] + +[region=right_aside] +[widget=notifications][/widget] +[widget=newmember][/widget] +[/region] diff --git a/hubzilla/addon/vs01/vs01.apd b/hubzilla/addon/vs01/vs01.apd new file mode 100644 index 0000000..07f08f0 --- /dev/null +++ b/hubzilla/addon/vs01/vs01.apd @@ -0,0 +1,7 @@ +version: 2 +url: $baseurl/vs01 +requires: local_channel +name: Vital Signs +photo: icon:heart-pulse +categories: Civic Diagnostics +desc: The ten structural preconditions of an HOA association. Public-facing diagnostic reference. diff --git a/hubzilla/addon/vs01/vs01.php b/hubzilla/addon/vs01/vs01.php new file mode 100644 index 0000000..3635197 --- /dev/null +++ b/hubzilla/addon/vs01/vs01.php @@ -0,0 +1,155 @@ + + + + '; +} + +// ---------------------------------------------------------------------------- +// CONTENT +// ---------------------------------------------------------------------------- + +function vs01_content() { + if (function_exists('head_add_css')) { + head_add_css('/addon/vs01/view/css/vs01.css'); + } + if (function_exists('head_add_js')) { + head_add_js('/addon/vs01/view/js/vs01.js'); + } + + $access = vs01_access_state(); + + // vs01 is public — access wall only gates submission, not reading + if ($_SERVER['REQUEST_METHOD'] === 'POST') { + if ($access === 'public' || $access === 'denied') { + return vs01_access_wall(); + } + // TODO: handle POST submission + return vs01_access_wall(); + } + + return vs01_render_main($access); +} + +// ---------------------------------------------------------------------------- +// RENDER +// ---------------------------------------------------------------------------- + +function vs01_render_main($access) { + $out = '
'; + $out .= '
'; + $out .= '

Vital Signs

'; + $out .= '

The ten structural preconditions of an HOA association.

'; + $out .= '
'; + + // TODO: render the ten Vital Signs + + $out .= '
Content forthcoming.
'; + $out .= '
'; + + return $out; +} + +// ---------------------------------------------------------------------------- +// CONFIG +// ---------------------------------------------------------------------------- + +function vs01_load_config() { + $path = 'addon/vs01/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 vs01_csrf_token() { + if (empty($_SESSION['vs01_csrf'])) { + $_SESSION['vs01_csrf'] = bin2hex(random_bytes(16)); + } + return ''; +} + +function vs01_verify_csrf() { + return isset($_POST['vs01_csrf'], $_SESSION['vs01_csrf']) + && hash_equals($_SESSION['vs01_csrf'], $_POST['vs01_csrf']); +}