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/posts.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/posts.php')
-rw-r--r-- | admin/posts.php | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/admin/posts.php b/admin/posts.php new file mode 100644 index 0000000..ac5b612 --- /dev/null +++ b/admin/posts.php | |||
@@ -0,0 +1,100 @@ | |||
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/pages.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 = 'posts'; | ||
27 | $pageaid = 'posts'; | ||
28 | |||
29 | if (isset($_GET['action'])) | ||
30 | { | ||
31 | if ($_GET['action'] == 'delete') | ||
32 | { | ||
33 | if (is_numeric($_POST['id'])) | ||
34 | { | ||
35 | $delpost = "DELETE FROM updates WHERE id = " . $_POST['id']; | ||
36 | $delpost2 = mysql_query($delpost); | ||
37 | |||
38 | $flashmsg = 'The selected post 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 | $delpost = "DELETE FROM updates WHERE id = " . $id; | ||
49 | $delpost2 = mysql_query($delpost); | ||
50 | } | ||
51 | |||
52 | $flashmsg = 'The selected posts have been deleted.'; | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
57 | $template = new FITemplate('admin/posts'); | ||
58 | |||
59 | $getposts = "SELECT * FROM updates 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['title'], | ||
86 | 'AUTHOR' => $post['author'], | ||
87 | 'ID' => $post['id'], | ||
88 | 'CODED' => $post['slug'], | ||
89 | 'ODD' => ($j % 2 ? '' : ' class="odd"'))); | ||
90 | } | ||
91 | |||
92 | $j++; | ||
93 | } | ||
94 | |||
95 | $template->add('PAGEID', $pager->getCurrentPageID()); | ||
96 | $template->add('PAGINATION', $pager->links); | ||
97 | |||
98 | $template->display(); | ||
99 | |||
100 | ?> | ||