Ejemplo n.º 1
0
    Kill($loguser['banned'] ? __('You may not post because you are banned.') : __('You may not post in this forum.'));
}
$rFora = Query("select * from {forums} where id={0}", $fid);
if (NumRows($rFora)) {
    $forum = Fetch($rFora);
} else {
    Kill("Unknown forum ID.");
}
$fid = $forum['id'];
$isHidden = !HasPermission('forum.viewforum', $fid, true);
if ($thread['closed'] && !HasPermission('mod.closethreads', $fid)) {
    Kill(__("This thread is locked."));
}
$OnlineUsersFid = $fid;
LoadPostToolbar();
$tags = ParseThreadTags($thread['title']);
$urlname = $isHidden ? '' : $tags[0];
MakeCrumbs(forumCrumbs($forum) + array(actionLink("thread", $tid, '', $urlname) => $tags[0], '' => __("New reply")));
if (!$thread['sticky'] && Settings::get("oldThreadThreshold") > 0 && $thread['lastpostdate'] < time() - 2592000 * Settings::get("oldThreadThreshold")) {
    Alert(__("You are about to bump an old thread. This is usually a very bad idea. Please think about what you are about to do before you press the Post button."));
}
$attachs = array();
if (isset($_POST['saveuploads'])) {
    $attachs = HandlePostAttachments(0, false);
} else {
    if (isset($_POST['actionpreview'])) {
        $attachs = HandlePostAttachments(0, false);
        $previewPost['text'] = $_POST["text"];
        $previewPost['num'] = $loguser['posts'] + 1;
        $previewPost['posts'] = $loguser['posts'] + 1;
        $previewPost['id'] = 0;
Ejemplo n.º 2
0
             $r = array();
             $r['link'] = makeThreadLink($result);
             $r['description'] = '';
             $r['user'] = UserLink(getDataPrefix($result, "u_"));
             $r['formattedDate'] = formatdate($result['lastpostdate']);
             $rdata[] = $r;
         }
     }
 } else {
     $nres = FetchResult("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {posts_text} pt\n\t\t\t\tLEFT JOIN {posts} p ON pt.pid = p.id\n\t\t\t\tLEFT JOIN {threads} t ON t.id = p.thread\n\t\t\tWHERE pt.pid IN ({0c}) AND t.forum IN ({1c}) AND pt.revision = p.currentrevision", $results, $viewableforums);
     $search = Query("\n\t\t\tSELECT\n\t\t\t\tpt.text, pt.pid,\n\t\t\t\tp.date,\n\t\t\t\tt.title, t.id,\n\t\t\t\tu.(_userfields)\n\t\t\tFROM {posts_text} pt\n\t\t\t\tLEFT JOIN {posts} p ON pt.pid = p.id\n\t\t\t\tLEFT JOIN {threads} t ON t.id = p.thread\n\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\tWHERE pt.pid IN ({0c}) AND t.forum IN ({1c}) AND pt.revision = p.currentrevision\n\t\t\tORDER BY p.date DESC\n\t\t\tLIMIT {2u},{3u}", $results, $viewableforums, $from, $tpp);
     if (NumRows($search)) {
         $results = "";
         while ($result = Fetch($search)) {
             $r = array();
             $tags = ParseThreadTags($result['title']);
             //			$result['text'] = str_replace("<!--", "~#~", str_replace("-->", "~#~", $result['text']));
             $r['description'] = MakeSnippet($result['text'], $terms);
             $r['user'] = UserLink(getDataPrefix($result, "u_"));
             $r['link'] = actionLinkTag($tags[0], "post", $result['pid']);
             $r['formattedDate'] = formatdate($result['date']);
             $rdata[] = $r;
         }
     }
 }
 if ($nres == 0) {
     $restext = __('No results found');
 } else {
     if ($nres == 1) {
         $restext = __('1 result found');
     } else {
Ejemplo n.º 3
0
echo htmlspecialchars($url);
?>
</link>
		<description><?php 
echo htmlspecialchars($desc);
?>
</description>
		<atom:link href="<?php 
echo htmlspecialchars($fullurl);
?>
/rss.php" rel="self" type="application/rss+xml" />

<?php 
$entries = Query("\tSELECT \n\t\t\t\t\t\t\tt.id, t.title, \n\t\t\t\t\t\t\tp.date,\n\t\t\t\t\t\t\tpt.text,\n\t\t\t\t\t\t\tsu.name uname, su.displayname udname\n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\t\tLEFT JOIN {posts} p ON p.thread=t.id AND p.id=t.firstpostid\n\t\t\t\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid=p.id AND pt.revision=p.currentrevision\n\t\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tWHERE t.forum={0} AND p.deleted=0\n\t\t\t\t\t\tORDER BY p.date DESC LIMIT 5", $fid);
while ($entry = Fetch($entries)) {
    $tags = ParseThreadTags($entry['title']);
    $title = htmlspecialchars($entry['title']);
    $username = $entry['udname'] ? $entry['udname'] : $entry['uname'];
    $rfcdate = htmlspecialchars(gmdate(DATE_RFC1123, $entry['date']));
    $entryurl = htmlspecialchars($url . actionLink('thread', $entry['id'], '', $tags[0]));
    $text = $entry['text'];
    $text = preg_replace_callback('@\\[youtube\\](.*?)\\[/youtube\\]@si', 'fixyoutube', $text);
    $text = preg_replace('@\\[spoiler.*?\\].*?\\[/spoiler\\]@si', '(spoiler)', $text);
    $text = CleanUpPost($text, $username, true);
    $text = preg_replace('@<img[^>]+?src\\s*=\\s*(["\'])(.*?)\\1[^>]*?>@si', '<a href="$2">(image)</a>', $text);
    $text = preg_replace('@<img[^>]+?src\\s*=\\s*([^\\s>]+?)(\\s+[^>]*?)?>@si', '<a href="$1">(image)</a>', $text);
    $text = preg_replace('@([="\'])\\?page=@si', '$1' . $fullurl . '/?page=', $text);
    $text = str_replace(']]>', ']]&gt;', $text);
    $username = htmlspecialchars($username);
    echo "\n\t\t<item>\n\t\t\t<title>{$title} -- posted by {$username}</title>\n\t\t\t<link>{$entryurl}</link>\n\t\t\t<pubDate>{$rfcdate}</pubDate>\n\t\t\t<description><![CDATA[{$text}]]></description>\n\t\t\t<guid>{$entryurl}</guid>\n\t\t</item>\n";
}
Ejemplo n.º 4
0
function makeThreadListing($threads, $pagelinks, $dostickies = true, $showforum = false)
{
    global $loguserid, $loguser, $misc;
    $threadlist = array();
    while ($thread = Fetch($threads)) {
        $tdata = array('id' => $thread['id']);
        $starter = getDataPrefix($thread, 'su_');
        $last = getDataPrefix($thread, 'lu_');
        $ispublic = HasPermission('forum.viewforum', $thread['forum'], true);
        $tags = ParseThreadTags($thread['title']);
        $urlname = $ispublic ? $tags[0] : '';
        $threadlink = actionLinkTag($tags[0], 'thread', $thread['id'], '', $urlname);
        $tdata['link'] = Settings::get("tagsDirection") === 'Left' ? $tags[1] . ' ' . $threadlink : $threadlink . ' ' . $tags[1];
        $NewIcon = '';
        $tdata['gotonew'] = '';
        if ($thread['closed']) {
            $NewIcon = 'off';
        }
        if ($thread['replies'] >= $misc['hotcount']) {
            $NewIcon .= 'hot';
        }
        if (!$loguserid && $thread['lastpostdate'] > time() - 900 || $loguserid && $thread['lastpostdate'] > $thread['readdate']) {
            $NewIcon .= 'new';
            if ($loguserid) {
                $tdata['gotonew'] = actionLinkTag('<img src="' . resourceLink('img/gotounread.png') . '" alt="[go to first unread post]">', 'post', '', 'tid=' . $thread['id'] . '&time=' . (int) $thread['readdate']);
            }
        } else {
            if (!$thread['closed'] && !$thread['sticky'] && Settings::get("oldThreadThreshold") > 0 && $thread['lastpostdate'] < time() - 2592000 * Settings::get("oldThreadThreshold")) {
                $NewIcon = 'old';
            }
        }
        if ($NewIcon) {
            $tdata['new'] = '<div class="statusIcon ' . $NewIcon . '"></div>';
        } else {
            $tdata['new'] = '';
        }
        $tdata['sticky'] = $thread['sticky'];
        if ($thread['icon']) {
            //This is a hack, but given how icons are stored in the DB, I can do nothing about it without breaking DB compatibility.
            if (startsWith($thread['icon'], "img/")) {
                $thread['icon'] = resourceLink($thread['icon']);
            }
            $tdata['icon'] = "<img src=\"" . htmlspecialchars($thread['icon']) . "\" alt=\"\" class=\"smiley\" style=\"max-width:32px; max-height:32px;\">";
        } else {
            $tdata['icon'] = '';
        }
        $tdata['poll'] = $thread['poll'] ? "<img src=\"" . resourceLink("img/poll.png") . "\" alt=\"[poll]\">" : "";
        $n = 4;
        $total = $thread['replies'];
        $ppp = $loguser['postsperpage'];
        if (!$ppp) {
            $ppp = 20;
        }
        $numpages = floor($total / $ppp);
        $pl = '';
        if ($numpages <= $n * 2) {
            for ($i = 1; $i <= $numpages; $i++) {
                $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp, $urlname);
            }
        } else {
            for ($i = 1; $i < $n; $i++) {
                $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp, $urlname);
            }
            $pl .= " &hellip; ";
            for ($i = $numpages - $n + 1; $i <= $numpages; $i++) {
                $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp, $urlname);
            }
        }
        if ($pl) {
            $tdata['pagelinks'] = actionLinkTag(1, "thread", $thread['id'], '', $urlname) . $pl;
        } else {
            $tdata['pagelinks'] = '';
        }
        if ($showforum) {
            $tdata['forumlink'] = actionLinkTag(htmlspecialchars($thread["f_title"]), "forum", $thread["f_id"], "", $ispublic ? $thread["f_title"] : '');
        }
        $tdata['startuser'] = UserLink($starter);
        $tdata['replies'] = $thread['replies'];
        $tdata['views'] = $thread['views'];
        $tdata['lastpostdate'] = formatdate($thread['lastpostdate']);
        $tdata['lastpostuser'] = UserLink($last);
        $tdata['lastpostlink'] = actionLink("post", $thread['lastpostid']);
        $threadlist[$tdata['id']] = $tdata;
    }
    RenderTemplate('threadlist', array('threads' => $threadlist, 'pagelinks' => $pagelinks, 'dostickies' => $dostickies, 'showforum' => $showforum));
}
Ejemplo n.º 5
0
function makeThreadLink($thread)
{
    $tags = ParseThreadTags($thread["title"]);
    setUrlName("thread", $thread["id"], $tags[0]);
    $link = actionLinkTag($tags[0], "thread", $thread["id"], "", $tags[0]);
    $tags = $tags[1];
    if (Settings::get("tagsDirection") === 'Left') {
        return $tags . " " . $link;
    } else {
        return $link . " " . $tags;
    }
}
Ejemplo n.º 6
0
function makeThreadLink($thread)
{
    $tags = ParseThreadTags($thread['title']);
    $link = actionLinkTag($tags[0], 'thread', $thread['id'], '', HasPermission('forum.viewforum', $thread['forum'], true) ? $tags[0] : '');
    $tags = $tags[1];
    if (Settings::get("tagsDirection") === 'Left') {
        return $tags . " " . $link;
    } else {
        return $link . " " . $tags;
    }
}