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']);
}
Exemplo n.º 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);
    }
}
Exemplo n.º 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 "";
    }
}
Exemplo n.º 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;
}
Exemplo n.º 5
0
<?php

//  AcmlmBoard XD - Frequently Asked Questions page
//  Access: all
if (!defined('BLARG')) {
    die;
}
$title = __("FAQ");
$links = array();
if (HasPermission('admin.editsettings')) {
    $links[] = actionLinkTag(__("Edit the FAQ"), "editsettings", '', 'field=faqText');
}
MakeCrumbs(array(actionLink("faq") => __("FAQ")), $links);
makeThemeArrays();
$admin = Fetch(Query("select u.(_userfields) from {users} u where u.primarygroup={0}", Settings::get('rootGroup')));
$admin = userLink(getDataPrefix($admin, 'u_'));
$sexes = array(0 => __("Male"), 1 => __("Female"), 2 => __("N/A"));
$scolors = array(0 => 'color_male', 1 => 'color_female', 2 => 'color_unspec');
$gcolors = array();
$g = Query("SELECT title, color_male, color_female, color_unspec FROM {usergroups} WHERE type=0 ORDER BY rank");
while ($group = Fetch($g)) {
    $gcolors[] = $group;
}
$headers = "";
$colors = "";
foreach ($sexes as $ss) {
    $headers .= format("\n\t<th>\n\t\t{0}\n\t</th>\n", $ss);
}
foreach ($gcolors as $g) {
    $cellClass = ($cellClass + 1) % 2;
    $items = "";
Exemplo n.º 6
0
        $ts = cdate($mydatefmt, $date);
        if ($ts == $today) {
            $ts = 'Today';
        } else {
            if ($ts == $yesterday) {
                $ts = 'Yesterday';
            }
        }
        if ($ts != $lastts) {
            $lastts = $ts;
            echo '
		<tr class="header0">
			<th colspan="2">' . $ts . '</th>
		</tr>';
        }
        $user = getDataPrefix($change, 'u_');
        $userlink = userLink($user);
        $date = formatdate($date);
        $links = actionLinkTagItem('View page', 'wiki', $change['id'], 'rev=' . $change['revision']);
        $changetext = 'Page ' . actionLinkTag(htmlspecialchars(url2title($change['id'])), 'wiki', $change['id']);
        if ($change['revision'] > 1) {
            $changetext .= ' edited by ' . $userlink . ' on ' . $date . ' (revision ' . $change['revision'] . ')';
            $links .= actionLinkTagItem('Diff', 'wikidiff', $change['id'], 'rev=' . $change['revision']);
        } else {
            $changetext .= ' created by ' . $userlink . ' on ' . $date;
        }
        echo '
		<tr class="cell' . $c . '">
			<td>' . $changetext . '</td>
			<td><ul class="pipemenu">' . $links . '</ul></td>
		</tr>';
Exemplo n.º 7
0
$rankset = $_GET['id'];
if (!isset($ranksetData[$rankset])) {
    Kill(__("Rankset not found."));
}
$ranksets = array();
foreach ($ranksetNames as $name => $title) {
    if ($name == $rankset) {
        $ranksets[] = $title;
    } else {
        $ranksets[] = actionLinkTag($title, 'ranks', $name);
    }
}
$users = array();
$rUsers = Query("select u.(_userfields), u.(posts,lastposttime) from {users} u order by id asc");
while ($user = Fetch($rUsers)) {
    $users[$user['u_id']] = getDataPrefix($user, "u_");
}
$ranks = $ranksetData[$rankset];
$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']) {
Exemplo n.º 8
0
<?php

//  AcmlmBoard XD - Frequently Asked Questions page
//  Access: all
$title = "FAQ";
$links = new PipeMenu();
if ($loguser["powerlevel"] >= 3) {
    $links->add(new PipeMenuLinkEntry(__("Edit the FAQ"), "editsettings", "faq"));
}
makeLinks($links);
$crumbs = new PipeMenu();
$crumbs->add(new PipeMenuLinkEntry(__("FAQ"), "faq"));
makeBreadcrumbs($crumbs);
makeThemeArrays();
$admin = Fetch(Query("select u.(_userfields) from {users} u where id = 1"));
$admin = UserLink(getDataPrefix($admin, "u_"));
$sexes = array(0 => __("Male"), 1 => __("Female"), 2 => __("N/A"));
$powerlevels = array(0 => __("Normal user"), 1 => __("Local moderator"), 2 => __("Full moderator"), 3 => __("Administrator"), 4 => __("Root"));
$headers = "";
$colors = "";
foreach ($sexes as $ss) {
    $headers .= format("\n\t<th>\n\t\t{0}\n\t</th>\n", $ss);
}
foreach ($powerlevels as $pn => $ps) {
    $cellClass = ($cellClass + 1) % 2;
    $items = "";
    foreach ($sexes as $sn => $ss) {
        $items .= format("\n\t<td class=\"center\">\n\t\t<a href=\"javascript:void()\"><span class=\"nc{0}{1}\" style=\"font-weight: bold;\">\n\t\t\t{2}\n\t\t</span></a>\n\t</td>\n", $sn, $pn, $ps);
    }
    $colors .= format("\n<tr class=\"cell{0}\">\n\t{1}\n</tr>\n", $cellClass, $items);
}
Exemplo n.º 9
0
function WriteForumEditContents($fid)
{
    global $loguser;
    //Get all categories.
    $rCats = Query("SELECT * FROM {categories} ORDER BY corder, id");
    $cats = array();
    while ($cat = Fetch($rCats)) {
        $cats[$cat['id']] = $cat;
    }
    $rFora = Query("SELECT * FROM {forums} ORDER BY forder, id");
    $fora = array();
    while ($forum = Fetch($rFora)) {
        $fora[$forum['id']] = $forum;
    }
    if (count($cats) == 0) {
        $cats[0] = __("No categories");
    }
    if ($fid != -1) {
        $rForum = Query("SELECT * FROM {forums} WHERE id={0}", $fid);
        if (!NumRows($rForum)) {
            Kill(__("Forum not found."));
        }
        $forum = Fetch($rForum);
        $title = htmlspecialchars($forum['title']);
        $description = htmlspecialchars($forum['description']);
        $catselect = MakeCatSelect('cat', $cats, $fora, $forum['catid'], $forum['id']);
        $minpower = PowerSelect('minpower', $forum['minpower']);
        $minpowerthread = PowerSelect("minpowerthread", $forum['minpowerthread']);
        $minpowerreply = PowerSelect('minpowerreply', $forum['minpowerreply']);
        $forder = $forum['forder'];
        $func = "changeForumInfo";
        $button = __("Save");
        $boxtitle = __("Edit Forum");
        $delbutton = "\n\t\t\t<button onclick='showDeleteForum(); return false;'>\n\t\t\t\t" . __("Delete") . "\n\t\t\t</button>";
        $localmods = "";
        $rMods = query("SELECT u.(_userfields)\n\t\t\t\t\t\tFROM {forummods} m\n\t\t\t\t\t\tLEFT JOIN {users} u ON u.id = m.user\n\t\t\t\t\t\tWHERE m.forum={0}\n\t\t\t\t\t\tORDER BY m.user", $fid);
        $addedMods = array();
        if (!numRows($rMods)) {
            $localmods .= "(No local moderators assigned to this forum)<br /><br />";
        } else {
            $localmods .= "<ul>";
            while ($mod = fetch($rMods)) {
                $mod = getDataPrefix($mod, "u_");
                $localmods .= "<li>" . UserLink($mod);
                $mid = $mod["id"];
                $addedMods[$mid] = 1;
                $localmods .= " <sup><a href=\"\" onclick=\"deleteMod({$mid}); return false;\">&#x2718;</a></li>";
            }
            $localmods .= "</ul>";
        }
        $rMods = query("SELECT u.(_userfields)\n\t\t\t\t\t\tFROM {users} u\n\t\t\t\t\t\tWHERE u.powerlevel = 1\n\t\t\t\t\t\tORDER BY u.id");
        $canAddMods = false;
        $addmod = "Add a mod: ";
        $addmod .= "<select name=\"addmod\" id=\"addmod\">";
        while ($mod = fetch($rMods)) {
            $mod = getDataPrefix($mod, "u_");
            if (isset($addedMods[$mod["id"]])) {
                continue;
            }
            $canAddMods = true;
            $mid = $mod["id"];
            $mname = $mod["displayname"];
            if (!$mname) {
                $mname = $mod["name"];
            }
            $addmod .= "<option value=\"{$mid}\">{$mname} ({$mid})</option>";
        }
        $addmod .= "</select>";
        $addmod .= "<button type=\"button\" onclick=\"addMod(); return false;\">Add</button>";
        if (!$canAddMods) {
            $addmod = "<br>No moderators available for adding.<br>To add a mod, set his powerlevel to Local Mod first.";
        }
        $localmods .= $addmod;
    } else {
        $title = __("New Forum");
        $description = __("Description goes here. <strong>HTML allowed.</strong>");
        $catselect = MakeCatSelect('cat', $cats, $fora, 1, -1);
        $minpower = PowerSelect('minpower', 0);
        $minpowerthread = PowerSelect("minpowerthread", 0);
        $minpowerreply = PowerSelect('minpowerreply', 0);
        $forder = 0;
        $func = "addForum";
        $button = __("Add");
        $boxtitle = __("New Forum");
        $delbutton = "";
        $localmods = "(Create the forum before managing mods)";
        $privusers = '<small>(create the forum before adding users here)</small>';
    }
    echo "\n\t<form method=\"post\" id=\"forumform\" action=\"" . actionLink("editfora") . "\">\n\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser['token'] . "\">\n\t<input type=\"hidden\" name=\"id\" value=\"{$fid}\">\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t{$boxtitle}\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr class=\"cell1\">\n\t\t\t<td style=\"width: 25%;\">\n\t\t\t\t" . __("Title") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" style=\"width: 98%;\" name=\"title\" value=\"{$title}\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell0\">\n\n\t\t\t<td>\n\t\t\t\t" . __("Description") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" style=\"width: 98%;\" name=\"description\" value=\"{$description}\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell1\">\n\t\t\t<td>\n\t\t\t\t" . __("Parent") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$catselect}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell0\">\n\t\t\t<td>\n\t\t\t\t" . __("Listing order") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" size=\"2\" name=\"forder\" value=\"{$forder}\" />\n\t\t\t\t<img src=\"" . resourceLink("img/icons/icon5.png") . "\" title=\"" . __("Everything is sorted by listing order first, then by ID. If everything has its listing order set to 0, they will therefore be sorted by ID only.") . "\" alt=\"[?]\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell1\">\n\t\t\t<td>\n\t\t\t\t" . __("Powerlevel required") . "\n\t\t\t</td>\n\t\t\t<td>\n\n\t\t\t\t{$minpower}\n\t\t\t\t" . __("to view") . "\n\t\t\t\t<br />\n\t\t\t\t{$minpowerthread}\n\t\t\t\t" . __("to post threads") . "\n\t\t\t\t<br />\n\t\t\t\t{$minpowerreply}\n\t\t\t\t" . __("to reply") . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell0\">\n\t\t\t<td>\n\t\t\t\t" . __("Local moderators") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$localmods}\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr class=\"cell2\">\n\t\t\t<td>\n\t\t\t\t&nbsp;\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<button onclick=\"{$func}(); return false;\">\n\t\t\t\t\t{$button}\n\t\t\t\t</button>\n\t\t\t\t{$delbutton}\n\t\t\t</td>\n\t\t</tr>\n\t</table></form>\n\n\t<form method=\"post\" id=\"deleteform\" action=\"" . actionLink("editfora") . "\">\n\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser['token'] . "\">\n\t<input type=\"hidden\" name=\"id\" value=\"{$fid}\">\n\t<div id=\"deleteforum\" style=\"display:none\">\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header1\">\n\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Delete forum") . "\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell0\">\n\t\t\t\t<td>\n\t\t\t\t\t" . __("Instead of deleting a forum, you might want to consider archiving it: Change its name or description to say so, and raise the minimum powerlevel to reply and create threads so it's effectively closed.") . "<br><br>\n\t\t\t\t\t" . __("If you still want to delete it, click below:") . "<br>\n\t\t\t\t\t<button onclick=\"deleteForum('delete'); return false;\">\n\t\t\t\t\t\t" . __("Delete forum") . "\n\t\t\t\t\t</button>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n\t</form>";
    //	, $title, $description, $catselect, $minpower, $minpowerthread, $minpowerreply, $fid, $forder, $loguser['token'], $func, $button, $boxtitle, $delbutton);
}
Exemplo n.º 10
0
if (NumRows($rPost)) {
    $post = Fetch($rPost);
} else {
    die(format(__("Unknown post ID #{0}."), $id) . " " . $hideTricks);
}
$qThread = "select forum from {threads} where id={0}";
$rThread = Query($qThread, $post['thread']);
$thread = Fetch($rThread);
$qForum = "select minpower from {forums} where id={0}";
$rForum = Query($qForum, $thread['forum']);
$forum = Fetch($rForum);
if ($forum['minpower'] > $loguser['powerlevel']) {
    die(__("No.") . " " . $hideTricks);
}
$qRevs = "SELECT\n\t\t\trevision, date AS revdate,\n\t\t\tru.(_userfields)\n\t\tFROM\n\t\t\t{posts_text}\n\t\t\tLEFT JOIN {users} ru ON ru.id = user\n\t\tWHERE pid={0}\n\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;
echo $reply;
Exemplo n.º 11
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));
}
Exemplo n.º 12
0
<?php 
$c = 1;
$ulcache = array();
foreach ($passmatches as $uid => $match) {
    if (!$ulcache[$uid]) {
        $userdata = Fetch(Query("SELECT u.(_userfields) FROM {users} u WHERE u.id={0}", $uid));
        $userdata = getDataPrefix($userdata, 'u_');
        $ulcache[$uid] = $userdata;
    }
    $ul1 = userLink($ulcache[$uid]);
    $date = formatdate($match['m_date']);
    $users = explode(',', $match['m_matches']);
    $userlist = '';
    foreach ($users as $u) {
        if (!$ulcache[$u]) {
            $userdata = Fetch(Query("SELECT u.(_userfields) FROM {users} u WHERE u.id={0}", $u));
            $userdata = getDataPrefix($userdata, 'u_');
            $ulcache[$u] = $userdata;
        }
        $userlist .= userLink($ulcache[$u]) . ', ';
    }
    $userlist = substr($userlist, 0, -2);
    echo '
		<tr class="cell' . $c . '">
			<td class="center">' . $date . '</td>
			<td>' . $ul1 . ', ' . $userlist . '</td>
		</tr>';
    $c = $c == 1 ? 2 : 1;
}
?>
	</table>
Exemplo n.º 13
0
$realLen = $cpp;
if ($realFrom < 0) {
    $realLen += $realFrom;
    $realFrom = 0;
}
$rComments = Query("SELECT\n\t\tu.(_userfields),\n\t\t{usercomments}.id, {usercomments}.cid, {usercomments}.text\n\t\tFROM {usercomments}\n\t\tLEFT JOIN {users} u ON u.id = {usercomments}.cid\n\t\tWHERE uid={0}\n\t\tORDER BY {usercomments}.date ASC LIMIT {1u},{2u}", $id, $realFrom, $realLen);
$pagelinks = PageLinksInverted(actionLink($mobileLayout ? "usercomments" : "profile", $id, "from="), $cpp, $from, $total);
$commentList = "";
$commentField = "";
if (NumRows($rComments)) {
    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) {
Exemplo n.º 14
0
    $from = (int) $_GET['from'];
} else {
    $from = 0;
}
$tpp = 5;
print "<h2 style='text-align:center;'>Latest News</h2>";
$rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.id, t.title, t.closed, t.replies, t.lastpostid,\n\t\t\t\t\t\tp.date, p.options,\n\t\t\t\t\t\tpt.text,\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\tLEFT JOIN {posts} p ON p.id=t.firstpostid\n\t\t\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\tWHERE forum={0}\n\t\t\t\t\tORDER BY sticky DESC, date DESC LIMIT {1u}, {2u}", $fid, $from, $tpp);
$numonpage = NumRows($rThreads);
$pagelinks = PageLinks(actionLink("blog", "", "from="), $tpp, $from, $total);
if ($pagelinks && $_GET["from"]) {
    Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
$haveStickies = 0;
while ($thread = Fetch($rThreads)) {
    $starter = getDataPrefix($thread, "su_");
    $last = getDataPrefix($thread, "lu_");
    $tags = ParseThreadTags($thread['title']);
    if ($thread['sticky'] && $haveStickies == 0) {
        $haveStickies = 1;
    }
    $lastLink = "";
    if ($thread['lastpostid']) {
        $lastLink = " " . actionLinkTag("&raquo;", "post", $thread['lastpostid']);
    }
    if ($thread['replies'] == 0) {
        $lastLink = "";
    }
    $subtitle = strip_tags($thread['subtitle']);
    if ($subtitle != "") {
        $subtitle = '<br>' . $subtitle;
    }
Exemplo n.º 15
0
$now = getdate(time());
$year = $now['year'];
$month = $now['mon'];
$day = $now['mday'];
if ((int) $_GET['month']) {
    $month = (int) $_GET['month'];
    $day = 0;
}
$d = getdate(mktime(0, 0, 0, $month, 1, $year));
$i = 1 - $d['wday'];
$d = getdate(mktime(0, 0, 0, $month + 1, 0, $year));
$max = $d['mday'];
$users = Query("select u.(_userfields), u.birthday as u_birthday from {users} u where birthday != 0 order by name");
$cells = array();
while ($user = Fetch($users)) {
    $user = getDataPrefix($user, "u_");
    $d = getdate($user['birthday']);
    if ($d['mon'] == $month) {
        $dd = $d['mday'];
        $age = $year - $d['year'];
        $cells[$dd] .= "<br />&bull; " . format(__("{0}'s birthday ({1})"), Userlink($user), $age) . "\n";
    }
}
if ($year == 2012 && $month == 12) {
    $cells[21] .= '<br>&bull; <span style="color:red;font-weight:bold;text-decoration:blink;">THE END OF THE WORLD</span>';
    $cells[22] .= '<br>&bull; Laugh at those who actually believed it';
}
$cellClass = 0;
while ($i <= $max) {
    $grid .= format("\n\t<tr>\n");
    for ($dn = 0; $dn <= 6; $dn++) {
Exemplo n.º 16
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));
        }
    }
}
Exemplo n.º 17
0
$links[] = $showWhat == 2 ? __("Show drafts") : actionLinkTag(__("Show drafts"), "private", "", "show=2" . $userGet);
$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']);
Exemplo n.º 18
0
$realLen = $cpp;
if ($realFrom < 0) {
    $realLen += $realFrom;
    $realFrom = 0;
}
$rComments = Query("SELECT\n\t\tu.(_userfields),\n\t\tuc.id, uc.cid, uc.text, uc.date\n\t\tFROM {usercomments} uc\n\t\tLEFT JOIN {users} u ON u.id = uc.cid\n\t\tWHERE uc.uid={0}\n\t\tORDER BY uc.date ASC LIMIT {1u},{2u}", $id, $realFrom, $realLen);
$pagelinks = PageLinksInverted(actionLink("profile", $id, "from=", $user['name']), $cpp, $from, $total);
$comments = array();
while ($comment = Fetch($rComments)) {
    $cmt = array();
    $deleteLink = '';
    if ($canDeleteComments || $comment['cid'] == $loguserid && HasPermission('user.deleteownusercomments')) {
        $deleteLink = "<small style=\"float: right; margin: 0px 4px;\">" . actionLinkTag("&#x2718;", "profile", $id, "action=delete&cid=" . $comment['id'] . "&token={$loguser['token']}") . "</small>";
    }
    $cmt['deleteLink'] = $deleteLink;
    $cmt['userlink'] = UserLink(getDataPrefix($comment, 'u_'));
    $cmt['formattedDate'] = relativedate($comment['date']);
    $cmt['text'] = CleanUpPost($comment['text']);
    $comments[] = $cmt;
}
$commentField = '';
if ($canComment) {
    $commentField = "\n\t\t<form name=\"commentform\" method=\"post\" action=\"" . htmlentities(actionLink("profile")) . "\">\n\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$id}\">\n\t\t\t<input type=\"text\" name=\"text\" style=\"width: 80%;\" maxlength=\"255\">\n\t\t\t<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\">\n\t\t\t<input type=\"hidden\" name=\"token\" value=\"{$loguser['token']}\">\n\t\t</form>";
}
RenderTemplate('profile', array('username' => htmlspecialchars($uname), 'userlink' => UserLink($user), 'profileParts' => $profileParts, 'comments' => $comments, 'commentField' => $commentField, 'pagelinks' => $pagelinks));
if (!$mobileLayout) {
    $previewPost['text'] = Settings::get("profilePreviewText");
    $previewPost['num'] = 0;
    $previewPost['id'] = 0;
    foreach ($user as $key => $value) {
        $previewPost['u_' . $key] = $value;
Exemplo n.º 19
0
                 $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 {
                 die(format(__("Unknown post ID #{0} or revision missing."), $id));
             }
             if (!HasPermission('mod.editposts', $post['fid'])) {
                 die('No.');
             }
             die(makePostText($post, getDataPrefix($post, 'u_')));
         } elseif ($action == "em") {
             $privacy = HasPermission('admin.editusers') ? '' : ' and showemail=1';
             $blah = FetchResult("select email from {users} where id={0}{$privacy}", $id);
             die(htmlspecialchars($blah));
         } elseif ($action == "vc") {
             $blah = FetchResult("select views from {misc}");
             die(number_format($blah));
         } else {
             if ($action == 'no') {
                 $notif = getNotifications();
                 die(json_encode($notif));
             }
         }
     }
 }
Exemplo n.º 20
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');
     }
 }
Exemplo n.º 21
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);
    }
}
Exemplo n.º 22
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.º 23
0
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 "";
    }
}
Exemplo n.º 24
0
    }
}
if (isset($_GET['unban'])) {
    $title = __('Unban user');
    MakeCrumbs(array(actionLink("profile", $id, '', $user['u_name']) => htmlspecialchars($user['u_displayname'] ? $user['u_displayname'] : $user['u_name']), actionLink('banhammer', $id, 'unban=1') => __('Unban user')));
    $userlink = userLink(getDataPrefix($user, 'u_'));
    $fields = array('target' => $userlink, 'btnUnbanUser' => '<input type="submit" name="unban" value="Unban user">');
    $template = 'form_unbanuser';
} else {
    $title = __('Ban user');
    MakeCrumbs(array(actionLink("profile", $id, '', $user['u_name']) => htmlspecialchars($user['u_displayname'] ? $user['u_displayname'] : $user['u_name']), actionLink('banhammer', $id) => __('Ban user')));
    $duration = '
	<label><input type="radio" name="permanent" value="0"> For: </label>
		<input type="text" name="time" size="4" maxlength="2">
		<select name="timemult">
			<option value="3600">hours</option>
			<option value="86400">days</option>
			<option value="604800">weeks</option>
		</select>
		<br>
	<label><input type="radio" name="permanent" value="1" checked="checked"> Permanent</label>';
    $userlink = userLink(getDataPrefix($user, 'u_'));
    $fields = array('target' => $userlink, 'duration' => $duration, 'reason' => '<input type="text" name="reason" size=80 maxlength=200>', 'btnBanUser' => '<input type="submit" name="ban" value="Ban user">');
    $template = 'form_banuser';
}
echo '
	<form action="" method="POST">';
RenderTemplate($template, array('fields' => $fields));
echo '
		<input type="hidden" name="token" value="' . $loguser['token'] . '">
	</form>';
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>";
    }
}
Exemplo n.º 26
0
}
$tpp = 5;
//echo '<br>';
$links = array('<a href="' . BOARD_ROOT . 'rss.php">' . __('RSS feed') . '</a>');
if (HasPermission('forum.postthreads', $forum['id'])) {
    $links[] = actionLinkTag(__('Post new'), 'newthread', $forum['id']);
}
MakeCrumbs(array(), $links);
$rThreads = Query("\tSELECT \n\t\t\t\t\t\tt.id, t.title, t.closed, t.replies, t.lastpostid,\n\t\t\t\t\t\tp.id pid, p.date,\n\t\t\t\t\t\tpt.text,\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM \n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\tLEFT JOIN {posts} p ON p.thread=t.id AND p.id=t.firstpostid\n\t\t\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid=p.id AND pt.revision=p.currentrevision\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\tWHERE t.forum={0} AND p.deleted=0\n\t\t\t\t\tORDER BY p.date DESC LIMIT {1u}, {2u}", $fid, $from, $tpp);
$numonpage = NumRows($rThreads);
$pagelinks = PageLinks(actionLink('home', '', 'from='), $tpp, $from, $total);
RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'top'));
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;
Exemplo n.º 27
0
				If you are in the green part, you are fine, but try to be a little careful.<br>
				If you are in the orange part, you should really improve the quality of your posts.<br>
				If you are in the red part, you are walking on thin ice, and should think twice before posting again.<br>
				<br>
			</td>
		</tr>
		<tr class="header1">
			<th>User</th>
			<th>Posts</th>
			<th>Deleted</th>
			<th>Ratio</th>
			<th style="width:120px;">&nbsp;</th>
		</tr>';
$c = 1;
while ($user = Fetch($stuff)) {
    $udata = getDataPrefix($user, 'u_');
    $ulink = userLink($udata);
    $total = $user['totalposts'];
    $del = $user['deletedposts'];
    $ratio = $del * 100 / $total;
    //if ($ratio <= 1) break;
    if ($ratio > 25) {
        $color = '#f00';
    } else {
        if ($ratio > 10) {
            $color = '#f80';
        } else {
            $color = '#0f0';
        }
    }
    $lol1 = '<span style="color:' . $color . ';">';
Exemplo n.º 28
0
if ($page['flags'] & WIKI_PFLAG_DELETED) {
    echo '<h1>' . $nicetitle . '</h1>This page has been deleted.';
} else {
    if ($page['new']) {
        echo '<h1>' . $nicetitle . '</h1>This page does not exist.';
        if ($page['canedit']) {
            echo '<br><br>' . actionLinkTag('Create it now', 'wikiedit', $urltitle);
        }
    } else {
        $revInfo = '';
        $revList = '';
        if ($rev > 0) {
            $revs = Query("SELECT pt.revision r FROM {wiki_pages_text} pt WHERE pt.id={0} ORDER BY r ASC", $urltitle);
            while ($therev = Fetch($revs)) {
                if ($therev['r'] == $rev) {
                    $revList .= '&nbsp;' . $therev['r'] . '&nbsp;';
                } else {
                    $revList .= '&nbsp;' . actionLinkTag($therev['r'], 'wiki', $urltitle, 'rev=' . $therev['r']) . '&nbsp;';
                }
            }
            $user = Fetch(Query("SELECT u.(_userfields) FROM {users} u WHERE u.id={0}", $page['user']));
            $user = getDataPrefix($user, 'u_');
            $revInfo = 'Viewing revision ' . $rev . ' (by ' . userLink($user) . ' on ' . formatdate($page['date']) . ')<br>(revisions: ' . $revList . ')<br><br>';
        }
        echo '<h1>' . $nicetitle . '</h1>' . $revInfo . wikiFilter($page['text'], $page['flags'] & WIKI_PFLAG_NOCONTBOX);
    }
}
echo '
				</td>
			</tr>
		</table>';
Exemplo n.º 29
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);
Exemplo n.º 30
0
function userLinkById($id)
{
    global $userlinkCache;
    if (!isset($userlinkCache[$id])) {
        $rUser = Query("SELECT u.(_userfields) FROM {users} u WHERE u.id={0}", $id);
        if (NumRows($rUser)) {
            $userlinkCache[$id] = getDataPrefix(Fetch($rUser), "u_");
        } else {
            $userlinkCache[$id] = array('id' => 0, 'name' => "Unknown User", 'sex' => 0, 'powerlevel' => -1);
        }
    }
    return UserLink($userlinkCache[$id]);
}