Completed
Push — master ( acb423...2a302c )
by Jacob
03:45
created

CommentCollector::getCommentCountForURL()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 2
1
<?
0 ignored issues
show
Security Best Practice introduced by
It is not recommend to use PHP's short opening tag <?, better use <?php, or <?= in case of outputting.

Short opening tags are disabled in PHP’s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.

As a precaution to avoid these problems better use the long opening tag <?php.

Loading history...
2
3
Loader::load('collector', 'Collector');
4
5
final class CommentCollector extends Collector
6
{
7
8
	public static function getCommenterByFields($name, $email, $website)
9
	{
10
		$name = self::escape($name);
11
		$email = self::escape($email);
12
		$website = self::escape($website);
13
		
14
		$query = "
15
			SELECT
16
				*
17
			FROM
18
				`jpemeric_comment`.`commenter`
19
			WHERE
20
				`name` = '{$name}' &&
21
				`email` = '{$email}' &&
22
				`url` = '{$website}'
23
			LIMIT 1";
24
		
25
		return self::run_row_query($query);
26
	}
27
28
	public static function getCommentByBody($body)
29
	{
30
		$body = self::escape($body);
31
		
32
		$query = "
33
			SELECT
34
				*
35
			FROM
36
				`jpemeric_comment`.`comment`
37
			WHERE
38
				`body` = '{$body}'
39
			LIMIT 1";
40
		
41
		return self::run_row_query($query);
42
	}
43
44
	public static function getCommentPageByURL($path, $site)
45
	{
46
		$path = self::escape($path);
47
		
48
		$query = "
49
			SELECT
50
				*
51
			FROM
52
				`jpemeric_comment`.`comment_page`
53
			WHERE
54
				`site` = '{$site}' &&
55
				`path` = '{$path}'
56
			LIMIT
57
				1";
58
		
59
		return self::run_row_query($query);
60
	}
61
62
	public static function getNotificationForPage($comment_page)
63
	{
64
		$query = "
65
			SELECT
66
				`name`,
67
				`email`
68
			FROM
69
				`jpemeric_comment`.`commenter`
70
					INNER JOIN
71
						`jpemeric_comment`.`comment_meta` ON
72
							`comment_meta`.`commenter` = `commenter`.`id` &&
73
							`comment_meta`.`comment_page` = '{$comment_page}' &&
74
							`comment_meta`.`notify` = '1' &&
75
							`comment_meta`.`display` = '1'
76
			WHERE
77
				`commenter`.`trusted` = '1'
78
			GROUP BY
79
				`email`
80
			ORDER BY
81
				`date` DESC";
82
		
83
		return self::run_query($query);
84
	}
85
}
86