Completed
Push — master ( 4583c4...306300 )
by mains
02:38
created
index.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1
-<?php include 'php/jodel-web.php';?>
1
+<?php include 'php/jodel-web.php'; ?>
2 2
 <!DOCTYPE html>
3 3
 <html lang="en">
4 4
 	<head>
5
-		<title><?php echo $viewTest::getTitle($posts[0], $view, $isDetailedView);?></title>
5
+		<title><?php echo $viewTest::getTitle($posts[0], $view, $isDetailedView); ?></title>
6 6
 		
7 7
 		<meta charset="utf-8">
8 8
 		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
9 9
 		<meta http-equiv="x-ua-compatible" content="ie=edge">
10 10
 		
11
-		<meta name="description" content="<?php echo $viewTest::getMetaDescription($posts[0], $view, $isDetailedView);?>">
11
+		<meta name="description" content="<?php echo $viewTest::getMetaDescription($posts[0], $view, $isDetailedView); ?>">
12 12
 		<meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client, web-app, browser, app">
13 13
 		
14 14
 		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 					<content id="posts">
92 92
 						<?php
93
-							for($i = 0; $i<$loops; $i++)
93
+							for($i = 0; $i < $loops; $i++)
94 94
 							{
95 95
 								if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id']))
96 96
 								{
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
135 135
 								<h2>Comment on Jodel</h2>
136 136
 								<form method="POST">				
137
-										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
137
+										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" />
138 138
 										<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> 
139 139
 									<br />
140 140
 									<input type="submit" value="SEND" /> 
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 				<div class="col-xs-12">
172 172
 					<div class="row">
173 173
 						<div class="col-xs-3">
174
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
174
+							<a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a>
175 175
 						</div>
176 176
 						<div class="col-xs-3">
177
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
177
+							<a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a>
178 178
 						</div>
179 179
 						<div class="col-xs-3">
180
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
180
+							<a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a>
181 181
 						</div>
182 182
 						<div class="col-xs-3">
183 183
 							<nav>
Please login to merge, or discard this patch.
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.