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,76 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// Copyright (c) 2007 by Tammy Keefer
4
+// Valid HTML 4.01 Transitional
5
+// Based on eFiction 1.1
6
+// Copyright (C) 2003 by Rebecca Smallwood.
7
+// http://efiction.sourceforge.net/
8
+// ----------------------------------------------------------------------
9
+// LICENSE
10
+//
11
+// This program is free software; you can redistribute it and/or
12
+// modify it under the terms of the GNU General Public License (GPL)
13
+// as published by the Free Software Foundation; either version 2
14
+// of the License, or (at your option) any later version.
15
+//
16
+// This program is distributed in the hope that it will be useful,
17
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
+// GNU General Public License for more details.
20
+//
21
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
22
+// ----------------------------------------------------------------------
23
+if(!defined("_CHARSET")) exit( );
24
+
25
+$current = "authors";
26
+
27
+$uid = isset($_GET['uid']) && isNumber($_GET['uid']) ? $_GET['uid'] : 0;
28
+
29
+if($uid > 0) {
30
+	$query = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
31
+	list($penname) = dbrow($query);
32
+	$output = "<div id='pagetitle'>".stripslashes($penname)."</div>\n";
33
+	$squery = "SELECT stories.*, "._PENNAMEFIELD." as penname, stories.date as date, stories.updated as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as coauth ON coauth.sid = stories.sid WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 $squery AND (stories.uid = '$uid' OR coauth.uid = '$uid') "._ORDERBY;
34
+	$cquery = "SELECT count(stories.sid) FROM ".TABLEPREFIX."fanfiction_stories as stories LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as coauth ON stories.sid = coauth.sid WHERE validated > 0 $countquery AND (stories.uid = '$uid' OR coauth.uid = '$uid')";
35
+	$numrows = search($squery, $cquery, "browse.php?");
36
+}
37
+else {
38
+	$output .= "<div id=\"pagetitle\">"._AUTHORS.($let ? " - $let" : "")."</div>".build_alphalinks("browse.php?$terms&amp;", $let);
39
+
40
+	if($let == _OTHER) $query = " "._PENNAMEFIELD." REGEXP '^[^a-z]'";
41
+	else if($let) $query = " "._PENNAMEFIELD." LIKE '$let%'";
42
+	else $query = "";
43
+
44
+	$authorquery = "SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid, ap.stories FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs AS ap ON "._UIDFIELD." = ap.uid WHERE ap.stories > 0 ".($query ? " AND $query" : "");
45
+	$countquery = "SELECT count(ap.uid) FROM ".TABLEPREFIX."fanfiction_authorprefs AS ap LEFT JOIN "._AUTHORTABLE." ON "._UIDFIELD." = ap.uid ".($query ? " AND $query" : "");
46
+	$uid = 0;
47
+	$count = dbquery($countquery);
48
+	list($numrows)= dbrow($count);
49
+	$limit = $itemsperpage *  $displaycolumns;
50
+	$total = ($numrows > $limit ? $limit : $numrows);
51
+	$list = floor($total /  $displaycolumns);
52
+	if($total % $displaycolumns != 0) $list++;
53
+	$colwidth = (100/ $displaycolumns) -1;
54
+	$count = 0;
55
+	$column = 1;
56
+	$result2 = dbquery($authorquery." ORDER BY "._PENNAMEFIELD." LIMIT $offset,$limit");
57
+	$output .= "<div id=\"columncontainer\"><div id=\"browseblock\">".($displaycolumns ? "<div class=\"column\">" : "");
58
+	while($auth = dbassoc($result2)) {
59
+		$count++;
60
+		 $output .= "<a href=\"browse.php?type=authors&amp;uid=".$auth['uid']."\">".stripslashes($auth['penname'])."</a> [".$auth['stories']."]<br />";
61
+		if( $count >= $list && $column != $displaycolumns) {
62
+			$output .= "</div><div class=\"column\">";
63
+			if($total % $displaycolumns == $column) $list--;
64
+			$column++;
65
+			$count = 0;
66
+		}
67
+	}
68
+	$output .= "</div>".($displaycolumns ? "</div>" : "")."<div class='cleaner'>&nbsp;</div></div>";
69
+	if ($numrows > $limit) {
70
+		$output .= build_pagelinks("browse.php?type=authors".($let ? "&amp;let=$let" : "")."&amp;", $numrows, $offset, $displaycolumns);
71
+	}
72
+	else if(!$numrows) $output .= write_message(_NORESULTS);
73
+	$numrows = 0;
74
+}	
75
+	$seriesquery .= (!empty($seriesquery) ? " AND " : "")."uid = '$uid'";
76
+?>
0 77
\ No newline at end of file