@@ -66,4 +66,4 @@ |
||
66 | 66 | </article> |
67 | 67 | </div> |
68 | 68 | </div> |
69 | -<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php');?> |
|
70 | 69 | \ No newline at end of file |
70 | +<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php'); ?> |
|
71 | 71 | \ No newline at end of file |
@@ -49,7 +49,7 @@ |
||
49 | 49 | } |
50 | 50 | if(!isset($posts[0])) |
51 | 51 | { |
52 | - error_log('Fehler: ' . print_r($posts, true) . print_r($posts['recent'], true) . print_r($posts['posts'], true)); |
|
52 | + error_log('Fehler: ' . print_r($posts, TRUE) . print_r($posts['recent'], TRUE) . print_r($posts['posts'], TRUE)); |
|
53 | 53 | $title = $view->getTitle(); |
54 | 54 | $description = $view->getMetaDescription(); |
55 | 55 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | </article> |
105 | 105 | |
106 | 106 | <aside class="topSidebar col-sm-4 sidebar-outer"> |
107 | - <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>"> |
|
107 | + <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile'); ?>"> |
|
108 | 108 | <article> |
109 | 109 | <div> |
110 | 110 | <h2>Position / Hashtag</h2> |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
142 | 142 | <h2>Comment on Jodel</h2> |
143 | 143 | <form method="POST"> |
144 | - <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
|
144 | + <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']); ?>" /> |
|
145 | 145 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
146 | 146 | <br /> |
147 | 147 | <input type="submit" value="SEND" /> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | </div> |
204 | 204 | </aside> |
205 | 205 | </div> |
206 | - <?php include 'templates/nav-bottom.php';?> |
|
206 | + <?php include 'templates/nav-bottom.php'; ?> |
|
207 | 207 | </div> |
208 | 208 | <?php |
209 | 209 | $includeEmojiAndAjax = TRUE; |
@@ -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> |
@@ -13,17 +13,17 @@ |
||
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 | - { |
|
17 | - $this->view = $view; |
|
18 | - $this->actions = $actions; |
|
19 | - $this->accountId = $accountId; |
|
20 | - $this->isVerified = $isVerified; |
|
21 | - $this->isTokenFresh = $isTokenFresh; |
|
22 | - $this->page = $page; |
|
23 | - $this->referrer = $referrer; |
|
24 | - $this->msg = $msg; |
|
25 | - $this->varsToDump = $varsToDump; |
|
26 | - } |
|
16 | + { |
|
17 | + $this->view = $view; |
|
18 | + $this->actions = $actions; |
|
19 | + $this->accountId = $accountId; |
|
20 | + $this->isVerified = $isVerified; |
|
21 | + $this->isTokenFresh = $isTokenFresh; |
|
22 | + $this->page = $page; |
|
23 | + $this->referrer = $referrer; |
|
24 | + $this->msg = $msg; |
|
25 | + $this->varsToDump = $varsToDump; |
|
26 | + } |
|
27 | 27 | |
28 | 28 | function writeErrorToLog() |
29 | 29 | { |
@@ -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; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | error_log("=============================== ERROR ================================"); |
31 | 31 | error_log("msg: " . $this->msg); |
32 | - error_log("view: " . print_r($this->view, true)); |
|
32 | + error_log("view: " . print_r($this->view, TRUE)); |
|
33 | 33 | error_log("actions: " . $this->actionsToString()); |
34 | 34 | error_log("accountId: " . $this->accountId); |
35 | 35 | error_log("isVerified: " . $this->isVerified); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | ?> |
6 | 6 | <div id="captchaWrapper"> |
7 | 7 | <p>Check all images with Coons on it (Coons look like <img style="height: 1.0em; width: unset;" src="img/coon.png">).</p> |
8 | - <img src="<?php echo $captcha['image_url'];?>"> |
|
8 | + <img src="<?php echo $captcha['image_url']; ?>"> |
|
9 | 9 | <div class='captchaWrapper'> |
10 | 10 | <input id='box_0' type='checkbox'> |
11 | 11 | <input id='box_1' type='checkbox'> |
@@ -17,5 +17,5 @@ discard block |
||
17 | 17 | <input id='box_7' type='checkbox'> |
18 | 18 | <input id='box_8' type='checkbox'> |
19 | 19 | </div> |
20 | - <button onClick="verifyAccount('<?php echo $captcha['key'];?>','<?php echo $jodelAccountForView->deviceUid?>')">Verify</button> |
|
20 | + <button onClick="verifyAccount('<?php echo $captcha['key']; ?>','<?php echo $jodelAccountForView->deviceUid?>')">Verify</button> |
|
21 | 21 | </div> |
22 | 22 | \ No newline at end of file |
@@ -317,7 +317,7 @@ |
||
317 | 317 | { |
318 | 318 | if($this->lastPostId == '') |
319 | 319 | { |
320 | - error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true)); |
|
320 | + error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, TRUE)); |
|
321 | 321 | //error_log(print_r($data, true)); |
322 | 322 | |
323 | 323 | $notFound[0] = array( |
@@ -2,112 +2,112 @@ discard block |
||
2 | 2 | |
3 | 3 | class View |
4 | 4 | { |
5 | - public $country; |
|
6 | - public $city; |
|
7 | - public $hashtag; |
|
5 | + public $country; |
|
6 | + public $city; |
|
7 | + public $hashtag; |
|
8 | 8 | public $view; |
9 | - public $postId; |
|
10 | - public $isDetailedView; |
|
11 | - public $baseUrl; |
|
12 | - public $rights; |
|
9 | + public $postId; |
|
10 | + public $isDetailedView; |
|
11 | + public $baseUrl; |
|
12 | + public $rights; |
|
13 | 13 | |
14 | 14 | public $lastPostId = ''; |
15 | 15 | |
16 | - function __construct($baseUrl, $country, $city, $hashtag = '%23all', $view = 'time', $postId = '') |
|
17 | - { |
|
18 | - $this->baseUrl = $baseUrl; |
|
19 | - $this->country = $country; |
|
20 | - $this->city = $city; |
|
21 | - $this->hashtag = urldecode($hashtag); |
|
22 | - $this->view = $view; |
|
23 | - $this->postId = $postId; |
|
16 | + function __construct($baseUrl, $country, $city, $hashtag = '%23all', $view = 'time', $postId = '') |
|
17 | + { |
|
18 | + $this->baseUrl = $baseUrl; |
|
19 | + $this->country = $country; |
|
20 | + $this->city = $city; |
|
21 | + $this->hashtag = urldecode($hashtag); |
|
22 | + $this->view = $view; |
|
23 | + $this->postId = $postId; |
|
24 | 24 | |
25 | - if(isUserAdmin()) |
|
26 | - { |
|
27 | - $this->rights = 'admin'; |
|
28 | - } |
|
29 | - else if(isUserVoter()) |
|
30 | - { |
|
31 | - $this->rights = 'voter'; |
|
32 | - } |
|
33 | - else |
|
34 | - { |
|
35 | - $this->rights = 'user'; |
|
36 | - } |
|
25 | + if(isUserAdmin()) |
|
26 | + { |
|
27 | + $this->rights = 'admin'; |
|
28 | + } |
|
29 | + else if(isUserVoter()) |
|
30 | + { |
|
31 | + $this->rights = 'voter'; |
|
32 | + } |
|
33 | + else |
|
34 | + { |
|
35 | + $this->rights = 'user'; |
|
36 | + } |
|
37 | 37 | |
38 | - if($postId == '') |
|
39 | - { |
|
40 | - $this->isDetailedView = FALSE; |
|
41 | - } |
|
42 | - else |
|
43 | - { |
|
44 | - $this->isDetailedView = TRUE; |
|
45 | - } |
|
46 | - } |
|
38 | + if($postId == '') |
|
39 | + { |
|
40 | + $this->isDetailedView = FALSE; |
|
41 | + } |
|
42 | + else |
|
43 | + { |
|
44 | + $this->isDetailedView = TRUE; |
|
45 | + } |
|
46 | + } |
|
47 | 47 | /** |
48 | 48 | * Compute HTML Code |
49 | 49 | */ |
50 | 50 | function jodelToHtml($post) |
51 | - { //ToDO |
|
52 | - //Replace # with link |
|
53 | - //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
|
51 | + { //ToDO |
|
52 | + //Replace # with link |
|
53 | + //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
|
54 | 54 | |
55 | - //Time to time difference |
|
56 | - $now = new DateTime(); |
|
57 | - $d = new DateTime($post['created_at']); |
|
58 | - $timediff = $now->diff($d); |
|
55 | + //Time to time difference |
|
56 | + $now = new DateTime(); |
|
57 | + $d = new DateTime($post['created_at']); |
|
58 | + $timediff = $now->diff($d); |
|
59 | 59 | |
60 | - $timediff_inSeconds = (string)$timediff->format('%s'); |
|
61 | - $timediff_inMinutes = (string)$timediff->format('%i'); |
|
62 | - $timediff_inHours = (string)$timediff->format('%h'); |
|
63 | - $timediff_inDays = (string)$timediff->format('%d'); |
|
64 | - $timediff_inMonth = (string)$timediff->format('%m'); |
|
60 | + $timediff_inSeconds = (string)$timediff->format('%s'); |
|
61 | + $timediff_inMinutes = (string)$timediff->format('%i'); |
|
62 | + $timediff_inHours = (string)$timediff->format('%h'); |
|
63 | + $timediff_inDays = (string)$timediff->format('%d'); |
|
64 | + $timediff_inMonth = (string)$timediff->format('%m'); |
|
65 | 65 | |
66 | - if($timediff_inMonth!=0) |
|
67 | - { |
|
68 | - $timediff = $timediff_inMonth . "m"; |
|
69 | - } |
|
70 | - else |
|
71 | - { |
|
72 | - if($timediff_inDays!=0) |
|
73 | - { |
|
74 | - $timediff = $timediff_inDays . "d"; |
|
75 | - } |
|
76 | - else |
|
77 | - { |
|
78 | - if($timediff_inHours!=0) |
|
79 | - { |
|
80 | - $timediff = $timediff_inHours . "h"; |
|
81 | - } |
|
82 | - else |
|
83 | - { |
|
84 | - if($timediff_inMinutes!=0) |
|
85 | - { |
|
86 | - $timediff = $timediff_inMinutes . "m"; |
|
87 | - } |
|
88 | - else |
|
89 | - { |
|
90 | - $timediff = $timediff_inSeconds . "s"; |
|
91 | - } |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
66 | + if($timediff_inMonth!=0) |
|
67 | + { |
|
68 | + $timediff = $timediff_inMonth . "m"; |
|
69 | + } |
|
70 | + else |
|
71 | + { |
|
72 | + if($timediff_inDays!=0) |
|
73 | + { |
|
74 | + $timediff = $timediff_inDays . "d"; |
|
75 | + } |
|
76 | + else |
|
77 | + { |
|
78 | + if($timediff_inHours!=0) |
|
79 | + { |
|
80 | + $timediff = $timediff_inHours . "h"; |
|
81 | + } |
|
82 | + else |
|
83 | + { |
|
84 | + if($timediff_inMinutes!=0) |
|
85 | + { |
|
86 | + $timediff = $timediff_inMinutes . "m"; |
|
87 | + } |
|
88 | + else |
|
89 | + { |
|
90 | + $timediff = $timediff_inSeconds . "s"; |
|
91 | + } |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | - ?> |
|
97 | + ?> |
|
98 | 98 | <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;"> |
99 | 99 | <content> |
100 | 100 | <?php |
101 | - if(isset($post['image_url'])) |
|
102 | - { |
|
103 | - $regexRest = '/[^\w$ .!?-]+/u'; |
|
101 | + if(isset($post['image_url'])) |
|
102 | + { |
|
103 | + $regexRest = '/[^\w$ .!?-]+/u'; |
|
104 | 104 | |
105 | - echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
|
106 | - } |
|
107 | - else { |
|
108 | - echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
|
109 | - } |
|
110 | - ?> |
|
105 | + echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
|
106 | + } |
|
107 | + else { |
|
108 | + echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
|
109 | + } |
|
110 | + ?> |
|
111 | 111 | </content> |
112 | 112 | <aside> |
113 | 113 | <button onclick="vote('<?php echo $post['post_id'];?>', 'up', this)"> |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>"> |
137 | 137 | <i class="fa fa-commenting-o"></i> |
138 | 138 | <?php if(array_key_exists("child_count", $post)) |
139 | - { |
|
140 | - echo $post["child_count"]; |
|
141 | - } else echo "0"; |
|
142 | - ?> |
|
139 | + { |
|
140 | + echo $post["child_count"]; |
|
141 | + } else echo "0"; |
|
142 | + ?> |
|
143 | 143 | </a> |
144 | 144 | </span> |
145 | 145 | |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | ?> |
160 | 160 | <span class="distance"> |
161 | 161 | <?php |
162 | - if($this->isDetailedView) |
|
163 | - { |
|
164 | - if(isset($post['user_handle']) && $post['user_handle'] == 'OJ') |
|
165 | - { |
|
166 | - ?> |
|
162 | + if($this->isDetailedView) |
|
163 | + { |
|
164 | + if(isset($post['user_handle']) && $post['user_handle'] == 'OJ') |
|
165 | + { |
|
166 | + ?> |
|
167 | 167 | <span data-tooltip="Author"> |
168 | 168 | <i class="fa fa-user-o"></i> OJ | |
169 | 169 | </span> |
170 | 170 | <?php |
171 | - } |
|
172 | - } |
|
173 | - ?> |
|
171 | + } |
|
172 | + } |
|
173 | + ?> |
|
174 | 174 | |
175 | 175 | <span class="tip" data-tooltip="Distance"> |
176 | 176 | <i class="fa fa-map-marker"></i> |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | </footer> |
184 | 184 | </article> |
185 | 185 | <?php |
186 | - } |
|
186 | + } |
|
187 | 187 | |
188 | 188 | |
189 | 189 | /** |
@@ -220,147 +220,147 @@ discard block |
||
220 | 220 | return $description; |
221 | 221 | } |
222 | 222 | |
223 | - function toUrl($msg = '') |
|
224 | - { |
|
225 | - $url = $this->baseUrl . 'index.php?country=DE' . |
|
226 | - '&city=' . urlencode($this->city) . |
|
227 | - '&hashtag=' . urlencode($this->hashtag) . |
|
228 | - '&view=' . $this->view; |
|
229 | - if($this->postId != '') |
|
230 | - { |
|
231 | - $url .= '&postId=' . $this->postId . |
|
232 | - '&getPostDetails=TRUE'; |
|
233 | - } |
|
223 | + function toUrl($msg = '') |
|
224 | + { |
|
225 | + $url = $this->baseUrl . 'index.php?country=DE' . |
|
226 | + '&city=' . urlencode($this->city) . |
|
227 | + '&hashtag=' . urlencode($this->hashtag) . |
|
228 | + '&view=' . $this->view; |
|
229 | + if($this->postId != '') |
|
230 | + { |
|
231 | + $url .= '&postId=' . $this->postId . |
|
232 | + '&getPostDetails=TRUE'; |
|
233 | + } |
|
234 | 234 | |
235 | - if($msg != '') |
|
236 | - { |
|
237 | - $url .= '&msg=' . urlencode($msg); |
|
238 | - } |
|
235 | + if($msg != '') |
|
236 | + { |
|
237 | + $url .= '&msg=' . urlencode($msg); |
|
238 | + } |
|
239 | 239 | |
240 | - return $url; |
|
241 | - } |
|
240 | + return $url; |
|
241 | + } |
|
242 | 242 | |
243 | - function changePostId($postId) |
|
244 | - { |
|
245 | - $tempView = clone $this; |
|
246 | - $tempView->postId = $postId; |
|
247 | - $tempView->isDetailedView = TRUE; |
|
248 | - return $tempView; |
|
249 | - } |
|
243 | + function changePostId($postId) |
|
244 | + { |
|
245 | + $tempView = clone $this; |
|
246 | + $tempView->postId = $postId; |
|
247 | + $tempView->isDetailedView = TRUE; |
|
248 | + return $tempView; |
|
249 | + } |
|
250 | 250 | |
251 | - function back() |
|
252 | - { |
|
253 | - $tempView = clone $this; |
|
254 | - $tempView->postId = ''; |
|
255 | - return $tempView; |
|
256 | - } |
|
251 | + function back() |
|
252 | + { |
|
253 | + $tempView = clone $this; |
|
254 | + $tempView->postId = ''; |
|
255 | + return $tempView; |
|
256 | + } |
|
257 | 257 | |
258 | - function changeView($view) |
|
259 | - { |
|
260 | - $tempView = clone $this; |
|
261 | - $tempView->view = $view; |
|
262 | - return $tempView; |
|
263 | - } |
|
258 | + function changeView($view) |
|
259 | + { |
|
260 | + $tempView = clone $this; |
|
261 | + $tempView->view = $view; |
|
262 | + return $tempView; |
|
263 | + } |
|
264 | 264 | |
265 | 265 | function getPosts($jodelAccount) |
266 | 266 | { |
267 | - if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL) |
|
268 | - { |
|
269 | - $accountCreator = new GetChannel(); |
|
270 | - $accountCreator->view = $this->view; |
|
271 | - $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
272 | - $accountCreator->channel = $this->hashtag; |
|
273 | - $accountCreator->lastPostId = $this->lastPostId; |
|
274 | - $data = $accountCreator->execute(); |
|
275 | - } |
|
276 | - else |
|
277 | - { |
|
278 | - if($this->lastPostId == '' && $this->view == 'combo') |
|
279 | - { |
|
280 | - $url = "/v3/posts/location/combo"; |
|
281 | - } |
|
282 | - else |
|
283 | - { |
|
284 | - if($this->view == 'discussed') |
|
285 | - { |
|
286 | - $url = "/v2/posts/location/discussed/"; |
|
287 | - } |
|
288 | - else |
|
289 | - { |
|
290 | - if($this->view == 'popular') |
|
291 | - { |
|
292 | - $url = "/v2/posts/location/popular/"; |
|
293 | - } |
|
294 | - else |
|
295 | - { |
|
296 | - $url = "/v2/posts/location/"; |
|
297 | - } |
|
298 | - } |
|
299 | - } |
|
267 | + if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL) |
|
268 | + { |
|
269 | + $accountCreator = new GetChannel(); |
|
270 | + $accountCreator->view = $this->view; |
|
271 | + $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
272 | + $accountCreator->channel = $this->hashtag; |
|
273 | + $accountCreator->lastPostId = $this->lastPostId; |
|
274 | + $data = $accountCreator->execute(); |
|
275 | + } |
|
276 | + else |
|
277 | + { |
|
278 | + if($this->lastPostId == '' && $this->view == 'combo') |
|
279 | + { |
|
280 | + $url = "/v3/posts/location/combo"; |
|
281 | + } |
|
282 | + else |
|
283 | + { |
|
284 | + if($this->view == 'discussed') |
|
285 | + { |
|
286 | + $url = "/v2/posts/location/discussed/"; |
|
287 | + } |
|
288 | + else |
|
289 | + { |
|
290 | + if($this->view == 'popular') |
|
291 | + { |
|
292 | + $url = "/v2/posts/location/popular/"; |
|
293 | + } |
|
294 | + else |
|
295 | + { |
|
296 | + $url = "/v2/posts/location/"; |
|
297 | + } |
|
298 | + } |
|
299 | + } |
|
300 | 300 | |
301 | - $accountCreator = new GetPosts(); |
|
302 | - $accountCreator->setLastPostId($this->lastPostId); |
|
303 | - $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
304 | - $accountCreator->setUrl($url); |
|
305 | - $accountCreator->version = 'v3'; |
|
301 | + $accountCreator = new GetPosts(); |
|
302 | + $accountCreator->setLastPostId($this->lastPostId); |
|
303 | + $accountCreator->setAccessToken($jodelAccount->accessToken); |
|
304 | + $accountCreator->setUrl($url); |
|
305 | + $accountCreator->version = 'v3'; |
|
306 | 306 | |
307 | - $config = parse_ini_file('config/config.ini.php'); |
|
308 | - $location = new Location(); |
|
309 | - $location->setLat($config['default_lat']); |
|
310 | - $location->setLng($config['default_lng']); |
|
311 | - $location->setCityName($config['default_location']); |
|
312 | - $accountCreator->location = $location; |
|
313 | - $data = $accountCreator->execute(); |
|
314 | - } |
|
315 | - if(is_array($data) && array_key_exists('recent', $data) && array_key_exists(0, $data['recent'])) |
|
316 | - { |
|
317 | - return $data['recent']; |
|
318 | - } |
|
319 | - else if(is_array($data) && array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
|
320 | - { |
|
321 | - return $data['posts']; |
|
322 | - } |
|
323 | - else |
|
324 | - { |
|
325 | - if($this->lastPostId == '') |
|
326 | - { |
|
327 | - error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true)); |
|
328 | - //error_log(print_r($data, true)); |
|
307 | + $config = parse_ini_file('config/config.ini.php'); |
|
308 | + $location = new Location(); |
|
309 | + $location->setLat($config['default_lat']); |
|
310 | + $location->setLng($config['default_lng']); |
|
311 | + $location->setCityName($config['default_location']); |
|
312 | + $accountCreator->location = $location; |
|
313 | + $data = $accountCreator->execute(); |
|
314 | + } |
|
315 | + if(is_array($data) && array_key_exists('recent', $data) && array_key_exists(0, $data['recent'])) |
|
316 | + { |
|
317 | + return $data['recent']; |
|
318 | + } |
|
319 | + else if(is_array($data) && array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
|
320 | + { |
|
321 | + return $data['posts']; |
|
322 | + } |
|
323 | + else |
|
324 | + { |
|
325 | + if($this->lastPostId == '') |
|
326 | + { |
|
327 | + error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true)); |
|
328 | + //error_log(print_r($data, true)); |
|
329 | 329 | |
330 | - $notFound[0] = array( |
|
331 | - "post_id" => "0", |
|
332 | - "discovered_by" => 0, |
|
333 | - "message" => "No more Posts found", |
|
334 | - "created_at" => "2017-02-11T16:44:50.385Z", |
|
335 | - "updated_at" => "2017-02-11T16:44:50.385Z", |
|
336 | - "pin_count" => 0, |
|
337 | - "color" => "5682a3", |
|
338 | - "got_thanks" => FALSE, |
|
339 | - "post_own" => "friend", |
|
340 | - "discovered" => 0, |
|
341 | - "distance" => 9, |
|
342 | - "vote_count" => 0, |
|
343 | - "location" => |
|
344 | - array("name" => "Berlin", |
|
345 | - "loc_coordinates" => |
|
346 | - array( |
|
347 | - "lat" => 0, |
|
348 | - "lng" => 0 |
|
349 | - ), |
|
350 | - "loc_accuracy" => 0, |
|
351 | - "country" => "", |
|
352 | - "city" => "", |
|
353 | - ), |
|
354 | - "tags" => |
|
355 | - array(), |
|
356 | - "user_handle" => "0" |
|
357 | - ); |
|
358 | - return $notFound; |
|
359 | - } |
|
360 | - else |
|
361 | - { |
|
362 | - return FALSE; |
|
363 | - } |
|
364 | - } |
|
330 | + $notFound[0] = array( |
|
331 | + "post_id" => "0", |
|
332 | + "discovered_by" => 0, |
|
333 | + "message" => "No more Posts found", |
|
334 | + "created_at" => "2017-02-11T16:44:50.385Z", |
|
335 | + "updated_at" => "2017-02-11T16:44:50.385Z", |
|
336 | + "pin_count" => 0, |
|
337 | + "color" => "5682a3", |
|
338 | + "got_thanks" => FALSE, |
|
339 | + "post_own" => "friend", |
|
340 | + "discovered" => 0, |
|
341 | + "distance" => 9, |
|
342 | + "vote_count" => 0, |
|
343 | + "location" => |
|
344 | + array("name" => "Berlin", |
|
345 | + "loc_coordinates" => |
|
346 | + array( |
|
347 | + "lat" => 0, |
|
348 | + "lng" => 0 |
|
349 | + ), |
|
350 | + "loc_accuracy" => 0, |
|
351 | + "country" => "", |
|
352 | + "city" => "", |
|
353 | + ), |
|
354 | + "tags" => |
|
355 | + array(), |
|
356 | + "user_handle" => "0" |
|
357 | + ); |
|
358 | + return $notFound; |
|
359 | + } |
|
360 | + else |
|
361 | + { |
|
362 | + return FALSE; |
|
363 | + } |
|
364 | + } |
|
365 | 365 | } |
366 | 366 | } |
@@ -63,25 +63,25 @@ discard block |
||
63 | 63 | $timediff_inDays = (string)$timediff->format('%d'); |
64 | 64 | $timediff_inMonth = (string)$timediff->format('%m'); |
65 | 65 | |
66 | - if($timediff_inMonth!=0) |
|
66 | + if($timediff_inMonth != 0) |
|
67 | 67 | { |
68 | 68 | $timediff = $timediff_inMonth . "m"; |
69 | 69 | } |
70 | 70 | else |
71 | 71 | { |
72 | - if($timediff_inDays!=0) |
|
72 | + if($timediff_inDays != 0) |
|
73 | 73 | { |
74 | 74 | $timediff = $timediff_inDays . "d"; |
75 | 75 | } |
76 | 76 | else |
77 | 77 | { |
78 | - if($timediff_inHours!=0) |
|
78 | + if($timediff_inHours != 0) |
|
79 | 79 | { |
80 | 80 | $timediff = $timediff_inHours . "h"; |
81 | 81 | } |
82 | 82 | else |
83 | 83 | { |
84 | - if($timediff_inMinutes!=0) |
|
84 | + if($timediff_inMinutes != 0) |
|
85 | 85 | { |
86 | 86 | $timediff = $timediff_inMinutes . "m"; |
87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | |
97 | 97 | ?> |
98 | - <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;"> |
|
98 | + <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color']; ?>;"> |
|
99 | 99 | <content> |
100 | 100 | <?php |
101 | 101 | if(isset($post['image_url'])) |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | ?> |
111 | 111 | </content> |
112 | 112 | <aside> |
113 | - <button onclick="vote('<?php echo $post['post_id'];?>', 'up', this)"> |
|
113 | + <button onclick="vote('<?php echo $post['post_id']; ?>', 'up', this)"> |
|
114 | 114 | <i class="fa fa-angle-up fa-3x"></i> |
115 | 115 | </button> |
116 | - <br><span><?php echo $post["vote_count"];?></span><br> |
|
116 | + <br><span><?php echo $post["vote_count"]; ?></span><br> |
|
117 | 117 | |
118 | - <button onclick="vote('<?php echo $post['post_id'];?>', 'down', this)"> |
|
118 | + <button onclick="vote('<?php echo $post['post_id']; ?>', 'down', this)"> |
|
119 | 119 | <i class="fa fa-angle-down fa-3x"></i> |
120 | 120 | </button> |
121 | 121 | </aside> |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | <span class="time"> |
127 | 127 | <span class="tip" data-tooltip="Time"> |
128 | 128 | <i class="fa fa-clock-o"></i> |
129 | - <?php echo $timediff;?> |
|
130 | - <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
|
129 | + <?php echo $timediff; ?> |
|
130 | + <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span> |
|
131 | 131 | </span> |
132 | 132 | </span> |
133 | 133 | <?php if(!$this->isDetailedView) {?> |
134 | 134 | <span class="comments"> |
135 | 135 | <span data-tooltip="Comments"> |
136 | - <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>"> |
|
136 | + <a href="<?php echo $this->changePostId($post['post_id'])->toUrl(); ?>"> |
|
137 | 137 | <i class="fa fa-commenting-o"></i> |
138 | 138 | <?php if(array_key_exists("child_count", $post)) |
139 | 139 | { |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | |
175 | 175 | <span class="tip" data-tooltip="Distance"> |
176 | 176 | <i class="fa fa-map-marker"></i> |
177 | - <?php echo $post['distance'];?> km |
|
178 | - <span class="tiptext"><?php echo $post['location']['name'];?></span> |
|
177 | + <?php echo $post['distance']; ?> km |
|
178 | + <span class="tiptext"><?php echo $post['location']['name']; ?></span> |
|
179 | 179 | </span> |
180 | 180 | </span> |
181 | 181 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | if($post != '' && array_key_exists('message', $post) && $post['message'] != '' && $this->isDetailedView) |
216 | 216 | { |
217 | - $description = 'On JodelBlue in ' . htmlspecialchars($this->city) . ' with ' . htmlspecialchars($post['vote_count']) . ' Upvotes: ' . substr(htmlspecialchars($post['message']), 0, 130); |
|
217 | + $description = 'On JodelBlue in ' . htmlspecialchars($this->city) . ' with ' . htmlspecialchars($post['vote_count']) . ' Upvotes: ' . substr(htmlspecialchars($post['message']), 0, 130); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | return $description; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | { |
317 | 317 | return $data['recent']; |
318 | 318 | } |
319 | - else if(is_array($data) && array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
|
319 | + else if(is_array($data) && array_key_exists('posts', $data) && array_key_exists(0, $data['posts'])) |
|
320 | 320 | { |
321 | 321 | return $data['posts']; |
322 | 322 | } |
@@ -48,7 +48,8 @@ discard block |
||
48 | 48 | * Compute HTML Code |
49 | 49 | */ |
50 | 50 | function jodelToHtml($post) |
51 | - { //ToDO |
|
51 | + { |
|
52 | +//ToDO |
|
52 | 53 | //Replace # with link |
53 | 54 | //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text); |
54 | 55 | |
@@ -104,7 +105,8 @@ discard block |
||
104 | 105 | |
105 | 106 | echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">'; |
106 | 107 | } |
107 | - else { |
|
108 | + else |
|
109 | + { |
|
108 | 110 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($post['message']))); |
109 | 111 | } |
110 | 112 | ?> |
@@ -130,15 +132,20 @@ discard block |
||
130 | 132 | <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span> |
131 | 133 | </span> |
132 | 134 | </span> |
133 | - <?php if(!$this->isDetailedView) {?> |
|
135 | + <?php if(!$this->isDetailedView) |
|
136 | +{ |
|
137 | +?> |
|
134 | 138 | <span class="comments"> |
135 | 139 | <span data-tooltip="Comments"> |
136 | 140 | <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>"> |
137 | 141 | <i class="fa fa-commenting-o"></i> |
138 | 142 | <?php if(array_key_exists("child_count", $post)) |
139 | - { |
|
143 | +{ |
|
140 | 144 | echo $post["child_count"]; |
141 | - } else echo "0"; |
|
145 | + } |
|
146 | + else { |
|
147 | + echo "0"; |
|
148 | + } |
|
142 | 149 | ?> |
143 | 150 | </a> |
144 | 151 | </span> |
@@ -313,7 +320,7 @@ discard block |
||
313 | 320 | $data = $accountCreator->execute(); |
314 | 321 | } |
315 | 322 | if(is_array($data) && array_key_exists('recent', $data) && array_key_exists(0, $data['recent'])) |
316 | - { |
|
323 | + { |
|
317 | 324 | return $data['recent']; |
318 | 325 | } |
319 | 326 | else if(is_array($data) && array_key_exists('posts', $data)&& array_key_exists(0, $data['posts'])) |
@@ -44,17 +44,17 @@ |
||
44 | 44 | { |
45 | 45 | //insert voter into db |
46 | 46 | $db = new DatabaseConnect(); |
47 | - $result = $db->query("INSERT INTO users (user_token, remaining_votes, device_uid, rights) |
|
47 | + $result = $db->query("INSERT INTO users (user_token, remaining_votes, device_uid, rights) |
|
48 | 48 | VALUES ('" . $db->escape_string($_POST['user_token']) |
49 | - . "','" . $db->escape_string($_POST['remaining_votes']) |
|
50 | - . "','" . $db->escape_string($_POST['device_uid']) |
|
51 | - . "','" . $db->escape_string($_POST['rights']) . "')"); |
|
49 | + . "','" . $db->escape_string($_POST['remaining_votes']) |
|
50 | + . "','" . $db->escape_string($_POST['device_uid']) |
|
51 | + . "','" . $db->escape_string($_POST['rights']) . "')"); |
|
52 | 52 | |
53 | - if($result === false){ |
|
54 | - $error = db_error(); |
|
55 | - error_log($error); |
|
56 | - error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
|
57 | - } |
|
53 | + if($result === false){ |
|
54 | + $error = db_error(); |
|
55 | + error_log($error); |
|
56 | + error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | //Vote |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | |
21 | 21 | if(isUserAdmin()) |
22 | 22 | { |
23 | - $userIsAdmin = true; |
|
24 | - $userIsVoter = true; |
|
23 | + $userIsAdmin = TRUE; |
|
24 | + $userIsVoter = TRUE; |
|
25 | 25 | $votesRemaining = 'Unlimited'; |
26 | 26 | } |
27 | 27 | else if(isUserVoter()) |
28 | 28 | { |
29 | - $userIsAdmin = false; |
|
30 | - $userIsVoter = true; |
|
29 | + $userIsAdmin = FALSE; |
|
30 | + $userIsVoter = TRUE; |
|
31 | 31 | |
32 | 32 | $result = $db->query("SELECT user_token, remaining_votes FROM users WHERE user_token = '" . $_COOKIE['JodelVoterPassword'] . "'"); |
33 | 33 | if($result->num_rows > 0) |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | . "','" . $db->escape_string($_POST['device_uid']) |
63 | 63 | . "','" . $db->escape_string($_POST['rights']) . "')"); |
64 | 64 | |
65 | - if($result === false){ |
|
65 | + if($result === FALSE){ |
|
66 | 66 | $error = db_error(); |
67 | 67 | error_log($error); |
68 | 68 | error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | |
6 | 6 | if(isset($_GET['pw'])) |
7 | 7 | { |
8 | - setcookie('JodelAdminPassword', $_GET['pw'], time()+60*60*24*365*10); |
|
8 | + setcookie('JodelAdminPassword', $_GET['pw'], time() + 60 * 60 * 24 * 365 * 10); |
|
9 | 9 | error_log('admin password saved for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
10 | 10 | header('Location: ' . $baseUrl . 'admin.php'); |
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | else if(isset($_GET['voterPw'])) |
14 | 14 | { |
15 | - setcookie('JodelVoterPassword', $_GET['voterPw'], time()+60*60*24*365*10); |
|
15 | + setcookie('JodelVoterPassword', $_GET['voterPw'], time() + 60 * 60 * 24 * 365 * 10); |
|
16 | 16 | error_log('voter password saved for [' . $_SERVER ['HTTP_USER_AGENT'] . ']'); |
17 | 17 | header('Location: ' . $baseUrl); |
18 | 18 | exit; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | else |
44 | 44 | { |
45 | - error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong voterPw / pw on admin.php'); |
|
45 | + error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong voterPw / pw on admin.php'); |
|
46 | 46 | die(); |
47 | 47 | } |
48 | 48 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | . "','" . $db->escape_string($_POST['device_uid']) |
63 | 63 | . "','" . $db->escape_string($_POST['rights']) . "')"); |
64 | 64 | |
65 | - if($result === false){ |
|
65 | + if($result === false) { |
|
66 | 66 | $error = db_error(); |
67 | 67 | error_log($error); |
68 | 68 | error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
@@ -110,42 +110,42 @@ discard block |
||
110 | 110 | <meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client"> |
111 | 111 | |
112 | 112 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous"> |
113 | - <link rel="stylesheet" href="<?php echo $baseUrl;?>css/font-awesome.min.css"> |
|
114 | - <link rel="stylesheet" href="<?php echo $baseUrl;?>style.css" type="text/css"> |
|
113 | + <link rel="stylesheet" href="<?php echo $baseUrl; ?>css/font-awesome.min.css"> |
|
114 | + <link rel="stylesheet" href="<?php echo $baseUrl; ?>style.css" type="text/css"> |
|
115 | 115 | |
116 | - <link rel="shortcut icon" type="image/x-icon" href="<?php echo $baseUrl;?>img/favicon/favicon.ico"> |
|
117 | - <link rel="icon" type="image/x-icon" href="<?php echo $baseUrl;?>img/favicon/favicon.ico"> |
|
118 | - <link rel="icon" type="image/gif" href="<?php echo $baseUrl;?>img/favicon/favicon.gif"> |
|
119 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon.png"> |
|
120 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon.png"> |
|
121 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-57x57.png" sizes="57x57"> |
|
122 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-60x60.png" sizes="60x60"> |
|
123 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-72x72.png" sizes="72x72"> |
|
124 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-76x76.png" sizes="76x76"> |
|
125 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-114x114.png" sizes="114x114"> |
|
126 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-120x120.png" sizes="120x120"> |
|
127 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-128x128.png" sizes="128x128"> |
|
128 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-144x144.png" sizes="144x144"> |
|
129 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-152x152.png" sizes="152x152"> |
|
130 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-180x180.png" sizes="180x180"> |
|
131 | - <link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-precomposed.png"> |
|
132 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-16x16.png" sizes="16x16"> |
|
133 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-32x32.png" sizes="32x32"> |
|
134 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-96x96.png" sizes="96x96"> |
|
135 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-160x160.png" sizes="160x160"> |
|
136 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-192x192.png" sizes="192x192"> |
|
137 | - <link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-196x196.png" sizes="196x196"> |
|
138 | - <meta name="msapplication-TileImage" content="<?php echo $baseUrl;?>img/favicon/win8-tile-144x144.png"> |
|
116 | + <link rel="shortcut icon" type="image/x-icon" href="<?php echo $baseUrl; ?>img/favicon/favicon.ico"> |
|
117 | + <link rel="icon" type="image/x-icon" href="<?php echo $baseUrl; ?>img/favicon/favicon.ico"> |
|
118 | + <link rel="icon" type="image/gif" href="<?php echo $baseUrl; ?>img/favicon/favicon.gif"> |
|
119 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon.png"> |
|
120 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon.png"> |
|
121 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-57x57.png" sizes="57x57"> |
|
122 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-60x60.png" sizes="60x60"> |
|
123 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-72x72.png" sizes="72x72"> |
|
124 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-76x76.png" sizes="76x76"> |
|
125 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-114x114.png" sizes="114x114"> |
|
126 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-120x120.png" sizes="120x120"> |
|
127 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-128x128.png" sizes="128x128"> |
|
128 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-144x144.png" sizes="144x144"> |
|
129 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-152x152.png" sizes="152x152"> |
|
130 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-180x180.png" sizes="180x180"> |
|
131 | + <link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-precomposed.png"> |
|
132 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-16x16.png" sizes="16x16"> |
|
133 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-32x32.png" sizes="32x32"> |
|
134 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-96x96.png" sizes="96x96"> |
|
135 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-160x160.png" sizes="160x160"> |
|
136 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-192x192.png" sizes="192x192"> |
|
137 | + <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-196x196.png" sizes="196x196"> |
|
138 | + <meta name="msapplication-TileImage" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-144x144.png"> |
|
139 | 139 | <meta name="msapplication-TileColor" content="#5682a3"> |
140 | 140 | <meta name="msapplication-navbutton-color" content="#5682a3"> |
141 | 141 | <meta name="application-name" content="JodelBlue"/> |
142 | 142 | <meta name="msapplication-tooltip" content="JodelBlue"/> |
143 | 143 | <meta name="apple-mobile-web-app-title" content="JodelBlue"/> |
144 | - <meta name="msapplication-square70x70logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-70x70.png"> |
|
145 | - <meta name="msapplication-square144x144logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-144x144.png"> |
|
146 | - <meta name="msapplication-square150x150logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-150x150.png"> |
|
147 | - <meta name="msapplication-wide310x150logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-310x150.png"> |
|
148 | - <meta name="msapplication-square310x310logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-310x310.png"> |
|
144 | + <meta name="msapplication-square70x70logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-70x70.png"> |
|
145 | + <meta name="msapplication-square144x144logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-144x144.png"> |
|
146 | + <meta name="msapplication-square150x150logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-150x150.png"> |
|
147 | + <meta name="msapplication-wide310x150logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-310x150.png"> |
|
148 | + <meta name="msapplication-square310x310logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-310x310.png"> |
|
149 | 149 | </head> |
150 | 150 | |
151 | 151 | <body> |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | ?> |
218 | 218 | <div class="row"> |
219 | 219 | <div class="col-12 col-sm-12"> |
220 | - <h2>Voting (<?php echo $votesRemaining;?> votes remaining)</h2> |
|
220 | + <h2>Voting (<?php echo $votesRemaining; ?> votes remaining)</h2> |
|
221 | 221 | <form> |
222 | 222 | <div class="form-group"> |
223 | 223 | <label for="quantityDelay">Quantity</label> |
@@ -226,20 +226,20 @@ discard block |
||
226 | 226 | <div class="form-group"> |
227 | 227 | <label for="minDelay">Minimum delay</label> |
228 | 228 | <div class="input-group"> |
229 | - <input placeholder="min interval" class="form-control" id="minDelay" value="<?php echo $config['minInterval'];?>" type="number" name="min"> |
|
229 | + <input placeholder="min interval" class="form-control" id="minDelay" value="<?php echo $config['minInterval']; ?>" type="number" name="min"> |
|
230 | 230 | <span class="input-group-addon">seconds</span> |
231 | 231 | </div> |
232 | 232 | </div> |
233 | 233 | <div class="form-group"> |
234 | 234 | <label for="maxDelay">Maximum delay</label> |
235 | 235 | <div class="input-group"> |
236 | - <input placeholder="max interval" class="form-control" id="maxDelay" value="<?php echo $config['maxInterval'];?>" type="number" name="max"> |
|
236 | + <input placeholder="max interval" class="form-control" id="maxDelay" value="<?php echo $config['maxInterval']; ?>" type="number" name="max"> |
|
237 | 237 | <span class="input-group-addon">seconds</span> |
238 | 238 | </div> |
239 | 239 | </div> |
240 | 240 | <div class="form-group"> |
241 | 241 | <label for="postIdDelay">Post Id</label> |
242 | - <input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) echo $_GET['postId'];?>" type="text" name="postId"> |
|
242 | + <input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) echo $_GET['postId']; ?>" type="text" name="postId"> |
|
243 | 243 | </div> |
244 | 244 | <div class="row"> |
245 | 245 | <div class="col-6 col-xs-6"><button type="button" name="vote" value="up" class="half" onclick="voteWithAjax('up');">Upvote</button></div> |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | crossorigin="anonymous"></script> |
266 | 266 | <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script> |
267 | 267 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script> |
268 | - <script src="<?php echo $baseUrl;?>js/jQueryEmoji.js"></script> |
|
268 | + <script src="<?php echo $baseUrl; ?>js/jQueryEmoji.js"></script> |
|
269 | 269 | <script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.1.1/ekko-lightbox.min.js" integrity="sha256-1odJPEl+KoMUaA1T7QNMGSSU/r5LCKCRC6SL8P0r2gY=" crossorigin="anonymous"></script> |
270 | 270 | |
271 | 271 | <script> |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | { |
310 | 310 | $.ajax({ |
311 | 311 | type: "POST", |
312 | - url: "<?php echo $baseUrl;?>vote-ajax.php", |
|
312 | + url: "<?php echo $baseUrl; ?>vote-ajax.php", |
|
313 | 313 | data: {"vote" : data["vote"], |
314 | 314 | "postId" : data["id"]}, |
315 | 315 | success: function(result){ |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | console.log(solution); |
364 | 364 | $.ajax({ |
365 | 365 | type: "POST", |
366 | - url: "<?php echo $baseUrl;?>vote-ajax.php?solution=" + solution + "&key="+key, |
|
366 | + url: "<?php echo $baseUrl; ?>vote-ajax.php?solution=" + solution + "&key="+key, |
|
367 | 367 | data: {"deviceUid" : deviceUid}, |
368 | 368 | success: function(result){ |
369 | 369 | var response = JSON.parse(result); |
@@ -62,7 +62,8 @@ discard block |
||
62 | 62 | . "','" . $db->escape_string($_POST['device_uid']) |
63 | 63 | . "','" . $db->escape_string($_POST['rights']) . "')"); |
64 | 64 | |
65 | - if($result === false){ |
|
65 | + if($result === false) |
|
66 | + { |
|
66 | 67 | $error = db_error(); |
67 | 68 | error_log($error); |
68 | 69 | error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
@@ -165,7 +166,9 @@ discard block |
||
165 | 166 | <div class="row"> |
166 | 167 | <article class="topContent col-12 col-sm-12"> |
167 | 168 | <content id="posts" class="adminpanel"> |
168 | - <?php if($userIsAdmin) { ?> |
|
169 | + <?php if($userIsAdmin) |
|
170 | +{ |
|
171 | +?> |
|
169 | 172 | <div class="row"> |
170 | 173 | <div class="col-md-12"> |
171 | 174 | <h2>Account management</h2> |
@@ -213,7 +216,8 @@ discard block |
||
213 | 216 | <?php |
214 | 217 | } |
215 | 218 | |
216 | - if($userIsVoter) { |
|
219 | + if($userIsVoter) |
|
220 | + { |
|
217 | 221 | ?> |
218 | 222 | <div class="row"> |
219 | 223 | <div class="col-12 col-sm-12"> |
@@ -239,7 +243,11 @@ discard block |
||
239 | 243 | </div> |
240 | 244 | <div class="form-group"> |
241 | 245 | <label for="postIdDelay">Post Id</label> |
242 | - <input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) echo $_GET['postId'];?>" type="text" name="postId"> |
|
246 | + <input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) |
|
247 | +{ |
|
248 | + echo $_GET['postId']; |
|
249 | +} |
|
250 | +?>" type="text" name="postId"> |
|
243 | 251 | </div> |
244 | 252 | <div class="row"> |
245 | 253 | <div class="col-6 col-xs-6"><button type="button" name="vote" value="up" class="half" onclick="voteWithAjax('up');">Upvote</button></div> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $header = $this->getSignHeaders(); |
30 | 30 | $url = $this->getFullUrl(); |
31 | 31 | |
32 | - if ($this->getAccessToken()) { |
|
32 | + if($this->getAccessToken()) { |
|
33 | 33 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
34 | 34 | } |
35 | 35 | //Comment out to debug the Request: |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'proxy' => '186.103.169.165:8080', |
53 | 53 | );*/ |
54 | 54 | |
55 | - switch ($this->getMethod()) { |
|
55 | + switch($this->getMethod()) { |
|
56 | 56 | case 'POST': |
57 | 57 | $result = Requests::post($url, $header, $this->payLoad); |
58 | 58 | break; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | http_response_code($result->status_code); |
75 | 75 | |
76 | - switch ($result->status_code) { |
|
76 | + switch($result->status_code) { |
|
77 | 77 | case 200: |
78 | 78 | $result = json_decode($result->body, true); |
79 | 79 | break; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | case 502: |
117 | 117 | error_log('Error 502 - ' . print_r($result, true)); |
118 | 118 | $result = json_decode($result->body, true); |
119 | - header('location:'.$_SERVER['PHP_SELF']); |
|
119 | + header('location:' . $_SERVER['PHP_SELF']); |
|
120 | 120 | break; |
121 | 121 | case 503: |
122 | 122 | error_log('Error 503 - ' . print_r($result, true)); |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | |
125 | 125 | if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable') |
126 | 126 | { |
127 | - header('location:'.$_SERVER['PHP_SELF']); |
|
127 | + header('location:' . $_SERVER['PHP_SELF']); |
|
128 | 128 | } |
129 | 129 | break; |
130 | 130 | default: |
131 | - error_log('Error '.$result->status_code.' - unknown error'); |
|
131 | + error_log('Error ' . $result->status_code . ' - unknown error'); |
|
132 | 132 | $result = json_decode($result->body, true); |
133 | 133 | } |
134 | 134 |
@@ -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 = 'hFvMqLauMtnodakokftuKETbIsVLxpqfjAXiRoih'; |
@@ -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; |
@@ -153,10 +157,12 @@ discard block |
||
153 | 157 | */ |
154 | 158 | private function getSignHeaders() |
155 | 159 | { |
156 | - if($this->getAccessToken() == null) { |
|
160 | + if($this->getAccessToken() == null) |
|
161 | + { |
|
157 | 162 | $payload_accessToken = ""; |
158 | 163 | } |
159 | - else { |
|
164 | + else |
|
165 | + { |
|
160 | 166 | $payload_accessToken = $this->getAccessToken(); |
161 | 167 | } |
162 | 168 |
@@ -2,21 +2,21 @@ discard block |
||
2 | 2 | |
3 | 3 | abstract class AbstractRequest |
4 | 4 | { |
5 | - const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
|
6 | - const APIURL = 'https://api.go-tellm.com/api'; |
|
7 | - const SECRET = 'hFvMqLauMtnodakokftuKETbIsVLxpqfjAXiRoih'; |
|
8 | - const USERAGENT = 'Jodel/4.41.0 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
|
9 | - const CLIENT_TYPE = 'android_4.41.0'; |
|
5 | + const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
|
6 | + const APIURL = 'https://api.go-tellm.com/api'; |
|
7 | + const SECRET = 'hFvMqLauMtnodakokftuKETbIsVLxpqfjAXiRoih'; |
|
8 | + const USERAGENT = 'Jodel/4.41.0 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
|
9 | + const CLIENT_TYPE = 'android_4.41.0'; |
|
10 | 10 | |
11 | - private $accessToken = null; |
|
12 | - private $payLoad; |
|
13 | - public $expects = ''; |
|
14 | - public $version = 'v2'; |
|
15 | - public $hasPayload = FALSE; |
|
11 | + private $accessToken = null; |
|
12 | + private $payLoad; |
|
13 | + public $expects = ''; |
|
14 | + public $version = 'v2'; |
|
15 | + public $hasPayload = FALSE; |
|
16 | 16 | |
17 | - public function execute() |
|
18 | - { |
|
19 | - $result = new \stdClass(); |
|
17 | + public function execute() |
|
18 | + { |
|
19 | + $result = new \stdClass(); |
|
20 | 20 | |
21 | 21 | $this->payLoad = $this->getPayload(); |
22 | 22 | $device_uid = ''; |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | - $this->payLoad = json_encode($this->payLoad); |
|
29 | - $header = $this->getSignHeaders(); |
|
30 | - $url = $this->getFullUrl(); |
|
28 | + $this->payLoad = json_encode($this->payLoad); |
|
29 | + $header = $this->getSignHeaders(); |
|
30 | + $url = $this->getFullUrl(); |
|
31 | 31 | |
32 | - if ($this->getAccessToken()) { |
|
33 | - $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
34 | - } |
|
35 | - //Comment out to debug the Request: |
|
32 | + if ($this->getAccessToken()) { |
|
33 | + $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
34 | + } |
|
35 | + //Comment out to debug the Request: |
|
36 | 36 | |
37 | - /* |
|
37 | + /* |
|
38 | 38 | printf("URL: "); |
39 | 39 | var_dump($url); |
40 | 40 | echo "<br />"; |
@@ -45,124 +45,124 @@ discard block |
||
45 | 45 | var_dump($this->payLoad); |
46 | 46 | echo "<br />"; |
47 | 47 | */ |
48 | - /* |
|
48 | + /* |
|
49 | 49 | $options = array( |
50 | 50 | 'timeout' => 100, |
51 | 51 | 'connect_timeout' => 100, |
52 | 52 | 'proxy' => '186.103.169.165:8080', |
53 | 53 | );*/ |
54 | 54 | |
55 | - switch ($this->getMethod()) { |
|
56 | - case 'POST': |
|
57 | - $result = Requests::post($url, $header, $this->payLoad); |
|
58 | - break; |
|
59 | - case 'GET': |
|
60 | - if($this->hasPayload) |
|
61 | - { |
|
62 | - $result = Requests::get($url, $header, $this->payLoad); |
|
63 | - } |
|
64 | - else |
|
65 | - { |
|
66 | - $result = Requests::get($url, $header); |
|
67 | - } |
|
68 | - break; |
|
69 | - case 'PUT': |
|
70 | - $result = Requests::put($url, $header, $this->payLoad); |
|
71 | - break; |
|
72 | - } |
|
55 | + switch ($this->getMethod()) { |
|
56 | + case 'POST': |
|
57 | + $result = Requests::post($url, $header, $this->payLoad); |
|
58 | + break; |
|
59 | + case 'GET': |
|
60 | + if($this->hasPayload) |
|
61 | + { |
|
62 | + $result = Requests::get($url, $header, $this->payLoad); |
|
63 | + } |
|
64 | + else |
|
65 | + { |
|
66 | + $result = Requests::get($url, $header); |
|
67 | + } |
|
68 | + break; |
|
69 | + case 'PUT': |
|
70 | + $result = Requests::put($url, $header, $this->payLoad); |
|
71 | + break; |
|
72 | + } |
|
73 | 73 | |
74 | - http_response_code($result->status_code); |
|
74 | + http_response_code($result->status_code); |
|
75 | 75 | |
76 | - switch ($result->status_code) { |
|
77 | - case 200: |
|
78 | - $result = json_decode($result->body, true); |
|
79 | - break; |
|
80 | - case 204: |
|
81 | - $result = 'Success'; |
|
82 | - http_response_code(200); |
|
83 | - break; |
|
84 | - case 400: |
|
85 | - $result = json_decode($result->body, true); |
|
86 | - error_log('Error 400 - ' . print_r($result, true)); |
|
87 | - break; |
|
88 | - case 401: |
|
76 | + switch ($result->status_code) { |
|
77 | + case 200: |
|
78 | + $result = json_decode($result->body, true); |
|
79 | + break; |
|
80 | + case 204: |
|
81 | + $result = 'Success'; |
|
82 | + http_response_code(200); |
|
83 | + break; |
|
84 | + case 400: |
|
85 | + $result = json_decode($result->body, true); |
|
86 | + error_log('Error 400 - ' . print_r($result, true)); |
|
87 | + break; |
|
88 | + case 401: |
|
89 | 89 | |
90 | - if($result == "Unauthorized") |
|
91 | - { |
|
92 | - error_log("Error 401: Unauthorized"); |
|
93 | - } |
|
94 | - else |
|
95 | - { |
|
96 | - $result = json_decode($result->body, true); |
|
90 | + if($result == "Unauthorized") |
|
91 | + { |
|
92 | + error_log("Error 401: Unauthorized"); |
|
93 | + } |
|
94 | + else |
|
95 | + { |
|
96 | + $result = json_decode($result->body, true); |
|
97 | 97 | |
98 | - if(is_array($result) && $result['error'] == 'length') |
|
99 | - { |
|
98 | + if(is_array($result) && $result['error'] == 'length') |
|
99 | + { |
|
100 | 100 | |
101 | - } |
|
102 | - else |
|
103 | - { |
|
104 | - error_log('Error 401 - ' . print_r($result, true)); |
|
105 | - } |
|
106 | - } |
|
101 | + } |
|
102 | + else |
|
103 | + { |
|
104 | + error_log('Error 401 - ' . print_r($result, true)); |
|
105 | + } |
|
106 | + } |
|
107 | 107 | |
108 | 108 | |
109 | - break; |
|
110 | - case 404: |
|
111 | - error_log('Error 404 - ' . print_r($result, true)); |
|
112 | - $result = json_decode($result->body, true); |
|
113 | - break; |
|
109 | + break; |
|
110 | + case 404: |
|
111 | + error_log('Error 404 - ' . print_r($result, true)); |
|
112 | + $result = json_decode($result->body, true); |
|
113 | + break; |
|
114 | 114 | case 477: |
115 | - $result = json_decode($result->body, true); |
|
116 | - error_log('Error 477 - ' . print_r($result, true)); |
|
117 | - break; |
|
118 | - case 429: |
|
119 | - error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true)); |
|
120 | - exit("Error 429: Too Many Requests"); |
|
121 | - break; |
|
122 | - case 403: |
|
123 | - error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true)); |
|
124 | - $result = json_decode($result->body, true); |
|
125 | - break; |
|
126 | - case 502: |
|
127 | - error_log('Error 502 - ' . print_r($result, true)); |
|
128 | - $result = json_decode($result->body, true); |
|
129 | - header('location:'.$_SERVER['PHP_SELF']); |
|
130 | - break; |
|
131 | - case 503: |
|
132 | - error_log('Error 503 - ' . print_r($result, true)); |
|
133 | - $result = json_decode($result->body, true); |
|
115 | + $result = json_decode($result->body, true); |
|
116 | + error_log('Error 477 - ' . print_r($result, true)); |
|
117 | + break; |
|
118 | + case 429: |
|
119 | + error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true)); |
|
120 | + exit("Error 429: Too Many Requests"); |
|
121 | + break; |
|
122 | + case 403: |
|
123 | + error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true)); |
|
124 | + $result = json_decode($result->body, true); |
|
125 | + break; |
|
126 | + case 502: |
|
127 | + error_log('Error 502 - ' . print_r($result, true)); |
|
128 | + $result = json_decode($result->body, true); |
|
129 | + header('location:'.$_SERVER['PHP_SELF']); |
|
130 | + break; |
|
131 | + case 503: |
|
132 | + error_log('Error 503 - ' . print_r($result, true)); |
|
133 | + $result = json_decode($result->body, true); |
|
134 | 134 | |
135 | - if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable') |
|
136 | - { |
|
137 | - header('location:'.$_SERVER['PHP_SELF']); |
|
138 | - } |
|
139 | - break; |
|
140 | - default: |
|
141 | - error_log('Error '.$result->status_code.' - unknown error'); |
|
142 | - $result = json_decode($result->body, true); |
|
143 | - } |
|
135 | + if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable') |
|
136 | + { |
|
137 | + header('location:'.$_SERVER['PHP_SELF']); |
|
138 | + } |
|
139 | + break; |
|
140 | + default: |
|
141 | + error_log('Error '.$result->status_code.' - unknown error'); |
|
142 | + $result = json_decode($result->body, true); |
|
143 | + } |
|
144 | 144 | |
145 | - //important for account refresh |
|
146 | - if($device_uid != '') |
|
147 | - { |
|
145 | + //important for account refresh |
|
146 | + if($device_uid != '') |
|
147 | + { |
|
148 | 148 | $result[0] = $result; |
149 | 149 | $result[1] = $device_uid; |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | 152 | |
153 | - /* |
|
153 | + /* |
|
154 | 154 | var_dump($result); |
155 | 155 | */ |
156 | 156 | |
157 | - return $result; |
|
158 | - } |
|
159 | - abstract function getPayload(); |
|
160 | - /** |
|
161 | - * Gets Sign headers |
|
162 | - * @return array headers |
|
163 | - */ |
|
164 | - private function getSignHeaders() |
|
165 | - { |
|
157 | + return $result; |
|
158 | + } |
|
159 | + abstract function getPayload(); |
|
160 | + /** |
|
161 | + * Gets Sign headers |
|
162 | + * @return array headers |
|
163 | + */ |
|
164 | + private function getSignHeaders() |
|
165 | + { |
|
166 | 166 | if($this->getAccessToken() == null) { |
167 | 167 | $payload_accessToken = ""; |
168 | 168 | } |
@@ -171,54 +171,54 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | - $headers = array( |
|
175 | - "Connection" => "keep-alive", |
|
176 | - "Accept-Encoding" => "gzip", |
|
177 | - "Content-Type" => "application/json; charset=UTF-8", |
|
178 | - "User-Agent" => self::USERAGENT |
|
179 | - ); |
|
180 | - $timestamp = new DateTime(); |
|
181 | - $timestamp = $timestamp->format(DateTime::ATOM); |
|
182 | - $timestamp = substr($timestamp, 0, -6); |
|
183 | - $timestamp .= "Z"; |
|
184 | - $urlParts = parse_url($this->getFullUrl()); |
|
185 | - $url2 = ""; |
|
186 | - $req = [$this->getMethod(), |
|
187 | - $urlParts['host'], |
|
188 | - "443", |
|
189 | - $urlParts['path'], |
|
190 | - $payload_accessToken, |
|
191 | - $timestamp, |
|
192 | - $url2, |
|
193 | - $this->payLoad]; |
|
194 | - $reqString = implode("%", $req); |
|
195 | - $secret = self::SECRET; |
|
196 | - $signature = hash_hmac('sha1', $reqString, $secret); |
|
197 | - $signature = strtoupper($signature); |
|
198 | - $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
199 | - $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
200 | - $headers['X-Timestamp'] = $timestamp; |
|
201 | - $headers['X-Api-Version'] = '0.2'; |
|
202 | - return $headers; |
|
203 | - } |
|
204 | - private function getFullUrl() |
|
205 | - { |
|
206 | - return self::APIURL . $this->getApiEndPoint(); |
|
207 | - } |
|
208 | - abstract function getApiEndPoint(); |
|
209 | - abstract function getMethod(); |
|
210 | - /** |
|
211 | - * @return string |
|
212 | - */ |
|
213 | - private function getAccessToken() |
|
214 | - { |
|
215 | - return $this->accessToken; |
|
216 | - } |
|
217 | - /** |
|
218 | - * @param string $accessToken |
|
219 | - */ |
|
220 | - public function setAccessToken($accessToken) |
|
221 | - { |
|
222 | - $this->accessToken = $accessToken; |
|
223 | - } |
|
174 | + $headers = array( |
|
175 | + "Connection" => "keep-alive", |
|
176 | + "Accept-Encoding" => "gzip", |
|
177 | + "Content-Type" => "application/json; charset=UTF-8", |
|
178 | + "User-Agent" => self::USERAGENT |
|
179 | + ); |
|
180 | + $timestamp = new DateTime(); |
|
181 | + $timestamp = $timestamp->format(DateTime::ATOM); |
|
182 | + $timestamp = substr($timestamp, 0, -6); |
|
183 | + $timestamp .= "Z"; |
|
184 | + $urlParts = parse_url($this->getFullUrl()); |
|
185 | + $url2 = ""; |
|
186 | + $req = [$this->getMethod(), |
|
187 | + $urlParts['host'], |
|
188 | + "443", |
|
189 | + $urlParts['path'], |
|
190 | + $payload_accessToken, |
|
191 | + $timestamp, |
|
192 | + $url2, |
|
193 | + $this->payLoad]; |
|
194 | + $reqString = implode("%", $req); |
|
195 | + $secret = self::SECRET; |
|
196 | + $signature = hash_hmac('sha1', $reqString, $secret); |
|
197 | + $signature = strtoupper($signature); |
|
198 | + $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
199 | + $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
200 | + $headers['X-Timestamp'] = $timestamp; |
|
201 | + $headers['X-Api-Version'] = '0.2'; |
|
202 | + return $headers; |
|
203 | + } |
|
204 | + private function getFullUrl() |
|
205 | + { |
|
206 | + return self::APIURL . $this->getApiEndPoint(); |
|
207 | + } |
|
208 | + abstract function getApiEndPoint(); |
|
209 | + abstract function getMethod(); |
|
210 | + /** |
|
211 | + * @return string |
|
212 | + */ |
|
213 | + private function getAccessToken() |
|
214 | + { |
|
215 | + return $this->accessToken; |
|
216 | + } |
|
217 | + /** |
|
218 | + * @param string $accessToken |
|
219 | + */ |
|
220 | + public function setAccessToken($accessToken) |
|
221 | + { |
|
222 | + $this->accessToken = $accessToken; |
|
223 | + } |
|
224 | 224 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | const USERAGENT = 'Jodel/4.41.0 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
9 | 9 | const CLIENT_TYPE = 'android_4.41.0'; |
10 | 10 | |
11 | - private $accessToken = null; |
|
11 | + private $accessToken = NULL; |
|
12 | 12 | private $payLoad; |
13 | 13 | public $expects = ''; |
14 | 14 | public $version = 'v2'; |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | |
76 | 76 | switch ($result->status_code) { |
77 | 77 | case 200: |
78 | - $result = json_decode($result->body, true); |
|
78 | + $result = json_decode($result->body, TRUE); |
|
79 | 79 | break; |
80 | 80 | case 204: |
81 | 81 | $result = 'Success'; |
82 | 82 | http_response_code(200); |
83 | 83 | break; |
84 | 84 | case 400: |
85 | - $result = json_decode($result->body, true); |
|
86 | - error_log('Error 400 - ' . print_r($result, true)); |
|
85 | + $result = json_decode($result->body, TRUE); |
|
86 | + error_log('Error 400 - ' . print_r($result, TRUE)); |
|
87 | 87 | break; |
88 | 88 | case 401: |
89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | else |
95 | 95 | { |
96 | - $result = json_decode($result->body, true); |
|
96 | + $result = json_decode($result->body, TRUE); |
|
97 | 97 | |
98 | 98 | if(is_array($result) && $result['error'] == 'length') |
99 | 99 | { |
@@ -101,36 +101,36 @@ discard block |
||
101 | 101 | } |
102 | 102 | else |
103 | 103 | { |
104 | - error_log('Error 401 - ' . print_r($result, true)); |
|
104 | + error_log('Error 401 - ' . print_r($result, TRUE)); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | break; |
110 | 110 | case 404: |
111 | - error_log('Error 404 - ' . print_r($result, true)); |
|
112 | - $result = json_decode($result->body, true); |
|
111 | + error_log('Error 404 - ' . print_r($result, TRUE)); |
|
112 | + $result = json_decode($result->body, TRUE); |
|
113 | 113 | break; |
114 | 114 | case 477: |
115 | - $result = json_decode($result->body, true); |
|
116 | - error_log('Error 477 - ' . print_r($result, true)); |
|
115 | + $result = json_decode($result->body, TRUE); |
|
116 | + error_log('Error 477 - ' . print_r($result, TRUE)); |
|
117 | 117 | break; |
118 | 118 | case 429: |
119 | - error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true)); |
|
119 | + error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, TRUE), TRUE)); |
|
120 | 120 | exit("Error 429: Too Many Requests"); |
121 | 121 | break; |
122 | 122 | case 403: |
123 | - error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true)); |
|
124 | - $result = json_decode($result->body, true); |
|
123 | + error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, TRUE), TRUE)); |
|
124 | + $result = json_decode($result->body, TRUE); |
|
125 | 125 | break; |
126 | 126 | case 502: |
127 | - error_log('Error 502 - ' . print_r($result, true)); |
|
128 | - $result = json_decode($result->body, true); |
|
127 | + error_log('Error 502 - ' . print_r($result, TRUE)); |
|
128 | + $result = json_decode($result->body, TRUE); |
|
129 | 129 | header('location:'.$_SERVER['PHP_SELF']); |
130 | 130 | break; |
131 | 131 | case 503: |
132 | - error_log('Error 503 - ' . print_r($result, true)); |
|
133 | - $result = json_decode($result->body, true); |
|
132 | + error_log('Error 503 - ' . print_r($result, TRUE)); |
|
133 | + $result = json_decode($result->body, TRUE); |
|
134 | 134 | |
135 | 135 | if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable') |
136 | 136 | { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | break; |
140 | 140 | default: |
141 | 141 | error_log('Error '.$result->status_code.' - unknown error'); |
142 | - $result = json_decode($result->body, true); |
|
142 | + $result = json_decode($result->body, TRUE); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | //important for account refresh |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | private function getSignHeaders() |
165 | 165 | { |
166 | - if($this->getAccessToken() == null) { |
|
166 | + if($this->getAccessToken() == NULL) { |
|
167 | 167 | $payload_accessToken = ""; |
168 | 168 | } |
169 | 169 | else { |
@@ -17,10 +17,10 @@ |
||
17 | 17 | { |
18 | 18 | error_log('ER_TOO_MANY_USER_CONNECTIONS'); |
19 | 19 | sleep(1); |
20 | - header('location: '.$_SERVER['PHP_SELF']); |
|
20 | + header('location: ' . $_SERVER['PHP_SELF']); |
|
21 | 21 | } |
22 | 22 | |
23 | -if ($db->connect_errno) |
|
23 | +if($db->connect_errno) |
|
24 | 24 | { |
25 | 25 | error_log('Sorry, die Verbindung zu unserem |
26 | 26 | Server ist hops gegangen. Wegen '. $db -> connect_error); |
@@ -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 | } |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | { |
7 | 7 | header('Content-Type: application/json'); |
8 | 8 | $voteResult = $jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']); |
9 | - echo json_encode($voteResult); |
|
10 | - die(); |
|
9 | + echo json_encode($voteResult); |
|
10 | + die(); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if(isset($_GET['solution']) && isset($_POST['deviceUid'])) |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | WHERE user_token='" . $_COOKIE['JodelVoterPassword'] . "'"); |
93 | 93 | if($result === false) |
94 | 94 | { |
95 | - error_log("Update remaining votes failed: (" . $db->errno . ") " . $db->error); |
|
96 | - } |
|
97 | - $db->close(); |
|
98 | - } |
|
95 | + error_log("Update remaining votes failed: (" . $db->errno . ") " . $db->error); |
|
96 | + } |
|
97 | + $db->close(); |
|
98 | + } |
|
99 | 99 | $jodelAccount->votePostId($_POST['postId'], $_POST['vote']); |
100 | 100 | //Feedback |
101 | 101 | } |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | } |
25 | 25 | else |
26 | 26 | { |
27 | - $userIsVoter = false; |
|
27 | + $userIsVoter = FALSE; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if(!$userIsVoter && !$userIsAdmin) |
31 | 31 | { |
32 | 32 | error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php'); |
33 | - $response = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php',"success" => false); |
|
33 | + $response = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php',"success" => FALSE); |
|
34 | 34 | echo json_encode($response); |
35 | 35 | die(); |
36 | 36 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if($remaining_votes <= 0) |
48 | 48 | { |
49 | 49 | $message = 'This voter account run out of votes. For more information please contact [email protected]'; |
50 | - $success = false; |
|
50 | + $success = FALSE; |
|
51 | 51 | |
52 | 52 | $response = array("success" => $success, "message" => $message); |
53 | 53 | echo json_encode($response); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | |
59 | 59 | $message = ""; |
60 | - $success = true; |
|
60 | + $success = TRUE; |
|
61 | 61 | $token = ""; |
62 | 62 | if(isset($_POST['vote']) && isset($_POST['postId'])) |
63 | 63 | { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $_GET['key'] = $captcha["key"]; |
81 | 81 | $_GET['deviceUid'] = $deviceUid; |
82 | 82 | |
83 | - $success = false; |
|
83 | + $success = FALSE; |
|
84 | 84 | } |
85 | 85 | else |
86 | 86 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $result = $db->query("UPDATE users |
91 | 91 | SET remaining_votes='" . $remaining_votes . "' |
92 | 92 | WHERE user_token='" . $_COOKIE['JodelVoterPassword'] . "'"); |
93 | - if($result === false) |
|
93 | + if($result === FALSE) |
|
94 | 94 | { |
95 | 95 | error_log("Update remaining votes failed: (" . $db->errno . ") " . $db->error); |
96 | 96 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | else |
104 | 104 | { |
105 | 105 | $message = 'There is no account available for this jodel. Please create at least one new account to vote this jodel.'; |
106 | - $success = false; |
|
106 | + $success = FALSE; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 |
@@ -29,8 +29,8 @@ |
||
29 | 29 | |
30 | 30 | if(!$userIsVoter && !$userIsAdmin) |
31 | 31 | { |
32 | - error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php'); |
|
33 | - $response = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php',"success" => false); |
|
32 | + error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php'); |
|
33 | + $response = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php', "success" => false); |
|
34 | 34 | echo json_encode($response); |
35 | 35 | die(); |
36 | 36 | } |