Completed
Push — master ( f6acde...7e6a05 )
by mains
02:40
created
admin.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	$i = 0;
22 22
 	$result = $db->query("SELECT access_token FROM accounts");
23 23
 
24
-	if ($result->num_rows > 0)
24
+	if($result->num_rows > 0)
25 25
 	{
26 26
 		// output data of each row
27 27
 		while(($row = $result->fetch_assoc()) && $i < $_POST['quantity'])
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
171 171
 								<h2>Comment on Jodel</h2>
172 172
 								<form method="POST">				
173
-										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
173
+										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" />
174 174
 										<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> 
175 175
 									<br />
176 176
 									<input type="submit" value="SEND" /> 
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 				<div class="col-sm-12">
208 208
 					<div class="row">
209 209
 						<div class="col-sm-3">
210
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
210
+							<a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a>
211 211
 						</div>
212 212
 						<div class="col-sm-3">
213
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
213
+							<a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a>
214 214
 						</div>
215 215
 						<div class="col-sm-3">
216
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
216
+							<a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a>
217 217
 						</div>
218 218
 						<div class="col-sm-3">
219 219
 							<nav>
Please login to merge, or discard this patch.
Braces   +34 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,10 +30,12 @@  discard block
 block discarded – undo
30 30
 			var_dump($accessToken);
31 31
 			isTokenFreshByAccessToken($location, $accessToken);
32 32
 
33
-			if($_POST['vote'] == "up") {
33
+			if($_POST['vote'] == "up")
34
+			{
34 35
 				$accountCreator = new Upvote();
35 36
 			}
36
-			else if($_POST['vote'] == "down") {
37
+			else if($_POST['vote'] == "down")
38
+			{
37 39
 				$accountCreator = new Downvote();
38 40
 			}
39 41
 
@@ -151,7 +153,11 @@  discard block
 block discarded – undo
151 153
 							<div>
152 154
 								<h2>Position</h2>
153 155
 								<form method="get">
154
-									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
156
+									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
157
+{
158
+	echo $newPositionStatus;
159
+}
160
+?>" required>
155 161
 
156 162
 									<input type="submit" value="Set Location" /> 
157 163
 								</form>
@@ -167,7 +173,9 @@  discard block
 block discarded – undo
167 173
 
168 174
 						<article>
169 175
 							<div>
170
-								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
176
+								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
177
+{
178
+?>
171 179
 								<h2>Comment on Jodel</h2>
172 180
 								<form method="POST">				
173 181
 										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
@@ -175,7 +183,10 @@  discard block
 block discarded – undo
175 183
 									<br />
176 184
 									<input type="submit" value="SEND" /> 
177 185
 								</form>
178
-									<?php } else { ?>
186
+									<?php }
187
+else
188
+{
189
+?>
179 190
 								<h2>New Jodel</h2>
180 191
 								<form method="POST">
181 192
 									<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -207,13 +218,25 @@  discard block
 block discarded – undo
207 218
 				<div class="col-sm-12">
208 219
 					<div class="row">
209 220
 						<div class="col-sm-3">
210
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
221
+							<a href="index.php" <?php if($view=='time')
222
+{
223
+	echo 'class="active"';
224
+}
225
+?>><i class="fa fa-clock-o fa-3x"></i></a>
211 226
 						</div>
212 227
 						<div class="col-sm-3">
213
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
228
+							<a href="index.php?view=comment" <?php if($view=='comment')
229
+{
230
+	echo 'class="active"';
231
+}
232
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
214 233
 						</div>
215 234
 						<div class="col-sm-3">
216
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
235
+							<a href="index.php?view=upVote" <?php if($view=='upVote')
236
+{
237
+	echo 'class="active"';
238
+}
239
+?>><i class="fa fa-angle-up fa-3x"></i></a>
217 240
 						</div>
218 241
 						<div class="col-sm-3">
219 242
 							<nav>
@@ -256,7 +279,9 @@  discard block
 block discarded – undo
256 279
 				    $('html,body').animate({scrollTop: aTag.offset().top-90},'slow');
257 280
 				}
258 281
 
259
-				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
282
+				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
283
+{
284
+?>
260 285
 
261 286
 				
262 287
 
Please login to merge, or discard this patch.
php/Requests/Downvote.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 class Downvote extends AbstractRequest
3 3
 {
4
-    public $postId;
4
+	public $postId;
5 5
 		
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/posts/' . $this->postId . '/downvote';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
13
-        );
14
-    }
15
-    function getMethod()
16
-    {
17
-        return 'PUT';
18
-    }
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/posts/' . $this->postId . '/downvote';
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13
+		);
14
+	}
15
+	function getMethod()
16
+	{
17
+		return 'PUT';
18
+	}
19 19
 }
20 20
 
Please login to merge, or discard this patch.
php/Requests/Upvote.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 class Upvote extends AbstractRequest {
3 3
 		
4
-    public $postId;
4
+	public $postId;
5 5
 
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/posts/' . $this->postId . '/upvote';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/posts/' . $this->postId . '/upvote';
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13 13
 					"reason_code" => -1,
14
-        );
15
-    }
16
-    function getMethod()
17
-    {
18
-        return 'PUT';
19
-    }
14
+		);
15
+	}
16
+	function getMethod()
17
+	{
18
+		return 'PUT';
19
+	}
20 20
 }
21 21
 
Please login to merge, or discard this patch.
php/jodel-web.php 3 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	$db = new DatabaseConnect();  
24 24
 	$result = $db->query("SELECT * FROM accounts WHERE id='1'");
25 25
 	
26
-	if ($result->num_rows > 0)
26
+	if($result->num_rows > 0)
27 27
 	{
28 28
 			// output data of each row
29 29
 			while($row = $result->fetch_assoc()) {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 	if($expiration_date <= time()) {
42 42
 		$accountCreator = new CreateUser();
43
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
43
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
44 44
 		$accountCreator->setDeviceUid($deviceUid);
45 45
 		$accountCreator->setLocation($location);
46 46
 		$data = $accountCreator->execute();
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 									expiration_date='" . $expiration_date . "'
56 56
 								WHERE device_uid='" . $device_uid . "'");
57 57
 
58
-		if($result === false){
58
+		if($result === false) {
59 59
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
60 60
 		}	
61 61
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	$db = new DatabaseConnect();  
69 69
 	$result = $db->query("SELECT * FROM accounts WHERE access_token='" . $accessToken . "'");
70 70
 	
71
-	if ($result->num_rows > 0)
71
+	if($result->num_rows > 0)
72 72
 	{
73 73
 			// output data of each row
74 74
 			while($row = $result->fetch_assoc()) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 	if($expiration_date <= time()) {
87 87
 		$accountCreator = new CreateUser();
88
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
88
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
89 89
 		$accountCreator->setDeviceUid($deviceUid);
90 90
 		$accountCreator->setLocation($location);
91 91
 		$data = $accountCreator->execute();
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 									expiration_date='" . $expiration_date . "'
101 101
 								WHERE device_uid='" . $device_uid . "'");
102 102
 
103
-		if($result === false){
103
+		if($result === false) {
104 104
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
105 105
 		}	
106 106
 	}
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 	$result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type,
139 139
 					expires_in, expiration_date, distinct_id, device_uid, name, lat, lng)
140 140
 					VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type .
141
-					"','" .  $expires_in . "','" . $expiration_date . "','" . $distinct_id .
141
+					"','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id .
142 142
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
143 143
 
144 144
 	$success = TRUE;
145
-	if($result === false){
145
+	if($result === false) {
146 146
 			$error = db_error();
147 147
 			echo $error;
148 148
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -197,25 +197,25 @@  discard block
 block discarded – undo
197 197
 	$timediff_inDays = (string)$timediff->format('%d');
198 198
 	$timediff_inMonth = (string)$timediff->format('%m');
199 199
 
200
-	if($timediff_inMonth!=0)
200
+	if($timediff_inMonth != 0)
201 201
 	{
202 202
 			$timediff = $timediff_inMonth . "m";
203 203
 	}
204 204
 	else
205 205
 	{
206
-		if($timediff_inDays!=0)
206
+		if($timediff_inDays != 0)
207 207
 		{
208 208
 			$timediff = $timediff_inDays . "d";
209 209
 		}
210 210
 		else
211 211
 		{
212
-			if($timediff_inHours!=0)
212
+			if($timediff_inHours != 0)
213 213
 			{
214 214
 				$timediff = $timediff_inHours . "h";
215 215
 			}
216 216
 			else
217 217
 			{
218
-				if($timediff_inMinutes!=0)
218
+				if($timediff_inMinutes != 0)
219 219
 				{
220 220
 					$timediff = $timediff_inMinutes . "m";
221 221
 				}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
 
231 231
 	?>
232
-	<article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;">
232
+	<article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"]; ?>;">
233 233
 		<content>
234 234
 			<?php 
235 235
 			if(isset($post["image_url"])) {
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
 			?>
242 242
 		</content>
243 243
 		<aside>
244
-			<a href="index.php?vote=up&postID=<?php echo $post["post_id"];?>">
244
+			<a href="index.php?vote=up&postID=<?php echo $post["post_id"]; ?>">
245 245
 				<i class="fa fa-angle-up fa-3x"></i>
246 246
 			</a>	
247 247
 				<br />
248
-			<?php echo $post["vote_count"];?><br />
249
-			<a href="index.php?vote=down&postID=<?php echo $post["post_id"];?>">
248
+			<?php echo $post["vote_count"]; ?><br />
249
+			<a href="index.php?vote=down&postID=<?php echo $post["post_id"]; ?>">
250 250
 				<i class="fa fa-angle-down fa-3x"></i>
251 251
 			</a>
252 252
 		</aside>
@@ -257,13 +257,13 @@  discard block
 block discarded – undo
257 257
 					<td class="time">
258 258
 						<span data-tooltip="Time">
259 259
 							<i class="fa fa-clock-o"></i>
260
-							<?php echo $timediff;?>
260
+							<?php echo $timediff; ?>
261 261
 						</span> 
262 262
 					</td>
263 263
 					<td class="comments">
264 264
 						<?php if(!$isDetailedView) {?>
265 265
 						<span data-tooltip="Comments">
266
-							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
266
+							<a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $post["post_id"]; ?>">
267 267
 								<i class="fa fa-commenting-o"></i>
268 268
 								<?php if(array_key_exists("child_count", $post)) {
269 269
 											echo $post["child_count"];
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 									{
293 293
 							  			?>
294 294
 							  			<span data-tooltip="Author">
295
-											<i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> |
295
+											<i class="fa fa-user-o"></i> #<?php echo $post["user_handle"]; ?> |
296 296
 										</span>
297 297
 										<?php
298 298
 									}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 						<span data-tooltip="Distance">
304 304
 							<i class="fa fa-map-marker"></i>
305
-							<?php echo $post["distance"];?> km
305
+							<?php echo $post["distance"]; ?> km
306 306
 						</span>
307 307
 					</td>
308 308
 				</tr>
Please login to merge, or discard this patch.
Braces   +32 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
 	if ($result->num_rows > 0)
27 27
 	{
28 28
 			// output data of each row
29
-			while($row = $result->fetch_assoc()) {
29
+			while($row = $result->fetch_assoc())
30
+			{
30 31
 					//$access_token = $row["access_token"];
31 32
 					$expiration_date = $row["expiration_date"];
32 33
 					$deviceUid = $row["device_uid"];
@@ -38,7 +39,8 @@  discard block
 block discarded – undo
38 39
 			echo '0 results';
39 40
 	}
40 41
 
41
-	if($expiration_date <= time()) {
42
+	if($expiration_date <= time())
43
+	{
42 44
 		$accountCreator = new CreateUser();
43 45
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
44 46
 		$accountCreator->setDeviceUid($deviceUid);
@@ -55,7 +57,8 @@  discard block
 block discarded – undo
55 57
 									expiration_date='" . $expiration_date . "'
56 58
 								WHERE device_uid='" . $device_uid . "'");
57 59
 
58
-		if($result === false){
60
+		if($result === false)
61
+		{
59 62
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
60 63
 		}	
61 64
 	}
@@ -71,7 +74,8 @@  discard block
 block discarded – undo
71 74
 	if ($result->num_rows > 0)
72 75
 	{
73 76
 			// output data of each row
74
-			while($row = $result->fetch_assoc()) {
77
+			while($row = $result->fetch_assoc())
78
+			{
75 79
 					//$access_token = $row["access_token"];
76 80
 					$expiration_date = $row["expiration_date"];
77 81
 					$deviceUid = $row["device_uid"];
@@ -83,7 +87,8 @@  discard block
 block discarded – undo
83 87
 			echo '0 results';
84 88
 	}
85 89
 
86
-	if($expiration_date <= time()) {
90
+	if($expiration_date <= time())
91
+	{
87 92
 		$accountCreator = new CreateUser();
88 93
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
89 94
 		$accountCreator->setDeviceUid($deviceUid);
@@ -100,7 +105,8 @@  discard block
 block discarded – undo
100 105
 									expiration_date='" . $expiration_date . "'
101 106
 								WHERE device_uid='" . $device_uid . "'");
102 107
 
103
-		if($result === false){
108
+		if($result === false)
109
+		{
104 110
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
105 111
 		}	
106 112
 	}
@@ -117,7 +123,8 @@  discard block
 block discarded – undo
117 123
 	return $data["karma"];
118 124
 }
119 125
 
120
-function registerAccount(Location $location) {
126
+function registerAccount(Location $location)
127
+{
121 128
 	$accountCreator = new CreateUser();
122 129
 	$accountCreator->setLocation($location);
123 130
 	$data = $accountCreator->execute();
@@ -142,7 +149,8 @@  discard block
 block discarded – undo
142 149
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
143 150
 
144 151
 	$success = TRUE;
145
-	if($result === false){
152
+	if($result === false)
153
+	{
146 154
 			$error = db_error();
147 155
 			echo $error;
148 156
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -153,7 +161,7 @@  discard block
 block discarded – undo
153 161
 }
154 162
 
155 163
 function getPosts($lastPostId, $accessToken, $url, $version = 'v2')
156
-{	
164
+{
157 165
 	$accountCreator = new GetPosts();
158 166
 	$accountCreator->setLastPostId($lastPostId);
159 167
 	$accountCreator->setAccessToken($accessToken);
@@ -181,7 +189,8 @@  discard block
 block discarded – undo
181 189
 }
182 190
 
183 191
 function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE)
184
-{	//ToDO
192
+{
193
+//ToDO
185 194
 	//Replace # with link
186 195
 	//preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
187 196
 
@@ -232,10 +241,12 @@  discard block
 block discarded – undo
232 241
 	<article id ="postId-<?php echo $post["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $post["color"];?>;">
233 242
 		<content>
234 243
 			<?php 
235
-			if(isset($post["image_url"])) {
244
+			if(isset($post["image_url"]))
245
+			{
236 246
 				echo '<img src="' . $post["image_url"] . '">';
237 247
 			}
238
-			else {
248
+			else
249
+			{
239 250
 				echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post["message"])));
240 251
 			}
241 252
 			?>
@@ -261,13 +272,19 @@  discard block
 block discarded – undo
261 272
 						</span> 
262 273
 					</td>
263 274
 					<td class="comments">
264
-						<?php if(!$isDetailedView) {?>
275
+						<?php if(!$isDetailedView)
276
+{
277
+?>
265 278
 						<span data-tooltip="Comments">
266 279
 							<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $post["post_id"];?>">
267 280
 								<i class="fa fa-commenting-o"></i>
268
-								<?php if(array_key_exists("child_count", $post)) {
281
+								<?php if(array_key_exists("child_count", $post))
282
+{
269 283
 											echo $post["child_count"];
270
-										} else echo "0";
284
+										}
285
+										else {
286
+											echo "0";
287
+										}
271 288
 								?>
272 289
 								</a>
273 290
 						</span>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 									expiration_date='" . $expiration_date . "'
56 56
 								WHERE device_uid='" . $device_uid . "'");
57 57
 
58
-		if($result === false){
58
+		if($result === FALSE){
59 59
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
60 60
 		}	
61 61
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 									expiration_date='" . $expiration_date . "'
101 101
 								WHERE device_uid='" . $device_uid . "'");
102 102
 
103
-		if($result === false){
103
+		if($result === FALSE){
104 104
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
105 105
 		}	
106 106
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 					"','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
143 143
 
144 144
 	$success = TRUE;
145
-	if($result === false){
145
+	if($result === FALSE){
146 146
 			$error = db_error();
147 147
 			echo $error;
148 148
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
Please login to merge, or discard this patch.