@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlWatercourseRepository implements WatercourseRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlWatercourseRepository implements WatercourseRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
21 | 21 | // todo wot are you even serious |
22 | - public function getWatercourseList() |
|
23 | - { |
|
22 | + public function getWatercourseList() |
|
23 | + { |
|
24 | 24 | $query = " |
25 | 25 | SELECT `sum_table`.`name`, `sum_table`.`alias`, SUM(`count`) AS `count` |
26 | 26 | FROM (( |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlCountyRepository implements CountyRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlCountyRepository implements CountyRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
21 | - public function getCountyList() |
|
22 | - { |
|
21 | + public function getCountyList() |
|
22 | + { |
|
23 | 23 | $query = " |
24 | 24 | SELECT `county`.`name`, `county`.`alias`, COUNT(1) AS `count` |
25 | 25 | FROM `jpemeric_waterfall`.`county` |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlPeriodRepository implements PeriodRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlPeriodRepository implements PeriodRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
21 | - public function getPeriodList() |
|
22 | - { |
|
21 | + public function getPeriodList() |
|
22 | + { |
|
23 | 23 | $query = " |
24 | 24 | SELECT `period`.`name`, `period`.`alias`, COUNT(1) AS `count` |
25 | 25 | FROM `jpemeric_waterfall`.`period` |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlCompanionRepository implements CompanionRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlCompanionRepository implements CompanionRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
21 | - public function getCompanionList() |
|
22 | - { |
|
21 | + public function getCompanionList() |
|
22 | + { |
|
23 | 23 | $query = " |
24 | 24 | SELECT `companion`.`name`, `companion`.`alias`, COUNT(1) AS `count` |
25 | 25 | FROM `jpemeric_waterfall`.`companion` |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlWaterfallRepository implements WaterfallRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlWaterfallRepository implements WaterfallRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
21 | - public function getWaterfalls($limit = null, $offset = 0) |
|
22 | - { |
|
21 | + public function getWaterfalls($limit = null, $offset = 0) |
|
22 | + { |
|
23 | 23 | $query = " |
24 | 24 | SELECT `waterfall`.`id`, `waterfall`.`name`, `waterfall`.`alias`, |
25 | 25 | `watercourse`.`name` AS `watercourse`, `watercourse`.`alias` AS `watercourse_alias` |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlLogRepository implements LogRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlLogRepository implements LogRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
21 | - public function getActiveLogs($limit = null, $offset = 0) |
|
22 | - { |
|
21 | + public function getActiveLogs($limit = null, $offset = 0) |
|
22 | + { |
|
23 | 23 | $query = " |
24 | 24 | SELECT `id`, `title`, `alias`, `date`, `publish_date`, `introduction` |
25 | 25 | FROM `jpemeric_waterfall`.`log` |
@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('collector', 'Collector'); |
4 | 4 | |
5 | -final class CommentCollector extends Collector |
|
6 | -{ |
|
5 | +final class CommentCollector extends Collector |
|
6 | +{ |
|
7 | 7 | |
8 | - public static function getCommenterByFields($name, $email, $website) |
|
9 | - { |
|
8 | + public static function getCommenterByFields($name, $email, $website) |
|
9 | + { |
|
10 | 10 | $name = self::escape($name); |
11 | 11 | $email = self::escape($email); |
12 | 12 | $website = self::escape($website); |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | return self::run_row_query($query); |
26 | 26 | } |
27 | 27 | |
28 | - public static function getCommentByBody($body) |
|
29 | - { |
|
28 | + public static function getCommentByBody($body) |
|
29 | + { |
|
30 | 30 | $body = self::escape($body); |
31 | 31 | |
32 | 32 | $query = " |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | return self::run_row_query($query); |
42 | 42 | } |
43 | 43 | |
44 | - public static function getCommentPageByURL($path, $site) |
|
45 | - { |
|
44 | + public static function getCommentPageByURL($path, $site) |
|
45 | + { |
|
46 | 46 | $path = self::escape($path); |
47 | 47 | |
48 | 48 | $query = " |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | return self::run_row_query($query); |
60 | 60 | } |
61 | 61 | |
62 | - public static function getNotificationForPage($comment_page) |
|
63 | - { |
|
62 | + public static function getNotificationForPage($comment_page) |
|
63 | + { |
|
64 | 64 | $query = " |
65 | 65 | SELECT |
66 | 66 | `name`, |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | return self::run_query($query); |
84 | 84 | } |
85 | 85 | |
86 | - public static function getRecentBlogComments($count) |
|
87 | - { |
|
86 | + public static function getRecentBlogComments($count) |
|
87 | + { |
|
88 | 88 | $query = " |
89 | 89 | SELECT |
90 | 90 | `comment_meta`.`id`, |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | return self::run_query($query); |
115 | 115 | } |
116 | 116 | |
117 | - public static function getRecentWaterfallComments($count = 5) |
|
118 | - { |
|
117 | + public static function getRecentWaterfallComments($count = 5) |
|
118 | + { |
|
119 | 119 | $query = " |
120 | 120 | SELECT |
121 | 121 | `comment_meta`.`id`, |
@@ -159,14 +159,15 @@ discard block |
||
159 | 159 | return self::run_query($query); |
160 | 160 | } |
161 | 161 | |
162 | - public static function getCommentsForURL($site, $path, $commenter = 0) |
|
163 | - { |
|
162 | + public static function getCommentsForURL($site, $path, $commenter = 0) |
|
163 | + { |
|
164 | 164 | $path = self::escape($path); |
165 | 165 | |
166 | - if($commenter != 0) |
|
167 | - $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; |
|
168 | - else |
|
169 | - $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
|
166 | + if($commenter != 0) { |
|
167 | + $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; |
|
168 | + } else { |
|
169 | + $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
|
170 | + } |
|
170 | 171 | |
171 | 172 | $query = " |
172 | 173 | SELECT |
@@ -197,8 +198,8 @@ discard block |
||
197 | 198 | return self::run_query($query); |
198 | 199 | } |
199 | 200 | |
200 | - public static function getCommentCountForURL($site, $path) |
|
201 | - { |
|
201 | + public static function getCommentCountForURL($site, $path) |
|
202 | + { |
|
202 | 203 | $path = self::escape($path); |
203 | 204 | |
204 | 205 | $query = " |
@@ -2,31 +2,31 @@ |
||
2 | 2 | |
3 | 3 | Loader::loadInstance('utility', 'Database'); |
4 | 4 | |
5 | -abstract class Collector |
|
6 | -{ |
|
5 | +abstract class Collector |
|
6 | +{ |
|
7 | 7 | |
8 | - protected static function run_query($query) |
|
9 | - { |
|
8 | + protected static function run_query($query) |
|
9 | + { |
|
10 | 10 | return Database::select($query); |
11 | 11 | } |
12 | 12 | |
13 | - protected static function run_row_query($query) |
|
14 | - { |
|
13 | + protected static function run_row_query($query) |
|
14 | + { |
|
15 | 15 | return Database::selectRow($query); |
16 | 16 | } |
17 | 17 | |
18 | - protected static function get_count($query) |
|
19 | - { |
|
18 | + protected static function get_count($query) |
|
19 | + { |
|
20 | 20 | return Database::selectRow($query)->count; |
21 | 21 | } |
22 | 22 | |
23 | - protected static function check_exists($query) |
|
24 | - { |
|
23 | + protected static function check_exists($query) |
|
24 | + { |
|
25 | 25 | return Database::selectRow($query) !== null; |
26 | 26 | } |
27 | 27 | |
28 | - protected static function escape($string) |
|
29 | - { |
|
28 | + protected static function escape($string) |
|
29 | + { |
|
30 | 30 | return Database::escape($string); |
31 | 31 | } |
32 | 32 |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | Loader::load('collector', 'Collector'); |
4 | 4 | |
5 | -final class AlbumCollector extends Collector |
|
6 | -{ |
|
5 | +final class AlbumCollector extends Collector |
|
6 | +{ |
|
7 | 7 | |
8 | - public static function getPhotoListForAlbum($album) |
|
9 | - { |
|
8 | + public static function getPhotoListForAlbum($album) |
|
9 | + { |
|
10 | 10 | $query = " |
11 | 11 | SELECT |
12 | 12 | `photo`.`name`, |