mmainstreet /
jodel-web
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 | |||
| 141 | |||
| 142 | if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?> |
||
| 143 | <h2>Comment on Jodel</h2> |
||
| 144 | <form method="POST"> |
||
| 145 | <input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" /> |
||
| 146 | <textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> |
||
|
0 ignored issues
–
show
|
|||
| 147 | <br /> |
||
| 148 | <input type="submit" value="SEND" /> |
||
| 149 | </form> |
||
| 150 | <?php } else { ?> |
||
| 151 | <h2>New Jodel</h2> |
||
| 152 | <form enctype="multipart/form-data" method="POST"> |
||
| 153 | <textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> |
||
| 154 | <br /> |
||
| 155 | <select id="postColorPicker" name="color"> |
||
| 156 | <option value="06A3CB">Blue</option> |
||
| 157 | <option value="8ABDB0">Teal</option> |
||
| 158 | <option value="9EC41C">Green</option> |
||
| 159 | <option value="FFBA00">Yellow</option> |
||
| 160 | <option value="DD5F5F">Red</option> |
||
| 161 | <option value="FF9908">Orange</option> |
||
| 162 | </select> |
||
| 163 | <br /> |
||
| 164 | <input type="hidden" name="MAX_FILE_SIZE" value="999990000" /> |
||
| 165 | <input name="image" type="file" /> |
||
| 166 | <input type="submit" value="SEND" /> |
||
| 167 | </form> |
||
| 168 | <?php } ?> |
||
| 169 | <?php } ?> |
||
| 170 | </div> |
||
| 171 | </article> |
||
| 172 | |||
| 173 | <article> |
||
| 174 | <div> |
||
| 175 | <h2>Thank you for donating!</h2> |
||
| 176 | |||
| 177 | <progress max="3500" value="3871"></progress> |
||
| 178 | <p> |
||
| 179 | The money will be enough until end of 2017. |
||
| 180 | </p> |
||
| 181 | </div> |
||
| 182 | </article> |
||
| 183 | </div> |
||
| 184 | </aside> |
||
| 185 | </div> |
||
| 186 | <?php include 'templates/nav-bottom.php';?> |
||
| 187 | </div> |
||
| 188 | <?php |
||
| 189 | $includeEmojiAndAjax = TRUE; |
||
| 190 | include 'templates/footer.php'; |
||
| 191 | ?> |
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.