function FormatNotif_PM($id, $args)
{
    global $loguserid;
    $staffpm = '';
    if (HasPermission('admin.viewstaffpms')) {
        $staffpm = ' OR p.userto=-1';
    }
    $pm = Fetch(Query("\tSELECT \n\t\t\t\t\t\t\tp.id,\n\t\t\t\t\t\t\tpt.title pmtitle, \n\t\t\t\t\t\t\tu.(_userfields) \n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t{pmsgs} p \n\t\t\t\t\t\t\tLEFT JOIN {pmsgs_text} pt ON pt.pid=p.id \n\t\t\t\t\t\t\tLEFT JOIN {users} u ON u.id=p.userfrom \n\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\tp.id={0} AND (p.userto={1}{$staffpm})", $id, $loguserid));
    $userdata = getDataPrefix($pm, 'u_');
    return __('New private message from ') . UserLink($userdata) . "\n" . actionLinkTag(htmlspecialchars($pm['pmtitle']), 'showprivate', $pm['id']);
}
Exemple #2
0
function doThreadPreview($tid)
{
    global $mobileLayout;
    if ($mobileLayout) {
        return;
    }
    $rPosts = Query("\n\t\tselect\n\t\t\t{posts}.id, {posts}.date, {posts}.num, {posts}.deleted, {posts}.options, {posts}.mood, {posts}.ip,\n\t\t\t{posts_text}.text, {posts_text}.text, {posts_text}.revision,\n\t\t\tu.(_userfields)\n\t\tfrom {posts}\n\t\tleft join {posts_text} on {posts_text}.pid = {posts}.id and {posts_text}.revision = {posts}.currentrevision\n\t\tleft join {users} u on u.id = {posts}.user\n\t\twhere thread={0} and deleted=0\n\t\torder by date desc limit 0, 20", $tid);
    if (NumRows($rPosts)) {
        $posts = "";
        while ($post = Fetch($rPosts)) {
            $cellClass = ($cellClass + 1) % 2;
            $poster = getDataPrefix($post, "u_");
            $nosm = $post['options'] & 2;
            $nobr = $post['options'] & 4;
            $posts .= Format("\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\" style=\"width: 15%; vertical-align: top;\">\n\t\t\t\t\t{1}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell{0}\">\n\t\t\t\t\t<button style=\"float: right;\" onclick=\"insertQuote({2});\">" . __("Quote") . "</button>\n\t\t\t\t\t<button style=\"float: right;\" onclick=\"insertChanLink({2});\">" . __("Link") . "</button>\n\t\t\t\t\t{3}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t", $cellClass, UserLink($poster), $post['id'], CleanUpPost($post['text'], $poster['name'], $nosm));
        }
        Write("\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"2\">" . __("Thread review") . "</th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t", $posts);
    }
}
Exemple #3
0
function getBirthdaysText()
{
    $rBirthdays = Query("select u.birthday, u.(_userfields) from {users} u where birthday > 0 and powerlevel >= 0 order by name");
    $birthdays = array();
    while ($user = Fetch($rBirthdays)) {
        $b = $user['birthday'];
        if (gmdate("m-d", $b) == gmdate("m-d")) {
            $y = gmdate("Y") - gmdate("Y", $b);
            $birthdays[] = UserLink(getDataPrefix($user, "u_")) . " (" . $y . ")";
        }
    }
    if (count($birthdays)) {
        $birthdaysToday = implode(", ", $birthdays);
    }
    if ($birthdaysToday) {
        return "<br>" . __("Birthdays today:") . " " . $birthdaysToday;
    } else {
        return "";
    }
}
Exemple #4
0
function OnlineUsers($forum = 0, $update = true)
{
    global $loguserid;
    $forumClause = "";
    $browseLocation = __("online");
    if ($update) {
        if ($loguserid) {
            Query("UPDATE {users} SET lastforum={0} WHERE id={1}", $forum, $loguserid);
        } else {
            Query("UPDATE {guests} SET lastforum={0} WHERE ip={1}", $forum, $_SERVER['REMOTE_ADDR']);
        }
    }
    if ($forum) {
        $forumClause = " and lastforum={1}";
        $forumName = FetchResult("SELECT title FROM {forums} WHERE id={0}", $forum);
        $browseLocation = format(__("browsing {0}"), $forumName);
    }
    $rOnlineUsers = Query("select u.(_userfields) from {users} u where (lastactivity > {0} or lastposttime > {0}) and loggedin = 1 " . $forumClause . " order by name", time() - 300, $forum);
    $onlineUserCt = 0;
    $onlineUsers = "";
    while ($user = Fetch($rOnlineUsers)) {
        $user = getDataPrefix($user, "u_");
        $userLink = UserLink($user, true);
        $onlineUsers .= ($onlineUserCt ? ", " : "") . $userLink;
        $onlineUserCt++;
    }
    //$onlineUsers = $onlineUserCt." "user".(($onlineUserCt > 1 || $onlineUserCt == 0) ? "s" : "")." ".$browseLocation.($onlineUserCt ? ": " : ".").$onlineUsers;
    $onlineUsers = Plural($onlineUserCt, __("user")) . " " . $browseLocation . ($onlineUserCt ? ": " : ".") . $onlineUsers;
    $data = Fetch(Query("select \n\t\t(select count(*) from {guests} where bot=0 and date > {0} {$forumClause}) as guests,\n\t\t(select count(*) from {guests} where bot=1 and date > {0} {$forumClause}) as bots\n\t\t", time() - 300, $forum));
    $guests = $data["guests"];
    $bots = $data["bots"];
    if ($guests) {
        $onlineUsers .= " | " . Plural($guests, __("guest"));
    }
    if ($bots) {
        $onlineUsers .= " | " . Plural($bots, __("bot"));
    }
    //	$onlineUsers = "<div style=\"display: inline-block; height: 16px; overflow: hidden; padding: 0px; line-height: 16px;\">".$onlineUsers."</div>";
    return $onlineUsers;
}
Exemple #5
0
function DoPrivateMessageBar()
{
    global $loguserid, $loguser;
    if ($loguserid) {
        $unread = FetchResult("select count(*) from {pmsgs} where userto = {0} and msgread=0 and drafting=0", $loguserid);
        $content = "";
        if ($unread) {
            $pmNotice = $loguser['usebanners'] ? "id=\"pmNotice\" " : "";
            $rLast = Query("select * from {pmsgs} where userto = {0} and msgread=0 order by date desc limit 0,1", $loguserid);
            $last = Fetch($rLast);
            $rUser = Query("select * from {users} where id = {0}", $last['userfrom']);
            $user = Fetch($rUser);
            $content .= format("\n\t\t" . __("You have {0}{1}. {2}Last message{1} from {3} on {4}."), Plural($unread, format(__("new {0}private message"), "<a href=\"" . actionLink("private") . "\">")), "</a>", "<a href=\"" . actionLink("showprivate", $last['id']) . "\">", UserLink($user), formatdate($last['date']));
        }
        if ($loguser['newcomments']) {
            $content .= format("\n\t\t" . __("You {0} have new comments in your {1}profile{2}."), $content != "" ? "also" : "", "<a href=\"" . actionLink("profile", $loguserid) . "\">", "</a>");
        }
        if ($content) {
            write("\n\t<div {0} class=\"outline margin header0 cell0 smallFonts\">\n\t\t{1}\n\t</div>\n", $pmNotice, $content);
        }
    }
}
    if ($havePrivates) {
        $head = str_replace("<input type=\"checkbox\" id=\"ca\" onchange=\"checkAll();\" />", "", $head);
    }
    $public = format("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"7\">" . __("Public Files") . "</th>\n\t\t</tr>\n\t\t{0}\n", $head);
    while ($entry = Fetch($entries)) {
        $delete = "";
        $multidel = "";
        if ($loguserid) {
            $multidel = "<td><input type=\"checkbox\" name=\"delete[" . $entry['id'] . "]\" disabled=\"disabled\" /></td>";
        }
        if ($loguserid == $entry['user'] || $loguser['powerlevel'] > 2) {
            $delete = "<sup>&nbsp;" . actionLinkTag("&#x2718;", "uploader", "", "action=delete&fid=" . $entry['id']) . "</sup>";
            $multidel = "<td><input type=\"checkbox\" name=\"del[" . $entry['id'] . "]\" /></td>";
        }
        $cellClass = ($cellClass + 1) % 2;
        $public .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t{7}\n\t\t\t<td>\n\t\t\t\t<a href=\"{$boardroot}get.php?id={1}\">{2}</a>{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{4}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{6}\n\t\t\t</td>\n\t\t</tr>\n", $cellClass, $entry['id'], $entry['filename'], $delete, $entry['description'], BytesToSize(@filesize($rootdir . "/" . $entry['filename'])), UserLink($entry, "user"), $multidel);
    }
    if ($loguserid) {
        $public .= format("\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th style=\"text-align: right;\" colspan=\"6\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"multidel\" />\n\t\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.forms[2].submit();\">" . __("delete checked") . "</a>\n\t\t\t\t</th>\n\t\t\t</tr>");
    }
    $public .= "</table>";
}
$maxSizeMult = $uploaderMaxFileSize * 1024 * 1024;
if ($loguserid && IsAllowed("useUploader")) {
    $uploadPart = format("\n<script type=\"text/javascript\">\n\twindow.addEventListener(\"load\", function() { hookUploadCheck(\"newfile\", 1, {1}) }, false);\n</script>\n<button style=\"float: right;\" onclick=\"var uploadForm = document.getElementById(&quot;uploadForm&quot;); uploadForm.style.display = (uploadForm.style.display == 'none' ? 'block' : 'none');\">Upload new file</button>\n<form action=\"" . actionLink("uploader") . "\" method=\"post\" enctype=\"multipart/form-data\" id=\"uploadForm\" style=\"display: none;\">\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"4\">" . __("Upload") . "</th>\n\t\t</tr>\n\t\t<tr class=\"cell2\">\n\t\t\t<td>\n\t\t\t\t<input type=\"file\" id=\"newfile\" name=\"newfile\" style=\"width: 80%;\" />\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" name=\"description\" style=\"width: 80%;\" />\n\t\t\t\t<label>\n\t\t\t\t\t<input type=\"checkbox\" name=\"private\" />&nbsp;" . __("Private") . "\n\t\t\t\t</label>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"submit\" id=\"submit\" name=\"action\" value=\"" . __("Upload") . "\" disabled=\"disabled\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell1 smallFonts\">\n\t\t\t<td colspan=\"3\">\n\t\t\t\t" . __("The maximum upload size is {0} per file. You can upload the following types: {2}.") . "\n\t\t\t\t<div id=\"sizeWarning\" style=\"display: none; font-weight: bold\">" . __("File is too large.") . "</div>\n\t\t\t\t<div id=\"typeWarning\" style=\"display: none; font-weight: bold\">" . __("File is not an allowed type.") . "</div>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t<br />\n</form>\n", BytesToSize($maxSizeMult), $maxSizeMult, Settings::pluginGet('uploaderWhitelist'));
}
$bar = "&nbsp;0%";
if ($totalsize > 0) {
    $width = floor(100 * ($totalsize / $quota));
    if ($width > 0) {
        $color = "green";
function getBirthdaysText($ret = true)
{
    global $luckybastards, $loguser;
    $luckybastards = array();
    $today = gmdate('m-d', time() + $loguser['timezone']);
    $rBirthdays = Query("select u.birthday, u.(_userfields) from {users} u where u.birthday > 0 and u.primarygroup!={0} order by u.name", Settings::get('bannedGroup'));
    $birthdays = array();
    while ($user = Fetch($rBirthdays)) {
        $b = $user['birthday'];
        if (gmdate("m-d", $b) == $today) {
            $luckybastards[] = $user['u_id'];
            if ($ret) {
                $y = gmdate("Y") - gmdate("Y", $b);
                $birthdays[] = UserLink(getDataPrefix($user, 'u_')) . " (" . $y . ")";
            }
        }
    }
    if (!$ret) {
        return '';
    }
    if (count($birthdays)) {
        $birthdaysToday = implode(", ", $birthdays);
    }
    if (isset($birthdaysToday)) {
        return __("Birthdays today:") . " " . $birthdaysToday;
    } else {
        return "";
    }
}
    if ($commentsWasEmpty) {
        $commentList = "";
    }
    $commentList .= $thisComment;
}
//print "lastCID: ".$lastCID;
if ($loguserid) {
    $commentField = format("\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<form method=\"post\" action=\"profile.php\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{0}\" />\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"text\" style=\"width: 80%;\" maxlength=\"255\" />\n\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Post") . "\" />\n\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t</div>\n", $id);
    if ($lastCID == $loguserid) {
        $commentField = __("You already have the last word.");
    }
    if (!IsAllowed("makeComments")) {
        $commentField = __("You are not allowed to post usercomments.");
    }
}
write("\n\t\t\t<td style=\"vertical-align: top; border: 0px none;\">\n\t\t\t\t<table class=\"outline margin\">\n\t\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t\t\t" . __("Comments about {0}") . "\n\t\t\t\t\t\t</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t{1}\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=\"2\" class=\"cell2\">\n\t\t\t\t\t\t\t{2}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n", UserLink($user), $commentList, $commentField);
$bucket = "profileRight";
include "./lib/pluginloader.php";
write("\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n");
/*
//Randomized previews
$previews = array
(
	"(sample text)", //from AcmlmBoard 1.8a and 2.0a2
	"[quote=Spock]A sample quote, with a <a href=\"about:blank\">link</a>, for testing your layout.[/quote](sample text)", //from ProtoBoard
	"[quote=\"The Joker\" id=\"4\"]Why so <a href=\"profile.php?id=".$id."\">serious</a>?[/quote]Because I heard it before. And it wasn't funny then.", //from "The Dark Knight" and "The Killing Joke"
	"[quote=Barack Obama]I am Barack Obama and I approve this preview message.[/quote](sample post)",
);
$previewPost['text'] = $previews[array_rand($previews)];
//</randompreviews>
*/
CheckPermission('admin.ipsearch');
$ip = $_GET["id"];
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
    Kill("Invalid IP");
}
$links = array();
$links[] = "<a href=\"http://dnsquery.org/ipwhois/{$ip}\" target=\"_blank\">Whois Query</a>";
$links[] = "<a onclick=\"if(confirm('Are you sure you want to IP-ban {$ip}?')) {document.getElementById('banform').submit();} return false;\" href=\"#\">IP Ban</a>";
MakeCrumbs(array(actionLink("admin") => __("Admin"), actionLink("ipbans") => __("IP ban manager"), '' => $ip), $links);
$rUsers = Query("select * from {users} where lastip={0}", $ip);
echo "<h3>Users with this IP</h3>";
$userList = "";
$ipBanComment = "";
$i = 1;
if (NumRows($rUsers)) {
    while ($user = Fetch($rUsers)) {
        $ipBanComment .= $user["name"] . " ";
        $cellClass = ($cellClass + 1) % 2;
        if ($user['lasturl']) {
            $lastUrl = "<a href=\"" . $user['lasturl'] . "\">" . $user['lasturl'] . "</a>";
        } else {
            $lastUrl = __("None");
        }
        $userList .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{4}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{6}\n\t\t\t</td>\n\t\t</tr>\n\t", $cellClass, $i, UserLink($user), cdate("d-m-y G:i:s", $user['lastactivity']), $user['lastposttime'] ? cdate("d-m-y G:i:s", $user['lastposttime']) : __("Never"), $lastUrl, formatIP($user['lastip']));
        $i++;
    }
} else {
    $userList = "<tr class=\"cell0\"><td colspan=\"6\">" . __("No users") . "</td></tr>";
}
echo "<form id=\"banform\" action=\"" . htmlentities(actionLink('ipbans')) . "\" method=\"post\">\n\t<input type=\"hidden\" name=\"ip\" value=\"{$ip}\">\n\t<input type=\"hidden\" name=\"reason\" value=\"" . htmlentities($ipBanComment) . "\">\n\t<input type=\"hidden\" name=\"days\" value=\"0\">\n\t<input type=\"hidden\" name=\"actionadd\" value=\"yes, do it!\">\n</form>";
echo "\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 30px;\">\n\t\t\t\t#\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Name") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last view") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last post") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("URL") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("IP") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{$userList}\n\t</table>";
if ($isMod) {
    $format = "\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{4}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t</tr>\n\t";
} else {
    $format = "\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t</tr>\n\t";
}
$items = "";
while ($user = Fetch($peeps)) {
    $bucket = "userMangler";
    include "./lib/pluginloader.php";
    $lip = $user['lastip'];
    $lkb = $user['lastknownbrowser'];
    if (isset($_GET['showfull'])) {
        $lkb = str_replace("-->", "", str_replace("<!--", " &mdash;", $lkb));
    }
    $cellClass = ($cellClass + 1) % 2;
    $items .= format($format, $cellClass, $user['id'], UserLink($user), IP2C($lip), $lip, $lkb);
}
if ($isMod) {
    write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th>\n\t\t\t\t" . __("ID") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Name") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t&nbsp;\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("IP") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Last known browser") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $items);
} else {
    write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th>\n\t\t\t\t" . __("ID") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Name") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t&nbsp;\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Last known browser") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $items);
}
function IP2C($ip)
{
    $q = @mysql_query("select cc from ip2c where ip_from <= inet_aton('" . $ip . "') and ip_to >= inet_aton('" . $ip . "')") or $r['cc'] = "";
    if ($q) {
        $r = @mysql_fetch_array($q);
    }
    if ($r['cc']) {
        return " <img src=\"img/flags/" . strtolower($r['cc']) . ".png\" alt=\"" . $r['cc'] . "\" title=\"" . $r['cc'] . "\" />";
    }
$links[] = actionLinkTag(__("Send new PM"), "sendprivate");
MakeCrumbs(array(actionLink("private") => __("Private messages")), $links);
$rPM = Query("\n\tSELECT \n\t\tp.*,\n\t\tpt.*,\n\t\tu.(_userfields) \n\tFROM \n\t\t{pmsgs} p \n\t\tLEFT JOIN {pmsgs_text} pt ON pt.pid = p.id \n\t\tLEFT JOIN {users} u ON u.id={$onclause}\n\tWHERE \n\t(" . $whereFrom . $staffpms . ") AND !(p.deleted & {1})\n\tORDER BY p.date DESC LIMIT {2u}, {3u}", $user, $deleted, $from, $ppp, -1);
$pagelinks = PageLinks(actionLink("private", "", "{$show}{$userGet}&from="), $ppp, $from, $total);
RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'top'));
$pms = array();
while ($pm = Fetch($rPM)) {
    $pmdata = array();
    if ($showWhat == 1 && $pm['userto'] == -1) {
        $pmdata['userlink'] = 'Staff';
    } else {
        if ($pm['drafting']) {
            $pmdata['userlink'] = htmlspecialchars($pm['draft_to']);
        } else {
            $user = getDataPrefix($pm, 'u_');
            $pmdata['userlink'] = UserLink($user);
        }
    }
    if (!$pm['msgread']) {
        $pmdata['newIcon'] = "<div class=\"statusIcon new\"></div>";
    } else {
        $pmdata['newIcon'] = '';
    }
    if ($pm['drafting']) {
        $pmdata['link'] = actionLinkTag(htmlspecialchars($pm['title']), 'sendprivate', '', 'pid=' . $pm['id'] . $snoop);
    } else {
        $pmdata['link'] = actionLinkTag(htmlspecialchars($pm['title']), 'showprivate', $pm['id'], substr($snoop, 1));
    }
    $pmdata['deleteCheck'] = $snoop ? '' : "<input type=\"checkbox\" name=\"delete[{$pm['id']}]\">";
    $pmdata['formattedDate'] = formatdate($pm['date']);
    $pms[] = $pmdata;
Exemple #12
0
            for ($i = 1; $i < $n; $i++) {
                $pl .= " <a href=\"thread.php?id=" . $thread['id'] . "&amp;from=" . $i * $ppp . "\">" . ($i + 1) . "</a>";
            }
            $pl .= " &hellip; ";
            for ($i = $numpages - $n + 1; $i <= $numpages; $i++) {
                $pl .= " <a href=\"thread.php?id=" . $thread['id'] . "&amp;from=" . $i * $ppp . "\">" . ($i + 1) . "</a>";
            }
        }
        if ($pl) {
            $pl = " <span class=\"smallFonts\">[<a href=\"thread.php?id=" . $thread['id'] . "\">1</a>" . $pl . "]</span>";
        }
        $lastLink = "";
        if ($thread['lastpostid']) {
            $lastLink = " <a href=\"thread.php?pid=" . $thread['lastpostid'] . "#" . $thread['lastpostid'] . "\">&raquo;</a>";
        }
        $forumList .= Format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td class=\"cell2 threadIcon\">{1}</td>\n\t\t\t<td class=\"threadIcon\" style=\"border-right: 0px none;\">\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td style=\"border-left: 0px none;\">\n\t\t\t\t{3}\n\t\t\t\t<a href=\"thread.php?id={4}\">\n\t\t\t\t\t{5}\n\t\t\t\t</a>\n\t\t\t\t{6}\n\t\t\t\t{7}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{8}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{9}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{10}\n\t\t\t</td>\n\t\t\t<td class=\"smallFonts center\">\n\t\t\t\t{11}<br />\n\t\t\t\t" . __("by") . " {12} {13}</td>\n\t\t</tr>\n", $cellClass, $NewIcon, $ThreadIcon, $poll, $thread['id'], strip_tags($thread['title']), $pl, $tags, UserLink($starter), $thread['replies'], $thread['views'], cdate($dateformat, $thread['lastpostdate']), UserLink($last), $lastLink);
    }
    Write("\n\t<table class=\"outline margin width100\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 20px;\">&nbsp;</th>\n\t\t\t<th style=\"width: 16px;\">&nbsp;</th>\n\t\t\t<th style=\"width: 60%;\">" . __("Title") . "</th>\n\t\t\t<th>" . __("Started by") . "</th>\n\t\t\t<th>" . __("Replies") . "</th>\n\t\t\t<th>" . __("Views") . "</th>\n\t\t\t<th>" . __("Last post") . "</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $forumList);
} else {
    if ($forum['minpowerthread'] > $loguser['powerlevel']) {
        Alert(__("You cannot start any threads here."), __("Empty forum"));
    } elseif ($loguserid) {
        Alert(format(__("Would you like to {0}post something{1}?"), "<a href=\"newthread.php?id=" . $fid . "\">", "</a>"), __("Empty forum"));
    } else {
        Alert(format(__("{0}Log in{1} so you can post something."), "<a href=\"login.php\">", "</a>"), __("Empty forum"));
    }
}
if ($pagelinks) {
    Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
MakeCrumbs(array(__("Main") => "./", $forum['title'] => "forum.php?id=" . $fid), $links);
Exemple #13
0
             $r['user'] = UserLink(getDataPrefix($result, "u_"));
             $r['formattedDate'] = formatdate($result['lastpostdate']);
             $rdata[] = $r;
         }
     }
 } else {
     $nres = FetchResult("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {posts_text} pt\n\t\t\t\tLEFT JOIN {posts} p ON pt.pid = p.id\n\t\t\t\tLEFT JOIN {threads} t ON t.id = p.thread\n\t\t\tWHERE pt.pid IN ({0c}) AND t.forum IN ({1c}) AND pt.revision = p.currentrevision", $results, $viewableforums);
     $search = Query("\n\t\t\tSELECT\n\t\t\t\tpt.text, pt.pid,\n\t\t\t\tp.date,\n\t\t\t\tt.title, t.id,\n\t\t\t\tu.(_userfields)\n\t\t\tFROM {posts_text} pt\n\t\t\t\tLEFT JOIN {posts} p ON pt.pid = p.id\n\t\t\t\tLEFT JOIN {threads} t ON t.id = p.thread\n\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\tWHERE pt.pid IN ({0c}) AND t.forum IN ({1c}) AND pt.revision = p.currentrevision\n\t\t\tORDER BY p.date DESC\n\t\t\tLIMIT {2u},{3u}", $results, $viewableforums, $from, $tpp);
     if (NumRows($search)) {
         $results = "";
         while ($result = Fetch($search)) {
             $r = array();
             $tags = ParseThreadTags($result['title']);
             //			$result['text'] = str_replace("<!--", "~#~", str_replace("-->", "~#~", $result['text']));
             $r['description'] = MakeSnippet($result['text'], $terms);
             $r['user'] = UserLink(getDataPrefix($result, "u_"));
             $r['link'] = actionLinkTag($tags[0], "post", $result['pid']);
             $r['formattedDate'] = formatdate($result['date']);
             $rdata[] = $r;
         }
     }
 }
 if ($nres == 0) {
     $restext = __('No results found');
 } else {
     if ($nres == 1) {
         $restext = __('1 result found');
     } else {
         $restext = $nres . __(' results found');
     }
 }
$ranklist = array();
for ($i = 0; $i < count($ranks); $i++) {
    $rdata = array();
    $rank = $ranks[$i];
    $nextRank = $ranks[$i + 1];
    if ($nextRank['num'] == 0) {
        $nextRank['num'] = $ranks[$i]['num'] + 1;
    }
    $members = array();
    $inactive = 0;
    $total = 0;
    foreach ($users as $user) {
        if ($user['posts'] >= $rank['num'] && $user['posts'] < $nextRank['num']) {
            $total++;
            if ($user['lastposttime'] > time() - 2592000) {
                $members[] = UserLink($user);
            } else {
                $inactive++;
            }
        }
    }
    if ($inactive) {
        $members[] = $inactive . ' inactive';
    }
    $showRank = HasPermission('admin.viewallranks') || $loguser['posts'] >= $rank['num'] || count($members) > 0;
    if ($showRank) {
        $rdata['rank'] = getRankHtml($rankset, $rank);
    } else {
        $rdata['rank'] = '???';
    }
    if (count($members) == 0) {
Exemple #15
0
     $qThread = "select forum from {threads} where id={0}";
     $rThread = Query($qThread, $post['thread']);
     $thread = Fetch($rThread);
     if (!HasPermission('forum.viewforum', $thread['forum'])) {
         die('No.');
     }
     if (!HasPermission('mod.editposts', $thread['forum'])) {
         die('No.');
     }
     $qRevs = "SELECT\n\t\t\t\trevision, date AS revdate,\n\t\t\t\tru.(_userfields)\n\t\t\tFROM\n\t\t\t\t{posts_text}\n\t\t\t\tLEFT JOIN {users} ru ON ru.id = user\n\t\t\tWHERE pid={0}\n\t\t\tORDER BY revision ASC";
     $revs = Query($qRevs, $id);
     $reply = __("Show revision:") . "<br />";
     while ($revision = Fetch($revs)) {
         $reply .= " <a href=\"javascript:void(0)\" onclick=\"showRevision(" . $id . "," . $revision["revision"] . ")\">" . format(__("rev. {0}"), $revision["revision"]) . "</a>";
         if ($revision['ru_id']) {
             $ru_link = UserLink(getDataPrefix($revision, "ru_"));
             $revdetail = " " . format(__("by {0} on {1}"), $ru_link, formatdate($revision['revdate']));
         } else {
             $revdetail = '';
         }
         $reply .= $revdetail;
         $reply .= "<br />";
     }
     $hideTricks = " <a href=\"javascript:void(0)\" onclick=\"showRevision(" . $id . "," . $post["currentrevision"] . "); hideTricks(" . $id . ")\">" . __("Back") . "</a>";
     $reply .= $hideTricks;
     die($reply);
 } elseif ($action == "sr") {
     $rPost = Query("\n\t\t\tSELECT\n\t\t\t\tp.*,\n\t\t\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\t\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock),\n\t\t\t\tru.(_userfields),\n\t\t\t\tdu.(_userfields),\n\t\t\t\tt.forum fid\n\t\t\tFROM\n\t\t\t\t{posts} p\n\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = {1}\n\t\t\t\tLEFT JOIN {threads} t ON t.id=p.thread\n\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\t\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\t\tWHERE p.id={0} AND t.forum IN ({2c})", $id, (int) $_GET['rev'], ForumsWithPermission('forum.viewforum'));
     if (NumRows($rPost)) {
         $post = Fetch($rPost);
     } else {
    }
    $postdate = formatdate($thread['date']);
    $posttext = CleanUpPost($thread['text'], $thread['u_name'], false, false);
    $comments = Plural($thread['replies'], "comment");
    $comments = actionLinkTag($comments, "thread", $thread['id'], "", $thread["title"]) . ".";
    if ($thread['replies'] != 0) {
        $comments .= " Last by " . UserLink($last) . ". {$lastLink}";
    }
    $newreply = actionLinkTag("Post a comment", "newreply", $thread['id'], "", $thread["title"]);
    if ($thread['sticky']) {
        $forumList .= "<table class='outline margin width100'>";
        $forumList .= "<tr class='cell1'><td style='border: 1px solid #000; padding:16px' colspan='2'>{$posttext}</td></tr>";
        $forumList .= "</table>";
    } else {
        $forumList .= "<table class='outline margin width100'>";
        $forumList .= "\n\t\t<tr class=\"header1\" >\n\t\t\t<th style='text-align:left;'><span style='font-size:15px'>" . $tags[0] . "</span><span style='font-weight:normal;'>{$subtitle}</span></th>\n\t\t\t<th style='text-align:left; width:150px; font-weight:normal;'>Posted by " . UserLink($starter) . "<br>{$postdate}</th>\n\t\t</tr>";
        $forumList .= "<tr class='cell1'><td colspan='2' style='padding:10px'>{$posttext}</td></tr>";
        $forumList .= "<tr class='cell0'><td>{$comments}</td><td style=\"border-left: 0px none;\">{$newreply}</td></tr>";
        $forumList .= "</table>";
    }
}
Write($forumList);
if ($pagelinks) {
    Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
if ($twoColumns) {
    echo '</td><td style="border: 0px none; vertical-align: top; padding-right: 1em; padding-bottom: 1em;">';
    echo '<table class="outline margin width100">
	<tr class="header0"><th>&nbsp;</th></tr>
	<tr class="cell1"><td style="padding:16px" colspan="2">';
    echo CleanUpPost(Settings::pluginGet("righttext"));
Exemple #17
0
while ($thread = Fetch($rThreads)) {
    $pdata = array();
    $starter = getDataPrefix($thread, 'su_');
    $last = getDataPrefix($thread, 'lu_');
    $tags = ParseThreadTags($thread['title']);
    $pdata['title'] = $tags[0];
    $pdata['formattedDate'] = formatdate($thread['date']);
    $pdata['userlink'] = UserLink($starter);
    $pdata['text'] = CleanUpPost($thread['text'], $starter['name'], false, false);
    if (!$thread['replies']) {
        $comments = 'No comments yet';
    } else {
        if ($thread['replies'] < 2) {
            $comments = actionLinkTag('1 comment', 'post', $thread['lastpostid']) . ' (by ' . UserLink($last) . ')';
        } else {
            $comments = actionLinkTag($thread['replies'] . ' comments', 'post', $thread['lastpostid']) . ' (last by ' . UserLink($last) . ')';
        }
    }
    $pdata['comments'] = $comments;
    if ($thread['closed']) {
        $newreply = __('Comment posting closed.');
    } else {
        if (!$loguserid) {
            $newreply = actionLinkTag(__('Log in'), 'login') . __(' to post a comment.');
        } else {
            $newreply = actionLinkTag(__("Post a comment"), "newreply", $thread['id']);
        }
    }
    $pdata['replylink'] = $newreply;
    $modlinks = array();
    if ($loguserid == $starter['id'] && HasPermission('user.editownposts') || HasPermission('mod.editposts', $forum['id'])) {
function listCategory($cat)
{
    global $loguser, $loguserid, $rootdir, $userSelectUsers, $boardroot;
    if (isset($_GET['sort']) && $_GET['sort'] == "filename" || $_GET['sort'] == "date") {
        $skey = $_GET['sort'];
    } else {
        $skey = "date";
    }
    $sortOptions = "<div class=\"margin smallFonts\">" . __("Sort order") . ": <ul class=\"pipemenu\">";
    $sortOptions .= $skey == "filename" ? "<li>" . __("Name") . "</li>" : actionLinkTagItem(__("Name"), "uploaderlist", "", "cat={$_GET["cat"]}&sort=filename");
    $sortOptions .= $skey == "date" ? "<li>" . __("Date") . "</li>" : actionLinkTagItem(__("Date"), "uploaderlist", "", "cat={$_GET["cat"]}&sort=date");
    $sortOptions .= "</ul></div>";
    $sdir = $skey == "date" ? " desc" : " asc";
    print $sortOptions;
    if ($cat == -1) {
        $condition = "up.user = "******" and up.private = 1";
    } else {
        if ($cat == -2 && $loguser['powerlevel'] > 2) {
            $condition = "up.private = 1";
        } else {
            $condition = "up.private = 0 and up.category = {0}";
        }
    }
    $errormsg = __("The category is empty.");
    if ($cat < 0) {
        $errormsg = __("You have no private files.");
    }
    $entries = Query("SELECT\n\t\t\tup.*,\n\t\t\tu.(_userfields)\n\t\t\tFROM {uploader} up\n\t\t\tLEFT JOIN {users} u on up.user = u.id\n\t\t\tWHERE {$condition}\n\t\t\tORDER BY " . $skey . $sdir, $cat);
    $checkbox = "";
    if ($loguserid) {
        $checkbox = "<input type=\"checkbox\" id=\"ca\" onchange=\"checkAll();\" />";
        $checkbox = "<th style=\"width: 22px;\">{$checkbox}</th>";
    }
    if (NumRows($entries) == 0) {
        print "\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"7\">" . __("Files") . "</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell1\">\n\t\t\t\t<td colspan=\"4\">\n\t\t\t\t\t" . $errormsg . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t";
    } else {
        print "\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"7\">" . __("Files") . "</th>\n\t\t\t</tr>\n\n\t\t";
        print "\n\t\t\t<tr class=\"header1\">\n\t\t\t\t{$checkbox}\n\t\t\t\t<th>\n\t\t\t\t\t" . __("File") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Description") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Size") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Uploader") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Downloads") . "\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t";
        while ($entry = Fetch($entries)) {
            $delete = "";
            $multidel = "";
            if ($loguserid) {
                $multidel = "<td><input type=\"checkbox\" name=\"delete[" . $entry['id'] . "]\" disabled=\"disabled\" /></td>";
            }
            if ($loguserid == $entry['user'] || $loguser['powerlevel'] > 2) {
                $delete = "&nbsp;<sup>" . actionLinkTag("&#x2718;", "uploader", "", "action=delete&fid=" . $entry['id'] . "&cat=" . $_GET["cat"]) . "</sup>";
                $multidel = "<td><input type=\"checkbox\" name=\"del[" . $entry['id'] . "]\" /></td>";
            }
            $cellClass = ($cellClass + 1) % 2;
            $filepath = $rootdir . "/" . $entry['filename'];
            if ($entry['private']) {
                $filepath = $rootdir . "/" . $entry['user'] . "/" . $entry['filename'];
            }
            print format("\n\t\t\t<tr class=\"cell{0}\">\n\t\t\t\t{7}\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"{$boardroot}get.php?id={1}\">{2}</a>{3}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{4}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{5}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{6}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{8}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t", $cellClass, $entry['id'], $entry['filename'], $delete, $entry['description'], BytesToSize(@filesize($filepath)), UserLink(getDataPrefix($entry, "u_")), $multidel, $entry["downloads"]);
        }
        if ($loguserid) {
            $entries = Query("select * from {uploader_categories} order by ord");
            $movelist = "";
            while ($entry = Fetch($entries)) {
                $movelist .= "<option value='{$entry["id"]}'>{$entry["name"]}</option>";
            }
            $movelist = "<select name='destcat' size='1'>{$movelist}</select>";
            print format("\n\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t<th style=\"text-align: right;\" colspan=\"6\">\n\t\t\t\t\t\t<input type=\"hidden\" id='actionfield' name=\"action\" value=\"multidel\" />\n\t\t\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.getElementById('actionfield').value = 'multidel'; document.forms[1].submit();\">" . __("delete checked") . "</a>\n\t\t\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.getElementById('actionfield').value = 'multimove'; document.forms[1].submit();\">" . __("Move checked to") . "</a>{$movelist}\n\t\t\t\t\t</th>\n\t\t\t\t</tr>");
        }
        print "</table>";
    }
}
Exemple #19
0
    while ($comment = Fetch($rComments)) {
        if ($canDeleteComments) {
            $deleteLink = "<small style=\"float: right; margin: 0px 4px;\">" . actionLinkTag("&#x2718;", $mobileLayout ? "usercomments" : "profile", $id, "action=delete&cid=" . $comment['id'] . "&token={$loguser['token']}") . "</small>";
        }
        $cellClass = ($cellClass + 1) % 2;
        $thisComment = format("\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\t\t\t\t{0}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"cell{1}\">\n\t\t\t\t\t\t\t\t{3}{2}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n", UserLink(getDataPrefix($comment, "u_")), $cellClass, CleanUpPost($comment['text'], $comment['u_name']), $deleteLink);
        $commentList = $commentList . $thisComment;
        if (!isset($lastCID)) {
            $lastCID = $comment['cid'];
        }
    }
    $pagelinks = "<td colspan=\"2\" class=\"cell1\">{$pagelinks}</td>";
    if ($total > $cpp) {
        $commentList = "{$pagelinks}{$commentList}{$pagelinks}";
    }
} else {
    $commentsWasEmpty = true;
    $commentList = $thisComment = format("\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"cell0\" colspan=\"2\">\n\t\t\t\t\t\t\t\t" . __("No comments.") . "\n\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n");
}
//print "lastCID: ".$lastCID;
if ($loguserid) {
    $commentField = "\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<form name=\"commentform\" method=\"post\" action=\"" . actionLink("usercomments") . "\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"text\" style=\"width: 80%;\" maxlength=\"255\" />\n\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\" />\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"token\" value=\"{$loguser['token']}\" />\n\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t</div>";
    //	if($lastCID == $loguserid)
    //		$commentField = __("You already have the last word.");
    if (!IsAllowed("makeComments") || !$canComment) {
        $commentField = __("You are not allowed to post usercomments.");
    }
}
print "\n\t\t\t\t<table class=\"outline margin\">\n\t\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t\t\t" . format(__("Comments about {0}"), UserLink($user)) . "\n\t\t\t\t\t\t</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t{$commentList}\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=\"2\" class=\"cell2\">\n\t\t\t\t\t\t\t{$commentField}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>";
$bucket = "profileRight";
include "./lib/pluginloader.php";
Exemple #20
0
$spanList = "";
foreach ($spans as $span) {
    $spanList .= actionLinkTagItem(timeunits($span), "online", "", "time={$span}");
}
write("\n\t<div class=\"smallFonts margin\">\n\t\t" . __("Show visitors from this far back:") . "\n\t\t<ul class=\"pipemenu\">\n\t\t\t{0}\n\t\t</ul>\n\t</div>\n", $spanList);
$userList = "";
$i = 1;
if (NumRows($rUsers)) {
    while ($user = Fetch($rUsers)) {
        $cellClass = ($cellClass + 1) % 2;
        if ($user['lasturl']) {
            $lastUrl = "<a href=\"" . FilterURL($user['lasturl']) . "\">" . FilterURL($user['lasturl']) . "</a>";
        } else {
            $lastUrl = __("None");
        }
        $userList .= "\n\t\t<tr class=\"cell{$cellClass}\">\n\t\t\t<td>{$i}</td>\n\t\t\t<td>" . UserLink($user) . "</td>\n\t\t\t<td>" . ($user['lastposttime'] ? cdate("d-m-y G:i:s", $user['lastposttime']) : __("Never")) . "</td>\n\t\t\t<td>" . cdate("d-m-y G:i:s", $user['lastactivity']) . "</td>\n\t\t\t<td>{$lastUrl}</td>";
        if ($showIPs) {
            $userList .= "<td>" . formatIP($user['lastip']) . "</td>";
        }
        $userList .= "</tr>";
        $i++;
    }
} else {
    $userList = "<tr class=\"cell0\"><td colspan=\"6\">" . __("No users") . "</td></tr>";
}
function listGuests($rGuests, $noMsg)
{
    global $showIPs;
    if (!NumRows($rGuests)) {
        return "<tr class=\"cell0\"><td colspan=\"6\">{$noMsg}</td></tr>";
    }
Exemple #21
0
function makeAnncBar()
{
    global $loguserid;
    $anncforum = Settings::get('anncForum');
    if ($anncforum > 0) {
        $annc = Query("\tSELECT \n\t\t\t\t\t\t\tt.id, t.title, t.icon, t.poll, t.forum,\n\t\t\t\t\t\t\tt.date anncdate,\n\t\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\n\t\t\t\t\t\t\tu.(_userfields)\n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t{threads} t \n\t\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={1}" : '') . "\n\t\t\t\t\t\t\tLEFT JOIN {users} u ON u.id=t.user\n\t\t\t\t\t\tWHERE forum={0}\n\t\t\t\t\t\tORDER BY anncdate DESC LIMIT 1", $anncforum, $loguserid);
        if ($annc && NumRows($annc)) {
            $annc = Fetch($annc);
            $adata = array();
            $adata['new'] = '';
            if (!$loguserid && $annc['anncdate'] > time() - 900 || $loguserid && $annc['anncdate'] > $annc['readdate']) {
                $adata['new'] = "<div class=\"statusIcon new\"></div>";
            }
            $adata['poll'] = $annc['poll'] ? "<img src=\"" . resourceLink('img/poll.png') . "\" alt=\"Poll\"/> " : '';
            $adata['link'] = MakeThreadLink($annc);
            $user = getDataPrefix($annc, 'u_');
            $adata['user'] = UserLink($user);
            $adata['date'] = formatdate($annc['anncdate']);
            RenderTemplate('anncbar', array('annc' => $adata));
        }
    }
}
Exemple #22
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);
    write("\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Sort by") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{1}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{2}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{3}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{4}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{5}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Order") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{6}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{7}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Sex") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{8}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{9}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{10}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{11}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Power") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{12}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{13}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{14}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{15}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{16}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{17}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{18}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Name") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t{19}\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n", null, mlink("", $sex, $pow, $tpp, $letter, $dir) . __("Posts") . "</a>", mlink("id", $sex, $pow, $tpp, $letter) . __("ID") . "</a>", mlink("name", $sex, $pow, $tpp, $letter, $dir) . __("Username") . "</a>", mlink("karma", $sex, $pow, $tpp, $letter, $dir) . __("Karma") . "</a>", mlink("reg", $sex, $pow, $tpp, $letter, $dir) . __("Registration date") . "</a>", mlink($sort, $sex, $pow, $tpp, $letter, "asc") . __("Ascending") . "</a>", mlink($sort, $sex, $pow, $tpp, $letter, "desc") . __("Descending") . "</a>", mlink($sort, "m", $pow, $tpp, $letter, $dir) . __("Male") . "</a>", mlink($sort, "f", $pow, $tpp, $letter, $dir) . __("Female") . "</a>", mlink($sort, "n", $pow, $tpp, $letter, $dir) . __("N/A") . "</a>", mlink($sort, "", $pow, $tpp, $letter, $dir) . __("All") . "</a>", mlink($sort, $sex, "-1", $tpp, $letter, $dir) . __("Banned") . "</a>", mlink($sort, $sex, "0", $tpp, $letter, $dir) . __("Normal") . "</a>", mlink($sort, $sex, "1", $tpp, $letter, $dir) . __("Local moderator") . "</a>", mlink($sort, $sex, "2", $tpp, $letter, $dir) . __("Full moderator") . "</a>", mlink($sort, $sex, "3", $tpp, $letter, $dir) . __("Administrator") . "</a>", mlink($sort, $sex, "4", $tpp, $letter, $dir) . __("Root") . "</a>", mlink($sort, $sex, "", $tpp, $letter, $dir) . __("All") . "</a>", $alphabet);
}
if ($pagelinks) {
    write("\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Page") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t{0}\n\t\t\t</td>\n\t\t</tr>\n", $pagelinks);
}
$memberList = "";
if ($numUsers) {
    while ($user = Fetch($rUsers)) {
        $bucket = "userMangler";
        include "./lib/pluginloader.php";
        $daysKnown = (time() - $user['regdate']) / 86400;
        $user['average'] = sprintf("%1.02f", $user['posts'] / $daysKnown);
        $userPic = "";
        if ($user['picture'] && $hacks['themenames'] != 3) {
            $userPic = "<img src=\"" . str_replace("img/avatars/", "img/avatars/", $user['picture']) . "\" alt=\"\" style=\"width: 60px;\" />";
        }
        $cellClass = ($cellClass + 1) % 2;
        $memberList .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>{1}</td>\n\t\t\t<td>{2}</td>\n\t\t\t<td>{3}</td>\n\t\t\t<td>{4}</td>\n\t\t\t<td>{5}</td>\n\t\t\t<td>{6}</td>\n\t\t\t<td>{7}</td>\n\t\t\t<td>{8}</td>\n\t\t</tr>\n", $cellClass, $user['id'], $userPic, UserLink($user), $user['posts'], $user['average'], $user['karma'], $user['birthday'] ? cdate("M jS", $user['birthday']) : "&nbsp;", cdate("M jS Y", $user['regdate']));
    }
} else {
    $memberList = format("\n\t\t<tr class=\"cell0\">\n\t\t\t<td colspan=\"8\">\n\t\t\t\t" . __("Nothing here.") . "\n\t\t\t</td>\n\t\t</tr>\n");
}
write("\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 30px; \">#</th>\n\t\t\t<th style=\"width: 62px; \">" . __("Picture") . "</th>\n\t\t\t<th>" . __("Name") . "</th>\n\t\t\t<th style=\"width: 50px; \">" . __("Posts") . "</th>\n\t\t\t<th style=\"width: 50px; \">" . __("Average") . "</th>\n\t\t\t<th style=\"width: 50px; \">" . __("Karma") . "</th>\n\t\t\t<th style=\"width: 80px; \">" . __("Birthday") . "</th>\n\t\t\t<th style=\"width: 130px; \">" . __("Registered on") . "</th>\n\t\t</tr>\n\t\t{0}\n", $memberList);
if ($pagelinks) {
    write("\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Page") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t{0}\n\t\t\t</td>\n\t\t</tr>\n", $pagelinks);
}
write("\n\t</table>\n");
function mlink($sort, $sex, $pow, $tpp, $letter = "", $dir = "", $from = 1)
{
    return "<a href=\"memberlist.php?" . ($sort ? "sort={$sort}" : "") . ($sex ? "&amp;sex={$sex}" : "") . (isset($pow) ? "&amp;pow={$pow}" : "") . ($letter != "" ? "&amp;letter={$letter}" : "") . ($dir ? "&dir={$dir}" : "") . ($from != 1 ? "&amp;from={$from}" : "") . "\" rel=\"nofollow\">";
}
Exemple #24
0
function doLastPosts($compact, $limit)
{
    global $mobileLayout, $loguser;
    if ($mobileLayout) {
        $compact = true;
    }
    $hours = 72;
    $rPosts = Query("SELECT\n\t\t\t\t\t\tp.id, p.date,\n\t\t\t\t\t\tu.(_userfields),\n\t\t\t\t\t\tt.title AS ttit, t.id AS tid,\n\t\t\t\t\t\tf.title AS ftit, f.id AS fid\n\t\t\t\t\tFROM {posts} p\n\t\t\t\t\t\tLEFT JOIN {users} u on u.id = p.user\n\t\t\t\t\t\tLEFT JOIN {threads} t on t.id = p.thread\n\t\t\t\t\t\tLEFT JOIN {forums} f on t.forum = f.id\n\t\t\t\t\tWHERE " . forumAccessControlSql() . " AND p.date >= {0}\n\t\t\t\t\tORDER BY date DESC LIMIT 0, {1u}", time() - $hours * 60 * 60, $limit);
    while ($post = Fetch($rPosts)) {
        $thread = array();
        $thread["title"] = $post["ttit"];
        $thread["id"] = $post["tid"];
        $c = ($c + 1) % 2;
        if ($compact) {
            $theList .= format("\n\t\t\t\t<tr class=\"cell{5}\">\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{3} &raquo; {4}\n\t\t\t\t\t\t<br>{2}, {1} \n\t\t\t\t\t\t<span style=\"float:right\">&raquo; {6}</span>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t", $post['id'], formatdate($post['date']), UserLink(getDataPrefix($post, "u_")), actionLinkTag($post["ftit"], "forum", $post["fid"], "", $post["ftit"]), makeThreadLink($thread), $c, actionLinkTag($post['id'], "post", $post['id']));
        } else {
            $theList .= format("\n\t\t\t\t<tr class=\"cell{5}\">\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{3}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{4}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{2}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{1}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t&raquo; {6}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t", $post['id'], formatdate($post['date']), UserLink(getDataPrefix($post, "u_")), actionLinkTag($post["ftit"], "forum", $post["fid"], "", $post["ftit"]), makeThreadLink($thread), $c, actionLinkTag($post['id'], "post", $post['id']));
        }
    }
    if ($theList == "") {
        $theList = format("\n\t\t<tr class=\"cell1\">\n\t\t\t<td colspan=\"5\" style=\"text-align: center\">\n\t\t\t\t" . __("Nothing has been posted in the last {0}.") . "\n\t\t\t</td>\n\t\t</tr>\n\t", Plural($hours, __("hour")));
    }
    if ($compact) {
        write("\n\t\t<table class=\"margin outline\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"5\">" . __("Last posts") . "</th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t\t", $theList);
    } else {
        write("\n\t\t<table class=\"margin outline\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"5\">" . __("Last posts") . "</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th>" . __("Forum") . "</th>\n\t\t\t\t<th>" . __("Thread") . "</th>\n\t\t\t\t<th>" . __("User") . "</th>\n\t\t\t\t<th>" . __("Date") . "</th>\n\t\t\t\t<th></th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t\t", $theList);
    }
}
Exemple #25
0
$bucket = "topMenu";
include "./lib/pluginloader.php";
?>
					</ul>
				</td>
				<td rowspan="2" class="smallFonts" style="text-align: center; width: 10%;">
					<?php 
print cdate($dateformat) . "\n";
?>
				</td>
			</tr>
			<tr class="cell2">
				<td class="smallFonts" style="text-align: center">
					<?php 
if ($loguserid) {
    print UserLink($loguser) . ": ";
    print "<ul class=\"pipemenu\">";
    print "<li><a href=\"#\" onclick=\"if(confirm('" . __("Are you sure you want to log out?") . "')) document.forms[0].submit();\">" . __("Log out") . "</a></li>";
    if (IsAllowed("editProfile")) {
        print "<li><a href=\"editprofile.php\">" . __("Edit profile") . "</a></li>";
    }
    if (IsAllowed("viewPM")) {
        print "<li><a href=\"private.php\">" . __("Private messages") . "</a></li>";
    }
    if (IsAllowed("editMoods")) {
        print "<li><a href=\"editavatars.php\">" . __("Mood avatars") . "</a></li>";
    }
    $bucket = "bottomMenu";
    include "./lib/pluginloader.php";
    if (!isset($_POST['id']) && isset($_GET['id'])) {
        $_POST['id'] = (int) $_GET['id'];
Exemple #26
0
makeBreadcrumbs($crumbs);
$rPM = Query("select * from {pmsgs} left join {pmsgs_text} on pid = {pmsgs}.id where " . $whereFrom . " and deleted != {1} order by date desc limit {2u}, {3u}", $user, $deleted, $from, $ppp);
$numonpage = NumRows($rPM);
$pagelinks = PageLinks(actionLink("private", "", "{$show}{$userGet}&from="), $ppp, $from, $total);
if ($pagelinks) {
    write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
if (NumRows($rPM)) {
    while ($pm = Fetch($rPM)) {
        $rUser = Query("select * from {users} where id = {0}", isset($_GET['show']) ? $pm['userto'] : $pm['userfrom']);
        if (NumRows($rUser)) {
            $user = Fetch($rUser);
        }
        $cellClass = ($cellClass + 1) % 2;
        if (!$pm['msgread']) {
            $img = "<img src=\"" . resourceLink("img/status/new.png") . "\" alt=\"New!\" />";
        } else {
            $img = "";
        }
        $sender = NumRows($rUser) ? UserLink($user) : "_";
        $check = $snoop ? "" : "<input type=\"checkbox\" name=\"delete[{2}]\" />";
        $delLink = $snoop == "" ? "<sup>&nbsp;" . actionLinkTag("&#x2718;", "private", "", "del=" . $pm['id'] . $show . '&token=' . $loguser['token']) . "</sup>" : "";
        $pms .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t" . $check . "\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t" . actionLinkTag(htmlspecialchars($pm['title']), "showprivate", $pm['id'], $snoop) . "{7}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{6}\n\t\t\t</td>\n\t\t</tr>\n", $cellClass, $img, $pm['id'], $snoop, htmlspecialchars($pm['title']), $sender, formatdate($pm['date']), $delLink);
    }
} else {
    $pms = format("\n\t\t<tr class=\"cell1\">\n\t\t\t<td colspan=\"6\">\n\t\t\t\t" . __("There are no messages to display.") . "\n\t\t\t</td>\n\t\t</tr>\n");
}
write("\n\t<form method=\"post\" action=\"" . actionLink("private") . "\">\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 22px;\">\n\t\t\t\t<input type=\"checkbox\" id=\"ca\" onchange=\"checkAll();\" />\n\t\t\t</th>\n\t\t\t<th style=\"width: 22px;\">&nbsp;</th>\n\t\t\t<th style=\"width: 75%;\">" . __("Title") . "</th>\n\t\t\t<th>{0}</th>\n\t\t\t<th style=\"min-width:120px\">" . __("Date") . "</th>\n\t\t</tr>\n\t\t{1}\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"text-align: right;\" colspan=\"6\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"multidel\" />\n\t\t\t\t<input type=\"hidden\" name=\"token\" value=\"{$loguser['token']}\" />\n\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.forms[1].submit();\">" . __("delete checked") . "</a>\n\t\t\t</th>\n\t\t</tr>\n\t</table>\n\t</font>\n", isset($_GET['show']) ? __("To") : __("From"), $pms);
if ($pagelinks) {
    write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
Exemple #27
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));
}
// change this to change your board's default page
define('MAIN_PAGE', 'home');
$ajaxPage = false;
if (isset($_GET['ajax'])) {
    $ajaxPage = true;
}
require 'lib/common.php';
$layout_crumbs = '';
$layout_actionlinks = '';
if (isset($_GET['forcelayout'])) {
    setcookie('forcelayout', (int) $_GET['forcelayout'], time() + 365 * 24 * 3600, BOARD_ROOT, "", false, true);
    die(header('Location: ' . $_SERVER['HTTP_REFERER']));
}
$layout_birthdays = getBirthdaysText();
$tpl->assign('logusername', htmlspecialchars($loguser['displayname'] ?: $loguser['name']));
$tpl->assign('loguserlink', UserLink($loguser));
$metaStuff = array('description' => Settings::get('metaDescription'), 'tags' => Settings::get('metaTags'));
//=======================
// Do the page
if (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    $page = MAIN_PAGE;
}
if (!ctype_alnum($page)) {
    $page = MAIN_PAGE;
}
define('CURRENT_PAGE', $page);
ob_start();
$layout_crumbs = "";
$fakeerror = false;
Exemple #29
0
<?php

//  AcmlmBoard XD support - View counter support
if (!defined('BLARG')) {
    die;
}
//Update view counter
if (!$isBot) {
    $rViewCounter = Query("update {misc} set views = views + 1");
    $misc['views']++;
    $viewcountInterval = Settings::get("viewcountInterval");
    //Milestone reporting
    if ($viewcountInterval > 0 && $misc['views'] > 0 && $misc['views'] % $viewcountInterval == 0) {
        if ($loguserid) {
            $who = UserLink($loguser);
            //$loguser['name'];
            //3.0 update: give a badge
            Query("insert ignore into {badges} values({0}, {1}, 0)", $loguserid, 'View ' . number_format($misc['views']));
        } else {
            $who = "a guest at " . $_SERVER['REMOTE_ADDR'];
        }
        Query("update {misc} set milestone = {0}", 'View ' . $misc['views'] . ' reached by ' . $who);
    }
}
        $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";
    }
    $mod .= "\n\n";
}
write("\n\t<table style=\"width: 100%;\">\n\t\t<tr>\n\t\t\t<td style=\"vertical-align: top; border: none;\">\n\t\t\t\t<form action=\"newreply.php\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"ninja\" value=\"{0}\" />\n\t\t\t\t\t<table class=\"outline margin width100\">\n\t\t\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t\t\t\t" . __("New reply") . "\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t</tr>\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=\"uname\">\n\t\t\t\t\t\t\t\t\t" . __("User name", 1) . "\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=\"uname\" name=\"username\" value=\"{1}\" size=\"32\" maxlength=\"32\" />\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=\"upass\">\n\t\t\t\t\t\t\t\t\t" . __("Password") . "\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=\"password\" id=\"upass\" name=\"password\" value=\"{2}\" size=\"32\" maxlength=\"32\" />\n\t\t\t\t\t\t\t\t<img src=\"img/icons/icon5.png\" title=\"" . __("If you want to post under another account without having to log out, enter that account's user name and password here. Leave the password field blank to use the current account ({10}).") . "\" alt=\"[?]\" />\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=\"cell0\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"text\">\n\t\t\t\t\t\t\t\t\t" . __("Post") . "\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%;\">{3}</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<input type=\"submit\" name=\"action\" value=\"" . __("Post") . "\" /> \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{4}\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\" {5} />&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\" {6} />&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\" {9} />&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=\"{7}\" />\n\t\t\t\t\t\t\t\t{8}\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: 20%; vertical-align: top; border: none;\">\n", $ninja, htmlval($postingAsUser['name']), $_POST['password'], $prefill, $moodOptions, $nopl, $nosm, $tid, $mod, $nobr, htmlspecialchars($loguser['name']));
DoSmileyBar();
DoPostHelp();
write("\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n");
$qPosts = "select ";
$qPosts .= "posts.id, posts.date, posts.num, posts.deleted, posts.options, posts.mood, posts.ip, posts_text.text, posts_text.text, posts_text.revision, users.id as uid, users.name, users.displayname, users.rankset, users.powerlevel, users.sex, users.posts";
$qPosts .= " from 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";
$qPosts .= " where thread=" . $tid . " and deleted=0 order by date desc limit 0, 20";
$rPosts = Query($qPosts);
if (NumRows($rPosts)) {
    $posts = "";
    while ($post = Fetch($rPosts)) {
        $cellClass = ($cellClass + 1) % 2;
        $poster = $post;
        $poster['id'] = $post['uid'];
        $nosm = $post['options'] & 2;
        $nobr = $post['options'] & 4;
        $posts .= Format("\n\t\t<tr>\n\t\t\t<td class=\"cell2\" style=\"width: 15%; vertical-align: top;\">\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td class=\"cell{0}\">\n\t\t\t\t<button style=\"float: right;\" onclick=\"insertQuote({2});\">" . __("Quote") . "</button>\n\t\t\t\t<button style=\"float: right;\" onclick=\"insertChanLink({2});\">" . __("Link") . "</button>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t</tr>\n", $cellClass, UserLink($poster), $post['id'], CleanUpPost($post['text'], $poster['name'], $nosm, $nobr));
    }
    Write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"2\">" . __("Thread review") . "</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $posts);
}
MakeCrumbs(array(__("Main") => "./", $forum['title'] => "forum.php?id=" . $fid, $titleandtags => "thread.php?id=" . $tid, __("New reply") => ""), $links);