| Server IP : 188.114.96.3 / Your IP : 216.73.216.143 Web Server : Apache System : Linux sv058.home.net.pl 6.8.2 husak_dirty_pages_fix #1 SMP PREEMPT_DYNAMIC Tue Apr 2 22:06:51 CEST 2024 x86_64 User : ( 3194769) PHP Version : 8.5.12 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /test2.famaresto/inc/ |
Upload File : |
<?php
// Front-end page renderer for CMS pages (no DB). Requires /inc/pages.php from step2.
require_once __DIR__ . '/pages.php';
function cms_front_menu_items(): array {
// Update once here when you add more pages
return [
['label' => 'Home', 'href' => '/index.php'],
['label' => 'Szukaj', 'href' => '/szukaj/'],
['label' => 'Administracyjne', 'href' => '/adm/adm.php'],
['label' => 'Scientia', 'href' => '/scientia/scientia.php'],
['label' => 'Granty', 'href' => '/granty/granty.php'],
['label' => 'Dział Zbiorów', 'href' => '/zbiory/zbiory.php'],
['label' => 'Doktoranckie', 'href' => '/doktoranckie/doktoranckie.php'],
['label' => 'Media', 'href' => '/media/media.php'],
['label' => 'Sieć', 'href' => '/siec/siec.php'],
['label' => 'RODO', 'href' => '/rodo/rodo.php'],
// keep existing static page for now
['label' => 'Czas pracy', 'href' => '/czas-pracy.html'],
];
}
function cms_front_h($s): string {
return htmlspecialchars((string)$s, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}
function cms_render_page(string $slug, string $fallbackTitle): void {
header('Content-Type: text/html; charset=utf-8');
$page = cms_load_page($slug);
$title = trim((string)($page['title'] ?? ''));
if ($title === '') $title = $fallbackTitle;
?><!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= cms_front_h($title) ?> - ISEZ-ADM</title>
<style>
html, body { margin:0; padding:0; width:100%; min-height:100vh; overflow-x:hidden; }
body{ background-color:#f0f0df; font-family: Verdana, Arial, Helvetica, sans-serif; font-size:10pt; color:black; box-sizing:border-box; }
.menu-bar{ background:#D6D3C0; padding:12px 0; text-align:center; margin-bottom:25px; width:100%; box-sizing:border-box; }
.menu-bar a{ margin:0 8px; color:#3c001e; text-decoration:none; font-family:Arial, Helvetica, sans-serif; font-size:17px; font-weight:bold; white-space:nowrap; }
.menu-bar a:hover{ text-decoration:underline; color:green; }
.container{ width:100%; margin:0 auto; padding:0 20px 30px 20px; box-sizing:border-box; max-width:1100px; }
.section-header{ background:#D8D0B1; padding:12px 20px; font-family:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#000; margin:20px 0 15px 0; width:100%; box-sizing:border-box; border-radius:8px; }
.section-content{ padding:15px; margin:10px 0 25px 0; width:100%; box-sizing:border-box; background:#f8f8f0; border:1px solid #D8D0B1; border-radius:8px; }
.link-list{ list-style-type:none; padding-left:0; margin:0; width:100%; }
.link-list > li{ margin:8px 0; }
.link-list a{ color:#0E5C93; text-decoration:none; font-size:14px; line-height:1.5; }
.link-list a:hover{ text-decoration:underline; }
.note{ margin:8px 0 0 0; font-size:13px; opacity:.85; color:#333; }
.muted{ opacity:.75; }
@media (max-width: 600px){ .menu-bar a{display:inline-block;margin:6px 6px;font-size:15px;} .container{padding:0 14px 24px 14px;} }
</style>
</head>
<body>
<div class="menu-bar">
<?php
$items = cms_front_menu_items();
$parts = [];
foreach ($items as $it) {
$parts[] = '<a href="' . cms_front_h($it['href']) . '">' . cms_front_h($it['label']) . '</a>';
}
echo implode(' - ', $parts);
?>
</div>
<div class="container">
<?php $sections = $page['sections'] ?? []; if (!is_array($sections)) $sections = []; ?>
<?php if (count($sections) === 0): ?>
<div class="section-content muted">Brak treści dla tej strony. Wejdź do panelu: <a href="/admin/page_edit.php?slug=<?= cms_front_h($slug) ?>">Edycja</a>.</div>
<?php endif; ?>
<?php foreach ($sections as $sec): ?>
<div class="section-header"><?= cms_front_h($sec['title'] ?? '') ?></div>
<div class="section-content">
<?php $note = trim((string)($sec['note'] ?? '')); if ($note !== ''): ?>
<div class="note"><?= nl2br(cms_front_h($note)) ?></div>
<?php endif; ?>
<?php $items = $sec['items'] ?? []; if (is_array($items) && count($items) > 0): ?>
<ul class="link-list">
<?php foreach ($items as $it): ?>
<li><a href="<?= cms_front_h($it['href'] ?? '') ?>"><?= cms_front_h($it['title'] ?? '') ?></a></li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<div class="note muted">Brak linków w tej sekcji.</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
</body>
</html>
<?php
}