* */ require_once "src/base.inc.php"; // Check if we need to login first... if (isset($_GET['moderate']) and !isset($_SESSION['currentUser'])) { header('Location: ' . $CONFIG['urlroot'].'/moderate/login.php'); exit(); } require_once "src/header.inc.php"; // Make sure we had a path info if (!isset($_SERVER['PATH_INFO'])) { errorNotFound(); } // Clean up the id in the path info. $id = substr($_SERVER['PATH_INFO'], 1, strpos($_SERVER['PATH_INFO'], '.') - 1); if (!is_numeric($id)) { errorNotFound(); } // Get the post. $post = Post::getById($id); if (!$post or (!isset($_SESSION['currentUser']) and $post->getStage() != 'approved')) { errorNotFound(); } if (isset($_SESSION['currentUser'])) { if ($post->getStage() != 'approved') { // Post waiting for approval... echo "
You are moderating this post: "; printf("approve " . " or reject." , $post->getid(), $post->getid()); // Print Source information printSourceInfo($post); echo "

return to moderation

"; echo "
"; } else { // Post already approved echo "
Administrative options:
"; printf("delete post
" . "reject post", $post->getid(), $post->getid()); printSourceInfo($post); echo "
"; } } // Display the post. echo "

". $post->getName(); if ($post->getPrice() != 0) { echo ' - $' . $post->getPrice(); } echo "

"; echo "

Category: " . $post->getCategory()->getName() . "

"; echo "

Date: ". date('r', $post->getTimestamp()) ."

"; echo "

Email: getPublicEmail() ."\">" . $post->getPublicEmail() ."

"; echo "

Location: ". $post->getLocation() ."

"; echo "

". str_replace("\n", '
', $post->getDescription()) ."

"; foreach ($post->getImages() as $imgid) { echo "

"; } require_once "src/footer.inc.php"; function printSourceInfo($post) { // Print Source information $source = $post->getSource(); if ($source !== false) { // Get source from source id $sourceObj = Source::getById($source); $source = $sourceObj->getName(); } else { // Get other $source = $post->getOtherSource(); } printf("

This post was posted by %s from %s.

", $post->getEmail(), $source); } function errorNotFound() { // Get the 404 page $page = Page::getByUrl('404'); if ($page) { echo $page->getContent(); } else { echo "Error: Page not found."; } require_once "src/footer.inc.php"; exit; } ?>