summary refs log tree commit diff stats
path: root/admin/pending.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/pending.php')
-rw-r--r--admin/pending.php180
1 files changed, 180 insertions, 0 deletions
diff --git a/admin/pending.php b/admin/pending.php new file mode 100644 index 0000000..407cd35 --- /dev/null +++ b/admin/pending.php
@@ -0,0 +1,180 @@
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/pending.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 = 'posts';
27$pageaid = 'pending';
28
29if (isset($_GET['action']))
30{
31 if ($_GET['action'] == 'delete')
32 {
33 if (is_numeric($_POST['id']))
34 {
35 $delpost = "DELETE FROM pending WHERE id = " . $_POST['id'];
36 $delpost2 = mysql_query($delpost);
37
38 $flashmsg = 'The selected pending post has been deleted.';
39 }
40 } else if (($_GET['action'] == 'moveup') || ($_GET['action'] == 'movedown'))
41 {
42 if (is_numeric($_GET['id']))
43 {
44 $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id'];
45 $getpending2 = mysql_query($getpending);
46 $getpending3 = mysql_fetch_array($getpending2);
47
48 if ($getpending3['id'] == $_GET['id'])
49 {
50 if ($_GET['action'] == 'moveup')
51 {
52 $get2pending = "SELECT * FROM pending WHERE id < " . $_GET['id'] . " ORDER BY id DESC LIMIT 0,1";
53 $get2pending2 = mysql_query($get2pending);
54 $get2pending3 = mysql_fetch_array($get2pending2);
55
56 if (isset($get2pending3['id']))
57 {
58 $otherPending = $get2pending3;
59 }
60 } else if ($_GET['action'] == 'movedown')
61 {
62 $get2pending = "SELECT * FROM pending WHERE id > " . $_GET['id'] . " ORDER BY id ASC LIMIT 0,1";
63 $get2pending2 = mysql_query($get2pending);
64 $get2pending3 = mysql_fetch_array($get2pending2);
65
66 if (isset($get2pending3['id']))
67 {
68 $otherPending = $get2pending3;
69 }
70 }
71
72 if (isset($otherPending))
73 {
74 $delpending = "DELETE FROM pending WHERE id = " . $_GET['id'] . " OR id = " . $otherPending['id'];
75 $delpending2 = mysql_query($delpending);
76
77 $inspending = "INSERT INTO pending (id, title, author, text, slug) VALUES (" . $_GET['id'] . ",\"" . $otherPending['title'] . "\",\"" . $otherPending['author'] . "\",\"" . mysql_real_escape_string($otherPending['text']) . "\",\"" . $otherPending['slug'] . "\")";
78 $inspending2 = mysql_query($inspending);
79
80 $ins2pending = "INSERT INTO pending (id, title, author, text, slug) VALUES (" . $otherPending['id'] . ",\"" . $getpending3['title'] . "\",\"" . $getpending3['author'] . "\",\"" . mysql_real_escape_string($getpending3['text']) . "\",\"" . $getpending3['slug'] . "\")";
81 $ins2pending2 = mysql_query($ins2pending) or die($ins2pending);
82
83 $tags1 = getTags($_GET['id'], 'pending');
84 $tags2 = getTags($otherPending['id'], 'pending');
85 removeTags($_GET['id'], 'pending');
86 removeTags($otherPending['id'], 'pending');
87 addTags($_GET['id'], $tags2, 'pending');
88 addTags($otherPending['id'], $tags1, 'pending');
89
90 $flashmsg = 'The selected post was moved sucessfully.';
91 }
92 }
93 }
94 } else if ($_GET['action'] == 'deletes')
95 {
96 $ids = explode(',', $_POST['ids']);
97
98 if (is_array($ids) && !empty($ids))
99 {
100 foreach ($ids as $id)
101 {
102 $delpost = "DELETE FROM pending WHERE id = " . $id;
103 $delpost2 = mysql_query($delpost);
104 }
105
106 $flashmsg = 'The selected posts have been deleted.';
107 }
108 }
109}
110
111$template = new FITemplate('admin/pending');
112
113$getposts = "SELECT * FROM pending ORDER BY id ASC";
114$getposts2 = mysql_query($getposts);
115$i=0;
116while ($getposts3[$i] = mysql_fetch_array($getposts2))
117{
118 $i++;
119}
120
121if ($i != 0)
122{
123 $template->adds_block('AVAIL',array('exi'=>1));
124} else {
125 $template->adds_block('NOTAVAIL',array('exi'=>1));
126}
127
128$pager = &Pager::factory(array( 'mode' => 'Sliding',
129 'perPage' => 20,
130 'delta' => 2,
131 'itemData' => $getposts3));
132
133$j=0;
134
135if ($pager->isLastPage())
136{
137 foreach (array_reverse($pager->getPageData()) as $post)
138 {
139 if (!empty($post))
140 {
141 $last = $post;
142 break;
143 }
144 }
145}
146
147foreach ($pager->getPageData() as $post)
148{
149 if (!empty($post))
150 {
151 $template->add_ref($j, 'POST', array( 'TITLE' => $post['title'],
152 'AUTHOR' => $post['author'],
153 'ID' => $post['id'],
154 'CODED' => $post['slug'],
155 'ODD' => ($j % 2 ? '' : ' class="odd"')));
156
157 if ($pager->isFirstPage() && ($j == 0))
158 {
159 $template->adds_ref_sub($j, 'NOMOVEUP', array('exi'=>1));
160 } else {
161 $template->adds_ref_sub($j, 'CANMOVEUP', array('exi'=>1));
162 }
163
164 if ($pager->isLastPage() && ($post == $last))
165 {
166 $template->adds_ref_sub($j, 'NOMOVEDOWN', array('exi'=>1));
167 } else {
168 $template->adds_ref_sub($j, 'CANMOVEDOWN', array('exi'=>1));
169 }
170 }
171
172 $j++;
173}
174
175$template->add('PAGEID', $pager->getCurrentPageID());
176$template->add('PAGINATION', $pager->links);
177
178$template->display();
179
180?>