| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,98 @@ |
| 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 |
+ $title = addslashes(strip_tags(descript($_POST['title']), $allowed_tags)); |
|
| 31 |
+ $author = addslashes(strip_tags(descript($_POST['author']), $allowed_tags)); |
|
| 32 |
+ $story = addslashes(strip_tags(descript($_POST['story']), $allowed_tags)); |
|
| 33 |
+ if($_GET['form'] == "new") $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_news (title, author, story, time) VALUES ('$title', '$author', '$story', now())");
|
|
| 34 |
+ else $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET title = '$title', author = '$author', story = '$story' WHERE nid = '$_POST[nid]'");
|
|
| 35 |
+ if($result) {
|
|
| 36 |
+ $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 37 |
+ unset($_GET['form']); |
|
| 38 |
+ } |
|
| 39 |
+ else $output .= write_error(_ERROR." ".TRYAGAIN); |
|
| 40 |
+ } |
|
| 41 |
+ if(isset($_GET['delete']) && isNumber($_GET['delete'])) {
|
|
| 42 |
+ if($_GET['confirm'] == "yes") {
|
|
| 43 |
+ dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_news where nid = '".$_GET['delete']."'");
|
|
| 44 |
+ $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 45 |
+ } |
|
| 46 |
+ else if ($_GET['confirm'] == "no") $output .= write_message(_ACTIONCANCELLED); |
|
| 47 |
+ else {
|
|
| 48 |
+ $output .= write_message(_CONFIRMDELETE."<br /><br /> |
|
| 49 |
+[ <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> ]"); |
|
| 50 |
+ } |
|
| 51 |
+ } |
|
| 52 |
+ else if(isset($_GET["form"])) {
|
|
| 53 |
+ if($_GET["form"] != "new" && isNumber($_GET["form"])) {
|
|
| 54 |
+ $result = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_news WHERE nid = '".$_GET['form']."' LIMIT 1");
|
|
| 55 |
+ $newsitem = dbassoc($result); |
|
| 56 |
+ } |
|
| 57 |
+ else $newsitem = array("title" => "", "author" => "", "story" => "");
|
|
| 58 |
+ $output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=news&form=$_GET[form]\"> |
|
| 59 |
+ <table align=\"center\"><tr><td colspan=\"2\" align=\"center\"><b>".($_GET["form"] == "new" ? _ADDNEWS : _EDITNEWS)."</b></td></tr> |
|
| 60 |
+ <tr><td>"._AUTHOR.": </td><td><INPUT type=\"text\" class=\"textbox=\" name=\"author\" value=\"".stripslashes($newsitem['author'])."\"></td></tr> |
|
| 61 |
+ <tr><td>"._TITLE.": </td><td><INPUT type=\"text\" class=\"textbox=\" name=\"title\" value=\"".stripslashes($newsitem['title'])."\"></td></tr> |
|
| 62 |
+ <tr><td>"._TEXT.": </td><td><textarea class=\"textbox\" name=\"story\" id=\"story\" COLS=\"45\" ROWS=\"6\">".stripslashes($newsitem['story'])."</TEXTAREA>"; |
|
| 63 |
+ if($tinyMCE) |
|
| 64 |
+ $output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('story');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
|
|
| 65 |
+ |
|
| 66 |
+ $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>"; |
|
| 67 |
+ } |
|
| 68 |
+ else {
|
|
| 69 |
+ $output .= "<p align=\"center\"><a href=\"admin.php?action=news&form=new\">"._ADDNEWS."</a></p>"; |
|
| 70 |
+ $count = dbquery("SELECT COUNT(nid) FROM ".TABLEPREFIX."fanfiction_news");
|
|
| 71 |
+ list($numrows)= dbrow($count); |
|
| 72 |
+ |
|
| 73 |
+ $result = dbquery("SELECT n.*, UNIX_TIMESTAMP(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");
|
|
| 74 |
+ if(file_exists("$skindir/newsbox.tpl")) $news = new TemplatePower( "$skindir/newsbox.tpl" );
|
|
| 75 |
+ else $news = new TemplatePower( "default_tpls/newsbox.tpl" ); |
|
| 76 |
+ $news->prepare(); |
|
| 77 |
+ $count = 0; |
|
| 78 |
+ while($stories = dbassoc($result)) {
|
|
| 79 |
+ $news->newBlock("newsbox");
|
|
| 80 |
+ |
|
| 81 |
+ //assign values |
|
| 82 |
+ $news->assign("newstitle" , $stories['title'] );
|
|
| 83 |
+ $news->assign("newsstory" , $stories['story'] );
|
|
| 84 |
+ $news->assign("newsauthor", $stories['author'] );
|
|
| 85 |
+ $news->assign("newsdate", date("$dateformat $timeformat", $stories['date']) );
|
|
| 86 |
+ $news->assign("oddeven", ($count % 2 ? "even" : "odd"));
|
|
| 87 |
+ if($newscomments == "1") |
|
| 88 |
+ $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".$stories['nid']."\">".$stories['comments']." "._COMMENTS."</a>");
|
|
| 89 |
+ if(isADMIN) |
|
| 90 |
+ $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>");
|
|
| 91 |
+ $count++; |
|
| 92 |
+ } |
|
| 93 |
+ $news->gotoBlock("_ROOT");
|
|
| 94 |
+ $output .= $news->getOutputContent( ); |
|
| 95 |
+ if($numrows > $itemsperpage) $output .= build_pagelinks("admin.php?action=news&", $numrows, $offset);
|
|
| 96 |
+ } |
|
| 97 |
+ |
|
| 98 |
+?> |
|
| 0 | 99 |
\ No newline at end of file |