Siteβ―Builder
Editing:
indexyyyyyyyy.php
writable 0666
<?php /************************************************************************** * BUSINESS PROFILE INDEX β v8.0 (futuristic theme + userβorder) * © 2025Β BestDealOn β free to modify. **************************************************************************/ declare(strict_types=1); require_once $_SERVER['DOCUMENT_ROOT'].'/pages/lib/helpers.php'; /* βββ profile & helpers (unchanged) βββ */ $profile = get_profile(); function h(string $s):string{return htmlspecialchars($s,ENT_QUOTES,'UTF-8');} function ss(string $st):string{return strtoupper(trim($st));} function cs(string $c):string {return strtolower(str_replace(' ','-',$c));} function fp(string $n):string{$d=preg_replace('/\D/','',$n); return strlen($d)===10?sprintf('(%s) %sβ%s',substr($d,0,3),substr($d,3,3),substr($d,6)):$n;} /* basic fields */ $name = $profile['display_name'] ?? 'Business'; $slogan = $profile['slogan'] ?? ''; $desc = $profile['description'] ?? ''; $addr = $profile['address'] ?? ''; $city = $profile['city'] ?? ''; $state = $profile['state'] ?? ''; $zip = $profile['zip'] ?? ''; $phone = $profile['phone'] ?? ''; $site = $profile['website'] ?? ''; $country= 'USA'; $stateslug = ss($state); $cityslug = cs($city); $metaTitle = "$name in $city, $state | BestDealOn"; $metaDesc = $desc ?: ($slogan ?: $name); $canonical = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; /* βββββββββββββββββββββββββββββββββββββββββββββββ * MODULES REGISTRY β honours perβuser order + admin locks * βββββββββββββββββββββββββββββββββββββββββββββββ */ $root = $_SERVER['DOCUMENT_ROOT']; $modDir = "$root/pages/modules"; $gCfg = "$modDir/modules.json"; // global master $lCfg = __DIR__.'/config.json'; // perβprofile config $gMods = is_readable($gCfg) ? json_decode(file_get_contents($gCfg), true) : []; $globalByName = $adminActive = []; foreach ($gMods as $row) { $globalByName[$row['name']] = $row; $adminActive[$row['name']] = !empty($row['active']); } /* user file may be {"modules":[β¦]} or legacy list */ $localRows = []; $localRaw = is_readable($lCfg) ? json_decode(file_get_contents($lCfg), true) : []; if (is_array($localRaw)) { $rows = $localRaw['modules'] ?? $localRaw; foreach ($rows as $row) if (isset($row['name'])) $localRows[$row['name']] = $row; } /* ordered names */ $orderNames = array_keys($localRows) ?: array_keys($globalByName); foreach ($globalByName as $n=>$_) if (!in_array($n,$orderNames,true)) $orderNames[]=$n; /* merged + filtered */ $modules=[]; foreach ($orderNames as $n){ if(!isset($globalByName[$n])) continue; $g=$globalByName[$n]; $u=$localRows[$n]??[]; $want = array_key_exists('active',$u) ? !empty($u['active']) : !empty($g['active']); $active = ($adminActive[$n]??true) && $want; if($active) $modules[] = array_merge($g,$u); } ?> <!doctype html><html lang="en"><head> <meta charset="utf-8"> <title><?=h($metaTitle)?></title> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="description" content="<?=h($metaDesc)?>"> <link rel="canonical" href="<?=h($canonical)?>"> <style> /* βββ palette βββ */ :root{ --bg-edge:#e9edf6; --bg-centre:#fdfdff; --accent:#2463ff; --accent-dark:#153aa8; --text:#1b334a; --muted:#59728c; font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif; } /* βββ global layout βββ */ html,body{margin:0;padding:0;background: linear-gradient(90deg,var(--bg-edge) 0 160px,var(--bg-centre) 160px calc(100% - 160px),var(--bg-edge) calc(100% - 160px) 100%); color:var(--text);} @media(max-width:900px){ html,body{background:var(--bg-centre);} } .top-bar{ display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap; gap:.45rem;padding:.55rem 1rem;background:#f0f2f8;font-size:.92rem} .logo{font-weight:900;letter-spacing:-.5px;color:var(--accent);text-decoration:none} .breadcrumb a{color:var(--accent);text-decoration:none}.breadcrumb span{margin:0 .25rem} /* βββ business card βββ */ .card{ max-width:680px;margin:2.2rem auto 1.8rem;background:#fff;border-radius:24px; box-shadow:0 8px 24px rgba(31,61,138,.08);padding:2.2rem 2rem;text-align:center; } .card h1{margin:.1em 0;font-size:2.1rem;font-weight:900;color:var(--accent-dark)} .card .slogan{margin:.35rem auto 0;font-size:1.15rem;font-weight:600;color:var(--muted)} details.contact{margin-top:1.4rem;font-size:.95rem;text-align:left} details.contact summary{ cursor:pointer;list-style:none;font-weight:700;color:var(--accent-dark); display:flex;justify-content:center;gap:.5rem;align-items:center} details.contact summary::after{ content:"βΎ";transition:transform .25s} details.contact[open] summary::after{transform:rotate(180deg)} .contact-content{margin-top:.9rem;line-height:1.55;color:var(--text)} .contact-content a{color:var(--accent);text-decoration:none} /* βββ modules feed βββ */ .modules{ max-width:760px;margin:0 auto 2.2rem;padding:0 1rem;display:flex;flex-direction:column;gap:1.4rem} .mod-card{background:#fff;border-radius:20px;box-shadow:0 6px 20px rgba(30,60,120,.07);padding:1.6rem} .mod-card > *:first-child{margin-top:0} .mod-card > *:last-child{margin-bottom:0} /* darkΒ mode flicker guard */ @media (prefers-color-scheme:dark){ :root{--bg-edge:#10131a;--bg-centre:#131720;--text:#d4d8e4;--muted:#9aa5bf} body{color:var(--text);} .card,.mod-card{background:#1a1f2b;box-shadow:0 6px 18px #0004} .top-bar{background:#1a1f2b} } </style> </head><body> <!-- top bar --> <div class="top-bar"> <a class="logo" href="/">BESTΒ DEALΒ ON</a> <nav class="breadcrumb" aria-label="Breadcrumb"> <a href="/">Index</a><span>/</span> <a href="/geo/<?=h($country)?>/<?=h($stateslug)?>/"><?=h($stateslug)?></a><span>/</span> <?php if($city):?> <a href="/geo/<?=h($country)?>/<?=h($stateslug)?>/<?=h($cityslug)?>/"><?=h($city)?></a><span>/</span> <?php endif;?> <span><?=h($name)?></span> </nav> </div> <!-- business card --> <section class="card"> <h1><?=h($name)?></h1> <?php if($slogan):?><p class="slogan"><?=h($slogan)?></p><?php endif;?> <details class="contact"> <summary>ContactΒ Info</summary> <div class="contact-content"> <?php if($addr||$city||$state||$zip):?> <p><?=h($addr)?><?php if($addr):?><br><?php endif;?> <?=h(trim(($city?$city.', ':'').$state.' '.$zip))?></p> <?php endif;?> <?php if($phone):?><p><strong>Phone:</strong> <a href="tel:<?=preg_replace('/\D/','',$phone)?>"><?=h(fp($phone))?></a></p><?php endif;?> <?php if($site):?><p><strong>Website:</strong> <a href="<?=h($site)?>" target="_blank"><?=h($site)?></a></p><?php endif;?> </div> </details> <?php if($desc):?> <p style="margin-top:1.6rem;line-height:1.55;color:var(--text);"><?=h($desc)?></p> <?php endif;?> </section> <!-- modules --> <main class="modules"> <?php foreach ($modules as $mod) { if (empty($mod['relative_path'])) continue; $abs = $modDir.'/'.$mod['relative_path']; if (!is_file($abs)) continue; echo "<section class='mod-card'>"; try { include $abs; } catch (Throwable $e){ echo '<p style="color:#c00">Module β'.h($mod['name']).'β failed.</p>'; } echo "</section>"; } ?> </main> </body></html>
Save changes
Create folder
writable 0777
Create
Cancel