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('status_code', $data) && $data->status_code == 404) |
||
15 | { |
||
16 | header('HTTP/1.1 410 Gone'); |
||
17 | include 'error-pages/410.php'; |
||
18 | exit; |
||
19 | } |
||
20 | |||
21 | $posts[0] = $data; |
||
22 | |||
23 | if(array_key_exists('children', $data)) { |
||
24 | foreach($data['children'] as $key => $child) |
||
25 | { |
||
26 | |||
27 | if(!$child["parent_creator"] == 1) |
||
28 | { |
||
29 | $numberForUser = array_search($child['user_handle'], $userHandleBuffer); |
||
30 | if($numberForUser === FALSE) |
||
31 | { |
||
32 | array_push($userHandleBuffer, $child['user_handle']); |
||
33 | $data['children'][$key]['user_handle'] = count($userHandleBuffer); |
||
34 | } |
||
35 | else |
||
36 | { |
||
37 | $data['children'][$key]['user_handle'] = $numberForUser + 1; |
||
38 | } |
||
39 | } |
||
40 | |||
41 | array_push($posts, $data['children'][$key]); |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | //Get Posts and Hashtags |
||
46 | else |
||
47 | { |
||
48 | $posts = $view->getPosts($jodelAccountForView); |
||
49 | } |
||
50 | if(!isset($posts[0])) |
||
51 | { |
||
52 | error_log('Fehler: ' . print_r($posts, true) . print_r($posts['recent'], true) . print_r($posts['posts'], true)); |
||
53 | $title = $view->getTitle(); |
||
54 | $description = $view->getMetaDescription(); |
||
55 | } |
||
56 | else |
||
57 | { |
||
58 | $title = $view->getTitle($posts[0]); |
||
59 | $description = $view->getMetaDescription($posts[0]); |
||
60 | } |
||
61 | |||
62 | if($view->isDetailedView) |
||
63 | { |
||
64 | $backButton = $view->back()->toUrl() . '#postId-' . $view->postId; |
||
65 | } |
||
66 | else |
||
67 | { |
||
68 | $backButton = ''; |
||
69 | } |
||
70 | include 'templates/header.php'; |
||
71 | ?> |
||
72 | |||
73 | <div class="mainContent container"> |
||
74 | <div class="content row"> |
||
75 | <article class="topContent col-sm-8"> |
||
76 | |||
77 | <content id="posts"> |
||
78 | <?php |
||
79 | foreach($posts as $post) |
||
80 | { |
||
81 | $view->lastPostId = $post['post_id']; |
||
82 | $view->jodelToHtml($post); |
||
83 | } ?> |
||
84 | </content> |
||
85 | |||
86 | <?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?> |
||
87 | <p id="loading"> |
||
88 | Loading… |
||
89 | </p> |
||
90 | <?php } ?> |
||
91 | </article> |
||
92 | |||
93 | <aside class="topSidebar col-sm-4 sidebar-outer"> |
||
94 | <div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>"> |
||
95 | <article> |
||
96 | <div> |
||
97 | <h2>Position / Hashtag</h2> |
||
98 | <form method="get"> |
||
99 | <input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required> |
||
100 | <label>try: #jhj</label><br> |
||
101 | <input type="submit" value="Set Location" /> |
||
102 | </form> |
||
103 | </div> |
||
104 | </article> |
||
105 | |||
106 | <article> |
||
107 | <div> |
||
108 | <h2>Karma</h2> |
||
109 | <?php echo $jodelAccountForKarma->getKarma(); ?> |
||
110 | </div> |
||
111 | </article> |
||
112 | |||
113 | <article> |
||
114 | <div> |
||
115 | <?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
||
116 | <h2>Comment on Jodel</h2> |
||
117 | <form method="POST"> |
||
118 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
||
119 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
||
120 | <br /> |
||
121 | <input type="submit" value="SEND" /> |
||
122 | </form> |
||
123 | <?php } else { ?> |
||
124 | <h2>New Jodel</h2> |
||
125 | <form method="POST"> |
||
126 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
||
127 | <br /> |
||
128 | <select id="postColorPicker" name="color"> |
||
129 | <option value="06A3CB">Blue</option> |
||
130 | <option value="8ABDB0">Teal</option> |
||
131 | <option value="9EC41C">Green</option> |
||
132 | <option value="FFBA00">Yellow</option> |
||
133 | <option value="DD5F5F">Red</option> |
||
134 | <option value="FF9908">Orange</option> |
||
135 | </select> |
||
136 | <br /> |
||
137 | <input type="submit" value="SEND" /> |
||
138 | </form> |
||
139 | <?php } ?> |
||
140 | </div> |
||
141 | </article> |
||
142 | |||
143 | <article> |
||
144 | <div> |
||
145 | <h2>Donate to JodelBlue</h2> |
||
146 | <p class="bitcoin-address">Bitcoin-address: <a href="img/bitcoin-address.png">1DzaUWm9Du6CUQLj6QTGC9kpxzKE3yZZHV</a></p> |
||
0 ignored issues
–
show
|
|||
147 | <progress max="35" value="0"></progress> |
||
148 | <p> |
||
149 | My payments to keep this Project up so far: |
||
150 | </p> |
||
151 | <ul> |
||
152 | <li>Webspace 15€ - goes till 01-03-2018</li> |
||
153 | <li>Domain 20€ - goes till 06-12-2017</li> |
||
154 | </ul> |
||
155 | </div> |
||
156 | </article> |
||
157 | </div> |
||
158 | </aside> |
||
159 | </div> |
||
160 | <?php include 'templates/nav-bottom.php';?> |
||
161 | </div> |
||
162 | <?php |
||
163 | $includeEmojiAndAjax = TRUE; |
||
164 | include 'templates/footer.php'; |
||
165 | ?> |
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.