Files
MyKeyser/index.php
T
Ty Clifford 25327e3302 - [index.php](/Users/tyemeclifford/Documents/GH/MyKeyser/index.php): events now appear before featured businesses, plus forum pretty-route fallback.
[events.php](/Users/tyemeclifford/Documents/GH/MyKeyser/events.php) and 
[admin/events.php](/Users/tyemeclifford/Documents/GH/MyKeyser/admin/events.php): 
event image uploads.
[menu.php](/Users/tyemeclifford/Documents/GH/MyKeyser/menu.php), 
[admin/menus.php](/Users/tyemeclifford/Documents/GH/MyKeyser/admin/menus.php), 
and 
[business.php](/Users/tyemeclifford/Documents/GH/MyKeyser/business.php): 
one configurable menu item image slot.
[account.php](/Users/tyemeclifford/Documents/GH/MyKeyser/account.php): 
circular avatar upload and crop controls.
[forum.php](/Users/tyemeclifford/Documents/GH/MyKeyser/forum.php), 
[admin/forum.php](/Users/tyemeclifford/Documents/GH/MyKeyser/admin/forum.php), 
[.htaccess](/Users/tyemeclifford/Documents/GH/MyKeyser/.htaccess), and 
[forum/index.php](/Users/tyemeclifford/Documents/GH/MyKeyser/forum/index.php): 
forum, categories, topic/reply uploads, permalinks, toggle/moderation.
[includes/db.php](/Users/tyemeclifford/Documents/GH/MyKeyser/includes/db.php) 
and 
[includes/functions.php](/Users/tyemeclifford/Documents/GH/MyKeyser/includes/functions.php): 
schema upgrades and shared upload/image helpers.
[assets/css/style.css](/Users/tyemeclifford/Documents/GH/MyKeyser/assets/css/style.css): 
neon styling for forum, images, avatars, attachments.
2026-06-19 10:49:48 -04:00

234 lines
10 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
$__requestPath = (string)(parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH) ?? '');
if (preg_match('#^/forum/[^/]+/?$#', $__requestPath)) {
require __DIR__.'/forum.php';
exit;
}
require_once __DIR__.'/includes/boot.php';
$pageTitle='Discover Keyser WV — The Friendliest City in the U.S.A.';
$activeNav='home';
$alerts=qall("SELECT a.*,b.name bname,b.id bid,b.slug bslug FROM alerts a JOIN businesses b ON b.id=a.business_id WHERE a.is_active=1 ORDER BY a.created_at DESC LIMIT 4");
$featured=qall("SELECT b.*,c.name cat,c.icon cat_icon,COALESCE(AVG(r.rating),0) avg,COUNT(r.id) rcnt FROM businesses b JOIN categories c ON c.id=b.category_id LEFT JOIN reviews r ON r.business_id=b.id AND r.is_approved=1 WHERE b.is_active=1 AND b.is_featured=1 GROUP BY b.id ORDER BY avg DESC,rcnt DESC,b.name LIMIT 6");
$totalBiz=(int)qval("SELECT COUNT(*) FROM businesses WHERE is_active=1");
$upevts=qall("SELECT * FROM events WHERE status='approved' AND event_date>=date('now') ORDER BY is_featured DESC,event_date ASC LIMIT 4");
$randomInterval = setting('home_random_interval','2hours');
$slotKey = $randomInterval === 'day' ? date('Y-m-d') : (string)floor(time() / 7200);
$rotationLabel = $randomInterval === 'day' ? 'Refreshes daily' : 'Refreshes every two hours';
$randomPool = qall("
SELECT b.*,c.name cat,c.icon cat_icon,COALESCE(AVG(r.rating),0) avg,COUNT(r.id) rcnt
FROM businesses b
JOIN categories c ON c.id=b.category_id
LEFT JOIN reviews r ON r.business_id=b.id AND r.is_approved=1
WHERE b.is_active=1
GROUP BY b.id
");
usort($randomPool, fn($a,$b) => strcmp(hash('sha256',$slotKey.'-'.$a['id']), hash('sha256',$slotKey.'-'.$b['id'])));
$randomBiz = array_slice($randomPool, 0, 8);
include __DIR__.'/includes/header.php';
?>
<section class="home-hero">
<div class="home-hero-glow"></div>
<div class="home-hero-grid">
<div class="home-hero-copy">
<div class="hero-eyebrow">MINERAL COUNTY · WEST VIRGINIA</div>
<h1 class="hero-h1">DISCOVER<span class="gld">KEYSER</span></h1>
<p class="hero-desc">This place is new. Sign up to claim your business, submit corrections and events!</p>
<form action="/directory.php" method="GET" class="hero-search">
<span class="s-icon">⌕</span>
<input class="search-input" type="text" name="q" placeholder="Search restaurants, shops, services...">
<button class="btn btn-primary">Search</button>
</form>
<div class="hero-actions">
<a href="/directory.php" class="btn btn-outline">View Directory</a>
<a href="/events.php" class="btn btn-secondary">Upcoming Events</a>
<?php if(!authed() && setting('registration_enabled','1')==='1'): ?>
<a href="/register.php" class="btn btn-primary">Join or Claim a Page</a>
<?php endif; ?>
</div>
</div>
<div class="hero-signal">
<div class="signal-card signal-card-main">
<div class="signal-label">Live Directory</div>
<div class="signal-number"><?=$totalBiz?></div>
<div class="signal-copy">active Keyser business listings</div>
</div>
<div class="signal-mini-grid">
<?php foreach([['1874','Founded'],['809 ft','Elevation'],['WVU','Potomac State'],['North Branch','Potomac River']] as [$n,$l]): ?>
<div class="signal-card">
<div class="signal-small"><?=$n?></div>
<div class="signal-copy"><?=$l?></div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</section>
<?php if($alerts): ?>
<div class="alert-strip neon-alerts">
<div class="alert-strip-inner">
<div class="eyebrow">LOCAL BUSINESS SIGNALS</div>
<?php foreach($alerts as $a): ?>
<div class="alert-item a-<?=e($a['type'])?>">
<div class="alert-ico"><?=alertIcon($a['type'] ?? '')?></div>
<div>
<div class="alert-title"><?=e($a['title'])?></div>
<div class="alert-body"><?=e($a['body'])?></div>
<div class="alert-meta">From <a href="/business.php?slug=<?=e($a['bslug'])?>"><?=e($a['bname'])?></a> · <?=ago($a['created_at'] ?? '')?></div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<div class="home-band">
<div class="section">
<div class="section-head">
<div>
<div class="eyebrow">UPCOMING EVENTS</div>
<h2 class="sec-title">Whats Happening Around Keyser</h2>
</div>
<a href="/events.php" class="btn btn-outline btn-sm">All Events</a>
</div>
<?php if($upevts): ?>
<div class="event-strip">
<?php foreach($upevts as $ev): ?>
<div class="evt-card">
<?php if(!empty($ev['image_path'])): ?>
<div class="evt-image-wrap"><img src="<?=e($ev['image_path'])?>" alt="<?=e($ev['title'])?>" class="evt-image"></div>
<?php endif; ?>
<div class="evt-date-box">
<div class="evt-mon"><?=strtoupper(date('M',strtotime($ev['event_date'])))?></div>
<div class="evt-day"><?=date('j',strtotime($ev['event_date']))?></div>
<div class="evt-yr"><?=date('Y',strtotime($ev['event_date']))?></div>
</div>
<div class="evt-body">
<div class="evt-title"><?=e($ev['title'])?><?php if($ev['is_featured']): ?> <span class="featured-badge">FEATURED</span><?php endif; ?></div>
<div class="evt-meta">
<?php if($ev['venue']): ?><span><?=e($ev['venue'])?></span><?php endif; ?>
<?php if($ev['event_time']): ?><span><?=e($ev['event_time'])?></span><?php endif; ?>
<span><?=e($ev['cost'])?></span>
</div>
<div class="evt-desc"><?=e(substr($ev['description'],0,160)).(strlen($ev['description'])>160?'...':'')?></div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<div class="empty event-empty">
<div class="empty-ico">◇</div>
<h3>No upcoming approved events yet</h3>
<p style="margin-top:.5rem;color:var(--text-d)">Community events will appear here as they are approved.</p>
</div>
<?php endif; ?>
<div class="text-center mt3">
<a href="/events.php?submit=1" class="btn btn-primary">Submit an Event</a>
</div>
</div>
</div>
<div class="section">
<div class="section-head">
<div>
<div class="eyebrow">FEATURED BUSINESS</div>
<h2 class="sec-title">Local Places in the Spotlight</h2>
</div>
<a href="/directory.php" class="btn btn-outline btn-sm">All Businesses</a>
</div>
<div class="g3">
<?php foreach($featured as $b): ?>
<a href="/business.php?slug=<?=e($b['slug'])?>" class="card-link">
<div class="biz-card neon-card">
<div class="biz-card-top">
<div class="cat-badge"><?=e($b['cat_icon'].' '.$b['cat'])?></div>
<span class="featured-badge">FEATURED</span>
<div class="biz-name"><?=e($b['name'])?></div>
<?php if($b['subcategory']): ?><div class="biz-sub"><?=e($b['subcategory'])?></div><?php endif; ?>
</div>
<div class="biz-card-body">
<div class="biz-desc"><?=e($b['description'])?></div>
<div class="biz-meta">
<?php if($b['address']): ?><div class="biz-meta-row"><span class="biz-meta-icon">◇</span><?=e($b['address'])?></div><?php endif; ?>
<?php if($b['phone']): ?><div class="biz-meta-row"><span class="biz-meta-icon">☎</span><?=e($b['phone'])?></div><?php endif; ?>
</div>
</div>
<div class="biz-card-foot">
<div class="flex-row" style="gap:.4rem">
<?=starDisplay((float)$b['avg'])?>
<span class="rat-score"><?=number_format((float)$b['avg'],1)?></span>
<span class="rat-cnt">(<?=$b['rcnt']?>)</span>
</div>
<span class="view-label">VIEW</span>
</div>
</div>
</a>
<?php endforeach; ?>
</div>
</div>
<div class="section about-split">
<div>
<div class="eyebrow">ABOUT KEYSER</div>
<h2 class="sec-title">Railroad Roots, River Views, Mountain Pace</h2>
<div class="prose">
<p>Keyser began as Paddy Town, then New Creek, before taking its current name in 1874 in honor of Baltimore &amp; Ohio Railroad leader William Keyser. The rail line shaped the citys downtown, its work ethic, and its role as Mineral Countys county seat.</p>
<p>Today the city sits where New Creek meets the North Branch Potomac River, with Potomac State College of WVU, local restaurants, small shops, healthcare, civic life, and outdoor access all close by.</p>
</div>
<a href="/about.php" class="btn btn-outline">Learn More About Keyser</a>
</div>
<div class="fact-grid home-facts">
<?php foreach([['Historic Core','Downtown, rail heritage, and civic landmarks'],['Outdoor Access','River routes, nearby trails, and mountain drives'],['College Town','Home to Potomac State College of WVU'],['Local Directory',$totalBiz.' active business pages and growing']] as [$lbl,$val]): ?>
<div class="fact-card">
<div class="fact-lbl"><?=e($lbl)?></div>
<div class="fact-val"><?=e($val)?></div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="section random-section">
<div class="section-head">
<div>
<div class="eyebrow">RANDOM LOCAL PICKS · <?=e(strtoupper($rotationLabel))?></div>
<h2 class="sec-title">Explore Something Different</h2>
</div>
<a href="/directory.php" class="btn btn-primary btn-sm">View All Businesses</a>
</div>
<div class="random-list">
<?php foreach($randomBiz as $b): ?>
<a href="/business.php?slug=<?=e($b['slug'])?>" class="random-row">
<span class="random-cat"><?=e($b['cat_icon'])?></span>
<span class="random-main">
<strong><?=e($b['name'])?></strong>
<em><?=e($b['cat'])?><?= $b['subcategory'] ? ' · '.e($b['subcategory']) : '' ?></em>
</span>
<span class="random-arrow">→</span>
</a>
<?php endforeach; ?>
</div>
<div class="text-center mt3">
<a href="/directory.php" class="btn btn-outline">Browse the Full Business Directory</a>
</div>
</div>
<div class="join-band">
<div>
<div class="eyebrow">BUSINESS OWNERS</div>
<h2>Claim your Keyser business page</h2>
<p>Create a business-owner account, choose the listing you manage, add a verification phone number, and submit first edits or a YouTube/Vimeo video for admin review.</p>
</div>
<?php if(!authed() && setting('registration_enabled','1')==='1'): ?>
<a href="/register.php" class="btn btn-primary">Start a Claim</a>
<?php else: ?>
<a href="/dashboard.php" class="btn btn-primary">Open Dashboard</a>
<?php endif; ?>
</div>
<?php include __DIR__.'/includes/footer.php'; ?>