Completed
Push — master ( 645415...94bf36 )
by mains
02:39
created
php/Location.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class Location{
3
+class Location
4
+{
4 5
 
5 6
     public $cityName;
6 7
 
@@ -37,7 +38,8 @@  discard block
 block discarded – undo
37 38
     {
38 39
         $this->lng = $lng;
39 40
     }
40
-    public function toArray(){
41
+    public function toArray()
42
+    {
41 43
         return array(
42 44
             "city" => $this->getCityName(),
43 45
             "country" => 'DE',
Please login to merge, or discard this patch.
php/jodel-web.php 1 patch
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
 $lastPostId = "";
20 20
 
21
-function isTokenFresh(Location $location) {
21
+function isTokenFresh(Location $location)
22
+{
22 23
 	$db = new DatabaseConnect();  
23 24
 	$result = $db->query("SELECT * FROM accounts WHERE id='1'");
24 25
 	
@@ -29,7 +30,8 @@  discard block
 block discarded – undo
29 30
 	if ($result->num_rows > 0)
30 31
 	{
31 32
 			// output data of each row
32
-			while($row = $result->fetch_assoc()) {
33
+			while($row = $result->fetch_assoc())
34
+			{
33 35
 					//$access_token = $row["access_token"];
34 36
 					$expiration_date = $row["expiration_date"];
35 37
 					$deviceUid = $row["device_uid"];
@@ -41,7 +43,8 @@  discard block
 block discarded – undo
41 43
 			echo "0 results";
42 44
 	}
43 45
 
44
-	if($expiration_date <= time()) {
46
+	if($expiration_date <= time())
47
+	{
45 48
 		$accountCreator = new CreateUser();
46 49
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
47 50
 		$accountCreator->setDeviceUid($deviceUid);
@@ -63,7 +66,8 @@  discard block
 block discarded – undo
63 66
 								WHERE device_uid='" . $device_uid . "'");
64 67
 
65 68
 		$success = TRUE;
66
-		if($result === false){
69
+		if($result === false)
70
+		{
67 71
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
68 72
 				$success = FALSE;
69 73
 		}	
@@ -85,7 +89,8 @@  discard block
 block discarded – undo
85 89
 	return $data["karma"];
86 90
 }
87 91
 
88
-function registerAccount(Location $location) {
92
+function registerAccount(Location $location)
93
+{
89 94
 	$accountCreator = new CreateUser();
90 95
 	$accountCreator->setLocation($location);
91 96
 	$data = $accountCreator->execute();
@@ -106,7 +111,8 @@  discard block
 block discarded – undo
106 111
 					"','" . $device_uid . "') ");
107 112
 
108 113
 	$success = TRUE;
109
-	if($result === false){
114
+	if($result === false)
115
+	{
110 116
 			$error = db_error();
111 117
 			echo $error;
112 118
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -117,7 +123,7 @@  discard block
 block discarded – undo
117 123
 }
118 124
 
119 125
 function getPosts($lastPostId, $accessToken, $url)
120
-{	
126
+{
121 127
 	$accountCreator = new GetPosts();
122 128
 	$accountCreator->setLastPostId($lastPostId);
123 129
 	$accountCreator->setAccessToken($accessToken);
@@ -127,7 +133,8 @@  discard block
 block discarded – undo
127 133
 	return $data;
128 134
 }
129 135
 
130
-function createAccount() {
136
+function createAccount()
137
+{
131 138
 	$location = new Location();
132 139
 	$location->setLat(50.690399);
133 140
 	$location->setLng(10.918175);
Please login to merge, or discard this patch.
get-posts-ajax.php 1 patch
Braces   +29 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,18 +17,22 @@  discard block
 block discarded – undo
17 17
 require_once 'php/Requests/libary/Requests.php';
18 18
 Requests::register_autoloader();
19 19
 
20
-function getPosts($lastPostId, $url) {
20
+function getPosts($lastPostId, $url)
21
+{
21 22
 	$db = new DatabaseConnect();
22
-	if ($db->connect_errno) {
23
+	if ($db->connect_errno)
24
+	{
23 25
 		echo 'Sorry, die Verbindung zu unserem superfetten endgeilen 
24 26
 					Server ist hops gegangen. Wegen '. $db -> connect_error;
25 27
 	}
26 28
 	
27 29
 	$result = $db->query("SELECT * FROM accounts WHERE id='1'");
28 30
 	
29
-	if ($result->num_rows > 0) {
31
+	if ($result->num_rows > 0)
32
+	{
30 33
 		// output data of each row
31
-		while($row = $result->fetch_assoc()) {
34
+		while($row = $result->fetch_assoc())
35
+		{
32 36
 			$access_token = $row["access_token"];
33 37
 		}
34 38
 	}
@@ -66,7 +70,8 @@  discard block
 block discarded – undo
66 70
 		}
67 71
 	}
68 72
 
69
-	if(isset($_GET['lastPostId'])) {
73
+	if(isset($_GET['lastPostId']))
74
+	{
70 75
 	
71 76
 		$lastPostId = $_GET['lastPostId'];
72 77
 		
@@ -76,9 +81,11 @@  discard block
 block discarded – undo
76 81
 		?>
77 82
 		<div class="nextPosts">
78 83
 		<?php
79
-		for($i = 0; $i<$loops; $i++) {
84
+		for($i = 0; $i<$loops; $i++)
85
+		{
80 86
 		
81
-			if(isset($posts[$i])) {
87
+			if(isset($posts[$i]))
88
+			{
82 89
 				$lastPostId = $posts[$i]['post_id'];
83 90
 
84 91
 				
@@ -94,7 +101,8 @@  discard block
 block discarded – undo
94 101
 							$timediff_inHours = (string)$timediff->format('%h');
95 102
 							$timediff_inDays = (string)$timediff->format('%d');
96 103
 							$timediff_inMonth = (string)$timediff->format('%m');
97
-							if($timediff_inMonth!=0) {
104
+							if($timediff_inMonth!=0)
105
+							{
98 106
 									$timediff = $timediff_inMonth . "m";
99 107
 							}
100 108
 							else
@@ -127,10 +135,12 @@  discard block
 block discarded – undo
127 135
 				<article class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
128 136
 					<content>
129 137
 						<?php 
130
-						if(isset($posts[$i]["image_url"])) {
138
+						if(isset($posts[$i]["image_url"]))
139
+						{
131 140
 							echo '<img src="' . $posts[$i]["image_url"] . '">';
132 141
 						}
133
-						else {
142
+						else
143
+						{
134 144
 							echo nl2br($posts[$i]["message"]);
135 145
 						}
136 146
 						?>
@@ -156,13 +166,19 @@  discard block
 block discarded – undo
156 166
 									</span> 
157 167
 								</td>
158 168
 								<td class="comments">
159
-									<?php if($showCommentIcon) {?>
169
+									<?php if($showCommentIcon)
170
+{
171
+?>
160 172
 									<span data-tooltip="Comments">
161 173
 										<a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>">
162 174
 											<i class="fa fa-commenting-o"></i>
163
-											<?php if(array_key_exists("child_count", $posts[$i])) {
175
+											<?php if(array_key_exists("child_count", $posts[$i]))
176
+{
164 177
 														echo $posts[$i]["child_count"];
165
-													} else echo "0";
178
+													}
179
+													else {
180
+														echo "0";
181
+													}
166 182
 											?>
167 183
 											</a>
168 184
 									</span>
Please login to merge, or discard this patch.