function bbcodeThread($contents, $arg, $parenttag)
{
    global $threadLinkCache, $loguser;
    $id = (int) $arg;
    if (!isset($threadLinkCache[$id])) {
        $rThread = Query("select t.id, t.title, t.forum from {threads} t where t.id={0} AND t.forum IN ({1c})", $id, ForumsWithPermission('forum.viewforum'));
        if (NumRows($rThread)) {
            $thread = Fetch($rThread);
            $threadLinkCache[$id] = makeThreadLink($thread);
        } else {
            $threadLinkCache[$id] = "<invalid thread ID>";
        }
    }
    return $threadLinkCache[$id];
}
Esempio n. 2
0
function makePost($post, $type, $params = array())
{
    global $loguser, $loguserid, $usergroups, $isBot, $blocklayouts;
    $poster = getDataPrefix($post, 'u_');
    $post['userlink'] = UserLink($poster);
    LoadBlockLayouts();
    $pltype = Settings::get('postLayoutType');
    $isBlocked = $poster['globalblock'] || $loguser['blocklayouts'] || $post['options'] & 1 || isset($blocklayouts[$poster['id']]);
    $post['type'] = $type;
    $post['formattedDate'] = formatdate($post['date']);
    if (!HasPermission('admin.viewips')) {
        $post['ip'] = '';
    } else {
        $post['ip'] = htmlspecialchars($post['ip']);
    }
    // TODO IP formatting?
    if ($post['deleted'] && $type == POST_NORMAL) {
        $post['deluserlink'] = UserLink(getDataPrefix($post, 'du_'));
        $post['delreason'] = htmlspecialchars($post['reason']);
        $links = array();
        if (HasPermission('mod.deleteposts', $params['fid'])) {
            $links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']);
            $links['view'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",true); return false;\">" . __("View") . "</a>";
        }
        $post['links'] = $links;
        RenderTemplate('postbox_deleted', array('post' => $post));
        return;
    }
    $links = array();
    if ($type != POST_SAMPLE) {
        $forum = $params['fid'];
        $thread = $params['tid'];
        $notclosed = !$post['closed'] || HasPermission('mod.closethreads', $forum);
        $extraLinks = array();
        if (!$isBot) {
            if ($type == POST_DELETED_SNOOP) {
                if ($notclosed && HasPermission('mod.deleteposts', $forum)) {
                    $links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']);
                }
                $links['close'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",false); return false;\">" . __("Close") . "</a>";
            } else {
                if ($type == POST_NORMAL) {
                    if ($notclosed) {
                        if ($loguserid && HasPermission('forum.postreplies', $forum) && !$params['noreplylinks']) {
                            $links['quote'] = actionLinkTag(__("Quote"), "newreply", $thread, "quote=" . $post['id']);
                        }
                        $editrights = 0;
                        if ($poster['id'] == $loguserid && HasPermission('user.editownposts') || HasPermission('mod.editposts', $forum)) {
                            $links['edit'] = actionLinkTag(__("Edit"), "editpost", $post['id']);
                            $editrights++;
                        }
                        if ($poster['id'] == $loguserid && HasPermission('user.deleteownposts') || HasPermission('mod.deleteposts', $forum)) {
                            if ($post['id'] != $post['firstpostid']) {
                                $link = htmlspecialchars(actionLink('editpost', $post['id'], 'delete=1&key=' . $loguser['token']));
                                $onclick = HasPermission('mod.deleteposts', $forum) ? " onclick=\"deletePost(this);return false;\"" : ' onclick="if(!confirm(\'Really delete this post?\'))return false;"';
                                $links['delete'] = "<a href=\"{$link}\"{$onclick}>" . __('Delete') . "</a>";
                            }
                            $editrights++;
                        }
                        if ($editrights < 2 && HasPermission('user.reportposts')) {
                            $links['report'] = actionLinkTag(__('Report'), 'reportpost', $post['id']);
                        }
                    }
                    // plugins should add to $extraLinks
                    $bucket = "topbar";
                    include __DIR__ . "/pluginloader.php";
                }
            }
            $links['extra'] = $extraLinks;
        }
        //Threadlinks for listpost.php
        if ($params['threadlink']) {
            $thread = array();
            $thread['id'] = $post['thread'];
            $thread['title'] = $post['threadname'];
            $thread['forum'] = $post['fid'];
            $post['threadlink'] = makeThreadLink($thread);
        } else {
            $post['threadlink'] = '';
        }
        //Revisions
        if ($post['revision']) {
            $ru_link = UserLink(getDataPrefix($post, "ru_"));
            $revdetail = ' ' . format(__('by {0} on {1}'), $ru_link, formatdate($post['revdate']));
            if (HasPermission('mod.editposts', $forum)) {
                $post['revdetail'] = "<a href=\"javascript:void(0);\" onclick=\"showRevisions(" . $post['id'] . ")\">" . Format(__('rev. {0}'), $post['revision']) . "</a>" . $revdetail;
            } else {
                $post['revdetail'] = Format(__('rev. {0}'), $post['revision']) . $revdetail;
            }
        }
        //</revisions>
    }
    $post['links'] = $links;
    // POST SIDEBAR
    $sidebar = array();
    // quit abusing custom syndromes you unoriginal fuckers
    $poster['title'] = preg_replace('@Affected by \'?.*?Syndrome\'?@si', '', $poster['title']);
    $sidebar['rank'] = GetRank($poster['rankset'], $poster['posts']);
    if ($poster['title']) {
        $sidebar['title'] = strip_tags(CleanUpPost($poster['title'], '', true), '<b><strong><i><em><span><s><del><img><a><br/><br><small>');
    } else {
        $sidebar['title'] = htmlspecialchars($usergroups[$poster['primarygroup']]['title']);
    }
    $sidebar['syndrome'] = GetSyndrome(getActivity($poster['id']));
    if ($post['mood'] > 0) {
        if (file_exists(DATA_DIR . "avatars/" . $poster['id'] . "_" . $post['mood'])) {
            $sidebar['avatar'] = "<img src=\"" . DATA_URL . "avatars/" . $poster['id'] . "_" . $post['mood'] . "\" alt=\"\">";
        }
    } else {
        if ($poster['picture']) {
            $pic = str_replace('$root/', DATA_URL, $poster['picture']);
            $sidebar['avatar'] = "<img src=\"" . htmlspecialchars($pic) . "\" alt=\"\">";
        }
    }
    $lastpost = $poster['lastposttime'] ? timeunits(time() - $poster['lastposttime']) : "none";
    $lastview = timeunits(time() - $poster['lastactivity']);
    if (!$post['num']) {
        $sidebar['posts'] = $poster['posts'];
    } else {
        $sidebar['posts'] = $post['num'] . '/' . $poster['posts'];
    }
    $sidebar['since'] = cdate($loguser['dateformat'], $poster['regdate']);
    $sidebar['lastpost'] = $lastpost;
    $sidebar['lastview'] = $lastview;
    if ($poster['lastactivity'] > time() - 300) {
        $sidebar['isonline'] = __("User is <strong>online</strong>");
    }
    $sidebarExtra = array();
    $bucket = "sidebar";
    include __DIR__ . "/pluginloader.php";
    $sidebar['extra'] = $sidebarExtra;
    $post['sidebar'] = $sidebar;
    // OTHER STUFF
    $post['haslayout'] = false;
    $post['fulllayout'] = false;
    if (!$isBlocked) {
        $poster['postheader'] = $pltype ? trim($poster['postheader']) : '';
        $poster['signature'] = trim($poster['signature']);
        $post['haslayout'] = $poster['postheader'] ? 1 : 0;
        $post['fulllayout'] = $poster['fulllayout'] && $post['haslayout'] && $pltype == 2;
        if (!$post['haslayout'] && $poster['signature']) {
            $poster['signature'] = '<div class="signature">' . $poster['signature'] . '</div>';
        }
    } else {
        $poster['postheader'] = '';
        $poster['signature'] = '';
    }
    $post['contents'] = makePostText($post, $poster);
    //PRINT THE POST!
    RenderTemplate('postbox', array('post' => $post));
}
Esempio n. 3
0
$fid = $forum['id'];
AssertForbidden("viewForum", $fid);
$isHidden = (int) ($forum['minpower'] > 0);
if ($forum['minpowerreply'] > $loguser['powerlevel']) {
    Kill(__("Your power is not enough."));
}
if ($thread['closed'] && $loguser['powerlevel'] < 3) {
    Kill(__("This thread is locked."));
}
$OnlineUsersFid = $fid;
write("\n\t<script type=\"text/javascript\">\n\t\t\twindow.addEventListener(\"load\",  hookUpControls, false);\n\t</script>\n");
$tags = ParseThreadTags($thread['title']);
setUrlName("thread", $thread["id"], $thread["title"]);
$crumbs = new PipeMenu();
makeForumCrumbs($crumbs, $forum);
$crumbs->add(new PipeMenuHtmlEntry(makeThreadLink($thread)));
$crumbs->add(new PipeMenuTextEntry(__("New reply")));
makeBreadcrumbs($crumbs);
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."));
}
if (isset($_POST['actionpreview'])) {
    $previewPost['text'] = $_POST["text"];
    $previewPost['num'] = $loguser['posts'] + 1;
    $previewPost['posts'] = $loguser['posts'] + 1;
    $previewPost['id'] = "_";
    $previewPost['options'] = 0;
    if ($_POST['nopl']) {
        $previewPost['options'] |= 1;
    }
    if ($_POST['nosm']) {
Esempio n. 4
0
 if (isset($_GET['from'])) {
     $from = (int) $_GET['from'];
 } else {
     $from = 0;
 }
 $tpp = $loguser['threadsperpage'];
 if ($tpp < 1) {
     $tpp = 50;
 }
 if (!$_GET['inposts']) {
     $nres = FetchResult("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {threads} t\n\t\t\tWHERE t.id IN ({0c}) AND t.forum IN ({1c})", $results, $viewableforums);
     $search = Query("\n\t\t\tSELECT\n\t\t\t\tt.id, t.title, t.user, t.lastpostdate, t.forum, \n\t\t\t\tu.(_userfields)\n\t\t\tFROM {threads} t\n\t\t\t\tLEFT JOIN {users} u ON u.id=t.user\n\t\t\tWHERE t.id IN ({0c}) AND t.forum IN ({1c})\n\t\t\tORDER BY t.lastpostdate DESC\n\t\t\tLIMIT {2u},{3u}", $results, $viewableforums, $from, $tpp);
     if (NumRows($search)) {
         while ($result = Fetch($search)) {
             $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']));
Esempio n. 5
0
function doLastPosts($compact, $limit)
{
    global $mobileLayout, $loguser;
    if ($mobileLayout) {
        $compact = true;
    }
    $hours = 72;
    $rPosts = Query("SELECT\n\t\t\t\t\t\tp.id, p.date,\n\t\t\t\t\t\tu.(_userfields),\n\t\t\t\t\t\tt.title AS ttit, t.id AS tid,\n\t\t\t\t\t\tf.title AS ftit, f.id AS fid\n\t\t\t\t\tFROM {posts} p\n\t\t\t\t\t\tLEFT JOIN {users} u on u.id = p.user\n\t\t\t\t\t\tLEFT JOIN {threads} t on t.id = p.thread\n\t\t\t\t\t\tLEFT JOIN {forums} f on t.forum = f.id\n\t\t\t\t\tWHERE " . forumAccessControlSql() . " AND p.date >= {0}\n\t\t\t\t\tORDER BY date DESC LIMIT 0, {1u}", time() - $hours * 60 * 60, $limit);
    while ($post = Fetch($rPosts)) {
        $thread = array();
        $thread["title"] = $post["ttit"];
        $thread["id"] = $post["tid"];
        $c = ($c + 1) % 2;
        if ($compact) {
            $theList .= format("\n\t\t\t\t<tr class=\"cell{5}\">\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{3} &raquo; {4}\n\t\t\t\t\t\t<br>{2}, {1} \n\t\t\t\t\t\t<span style=\"float:right\">&raquo; {6}</span>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t", $post['id'], formatdate($post['date']), UserLink(getDataPrefix($post, "u_")), actionLinkTag($post["ftit"], "forum", $post["fid"], "", $post["ftit"]), makeThreadLink($thread), $c, actionLinkTag($post['id'], "post", $post['id']));
        } else {
            $theList .= format("\n\t\t\t\t<tr class=\"cell{5}\">\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{3}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{4}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{2}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{1}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t&raquo; {6}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t", $post['id'], formatdate($post['date']), UserLink(getDataPrefix($post, "u_")), actionLinkTag($post["ftit"], "forum", $post["fid"], "", $post["ftit"]), makeThreadLink($thread), $c, actionLinkTag($post['id'], "post", $post['id']));
        }
    }
    if ($theList == "") {
        $theList = format("\n\t\t<tr class=\"cell1\">\n\t\t\t<td colspan=\"5\" style=\"text-align: center\">\n\t\t\t\t" . __("Nothing has been posted in the last {0}.") . "\n\t\t\t</td>\n\t\t</tr>\n\t", Plural($hours, __("hour")));
    }
    if ($compact) {
        write("\n\t\t<table class=\"margin outline\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"5\">" . __("Last posts") . "</th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t\t", $theList);
    } else {
        write("\n\t\t<table class=\"margin outline\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"5\">" . __("Last posts") . "</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th>" . __("Forum") . "</th>\n\t\t\t\t<th>" . __("Thread") . "</th>\n\t\t\t\t<th>" . __("User") . "</th>\n\t\t\t\t<th>" . __("Date") . "</th>\n\t\t\t\t<th></th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t\t", $theList);
    }
}
Esempio n. 6
0
$foo[__("Total threads")] = format("{0} ({1} per day)", $threads, $averageThreads);
$foo[__("Registered on")] = format("{0} ({1} ago)", formatdate($user['regdate']), TimeUnits($daysKnown * 86400));
$lastPost = Fetch(Query("\n\tSELECT\n\t\tp.id as pid, p.date as date,\n\t\t{threads}.title AS ttit, {threads}.id AS tid,\n\t\t{forums}.title AS ftit, {forums}.id AS fid, {forums}.minpower\n\tFROM {posts} p\n\t\tLEFT JOIN {users} u on u.id = p.user\n\t\tLEFT JOIN {threads} on {threads}.id = p.thread\n\t\tLEFT JOIN {forums} on {threads}.forum = {forums}.id\n\tWHERE p.user={0}\n\tORDER BY p.date DESC\n\tLIMIT 0, 1", $user["id"]));
if ($lastPost) {
    $thread = array();
    $thread["title"] = $lastPost["ttit"];
    $thread["id"] = $lastPost["tid"];
    $realpl = $loguser["powerlevel"];
    if ($realpl < 0) {
        $realpl = 0;
    }
    if ($lastPost["minpower"] > $realpl) {
        $place = __("a restricted forum.");
    } else {
        $pid = $lastPost["pid"];
        $place = makeThreadLink($thread) . " (" . actionLinkTag($lastPost["ftit"], "forum", $lastPost["fid"], "", $lastPost["ftit"]) . ")";
        $place .= " &raquo; " . actionLinkTag($pid, "post", $pid);
    }
    $foo[__("Last post")] = format("{0} ({1} ago)", formatdate($lastPost["date"]), TimeUnits(time() - $lastPost["date"])) . "<br>" . __("in") . " " . $place;
} else {
    $foo[__("Last post")] = __("Never");
}
$foo[__("Last view")] = format("{0} ({1} ago)", formatdate($user['lastactivity']), TimeUnits(time() - $user['lastactivity']));
$foo[__("Browser")] = $user['lastknownbrowser'];
if ($loguser['powerlevel'] > 0) {
    $foo[__("Last known IP")] = formatIP($user['lastip']);
}
$profileParts[__("General information")] = $foo;
$foo = array();
$foo[__("Email address")] = $emailField;
if ($homepage) {
Esempio n. 7
0
function bbcodeThread($dom, $nothing, $arg)
{
    global $threadLinkCache, $loguser;
    $id = (int) $arg;
    if (!isset($threadLinkCache[$id])) {
        $rThread = Query("SELECT\n\t\t\t\t\t\t\tt.id, t.title\n\t\t\t\t\t\tFROM {threads} t\n\t\t\t\t\t\tLEFT JOIN {forums} f ON t.forum = f.id\n\t\t\t\t\t\tWHERE t.id={0} AND f.minpower <= {1} ", $id, $loguser["powerlevel"]);
        if (NumRows($rThread)) {
            $thread = Fetch($rThread);
            $threadLinkCache[$id] = makeThreadLink($thread);
        } else {
            $threadLinkCache[$id] = "&lt;invalid thread ID&gt;";
        }
    }
    return markupToMarkup($dom, $threadLinkCache[$id]);
}
Esempio n. 8
0
function makePost($post, $type, $params = array())
{
    global $loguser, $loguserid, $blocklayouts, $dataDir, $dataUrl, $mobileLayout;
    $sideBarStuff = "";
    $poster = getDataPrefix($post, "u_");
    LoadBlockLayouts();
    $isBlocked = $poster['globalblock'] || $loguser['blocklayouts'] || $post['options'] & 1 || isset($blocklayouts[$poster['id']]);
    $links = makePostLinks($post, $type, $params);
    if ($post['deleted'] && $type == POST_NORMAL) {
        $meta = format(__("Posted on {0}"), formatdate($post['date']));
        $meta .= __(', deleted');
        if ($post['deletedby']) {
            $db_link = UserLink(getDataPrefix($post, "du_"));
            $meta .= __(' by ') . $db_link;
            if ($post['reason']) {
                $meta .= ': ' . htmlspecialchars($post['reason']);
            }
        }
        if ($mobileLayout) {
            $links->setClass("toolbarMenu");
            echo "\n\t\t\t\t<table class=\"outline margin mobile-postBox\" id=\"post{$post['id']}\">\n\t\t\t\t\t<tr class=\"header0 mobile-postHeader\">\n\t\t\t\t\t\t<th>\n\t\t\t\t\t\t\t{$anchor}\n\t\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<div class=\"mobile-userAvatarBox\">\n\t\t\t\t\t\t\t\t\t\t\t{$picture}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td class=\"mobile-postInfoCell\" style=\"width: 99%; overflow: hidden;\">\n\t\t\t\t\t\t\t\t\t\t<div style=\"position: relative; height: 40px; top: 0; left: 0;\">\n\t\t\t\t\t\t\t\t\t\t\t<div style=\"position: absolute; top: 0; left: 0;\">\n\t\t\t\t\t\t\t\t\t\t\t\t" . userLink($poster) . "<br />\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"date\">{$meta}</span>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<span style=\"text-align:left; display: none;\" id=\"dyna_{$post['id']}\">\n\t\t\t\t\t\t\t\t\t\t\t&nbsp;\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t" . $links->build(2) . "\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t";
        } else {
            echo "\n\t\t\t\t<table class=\"post margin deletedpost\" id=\"post{$post['id']}\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"side userlink\">\n\t\t\t\t\t\t\t" . userLink($poster) . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class=\"smallFonts meta right\">\n\t\t\t\t\t\t\t<div style=\"float:left\">\n\t\t\t\t\t\t\t\t{$meta}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t" . $links->build() . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>";
        }
        return;
    }
    if ($type == POST_SAMPLE) {
        $meta = $params['metatext'] ? $params['metatext'] : __("Sample post");
    } else {
        $forum = $params['fid'];
        $thread = $params['tid'];
        $canMod = CanMod($loguserid, $forum);
        $canReply = ($canMod || !$post['closed'] && $loguser['powerlevel'] > -1) && $loguserid;
        if ($type == POST_PM) {
            $message = __("Sent on {0}");
        } else {
            $message = __("Posted on {0}");
        }
        $meta = format($message, formatdate($post['date']));
        //Threadlinks for listpost.php
        if ($params['threadlink']) {
            $thread = array();
            $thread["id"] = $post["thread"];
            $thread["title"] = $post["threadname"];
            $meta .= " " . __("in") . " " . makeThreadLink($thread);
        }
        //Revisions
        if ($post['revision']) {
            if ($post['revuser']) {
                $ru_link = UserLink(getDataPrefix($post, "ru_"));
                $revdetail = " " . format(__("by {0} on {1}"), $ru_link, formatdate($post['revdate']));
            } else {
                $revdetail = '';
            }
            if ($canMod) {
                $meta .= " (<a href=\"javascript:void(0);\" onclick=\"showRevisions(" . $post['id'] . ")\">" . format(__("rev. {0}"), $post['revision']) . "</a>" . $revdetail . ")";
            } else {
                $meta .= " (" . format(__("rev. {0}"), $post['revision']) . $revdetail . ")";
            }
        }
        //</revisions>
    }
    // POST SIDEBAR
    $sideBarStuff .= GetRank($poster["rankset"], $poster["posts"]);
    if ($sideBarStuff) {
        $sideBarStuff .= "<br />";
    }
    if ($poster['title']) {
        $sideBarStuff .= strip_tags(CleanUpPost($poster['title'], "", true), "<b><strong><i><em><span><s><del><img><a><br/><br><small>") . "<br />";
    } else {
        $levelRanks = array(-1 => __("Banned"), 0 => "", 1 => __("Local mod"), 2 => __("Full mod"), 3 => __("Administrator"));
        $sideBarStuff .= $levelRanks[$poster['powerlevel']] . "<br />";
    }
    $sideBarStuff .= GetSyndrome(getActivity($poster["id"]));
    $pictureUrl = "";
    if ($post['mood'] > 0) {
        if (file_exists("{$dataDir}avatars/" . $poster['id'] . "_" . $post['mood'])) {
            $pictureUrl = "{$dataUrl}avatars/" . $poster['id'] . "_" . $post['mood'];
        }
    } else {
        if ($poster["picture"] == "#INTERNAL#") {
            $pictureUrl = "{$dataUrl}avatars/" . $poster['id'];
        } else {
            if ($poster["picture"]) {
                $pictureUrl = $poster["picture"];
            }
        }
    }
    if ($pictureUrl) {
        $sideBarStuff .= "<img src=\"" . htmlspecialchars($pictureUrl) . "\" alt=\"\" />";
    }
    $lastpost = $poster['lastposttime'] ? timeunits(time() - $poster['lastposttime']) : "none";
    $lastview = timeunits(time() - $poster['lastactivity']);
    $sideBarStuff .= "<br />\n" . __("Karma:") . " " . $poster['karma'];
    if (!$params['forcepostnum'] && ($type == POST_PM || $type == POST_SAMPLE)) {
        $sideBarStuff .= "<br />\n" . __("Posts:") . " " . $poster['posts'];
    } else {
        $sideBarStuff .= "<br />\n" . __("Posts:") . " " . $post['num'] . "/" . $poster['posts'];
    }
    $sideBarStuff .= "<br />\n" . __("Since:") . " " . cdate($loguser['dateformat'], $poster['regdate']) . "<br />";
    $bucket = "sidebar";
    include "./lib/pluginloader.php";
    if (Settings::get("showExtraSidebar")) {
        $sideBarStuff .= "<br />\n" . __("Last post:") . " " . $lastpost;
        $sideBarStuff .= "<br />\n" . __("Last view:") . " " . $lastview;
        if ($poster['lastactivity'] > time() - 300) {
            $sideBarStuff .= "<br />\n" . __("User is <strong>online</strong>");
        }
    }
    // OTHER STUFF
    if ($type == POST_NORMAL) {
        $anchor = "<a name=\"" . $post['id'] . "\"></a>";
    }
    if (!$isBlocked) {
        $pTable = "table" . $poster['id'];
        $row1 = "row" . $poster['id'] . "_1";
        $row2 = "row" . $poster['id'] . "_2";
        $topBar1 = "topbar" . $poster['id'] . "_1";
        $topBar2 = "topbar" . $poster['id'] . "_2";
        $sideBar = "sidebar" . $poster['id'];
        $mainBar = "mainbar" . $poster['id'];
    }
    $postText = makePostText($post);
    //PRINT THE POST!
    if ($mobileLayout) {
        $links->setClass("toolbarMenu");
        if ($pictureUrl) {
            $picture = "<img src=\"" . htmlspecialchars($pictureUrl) . "\" alt=\"\" style=\"max-width: 40px; max-height: 40px;\"/>";
        } else {
            $picture = "";
        }
        echo "\n\t\t\t\t<table class=\"outline margin mobile-postBox\" id=\"post{$post['id']}\">\n\t\t\t\t<tr class=\"header0 mobile-postHeader\">\n\t\t\t\t\t<th>\n\t\t\t\t\t\t{$anchor}\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<div class=\"mobile-userAvatarBox\">\n\t\t\t\t\t\t\t\t\t\t{$picture}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"mobile-postInfoCell\" style=\"width: 99%; overflow: hidden;\">\n\t\t\t\t\t\t\t\t\t<div style=\"position: relative; height: 40px; top: 0; left: 0;\">\n\t\t\t\t\t\t\t\t\t\t<div style=\"position: absolute; top: 0; left: 0;\">\n\t\t\t\t\t\t\t\t\t\t\t" . userLink($poster) . "<br />\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"date\">{$meta}</span>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<span style=\"text-align:left; display: none;\" id=\"dyna_{$post['id']}\">\n\t\t\t\t\t\t\t\t\t\t&nbsp;\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . $links->build(2) . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=\"3\" class=\"cell0 mobile-postBox\">\n\t\t\t\t\t\t{$postText}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t";
    } else {
        echo "\n\t\t\t<table class=\"post margin {$pTable}\" id=\"post{$post['id']}\">\n\t\t\t\t<tr class=\"{$row1}\">\n\t\t\t\t\t<td class=\"side userlink {$topBar1}\">\n\t\t\t\t\t\t{$anchor}\n\t\t\t\t\t\t" . UserLink($poster) . "\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class=\"meta right {$topBar2}\">\n\t\t\t\t\t\t<div style=\"float: left;\" id=\"meta_{$post['id']}\">\n\t\t\t\t\t\t\t{$meta}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div style=\"float: left; text-align:left; display: none;\" id=\"dyna_{$post['id']}\">\n\t\t\t\t\t\t\tHi.\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t" . $links->build() . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"" . $row2 . "\">\n\t\t\t\t\t<td class=\"side {$sideBar}\">\n\t\t\t\t\t\t<div class=\"smallFonts\">\n\t\t\t\t\t\t\t{$sideBarStuff}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class=\"post {$mainBar}\" id=\"post_{$post['id']}\">\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t{$postText}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>";
    }
}
Esempio n. 9
0
function listThread($thread, $cellClass, $dostickies = true, $showforum = false)
{
    global $haveStickies, $loguserid, $loguser, $misc;
    $forumList = "";
    $starter = getDataPrefix($thread, "su_");
    $last = getDataPrefix($thread, "lu_");
    $NewIcon = "";
    $newstuff = 0;
    if ($thread['closed']) {
        $NewIcon = "off";
    }
    if ($thread['replies'] >= $misc['hotcount']) {
        $NewIcon .= "hot";
    }
    if (!$loguserid && $thread['lastpostdate'] > time() - 900 || $loguserid && $thread['lastpostdate'] > $thread['readdate'] && !$isIgnored) {
        $NewIcon .= "new";
        $newstuff++;
    } else {
        if (!$thread['closed'] && !$thread['sticky'] && Settings::get("oldThreadThreshold") > 0 && $thread['lastpostdate'] < time() - 2592000 * Settings::get("oldThreadThreshold")) {
            $NewIcon = "old";
        }
    }
    if ($NewIcon) {
        $NewIcon = "<img src=\"" . resourceLink("img/status/" . $NewIcon . ".png") . "\" alt=\"\"/>";
    }
    if ($thread['sticky'] == 0 && $haveStickies == 1 && $dostickies) {
        $haveStickies = 2;
        $forumList .= "<tr class=\"header1\"><th colspan=\"" . ($showforum ? '8' : '7') . "\" style=\"height: 6px;\"></th></tr>";
    }
    if ($thread['sticky'] && $haveStickies == 0) {
        $haveStickies = 1;
    }
    $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);
        }
    } else {
        for ($i = 1; $i < $n; $i++) {
            $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp);
        }
        $pl .= " &hellip; ";
        for ($i = $numpages - $n + 1; $i <= $numpages; $i++) {
            $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp);
        }
    }
    if ($pl) {
        $pl = " <span class=\"smallFonts\">[" . actionLinkTag(1, "thread", $thread['id']) . $pl . "]</span>";
    }
    $lastLink = "";
    if ($thread['lastpostid']) {
        $lastLink = " " . actionLinkTag("&raquo;", "post", $thread['lastpostid']);
    }
    $threadlink = makeThreadLink($thread);
    $forumcell = "";
    if ($showforum) {
        $forumcell = " in " . actionLinkTag(htmlspecialchars($thread["f_title"]), "forum", $thread["f_id"]);
    }
    $forumList .= "\n\t<tr class=\"cell{$cellClass}\">\n\t\t<td>\n\t\t\t{$NewIcon}\n\t\t\t{$poll}\n\t\t\t{$threadlink} {$pl}<br>\n\t\t\t<small>by " . UserLink($starter) . $forumcell . " -- " . Plural($thread['replies'], 'reply') . "</small>\n\t\t</td>\n\t\t<td class=\"smallFonts center\">\n\t\t\t" . formatdate($thread['lastpostdate']) . "<br />\n\t\t\t" . __("by") . " " . UserLink($last) . " {$lastLink}</td>\n\t</tr>";
    return $forumList;
}
Esempio n. 10
0
function logFormat_thread($data)
{
    $thread = getDataPrefix($data, "thread_");
    return makeThreadLink($thread);
}
Esempio n. 11
0
function listThread($thread, $cellClass, $dostickies = true, $showforum = false)
{
    global $haveStickies, $loguserid, $loguser, $misc;
    $forumList = "";
    $starter = getDataPrefix($thread, "su_");
    $last = getDataPrefix($thread, "lu_");
    $threadlink = makeThreadLink($thread);
    $NewIcon = "";
    $newstuff = 0;
    if ($thread['closed']) {
        $NewIcon = "off";
    }
    if ($thread['replies'] >= $misc['hotcount']) {
        $NewIcon .= "hot";
    }
    if (!$loguserid && $thread['lastpostdate'] > time() - 900 || $loguserid && $thread['lastpostdate'] > $thread['readdate'] && !$isIgnored) {
        $NewIcon .= "new";
        $newstuff++;
    } else {
        if (!$thread['closed'] && !$thread['sticky'] && Settings::get("oldThreadThreshold") > 0 && $thread['lastpostdate'] < time() - 2592000 * Settings::get("oldThreadThreshold")) {
            $NewIcon = "old";
        }
    }
    if ($NewIcon) {
        $NewIcon = "<img src=\"" . resourceLink("img/status/" . $NewIcon . ".png") . "\" alt=\"\"/>";
    }
    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']);
        }
        $ThreadIcon = "<img src=\"" . htmlspecialchars($thread['icon']) . "\" alt=\"\" class=\"smiley\"/>";
    } else {
        $ThreadIcon = "";
    }
    if ($thread['sticky'] == 0 && $haveStickies == 1 && $dostickies) {
        $haveStickies = 2;
        $forumList .= "<tr class=\"header1\"><th colspan=\"7\" style=\"height: 8px;\"></th></tr>";
    }
    if ($thread['sticky'] && $haveStickies == 0) {
        $haveStickies = 1;
    }
    $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);
        }
    } else {
        for ($i = 1; $i < $n; $i++) {
            $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp);
        }
        $pl .= " &hellip; ";
        for ($i = $numpages - $n + 1; $i <= $numpages; $i++) {
            $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp);
        }
    }
    if ($pl) {
        $pl = " <span class=\"smallFonts\">[" . actionLinkTag(1, "thread", $thread['id']) . $pl . "]</span>";
    }
    $lastLink = "";
    if ($thread['lastpostid']) {
        $lastLink = " " . actionLinkTag("&raquo;", "post", $thread['lastpostid']);
    }
    $forumcell = "";
    if ($showforum) {
        $forumcell = "<td class=\"center\">" . actionLinkTag(htmlspecialchars($thread["f_title"]), "forum", $thread["f_id"], "", $thread["f_title"]) . "</td>";
    }
    $forumList .= "\n\t<tr class=\"cell{$cellClass}\">\n\t\t<td class=\"cell2 threadIcon\"> {$NewIcon}</td>\n\t\t<td class=\"threadIcon\" style=\"border-right: 0px none;\">\n\t\t\t {$ThreadIcon}\n\t\t</td>\n\t\t<td style=\"border-left: 0px none;\">\n\t\t\t{$poll}\n\t\t\t{$threadlink}\n\t\t\t{$pl}\n\t\t</td>\n\t\t{$forumcell}\n\t\t<td class=\"center\">\n\t\t\t" . UserLink($starter) . "\n\t\t</td>\n\t\t<td class=\"center\">\n\t\t\t{$thread['replies']}\n\t\t</td>\n\t\t<td class=\"center\">\n\t\t\t{$thread['views']}\n\t\t</td>\n\t\t<td class=\"smallFonts center\">\n\t\t\t" . formatdate($thread['lastpostdate']) . "<br />\n\t\t\t" . __("by") . " " . UserLink($last) . " {$lastLink}</td>\n\t</tr>";
    return $forumList;
}
Esempio n. 12
0
             $totalResults++;
             $results .= "\n\t<tr class=\"cell0\">\n\t\t<td class=\"smallFonts\">\n\t\t\t{$userlink}\n\t\t</td>\n\t\t<td>\n\t\t\t{$threadlink}\n\t\t</td>\n\t</tr>";
         }
     }
     if ($results != "") {
         $final .= "\n<table class=\"outline margin\">\n\t<tr class=\"header0\">\n\t\t<th colspan=\"4\">Thread title results</th>\n\t</tr>\n\t<tr class=\"header1\">\n\t\t<th style=\"width:15%\">User</th>\n\t\t<th>Thread</th>\n\t</tr>\n\t{$results}\n</table>";
     }
 }
 $search = Query("\n\t\tSELECT\n\t\t\tpt.text, pt.pid,\n\t\t\tt.title, t.id,\n\t\t\tu.(_userfields)\n\t\tFROM {posts_text} pt\n\t\t\tLEFT JOIN {posts} p ON pt.pid = p.id\n\t\t\tLEFT JOIN {threads} t ON t.id = p.thread\n\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\tWHERE pt.revision = p.currentrevision AND MATCH(pt.text) AGAINST({0} IN BOOLEAN MODE)\n\t\tORDER BY p.date DESC\n\t\tLIMIT 0,100", $bool);
 if (NumRows($search)) {
     $results = "";
     while ($result = Fetch($search)) {
         //			$result['text'] = str_replace("<!--", "~#~", str_replace("-->", "~#~", $result['text']));
         $snippet = MakeSnippet($result['text'], $terms);
         $userlink = UserLink(getDataPrefix($result, "u_"));
         $threadlink = makeThreadLink($result);
         $posturl = actionLink("thread", "", "pid=" . $result['pid'] . "#" . $result['pid']);
         if ($snippet != "") {
             $totalResults++;
             $results .= "\n\t<tr class=\"cell0\">\n\t\t<td class=\"smallFonts\">\n\t\t\t{$userlink}\n\t\t</td>\n\t\t<td>\n\t\t\t{$snippet}\n\t\t</td>\n\t\t<td class=\"smallFonts\">\n\t\t\t{$threadlink}\n\t\t</td>\n\t\t<td class=\"smallFonts\">\n\t\t\t&raquo;&nbsp;<a href=\"{$posturl}\">{$result['pid']}</a>\n\t\t</td>\n\t</tr>";
         }
     }
     if ($results != "") {
         $final .= "\n<table class=\"outline margin\">\n\t<tr class=\"header0\">\n\t\t<th colspan=\"4\">Text results</th>\n\t</tr>\n\t<tr class=\"header1\">\n\t\t<th>User</th>\n\t\t<th>Text</th>\n\t\t<th>Thread</th>\n\t\t<th>ID</th>\n\t</tr>\n\t{$results}\n</table>";
     }
 }
 if ($totalResults == 0) {
     Alert(Format("No results for \"{0}\".", htmlspecialchars($searchQuery)), "Search");
 } else {
     Write("\n<div class=\"outline header2 cell2 margin\" style=\"text-align: center; font-size: 130%;\">\n\t{0}\n</div>\n{1}\n", Plural($totalResults, "result"), $final);
 }