Completed
Push — master ( 702a44...77d52d )
by mains
02:36
created
index.php 1 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
 		{
@@ -113,7 +118,11 @@  discard block
 block discarded – undo
113 118
 		  			<a href="index.php">
114 119
 						<h1>
115 120
 							JodelBlue
116
-							<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?>
121
+							<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
122
+{
123
+	echo '<i class="fa fa-refresh fa-1x"></i>';
124
+}
125
+?>
117 126
 						</h1>					
118 127
 					</a>
119 128
 				</div>
@@ -131,7 +140,8 @@  discard block
 block discarded – undo
131 140
 							//Set View
132 141
 							if(isset($_GET['view']))
133 142
 							{
134
-								switch ($_GET['view']) {
143
+								switch ($_GET['view'])
144
+								{
135 145
 									case 'comment':
136 146
 										$view = 'comment';
137 147
 										break;
@@ -151,7 +161,8 @@  discard block
 block discarded – undo
151 161
 							}
152 162
 
153 163
 							//Get Post Details
154
-							if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) {
164
+							if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
165
+							{
155 166
 								//Header Nav in Comment View
156 167
 								?>
157 168
 								<a id="comment-back" href="index.php?view=<?php echo $view;?>#postId-<?php echo htmlspecialchars($_GET['postID']);?>">
@@ -169,13 +180,17 @@  discard block
 block discarded – undo
169 180
 								$data = $accountCreator->execute();
170 181
 								
171 182
 								$posts[0] = $data;
172
-								if(isset($data['children'])) {
173
-									foreach($data['children'] as $child) {
183
+								if(isset($data['children']))
184
+								{
185
+									foreach($data['children'] as $child)
186
+									{
174 187
 										array_push($posts, $child);
175 188
 									}
176 189
 									$loops = $data['child_count'] + 1;
177 190
 								}
178
-								else $loops = 1;
191
+								else {
192
+									$loops = 1;
193
+								}
179 194
 								$showCommentIcon = FALSE;
180 195
 							}
181 196
 							//Get Posts
@@ -203,9 +218,11 @@  discard block
 block discarded – undo
203 218
 							}
204 219
 							
205 220
 
206
-							for($i = 0; $i<$loops; $i++) {
221
+							for($i = 0; $i<$loops; $i++)
222
+							{
207 223
 							
208
-							if(isset($posts[$i])) {
224
+							if(isset($posts[$i]))
225
+							{
209 226
 							$lastPostId = $posts[$i]['post_id'];
210 227
 
211 228
 							
@@ -221,7 +238,8 @@  discard block
 block discarded – undo
221 238
 							$timediff_inHours = (string)$timediff->format('%h');
222 239
 							$timediff_inDays = (string)$timediff->format('%d');
223 240
 							$timediff_inMonth = (string)$timediff->format('%m');
224
-							if($timediff_inMonth!=0) {
241
+							if($timediff_inMonth!=0)
242
+							{
225 243
 									$timediff = $timediff_inMonth . "m";
226 244
 							}
227 245
 							else
@@ -254,10 +272,12 @@  discard block
 block discarded – undo
254 272
 						<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
255 273
 							<content>
256 274
 								<?php 
257
-								if(isset($posts[$i]["image_url"])) {
275
+								if(isset($posts[$i]["image_url"]))
276
+								{
258 277
 									echo '<img src="' . $posts[$i]["image_url"] . '">';
259 278
 								}
260
-								else {
279
+								else
280
+								{
261 281
 									echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($posts[$i]["message"])));
262 282
 								}
263 283
 								?>
@@ -283,13 +303,19 @@  discard block
 block discarded – undo
283 303
 											</span> 
284 304
 										</td>
285 305
 										<td class="comments">
286
-											<?php if($showCommentIcon) {?>
306
+											<?php if($showCommentIcon)
307
+{
308
+?>
287 309
 											<span data-tooltip="Comments">
288 310
 												<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>">
289 311
 													<i class="fa fa-commenting-o"></i>
290
-													<?php if(array_key_exists("child_count", $posts[$i])) {
312
+													<?php if(array_key_exists("child_count", $posts[$i]))
313
+{
291 314
 																echo $posts[$i]["child_count"];
292
-															} else echo "0";
315
+															}
316
+															else {
317
+																echo "0";
318
+															}
293 319
 													?>
294 320
 													</a>
295 321
 											</span>
@@ -313,7 +339,9 @@  discard block
 block discarded – undo
313 339
 
314 340
 					</content>
315 341
 					
316
-					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
342
+					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
343
+{
344
+?>
317 345
 						<p id="loading">
318 346
 							Loading…
319 347
 						</p>
@@ -326,7 +354,14 @@  discard block
 block discarded – undo
326 354
 							<div>
327 355
 								<h2>Position</h2>
328 356
 								<form method="get">
329
-									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo htmlspecialchars($posts[0]["location"]["name"]); ?>" required>
357
+									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
358
+{
359
+	echo $newPositionStatus;
360
+}
361
+else {
362
+	echo htmlspecialchars($posts[0]["location"]["name"]);
363
+}
364
+?>" required>
330 365
 
331 366
 									<input type="submit" value="Set Location" /> 
332 367
 								</form>
@@ -342,7 +377,9 @@  discard block
 block discarded – undo
342 377
 
343 378
 						<article>
344 379
 							<div>
345
-								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
380
+								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
381
+{
382
+?>
346 383
 								<h2>Comment on Jodel</h2>
347 384
 								<form method="POST">				
348 385
 										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
@@ -350,7 +387,10 @@  discard block
 block discarded – undo
350 387
 									<br />
351 388
 									<input type="submit" value="SEND" /> 
352 389
 								</form>
353
-									<?php } else { ?>
390
+									<?php }
391
+else
392
+{
393
+?>
354 394
 								<h2>New Jodel</h2>
355 395
 								<form method="POST">
356 396
 									<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -373,13 +413,25 @@  discard block
 block discarded – undo
373 413
 				<div class="col-sm-12">
374 414
 					<div class="row">
375 415
 						<div class="col-sm-3">
376
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
416
+							<a href="index.php" <?php if($view=='time')
417
+{
418
+	echo 'class="active"';
419
+}
420
+?>><i class="fa fa-clock-o fa-3x"></i></a>
377 421
 						</div>
378 422
 						<div class="col-sm-3">
379
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
423
+							<a href="index.php?view=comment" <?php if($view=='comment')
424
+{
425
+	echo 'class="active"';
426
+}
427
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
380 428
 						</div>
381 429
 						<div class="col-sm-3">
382
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
430
+							<a href="index.php?view=upVote" <?php if($view=='upVote')
431
+{
432
+	echo 'class="active"';
433
+}
434
+?>><i class="fa fa-angle-up fa-3x"></i></a>
383 435
 						</div>
384 436
 						<div class="col-sm-3">
385 437
 							<nav>
@@ -403,7 +455,9 @@  discard block
 block discarded – undo
403 455
 			    $(this).addClass('selected');
404 456
 			});
405 457
 
406
-			<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
458
+			<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
459
+{
460
+?>
407 461
 			$(document).ready(function() {
408 462
 				var win = $(window);
409 463
 				var lastPostId = "<?php echo $lastPostId; ?>";
Please login to merge, or discard this patch.