Completed
Push — master ( bae45b...4583c4 )
by mains
02:48
created
php/jodel-web.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 {
44 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)
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 function isDeviceUidInDatabase($deviceUid)
62 62
 {
63 63
     $db = new DatabaseConnect();  
64
-    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid  . "'");
64
+    $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $deviceUid . "'");
65 65
 
66
-    if ($result->num_rows > 0)
66
+    if($result->num_rows > 0)
67 67
     {
68 68
         return TRUE;
69 69
     }
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 		if(!isset($_COOKIE['JodelDeviceId']) || !isDeviceUidInDatabase($_COOKIE['JodelDeviceId']))
86 86
 		{
87 87
 			$jodelAccountForView = new JodelAccount();
88
-			setcookie('JodelDeviceId', $jodelAccountForView->deviceUid, time()+60*60*24*365*10);
89
-			error_log('Created account with JodelDeviceId:' . $jodelAccountForView->deviceUid .  ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
88
+			setcookie('JodelDeviceId', $jodelAccountForView->deviceUid, time() + 60 * 60 * 24 * 365 * 10);
89
+			error_log('Created account with JodelDeviceId:' . $jodelAccountForView->deviceUid . ' for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
90 90
 			
91 91
 		}
92 92
 		else
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	//Set View
115 115
 	if(isset($_GET['view']))
116 116
 	{
117
-		switch ($_GET['view']) {
117
+		switch($_GET['view']) {
118 118
 			case 'comment':
119 119
 				$view = 'comment';
120 120
 				break;
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
 		else
313 313
 		{
314 314
 			$version = 'v2';
315
-			if($view=='comment')
315
+			if($view == 'comment')
316 316
 			{
317 317
 				$url = "/v2/posts/location/discussed/";
318 318
 			}
319 319
 			else
320 320
 			{
321
-				if($view=='upVote')
321
+				if($view == 'upVote')
322 322
 				{
323 323
 					$url = "/v2/posts/location/popular/";
324 324
 				}
Please login to merge, or discard this patch.
php/JodelAccount.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         {
36 36
             $this::refreshToken();
37 37
         }
38
-        $this->accessToken  = $this::getAccessToken();
38
+        $this->accessToken = $this::getAccessToken();
39 39
     }
40 40
 
41 41
     function isAccountVerified()
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                     }
95 95
                     else
96 96
                     {
97
-                        error_log('User with JodelDeviceId:' . $this->deviceUid .  ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name);
97
+                        error_log('User with JodelDeviceId:' . $this->deviceUid . ' [' . $_SERVER['REMOTE_ADDR'] . '][' . $_SERVER ['HTTP_USER_AGENT'] . '] changed to Location: ' . $name);
98 98
                     }
99 99
                 }
100 100
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
     function getLocation()
107 107
     {
108 108
         $db = new DatabaseConnect();
109
-        $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid  . "'");
109
+        $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'");
110 110
         
111 111
         $location = new Location();
112 112
         
113
-        if ($result->num_rows > 0)
113
+        if($result->num_rows > 0)
114 114
         {
115 115
             // output data of each row
116 116
             while($row = $result->fetch_assoc())
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         if(isset($_POST['color']))
201 201
         {
202 202
             $color = $_POST['color'];
203
-            switch ($color) {
203
+            switch($color) {
204 204
                 case '8ABDB0':
205 205
                     $color = '8ABDB0';
206 206
                     break;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
         $access_token;
258 258
 
259
-        if ($result->num_rows > 0)
259
+        if($result->num_rows > 0)
260 260
         {
261 261
                 // output data of each row
262 262
                 while($row = $result->fetch_assoc()) {
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                                         expiration_date='" . $expiration_date . "'
289 289
                                     WHERE device_uid='" . $device_uid . "'");
290 290
 
291
-            if($result === false){
291
+            if($result === false) {
292 292
                     echo "Adding account failed: (" . $db->errno . ") " . $db->error;
293 293
             }   
294 294
         }
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
     function getAccessToken()
307 307
     {
308 308
         $db = new DatabaseConnect();
309
-        $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid  . "'");
309
+        $result = $db->query("SELECT * FROM accounts WHERE device_uid='" . $this->deviceUid . "'");
310 310
         
311 311
         $accessToken;
312 312
         
313
-        if ($result->num_rows > 0)
313
+        if($result->num_rows > 0)
314 314
         {
315 315
             // output data of each row
316 316
             while($row = $result->fetch_assoc())
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         $result = $db->query("INSERT INTO votes (device_uid, postId, type)
379 379
                         VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')");
380 380
         
381
-        if($result === false){
381
+        if($result === false) {
382 382
                 $error = db_error();
383 383
                 echo $error;
384 384
                 echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
         $result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type,
407 407
                         expires_in, expiration_date, distinct_id, device_uid, name, lat, lng)
408 408
                         VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type .
409
-                        "','" .  $expires_in . "','" . $expiration_date . "','" . $distinct_id .
409
+                        "','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id .
410 410
                         "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
411 411
 
412 412
         $success = TRUE;
413
-        if($result === false){
413
+        if($result === false) {
414 414
                 $error = db_error();
415 415
                 echo $error;
416 416
                 echo "Adding account failed: (" . $result->errno . ") " . $result->error;
Please login to merge, or discard this patch.