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) |
||
0 ignored issues
–
show
|
|||
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 action="index.php" 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 | |||
147 | <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> |
||
148 | <input type="hidden" name="cmd" value="_s-xclick"> |
||
149 | <input type="hidden" name="hosted_button_id" value="RR45538QV3VXE"> |
||
150 | <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> |
||
151 | <img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1"> |
||
152 | </form> |
||
153 | |||
154 | <p class="bitcoin-address">Bitcoin-address: <a href="img/bitcoin-address.png">1DzaUWm9Du6CUQLj6QTGC9kpxzKE3yZZHV</a></p> |
||
155 | |||
156 | <progress max="3500" value="111"></progress> |
||
157 | <p> |
||
158 | My payments to keep this Project up so far: |
||
159 | </p> |
||
160 | <ul> |
||
161 | <li>Webspace 15€ - goes till 01-03-2018</li> |
||
162 | <li>Domain 20€ - goes till 06-12-2017</li> |
||
163 | </ul> |
||
164 | </div> |
||
165 | </article> |
||
166 | |||
167 | <article> |
||
168 | <div> |
||
169 | <h2>Beta - Votebot</h2> |
||
170 | |||
171 | <p>The Beta for the vote bot feature is starting soon. You are cordially invited to test. Please contact us: [email protected]</p> |
||
172 | </div> |
||
173 | </article> |
||
174 | </div> |
||
175 | </aside> |
||
176 | </div> |
||
177 | <?php include 'templates/nav-bottom.php';?> |
||
178 | </div> |
||
179 | <?php |
||
180 | $includeEmojiAndAjax = TRUE; |
||
181 | include 'templates/footer.php'; |
||
182 | ?> |
PHP provides two ways to mark string literals. Either with single quotes
'literal'
or with double quotes"literal"
. The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (
\'
) and the backslash (\\
). Every other character is displayed as is.Double quoted string literals may contain other variables or more complex escape sequences.
will print an indented:
Single is Value
If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.
For more information on PHP string literals and available escape sequences see the PHP core documentation.