Completed
Push — master ( b88c26...7162ef )
by mains
02:47
created
php/Requests/AbstractRequest.php 1 patch
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@  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 = 'OFIqFvBgkccPNTVbIzkYaSmrwMlbVzRoOBBjXUIG';
8
-    const USERAGENT = 'Jodel/4.32.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
-    const CLIENT_TYPE = 'android_4.32.2';
5
+	const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
+	const APIURL = 'https://api.go-tellm.com/api';
7
+	const SECRET = 'OFIqFvBgkccPNTVbIzkYaSmrwMlbVzRoOBBjXUIG';
8
+	const USERAGENT = 'Jodel/4.32.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
+	const CLIENT_TYPE = 'android_4.32.2';
10 10
     
11
-    private $accessToken = null;
12
-    private $payLoad;
13
-    public $expects = '';
14
-    public $version = 'v2';
15
-    public $hasPayload = FALSE;
11
+	private $accessToken = null;
12
+	private $payLoad;
13
+	public $expects = '';
14
+	public $version = 'v2';
15
+	public $hasPayload = FALSE;
16 16
 
17
-    public function execute()
18
-    {
17
+	public function execute()
18
+	{
19 19
 		$result = new \stdClass();
20 20
 		        
21 21
 		$this->payLoad = $this->getPayload();
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
 		}
26 26
 				
27 27
 				
28
-        $this->payLoad = json_encode($this->payLoad);
29
-        $header = $this->getSignHeaders();
30
-        $url = $this->getFullUrl();
28
+		$this->payLoad = json_encode($this->payLoad);
29
+		$header = $this->getSignHeaders();
30
+		$url = $this->getFullUrl();
31 31
 
32
-        if ($this->getAccessToken()) {
33
-            $header['Authorization'] = "Bearer " . $this->getAccessToken();
34
-        }
35
-        //Comment out to debug the Request:
32
+		if ($this->getAccessToken()) {
33
+			$header['Authorization'] = "Bearer " . $this->getAccessToken();
34
+		}
35
+		//Comment out to debug the Request:
36 36
 
37
-        /*
37
+		/*
38 38
         printf("URL: ");
39 39
         var_dump($url);
40 40
         echo "<br />";
@@ -45,86 +45,86 @@  discard block
 block discarded – undo
45 45
         var_dump($this->payLoad);
46 46
         echo "<br />";
47 47
         */
48
-        /*
48
+		/*
49 49
         $options = array(
50 50
             'timeout' => 100,
51 51
             'connect_timeout' => 100,
52 52
             'proxy' => '186.103.169.165:8080',
53 53
         );*/
54 54
 
55
-        switch ($this->getMethod()) {
56
-            case 'POST':
57
-                $result = Requests::post($url, $header, $this->payLoad);
58
-                break;
59
-            case 'GET':
60
-                if($this->hasPayload)
61
-                {
62
-                    $result = Requests::get($url, $header, $this->payLoad);
63
-                }
64
-                else
65
-                {
66
-                    $result = Requests::get($url, $header);
67
-                }
68
-                break;
69
-            case 'PUT':
70
-                $result = Requests::put($url, $header, $this->payLoad);
71
-                break;
72
-        }
73
-        switch ($result->status_code) {
74
-            case 200:
75
-                $result = json_decode($result->body, true);
76
-                break;
77
-            case 204:
78
-                $result = "Success";
79
-                break;
80
-            case 400:
81
-                //throw new \Exception('Unauthorized');
82
-                error_log('Error 400 - Fehlerhafte Anfrage'); // - JodelDeviceId:' . $deviceUid);
83
-                break;
84
-            case 401:
55
+		switch ($this->getMethod()) {
56
+			case 'POST':
57
+				$result = Requests::post($url, $header, $this->payLoad);
58
+				break;
59
+			case 'GET':
60
+				if($this->hasPayload)
61
+				{
62
+					$result = Requests::get($url, $header, $this->payLoad);
63
+				}
64
+				else
65
+				{
66
+					$result = Requests::get($url, $header);
67
+				}
68
+				break;
69
+			case 'PUT':
70
+				$result = Requests::put($url, $header, $this->payLoad);
71
+				break;
72
+		}
73
+		switch ($result->status_code) {
74
+			case 200:
75
+				$result = json_decode($result->body, true);
76
+				break;
77
+			case 204:
78
+				$result = "Success";
79
+				break;
80
+			case 400:
81
+				//throw new \Exception('Unauthorized');
82
+				error_log('Error 400 - Fehlerhafte Anfrage'); // - JodelDeviceId:' . $deviceUid);
83
+				break;
84
+			case 401:
85 85
 				//throw new \Exception('Unauthorized');
86
-                error_log('Error 401 - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
87
-                break;
88
-            case 404:
89
-                //echo "Es wurde bereits gevoted";
90
-                error_log('Error 404 - Es wurde bereits gevoted'); // - JodelDeviceId:' . $deviceUid);
86
+				error_log('Error 401 - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
87
+				break;
88
+			case 404:
89
+				//echo "Es wurde bereits gevoted";
90
+				error_log('Error 404 - Es wurde bereits gevoted'); // - JodelDeviceId:' . $deviceUid);
91 91
 			case 477:
92
-                //echo "Es wurde bereits gevoted";
93
-                //throw  new \Exception('Signing failed!');
94
-                error_log('Error 477 - Signing failed'); // - JodelDeviceId:' . $deviceUid);
95
-                break;
96
-            case 429:
97
-                error_log('Error 429 - Too Many Requests'); // - JodelDeviceId:' . $deviceUid);
98
-            	exit("Error 429: Too Many Requests");
99
-            	break;
100
-            case 403:
101
-                error_log('Error 403 - Access denied'); // - JodelDeviceId:' . $deviceUid);
102
-                exit("Error 403: Access denied");
103
-                break;
104
-            default:
105
-                error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
106
-                //throw  new \Exception('Unknown Error: '.$result->status_code);
107
-        }
92
+				//echo "Es wurde bereits gevoted";
93
+				//throw  new \Exception('Signing failed!');
94
+				error_log('Error 477 - Signing failed'); // - JodelDeviceId:' . $deviceUid);
95
+				break;
96
+			case 429:
97
+				error_log('Error 429 - Too Many Requests'); // - JodelDeviceId:' . $deviceUid);
98
+				exit("Error 429: Too Many Requests");
99
+				break;
100
+			case 403:
101
+				error_log('Error 403 - Access denied'); // - JodelDeviceId:' . $deviceUid);
102
+				exit("Error 403: Access denied");
103
+				break;
104
+			default:
105
+				error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
106
+				//throw  new \Exception('Unknown Error: '.$result->status_code);
107
+		}
108 108
 
109
-        if($device_uid != '')
110
-        {
109
+		if($device_uid != '')
110
+		{
111 111
 			$result[0] = $result;
112 112
 			$result[1] = $device_uid;
113 113
 	}
114 114
 
115
-        /*
115
+		/*
116 116
         var_dump($result);
117 117
         */
118 118
 
119
-        return $result;
120
-    }
121
-    abstract function getPayload();
122
-    /**
123
-     * Gets Sign headers
124
-     * @return array headers
125
-     */
126
-    private function getSignHeaders()
127
-    {
119
+		return $result;
120
+	}
121
+	abstract function getPayload();
122
+	/**
123
+	 * Gets Sign headers
124
+	 * @return array headers
125
+	 */
126
+	private function getSignHeaders()
127
+	{
128 128
 			if($this->getAccessToken() == null) {
129 129
 				$payload_accessToken = "";
130 130
 			}
@@ -133,54 +133,54 @@  discard block
 block discarded – undo
133 133
 			}
134 134
 			
135 135
 			
136
-        $headers = array(
137
-            "Connection" => "keep-alive",
138
-            "Accept-Encoding" => "gzip",
139
-            "Content-Type" => "application/json; charset=UTF-8",
140
-            "User-Agent" => self::USERAGENT
141
-        );
142
-        $timestamp = new DateTime();
143
-        $timestamp = $timestamp->format(DateTime::ATOM);
144
-        $timestamp = substr($timestamp, 0, -6);
145
-        $timestamp .= "Z";
146
-        $urlParts = parse_url($this->getFullUrl());
147
-        $url2 = "";
148
-        $req = [$this->getMethod(),
149
-            $urlParts['host'],
150
-            "443",
151
-            $urlParts['path'],
152
-            $payload_accessToken,
153
-            $timestamp,
154
-            $url2,
155
-            $this->payLoad];
156
-        $reqString = implode("%", $req);
157
-        $secret = self::SECRET;
158
-        $signature = hash_hmac('sha1', $reqString, $secret);
159
-        $signature = strtoupper($signature);
160
-        $headers['X-Authorization'] = 'HMAC ' . $signature;
161
-        $headers['X-Client-Type'] = self::CLIENT_TYPE;
162
-        $headers['X-Timestamp'] = $timestamp;
163
-        $headers['X-Api-Version'] = '0.2';
164
-        return $headers;
165
-    }
166
-    private function getFullUrl()
167
-    {
168
-        return self::APIURL . $this->getApiEndPoint();
169
-    }
170
-    abstract function getApiEndPoint();
171
-    abstract function getMethod();
172
-    /**
173
-     * @return string
174
-     */
175
-    private function getAccessToken()
176
-    {
177
-        return $this->accessToken;
178
-    }
179
-    /**
180
-     * @param string $accessToken
181
-     */
182
-    public function setAccessToken($accessToken)
183
-    {
184
-        $this->accessToken = $accessToken;
185
-    }
136
+		$headers = array(
137
+			"Connection" => "keep-alive",
138
+			"Accept-Encoding" => "gzip",
139
+			"Content-Type" => "application/json; charset=UTF-8",
140
+			"User-Agent" => self::USERAGENT
141
+		);
142
+		$timestamp = new DateTime();
143
+		$timestamp = $timestamp->format(DateTime::ATOM);
144
+		$timestamp = substr($timestamp, 0, -6);
145
+		$timestamp .= "Z";
146
+		$urlParts = parse_url($this->getFullUrl());
147
+		$url2 = "";
148
+		$req = [$this->getMethod(),
149
+			$urlParts['host'],
150
+			"443",
151
+			$urlParts['path'],
152
+			$payload_accessToken,
153
+			$timestamp,
154
+			$url2,
155
+			$this->payLoad];
156
+		$reqString = implode("%", $req);
157
+		$secret = self::SECRET;
158
+		$signature = hash_hmac('sha1', $reqString, $secret);
159
+		$signature = strtoupper($signature);
160
+		$headers['X-Authorization'] = 'HMAC ' . $signature;
161
+		$headers['X-Client-Type'] = self::CLIENT_TYPE;
162
+		$headers['X-Timestamp'] = $timestamp;
163
+		$headers['X-Api-Version'] = '0.2';
164
+		return $headers;
165
+	}
166
+	private function getFullUrl()
167
+	{
168
+		return self::APIURL . $this->getApiEndPoint();
169
+	}
170
+	abstract function getApiEndPoint();
171
+	abstract function getMethod();
172
+	/**
173
+	 * @return string
174
+	 */
175
+	private function getAccessToken()
176
+	{
177
+		return $this->accessToken;
178
+	}
179
+	/**
180
+	 * @param string $accessToken
181
+	 */
182
+	public function setAccessToken($accessToken)
183
+	{
184
+		$this->accessToken = $accessToken;
185
+	}
186 186
 }
Please login to merge, or discard this patch.
php/Requests/GetChannel.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
 
3 3
 class GetChannel extends AbstractRequest
4 4
 {
5
-    /**
6
-     * @var Location
7
-     */
8
-    public $location;
9
-    public $channel;
10
-    public $hasPayload = FALSE;
5
+	/**
6
+	 * @var Location
7
+	 */
8
+	public $location;
9
+	public $channel;
10
+	public $hasPayload = FALSE;
11 11
 		
12
-    function getApiEndPoint()
13
-    {
14
-        $apiEndPoint = '/v3/posts/hashtag/combo?hashtag=' . $this->channel;
15
-        return $apiEndPoint;
16
-    }
17
-    function getPayload()
18
-    {
19
-        return array(
20
-        );
21
-    }
22
-    function getMethod()
23
-    {
24
-        return 'GET';
25
-    }
12
+	function getApiEndPoint()
13
+	{
14
+		$apiEndPoint = '/v3/posts/hashtag/combo?hashtag=' . $this->channel;
15
+		return $apiEndPoint;
16
+	}
17
+	function getPayload()
18
+	{
19
+		return array(
20
+		);
21
+	}
22
+	function getMethod()
23
+	{
24
+		return 'GET';
25
+	}
26 26
 }
Please login to merge, or discard this patch.
php/jodel-web.php 1 patch
Braces   +51 added lines, -26 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$channel = substr($_GET['city'], 1);
86 86
 
87 87
 		return htmlspecialchars($_GET['city']);
88
-	}                
88
+	}
89 89
 	else
90 90
 	{
91 91
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
@@ -189,7 +189,8 @@  discard block
 block discarded – undo
189 189
 	if(isset($_POST['color']))
190 190
 	{
191 191
 		$color = $_POST['color'];
192
-		switch ($color) {
192
+		switch ($color)
193
+		{
193 194
 			case '8ABDB0':
194 195
 				$color = '8ABDB0';
195 196
 				break;
@@ -263,7 +264,8 @@  discard block
 block discarded – undo
263 264
 	if ($result->num_rows > 0)
264 265
 	{
265 266
 			// output data of each row
266
-			while($row = $result->fetch_assoc()) {
267
+			while($row = $result->fetch_assoc())
268
+			{
267 269
 					//$access_token = $row["access_token"];
268 270
 					$expiration_date = $row["expiration_date"];
269 271
 					$deviceUid = $row["device_uid"];
@@ -275,7 +277,8 @@  discard block
 block discarded – undo
275 277
 			echo '0 results';
276 278
 	}
277 279
 
278
-	if($expiration_date <= time()) {
280
+	if($expiration_date <= time())
281
+	{
279 282
 		$accountCreator = new CreateUser();
280 283
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
281 284
 		$accountCreator->setDeviceUid($deviceUid);
@@ -292,7 +295,8 @@  discard block
 block discarded – undo
292 295
 									expiration_date='" . $expiration_date . "'
293 296
 								WHERE device_uid='" . $device_uid . "'");
294 297
 
295
-		if($result === false){
298
+		if($result === false)
299
+		{
296 300
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
297 301
 		}	
298 302
 	}
@@ -308,7 +312,8 @@  discard block
 block discarded – undo
308 312
 	if ($result->num_rows > 0)
309 313
 	{
310 314
 			// output data of each row
311
-			while($row = $result->fetch_assoc()) {
315
+			while($row = $result->fetch_assoc())
316
+			{
312 317
 					//$access_token = $row["access_token"];
313 318
 					$expiration_date = $row["expiration_date"];
314 319
 					$deviceUid = $row["device_uid"];
@@ -320,7 +325,8 @@  discard block
 block discarded – undo
320 325
 			echo '0 results';
321 326
 	}
322 327
 
323
-	if($expiration_date <= time()) {
328
+	if($expiration_date <= time())
329
+	{
324 330
 		$accountCreator = new CreateUser();
325 331
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
326 332
 		$accountCreator->setDeviceUid($deviceUid);
@@ -337,7 +343,8 @@  discard block
 block discarded – undo
337 343
 									expiration_date='" . $expiration_date . "'
338 344
 								WHERE device_uid='" . $device_uid . "'");
339 345
 
340
-		if($result === false){
346
+		if($result === false)
347
+		{
341 348
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
342 349
 		}	
343 350
 	}
@@ -355,7 +362,8 @@  discard block
 block discarded – undo
355 362
 	if ($result->num_rows > 0)
356 363
 	{
357 364
 			// output data of each row
358
-			while($row = $result->fetch_assoc()) {
365
+			while($row = $result->fetch_assoc())
366
+			{
359 367
 					//$access_token = $row["access_token"];
360 368
 					$expiration_date = $row["expiration_date"];
361 369
 					$deviceUid = $row["device_uid"];
@@ -367,7 +375,8 @@  discard block
 block discarded – undo
367 375
 			echo '0 results';
368 376
 	}
369 377
 
370
-	if($expiration_date <= time()) {
378
+	if($expiration_date <= time())
379
+	{
371 380
 		$accountCreator = new CreateUser();
372 381
 		$accountCreator->setAccessToken($access_token);
373 382
 		$accountCreator->setDeviceUid($deviceUid);
@@ -384,7 +393,8 @@  discard block
 block discarded – undo
384 393
 									expiration_date='" . $expiration_date . "'
385 394
 								WHERE device_uid='" . $device_uid . "'");
386 395
 
387
-		if($result === false){
396
+		if($result === false)
397
+		{
388 398
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
389 399
 		}	
390 400
 	}
@@ -540,14 +550,16 @@  discard block
 block discarded – undo
540 550
 	$result = $db->query("INSERT INTO votes (device_uid, postId, type)
541 551
 					VALUES ('" . $device_uid . "','" . $postId . "','" . $voteType . "')");
542 552
 	
543
-	if($result === false){
553
+	if($result === false)
554
+	{
544 555
 			$error = db_error();
545 556
 			echo $error;
546 557
 			echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
547 558
 	}		
548 559
 }
549 560
 
550
-function registerAccount(Location $location) {
561
+function registerAccount(Location $location)
562
+{
551 563
 	$accountCreator = new CreateUser();
552 564
 	$accountCreator->setLocation($location);
553 565
 	$data = $accountCreator->execute();
@@ -572,7 +584,8 @@  discard block
 block discarded – undo
572 584
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
573 585
 
574 586
 	$success = TRUE;
575
-	if($result === false){
587
+	if($result === false)
588
+	{
576 589
 			$error = db_error();
577 590
 			echo $error;
578 591
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -583,7 +596,7 @@  discard block
 block discarded – undo
583 596
 }
584 597
 
585 598
 function getPosts($lastPostId, $accessToken, $url, $version = 'v2')
586
-{	
599
+{
587 600
 	$accountCreator = new GetPosts();
588 601
 	$accountCreator->setLastPostId($lastPostId);
589 602
 	$accountCreator->setAccessToken($accessToken);
@@ -672,7 +685,8 @@  discard block
 block discarded – undo
672 685
 }
673 686
 
674 687
 function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE)
675
-{	//ToDO
688
+{
689
+//ToDO
676 690
 	//Replace # with link
677 691
 	//preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
678 692
 
@@ -728,7 +742,8 @@  discard block
 block discarded – undo
728 742
 
729 743
 				echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
730 744
 			}
731
-			else {
745
+			else
746
+			{
732 747
 				echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post['message'])));
733 748
 			}
734 749
 			?>
@@ -736,11 +751,13 @@  discard block
 block discarded – undo
736 751
 		<aside>
737 752
 			<?php
738 753
 				if($isDetailedView)
739
-				{?>
754
+				{
755
+?>
740 756
 					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
741 757
 		  <?php }
742
-				else
743
-				{?>
758
+else
759
+				{
760
+?>
744 761
 					<a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>" rel="nofollow">
745 762
 		  <?php } ?>
746 763
 						<i class="fa fa-angle-up fa-3x"></i>
@@ -749,11 +766,13 @@  discard block
 block discarded – undo
749 766
 					<?php echo $post["vote_count"];?><br />
750 767
 			<?php
751 768
 				if($isDetailedView)
752
-				{?>
769
+				{
770
+?>
753 771
 					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
754 772
 		  <?php }
755
-				else
756
-				{?>
773
+else
774
+				{
775
+?>
757 776
 					<a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>" rel="nofollow">
758 777
 		  <?php } ?>
759 778
 						<i class="fa fa-angle-down fa-3x"></i>
@@ -771,13 +790,19 @@  discard block
 block discarded – undo
771 790
 						</span> 
772 791
 					</td>
773 792
 					<td class="comments">
774
-						<?php if(!$isDetailedView) {?>
793
+						<?php if(!$isDetailedView)
794
+{
795
+?>
775 796
 						<span data-tooltip="Comments">
776 797
 							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
777 798
 								<i class="fa fa-commenting-o"></i>
778
-								<?php if(array_key_exists("child_count", $post)) {
799
+								<?php if(array_key_exists("child_count", $post))
800
+{
779 801
 											echo $post["child_count"];
780
-										} else echo "0";
802
+										}
803
+										else {
804
+											echo "0";
805
+										}
781 806
 								?>
782 807
 								</a>
783 808
 						</span>
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -133,32 +133,32 @@  discard block
 block discarded – undo
133 133
 			if(!array_key_exists(0, $posts))
134 134
 			{
135 135
 				$posts[0] = array(
136
-			    "post_id" => "0",
137
-			    "discovered_by" => 0,
138
-			    "message" => "Not found",
139
-			    "created_at" => "2017-02-11T16:44:50.385Z",
140
-			    "updated_at" => "2017-02-11T16:44:50.385Z",
141
-			    "pin_count" => 0,
142
-			    "color" => "FFBA00",
143
-			    "got_thanks" => FALSE,
144
-			    "post_own" => "friend",
145
-			    "discovered" => 0,
146
-			    "distance" => 9,
147
-			    "vote_count" => 0,
148
-			    "location" =>
149
-			    array("name" => "Berlin",
150
-			      "loc_coordinates" =>
151
-			      array(
152
-			        "lat" => 0,
153
-			        "lng" => 0
154
-			      ),
155
-			      "loc_accuracy" => 0,
156
-			      "country" => "",
157
-			      "city" => "",
158
-			    ),
159
-			    "tags" =>
160
-			    array(),
161
-			    "user_handle" => "0"
136
+				"post_id" => "0",
137
+				"discovered_by" => 0,
138
+				"message" => "Not found",
139
+				"created_at" => "2017-02-11T16:44:50.385Z",
140
+				"updated_at" => "2017-02-11T16:44:50.385Z",
141
+				"pin_count" => 0,
142
+				"color" => "FFBA00",
143
+				"got_thanks" => FALSE,
144
+				"post_own" => "friend",
145
+				"discovered" => 0,
146
+				"distance" => 9,
147
+				"vote_count" => 0,
148
+				"location" =>
149
+				array("name" => "Berlin",
150
+				  "loc_coordinates" =>
151
+				  array(
152
+					"lat" => 0,
153
+					"lng" => 0
154
+				  ),
155
+				  "loc_accuracy" => 0,
156
+				  "country" => "",
157
+				  "city" => "",
158
+				),
159
+				"tags" =>
160
+				array(),
161
+				"user_handle" => "0"
162 162
 			 );
163 163
 			}
164 164
 		}
@@ -167,32 +167,32 @@  discard block
 block discarded – undo
167 167
 			$posts = array();
168 168
 			$posts[0] = 
169 169
 			array(
170
-			    "post_id" => "0",
171
-			    "discovered_by" => 0,
172
-			    "message" => "Bad Request",
173
-			    "created_at" => "2017-02-11T16:44:50.385Z",
174
-			    "updated_at" => "2017-02-11T16:44:50.385Z",
175
-			    "pin_count" => 0,
176
-			    "color" => "FFBA00",
177
-			    "got_thanks" => FALSE,
178
-			    "post_own" => "friend",
179
-			    "discovered" => 0,
180
-			    "distance" => 9,
181
-			    "vote_count" => 0,
182
-			    "location" =>
183
-			    array("name" => "Berlin",
184
-			      "loc_coordinates" =>
185
-			      array(
186
-			        "lat" => 0,
187
-			        "lng" => 0
188
-			      ),
189
-			      "loc_accuracy" => 0,
190
-			      "country" => "",
191
-			      "city" => "",
192
-			    ),
193
-			    "tags" =>
194
-			    array(),
195
-			    "user_handle" => "0"
170
+				"post_id" => "0",
171
+				"discovered_by" => 0,
172
+				"message" => "Bad Request",
173
+				"created_at" => "2017-02-11T16:44:50.385Z",
174
+				"updated_at" => "2017-02-11T16:44:50.385Z",
175
+				"pin_count" => 0,
176
+				"color" => "FFBA00",
177
+				"got_thanks" => FALSE,
178
+				"post_own" => "friend",
179
+				"discovered" => 0,
180
+				"distance" => 9,
181
+				"vote_count" => 0,
182
+				"location" =>
183
+				array("name" => "Berlin",
184
+				  "loc_coordinates" =>
185
+				  array(
186
+					"lat" => 0,
187
+					"lng" => 0
188
+				  ),
189
+				  "loc_accuracy" => 0,
190
+				  "country" => "",
191
+				  "city" => "",
192
+				),
193
+				"tags" =>
194
+				array(),
195
+				"user_handle" => "0"
196 196
 			 );
197 197
 
198 198
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		<?php  
596 596
 			if(is_file('./piwik-script.html'))
597 597
 			{
598
-			    require_once('./piwik-script.html');
598
+				require_once('./piwik-script.html');
599 599
 			}
600 600
 		?>
601 601
 
Please login to merge, or discard this patch.
Braces   +42 added lines, -11 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;
@@ -212,7 +213,8 @@  discard block
 block discarded – undo
212 213
 			$data = $accountCreator->execute();
213 214
 			
214 215
 			$posts[0] = $data;
215
-			if(array_key_exists('children', $data)) {
216
+			if(array_key_exists('children', $data))
217
+			{
216 218
 				foreach($data['children'] as $key => $child)
217 219
 				{
218 220
 					
@@ -350,7 +352,11 @@  discard block
 block discarded – undo
350 352
 
351 353
 					<div id="location_mobile" class="hidden-sm-up">
352 354
 						<form method="get">
353
-							<input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
355
+							<input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus))
356
+{
357
+	echo $newPositionStatus;
358
+}
359
+?>" required>
354 360
 
355 361
 							<input type="submit" id="submit_mobile" class="fa" value="&#xf0ac;" />
356 362
 						</form>
@@ -377,7 +383,9 @@  discard block
 block discarded – undo
377 383
 
378 384
 					</content>
379 385
 					
380
-					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
386
+					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
387
+{
388
+?>
381 389
 						<p id="loading">
382 390
 							Loading…
383 391
 						</p>
@@ -390,7 +398,11 @@  discard block
 block discarded – undo
390 398
 							<div>
391 399
 								<h2>Position / Hashtag</h2>
392 400
 								<form method="get">
393
-									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
401
+									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
402
+{
403
+	echo $newPositionStatus;
404
+}
405
+?>" required>
394 406
 									<label>try: #jhj</label><br>
395 407
 									<input type="submit" value="Set Location" /> 
396 408
 								</form>
@@ -406,7 +418,9 @@  discard block
 block discarded – undo
406 418
 
407 419
 						<article>
408 420
 							<div>
409
-								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
421
+								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
422
+{
423
+?>
410 424
 								<h2>Comment on Jodel</h2>
411 425
 								<form method="POST">				
412 426
 										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
@@ -414,7 +428,10 @@  discard block
 block discarded – undo
414 428
 									<br />
415 429
 									<input type="submit" value="SEND" /> 
416 430
 								</form>
417
-									<?php } else { ?>
431
+									<?php }
432
+else
433
+{
434
+?>
418 435
 								<h2>New Jodel</h2>
419 436
 								<form method="POST">
420 437
 									<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -446,13 +463,25 @@  discard block
 block discarded – undo
446 463
 				<div class="col-xs-12">
447 464
 					<div class="row">
448 465
 						<div class="col-xs-3">
449
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
466
+							<a href="index.php" <?php if($view=='time')
467
+{
468
+	echo 'class="active"';
469
+}
470
+?>><i class="fa fa-clock-o fa-3x"></i></a>
450 471
 						</div>
451 472
 						<div class="col-xs-3">
452
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
473
+							<a href="index.php?view=comment" <?php if($view=='comment')
474
+{
475
+	echo 'class="active"';
476
+}
477
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
453 478
 						</div>
454 479
 						<div class="col-xs-3">
455
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
480
+							<a href="index.php?view=upVote" <?php if($view=='upVote')
481
+{
482
+	echo 'class="active"';
483
+}
484
+?>><i class="fa fa-angle-up fa-3x"></i></a>
456 485
 						</div>
457 486
 						<div class="col-xs-3">
458 487
 							<nav>
@@ -493,7 +522,9 @@  discard block
 block discarded – undo
493 522
 				    $('html,body').animate({scrollTop: aTag.offset().top-90},'slow');
494 523
 				}
495 524
 
496
-				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
525
+				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
526
+{
527
+?>
497 528
 
498 529
 				
499 530
 
Please login to merge, or discard this patch.