Esempio n. 1
0
if (!$canVote) {
    $karmaLinks = "";
}
$daysKnown = (time() - $user['regdate']) / 86400;
$qPosts = "select count(*) from posts where user="******"select count(*) from threads where user="******"%1.02f", $user['posts'] / $daysKnown);
$averageThreads = sprintf("%1.02f", $threads / $daysKnown);
$score = (int) $daysKnown * 2 + $posts * 4 + $threads * 8 + ($karma - 100) * 3;
if ($user['minipic']) {
    $minipic = "<img src=\"" . $user['minipic'] . "\" alt=\"\" style=\"vertical-align: middle;\" />&nbsp;";
}
if ($user['rankset']) {
    $currentRank = GetRank($user);
    $toNextRank = GetToNextRank($user);
    if ($toNextRank) {
        $toNextRank = Plural($toNextRank, "post");
    }
}
if ($user['title']) {
    $title = str_replace("<br />", " &bull; ", strip_tags(CleanUpPost($user['title'], "", true), "<b><strong><i><em><span><s><del><img><a><br><small>"));
}
//$title = "";
if ($user['homepageurl']) {
    if ($user['homepagename']) {
        $homepage = "<a href=\"" . $user['homepageurl'] . "\">" . $user['homepagename'] . "</a> &mdash; " . $user['homepageurl'];
    } else {
        $homepage = "<a href=\"" . $user['homepageurl'] . "\">" . $user['homepageurl'] . "</a>";
    }
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));
}
 $rForum = Query($qForum);
 $forum = Fetch($rForum);
 if ($forum['minpower'] > $loguser['powerlevel']) {
     $post['text'] = __("No.");
 }
 LoadBlockLayouts();
 $isBlocked = $blocklayouts[$post['uid']] | $post['globalblock'] | $loguser['blocklayouts'] | $post['options'] & 1;
 $noSmilies = $post['options'] & 2;
 $tags = array();
 $rankHax = $post['posts'];
 if ($post['num'] == "???") {
     $post['num'] = $post['posts'];
 }
 $post['posts'] = $post['num'];
 //Disable tags by commenting/removing this part.
 $tags = array("numposts" => $post['num'], "numdays" => floor((time() - $post['regdate']) / 86400), "date" => cdate($dateformat, $post['date']), "rank" => GetRank($post));
 $bucket = "amperTags";
 include "./lib/pluginloader.php";
 $post['posts'] = $rankHax;
 if ($post['postheader'] && !$isBlocked) {
     $postHeader = str_replace('$theme', $theme, ApplyTags(CleanUpPost($post['postheader']), $tags));
 }
 $postText = ApplyTags(CleanUpPost($post['text'], $post['name'], $noSmilies), $tags);
 $bucket = "postMangler";
 include "./lib/pluginloader.php";
 if ($post['signature'] && !$isBlocked) {
     $postFooter = ApplyTags(CleanUpPost($post['signature']), $tags);
     if (!$post['signsep']) {
         $separator = "<br />_________________________<br />";
     } else {
         $separator = "<br />";
Esempio n. 4
0
        }
        $voters = count($voters);
        write("\n\t<table border=\"2\">\n\t\t<tr>\n\t\t\t<th colspan=\"2\">\n\t\t\t\tPoll: {1}\n\t\t\t</th>\n\t\t</tr>\n\t\t{2}\n\t\t<tr>\n\t\t\t<td colspan=\"2\">\n\t\t\t\t{3} voted so far.\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n", $cellClass, htmlspecialchars($poll['question']), $pollLines, $voters == 1 ? $voters . " user has" : $voters . " users have");
    }
}
$rPosts = Query("select\n{posts}.id, {posts}.date, {posts}.deleted, {posts}.options, {posts}.num, {posts_text}.text, {posts_text}.revision, {users}.name, {users}.displayname, {users}.rankset, {users}.posts\nfrom {posts} left join {posts_text} on {posts_text}.pid = {posts}.id and {posts_text}.revision = {posts}.currentrevision left join {users} on {users}.id = {posts}.user\nwhere thread={0} order by date asc", $tid);
if (NumRows($rPosts)) {
    while ($post = Fetch($rPosts)) {
        $noSmiles = $post['options'] & 2;
        $noBr = $post['options'] & 4;
        $text = $post['text'];
        $text = preg_replace("'\\[spoiler\\](.*?)\\[/spoiler\\]'si", "&laquo;Spoiler&raquo;", $text);
        $text = preg_replace("'\\[video\\](.*?)\\[/video\\]'si", "&laquo;HTML5 video&raquo;", $text);
        $text = preg_replace("'\\[youtube\\](.*?)\\[/youtube\\]'si", "&laquo;YouTube video&raquo;", $text);
        $text = preg_replace("'\\[youtube/loop\\](.*?)\\[/youtube\\]'si", "&laquo;YouTube video&raquo;", $text);
        $text = preg_replace("'\\[swf ([0-9]+) ([0-9]+)\\](.*?)\\[/swf\\]'si", "&laquo;Flash video&raquo;", $text);
        $text = preg_replace("'\\[svg ([0-9]+) ([0-9]+)\\](.*?)\\[/svg\\]'si", "&laquo;SVG image&raquo;", $text);
        $text = CleanUpPost($text, $post['name'], $noSmiles, $noBr);
        $text = preg_replace("'<div class=\"geshi\">(.*?)</div>'si", "<div class=\"geshi\"><code>\\1</code></div>", $text);
        $text = preg_replace("'<table class=\"outline\">'si", "<table border=\"2\">", $text);
        $text = preg_replace("'<td (.*?)style=\"(.*?)\"(.*?)>'si", "<td \\1\\3>", $text);
        $text = preg_replace("'<a (.*?)style=\"(.*?)\"(.*?)>'si", "<a \\1\\3>", $text);
        $tags = array();
        $rankHax = $post['posts'];
        $post['posts'] = $post['num'];
        $tags = array("numposts" => $post['num'], "5000" => 5000 - $post['num'], "20000" => 20000 - $post['num'], "30000" => 30000 - $post['num'], "rank" => GetRank($post));
        $post['posts'] = $rankHax;
        $text = ApplyTags($text, $tags);
        write("\n\t<hr />\n\t<p>\n\t\t<strong>\n\t\t\t{1}\n\t\t</strong>\n\t\t<small>\n\t\t\t&mdash; {2}, post #{3}\n\t\t</small>\n\t</p>\n\t<p>\n\t\t{0}\n\t</p>\n", $text, $post['name'], formatdate($post['date']), $post['id']);
    }
}
Esempio n. 5
0
        $blockLayoutLink = actionLinkTag($blocktext, "profile", $id, "block=1&token={$loguser['token']}");
    }
}
$daysKnown = (time() - $user['regdate']) / 86400;
if (!$daysKnown) {
    $daysKnown = 1;
}
$posts = FetchResult("select count(*) from {posts} where user={0}", $id);
$threads = FetchResult("select count(*) from {threads} where user={0}", $id);
$averagePosts = sprintf("%1.02f", $user['posts'] / $daysKnown);
$averageThreads = sprintf("%1.02f", $threads / $daysKnown);
//$deletedposts = FetchResult("SELECT COUNT(*) FROM {posts} p WHERE p.user={0} AND p.deleted!=0 AND p.deletedby!={0}", $id);
//$score = 1000 + (10 * $user['postplusones']) - (20 * $deletedposts);
$minipic = getMinipicTag($user);
if ($user['rankset']) {
    $currentRank = GetRank($user["rankset"], $user["posts"]);
    $toNextRank = GetToNextRank($user["rankset"], $user["posts"]);
    if ($toNextRank) {
        $toNextRank = Plural($toNextRank, "post");
    }
}
if ($user['title']) {
    $title = preg_replace('@<br.*?>\\s*(\\S)@i', ' &bull; $1', strip_tags(CleanUpPost($user['title'], "", true), "<b><strong><i><em><span><s><del><img><a><br><br/><small>"));
}
if ($user['homepageurl']) {
    $nofollow = "";
    if (Settings::get("nofollow")) {
        $nofollow = "rel=\"nofollow\"";
    }
    if ($user['homepagename']) {
        $homepage = "<a {$nofollow} target=\"_blank\" href=\"" . htmlspecialchars($user['homepageurl']) . "\">" . htmlspecialchars($user['homepagename']) . "</a> - " . htmlspecialchars($user['homepageurl']);
Esempio n. 6
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. 7
0
function MakePost($post, $thread, $forum, $ispm = 0)
{
    global $loguser, $loguserid, $dateformat, $theme, $hacks, $isBot, $blocklayouts, $postText, $sideBarStuff, $sideBarData, $salt;
    $sideBarStuff = "";
    if (isset($_GET['pid'])) {
        $highlight = (int) $_GET['pid'];
    }
    //$qBlock = "select * from blockedlayouts where user="******" and blockee=".$loguserid;
    //$rBlock = Query($qBlock);
    LoadBlockLayouts();
    $isBlocked = $blocklayouts[$post['uid']] | $post['globalblock'] | $loguser['blocklayouts'] | $post['options'] & 1;
    $noSmilies = $post['options'] & 2;
    $noBr = $post['options'] & 4;
    if ($post['deleted'] && !$ispm) {
        $meta = format(__("Posted on {0}"), cdate($dateformat, $post['date']));
        $links = "<ul class=\"pipemenu\"><li>" . __("Post deleted") . "</li>";
        if (CanMod($loguserid, $forum)) {
            $key = hash('sha256', "{$loguserid},{$loguser['pss']},{$salt}");
            if (IsAllowed("editPost", $post['id'])) {
                $links .= "<li><a href=\"editpost.php?id=" . $post['id'] . "&amp;delete=2&amp;key=" . $key . "\">" . __("Undelete") . "</a></li>";
            }
            $links .= "<li><a href=\"#\" onclick=\"ReplacePost(" . $post['id'] . ",true); return false;\">" . __("View") . "</a></li>";
        }
        $links .= "<li>" . format(__("ID: {0}"), $post['id']) . "</li></ul>";
        write("\n\t\t<table class=\"post margin\" id=\"post{0}\">\n\t\t\t<tr>\n\t\t\t\t<td class=\"side userlink\" id=\"{0}\">\n\t\t\t\t\t{1}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"smallFonts\" style=\"border-left: 0px none; border-right: 0px none;\">\n\t\t\t\t\t{2}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"smallFonts right\" style=\"border-left: 0px none;\">\n\t\t\t\t\t{3}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n", $post['id'], UserLink($post, "uid"), $meta, $links);
        return;
    }
    if ($ispm == 1) {
        $thread = $ispm;
    }
    if ($thread) {
        $links = "";
        if (!$ispm && !$isBot) {
            if ($post['unfoldhax']) {
                $key = hash('sha256', "{$loguserid},{$loguser['pss']},{$salt}");
                $links = "<ul class=\"pipemenu\"><li>" . __("Post deleted") . "</li>";
                if (IsAllowed("editPost", $post['id'])) {
                    $links .= "<li><a href=\"editpost.php?id=" . $post['id'] . "&amp;delete=2&amp;key=" . $key . "\">" . __("Undelete") . "</a></li>";
                }
                $links .= "<li><a href=\"#\" onclick=\"ReplacePost(" . $post['id'] . ",false); return false;\">" . __("Close") . "</a></li>";
                $links .= "<li>" . format(__("ID: {0}"), $post['id']) . "</li></ul>";
            } else {
                $links .= "<ul class=\"pipemenu\"><li><a href=\"thread.php?pid=" . $post['id'] . "#" . $post['id'] . "\">" . __("Link") . "</a></li>";
                if ($thread && $loguser['powerlevel'] > -1 && $forum != -2 && IsAllowed("makeReply", $thread)) {
                    $links .= "<li><a href=\"newreply.php?id=" . $thread . "&amp;quote=" . $post['id'] . "\">" . __("Quote") . "</a></li>";
                }
                if (CanMod($loguserid, $forum) || $post['uid'] == $loguserid && $loguser['powerlevel'] > -1 && !$post['closed'] && IsAllowed("editPost", $post['id'])) {
                    $links .= "<li><a href=\"editpost.php?id=" . $post['id'] . "\">" . __("Edit") . "</a></li>";
                }
                if (CanMod($loguserid, $forum) && IsAllowed("editPost", $post['id'])) {
                    $key = hash('sha256', "{$loguserid},{$loguser['pss']},{$salt}");
                    $links .= "<li><a href=\"editpost.php?id=" . $post['id'] . "&amp;delete=1&amp;key=" . $key . "\">" . __("Delete") . "</a></li>";
                }
                if ($forum != -2 && IsAllowed("makeReply", $thread)) {
                    $links .= "<li>" . format(__("ID: {0}"), "<a href=\"newreply.php?id=" . $thread . "&amp;link=" . $post['id'] . "\">" . $post['id'] . "</a>") . "</li>";
                } else {
                    $links .= "<li>" . format(__("ID: {0}"), $post['id']) . "</li>";
                }
                if ($loguser['powerlevel'] > 0) {
                    $links .= "<li>" . $post['ip'] . "</li>";
                }
                $links .= "</ul>";
            }
        }
        $meta = format(__(!$ispm ? "Posted on {0}" : "Sent on {0}"), cdate($dateformat, $post['date']));
        //Threadlinks for listpost.php
        if ($forum == -2) {
            $meta .= " " . __("in") . " <a href=\"thread.php?id=" . $post['thread'] . "\">" . htmlspecialchars($post['threadname']) . "</a>";
        }
        //Revisions
        if ($post['revision']) {
            if (CanMod($loguserid, $forum)) {
                $meta .= " (<a href=\"javascript:void(0);\" onclick=\"showRevisions(" . $post['id'] . ")\">" . format(__("revision {0}"), $post['revision']) . "</a>)";
            } else {
                $meta .= " (" . format(__("revision {0}"), $post['revision']) . ")";
            }
        }
        //</revisions>
    } else {
        $meta = __("Sample post");
    }
    if ($forum == -1) {
        $meta = __("Posted in") . " <a href=\"thread.php?id=" . $thread['id'] . "\">" . htmlspecialchars($thread['title']) . "</a>";
    }
    //if($post['postbg'])
    //	$postbg = " style=\"background: url(".$post['postbg'].");\"";
    $sideBarStuff .= GetRank($post);
    if ($sideBarStuff) {
        $sideBarStuff .= "<br />";
    }
    if ($post['title']) {
        $sideBarStuff .= strip_tags(CleanUpPost($post['title'], "", true), "<b><strong><i><em><span><s><del><img><a><br><small>") . "<br />";
    } else {
        $levelRanks = array(-1 => __("Banned"), 0 => "", 1 => __("Local mod"), 2 => __("Full mod"), 3 => __("Administrator"));
        $sideBarStuff .= $levelRanks[$post['powerlevel']] . "<br />";
    }
    $sideBarStuff .= GetSyndrome($post['activity']);
    if ($post['picture']) {
        if ($post['mood'] > 0 && file_exists("img/avatars/" . $post['uid'] . "_" . $post['mood'])) {
            $sideBarStuff .= "<img src=\"img/avatars/" . $post['uid'] . "_" . $post['mood'] . "\" alt=\"\" />";
        } else {
            $sideBarStuff .= "<img src=\"" . $post['picture'] . "\" alt=\"\" />";
        }
    } else {
        $sideBarStuff .= "<div style=\"width: 50px; height: 50px;\">&nbsp;</div>";
    }
    $lastpost = $post['lastposttime'] ? timeunits(time() - $post['lastposttime']) : "none";
    $lastview = timeunits(time() - $post['lastactivity']);
    if ($post['num'] != "preview") {
        $sideBarStuff .= "<br />\n" . __("Posts:") . " " . $post['num'] . "/" . $post['posts'];
    } else {
        $sideBarStuff .= "<br />\n" . __("Posts:") . " " . $post['posts'];
    }
    $sideBarStuff .= "<br />\n" . __("Since:") . " " . cdate($loguser['dateformat'], $post['regdate']) . "<br />";
    $bucket = "sidebar";
    include "./lib/pluginloader.php";
    $sideBarStuff .= "<br />\n" . __("Last post:") . " " . $lastpost;
    $sideBarStuff .= "<br />\n" . __("Last view:") . " " . $lastview;
    if ($hacks['themenames'] == 3) {
        $sideBarStuff = "";
        $isBlocked = 1;
    }
    if ($post['lastactivity'] > time() - 3600) {
        $sideBarStuff .= "<br />\n" . __("User is <strong>online</strong>");
    }
    if ($post['id'] != "preview") {
        $anchor = "<a name=\"" . $post['id'] . "\" />";
    }
    if (!$isBlocked) {
        $topBar1 = "topbar" . $post['uid'] . "_1";
        $topBar2 = "topbar" . $post['uid'] . "_2";
        $sideBar = "sidebar" . $post['uid'];
        $mainBar = "mainbar" . $post['uid'];
    }
    $tags = array();
    $rankHax = $post['posts'];
    //if($post['num'] == "preview")
    //	$post['num'] = $post['posts'];
    $post['posts'] = $post['num'];
    //Disable tags by commenting/removing this part.
    $tags = array("numposts" => $post['num'], "numdays" => floor((time() - $post['regdate']) / 86400), "date" => cdate($dateformat, $post['date']), "rank" => GetRank($post));
    $bucket = "amperTags";
    include "./lib/pluginloader.php";
    $post['posts'] = $rankHax;
    if ($post['postheader'] && !$isBlocked) {
        $postHeader = str_replace('$theme', $theme, ApplyTags(CleanUpPost($post['postheader'], "", $noSmilies, true), $tags));
    }
    $postText = ApplyTags(CleanUpPost($post['text'], $post['name'], $noSmilies, $noBr), $tags);
    $bucket = "postMangler";
    include "./lib/pluginloader.php";
    if ($post['signature'] && !$isBlocked) {
        $postFooter = ApplyTags(CleanUpPost($post['signature'], "", $noSmilies, true), $tags);
        if (!$post['signsep']) {
            $separator = "<br />_________________________<br />";
        } else {
            $separator = "<br />";
        }
    }
    $postCode = "\n\t\t<table class=\"post margin {14}\" id=\"post{13}\">\n\t\t\t<tr>\n\t\t\t\t<td class=\"side userlink {1}\">\n\t\t\t\t\t{0}\n\t\t\t\t\t{5}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"meta right {2}\">\n\t\t\t\t\t<div style=\"float: left;\" id=\"meta_{13}\">\n\t\t\t\t\t\t{7}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style=\"float: left; display: none;\" id=\"dyna_{13}\">\n\t\t\t\t\t\tHi.\n\t\t\t\t\t</div>\n\t\t\t\t\t{8}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"side {3}\">\n\t\t\t\t\t<div class=\"smallFonts\">\n\t\t\t\t\t\t{6}\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"post {4}\" id=\"post_{13}\">\n\n\t\t\t\t\t{9}\n\n\t\t\t\t\t{10}\n\n\t\t\t\t\t{12}\n\t\t\t\t\t{11}\n\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n";
    write($postCode, $anchor, $topBar1, $topBar2, $sideBar, $mainBar, UserLink($post, "uid"), $sideBarStuff, $meta, $links, $postHeader, $postText, $postFooter, $separator, $post['id'], $post['id'] == $highlight ? "highlightedPost" : "");
}