Completed
Push — master ( 285880...d65ec1 )
by mains
02:43
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
 		{
@@ -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.