. */ /** * Note to anyone feeling the need to edit this file... * You MUST declare $db as global inside your functions in order access MySQL from here. */ function ListArticles($pageid){ global $db; $result = $db->Query("SELECT article_id,title FROM bayonet_articles WHERE `page_id` = $pageid ORDER BY `weight`"); $articles = $db->Fetch($result); echo ""; if(count($articles)==0){ echo "
There are no articles posted on this page.
"; return; } foreach($articles as $article) { if($_GET['aid'] == $article['article_id']) echo ''; else echo ''; ?> ^ v "; } function EditArticle($article_id){ global $db; //Grab the page from the database according to the $article_id passed to the function. // {{{ XXX: FIXME -- Needs to be re-written /* $result = $db->Query("SELECT title,text FROM bayonet_articles WHERE article_id = '$article_id'"); while(($row = $db->Fetch($result))!=false) { //We only want one row, so we don't have to $article[]... No foreach necessary. $article = $row; } */ // }}} ?>
Query("SELECT page_id,title FROM bayonet_pages"); echo 'Select page: '; // echo ""; } function NewPage() { global $db; if(isset($_POST['processed'])) { //Secure our data to prevent injection attacks. $title = addslashes($_POST['title']); $text = addslashes($_POST['text']); if(empty($title) || empty($text)) { echo "You must fill everything out before proceeding."; return; } //Update the database with the new data. $db->Query("INSERT INTO bayonet_pages SET title = '$title', text = '$text'"); echo "New page, '$title', has been added.\n"; //die, because we have completed what we wanted to do. return; } ?>

Add New Page

Title
Text
Query("UPDATE bayonet_pages SET title = '$title', text = '$text' WHERE page_id = '$page_id'"); echo "Page, '$title', has been edited.\n"; //die, because we have completed what we wanted to do. return; } $aid = $_GET['aid']; ?>
 View this Page','?load=page&id='.$page_id); ?>  Delete this Page','?load=admin&op=pages&delete='.$page_id); ?>

0){ EditArticle($aid); } ?>
Query("SELECT title FROM bayonet_pages WHERE page_id = '$page_id'"); $page = $db->Fetch($result); if(isset($_POST['proceed'])) { echo "Page '{$page['title']}', was deleted."; $db->Query("DELETE FROM bayonet_pages WHERE page_id = '$page_id' LIMIT 1"); return; } if(isset($_POST['cancel'])) { echo "User cancelled deletion of page: '{$page['title']}'"; return; } if($page_id == 1){ echo "You can not delete the home page."; return; } ?>
Are you SURE you want to delete the page titled: ''?