| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,110 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+// ---------------------------------------------------------------------- |
|
| 4 |
+// eFiction 3.2 |
|
| 5 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 6 |
+// Valid HTML 4.01 Transitional |
|
| 7 |
+// Based on eFiction 1.1 |
|
| 8 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 9 |
+// http://efiction.sourceforge.net/ |
|
| 10 |
+// ---------------------------------------------------------------------- |
|
| 11 |
+// LICENSE |
|
| 12 |
+// |
|
| 13 |
+// This program is free software; you can redistribute it and/or |
|
| 14 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 15 |
+// as published by the Free Software Foundation; either version 2 |
|
| 16 |
+// of the License, or (at your option) any later version. |
|
| 17 |
+// |
|
| 18 |
+// This program is distributed in the hope that it will be useful, |
|
| 19 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 20 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 21 |
+// GNU General Public License for more details. |
|
| 22 |
+// |
|
| 23 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 24 |
+// ---------------------------------------------------------------------- |
|
| 25 |
+ |
|
| 26 |
+if (!defined("_CHARSET")) exit();
|
|
| 27 |
+if (uLEVEL > 3) accessDenied(); |
|
| 28 |
+$output .= "<div id=\"pagetitle\">" . _NEWS . "</div>"; |
|
| 29 |
+if (isset($_POST['submit'])) |
|
| 30 |
+{
|
|
| 31 |
+ $title = addslashes(strip_tags(descript($_POST['title']), $allowed_tags)); |
|
| 32 |
+ $author = addslashes(strip_tags(descript($_POST['author']), $allowed_tags)); |
|
| 33 |
+ $story = addslashes(strip_tags(descript($_POST['story']), $allowed_tags)); |
|
| 34 |
+ $time = time(); |
|
| 35 |
+ if ($_GET['form'] == "new") $result = dbquery("INSERT INTO " . TABLEPREFIX . "fanfiction_news (title, author, story, time) VALUES ('$title', '$author', '$story', '$time')");
|
|
| 36 |
+ else $result = dbquery("UPDATE " . TABLEPREFIX . "fanfiction_news
|
|
| 37 |
+ SET title = '$title', author = '$author', story = '$story' WHERE nid = '$_POST[nid]'"); |
|
| 38 |
+ if ($result) |
|
| 39 |
+ {
|
|
| 40 |
+ $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 41 |
+ unset($_GET['form']); |
|
| 42 |
+ } |
|
| 43 |
+ else $output .= write_error(_ERROR . " " . TRYAGAIN); |
|
| 44 |
+} |
|
| 45 |
+if (isset($_GET['delete']) && isNumber($_GET['delete'])) |
|
| 46 |
+{
|
|
| 47 |
+ if (isset($_GET['confirm'])) |
|
| 48 |
+ {
|
|
| 49 |
+ if ($_GET['confirm'] == "yes") |
|
| 50 |
+ {
|
|
| 51 |
+ dbquery("DELETE FROM " . TABLEPREFIX . "fanfiction_news where nid = '" . $_GET['delete'] . "'");
|
|
| 52 |
+ $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 53 |
+ } |
|
| 54 |
+ else if ($_GET['confirm'] == "no") $output .= write_message(_ACTIONCANCELLED); |
|
| 55 |
+ } |
|
| 56 |
+ else |
|
| 57 |
+ {
|
|
| 58 |
+ $output .= write_message(_CONFIRMDELETE . "<br /><br /> |
|
| 59 |
+ [ <a href=\"admin.php?action=news&confirm=yes&delete=$_GET[delete]\">" . _YES . "</a> | <a href=\"admin.php?action=news&confirm=no&delete=$_GET[delete]\">" . _NO . "</a> ]"); |
|
| 60 |
+ } |
|
| 61 |
+} |
|
| 62 |
+else if (isset($_GET["form"])) |
|
| 63 |
+{
|
|
| 64 |
+ if ($_GET["form"] != "new" && isNumber($_GET["form"])) |
|
| 65 |
+ {
|
|
| 66 |
+ $result = dbquery("SELECT * FROM " . TABLEPREFIX . "fanfiction_news WHERE nid = '" . $_GET['form'] . "' LIMIT 1");
|
|
| 67 |
+ $newsitem = dbassoc($result); |
|
| 68 |
+ } |
|
| 69 |
+ else $newsitem = array("title" => "", "author" => "", "story" => "");
|
|
| 70 |
+ $output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=news&form=$_GET[form]\"> |
|
| 71 |
+ <table align=\"center\"><tr><td colspan=\"2\" align=\"center\"><b>" . ($_GET["form"] == "new" ? _ADDNEWS : _EDITNEWS) . "</b></td></tr> |
|
| 72 |
+ <tr><td>" . _AUTHOR . ": </td><td><INPUT type=\"text\" class=\"textbox=\" name=\"author\" value=\"" . stripslashes($newsitem['author']) . "\"></td></tr> |
|
| 73 |
+ <tr><td>" . _TITLE . ": </td><td><INPUT type=\"text\" class=\"textbox=\" name=\"title\" value=\"" . stripslashes($newsitem['title']) . "\"></td></tr> |
|
| 74 |
+ <tr><td>" . _TEXT . ": </td><td><textarea class=\"textbox\" name=\"story\" id=\"story\" COLS=\"45\" ROWS=\"6\">" . stripslashes($newsitem['story']) . "</TEXTAREA>"; |
|
| 75 |
+ if ($tinyMCE) |
|
| 76 |
+ $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('story');\" checked><label for='toggle'>" . _TINYMCETOGGLE . "</label></div>";
|
|
| 77 |
+ |
|
| 78 |
+ $output .= "</td></tr><tr><td colspan=\"2\" align=\"center\">" . ($_GET["form"] != "new" ? "<INPUT type=\"hidden\" name=\"nid\" value=\"" . $_GET['form'] . "\">" : "") . "<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _SUBMIT . "\"></td></tr></table></form>"; |
|
| 79 |
+} |
|
| 80 |
+else |
|
| 81 |
+{
|
|
| 82 |
+ $output .= "<p align=\"center\"><a href=\"admin.php?action=news&form=new\">" . _ADDNEWS . "</a></p>"; |
|
| 83 |
+ $count = dbquery("SELECT COUNT(nid) FROM " . TABLEPREFIX . "fanfiction_news");
|
|
| 84 |
+ list($numrows) = dbrow($count); |
|
| 85 |
+ |
|
| 86 |
+ $result = dbquery("SELECT n.*, n.time as date, count(c.cid) as comments FROM " . TABLEPREFIX . "fanfiction_news as n LEFT JOIN " . TABLEPREFIX . "fanfiction_comments as c ON n.nid = c.nid GROUP BY n.nid ORDER BY time DESC LIMIT $offset, $itemsperpage");
|
|
| 87 |
+ if (file_exists("$skindir/newsbox.tpl")) $news = new TemplatePower("$skindir/newsbox.tpl");
|
|
| 88 |
+ else $news = new TemplatePower("default_tpls/newsbox.tpl");
|
|
| 89 |
+ $news->prepare(); |
|
| 90 |
+ $count = 0; |
|
| 91 |
+ while ($stories = dbassoc($result)) |
|
| 92 |
+ {
|
|
| 93 |
+ $news->newBlock("newsbox");
|
|
| 94 |
+ |
|
| 95 |
+ //assign values |
|
| 96 |
+ $news->assign("newstitle", $stories['title']);
|
|
| 97 |
+ $news->assign("newsstory", $stories['story']);
|
|
| 98 |
+ $news->assign("newsauthor", $stories['author']);
|
|
| 99 |
+ $news->assign("newsdate", date("$dateformat $timeformat", $stories['date']));
|
|
| 100 |
+ $news->assign("oddeven", ($count % 2 ? "even" : "odd"));
|
|
| 101 |
+ if ($newscomments == "1") |
|
| 102 |
+ $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=" . $stories['nid'] . "\">" . $stories['comments'] . " " . _COMMENTS . "</a>");
|
|
| 103 |
+ if (isADMIN) |
|
| 104 |
+ $news->assign("adminoptions", "<a href=\"admin.php?action=news&form=" . $stories['nid'] . "\">" . _EDIT . "</a> | <a href=\"admin.php?action=news&delete=" . $stories['nid'] . "\">" . _DELETE . "</a>");
|
|
| 105 |
+ $count++; |
|
| 106 |
+ } |
|
| 107 |
+ $news->gotoBlock("_ROOT");
|
|
| 108 |
+ $output .= $news->getOutputContent(); |
|
| 109 |
+ if ($numrows > $itemsperpage) $output .= build_pagelinks("admin.php?action=news&", $numrows, $offset);
|
|
| 110 |
+} |