diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2011-04-17 20:13:07 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2011-04-17 20:13:07 -0400 |
commit | 0077cb99704fe863cf731fc5cab792af2ede96c2 (patch) | |
tree | dd68f44971aa2aee821f588d33b250dcd2fe57e3 /admin/announcements | |
parent | e8b28c5e910d92cbec3d4baa6e98f025e8418d28 (diff) | |
download | bayonetcms-0077cb99704fe863cf731fc5cab792af2ede96c2.tar.gz |
Backporting retarded amount of changes outside of version control
Diffstat (limited to 'admin/announcements')
-rw-r--r-- | admin/announcements/functions.php | 132 | ||||
-rw-r--r-- | admin/announcements/index.php | 66 |
2 files changed, 99 insertions, 99 deletions
diff --git a/admin/announcements/functions.php b/admin/announcements/functions.php index f45a7e3..b089cf3 100644 --- a/admin/announcements/functions.php +++ b/admin/announcements/functions.php @@ -1,67 +1,67 @@ -<?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['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("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
- PageRedirect(2, "?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");
- $announcement = $db->FetchRow($result);
-
- ?>
- <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="processed" value="Submit Changes" /> </td></tr>
- </table>
- </form>
- <?php
-}
+<?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['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("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 + PageRedirect(2, "?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"); + $announcement = $db->FetchRow($result); + + ?> + <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="processed" 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 index 6b0874e..14d7710 100644 --- a/admin/announcements/index.php +++ b/admin/announcements/index.php @@ -1,34 +1,34 @@ -<?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/>.
- */
- ?>
-
- <div style="text-align:left;"><h2>- Edit Announcements</h2></div>
-
- <?php
-
-if(!defined("ADMIN_FILE"))
-{
- die("Access denied.");
-}
-
-include $basedir.'announcements/functions.php';
-?>
-<table class="panel" width="100%">
- <tr><td><?php EditAnnouncements(); ?></td></tr>
+<?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/>. + */ + ?> + + <div style="text-align:left;"><h2>- Edit Announcements</h2></div> + + <?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 |