// Determine what type of feed to output $type = isset($_GET['type']) ? strtolower($_GET['type']) : 'html'; if (!in_array($type, array('html', 'rss', 'atom', 'xml'))) { $type = 'html'; } $show = isset($_GET['show']) ? intval($_GET['show']) : 15; if ($show < 1 || $show > 50) { $show = 15; } // Was a thread ID supplied? if (isset($_GET['tid'])) { $tid = intval($_GET['tid']); // Fetch thread subject $result = $db->query('SELECT t.subject, t.first_comment_id FROM ' . $db->prefix . 'threads AS t LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id=' . $luna_user['g_id'] . ') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL AND t.id=' . $tid) or error('Unable to fetch thread info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) { http_authenticate_user(); exit(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna')); } $cur_thread = $db->fetch_assoc($result); if ($luna_config['o_censoring'] == '1') { $cur_thread['subject'] = censor_words($cur_thread['subject']); } // Setup the feed $feed = array('title' => $luna_config['o_board_title'] . __(' / ', 'luna') . $cur_thread['subject'], 'link' => get_base_url(true) . '/thread.php?id=' . $tid, 'description' => sprintf(__('The most recent comments in %s.', 'luna'), $cur_thread['subject']), 'items' => array(), 'type' => 'comments'); // Fetch $show comments $result = $db->query('SELECT p.id, p.commenter, p.message, p.hide_smilies, p.commented, p.commenter_id, u.email_setting, u.email, p.commenter_email FROM ' . $db->prefix . 'comments AS p INNER JOIN ' . $db->prefix . 'users AS u ON u.id=p.commenter_id WHERE p.thread_id=' . $tid . ' ORDER BY p.commented DESC LIMIT ' . $show) or error('Unable to fetch comment info', __FILE__, __LINE__, $db->error()); while ($cur_comment = $db->fetch_assoc($result)) { $cur_comment['message'] = parse_message($cur_comment['message']); $item = array('id' => $cur_comment['id'], 'title' => $cur_thread['first_comment_id'] == $cur_comment['id'] ? $cur_thread['subject'] : __('Re: ', 'luna') . $cur_thread['subject'], 'link' => get_base_url(true) . '/thread.php?pid=' . $cur_comment['id'] . '#p' . $cur_comment['id'], 'description' => $cur_comment['message'], 'author' => array('name' => $cur_comment['commenter']), 'pubdate' => $cur_comment['commented']); if ($cur_comment['commenter_id'] > 1) { if ($cur_comment['email_setting'] == '0' && !$luna_user['is_guest']) {
case "rss": $feed = db_escape_string($_REQUEST["id"]); $user = db_escape_string($_REQUEST["user"]); $pass = db_escape_string($_REQUEST["pass"]); $is_cat = $_REQUEST["is_cat"] != false; $limit = (int) db_escape_string($_REQUEST["limit"]); $search = db_escape_string($_REQUEST["q"]); $match_on = db_escape_string($_REQUEST["m"]); $search_mode = db_escape_string($_REQUEST["smode"]); if (SINGLE_USER_MODE) { authenticate_user($link, "admin", null); } if (!$_SESSION["uid"] && $user && $pass) { authenticate_user($link, $user, $pass); } if ($_SESSION["uid"] || http_authenticate_user($link)) { generate_syndicated_feed($link, 0, $feed, $is_cat, $limit, $search, $search_mode, $match_on); } break; // rss // rss case "getUnread": $login = db_escape_string($_REQUEST["login"]); $fresh = $_REQUEST["fresh"] == "1"; header("Content-Type: text/plain; charset=utf-8"); $result = db_query($link, "SELECT id FROM ttrss_users WHERE login = '******'"); if (db_num_rows($result) == 1) { $uid = db_fetch_result($result, 0, "id"); print getGlobalUnread($link, $uid); if ($fresh) { print ";";