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
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				}
127 127
 				else
128 128
 				{
129
-					error_log('User with JodelDeviceId:' . $deviceUid .  ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name);
129
+					error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name);
130 130
 				}
131 131
 			}
132 132
 
@@ -189,7 +189,7 @@  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
 			case '8ABDB0':
194 194
 				$color = '8ABDB0';
195 195
 				break;
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 function isDeviceUidInDatabase($deviceUid)
242 242
 {
243 243
 	$db = new DatabaseConnect();  
244
-	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
244
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
245 245
 
246
-	if ($result->num_rows > 0)
246
+	if($result->num_rows > 0)
247 247
 	{
248 248
 		return TRUE;
249 249
 	}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	
261 261
 	$access_token;
262 262
 
263
-	if ($result->num_rows > 0)
263
+	if($result->num_rows > 0)
264 264
 	{
265 265
 			// output data of each row
266 266
 			while($row = $result->fetch_assoc()) {
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 	if($expiration_date <= time()) {
279 279
 		$accountCreator = new CreateUser();
280
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
280
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
281 281
 		$accountCreator->setDeviceUid($deviceUid);
282 282
 		$accountCreator->setLocation($location);
283 283
 		$data = $accountCreator->execute();
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 									expiration_date='" . $expiration_date . "'
293 293
 								WHERE device_uid='" . $device_uid . "'");
294 294
 
295
-		if($result === false){
295
+		if($result === false) {
296 296
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
297 297
 		}	
298 298
 	}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	$db = new DatabaseConnect();  
306 306
 	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'");
307 307
 	
308
-	if ($result->num_rows > 0)
308
+	if($result->num_rows > 0)
309 309
 	{
310 310
 			// output data of each row
311 311
 			while($row = $result->fetch_assoc()) {
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
 	if($expiration_date <= time()) {
324 324
 		$accountCreator = new CreateUser();
325
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
325
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
326 326
 		$accountCreator->setDeviceUid($deviceUid);
327 327
 		$accountCreator->setLocation($location);
328 328
 		$data = $accountCreator->execute();
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 									expiration_date='" . $expiration_date . "'
338 338
 								WHERE device_uid='" . $device_uid . "'");
339 339
 
340
-		if($result === false){
340
+		if($result === false) {
341 341
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
342 342
 		}	
343 343
 	}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 	$access_token;
354 354
 
355
-	if ($result->num_rows > 0)
355
+	if($result->num_rows > 0)
356 356
 	{
357 357
 			// output data of each row
358 358
 			while($row = $result->fetch_assoc()) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 									expiration_date='" . $expiration_date . "'
385 385
 								WHERE device_uid='" . $device_uid . "'");
386 386
 
387
-		if($result === false){
387
+		if($result === false) {
388 388
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
389 389
 		}	
390 390
 	}
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 function getLocationByAccessToken($accessToken)
396 396
 {
397 397
 	$db = new DatabaseConnect();
398
-	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken  . "'");
398
+	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'");
399 399
 	
400 400
 	$location = new Location();
401 401
 	
402
-	if ($result->num_rows > 0)
402
+	if($result->num_rows > 0)
403 403
 	{
404 404
 		// output data of each row
405 405
 		while($row = $result->fetch_assoc())
@@ -420,11 +420,11 @@  discard block
 block discarded – undo
420 420
 function getLocationByDeviceUid($deviceUid)
421 421
 {
422 422
 	$db = new DatabaseConnect();
423
-	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
423
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
424 424
 	
425 425
 	$location = new Location();
426 426
 	
427
-	if ($result->num_rows > 0)
427
+	if($result->num_rows > 0)
428 428
 	{
429 429
 		// output data of each row
430 430
 		while($row = $result->fetch_assoc())
@@ -445,11 +445,11 @@  discard block
 block discarded – undo
445 445
 function getDeviceUidByAccessToken($accesstoken)
446 446
 {
447 447
 	$db = new DatabaseConnect();
448
-	$result = $db->query("SELECT device_uid FROM accounts WHERE access_token='" . $accesstoken  . "'");
448
+	$result = $db->query("SELECT device_uid FROM accounts WHERE access_token='" . $accesstoken . "'");
449 449
 	
450 450
 	$deviceUid;
451 451
 	
452
-	if ($result->num_rows > 0)
452
+	if($result->num_rows > 0)
453 453
 	{
454 454
 		// output data of each row
455 455
 		while($row = $result->fetch_assoc())
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 function getAccessTokenByDeviceUid($deviceUid)
469 469
 {
470 470
 	$db = new DatabaseConnect();
471
-	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
471
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
472 472
 	
473 473
 	$accessToken;
474 474
 	
475
-	if ($result->num_rows > 0)
475
+	if($result->num_rows > 0)
476 476
 	{
477 477
 		// output data of each row
478 478
 		while($row = $result->fetch_assoc())
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	$result = $db->query("INSERT INTO votes (device_uid, postId, type)
541 541
 					VALUES ('" . $device_uid . "','" . $postId . "','" . $voteType . "')");
542 542
 	
543
-	if($result === false){
543
+	if($result === false) {
544 544
 			$error = db_error();
545 545
 			echo $error;
546 546
 			echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
@@ -568,11 +568,11 @@  discard block
 block discarded – undo
568 568
 	$result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type,
569 569
 					expires_in, expiration_date, distinct_id, device_uid, name, lat, lng)
570 570
 					VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type .
571
-					"','" .  $expires_in . "','" . $expiration_date . "','" . $distinct_id .
571
+					"','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id .
572 572
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
573 573
 
574 574
 	$success = TRUE;
575
-	if($result === false){
575
+	if($result === false) {
576 576
 			$error = db_error();
577 577
 			echo $error;
578 578
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 {
619 619
 	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
620 620
 
621
-    return (isset($matches[0])) ? true : false;
621
+    return (isset($matches[0]))?true : false;
622 622
 }
623 623
 
624 624
 function botDeviceUidIsSet($config)
@@ -687,25 +687,25 @@  discard block
 block discarded – undo
687 687
 	$timediff_inDays = (string)$timediff->format('%d');
688 688
 	$timediff_inMonth = (string)$timediff->format('%m');
689 689
 
690
-	if($timediff_inMonth!=0)
690
+	if($timediff_inMonth != 0)
691 691
 	{
692 692
 			$timediff = $timediff_inMonth . "m";
693 693
 	}
694 694
 	else
695 695
 	{
696
-		if($timediff_inDays!=0)
696
+		if($timediff_inDays != 0)
697 697
 		{
698 698
 			$timediff = $timediff_inDays . "d";
699 699
 		}
700 700
 		else
701 701
 		{
702
-			if($timediff_inHours!=0)
702
+			if($timediff_inHours != 0)
703 703
 			{
704 704
 				$timediff = $timediff_inHours . "h";
705 705
 			}
706 706
 			else
707 707
 			{
708
-				if($timediff_inMinutes!=0)
708
+				if($timediff_inMinutes != 0)
709 709
 				{
710 710
 					$timediff = $timediff_inMinutes . "m";
711 711
 				}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 
720 720
 
721 721
 	?>
722
-	<article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;">
722
+	<article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color']; ?>;">
723 723
 		<content>
724 724
 			<?php 
725 725
 			if(isset($post['image_url']))
@@ -737,24 +737,24 @@  discard block
 block discarded – undo
737 737
 			<?php
738 738
 				if($isDetailedView)
739 739
 				{?>
740
-					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
740
+					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id']; ?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']); ?>" rel="nofollow">
741 741
 		  <?php }
742 742
 				else
743 743
 				{?>
744
-					<a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>" rel="nofollow">
744
+					<a href="index.php?vote=up&postID=<?php echo $post['post_id']; ?>" rel="nofollow">
745 745
 		  <?php } ?>
746 746
 						<i class="fa fa-angle-up fa-3x"></i>
747 747
 					</a>	
748 748
 						<br />
749
-					<?php echo $post["vote_count"];?><br />
749
+					<?php echo $post["vote_count"]; ?><br />
750 750
 			<?php
751 751
 				if($isDetailedView)
752 752
 				{?>
753
-					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
753
+					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id']; ?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']); ?>" rel="nofollow">
754 754
 		  <?php }
755 755
 				else
756 756
 				{?>
757
-					<a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>" rel="nofollow">
757
+					<a href="index.php?vote=down&postID=<?php echo $post['post_id']; ?>" rel="nofollow">
758 758
 		  <?php } ?>
759 759
 						<i class="fa fa-angle-down fa-3x"></i>
760 760
 					</a>
@@ -766,14 +766,14 @@  discard block
 block discarded – undo
766 766
 					<td class="time">
767 767
 						<span class="tip" data-tooltip="Time">
768 768
 							<i class="fa fa-clock-o"></i>
769
-							<?php echo $timediff;?>
770
-							<span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span>
769
+							<?php echo $timediff; ?>
770
+							<span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span>
771 771
 						</span> 
772 772
 					</td>
773 773
 					<td class="comments">
774 774
 						<?php if(!$isDetailedView) {?>
775 775
 						<span data-tooltip="Comments">
776
-							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
776
+							<a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>">
777 777
 								<i class="fa fa-commenting-o"></i>
778 778
 								<?php if(array_key_exists("child_count", $post)) {
779 779
 											echo $post["child_count"];
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 									{
803 803
 							  			?>
804 804
 							  			<span data-tooltip="Author">
805
-											<i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> |
805
+											<i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> |
806 806
 										</span>
807 807
 										<?php
808 808
 									}
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 
813 813
 						<span class="tip" data-tooltip="Distance">
814 814
 							<i class="fa fa-map-marker"></i>
815
-							<?php echo $post['distance'];?> km
816
-							<span class="tiptext"><?php echo $post['location']['name'];?></span>
815
+							<?php echo $post['distance']; ?> km
816
+							<span class="tiptext"><?php echo $post['location']['name']; ?></span>
817 817
 						</span>
818 818
 					</td>
819 819
 				</tr>
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.
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']) || !isDeviceUidInDatabase($_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;
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
 		else
245 245
 		{
246 246
 			$version = 'v2';
247
-			if($view=='comment')
247
+			if($view == 'comment')
248 248
 			{
249 249
 				$url = "/v2/posts/location/discussed/";
250 250
 			}
251 251
 			else
252 252
 			{
253
-				if($view=='upVote')
253
+				if($view == 'upVote')
254 254
 				{
255 255
 					$url = "/v2/posts/location/popular/";
256 256
 				}
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
 <!DOCTYPE html>
278 278
 <html lang="en">
279 279
 	<head>
280
-		<title><?php echo getTitle($posts[0], $view, $isDetailedView);?></title>
280
+		<title><?php echo getTitle($posts[0], $view, $isDetailedView); ?></title>
281 281
 		
282 282
 		<meta charset="utf-8">
283 283
 		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
284 284
 		<meta http-equiv="x-ua-compatible" content="ie=edge">
285 285
 		
286
-		<meta name="description" content="<?php echo getMetaDescription($posts[0], $view, $isDetailedView);?>">
286
+		<meta name="description" content="<?php echo getMetaDescription($posts[0], $view, $isDetailedView); ?>">
287 287
 		<meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client, web-app, browser, app">
288 288
 		
289 289
 		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 
366 366
 					<content id="posts">
367 367
 						<?php
368
-							for($i = 0; $i<$loops; $i++)
368
+							for($i = 0; $i < $loops; $i++)
369 369
 							{
370 370
 								if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id']))
371 371
 								{
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
410 410
 								<h2>Comment on Jodel</h2>
411 411
 								<form method="POST">				
412
-										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
412
+										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" />
413 413
 										<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> 
414 414
 									<br />
415 415
 									<input type="submit" value="SEND" /> 
@@ -446,13 +446,13 @@  discard block
 block discarded – undo
446 446
 				<div class="col-xs-12">
447 447
 					<div class="row">
448 448
 						<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>
449
+							<a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a>
450 450
 						</div>
451 451
 						<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>
452
+							<a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a>
453 453
 						</div>
454 454
 						<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>
455
+							<a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a>
456 456
 						</div>
457 457
 						<div class="col-xs-3">
458 458
 							<nav>
Please login to merge, or discard this patch.