@@ -74,7 +74,11 @@ |
||
74 | 74 | |
75 | 75 | <div id="location_mobile" class="hidden-sm-up"> |
76 | 76 | <form method="get"> |
77 | - <input type="text" id="city_mobile" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
|
77 | + <input type="text" id="city_mobile" name="search" placeholder="<?php if(isset($newPositionStatus)) |
|
78 | +{ |
|
79 | + echo $newPositionStatus; |
|
80 | +} |
|
81 | +?>" required> |
|
78 | 82 | |
79 | 83 | <input type="submit" id="submit_mobile" class="fa" value="" /> |
80 | 84 | </form> |
@@ -55,7 +55,8 @@ discard block |
||
55 | 55 | return TRUE; |
56 | 56 | } |
57 | 57 | } |
58 | -function isUserAdmin() { |
|
58 | +function isUserAdmin() |
|
59 | +{ |
|
59 | 60 | global $config; |
60 | 61 | if (isset($_COOKIE['JodelAdminPassword']) && configPropertyExists($config, 'pw') && $config['pw'] == $_COOKIE['JodelAdminPassword']) |
61 | 62 | { |
@@ -106,7 +107,7 @@ discard block |
||
106 | 107 | } |
107 | 108 | |
108 | 109 | if(configPropertyExists($config, 'karmaDeviceUid')) |
109 | - { |
|
110 | + { |
|
110 | 111 | $jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']); |
111 | 112 | } |
112 | 113 | else |
@@ -176,7 +177,8 @@ discard block |
||
176 | 177 | |
177 | 178 | if(isset($_GET['view'])) |
178 | 179 | { |
179 | - switch ($_GET['view']) { |
|
180 | + switch ($_GET['view']) |
|
181 | + { |
|
180 | 182 | case 'discussed': |
181 | 183 | $view = 'discussed'; |
182 | 184 | break; |
@@ -223,7 +225,7 @@ discard block |
||
223 | 225 | { |
224 | 226 | $jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']); |
225 | 227 | if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails'])) |
226 | - { |
|
228 | + { |
|
227 | 229 | header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId'])); |
228 | 230 | } |
229 | 231 | else |
@@ -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 = 'SDydTnTdqqaiAMfneLkqXYxamvNuUYOmkqpdiZTu'; |
@@ -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; |
@@ -70,7 +73,8 @@ discard block |
||
70 | 73 | $result = Requests::put($url, $header, $this->payLoad); |
71 | 74 | break; |
72 | 75 | } |
73 | - switch ($result->status_code) { |
|
76 | + switch ($result->status_code) |
|
77 | + { |
|
74 | 78 | case 200: |
75 | 79 | $result = json_decode($result->body, true); |
76 | 80 | break; |
@@ -127,10 +131,12 @@ discard block |
||
127 | 131 | */ |
128 | 132 | private function getSignHeaders() |
129 | 133 | { |
130 | - if($this->getAccessToken() == null) { |
|
134 | + if($this->getAccessToken() == null) |
|
135 | + { |
|
131 | 136 | $payload_accessToken = ""; |
132 | 137 | } |
133 | - else { |
|
138 | + else |
|
139 | + { |
|
134 | 140 | $payload_accessToken = $this->getAccessToken(); |
135 | 141 | } |
136 | 142 |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | { |
14 | 14 | window.history.back(); |
15 | 15 | } |
16 | - <?php if(isset($includeEmojiAndAjax)){ ?> |
|
16 | + <?php if(isset($includeEmojiAndAjax)) |
|
17 | +{ |
|
18 | +?> |
|
17 | 19 | $(document).ready(function() |
18 | 20 | { |
19 | 21 | //Transform UTF-8 Emoji to img |
@@ -72,7 +74,9 @@ discard block |
||
72 | 74 | return {"lastPostId":lastPostId, "old_lastPostId":old_lastPostId}; |
73 | 75 | } |
74 | 76 | |
75 | - <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
|
77 | + <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) |
|
78 | +{ |
|
79 | +?> |
|
76 | 80 | |
77 | 81 | if(window.location.hash) |
78 | 82 | { |
@@ -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; |
@@ -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 | ?> |
@@ -98,11 +100,13 @@ discard block |
||
98 | 100 | <aside> |
99 | 101 | <?php |
100 | 102 | if($this->isDetailedView) |
101 | - {?> |
|
103 | + { |
|
104 | +?> |
|
102 | 105 | <a href="index.php?vote=up&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
103 | 106 | <?php } |
104 | - else |
|
105 | - {?> |
|
107 | +else |
|
108 | + { |
|
109 | +?> |
|
106 | 110 | <a href="index.php?vote=up&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
107 | 111 | <?php } ?> |
108 | 112 | <i class="fa fa-angle-up fa-3x"></i> |
@@ -111,11 +115,13 @@ discard block |
||
111 | 115 | <?php echo $post["vote_count"];?><br /> |
112 | 116 | <?php |
113 | 117 | if($this->isDetailedView) |
114 | - {?> |
|
118 | + { |
|
119 | +?> |
|
115 | 120 | <a href="index.php?vote=down&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow"> |
116 | 121 | <?php } |
117 | - else |
|
118 | - {?> |
|
122 | +else |
|
123 | + { |
|
124 | +?> |
|
119 | 125 | <a href="index.php?vote=down&postId=<?php echo $post['post_id'];?>" rel="nofollow"> |
120 | 126 | <?php } ?> |
121 | 127 | <i class="fa fa-angle-down fa-3x"></i> |
@@ -132,14 +138,20 @@ discard block |
||
132 | 138 | <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
133 | 139 | </span> |
134 | 140 | </span> |
135 | - <?php if(!$this->isDetailedView) {?> |
|
141 | + <?php if(!$this->isDetailedView) |
|
142 | +{ |
|
143 | +?> |
|
136 | 144 | <span class="comments"> |
137 | 145 | <span data-tooltip="Comments"> |
138 | 146 | <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>"> |
139 | 147 | <i class="fa fa-commenting-o"></i> |
140 | - <?php if(array_key_exists("child_count", $post)) { |
|
148 | + <?php if(array_key_exists("child_count", $post)) |
|
149 | +{ |
|
141 | 150 | echo $post["child_count"]; |
142 | - } else echo "0"; |
|
151 | + } |
|
152 | + else { |
|
153 | + echo "0"; |
|
154 | + } |
|
143 | 155 | ?> |
144 | 156 | </a> |
145 | 157 | </span> |
@@ -355,7 +367,7 @@ discard block |
||
355 | 367 | $data = $accountCreator->execute(); |
356 | 368 | } |
357 | 369 | if(array_key_exists('recent', $data) && array_key_exists(0, $data['recent'])) |
358 | - { |
|
370 | + { |
|
359 | 371 | return $data['recent']; |
360 | 372 | } |
361 | 373 | else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
@@ -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; |
@@ -13,14 +13,18 @@ |
||
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 | } |
22 | 25 | |
23 | -if ($db->connect_errno) { |
|
26 | +if ($db->connect_errno) |
|
27 | +{ |
|
24 | 28 | echo 'Sorry, die Verbindung zu unserem |
25 | 29 | Server ist hops gegangen. Wegen '. $db -> connect_error; |
26 | 30 | } |
@@ -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> |
@@ -125,7 +135,9 @@ discard block |
||
125 | 135 | |
126 | 136 | <article> |
127 | 137 | <div> |
128 | - <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
|
138 | + <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) |
|
139 | +{ |
|
140 | +?> |
|
129 | 141 | <h2>Comment on Jodel</h2> |
130 | 142 | <form method="POST"> |
131 | 143 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
@@ -133,7 +145,10 @@ discard block |
||
133 | 145 | <br /> |
134 | 146 | <input type="submit" value="SEND" /> |
135 | 147 | </form> |
136 | - <?php } else { ?> |
|
148 | + <?php } |
|
149 | +else |
|
150 | +{ |
|
151 | +?> |
|
137 | 152 | <h2>New Jodel</h2> |
138 | 153 | <form enctype="multipart/form-data" method="POST"> |
139 | 154 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |