diff --git a/public/admin.php b/public/admin.php index d83a97e..4347d82 100644 --- a/public/admin.php +++ b/public/admin.php @@ -57,6 +57,16 @@ $stmt = $pdo->prepare("SELECT * FROM municipalities WHERE slug = :slug"); $stmt->execute([':slug' => getenv('MUNICIPALITY_SLUG')]); $municipality = $stmt->fetch(); +// Loads News for Moderation +$stmt = $pdo->prepare(" + SELECT news_id, title, content, author_name, published_at, created_at + FROM news + WHERE municipality_id = :mid + ORDER BY published_at DESC +"); +$stmt->execute([':mid' => $municipality['municipality_id']]); +$news_items = $stmt->fetchAll(); + // Shows Login Page if not authenticated if ($page === 'login' || !is_admin()) { show_login_page($municipality, $login_error ?? null); @@ -312,15 +322,56 @@ $counts['total'] = count($all_contributions); - +