diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-08-13 17:46:09 -0400 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-08-13 17:46:09 -0400 |
commit | b5736e3ad3830fa732dcbd1a518ec3dd6ea7b98a (patch) | |
tree | 0449277e94a42aa155995a90fd8a89cb3309e7ab /admin/modquotes.php | |
parent | 6a1d5b60e6ec541a36727b84b71168f62221f7d7 (diff) | |
download | fourisland-b5736e3ad3830fa732dcbd1a518ec3dd6ea7b98a.tar.gz fourisland-b5736e3ad3830fa732dcbd1a518ec3dd6ea7b98a.tar.bz2 fourisland-b5736e3ad3830fa732dcbd1a518ec3dd6ea7b98a.zip |
Rewrote Admin panel
The following database changes must be made: * A TEXT column called "text" must be added to the end of "polloftheweek" * The transferPollRss.php script must be run * The "pollrss" table must be dropped Closes #113
Diffstat (limited to 'admin/modquotes.php')
-rw-r--r-- | admin/modquotes.php | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/admin/modquotes.php b/admin/modquotes.php new file mode 100644 index 0000000..8340fd1 --- /dev/null +++ b/admin/modquotes.php | |||
@@ -0,0 +1,136 @@ | |||
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/modquotes.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 = 'quotes'; | ||
27 | $pageaid = 'modquotes'; | ||
28 | |||
29 | if (isset($_GET['action'])) | ||
30 | { | ||
31 | if (($_GET['action'] == 'deny') || ($_GET['action'] == 'approve')) | ||
32 | { | ||
33 | if (is_numeric($_POST['id'])) | ||
34 | { | ||
35 | $getpending = "SELECT * FROM rash_queue WHERE id = " . $_POST['id']; | ||
36 | $getpending2 = mysql_query($getpending); | ||
37 | $getpending3 = mysql_fetch_array($getpending2); | ||
38 | |||
39 | if ($getpending3['id'] == $_POST['id']) | ||
40 | { | ||
41 | if ($_GET['action'] == 'deny') | ||
42 | { | ||
43 | $delpending = "DELETE FROM rash_queue WHERE id = " . $_POST['id']; | ||
44 | $delpending2 = mysql_query($delpending); | ||
45 | |||
46 | $flashmsg = 'The selected quote has been deleted.'; | ||
47 | } else if ($_GET['action'] == 'approve') | ||
48 | { | ||
49 | $insquote = "INSERT INTO rash_quotes (quote,date) VALUES (\"" . mysql_real_escape_string($getpending3['quote']) . "\",\"" . time() . "\")"; | ||
50 | $insquote2 = mysql_query($insquote); | ||
51 | |||
52 | $delpending = "DELETE FROM rash_queue WHERE id = " . $_POST['id']; | ||
53 | $delpending2 = mysql_query($delpending); | ||
54 | |||
55 | $flashmsg = 'The selected quote has been approved.'; | ||
56 | } | ||
57 | } | ||
58 | } | ||
59 | } else if (($_GET['action'] == 'denys') || ($_GET['action'] == 'approves')) | ||
60 | { | ||
61 | $ids = explode(',', $_POST['ids']); | ||
62 | |||
63 | if (is_array($ids) && !empty($ids)) | ||
64 | { | ||
65 | foreach ($ids as $id) | ||
66 | { | ||
67 | $getcomment = "SELECT * FROM rash_queue WHERE id = " . $id; | ||
68 | $getcomment2 = mysql_query($getcomment); | ||
69 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
70 | |||
71 | if ($getcomment3['id'] == $id) | ||
72 | { | ||
73 | if ($_GET['action'] == 'denys') | ||
74 | { | ||
75 | $delpending = "DELETE FROM rash_queue WHERE id = " . $id; | ||
76 | $delpending2 = mysql_query($delpending); | ||
77 | |||
78 | $flashmsg = 'The selected quote has been deleted.'; | ||
79 | } else if ($_GET['action'] == 'approves') | ||
80 | { | ||
81 | $insquote = "INSERT INTO rash_quotes (quote,date) VALUES (\"" . mysql_real_escape_string($getpending3['quote']) . "\",\"" . time() . "\")"; | ||
82 | $insquote2 = mysql_query($insquote); | ||
83 | |||
84 | $delpending = "DELETE FROM rash_queue WHERE id = " . $id; | ||
85 | $delpending2 = mysql_query($delpending); | ||
86 | |||
87 | $flashmsg = 'The selected quote has been approved.'; | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | $template = new FITemplate('admin/modquotes'); | ||
96 | |||
97 | $getpendingq = "SELECT * FROM rash_queue ORDER BY id ASC"; | ||
98 | $getpendingq2 = mysql_query($getpendingq); | ||
99 | $i=0; | ||
100 | while ($getpendingq3[$i] = mysql_fetch_array($getpendingq2)) | ||
101 | { | ||
102 | $i++; | ||
103 | } | ||
104 | |||
105 | if ($i != 0) | ||
106 | { | ||
107 | $template->adds_block('AVAIL',array('exi'=>1)); | ||
108 | } else { | ||
109 | $template->adds_block('NOTAVAIL',array('exi'=>1)); | ||
110 | } | ||
111 | |||
112 | $pager = &Pager::factory(array( 'mode' => 'Sliding', | ||
113 | 'perPage' => 20, | ||
114 | 'delta' => 2, | ||
115 | 'itemData' => $getpendingq3)); | ||
116 | |||
117 | $j=0; | ||
118 | |||
119 | foreach ($pager->getPageData() as $quote) | ||
120 | { | ||
121 | if (!empty($quote)) | ||
122 | { | ||
123 | $template->adds_block('QUOTE', array( 'TEXT' => str_replace("\n","<br />",htmlentities(stripslashes($quote['quote']))), | ||
124 | 'ID' => $quote['id'], | ||
125 | 'ODD' => ($j % 2 ? '' : ' class="odd"'))); | ||
126 | } | ||
127 | |||
128 | $j++; | ||
129 | } | ||
130 | |||
131 | $template->add('PAGEID', $pager->getCurrentPageID()); | ||
132 | $template->add('PAGINATION', $pager->links); | ||
133 | |||
134 | $template->display(); | ||
135 | |||
136 | ?> | ||