Completed
Pull Request — master (#10)
by
unknown
02:50
created
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/Requests/Upvote.php 2 patches
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.
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.
php/Requests/AbstractRequest.php 4 patches
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 = 'OFIqFvBgkccPNTVbIzkYaSmrwMlbVzRoOBBjXUIG';
@@ -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.32.2 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9 9
     const CLIENT_TYPE = 'android_4.32.2';
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.
Spacing   +4 added lines, -4 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:
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             'proxy' => '186.103.169.165:8080',
51 51
         );*/
52 52
 
53
-        switch ($this->getMethod()) {
53
+        switch($this->getMethod()) {
54 54
             case 'POST':
55 55
                 $result = Requests::post($url, $header, $this->payLoad);
56 56
                 break;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 $result = Requests::put($url, $header, $this->payLoad);
69 69
                 break;
70 70
         }
71
-        switch ($result->status_code) {
71
+        switch($result->status_code) {
72 72
             case 200:
73 73
                 $result = json_decode($result->body, true);
74 74
                 break;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                 exit("Error 403: Access denied");
97 97
                 break;
98 98
             default:
99
-                error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
99
+                error_log('Error ' . $result->status_code . ' - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
100 100
                 //throw  new \Exception('Unknown Error: '.$result->status_code);
101 101
         }
102 102
 
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 = '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';
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,16 +24,16 @@  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
         printf("URL: ");
38 38
         var_dump($url);
39 39
         echo "<br />";
@@ -44,82 +44,82 @@  discard block
 block discarded – undo
44 44
         var_dump($this->payLoad);
45 45
         echo "<br />";
46 46
         */
47
-        /*
47
+		/*
48 48
         $options = array(
49 49
             'timeout' => 100,
50 50
             'connect_timeout' => 100,
51 51
             'proxy' => '186.103.169.165:8080',
52 52
         );*/
53 53
 
54
-        switch ($this->getMethod()) {
55
-            case 'POST':
56
-                $result = Requests::post($url, $header, $this->payLoad);
57
-                break;
58
-            case 'GET':
59
-                if($this->version == 'v3')
60
-                {
61
-                    $result = Requests::get($url, $header);
62
-                }
63
-                else
64
-                {
65
-                    $result = Requests::get($url, $header);
66
-                }
67
-                break;
68
-            case 'PUT':
69
-                $result = Requests::put($url, $header, $this->payLoad);
70
-                break;
71
-        }
72
-        switch ($result->status_code) {
73
-            case 200:
74
-                $result = json_decode($result->body, true);
75
-                break;
76
-            case 204:
77
-                $result = "Success";
78
-                break;
79
-            case 401:
54
+		switch ($this->getMethod()) {
55
+			case 'POST':
56
+				$result = Requests::post($url, $header, $this->payLoad);
57
+				break;
58
+			case 'GET':
59
+				if($this->version == 'v3')
60
+				{
61
+					$result = Requests::get($url, $header);
62
+				}
63
+				else
64
+				{
65
+					$result = Requests::get($url, $header);
66
+				}
67
+				break;
68
+			case 'PUT':
69
+				$result = Requests::put($url, $header, $this->payLoad);
70
+				break;
71
+		}
72
+		switch ($result->status_code) {
73
+			case 200:
74
+				$result = json_decode($result->body, true);
75
+				break;
76
+			case 204:
77
+				$result = "Success";
78
+				break;
79
+			case 401:
80 80
 				//throw new \Exception('Unauthorized');
81
-                error_log('Error 401 - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
82
-                break;
83
-            case 404:
84
-                //echo "Es wurde bereits gevoted";
85
-                error_log('Error 404 - Es wurde bereits gevoted'); // - JodelDeviceId:' . $deviceUid);
81
+				error_log('Error 401 - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
82
+				break;
83
+			case 404:
84
+				//echo "Es wurde bereits gevoted";
85
+				error_log('Error 404 - Es wurde bereits gevoted'); // - JodelDeviceId:' . $deviceUid);
86 86
 			case 477:
87
-                //echo "Es wurde bereits gevoted";
88
-                //throw  new \Exception('Signing failed!');
89
-                error_log('Error 477 - Signing failed'); // - JodelDeviceId:' . $deviceUid);
90
-                break;
91
-            case 429:
92
-                error_log('Error 429 - Too Many Requests'); // - JodelDeviceId:' . $deviceUid);
93
-            	exit("Error 429: Too Many Requests");
94
-            	break;
95
-            case 403:
96
-                error_log('Error 403 - Access denied'); // - JodelDeviceId:' . $deviceUid);
97
-                exit("Error 403: Access denied");
98
-                break;
99
-            default:
100
-                error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
101
-                //throw  new \Exception('Unknown Error: '.$result->status_code);
102
-        }
87
+				//echo "Es wurde bereits gevoted";
88
+				//throw  new \Exception('Signing failed!');
89
+				error_log('Error 477 - Signing failed'); // - JodelDeviceId:' . $deviceUid);
90
+				break;
91
+			case 429:
92
+				error_log('Error 429 - Too Many Requests'); // - JodelDeviceId:' . $deviceUid);
93
+				exit("Error 429: Too Many Requests");
94
+				break;
95
+			case 403:
96
+				error_log('Error 403 - Access denied'); // - JodelDeviceId:' . $deviceUid);
97
+				exit("Error 403: Access denied");
98
+				break;
99
+			default:
100
+				error_log('Error '.$result->status_code.' - Unauthorized'); // - JodelDeviceId:' . $deviceUid);
101
+				//throw  new \Exception('Unknown Error: '.$result->status_code);
102
+		}
103 103
 
104
-        if($device_uid != '')
105
-        {
104
+		if($device_uid != '')
105
+		{
106 106
 			$result[0] = $result;
107 107
 			$result[1] = $device_uid;
108 108
 	}
109 109
 
110
-        /*
110
+		/*
111 111
         var_dump($result);
112 112
         */
113 113
 
114
-        return $result;
115
-    }
116
-    abstract function getPayload();
117
-    /**
118
-     * Gets Sign headers
119
-     * @return array headers
120
-     */
121
-    private function getSignHeaders()
122
-    {
114
+		return $result;
115
+	}
116
+	abstract function getPayload();
117
+	/**
118
+	 * Gets Sign headers
119
+	 * @return array headers
120
+	 */
121
+	private function getSignHeaders()
122
+	{
123 123
 			if($this->getAccessToken() == null) {
124 124
 				$payload_accessToken = "";
125 125
 			}
@@ -128,54 +128,54 @@  discard block
 block discarded – undo
128 128
 			}
129 129
 			
130 130
 			
131
-        $headers = array(
132
-            "Connection" => "keep-alive",
133
-            "Accept-Encoding" => "gzip",
134
-            "Content-Type" => "application/json; charset=UTF-8",
135
-            "User-Agent" => self::USERAGENT
136
-        );
137
-        $timestamp = new DateTime();
138
-        $timestamp = $timestamp->format(DateTime::ATOM);
139
-        $timestamp = substr($timestamp, 0, -6);
140
-        $timestamp .= "Z";
141
-        $urlParts = parse_url($this->getFullUrl());
142
-        $url2 = "";
143
-        $req = [$this->getMethod(),
144
-            $urlParts['host'],
145
-            "443",
146
-            $urlParts['path'],
147
-            $payload_accessToken,
148
-            $timestamp,
149
-            $url2,
150
-            $this->payLoad];
151
-        $reqString = implode("%", $req);
152
-        $secret = self::SECRET;
153
-        $signature = hash_hmac('sha1', $reqString, $secret);
154
-        $signature = strtoupper($signature);
155
-        $headers['X-Authorization'] = 'HMAC ' . $signature;
156
-        $headers['X-Client-Type'] = self::CLIENT_TYPE;
157
-        $headers['X-Timestamp'] = $timestamp;
158
-        $headers['X-Api-Version'] = '0.2';
159
-        return $headers;
160
-    }
161
-    private function getFullUrl()
162
-    {
163
-        return self::APIURL . $this->getApiEndPoint();
164
-    }
165
-    abstract function getApiEndPoint();
166
-    abstract function getMethod();
167
-    /**
168
-     * @return string
169
-     */
170
-    private function getAccessToken()
171
-    {
172
-        return $this->accessToken;
173
-    }
174
-    /**
175
-     * @param string $accessToken
176
-     */
177
-    public function setAccessToken($accessToken)
178
-    {
179
-        $this->accessToken = $accessToken;
180
-    }
131
+		$headers = array(
132
+			"Connection" => "keep-alive",
133
+			"Accept-Encoding" => "gzip",
134
+			"Content-Type" => "application/json; charset=UTF-8",
135
+			"User-Agent" => self::USERAGENT
136
+		);
137
+		$timestamp = new DateTime();
138
+		$timestamp = $timestamp->format(DateTime::ATOM);
139
+		$timestamp = substr($timestamp, 0, -6);
140
+		$timestamp .= "Z";
141
+		$urlParts = parse_url($this->getFullUrl());
142
+		$url2 = "";
143
+		$req = [$this->getMethod(),
144
+			$urlParts['host'],
145
+			"443",
146
+			$urlParts['path'],
147
+			$payload_accessToken,
148
+			$timestamp,
149
+			$url2,
150
+			$this->payLoad];
151
+		$reqString = implode("%", $req);
152
+		$secret = self::SECRET;
153
+		$signature = hash_hmac('sha1', $reqString, $secret);
154
+		$signature = strtoupper($signature);
155
+		$headers['X-Authorization'] = 'HMAC ' . $signature;
156
+		$headers['X-Client-Type'] = self::CLIENT_TYPE;
157
+		$headers['X-Timestamp'] = $timestamp;
158
+		$headers['X-Api-Version'] = '0.2';
159
+		return $headers;
160
+	}
161
+	private function getFullUrl()
162
+	{
163
+		return self::APIURL . $this->getApiEndPoint();
164
+	}
165
+	abstract function getApiEndPoint();
166
+	abstract function getMethod();
167
+	/**
168
+	 * @return string
169
+	 */
170
+	private function getAccessToken()
171
+	{
172
+		return $this->accessToken;
173
+	}
174
+	/**
175
+	 * @param string $accessToken
176
+	 */
177
+	public function setAccessToken($accessToken)
178
+	{
179
+		$this->accessToken = $accessToken;
180
+	}
181 181
 }
Please login to merge, or discard this patch.
php/jodel-web.php 4 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 
298 298
 	if($result->num_rows == 0)
299 299
 	{
300
-	    return FALSE;
300
+		return FALSE;
301 301
 	}
302 302
 	else
303 303
 	{
304
-	    return TRUE;
304
+		return TRUE;
305 305
 	}
306 306
 }
307 307
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 {
399 399
 	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
400 400
 
401
-    return (isset($matches[0])) ? true : false;
401
+	return (isset($matches[0])) ? true : false;
402 402
 }
403 403
 
404 404
 function botDeviceUidIsSet($config)
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 			<?php 
505 505
 			if(isset($post['image_url']))
506 506
 			{
507
-			    $regexRest = '/[^\w$ .!?-]+/u';
507
+				$regexRest = '/[^\w$ .!?-]+/u';
508 508
 
509 509
 				echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
510 510
 			}
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			}
108 108
 			else
109 109
 			{
110
-				error_log('User with JodelDeviceId:' . $deviceUid .  ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name);
110
+				error_log('User with JodelDeviceId:' . $deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name);
111 111
 			}
112 112
 		}
113 113
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	if(isset($_POST['color']))
170 170
 	{
171 171
 		$color = $_POST['color'];
172
-		switch ($color) {
172
+		switch($color) {
173 173
 			case '8ABDB0':
174 174
 				$color = '8ABDB0';
175 175
 				break;
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 function isDeviceUidInDatabase($deviceUid)
222 222
 {
223 223
 	$db = new DatabaseConnect();  
224
-	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
224
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
225 225
 
226
-	if ($result->num_rows > 0)
226
+	if($result->num_rows > 0)
227 227
 	{
228 228
 		return TRUE;
229 229
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	
241 241
 	$access_token;
242 242
 
243
-	if ($result->num_rows > 0)
243
+	if($result->num_rows > 0)
244 244
 	{
245 245
 			// output data of each row
246 246
 			while($row = $result->fetch_assoc()) {
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 	if($expiration_date <= time()) {
259 259
 		$accountCreator = new CreateUser();
260
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
260
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
261 261
 		$accountCreator->setDeviceUid($deviceUid);
262 262
 		$accountCreator->setLocation($location);
263 263
 		$data = $accountCreator->execute();
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 									expiration_date='" . $expiration_date . "'
273 273
 								WHERE device_uid='" . $device_uid . "'");
274 274
 
275
-		if($result === false){
275
+		if($result === false) {
276 276
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
277 277
 		}	
278 278
 	}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	$db = new DatabaseConnect();  
286 286
 	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'");
287 287
 	
288
-	if ($result->num_rows > 0)
288
+	if($result->num_rows > 0)
289 289
 	{
290 290
 			// output data of each row
291 291
 			while($row = $result->fetch_assoc()) {
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 	if($expiration_date <= time()) {
304 304
 		$accountCreator = new CreateUser();
305
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
305
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
306 306
 		$accountCreator->setDeviceUid($deviceUid);
307 307
 		$accountCreator->setLocation($location);
308 308
 		$data = $accountCreator->execute();
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 									expiration_date='" . $expiration_date . "'
318 318
 								WHERE device_uid='" . $device_uid . "'");
319 319
 
320
-		if($result === false){
320
+		if($result === false) {
321 321
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
322 322
 		}	
323 323
 	}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
 	$access_token;
334 334
 
335
-	if ($result->num_rows > 0)
335
+	if($result->num_rows > 0)
336 336
 	{
337 337
 			// output data of each row
338 338
 			while($row = $result->fetch_assoc()) {
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 									expiration_date='" . $expiration_date . "'
365 365
 								WHERE device_uid='" . $device_uid . "'");
366 366
 
367
-		if($result === false){
367
+		if($result === false) {
368 368
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
369 369
 		}	
370 370
 	}
@@ -375,11 +375,11 @@  discard block
 block discarded – undo
375 375
 function getLocationByAccessToken($accessToken)
376 376
 {
377 377
 	$db = new DatabaseConnect();
378
-	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken  . "'");
378
+	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'");
379 379
 	
380 380
 	$location = new Location();
381 381
 	
382
-	if ($result->num_rows > 0)
382
+	if($result->num_rows > 0)
383 383
 	{
384 384
 		// output data of each row
385 385
 		while($row = $result->fetch_assoc())
@@ -400,11 +400,11 @@  discard block
 block discarded – undo
400 400
 function getLocationByDeviceUid($deviceUid)
401 401
 {
402 402
 	$db = new DatabaseConnect();
403
-	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
403
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
404 404
 	
405 405
 	$location = new Location();
406 406
 	
407
-	if ($result->num_rows > 0)
407
+	if($result->num_rows > 0)
408 408
 	{
409 409
 		// output data of each row
410 410
 		while($row = $result->fetch_assoc())
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
 function getDeviceUidByAccessToken($accesstoken)
426 426
 {
427 427
 	$db = new DatabaseConnect();
428
-	$result = $db->query("SELECT device_uid FROM accounts WHERE access_token='" . $accesstoken  . "'");
428
+	$result = $db->query("SELECT device_uid FROM accounts WHERE access_token='" . $accesstoken . "'");
429 429
 	
430 430
 	$deviceUid;
431 431
 	
432
-	if ($result->num_rows > 0)
432
+	if($result->num_rows > 0)
433 433
 	{
434 434
 		// output data of each row
435 435
 		while($row = $result->fetch_assoc())
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 function getAccessTokenByDeviceUid($deviceUid)
449 449
 {
450 450
 	$db = new DatabaseConnect();
451
-	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
451
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
452 452
 	
453 453
 	$accessToken;
454 454
 	
455
-	if ($result->num_rows > 0)
455
+	if($result->num_rows > 0)
456 456
 	{
457 457
 		// output data of each row
458 458
 		while($row = $result->fetch_assoc())
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	$result = $db->query("INSERT INTO votes (device_uid, postId, type)
521 521
 					VALUES ('" . $device_uid . "','" . $postId . "','" . $voteType . "')");
522 522
 	
523
-	if($result === false){
523
+	if($result === false) {
524 524
 			$error = db_error();
525 525
 			echo $error;
526 526
 			echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
@@ -548,11 +548,11 @@  discard block
 block discarded – undo
548 548
 	$result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type,
549 549
 					expires_in, expiration_date, distinct_id, device_uid, name, lat, lng)
550 550
 					VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type .
551
-					"','" .  $expires_in . "','" . $expiration_date . "','" . $distinct_id .
551
+					"','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id .
552 552
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
553 553
 
554 554
 	$success = TRUE;
555
-	if($result === false){
555
+	if($result === false) {
556 556
 			$error = db_error();
557 557
 			echo $error;
558 558
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 {
599 599
 	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
600 600
 
601
-    return (isset($matches[0])) ? true : false;
601
+    return (isset($matches[0]))?true : false;
602 602
 }
603 603
 
604 604
 function botDeviceUidIsSet($config)
@@ -667,25 +667,25 @@  discard block
 block discarded – undo
667 667
 	$timediff_inDays = (string)$timediff->format('%d');
668 668
 	$timediff_inMonth = (string)$timediff->format('%m');
669 669
 
670
-	if($timediff_inMonth!=0)
670
+	if($timediff_inMonth != 0)
671 671
 	{
672 672
 			$timediff = $timediff_inMonth . "m";
673 673
 	}
674 674
 	else
675 675
 	{
676
-		if($timediff_inDays!=0)
676
+		if($timediff_inDays != 0)
677 677
 		{
678 678
 			$timediff = $timediff_inDays . "d";
679 679
 		}
680 680
 		else
681 681
 		{
682
-			if($timediff_inHours!=0)
682
+			if($timediff_inHours != 0)
683 683
 			{
684 684
 				$timediff = $timediff_inHours . "h";
685 685
 			}
686 686
 			else
687 687
 			{
688
-				if($timediff_inMinutes!=0)
688
+				if($timediff_inMinutes != 0)
689 689
 				{
690 690
 					$timediff = $timediff_inMinutes . "m";
691 691
 				}
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 
700 700
 
701 701
 	?>
702
-	<article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;">
702
+	<article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color']; ?>;">
703 703
 		<content>
704 704
 			<?php 
705 705
 			if(isset($post['image_url']))
@@ -717,24 +717,24 @@  discard block
 block discarded – undo
717 717
 			<?php
718 718
 				if($isDetailedView)
719 719
 				{?>
720
-					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
720
+					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id']; ?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']); ?>" rel="nofollow">
721 721
 		  <?php }
722 722
 				else
723 723
 				{?>
724
-					<a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>" rel="nofollow">
724
+					<a href="index.php?vote=up&postID=<?php echo $post['post_id']; ?>" rel="nofollow">
725 725
 		  <?php } ?>
726 726
 						<i class="fa fa-angle-up fa-3x"></i>
727 727
 					</a>	
728 728
 						<br />
729
-					<?php echo $post["vote_count"];?><br />
729
+					<?php echo $post["vote_count"]; ?><br />
730 730
 			<?php
731 731
 				if($isDetailedView)
732 732
 				{?>
733
-					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
733
+					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id']; ?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']); ?>" rel="nofollow">
734 734
 		  <?php }
735 735
 				else
736 736
 				{?>
737
-					<a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>" rel="nofollow">
737
+					<a href="index.php?vote=down&postID=<?php echo $post['post_id']; ?>" rel="nofollow">
738 738
 		  <?php } ?>
739 739
 						<i class="fa fa-angle-down fa-3x"></i>
740 740
 					</a>
@@ -746,14 +746,14 @@  discard block
 block discarded – undo
746 746
 					<td class="time">
747 747
 						<span class="tip" data-tooltip="Time">
748 748
 							<i class="fa fa-clock-o"></i>
749
-							<?php echo $timediff;?>
750
-							<span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span>
749
+							<?php echo $timediff; ?>
750
+							<span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span>
751 751
 						</span> 
752 752
 					</td>
753 753
 					<td class="comments">
754 754
 						<?php if(!$isDetailedView) {?>
755 755
 						<span data-tooltip="Comments">
756
-							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
756
+							<a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>">
757 757
 								<i class="fa fa-commenting-o"></i>
758 758
 								<?php if(array_key_exists("child_count", $post)) {
759 759
 											echo $post["child_count"];
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 									{
783 783
 							  			?>
784 784
 							  			<span data-tooltip="Author">
785
-											<i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> |
785
+											<i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> |
786 786
 										</span>
787 787
 										<?php
788 788
 									}
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 
793 793
 						<span class="tip" data-tooltip="Distance">
794 794
 							<i class="fa fa-map-marker"></i>
795
-							<?php echo $post['distance'];?> km
796
-							<span class="tiptext"><?php echo $post['location']['name'];?></span>
795
+							<?php echo $post['distance']; ?> km
796
+							<span class="tiptext"><?php echo $post['location']['name']; ?></span>
797 797
 						</span>
798 798
 					</td>
799 799
 				</tr>
Please login to merge, or discard this patch.
Braces   +50 added lines, -25 removed lines patch added patch discarded remove patch
@@ -169,7 +169,8 @@  discard block
 block discarded – undo
169 169
 	if(isset($_POST['color']))
170 170
 	{
171 171
 		$color = $_POST['color'];
172
-		switch ($color) {
172
+		switch ($color)
173
+		{
173 174
 			case '8ABDB0':
174 175
 				$color = '8ABDB0';
175 176
 				break;
@@ -243,7 +244,8 @@  discard block
 block discarded – undo
243 244
 	if ($result->num_rows > 0)
244 245
 	{
245 246
 			// output data of each row
246
-			while($row = $result->fetch_assoc()) {
247
+			while($row = $result->fetch_assoc())
248
+			{
247 249
 					//$access_token = $row["access_token"];
248 250
 					$expiration_date = $row["expiration_date"];
249 251
 					$deviceUid = $row["device_uid"];
@@ -255,7 +257,8 @@  discard block
 block discarded – undo
255 257
 			echo '0 results';
256 258
 	}
257 259
 
258
-	if($expiration_date <= time()) {
260
+	if($expiration_date <= time())
261
+	{
259 262
 		$accountCreator = new CreateUser();
260 263
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
261 264
 		$accountCreator->setDeviceUid($deviceUid);
@@ -272,7 +275,8 @@  discard block
 block discarded – undo
272 275
 									expiration_date='" . $expiration_date . "'
273 276
 								WHERE device_uid='" . $device_uid . "'");
274 277
 
275
-		if($result === false){
278
+		if($result === false)
279
+		{
276 280
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
277 281
 		}	
278 282
 	}
@@ -288,7 +292,8 @@  discard block
 block discarded – undo
288 292
 	if ($result->num_rows > 0)
289 293
 	{
290 294
 			// output data of each row
291
-			while($row = $result->fetch_assoc()) {
295
+			while($row = $result->fetch_assoc())
296
+			{
292 297
 					//$access_token = $row["access_token"];
293 298
 					$expiration_date = $row["expiration_date"];
294 299
 					$deviceUid = $row["device_uid"];
@@ -300,7 +305,8 @@  discard block
 block discarded – undo
300 305
 			echo '0 results';
301 306
 	}
302 307
 
303
-	if($expiration_date <= time()) {
308
+	if($expiration_date <= time())
309
+	{
304 310
 		$accountCreator = new CreateUser();
305 311
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
306 312
 		$accountCreator->setDeviceUid($deviceUid);
@@ -317,7 +323,8 @@  discard block
 block discarded – undo
317 323
 									expiration_date='" . $expiration_date . "'
318 324
 								WHERE device_uid='" . $device_uid . "'");
319 325
 
320
-		if($result === false){
326
+		if($result === false)
327
+		{
321 328
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
322 329
 		}	
323 330
 	}
@@ -335,7 +342,8 @@  discard block
 block discarded – undo
335 342
 	if ($result->num_rows > 0)
336 343
 	{
337 344
 			// output data of each row
338
-			while($row = $result->fetch_assoc()) {
345
+			while($row = $result->fetch_assoc())
346
+			{
339 347
 					//$access_token = $row["access_token"];
340 348
 					$expiration_date = $row["expiration_date"];
341 349
 					$deviceUid = $row["device_uid"];
@@ -347,7 +355,8 @@  discard block
 block discarded – undo
347 355
 			echo '0 results';
348 356
 	}
349 357
 
350
-	if($expiration_date <= time()) {
358
+	if($expiration_date <= time())
359
+	{
351 360
 		$accountCreator = new CreateUser();
352 361
 		$accountCreator->setAccessToken($access_token);
353 362
 		$accountCreator->setDeviceUid($deviceUid);
@@ -364,7 +373,8 @@  discard block
 block discarded – undo
364 373
 									expiration_date='" . $expiration_date . "'
365 374
 								WHERE device_uid='" . $device_uid . "'");
366 375
 
367
-		if($result === false){
376
+		if($result === false)
377
+		{
368 378
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
369 379
 		}	
370 380
 	}
@@ -520,14 +530,16 @@  discard block
 block discarded – undo
520 530
 	$result = $db->query("INSERT INTO votes (device_uid, postId, type)
521 531
 					VALUES ('" . $device_uid . "','" . $postId . "','" . $voteType . "')");
522 532
 	
523
-	if($result === false){
533
+	if($result === false)
534
+	{
524 535
 			$error = db_error();
525 536
 			echo $error;
526 537
 			echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
527 538
 	}		
528 539
 }
529 540
 
530
-function registerAccount(Location $location) {
541
+function registerAccount(Location $location)
542
+{
531 543
 	$accountCreator = new CreateUser();
532 544
 	$accountCreator->setLocation($location);
533 545
 	$data = $accountCreator->execute();
@@ -552,7 +564,8 @@  discard block
 block discarded – undo
552 564
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
553 565
 
554 566
 	$success = TRUE;
555
-	if($result === false){
567
+	if($result === false)
568
+	{
556 569
 			$error = db_error();
557 570
 			echo $error;
558 571
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -563,7 +576,7 @@  discard block
 block discarded – undo
563 576
 }
564 577
 
565 578
 function getPosts($lastPostId, $accessToken, $url, $version = 'v2')
566
-{	
579
+{
567 580
 	$accountCreator = new GetPosts();
568 581
 	$accountCreator->setLastPostId($lastPostId);
569 582
 	$accountCreator->setAccessToken($accessToken);
@@ -652,7 +665,8 @@  discard block
 block discarded – undo
652 665
 }
653 666
 
654 667
 function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE)
655
-{	//ToDO
668
+{
669
+//ToDO
656 670
 	//Replace # with link
657 671
 	//preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
658 672
 
@@ -708,7 +722,8 @@  discard block
 block discarded – undo
708 722
 
709 723
 				echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
710 724
 			}
711
-			else {
725
+			else
726
+			{
712 727
 				echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post['message'])));
713 728
 			}
714 729
 			?>
@@ -716,11 +731,13 @@  discard block
 block discarded – undo
716 731
 		<aside>
717 732
 			<?php
718 733
 				if($isDetailedView)
719
-				{?>
734
+				{
735
+?>
720 736
 					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
721 737
 		  <?php }
722
-				else
723
-				{?>
738
+else
739
+				{
740
+?>
724 741
 					<a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>" rel="nofollow">
725 742
 		  <?php } ?>
726 743
 						<i class="fa fa-angle-up fa-3x"></i>
@@ -729,11 +746,13 @@  discard block
 block discarded – undo
729 746
 					<?php echo $post["vote_count"];?><br />
730 747
 			<?php
731 748
 				if($isDetailedView)
732
-				{?>
749
+				{
750
+?>
733 751
 					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
734 752
 		  <?php }
735
-				else
736
-				{?>
753
+else
754
+				{
755
+?>
737 756
 					<a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>" rel="nofollow">
738 757
 		  <?php } ?>
739 758
 						<i class="fa fa-angle-down fa-3x"></i>
@@ -751,13 +770,19 @@  discard block
 block discarded – undo
751 770
 						</span> 
752 771
 					</td>
753 772
 					<td class="comments">
754
-						<?php if(!$isDetailedView) {?>
773
+						<?php if(!$isDetailedView)
774
+{
775
+?>
755 776
 						<span data-tooltip="Comments">
756 777
 							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
757 778
 								<i class="fa fa-commenting-o"></i>
758
-								<?php if(array_key_exists("child_count", $post)) {
779
+								<?php if(array_key_exists("child_count", $post))
780
+{
759 781
 											echo $post["child_count"];
760
-										} else echo "0";
782
+										}
783
+										else {
784
+											echo "0";
785
+										}
761 786
 								?>
762 787
 								</a>
763 788
 						</span>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 {
72 72
 	$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
73 73
 	$result = Requests::post($url);
74
-	if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST')
74
+	if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST')
75 75
 	{
76 76
 		return "0 results";
77 77
 	}
78 78
 	else
79 79
 	{
80
-		$name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name'];
81
-		$lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat'];
82
-		$lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng'];
80
+		$name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name'];
81
+		$lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat'];
82
+		$lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng'];
83 83
 
84 84
 		$location = new Location();
85 85
 		$location->setLat($lat);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 						lng='" . $lng . "'
102 102
 					WHERE access_token='" . $accessToken . "'");
103 103
 
104
-			if($result === false)
104
+			if($result === FALSE)
105 105
 			{
106 106
 					echo "Updating location failed: (" . $db->errno . ") " . $db->error;
107 107
 			}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 									expiration_date='" . $expiration_date . "'
273 273
 								WHERE device_uid='" . $device_uid . "'");
274 274
 
275
-		if($result === false){
275
+		if($result === FALSE){
276 276
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
277 277
 		}	
278 278
 	}
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 									expiration_date='" . $expiration_date . "'
318 318
 								WHERE device_uid='" . $device_uid . "'");
319 319
 
320
-		if($result === false){
320
+		if($result === FALSE){
321 321
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
322 322
 		}	
323 323
 	}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 									expiration_date='" . $expiration_date . "'
365 365
 								WHERE device_uid='" . $device_uid . "'");
366 366
 
367
-		if($result === false){
367
+		if($result === FALSE){
368 368
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
369 369
 		}	
370 370
 	}
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 						  FROM votes
489 489
 						  WHERE (postId = '" . $postId . "' AND device_uid = '" . $deviceUid . "')");
490 490
 	
491
-	if($result === false)
491
+	if($result === FALSE)
492 492
 	{
493 493
 		$error = db_error();
494 494
 		echo $error;
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	$result = $db->query("INSERT INTO votes (device_uid, postId, type)
521 521
 					VALUES ('" . $device_uid . "','" . $postId . "','" . $voteType . "')");
522 522
 	
523
-	if($result === false){
523
+	if($result === FALSE){
524 524
 			$error = db_error();
525 525
 			echo $error;
526 526
 			echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
553 553
 
554 554
 	$success = TRUE;
555
-	if($result === false){
555
+	if($result === FALSE){
556 556
 			$error = db_error();
557 557
 			echo $error;
558 558
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 {
599 599
 	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
600 600
 
601
-    return (isset($matches[0])) ? true : false;
601
+    return (isset($matches[0])) ? TRUE : FALSE;
602 602
 }
603 603
 
604 604
 function botDeviceUidIsSet($config)
Please login to merge, or discard this patch.
php/Requests/PostCaptcha.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2,22 +2,22 @@
 block discarded – undo
2 2
 class PostCaptcha extends AbstractRequest
3 3
 {
4 4
 	public $captchaKey;
5
-    public $captchaSolution;
5
+	public $captchaSolution;
6 6
 
7
-    function getApiEndPoint()
8
-    {
9
-        return '/v3/user/verification/imageCaptcha/';
10
-    }
11
-    function getPayload()
12
-    {
13
-        return array(
14
-            'key' => $this->captchaKey,
15
-            'answer' => $this->captchaSolution,
16
-        );
17
-    }
18
-    function getMethod()
19
-    {
20
-        return 'POST';
21
-    }
7
+	function getApiEndPoint()
8
+	{
9
+		return '/v3/user/verification/imageCaptcha/';
10
+	}
11
+	function getPayload()
12
+	{
13
+		return array(
14
+			'key' => $this->captchaKey,
15
+			'answer' => $this->captchaSolution,
16
+		);
17
+	}
18
+	function getMethod()
19
+	{
20
+		return 'POST';
21
+	}
22 22
 }
23 23
 
Please login to merge, or discard this patch.
php/Requests/GetUserConfig.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 class GetUserConfig extends AbstractRequest
3 3
 {
4 4
 		
5
-    function getApiEndPoint()
6
-    {
7
-        return '/v3/user/config/';
8
-    }
9
-    function getPayload()
10
-    {
11
-        return array(
12
-        );
13
-    }
14
-    function getMethod()
15
-    {
16
-        return 'GET';
17
-    }
5
+	function getApiEndPoint()
6
+	{
7
+		return '/v3/user/config/';
8
+	}
9
+	function getPayload()
10
+	{
11
+		return array(
12
+		);
13
+	}
14
+	function getMethod()
15
+	{
16
+		return 'GET';
17
+	}
18 18
 }
19 19
 
Please login to merge, or discard this patch.
php/Requests/GetCaptcha.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 class GetCaptcha extends AbstractRequest
3 3
 {		
4
-    function getApiEndPoint()
5
-    {
6
-        return '/v3/user/verification/imageCaptcha/';
7
-    }
8
-    function getPayload()
9
-    {
10
-        return array(
11
-        );
12
-    }
13
-    function getMethod()
14
-    {
15
-        return 'GET';
16
-    }
4
+	function getApiEndPoint()
5
+	{
6
+		return '/v3/user/verification/imageCaptcha/';
7
+	}
8
+	function getPayload()
9
+	{
10
+		return array(
11
+		);
12
+	}
13
+	function getMethod()
14
+	{
15
+		return 'GET';
16
+	}
17 17
 }
18 18
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 class GetCaptcha extends AbstractRequest
3
-{		
3
+{
4 4
     function getApiEndPoint()
5 5
     {
6 6
         return '/v3/user/verification/imageCaptcha/';
Please login to merge, or discard this patch.
index.php 6 patches
Doc Comments   +1 added lines, -101 removed lines patch added patch discarded remove patch
@@ -416,104 +416,4 @@
 block discarded – undo
416 416
 
417 417
 				var win = $(window);
418 418
 				var lastPostId = "<?php echo $lastPostId; ?>";
419
-				var view = "<?php echo $view; ?>"
420
-				var old_lastPostId = "";
421
-				var morePostsAvailable = true;
422
-
423
-				if(window.location.hash)
424
-				{
425
-					var hash = window.location.hash.slice(1);
426
-
427
-					if(!$("article[id='"+ hash +"']").length)
428
-					{
429
-						for (var i = 5; i >= 0; i--)
430
-						{
431
-							if(!$("article[id='"+ hash +"']").length)
432
-							{
433
-								$.ajax({
434
-									url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
435
-									dataType: 'html',
436
-									async: false,
437
-									success: function(html) {
438
-										var div = document.createElement('div');
439
-										div.innerHTML = html;
440
-										var elements = div.childNodes;
441
-										old_lastPostId = lastPostId;
442
-										lastPostId = elements[3].textContent;
443
-										lastPostId = lastPostId.replace(/\s+/g, '');
444
-										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
445
-										if(lastPostId == old_lastPostId) {
446
-											
447
-											//morePostsAvailable = false;
448
-										}
449
-										else {
450
-											//alert(elements[3].textContent);
451
-											$('#posts').append(elements[1].innerHTML);
452
-											$('#posts').hide().show(0);
453
-										}
454
-										$('#loading').hide();
455
-									}
456
-								});
457
-
458
-								$('.jodel > content').Emoji();
459
-							}
460
-							
461
-						}
462
-						scrollToAnchor(hash);
463
-
464
-					}						
465
-				}
466
-
467
-				// Each time the user scrolls
468
-				win.scroll(function() {
469
-
470
-
471
-					// End of the document reached?
472
-					if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable)
473
-					{
474
-						$('#loading').show();
475
-
476
-						$.ajax({
477
-							url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
478
-							dataType: 'html',
479
-							async: false,
480
-							success: function(html) {
481
-								var div = document.createElement('div');
482
-								div.innerHTML = html;
483
-								var elements = div.childNodes;
484
-								old_lastPostId = lastPostId;
485
-								lastPostId = elements[3].textContent;
486
-								lastPostId = lastPostId.replace(/\s+/g, '');
487
-								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
488
-								if(lastPostId == old_lastPostId)
489
-								{
490
-									
491
-									//morePostsAvailable = false;
492
-								}
493
-								else
494
-								{
495
-									//alert(elements[3].textContent);
496
-									$('#posts').append(elements[1].innerHTML);
497
-								}
498
-								$('#loading').hide();
499
-							}
500
-						});
501
-
502
-						$('.jodel > content').Emoji();
503
-					}
504
-				});
505
-			<?php } ?>
506
-			});	
507
-
508
-		</script>
509
-
510
-		<?php  
511
-			if(is_file('./piwik-script.html'))
512
-			{
513
-			    require_once('./piwik-script.html');
514
-			}
515
-		?>
516
-
517
-	</body>
518
-</html>
519
-
419
+				var view = "<?php echo $view
520 420
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +1 added lines, -101 removed lines patch added patch discarded remove patch
@@ -416,104 +416,4 @@
 block discarded – undo
416 416
 
417 417
 				var win = $(window);
418 418
 				var lastPostId = "<?php echo $lastPostId; ?>";
419
-				var view = "<?php echo $view; ?>"
420
-				var old_lastPostId = "";
421
-				var morePostsAvailable = true;
422
-
423
-				if(window.location.hash)
424
-				{
425
-					var hash = window.location.hash.slice(1);
426
-
427
-					if(!$("article[id='"+ hash +"']").length)
428
-					{
429
-						for (var i = 5; i >= 0; i--)
430
-						{
431
-							if(!$("article[id='"+ hash +"']").length)
432
-							{
433
-								$.ajax({
434
-									url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
435
-									dataType: 'html',
436
-									async: false,
437
-									success: function(html) {
438
-										var div = document.createElement('div');
439
-										div.innerHTML = html;
440
-										var elements = div.childNodes;
441
-										old_lastPostId = lastPostId;
442
-										lastPostId = elements[3].textContent;
443
-										lastPostId = lastPostId.replace(/\s+/g, '');
444
-										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
445
-										if(lastPostId == old_lastPostId) {
446
-											
447
-											//morePostsAvailable = false;
448
-										}
449
-										else {
450
-											//alert(elements[3].textContent);
451
-											$('#posts').append(elements[1].innerHTML);
452
-											$('#posts').hide().show(0);
453
-										}
454
-										$('#loading').hide();
455
-									}
456
-								});
457
-
458
-								$('.jodel > content').Emoji();
459
-							}
460
-							
461
-						}
462
-						scrollToAnchor(hash);
463
-
464
-					}						
465
-				}
466
-
467
-				// Each time the user scrolls
468
-				win.scroll(function() {
469
-
470
-
471
-					// End of the document reached?
472
-					if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable)
473
-					{
474
-						$('#loading').show();
475
-
476
-						$.ajax({
477
-							url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
478
-							dataType: 'html',
479
-							async: false,
480
-							success: function(html) {
481
-								var div = document.createElement('div');
482
-								div.innerHTML = html;
483
-								var elements = div.childNodes;
484
-								old_lastPostId = lastPostId;
485
-								lastPostId = elements[3].textContent;
486
-								lastPostId = lastPostId.replace(/\s+/g, '');
487
-								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
488
-								if(lastPostId == old_lastPostId)
489
-								{
490
-									
491
-									//morePostsAvailable = false;
492
-								}
493
-								else
494
-								{
495
-									//alert(elements[3].textContent);
496
-									$('#posts').append(elements[1].innerHTML);
497
-								}
498
-								$('#loading').hide();
499
-							}
500
-						});
501
-
502
-						$('.jodel > content').Emoji();
503
-					}
504
-				});
505
-			<?php } ?>
506
-			});	
507
-
508
-		</script>
509
-
510
-		<?php  
511
-			if(is_file('./piwik-script.html'))
512
-			{
513
-			    require_once('./piwik-script.html');
514
-			}
515
-		?>
516
-
517
-	</body>
518
-</html>
519
-
419
+				var view = "<?php echo $view
520 420
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +1 added lines, -101 removed lines patch added patch discarded remove patch
@@ -416,104 +416,4 @@
 block discarded – undo
416 416
 
417 417
 				var win = $(window);
418 418
 				var lastPostId = "<?php echo $lastPostId; ?>";
419
-				var view = "<?php echo $view; ?>"
420
-				var old_lastPostId = "";
421
-				var morePostsAvailable = true;
422
-
423
-				if(window.location.hash)
424
-				{
425
-					var hash = window.location.hash.slice(1);
426
-
427
-					if(!$("article[id='"+ hash +"']").length)
428
-					{
429
-						for (var i = 5; i >= 0; i--)
430
-						{
431
-							if(!$("article[id='"+ hash +"']").length)
432
-							{
433
-								$.ajax({
434
-									url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
435
-									dataType: 'html',
436
-									async: false,
437
-									success: function(html) {
438
-										var div = document.createElement('div');
439
-										div.innerHTML = html;
440
-										var elements = div.childNodes;
441
-										old_lastPostId = lastPostId;
442
-										lastPostId = elements[3].textContent;
443
-										lastPostId = lastPostId.replace(/\s+/g, '');
444
-										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
445
-										if(lastPostId == old_lastPostId) {
446
-											
447
-											//morePostsAvailable = false;
448
-										}
449
-										else {
450
-											//alert(elements[3].textContent);
451
-											$('#posts').append(elements[1].innerHTML);
452
-											$('#posts').hide().show(0);
453
-										}
454
-										$('#loading').hide();
455
-									}
456
-								});
457
-
458
-								$('.jodel > content').Emoji();
459
-							}
460
-							
461
-						}
462
-						scrollToAnchor(hash);
463
-
464
-					}						
465
-				}
466
-
467
-				// Each time the user scrolls
468
-				win.scroll(function() {
469
-
470
-
471
-					// End of the document reached?
472
-					if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable)
473
-					{
474
-						$('#loading').show();
475
-
476
-						$.ajax({
477
-							url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
478
-							dataType: 'html',
479
-							async: false,
480
-							success: function(html) {
481
-								var div = document.createElement('div');
482
-								div.innerHTML = html;
483
-								var elements = div.childNodes;
484
-								old_lastPostId = lastPostId;
485
-								lastPostId = elements[3].textContent;
486
-								lastPostId = lastPostId.replace(/\s+/g, '');
487
-								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
488
-								if(lastPostId == old_lastPostId)
489
-								{
490
-									
491
-									//morePostsAvailable = false;
492
-								}
493
-								else
494
-								{
495
-									//alert(elements[3].textContent);
496
-									$('#posts').append(elements[1].innerHTML);
497
-								}
498
-								$('#loading').hide();
499
-							}
500
-						});
501
-
502
-						$('.jodel > content').Emoji();
503
-					}
504
-				});
505
-			<?php } ?>
506
-			});	
507
-
508
-		</script>
509
-
510
-		<?php  
511
-			if(is_file('./piwik-script.html'))
512
-			{
513
-			    require_once('./piwik-script.html');
514
-			}
515
-		?>
516
-
517
-	</body>
518
-</html>
519
-
419
+				var view = "<?php echo $view
520 420
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -105 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;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	//Vote
92 92
 	if(isset($_GET['vote']) && isset($_GET['postID']))
93 93
 	{
94
-<<<<<<< HEAD
94
+<< << <<< HEAD
95 95
 		if(!deviceUidHasVotedThisPostId($deviceUid_forId1, $_GET['postID']))
96 96
 		{
97 97
 			if($_GET['vote'] == "up")
@@ -416,104 +416,4 @@  discard block
 block discarded – undo
416 416
 
417 417
 				var win = $(window);
418 418
 				var lastPostId = "<?php echo $lastPostId; ?>";
419
-				var view = "<?php echo $view; ?>"
420
-				var old_lastPostId = "";
421
-				var morePostsAvailable = true;
422
-
423
-				if(window.location.hash)
424
-				{
425
-					var hash = window.location.hash.slice(1);
426
-
427
-					if(!$("article[id='"+ hash +"']").length)
428
-					{
429
-						for (var i = 5; i >= 0; i--)
430
-						{
431
-							if(!$("article[id='"+ hash +"']").length)
432
-							{
433
-								$.ajax({
434
-									url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
435
-									dataType: 'html',
436
-									async: false,
437
-									success: function(html) {
438
-										var div = document.createElement('div');
439
-										div.innerHTML = html;
440
-										var elements = div.childNodes;
441
-										old_lastPostId = lastPostId;
442
-										lastPostId = elements[3].textContent;
443
-										lastPostId = lastPostId.replace(/\s+/g, '');
444
-										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
445
-										if(lastPostId == old_lastPostId) {
446
-											
447
-											//morePostsAvailable = false;
448
-										}
449
-										else {
450
-											//alert(elements[3].textContent);
451
-											$('#posts').append(elements[1].innerHTML);
452
-											$('#posts').hide().show(0);
453
-										}
454
-										$('#loading').hide();
455
-									}
456
-								});
457
-
458
-								$('.jodel > content').Emoji();
459
-							}
460
-							
461
-						}
462
-						scrollToAnchor(hash);
463
-
464
-					}						
465
-				}
466
-
467
-				// Each time the user scrolls
468
-				win.scroll(function() {
469
-
470
-
471
-					// End of the document reached?
472
-					if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable)
473
-					{
474
-						$('#loading').show();
475
-
476
-						$.ajax({
477
-							url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
478
-							dataType: 'html',
479
-							async: false,
480
-							success: function(html) {
481
-								var div = document.createElement('div');
482
-								div.innerHTML = html;
483
-								var elements = div.childNodes;
484
-								old_lastPostId = lastPostId;
485
-								lastPostId = elements[3].textContent;
486
-								lastPostId = lastPostId.replace(/\s+/g, '');
487
-								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
488
-								if(lastPostId == old_lastPostId)
489
-								{
490
-									
491
-									//morePostsAvailable = false;
492
-								}
493
-								else
494
-								{
495
-									//alert(elements[3].textContent);
496
-									$('#posts').append(elements[1].innerHTML);
497
-								}
498
-								$('#loading').hide();
499
-							}
500
-						});
501
-
502
-						$('.jodel > content').Emoji();
503
-					}
504
-				});
505
-			<?php } ?>
506
-			});	
507
-
508
-		</script>
509
-
510
-		<?php  
511
-			if(is_file('./piwik-script.html'))
512
-			{
513
-			    require_once('./piwik-script.html');
514
-			}
515
-		?>
516
-
517
-	</body>
518
-</html>
519
-
419
+				var view = "<?php echo $view
520 420
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -102 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;
@@ -416,104 +417,4 @@  discard block
 block discarded – undo
416 417
 
417 418
 				var win = $(window);
418 419
 				var lastPostId = "<?php echo $lastPostId; ?>";
419
-				var view = "<?php echo $view; ?>"
420
-				var old_lastPostId = "";
421
-				var morePostsAvailable = true;
422
-
423
-				if(window.location.hash)
424
-				{
425
-					var hash = window.location.hash.slice(1);
426
-
427
-					if(!$("article[id='"+ hash +"']").length)
428
-					{
429
-						for (var i = 5; i >= 0; i--)
430
-						{
431
-							if(!$("article[id='"+ hash +"']").length)
432
-							{
433
-								$.ajax({
434
-									url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
435
-									dataType: 'html',
436
-									async: false,
437
-									success: function(html) {
438
-										var div = document.createElement('div');
439
-										div.innerHTML = html;
440
-										var elements = div.childNodes;
441
-										old_lastPostId = lastPostId;
442
-										lastPostId = elements[3].textContent;
443
-										lastPostId = lastPostId.replace(/\s+/g, '');
444
-										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
445
-										if(lastPostId == old_lastPostId) {
446
-											
447
-											//morePostsAvailable = false;
448
-										}
449
-										else {
450
-											//alert(elements[3].textContent);
451
-											$('#posts').append(elements[1].innerHTML);
452
-											$('#posts').hide().show(0);
453
-										}
454
-										$('#loading').hide();
455
-									}
456
-								});
457
-
458
-								$('.jodel > content').Emoji();
459
-							}
460
-							
461
-						}
462
-						scrollToAnchor(hash);
463
-
464
-					}						
465
-				}
466
-
467
-				// Each time the user scrolls
468
-				win.scroll(function() {
469
-
470
-
471
-					// End of the document reached?
472
-					if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable)
473
-					{
474
-						$('#loading').show();
475
-
476
-						$.ajax({
477
-							url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
478
-							dataType: 'html',
479
-							async: false,
480
-							success: function(html) {
481
-								var div = document.createElement('div');
482
-								div.innerHTML = html;
483
-								var elements = div.childNodes;
484
-								old_lastPostId = lastPostId;
485
-								lastPostId = elements[3].textContent;
486
-								lastPostId = lastPostId.replace(/\s+/g, '');
487
-								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
488
-								if(lastPostId == old_lastPostId)
489
-								{
490
-									
491
-									//morePostsAvailable = false;
492
-								}
493
-								else
494
-								{
495
-									//alert(elements[3].textContent);
496
-									$('#posts').append(elements[1].innerHTML);
497
-								}
498
-								$('#loading').hide();
499
-							}
500
-						});
501
-
502
-						$('.jodel > content').Emoji();
503
-					}
504
-				});
505
-			<?php } ?>
506
-			});	
507
-
508
-		</script>
509
-
510
-		<?php  
511
-			if(is_file('./piwik-script.html'))
512
-			{
513
-			    require_once('./piwik-script.html');
514
-			}
515
-		?>
516
-
517
-	</body>
518
-</html>
519
-
420
+				var view = "<?php echo $view
520 421
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -101 removed lines patch added patch discarded remove patch
@@ -416,104 +416,4 @@
 block discarded – undo
416 416
 
417 417
 				var win = $(window);
418 418
 				var lastPostId = "<?php echo $lastPostId; ?>";
419
-				var view = "<?php echo $view; ?>"
420
-				var old_lastPostId = "";
421
-				var morePostsAvailable = true;
422
-
423
-				if(window.location.hash)
424
-				{
425
-					var hash = window.location.hash.slice(1);
426
-
427
-					if(!$("article[id='"+ hash +"']").length)
428
-					{
429
-						for (var i = 5; i >= 0; i--)
430
-						{
431
-							if(!$("article[id='"+ hash +"']").length)
432
-							{
433
-								$.ajax({
434
-									url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
435
-									dataType: 'html',
436
-									async: false,
437
-									success: function(html) {
438
-										var div = document.createElement('div');
439
-										div.innerHTML = html;
440
-										var elements = div.childNodes;
441
-										old_lastPostId = lastPostId;
442
-										lastPostId = elements[3].textContent;
443
-										lastPostId = lastPostId.replace(/\s+/g, '');
444
-										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
445
-										if(lastPostId == old_lastPostId) {
446
-											
447
-											//morePostsAvailable = false;
448
-										}
449
-										else {
450
-											//alert(elements[3].textContent);
451
-											$('#posts').append(elements[1].innerHTML);
452
-											$('#posts').hide().show(0);
453
-										}
454
-										$('#loading').hide();
455
-									}
456
-								});
457
-
458
-								$('.jodel > content').Emoji();
459
-							}
460
-							
461
-						}
462
-						scrollToAnchor(hash);
463
-
464
-					}						
465
-				}
466
-
467
-				// Each time the user scrolls
468
-				win.scroll(function() {
469
-
470
-
471
-					// End of the document reached?
472
-					if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable)
473
-					{
474
-						$('#loading').show();
475
-
476
-						$.ajax({
477
-							url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
478
-							dataType: 'html',
479
-							async: false,
480
-							success: function(html) {
481
-								var div = document.createElement('div');
482
-								div.innerHTML = html;
483
-								var elements = div.childNodes;
484
-								old_lastPostId = lastPostId;
485
-								lastPostId = elements[3].textContent;
486
-								lastPostId = lastPostId.replace(/\s+/g, '');
487
-								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
488
-								if(lastPostId == old_lastPostId)
489
-								{
490
-									
491
-									//morePostsAvailable = false;
492
-								}
493
-								else
494
-								{
495
-									//alert(elements[3].textContent);
496
-									$('#posts').append(elements[1].innerHTML);
497
-								}
498
-								$('#loading').hide();
499
-							}
500
-						});
501
-
502
-						$('.jodel > content').Emoji();
503
-					}
504
-				});
505
-			<?php } ?>
506
-			});	
507
-
508
-		</script>
509
-
510
-		<?php  
511
-			if(is_file('./piwik-script.html'))
512
-			{
513
-			    require_once('./piwik-script.html');
514
-			}
515
-		?>
516
-
517
-	</body>
518
-</html>
519
-
419
+				var view = "<?php echo $view
520 420
\ No newline at end of file
Please login to merge, or discard this patch.
vote-ajax.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 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 vote-ajax.php');
7
-	$respone = array("message" => $_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php',"success" => false);
6
+	error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php');
7
+	$respone = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php', "success" => false);
8 8
 	echo json_encode($response);
9 9
 	
10 10
 	die();
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		}
71 71
 	}
72 72
 
73
-if (isset($captcha))
73
+if(isset($captcha))
74 74
 {
75 75
 	$response = array("success" => $success, "message" => $message, "captcha" => $captcha, "accessToken" => $token);
76 76
 }
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,17 +40,20 @@  discard block
 block discarded – undo
40 40
 				$token = $accessToken;
41 41
 				$success = false;
42 42
 			}
43
-			else {
43
+			else
44
+			{
44 45
 				
45 46
 				$location = getLocationByAccessToken($accessToken);
46 47
 
47 48
 				$accessToken = isTokenFreshByAccessToken($location, $accessToken);
48 49
 
49 50
 
50
-				if($_POST['vote'] == "up") {
51
+				if($_POST['vote'] == "up")
52
+				{
51 53
 					$accountCreator = new Upvote();
52 54
 				}
53
-				else if($_POST['vote'] == "down") {
55
+				else if($_POST['vote'] == "down")
56
+				{
54 57
 					$accountCreator = new Downvote();
55 58
 				}
56 59
 
@@ -74,7 +77,7 @@  discard block
 block discarded – undo
74 77
 {
75 78
 	$response = array("success" => $success, "message" => $message, "captcha" => $captcha, "accessToken" => $token);
76 79
 }
77
-else 
80
+else
78 81
 {
79 82
 	$response = array("success" => $success, "message" => $message);
80 83
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 if(!isset($_GET['pw']) || $config['pw'] != $_GET['pw'])
5 5
 {
6 6
 	error_log($_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php');
7
-	$respone = array("message" => $_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php',"success" => false);
7
+	$respone = array("message" => $_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php',"success" => FALSE);
8 8
 	echo json_encode($response);
9 9
 	
10 10
 	die();
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 }
21 21
 
22 22
 $message = "";
23
-$success = true;
23
+$success = TRUE;
24 24
 $token = "";
25 25
 	if(isset($_POST['vote']) && isset($_POST['postId']))
26 26
 	{
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 				$message = "This account is not verified. Please verify this account first.";
39 39
 				$captcha = getCaptcha($accessToken);
40 40
 				$token = $accessToken;
41
-				$success = false;
41
+				$success = FALSE;
42 42
 			}
43 43
 			else {
44 44
 				
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		else
67 67
 		{
68 68
 			$message = 'There is no account available for this jodel. Please create at least one new account to vote this jodel.';
69
-			$success = false;
69
+			$success = FALSE;
70 70
 		}
71 71
 	}
72 72
 
Please login to merge, or discard this patch.