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,56 @@
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
+if(!isset($anonchallenges)) accessDenied( );
25
+
26
+if(file_exists(_BASEDIR."modules/challenges/languages/{$language}.php")) include_once(_BASEDIR."modules/challenges/languages/{$language}.php");
27
+else include_once(_BASEDIR."modules/challenges/languages/en.php");
28
+
29
+$chalquery = dbquery("SELECT chal.*, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_challenges as chal, "._AUTHORTABLE." WHERE "._UIDFIELD." = chal.uid ORDER BY chal.responses DESC LIMIT 10");
30
+if(dbnumrows($chalquery) > 0) {
31
+	$count = 0;
32
+	if(file_exists("./$skindir/challenges.tpl")) $challenges = new TemplatePower("./$skindir/challenges.tpl");
33
+	else $challenges = new TemplatePower("./"._BASEDIR."modules/challenges/default_tpls/challenges.tpl");
34
+	$challenges->prepare( );
35
+	while($challenge = dbassoc($chalquery)) {
36
+		$challenges->newBlock("challenge");
37
+		if(isADMIN || USERUID == $challenge['uid']) $challenges->assign("adminoptions", "<div class=\"adminoptions\"><span class=\"label\">".(isADMIN ? _ADMINOPTIONS : _OPTIONS).":</span> [<a href=\"challenges.php?action=edit&amp;chalid=".$challenge['chalid']."\">"._EDIT."</a>] [<a href=\"challenges.php?action=delete&amp;chalid=".$challenge['chalid']."\">"._DELETE."</a>]</div>");
38
+		$challenges->assign("author", ($challenge['uid'] ? "<a href=\"viewuser.php?uid=".$challenge['uid']."\">".$challenge['challenger']."</a>" : $challenge['challenger']));
39
+		$challenges->assign("title", "<a href=\"modules/challenges/challenges.php?chalid=".$challenge['chalid']."\">".stripslashes($challenge['title'])."</a>");
40
+		$challenges->assign("numresponses", "<a href=\"modules/challenges/challenges.php?chalid=".$challenge['chalid']."\">".$challenge['responses']."</a>");
41
+		$challenges->assign("responses", "<a href=\"modules/challenges/challenges.php?chalid=".$challenge['chalid']."\">"._RESPONSES."</a>");
42
+		$challenges->assign("summary", stripslashes($challenge['summary']));
43
+		$challenges->assign("characters", $challenge['characters'] ? charlist($challenge['characters']) : _NONE);
44
+		$challenges->assign("category"   , ($challenge['catid'] > 0 ? catlist($challenge['catid']) : _NONE) );
45
+		$challenges->assign("respond", "<div class=\"respond\"><a href=\"modules/challenges/challenges.php?action=respond&amp;chalid=".$challenge['chalid']."\">"._RESPOND2CHALLENGE."</a></div>");
46
+		$count++;
47
+		$challenges->assign("oddeven", ($count % 2 ? "odd" : "even"));
48
+	}
49
+	$tpl->newBlock("listings");
50
+	if(dbnumrows($chalquery) > $itemsperpage) $tpl->assign("pagelinks", build_pagelinks(basename($_SERVER['PHP_SELF'])."?=challengesby&amp;uid=$uid&amp;", $numchal, $offset));
51
+	$tpl->gotoBlock("_ROOT");
52
+	$output .= $challenges->getOutputContent( );
53
+
54
+}
55
+else $output .= write_message(_NORESULTS);
56
+?>