Completed
Push — master ( 602f8a...43b654 )
by mains
02:59
created
php/Requests/Upvote.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 class Upvote extends AbstractRequest {
3 3
 		
4
-    public $postId;
4
+	public $postId;
5 5
 
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/posts/' . $this->postId . '/upvote';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/posts/' . $this->postId . '/upvote';
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13 13
 					"reason_code" => -1,
14
-        );
15
-    }
16
-    function getMethod()
17
-    {
18
-        return 'PUT';
19
-    }
14
+		);
15
+	}
16
+	function getMethod()
17
+	{
18
+		return 'PUT';
19
+	}
20 20
 }
21 21
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-class Upvote extends AbstractRequest {
2
+class Upvote extends AbstractRequest
3
+{
3 4
 		
4 5
     public $postId;
5 6
 
Please login to merge, or discard this patch.
admin.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 $config = parse_ini_file('config/config.ini.php');
4 4
 if(!isset($_GET['pw']) || $config['pw'] != $_GET['pw'])
5 5
 {
6
-	error_log($_SERVER['REMOTE_ADDR']  . ' used a wrong password on admin.php');
6
+	error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on admin.php');
7 7
 	die();
8 8
 }
9 9
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,10 +40,12 @@
 block discarded – undo
40 40
 			$accessToken = isTokenFreshByAccessToken($location, $accessToken);
41 41
 
42 42
 
43
-			if($_POST['vote'] == "up") {
43
+			if($_POST['vote'] == "up")
44
+			{
44 45
 				$accountCreator = new Upvote();
45 46
 			}
46
-			else if($_POST['vote'] == "down") {
47
+			else if($_POST['vote'] == "down")
48
+			{
47 49
 				$accountCreator = new Downvote();
48 50
 			}
49 51
 
Please login to merge, or discard this patch.
php/jodel-web.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -309,7 +309,7 @@
 block discarded – undo
309 309
 {
310 310
 	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
311 311
 
312
-    return (isset($matches[0])) ? true : false;
312
+	return (isset($matches[0])) ? true : false;
313 313
 }
314 314
 
315 315
 function botDeviceUidIsSet($config)
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 									expiration_date='" . $expiration_date . "'
58 58
 								WHERE device_uid='" . $device_uid . "'");
59 59
 
60
-		if($result === false){
60
+		if($result === FALSE){
61 61
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
62 62
 		}	
63 63
 	}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 									expiration_date='" . $expiration_date . "'
103 103
 								WHERE device_uid='" . $device_uid . "'");
104 104
 
105
-		if($result === false){
105
+		if($result === FALSE){
106 106
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
107 107
 		}	
108 108
 	}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 									expiration_date='" . $expiration_date . "'
150 150
 								WHERE device_uid='" . $device_uid . "'");
151 151
 
152
-		if($result === false){
152
+		if($result === FALSE){
153 153
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
154 154
 		}	
155 155
 	}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
266 266
 
267 267
 	$success = TRUE;
268
-	if($result === false){
268
+	if($result === FALSE){
269 269
 			$error = db_error();
270 270
 			echo $error;
271 271
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 {
310 310
 	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
311 311
 
312
-    return (isset($matches[0])) ? true : false;
312
+    return (isset($matches[0])) ? TRUE : FALSE;
313 313
 }
314 314
 
315 315
 function botDeviceUidIsSet($config)
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	
26 26
 	$access_token;
27 27
 
28
-	if ($result->num_rows > 0)
28
+	if($result->num_rows > 0)
29 29
 	{
30 30
 			// output data of each row
31 31
 			while($row = $result->fetch_assoc()) {
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 	if($expiration_date <= time()) {
44 44
 		$accountCreator = new CreateUser();
45
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
45
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
46 46
 		$accountCreator->setDeviceUid($deviceUid);
47 47
 		$accountCreator->setLocation($location);
48 48
 		$data = $accountCreator->execute();
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 									expiration_date='" . $expiration_date . "'
58 58
 								WHERE device_uid='" . $device_uid . "'");
59 59
 
60
-		if($result === false){
60
+		if($result === false) {
61 61
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
62 62
 		}	
63 63
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	$db = new DatabaseConnect();  
71 71
 	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'");
72 72
 	
73
-	if ($result->num_rows > 0)
73
+	if($result->num_rows > 0)
74 74
 	{
75 75
 			// output data of each row
76 76
 			while($row = $result->fetch_assoc()) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 	if($expiration_date <= time()) {
89 89
 		$accountCreator = new CreateUser();
90
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
90
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
91 91
 		$accountCreator->setDeviceUid($deviceUid);
92 92
 		$accountCreator->setLocation($location);
93 93
 		$data = $accountCreator->execute();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 									expiration_date='" . $expiration_date . "'
103 103
 								WHERE device_uid='" . $device_uid . "'");
104 104
 
105
-		if($result === false){
105
+		if($result === false) {
106 106
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
107 107
 		}	
108 108
 	}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	$access_token;
119 119
 
120
-	if ($result->num_rows > 0)
120
+	if($result->num_rows > 0)
121 121
 	{
122 122
 			// output data of each row
123 123
 			while($row = $result->fetch_assoc()) {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 									expiration_date='" . $expiration_date . "'
150 150
 								WHERE device_uid='" . $device_uid . "'");
151 151
 
152
-		if($result === false){
152
+		if($result === false) {
153 153
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
154 154
 		}	
155 155
 	}
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 function getLocationByAccessToken($accessToken)
161 161
 {
162 162
 	$db = new DatabaseConnect();
163
-	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken  . "'");
163
+	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'");
164 164
 	
165 165
 	$location = new Location();
166 166
 	
167
-	if ($result->num_rows > 0)
167
+	if($result->num_rows > 0)
168 168
 	{
169 169
 		// output data of each row
170 170
 		while($row = $result->fetch_assoc())
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 function getLocationByDeviceUid($deviceUid)
186 186
 {
187 187
 	$db = new DatabaseConnect();
188
-	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
188
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
189 189
 	
190 190
 	$location = new Location();
191 191
 	
192
-	if ($result->num_rows > 0)
192
+	if($result->num_rows > 0)
193 193
 	{
194 194
 		// output data of each row
195 195
 		while($row = $result->fetch_assoc())
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 function getAccessTokenByDeviceUid($deviceUid)
211 211
 {
212 212
 	$db = new DatabaseConnect();
213
-	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
213
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
214 214
 	
215 215
 	$accessToken;
216 216
 	
217
-	if ($result->num_rows > 0)
217
+	if($result->num_rows > 0)
218 218
 	{
219 219
 		// output data of each row
220 220
 		while($row = $result->fetch_assoc())
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 	$result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type,
262 262
 					expires_in, expiration_date, distinct_id, device_uid, name, lat, lng)
263 263
 					VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type .
264
-					"','" .  $expires_in . "','" . $expiration_date . "','" . $distinct_id .
264
+					"','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id .
265 265
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
266 266
 
267 267
 	$success = TRUE;
268
-	if($result === false){
268
+	if($result === false) {
269 269
 			$error = db_error();
270 270
 			echo $error;
271 271
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 {
310 310
 	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
311 311
 
312
-    return (isset($matches[0])) ? true : false;
312
+    return (isset($matches[0]))?true : false;
313 313
 }
314 314
 
315 315
 function botDeviceUidIsSet($config)
@@ -340,25 +340,25 @@  discard block
 block discarded – undo
340 340
 	$timediff_inDays = (string)$timediff->format('%d');
341 341
 	$timediff_inMonth = (string)$timediff->format('%m');
342 342
 
343
-	if($timediff_inMonth!=0)
343
+	if($timediff_inMonth != 0)
344 344
 	{
345 345
 			$timediff = $timediff_inMonth . "m";
346 346
 	}
347 347
 	else
348 348
 	{
349
-		if($timediff_inDays!=0)
349
+		if($timediff_inDays != 0)
350 350
 		{
351 351
 			$timediff = $timediff_inDays . "d";
352 352
 		}
353 353
 		else
354 354
 		{
355
-			if($timediff_inHours!=0)
355
+			if($timediff_inHours != 0)
356 356
 			{
357 357
 				$timediff = $timediff_inHours . "h";
358 358
 			}
359 359
 			else
360 360
 			{
361
-				if($timediff_inMinutes!=0)
361
+				if($timediff_inMinutes != 0)
362 362
 				{
363 363
 					$timediff = $timediff_inMinutes . "m";
364 364
 				}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
 
374 374
 	?>
375
-	<article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;">
375
+	<article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"]; ?>;">
376 376
 		<content>
377 377
 			<?php 
378 378
 			if(isset($post["image_url"])) {
@@ -387,24 +387,24 @@  discard block
 block discarded – undo
387 387
 			<?php
388 388
 				if($isDetailedView)
389 389
 				{?>
390
-					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>">
390
+					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id']; ?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']); ?>">
391 391
 		  <?php }
392 392
 				else
393 393
 				{?>
394
-					<a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>">
394
+					<a href="index.php?vote=up&postID=<?php echo $post['post_id']; ?>">
395 395
 		  <?php } ?>
396 396
 						<i class="fa fa-angle-up fa-3x"></i>
397 397
 					</a>	
398 398
 						<br />
399
-					<?php echo $post["vote_count"];?><br />
399
+					<?php echo $post["vote_count"]; ?><br />
400 400
 			<?php
401 401
 				if($isDetailedView)
402 402
 				{?>
403
-					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>">
403
+					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id']; ?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']); ?>">
404 404
 		  <?php }
405 405
 				else
406 406
 				{?>
407
-					<a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>">
407
+					<a href="index.php?vote=down&postID=<?php echo $post['post_id']; ?>">
408 408
 		  <?php } ?>
409 409
 						<i class="fa fa-angle-down fa-3x"></i>
410 410
 					</a>
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 					<td class="time">
417 417
 						<span class="tip" data-tooltip="Time">
418 418
 							<i class="fa fa-clock-o"></i>
419
-							<?php echo $timediff;?>
420
-							<span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span>
419
+							<?php echo $timediff; ?>
420
+							<span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span>
421 421
 						</span> 
422 422
 					</td>
423 423
 					<td class="comments">
424 424
 						<?php if(!$isDetailedView) {?>
425 425
 						<span data-tooltip="Comments">
426
-							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
426
+							<a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>">
427 427
 								<i class="fa fa-commenting-o"></i>
428 428
 								<?php if(array_key_exists("child_count", $post)) {
429 429
 											echo $post["child_count"];
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 									{
453 453
 							  			?>
454 454
 							  			<span data-tooltip="Author">
455
-											<i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> |
455
+											<i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> |
456 456
 										</span>
457 457
 										<?php
458 458
 									}
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 
463 463
 						<span class="tip" data-tooltip="Distance">
464 464
 							<i class="fa fa-map-marker"></i>
465
-							<?php echo $post['distance'];?> km
466
-							<span class="tiptext"><?php echo $post['location']['name'];?></span>
465
+							<?php echo $post['distance']; ?> km
466
+							<span class="tiptext"><?php echo $post['location']['name']; ?></span>
467 467
 						</span>
468 468
 					</td>
469 469
 				</tr>
Please login to merge, or discard this patch.
Braces   +48 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@  discard block
 block discarded – undo
28 28
 	if ($result->num_rows > 0)
29 29
 	{
30 30
 			// output data of each row
31
-			while($row = $result->fetch_assoc()) {
31
+			while($row = $result->fetch_assoc())
32
+			{
32 33
 					//$access_token = $row["access_token"];
33 34
 					$expiration_date = $row["expiration_date"];
34 35
 					$deviceUid = $row["device_uid"];
@@ -40,7 +41,8 @@  discard block
 block discarded – undo
40 41
 			echo '0 results';
41 42
 	}
42 43
 
43
-	if($expiration_date <= time()) {
44
+	if($expiration_date <= time())
45
+	{
44 46
 		$accountCreator = new CreateUser();
45 47
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
46 48
 		$accountCreator->setDeviceUid($deviceUid);
@@ -57,7 +59,8 @@  discard block
 block discarded – undo
57 59
 									expiration_date='" . $expiration_date . "'
58 60
 								WHERE device_uid='" . $device_uid . "'");
59 61
 
60
-		if($result === false){
62
+		if($result === false)
63
+		{
61 64
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
62 65
 		}	
63 66
 	}
@@ -73,7 +76,8 @@  discard block
 block discarded – undo
73 76
 	if ($result->num_rows > 0)
74 77
 	{
75 78
 			// output data of each row
76
-			while($row = $result->fetch_assoc()) {
79
+			while($row = $result->fetch_assoc())
80
+			{
77 81
 					//$access_token = $row["access_token"];
78 82
 					$expiration_date = $row["expiration_date"];
79 83
 					$deviceUid = $row["device_uid"];
@@ -85,7 +89,8 @@  discard block
 block discarded – undo
85 89
 			echo '0 results';
86 90
 	}
87 91
 
88
-	if($expiration_date <= time()) {
92
+	if($expiration_date <= time())
93
+	{
89 94
 		$accountCreator = new CreateUser();
90 95
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
91 96
 		$accountCreator->setDeviceUid($deviceUid);
@@ -102,7 +107,8 @@  discard block
 block discarded – undo
102 107
 									expiration_date='" . $expiration_date . "'
103 108
 								WHERE device_uid='" . $device_uid . "'");
104 109
 
105
-		if($result === false){
110
+		if($result === false)
111
+		{
106 112
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
107 113
 		}	
108 114
 	}
@@ -120,7 +126,8 @@  discard block
 block discarded – undo
120 126
 	if ($result->num_rows > 0)
121 127
 	{
122 128
 			// output data of each row
123
-			while($row = $result->fetch_assoc()) {
129
+			while($row = $result->fetch_assoc())
130
+			{
124 131
 					//$access_token = $row["access_token"];
125 132
 					$expiration_date = $row["expiration_date"];
126 133
 					$deviceUid = $row["device_uid"];
@@ -132,7 +139,8 @@  discard block
 block discarded – undo
132 139
 			echo '0 results';
133 140
 	}
134 141
 
135
-	if($expiration_date <= time()) {
142
+	if($expiration_date <= time())
143
+	{
136 144
 		$accountCreator = new CreateUser();
137 145
 		$accountCreator->setAccessToken($access_token);
138 146
 		$accountCreator->setDeviceUid($deviceUid);
@@ -149,7 +157,8 @@  discard block
 block discarded – undo
149 157
 									expiration_date='" . $expiration_date . "'
150 158
 								WHERE device_uid='" . $device_uid . "'");
151 159
 
152
-		if($result === false){
160
+		if($result === false)
161
+		{
153 162
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
154 163
 		}	
155 164
 	}
@@ -240,7 +249,8 @@  discard block
 block discarded – undo
240 249
 	return $data["karma"];
241 250
 }
242 251
 
243
-function registerAccount(Location $location) {
252
+function registerAccount(Location $location)
253
+{
244 254
 	$accountCreator = new CreateUser();
245 255
 	$accountCreator->setLocation($location);
246 256
 	$data = $accountCreator->execute();
@@ -265,7 +275,8 @@  discard block
 block discarded – undo
265 275
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
266 276
 
267 277
 	$success = TRUE;
268
-	if($result === false){
278
+	if($result === false)
279
+	{
269 280
 			$error = db_error();
270 281
 			echo $error;
271 282
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -276,7 +287,7 @@  discard block
 block discarded – undo
276 287
 }
277 288
 
278 289
 function getPosts($lastPostId, $accessToken, $url, $version = 'v2')
279
-{	
290
+{
280 291
 	$accountCreator = new GetPosts();
281 292
 	$accountCreator->setLastPostId($lastPostId);
282 293
 	$accountCreator->setAccessToken($accessToken);
@@ -325,7 +336,8 @@  discard block
 block discarded – undo
325 336
 }
326 337
 
327 338
 function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE)
328
-{	//ToDO
339
+{
340
+//ToDO
329 341
 	//Replace # with link
330 342
 	//preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
331 343
 
@@ -375,10 +387,12 @@  discard block
 block discarded – undo
375 387
 	<article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;">
376 388
 		<content>
377 389
 			<?php 
378
-			if(isset($post["image_url"])) {
390
+			if(isset($post["image_url"]))
391
+			{
379 392
 				echo '<img src="' . $post["image_url"] . '">';
380 393
 			}
381
-			else {
394
+			else
395
+			{
382 396
 				echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post["message"])));
383 397
 			}
384 398
 			?>
@@ -386,11 +400,13 @@  discard block
 block discarded – undo
386 400
 		<aside>
387 401
 			<?php
388 402
 				if($isDetailedView)
389
-				{?>
403
+				{
404
+?>
390 405
 					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>">
391 406
 		  <?php }
392
-				else
393
-				{?>
407
+else
408
+				{
409
+?>
394 410
 					<a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>">
395 411
 		  <?php } ?>
396 412
 						<i class="fa fa-angle-up fa-3x"></i>
@@ -399,11 +415,13 @@  discard block
 block discarded – undo
399 415
 					<?php echo $post["vote_count"];?><br />
400 416
 			<?php
401 417
 				if($isDetailedView)
402
-				{?>
418
+				{
419
+?>
403 420
 					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>">
404 421
 		  <?php }
405
-				else
406
-				{?>
422
+else
423
+				{
424
+?>
407 425
 					<a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>">
408 426
 		  <?php } ?>
409 427
 						<i class="fa fa-angle-down fa-3x"></i>
@@ -421,13 +439,19 @@  discard block
 block discarded – undo
421 439
 						</span> 
422 440
 					</td>
423 441
 					<td class="comments">
424
-						<?php if(!$isDetailedView) {?>
442
+						<?php if(!$isDetailedView)
443
+{
444
+?>
425 445
 						<span data-tooltip="Comments">
426 446
 							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
427 447
 								<i class="fa fa-commenting-o"></i>
428
-								<?php if(array_key_exists("child_count", $post)) {
448
+								<?php if(array_key_exists("child_count", $post))
449
+{
429 450
 											echo $post["child_count"];
430
-										} else echo "0";
451
+										}
452
+										else {
453
+											echo "0";
454
+										}
431 455
 								?>
432 456
 								</a>
433 457
 						</span>
Please login to merge, or discard this patch.
php/Requests/AbstractRequest.php 4 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $header = $this->getSignHeaders();
29 29
         $url = $this->getFullUrl();
30 30
 
31
-        if ($this->getAccessToken()) {
31
+        if($this->getAccessToken()) {
32 32
             $header['Authorization'] = "Bearer " . $this->getAccessToken();
33 33
         }
34 34
         //Comment out to debug the Request:
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             'proxy' => '186.103.169.165:8080',
46 46
         );*/
47 47
 
48
-        switch ($this->getMethod()) {
48
+        switch($this->getMethod()) {
49 49
             case 'POST':
50 50
                 $result = Requests::post($url, $header, $this->payLoad);
51 51
                 break;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                 $result = Requests::put($url, $header, $this->payLoad);
64 64
                 break;
65 65
         }
66
-        switch ($result->status_code) {
66
+        switch($result->status_code) {
67 67
             case 200:
68 68
                 $result = json_decode($result->body, true);
69 69
                 break;
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
                 exit("Error 403: Access denied");
92 92
                 break;
93 93
             default:
94
-                error_log('Error '.$result->status_code.' - Unauthorized - JodelDeviceId:' . $deviceUid);
95
-                throw  new \Exception('Unknown Error: '.$result->status_code);
94
+                error_log('Error ' . $result->status_code . ' - Unauthorized - JodelDeviceId:' . $deviceUid);
95
+                throw  new \Exception('Unknown Error: ' . $result->status_code);
96 96
         }
97 97
 
98 98
         if($device_uid != "")
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@  discard block
 block discarded – undo
2 2
 
3 3
 abstract class AbstractRequest
4 4
 {	
5
-    const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
-    const APIURL = 'https://api.go-tellm.com/api';
7
-    const SECRET = 'plerFToqEdWlzShdZlTywaCHRuzlKIMsNmOJVDGE';
8
-    const USERAGENT = 'Jodel/4.31.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
-    const CLIENT_TYPE = 'android_4.31.1';
5
+	const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
+	const APIURL = 'https://api.go-tellm.com/api';
7
+	const SECRET = 'plerFToqEdWlzShdZlTywaCHRuzlKIMsNmOJVDGE';
8
+	const USERAGENT = 'Jodel/4.31.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
+	const CLIENT_TYPE = 'android_4.31.1';
10 10
     
11
-    private $accessToken = null;
12
-    private $payLoad;
13
-    public $expects = '';
14
-    public $version = 'v2';
11
+	private $accessToken = null;
12
+	private $payLoad;
13
+	public $expects = '';
14
+	public $version = 'v2';
15 15
 
16
-    public function execute()
17
-    {
16
+	public function execute()
17
+	{
18 18
 		$result = new \stdClass();
19 19
 		        
20 20
 		$this->payLoad = $this->getPayload();
@@ -24,96 +24,96 @@  discard block
 block discarded – undo
24 24
 		}
25 25
 				
26 26
 				
27
-        $this->payLoad = json_encode($this->payLoad);
28
-        $header = $this->getSignHeaders();
29
-        $url = $this->getFullUrl();
27
+		$this->payLoad = json_encode($this->payLoad);
28
+		$header = $this->getSignHeaders();
29
+		$url = $this->getFullUrl();
30 30
 
31
-        if ($this->getAccessToken()) {
32
-            $header['Authorization'] = "Bearer " . $this->getAccessToken();
33
-        }
34
-        //Comment out to debug the Request:
31
+		if ($this->getAccessToken()) {
32
+			$header['Authorization'] = "Bearer " . $this->getAccessToken();
33
+		}
34
+		//Comment out to debug the Request:
35 35
         
36
-        /*
36
+		/*
37 37
         var_dump($url);
38 38
         var_dump($header);
39 39
         var_dump($this->payLoad);
40 40
         */
41
-        /*
41
+		/*
42 42
         $options = array(
43 43
             'timeout' => 100,
44 44
             'connect_timeout' => 100,
45 45
             'proxy' => '186.103.169.165:8080',
46 46
         );*/
47 47
 
48
-        switch ($this->getMethod()) {
49
-            case 'POST':
50
-                $result = Requests::post($url, $header, $this->payLoad);
51
-                break;
52
-            case 'GET':
53
-                if($this->version == 'v3')
54
-                {
55
-                    $result = Requests::get($url, $header);
56
-                }
57
-                else
58
-                {
59
-                    $result = Requests::get($url, $header);
60
-                }
61
-                break;
62
-            case 'PUT':
63
-                $result = Requests::put($url, $header, $this->payLoad);
64
-                break;
65
-        }
66
-        switch ($result->status_code) {
67
-            case 200:
68
-                $result = json_decode($result->body, true);
69
-                break;
70
-            case 204:
71
-                $result = "Success";
72
-                break;
73
-            case 401:
48
+		switch ($this->getMethod()) {
49
+			case 'POST':
50
+				$result = Requests::post($url, $header, $this->payLoad);
51
+				break;
52
+			case 'GET':
53
+				if($this->version == 'v3')
54
+				{
55
+					$result = Requests::get($url, $header);
56
+				}
57
+				else
58
+				{
59
+					$result = Requests::get($url, $header);
60
+				}
61
+				break;
62
+			case 'PUT':
63
+				$result = Requests::put($url, $header, $this->payLoad);
64
+				break;
65
+		}
66
+		switch ($result->status_code) {
67
+			case 200:
68
+				$result = json_decode($result->body, true);
69
+				break;
70
+			case 204:
71
+				$result = "Success";
72
+				break;
73
+			case 401:
74 74
 				//throw new \Exception('Unauthorized');
75
-                error_log('Error 401 - Unauthorized - JodelDeviceId:' . $deviceUid);
76
-                break;
77
-            case 404:
78
-                //echo "Es wurde bereits gevoted";
79
-                error_log('Error 404 - Es wurde bereits gevoted - JodelDeviceId:' . $deviceUid);
75
+				error_log('Error 401 - Unauthorized - JodelDeviceId:' . $deviceUid);
76
+				break;
77
+			case 404:
78
+				//echo "Es wurde bereits gevoted";
79
+				error_log('Error 404 - Es wurde bereits gevoted - JodelDeviceId:' . $deviceUid);
80 80
 			case 477:
81
-                //echo "Es wurde bereits gevoted";
82
-                //throw  new \Exception('Signing failed!');
83
-                error_log('Error 477 - Signing failed - JodelDeviceId:' . $deviceUid);
84
-                break;
85
-            case 429:
86
-                error_log('Error 429 - Too Many Requests - JodelDeviceId:' . $deviceUid);
87
-            	exit("Error 429: Too Many Requests");
88
-            	break;
89
-            case 403:
90
-                error_log('Error 403 - Access denied - JodelDeviceId:' . $deviceUid);
91
-                exit("Error 403: Access denied");
92
-                break;
93
-            default:
94
-                error_log('Error '.$result->status_code.' - Unauthorized - JodelDeviceId:' . $deviceUid);
95
-                throw  new \Exception('Unknown Error: '.$result->status_code);
96
-        }
81
+				//echo "Es wurde bereits gevoted";
82
+				//throw  new \Exception('Signing failed!');
83
+				error_log('Error 477 - Signing failed - JodelDeviceId:' . $deviceUid);
84
+				break;
85
+			case 429:
86
+				error_log('Error 429 - Too Many Requests - JodelDeviceId:' . $deviceUid);
87
+				exit("Error 429: Too Many Requests");
88
+				break;
89
+			case 403:
90
+				error_log('Error 403 - Access denied - JodelDeviceId:' . $deviceUid);
91
+				exit("Error 403: Access denied");
92
+				break;
93
+			default:
94
+				error_log('Error '.$result->status_code.' - Unauthorized - JodelDeviceId:' . $deviceUid);
95
+				throw  new \Exception('Unknown Error: '.$result->status_code);
96
+		}
97 97
 
98
-        if($device_uid != "")
99
-        {
98
+		if($device_uid != "")
99
+		{
100 100
 			$result[0] = $result;
101 101
 			$result[1] = $device_uid;
102 102
 		}
103 103
 
104 104
         
105
-        /*var_dump($result);*/
105
+		/*var_dump($result);*/
106 106
         
107 107
 
108
-        return $result;
109
-    }
110
-    abstract function getPayload();
111
-    /**
112
-     * Gets Sign headers
113
-     * @return array headers
114
-     */
115
-    private function getSignHeaders()
116
-    {
108
+		return $result;
109
+	}
110
+	abstract function getPayload();
111
+	/**
112
+	 * Gets Sign headers
113
+	 * @return array headers
114
+	 */
115
+	private function getSignHeaders()
116
+	{
117 117
 			if($this->getAccessToken() == null) {
118 118
 				$payload_accessToken = "";
119 119
 			}
@@ -122,54 +122,54 @@  discard block
 block discarded – undo
122 122
 			}
123 123
 			
124 124
 			
125
-        $headers = array(
126
-            "Connection" => "keep-alive",
127
-            "Accept-Encoding" => "gzip",
128
-            "Content-Type" => "application/json; charset=UTF-8",
129
-            "User-Agent" => self::USERAGENT
130
-        );
131
-        $timestamp = new DateTime();
132
-        $timestamp = $timestamp->format(DateTime::ATOM);
133
-        $timestamp = substr($timestamp, 0, -6);
134
-        $timestamp .= "Z";
135
-        $urlParts = parse_url($this->getFullUrl());
136
-        $url2 = "";
137
-        $req = [$this->getMethod(),
138
-            $urlParts['host'],
139
-            "443",
140
-            $urlParts['path'],
141
-            $payload_accessToken,
142
-            $timestamp,
143
-            $url2,
144
-            $this->payLoad];
145
-        $reqString = implode("%", $req);
146
-        $secret = self::SECRET;
147
-        $signature = hash_hmac('sha1', $reqString, $secret);
148
-        $signature = strtoupper($signature);
149
-        $headers['X-Authorization'] = 'HMAC ' . $signature;
150
-        $headers['X-Client-Type'] = self::CLIENT_TYPE;
151
-        $headers['X-Timestamp'] = $timestamp;
152
-        $headers['X-Api-Version'] = '0.2';
153
-        return $headers;
154
-    }
155
-    private function getFullUrl()
156
-    {
157
-        return self::APIURL . $this->getApiEndPoint();
158
-    }
159
-    abstract function getApiEndPoint();
160
-    abstract function getMethod();
161
-    /**
162
-     * @return string
163
-     */
164
-    private function getAccessToken()
165
-    {
166
-        return $this->accessToken;
167
-    }
168
-    /**
169
-     * @param string $accessToken
170
-     */
171
-    public function setAccessToken($accessToken)
172
-    {
173
-        $this->accessToken = $accessToken;
174
-    }
125
+		$headers = array(
126
+			"Connection" => "keep-alive",
127
+			"Accept-Encoding" => "gzip",
128
+			"Content-Type" => "application/json; charset=UTF-8",
129
+			"User-Agent" => self::USERAGENT
130
+		);
131
+		$timestamp = new DateTime();
132
+		$timestamp = $timestamp->format(DateTime::ATOM);
133
+		$timestamp = substr($timestamp, 0, -6);
134
+		$timestamp .= "Z";
135
+		$urlParts = parse_url($this->getFullUrl());
136
+		$url2 = "";
137
+		$req = [$this->getMethod(),
138
+			$urlParts['host'],
139
+			"443",
140
+			$urlParts['path'],
141
+			$payload_accessToken,
142
+			$timestamp,
143
+			$url2,
144
+			$this->payLoad];
145
+		$reqString = implode("%", $req);
146
+		$secret = self::SECRET;
147
+		$signature = hash_hmac('sha1', $reqString, $secret);
148
+		$signature = strtoupper($signature);
149
+		$headers['X-Authorization'] = 'HMAC ' . $signature;
150
+		$headers['X-Client-Type'] = self::CLIENT_TYPE;
151
+		$headers['X-Timestamp'] = $timestamp;
152
+		$headers['X-Api-Version'] = '0.2';
153
+		return $headers;
154
+	}
155
+	private function getFullUrl()
156
+	{
157
+		return self::APIURL . $this->getApiEndPoint();
158
+	}
159
+	abstract function getApiEndPoint();
160
+	abstract function getMethod();
161
+	/**
162
+	 * @return string
163
+	 */
164
+	private function getAccessToken()
165
+	{
166
+		return $this->accessToken;
167
+	}
168
+	/**
169
+	 * @param string $accessToken
170
+	 */
171
+	public function setAccessToken($accessToken)
172
+	{
173
+		$this->accessToken = $accessToken;
174
+	}
175 175
 }
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 abstract class AbstractRequest
4
-{	
4
+{
5 5
     const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6 6
     const APIURL = 'https://api.go-tellm.com/api';
7 7
     const SECRET = 'plerFToqEdWlzShdZlTywaCHRuzlKIMsNmOJVDGE';
@@ -19,7 +19,8 @@  discard block
 block discarded – undo
19 19
 		        
20 20
 		$this->payLoad = $this->getPayload();
21 21
 		$device_uid = '';
22
-		if(isset($this->payLoad['device_uid'])) {
22
+		if(isset($this->payLoad['device_uid']))
23
+		{
23 24
 			$device_uid = $this->payLoad['device_uid'];
24 25
 		}
25 26
 				
@@ -28,7 +29,8 @@  discard block
 block discarded – undo
28 29
         $header = $this->getSignHeaders();
29 30
         $url = $this->getFullUrl();
30 31
 
31
-        if ($this->getAccessToken()) {
32
+        if ($this->getAccessToken())
33
+        {
32 34
             $header['Authorization'] = "Bearer " . $this->getAccessToken();
33 35
         }
34 36
         //Comment out to debug the Request:
@@ -45,7 +47,8 @@  discard block
 block discarded – undo
45 47
             'proxy' => '186.103.169.165:8080',
46 48
         );*/
47 49
 
48
-        switch ($this->getMethod()) {
50
+        switch ($this->getMethod())
51
+        {
49 52
             case 'POST':
50 53
                 $result = Requests::post($url, $header, $this->payLoad);
51 54
                 break;
@@ -63,7 +66,8 @@  discard block
 block discarded – undo
63 66
                 $result = Requests::put($url, $header, $this->payLoad);
64 67
                 break;
65 68
         }
66
-        switch ($result->status_code) {
69
+        switch ($result->status_code)
70
+        {
67 71
             case 200:
68 72
                 $result = json_decode($result->body, true);
69 73
                 break;
@@ -114,10 +118,12 @@  discard block
 block discarded – undo
114 118
      */
115 119
     private function getSignHeaders()
116 120
     {
117
-			if($this->getAccessToken() == null) {
121
+			if($this->getAccessToken() == null)
122
+			{
118 123
 				$payload_accessToken = "";
119 124
 			}
120
-			else {
125
+			else
126
+			{
121 127
 				$payload_accessToken = $this->getAccessToken();
122 128
 			}
123 129
 			
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
     const USERAGENT = 'Jodel/4.31.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9 9
     const CLIENT_TYPE = 'android_4.31.1';
10 10
     
11
-    private $accessToken = null;
11
+    private $accessToken = NULL;
12 12
     private $payLoad;
13 13
     public $expects = '';
14 14
     public $version = 'v2';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         }
66 66
         switch ($result->status_code) {
67 67
             case 200:
68
-                $result = json_decode($result->body, true);
68
+                $result = json_decode($result->body, TRUE);
69 69
                 break;
70 70
             case 204:
71 71
                 $result = "Success";
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     private function getSignHeaders()
116 116
     {
117
-			if($this->getAccessToken() == null) {
117
+			if($this->getAccessToken() == NULL) {
118 118
 				$payload_accessToken = "";
119 119
 			}
120 120
 			else {
Please login to merge, or discard this patch.
index.php 3 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		if(!isset($_COOKIE['JodelDeviceId']))
37 37
 		{
38 38
 			$deviceUid = createAccount();
39
-			setcookie('JodelDeviceId', $deviceUid, time()+60*60*24*365*10);
40
-			error_log('Created account with JodelDeviceId:' . $deviceUid .  ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
39
+			setcookie('JodelDeviceId', $deviceUid, time() + 60 * 60 * 24 * 365 * 10);
40
+			error_log('Created account with JodelDeviceId:' . $deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
41 41
 			
42 42
 		}
43 43
 		else
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	//Set View
58 58
 	if(isset($_GET['view']))
59 59
 	{
60
-		switch ($_GET['view']) {
60
+		switch($_GET['view']) {
61 61
 			case 'comment':
62 62
 				$view = 'comment';
63 63
 				break;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 				else
116 116
 				{
117 117
 					$newPositionStatus = $name;
118
-					error_log('User with JodelDeviceId:' . $deviceUid .  ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name);
118
+					error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name);
119 119
 				}
120 120
 			}
121 121
 		}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		if(isset($_POST['color']))
159 159
 		{
160 160
 			$color = $_POST['color'];
161
-			switch ($color) {
161
+			switch($color) {
162 162
 				case '8ABDB0':
163 163
 					$color = '8ABDB0';
164 164
 					break;
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
 							else
345 345
 							{
346 346
 								$version = 'v2';
347
-								if($view=='comment')
347
+								if($view == 'comment')
348 348
 								{
349 349
 									$url = "/v2/posts/location/discussed/";
350 350
 								}
351 351
 								else
352 352
 								{
353
-									if($view=='upVote')
353
+									if($view == 'upVote')
354 354
 									{
355 355
 										$url = "/v2/posts/location/popular/";
356 356
 									}
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 							}
375 375
 							
376 376
 
377
-							for($i = 0; $i<$loops; $i++)
377
+							for($i = 0; $i < $loops; $i++)
378 378
 							{
379 379
 								if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id']))
380 380
 								{
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
419 419
 								<h2>Comment on Jodel</h2>
420 420
 								<form method="POST">				
421
-										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
421
+										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" />
422 422
 										<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> 
423 423
 									<br />
424 424
 									<input type="submit" value="SEND" /> 
@@ -455,13 +455,13 @@  discard block
 block discarded – undo
455 455
 				<div class="col-xs-12">
456 456
 					<div class="row">
457 457
 						<div class="col-xs-3">
458
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
458
+							<a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a>
459 459
 						</div>
460 460
 						<div class="col-xs-3">
461
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
461
+							<a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a>
462 462
 						</div>
463 463
 						<div class="col-xs-3">
464
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
464
+							<a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a>
465 465
 						</div>
466 466
 						<div class="col-xs-3">
467 467
 							<nav>
Please login to merge, or discard this patch.
Braces   +52 added lines, -16 removed lines patch added patch discarded remove patch
@@ -57,7 +57,8 @@  discard block
 block discarded – undo
57 57
 	//Set View
58 58
 	if(isset($_GET['view']))
59 59
 	{
60
-		switch ($_GET['view']) {
60
+		switch ($_GET['view'])
61
+		{
61 62
 			case 'comment':
62 63
 				$view = 'comment';
63 64
 				break;
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
 	}
78 79
 	
79 80
 	//Set Location
80
-	if(isset($_GET['city'])) {
81
+	if(isset($_GET['city']))
82
+	{
81 83
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
82 84
 		$result = Requests::post($url);
83 85
 		if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST')
@@ -122,11 +124,14 @@  discard block
 block discarded – undo
122 124
 	}
123 125
 	
124 126
 	//Vote
125
-	if(isset($_GET['vote']) && isset($_GET['postID'])) {
126
-		if($_GET['vote'] == "up") {
127
+	if(isset($_GET['vote']) && isset($_GET['postID']))
128
+	{
129
+		if($_GET['vote'] == "up")
130
+		{
127 131
 			$accountCreator = new Upvote();
128 132
 		}
129
-		else if($_GET['vote'] == "down") {
133
+		else if($_GET['vote'] == "down")
134
+		{
130 135
 			$accountCreator = new Downvote();
131 136
 		}
132 137
 		$accountCreator->setAccessToken($accessToken_forId1);
@@ -158,7 +163,8 @@  discard block
 block discarded – undo
158 163
 		if(isset($_POST['color']))
159 164
 		{
160 165
 			$color = $_POST['color'];
161
-			switch ($color) {
166
+			switch ($color)
167
+			{
162 168
 				case '8ABDB0':
163 169
 					$color = '8ABDB0';
164 170
 					break;
@@ -285,7 +291,11 @@  discard block
 block discarded – undo
285 291
 
286 292
 					<div id="location_mobile" class="hidden-sm-up">
287 293
 						<form method="get">
288
-							<input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
294
+							<input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus))
295
+{
296
+	echo $newPositionStatus;
297
+}
298
+?>" required>
289 299
 
290 300
 							<input type="submit" id="submit_mobile" class="fa" value="&#xf0ac;" />
291 301
 						</form>
@@ -312,7 +322,8 @@  discard block
 block discarded – undo
312 322
 								$data = $accountCreator->execute();
313 323
 								
314 324
 								$posts[0] = $data;
315
-								if(array_key_exists('children', $data)) {
325
+								if(array_key_exists('children', $data))
326
+								{
316 327
 									foreach($data['children'] as $key => $child)
317 328
 									{
318 329
 										
@@ -386,7 +397,9 @@  discard block
 block discarded – undo
386 397
 
387 398
 					</content>
388 399
 					
389
-					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
400
+					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
401
+{
402
+?>
390 403
 						<p id="loading">
391 404
 							Loading…
392 405
 						</p>
@@ -399,7 +412,11 @@  discard block
 block discarded – undo
399 412
 							<div>
400 413
 								<h2>Position</h2>
401 414
 								<form method="get">
402
-									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
415
+									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
416
+{
417
+	echo $newPositionStatus;
418
+}
419
+?>" required>
403 420
 
404 421
 									<input type="submit" value="Set Location" /> 
405 422
 								</form>
@@ -415,7 +432,9 @@  discard block
 block discarded – undo
415 432
 
416 433
 						<article>
417 434
 							<div>
418
-								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
435
+								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
436
+{
437
+?>
419 438
 								<h2>Comment on Jodel</h2>
420 439
 								<form method="POST">				
421 440
 										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
@@ -423,7 +442,10 @@  discard block
 block discarded – undo
423 442
 									<br />
424 443
 									<input type="submit" value="SEND" /> 
425 444
 								</form>
426
-									<?php } else { ?>
445
+									<?php }
446
+else
447
+{
448
+?>
427 449
 								<h2>New Jodel</h2>
428 450
 								<form method="POST">
429 451
 									<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -455,13 +477,25 @@  discard block
 block discarded – undo
455 477
 				<div class="col-xs-12">
456 478
 					<div class="row">
457 479
 						<div class="col-xs-3">
458
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
480
+							<a href="index.php" <?php if($view=='time')
481
+{
482
+	echo 'class="active"';
483
+}
484
+?>><i class="fa fa-clock-o fa-3x"></i></a>
459 485
 						</div>
460 486
 						<div class="col-xs-3">
461
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
487
+							<a href="index.php?view=comment" <?php if($view=='comment')
488
+{
489
+	echo 'class="active"';
490
+}
491
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
462 492
 						</div>
463 493
 						<div class="col-xs-3">
464
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
494
+							<a href="index.php?view=upVote" <?php if($view=='upVote')
495
+{
496
+	echo 'class="active"';
497
+}
498
+?>><i class="fa fa-angle-up fa-3x"></i></a>
465 499
 						</div>
466 500
 						<div class="col-xs-3">
467 501
 							<nav>
@@ -504,7 +538,9 @@  discard block
 block discarded – undo
504 538
 				    $('html,body').animate({scrollTop: aTag.offset().top-90},'slow');
505 539
 				}
506 540
 
507
-				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
541
+				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
542
+{
543
+?>
508 544
 
509 545
 				
510 546
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	if(isset($_GET['city'])) {
81 81
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
82 82
 		$result = Requests::post($url);
83
-		if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST')
83
+		if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST')
84 84
 		{
85 85
 			$newPositionStatus = "0 results";
86 86
 		}
87 87
 		else
88 88
 		{
89
-			$name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name'];
90
-			$lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat'];
91
-			$lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng'];
89
+			$name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name'];
90
+			$lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat'];
91
+			$lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng'];
92 92
 
93 93
 			$location = new Location();
94 94
 			$location->setLat($lat);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 							lng='" . $lng . "'
109 109
 						WHERE access_token='" . $accessToken . "'");
110 110
 
111
-				if($result === false)
111
+				if($result === FALSE)
112 112
 				{
113 113
 						echo "Updating location failed: (" . $db->errno . ") " . $db->error;
114 114
 				}
Please login to merge, or discard this patch.