diff options
Diffstat (limited to 'admin/polls.php')
-rw-r--r-- | admin/polls.php | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/admin/polls.php b/admin/polls.php new file mode 100644 index 0000000..8e1465c --- /dev/null +++ b/admin/polls.php | |||
@@ -0,0 +1,98 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 admin/polls.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | require_once('Pager.php'); | ||
25 | |||
26 | $category = 'polls'; | ||
27 | $pageaid = 'polls'; | ||
28 | |||
29 | if (isset($_GET['action'])) | ||
30 | { | ||
31 | if ($_GET['action'] == 'delete') | ||
32 | { | ||
33 | if (is_numeric($_POST['id'])) | ||
34 | { | ||
35 | $delpoll = "DELETE FROM polloftheweek WHERE id = " . $_POST['id']; | ||
36 | $delpoll2 = mysql_query($delpoll); | ||
37 | |||
38 | $flashmsg = 'The selected poll has been deleted.'; | ||
39 | } | ||
40 | } else if ($_GET['action'] == 'deletes') | ||
41 | { | ||
42 | $ids = explode(',', $_POST['ids']); | ||
43 | |||
44 | if (is_array($ids) && !empty($ids)) | ||
45 | { | ||
46 | foreach ($ids as $id) | ||
47 | { | ||
48 | $delpoll = "DELETE FROM polloftheweek WHERE id = " . $id; | ||
49 | $delpoll2 = mysql_query($delpoll); | ||
50 | } | ||
51 | |||
52 | $flashmsg = 'The selected polls have been deleted.'; | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
57 | $template = new FITemplate('admin/polls'); | ||
58 | |||
59 | $getposts = "SELECT * FROM polloftheweek ORDER BY id DESC"; | ||
60 | $getposts2 = mysql_query($getposts); | ||
61 | $i=0; | ||
62 | while ($getposts3[$i] = mysql_fetch_array($getposts2)) | ||
63 | { | ||
64 | $i++; | ||
65 | } | ||
66 | |||
67 | if ($i != 0) | ||
68 | { | ||
69 | $template->adds_block('AVAIL',array('exi'=>1)); | ||
70 | } else { | ||
71 | $template->adds_block('NOTAVAIL',array('exi'=>1)); | ||
72 | } | ||
73 | |||
74 | $pager = &Pager::factory(array( 'mode' => 'Sliding', | ||
75 | 'perPage' => 20, | ||
76 | 'delta' => 2, | ||
77 | 'itemData' => $getposts3)); | ||
78 | |||
79 | $j=0; | ||
80 | |||
81 | foreach ($pager->getPageData() as $post) | ||
82 | { | ||
83 | if (!empty($post)) | ||
84 | { | ||
85 | $template->adds_block('POST', array( 'TITLE' => $post['question'], | ||
86 | 'ID' => $post['id'], | ||
87 | 'ODD' => ($j % 2 ? '' : ' class="odd"'))); | ||
88 | } | ||
89 | |||
90 | $j++; | ||
91 | } | ||
92 | |||
93 | $template->add('PAGEID', $pager->getCurrentPageID()); | ||
94 | $template->add('PAGINATION', $pager->links); | ||
95 | |||
96 | $template->display(); | ||
97 | |||
98 | ?> | ||