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,78 @@
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
+
24
+$current = "pollarchive";
25
+
26
+include ("../../header.php");
27
+
28
+if(file_exists(_BASEDIR."blocks/poll/{$language}.php")) include(_BASEDIR."blocks/poll/{$language}.php");
29
+else include(_BASEDIR."blocks/poll/en.php");
30
+if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
31
+else $tpl = new TemplatePower(_BASEDIR."default_tpls/default.tpl");
32
+$tpl->assignInclude( "header", "./$skindir/header.tpl" );
33
+$tpl->assignInclude( "footer", "./$skindir/footer.tpl" );
34
+//let TemplatePower do its thing, parsing etc.
35
+$tpl->prepare();
36
+
37
+include("../../includes/pagesetup.php");
38
+
39
+$poll = !empty($_GET['poll']) && isNumber($_GET['poll']) ? $_GET['poll'] : false;
40
+
41
+if($poll) {
42
+	$pollquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_id = '$poll' ORDER BY poll_id DESC LIMIT 1");
43
+	$currentpoll = dbassoc($pollquery);
44
+	$opts = explode("|#|", $currentpoll['poll_opts']);
45
+	$votes = explode("#", $currentpoll['poll_results']);
46
+	$output .= "<div id='pagetitle'>"._POLLARCHIVE.": ".$currentpoll['poll_question']."</div><br />";
47
+	if(isset($blocks['poll']['bar']) && file_exists($blocks['poll']['bar'])) $bar = $blocks['poll']['bar'];
48
+	else $bar = _BASEDIR."blocks/poll/bar.jpg";
49
+	$totalvotes = 0;
50
+	$results = array( );
51
+	foreach($votes as $opt => $count) {
52
+		$results[$opt] = $count;
53
+		 $totalvotes = $count ? $count + $totalvotes : $totalvotes;
54
+	}
55
+	$output .= "<div id='story'>";
56
+	foreach($opts as $num => $opt) {
57
+		unset($percent);
58
+		if(!empty($results[$num]) && $results[$num] > 0) $percent = floor(($results[$num] / $totalvotes) * 100);
59
+		else $percent = 0;
60
+		$output .= "<div>$opt <br /> <img src='$bar' alt='".strip_tags($opt)."' height='12' class='poll' width='".$percent."'> $percent%</div>";	
61
+	}
62
+	$output .= "</diV>";
63
+}
64
+else {
65
+	$output .= "<div id='pagetitle'>"._POLLARCHIVE."</div>";
66
+	$listquery = dbquery("SELECT poll_id, poll_question, poll_start as start, poll_end as end FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_end IS NOT NULL OR poll_end != 0 ORDER BY poll_id DESC");
67
+	if(dbnumrows($listquery) > 0) {
68
+		$output .= "<table class='tblborder' style='margin: 1em auto;'><tr><th class='tblborder'>"._POLLARCHQUESTION."</th><th class='tblborder'>"._START."</th><th class='tblborder'>"._END."</th></tr>";
69
+		while($poll = dbassoc($listquery)) {
70
+			$output .= "<tr><td class='tblborder'><a href='pollarchive.php?poll=".$poll['poll_id']."'>".$poll['poll_question']."</a></td><td class='tblborder'>".date("$dateformat", $poll['start'])."</td><td class='tblborder'>".date("$dateformat", $poll['end'])."</td></tr>";
71
+		}
72
+		$output .= "</table>";
73
+	}
74
+}
75
+$tpl->assign("output", $output);
76
+$tpl->printToScreen();
77
+
78
+?>
0 79
\ No newline at end of file