Browse code

Initial uplad w/ php7 fixes

Rainer Volkrodt authored on 2016/03/12 15:54:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,123 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// Copyright (c) 2007 by Tammy Keefer
4
+// Valid HTML 4.01 Transitional
5
+// Based on eFiction 1.1
6
+// Copyright (C) 2003 by Rebecca Smallwood.
7
+// http://efiction.sourceforge.net/
8
+// ----------------------------------------------------------------------
9
+// LICENSE
10
+//
11
+// This program is free software; you can redistribute it and/or
12
+// modify it under the terms of the GNU General Public License (GPL)
13
+// as published by the Free Software Foundation; either version 2
14
+// of the License, or (at your option) any later version.
15
+//
16
+// This program is distributed in the hope that it will be useful,
17
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
+// GNU General Public License for more details.
20
+//
21
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
22
+// ----------------------------------------------------------------------
23
+
24
+if(!defined("_CHARSET")) exit( );
25
+	if(!isset($count)) $count = 0;
26
+	$tpl->assign("sid", $stories['sid']);
27
+	unset($challengelinks, $challengeadmin, $serieslinks, $categorylinks, $adminlinks, $authlink);
28
+	if($stories['coauthors'] == 1) {
29
+		$coauthors = array();
30
+		$coauth = dbquery("SELECT "._PENNAMEFIELD." as penname, co.uid FROM ".TABLEPREFIX."fanfiction_coauthors AS co LEFT JOIN "._AUTHORTABLE." ON co.uid = "._UIDFIELD." WHERE co.sid = '".$stories['sid']."'");
31
+		while($c = dbassoc($coauth)) {
32
+			$coauthors[$c['uid']] = $c['penname'];
33
+		}
34
+		$stories['coauthors'] = $coauthors;
35
+		unset($coauthors);
36
+	}
37
+	else if(empty($stories['coauthors'])) $stories['coauthors'] = array( );	
38
+	$tpl->assign("title"   , stripslashes(title_link($stories)) );
39
+	$tpl->assign("author"   , author_link($stories));
40
+	$tpl->assign("summary", stripslashes($stories['summary']) );
41
+	$tpl->assign("rating"   , $ratingslist[$stories['rid']]['name']);
42
+	$tpl->assign("score", ratingpics($stories['rating']) );
43
+	$tpl->assign("count", $stories['count'] ? $stories['count'] : "0");
44
+	$allclasslist = "";
45
+	$adminlinks = "";
46
+	$storyclasses = array( );
47
+	if($stories['classes']) {
48
+		foreach(explode(",", $stories['classes']) as $c) {
49
+			if(isset($action) && $action == "printable") $storyclasses[$classlist["$c"]['type']][] = $classlist[$c]['name'];
50
+			else $storyclasses[$classlist["$c"]['type']][] = "<a href='browse.php?type=class&amp;type_id=".$classlist["$c"]['type']."&amp;classid=$c'>".$classlist[$c]['name']."</a>";
51
+		}
52
+	}
53
+	foreach($classtypelist as $num => $c) {
54
+		if(isset($storyclasses[$num])) {
55
+			$tpl->assign($c['name'], implode(", ", $storyclasses[$num]));
56
+			$allclasslist .= "<span class='label'>".$c['title'].": </span> ".implode(", ", $storyclasses[$num])."<br />";
57
+		}
58
+		else {
59
+			$tpl->assign($c['name'], _NONE);
60
+			$allclasslist .= "<span class='label'>".$c['title'].": </span> "._NONE."<br />";
61
+		}
62
+	}		
63
+	// We only want to pull this list once
64
+	if(!isset($storycodeblocks)) {
65
+		$storycodeblocks = array( );
66
+		$codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'storyblock'");
67
+		while($code = dbassoc($codequery)) {
68
+			$storycodeblocks[] = $code['code_text'];
69
+		}
70
+	}
71
+	if(count($storycodeblocks)) foreach($storycodeblocks as $c) { eval($c); } 
72
+	$tpl->assign("classifications", $allclasslist);
73
+	$seriesquery = "SELECT series.* FROM ".TABLEPREFIX."fanfiction_inseries as list, ".TABLEPREFIX."fanfiction_series as series WHERE list.sid = '".$stories['sid']."' AND series.seriesid = list.seriesid";
74
+	$seriesresult = dbquery($seriesquery) or die(_FATALERROR."<br>Query: $seriesquery<br>Error: (".mysql_errno( ).") ".mysql_error( ));
75
+	$serieslinks = array( );
76
+	while($s = dbassoc($seriesresult)) {
77
+		if(isset($action) && $action == "printable") $serieslinks[] = stripslashes($s['title']);
78
+		else $serieslinks[] = "<a href=\""._BASEDIR."viewseries.php?seriesid=".$s['seriesid']."\">".stripslashes($s['title'])."</a>";
79
+	}
80
+	$tpl->assign("serieslinks", (count($serieslinks) > 0 ? implode(", ", $serieslinks) : _NONE));
81
+	$tpl->assign("characters", ($stories['charid'] ? charlist($stories['charid']) : _NONE));
82
+	
83
+	$tpl->assign("category",  $stories['catid'] == '-1' || !$stories['catid'] ? _ORPHAN : catlist($stories['catid']));
84
+	$tpl->assign("completed"   , ($stories['completed'] ? _YES : _NO) );
85
+	$tpl->assign("roundrobin"   , ($stories['rr'] ?  (!empty($roundrobin) ? $roundrobin : "<img src=\"images/roundrobin.gif\" alt=\""._ROUNDROBIN."\">") : "") );
86
+	$tpl->assign("ratingpics"   , ratingpics($stories['rating']) );
87
+	$tpl->assign("reviews"   , ($reviewsallowed ? "<a href=\""._BASEDIR."reviews.php?type=ST&amp;item=".$stories['sid']."\">"._REVIEWS."</a>" : "") );
88
+	if(isMEMBER && !empty($favorites)) 
89
+		$tpl->assign("addtofaves", "[<a href=\""._BASEDIR."user.php?action=favst&amp;add=1&amp;sid=".$stories['sid']."\">"._ADDSTORY2FAVES."</a>] [<a href=\""._BASEDIR."user.php?action=favau&amp;add=".$stories['uid'].(count($stories['coauthors']) ? ",".implode(",", array_keys($stories['coauthors'])) : "")."\">"._ADDAUTHOR2FAVES."</a>]");
90
+	
91
+	$numchapsquery = dbquery("SELECT count(sid) FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '".$stories['sid']."' AND validated > 0");
92
+	list($chapters) = dbrow($numchapsquery);
93
+	$tpl->assign("numchapters", $chapters );
94
+
95
+	$tpl->assign("updated"   , date("$dateformat", $stories['updated']) );
96
+	$tpl->assign("published"   , date("$dateformat", $stories['date']) );
97
+	if(!empty($recentdays)) {
98
+		$recent = time( ) - ($recentdays * 24 * 60 *60);
99
+		if($stories['updated'] > $recent) $tpl->assign("new", isset($new) ? file_exists(_BASEDIR.$new) ? "<img src='$new' alt='"._NEW."'>" : $new : _NEW);
100
+	}
101
+	$tpl->assign("wordcount"   , $stories['wordcount'] ? $stories['wordcount'] : "0" );
102
+	$tpl->assign("numreviews"   , ($reviewsallowed == "1" ? "<a href=\""._BASEDIR."reviews.php?type=ST&amp;item=".$stories['sid']."\">".$stories['reviews']."</a>" : "") );
103
+	if((isADMIN && uLEVEL < 4) || USERUID == $stories['uid'] || (is_array($stories['coauthors']) && array_key_exists(USERUID, $stories['coauthors'])))
104
+		$adminlinks .= "[<a href=\""._BASEDIR."stories.php?action=editstory&amp;sid=".$stories['sid'].(isADMIN ? "&amp;admin=1" : "")."\">"._EDIT."</a>] [<a href=\""._BASEDIR."stories.php?action=delete&amp;sid=".$stories['sid'].(isADMIN ? "&amp;admin=1" : "")."\">"._DELETE."</a>]";
105
+	global $featured;
106
+	if($stories['featured'] == 1) {
107
+		$tpl->assign("featuredstory", (isset($featured) ? $featured : "<img src=\""._BASEDIR."images/blueribbon.gif\" class=\"featured\" alt=\""._FSTORY."\">"));
108
+		$tpl->assign("featuredtext", _FSTORY);
109
+		if(isADMIN && uLEVEL < 4) $adminlinks .= " ["._FEATURED.": <a href=\""._BASEDIR."admin.php?action=featured&amp;retire=".$stories['sid']."\">"._RETIRE."</a> | <a href=\""._BASEDIR."admin.php?action=featured&amp;remove=".$stories['sid']."\">"._REMOVE."</a>]";
110
+	}
111
+	else if($stories['featured'] == 2) {
112
+		$tpl->assign("featuredstory", (isset($retired) ? $retired : "<img src=\""._BASEDIR."images/redribbon.gif\"align=\"left\" class=\"retired\" alt=\""._PFSTORY."\">"));
113
+		$tpl->assign("featuredtext", _PFSTORY);
114
+		if(isADMIN && uLEVEL < 4) $adminlinks .= " [<a href=\""._BASEDIR."admin.php?action=featured&amp;remove=".$stories['sid']."\">"._REMOVE."</a>]";
115
+	}
116
+	else if(isADMIN && uLEVEL < 4) $adminlinks .= " [<a href=\""._BASEDIR."admin.php?action=featured&amp;feature=".$stories['sid']."\">"._FEATURED."</a>]";
117
+	$tpl->assign("toc", "<a href=\""._BASEDIR."viewstory.php?sid=".$stories['sid']."&amp;index=1\">"._TOC."</a>");
118
+	$tpl->assign("oddeven", ($count % 2 ? "odd" : "even"));
119
+	$tpl->assign("reportthis", "[<a href=\""._BASEDIR."contact.php?action=report&amp;url=viewstory.php?sid=".$stories['sid']."\">"._REPORTTHIS."</a>]");
120
+	if(isADMIN && uLEVEL < 4) $tpl->assign("adminlinks", "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".$adminlinks."</div>");
121
+	else if(isMEMBER && (USERUID == $stories['uid'] || array_key_exists(USERUID, $stories['coauthors']))) $tpl->assign("adminlinks", "<div class=\"adminoptions\"><span class='label'>"._OPTIONS.":</span> ".$adminlinks."</div>");
122
+	$count++;
123
+?>
0 124
\ No newline at end of file