Commit 243aae7b17
Unsigned
Layout: unified · split
index.php +8 −6
| @@ -177,16 +177,18 @@ function get_user(string $api_url, string $inline_title) { | |||
| 177 | $limit = count($response['submitted']) > 10 ? 10 : count($response['submitted']); | 177 | $limit = count($response['submitted']) > 10 ? 10 : count($response['submitted']); |
| 178 | if (count($response['submitted']) > 0) { | 178 | if (count($response['submitted']) > 0) { |
| 179 | for ($i = 0; $i < $limit; $i++) { | 179 | for ($i = 0; $i < $limit; $i++) { |
| 180 | $sub_url = 'https://hacker-news.firebaseio.com/v0/item/' . $response['submitted> | 180 | $sub_url = 'https://hacker-news.firebaseio.com/v0/item/' . $response['submitted][$i] . '.json'; |
| 181 | $sub_response_raw = file_get_contents($sub_url); | 181 | $sub_response_raw = file_get_contents($sub_url); |
| 182 | $sub_response = json_decode($sub_response_raw, true); | 182 | $sub_response = json_decode($sub_response_raw, true); |
| 183 | 183 | ||
| 184 | // TODO: Create switch-case to cover a story, comment, job, poll, or pollopt | 184 | // TODO: Create switch-case to cover a story, comment, job, poll, or pollopt |
| 185 | $html = '<div><a href="' . $sub_response['url'] . '">' . $sub_response['title']> | 185 | $html = '<div><a href="' . $sub_response['url'] . '">' . $sub_response['title'] . '</a>'; |
| 186 | $html .= '<p><time datetime="' . date('Y-m-d h:m:s', $sub_response['time']) . '> | 186 | $html .= '<p><time datetime="' . date('Y-m-d h:m:s', $sub_response['time']) . '">'; |
| 187 | $html .= date('Y-m-d h:m:s', $sub_response['time']) . '</time> by '; | 187 | $html .= date('Y-m-d h:m:s', $sub_response['time']) . '</time> by <a'; |
| 188 | $html .= $sub_response['by'] . ' | ' . $sub_response['score'] . ' points</p></d> | 188 | $html .= 'href="/user/'. $sub_response['by'] . '">'; |
| 189 | $html_output .= $html; | 189 | $html .= $sub_response['by'] . ' | ' . $sub_response['score']; |
| 190 | $html .= 'points</p></div>'; | ||
| 191 | $html_output .= $html; | ||
| 190 | } | 192 | } |
| 191 | } else { | 193 | } else { |
| 192 | $html_output .= '<p>User has no subsmissions.</p>'; | 194 | $html_output .= '<p>User has no subsmissions.</p>'; |