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,109 @@
1
+<?php
2
+
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+if(!defined("_CHARSET")) exit( );
27
+
28
+function warnings( ) {
29
+	global $allowed_tags;
30
+
31
+	$output .= "<center><h4>"._WARNINGS."</h4></center>";
32
+	if($_GET["delete"]) {
33
+		$wid = $_GET["delete"];
34
+		if($_GET["confirm"] == "yes")
35
+		{
36
+			$result5 = dbquery("SELECT warning FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '$wid'");
37
+			$warnings = dbassoc($result5);
38
+			$newquery5 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_stories WHERE FIND_IN_SET($wid, wid) > 1");
39
+				while($warningresult = dbassoc($newquery5))
40
+				{
41
+					$tok = strtok($warningresult['wid'], ", ");// tokenize the old list of names
42
+					$newString = "";// the new list of good names
43
+					while($tok)
44
+					{
45
+						if( $tok != $warnings['warning'] )// oldname is the thing that is going away
46
+						{
47
+							// It's a keeper, so decide if it is first or not for comma-age, then add it in
48
+							if( $newString != "" )
49
+								$newString .= ", ";
50
+							$newString .= $tok;
51
+						}
52
+						$tok = strtok(", "); //advance to the next token
53
+					}
54
+					dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET wid = '$newString' WHERE sid = '".$warningresult['sid']."'");
55
+				}
56
+			dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_warnings where wid = '$wid'");
57
+			$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
58
+		}
59
+		else if ($_GET["confirm"] == "no")
60
+		{
61
+			$output .= "<center>"._ACTIONCANCELLED."</center>";
62
+		}
63
+		else
64
+		{
65
+			$output .= "<center>"._CONFIRMDELETE."<br /><br />";
66
+			$output .= "[ <a href=\"admin.php?action=warnings&delete=$wid&confirm=yes\">"._YES."</a> | <a href=\"admin.php?action=warnings&delete=$wid&confirm=no\">"._NO."</a> ]</center>";
67
+			return $output;
68
+		}
69
+	}
70
+	if ($_POST['submit']) {
71
+		if($_GET['warning'] == "new") dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(stripinput(strip_tags($_POST['warning'])))."')") or die(_FATALERROR."Query: INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(strip_tags($_POST['warning']))."')<br />Error: (".mysql_errno( ).") ".mysql_error( ));
72
+		else dbquery("UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(stripinput(strip_tags($_POST['warning'])))."' WHERE wid = '".$_GET['warning']."'") or die(_FATALERROR."Query: UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(strip_tags($_POST['warnings']))."' WHERE wid = '".$_GET['warning']."'<br />Error: (".mysql_errno( ).") ".mysql_error( ));
73
+			$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
74
+	}
75
+	else {
76
+		if(isset($_GET['warning'])) {
77
+			if($_GET['warning'] != "new") {
78
+				$warnquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1") or die(_FATALERROR."Query: SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1<br />Error: (".mysql_errno( ).") ".mysql_error( ));
79
+				$warning = dbassoc($warnquery);
80
+			}
81
+			$output .=  "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=warnings&warning=".$_GET['warning']."\">
82
+			<table align=\"center\">	<tr><td colspan=\"2\">	<b>".($_GET['warning'] == "new" ? _NEWWARNING : _EDITWARNING)."</b></td></tr>
83
+			<tr><td>"._WARNING.": <A HREF=\"javascript:pop('docs/adminhints.htm#warnings');\">[?]</A>
84
+			</td><td><INPUT  type=\"text\" class=\"textbox=\"  name=\"warning\" value=\"".$warning['warning']."\"></td></tr>
85
+			<tr><td colspan=\"2\"><INPUT type=\"submit\" class=\"button\" value=\""._SUBMIT."\" name=\"submit\"></td></tr></table></form>";
86
+		}
87
+		else {
88
+
89
+			$result = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_warnings");
90
+
91
+			//List of current warnings
92
+
93
+			$output .= "<table class=\"tblborder\" cellpadding=\"3\" cellspacing=\"0\" align=\"center\">
94
+			<tr><th colspan=\"2\" align=\"center\">"._WARNINGS."</th></tr>
95
+			<tr><td colspan=\"2\" align=\"center\" class=\"tblborder\"><a href=\"admin.php?action=warnings&warning=new\">"._ADDWARNING."</a></td></tr>";
96
+			while ($warningresults = dbassoc($result))
97
+			{
98
+				$output .=  "<tr><td class=\"tblborder\">".$warningresults['warning'];
99
+				$output .=  "</td><td class=\"tblborder\"><a href=\"admin.php?action=warnings&warning=".$warningresults['wid']."\">"._EDIT."</a> | <a href=\"admin.php?action=warnings&delete=".$warningresults['wid']."\">"._DELETE."</td></tr>";
100
+			}
101
+			$output .= "</table>";
102
+
103
+		}
104
+	}
105
+	return $output;
106
+}
107
+// end warnings function
108
+
109
+?>
0 110
\ No newline at end of file