Beispiel #1
0
function makePostText($post, $poster)
{
    $noSmilies = $post['options'] & 2;
    //Do Ampersand Tags
    $tags = array("postnum" => $post['num'], "postcount" => $poster['posts'], "numdays" => floor((time() - $poster['regdate']) / 86400), "date" => formatdate($post['date']), "rank" => GetRank($poster['rankset'], $poster['posts']));
    $bucket = "amperTags";
    include __DIR__ . "/pluginloader.php";
    if ($poster['signature']) {
        if (!$poster['signsep']) {
            $separator = "<br>_________________________<br>";
        } else {
            $separator = "<br>";
        }
    }
    $attachblock = '';
    if ($post['has_attachments']) {
        if (isset($post['preview_attachs'])) {
            $ispreview = true;
            $fileids = array_keys($post['preview_attachs']);
            $attachs = Query("SELECT id,filename,physicalname,description,downloads \n\t\t\t\tFROM {uploadedfiles}\n\t\t\t\tWHERE id IN ({0c})", $fileids);
        } else {
            $ispreview = false;
            $attachs = Query("SELECT id,filename,physicalname,description,downloads \n\t\t\t\tFROM {uploadedfiles}\n\t\t\t\tWHERE parenttype={0} AND parentid={1} AND deldate=0\n\t\t\t\tORDER BY filename", 'post_attachment', $post['id']);
        }
        while ($attach = Fetch($attachs)) {
            $url = URL_ROOT . 'get.php?id=' . htmlspecialchars($attach['id']);
            $linkurl = $ispreview ? '#' : $url;
            $filesize = filesize(DATA_DIR . 'uploads/' . $attach['physicalname']);
            $attachblock .= '<br><div class="post_attachment">';
            $fext = strtolower(substr($attach['filename'], -4));
            if ($fext == '.png' || $fext == '.jpg' || $fext == 'jpeg' || $fext == '.gif') {
                $alt = htmlspecialchars($attach['filename']) . ' &mdash; ' . BytesToSize($filesize) . ', viewed ' . Plural($attach['downloads'], 'time');
                $attachblock .= '<a href="' . $linkurl . '"><img src="' . $url . '" alt="' . $alt . '" title="' . $alt . '" style="max-width:300px; max-height:300px;"></a>';
            } else {
                $link = '<a href="' . $linkurl . '">' . htmlspecialchars($attach['filename']) . '</a>';
                $desc = htmlspecialchars($attach['description']);
                if ($desc) {
                    $desc .= '<br>';
                }
                $attachblock .= '<strong>' . __('Attachment: ') . $link . '</strong><br>';
                $attachblock .= '<div class="smallFonts">' . $desc;
                $attachblock .= BytesToSize($filesize) . __(' &mdash; Downloaded ') . Plural($attach['downloads'], 'time') . '</div>';
            }
            $attachblock .= '</div>';
        }
    }
    $postText = $poster['postheader'] . $post['text'] . $attachblock . $separator . $poster['signature'];
    $postText = ApplyTags($postText, $tags);
    $postText = CleanUpPost($postText, $noSmilies, false);
    return $postText;
}
         $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 />";
         }
     }
     $reply = $postHeader . $postText . $separator . $postFooter;
     die($reply);
 } elseif ($action == "em") {
     $blah = FetchResult("select email from users where id=" . $id . " and showemail=1");
     die(htmlspecialchars($blah));
 } elseif ($action == "vc") {
     $blah = FetchResult("select views from misc");
     die(number_format($blah));
 }
Beispiel #3
0
function makePostText($post)
{
    global $loguser, $loguserid, $layoutCache, $blocklayouts, $mobileLayout;
    LoadBlockLayouts();
    $poster = getDataPrefix($post, "u_");
    $isBlocked = $poster['globalblock'] || $loguser['blocklayouts'] || $post['options'] & 1 || isset($blocklayouts[$poster['id']]);
    $noSmilies = $post['options'] & 2;
    $noBr = $post['options'] & 4;
    //Do Ampersand Tags
    $tags = array("postcount" => $poster['posts'], "numdays" => floor((time() - $poster['regdate']) / 86400), "date" => formatdate($post['date']), "rank" => GetRank($poster["rankset"], $poster["posts"]));
    $bucket = "amperTags";
    include "./lib/pluginloader.php";
    $postText = $post['text'];
    $postText = ApplyTags($postText, $tags);
    $postText = CleanUpPost($postText, $poster['name'], $noSmilies);
    //Post header and footer.
    $magicString = "###POSTTEXTGOESHEREOMG###";
    $separator = "";
    if ($isBlocked || $mobileLayout) {
        $postLayout = $magicString;
    } else {
        if (!isset($layoutCache[$poster["id"]])) {
            $postLayout = $poster['postheader'] . $magicString . $poster['signature'];
            $postLayout = ApplyTags($postLayout, $tags);
            $postLayout = CleanUpPost($postLayout, $poster['name']);
            $layoutCache[$poster["id"]] = $postLayout;
        } else {
            $postLayout = $layoutCache[$poster["id"]];
        }
        if ($poster['signature']) {
            if (!$poster['signsep']) {
                $separator = "<br />_________________________<br />";
            } else {
                $separator = "<br />";
            }
        }
    }
    $postText = str_replace($magicString, $postText . $separator, $postLayout);
    return $postText;
}
Beispiel #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']);
    }
}
Beispiel #5
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" : "");
}