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,71 @@
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
+if(!isset($uid)) {
26
+	$uid = USERUID;
27
+}
28
+else {
29
+	$authquery = dbquery("SELECT "._PENNAMEFIELD." FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid'");
30
+	list($penname) = dbrow($authquery);
31
+}
32
+if(file_exists(_BASEDIR."modules/challenges/languages/{$language}.php")) include_once(_BASEDIR."modules/challenges/languages/{$language}.php");
33
+else include_once(_BASEDIR."modules/challenges/languages/en.php");
34
+$countquery = dbquery("SELECT COUNT(chalid) FROM ".TABLEPREFIX."fanfiction_challenges WHERE uid = '$uid'");
35
+list($numchal) = dbrow($countquery);
36
+if($numchal) {
37
+	$infoquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
38
+	list($penname) = dbrow($infoquery);
39
+	$output .= "<div class='sectionheader'>"._CHALLENGESBY." $penname</div>";
40
+	if(file_exists("./$skindir/challenges.tpl")) $challenges = new TemplatePower("./$skindir/challenges.tpl");
41
+	else $challenges = new TemplatePower(_BASEDIR."modules/challenges/default_tpls/challenges.tpl");
42
+	$challenges->prepare( );
43
+	$chalquery = dbquery("SELECT chal.*, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_challenges as chal, "._AUTHORTABLE." WHERE "._UIDFIELD." = chal.uid AND chal.uid = '$uid' LIMIT $offset, $itemsperpage");
44
+	$count = 0;
45
+	while($challenge = dbassoc($chalquery)) {
46
+		$challenges->newBlock("challenge");
47
+		if(isADMIN || USERUID == $challenge['uid']) $challenges->assign("adminoptions", "<div class=\"adminoptions\"><span class=\"label\">".(isADMIN ? _ADMINOPTIONS : _OPTIONS).":</span> [<a href=\""._BASEDIR."modules/challenges/challenges.php?action=edit&amp;chalid=".$challenge['chalid']."\">"._EDIT."</a>] [<a href=\""._BASEDIR."modules/challenges/challenges.php?action=delete&amp;chalid=".$challenge['chalid']."\">"._DELETE."</a>]</div>");
48
+		$challenges->assign("author", ($challenge['uid'] ? "<a href=\"viewuser.php?uid=".$challenge['uid']."\">".$challenge['challenger']."</a>" : $challenge['challenger']));
49
+		$challenges->assign("title", "<a href=\"modules/challenges/challenges.php?chalid=".$challenge['chalid']."\">".stripslashes($challenge['title'])."</a>");
50
+		$challenges->assign("numresponses", "<a href=\"modules/challenges/challenges.php?chalid=".$challenge['chalid']."\">".$challenge['responses']."</a>");
51
+		$challenges->assign("responses", "<a href=\"modules/challenges/challenges.php?chalid=".$challenge['chalid']."\">"._RESPONSES."</a>");
52
+		$challenges->assign("summary", stripslashes($challenge['summary']));
53
+		$challenges->assign("characters", $challenge['characters'] ? charlist($challenge['characters']) : _NONE);
54
+		$challenges->assign("category"   , ($challenge['catid'] > 0 ? catlist($challenge['catid']) : _NONE) );
55
+		$challenges->assign("respond", "<div class=\"respond\"><a href=\""._BASEDIR."modules/challenges/challenges.php?action=respond&amp;chalid=".$challenge['chalid']."\">"._RESPOND2CHALLENGE."</a></div>");
56
+		$challenges->assign("reportthis", "[<a href=\""._BASEDIR."contact.php?action=report&amp;url=modules/challenges/challenges.php?chalid=".$challenge['chalid']."\">"._REPORTTHIS."</a>]");
57
+		$codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'challengeblock'");
58
+		while($code = dbassoc($codequery)) {
59
+			eval($code['code_text']);
60
+		}
61
+		$count++;
62
+		$challenges->assign("oddeven", ($count % 2 ? "odd" : "even"));
63
+	}
64
+	$tpl->newBlock("listings");
65
+	if($numchal > $itemsperpage) $tpl->assign("pagelinks", build_pagelinks(basename($_SERVER['PHP_SELF'])."?action=challengesby&amp;uid=$uid&amp;", $numchal, $offset));
66
+	$tpl->gotoBlock("_ROOT");
67
+	$output .= $challenges->getOutputContent( );
68
+
69
+}
70
+else $output .= write_message(_NORESULTS);
71
+?>