Completed
Push — master ( 7e6a05...9607b1 )
by mains
02:47
created
index.php 1 patch
Braces   +52 added lines, -17 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@  discard block
 block discarded – undo
35 35
 	//Set View
36 36
 	if(isset($_GET['view']))
37 37
 	{
38
-		switch ($_GET['view']) {
38
+		switch ($_GET['view'])
39
+		{
39 40
 			case 'comment':
40 41
 				$view = 'comment';
41 42
 				break;
@@ -55,7 +56,8 @@  discard block
 block discarded – undo
55 56
 	}
56 57
 	
57 58
 	//Set Location
58
-	if(isset($_GET['city'])) {
59
+	if(isset($_GET['city']))
60
+	{
59 61
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
60 62
 		$result = Requests::post($url);
61 63
 		if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST')
@@ -99,11 +101,14 @@  discard block
 block discarded – undo
99 101
 	}
100 102
 	
101 103
 	//Vote
102
-	if(isset($_GET['vote']) && isset($_GET['postID'])) {
103
-		if($_GET['vote'] == "up") {
104
+	if(isset($_GET['vote']) && isset($_GET['postID']))
105
+	{
106
+		if($_GET['vote'] == "up")
107
+		{
104 108
 			$accountCreator = new Upvote();
105 109
 		}
106
-		else if($_GET['vote'] == "down") {
110
+		else if($_GET['vote'] == "down")
111
+		{
107 112
 			$accountCreator = new Downvote();
108 113
 		}
109 114
 		$accountCreator->setAccessToken($accessToken);
@@ -115,7 +120,8 @@  discard block
 block discarded – undo
115 120
 	
116 121
 	
117 122
 	//SendJodel
118
-	if(isset($_POST['message'])) {
123
+	if(isset($_POST['message']))
124
+	{
119 125
 		$accountCreator = new SendJodel();
120 126
 
121 127
 		if(isset($_POST['ancestor']))
@@ -126,7 +132,8 @@  discard block
 block discarded – undo
126 132
 		if(isset($_POST['color']))
127 133
 		{
128 134
 			$color = $_POST['color'];
129
-			switch ($color) {
135
+			switch ($color)
136
+			{
130 137
 				case '8ABDB0':
131 138
 					$color = '8ABDB0';
132 139
 					break;
@@ -228,7 +235,8 @@  discard block
 block discarded – undo
228 235
 								$data = $accountCreator->execute();
229 236
 								
230 237
 								$posts[0] = $data;
231
-								if(isset($data['children'])) {
238
+								if(isset($data['children']))
239
+								{
232 240
 									foreach($data['children'] as $key => $child)
233 241
 									{
234 242
 										
@@ -250,7 +258,9 @@  discard block
 block discarded – undo
250 258
 									}
251 259
 									$loops = $data['child_count'] + 1;
252 260
 								}
253
-								else $loops = 1;
261
+								else {
262
+									$loops = 1;
263
+								}
254 264
 								$isDetailedView = TRUE;
255 265
 							}
256 266
 							//Get Posts
@@ -291,7 +301,9 @@  discard block
 block discarded – undo
291 301
 
292 302
 					</content>
293 303
 					
294
-					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
304
+					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
305
+{
306
+?>
295 307
 						<p id="loading">
296 308
 							Loading…
297 309
 						</p>
@@ -304,7 +316,11 @@  discard block
 block discarded – undo
304 316
 							<div>
305 317
 								<h2>Position</h2>
306 318
 								<form method="get">
307
-									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
319
+									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
320
+{
321
+	echo $newPositionStatus;
322
+}
323
+?>" required>
308 324
 
309 325
 									<input type="submit" value="Set Location" /> 
310 326
 								</form>
@@ -320,7 +336,9 @@  discard block
 block discarded – undo
320 336
 
321 337
 						<article>
322 338
 							<div>
323
-								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
339
+								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
340
+{
341
+?>
324 342
 								<h2>Comment on Jodel</h2>
325 343
 								<form method="POST">				
326 344
 										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
@@ -328,7 +346,10 @@  discard block
 block discarded – undo
328 346
 									<br />
329 347
 									<input type="submit" value="SEND" /> 
330 348
 								</form>
331
-									<?php } else { ?>
349
+									<?php }
350
+else
351
+{
352
+?>
332 353
 								<h2>New Jodel</h2>
333 354
 								<form method="POST">
334 355
 									<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -360,13 +381,25 @@  discard block
 block discarded – undo
360 381
 				<div class="col-sm-12">
361 382
 					<div class="row">
362 383
 						<div class="col-sm-3">
363
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
384
+							<a href="index.php" <?php if($view=='time')
385
+{
386
+	echo 'class="active"';
387
+}
388
+?>><i class="fa fa-clock-o fa-3x"></i></a>
364 389
 						</div>
365 390
 						<div class="col-sm-3">
366
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
391
+							<a href="index.php?view=comment" <?php if($view=='comment')
392
+{
393
+	echo 'class="active"';
394
+}
395
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
367 396
 						</div>
368 397
 						<div class="col-sm-3">
369
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
398
+							<a href="index.php?view=upVote" <?php if($view=='upVote')
399
+{
400
+	echo 'class="active"';
401
+}
402
+?>><i class="fa fa-angle-up fa-3x"></i></a>
370 403
 						</div>
371 404
 						<div class="col-sm-3">
372 405
 							<nav>
@@ -401,7 +434,9 @@  discard block
 block discarded – undo
401 434
 				    $('html,body').animate({scrollTop: aTag.offset().top-90},'slow');
402 435
 				}
403 436
 
404
-				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
437
+				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
438
+{
439
+?>
405 440
 
406 441
 				
407 442
 
Please login to merge, or discard this patch.
admin.php 1 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/jodel-web.php 1 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.