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,127 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// Copyright (c) 2007 by Tammy Keefer
4
+// Based on eFiction 1.1
5
+// Copyright (C) 2003 by Rebecca Smallwood.
6
+// http://efiction.sourceforge.net/
7
+// ----------------------------------------------------------------------
8
+// LICENSE
9
+//
10
+// This program is free software; you can redistribute it and/or
11
+// modify it under the terms of the GNU General Public License (GPL)
12
+// as published by the Free Software Foundation; either version 2
13
+// of the License, or (at your option) any later version.
14
+//
15
+// This program is distributed in the hope that it will be useful,
16
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+// GNU General Public License for more details.
19
+//
20
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
21
+// ----------------------------------------------------------------------
22
+
23
+// Identify the current page for the pagelinks etc.
24
+$current = "viewuser";
25
+
26
+// Include some files for page setup and core functions
27
+
28
+include ("header.php");
29
+
30
+//make a new TemplatePower object
31
+if(file_exists("$skindir/user.tpl")) $tpl = new TemplatePower( "$skindir/user.tpl" );
32
+else $tpl = new TemplatePower("default_tpls/user.tpl");
33
+if(file_exists("$skindir/listings.tpl")) $tpl->assignInclude( "listings", "./$skindir/listings.tpl" );
34
+else $tpl->assignInclude( "listings", "./default_tpls/listings.tpl" );
35
+$tpl->assignInclude( "header", "./$skindir/header.tpl" );
36
+$tpl->assignInclude( "footer", "./$skindir/footer.tpl" );
37
+if(file_exists("$skindir/profile.tpl")) $tpl->assignInclude("profile", "$skindir/profile.tpl");
38
+else $tpl->assignInclude("profile", "./default_tpls/profile.tpl");
39
+include("includes/pagesetup.php");	
40
+// If uid isn't a number kill the script with an error message.  The only way this happens is a hacker.
41
+if(empty($uid)) {
42
+	if(!isMEMBER) accessDenied( );
43
+	else $uid = USERUID;
44
+}
45
+if($displayprofile) include("user/profile.php");
46
+else if(isADMIN && uLEVEL < 3) {
47
+	$result2 = dbquery("SELECT * FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
48
+	$userinfo = dbassoc($result2);
49
+	$adminopts = "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".(isset($userinfo['validated']) && $userinfo['validated'] ? "[<a href=\"admin.php?action=members&amp;revoke=$uid\" class=\"vuadmin\">"._REVOKEVAL."</a>] " : "[<a href=\"admin.php?action=members&amp;validate=$uid\" class=\"vuadmin\">"._VALIDATE."</a>] ")."[<a href=\"user.php?action=editbio&amp;uid=$uid\" class=\"vuadmin\">"._EDIT."</a>] [<a href=\"admin.php?action=members&amp;delete=$uid\" class=\"vuadmin\">"._DELETE."</a>]";
50
+	$adminopts .= " [<a href=\"admin.php?action=members&amp;".($userinfo['level'] < 0 ? "unlock=".$userinfo['uid']."\" class=\"vuadmin\">"._UNLOCKMEM : "lock=".$userinfo['uid']."\" class=\"vuadmin\">"._LOCKMEM)."</a>]";
51
+	$adminopts .= " [<a href=\"admin.php?action=admins&amp;".(isset($userinfo['level']) && $userinfo['level'] > 0 ? "revoke=$uid\" class=\"vuadmin\">"._REVOKEADMIN."</a>] [<a href=\"admin.php?action=admins&amp;do=edit&amp;uid=$uid\" class=\"vuadmin\">"._EDITADMIN : "do=new&amp;uid=$uid\" class=\"vuadmin\">"._MAKEADMIN)."</a>]</div>";
52
+	$tpl->assign("adminoptions", $adminopts);
53
+}
54
+
55
+$infoquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
56
+
57
+list($penname) = dbrow($infoquery);
58
+$tpl->assign("pagetitle", "<div id='pagetitle'>$penname</div>");
59
+$panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE ".($action ? "panel_name = '$action' AND (panel_type = 'P' OR panel_type = 'F')" : "panel_type = 'P' AND panel_hidden = 0 ORDER BY panel_order ASC")." LIMIT 1");
60
+if($panelquery) {
61
+	$panel = dbassoc($panelquery);
62
+	if(!empty($panel['panel_url']) && file_exists(_BASEDIR.$panel['panel_url'])) include(_BASEDIR.$panel['panel_url']);
63
+	else if(file_exists("user/".$panel['panel_name'].".php")) include("user/".$panel['panel_name'].".php");
64
+	else $output .= write_error(_ERROR);
65
+}
66
+else if($action) $output .= write_error(_ERROR);
67
+
68
+$tpl->gotoBlock("_ROOT");
69
+$panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_hidden != '1' AND panel_level = '0' AND (panel_type = 'P'".($favorites ? " OR panel_type = 'F'" : "").") ORDER BY panel_type DESC, panel_order ASC, panel_title ASC");
70
+$numtabs = dbnumrows($panelquery);
71
+$tabwidth = floor(100 / $numtabs);
72
+if(!$panelquery) $output .= write_error(_ERROR);
73
+
74
+// Special tab counts
75
+$codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'userTabs'");
76
+while($code = dbassoc($codequery)) {
77
+	eval($code['code_text']);
78
+}
79
+
80
+while($panel = dbassoc($panelquery)) {
81
+	$panellink = "";
82
+	if(substr($panel['panel_name'], -2, 2) == "by") {
83
+		$itemcount = 0;
84
+		if($panel['panel_name'] == "storiesby") {
85
+			$count = dbquery("SELECT stories FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE uid = '$uid'");
86
+		}
87
+		else {
88
+			if(substr($panel['panel_name'], 0, 3) == "val") {
89
+				$table = substr($panel['panel_name'], 3);
90
+				$table = substr($table, 0, strlen($table) - 2);
91
+				$valid = 1;
92
+			}
93
+			else {
94
+				$table = $panel['panel_name'];
95
+				if(substr($panel['panel_name'], 0, strlen($panel['panel_name']) - 2) == "stories") $valid = 1;
96
+				else $valid = 0;
97
+			}
98
+			$count = dbquery("SELECT COUNT(uid) FROM ".TABLEPREFIX."fanfiction_".substr($table, 0, strlen($panel['panel_name']) - 2)." WHERE (uid = '$uid'".($panel['panel_name'] == "storiesby" ? " OR FIND_IN_SET($uid, coauthors) > 0" : "").")".($valid ? " AND validated > 0" : "").($panel['panel_name'] == "reviewsby" ? " AND review != 'No Review'" : ""));
99
+		}
100
+		list($itemcount) = dbrow($count);
101
+	}
102
+	if(substr($panel['panel_name'], 0, 3) == "fav" && $type = substr($panel['panel_name'], 3)) {
103
+		$itemcount = 0;
104
+		$countquery = dbquery("SELECT COUNT(item) FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '$uid' AND type = '$type'");
105
+		list($itemcount) = dbrow($countquery);
106
+	}
107
+	if($panel['panel_name'] == "favlist") {
108
+		$itemcount = 0;
109
+		$countquery = dbquery("SELECT COUNT(item) FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '$uid'");
110
+		list($itemcount) = dbrow($countquery);
111
+	}
112
+	if(!empty($tabCounts[$panel['panel_name']])) $itemcount = $tabCounts[$panel['panel_name']];
113
+	$panellinkplus = "<a href=\"viewuser.php?action=".$panel['panel_name']."&amp;uid=$uid\">".preg_replace("<\{author\}>", $penname, stripslashes($panel['panel_title'])).(isset($itemcount) ? " [$itemcount]" : "")."</a>\n";
114
+	$panellink = "<a href=\"viewuser.php?action=".$panel['panel_name']."&amp;uid=$uid\">".preg_replace("<\{author\}>", $penname, stripslashes($panel['panel_title']))."</a>\n";
115
+	$tpl->newBlock("paneltabs");
116
+	$tpl->assign("tabwidth", $tabwidth);
117
+	$tpl->assign("class", $action == $panel['panel_name'] || (empty($action) && $panel['panel_order'] == 1 && $panel['panel_type'] == "P") ? "id='active'" : "");
118
+	$tpl->assign("link", $panellink);
119
+	$tpl->assign("linkcount", $panellinkplus);
120
+	$tpl->assign("count", (isset($itemcount) ? " [$itemcount]" : ""));
121
+	unset($panellink, $panellinkplus, $itemcount);
122
+}
123
+$tpl->gotoBlock("_ROOT");	
124
+$tpl->assign( "output", $output );
125
+$tpl->printToScreen();
126
+dbclose( );
127
+?>
0 128
\ No newline at end of file