Completed
Push — master ( ea693b...e34205 )
by mains
03:07
created
error-pages/404.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 	</div>
67 67
 
68 68
 </div>
69
-<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php');?>
70 69
\ No newline at end of file
70
+<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php'); ?>
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
php/jodel-web.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -49,27 +49,27 @@  discard block
 block discarded – undo
49 49
 
50 50
 function user_log($msg)
51 51
 {
52
-    $log  = $msg . PHP_EOL;
53
-    file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("Y.n.j") . '.txt', $log, FILE_APPEND);
52
+	$log  = $msg . PHP_EOL;
53
+	file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("Y.n.j") . '.txt', $log, FILE_APPEND);
54 54
 }
55 55
 
56 56
 function isUserBot()
57 57
 {
58
-    preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
58
+	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
59 59
 
60
-    return (isset($matches[0])) ? true : false;
60
+	return (isset($matches[0])) ? true : false;
61 61
 }
62 62
 
63 63
 function configPropertyExists($config, $property)
64 64
 {
65
-    if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
66
-    {
67
-        return FALSE;
68
-    }
69
-    else
70
-    {
71
-        return TRUE;
72
-    }
65
+	if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
66
+	{
67
+		return FALSE;
68
+	}
69
+	else
70
+	{
71
+		return TRUE;
72
+	}
73 73
 }
74 74
 
75 75
 function isUserVoter()
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
 
111 111
 function isDeviceUidInDatabase($deviceUid)
112 112
 {
113
-    $db = new DatabaseConnect();  
114
-    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
113
+	$db = new DatabaseConnect();  
114
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
115 115
 
116
-    if ($result->num_rows > 0)
117
-    {
118
-    	$db->close();
119
-        return TRUE;
120
-    }
121
-    else
122
-    {
123
-    	$db->close();
124
-        return FALSE;
125
-    }
116
+	if ($result->num_rows > 0)
117
+	{
118
+		$db->close();
119
+		return TRUE;
120
+	}
121
+	else
122
+	{
123
+		$db->close();
124
+		return FALSE;
125
+	}
126 126
 }
127 127
 
128 128
 	//Check if it's a Spider or Google Bot
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 	
151 151
 	if(configPropertyExists($config, 'karmaDeviceUid'))
152
-    {
153
-    	$jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']);
154
-    }
155
-    else
156
-    {
157
-    	error_log("No Karma deviceUid set in config file");
152
+	{
153
+		$jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']);
154
+	}
155
+	else
156
+	{
157
+		error_log("No Karma deviceUid set in config file");
158 158
 		$jodelAccountForKarma = new JodelAccount($deviceUid);
159
-    }
159
+	}
160 160
 
161 161
 	/*
162 162
 	 * Cunstruct View
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 function user_log($msg)
51 51
 {
52
-    $log  = $msg . PHP_EOL;
52
+    $log = $msg . PHP_EOL;
53 53
     file_put_contents(realpath(__DIR__ . '/..') . '/logs/user_log-' . date("Y.n.j") . '.txt', $log, FILE_APPEND);
54 54
 }
55 55
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 {
58 58
     preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
59 59
 
60
-    return (isset($matches[0])) ? true : false;
60
+    return (isset($matches[0]))?true : false;
61 61
 }
62 62
 
63 63
 function configPropertyExists($config, $property)
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 function isUserAdmin()
99 99
 {
100 100
 	global $config;
101
-	if (isset($_COOKIE['JodelAdminPassword']) && configPropertyExists($config, 'pw') && $config['pw'] == $_COOKIE['JodelAdminPassword'])
101
+	if(isset($_COOKIE['JodelAdminPassword']) && configPropertyExists($config, 'pw') && $config['pw'] == $_COOKIE['JodelAdminPassword'])
102 102
 	{
103 103
 		return TRUE;
104 104
 	}
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 function isDeviceUidInDatabase($deviceUid)
112 112
 {
113 113
     $db = new DatabaseConnect();  
114
-    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
114
+    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
115 115
 
116
-    if ($result->num_rows > 0)
116
+    if($result->num_rows > 0)
117 117
     {
118 118
     	$db->close();
119 119
         return TRUE;
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 		if(!isset($_COOKIE['JodelDeviceId']) || !isDeviceUidInDatabase($_COOKIE['JodelDeviceId']))
138 138
 		{
139 139
 			$jodelAccountForView = new JodelAccount();
140
-			setcookie('JodelDeviceId', $jodelAccountForView->deviceUid, time()+60*60*24*365*10);
141
-			user_log('Created account with JodelDeviceId:' . $jodelAccountForView->deviceUid .  ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
140
+			setcookie('JodelDeviceId', $jodelAccountForView->deviceUid, time() + 60 * 60 * 24 * 365 * 10);
141
+			user_log('Created account with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
142 142
 			
143 143
 		}
144 144
 		else
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	if(isset($_GET['search']))
168 168
 	{
169 169
 
170
-		user_log('User with JodelDeviceId:' . $jodelAccountForView->deviceUid .  ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] searched for ' . $_GET['search']);
170
+		user_log('User with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] searched for ' . $_GET['search']);
171 171
 
172 172
 		if(substr($_GET['search'], 0, 1) === "#")
173 173
 		{
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	
223 223
 	if(isset($_GET['view']))
224 224
 	{
225
-		switch ($_GET['view']) {
225
+		switch($_GET['view']) {
226 226
 			case 'discussed':
227 227
 				$view = 'discussed';
228 228
 				break;
Please login to merge, or discard this patch.
php/Requests/AbstractRequest.php 2 patches
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -2,21 +2,21 @@  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 = 'bJYlFZkrnLpLMVisrbstPDNsaYHPbzcKRSpqtjtt';
8
-    const USERAGENT = 'Jodel/4.42.4 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
-    const CLIENT_TYPE = 'android_4.42.4';
5
+	const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
+	const APIURL = 'https://api.go-tellm.com/api';
7
+	const SECRET = 'bJYlFZkrnLpLMVisrbstPDNsaYHPbzcKRSpqtjtt';
8
+	const USERAGENT = 'Jodel/4.42.4 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
+	const CLIENT_TYPE = 'android_4.42.4';
10 10
     
11
-    private $accessToken = null;
12
-    private $payLoad;
13
-    public $expects = '';
14
-    public $version = 'v2';
15
-    public $hasPayload = FALSE;
16
-
17
-    public function execute()
18
-    {
19
-        $result = new \stdClass();
11
+	private $accessToken = null;
12
+	private $payLoad;
13
+	public $expects = '';
14
+	public $version = 'v2';
15
+	public $hasPayload = FALSE;
16
+
17
+	public function execute()
18
+	{
19
+		$result = new \stdClass();
20 20
 		        
21 21
 		$this->payLoad = $this->getPayload();
22 22
 		$device_uid = '';
@@ -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,134 +45,134 @@  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
-
74
-        http_response_code($result->status_code);
75
-
76
-        switch ($result->status_code) {
77
-            case 200:
78
-                $result = json_decode($result->body, true);
79
-                break;
80
-            case 204:
81
-                $result = 'Success';
82
-                http_response_code(200);
83
-                break;
84
-            case 400:
85
-                $result = json_decode($result->body, true);
86
-                error_log('Error 400 - ' . print_r($result, true));
87
-                break;
88
-            case 401:
89
-
90
-                if($result == "Unauthorized")
91
-                {
92
-                    error_log("Error 401: Unauthorized");
93
-                }
94
-                else
95
-                {
96
-                    $result = json_decode($result->body, true);
97
-
98
-                    if(is_array($result) && $result['error'] == 'length')
99
-                    {
100
-
101
-                    }
102
-                    else
103
-                    {
104
-                        error_log('Error 401 - ' . print_r($result, true));
105
-                    }
106
-                }
107
-
108
-
109
-                break;
110
-            case 404:
111
-
112
-
113
-                error_log('Error 404 - ' . print_r($result, true));
114
-                $result = json_decode($result->body, true);
115
-
116
-                if(array_key_exists('error', $result) && $result['error'] == 'post_blocked')
117
-                {
118
-                    header('HTTP/1.0 404 Not Found');
119
-                    include('error-pages/404.php');
120
-                    exit();
121
-                }
122
-
123
-                break;
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
+
74
+		http_response_code($result->status_code);
75
+
76
+		switch ($result->status_code) {
77
+			case 200:
78
+				$result = json_decode($result->body, true);
79
+				break;
80
+			case 204:
81
+				$result = 'Success';
82
+				http_response_code(200);
83
+				break;
84
+			case 400:
85
+				$result = json_decode($result->body, true);
86
+				error_log('Error 400 - ' . print_r($result, true));
87
+				break;
88
+			case 401:
89
+
90
+				if($result == "Unauthorized")
91
+				{
92
+					error_log("Error 401: Unauthorized");
93
+				}
94
+				else
95
+				{
96
+					$result = json_decode($result->body, true);
97
+
98
+					if(is_array($result) && $result['error'] == 'length')
99
+					{
100
+
101
+					}
102
+					else
103
+					{
104
+						error_log('Error 401 - ' . print_r($result, true));
105
+					}
106
+				}
107
+
108
+
109
+				break;
110
+			case 404:
111
+
112
+
113
+				error_log('Error 404 - ' . print_r($result, true));
114
+				$result = json_decode($result->body, true);
115
+
116
+				if(array_key_exists('error', $result) && $result['error'] == 'post_blocked')
117
+				{
118
+					header('HTTP/1.0 404 Not Found');
119
+					include('error-pages/404.php');
120
+					exit();
121
+				}
122
+
123
+				break;
124 124
 			case 477:
125
-                $result = json_decode($result->body, true);
126
-                error_log('Error 477 - ' . print_r($result, true));
127
-                break;
128
-            case 429:
129
-                error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true));
130
-            	exit("Error 429: Too Many Requests");
131
-            	break;
132
-            case 403:
133
-                error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true));
134
-                $result = json_decode($result->body, true);
135
-                break;
136
-            case 502:
137
-                error_log('Error 502 - ' . print_r($result, true));
138
-                $result = json_decode($result->body, true);
139
-                header('location:'.$_SERVER['PHP_SELF']);
140
-                break;
141
-            case 503:
142
-                error_log('Error 503 - ' . print_r($result, true));
143
-                $result = json_decode($result->body, true);
144
-
145
-                if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable')
146
-                {
147
-                    header('location:'.$_SERVER['PHP_SELF']); 
148
-                }
149
-                break;
150
-            default:
151
-                error_log('Error '.$result->status_code.' - unknown error');
152
-                $result = json_decode($result->body, true);
153
-        }
154
-
155
-        //important for account refresh
156
-        if($device_uid != '')
157
-        {
125
+				$result = json_decode($result->body, true);
126
+				error_log('Error 477 - ' . print_r($result, true));
127
+				break;
128
+			case 429:
129
+				error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true));
130
+				exit("Error 429: Too Many Requests");
131
+				break;
132
+			case 403:
133
+				error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true));
134
+				$result = json_decode($result->body, true);
135
+				break;
136
+			case 502:
137
+				error_log('Error 502 - ' . print_r($result, true));
138
+				$result = json_decode($result->body, true);
139
+				header('location:'.$_SERVER['PHP_SELF']);
140
+				break;
141
+			case 503:
142
+				error_log('Error 503 - ' . print_r($result, true));
143
+				$result = json_decode($result->body, true);
144
+
145
+				if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable')
146
+				{
147
+					header('location:'.$_SERVER['PHP_SELF']); 
148
+				}
149
+				break;
150
+			default:
151
+				error_log('Error '.$result->status_code.' - unknown error');
152
+				$result = json_decode($result->body, true);
153
+		}
154
+
155
+		//important for account refresh
156
+		if($device_uid != '')
157
+		{
158 158
 			$result[0] = $result;
159 159
 			$result[1] = $device_uid;
160
-        }
160
+		}
161 161
 
162 162
         
163
-        /*
163
+		/*
164 164
         var_dump($result);
165 165
         */
166 166
         
167
-        return $result;
168
-    }
169
-    abstract function getPayload();
170
-    /**
171
-     * Gets Sign headers
172
-     * @return array headers
173
-     */
174
-    private function getSignHeaders()
175
-    {
167
+		return $result;
168
+	}
169
+	abstract function getPayload();
170
+	/**
171
+	 * Gets Sign headers
172
+	 * @return array headers
173
+	 */
174
+	private function getSignHeaders()
175
+	{
176 176
 			if($this->getAccessToken() == null) {
177 177
 				$payload_accessToken = "";
178 178
 			}
@@ -181,54 +181,54 @@  discard block
 block discarded – undo
181 181
 			}
182 182
 			
183 183
 			
184
-        $headers = array(
185
-            "Connection" => "keep-alive",
186
-            "Accept-Encoding" => "gzip",
187
-            "Content-Type" => "application/json; charset=UTF-8",
188
-            "User-Agent" => self::USERAGENT
189
-        );
190
-        $timestamp = new DateTime();
191
-        $timestamp = $timestamp->format(DateTime::ATOM);
192
-        $timestamp = substr($timestamp, 0, -6);
193
-        $timestamp .= "Z";
194
-        $urlParts = parse_url($this->getFullUrl());
195
-        $url2 = "";
196
-        $req = [$this->getMethod(),
197
-            $urlParts['host'],
198
-            "443",
199
-            $urlParts['path'],
200
-            $payload_accessToken,
201
-            $timestamp,
202
-            $url2,
203
-            $this->payLoad];
204
-        $reqString = implode("%", $req);
205
-        $secret = self::SECRET;
206
-        $signature = hash_hmac('sha1', $reqString, $secret);
207
-        $signature = strtoupper($signature);
208
-        $headers['X-Authorization'] = 'HMAC ' . $signature;
209
-        $headers['X-Client-Type'] = self::CLIENT_TYPE;
210
-        $headers['X-Timestamp'] = $timestamp;
211
-        $headers['X-Api-Version'] = '0.2';
212
-        return $headers;
213
-    }
214
-    private function getFullUrl()
215
-    {
216
-        return self::APIURL . $this->getApiEndPoint();
217
-    }
218
-    abstract function getApiEndPoint();
219
-    abstract function getMethod();
220
-    /**
221
-     * @return string
222
-     */
223
-    private function getAccessToken()
224
-    {
225
-        return $this->accessToken;
226
-    }
227
-    /**
228
-     * @param string $accessToken
229
-     */
230
-    public function setAccessToken($accessToken)
231
-    {
232
-        $this->accessToken = $accessToken;
233
-    }
184
+		$headers = array(
185
+			"Connection" => "keep-alive",
186
+			"Accept-Encoding" => "gzip",
187
+			"Content-Type" => "application/json; charset=UTF-8",
188
+			"User-Agent" => self::USERAGENT
189
+		);
190
+		$timestamp = new DateTime();
191
+		$timestamp = $timestamp->format(DateTime::ATOM);
192
+		$timestamp = substr($timestamp, 0, -6);
193
+		$timestamp .= "Z";
194
+		$urlParts = parse_url($this->getFullUrl());
195
+		$url2 = "";
196
+		$req = [$this->getMethod(),
197
+			$urlParts['host'],
198
+			"443",
199
+			$urlParts['path'],
200
+			$payload_accessToken,
201
+			$timestamp,
202
+			$url2,
203
+			$this->payLoad];
204
+		$reqString = implode("%", $req);
205
+		$secret = self::SECRET;
206
+		$signature = hash_hmac('sha1', $reqString, $secret);
207
+		$signature = strtoupper($signature);
208
+		$headers['X-Authorization'] = 'HMAC ' . $signature;
209
+		$headers['X-Client-Type'] = self::CLIENT_TYPE;
210
+		$headers['X-Timestamp'] = $timestamp;
211
+		$headers['X-Api-Version'] = '0.2';
212
+		return $headers;
213
+	}
214
+	private function getFullUrl()
215
+	{
216
+		return self::APIURL . $this->getApiEndPoint();
217
+	}
218
+	abstract function getApiEndPoint();
219
+	abstract function getMethod();
220
+	/**
221
+	 * @return string
222
+	 */
223
+	private function getAccessToken()
224
+	{
225
+		return $this->accessToken;
226
+	}
227
+	/**
228
+	 * @param string $accessToken
229
+	 */
230
+	public function setAccessToken($accessToken)
231
+	{
232
+		$this->accessToken = $accessToken;
233
+	}
234 234
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
     const USERAGENT = 'Jodel/4.42.4 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9 9
     const CLIENT_TYPE = 'android_4.42.4';
10 10
     
11
-    private $accessToken = null;
11
+    private $accessToken = NULL;
12 12
     private $payLoad;
13 13
     public $expects = '';
14 14
     public $version = 'v2';
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
 
76 76
         switch ($result->status_code) {
77 77
             case 200:
78
-                $result = json_decode($result->body, true);
78
+                $result = json_decode($result->body, TRUE);
79 79
                 break;
80 80
             case 204:
81 81
                 $result = 'Success';
82 82
                 http_response_code(200);
83 83
                 break;
84 84
             case 400:
85
-                $result = json_decode($result->body, true);
86
-                error_log('Error 400 - ' . print_r($result, true));
85
+                $result = json_decode($result->body, TRUE);
86
+                error_log('Error 400 - ' . print_r($result, TRUE));
87 87
                 break;
88 88
             case 401:
89 89
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 }
94 94
                 else
95 95
                 {
96
-                    $result = json_decode($result->body, true);
96
+                    $result = json_decode($result->body, TRUE);
97 97
 
98 98
                     if(is_array($result) && $result['error'] == 'length')
99 99
                     {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                     }
102 102
                     else
103 103
                     {
104
-                        error_log('Error 401 - ' . print_r($result, true));
104
+                        error_log('Error 401 - ' . print_r($result, TRUE));
105 105
                     }
106 106
                 }
107 107
 
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
             case 404:
111 111
 
112 112
 
113
-                error_log('Error 404 - ' . print_r($result, true));
114
-                $result = json_decode($result->body, true);
113
+                error_log('Error 404 - ' . print_r($result, TRUE));
114
+                $result = json_decode($result->body, TRUE);
115 115
 
116 116
                 if(array_key_exists('error', $result) && $result['error'] == 'post_blocked')
117 117
                 {
@@ -122,25 +122,25 @@  discard block
 block discarded – undo
122 122
 
123 123
                 break;
124 124
 			case 477:
125
-                $result = json_decode($result->body, true);
126
-                error_log('Error 477 - ' . print_r($result, true));
125
+                $result = json_decode($result->body, TRUE);
126
+                error_log('Error 477 - ' . print_r($result, TRUE));
127 127
                 break;
128 128
             case 429:
129
-                error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true));
129
+                error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, TRUE), TRUE));
130 130
             	exit("Error 429: Too Many Requests");
131 131
             	break;
132 132
             case 403:
133
-                error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true));
134
-                $result = json_decode($result->body, true);
133
+                error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, TRUE), TRUE));
134
+                $result = json_decode($result->body, TRUE);
135 135
                 break;
136 136
             case 502:
137
-                error_log('Error 502 - ' . print_r($result, true));
138
-                $result = json_decode($result->body, true);
137
+                error_log('Error 502 - ' . print_r($result, TRUE));
138
+                $result = json_decode($result->body, TRUE);
139 139
                 header('location:'.$_SERVER['PHP_SELF']);
140 140
                 break;
141 141
             case 503:
142
-                error_log('Error 503 - ' . print_r($result, true));
143
-                $result = json_decode($result->body, true);
142
+                error_log('Error 503 - ' . print_r($result, TRUE));
143
+                $result = json_decode($result->body, TRUE);
144 144
 
145 145
                 if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable')
146 146
                 {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                 break;
150 150
             default:
151 151
                 error_log('Error '.$result->status_code.' - unknown error');
152
-                $result = json_decode($result->body, true);
152
+                $result = json_decode($result->body, TRUE);
153 153
         }
154 154
 
155 155
         //important for account refresh
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      */
174 174
     private function getSignHeaders()
175 175
     {
176
-			if($this->getAccessToken() == null) {
176
+			if($this->getAccessToken() == NULL) {
177 177
 				$payload_accessToken = "";
178 178
 			}
179 179
 			else {
Please login to merge, or discard this patch.