'; foreach ($posts as $post) { if ($post->data->author == 'Liquid') continue; $i++; $text .= '
  • '.$post->data->author.' (Antworten): '.htmlspecialchars_decode($post->data->body_html); if ($post->data->replies) printPosts($tid,$i,$post->data->replies->data->children,$text); $text .= "
  • "; } $text .= ''; } $title = 'Noch keine Diskussionsbeiträge'; $text = ''; if (ereg("^[0-9]+$", $_SERVER["QUERY_STRING"])) { require("/opt/liquid_feedback_core/constants.php"); $dbconn = pg_connect("dbname=lfbot") or die('Verbindungsaufbau fehlgeschlagen: ' . pg_last_error()); $query = "SELECT forum FROM reddit_map WHERE lqfb = '" . $_SERVER["QUERY_STRING"] . "' LIMIT 1;"; $result = pg_query($query) or die('Abfrage fehlgeschlagen: ' . pg_last_error()); $tid = 0; while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) { $tid = $line["forum"]; } pg_free_result($result); pg_close($dbconn); $data = file_get_contents("https://reddit.piratenpartei.at/comments/$tid.json"); if (strlen($data) < 100) { $text = "Noch keine Beiträge"; return; } $data = json_decode($data); $data = $data[1]->data->children; $i = 0; printPosts($tid,$i,$data,$text); if ($i > 0) { $title = "$i Diskussionsbeiträge"; } else { $title = 'Noch keine Diskussionsbeiträge'; $text = ''; } } echo<<$title
    $text END; ?>