| ... | ... |
@@ -147,7 +147,7 @@ else {
|
| 147 | 147 |
|
| 148 | 148 |
//assign values |
| 149 | 149 |
$news->assign("newstitle" , $stories['title']);
|
| 150 |
- $news->assign("newsstory" , nl2br($stories['story']) );
|
|
| 150 |
+ $news->assign("newsstory" , format_story($stories['story']) );
|
|
| 151 | 151 |
$news->assign("newsauthor", $stories['author']);
|
| 152 | 152 |
$news->assign("newsdate", date("$dateformat $timeformat", $stories['date']) );
|
| 153 | 153 |
$news->assign("newsid", $stories['nid']);
|
| ... | ... |
@@ -123,8 +123,10 @@ if($nid) {
|
| 123 | 123 |
} |
| 124 | 124 |
else $comment = ""; |
| 125 | 125 |
$output .= "<table align=\"center\"><tr><td><strong>"._PENNAME.":</strong></td><td>".USERPENNAME."<INPUT type=\"hidden\" name=\"uname\" value=\"".USERPENNAME."\"></td></tr> |
| 126 |
- <tr><td><b>"._COMMENTS.":</b></td><td><TEXTAREA name=\"comment\" cols=\"35\" rows=\"6\">$comment</TEXTAREA></td></tr> |
|
| 127 |
- <tr><td><INPUT type=\"hidden\" name=\"nid\" value=\"$nid\"><INPUT name=\"submit\" id=\"submit\" type=\"submit\" value=\""._SUBMIT."\"></td></tr></table></form>"; |
|
| 126 |
+ <tr><td><b>"._COMMENTS.":</b></td><td><TEXTAREA name=\"comment\" id=\"comment\" cols=\"55\" rows=\"12\">$comment</TEXTAREA></td></tr>"; |
|
| 127 |
+ if($tinyMCE) |
|
| 128 |
+ $output .= "<tr><td></td><td><div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('comment');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div></td></tr>";
|
|
| 129 |
+ $output .= "<tr><td><INPUT type=\"hidden\" name=\"nid\" value=\"$nid\"><INPUT name=\"submit\" id=\"submit\" type=\"submit\" value=\""._SUBMIT."\"></td></tr></table></form>"; |
|
| 128 | 130 |
} |
| 129 | 131 |
$tpl->assign("output", $output);
|
| 130 | 132 |
} |
| ... | ... |
@@ -42,7 +42,7 @@ if($nid) {
|
| 42 | 42 |
$comment = escapestring(format_story(replace_naughty(strip_tags($_POST['comment'], $allowed_tags)))); |
| 43 | 43 |
$ef_news_ok = (bool)dbrow(dbquery("SELECT nid FROM ".TABLEPREFIX."fanfiction_news WHERE nid = '$nid' LIMIT 1"));
|
| 44 | 44 |
if(!$cid && USERUID && $newscomments && $ef_news_ok && trim($comment) !== "") {
|
| 45 |
- $insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_comments (nid, uid, comment, time) VALUES ('$nid', '".(int)USERUID."', '$comment', now())");
|
|
| 45 |
+ $insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_comments (nid, uid, comment, time) VALUES ('$nid', '".(int)USERUID."', '$comment', '" . time() . "')");
|
|
| 46 | 46 |
if($insert) dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = comments + 1 WHERE nid = '$nid' LIMIT 1");
|
| 47 | 47 |
} |
| 48 | 48 |
else if($cid && isADMIN && uLEVEL < 4) {
|
| ... | ... |
@@ -34,20 +34,6 @@ if(isset($_REQUEST['nid'])) $nid = $_REQUEST['nid']; |
| 34 | 34 |
if(!isset($nid) || !isNumber($nid)) $nid = false; |
| 35 | 35 |
$cid = isset($_REQUEST['cid']) && isNumber($_REQUEST['cid']) ? $_REQUEST['cid'] : false; |
| 36 | 36 |
|
| 37 |
-if ($nid < 1) {
|
|
| 38 |
- $current = "newserror"; |
|
| 39 |
- // load our template files to set up the page. |
|
| 40 |
- if (file_exists("$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl");
|
|
| 41 |
- else $tpl = new TemplatePower("default_tpls/default.tpl");
|
|
| 42 |
- $title = "News entry was not found"; |
|
| 43 |
- $text = "News entry with ID " . $nid . " is not in database"; |
|
| 44 |
- include("includes/pagesetup.php");
|
|
| 45 |
- $tpl->assign("output", "<div id='pagetitle'>" . $title . "</div>" . write_error($text));
|
|
| 46 |
- $tpl->printToScreen(); |
|
| 47 |
- dbclose(); |
|
| 48 |
- exit(); |
|
| 49 |
-} |
|
| 50 |
- |
|
| 51 | 37 |
if($nid) {
|
| 52 | 38 |
|
| 53 | 39 |
$output .= "<div id=\"pagetitle\">"._NEWS."</div>"; |
| ... | ... |
@@ -51,16 +51,18 @@ if ($nid < 1) {
|
| 51 | 51 |
if($nid) {
|
| 52 | 52 |
|
| 53 | 53 |
$output .= "<div id=\"pagetitle\">"._NEWS."</div>"; |
| 54 |
- if(isset($_POST['submit'])) |
|
| 54 |
+ if(isset($_POST['submit']) && isset($_POST['comment']) && is_string($_POST['comment'])) |
|
| 55 | 55 |
{
|
| 56 | 56 |
$comment = escapestring(format_story(replace_naughty(strip_tags($_POST['comment'], $allowed_tags)))); |
| 57 |
- if(!$cid && USERUID) {
|
|
| 58 |
- $insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_comments (nid, uid, comment, time) VALUES ('$nid', '".(USERUID ? USERUID : 0)."', '$comment', '" . time() . "')");
|
|
| 57 |
+ $ef_news_ok = (bool)dbrow(dbquery("SELECT nid FROM ".TABLEPREFIX."fanfiction_news WHERE nid = '$nid' LIMIT 1"));
|
|
| 58 |
+ if(!$cid && USERUID && $newscomments && $ef_news_ok && trim($comment) !== "") {
|
|
| 59 |
+ $insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_comments (nid, uid, comment, time) VALUES ('$nid', '".(int)USERUID."', '$comment', now())");
|
|
| 59 | 60 |
if($insert) dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = comments + 1 WHERE nid = '$nid' LIMIT 1");
|
| 60 | 61 |
} |
| 61 |
- else if($cid) {
|
|
| 62 |
- dbquery("UPDATE ".TABLEPREFIX."fanfiction_comments SET comment = '$comment' WHERE cid = '$cid'");
|
|
| 62 |
+ else if($cid && isADMIN && uLEVEL < 4) {
|
|
| 63 |
+ dbquery("UPDATE ".TABLEPREFIX."fanfiction_comments SET comment = '$comment' WHERE cid = '$cid' AND nid = '$nid'");
|
|
| 63 | 64 |
} |
| 65 |
+ else accessDenied( ); |
|
| 64 | 66 |
unset($comment); |
| 65 | 67 |
} |
| 66 | 68 |
if(isset($_GET['del']) && isADMIN && uLEVEL < 4 && !empty($cid)) {
|
| ... | ... |
@@ -98,7 +98,7 @@ if($nid) {
|
| 98 | 98 |
$news->assign("skindir", $skindir);
|
| 99 | 99 |
$news->assign("newsdate", date("$dateformat $timeformat", $stories['date']) );
|
| 100 | 100 |
if($newscomments) |
| 101 |
- $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".$stories['nid']."\">".(isset($stories['comments']) ? $stories['comments'] : null)." "._COMMENTS."</a>");
|
|
| 101 |
+ $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".$stories['nid']."\">".$stories['comments']." "._COMMENTS."</a>");
|
|
| 102 | 102 |
if(isADMIN && uLEVEL < 4) |
| 103 | 103 |
$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>");
|
| 104 | 104 |
$output .= $news->getOutputContent( ); |
| ... | ... |
@@ -90,17 +90,17 @@ if($nid) {
|
| 90 | 90 |
$news->newBlock("newsbox");
|
| 91 | 91 |
|
| 92 | 92 |
//assign values |
| 93 |
- $news->assign("newstitle" , stripslashes(isset($stories['title']) ? $stories['title'] : null) );
|
|
| 94 |
- $news->assign("newsstory" , format_story(isset($stories['story']) ? $stories['story'] : null) );
|
|
| 95 |
- $news->assign("newsauthor", stripslashes(isset($stories['author']) ? $stories['author'] : null) );
|
|
| 96 |
- $news->assign("newsid", (isset($stories['nid']) ? $stories['nid'] : null) );
|
|
| 93 |
+ $news->assign("newstitle" , stripslashes($stories['title']) );
|
|
| 94 |
+ $news->assign("newsstory" , format_story($stories['story']) );
|
|
| 95 |
+ $news->assign("newsauthor", stripslashes($stories['author']) );
|
|
| 96 |
+ $news->assign("newsid", $stories['nid']);
|
|
| 97 | 97 |
$news->assign("oddeven", "odd");
|
| 98 | 98 |
$news->assign("skindir", $skindir);
|
| 99 |
- $news->assign("newsdate", date("$dateformat $timeformat", (isset($stories['date']) ? $stories['date'] : null) ) );
|
|
| 99 |
+ $news->assign("newsdate", date("$dateformat $timeformat", $stories['date']) );
|
|
| 100 | 100 |
if($newscomments) |
| 101 |
- $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".(isset($stories['nid']) ? $stories['nid'] : null)."\">".(isset($stories['comments']) ? $stories['comments'] : null)." "._COMMENTS."</a>");
|
|
| 101 |
+ $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".$stories['nid']."\">".(isset($stories['comments']) ? $stories['comments'] : null)." "._COMMENTS."</a>");
|
|
| 102 | 102 |
if(isADMIN && uLEVEL < 4) |
| 103 |
- $news->assign("adminoptions", "<a href=\"admin.php?action=news&form=".(isset($stories['nid']) ? $stories['nid'] : null)."\">"._EDIT."</a> | <a href=\"admin.php?action=news&delete=".(isset($stories['nid']) ? $stories['nid'] : null)."\">"._DELETE."</a>");
|
|
| 103 |
+ $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>");
|
|
| 104 | 104 |
$output .= $news->getOutputContent( ); |
| 105 | 105 |
|
| 106 | 106 |
$cquery = dbquery("SELECT COUNT(cid) FROM ".TABLEPREFIX."fanfiction_comments WHERE nid = '$nid'");
|
| ... | ... |
@@ -72,7 +72,7 @@ if($nid) {
|
| 72 | 72 |
if(file_exists("./$skindir/newsbox.tpl"))
|
| 73 | 73 |
$news = new TemplatePower( "./$skindir/newsbox.tpl" ); |
| 74 | 74 |
else $news = new TemplatePower( "./default_tpls/newsbox.tpl" ); |
| 75 |
- if(empty($stories)) {
|
|
| 75 |
+ if(!$stories) {
|
|
| 76 | 76 |
$current = "newserror"; |
| 77 | 77 |
// load our template files to set up the page. |
| 78 | 78 |
if (file_exists("$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl");
|
| ... | ... |
@@ -34,6 +34,20 @@ if(isset($_REQUEST['nid'])) $nid = $_REQUEST['nid']; |
| 34 | 34 |
if(!isset($nid) || !isNumber($nid)) $nid = false; |
| 35 | 35 |
$cid = isset($_REQUEST['cid']) && isNumber($_REQUEST['cid']) ? $_REQUEST['cid'] : false; |
| 36 | 36 |
|
| 37 |
+if ($nid < 1) {
|
|
| 38 |
+ $current = "newserror"; |
|
| 39 |
+ // load our template files to set up the page. |
|
| 40 |
+ if (file_exists("$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl");
|
|
| 41 |
+ else $tpl = new TemplatePower("default_tpls/default.tpl");
|
|
| 42 |
+ $title = "News entry was not found"; |
|
| 43 |
+ $text = "News entry with ID " . $nid . " is not in database"; |
|
| 44 |
+ include("includes/pagesetup.php");
|
|
| 45 |
+ $tpl->assign("output", "<div id='pagetitle'>" . $title . "</div>" . write_error($text));
|
|
| 46 |
+ $tpl->printToScreen(); |
|
| 47 |
+ dbclose(); |
|
| 48 |
+ exit(); |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 37 | 51 |
if($nid) {
|
| 38 | 52 |
|
| 39 | 53 |
$output .= "<div id=\"pagetitle\">"._NEWS."</div>"; |
| ... | ... |
@@ -58,6 +72,19 @@ if($nid) {
|
| 58 | 72 |
if(file_exists("./$skindir/newsbox.tpl"))
|
| 59 | 73 |
$news = new TemplatePower( "./$skindir/newsbox.tpl" ); |
| 60 | 74 |
else $news = new TemplatePower( "./default_tpls/newsbox.tpl" ); |
| 75 |
+ if(empty($stories)) {
|
|
| 76 |
+ $current = "newserror"; |
|
| 77 |
+ // load our template files to set up the page. |
|
| 78 |
+ if (file_exists("$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl");
|
|
| 79 |
+ else $tpl = new TemplatePower("default_tpls/default.tpl");
|
|
| 80 |
+ $title = "News entry was not found"; |
|
| 81 |
+ $text = "News entry with ID " . $nid . " is not in database"; |
|
| 82 |
+ include("includes/pagesetup.php");
|
|
| 83 |
+ $tpl->assign("output", "<div id='pagetitle'>" . $title . "</div>" . write_error($text));
|
|
| 84 |
+ $tpl->printToScreen(); |
|
| 85 |
+ dbclose(); |
|
| 86 |
+ exit(); |
|
| 87 |
+ } |
|
| 61 | 88 |
$news->prepare( ); |
| 62 | 89 |
//create a new number_row block |
| 63 | 90 |
$news->newBlock("newsbox");
|
| ... | ... |
@@ -63,17 +63,17 @@ if($nid) {
|
| 63 | 63 |
$news->newBlock("newsbox");
|
| 64 | 64 |
|
| 65 | 65 |
//assign values |
| 66 |
- $news->assign("newstitle" , stripslashes($stories['title']) );
|
|
| 67 |
- $news->assign("newsstory" , format_story($stories['story']) );
|
|
| 68 |
- $news->assign("newsauthor", stripslashes($stories['author']) );
|
|
| 69 |
- $news->assign("newsid", $stories['nid']);
|
|
| 66 |
+ $news->assign("newstitle" , stripslashes(isset($stories['title']) ? $stories['title'] : null) );
|
|
| 67 |
+ $news->assign("newsstory" , format_story(isset($stories['story']) ? $stories['story'] : null) );
|
|
| 68 |
+ $news->assign("newsauthor", stripslashes(isset($stories['author']) ? $stories['author'] : null) );
|
|
| 69 |
+ $news->assign("newsid", (isset($stories['nid']) ? $stories['nid'] : null) );
|
|
| 70 | 70 |
$news->assign("oddeven", "odd");
|
| 71 | 71 |
$news->assign("skindir", $skindir);
|
| 72 |
- $news->assign("newsdate", date("$dateformat $timeformat", $stories['date']) );
|
|
| 72 |
+ $news->assign("newsdate", date("$dateformat $timeformat", (isset($stories['date']) ? $stories['date'] : null) ) );
|
|
| 73 | 73 |
if($newscomments) |
| 74 |
- $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".$stories['nid']."\">".$stories['comments']." "._COMMENTS."</a>");
|
|
| 74 |
+ $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".(isset($stories['nid']) ? $stories['nid'] : null)."\">".(isset($stories['comments']) ? $stories['comments'] : null)." "._COMMENTS."</a>");
|
|
| 75 | 75 |
if(isADMIN && uLEVEL < 4) |
| 76 |
- $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>");
|
|
| 76 |
+ $news->assign("adminoptions", "<a href=\"admin.php?action=news&form=".(isset($stories['nid']) ? $stories['nid'] : null)."\">"._EDIT."</a> | <a href=\"admin.php?action=news&delete=".(isset($stories['nid']) ? $stories['nid'] : null)."\">"._DELETE."</a>");
|
|
| 77 | 77 |
$output .= $news->getOutputContent( ); |
| 78 | 78 |
|
| 79 | 79 |
$cquery = dbquery("SELECT COUNT(cid) FROM ".TABLEPREFIX."fanfiction_comments WHERE nid = '$nid'");
|
| ... | ... |
@@ -41,7 +41,7 @@ if($nid) {
|
| 41 | 41 |
{
|
| 42 | 42 |
$comment = escapestring(format_story(replace_naughty(strip_tags($_POST['comment'], $allowed_tags)))); |
| 43 | 43 |
if(!$cid && USERUID) {
|
| 44 |
- $insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_comments (nid, uid, comment, time) VALUES ('$nid', '".(USERUID ? USERUID : 0)."', '$comment', now())");
|
|
| 44 |
+ $insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_comments (nid, uid, comment, time) VALUES ('$nid', '".(USERUID ? USERUID : 0)."', '$comment', '" . time() . "')");
|
|
| 45 | 45 |
if($insert) dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = comments + 1 WHERE nid = '$nid' LIMIT 1");
|
| 46 | 46 |
} |
| 47 | 47 |
else if($cid) {
|
| ... | ... |
@@ -149,4 +149,4 @@ else {
|
| 149 | 149 |
|
| 150 | 150 |
$tpl->printToScreen(); |
| 151 | 151 |
dbclose( ); |
| 152 |
-?> |
|
| 153 | 152 |
\ No newline at end of file |
| 153 |
+?> |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,152 @@ |
| 1 |
+<?php |
|
| 2 |
+// ---------------------------------------------------------------------- |
|
| 3 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 4 |
+// Based on eFiction 1.1 |
|
| 5 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 6 |
+// http://efiction.sourceforge.net/ |
|
| 7 |
+// ---------------------------------------------------------------------- |
|
| 8 |
+// LICENSE |
|
| 9 |
+// |
|
| 10 |
+// This program is free software; you can redistribute it and/or |
|
| 11 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 12 |
+// as published by the Free Software Foundation; either version 2 |
|
| 13 |
+// of the License, or (at your option) any later version. |
|
| 14 |
+// |
|
| 15 |
+// This program is distributed in the hope that it will be useful, |
|
| 16 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
+// GNU General Public License for more details. |
|
| 19 |
+// |
|
| 20 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 21 |
+// ---------------------------------------------------------------------- |
|
| 22 |
+ |
|
| 23 |
+$current = "news"; |
|
| 24 |
+ |
|
| 25 |
+include ("header.php");
|
|
| 26 |
+ |
|
| 27 |
+if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
|
|
| 28 |
+else $tpl = new TemplatePower("default_tpls/default.tpl");
|
|
| 29 |
+ |
|
| 30 |
+include("includes/pagesetup.php");
|
|
| 31 |
+ |
|
| 32 |
+ |
|
| 33 |
+if(isset($_REQUEST['nid'])) $nid = $_REQUEST['nid']; |
|
| 34 |
+if(!isset($nid) || !isNumber($nid)) $nid = false; |
|
| 35 |
+$cid = isset($_REQUEST['cid']) && isNumber($_REQUEST['cid']) ? $_REQUEST['cid'] : false; |
|
| 36 |
+ |
|
| 37 |
+if($nid) {
|
|
| 38 |
+ |
|
| 39 |
+ $output .= "<div id=\"pagetitle\">"._NEWS."</div>"; |
|
| 40 |
+ if(isset($_POST['submit'])) |
|
| 41 |
+ {
|
|
| 42 |
+ $comment = escapestring(format_story(replace_naughty(strip_tags($_POST['comment'], $allowed_tags)))); |
|
| 43 |
+ if(!$cid && USERUID) {
|
|
| 44 |
+ $insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_comments (nid, uid, comment, time) VALUES ('$nid', '".(USERUID ? USERUID : 0)."', '$comment', now())");
|
|
| 45 |
+ if($insert) dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = comments + 1 WHERE nid = '$nid' LIMIT 1");
|
|
| 46 |
+ } |
|
| 47 |
+ else if($cid) {
|
|
| 48 |
+ dbquery("UPDATE ".TABLEPREFIX."fanfiction_comments SET comment = '$comment' WHERE cid = '$cid'");
|
|
| 49 |
+ } |
|
| 50 |
+ unset($comment); |
|
| 51 |
+ } |
|
| 52 |
+ if(isset($_GET['del']) && isADMIN && uLEVEL < 4 && !empty($cid)) {
|
|
| 53 |
+ $insert = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_comments WHERE cid = '$cid'");
|
|
| 54 |
+ if($insert) dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = comments - 1 WHERE nid = '$nid' LIMIT 1");
|
|
| 55 |
+ } |
|
| 56 |
+ $newsquery = dbquery("SELECT n.*, n.time as date FROM ".TABLEPREFIX."fanfiction_news as n WHERE n.nid = '$nid' LIMIT 1");
|
|
| 57 |
+ $stories = dbassoc($newsquery); |
|
| 58 |
+ if(file_exists("./$skindir/newsbox.tpl"))
|
|
| 59 |
+ $news = new TemplatePower( "./$skindir/newsbox.tpl" ); |
|
| 60 |
+ else $news = new TemplatePower( "./default_tpls/newsbox.tpl" ); |
|
| 61 |
+ $news->prepare( ); |
|
| 62 |
+ //create a new number_row block |
|
| 63 |
+ $news->newBlock("newsbox");
|
|
| 64 |
+ |
|
| 65 |
+ //assign values |
|
| 66 |
+ $news->assign("newstitle" , stripslashes($stories['title']) );
|
|
| 67 |
+ $news->assign("newsstory" , format_story($stories['story']) );
|
|
| 68 |
+ $news->assign("newsauthor", stripslashes($stories['author']) );
|
|
| 69 |
+ $news->assign("newsid", $stories['nid']);
|
|
| 70 |
+ $news->assign("oddeven", "odd");
|
|
| 71 |
+ $news->assign("skindir", $skindir);
|
|
| 72 |
+ $news->assign("newsdate", date("$dateformat $timeformat", $stories['date']) );
|
|
| 73 |
+ if($newscomments) |
|
| 74 |
+ $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".$stories['nid']."\">".$stories['comments']." "._COMMENTS."</a>");
|
|
| 75 |
+ if(isADMIN && uLEVEL < 4) |
|
| 76 |
+ $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>");
|
|
| 77 |
+ $output .= $news->getOutputContent( ); |
|
| 78 |
+ |
|
| 79 |
+ $cquery = dbquery("SELECT COUNT(cid) FROM ".TABLEPREFIX."fanfiction_comments WHERE nid = '$nid'");
|
|
| 80 |
+ list($ccount) = dbrow($cquery); |
|
| 81 |
+ if($ccount) {
|
|
| 82 |
+ $query2 = dbquery("SELECT c.*, "._PENNAMEFIELD." as penname, c.time as date FROM ".TABLEPREFIX."fanfiction_comments as c LEFT JOIN "._AUTHORTABLE." ON c.uid = "._UIDFIELD." WHERE c.nid = '$nid' ORDER BY time LIMIT $offset, $itemsperpage");
|
|
| 83 |
+ $output .= "<div class=\"sectionheader\">"._COMMENTS."</div>"; |
|
| 84 |
+ if(file_exists("$skindir/comments.tpl")) $c = new TemplatePower( "$skindir/comments.tpl" );
|
|
| 85 |
+ else $c = new TemplatePower( "default_tpls/comments.tpl" ); |
|
| 86 |
+ $c->prepare( ); |
|
| 87 |
+ $count = 0; |
|
| 88 |
+ while($comments = dbassoc($query2)) {
|
|
| 89 |
+ $c->newBlock("commentbox");
|
|
| 90 |
+ $c->assign("comment", format_story($comments['comment']));
|
|
| 91 |
+ $c->assign("uname", $comments['penname']);
|
|
| 92 |
+ $c->assign("date", date("$dateformat $timeformat", $comments['date']));
|
|
| 93 |
+ if(isADMIN && uLEVEL < 4) |
|
| 94 |
+ $c->assign("adminoptions", "<div class='adminoptions'><span class='label'>"._ADMINOPTIONS.":</span> [<a href=\"news.php?action=newsstory&edit=".$comments['cid']."&nid=$nid\">"._EDIT."</a>] [<a href=\"news.php?action=newsstory&cid=".$comments['cid']."&del=1&nid=$nid\">"._DELETE."</a>]</div>");
|
|
| 95 |
+ $c->assign("oddeven", ($count % 2 ? "odd" : "even"));
|
|
| 96 |
+ $count++; |
|
| 97 |
+ } |
|
| 98 |
+ $output .= $c->getOutputContent( ); |
|
| 99 |
+ if($ccount > $itemsperpage) $output .= build_pagelinks("news.php?nid=$nid&", $ccount, $offset);
|
|
| 100 |
+ } |
|
| 101 |
+ if(isMEMBER) {
|
|
| 102 |
+ $output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"news.php?action=newsstory&nid=$nid\">"; |
|
| 103 |
+ if(isset($_GET['edit']) && isNumber($_GET['edit'])) {
|
|
| 104 |
+ |
|
| 105 |
+ $select = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_comments WHERE cid = '".$_GET['edit']."' LIMIT 1");
|
|
| 106 |
+ list($cid, $nid, $uname, $comment, $time) = dbrow($select); |
|
| 107 |
+ $output .= "<input type=\"hidden\" name=\"cid\" value=\"$cid\">"; |
|
| 108 |
+ } |
|
| 109 |
+ else $comment = ""; |
|
| 110 |
+ $output .= "<table align=\"center\"><tr><td><strong>"._PENNAME.":</strong></td><td>".USERPENNAME."<INPUT type=\"hidden\" name=\"uname\" value=\"".USERPENNAME."\"></td></tr> |
|
| 111 |
+ <tr><td><b>"._COMMENTS.":</b></td><td><TEXTAREA name=\"comment\" cols=\"35\" rows=\"6\">$comment</TEXTAREA></td></tr> |
|
| 112 |
+ <tr><td><INPUT type=\"hidden\" name=\"nid\" value=\"$nid\"><INPUT name=\"submit\" id=\"submit\" type=\"submit\" value=\""._SUBMIT."\"></td></tr></table></form>"; |
|
| 113 |
+ } |
|
| 114 |
+ $tpl->assign("output", $output);
|
|
| 115 |
+} |
|
| 116 |
+else {
|
|
| 117 |
+ $output .= "<div id=\"pagetitle\">"._NEWS."</div>"; |
|
| 118 |
+ if(file_exists("./$skindir/newsbox.tpl"))
|
|
| 119 |
+ $news = new TemplatePower( "./$skindir/newsbox.tpl" ); |
|
| 120 |
+ else $news = new TemplatePower( "./default_tpls/newsbox.tpl" ); |
|
| 121 |
+ $news->prepare( ); |
|
| 122 |
+ $cquery = dbquery("SELECT count(nid) FROM ".TABLEPREFIX."fanfiction_news");
|
|
| 123 |
+ list($count) = dbrow($cquery); |
|
| 124 |
+ $newsquery = dbquery("SELECT n.*, n.time as date FROM ".TABLEPREFIX."fanfiction_news as n ORDER BY n.time DESC LIMIT $offset, $itemsperpage");
|
|
| 125 |
+ $counter = 0; |
|
| 126 |
+ while($stories = dbassoc($newsquery)) {
|
|
| 127 |
+ |
|
| 128 |
+ //create a new number_row block |
|
| 129 |
+ $news->newBlock("newsbox");
|
|
| 130 |
+ |
|
| 131 |
+ //assign values |
|
| 132 |
+ $news->assign("newstitle" , $stories['title']);
|
|
| 133 |
+ $news->assign("newsstory" , nl2br($stories['story']) );
|
|
| 134 |
+ $news->assign("newsauthor", $stories['author']);
|
|
| 135 |
+ $news->assign("newsdate", date("$dateformat $timeformat", $stories['date']) );
|
|
| 136 |
+ $news->assign("newsid", $stories['nid']);
|
|
| 137 |
+ $news->assign("skindir", $skindir);
|
|
| 138 |
+ if($newscomments) |
|
| 139 |
+ $news->assign("newscomments", "<a href=\"news.php?action=newsstory&nid=".$stories['nid']."\">".$stories['comments']." "._COMMENTS."</a>");
|
|
| 140 |
+ if(isADMIN && uLEVEL < 4) |
|
| 141 |
+ $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>");
|
|
| 142 |
+ $news->assign("oddeven", ($counter % 2 ? "even" : "odd"));
|
|
| 143 |
+ $counter++; |
|
| 144 |
+ } |
|
| 145 |
+ $output .= $news->getOutputContent( ); |
|
| 146 |
+ if ($count > $itemsperpage) $output .= build_pagelinks("news.php?", $count, $offset);
|
|
| 147 |
+ $tpl->assign("output", $output);
|
|
| 148 |
+} |
|
| 149 |
+ |
|
| 150 |
+$tpl->printToScreen(); |
|
| 151 |
+dbclose( ); |
|
| 152 |
+?> |
|
| 0 | 153 |
\ No newline at end of file |