Completed
Push — master ( 285880...d65ec1 )
by mains
02:43
created
index.php 3 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	$accessToken;
15 15
 	$newPositionStatus;
16 16
 	
17
-	if ($result->num_rows > 0)
17
+	if($result->num_rows > 0)
18 18
 	{
19 19
 		// output data of each row
20 20
 		while($row = $result->fetch_assoc())
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 				<a href="index.php">
115 115
 					<h1>
116 116
 						JodelBlue
117
-						<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?>
117
+						<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>'; ?>
118 118
 					</h1>					
119 119
 				</a>
120 120
 				<div class="clear"></div>
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 							if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) {
132 132
 								//Header Nav in Comment View
133 133
 								?>
134
-								<a id="comment-back" href="index.php#postId-<?php echo htmlspecialchars($_GET['postID']);?>">
134
+								<a id="comment-back" href="index.php#postId-<?php echo htmlspecialchars($_GET['postID']); ?>">
135 135
 									<i class="fa fa-angle-left fa-3x"></i>
136 136
 								</a>
137 137
 
138
-								<a id="comment-refresh" href="index.php?getPostDetails=<?php echo htmlspecialchars($_GET['getPostDetails']);?>&postID=<?php echo htmlspecialchars($_GET['postID']);?>">
138
+								<a id="comment-refresh" href="index.php?getPostDetails=<?php echo htmlspecialchars($_GET['getPostDetails']); ?>&postID=<?php echo htmlspecialchars($_GET['postID']); ?>">
139 139
 									<i class="fa fa-refresh fa-2x"></i>
140 140
 								</a>
141 141
 								<?php
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 							}
183 183
 							
184 184
 
185
-							for($i = 0; $i<$loops; $i++) {
185
+							for($i = 0; $i < $loops; $i++) {
186 186
 							
187 187
 							if(isset($posts[$i])) {
188 188
 							$lastPostId = $posts[$i]['post_id'];
@@ -200,24 +200,24 @@  discard block
 block discarded – undo
200 200
 							$timediff_inHours = (string)$timediff->format('%h');
201 201
 							$timediff_inDays = (string)$timediff->format('%d');
202 202
 							$timediff_inMonth = (string)$timediff->format('%m');
203
-							if($timediff_inMonth!=0) {
203
+							if($timediff_inMonth != 0) {
204 204
 									$timediff = $timediff_inMonth . "m";
205 205
 							}
206 206
 							else
207 207
 							{
208
-								if($timediff_inDays!=0)
208
+								if($timediff_inDays != 0)
209 209
 								{
210 210
 									$timediff = $timediff_inDays . "d";
211 211
 								}
212 212
 								else
213 213
 								{
214
-									if($timediff_inHours!=0)
214
+									if($timediff_inHours != 0)
215 215
 									{
216 216
 										$timediff = $timediff_inHours . "h";
217 217
 									}
218 218
 									else
219 219
 									{
220
-										if($timediff_inMinutes!=0)
220
+										if($timediff_inMinutes != 0)
221 221
 										{
222 222
 											$timediff = $timediff_inMinutes . "m";
223 223
 										}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 							}
231 231
 						?>
232 232
 						
233
-						<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
233
+						<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;">
234 234
 							<content>
235 235
 								<?php 
236 236
 								if(isset($posts[$i]["image_url"])) {
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 								?>
243 243
 							</content>
244 244
 							<aside>
245
-								<a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>">
245
+								<a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>">
246 246
 									<i class="fa fa-angle-up fa-3x"></i>
247 247
 								</a>	
248 248
 									<br />
249
-								<?php echo $posts[$i]["vote_count"];?><br />
250
-								<a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>">
249
+								<?php echo $posts[$i]["vote_count"]; ?><br />
250
+								<a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>">
251 251
 									<i class="fa fa-angle-down fa-3x"></i>
252 252
 								</a>
253 253
 							</aside>
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 										<td class="time">
259 259
 											<span data-tooltip="Time">
260 260
 												<i class="fa fa-clock-o"></i>
261
-												<?php echo $timediff;?>
261
+												<?php echo $timediff; ?>
262 262
 											</span> 
263 263
 										</td>
264 264
 										<td class="comments">
265 265
 											<?php if($showCommentIcon) {?>
266 266
 											<span data-tooltip="Comments">
267
-												<a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>">
267
+												<a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"]; ?>">
268 268
 													<i class="fa fa-commenting-o"></i>
269 269
 													<?php if(array_key_exists("child_count", $posts[$i])) {
270 270
 																echo $posts[$i]["child_count"];
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 										<td class="distance">
278 278
 											<span data-tooltip="Distance">
279 279
 												<i class="fa fa-map-marker"></i>
280
-												<?php echo $posts[$i]["distance"];?> km
280
+												<?php echo $posts[$i]["distance"]; ?> km
281 281
 											</span>
282 282
 										</td>
283 283
 									</tr>
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 						<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
320 320
 						<h2>Comment on Jodel</h2>
321 321
 						<form method="POST">				
322
-								<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
322
+								<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" />
323 323
 								<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> 
324 324
 							<br />
325 325
 							<input type="submit" value="SEND" /> 
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
 				<div class="col-sm-12">
345 345
 					<div class="row">
346 346
 						<div class="col-sm-3">
347
-							<a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
347
+							<a href="index.php" <?php if(isset($timeView)) echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a>
348 348
 						</div>
349 349
 						<div class="col-sm-3">
350
-							<a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
350
+							<a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a>
351 351
 						</div>
352 352
 						<div class="col-sm-3">
353
-							<a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
353
+							<a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a>
354 354
 						</div>
355 355
 						<div class="col-sm-3">
356 356
 							<nav>
Please login to merge, or discard this patch.
Braces   +81 added lines, -27 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
 	//createAccount();
32 32
 	
33 33
 	//Set Location
34
-	if(isset($_GET['city'])) {
34
+	if(isset($_GET['city']))
35
+	{
35 36
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
36 37
 		$result = Requests::post($url);
37 38
 		if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST')
@@ -52,11 +53,14 @@  discard block
 block discarded – undo
52 53
 	}
53 54
 	
54 55
 	//Vote
55
-	if(isset($_GET['vote']) && isset($_GET['postID'])) {
56
-		if($_GET['vote'] == "up") {
56
+	if(isset($_GET['vote']) && isset($_GET['postID']))
57
+	{
58
+		if($_GET['vote'] == "up")
59
+		{
57 60
 			$accountCreator = new Upvote();
58 61
 		}
59
-		else if($_GET['vote'] == "down") {
62
+		else if($_GET['vote'] == "down")
63
+		{
60 64
 			$accountCreator = new Downvote();
61 65
 		}
62 66
 		$accountCreator->setAccessToken($accessToken);
@@ -68,7 +72,8 @@  discard block
 block discarded – undo
68 72
 	
69 73
 	
70 74
 	//SendJodel
71
-	if(isset($_POST['message'])) {
75
+	if(isset($_POST['message']))
76
+	{
72 77
 		$ancestor;
73 78
 		if(isset($_POST['ancestor']))
74 79
 		{
@@ -114,7 +119,11 @@  discard block
 block discarded – undo
114 119
 				<a href="index.php">
115 120
 					<h1>
116 121
 						JodelBlue
117
-						<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?>
122
+						<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
123
+{
124
+	echo '<i class="fa fa-refresh fa-1x"></i>';
125
+}
126
+?>
118 127
 					</h1>					
119 128
 				</a>
120 129
 				<div class="clear"></div>
@@ -128,7 +137,8 @@  discard block
 block discarded – undo
128 137
 							$posts;
129 138
 
130 139
 							//Get Post Details
131
-							if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) {
140
+							if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
141
+							{
132 142
 								//Header Nav in Comment View
133 143
 								?>
134 144
 								<a id="comment-back" href="index.php#postId-<?php echo htmlspecialchars($_GET['postID']);?>">
@@ -146,17 +156,22 @@  discard block
 block discarded – undo
146 156
 								$data = $accountCreator->execute();
147 157
 								
148 158
 								$posts[0] = $data;
149
-								if(isset($data['children'])) {
150
-									foreach($data['children'] as $child) {
159
+								if(isset($data['children']))
160
+								{
161
+									foreach($data['children'] as $child)
162
+									{
151 163
 										array_push($posts, $child);
152 164
 									}
153 165
 									$loops = $data['child_count'] + 1;
154 166
 								}
155
-								else $loops = 1;
167
+								else {
168
+									$loops = 1;
169
+								}
156 170
 								$showCommentIcon = FALSE;
157 171
 							}
158 172
 							//Get Posts
159
-							else {
173
+							else
174
+							{
160 175
 								if(isset($_GET['commentView']))
161 176
 								{
162 177
 									$commentView = true;
@@ -182,9 +197,11 @@  discard block
 block discarded – undo
182 197
 							}
183 198
 							
184 199
 
185
-							for($i = 0; $i<$loops; $i++) {
200
+							for($i = 0; $i<$loops; $i++)
201
+							{
186 202
 							
187
-							if(isset($posts[$i])) {
203
+							if(isset($posts[$i]))
204
+							{
188 205
 							$lastPostId = $posts[$i]['post_id'];
189 206
 
190 207
 							
@@ -200,7 +217,8 @@  discard block
 block discarded – undo
200 217
 							$timediff_inHours = (string)$timediff->format('%h');
201 218
 							$timediff_inDays = (string)$timediff->format('%d');
202 219
 							$timediff_inMonth = (string)$timediff->format('%m');
203
-							if($timediff_inMonth!=0) {
220
+							if($timediff_inMonth!=0)
221
+							{
204 222
 									$timediff = $timediff_inMonth . "m";
205 223
 							}
206 224
 							else
@@ -233,10 +251,12 @@  discard block
 block discarded – undo
233 251
 						<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
234 252
 							<content>
235 253
 								<?php 
236
-								if(isset($posts[$i]["image_url"])) {
254
+								if(isset($posts[$i]["image_url"]))
255
+								{
237 256
 									echo '<img src="' . $posts[$i]["image_url"] . '">';
238 257
 								}
239
-								else {
258
+								else
259
+								{
240 260
 									echo nl2br(htmlspecialchars($posts[$i]["message"]));
241 261
 								}
242 262
 								?>
@@ -262,13 +282,19 @@  discard block
 block discarded – undo
262 282
 											</span> 
263 283
 										</td>
264 284
 										<td class="comments">
265
-											<?php if($showCommentIcon) {?>
285
+											<?php if($showCommentIcon)
286
+{
287
+?>
266 288
 											<span data-tooltip="Comments">
267 289
 												<a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>">
268 290
 													<i class="fa fa-commenting-o"></i>
269
-													<?php if(array_key_exists("child_count", $posts[$i])) {
291
+													<?php if(array_key_exists("child_count", $posts[$i]))
292
+{
270 293
 																echo $posts[$i]["child_count"];
271
-															} else echo "0";
294
+															}
295
+															else {
296
+																echo "0";
297
+															}
272 298
 													?>
273 299
 													</a>
274 300
 											</span>
@@ -292,7 +318,9 @@  discard block
 block discarded – undo
292 318
 
293 319
 					</content>
294 320
 					
295
-					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
321
+					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
322
+{
323
+?>
296 324
 						<p id="loading">
297 325
 							Loading…
298 326
 						</p>
@@ -303,7 +331,14 @@  discard block
 block discarded – undo
303 331
 					<article>
304 332
 						<h2>Position</h2>
305 333
 						<form method="get">
306
-							<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo htmlspecialchars($posts[0]["location"]["name"]); ?>" required>
334
+							<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
335
+{
336
+	echo $newPositionStatus;
337
+}
338
+else {
339
+	echo htmlspecialchars($posts[0]["location"]["name"]);
340
+}
341
+?>" required>
307 342
 
308 343
 							<input type="submit" value="Set Location" /> 
309 344
 						</form>
@@ -316,7 +351,9 @@  discard block
 block discarded – undo
316 351
 					</article>
317 352
 
318 353
 					<article>
319
-						<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
354
+						<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
355
+{
356
+?>
320 357
 						<h2>Comment on Jodel</h2>
321 358
 						<form method="POST">				
322 359
 								<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
@@ -324,7 +361,10 @@  discard block
 block discarded – undo
324 361
 							<br />
325 362
 							<input type="submit" value="SEND" /> 
326 363
 						</form>
327
-							<?php } else { ?>
364
+							<?php }
365
+else
366
+{
367
+?>
328 368
 						<h2>New Jodel</h2>
329 369
 						<form method="POST">
330 370
 							<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -344,13 +384,25 @@  discard block
 block discarded – undo
344 384
 				<div class="col-sm-12">
345 385
 					<div class="row">
346 386
 						<div class="col-sm-3">
347
-							<a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
387
+							<a href="index.php" <?php if(isset($timeView))
388
+{
389
+	echo 'class="active"';
390
+}
391
+?>><i class="fa fa-clock-o fa-3x"></i></a>
348 392
 						</div>
349 393
 						<div class="col-sm-3">
350
-							<a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
394
+							<a href="index.php?commentView=true" <?php if(isset($commentView))
395
+{
396
+	echo 'class="active"';
397
+}
398
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
351 399
 						</div>
352 400
 						<div class="col-sm-3">
353
-							<a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
401
+							<a href="index.php?upVoteView=true" <?php if(isset($upVoteView))
402
+{
403
+	echo 'class="active"';
404
+}
405
+?>><i class="fa fa-angle-up fa-3x"></i></a>
354 406
 						</div>
355 407
 						<div class="col-sm-3">
356 408
 							<nav>
@@ -374,7 +426,9 @@  discard block
 block discarded – undo
374 426
 			    $(this).addClass('selected');
375 427
 			});
376 428
 
377
-			<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
429
+			<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
430
+{
431
+?>
378 432
 			$(document).ready(function() {
379 433
 				var win = $(window);
380 434
 				var lastPostId = "<?php echo $lastPostId; ?>";
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 	if(isset($_GET['city'])) {
35 35
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
36 36
 		$result = Requests::post($url);
37
-		if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST')
37
+		if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST')
38 38
 		{
39 39
 			$newPositionStatus = "0 results";
40 40
 		}
41 41
 		else
42 42
 		{
43 43
 			$location = new Location();
44
-			$location->setLat(json_decode($result->body, true)['results']['0']['geometry']['location']['lat']);
45
-			$location->setLng(json_decode($result->body, true)['results']['0']['geometry']['location']['lng']);
44
+			$location->setLat(json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat']);
45
+			$location->setLng(json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng']);
46 46
 			$location->setCityName(htmlspecialchars($_GET['city']));
47 47
 			$accountCreator = new UpdateLocation();
48 48
 			$accountCreator->setLocation($location);
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
 							else {
160 160
 								if(isset($_GET['commentView']))
161 161
 								{
162
-									$commentView = true;
162
+									$commentView = TRUE;
163 163
 									$url = "/v2/posts/location/discussed/";
164 164
 								}
165 165
 								else
166 166
 								{
167 167
 									if(isset($_GET['upVoteView']))
168 168
 									{
169
-										$upVoteView = true;
169
+										$upVoteView = TRUE;
170 170
 										$url = "/v2/posts/location/popular/";
171 171
 									}
172 172
 									else
173 173
 									{
174
-										$timeView = true;
174
+										$timeView = TRUE;
175 175
 										$url = "/v2/posts";
176 176
 									}
177 177
 								}
Please login to merge, or discard this patch.
php/Requests/SetLocation.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -3,37 +3,37 @@
 block discarded – undo
3 3
 
4 4
 class UpdateLocation extends AbstractRequest {
5 5
 		 /**
6
-     * @var Location
7
-     */
8
-    public $location;
9
-    /**
10
-     * @return Location
11
-     */
12
-    public function getLocation()
13
-    {
14
-        return $this->location;
15
-    }
16
-    /**
17
-     * @param Location $location
18
-     */
19
-    public function setLocation($location)
20
-    {
21
-        $this->location = $location;
22
-    }
6
+		  * @var Location
7
+		  */
8
+	public $location;
9
+	/**
10
+	 * @return Location
11
+	 */
12
+	public function getLocation()
13
+	{
14
+		return $this->location;
15
+	}
16
+	/**
17
+	 * @param Location $location
18
+	 */
19
+	public function setLocation($location)
20
+	{
21
+		$this->location = $location;
22
+	}
23 23
 		
24
-    function getApiEndPoint()
25
-    {
26
-        return '/v2/users/location';
27
-    }
28
-    function getPayload()
29
-    {
30
-        return array(
24
+	function getApiEndPoint()
25
+	{
26
+		return '/v2/users/location';
27
+	}
28
+	function getPayload()
29
+	{
30
+		return array(
31 31
 					"location" => $this->getLocation()->toArray(),
32
-        );
33
-    }
34
-    function getMethod()
35
-    {
36
-        return 'PUT';
37
-    }
32
+		);
33
+	}
34
+	function getMethod()
35
+	{
36
+		return 'PUT';
37
+	}
38 38
 }
39 39
 
Please login to merge, or discard this patch.