Completed
Push — master ( 72ee7f...4775c0 )
by Jacob
03:43
created
src/Domain/Blog/Introduction/MysqlIntroductionRepository.php 1 patch
Braces   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Aura\Sql\ConnectionLocator;
6 6
 
7
-class MysqlIntroductionRepository implements IntroductionRepositoryInterface
8
-{
7
+class MysqlIntroductionRepository implements IntroductionRepositoryInterface
8
+{
9 9
 
10 10
     /** @var  Aura\Sql\ConnectionLocator */
11 11
     protected $connections;
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * @param Aura\Sql\ConnectionLocator
15 15
      */
16
-    public function __construct(ConnectionLocator $connections)
17
-    {
16
+    public function __construct(ConnectionLocator $connections) {
18 17
         $this->connections = $connections;
19 18
     }
20 19
 
@@ -24,8 +23,7 @@  discard block
 block discarded – undo
24 23
      *
25 24
      * @return array|false
26 25
      */
27
-    public function findByType($type, $value = '')
28
-    {
26
+    public function findByType($type, $value = '') {
29 27
         $query = "
30 28
             SELECT `title`, `content`, `image`
31 29
             FROM `jpemeric_blog`.`introduction`
Please login to merge, or discard this patch.
src/Domain/Blog/Introduction/IntroductionRepositoryInterface.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Jacobemerick\Web\Domain\Blog\Introduction;
4 4
 
5
-interface IntroductionRepositoryInterface
6
-{
5
+interface IntroductionRepositoryInterface
6
+{
7 7
     public function findByType($type, $value = '');
8 8
 }
Please login to merge, or discard this patch.
src/Domain/Stream/Changelog/MysqlChangelogRepository.php 1 patch
Braces   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Aura\Sql\ConnectionLocator;
6 6
 
7
-class MysqlChangelogRepository implements ChangelogRepositoryInterface
8
-{
7
+class MysqlChangelogRepository implements ChangelogRepositoryInterface
8
+{
9 9
 
10 10
     /** @var  ConnectionLocator */
11 11
     protected $connections;
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * @param ConnectonLocator $connections
15 15
      */
16
-    public function __construct(ConnectionLocator $connections)
17
-    {
16
+    public function __construct(ConnectionLocator $connections) {
18 17
         $this->connections = $connections;
19 18
     }
20 19
 
@@ -24,8 +23,7 @@  discard block
 block discarded – undo
24 23
      *
25 24
      * @return array|false
26 25
      */
27
-    public function getChanges($limit = null, $offset = 0)
28
-    {
26
+    public function getChanges($limit = null, $offset = 0) {
29 27
         $query = "
30 28
             SELECT `id`, `message`, `message_short`, `datetime`, `commit_link`
31 29
             FROM `jpemeric_stream`.`changelog`
Please login to merge, or discard this patch.
src/Domain/Stream/Changelog/ChangelogRepositoryInterface.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Jacobemerick\Web\Domain\Stream\Changelog;
4 4
 
5
-interface ChangelogRepositoryInterface
6
-{
5
+interface ChangelogRepositoryInterface
6
+{
7 7
     public function getChanges($limit = null, $offset = 0);
8 8
 }
Please login to merge, or discard this patch.
src/Domain/Stream/Activity/ActivityRepositoryInterface.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Jacobemerick\Web\Domain\Stream\Activity;
4 4
 
5
-interface ActivityRepositoryInterface
6
-{
5
+interface ActivityRepositoryInterface
6
+{
7 7
     public function getActivityById($id);
8 8
     public function getActivities($limit = null, $offset = 0);
9 9
     public function getActivitiesCount();
Please login to merge, or discard this patch.
src/Domain/Stream/Activity/MysqlActivityRepository.php 1 patch
Braces   +8 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Aura\Sql\ConnectionLocator;
6 6
 
7
-class MysqlActivityRepository implements ActivityRepositoryInterface
8
-{
7
+class MysqlActivityRepository implements ActivityRepositoryInterface
8
+{
9 9
 
10 10
     /** @var  ConnectionLocator */
11 11
     protected $connections;
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * @param ConnectonLocator $connections
15 15
      */
16
-    public function __construct(ConnectionLocator $connections)
17
-    {
16
+    public function __construct(ConnectionLocator $connections) {
18 17
         $this->connections = $connections;
19 18
     }
20 19
 
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
      *
24 23
      * @return array|false
25 24
      */
26
-    public function getActivityById($id)
27
-    {
25
+    public function getActivityById($id) {
28 26
         $query = "
29 27
             SELECT *
30 28
             FROM `jpemeric_stream`.`activity`
@@ -46,8 +44,7 @@  discard block
 block discarded – undo
46 44
      *
47 45
      * @return array|false
48 46
      */
49
-    public function getActivities($limit = null, $offset = 0)
50
-    {
47
+    public function getActivities($limit = null, $offset = 0) {
51 48
         $query = "
52 49
             SELECT *
53 50
             FROM `jpemeric_stream`.`activity`
@@ -63,8 +60,7 @@  discard block
 block discarded – undo
63 60
             ->fetchAll($query);
64 61
     }
65 62
 
66
-    public function getActivitiesCount()
67
-    {
63
+    public function getActivitiesCount() {
68 64
         $query = "
69 65
             SELECT COUNT(1) AS `count`
70 66
             FROM `jpemeric_stream`.`activity`";
@@ -75,8 +71,7 @@  discard block
 block discarded – undo
75 71
             ->fetchValue($query);
76 72
     }
77 73
 
78
-    public function getActivitiesByType($type, $limit = null, $offset = 0)
79
-    {
74
+    public function getActivitiesByType($type, $limit = null, $offset = 0) {
80 75
         $query = "
81 76
             SELECT *
82 77
             FROM `jpemeric_stream`.`activity`
@@ -96,8 +91,7 @@  discard block
 block discarded – undo
96 91
             ->fetchAll($query, $bindings);
97 92
     }
98 93
 
99
-    public function getActivitiesByTypeCount($type)
100
-    {
94
+    public function getActivitiesByTypeCount($type) {
101 95
         $query = "
102 96
             SELECT COUNT(1) AS `count`
103 97
             FROM `jpemeric_stream`.`activity`
Please login to merge, or discard this patch.
module/form/CommentSubmitModule.class.inc.php 1 patch
Braces   +60 added lines, -54 removed lines patch added patch discarded remove patch
@@ -7,34 +7,36 @@  discard block
 block discarded – undo
7 7
 	'Request',
8 8
 	'Validate'));
9 9
 
10
-final class CommentSubmitModule
11
-{
10
+final class CommentSubmitModule
11
+{
12 12
 
13 13
 	private $site;
14 14
 	private $path;
15 15
 	private $full_path;
16 16
 	private $page_title;
17 17
 
18
-	public function __construct($site, $path, $full_path, $page_title)
19
-	{
18
+	public function __construct($site, $path, $full_path, $page_title) {
20 19
 		$this->site = $site;
21 20
 		$this->path = $path;
22 21
 		$this->full_path = $full_path;
23 22
 		$this->page_title = $page_title;
24 23
 	}
25 24
 
26
-	public function activate()
27
-	{
28
-		if(!Request::hasPost())
29
-			return false;
30
-		if(!Request::getPost('submit') == 'Submit Comment')
31
-			return false;
25
+	public function activate() {
26
+		if(!Request::hasPost()) {
27
+					return false;
28
+		}
29
+		if(!Request::getPost('submit') == 'Submit Comment') {
30
+					return false;
31
+		}
32 32
 		
33 33
 		$errors = $this->fetch_errors();
34
-		if(count($errors) > 0)
35
-			return $errors;
36
-		if(Request::getPost('catch') !== '')
37
-			return false;
34
+		if(count($errors) > 0) {
35
+					return $errors;
36
+		}
37
+		if(Request::getPost('catch') !== '') {
38
+					return false;
39
+		}
38 40
 		
39 41
 		$page_id = $this->save_comment_page();
40 42
 		$commenter_id = $this->save_commenter();
@@ -47,30 +49,35 @@  discard block
 block discarded – undo
47 49
 		$this->redirect_to_comment($comment_meta_id);
48 50
 	}
49 51
 
50
-	private function fetch_errors()
51
-	{
52
+	private function fetch_errors() {
52 53
 		$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';
54
+		if(!Validate::checkRequest('post', 'name', 'name')) {
55
+					$errors['name'] = 'You must include a valid name';
56
+		}
57
+		if(!Validate::checkRequest('post', 'email', 'email')) {
58
+					$errors['email'] = 'You must include a valid email';
59
+		}
60
+		if(Request::getPost('website') && !Validate::checkRequest('post', 'website', 'url')) {
61
+					$errors['website'] = 'Please enter a valid website';
62
+		}
63
+		if(!Validate::checkRequest('post', 'comment', 'string')) {
64
+					$errors['comment'] = 'You must enter a comment';
65
+		}
66
+		if(Request::getPost('notify') && Request::getPost('notify') != 'check') {
67
+					$errors['notify'] = 'You entered an invalid notify request';
68
+		}
69
+		if(Request::getPost('reply') && !Validate::checkRequest('post', 'reply', 'integer')) {
70
+					$errors['reply'] = 'You entered an invalid reply request';
71
+		}
65 72
 		
66 73
 		return $errors;
67 74
 	}
68 75
 
69
-	private function save_comment_page()
70
-	{
76
+	private function save_comment_page() {
71 77
 		$page_result = CommentCollector::getCommentPageByURL($this->path, $this->site);
72
-		if($page_result !== null)
73
-			return $page_result->id;
78
+		if($page_result !== null) {
79
+					return $page_result->id;
80
+		}
74 81
 		
75 82
 		$query = "INSERT INTO `jpemeric_comment`.`comment_page` (`site`, `path`) VALUES ('%d', '%s')";
76 83
 		$query = sprintf($query, $this->site, $this->path);
@@ -79,20 +86,21 @@  discard block
 block discarded – undo
79 86
 		return Database::lastInsertID();
80 87
 	}
81 88
 
82
-	private function save_commenter()
83
-	{
89
+	private function save_commenter() {
84 90
 		$cookie_value = array(
85 91
 			'name' => Request::getPost('name'),
86 92
 			'email' => Request::getPost('email'));
87 93
 		
88
-		if(Request::getPost('website') != '')
89
-			$cookie_value['website'] = Request::getPost('website');
94
+		if(Request::getPost('website') != '') {
95
+					$cookie_value['website'] = Request::getPost('website');
96
+		}
90 97
 
91 98
     setcookie('commenter', json_encode($cookie_value), time() + 31536000, '/', 'jacobemerick.com');
92 99
 
93 100
 		$commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
94
-		if($commenter_result !== null)
95
-			return $commenter_result->id;
101
+		if($commenter_result !== null) {
102
+					return $commenter_result->id;
103
+		}
96 104
 		
97 105
 		$query = "INSERT INTO `jpemeric_comment`.`commenter` (`name`,`email`,`url`) VALUES ('%s','%s','%s')";
98 106
 		
@@ -105,11 +113,11 @@  discard block
 block discarded – undo
105 113
 		return Database::lastInsertID();
106 114
 	}
107 115
 
108
-	private function save_comment()
109
-	{
116
+	private function save_comment() {
110 117
 		$comment_result = CommentCollector::getCommentByBody(Request::getPost('comment'));
111
-		if($comment_result !== null)
112
-			return $comment_result->id;
118
+		if($comment_result !== null) {
119
+					return $comment_result->id;
120
+		}
113 121
 		
114 122
 		$query = "INSERT INTO `jpemeric_comment`.`comment` (`body`, `body_format`) VALUES ('%s', '%s')";
115 123
 		
@@ -124,13 +132,13 @@  discard block
 block discarded – undo
124 132
 		return Database::lastInsertID();
125 133
 	}
126 134
 
127
-	private function save_comment_meta($commenter, $comment, $page)
128
-	{
135
+	private function save_comment_meta($commenter, $comment, $page) {
129 136
 		$query = "INSERT INTO `jpemeric_comment`.`comment_meta` (`commenter`,`comment`,`reply`,`notify`,`comment_page`,`date`,`display`) VALUES ('%d','%d','%d','%d','%d','%s','%d')";
130 137
 		
131 138
 		$reply = Database::escape(Request::getPost('type'));
132
-		if($reply == 'new')
133
-			$reply = 0;
139
+		if($reply == 'new') {
140
+					$reply = 0;
141
+		}
134 142
 		// else check to make sure value is legit
135 143
 		
136 144
 		$notify = (Request::getPost('notify') == 'check') ? 1 : 0;
@@ -142,8 +150,7 @@  discard block
 block discarded – undo
142 150
 		return Database::lastInsertID();
143 151
 	}
144 152
 
145
-	private function send_notifications($page)
146
-	{
153
+	private function send_notifications($page) {
147 154
 		$email_recipient_array = array();
148 155
 		
149 156
 		$commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website'));
@@ -154,8 +161,9 @@  discard block
 block discarded – undo
154 161
 			
155 162
 			foreach($notification_result as $notification_row)
156 163
 			{
157
-				if($notification_row->email == Request::getPost('email'))
158
-					continue;
164
+				if($notification_row->email == Request::getPost('email')) {
165
+									continue;
166
+				}
159 167
 				
160 168
 				$email_recipient_array[$notification_row->email] = array(
161 169
 					'email' => $notification_row->email,
@@ -186,8 +194,7 @@  discard block
 block discarded – undo
186 194
 		}
187 195
 	}
188 196
 
189
-	private function redirect_to_comment($comment_id)
190
-	{
197
+	private function redirect_to_comment($comment_id) {
191 198
 		$url = '';
192 199
 		$url .= $this->full_path;
193 200
 		$url .= "#comment-{$comment_id}";
@@ -196,8 +203,7 @@  discard block
 block discarded – undo
196 203
 		exit;
197 204
 	}
198 205
 
199
-    private function save_to_comment_service(array $data)
200
-    {
206
+    private function save_to_comment_service(array $data) {
201 207
         $path = $_SERVER['REQUEST_URI'];
202 208
         $path = explode('/', $path);
203 209
         $path = array_filter($path);
Please login to merge, or discard this patch.
collector/image/PhotoCollector.class.inc.php 1 patch
Braces   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
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) {
10 9
 		$query = "
11 10
 			SELECT
12 11
 				`photo`.`name`,
@@ -27,8 +26,7 @@  discard block
 block discarded – undo
27 26
 		return self::run_row_query($query);
28 27
 	}
29 28
 
30
-	public static function getRow($id)
31
-	{
29
+	public static function getRow($id) {
32 30
 		$query = "
33 31
 			SELECT
34 32
 				`photo`.`name`,
Please login to merge, or discard this patch.
collector/image/AlbumCollector.class.inc.php 1 patch
Braces   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@
 block discarded – undo
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) {
10 9
 		$query = "
11 10
 			SELECT
12 11
 				`photo`.`name`,
Please login to merge, or discard this patch.