Completed
Push — master ( f4e497...bae45b )
by mains
02:47
created
php/jodel-web.php 2 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -41,36 +41,36 @@  discard block
 block discarded – undo
41 41
 
42 42
 function isUserBot()
43 43
 {
44
-    preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
44
+	preg_match('/bot|spider|google|twitter/i', $_SERVER['HTTP_USER_AGENT'], $matches);
45 45
 
46
-    return (isset($matches[0])) ? true : false;
46
+	return (isset($matches[0])) ? true : false;
47 47
 }
48 48
 
49 49
 function configPropertyExists($config, $property)
50 50
 {
51
-    if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
52
-    {
53
-        return FALSE;
54
-    }
55
-    else
56
-    {
57
-        return TRUE;
58
-    }
51
+	if(!array_key_exists($property, $config) || !isset($config[$property]) || $config[$property] == '' || $config[$property] == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
52
+	{
53
+		return FALSE;
54
+	}
55
+	else
56
+	{
57
+		return TRUE;
58
+	}
59 59
 }
60 60
 
61 61
 function isDeviceUidInDatabase($deviceUid)
62 62
 {
63
-    $db = new DatabaseConnect();  
64
-    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
63
+	$db = new DatabaseConnect();  
64
+	$result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
65 65
 
66
-    if ($result->num_rows > 0)
67
-    {
68
-        return TRUE;
69
-    }
70
-    else
71
-    {
72
-        return FALSE;
73
-    }
66
+	if ($result->num_rows > 0)
67
+	{
68
+		return TRUE;
69
+	}
70
+	else
71
+	{
72
+		return FALSE;
73
+	}
74 74
 }
75 75
 
76 76
 	//Check if it's a Spider or Google Bot
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 	
100 100
 	if(configPropertyExists($config, 'karmaDeviceUid'))
101
-    {
102
-    	$jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']);
103
-    }
104
-    else
105
-    {
106
-    	error_log("No Karma deviceUid set in config file");
101
+	{
102
+		$jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']);
103
+	}
104
+	else
105
+	{
106
+		error_log("No Karma deviceUid set in config file");
107 107
 		$jodelAccountForKarma = new JodelAccount($deviceUid);
108
-    }
108
+	}
109 109
 
110 110
 	$newPositionStatus = $jodelAccountForView->location->getCityName();
111 111
 
@@ -194,32 +194,32 @@  discard block
 block discarded – undo
194 194
 			if(!array_key_exists(0, $posts))
195 195
 			{
196 196
 				$posts[0] = array(
197
-			    "post_id" => "0",
198
-			    "discovered_by" => 0,
199
-			    "message" => "Not found",
200
-			    "created_at" => "2017-02-11T16:44:50.385Z",
201
-			    "updated_at" => "2017-02-11T16:44:50.385Z",
202
-			    "pin_count" => 0,
203
-			    "color" => "FFBA00",
204
-			    "got_thanks" => FALSE,
205
-			    "post_own" => "friend",
206
-			    "discovered" => 0,
207
-			    "distance" => 9,
208
-			    "vote_count" => 0,
209
-			    "location" =>
210
-			    array("name" => "Berlin",
211
-			      "loc_coordinates" =>
212
-			      array(
213
-			        "lat" => 0,
214
-			        "lng" => 0
215
-			      ),
216
-			      "loc_accuracy" => 0,
217
-			      "country" => "",
218
-			      "city" => "",
219
-			    ),
220
-			    "tags" =>
221
-			    array(),
222
-			    "user_handle" => "0"
197
+				"post_id" => "0",
198
+				"discovered_by" => 0,
199
+				"message" => "Not found",
200
+				"created_at" => "2017-02-11T16:44:50.385Z",
201
+				"updated_at" => "2017-02-11T16:44:50.385Z",
202
+				"pin_count" => 0,
203
+				"color" => "FFBA00",
204
+				"got_thanks" => FALSE,
205
+				"post_own" => "friend",
206
+				"discovered" => 0,
207
+				"distance" => 9,
208
+				"vote_count" => 0,
209
+				"location" =>
210
+				array("name" => "Berlin",
211
+				  "loc_coordinates" =>
212
+				  array(
213
+					"lat" => 0,
214
+					"lng" => 0
215
+				  ),
216
+				  "loc_accuracy" => 0,
217
+				  "country" => "",
218
+				  "city" => "",
219
+				),
220
+				"tags" =>
221
+				array(),
222
+				"user_handle" => "0"
223 223
 			 );
224 224
 			}
225 225
 		}
@@ -228,32 +228,32 @@  discard block
 block discarded – undo
228 228
 			$posts = array();
229 229
 			$posts[0] = 
230 230
 			array(
231
-			    "post_id" => "0",
232
-			    "discovered_by" => 0,
233
-			    "message" => "Bad Request",
234
-			    "created_at" => "2017-02-11T16:44:50.385Z",
235
-			    "updated_at" => "2017-02-11T16:44:50.385Z",
236
-			    "pin_count" => 0,
237
-			    "color" => "FFBA00",
238
-			    "got_thanks" => FALSE,
239
-			    "post_own" => "friend",
240
-			    "discovered" => 0,
241
-			    "distance" => 9,
242
-			    "vote_count" => 0,
243
-			    "location" =>
244
-			    array("name" => "Berlin",
245
-			      "loc_coordinates" =>
246
-			      array(
247
-			        "lat" => 0,
248
-			        "lng" => 0
249
-			      ),
250
-			      "loc_accuracy" => 0,
251
-			      "country" => "",
252
-			      "city" => "",
253
-			    ),
254
-			    "tags" =>
255
-			    array(),
256
-			    "user_handle" => "0"
231
+				"post_id" => "0",
232
+				"discovered_by" => 0,
233
+				"message" => "Bad Request",
234
+				"created_at" => "2017-02-11T16:44:50.385Z",
235
+				"updated_at" => "2017-02-11T16:44:50.385Z",
236
+				"pin_count" => 0,
237
+				"color" => "FFBA00",
238
+				"got_thanks" => FALSE,
239
+				"post_own" => "friend",
240
+				"discovered" => 0,
241
+				"distance" => 9,
242
+				"vote_count" => 0,
243
+				"location" =>
244
+				array("name" => "Berlin",
245
+				  "loc_coordinates" =>
246
+				  array(
247
+					"lat" => 0,
248
+					"lng" => 0
249
+				  ),
250
+				  "loc_accuracy" => 0,
251
+				  "country" => "",
252
+				  "city" => "",
253
+				),
254
+				"tags" =>
255
+				array(),
256
+				"user_handle" => "0"
257 257
 			 );
258 258
 
259 259
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 	
100 100
 	if(configPropertyExists($config, 'karmaDeviceUid'))
101
-    {
101
+	{
102 102
     	$jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']);
103 103
     }
104 104
     else
@@ -115,7 +115,8 @@  discard block
 block discarded – undo
115 115
 	//Set View
116 116
 	if(isset($_GET['view']))
117 117
 	{
118
-		switch ($_GET['view']) {
118
+		switch ($_GET['view'])
119
+		{
119 120
 			case 'comment':
120 121
 				$view = 'comment';
121 122
 				break;
@@ -160,7 +161,7 @@  discard block
 block discarded – undo
160 161
 
161 162
 
162 163
 	function getPosts($lastPostId, $accessToken, $url, $version = 'v2')
163
-	{	
164
+	{
164 165
 		$accountCreator = new GetPosts();
165 166
 		$accountCreator->setLastPostId($lastPostId);
166 167
 		$accountCreator->setAccessToken($accessToken);
@@ -281,7 +282,8 @@  discard block
 block discarded – undo
281 282
 
282 283
 			$posts[0] = $data;
283 284
 
284
-			if(array_key_exists('children', $data)) {
285
+			if(array_key_exists('children', $data))
286
+			{
285 287
 				foreach($data['children'] as $key => $child)
286 288
 				{
287 289
 					
Please login to merge, or discard this patch.