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,90 @@
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
+
26
+$disablesorts = array("categories");
27
+
28
+// Get variables
29
+	$catid = isset($_GET['catid']) && isNumber($_GET['catid']) ? $_GET['catid'] : -1;
30
+
31
+// End variables
32
+	if($catid == -1) $output .= "<div id=\"pagetitle\">"._CATEGORIES."</div>";
33
+	else $output .= "<div id=\"pagetitle\">".catlist($catid)."</div>";
34
+	$subs = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_categories WHERE parentcatid = '$catid' ORDER BY displayorder ASC");
35
+	$total = dbnumrows($subs);
36
+	$list = floor($total / $displaycolumns);
37
+	if($total % $displaycolumns != 0) $list++;
38
+	$colwidth = (100/$displaycolumns) -1;
39
+	$count = 0;
40
+	$column = 1;
41
+	$content = "";
42
+	if($total) {
43
+		$collist = array();
44
+		$colcount = floor(($total / $displaycolumns) + ($total % $displaycolumns ? 1 : 0));
45
+		if(!$colcount) $colcount = 1;
46
+		$mod = $total % $displaycolumns;
47
+		$col = 0;
48
+		$count = 0;
49
+		while($cats = dbassoc($subs)) {
50
+			unset($catinfo);
51
+			$count++;
52
+			if(file_exists("$skindir/categories.tpl")) $cat = new TemplatePower( "$skindir/categories.tpl" );
53
+			else $cat = new TemplatePower("default_tpls/categories.tpl");
54
+			$cat->prepare( );
55
+			$cat->newBlock("categoryblock");
56
+			$cat->assign("image", ($cats['image'] && file_exists("$skindir/images/".$cats['image']) ? "<img src=\"$skindir/images/".$cats['image']."\" alt=\"".$cats['category']."\" title=\"".$cats['category']."\">" : ""));
57
+			$cat->assign("link", "<a href=\"browse.php?type=categories&amp;catid=".$cats['catid']."\">".$cats['category']."</a>");
58
+			$cat->assign("count", "[".$cats['numitems']."]");
59
+			$cat->assign("description", stripslashes($cats['description']));
60
+			if($displaycolumns == 1) $content .= "<div>".$cat->getOutputContent( )."</div>";
61
+			else $collist[$col][] = "<div>".$cat->getOutputContent( )."</div>";
62
+			if(($mod && $col < $mod && $count == $colcount) || ($mod && $col >= $mod && $count >= ($colcount - 1)) || (!$mod && $count == $colcount)) {
63
+				$col++;
64
+				$count = 0;
65
+			}
66
+		}
67
+		if($displaycolumns > 1) {
68
+			$output .= "<div id=\"columncontainer\"><div><div id=\"browseblock\">";
69
+			$col = 0;
70
+			for($a = 0; $a < $colcount; $a++) {
71
+				$output .= "<div class=\"row\">";
72
+				foreach($collist as $c) {
73
+					if(isset($c[$a])) $output .= "<div class=\"column\">".$c[$a]."</div>";
74
+				}
75
+				$output .= "<div class=\"cleaner\">&nbsp;</div></div>";
76
+			}
77
+			$output .= "</div><div>&nbsp;</div></div></div>";
78
+		}
79
+		else {
80
+			$output .= "<div id=\"columncontainer\">";
81
+			$output .= $content;
82
+			$output .= "</div>";
83
+		}
84
+	}
85
+	if($catid > 0) {
86
+		$storyquery .= _ORDERBY;
87
+		$numrows = search(_STORYQUERY.$storyquery, _STORYCOUNT.$countquery, "browse.php?");
88
+	}
89
+	$catid = array($catid);
90
+?>
0 91
\ No newline at end of file