Completed
Push — master ( d9eba8...4988a4 )
by Jacob
03:52
created
module/form/CommentSubmitModule.class.inc.php 1 patch
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -3,165 +3,165 @@  discard block
 block discarded – undo
3 3
 Loader::load('collector', 'comment/CommentCollector');
4 4
 
5 5
 Loader::load('utility', array(
6
-	'Content',
7
-	'Request',
8
-	'Validate'));
6
+    'Content',
7
+    'Request',
8
+    'Validate'));
9 9
 
10 10
 final class CommentSubmitModule
11 11
 {
12 12
 
13
-	private $site;
14
-	private $path;
15
-	private $full_path;
16
-	private $page_title;
17
-
18
-	public function __construct($site, $path, $full_path, $page_title)
19
-	{
20
-		$this->site = $site;
21
-		$this->path = $path;
22
-		$this->full_path = $full_path;
23
-		$this->page_title = $page_title;
24
-	}
25
-
26
-	public function activate()
27
-	{
28
-		if(!Request::hasPost())
29
-			return false;
30
-		if(!Request::getPost('submit') == 'Submit Comment')
31
-			return false;
32
-		
33
-		$errors = $this->fetch_errors();
34
-		if(count($errors) > 0)
35
-			return $errors;
36
-		if(Request::getPost('catch') !== '')
37
-			return false;
38
-		
39
-		$page_id = $this->save_comment_page();
40
-		$commenter_id = $this->save_commenter();
41
-		$comment_id = $this->save_comment();
42
-		
43
-		$comment_meta_id = $this->save_comment_meta($commenter_id, $comment_id, $page_id);
13
+    private $site;
14
+    private $path;
15
+    private $full_path;
16
+    private $page_title;
17
+
18
+    public function __construct($site, $path, $full_path, $page_title)
19
+    {
20
+        $this->site = $site;
21
+        $this->path = $path;
22
+        $this->full_path = $full_path;
23
+        $this->page_title = $page_title;
24
+    }
25
+
26
+    public function activate()
27
+    {
28
+        if(!Request::hasPost())
29
+            return false;
30
+        if(!Request::getPost('submit') == 'Submit Comment')
31
+            return false;
32
+		
33
+        $errors = $this->fetch_errors();
34
+        if(count($errors) > 0)
35
+            return $errors;
36
+        if(Request::getPost('catch') !== '')
37
+            return false;
38
+		
39
+        $page_id = $this->save_comment_page();
40
+        $commenter_id = $this->save_commenter();
41
+        $comment_id = $this->save_comment();
42
+		
43
+        $comment_meta_id = $this->save_comment_meta($commenter_id, $comment_id, $page_id);
44 44
     $comment_service_id = $this->save_to_comment_service(Request::getPost());
45 45
 		
46
-		$this->send_notifications($page_id);
47
-		$this->redirect_to_comment($comment_meta_id);
48
-	}
49
-
50
-	private function fetch_errors()
51
-	{
52
-		$errors = array();
53
-		if(!Validate::checkRequest('post', 'name', 'name'))
54
-			$errors['name'] = 'You must include a valid name';
55
-		if(!Validate::checkRequest('post', 'email', 'email'))
56
-			$errors['email'] = 'You must include a valid email';
57
-		if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url'))
58
-			$errors['website'] = 'Please enter a valid website';
59
-		if(!Validate::checkRequest('post', 'comment', 'string'))
60
-			$errors['comment'] = 'You must enter a comment';
61
-		if(Request::getPost('notify') && Request::getPost('notify') != 'check')
62
-			$errors['notify'] = 'You entered an invalid notify request';
63
-		if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer'))
64
-			$errors['reply'] = 'You entered an invalid reply request';
65
-		
66
-		return $errors;
67
-	}
68
-
69
-	private function save_comment_page()
70
-	{
71
-		$page_result = CommentCollector::getCommentPageByURL($this->path, $this->site);
72
-		if($page_result !== null)
73
-			return $page_result->id;
74
-		
75
-		$query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site`, `path`) VALUES ('%d', '%s')";
76
-		$query = sprintf($query, $this->site, $this->path);
77
-		Database::execute($query);
78
-		
79
-		return Database::lastInsertID();
80
-	}
81
-
82
-	private function save_commenter()
83
-	{
84
-		$cookie_value = array(
85
-			'name' => Request::getPost('name'),
86
-			'email' => Request::getPost('email'));
87
-		
88
-		if(Request::getPost('website') != '')
89
-			$cookie_value['website'] = Request::getPost('website');
46
+        $this->send_notifications($page_id);
47
+        $this->redirect_to_comment($comment_meta_id);
48
+    }
49
+
50
+    private function fetch_errors()
51
+    {
52
+        $errors = array();
53
+        if(!Validate::checkRequest('post', 'name', 'name'))
54
+            $errors['name'] = 'You must include a valid name';
55
+        if(!Validate::checkRequest('post', 'email', 'email'))
56
+            $errors['email'] = 'You must include a valid email';
57
+        if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url'))
58
+            $errors['website'] = 'Please enter a valid website';
59
+        if(!Validate::checkRequest('post', 'comment', 'string'))
60
+            $errors['comment'] = 'You must enter a comment';
61
+        if(Request::getPost('notify') && Request::getPost('notify') != 'check')
62
+            $errors['notify'] = 'You entered an invalid notify request';
63
+        if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer'))
64
+            $errors['reply'] = 'You entered an invalid reply request';
65
+		
66
+        return $errors;
67
+    }
68
+
69
+    private function save_comment_page()
70
+    {
71
+        $page_result = CommentCollector::getCommentPageByURL($this->path, $this->site);
72
+        if($page_result !== null)
73
+            return $page_result->id;
74
+		
75
+        $query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site`, `path`) VALUES ('%d', '%s')";
76
+        $query = sprintf($query, $this->site, $this->path);
77
+        Database::execute($query);
78
+		
79
+        return Database::lastInsertID();
80
+    }
81
+
82
+    private function save_commenter()
83
+    {
84
+        $cookie_value = array(
85
+            'name' => Request::getPost('name'),
86
+            'email' => Request::getPost('email'));
87
+		
88
+        if(Request::getPost('website') != '')
89
+            $cookie_value['website'] = Request::getPost('website');
90 90
 
91 91
     setcookie('commenter', json_encode($cookie_value), time() + 31536000, '/', 'jacobemerick.com');
92 92
 
93
-		$commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
94
-		if($commenter_result !== null)
95
-			return $commenter_result->id;
93
+        $commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
94
+        if($commenter_result !== null)
95
+            return $commenter_result->id;
96 96
 		
97
-		$query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`) VALUES ('%s','%s','%s')";
97
+        $query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`) VALUES ('%s','%s','%s')";
98 98
 		
99
-		$name = Database::escape(Request::getPost('name'));
100
-		$email = Database::escape(Request::getPost('email'));
101
-		$website = Database::escape(Request::getPost('website'));
99
+        $name = Database::escape(Request::getPost('name'));
100
+        $email = Database::escape(Request::getPost('email'));
101
+        $website = Database::escape(Request::getPost('website'));
102 102
 		
103
-		$query = sprintf($query, $name, $email, $website);
104
-		Database::execute($query);
105
-		return Database::lastInsertID();
106
-	}
103
+        $query = sprintf($query, $name, $email, $website);
104
+        Database::execute($query);
105
+        return Database::lastInsertID();
106
+    }
107 107
 
108
-	private function save_comment()
109
-	{
110
-		$comment_result = CommentCollector::getCommentByBody(Request::getPost('comment'));
111
-		if($comment_result !== null)
112
-			return $comment_result->id;
108
+    private function save_comment()
109
+    {
110
+        $comment_result = CommentCollector::getCommentByBody(Request::getPost('comment'));
111
+        if($comment_result !== null)
112
+            return $comment_result->id;
113 113
 		
114
-		$query = "INSERT INTO `jpemeric_comment`.`comment` (`body`, `body_format`) VALUES ('%s', '%s')";
114
+        $query = "INSERT INTO `jpemeric_comment`.`comment` (`body`, `body_format`) VALUES ('%s', '%s')";
115 115
 		
116
-		$body = Database::escape(Request::getPost('comment'));
116
+        $body = Database::escape(Request::getPost('comment'));
117 117
 		
118
-		$body_format = Request::getPost('comment');
119
-		$body_format = Content::instance('CleanComment', $body_format)->activate();
120
-		$body_format = Database::escape($body_format);
118
+        $body_format = Request::getPost('comment');
119
+        $body_format = Content::instance('CleanComment', $body_format)->activate();
120
+        $body_format = Database::escape($body_format);
121 121
 		
122
-		$query = sprintf($query, $body, $body_format);
123
-		Database::execute($query);
124
-		return Database::lastInsertID();
125
-	}
122
+        $query = sprintf($query, $body, $body_format);
123
+        Database::execute($query);
124
+        return Database::lastInsertID();
125
+    }
126 126
 
127
-	private function save_comment_meta($commenter, $comment, $page)
128
-	{
129
-		$query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter`,`comment`,`reply`,`notify`,`comment_page`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')";
127
+    private function save_comment_meta($commenter, $comment, $page)
128
+    {
129
+        $query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter`,`comment`,`reply`,`notify`,`comment_page`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')";
130 130
 		
131
-		$reply = Database::escape(Request::getPost('type'));
132
-		if($reply == 'new')
133
-			$reply = 0;
134
-		// else check to make sure value is legit
131
+        $reply = Database::escape(Request::getPost('type'));
132
+        if($reply == 'new')
133
+            $reply = 0;
134
+        // else check to make sure value is legit
135 135
 		
136
-		$notify = (Request::getPost('notify') == 'check') ? 1 : 0;
137
-		$date = date('Y-m-d H:i:s');
138
-		$display = 1;
136
+        $notify = (Request::getPost('notify') == 'check') ? 1 : 0;
137
+        $date = date('Y-m-d H:i:s');
138
+        $display = 1;
139 139
 		
140
-		$query = sprintf($query, $commenter, $comment, $reply, $notify, $page, $date, $display);
141
-		Database::execute($query);
142
-		return Database::lastInsertID();
143
-	}
140
+        $query = sprintf($query, $commenter, $comment, $reply, $notify, $page, $date, $display);
141
+        Database::execute($query);
142
+        return Database::lastInsertID();
143
+    }
144 144
 
145
-	private function send_notifications($page)
146
-	{
147
-		$email_recipient_array = array();
145
+    private function send_notifications($page)
146
+    {
147
+        $email_recipient_array = array();
148 148
 		
149
-		$commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
149
+        $commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
150 150
 		
151
-		if($commenter_result->trusted == 1)
152
-		{
153
-			$notification_result = CommentCollector::getNotificationForPage($page);
151
+        if($commenter_result->trusted == 1)
152
+        {
153
+            $notification_result = CommentCollector::getNotificationForPage($page);
154 154
 			
155
-			foreach($notification_result as $notification_row)
156
-			{
157
-				if($notification_row->email == Request::getPost('email'))
158
-					continue;
155
+            foreach($notification_result as $notification_row)
156
+            {
157
+                if($notification_row->email == Request::getPost('email'))
158
+                    continue;
159 159
 				
160
-				$email_recipient_array[$notification_row->email] = array(
161
-					'email' => $notification_row->email,
162
-					'name' => $notification_row->name);
163
-			}
164
-		}
160
+                $email_recipient_array[$notification_row->email] = array(
161
+                    'email' => $notification_row->email,
162
+                    'name' => $notification_row->name);
163
+            }
164
+        }
165 165
         
166 166
         $site = URLDecode::getSite();
167 167
         
@@ -175,26 +175,26 @@  discard block
 block discarded – undo
175 175
 
176 176
     global $container;
177 177
 
178
-		foreach($email_recipient_array as $email_recipient)
179
-		{
180
-      $sent = $container['mail']
178
+        foreach($email_recipient_array as $email_recipient)
179
+        {
180
+        $sent = $container['mail']
181 181
         ->addTo($email_recipient['email'], $email_recipient['name'])
182 182
         ->addBCC($container['config']->admin_email)
183 183
         ->setSubject($subject)
184 184
         ->setPlainMessage($message)
185 185
         ->send();		
186
-		}
187
-	}
188
-
189
-	private function redirect_to_comment($comment_id)
190
-	{
191
-		$url = '';
192
-		$url .= $this->full_path;
193
-		$url .= "#comment-{$comment_id}";
194
-		
195
-		Loader::loadNew('controller', 'Error303Controller', array($url))->activate();
196
-		exit;
197
-	}
186
+        }
187
+    }
188
+
189
+    private function redirect_to_comment($comment_id)
190
+    {
191
+        $url = '';
192
+        $url .= $this->full_path;
193
+        $url .= "#comment-{$comment_id}";
194
+		
195
+        Loader::loadNew('controller', 'Error303Controller', array($url))->activate();
196
+        exit;
197
+    }
198 198
 
199 199
     private function save_to_comment_service(array $data)
200 200
     {
Please login to merge, or discard this patch.
collector/image/PhotoCollector.class.inc.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 final class PhotoCollector extends Collector
6 6
 {
7 7
 
8
-	public static function fetchRow($category, $photo)
9
-	{
10
-		$query = "
8
+    public static function fetchRow($category, $photo)
9
+    {
10
+        $query = "
11 11
 			SELECT
12 12
 				`photo`.`name`,
13 13
 				`photo_category`.`name` AS `category`,
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 				`photo`.`name` = '{$photo}' &&
25 25
 				`photo_category`.`name` = '{$category}'
26 26
 			LIMIT 1";
27
-		return self::run_row_query($query);
28
-	}
27
+        return self::run_row_query($query);
28
+    }
29 29
 
30
-	public static function getRow($id)
31
-	{
32
-		$query = "
30
+    public static function getRow($id)
31
+    {
32
+        $query = "
33 33
 			SELECT
34 34
 				`photo`.`name`,
35 35
 				`photo_category`.`name` AS `category`,
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 				`photo`.`photographer` = `photographer`.`id` &&
46 46
 				`photo`.`id` = '{$id}'
47 47
 			LIMIT 1";
48
-		return self::run_row_query($query);
49
-	}
48
+        return self::run_row_query($query);
49
+    }
50 50
 
51 51
 }
Please login to merge, or discard this patch.
collector/image/AlbumCollector.class.inc.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 final class AlbumCollector extends Collector
6 6
 {
7 7
 
8
-	public static function getPhotoListForAlbum($album)
9
-	{
10
-		$query = "
8
+    public static function getPhotoListForAlbum($album)
9
+    {
10
+        $query = "
11 11
 			SELECT
12 12
 				`photo`.`name`,
13 13
 				`photo_category`.`name` AS `category`,
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			ORDER BY
39 39
 				`photo`.`date_taken`";
40 40
 		
41
-		return self::run_query($query);
42
-	}
41
+        return self::run_query($query);
42
+    }
43 43
 
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
collector/waterfall/WatercourseCollector.class.inc.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 final class WatercourseCollector extends Collector
6 6
 {
7 7
 
8
-	public static function getById($id)
9
-	{
10
-		$query = "
8
+    public static function getById($id)
9
+    {
10
+        $query = "
11 11
 			SELECT
12 12
 				`watercourse`.`name`,
13 13
 				`watercourse`.`alias`
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 				`watercourse`.`id` = '{$id}'
18 18
 			LIMIT 1";
19 19
 			
20
-		return self::run_row_query($query);
21
-	}
20
+        return self::run_row_query($query);
21
+    }
22 22
 
23
-	public static function getByAlias($alias)
24
-	{
25
-		$alias = self::escape($alias);
23
+    public static function getByAlias($alias)
24
+    {
25
+        $alias = self::escape($alias);
26 26
 		
27
-		$query = "
27
+        $query = "
28 28
 			SELECT
29 29
 				`watercourse`.`id`,
30 30
 				`watercourse`.`name`,
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 				`watercourse`.`alias` = '{$alias}'
49 49
 			LIMIT 1";
50 50
 			
51
-		return self::run_row_query($query);
52
-	}
51
+        return self::run_row_query($query);
52
+    }
53 53
 
54
-	public static function getWatercourseList()
55
-	{
56
-		$query = "
54
+    public static function getWatercourseList()
55
+    {
56
+        $query = "
57 57
 			SELECT
58 58
 				`sum_table`.`name`,
59 59
 				`sum_table`.`alias`,
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 			ORDER BY
112 112
 				`sum_table`.`name`";
113 113
 		
114
-		return self::run_query($query);
115
-	}
114
+        return self::run_query($query);
115
+    }
116 116
 
117
-	public static function getLogListForWatercourse($watercourse, $total, $offset = 0)
118
-	{
119
-		$query = "
117
+    public static function getLogListForWatercourse($watercourse, $total, $offset = 0)
118
+    {
119
+        $query = "
120 120
 			SELECT
121 121
 				`waterfall`.`id`,
122 122
 				`waterfall`.`name`,
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
 				`watercourse`
151 151
 			LIMIT
152 152
 				{$offset}, {$total}";
153
-		return self::run_query($query);
154
-	}
153
+        return self::run_query($query);
154
+    }
155 155
 
156 156
     public static function getParentWatercourse($watercourse)
157 157
     {
158 158
     }
159 159
 
160
-	public static function getLogCountForWatercourse($watercourse)
161
-	{
162
-		$query = "
160
+    public static function getLogCountForWatercourse($watercourse)
161
+    {
162
+        $query = "
163 163
 			SELECT
164 164
 				SUM(`count`) AS `count`
165 165
 			FROM
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 					)
207 207
 				) AS `sum_table`";
208 208
 		
209
-		return self::get_count($query);
210
-	}
209
+        return self::get_count($query);
210
+    }
211 211
 
212 212
 }
213 213
\ No newline at end of file
Please login to merge, or discard this patch.
collector/waterfall/CompanionCollector.class.inc.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
 final class CompanionCollector extends Collector
6 6
 {
7 7
 
8
-	public static function getByAlias($alias)
9
-	{
10
-		$alias = self::escape($alias);
8
+    public static function getByAlias($alias)
9
+    {
10
+        $alias = self::escape($alias);
11 11
 		
12
-		$query = "
12
+        $query = "
13 13
 			SELECT
14 14
 				`companion`.`id`,
15 15
 				`companion`.`name`,
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 				`companion`.`alias` = '{$alias}'
33 33
 			LIMIT 1";
34 34
 		
35
-		return self::run_row_query($query);
36
-	}
35
+        return self::run_row_query($query);
36
+    }
37 37
 
38
-	public static function getCompanionList()
39
-	{
40
-		$query = "
38
+    public static function getCompanionList()
39
+    {
40
+        $query = "
41 41
 			SELECT
42 42
 				`companion`.`name`,
43 43
 				`companion`.`alias`,
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 			ORDER BY
58 58
 				`companion`.`name`";
59 59
 		
60
-		return self::run_query($query);
61
-	}
60
+        return self::run_query($query);
61
+    }
62 62
 
63
-	public static function getLogListForCompanion($companion, $total, $offset = 0)
64
-	{
65
-		$query = "
63
+    public static function getLogListForCompanion($companion, $total, $offset = 0)
64
+    {
65
+        $query = "
66 66
 			SELECT
67 67
 				`log`.`id`,
68 68
 				`log`.`title`,
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 				`log`.`date` DESC
91 91
 			LIMIT
92 92
 				{$offset}, {$total}";
93
-		return self::run_query($query);
94
-	}
93
+        return self::run_query($query);
94
+    }
95 95
 
96
-	public static function getLogCountForCompanion($companion)
97
-	{
98
-		$query = "
96
+    public static function getLogCountForCompanion($companion)
97
+    {
98
+        $query = "
99 99
 			SELECT
100 100
 				COUNT(1) AS `count`
101 101
 			FROM
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			WHERE
107 107
 				`log_companion_map`.`companion` = '{$companion}' &&
108 108
 				`log`.`is_public` = '1'";
109
-		return self::get_count($query);
110
-	}
109
+        return self::get_count($query);
110
+    }
111 111
 
112 112
 }
113 113
\ No newline at end of file
Please login to merge, or discard this patch.
collector/waterfall/PeriodCollector.class.inc.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
 final class PeriodCollector extends Collector
6 6
 {
7 7
 
8
-	public static function getByAlias($alias)
9
-	{
10
-		$alias = self::escape($alias);
8
+    public static function getByAlias($alias)
9
+    {
10
+        $alias = self::escape($alias);
11 11
 		
12
-		$query = "
12
+        $query = "
13 13
 			SELECT
14 14
 				`period`.`id`,
15 15
 				`period`.`name`,
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 			WHERE
32 32
 				`period`.`alias` = '{$alias}'
33 33
 			LIMIT 1";
34
-		return self::run_row_query($query);
35
-	}
34
+        return self::run_row_query($query);
35
+    }
36 36
 
37
-	public static function getPeriodList()
38
-	{
39
-		$query = "
37
+    public static function getPeriodList()
38
+    {
39
+        $query = "
40 40
 			SELECT
41 41
 				`period`.`name`,
42 42
 				`period`.`alias`,
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 				`period`.`alias`
53 53
 			ORDER BY
54 54
 				`period`.`id`";
55
-		return self::run_query($query);
56
-	}
55
+        return self::run_query($query);
56
+    }
57 57
 
58
-	public static function getLogListForPeriod($period, $total, $offset = 0)
59
-	{
60
-		$query = "
58
+    public static function getLogListForPeriod($period, $total, $offset = 0)
59
+    {
60
+        $query = "
61 61
 			SELECT
62 62
 				`log`.`id`,
63 63
 				`log`.`title`,
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 			LIMIT
84 84
 				{$offset}, {$total}";
85 85
 		
86
-		return self::run_query($query);
87
-	}
86
+        return self::run_query($query);
87
+    }
88 88
 
89
-	public static function getLogCountForPeriod($period)
90
-	{
91
-		$query = "
89
+    public static function getLogCountForPeriod($period)
90
+    {
91
+        $query = "
92 92
 			SELECT
93 93
 				COUNT(1) AS `count`
94 94
 			FROM
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			WHERE
97 97
 				`period` = '{$period}' &&
98 98
 				`is_public` = '1'";
99
-		return self::get_count($query);
100
-	}
99
+        return self::get_count($query);
100
+    }
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
collector/waterfall/CountyCollector.class.inc.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
 final class CountyCollector extends Collector
6 6
 {
7 7
 
8
-	public static function getByAlias($alias)
9
-	{
10
-		$alias = self::escape($alias);
8
+    public static function getByAlias($alias)
9
+    {
10
+        $alias = self::escape($alias);
11 11
 		
12
-		$query = "
12
+        $query = "
13 13
 			SELECT
14 14
 				`county`.`id`,
15 15
 				`county`.`name`,
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 				`county`.`alias` = '{$alias}'
33 33
 			LIMIT 1";
34 34
 		
35
-		return self::run_row_query($query);
36
-	}
35
+        return self::run_row_query($query);
36
+    }
37 37
 
38
-	public static function getCountyList()
39
-	{
40
-		$query = "
38
+    public static function getCountyList()
39
+    {
40
+        $query = "
41 41
 			SELECT
42 42
 				`county`.`name`,
43 43
 				`county`.`alias`,
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 			ORDER BY
55 55
 				`county`.`name`";
56 56
 		
57
-		return self::run_query($query);
58
-	}
57
+        return self::run_query($query);
58
+    }
59 59
 
60
-	public static function getLogListForCounty($county, $total, $offset = 0)
61
-	{
62
-		$query = "
60
+    public static function getLogListForCounty($county, $total, $offset = 0)
61
+    {
62
+        $query = "
63 63
 			SELECT
64 64
 				`waterfall`.`id`,
65 65
 				`waterfall`.`name`,
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
 				`watercourse`.`name`
94 94
 			LIMIT
95 95
 				{$offset}, {$total}";
96
-		return self::run_query($query);
97
-	}
96
+        return self::run_query($query);
97
+    }
98 98
 
99
-	public static function getLogCountForCounty($county)
100
-	{
101
-		$query = "
99
+    public static function getLogCountForCounty($county)
100
+    {
101
+        $query = "
102 102
 			SELECT
103 103
 				COUNT(1) AS `count`
104 104
 			FROM
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			WHERE
110 110
 				`waterfall`.`county` = '{$county}' &&
111 111
 				`waterfall`.`is_public` = '1'";
112
-		return self::get_count($query);
113
-	}
112
+        return self::get_count($query);
113
+    }
114 114
 
115 115
 }
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
collector/waterfall/LogCollector.class.inc.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 final class LogCollector extends Collector
6 6
 {
7 7
 
8
-	public static function getList($total, $offset = 0)
9
-	{
10
-		$query = "
8
+    public static function getList($total, $offset = 0)
9
+    {
10
+        $query = "
11 11
 			SELECT
12 12
 				`log`.`id`,
13 13
 				`log`.`title`,
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 				`log`.`date` DESC
32 32
 			LIMIT
33 33
 				{$offset}, {$total}";
34
-		return self::run_query($query);
35
-	}
34
+        return self::run_query($query);
35
+    }
36 36
 
37 37
     public static function getRecentList($total)
38 38
     {
@@ -62,21 +62,21 @@  discard block
 block discarded – undo
62 62
         return self::run_query($query);
63 63
     }
64 64
 
65
-	public static function getListCount()
66
-	{
67
-		$query = "
65
+    public static function getListCount()
66
+    {
67
+        $query = "
68 68
 			SELECT
69 69
 				COUNT(1) AS `count`
70 70
 			FROM
71 71
 				`jpemeric_waterfall`.`log`
72 72
 			WHERE
73 73
 				`is_public` = '1'";
74
-		return self::get_count($query);
75
-	}
74
+        return self::get_count($query);
75
+    }
76 76
 
77
-	public static function getCompanionListForLog($log)
78
-	{
79
-		$query = "
77
+    public static function getCompanionListForLog($log)
78
+    {
79
+        $query = "
80 80
 			SELECT
81 81
 				`companion`.`name`,
82 82
 				`companion`.`alias`
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 							ON `log_companion_map`.`companion` = `companion`.`id`
88 88
 			WHERE
89 89
 				`log_companion_map`.`log` = '{$log}'";
90
-		return self::run_query($query);
91
-	}
90
+        return self::run_query($query);
91
+    }
92 92
 
93
-	public static function getWaterfallListForLog($log)
94
-	{
95
-		$query = "
93
+    public static function getWaterfallListForLog($log)
94
+    {
95
+        $query = "
96 96
 			SELECT
97 97
 				`waterfall`.`name`,
98 98
 				`waterfall`.`alias`,
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 				`waterfall`.`is_public` = '1'
111 111
 			ORDER BY
112 112
 				`log_waterfall_map`.`order`";
113
-		return self::run_query($query);
114
-	}
113
+        return self::run_query($query);
114
+    }
115 115
 
116
-	public static function getLogListForWaterfall($waterfall)
117
-	{
118
-		$query = "
116
+    public static function getLogListForWaterfall($waterfall)
117
+    {
118
+        $query = "
119 119
 			SELECT
120 120
 				`log`.`title`,
121 121
 				`log`.`alias`,
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 				`log`.`is_public` = '1'
131 131
 			ORDER BY
132 132
 				`log`.`date`";
133
-		return self::run_query($query);
134
-	}
133
+        return self::run_query($query);
134
+    }
135 135
 
136
-	public static function getTagListForLog($log)
137
-	{
138
-		$query = "
136
+    public static function getTagListForLog($log)
137
+    {
138
+        $query = "
139 139
 			SELECT
140 140
 				`tag`.`name`,
141 141
 				`tag`.`alias`
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 					INNER JOIN
145 145
 						`jpemeric_waterfall`.`log_tag_map`
146 146
 							ON `log_tag_map`.`tag` = `tag`.`id` && `log_tag_map`.`log` = '{$log}'";
147
-		return self::run_query($query);
148
-	}
147
+        return self::run_query($query);
148
+    }
149 149
 
150
-	public static function getByAlias($alias)
151
-	{
152
-		$alias = self::escape($alias);
150
+    public static function getByAlias($alias)
151
+    {
152
+        $alias = self::escape($alias);
153 153
 		
154
-		$query = "
154
+        $query = "
155 155
 			SELECT
156 156
 				`log`.`id`,
157 157
 				`log`.`title`,
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 				`log`.`is_public` = '1'
176 176
 			LIMIT 1";
177 177
 		
178
-		return self::run_row_query($query);
179
-	}
178
+        return self::run_row_query($query);
179
+    }
180 180
 
181 181
     public static function getByDate($date)
182 182
     {
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
         return self::run_row_query($query);
196 196
     }
197 197
 	
198
-	public static function getById($log)
199
-	{
200
-		$query = "
198
+    public static function getById($log)
199
+    {
200
+        $query = "
201 201
 			SELECT
202 202
 				`title`,
203 203
 				`date`,
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 				`id` = '{$log}' AND
209 209
 				`is_public` = '1'
210 210
 			LIMIT 1";
211
-		return self::run_row_query($query);
212
-	}
211
+        return self::run_row_query($query);
212
+    }
213 213
 
214
-	public static function getPreviousLog($log)
215
-	{
216
-		$query = "
214
+    public static function getPreviousLog($log)
215
+    {
216
+        $query = "
217 217
 			SELECT
218 218
 				`title`,
219 219
 				`date`,
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 				`date` DESC
234 234
 			LIMIT 1";
235 235
 		
236
-		return self::run_row_query($query);
237
-	}
236
+        return self::run_row_query($query);
237
+    }
238 238
 
239
-	public static function getNextLog($log)
240
-	{
241
-		$query = "
239
+    public static function getNextLog($log)
240
+    {
241
+        $query = "
242 242
 			SELECT
243 243
 				`title`,
244 244
 				`date`,
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 				`date` ASC
259 259
 			LIMIT 1";
260 260
 		
261
-		return self::run_row_query($query);
262
-	}
261
+        return self::run_row_query($query);
262
+    }
263 263
 
264 264
 }
Please login to merge, or discard this patch.
collector/waterfall/WaterfallCollector.class.inc.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 final class WaterfallCollector extends Collector
6 6
 {
7 7
 
8
-	public static function getList($total, $offset = 0)
9
-	{
10
-		$query = "
8
+    public static function getList($total, $offset = 0)
9
+    {
10
+        $query = "
11 11
 			SELECT
12 12
 				`waterfall`.`id`,
13 13
 				`waterfall`.`name`,
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 				`watercourse`.`name`
41 41
 			LIMIT
42 42
 				{$offset}, {$total}";
43
-		return self::run_query($query);
44
-	}
43
+        return self::run_query($query);
44
+    }
45 45
 
46 46
     public static function getMapList()
47 47
     {
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
         return self::run_query($query);
75 75
     }
76 76
 
77
-	public static function getListCount()
78
-	{
79
-		$query = "
77
+    public static function getListCount()
78
+    {
79
+        $query = "
80 80
 			SELECT
81 81
 				COUNT(1) AS `count`
82 82
 			FROM
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 							ON `county`.`id` = `waterfall`.`county`
90 90
 			WHERE
91 91
 				`waterfall`.`is_public` = '1'";
92
-		return self::get_count($query);
93
-	}
92
+        return self::get_count($query);
93
+    }
94 94
 
95 95
     public static function getNearbyList($waterfall)
96 96
     {
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
         return self::run_row_query($query);
138 138
     }
139 139
 
140
-	public static function getByAlias($watercourse, $waterfall)
141
-	{
142
-		$watercourse = self::escape($watercourse);
143
-		$waterfall = self::escape($waterfall);
140
+    public static function getByAlias($watercourse, $waterfall)
141
+    {
142
+        $watercourse = self::escape($watercourse);
143
+        $waterfall = self::escape($waterfall);
144 144
 		
145
-		$query = "
145
+        $query = "
146 146
 			SELECT
147 147
 				`waterfall`.`id` AS `id`,
148 148
 				`waterfall`.`name`,
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 				`waterfall`.`is_public` = '1'
193 193
 			LIMIT 1";
194 194
 		
195
-		return self::run_row_query($query);
196
-	}
195
+        return self::run_row_query($query);
196
+    }
197 197
 
198 198
 }
199 199
\ No newline at end of file
Please login to merge, or discard this patch.