Ejemplo n.º 1
0
/** Redirect page to the given one in url */
function url_content()
{
    if (!isset($_GET[PT::URL_ACTION_PARAM]) && !isset($_GET[PT::URL_REPORT_PARAM])) {
        $action = "home";
        redirectAction($action);
    } else {
        if (isset($_GET[PT::URL_ACTION_PARAM])) {
            $action = $_GET[PT::URL_ACTION_PARAM];
            $action = str_replace("..", "", $action);
            redirectAction($action);
        } else {
            if (isset($_GET[PT::URL_REPORT_PARAM])) {
                $report = $_GET[PT::URL_REPORT_PARAM];
                $report = str_replace("..", "", $report);
                redirectReport($report);
            }
        }
    }
}
Ejemplo n.º 2
0
            if ($wantDraft) {
                $post = "<!-- ###MULTIREP:" . $_POST['to'] . " ### -->" . $post;
            }
            if ($_POST['action'] == __("Save as Draft")) {
                $rPM = Query("insert into {pmsgs} (userto, userfrom, date, ip, msgread, drafting) values ({0}, {1}, {2}, {3}, 0, {4})", $firstTo, $loguserid, time(), $_SERVER['REMOTE_ADDR'], $wantDraft);
                $pid = InsertId();
                $rPMT = Query("insert into {pmsgs_text} (pid,title,text) values ({0}, {1}, {2})", $pid, $_POST['title'], $post);
                redirectAction("private", "", "show=2");
                //Redirect(__("Draft saved!"), "private.php?show=2", __("your drafts box"));
            } else {
                foreach ($recipIDs as $recipient) {
                    $rPM = Query("insert into {pmsgs} (userto, userfrom, date, ip, msgread, drafting) values ({0}, {1}, {2}, {3}, 0, {4})", $recipient, $loguserid, time(), $_SERVER['REMOTE_ADDR'], $wantDraft);
                    $pid = InsertId();
                    $rPMT = Query("insert into {pmsgs_text} (pid,title,text) values ({0}, {1}, {2})", $pid, $_POST['title'], $post);
                }
                redirectAction("private", "", "show=1");
                //Redirect(__("PM sent!"),"private.php?show=1", __("your PM outbox"));
            }
            exit;
        } else {
            Alert(__("Enter a message and try again."), __("Your PM is empty."));
        }
    } else {
        Alert(__("Enter a title and try again."), __("Your PM is untitled."));
    }
}
write("\n    <script type=\"text/javascript\">\n            window.addEventListener(\"load\",  hookUpControls, false);\n    </script>\n");
$_POST['title'] = $_POST['title'];
$_POST['text'] = $_POST['text'];
if ($_POST['action'] == __("Preview")) {
    if ($_POST['text']) {
Ejemplo n.º 3
0
<?php

if ($loguserid && isset($_GET['action']) && $_GET['action'] == "markallread") {
    Query("REPLACE INTO {threadsread} (id,thread,date) SELECT {0}, {threads}.id, {1} FROM {threads}", $loguserid, time());
    redirectAction("board");
}
$links = new PipeMenu();
if ($loguserid) {
    $links->add(new PipeMenuLinkEntry(__("Mark all forums read"), "board", 0, "action=markallread", "ok"));
}
makeLinks($links);
makeBreadcrumbs(new PipeMenu());
if (!$mobileLayout) {
    $statData = Fetch(Query("SELECT\n\t\t(SELECT COUNT(*) FROM {threads}) AS numThreads,\n\t\t(SELECT COUNT(*) FROM {posts}) AS numPosts,\n\t\t(SELECT COUNT(*) FROM {users}) AS numUsers,\n\t\t(select count(*) from {posts} where date > {0}) AS newToday,\n\t\t(select count(*) from {posts} where date > {1}) AS newLastHour,\n\t\t(select count(*) from {users} where lastposttime > {2}) AS numActive", time() - 86400, time() - 3600, time() - 2592000));
    $stats = Format(__("{0} and {1} total"), Plural($statData["numThreads"], __("thread")), Plural($statData["numPosts"], __("post")));
    $stats .= "<br />" . format(__("{0} today, {1} last hour"), Plural($statData["newToday"], __("new post")), $statData["newLastHour"]);
    $percent = $statData["numUsers"] ? ceil(100 / $statData["numUsers"] * $statData["numActive"]) : 0;
    $lastUser = Query("select u.(_userfields) from {users} u order by u.regdate desc limit 1");
    if (numRows($lastUser)) {
        $lastUser = getDataPrefix(Fetch($lastUser), "u_");
        $last = format(__("{0}, {1} active ({2}%)"), Plural($statData["numUsers"], __("registered user")), $statData["numActive"], $percent) . "<br />" . format(__("Newest: {0}"), UserLink($lastUser));
    } else {
        $last = __("No registered users") . "<br />&nbsp;";
    }
    write("\n\t\t<table class=\"outline margin width100\" style=\"overflow: auto;\">\n\t\t\t<tr class=\"cell2 center\" style=\"overflow: auto;\">\n\t\t\t<td>\n\t\t\t\t<div style=\"float: left; width: 25%;\">&nbsp;<br />&nbsp;</div>\n\t\t\t\t<div style=\"float: right; width: 25%;\">{1}</div>\n\t\t\t\t<div class=\"center\">\n\t\t\t\t\t{0}\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t", $stats, $last);
}
printRefreshCode();
makeForumListing(0);
Ejemplo n.º 4
0
    if ($doublevote) {
        //Multivote.
        if ($existing) {
            Query("delete from {pollvotes} where poll={0} and choiceid={1} and user={2}", $thread['poll'], $vote, $loguserid);
        } else {
            Query("insert into {pollvotes} (poll, choiceid, user) values ({0}, {1}, {2})", $thread['poll'], $vote, $loguserid);
        }
    } else {
        //Single vote only?
        //Remove any old votes by this user on this poll, then add a new one.
        Query("delete from {pollvotes} where poll={0} and user={1}", $thread['poll'], $loguserid);
        if (!$existing) {
            Query("insert into {pollvotes} (poll, choiceid, user) values ({0}, {1}, {2})", $thread['poll'], $vote, $loguserid);
        }
    }
    redirectAction("thread", $tid, $fromstring);
}
if (!$thread['sticky'] && Settings::get("oldThreadThreshold") > 0 && $thread['lastpostdate'] < time() - 2592000 * Settings::get("oldThreadThreshold")) {
    $replyWarning = " onclick=\"if(!confirm('" . __("Are you sure you want to reply to this old thread? This will move it to the top of the list. Please only do this if you have something new and relevant to share about this thread's topic that is not better placed in a new thread.") . "')) return false;\"";
}
if ($thread['closed']) {
    $replyWarning = " onclick=\"if(!confirm('" . __("This thread is actually closed. Are you sure you want to abuse your staff position to post in a closed thread?") . "')) return false;\"";
}
$links = new PipeMenu();
if ($loguserid) {
    if ($loguser['powerlevel'] < 0) {
        $links->add(new PipeMenuTextEntry(__("You're banned.")));
    } else {
        if (IsAllowed("makeReply", $tid) && (!$thread['closed'] || $loguser['powerlevel'] > 2)) {
            $links->add(new PipeMenuLinkEntry(__("Post reply"), "newreply", $tid, "", "comment"));
        } else {
Ejemplo n.º 5
0
                    if ($_POST['unstick']) {
                        $mod .= ", sticky = 0";
                    }
                }
            }
            $now = time();
            $rUsers = Query("update {users} set posts=posts+1, lastposttime={0} where id={1} limit 1", time(), $loguserid);
            $rPosts = Query("insert into {posts} (thread, user, date, ip, num, options, mood) values ({0},{1},{2},{3},{4}, {5}, {6})", $tid, $loguserid, $now, $_SERVER['REMOTE_ADDR'], $loguser['posts'] + 1, $options, (int) $_POST['mood']);
            $pid = InsertId();
            $rPostsText = Query("insert into {posts_text} (pid,text,revision,user,date) values ({0}, {1}, {2}, {3}, {4})", $pid, $post, 0, $loguserid, time());
            $rFora = Query("update {forums} set numposts=numposts+1, lastpostdate={0}, lastpostuser={1}, lastpostid={2} where id={3} limit 1", $now, $loguserid, $pid, $fid);
            $rThreads = Query("update {threads} set lastposter={0}, lastpostdate={1}, replies=replies+1, lastpostid={2}" . $mod . " where id={3} limit 1", $loguserid, $now, $pid, $tid);
            logAction('newreply', array('forum' => $fid, 'thread' => $tid, 'post' => $pid));
            $bucket = "newreply";
            include "lib/pluginloader.php";
            redirectAction("post", $pid);
        }
    }
}
$prefill = htmlspecialchars($_POST['text']);
if ($_GET['link']) {
    $prefill = ">>" . (int) $_GET['link'] . "\r\n\r\n";
} else {
    if ($_GET['quote']) {
        $rQuote = Query("\tselect\n\t\t\t\t\tp.id, p.deleted, pt.text,\n\t\t\t\t\tf.minpower,\n\t\t\t\t\tu.name poster\n\t\t\t\tfrom {posts} p\n\t\t\t\t\tleft join {posts_text} pt on pt.pid = p.id and pt.revision = p.currentrevision\n\t\t\t\t\tleft join {threads} t on t.id=p.thread\n\t\t\t\t\tleft join {forums} f on f.id=t.forum\n\t\t\t\t\tleft join {users} u on u.id=p.user\n\t\t\t\twhere p.id={0}", (int) $_GET['quote']);
        if (NumRows($rQuote)) {
            $quote = Fetch($rQuote);
            //SPY CHECK!
            //Do we need to translate this line? It's not even displayed in its true form ._.
            if ($quote['minpower'] > $loguser['powerlevel']) {
                $quote['text'] = str_rot13("Pools closed due to not enough power. Prosecutors will be violated.");
Ejemplo n.º 6
0
    }
    $sets[] = "pluginsettings = '" . SqlEscape(serialize($pluginSettings)) . "'";
    if ((int) $_POST['powerlevel'] != $user['powerlevel']) {
        $sets[] = "tempbantime = 0";
    }
    $query .= join($sets, ", ") . " WHERE id = " . $userid;
    if (!$failed) {
        RawQuery($query);
        if ($loguserid == $userid) {
            $loguser = Fetch(Query("select * from {users} where id={0}", $loguserid));
        }
        if (isset($_POST['powerlevel']) && $_POST['powerlevel'] != $user['powerlevel']) {
            Karma();
        }
        logAction('edituser', array('user2' => $user['id']));
        redirectAction("profile", $userid);
    }
}
//If failed, get values from $_POST
//Else, get them from $user
foreach ($tabs as &$tab) {
    if (!isset($tab['page'])) {
        continue;
    }
    foreach ($tab['page'] as &$section) {
        foreach ($section['items'] as $field => &$item) {
            if ($item['type'] == "label" || $item['type'] == "password") {
                continue;
            }
            if (!$failed) {
                if (!isset($item["value"])) {
Ejemplo n.º 7
0
if ($_GET["action"] == "enable") {
    if ($_GET["key"] != $loguser['token']) {
        Kill("No.");
    }
    Query("insert into {enabledplugins} values ({0})", $_GET["id"]);
    logAction("enableplugin", array('text' => $_GET["id"]));
    Upgrade();
    redirectAction("pluginmanager");
}
if ($_GET["action"] == "disable") {
    if ($_GET["key"] != $loguser['token']) {
        Kill("No.");
    }
    Query("delete from {enabledplugins} where plugin={0}", $_GET["id"]);
    logAction("disableplugin", array('text' => $_GET["id"]));
    redirectAction("pluginmanager");
}
$pluginsDb = array();
$pluginList = query("SELECT * FROM {enabledplugins}");
while ($plugin = fetch($pluginList)) {
    $pluginsDb[$plugin["plugin"]] = true;
}
$cell = 0;
$pluginsDir = @opendir("plugins");
$enabledplugins = array();
$disabledplugins = array();
$pluginDatas = array();
if ($pluginsDir !== FALSE) {
    while (($plugin = readdir($pluginsDir)) !== FALSE) {
        if ($plugin == "." || $plugin == "..") {
            continue;
Ejemplo n.º 8
0
if ($_GET['action'] == "edit") {
    $trimmedTitle = trim(str_replace('&nbsp;', ' ', $_POST['title']));
    if ($trimmedTitle != "") {
        if ($_POST['iconid']) {
            $_POST['iconid'] = (int) $_POST['iconid'];
            if ($_POST['iconid'] < 255) {
                $iconurl = "img/icons/icon" . $_POST['iconid'] . ".png";
            } else {
                $iconurl = $_POST["iconurl"];
            }
        }
        if ($thread["title"] != $_POST['title'] || $thread["icon"] != $iconurl) {
            logAction('editthread', array('forum' => $fid, 'thread' => $tid, 'user2' => $thread["user"]));
        }
        $rThreads = Query("update {threads} set title={0}, icon={1} where id={2} limit 1", $_POST['title'], $iconurl, $tid);
        redirectAction("thread", $tid);
    } else {
        Alert(__("Your thread title is empty. Enter a message and try again."));
    }
}
//Fetch thread again in case something above has changed.
$rThread = Query("select * from {threads} where id={0}", $tid);
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."));
}
Ejemplo n.º 9
0
}
$title = $forum['title'];
setUrlName("newthread", $fid, $forum["title"]);
if ($loguserid) {
    $isIgnored = FetchResult("select count(*) from {ignoredforums} where uid={0} and fid={1}", $loguserid, $fid) == 1;
    if (isset($_GET['ignore'])) {
        if (!$isIgnored) {
            Query("insert into {ignoredforums} values ({0}, {1})", $loguserid, $fid);
        }
        redirectAction("forum", $fid);
    } else {
        if (isset($_GET['unignore'])) {
            if ($isIgnored) {
                Query("delete from {ignoredforums} where uid={0} and fid={1}", $loguserid, $fid);
            }
            redirectAction("forum", $fid);
        }
    }
}
$links = new PipeMenu();
if ($loguserid) {
    $links->add(new PipeMenuLinkEntry(__("Mark forum read"), "forum", $fid, "action=markasread", "ok"));
    if ($isIgnored) {
        $links->add(new PipeMenuLinkEntry(__("Unignore forum"), "forum", $fid, "unignore", "eye-open"));
    } else {
        $links->add(new PipeMenuLinkEntry(__("Ignore forum"), "forum", $fid, "ignore", "eye-close"));
    }
    if ($forum['minpowerthread'] <= $loguser['powerlevel']) {
        $links->add(new PipeMenuLinkEntry(__("Post thread"), "newthread", $fid, "", "comment"));
    }
}