Exemple #1
0
    }
}
$cpp = 15;
$total = FetchResult("SELECT\n\t\t\t\t\t\tcount(*)\n\t\t\t\t\tFROM {usercomments}\n\t\t\t\t\tWHERE uid={0}", $id);
$from = (int) $_GET["from"];
if (!isset($_GET["from"])) {
    $from = 0;
}
$realFrom = $total - $from - $cpp;
$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>";
Exemple #2
0
$bucket = "profileTable";
include BOARD_ROOT . "lib/pluginloader.php";
$cpp = 15;
$total = FetchResult("SELECT\n\t\t\t\t\t\tcount(*)\n\t\t\t\t\tFROM {usercomments}\n\t\t\t\t\tWHERE uid={0}", $id);
$from = (int) $_GET["from"];
if (!isset($_GET["from"])) {
    $from = 0;
}
$realFrom = $total - $from - $cpp;
$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) {