@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $accessToken = $row["access_token"]; |
23 | 23 | } |
24 | - } |
|
25 | - else |
|
24 | + } else |
|
26 | 25 | { |
27 | 26 | echo "Error: 0 results"; |
28 | 27 | } |
@@ -38,8 +37,7 @@ discard block |
||
38 | 37 | if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS') |
39 | 38 | { |
40 | 39 | $newPostionStatus = "0 results"; |
41 | - } |
|
42 | - else |
|
40 | + } else |
|
43 | 41 | { |
44 | 42 | $location = new Location(); |
45 | 43 | $location->setLat(json_decode($result->body, true)['results']['0']['geometry']['location']['lat']); |
@@ -56,8 +54,7 @@ discard block |
||
56 | 54 | if(isset($_GET['vote']) && isset($_GET['postID'])) { |
57 | 55 | if($_GET['vote'] == "up") { |
58 | 56 | $accountCreator = new Upvote(); |
59 | - } |
|
60 | - else if($_GET['vote'] == "down") { |
|
57 | + } else if($_GET['vote'] == "down") { |
|
61 | 58 | $accountCreator = new Downvote(); |
62 | 59 | } |
63 | 60 | $accountCreator->setAccessToken($accessToken); |
@@ -113,7 +110,10 @@ discard block |
||
113 | 110 | <a href="index.php"> |
114 | 111 | <h1> |
115 | 112 | Jodel WebClient |
116 | - <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?> |
|
113 | + <?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { |
|
114 | + echo '<i class="fa fa-refresh fa-1x"></i>'; |
|
115 | +} |
|
116 | +?> |
|
117 | 117 | </h1> |
118 | 118 | </a> |
119 | 119 | <div class="clear"></div> |
@@ -151,8 +151,9 @@ discard block |
||
151 | 151 | array_push($posts, $child); |
152 | 152 | } |
153 | 153 | $loops = $data['child_count'] + 1; |
154 | + } else { |
|
155 | + $loops = 1; |
|
154 | 156 | } |
155 | - else $loops = 1; |
|
156 | 157 | $showCommentIcon = FALSE; |
157 | 158 | } |
158 | 159 | //Get Posts |
@@ -161,15 +162,13 @@ discard block |
||
161 | 162 | { |
162 | 163 | $commentView = true; |
163 | 164 | $url = "/v2/posts/location/discussed/"; |
164 | - } |
|
165 | - else |
|
165 | + } else |
|
166 | 166 | { |
167 | 167 | if(isset($_GET['upVoteView'])) |
168 | 168 | { |
169 | 169 | $upVoteView = true; |
170 | 170 | $url = "/v2/posts/location/popular/"; |
171 | - } |
|
172 | - else |
|
171 | + } else |
|
173 | 172 | { |
174 | 173 | $timeView = true; |
175 | 174 | $url = "/v2/posts"; |
@@ -202,26 +201,22 @@ discard block |
||
202 | 201 | $timediff_inMonth = (string)$timediff->format('%m'); |
203 | 202 | if($timediff_inMonth!=0) { |
204 | 203 | $timediff = $timediff_inMonth . "m"; |
205 | - } |
|
206 | - else |
|
204 | + } else |
|
207 | 205 | { |
208 | 206 | if($timediff_inDays!=0) |
209 | 207 | { |
210 | 208 | $timediff = $timediff_inDays . "d"; |
211 | - } |
|
212 | - else |
|
209 | + } else |
|
213 | 210 | { |
214 | 211 | if($timediff_inHours!=0) |
215 | 212 | { |
216 | 213 | $timediff = $timediff_inHours . "h"; |
217 | - } |
|
218 | - else |
|
214 | + } else |
|
219 | 215 | { |
220 | 216 | if($timediff_inMinutes!=0) |
221 | 217 | { |
222 | 218 | $timediff = $timediff_inMinutes . "m"; |
223 | - } |
|
224 | - else |
|
219 | + } else |
|
225 | 220 | { |
226 | 221 | $timediff = $timediff_inSeconds . "s"; |
227 | 222 | } |
@@ -235,8 +230,7 @@ discard block |
||
235 | 230 | <?php |
236 | 231 | if(isset($posts[$i]["image_url"])) { |
237 | 232 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
238 | - } |
|
239 | - else { |
|
233 | + } else { |
|
240 | 234 | echo nl2br($posts[$i]["message"]); |
241 | 235 | } |
242 | 236 | ?> |
@@ -268,7 +262,9 @@ discard block |
||
268 | 262 | <i class="fa fa-commenting-o"></i> |
269 | 263 | <?php if(array_key_exists("child_count", $posts[$i])) { |
270 | 264 | echo $posts[$i]["child_count"]; |
271 | - } else echo "0"; |
|
265 | + } else { |
|
266 | + echo "0"; |
|
267 | + } |
|
272 | 268 | ?> |
273 | 269 | </a> |
274 | 270 | </span> |
@@ -298,9 +294,18 @@ discard block |
||
298 | 294 | </p> |
299 | 295 | <?php } ?> |
300 | 296 | <nav id="sortJodelBy"> |
301 | - <a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
302 | - <a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
303 | - <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
297 | + <a href="index.php" <?php if(isset($timeView)) { |
|
298 | + echo 'class="active"'; |
|
299 | +} |
|
300 | +?>><i class="fa fa-clock-o fa-3x"></i></a> |
|
301 | + <a href="index.php?commentView=true" <?php if(isset($commentView)) { |
|
302 | + echo 'class="active"'; |
|
303 | +} |
|
304 | +?>><i class="fa fa-commenting-o fa-3x"></i></a> |
|
305 | + <a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) { |
|
306 | + echo 'class="active"'; |
|
307 | +} |
|
308 | +?>><i class="fa fa-angle-up fa-3x"></i></a> |
|
304 | 309 | </nav> |
305 | 310 | </div> |
306 | 311 | |
@@ -308,7 +313,12 @@ discard block |
||
308 | 313 | <article> |
309 | 314 | <h3>Position</h3> |
310 | 315 | <form method="get"> |
311 | - <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required> |
|
316 | + <input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) { |
|
317 | + echo $newPositionStatus; |
|
318 | +} else { |
|
319 | + echo $posts[0]["location"]["name"]; |
|
320 | +} |
|
321 | +?>" required> |
|
312 | 322 | |
313 | 323 | <input type="submit" value="Set Location" /> |
314 | 324 | </form> |
@@ -51,15 +51,13 @@ discard block |
||
51 | 51 | { |
52 | 52 | $commentView = true; |
53 | 53 | $url = "/posts/location/discussed/"; |
54 | - } |
|
55 | - else |
|
54 | + } else |
|
56 | 55 | { |
57 | 56 | if(isset($_GET['upVoteView'])) |
58 | 57 | { |
59 | 58 | $upVoteView = true; |
60 | 59 | $url = "/posts/location/popular/"; |
61 | - } |
|
62 | - else |
|
60 | + } else |
|
63 | 61 | { |
64 | 62 | $timeView = true; |
65 | 63 | $url = "/v2/posts"; |
@@ -96,26 +94,22 @@ discard block |
||
96 | 94 | $timediff_inMonth = (string)$timediff->format('%m'); |
97 | 95 | if($timediff_inMonth!=0) { |
98 | 96 | $timediff = $timediff_inMonth . "m"; |
99 | - } |
|
100 | - else |
|
97 | + } else |
|
101 | 98 | { |
102 | 99 | if($timediff_inDays!=0) |
103 | 100 | { |
104 | 101 | $timediff = $timediff_inDays . "d"; |
105 | - } |
|
106 | - else |
|
102 | + } else |
|
107 | 103 | { |
108 | 104 | if($timediff_inHours!=0) |
109 | 105 | { |
110 | 106 | $timediff = $timediff_inHours . "h"; |
111 | - } |
|
112 | - else |
|
107 | + } else |
|
113 | 108 | { |
114 | 109 | if($timediff_inMinutes!=0) |
115 | 110 | { |
116 | 111 | $timediff = $timediff_inMinutes . "m"; |
117 | - } |
|
118 | - else |
|
112 | + } else |
|
119 | 113 | { |
120 | 114 | $timediff = $timediff_inSeconds . "s"; |
121 | 115 | } |
@@ -129,8 +123,7 @@ discard block |
||
129 | 123 | <?php |
130 | 124 | if(isset($posts[$i]["image_url"])) { |
131 | 125 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
132 | - } |
|
133 | - else { |
|
126 | + } else { |
|
134 | 127 | echo nl2br($posts[$i]["message"]); |
135 | 128 | } |
136 | 129 | ?> |
@@ -162,7 +155,9 @@ discard block |
||
162 | 155 | <i class="fa fa-commenting-o"></i> |
163 | 156 | <?php if(array_key_exists("child_count", $posts[$i])) { |
164 | 157 | echo $posts[$i]["child_count"]; |
165 | - } else echo "0"; |
|
158 | + } else { |
|
159 | + echo "0"; |
|
160 | + } |
|
166 | 161 | ?> |
167 | 162 | </a> |
168 | 163 | </span> |
@@ -92,8 +92,7 @@ |
||
92 | 92 | $payload_accessToken; |
93 | 93 | if($this->getAccessToken() == null) { |
94 | 94 | $payload_accessToken = ""; |
95 | - } |
|
96 | - else { |
|
95 | + } else { |
|
97 | 96 | $payload_accessToken = $this->getAccessToken(); |
98 | 97 | } |
99 | 98 |
@@ -57,16 +57,13 @@ |
||
57 | 57 | public function __construct($args = null) { |
58 | 58 | if (is_string($args)) { |
59 | 59 | $this->proxy = $args; |
60 | - } |
|
61 | - elseif (is_array($args)) { |
|
60 | + } elseif (is_array($args)) { |
|
62 | 61 | if (count($args) == 1) { |
63 | 62 | list($this->proxy) = $args; |
64 | - } |
|
65 | - elseif (count($args) == 3) { |
|
63 | + } elseif (count($args) == 3) { |
|
66 | 64 | list($this->proxy, $this->user, $this->pass) = $args; |
67 | 65 | $this->use_authentication = true; |
68 | - } |
|
69 | - else { |
|
66 | + } else { |
|
70 | 67 | throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); |
71 | 68 | } |
72 | 69 | } |
@@ -149,8 +149,7 @@ discard block |
||
149 | 149 | if ($options['verify'] === false) { |
150 | 150 | curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, 0); |
151 | 151 | curl_setopt($this->handle, CURLOPT_SSL_VERIFYPEER, 0); |
152 | - } |
|
153 | - elseif (is_string($options['verify'])) { |
|
152 | + } elseif (is_string($options['verify'])) { |
|
154 | 153 | curl_setopt($this->handle, CURLOPT_CAINFO, $options['verify']); |
155 | 154 | } |
156 | 155 | } |
@@ -246,8 +245,7 @@ discard block |
||
246 | 245 | ); |
247 | 246 | $responses[$key] = $exception; |
248 | 247 | $options['hooks']->dispatch('transport.internal.parse_error', array(&$responses[$key], $requests[$key])); |
249 | - } |
|
250 | - else { |
|
248 | + } else { |
|
251 | 249 | $responses[$key] = $subrequests[$key]->process_response($subrequests[$key]->response_data, $options); |
252 | 250 | |
253 | 251 | $options['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$key], $requests[$key])); |
@@ -322,8 +320,7 @@ discard block |
||
322 | 320 | if ($data_format === 'query') { |
323 | 321 | $url = self::format_get($url, $data); |
324 | 322 | $data = ''; |
325 | - } |
|
326 | - elseif (!is_string($data)) { |
|
323 | + } elseif (!is_string($data)) { |
|
327 | 324 | $data = http_build_query($data, null, '&'); |
328 | 325 | } |
329 | 326 | } |
@@ -361,15 +358,13 @@ discard block |
||
361 | 358 | |
362 | 359 | if (is_int($timeout) || $this->version < self::CURL_7_16_2) { |
363 | 360 | curl_setopt($this->handle, CURLOPT_TIMEOUT, ceil($timeout)); |
364 | - } |
|
365 | - else { |
|
361 | + } else { |
|
366 | 362 | curl_setopt($this->handle, CURLOPT_TIMEOUT_MS, round($timeout * 1000)); |
367 | 363 | } |
368 | 364 | |
369 | 365 | if (is_int($options['connect_timeout']) || $this->version < self::CURL_7_16_2) { |
370 | 366 | curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT, ceil($options['connect_timeout'])); |
371 | - } |
|
372 | - else { |
|
367 | + } else { |
|
373 | 368 | curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT_MS, round($options['connect_timeout'] * 1000)); |
374 | 369 | } |
375 | 370 | curl_setopt($this->handle, CURLOPT_URL, $url); |
@@ -380,8 +375,7 @@ discard block |
||
380 | 375 | } |
381 | 376 | if ($options['protocol_version'] === 1.1) { |
382 | 377 | curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
383 | - } |
|
384 | - else { |
|
378 | + } else { |
|
385 | 379 | curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
386 | 380 | } |
387 | 381 | |
@@ -408,8 +402,7 @@ discard block |
||
408 | 402 | if ($options['filename'] !== false) { |
409 | 403 | fclose($this->stream_handle); |
410 | 404 | $this->headers = trim($this->headers); |
411 | - } |
|
412 | - else { |
|
405 | + } else { |
|
413 | 406 | $this->headers .= $response; |
414 | 407 | } |
415 | 408 | |
@@ -479,8 +472,7 @@ discard block |
||
479 | 472 | |
480 | 473 | if ($this->stream_handle) { |
481 | 474 | fwrite($this->stream_handle, $data); |
482 | - } |
|
483 | - else { |
|
475 | + } else { |
|
484 | 476 | $this->response_data .= $data; |
485 | 477 | } |
486 | 478 | |
@@ -500,8 +492,7 @@ discard block |
||
500 | 492 | $url_parts = parse_url($url); |
501 | 493 | if (empty($url_parts['query'])) { |
502 | 494 | $query = $url_parts['query'] = ''; |
503 | - } |
|
504 | - else { |
|
495 | + } else { |
|
505 | 496 | $query = $url_parts['query']; |
506 | 497 | } |
507 | 498 | |
@@ -510,8 +501,7 @@ discard block |
||
510 | 501 | |
511 | 502 | if (empty($url_parts['query'])) { |
512 | 503 | $url .= '?' . $query; |
513 | - } |
|
514 | - else { |
|
504 | + } else { |
|
515 | 505 | $url = str_replace($url_parts['query'], $query, $url); |
516 | 506 | } |
517 | 507 | } |
@@ -92,8 +92,7 @@ discard block |
||
92 | 92 | if (isset($options['verify'])) { |
93 | 93 | if ($options['verify'] === false) { |
94 | 94 | $context_options['verify_peer'] = false; |
95 | - } |
|
96 | - elseif (is_string($options['verify'])) { |
|
95 | + } elseif (is_string($options['verify'])) { |
|
97 | 96 | $context_options['cafile'] = $options['verify']; |
98 | 97 | } |
99 | 98 | } |
@@ -104,8 +103,7 @@ discard block |
||
104 | 103 | } |
105 | 104 | |
106 | 105 | stream_context_set_option($context, array('ssl' => $context_options)); |
107 | - } |
|
108 | - else { |
|
106 | + } else { |
|
109 | 107 | $remote_socket = 'tcp://' . $host; |
110 | 108 | } |
111 | 109 | |
@@ -142,8 +140,7 @@ discard block |
||
142 | 140 | if ($data_format === 'query') { |
143 | 141 | $path = self::format_get($url_parts, $data); |
144 | 142 | $data = ''; |
145 | - } |
|
146 | - else { |
|
143 | + } else { |
|
147 | 144 | $path = self::format_get($url_parts, array()); |
148 | 145 | } |
149 | 146 | |
@@ -155,8 +152,7 @@ discard block |
||
155 | 152 | if ($options['type'] !== Requests::TRACE) { |
156 | 153 | if (is_array($data)) { |
157 | 154 | $request_body = http_build_query($data, null, '&'); |
158 | - } |
|
159 | - else { |
|
155 | + } else { |
|
160 | 156 | $request_body = $data; |
161 | 157 | } |
162 | 158 | |
@@ -222,8 +218,7 @@ discard block |
||
222 | 218 | $timeout_sec = (int) floor($options['timeout']); |
223 | 219 | if ($timeout_sec == $options['timeout']) { |
224 | 220 | $timeout_msec = 0; |
225 | - } |
|
226 | - else { |
|
221 | + } else { |
|
227 | 222 | $timeout_msec = self::SECOND_IN_MICROSECONDS * $options['timeout'] % self::SECOND_IN_MICROSECONDS; |
228 | 223 | } |
229 | 224 | stream_set_timeout($socket, $timeout_sec, $timeout_msec); |
@@ -271,8 +266,7 @@ discard block |
||
271 | 266 | $size += strlen($block); |
272 | 267 | if ($download) { |
273 | 268 | fwrite($download, $block); |
274 | - } |
|
275 | - else { |
|
269 | + } else { |
|
276 | 270 | $body .= $block; |
277 | 271 | } |
278 | 272 | } |
@@ -281,8 +275,7 @@ discard block |
||
281 | 275 | |
282 | 276 | if ($download) { |
283 | 277 | fclose($download); |
284 | - } |
|
285 | - else { |
|
278 | + } else { |
|
286 | 279 | $this->headers .= "\r\n\r\n" . $body; |
287 | 280 | } |
288 | 281 | fclose($socket); |
@@ -307,8 +300,7 @@ discard block |
||
307 | 300 | $responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']); |
308 | 301 | |
309 | 302 | $request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request)); |
310 | - } |
|
311 | - catch (Requests_Exception $e) { |
|
303 | + } catch (Requests_Exception $e) { |
|
312 | 304 | $responses[$id] = $e; |
313 | 305 | } |
314 | 306 | |
@@ -359,12 +351,10 @@ discard block |
||
359 | 351 | if (isset($url_parts['path'])) { |
360 | 352 | if (isset($url_parts['query'])) { |
361 | 353 | $get = $url_parts['path'] . '?' . $url_parts['query']; |
362 | - } |
|
363 | - else { |
|
354 | + } else { |
|
364 | 355 | $get = $url_parts['path']; |
365 | 356 | } |
366 | - } |
|
367 | - else { |
|
357 | + } else { |
|
368 | 358 | $get = '/'; |
369 | 359 | } |
370 | 360 | return $get; |
@@ -249,8 +249,7 @@ |
||
249 | 249 | if (is_array($this->data)) { |
250 | 250 | $request['data'] = $this->data; |
251 | 251 | } |
252 | - } |
|
253 | - elseif (is_array($request['data']) && is_array($this->data)) { |
|
252 | + } elseif (is_array($request['data']) && is_array($this->data)) { |
|
254 | 253 | $request['data'] = array_merge($this->data, $request['data']); |
255 | 254 | } |
256 | 255 |
@@ -106,8 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | if ($ip_parts[1] !== '') { |
108 | 108 | return implode(':', $ip_parts); |
109 | - } |
|
110 | - else { |
|
109 | + } else { |
|
111 | 110 | return $ip_parts[0]; |
112 | 111 | } |
113 | 112 | } |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | $ipv6_part = substr($ip, 0, $pos); |
131 | 130 | $ipv4_part = substr($ip, $pos + 1); |
132 | 131 | return array($ipv6_part, $ipv4_part); |
133 | - } |
|
134 | - else { |
|
132 | + } else { |
|
135 | 133 | return array($ip, ''); |
136 | 134 | } |
137 | 135 | } |
@@ -182,8 +180,7 @@ discard block |
||
182 | 180 | } |
183 | 181 | } |
184 | 182 | return true; |
185 | - } |
|
186 | - else { |
|
183 | + } else { |
|
187 | 184 | return false; |
188 | 185 | } |
189 | 186 | } |
@@ -112,8 +112,7 @@ |
||
112 | 112 | if (!$allow_redirects) { |
113 | 113 | throw new Requests_Exception('Redirection not allowed', 'response.no_redirects', $this); |
114 | 114 | } |
115 | - } |
|
116 | - elseif (!$this->success) { |
|
115 | + } elseif (!$this->success) { |
|
117 | 116 | $exception = Requests_Exception_HTTP::get_class($this->status_code); |
118 | 117 | throw new $exception(null, $this); |
119 | 118 | } |