summary refs log tree commit diff stats
path: root/admin/comments.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/comments.php')
-rw-r--r--admin/comments.php143
1 files changed, 143 insertions, 0 deletions
diff --git a/admin/comments.php b/admin/comments.php new file mode 100644 index 0000000..4cda9ec --- /dev/null +++ b/admin/comments.php
@@ -0,0 +1,143 @@
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/comments.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 = 'comments';
28
29if (isset($_GET['action']))
30{
31 if (($_GET['action'] == 'deny') || ($_GET['action'] == 'approve'))
32 {
33 if (is_numeric($_POST['id']))
34 {
35 $getcomment = "SELECT * FROM moderation WHERE id = " . $_POST['id'];
36 $getcomment2 = mysql_query($getcomment);
37 $getcomment3 = mysql_fetch_array($getcomment2);
38
39 if ($getcomment3['id'] == $_POST['id'])
40 {
41 if ($_GET['action'] == 'deny')
42 {
43 $delpost = "DELETE FROM moderation WHERE id = " . $_POST['id'];
44 $delpost2 = mysql_query($delpost);
45
46 $flashmsg = 'The selected comment has been deleted.';
47 } else if ($_GET['action'] == 'approve')
48 {
49 $insanon = "INSERT INTO anon_commenters (username,email,website) VALUES (\"" . $getcomment3['author'] . "\",\"" . $getcomment3['email'] . "\",\"" . $getcomment3['website'] . "\")";
50 $insanon2 = mysql_query($insanon);
51
52 $inscomment = "INSERT INTO comments (page_id,user_id,comment,is_anon) VALUES (\"" . $getcomment3['page_id'] . "\"," . mysql_insert_id() . ",\"" . $getcomment3['comment'] . "\",1)";
53 $inscomment2 = mysql_query($inscomment);
54
55 $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id'];
56 $delcomment2 = mysql_query($delcomment);
57
58 $flashmsg = 'The selected comment has been approved.';
59 }
60 }
61 }
62 } else if (($_GET['action'] == 'denys') || ($_GET['action'] == 'approves'))
63 {
64 $ids = explode(',', $_POST['ids']);
65
66 if (is_array($ids) && !empty($ids))
67 {
68 foreach ($ids as $id)
69 {
70 $getcomment = "SELECT * FROM moderation WHERE id = " . $id;
71 $getcomment2 = mysql_query($getcomment);
72 $getcomment3 = mysql_fetch_array($getcomment2);
73
74 if ($getcomment3['id'] == $id)
75 {
76 if ($_GET['action'] == 'denys')
77 {
78 $delpost = "DELETE FROM moderation WHERE id = " . $id;
79 $delpost2 = mysql_query($delpost);
80
81 $flashmsg = 'The selected comments have been deleted.';
82 } else if ($_GET['action'] == 'approves')
83 {
84 $insanon = "INSERT INTO anon_commenters (username,email,website) VALUES (\"" . $getcomment3['author'] . "\",\"" . $getcomment3['email'] . "\",\"" . $getcomment3['website'] . "\")";
85 $insanon2 = mysql_query($insanon);
86
87 $inscomment = "INSERT INTO comments (page_id,user_id,comment,is_anon) VALUES (\"" . $getcomment3['page_id'] . "\"," . mysql_insert_id() . ",\"" . $getcomment3['comment'] . "\",1)";
88 $inscomment2 = mysql_query($inscomment);
89
90 $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id'];
91 $delcomment2 = mysql_query($delcomment);
92
93 $flashmsg = 'The selected comments have been approved.';
94 }
95 }
96 }
97 }
98 }
99}
100
101$template = new FITemplate('admin/comments');
102
103$getcomments = "SELECT * FROM moderation ORDER BY id ASC";
104$getcomments2 = mysql_query($getcomments);
105$i=0;
106while ($getcomments3[$i] = mysql_fetch_array($getcomments2))
107{
108 $i++;
109}
110
111if ($i != 0)
112{
113 $template->adds_block('AVAIL',array('exi'=>1));
114} else {
115 $template->adds_block('NOTAVAIL',array('exi'=>1));
116}
117
118$pager = &Pager::factory(array( 'mode' => 'Sliding',
119 'perPage' => 20,
120 'delta' => 2,
121 'itemData' => $getcomments3));
122
123$j=0;
124
125foreach ($pager->getPageData() as $comment)
126{
127 if (!empty($comment))
128 {
129 $template->adds_block('COMMENT', array( 'TEXT' => parseText($comment['comment']),
130 'AUTHOR' => $comment['author'],
131 'ID' => $comment['id'],
132 'ODD' => ($j % 2 ? '' : ' class="odd"')));
133 }
134
135 $j++;
136}
137
138$template->add('PAGEID', $pager->getCurrentPageID());
139$template->add('PAGINATION', $pager->links);
140
141$template->display();
142
143?>