- Public display
This commit is contained in:
+23
-1
@@ -2,6 +2,26 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../app/bootstrap.php';
|
||||
|
||||
if (!app_admin_area_enabled()) {
|
||||
http_response_code(404);
|
||||
$pageTitle = 'Admin Unavailable | Medical Tracker';
|
||||
$activePage = '';
|
||||
require __DIR__ . '/partials/site-header.php';
|
||||
?>
|
||||
<main>
|
||||
<section class="admin-public-shell record-shell">
|
||||
<p class="site-eyebrow">Private area disabled</p>
|
||||
<h1>Admin is not available.</h1>
|
||||
<p>This public site is currently configured for reference browsing only.</p>
|
||||
<a class="site-primary" href="/">Return home</a>
|
||||
</section>
|
||||
</main>
|
||||
<?php
|
||||
require __DIR__ . '/partials/site-footer.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
app_db();
|
||||
|
||||
$pageTitle = 'Admin Dashboard | Medical Tracker';
|
||||
@@ -21,7 +41,9 @@ require __DIR__ . '/partials/site-header.php';
|
||||
<span>Acting profile</span>
|
||||
<select id="adminProfileSelect"></select>
|
||||
</label>
|
||||
<a class="site-secondary" href="/tracker.php">Open tracker</a>
|
||||
<?php if (app_tracker_area_enabled()): ?>
|
||||
<a class="site-secondary" href="/tracker.php">Open tracker</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="admin-denied" id="adminDenied" hidden>
|
||||
|
||||
@@ -8,6 +8,10 @@ try {
|
||||
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
|
||||
|
||||
if ($method === 'GET' && $action === 'state') {
|
||||
if (!app_private_tools_enabled()) {
|
||||
json_response(['error' => 'Private tracker/admin tools are disabled for this public site.'], 403);
|
||||
exit;
|
||||
}
|
||||
json_response(state_payload($_GET));
|
||||
exit;
|
||||
}
|
||||
@@ -23,6 +27,31 @@ try {
|
||||
}
|
||||
|
||||
$data = json_input();
|
||||
$adminActions = [
|
||||
'create_user' => true,
|
||||
'update_user' => true,
|
||||
'delete_user' => true,
|
||||
'refresh_medication_sources' => true,
|
||||
];
|
||||
$trackerActions = [
|
||||
'update_theme' => true,
|
||||
'create_exercise' => true,
|
||||
'create_supplement' => true,
|
||||
'create_nutrition_goal' => true,
|
||||
'create_routine' => true,
|
||||
'create_workout' => true,
|
||||
'update_workout' => true,
|
||||
'create_nutrition_log' => true,
|
||||
'create_supplement_log' => true,
|
||||
'create_body_metric' => true,
|
||||
'create_medication_log' => true,
|
||||
'create_vital_log' => true,
|
||||
'create_lab_result' => true,
|
||||
'create_symptom_log' => true,
|
||||
'create_allergy_record' => true,
|
||||
'create_appointment' => true,
|
||||
'create_immunization_record' => true,
|
||||
];
|
||||
$routes = [
|
||||
'create_user' => 'create_user',
|
||||
'update_user' => 'update_user',
|
||||
@@ -52,6 +81,16 @@ try {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($adminActions[$action]) && !app_admin_area_enabled()) {
|
||||
json_response(['error' => 'Admin tools are disabled for this public site.'], 403);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($trackerActions[$action]) && !app_tracker_area_enabled()) {
|
||||
json_response(['error' => 'Tracker tools are disabled for this public site.'], 403);
|
||||
exit;
|
||||
}
|
||||
|
||||
json_response($routes[$action]($data));
|
||||
} catch (InvalidArgumentException $exception) {
|
||||
json_response(['error' => $exception->getMessage()], 400);
|
||||
|
||||
@@ -52,7 +52,9 @@ require __DIR__ . '/partials/site-header.php';
|
||||
<p><?= htmlspecialchars((string) $condition['overview'], ENT_QUOTES) ?></p>
|
||||
</div>
|
||||
<div class="record-actions">
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
<?php if (app_tracker_area_enabled()): ?>
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
<?php endif; ?>
|
||||
<a class="site-secondary" href="/workouts.php?q=<?= rawurlencode((string) $condition['name']) ?>">Condition search</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+35
-27
@@ -11,6 +11,8 @@ $totalTerms = (int) db_value($pdo, 'SELECT COUNT(*) FROM medical_terms');
|
||||
$totalSymptoms = (int) db_value($pdo, 'SELECT COUNT(*) FROM medical_symptoms');
|
||||
$totalConditions = (int) db_value($pdo, 'SELECT COUNT(*) FROM medical_conditions');
|
||||
$totalStudies = (int) db_value($pdo, 'SELECT COUNT(*) FROM research_studies');
|
||||
$trackerAreaEnabled = app_tracker_area_enabled();
|
||||
$adminAreaEnabled = app_admin_area_enabled();
|
||||
|
||||
require __DIR__ . '/partials/site-header.php';
|
||||
?>
|
||||
@@ -19,7 +21,7 @@ require __DIR__ . '/partials/site-header.php';
|
||||
<div class="site-section-heading">
|
||||
<p class="site-eyebrow">Medical reference</p>
|
||||
<h1>Medicines, symptoms, terminology, conditions, and NIH/NLM study links.</h1>
|
||||
<p>Search the reference database or open the tracker/admin tools for profile-managed medical logs.</p>
|
||||
<p>Search the public reference database for medicine, condition, symptom, terminology, and research links.</p>
|
||||
</div>
|
||||
|
||||
<form class="library-search" method="get" action="/medical.php">
|
||||
@@ -78,31 +80,37 @@ require __DIR__ . '/partials/site-header.php';
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="admin-public-shell">
|
||||
<div class="site-section-heading">
|
||||
<p class="site-eyebrow">Profile tools</p>
|
||||
<h2>Manage medical logs through Tracker and Admin.</h2>
|
||||
</div>
|
||||
<div class="library-list">
|
||||
<article class="library-row">
|
||||
<div class="library-row-main">
|
||||
<h3>Tracker</h3>
|
||||
<p>Use existing profiles for medications, vitals, labs, symptoms, allergies, appointments, immunizations, and notes.</p>
|
||||
</div>
|
||||
<div class="library-row-actions">
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
</div>
|
||||
</article>
|
||||
<article class="library-row">
|
||||
<div class="library-row-main">
|
||||
<h3>Admin</h3>
|
||||
<p>Create, update, activate, deactivate, and remove profiles from the admin dashboard.</p>
|
||||
</div>
|
||||
<div class="library-row-actions">
|
||||
<a class="site-secondary" href="/admin.php">Manage profiles</a>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
<?php if ($trackerAreaEnabled || $adminAreaEnabled): ?>
|
||||
<section class="admin-public-shell">
|
||||
<div class="site-section-heading">
|
||||
<p class="site-eyebrow">Profile tools</p>
|
||||
<h2>Manage medical logs through enabled tools.</h2>
|
||||
</div>
|
||||
<div class="library-list">
|
||||
<?php if ($trackerAreaEnabled): ?>
|
||||
<article class="library-row">
|
||||
<div class="library-row-main">
|
||||
<h3>Tracker</h3>
|
||||
<p>Use existing profiles for medications, vitals, labs, symptoms, allergies, appointments, immunizations, and notes.</p>
|
||||
</div>
|
||||
<div class="library-row-actions">
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
<?php if ($adminAreaEnabled): ?>
|
||||
<article class="library-row">
|
||||
<div class="library-row-main">
|
||||
<h3>Admin</h3>
|
||||
<p>Create, update, activate, deactivate, and remove profiles from the admin dashboard.</p>
|
||||
</div>
|
||||
<div class="library-row-actions">
|
||||
<a class="site-secondary" href="/admin.php">Manage profiles</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
<?php require __DIR__ . '/partials/site-footer.php'; ?>
|
||||
|
||||
+3
-1
@@ -54,7 +54,9 @@ require __DIR__ . '/partials/site-header.php';
|
||||
<p><?= htmlspecialchars(medicine_used_for_text($medicine), ENT_QUOTES) ?></p>
|
||||
</div>
|
||||
<div class="record-actions">
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
<?php if (app_tracker_area_enabled()): ?>
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
<?php endif; ?>
|
||||
<a class="site-secondary" href="/nutrition.php?q=<?= rawurlencode((string) $medicine['generic_name']) ?>">Catalog search</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -26,7 +26,9 @@ require __DIR__ . '/partials/site-header.php';
|
||||
<p class="site-eyebrow">Medicine catalog</p>
|
||||
<h1>Search medicines by generic, chemical, brand, and alternate names.</h1>
|
||||
<p>The catalog includes common medicines and links each one to RxNorm, DailyMed, PubChem, MedlinePlus, PubMed, and ClinicalTrials.gov searches.</p>
|
||||
<a class="site-primary" href="/tracker.php">Open medical tracker</a>
|
||||
<?php if (app_tracker_area_enabled()): ?>
|
||||
<a class="site-primary" href="/tracker.php">Open medical tracker</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -3,10 +3,16 @@
|
||||
<strong>Medical Tracker</strong>
|
||||
<p>Medication logs, vitals, lab results, terminology, NIH/NLM study links, and admin-managed profiles.</p>
|
||||
</div>
|
||||
<div class="footer-links">
|
||||
<a href="/tracker.php">Open medical tracker</a>
|
||||
<a href="/admin.php">Admin dashboard</a>
|
||||
</div>
|
||||
<?php if (app_private_tools_enabled()): ?>
|
||||
<div class="footer-links">
|
||||
<?php if (app_tracker_area_enabled()): ?>
|
||||
<a href="/tracker.php">Open medical tracker</a>
|
||||
<?php endif; ?>
|
||||
<?php if (app_admin_area_enabled()): ?>
|
||||
<a href="/admin.php">Admin dashboard</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
$pageTitle = $pageTitle ?? 'Medical Tracker';
|
||||
$activePage = $activePage ?? '';
|
||||
$trackerAreaEnabled = app_tracker_area_enabled();
|
||||
$adminAreaEnabled = app_admin_area_enabled();
|
||||
function site_active(string $page, string $activePage): string
|
||||
{
|
||||
return $page === $activePage ? ' class="active"' : '';
|
||||
@@ -27,7 +29,11 @@ function site_active(string $page, string $activePage): string
|
||||
<a<?= site_active('symptoms', $activePage) ?> href="/symptoms.php">Symptoms</a>
|
||||
<a<?= site_active('research', $activePage) ?> href="/recovery.php">Research</a>
|
||||
<a<?= site_active('terminology', $activePage) ?> href="/medical.php">Terminology</a>
|
||||
<a href="/tracker.php">Tracker</a>
|
||||
<a href="/admin.php">Admin</a>
|
||||
<?php if ($trackerAreaEnabled): ?>
|
||||
<a href="/tracker.php">Tracker</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($adminAreaEnabled): ?>
|
||||
<a href="/admin.php">Admin</a>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
header('Location: /tracker.php', true, 302);
|
||||
require __DIR__ . '/../app/bootstrap.php';
|
||||
|
||||
header('Location: ' . (app_tracker_area_enabled() ? '/tracker.php' : '/'), true, 302);
|
||||
exit;
|
||||
|
||||
+3
-1
@@ -52,7 +52,9 @@ require __DIR__ . '/partials/site-header.php';
|
||||
<p><?= htmlspecialchars((string) $symptom['plain_language_description'], ENT_QUOTES) ?></p>
|
||||
</div>
|
||||
<div class="record-actions">
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
<?php if (app_tracker_area_enabled()): ?>
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
<?php endif; ?>
|
||||
<a class="site-secondary" href="/symptoms.php?q=<?= rawurlencode((string) $symptom['name']) ?>">Symptom search</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+3
-1
@@ -41,7 +41,9 @@ require __DIR__ . '/partials/site-header.php';
|
||||
<p><?= htmlspecialchars((string) $term['plain_language_definition'], ENT_QUOTES) ?></p>
|
||||
</div>
|
||||
<div class="record-actions">
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
<?php if (app_tracker_area_enabled()): ?>
|
||||
<a class="site-primary" href="/tracker.php">Open tracker</a>
|
||||
<?php endif; ?>
|
||||
<a class="site-secondary" href="/medical.php?q=<?= rawurlencode((string) $term['term']) ?>">Library search</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,26 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../app/bootstrap.php';
|
||||
|
||||
if (!app_tracker_area_enabled()) {
|
||||
http_response_code(404);
|
||||
$pageTitle = 'Tracker Unavailable | Medical Tracker';
|
||||
$activePage = '';
|
||||
require __DIR__ . '/partials/site-header.php';
|
||||
?>
|
||||
<main>
|
||||
<section class="admin-public-shell record-shell">
|
||||
<p class="site-eyebrow">Private area disabled</p>
|
||||
<h1>Tracker is not available.</h1>
|
||||
<p>This public site is currently configured for reference browsing only.</p>
|
||||
<a class="site-primary" href="/">Return home</a>
|
||||
</section>
|
||||
</main>
|
||||
<?php
|
||||
require __DIR__ . '/partials/site-footer.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
app_db();
|
||||
?>
|
||||
<!doctype html>
|
||||
|
||||
Reference in New Issue
Block a user