Exemplo n.º 1
0
<?php

$ajaxPage = true;
$id = (int) $_GET["id"];
$rPost = Query("\n\t\tSELECT\n\t\t\tp.id, p.date, p.num, p.deleted, p.deletedby, p.reason, p.options, p.mood, p.ip,\n\t\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock),\n\t\t\tru.(_userfields),\n\t\t\tdu.(_userfields),\n\t\t\tf.id fid\n\t\tFROM\n\t\t\t{posts} p\n\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\t\tLEFT JOIN {threads} t ON t.id=p.thread\n\t\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\tWHERE p.id={0}", $id);
if (!NumRows($rPost)) {
    die(__("Unknown post ID."));
}
$post = Fetch($rPost);
if (!CanMod($loguserid, $post['fid']) && $loguserid != $post["u_id"]) {
    die(__("No."));
}
echo MakePost($post, $_GET['o'] ? POST_DELETED_SNOOP : POST_NORMAL, array('tid' => $post['thread'], 'fid' => $post['fid']));
Exemplo n.º 2
0
}
if ($loguser['powerlevel'] < $forum['minpower']) {
    Kill(__("You are not allowed to browse this forum."));
}
$fid = $forum['id'];
AssertForbidden("viewForum", $fid);
//-- Mark as New if last post is edited --
$wasLastPost = $thread['lastpostdate'] == $post['date'];
$fid = $thread['forum'];
if ($post['deleted']) {
    Kill(__("This post has been deleted."));
}
if (!CanMod($loguserid, $fid) && $post['user'] != $loguserid) {
    Kill(__("You are not allowed to edit posts."));
}
if ($thread['closed'] && !CanMod($loguserid, $fid)) {
    Kill(__("This thread is closed."));
}
$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(__("Edit post")));
makeBreadcrumbs($crumbs);
write("\n\t<script type=\"text/javascript\">\n\t\t\twindow.addEventListener(\"load\",  hookUpControls, false);\n\t</script>\n");
if (isset($_POST['actionpreview'])) {
    $previewPost['text'] = $_POST["text"];
    $previewPost['num'] = $post['num'];
    $previewPost['id'] = "_";
    $previewPost['options'] = 0;
Exemplo n.º 3
0
if ($pagelinks) {
    write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
if (NumRows($rPosts)) {
    while ($post = Fetch($rPosts)) {
        $post['closed'] = $thread['closed'];
        MakePost($post, POST_NORMAL, array('tid' => $tid, 'fid' => $fid));
    }
}
if ($pagelinks) {
    write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
if ($loguserid && $loguser['powerlevel'] >= $forum['minpowerreply'] && (!$thread['closed'] || $loguser['powerlevel'] > 0) && !isset($replyWarning)) {
    $ninja = FetchResult("select id from {posts} where thread={0} order by date desc limit 0, 1", $tid);
    //Quick reply goes here
    if (CanMod($loguserid, $fid)) {
        //print $thread['closed'];
        if (!$thread['closed']) {
            $mod .= "<label><input type=\"checkbox\" name=\"lock\">&nbsp;" . __("Close thread", 1) . "</label>\n";
        } else {
            $mod .= "<label><input type=\"checkbox\" name=\"unlock\">&nbsp;" . __("Open thread", 1) . "</label>\n";
        }
        if (!$thread['sticky']) {
            $mod .= "<label><input type=\"checkbox\" name=\"stick\">&nbsp;" . __("Sticky", 1) . "</label>\n";
        } else {
            $mod .= "<label><input type=\"checkbox\" name=\"unstick\">&nbsp;" . __("Unstick", 1) . "</label>\n";
        }
    }
    $moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n";
    $rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid);
    while ($mood = Fetch($rMoods)) {
Exemplo n.º 4
0
    }
    if ($quote['deleted']) {
        $quote['text'] = __("Post is deleted");
    }
    $reply = "[quote=\"" . $quote['poster'] . "\" id=\"" . $quote['id'] . "\"]" . $quote['text'] . "[/quote]";
    $reply = str_replace("/me", "[b]* " . htmlval($quote['poster']) . "[/b]", $reply);
    die($reply);
} else {
    if ($action == 'rp') {
        $qPost = "\tselect \n\t\t\t\t\tposts.id, posts.date, posts.num, posts.deleted, posts.options, posts.mood, posts.ip, posts.thread, \n\t\t\t\t\tposts_text.text, posts_text.text, posts_text.revision, users.id as uid, \n\t\t\t\t\tforums.id fid, \n\t\t\t\t\tusers.name, users.displayname, users.rankset, users.powerlevel, users.title, users.sex, users.picture, users.posts, users.postheader, users.signature, users.signsep, users.globalblock, users.lastposttime, users.lastactivity, users.regdate\n\t\t\t\tfrom \n\t\t\t\t\tposts \n\t\t\t\t\tleft join posts_text on posts_text.pid = posts.id and posts_text.revision = posts.currentrevision \n\t\t\t\t\tleft join users on users.id = posts.user\n\t\t\t\t\tleft join threads on threads.id=posts.thread\n\t\t\t\t\tleft join forums on forums.id=threads.forum\n\t\t\t\twhere posts.id=" . $id;
        $rPost = Query($qPost);
        if (!NumRows($rPost)) {
            die(__("Unknown post ID."));
        }
        $post = Fetch($rPost);
        if (!CanMod($loguserid, $post['fid'])) {
            die(__("No."));
        }
        if (isset($_GET['o'])) {
            $post['deleted'] = 0;
            $post['unfoldhax'] = 1;
        }
        die(MakePost($post, $post['thread'], $post['fid']));
    } else {
        if ($action == "ou") {
            die(OnlineUsers((int) $_GET['f'], false));
        } else {
            if ($action == "tf") {
                include "css/themelist.php";
                $theme = $_GET['t'];
                if (!$themes[$theme]) {
Exemplo n.º 5
0
}
if (isset($_POST['id'])) {
    $_GET['id'] = $_POST['id'];
}
if (!isset($_GET['id'])) {
    Kill(__("Thread ID unspecified."));
}
$tid = (int) $_GET['id'];
$qThread = "select * from threads where id=" . $tid;
$rThread = Query($qThread);
if (NumRows($rThread)) {
    $thread = Fetch($rThread);
} else {
    Kill(__("Unknown thread ID."));
}
$canMod = CanMod($loguserid, $thread['forum']);
if (!$canMod && $thread['user'] != $loguserid) {
    Kill(__("You are not allowed to edit threads."));
}
$qFora = "select minpower from forums where id=" . $thread['forum'];
$rFora = Query($qFora);
if (NumRows($rFora)) {
    $forum = Fetch($rFora);
} else {
    Kill(__("Unknown forum ID."));
}
$isHidden = (int) ($forum['minpower'] > 0);
if ($canMod) {
    if ($_GET['action'] == "close") {
        $qThread = "update threads set closed=1 where id=" . $tid;
        $rThread = Query($qThread);
Exemplo 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>";
    }
}
Exemplo 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" : "");
}
Exemplo n.º 8
0
        $cellClass = ($cellClass + 1) % 2;
        $fixed = htmlval(deSlashMagic($_POST['pollOption' . $pops]));
        $pollOptions .= format("\n\t\t\t\t\t\t<tr class=\"cell{0}\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"p{1}\">" . __("Option {2}") . "</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" id=\"p{1}\" name=\"pollOption{1}\" value=\"{3}\" style=\"width: 50%;\" maxlength=\"40\" >&nbsp;\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t" . __("Color", 1) . "&nbsp;\n\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"pollColor{1}\" value=\"{4}\" size=\"10\" maxlength=\"7\" class=\"color {hash:true,required:false,pickerFaceColor:'black',pickerFace:3,pickerBorder:0,pickerInsetColor:'black',pickerPosition:'left',pickerMode:'HVS'}\" />\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t{5}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n", $cellClass, $pops, $pops + 1, $fixed, filterPollColors($_POST['pollColor' . $pops]), $first ? "&nbsp;(#rrggbb)" : "");
        $first = false;
    }
    write("\n\t\t\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"pq\">\n\t\t\t\t\t\t\t\t\t" . __("Poll question") . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" id=\"pq\" name=\"pollQuestion\" value=\"{0}\" style=\"width: 98%;\" maxlength=\"100\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"cell1\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"pn\">\n\t\t\t\t\t\t\t\t\t" . __("Number of options") . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" id=\"pn\" name=\"pollOptions\" value=\"{1}\" size=\"2\" maxlength=\"2\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t{2}\n", htmlval(deSlashMagic($_POST['pollQuestion'])), $_POST['pollOptions'], $pollOptions);
}
if ($_POST['mood']) {
    $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" ";
}
$moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n";
$rMoods = Query("select mid, name from moodavatars where uid=" . $loguserid . " order by mid asc");
while ($mood = Fetch($rMoods)) {
    $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlval($mood['name']));
}
if (CanMod($loguserid, $forum['id'])) {
    $mod = "\n\n<!-- Mod options -->\n";
    $mod .= "<label><input type=\"checkbox\" name=\"lock\">&nbsp;" . __("Close thread", 1) . "</label>\n";
    $mod .= "<label><input type=\"checkbox\" name=\"stick\">&nbsp;" . __("Sticky", 1) . "</label>\n";
    $mod .= "<!-- More could follow -->\n\n";
}
if (!$_POST['poll'] || $_POST['pollOptions']) {
    $postButton = "<input type=\"submit\" name=\"action\" value=\"" . __("Post") . "\" /> ";
}
if ($_POST['poll']) {
    $multivote = "<label><input type=\"checkbox\" " . ($_POST['multivote'] ? "checked=\"checked\"" : "") . " name=\"multivote\" />&nbsp;" . __("Multivote", 1) . "</label>";
}
write("\n\t\t\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"post\">\n\t\t\t\t\t\t\t\t\tPost\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<textarea id=\"text\" name=\"text\" rows=\"16\" style=\"width: 98%;\">{0}</textarea>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"cell2\">\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t{1}\n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t\t\t\t<select size=\"1\" name=\"mood\">\n\t\t\t\t\t\t\t\t\t{2}\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nopl\" {3} />&nbsp;" . __("Disable post layout", 1) . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nosm\" {4} />&nbsp;" . __("Disable smilies", 1) . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nobr\" {8} />&nbsp;" . __("Disable auto-<br>", 1) . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{5}\" />\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"poll\" value=\"{6}\" />\n\t\t\t\t\t\t\t\t{7}\n\t\t\t\t\t\t\t\t{9}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</form>\n\t\t\t</td>\n\t\t\t<td style=\"width: 200px; vertical-align: top; border: none;\">\n", $prefill, $postButton, $moodOptions, $nopl, $nosm, $fid, stripslashes($_POST['poll']), $multivote, $nobr, $mod);
DoSmileyBar();
DoPostHelp();
write("\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n");