aboutsummaryrefslogtreecommitdiff
path: root/admin/announcements
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-20 13:38:08 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-20 13:38:08 -0500
commitbe4f83cd2a17a0ec05f5bce50c91befaafaa6e0c (patch)
tree6f20672cf5df66044b3fa9dd71fc3bcdc484abe6 /admin/announcements
parent1a619f2638a4f77fb8ea9557edeefb883d8c06f8 (diff)
downloadbayonetcms-be4f83cd2a17a0ec05f5bce50c91befaafaa6e0c.tar.gz
Test.
git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@376 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'admin/announcements')
-rw-r--r--admin/announcements/functions.php70
-rw-r--r--admin/announcements/index.php35
2 files changed, 105 insertions, 0 deletions
diff --git a/admin/announcements/functions.php b/admin/announcements/functions.php
new file mode 100644
index 0000000..2e55125
--- /dev/null
+++ b/admin/announcements/functions.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Bayonet Content Management System
+ * Copyright (C) 2008 Joseph Hunkeler & Evan O'Connell
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * 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 EditAnnouncements()
+{
+ global $db;
+
+ if(isset($_POST['announcementprocessed']))
+ {
+ //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("UPDATE bayonet_announcements SET title = '$title', text = '$text' WHERE announcement_id = 0");
+ echo "Announcement, '$title', has been edited.\n <br /><br /> Please wait while you are redirected. <br /><br />
+ <a href=\"?op=announcements\">Click here if you don't feel like waiting.</a>";
+
+ // 3 second redirect to go back to the edit page
+ echo "<meta http-equiv=\"Refresh\" content=\"3;url=?op=announcements\">";
+
+ //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_announcements WHERE announcement_id = 0");
+ while(($row = $db->Fetch($result))!=false)
+ {
+ //We only want one row, so we don't have to $article[]... No foreach necessary.
+ $announcement = $row;
+ }
+ ?>
+ <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
+ <table>
+ <tr><td>Announcement Title: <input type="text" name="title" value="<?php echo $announcement['title'] ?>" maxlength="50" size="30" /> </td></tr>
+ <tr><td> <textarea id="markItUp" rows="30" cols="80" name="text"><?php echo $announcement['text'] ?></textarea> </td></tr>
+ <tr><td> <input type="submit" name="announcementprocessed" value="Submit Changes" /> </td></tr>
+ </table>
+ </form>
+ <?php
+}
+?> \ No newline at end of file
diff --git a/admin/announcements/index.php b/admin/announcements/index.php
new file mode 100644
index 0000000..17b6003
--- /dev/null
+++ b/admin/announcements/index.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Xoma Content Management System
+ * Copyright (C) 2008 Joseph Hunkeler & Evan O'Connell
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+ ?>
+
+ <div style="text-align:left;"><h2>- Edit Announcements</h2></div>
+ -Maybe see if this can go into more depth (ie. selecting whether to display announcements or not and on what pages)<br /><br />
+
+ <?php
+
+if(!defined("ADMIN_FILE"))
+{
+ die("Access denied.");
+}
+
+include $basedir.'announcements/functions.php';
+?>
+<table class="panel" width="100%">
+ <tr><td><?php EditAnnouncements(); ?></td></tr>
+</table> \ No newline at end of file