diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2008-12-07 17:27:58 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2008-12-07 17:27:58 -0500 |
commit | 07aae7e8f8b752e6b37b338783a6d6fef290ee10 (patch) | |
tree | 1072b9822f7e52e7d28e92979c4e88a3e261ec55 | |
parent | bb736bb631788574137742f60dfaa2a808573af8 (diff) | |
download | fourisland-07aae7e8f8b752e6b37b338783a6d6fef290ee10.tar.gz fourisland-07aae7e8f8b752e6b37b338783a6d6fef290ee10.tar.bz2 fourisland-07aae7e8f8b752e6b37b338783a6d6fef290ee10.zip |
Removed comment rating system
-rwxr-xr-x | includes/comments.php | 10 | ||||
-rwxr-xr-x | includes/functions.php | 26 | ||||
-rwxr-xr-x | pages/vote.php | 88 | ||||
-rwxr-xr-x | theme/comments.tpl | 6 |
4 files changed, 21 insertions, 109 deletions
diff --git a/includes/comments.php b/includes/comments.php index 682aa0e..ca5528e 100755 --- a/includes/comments.php +++ b/includes/comments.php | |||
@@ -68,19 +68,11 @@ while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | |||
68 | 68 | ||
69 | if (isset($username)) | 69 | if (isset($username)) |
70 | { | 70 | { |
71 | if ($getcomments3[$i]['rating'] > -2) | ||
72 | { | ||
73 | $text = parseBBCode($getcomments3[$i]['comment']); | ||
74 | } else { | ||
75 | $text = 'This comment has been rated down below the threshold for public viewing (-1), suggesting that it may contain inappropriate or off topic content. (Or it may have been flame bait, or simply bad!)'; | ||
76 | } | ||
77 | |||
78 | $template->add_ref($curID, 'COMMENTS', array( 'CODEDEMAIL' => md5(strtolower($email)), | 71 | $template->add_ref($curID, 'COMMENTS', array( 'CODEDEMAIL' => md5(strtolower($email)), |
79 | 'USERNAME' => (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username), | 72 | 'USERNAME' => (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username), |
80 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), | 73 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), |
81 | 'RATING' => $getcomments3[$i]['rating'], | ||
82 | 'ID' => $getcomments3[$i]['id'], | 74 | 'ID' => $getcomments3[$i]['id'], |
83 | 'TEXT' => $text)); | 75 | 'TEXT' => parseBBCode($getcomments3[$i]['comment']))); |
84 | } | 76 | } |
85 | $i++; | 77 | $i++; |
86 | } | 78 | } |
diff --git a/includes/functions.php b/includes/functions.php index ee19391..c71e69f 100755 --- a/includes/functions.php +++ b/includes/functions.php | |||
@@ -215,30 +215,4 @@ function verifyUser($username, $password) | |||
215 | return (($_POST['username'] != '') && ($getuser3['username'] == $_POST['username'])); | 215 | return (($_POST['username'] != '') && ($getuser3['username'] == $_POST['username'])); |
216 | } | 216 | } |
217 | 217 | ||
218 | function updateCommentPop($id, $plus=1) | ||
219 | { | ||
220 | $gettrack = "SELECT * FROM tracking_comments WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
221 | $gettrack2 = mysql_query($gettrack); | ||
222 | $gettrack3 = mysql_fetch_array($gettrack2); | ||
223 | |||
224 | $trackArr = explode(',',$gettrack3['comment_id']); | ||
225 | |||
226 | if (($gettrack3['ip'] != $_SERVER['REMOTE_ADDR']) || (array_search($id,$trackArr) === FALSE)) | ||
227 | { | ||
228 | $setcomment = "UPDATE comments SET rating = rating+" . $plus . " WHERE id = " . $id; | ||
229 | $setcomment2 = mysql_query($setcomment); | ||
230 | |||
231 | if ($gettrack3['ip'] == $_SERVER['REMOTE_ADDR']) | ||
232 | { | ||
233 | $settrack = "UPDATE tracking SET rating = \"" . $gettrack3['comment_id'] . "," . $id . "\" WHERE id = " . $gettrack3['id']; | ||
234 | } else { | ||
235 | $settrack = "INSERT INTO tracking (ip,rating) VALUES (\"" . $_SERVER['REMOTE_ADDR'] . "\",\"" . $id . "\")"; | ||
236 | } | ||
237 | $settrack2 = mysql_query($settrack) or die($settrack); | ||
238 | return 1; | ||
239 | } else { | ||
240 | return 0; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | ?> | 218 | ?> |
diff --git a/pages/vote.php b/pages/vote.php index 890b379..667b5c9 100755 --- a/pages/vote.php +++ b/pages/vote.php | |||
@@ -25,89 +25,41 @@ require('headerproc.php'); | |||
25 | $pageCategory = 'home'; | 25 | $pageCategory = 'home'; |
26 | $pageAID = 'archive'; | 26 | $pageAID = 'archive'; |
27 | 27 | ||
28 | if (!isset($_GET['mode'])) | 28 | $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; |
29 | $getpost2 = mysql_query($getpost); | ||
30 | $getpost3 = mysql_fetch_array($getpost2); | ||
31 | |||
32 | if ($getpost3['id'] == $_GET['id']) | ||
29 | { | 33 | { |
30 | $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; | 34 | $template = new FITemplate('msg2'); |
31 | $getpost2 = mysql_query($getpost); | 35 | $template->add('BACK','Back to ' . stripslashes($getpost3['title'])); |
32 | $getpost3 = mysql_fetch_array($getpost2); | 36 | $template->add('LINK','/blog/' . $getpost3['slug'] . '/'); |
33 | 37 | ||
34 | if ($getpost3['id'] == $_GET['id']) | 38 | if ($_GET['dir'] == 'plus') |
35 | { | 39 | { |
36 | $template = new FITemplate('msg2'); | 40 | if (updatePop($_GET['id'],'rating')) |
37 | $template->add('BACK','Back to ' . stripslashes($getpost3['title'])); | ||
38 | $template->add('LINK','/blog/' . $getpost3['slug'] . '/'); | ||
39 | |||
40 | if ($_GET['dir'] == 'plus') | ||
41 | { | 41 | { |
42 | if (updatePop($_GET['id'],'rating')) | 42 | $template->add('MSG','Thank you for voting!'); |
43 | { | ||
44 | $template->add('MSG','Thank you for voting!'); | ||
45 | } else { | ||
46 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this post.'); | ||
47 | } | ||
48 | } else if ($_GET['dir'] == 'minus') | ||
49 | { | ||
50 | if (updatePop($_GET['id'],'rating',-1)) | ||
51 | { | ||
52 | $template->add('MSG','Thank you for voting!'); | ||
53 | } else { | ||
54 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this post.'); | ||
55 | } | ||
56 | } else { | 43 | } else { |
57 | $template = new FITemplate('msg'); | 44 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this post.'); |
58 | $template->add('BACK','the previous page'); | ||
59 | $template->add('MSG','Um, what on earth are you doing?'); | ||
60 | } | 45 | } |
61 | } else { | 46 | } else if ($_GET['dir'] == 'minus') |
62 | $template = new FITemplate('msg'); | ||
63 | $template->add('BACK','the previous page'); | ||
64 | $template->add('MSG','Um, what on earth are you doing?'); | ||
65 | } | ||
66 | } else if ($_GET['mode'] == 'comment') | ||
67 | { | ||
68 | $getcomment = "SELECT * FROM comments WHERE id = " . $_GET['id']; | ||
69 | $getcomment2 = mysql_query($getcomment); | ||
70 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
71 | |||
72 | if ($getcomment3['id'] == $_GET['id']) | ||
73 | { | 47 | { |
74 | $page_id = $getcomment3['page_id']; | 48 | if (updatePop($_GET['id'],'rating',-1)) |
75 | $comID = substr($page_id,strpos($page_id,'-')+1); | ||
76 | |||
77 | $getpost = "SELECT * FROM updates WHERE id = " . $comID; | ||
78 | $getpost2 = mysql_query($getpost); | ||
79 | $getpost3 = mysql_fetch_array($getpost2); | ||
80 | |||
81 | $template = new FITemplate('msg2'); | ||
82 | $template->add('BACK','Back to ' . stripslashes($getpost3['title'])); | ||
83 | $template->add('LINK','/blog/' . $getpost3['slug'] . '/'); | ||
84 | |||
85 | if ($_GET['dir'] == 'plus') | ||
86 | { | ||
87 | if (updateCommentPop($_GET['id'])) | ||
88 | { | ||
89 | $template->add('MSG','Thank you for voting!'); | ||
90 | } else { | ||
91 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this comment.'); | ||
92 | } | ||
93 | } else if ($_GET['dir'] == 'minus') | ||
94 | { | 49 | { |
95 | if (updateCommentPop($_GET['id'],-1)) | 50 | $template->add('MSG','Thank you for voting!'); |
96 | { | ||
97 | $template->add('MSG','Thank you for voting!'); | ||
98 | } else { | ||
99 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this comment.'); | ||
100 | } | ||
101 | } else { | 51 | } else { |
102 | $template = new FITemplate('msg'); | 52 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this post.'); |
103 | $template->add('BACK','the previous page'); | ||
104 | $template->add('MSG','Um, what on earth are you doing?'); | ||
105 | } | 53 | } |
106 | } else { | 54 | } else { |
107 | $template = new FITemplate('msg'); | 55 | $template = new FITemplate('msg'); |
108 | $template->add('BACK','the previous page'); | 56 | $template->add('BACK','the previous page'); |
109 | $template->add('MSG','Um, what on earth are you doing?'); | 57 | $template->add('MSG','Um, what on earth are you doing?'); |
110 | } | 58 | } |
59 | } else { | ||
60 | $template = new FITemplate('msg'); | ||
61 | $template->add('BACK','the previous page'); | ||
62 | $template->add('MSG','Um, what on earth are you doing?'); | ||
111 | } | 63 | } |
112 | 64 | ||
113 | $template->display(); | 65 | $template->display(); |
diff --git a/theme/comments.tpl b/theme/comments.tpl index d814292..c029ffb 100755 --- a/theme/comments.tpl +++ b/theme/comments.tpl | |||
@@ -11,12 +11,6 @@ | |||
11 | </DIV> | 11 | </DIV> |
12 | </BLOCKQUOTE> | 12 | </BLOCKQUOTE> |
13 | <CITE><STRONG><!--COMMENTS.USERNAME--></STRONG> on <!--COMMENTS.DATE--></CITE> | 13 | <CITE><STRONG><!--COMMENTS.USERNAME--></STRONG> on <!--COMMENTS.DATE--></CITE> |
14 | |||
15 | <SPAN STYLE="float: right"> | ||
16 | <A HREF="/vote.php?id=<!--COMMENTS.ID-->&dir=plus&mode=comment" REL="nofollow"><IMG SRC="/theme/images/icons/thumb_up.png"></A> | ||
17 | <!--COMMENTS.RATING--> | ||
18 | <A HREF="/vote.php?id=<!--COMMENTS.ID-->&dir=minus&mode=comment" REL="nofollow"><IMG SRC="/theme/images/icons/thumb_down.png"></A> | ||
19 | </SPAN> | ||
20 | </DIV> | 14 | </DIV> |
21 | <!--END COMMENTS--> | 15 | <!--END COMMENTS--> |
22 | 16 | ||