summary refs log tree commit diff stats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rwxr-xr-xadmin/editPoll.php118
-rwxr-xr-xadmin/newPoll.php114
-rwxr-xr-xadmin/polls.php98
3 files changed, 0 insertions, 330 deletions
diff --git a/admin/editPoll.php b/admin/editPoll.php deleted file mode 100755 index 425f33c..0000000 --- a/admin/editPoll.php +++ /dev/null
@@ -1,118 +0,0 @@
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
104::::444444::::444
114::::::::::::::::4 admin/editPoll.php
124444444444:::::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
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24
25$category = 'polls';
26$pageaid = 'quotes';
27
28$template = new FITemplate('admin/writePoll');
29$template->add('TITLE', 'Edit Poll');
30$template->add('ACTION', '/admin/editPoll.php?id=' . $_GET['id'] . '&amp;submit=');
31
32if (isset($_GET['submit']))
33{
34 if (empty($_POST['question']))
35 {
36 $errors[] = array( 'field' => 'question',
37 'text' => 'Question is a required field');
38 }
39
40 if (empty($_POST['option1']))
41 {
42 $errors[] = array( 'field' => 'option1',
43 'text' => 'Option 1 is a required field');
44 }
45
46 if (empty($_POST['option2']))
47 {
48 $errors[] = array( 'field' => 'option2',
49 'text' => 'Option 2 is a required field');
50 }
51
52 if (empty($_POST['option3']))
53 {
54 $errors[] = array( 'field' => 'option3',
55 'text' => 'Option 3 is a required field');
56 }
57
58 if (empty($_POST['option4']))
59 {
60 $errors[] = array( 'field' => 'option4',
61 'text' => 'Option 4 is a required field');
62 }
63
64 if (isset($errors))
65 {
66 $template->adds_block('ISERROR',array('exi'=>1));
67
68 $eid = 0;
69 foreach ($errors as $error)
70 {
71 $template->adds_block('ERROR', array( 'ID' => $eid,
72 'TEXT' => $error['text']));
73 $template->add('IS' . strtoupper($error['field']) . 'ERROR', ' error');
74 $template->adds_block(strtoupper($error['field']) . 'ERROR', array( 'ID' => $eid,
75 'TEXT' => $error['text']));
76
77 $eid++;
78 }
79
80 $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $_GET['id'];
81 $getpoll2 = mysql_query($getpoll);
82 $getpoll3 = mysql_fetch_array($getpoll2);
83
84 $template->add('QUESTIONVALUE', htmlentities($_POST['question']));
85 $template->add('OPTION1VALUE', htmlentities($_POST['option1']));
86 $template->add('OPTION2VALUE', htmlentities($_POST['option2']));
87 $template->add('OPTION3VALUE', htmlentities($_POST['option3']));
88 $template->add('OPTION4VALUE', htmlentities($_POST['option4']));
89 $template->add('TEXTVALUE', $_POST['text']);
90 } else {
91 $inspoll = "UPDATE polloftheweek SET question = \"" . mysql_real_escape_string($_POST['question']) . "\", option1 = \"" . mysql_real_escape_string($_POST['option1']) . "\", option2 = \"" . mysql_real_escape_string($_POST['option2']) . "\", option3 = \"" . mysql_real_escape_string($_POST['option3']) . "\", option4 = \"" . mysql_real_escape_string($_POST['option4']) . "\", text = \"" . mysql_real_escape_string($_POST['text']) . "\" WHERE id = " . $_GET['id'];
92 $inspoll2 = mysql_query($inspoll);
93
94 $template->add('QUESTIONVALUE', htmlentities($_POST['question']));
95 $template->add('OPTION1VALUE', htmlentities($_POST['option1']));
96 $template->add('OPTION2VALUE', htmlentities($_POST['option2']));
97 $template->add('OPTION3VALUE', htmlentities($_POST['option3']));
98 $template->add('OPTION4VALUE', htmlentities($_POST['option4']));
99 $template->add('TEXTVALUE', $_POST['text']);
100
101 $template->adds_block('FLASH', array('TEXT' => 'Your poll has been sucessfully edited. <a href="/poll/' . $_GET['id'] . '.php">View poll</a>.'));
102 }
103} else {
104 $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $_GET['id'];
105 $getpoll2 = mysql_query($getpoll);
106 $getpoll3 = mysql_fetch_array($getpoll2);
107
108 $template->add('QUESTIONVALUE', htmlentities($getpoll3['question']));
109 $template->add('OPTION1VALUE', htmlentities($getpoll3['option1']));
110 $template->add('OPTION2VALUE', htmlentities($getpoll3['option2']));
111 $template->add('OPTION3VALUE', htmlentities($getpoll3['option3']));
112 $template->add('OPTION4VALUE', htmlentities($getpoll3['option4']));
113 $template->add('TEXTVALUE', $getpoll3['text']);
114}
115
116$template->display();
117
118?>
diff --git a/admin/newPoll.php b/admin/newPoll.php deleted file mode 100755 index d105f45..0000000 --- a/admin/newPoll.php +++ /dev/null
@@ -1,114 +0,0 @@
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
104::::444444::::444
114::::::::::::::::4 admin/newPoll.php
124444444444:::::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
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24
25$category = 'polls';
26$pageaid = 'newpoll';
27
28$template = new FITemplate('admin/writePoll');
29
30if (isset($_GET['submit']))
31{
32 if (empty($_POST['question']))
33 {
34 $errors[] = array( 'field' => 'question',
35 'text' => 'Question is a required field');
36 }
37
38 if (empty($_POST['option1']))
39 {
40 $errors[] = array( 'field' => 'option1',
41 'text' => 'Option 1 is a required field');
42 }
43
44 if (empty($_POST['option2']))
45 {
46 $errors[] = array( 'field' => 'option2',
47 'text' => 'Option 2 is a required field');
48 }
49
50 if (empty($_POST['option3']))
51 {
52 $errors[] = array( 'field' => 'option3',
53 'text' => 'Option 3 is a required field');
54 }
55
56 if (empty($_POST['option4']))
57 {
58 $errors[] = array( 'field' => 'option4',
59 'text' => 'Option 4 is a required field');
60 }
61
62 if (isset($errors))
63 {
64 $template->adds_block('ISERROR',array('exi'=>1));
65
66 $eid = 0;
67 foreach ($errors as $error)
68 {
69 $template->adds_block('ERROR', array( 'ID' => $eid,
70 'TEXT' => $error['text']));
71 $template->add('IS' . strtoupper($error['field']) . 'ERROR', ' error');
72 $template->adds_block(strtoupper($error['field']) . 'ERROR', array( 'ID' => $eid,
73 'TEXT' => $error['text']));
74
75 $eid++;
76 }
77
78 $template->add('TITLE', 'New Poll');
79 $template->add('ACTION', '/admin/newPoll.php?submit=');
80
81 $template->add('QUESTIONVALUE', htmlentities($_POST['question']));
82 $template->add('OPTION1VALUE', htmlentities($_POST['option1']));
83 $template->add('OPTION2VALUE', htmlentities($_POST['option2']));
84 $template->add('OPTION3VALUE', htmlentities($_POST['option3']));
85 $template->add('OPTION4VALUE', htmlentities($_POST['option4']));
86 $template->add('TEXTVALUE', htmlentities($_POST['text']));
87 } else {
88 $inspoll = "INSERT INTO polloftheweek (question,option1,option2,option3,option4,text) VALUES (\"" . mysql_real_escape_string($_POST['question']) . "\",\"" . mysql_real_escape_string($_POST['option1']) . "\",\"" . mysql_real_escape_string($_POST['option2']) . "\",\"" . mysql_real_escape_string($_POST['option3']) . "\",\"" . mysql_real_escape_string($_POST['option4']) . "\",\"" . mysql_real_escape_string($_POST['text']) . "\")";
89 $inspoll2 = mysql_query($inspoll);
90
91 $id = mysql_insert_id();
92
93 $cleardid = "TRUNCATE TABLE didpollalready";
94 $cleardid2 = mysql_query($cleardid);
95
96 $template->add('QUESTIONVALUE', htmlentities($_POST['question']));
97 $template->add('OPTION1VALUE', htmlentities($_POST['option1']));
98 $template->add('OPTION2VALUE', htmlentities($_POST['option2']));
99 $template->add('OPTION3VALUE', htmlentities($_POST['option3']));
100 $template->add('OPTION4VALUE', htmlentities($_POST['option4']));
101 $template->add('TEXTVALUE', htmlentities($_POST['text']));
102
103 $template->add('TITLE', 'Edit Poll');
104 $template->add('ACTION', '/admin/editPoll.php?id=' . $id . '&amp;submit=');
105 $template->adds_block('FLASH', array('TEXT' => 'Your poll has been sucessfully created. <a href="/poll/' . $id . '.php">View poll</a>.'));
106 }
107} else {
108 $template->add('TITLE', 'New Poll');
109 $template->add('ACTION', '/admin/newPoll.php?submit=');
110}
111
112$template->display();
113
114?>
diff --git a/admin/polls.php b/admin/polls.php deleted file mode 100755 index e4239fa..0000000 --- a/admin/polls.php +++ /dev/null
@@ -1,98 +0,0 @@
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
104::::444444::::444
114::::::::::::::::4 admin/polls.php
124444444444:::::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
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24require_once('Pager.php');
25
26$category = 'polls';
27$pageaid = 'polls';
28
29if (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;
62while ($getposts3[$i] = mysql_fetch_array($getposts2))
63{
64 $i++;
65}
66
67if ($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
81foreach ($pager->getPageData() as $post)
82{
83 if (!empty($post))
84 {
85 $template->adds_block('POST', array( 'TITLE' => htmlentities($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?>