@@ -13,7 +13,7 @@ |
||
13 | 13 | public $varsToDump; |
14 | 14 | |
15 | 15 | function __construct($msg = 'not Set', $varsToDump = 'not Set', $view = 'not Set', $actions = 'not Set', $accountId = 'not Set', $isVerified = 'not Set', $isTokenFresh = 'not Set', $page = 'not Set', $referrer = 'not Set') |
16 | - { |
|
16 | + { |
|
17 | 17 | $this->view = $view; |
18 | 18 | $this->actions = $actions; |
19 | 19 | $this->accountId = $accountId; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | if($location->getLat() == $lat && $location->getLng() == $lng && $location->getCityName() == $name) |
87 | 87 | { |
88 | 88 | return TRUE; |
89 | - } |
|
89 | + } |
|
90 | 90 | else |
91 | 91 | { |
92 | 92 | return FALSE; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if(substr($_GET['city'], 0, 1) === '#') |
100 | 100 | { |
101 | 101 | return htmlspecialchars($_GET['city']) . " " . $this->location->cityName; |
102 | - } |
|
102 | + } |
|
103 | 103 | else |
104 | 104 | { |
105 | 105 | $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w'; |
@@ -272,7 +272,8 @@ discard block |
||
272 | 272 | if(isset($_POST['color'])) |
273 | 273 | { |
274 | 274 | $color = $_POST['color']; |
275 | - switch ($color) { |
|
275 | + switch ($color) |
|
276 | + { |
|
276 | 277 | case '8ABDB0': |
277 | 278 | $color = '8ABDB0'; |
278 | 279 | break; |
@@ -369,7 +370,8 @@ discard block |
||
369 | 370 | expiration_date='" . $expiration_date . "' |
370 | 371 | WHERE device_uid='" . $device_uid . "'"); |
371 | 372 | |
372 | - if($result === false){ |
|
373 | + if($result === false) |
|
374 | + { |
|
373 | 375 | error_log("Adding account failed: (" . $db->errno . ") " . $db->error); |
374 | 376 | } |
375 | 377 | } |
@@ -449,14 +451,16 @@ discard block |
||
449 | 451 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
450 | 452 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
451 | 453 | |
452 | - if($result === false){ |
|
454 | + if($result === false) |
|
455 | + { |
|
453 | 456 | $error = db_error(); |
454 | 457 | echo $error; |
455 | 458 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
456 | 459 | } |
457 | 460 | } |
458 | 461 | |
459 | - function registerAccount($location) { |
|
462 | + function registerAccount($location) |
|
463 | + { |
|
460 | 464 | $accountCreator = new CreateUser(); |
461 | 465 | $accountCreator->setLocation($location); |
462 | 466 | $data = $accountCreator->execute(); |
@@ -481,7 +485,8 @@ discard block |
||
481 | 485 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
482 | 486 | |
483 | 487 | $success = TRUE; |
484 | - if($result === false){ |
|
488 | + if($result === false) |
|
489 | + { |
|
485 | 490 | $error = $db->error(); |
486 | 491 | echo $error; |
487 | 492 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
@@ -34,7 +34,8 @@ discard block |
||
34 | 34 | * Compute HTML Code |
35 | 35 | */ |
36 | 36 | function jodelToHtml($post) |
37 | - { //ToDO |
|
37 | + { |
|
38 | +//ToDO |
|
38 | 39 | //Replace # with link |
39 | 40 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
40 | 41 | |
@@ -90,7 +91,8 @@ discard block |
||
90 | 91 | |
91 | 92 | echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
92 | 93 | } |
93 | - else { |
|
94 | + else |
|
95 | + { |
|
94 | 96 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
95 | 97 | } |
96 | 98 | ?> |
@@ -116,15 +118,20 @@ discard block |
||
116 | 118 | <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
117 | 119 | </span> |
118 | 120 | </span> |
119 | - <?php if(!$this->isDetailedView) {?> |
|
121 | + <?php if(!$this->isDetailedView) |
|
122 | +{ |
|
123 | +?> |
|
120 | 124 | <span class="comments"> |
121 | 125 | <span data-tooltip="Comments"> |
122 | 126 | <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>"> |
123 | 127 | <i class="fa fa-commenting-o"></i> |
124 | 128 | <?php if(array_key_exists("child_count", $post)) |
125 | - { |
|
129 | +{ |
|
126 | 130 | echo $post["child_count"]; |
127 | - } else echo "0"; |
|
131 | + } |
|
132 | + else { |
|
133 | + echo "0"; |
|
134 | + } |
|
128 | 135 | ?> |
129 | 136 | </a> |
130 | 137 | </span> |
@@ -306,7 +313,7 @@ discard block |
||
306 | 313 | $data = $accountCreator->execute(); |
307 | 314 | } |
308 | 315 | if(array_key_exists('recent', $data) && array_key_exists(0, $data['recent'])) |
309 | - { |
|
316 | + { |
|
310 | 317 | return $data['recent']; |
311 | 318 | } |
312 | 319 | else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
@@ -96,7 +96,9 @@ discard block |
||
96 | 96 | } ?> |
97 | 97 | </content> |
98 | 98 | |
99 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
99 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
100 | +{ |
|
101 | +?> |
|
100 | 102 | <p id="loading"> |
101 | 103 | Loading… |
102 | 104 | </p> |
@@ -104,12 +106,20 @@ discard block |
||
104 | 106 | </article> |
105 | 107 | |
106 | 108 | <aside class="topSidebar col-sm-4 sidebar-outer"> |
107 | - <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>"> |
|
109 | + <div class="fixed<?php if(!$view->isDetailedView) |
|
110 | +{ |
|
111 | + echo(' hide-mobile'); |
|
112 | +} |
|
113 | +?>"> |
|
108 | 114 | <article> |
109 | 115 | <div> |
110 | 116 | <h2>Position / Hashtag</h2> |
111 | 117 | <form action="index.php" method="get"> |
112 | - <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
118 | + <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
119 | +{ |
|
120 | + echo $newPositionStatus; |
|
121 | +} |
|
122 | +?>" required> |
|
113 | 123 | <label>try: #jhj</label><br> |
114 | 124 | <input type="submit" value="Set Location" /> |
115 | 125 | </form> |
@@ -126,7 +136,7 @@ discard block |
||
126 | 136 | <article> |
127 | 137 | <div> |
128 | 138 | <?php if(!$jodelAccountForView->isAccountVerified()) |
129 | - { |
|
139 | +{ |
|
130 | 140 | ?> |
131 | 141 | <h2>New Jodel</h2> |
132 | 142 | |
@@ -138,7 +148,9 @@ discard block |
||
138 | 148 | { |
139 | 149 | |
140 | 150 | |
141 | - if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
|
151 | + if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) |
|
152 | + { |
|
153 | +?> |
|
142 | 154 | <h2>Comment on Jodel</h2> |
143 | 155 | <form method="POST"> |
144 | 156 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
@@ -146,7 +158,10 @@ discard block |
||
146 | 158 | <br /> |
147 | 159 | <input type="submit" value="SEND" /> |
148 | 160 | </form> |
149 | - <?php } else { ?> |
|
161 | + <?php } |
|
162 | +else |
|
163 | +{ |
|
164 | +?> |
|
150 | 165 | <h2>New Jodel</h2> |
151 | 166 | <form enctype="multipart/form-data" method="POST"> |
152 | 167 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
@@ -61,7 +61,9 @@ discard block |
||
61 | 61 | { |
62 | 62 | window.history.back(); |
63 | 63 | } |
64 | - <?php if(isset($includeEmojiAndAjax)){ ?> |
|
64 | + <?php if(isset($includeEmojiAndAjax)) |
|
65 | +{ |
|
66 | +?> |
|
65 | 67 | |
66 | 68 | function vote(postId, vote, obj) |
67 | 69 | { |
@@ -91,7 +93,9 @@ discard block |
||
91 | 93 | |
92 | 94 | $(document).ready(function() |
93 | 95 | { |
94 | - <?php if(isset($errorMsg)) { ?> |
|
96 | + <?php if(isset($errorMsg)) |
|
97 | +{ |
|
98 | +?> |
|
95 | 99 | //Error Msg |
96 | 100 | if('<?php echo $errorMsg;?>' != '') |
97 | 101 | { |
@@ -155,7 +159,9 @@ discard block |
||
155 | 159 | return {"lastPostId":lastPostId, "old_lastPostId":old_lastPostId}; |
156 | 160 | } |
157 | 161 | |
158 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
162 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
163 | +{ |
|
164 | +?> |
|
159 | 165 | |
160 | 166 | if(window.location.hash) |
161 | 167 | { |
@@ -114,7 +114,7 @@ |
||
114 | 114 | { |
115 | 115 | $response = array("success" => $success, "message" => $message, "captcha" => $captcha, "deviceUid" => $deviceUid); |
116 | 116 | } |
117 | - else |
|
117 | + else |
|
118 | 118 | { |
119 | 119 | $response = array("success" => $success, "message" => $message); |
120 | 120 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | function isUserVoter() |
76 | 76 | { |
77 | 77 | if(isset($_COOKIE['JodelVoterPassword'])) |
78 | - { |
|
78 | + { |
|
79 | 79 | $db = new DatabaseConnect(); |
80 | 80 | $result = $db->query("SELECT id FROM users WHERE user_token = '" . $_COOKIE['JodelVoterPassword'] . "'"); |
81 | 81 | if($result->num_rows == 0) |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | if(configPropertyExists($config, 'karmaDeviceUid')) |
150 | - { |
|
150 | + { |
|
151 | 151 | $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
152 | 152 | } |
153 | 153 | else |
@@ -220,7 +220,8 @@ discard block |
||
220 | 220 | |
221 | 221 | if(isset($_GET['view'])) |
222 | 222 | { |
223 | - switch ($_GET['view']) { |
|
223 | + switch ($_GET['view']) |
|
224 | + { |
|
224 | 225 | case 'discussed': |
225 | 226 | $view = 'discussed'; |
226 | 227 | break; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | abstract class AbstractRequest |
4 | -{ |
|
4 | +{ |
|
5 | 5 | const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
6 | 6 | const APIURL = 'https://api.go-tellm.com/api'; |
7 | 7 | const SECRET = 'cYjTAwjdJyiuXAyrMhkCDiVZhshhLhotNotLiPVu'; |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | $this->payLoad = $this->getPayload(); |
22 | 22 | $device_uid = ''; |
23 | - if(isset($this->payLoad['device_uid'])) { |
|
23 | + if(isset($this->payLoad['device_uid'])) |
|
24 | + { |
|
24 | 25 | $device_uid = $this->payLoad['device_uid']; |
25 | 26 | } |
26 | 27 | |
@@ -29,7 +30,8 @@ discard block |
||
29 | 30 | $header = $this->getSignHeaders(); |
30 | 31 | $url = $this->getFullUrl(); |
31 | 32 | |
32 | - if ($this->getAccessToken()) { |
|
33 | + if ($this->getAccessToken()) |
|
34 | + { |
|
33 | 35 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
34 | 36 | } |
35 | 37 | //Comment out to debug the Request: |
@@ -52,7 +54,8 @@ discard block |
||
52 | 54 | 'proxy' => '186.103.169.165:8080', |
53 | 55 | );*/ |
54 | 56 | |
55 | - switch ($this->getMethod()) { |
|
57 | + switch ($this->getMethod()) |
|
58 | + { |
|
56 | 59 | case 'POST': |
57 | 60 | $result = Requests::post($url, $header, $this->payLoad); |
58 | 61 | break; |
@@ -73,7 +76,8 @@ discard block |
||
73 | 76 | |
74 | 77 | http_response_code($result->status_code); |
75 | 78 | |
76 | - switch ($result->status_code) { |
|
79 | + switch ($result->status_code) |
|
80 | + { |
|
77 | 81 | case 200: |
78 | 82 | $result = json_decode($result->body, true); |
79 | 83 | break; |
@@ -151,10 +155,12 @@ discard block |
||
151 | 155 | */ |
152 | 156 | private function getSignHeaders() |
153 | 157 | { |
154 | - if($this->getAccessToken() == null) { |
|
158 | + if($this->getAccessToken() == null) |
|
159 | + { |
|
155 | 160 | $payload_accessToken = ""; |
156 | 161 | } |
157 | - else { |
|
162 | + else |
|
163 | + { |
|
158 | 164 | $payload_accessToken = $this->getAccessToken(); |
159 | 165 | } |
160 | 166 |
@@ -13,9 +13,12 @@ |
||
13 | 13 | } |
14 | 14 | $db = new DatabaseConnect(); |
15 | 15 | |
16 | -if($db->connect_errno == 1203) // 1203 == ER_TOO_MANY_USER_CONNECTIONS (mysqld_error.h) |
|
16 | +if($db->connect_errno == 1203) |
|
17 | +{ |
|
18 | + // 1203 == ER_TOO_MANY_USER_CONNECTIONS (mysqld_error.h) |
|
17 | 19 | { |
18 | 20 | error_log('ER_TOO_MANY_USER_CONNECTIONS'); |
21 | +} |
|
19 | 22 | sleep(1); |
20 | 23 | header('location: '.$_SERVER['PHP_SELF']); |
21 | 24 | } |