@@ -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`, |
@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('collector', 'Collector'); |
4 | 4 | |
5 | -final class PhotoCollector extends Collector |
|
6 | -{ |
|
5 | +final class PhotoCollector extends Collector |
|
6 | +{ |
|
7 | 7 | |
8 | - public static function fetchRow($category, $photo) |
|
9 | - { |
|
8 | + public static function fetchRow($category, $photo) |
|
9 | + { |
|
10 | 10 | $query = " |
11 | 11 | SELECT |
12 | 12 | `photo`.`name`, |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | return self::run_row_query($query); |
28 | 28 | } |
29 | 29 | |
30 | - public static function getRow($id) |
|
31 | - { |
|
30 | + public static function getRow($id) |
|
31 | + { |
|
32 | 32 | $query = " |
33 | 33 | SELECT |
34 | 34 | `photo`.`name`, |
@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('collector', 'Collector'); |
4 | 4 | |
5 | -final class CountyCollector extends Collector |
|
6 | -{ |
|
5 | +final class CountyCollector extends Collector |
|
6 | +{ |
|
7 | 7 | |
8 | - public static function getByAlias($alias) |
|
9 | - { |
|
8 | + public static function getByAlias($alias) |
|
9 | + { |
|
10 | 10 | $alias = self::escape($alias); |
11 | 11 | |
12 | 12 | $query = " |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | return self::run_row_query($query); |
36 | 36 | } |
37 | 37 | |
38 | - public static function getCountyList() |
|
39 | - { |
|
38 | + public static function getCountyList() |
|
39 | + { |
|
40 | 40 | $query = " |
41 | 41 | SELECT |
42 | 42 | `county`.`name`, |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | return self::run_query($query); |
58 | 58 | } |
59 | 59 | |
60 | - public static function getLogListForCounty($county, $total, $offset = 0) |
|
61 | - { |
|
60 | + public static function getLogListForCounty($county, $total, $offset = 0) |
|
61 | + { |
|
62 | 62 | $query = " |
63 | 63 | SELECT |
64 | 64 | `waterfall`.`id`, |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | return self::run_query($query); |
97 | 97 | } |
98 | 98 | |
99 | - public static function getLogCountForCounty($county) |
|
100 | - { |
|
99 | + public static function getLogCountForCounty($county) |
|
100 | + { |
|
101 | 101 | $query = " |
102 | 102 | SELECT |
103 | 103 | COUNT(1) AS `count` |
@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('collector', 'Collector'); |
4 | 4 | |
5 | -final class WaterfallCollector extends Collector |
|
6 | -{ |
|
5 | +final class WaterfallCollector extends Collector |
|
6 | +{ |
|
7 | 7 | |
8 | - public static function getList($total, $offset = 0) |
|
9 | - { |
|
8 | + public static function getList($total, $offset = 0) |
|
9 | + { |
|
10 | 10 | $query = " |
11 | 11 | SELECT |
12 | 12 | `waterfall`.`id`, |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | return self::run_query($query); |
44 | 44 | } |
45 | 45 | |
46 | - public static function getMapList() |
|
47 | - { |
|
46 | + public static function getMapList() |
|
47 | + { |
|
48 | 48 | $query = " |
49 | 49 | SELECT |
50 | 50 | `waterfall`.`name`, |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | return self::run_query($query); |
75 | 75 | } |
76 | 76 | |
77 | - public static function getListCount() |
|
78 | - { |
|
77 | + public static function getListCount() |
|
78 | + { |
|
79 | 79 | $query = " |
80 | 80 | SELECT |
81 | 81 | COUNT(1) AS `count` |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | return self::get_count($query); |
93 | 93 | } |
94 | 94 | |
95 | - public static function getNearbyList($waterfall) |
|
96 | - { |
|
95 | + public static function getNearbyList($waterfall) |
|
96 | + { |
|
97 | 97 | $query = " |
98 | 98 | SELECT |
99 | 99 | `waterfall`.`name`, |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | return self::run_query($query); |
118 | 118 | } |
119 | 119 | |
120 | - public static function getByOldAlias($alias) |
|
121 | - { |
|
120 | + public static function getByOldAlias($alias) |
|
121 | + { |
|
122 | 122 | $alias = self::escape($alias); |
123 | 123 | |
124 | 124 | $query = " |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | return self::run_row_query($query); |
138 | 138 | } |
139 | 139 | |
140 | - public static function getByAlias($watercourse, $waterfall) |
|
141 | - { |
|
140 | + public static function getByAlias($watercourse, $waterfall) |
|
141 | + { |
|
142 | 142 | $watercourse = self::escape($watercourse); |
143 | 143 | $waterfall = self::escape($waterfall); |
144 | 144 |