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,126 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// eFiction 3.2
4
+// Copyright (c) 2007 by Tammy Keefer
5
+// Valid HTML 4.01 Transitional
6
+// Based on eFiction 1.1
7
+// Copyright (C) 2003 by Rebecca Smallwood.
8
+// http://efiction.sourceforge.net/
9
+// ----------------------------------------------------------------------
10
+// LICENSE
11
+//
12
+// This program is free software; you can redistribute it and/or
13
+// modify it under the terms of the GNU General Public License (GPL)
14
+// as published by the Free Software Foundation; either version 2
15
+// of the License, or (at your option) any later version.
16
+//
17
+// This program is distributed in the hope that it will be useful,
18
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+// GNU General Public License for more details.
21
+//
22
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
23
+// ----------------------------------------------------------------------
24
+
25
+if(!defined("_CHARSET")) exit( );
26
+
27
+	$output .= "<div id=\"pagetitle\">"._MANAGEREVIEWS."</div>";
28
+	if(isset($_POST['submit'])) {
29
+		$reviewid = isset($_POST['reviewid']) && isNumber($_POST['reviewid']) ? $_POST['reviewid'] : false;
30
+		$result = dbquery("SELECT review, reviewid, item, type, chapid, uid FROM ".TABLEPREFIX."fanfiction_reviews WHERE reviewid = '".$_POST['rid']."' LIMIT 1");
31
+		list($review, $reviewid, $item, $type, $chapid, $uid) = dbrow($result);
32
+		$updated = escapestring($review . "<br><br><i>"._AUTHORSRESPONSE.": " .replace_naughty(descript($_POST['response'], $allowed_tags))."</i>");
33
+		$success = dbquery("UPDATE ".TABLEPREFIX."fanfiction_reviews SET review = '$updated', respond = '1' WHERE reviewid = '$reviewid'");
34
+		if($uid) {
35
+			$prefsquery = dbquery("SELECT "._UIDFIELD." as uid, "._EMAILFIELD." as email, "._PENNAMEFIELD." as penname, newrespond FROM ".TABLEPREFIX."fanfiction_authorprefs as ap LEFT JOIN "._AUTHORTABLE." ON ap.uid = "._UIDFIELD." WHERE ap.uid = "._UIDFIELD." AND "._UIDFIELD." = '$uid' LIMIT 1");
36
+			$prefs = dbassoc($prefsquery);
37
+			if(isset($prefs['newrespond']) && $prefs['newrespond'] == 1) {
38
+				include("includes/emailer.php");
39
+				sendemail($prefs['penname'], $prefs['email'], $sitename, $siteemail, _RESPONSESUBJECT, preg_replace(array("@\{penname\}@", "@\{review\}@"), array(USERPENNAME, $reviewid), _RESPONSETEXT), "html");
40
+			}
41
+		}
42
+		$back = sprintf(_BACK2REVIEWS, "item=$item&amp;type=$type".(isset($chapid) ? "&amp;chapid=$chapid" : ""));
43
+		if($success) $output .= write_message(_ACTIONSUCCESSFUL."  ".$back);
44
+		else $output .= write_error(_ERROR);
45
+	}
46
+	else {
47
+		$reviewid = isset($_GET['reviewid']) && isNumber($_GET['reviewid']) ? $_GET['reviewid'] : false;
48
+		if(!$reviewid) accessDenied( );
49
+		$result = dbquery("SELECT review.*, UNIX_TIMESTAMP(review.date) as date FROM ".TABLEPREFIX."fanfiction_reviews as review LEFT JOIN ".TABLEPREFIX."fanfiction_authors as member ON member.uid = review.uid WHERE review.reviewid = '$reviewid' LIMIT 1");
50
+		$reviews = dbassoc($result);
51
+		if(!empty($reviews['respond'])) {
52
+			$tpl->assign("output", write_message(_ALREADYRESPONDED));
53
+			$tpl->printToScreen( );
54
+			dbclose( );
55
+			exit( );
56
+
57
+		}
58
+		$type = $reviews['type'];
59
+		if($type == "SE") $query2 = "SELECT uid FROM ".TABLEPREFIX."fanfiction_series WHERE seriesid = '".$reviews['item']."'";
60
+		else if($type == "ST") {
61
+			$query2 = "SELECT uid, coauthors FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '".$reviews['item']."' LIMIT 1";
62
+		}
63
+		else { 
64
+			$codeblock = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'reviewto'");
65
+			while($code = dbassoc($codeblock)) {
66
+				eval($code['code_text']);
67
+			}
68
+		}
69
+		$user = dbassoc(dbquery($query2));
70
+		if(!empty($user['coauthors'])) {
71
+			$coQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '".$reviews['item']."'");
72
+			while($c = dbassoc($coQuery)) {
73
+				$coauthors[] = $c['uid'];
74
+			}
75
+		}
76
+		if(USERUID == $user['uid'] || (!empty($user['coauthors']) && in_array(USERUID, $coauthors))) {
77
+			if($type == "ST") {
78
+				$storyquery = dbquery("SELECT s.title, s.uid, r.rid, r.rating, r.ratingwarning, r.warningtext, s.sid FROM ".TABLEPREFIX."fanfiction_stories as s, ".TABLEPREFIX."fanfiction_ratings as r WHERE s.sid = '".$reviews['item']."' AND s.rid = r.rating LIMIT 1");
79
+				$story = dbassoc($storyquery);
80
+				$authoruid = $story['uid'];
81
+				$title = title_link($story);
82
+			}
83
+			else if($type == "SE") {
84
+				$storyquery = dbquery("SELECT title, uid FROM ".TABLEPREFIX."fanfiction_series WHERE seriesid = '$item' LIMIT 1");
85
+				list($title, $authoruid) = dbrow($storyquery);
86
+				$title = stripslashes($title);
87
+				$title = "<a href=\"series.php?seriesid=$item\">$title</a>";
88
+			}
89
+			else { 
90
+				$titlequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'revtitle'");
91
+				while($code = dbassoc($titlequery)) {
92
+					eval($code['code_text']);
93
+				}
94
+			}
95
+			if($reviews['uid']) {
96
+				$reviewer = "<a href=\"viewuser.php?uid=".$reviews['uid']."\">".$reviews['reviewer']."</a>";
97
+				$member = _SIGNED;
98
+			}
99
+			else {
100
+				if(USERUID == $authoruid && $revdelete && !isADMIN) $adminlink .= " [<a href=\"reviews.php?action=delete&amp;reviewid=".$reviews['reviewid']."\">"._DELETE."</a>]";
101
+				$reviewer = $reviews['reviewer'];
102
+				$member = _ANONYMOUS;
103
+			}
104
+			if(file_exists("$skindir/reviewblock.tpl")) $revlist = new TemplatePower( "$skindir/reviewblock.tpl" );
105
+			else $revlist = new TemplatePower("default_tpls/reviewblock.tpl");
106
+			$revlist->prepare( );
107
+			$revlist->newBlock("reviewsblock");
108
+			$revlist->assign("reviewer"   , $reviewer );
109
+			$revlist->assign("review"   , $reviews['review']);
110
+			$revlist->assign("chapter", (isset($chaptitle) ? _CHAPTER." $chapnum: $chaptitle" : ($story['title'] ? $story['title'] : _NONE)) );
111
+			$revlist->assign("reviewdate", date("$dateformat", $reviews['date']) );
112
+			$revlist->assign("rating", ratingpics($reviews['rating']) );
113
+			$revlist->assign("member", $member );
114
+			$revlist->assign("oddeven", "odd");
115
+			$output .= $revlist->getOutputContent( );
116
+			$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"user.php?action=revres\">";
117
+			$output .= "<INPUT type=\"hidden\" name=\"rid\" value=\"$reviewid\">
118
+				<div style=\"text-align: center;\"><label for=\"response\">"._AUTHORSRESPONSE.":</label><span style='clear: left;'>&nbsp;</span></div>
119
+				<div class='shorttextarea'><textarea class=\"textbox\" name=\"response\" id=\"response\" style='width: 100%;' rows=\"5\"></TEXTAREA></div>";
120
+			if($tinyMCE) 
121
+				$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('response');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
122
+			$output .= "<div style=\"text-align: center;\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" id=\"submit\" value=\""._SUBMIT."\"></div></form>";
123
+		}
124
+		else accessDenied( );
125
+	}
126
+?>
0 127
\ No newline at end of file