Browse code

forgotten date changes

Jimako authored on 2024/06/21 02:05:54
Showing 1 changed files
... ...
@@ -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
+?>
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
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&amp;nid=".$stories['nid']."\">".$stories['comments']." "._COMMENTS."</a>");
75
+	if(isADMIN && uLEVEL < 4) 
76
+		$news->assign("adminoptions", "<a href=\"admin.php?action=news&amp;form=".$stories['nid']."\">"._EDIT."</a> | <a href=\"admin.php?action=news&amp;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&amp;edit=".$comments['cid']."&amp;nid=$nid\">"._EDIT."</a>] [<a href=\"news.php?action=newsstory&amp;cid=".$comments['cid']."&amp;del=1&amp;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&amp;", $ccount, $offset);
100
+	}
101
+	if(isMEMBER) {
102
+		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"news.php?action=newsstory&amp;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&amp;nid=".$stories['nid']."\">".$stories['comments']." "._COMMENTS."</a>");
140
+		if(isADMIN && uLEVEL < 4) 
141
+			$news->assign("adminoptions", "<a href=\"admin.php?action=news&amp;form=".$stories['nid']."\">"._EDIT."</a> | <a href=\"admin.php?action=news&amp;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