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,118 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// eFiction 3.0
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
+	if(isset($_GET['do'])) $do = $_GET["do"];
28
+	else $do = false;
29
+	if(isset($_GET["revoke"])) {
30
+		if(isset($_GET["confirm"])) {
31
+			$output .= "<div id='pagetitle'>"._REVOKEADMIN."</div>";
32
+			if($_GET["confirm"] == "yes" && USERUID != $_GET['revoke']) {
33
+				$result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET level = '0' WHERE uid = '".$_GET['revoke']."'");
34
+				if($result) $output .=  write_message(_ACTIONSUCCESSFUL);
35
+				else {
36
+					$result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(`level`, `uid`) VALUES ('0', '".$_GET['revoke']."')"); // shouldn't be possible, but better safe than sorry.
37
+					$output .= write_error(_ERROR." "._TRYAGAIN);
38
+				}
39
+			}
40
+			else 
41
+			$output .= write_message(_ACTIONCANCELLED);
42
+		}
43
+		else {
44
+			$output .= write_message(_CONFIRMADMINREVOKE." [ <a href=\"admin.php?action=admins&confirm=yes&revoke=".$_GET['revoke']."\">"._YES."</a> | <a href=\"admin.php?action=admins&confirm=no&revoke=".$_GET['revoke']."\">"._NO."</a> ]</center>");
45
+		}
46
+	}
47
+	else if($do) {
48
+		if(isset($_POST['submit'])) {
49
+			$contact = (isset($_POST['contact']) && $_POST['contact'] == "on" ? "1" : "0");
50
+			if($_POST['catid']) $categories = $_POST['catid'];
51
+			else $categories = "0";
52
+			if(check_prefs($_POST['uid'])) $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET level = '".$_POST['adlevel']."', contact = '$contact', categories = '$categories' WHERE uid = '".$_POST['uid']."'");
53
+			else $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(`level`, `contact`, `categories`,  `uid`) VALUES ('".$_POST['adlevel']."', '$contact', '$categories', '".$_POST['uid']."')");
54
+			if($result) $output .= write_message(_ACTIONSUCCESSFUL._BACK2ADMIN);
55
+			else $output .= write_message(_ERROR);
56
+		}
57
+		else {
58
+			if($do == "edit") {
59
+				$uid = $_GET['uid'];
60
+				$info = dbquery("SELECT "._PENNAMEFIELD." as penname, level, categories, contact FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
61
+				list($penname, $adlevel, $adcategories, $adcontact) = dbrow($info);
62
+				$catid = explode(",", $adcategories);
63
+			}
64
+			$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : false;
65
+			if(!isNumber($uid)) $uid = false;
66
+			$output .= "<div id=\"pagetitle\">".($do == "edit" ? _EDITADMIN : _ADDADMIN)."</div>
67
+				<form method=\"POST\" name=\"form\" enctype=\"multipart/form-data\" action=\"admin.php?action=admins&do=$do\">
68
+				<div><label for=\"uid\">"._PENNAME.": </label>";
69
+			if($do == "new") {
70
+				$query = dbquery("SELECT "._PENNAMEFIELD." AS penname, "._UIDFIELD." AS uid, ap.level FROM "._AUTHORTABLE." LEFT  JOIN ".TABLEPREFIX."fanfiction_authorprefs AS ap ON "._UIDFIELD." = ap.uid ORDER  BY "._PENNAMEFIELD);
71
+				$output .= "<select name=\"uid\">";
72
+				while($users = dbassoc($query)) {
73
+					if(!$users['level']) $output .= "<option value=\"".$users['uid']."\"".($uid == $users['uid'] ? " selected" : "").">".$users['penname']."</option>";
74
+				}	
75
+				$output .= "</select></div>";
76
+			}
77
+			else if($do == "edit" && !empty($uid)) {
78
+				$output .= $penname."<input type=\"hidden\" name=\"uid\" value=\"$uid\"></div>";
79
+			}
80
+			$output .= "<div><label for=\"adlevel\">"._LEVEL.":</label>  <select name=\"adlevel\">";
81
+				for($x = 1; $x < 5; $x++) {
82
+					$output .= "<option value=\"$x\"".(isset($adlevel) && $adlevel == $x ? " selected" : "").">$x</option>";
83
+				}
84
+			$output .= "</select><A HREF=\"#adlevel\" class=\"pophelp\">[?]<span>"._HELP_ADLEVEL."</span></A></div>";
85
+			include("includes/categories.php");
86
+			$output .= (isset($adcategories) ? "<input type=\"hidden\" name=\"oldcats\" value=\"$adcategories\">" : "")."
87
+				<div><label for=\"contact\">"._CONTACT.":</label>
88
+				<INPUT type=\"checkbox\" class=\"checkbox\" name=\"contact\"".(isset($adcontact) && $adcontact == 1 ? " checked" : "").">
89
+				<A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_CONTACTSUB."</span></A></div>
90
+				<INPUT type=\"submit\" class=\"button\" id=\"submit\" value=\""._SUBMIT."\" name=\"submit\">
91
+				</form>";
92
+		}
93
+	}
94
+	else if(isset($_GET['category'])) {
95
+		$where = "WHERE (categories = '0' OR FIND_IN_SET('".$_GET['category']."', categories) > 0) AND ap.level > 0";
96
+		list($category) = dbrow(dbquery("SELECT category FROM ".TABLEPREFIX."fanfiction_categories WHERE catid = '".$_GET['category']."' LIMIT 1"));
97
+		$output .= "<center><p><b>$category "._ADMINS."</b></p>";
98
+		$authorlink = "<a href=\"admin.php?action=admins&amp;do=edit&amp;uid=";
99
+		$pagelink = "admin.php?action=admin&amp;category=".$_GET['category']."&amp;";
100
+		$countquery = "SELECT count(uid) FROM ".TABLEPREFIX."fanfiction_authorprefs as ap $where";
101
+		$authorquery = "SELECT count(stories.sid) as stories, "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM ".TABLEPREFIX."fanfiction_authorprefs as ap, "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_stories as stories ON ("._UIDFIELD." = stories.uid) AND "._UIDFIELD." > 0 AND stories.validated > 0 $where AND ap.level > 0 ".(isset($letter) ? " AND $letter" : "")." AND ap.uid = "._UIDFIELD." GROUP BY "._UIDFIELD;
102
+		include("includes/members_list.php");
103
+		$output .= "<p><a href=\"admin.php?action=admins&do=new&category=".$_GET['category']."\">"._ADDADMIN."</a></p>";
104
+	}
105
+	else {
106
+
107
+		if($let == _OTHER) $letter = _PENNAMEFIELD." REGEXP '^[^a-z]'";
108
+		else $letter = _PENNAMEFIELD." LIKE '".$let."%'";
109
+		$output .= "<div class=\"sectionheader\">"._ADMINS."</div>";
110
+		$authorlink = "<a href=\"admin.php?action=admins&amp;do=edit&amp;uid=";
111
+		$pagelink = "admin.php?action=admins&amp;";
112
+		$countquery = "SELECT count(uid) FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE level > 0";
113
+		$authorquery = "SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid, count(stories.uid) as stories FROM (".TABLEPREFIX."fanfiction_authorprefs as ap, "._AUTHORTABLE.") LEFT JOIN ".TABLEPREFIX."fanfiction_stories as stories ON ("._UIDFIELD." = stories.uid) AND stories.validated > 0 WHERE ap.level > 0 ".(isset($letter) ? " AND $letter" : "")." AND ap.uid = "._UIDFIELD." GROUP BY "._UIDFIELD;
114
+		include("includes/members_list.php");
115
+		$output .= write_message("<a href=\"admin.php?action=admins&do=new\">"._ADDADMIN."</a>");
116
+	}
117
+
118
+?>
0 119
\ No newline at end of file