These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | include('php/jodel-web.php'); |
||
3 | $posts; |
||
4 | |||
5 | //Get Post Details |
||
6 | if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) |
||
7 | { |
||
8 | $userHandleBuffer = []; |
||
9 | |||
10 | $accountCreator = new GetPostDetails(); |
||
11 | $accountCreator->setAccessToken($jodelAccountForView->accessToken); |
||
12 | $data = $accountCreator->execute(); |
||
13 | |||
14 | if(array_key_exists('error', $data)) |
||
15 | { |
||
16 | echo $data['error']; |
||
17 | exit(); |
||
18 | renderTemplate('The post has been blocked'); |
||
19 | exit(); |
||
20 | } |
||
21 | |||
22 | if(array_key_exists('status_code', $data) && $data->status_code == 404) |
||
23 | { |
||
24 | header('HTTP/1.1 410 Gone'); |
||
25 | include 'error-pages/410.php'; |
||
26 | exit(); |
||
27 | } |
||
28 | |||
29 | $posts[0] = $data; |
||
30 | $ojHandle = $posts[0]['user_handle']; |
||
31 | |||
32 | if(array_key_exists('children', $data)) |
||
33 | { |
||
34 | foreach($data['children'] as $key => $child) |
||
35 | { |
||
36 | //is Comment from OJ? |
||
37 | if($ojHandle == $child['user_handle']) |
||
38 | { |
||
39 | $data['children'][$key]['user_handle'] = 'OJ'; |
||
40 | } |
||
41 | else |
||
42 | { |
||
43 | $numberForUser = array_search($child['user_handle'], $userHandleBuffer); |
||
44 | if($numberForUser === FALSE) |
||
45 | { |
||
46 | array_push($userHandleBuffer, $child['user_handle']); |
||
47 | $data['children'][$key]['user_handle'] = count($userHandleBuffer); |
||
48 | } |
||
49 | else |
||
50 | { |
||
51 | $data['children'][$key]['user_handle'] = $numberForUser + 1; |
||
52 | } |
||
53 | } |
||
54 | array_push($posts, $data['children'][$key]); |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 | //Get Posts and Hashtags |
||
59 | else |
||
60 | { |
||
61 | $posts = $view->getPosts($jodelAccountForView); |
||
62 | } |
||
63 | if(!isset($posts[0])) |
||
64 | { |
||
65 | error_log('Fehler: ' . print_r($posts, true) . print_r($posts['recent'], true) . print_r($posts['posts'], true)); |
||
66 | $title = $view->getTitle(); |
||
67 | $description = $view->getMetaDescription(); |
||
68 | } |
||
69 | else |
||
70 | { |
||
71 | $title = $view->getTitle($posts[0]); |
||
72 | $description = $view->getMetaDescription($posts[0]); |
||
73 | } |
||
74 | |||
75 | if($view->isDetailedView) |
||
76 | { |
||
77 | $backButton = $view->back()->toUrl() . '#postId-' . $view->postId; |
||
78 | } |
||
79 | else |
||
80 | { |
||
81 | $backButton = ''; |
||
82 | } |
||
83 | include 'templates/header.php'; |
||
84 | ?> |
||
85 | |||
86 | <div class="mainContent container"> |
||
87 | <div class="content row"> |
||
88 | <article class="topContent col-sm-8"> |
||
89 | <div id="errorMsg"></div> |
||
90 | |||
91 | <content id="posts"> |
||
92 | <?php |
||
93 | foreach($posts as $post) |
||
94 | { |
||
95 | $view->lastPostId = $post['post_id']; |
||
96 | $view->jodelToHtml($post); |
||
97 | } ?> |
||
98 | </content> |
||
99 | |||
100 | <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
||
101 | <p id="loading"> |
||
102 | Loading… |
||
103 | </p> |
||
104 | <?php } ?> |
||
105 | </article> |
||
106 | |||
107 | <aside class="topSidebar col-sm-4 sidebar-outer"> |
||
108 | <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>"> |
||
109 | <article> |
||
110 | <div> |
||
111 | <h2>Position / Hashtag</h2> |
||
112 | <form action="index.php" method="get"> |
||
113 | <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
||
114 | <label>try: #jhj</label><br> |
||
115 | <input type="submit" value="Set Location" /> |
||
116 | </form> |
||
117 | </div> |
||
118 | </article> |
||
119 | |||
120 | <article> |
||
121 | <div> |
||
122 | <h2>Karma</h2> |
||
123 | <?php echo $jodelAccountForKarma->getKarma(); ?> |
||
124 | </div> |
||
125 | </article> |
||
126 | |||
127 | <article> |
||
128 | <div> |
||
129 | <?php if(!$jodelAccountForView->isAccountVerified()) |
||
130 | { |
||
131 | ?> |
||
132 | <h2>New Jodel</h2> |
||
133 | |||
134 | <button href="templates/captcha.php" data-title="Verify Captcha" data-width="1200" data-toggle="lightbox" data-gallery="remoteload">I am not a robot</button> |
||
135 | |||
136 | <?php |
||
137 | } |
||
138 | else |
||
139 | { |
||
140 | if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
||
141 | <h2>Comment on Jodel</h2> |
||
142 | <form enctype="multipart/form-data" method="POST"> |
||
143 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
||
144 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
||
0 ignored issues
–
show
|
|||
145 | <input type="hidden" name="MAX_FILE_SIZE" value="999990000" /> |
||
146 | <input name="image" type="file" /> |
||
147 | <input type="submit" value="SEND" /> |
||
148 | </form> |
||
149 | <?php } else { ?> |
||
150 | <h2>New Jodel</h2> |
||
151 | <form enctype="multipart/form-data" method="POST"> |
||
152 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
||
153 | <br /> |
||
154 | <select id="postColorPicker" name="color"> |
||
155 | <option value="06A3CB">Blue</option> |
||
156 | <option value="8ABDB0">Teal</option> |
||
157 | <option value="9EC41C">Green</option> |
||
158 | <option value="FFBA00">Yellow</option> |
||
159 | <option value="DD5F5F">Red</option> |
||
160 | <option value="FF9908">Orange</option> |
||
161 | </select> |
||
162 | <input type="hidden" name="MAX_FILE_SIZE" value="999990000" /> |
||
163 | <input name="image" type="file" /> |
||
164 | <input type="submit" value="SEND" /> |
||
165 | </form> |
||
166 | <?php } ?> |
||
167 | <?php } ?> |
||
168 | </div> |
||
169 | </article> |
||
170 | |||
171 | <article> |
||
172 | <div> |
||
173 | <h2>Thank you for donating!</h2> |
||
174 | |||
175 | <progress max="3500" value="3871"></progress> |
||
176 | <p> |
||
177 | The money will be enough until end of 2017. |
||
178 | </p> |
||
179 | </div> |
||
180 | </article> |
||
181 | </div> |
||
182 | </aside> |
||
183 | </div> |
||
184 | <?php include 'templates/nav-bottom.php';?> |
||
185 | </div> |
||
186 | <?php |
||
187 | $includeEmojiAndAjax = TRUE; |
||
188 | include 'templates/footer.php'; |
||
189 | ?> |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.