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,106 @@
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
+$output .= "<div id=\"pagetitle\">"._RATINGS."</div>";
27
+	$showlist = 1;
28
+	if(isset($_GET["delete"]) && isNumber($_GET["delete"])) {
29
+		$rid = $_GET["delete"];
30
+		$confirm = isset($_GET["confirm"]) ? $_GET["confirm"] : false;
31
+		if($confirm == "yes")
32
+		{
33
+			$result5 = dbquery("SELECT rating FROM ".TABLEPREFIX."fanfiction_ratings WHERE rid = '$rid'");
34
+			$ratings = dbassoc($result5);
35
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET rid = '"._NONE."' WHERE sid = '$ratingresult[sid]'");
36
+			dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_ratings WHERE rid = '$rid'");
37
+			$output .= write_message(_ACTIONSUCCESSFUL);
38
+		}
39
+		else if ($confirm == "no")
40
+		{
41
+			$output .= write_message(_ACTIONCANCELLED);
42
+		}
43
+		else
44
+		{
45
+			$showlist = 0;
46
+			$output .= write_message(_CONFIRMDELETE."<br /><br />
47
+[ <a href=\"admin.php?action=ratings&delete=$rid&confirm=yes\">"._YES."</a> | <a href=\"admin.php?action=ratings&delete=$rid&confirm=no\">"._NO."</a> ]");
48
+		}
49
+	}
50
+	if (isset($_POST["submit"]) && ((isset($_GET['rid']) && isNumber($_GET['rid'])) || $_GET['rid'] == "new")) {
51
+		$newrate = escapestring(strip_tags(descript($_POST['rating'])));
52
+		$newtext = escapestring(strip_tags(descript($_POST['warningtext'])));
53
+		$ratingwarning = isset($_POST['ratingwarning']) ? 1 : 0;
54
+		if(isset($_POST['rusersonly'])) $ratingwarning = $ratingwarning + 4;
55
+		if(isset($_POST['ageconsent'])) $ratingwarning = $ratingwarning + 2;
56
+		if($_GET["rid"] == "new") $ratingquery = "INSERT INTO ".TABLEPREFIX."fanfiction_ratings (rating, ratingwarning, warningtext) VALUES ('$newrate', '$ratingwarning', '$newtext')";
57
+		else $ratingquery = "UPDATE ".TABLEPREFIX."fanfiction_ratings SET rating = '$newrate', ratingwarning = '$ratingwarning', warningtext = '$newtext' WHERE rid = '".$_GET['rid']."'";
58
+		dbquery($ratingquery);
59
+		if($_GET["rid"] != "new" && $newrate != $_POST['oldrating']) dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET rid = '$newrate' WHERE rid = '".$_POST['oldrating']."'");
60
+		$output .= write_message(_ACTIONSUCCESSFUL);
61
+	}
62
+	else if(isset($_GET["rid"])) {
63
+		$showlist = 0;
64
+		$new = $_GET['rid'] == "new" ? true : false;
65
+		if(!$new && isNumber($_GET["rid"])) {
66
+			$ratingquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_ratings WHERE rid = '".$_GET['rid']."' LIMIT 1");
67
+			$rating = dbassoc($ratingquery);
68
+		}
69
+		$output .= "<form method=\"POST\" id='settingsform' enctype=\"multipart/form-data\" action=\"admin.php?action=ratings&rid=".$_GET['rid']."\">
70
+			<div class='sectionheader'>".($new ? _NEWRAT : _EDITRAT)."</div>
71
+			<div><label for='rating'>"._RATING.": </label> 
72
+			<INPUT  type=\"text\" class=\"textbox=\" name=\"rating\"".($new ? "" : "value=\"".$rating['rating']."\"")."><A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_RATING."</span></A>";
73
+		if(isset($rating)) 
74
+			$output .= "<input type=\"hidden\" name=\"oldrating\" value=\"".$rating['rating']."\">";
75
+		$warninglevel = isset($rating) ? sprintf("%03b", $rating['ratingwarning']) : array(0,0,0);
76
+		$output .= "</div><div><label for='ratingwarning'>"._WARNINGPOP.": </label>
77
+		<INPUT type=\"checkbox\" class=\"checkbox\" name=\"ratingwarning\"".(!$new && $warninglevel[2] ? " checked" : "")."><A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_RATINGWARNING."</span></A></div>
78
+		<div><label for='ageconsent'>"._AGECHECK.": </label>
79
+		<INPUT type=\"checkbox\" class=\"checkbox\" name=\"ageconsent\"".(!$new && $warninglevel[1] ? " checked" : "")."><A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_RATINGCONSENT."</span></A></div>
80
+		<div><label for='rusersonly'>"._RUSERSONLY.": </label>
81
+		<INPUT type=\"checkbox\" class=\"checkbox\" name=\"rusersonly\"".(!$new && $warninglevel[0] ? " checked" : "")."><A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_RATINGUSERS."</span></A></div>
82
+		<div><label for='warningtext'>"._WARNINGTEXT.": </label>
83
+		<textarea class=\"textarea\" name=\"warningtext\" cols=\"35\" rows=\"4\">".($new ? "" : $rating['warningtext'])."</TEXTAREA>";
84
+		if($tinyMCE) 
85
+			$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('warningtext');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";	
86
+		$output .= "</div><div style='text-align: center;'><A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_RATINGWARNTEXT."</span></A></div><INPUT type=\"submit\" class=\"button\" id='submit' value=\""._SUBMIT."\" name=\"submit\">";
87
+	}
88
+	if($showlist) {
89
+		$result = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_ratings");
90
+
91
+		//List of current ratings
92
+		$output .= "<table class=\"tblborder\" cellspacing=\"0\" cellpadding=\"o\" align=\"center\" style='margin: 0 auto;'>
93
+		<tr><th colspan=\"3\" align=\"center\" class=\"tblborder\">"._RATINGS."</th></tr>";
94
+		$output .= "<tr><td class=\"tblborder\"><b>"._RATING."</b></td><td class=\"tblborder\"><b>"._WARNING."</b></td><td class=\"tblborder\"><b>"._OPTIONS."</b></td></tr>";
95
+		while ($ratingresults = dbassoc($result))
96
+		{
97
+		$output .= "<tr><td class=\"tblborder\">".$ratingresults['rating'];
98
+			if($ratingresults['ratingwarning'] >= 1)
99
+				$output .= "</td><td class=\"tblborder\">"._YES."";
100
+			else
101
+				$output .= "</td><td class=\"tblborder\">"._NO."";
102
+			$output .= "</td><td class=\"tblborder\"><a href=\"admin.php?action=ratings&rid=".$ratingresults['rid']."\">"._EDIT."</a> | <a href=\"admin.php?action=ratings&delete=".$ratingresults['rid']."\">"._DELETE."</td></tr>";
103
+		}
104
+		$output .= "<tr><td colspan=\"3\" align=\"center\" class=\"tblborder\"><a href=\"admin.php?action=ratings&rid=new\">"._ADDRAT."</a></td></tr></table>";
105
+	}
106
+?>
0 107
\ No newline at end of file