. */ /** * 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`"); while(($row = $db->Fetch($result))!=false) { $articles[] = $row; } echo ""; ?>
 Add New Article','?op=pages&edit='.$pageid.'&newarticle=true'); ?>
No Articles Found.
"; return; } foreach($articles as $article) { if($_GET['aid'] == $article['article_id']) echo ''; else echo ''; ?> ^ v "; } function NewArticle($page_id) { global $db; if(isset($_POST['newarticleprocessed'])) { //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; } $weight = 0; $result = $db->Query("SELECT * FROM `bayonet_articles` WHERE `page_id` = $page_id ORDER BY `weight` DESC LIMIT 1"); while(($row = $db->Fetch($result))!=false) { $weight = $row['weight']; } $weight++; //Update the database with the new data. $db->Query("INSERT INTO `bayonet_articles` (`article_id` ,`page_id` ,`title` ,`text`, `weight`)VALUES (NULL , $page_id, '$title', '$text', '$weight')"); echo "New article, '$title', has been added.\n"; //die, because we have completed what we wanted to do. return; } ?>

Add New Article

Title:
Query("UPDATE bayonet_articles SET title = '$title', text = '$text' WHERE article_id = '$article_id'"); echo "Article, '$title', has been edited.\n

Please wait while you are redirected.

Click here if you don't feel like waiting."; // 3 second redirect to go back to the edit page //echo ""; PageRedirect(3,"?op=pages&edit={$_GET['edit']}&aid={$article_id}"); //die, because we have completed what we wanted to do. return; } //Grab the page from the database according to the $article_id passed to the function. $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; } ?>
Delete This Article
Query("SELECT title FROM bayonet_articles WHERE article_id = '$article_id'"); $article = $db->Fetch($result); if(isset($_POST['proceed'])) { echo "Article '{$article['title']}', was deleted."; $db->Query("DELETE FROM bayonet_articles WHERE article_id = '$article_id' LIMIT 1"); return; } if(isset($_POST['cancel'])) { echo "User cancelled deletion of article: '{$article['title']}'"; return; } ?>
Are you SURE you want to delete the article titled: ''?
   
Query("SELECT page_id,title FROM bayonet_pages"); while(($row = $db->Fetch($result))!=false) { $pages[] = $row; } echo ""; ?>
 Create New Page','?op=pages&create=true'); ?>
No Pages Found.
"; return; } foreach($pages as $page) { if($pid == $page['page_id']) echo ''; else echo ''; ?>  View this Page','../index.php?load=page&id='.$pid); ?>  Delete this Page','?op=pages&delete='.$pid); ?> "; } function NewPage() { global $db; if(isset($_POST['newpageprocessed'])) { //Secure our data to prevent injection attacks. $title = addslashes($_POST['title']); if(empty($title)) { echo "You must fill everything out before proceeding."; return; } //Update the database with the new data. $db->Query("INSERT INTO `bayonet_pages` (`page_id` ,`author_id` ,`page_created` ,`title` ,`text`)VALUES (NULL , '0',CURRENT_TIMESTAMP , '$title', '$text')"); echo "New page, '$title', has been added.\n"; //die, because we have completed what we wanted to do. return; } ?>

Add New Page

Title
Query("UPDATE bayonet_pages SET title = '$title' WHERE page_id = '$page_id'"); echo "Page, '$title', has been edited.\n"; //die, because we have completed what we wanted to do. return; } ?>
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: ''?
All articles attached to this page will be deleted as well.