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,157 @@
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
+//Begin basic page setup
25
+$current = "series";
26
+
27
+
28
+include ("header.php");
29
+
30
+if(file_exists( "$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl" );
31
+else $tpl = new TemplatePower(_BASEDIR."default_tpls/default.tpl");
32
+if(file_exists("$skindir/listings.tpl")) $tpl->assignInclude( "listings", "$skindir/listings.tpl" );
33
+else $tpl->assignInclude( "listings", _BASEDIR."default_tpls/listings.tpl" );
34
+$tpl->assignInclude( "header", "$skindir/header.tpl" );
35
+$tpl->assignInclude( "footer", "$skindir/footer.tpl" );
36
+include(_BASEDIR."includes/pagesetup.php");
37
+
38
+
39
+$seriesid = (isset($_GET['seriesid']) && is_numeric($_GET['seriesid'])) ? escapestring($_GET['seriesid']) : false;
40
+$sresult = dbquery(_SERIESQUERY." AND seriesid = '$seriesid' LIMIT 1");
41
+$series = dbassoc($sresult);
42
+if(file_exists("$skindir/series_title.tpl")) $titleblock = new TemplatePower( "$skindir/series_title.tpl" );
43
+else $titleblock = new TemplatePower( "default_tpls/series_title.tpl" );
44
+$titleblock->prepare( );
45
+$titleblock->newBlock("series");
46
+$titleblock->assign("pagetitle", stripslashes($series['title'])." "._BY." <a href=\"viewuser.php?uid=".$series['uid']."\">".$series['penname']."</a>");
47
+$titleblock->assign("summary", stripslashes($series['summary']));
48
+$titleblock->assign("category", $series['catid'] ? catlist($series['catid']) : _NONE);
49
+$titleblock->assign("characters", $series['characters'] ? charlist($series['characters']) : _NONE);
50
+$titleblock->assign("numstories", $series['numstories']);
51
+if($series['classes']) {
52
+	$classes = array( );
53
+	foreach(explode(",", $series['classes']) as $c) {
54
+		$classes[$classlist[$c]['type']][] = "<a href='browse.php?type=class&amp;type_id=".$classlist["$c"]['type']."&amp;classid=$c'>".$classlist[$c]['name']."</a>";
55
+	}
56
+}
57
+$allclasslist = "";
58
+foreach($classtypelist as $num => $c) {
59
+	if(isset($classes[$num])) {
60
+		$titleblock->assign($c['name'], implode(", ", $classes[$num]));
61
+		$allclasslist .= "<span class='label'>".$c['title'].": </span> ".implode(", ", $classes[$num])."<br />";
62
+	}
63
+	else {
64
+		$titleblock->assign($c['name'], _NONE);
65
+		$allclasslist .= "<span class='label'>".$c['title'].": </span> "._NONE."<br />";
66
+	}
67
+}
68
+$seriesType = array(_CLOSED, _MODERATED, _OPEN);
69
+$titleblock->assign("open", $seriesType[$series['isopen']]);
70
+$codeblocks = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'seriestitle'");
71
+while($code = dbassoc($codeblocks)) {
72
+	eval($code['code_text']);
73
+}
74
+$titleblock->assign("classifications", $allclasslist);
75
+if(isADMIN) $titleblock->assign("adminoptions", "<div class=\"adminoptions\">"._ADMINOPTIONS.": [<a href=\"series.php?action=add&amp;add=stories&amp;seriesid=$seriesid\">"._ADD2SERIES."</a>] [<a href=\"series.php?action=edit&amp;seriesid=$seriesid\">"._EDIT."</a>] [<a href=\"series.php?action=delete&amp;seriesid=$seriesid\">"._DELETE."</a>]</div>");
76
+$jumpmenu = "";
77
+if($reviewsallowed && (isMEMBER || $anonreviews)) {
78
+	$titleblock->assign("score", ratingpics($series['rating']));
79
+	$titleblock->assign("reviews", "<a href=\"reviews.php?type=SE&amp;item=$seriesid\">"._REVIEWS."</a>");
80
+	$titleblock->assign("numreviews", "<a href=\"reviews.php?type=SE&amp;item=$seriesid\">".$series['reviews']."</a>");
81
+	$titleblock->assign("submitreviews", "<a href=\"reviews.php?action=add&amp;type=SE&amp;item=$seriesid\">"._SUBMITREVIEW."</a>");
82
+	$jumpmenu .= "<option value=\"reviews.php?action=add&amp;type=SE&amp;item=$seriesid\">"._SUBMITREVIEW."</option>";
83
+}
84
+if(isMEMBER && $favorites) {
85
+	$addtofaves = "[<a href=\"user.php?action=favse&amp;uid=".USERUID."&amp;add=$seriesid\">"._ADDSERIES2FAVES."</a>]";
86
+	$jumpmenu .= "<option value=\"user.php?action=favse&amp;uid=".USERUID."&amp;add=$seriesid\">"._ADDSERIES2FAVES."</option>";
87
+	if($series['isopen'] == 0) { // Only closed series.
88
+		$addtofaves .= " [<a href=\"user.php?action=favau&amp;uid=".USERUID."&amp;add=".$series['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
89
+		$jumpmenu .= "<option value=\"user.php?action=favau&amp;uid=".USERUID."&amp;add=".$series['uid']."\">"._ADDAUTHOR2FAVES."</option>";
90
+	}
91
+}
92
+if($series['isopen'] && isMEMBER) {
93
+	$jumpmenu .= "<option value=\"series.php?action=add&amp;add=stories&amp;seriesid=".$seriesid."&amp;stories=".USERUID."\">"._ADD2SERIES."</option>";
94
+	$titleblock->assign("addtoseries", "[<a href='series.php?action=add&amp;add=stories&seriesid=$seriesid&amp;stories=".USERUID."'>"._ADD2SERIES."</a>]");
95
+}
96
+$jumpmenu = "<form name=\"jump2\" action=\"\"><select name=\"jump2\" onchange=\"if(this.selectedIndex.value != 'false') document.location = document.jump2.jump2.options[document.jump2.jump2.selectedIndex].value\"><option value=\"false\">"._OPTIONS."</option>".$jumpmenu."</select></form>";
97
+$titleblock->assign("jumpmenu", $jumpmenu);
98
+if(isset($addtofaves)) $titleblock->assign("addtofaves", $addtofaves);
99
+$parents = dbquery("SELECT s.title, s.seriesid FROM ".TABLEPREFIX."fanfiction_inseries as i, ".TABLEPREFIX."fanfiction_series as s WHERE s.seriesid = i.seriesid AND i.subseriesid = '$seriesid'");
100
+$plinks = array( );
101
+while($p = dbassoc($parents)) {
102
+	$plinks[] = "<a href='series.php?seriesid=".$p['seriesid']."'>".$p['title']."</a>";
103
+}
104
+$titleblock->assign("parentseries", count($plinks) ? implode(", ", $plinks) : _NONE);
105
+$codeblocks = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'seriestitle'");
106
+while($code = dbassoc($codeblocks)) {
107
+	eval($code['code_text']);
108
+}
109
+$output = $titleblock->getOutputContent( );
110
+$cquery = dbquery("SELECT subseriesid, sid, inorder FROM ".TABLEPREFIX."fanfiction_inseries WHERE seriesid = '$seriesid' AND confirmed = 1");
111
+$scount = dbnumrows($cquery);
112
+$serieslist = array( );
113
+if($scount) {
114
+	$subs = array( );
115
+	$stories = array( );
116
+	while($item = dbassoc($cquery)) {
117
+		if($item['subseriesid']) $subs[$item['inorder']] = $item['subseriesid'];
118
+		else $stories[$item['inorder']] = $item['sid'];
119
+	}
120
+	if(count($subs) > 0) {
121
+		$subsquery = dbquery(_SERIESQUERY." AND FIND_IN_SET(seriesid, '".implode(",", $subs)."') > 0");
122
+		while($sub = dbassoc($subsquery)) {
123
+			$serieslist[array_search($sub['seriesid'], $subs)] = $sub;
124
+		}
125
+	}
126
+	if(count($stories)) {
127
+		$seriesstoryquery = dbquery(_STORYQUERY." AND FIND_IN_SET(sid, '".implode(",", $stories)."') > 0");
128
+		while($story = dbassoc($seriesstoryquery)) {
129
+			$serieslist[array_search($story['sid'], $stories)] = $story;
130
+		}
131
+	}
132
+}
133
+ksort($serieslist);
134
+$count = 0;
135
+for($a = $offset + 1; $a <= $itemsperpage + $offset; $a++) {
136
+	$tpl->newBlock("listings");
137
+	$stories = isset($serieslist[$a]) ? $serieslist[$a] : false;
138
+	if(isset($stories['seriesid'])) {
139
+		$tpl->newBlock("seriesblock");
140
+		include("includes/seriesblock.php");
141
+	}
142
+	else if(isset($stories['sid'])) {
143
+		$tpl->newBlock("storyblock");
144
+		include("includes/storyblock.php");
145
+// print_r($stories);
146
+	}
147
+	$tpl->gotoBlock("_ROOT");
148
+}
149
+if($scount > $itemsperpage) {
150
+	$tpl->gotoBlock("listings");
151
+	$tpl->assign("pagelinks", build_pagelinks("viewseries.php?seriesid=$seriesid&amp;", $scount, $offset));
152
+}
153
+$tpl->gotoBlock( "_ROOT" );
154
+$tpl->assign("output", $output);
155
+$tpl->printToScreen( );
156
+
157
+?>
0 158
\ No newline at end of file