Completed
Push — master ( 0a28e3...0c8547 )
by mains
03:05
created
php/jodel-web.php 2 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.
Braces   +48 added lines, -24 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@  discard block
 block discarded – undo
43 43
 	if ($result->num_rows > 0)
44 44
 	{
45 45
 			// output data of each row
46
-			while($row = $result->fetch_assoc()) {
46
+			while($row = $result->fetch_assoc())
47
+			{
47 48
 					//$access_token = $row["access_token"];
48 49
 					$expiration_date = $row["expiration_date"];
49 50
 					$deviceUid = $row["device_uid"];
@@ -55,7 +56,8 @@  discard block
 block discarded – undo
55 56
 			echo '0 results';
56 57
 	}
57 58
 
58
-	if($expiration_date <= time()) {
59
+	if($expiration_date <= time())
60
+	{
59 61
 		$accountCreator = new CreateUser();
60 62
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
61 63
 		$accountCreator->setDeviceUid($deviceUid);
@@ -72,7 +74,8 @@  discard block
 block discarded – undo
72 74
 									expiration_date='" . $expiration_date . "'
73 75
 								WHERE device_uid='" . $device_uid . "'");
74 76
 
75
-		if($result === false){
77
+		if($result === false)
78
+		{
76 79
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
77 80
 		}	
78 81
 	}
@@ -88,7 +91,8 @@  discard block
 block discarded – undo
88 91
 	if ($result->num_rows > 0)
89 92
 	{
90 93
 			// output data of each row
91
-			while($row = $result->fetch_assoc()) {
94
+			while($row = $result->fetch_assoc())
95
+			{
92 96
 					//$access_token = $row["access_token"];
93 97
 					$expiration_date = $row["expiration_date"];
94 98
 					$deviceUid = $row["device_uid"];
@@ -100,7 +104,8 @@  discard block
 block discarded – undo
100 104
 			echo '0 results';
101 105
 	}
102 106
 
103
-	if($expiration_date <= time()) {
107
+	if($expiration_date <= time())
108
+	{
104 109
 		$accountCreator = new CreateUser();
105 110
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
106 111
 		$accountCreator->setDeviceUid($deviceUid);
@@ -117,7 +122,8 @@  discard block
 block discarded – undo
117 122
 									expiration_date='" . $expiration_date . "'
118 123
 								WHERE device_uid='" . $device_uid . "'");
119 124
 
120
-		if($result === false){
125
+		if($result === false)
126
+		{
121 127
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
122 128
 		}	
123 129
 	}
@@ -135,7 +141,8 @@  discard block
 block discarded – undo
135 141
 	if ($result->num_rows > 0)
136 142
 	{
137 143
 			// output data of each row
138
-			while($row = $result->fetch_assoc()) {
144
+			while($row = $result->fetch_assoc())
145
+			{
139 146
 					//$access_token = $row["access_token"];
140 147
 					$expiration_date = $row["expiration_date"];
141 148
 					$deviceUid = $row["device_uid"];
@@ -147,7 +154,8 @@  discard block
 block discarded – undo
147 154
 			echo '0 results';
148 155
 	}
149 156
 
150
-	if($expiration_date <= time()) {
157
+	if($expiration_date <= time())
158
+	{
151 159
 		$accountCreator = new CreateUser();
152 160
 		$accountCreator->setAccessToken($access_token);
153 161
 		$accountCreator->setDeviceUid($deviceUid);
@@ -164,7 +172,8 @@  discard block
 block discarded – undo
164 172
 									expiration_date='" . $expiration_date . "'
165 173
 								WHERE device_uid='" . $device_uid . "'");
166 174
 
167
-		if($result === false){
175
+		if($result === false)
176
+		{
168 177
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
169 178
 		}	
170 179
 	}
@@ -320,14 +329,16 @@  discard block
 block discarded – undo
320 329
 	$result = $db->query("INSERT INTO votes (device_uid, postId, type)
321 330
 					VALUES ('" . $device_uid . "','" . $postId . "','" . $voteType . "')");
322 331
 	
323
-	if($result === false){
332
+	if($result === false)
333
+	{
324 334
 			$error = db_error();
325 335
 			echo $error;
326 336
 			echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
327 337
 	}		
328 338
 }
329 339
 
330
-function registerAccount(Location $location) {
340
+function registerAccount(Location $location)
341
+{
331 342
 	$accountCreator = new CreateUser();
332 343
 	$accountCreator->setLocation($location);
333 344
 	$data = $accountCreator->execute();
@@ -352,7 +363,8 @@  discard block
 block discarded – undo
352 363
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
353 364
 
354 365
 	$success = TRUE;
355
-	if($result === false){
366
+	if($result === false)
367
+	{
356 368
 			$error = db_error();
357 369
 			echo $error;
358 370
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -363,7 +375,7 @@  discard block
 block discarded – undo
363 375
 }
364 376
 
365 377
 function getPosts($lastPostId, $accessToken, $url, $version = 'v2')
366
-{	
378
+{
367 379
 	$accountCreator = new GetPosts();
368 380
 	$accountCreator->setLastPostId($lastPostId);
369 381
 	$accountCreator->setAccessToken($accessToken);
@@ -452,7 +464,8 @@  discard block
 block discarded – undo
452 464
 }
453 465
 
454 466
 function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE)
455
-{	//ToDO
467
+{
468
+//ToDO
456 469
 	//Replace # with link
457 470
 	//preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
458 471
 
@@ -508,7 +521,8 @@  discard block
 block discarded – undo
508 521
 
509 522
 				echo '<img src="' . $post["image_url"] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post["message"])) . '">';
510 523
 			}
511
-			else {
524
+			else
525
+			{
512 526
 				echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post["message"])));
513 527
 			}
514 528
 			?>
@@ -516,11 +530,13 @@  discard block
 block discarded – undo
516 530
 		<aside>
517 531
 			<?php
518 532
 				if($isDetailedView)
519
-				{?>
533
+				{
534
+?>
520 535
 					<a href="index.php?vote=up&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
521 536
 		  <?php }
522
-				else
523
-				{?>
537
+else
538
+				{
539
+?>
524 540
 					<a href="index.php?vote=up&postID=<?php echo $post['post_id'];?>" rel="nofollow">
525 541
 		  <?php } ?>
526 542
 						<i class="fa fa-angle-up fa-3x"></i>
@@ -529,11 +545,13 @@  discard block
 block discarded – undo
529 545
 					<?php echo $post["vote_count"];?><br />
530 546
 			<?php
531 547
 				if($isDetailedView)
532
-				{?>
548
+				{
549
+?>
533 550
 					<a href="index.php?vote=down&getPostDetails=true&postID=<?php echo $post['post_id'];?>&postID_parent=<?php echo htmlspecialchars($_GET['postID']);?>" rel="nofollow">
534 551
 		  <?php }
535
-				else
536
-				{?>
552
+else
553
+				{
554
+?>
537 555
 					<a href="index.php?vote=down&postID=<?php echo $post['post_id'];?>" rel="nofollow">
538 556
 		  <?php } ?>
539 557
 						<i class="fa fa-angle-down fa-3x"></i>
@@ -551,13 +569,19 @@  discard block
 block discarded – undo
551 569
 						</span> 
552 570
 					</td>
553 571
 					<td class="comments">
554
-						<?php if(!$isDetailedView) {?>
572
+						<?php if(!$isDetailedView)
573
+{
574
+?>
555 575
 						<span data-tooltip="Comments">
556 576
 							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
557 577
 								<i class="fa fa-commenting-o"></i>
558
-								<?php if(array_key_exists("child_count", $post)) {
578
+								<?php if(array_key_exists("child_count", $post))
579
+{
559 580
 											echo $post["child_count"];
560
-										} else echo "0";
581
+										}
582
+										else {
583
+											echo "0";
584
+										}
561 585
 								?>
562 586
 								</a>
563 587
 						</span>
Please login to merge, or discard this patch.