Ejemplo n.º 1
0
    }
}
ksort($menulist);
$showsettings = str_pad(decbin($showsettings), 3, '0', STR_PAD_LEFT);
$customshow = $discuz_uid ? str_pad(base_convert($customshow, 10, 3), 3, '0', STR_PAD_LEFT) : '222';
$showimages = $customshow[2] == 2 ? $showsettings[2] : $customshow[2];
$attachtags = array();
$attachpids = $viewattachlist = 0;
$username = $blogtopic['author'];
$multipage = $multipage = spacemulti($blogtopic['replies'], $ppp, $page, "blog.php?tid={$tid}");
$usesigcheck = $discuz_uid && $sigstatus ? 'checked="checked"' : '';
$allowpostreply = (!$blogtopic['closed'] || $forum['ismoderator']) && (!$forum['replyperm'] && $allowreply || $forum['replyperm'] && forumperm($forum['replyperm']) || $forum['allowreply']);
$forum['allowbbcode'] = $forum['allowbbcode'] ? $_DCACHE['usergroups'][$blogtopic['groupid']]['allowcusbbcode'] ? 2 : 1 : 0;
$blogtopic['message'] = discuzcode($blogtopic['message'], $blogtopic['smileyoff'], $blogtopic['bbcodeoff'], sprintf('%00b', $blogtopic['htmlon']), $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'], $forum['allowhtml'], $forum['jammer'] && $blogtopic['authorid'] != $discuz_uid ? 1 : 0, 0, 0, $forum['allowmediacode'], $blogtopic['pid']);
$videoopen && ($blogtopic['message'] = videocode($blogtopic['message'], $tid, $blogtopic['pid']));
$blogtopic['karma'] = karmaimg($blogtopic['rate'], $blogtopic['ratetimes']);
$blogtopic['dateline'] = gmdate("{$dateformat} {$timeformat}", $blogtopic['dateline'] + $timeoffset * 3600);
$titleextra = ' - ' . $blogtopic['subject'];
$blogtopic['attachments'] = array();
if ($blogtopic['attachment'] && (!empty($forum['allowgetattach']) || $allowgetattach && !$forum['getattachperm'] || forumperm($forum['getattachperm']))) {
    require_once DISCUZ_ROOT . './include/attachment.func.php';
    $blogtopic['attachment'] = 0;
    if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $blogtopic['message'], $matchaids)) {
        $attachtags[$blogtopic['pid']] = $matchaids[1];
    }
    $tmp[$blogtopic['pid']] = $blogtopic;
    parseattach($blogtopic['pid'], $attachtags, $tmp);
    $blogtopic = $tmp[$blogtopic['pid']];
}
if ($tagstatus) {
    $query = $db->query("SELECT tagname FROM {$tablepre}threadtags WHERE tid='{$tid}'");
Ejemplo n.º 2
0
function viewthread_procpost($post, $special = 0)
{
    global $_DCACHE, $newpostanchor, $numpost, $thisbg, $postcount, $ratelogpids, $onlineauthors, $lastvisit, $thread, $attachpids, $attachtags, $forum, $dateformat, $timeformat, $timeoffset, $userstatusby, $allowgetattach, $allowpaytoauthor, $ratelogrecord, $showimages, $forum, $discuz_uid, $showavatars, $pagebydesc, $ppp2, $firstpid, $videoopen;
    if (!$newpostanchor && $post['dateline'] > $lastvisit) {
        $post['newpostanchor'] = '<a name="newpost"></a>';
        $newpostanchor = 1;
    } else {
        $post['newpostanchor'] = '';
    }
    $post['lastpostanchor'] = $numpost == $thread['replies'] ? '<a name="lastpost"></a>' : '';
    $post['count'] = $postcount++;
    if ($pagebydesc) {
        $post['number'] = $numpost + $ppp2--;
    } else {
        $post['number'] = ++$numpost;
    }
    $post['dbdateline'] = $post['dateline'];
    $post['dateline'] = gmdate("{$dateformat} {$timeformat}", $post['dateline'] + $timeoffset * 3600);
    $post['groupid'] = $_DCACHE['usergroups'][$post['groupid']] ? $post['groupid'] : 7;
    if ($post['username']) {
        $onlineauthors[] = $post['authorid'];
        $post['usernameenc'] = rawurlencode($post['username']);
        !$special && ($post['groupid'] = getgroupid($post['authorid'], $_DCACHE['usergroups'][$post['groupid']], $post));
        $post['readaccess'] = $_DCACHE['usergroups'][$post['groupid']]['readaccess'];
        if ($userstatusby == 1 || $_DCACHE['usergroups'][$post['groupid']]['byrank'] == 0) {
            $post['authortitle'] = $_DCACHE['usergroups'][$post['groupid']]['grouptitle'];
            $post['stars'] = $_DCACHE['usergroups'][$post['groupid']]['stars'];
        } elseif ($userstatusby == 2) {
            foreach ($_DCACHE['ranks'] as $rank) {
                if ($post['posts'] > $rank['postshigher']) {
                    $post['authortitle'] = $rank['ranktitle'];
                    $post['stars'] = $rank['stars'];
                    break;
                }
            }
        }
        $post['alipay'] = $allowpaytoauthor ? $post['alipay'] : '';
        $post['taobaoas'] = addslashes($post['taobao']);
        $post['authoras'] = !$post['anonymous'] ? ' ' . addslashes($post['author']) : '';
        $post['regdate'] = gmdate($dateformat, $post['regdate'] + $timeoffset * 3600);
        $post['lastdate'] = gmdate($dateformat, $post['lastactivity'] + $timeoffset * 3600);
        $post['allowuseblog'] = $_DCACHE['usergroups'][$post['groupid']]['allowuseblog'];
        if ($post['medals']) {
            @(include_once DISCUZ_ROOT . './forumdata/cache/cache_medals.php');
            foreach ($post['medals'] = explode("\t", $post['medals']) as $key => $medalid) {
                if (isset($_DCACHE['medals'][$medalid])) {
                    $post['medals'][$key] = $_DCACHE['medals'][$medalid];
                } else {
                    unset($post['medals'][$key]);
                }
            }
        }
        if ($showavatars) {
            if ($_DCACHE['usergroups'][$post['groupid']]['allowavatar'] && $post['avatar']) {
                $post['avatar'] = '<div class="avatar"><img src="' . $post['avatar'] . '" width="' . $post['avatarwidth'] . '" height="' . $post['avatarheight'] . '" border="0" alt="" />';
            } else {
                $post['avatar'] = '<div class="avatar"><img class="avatar" src="images/avatars/noavatar.gif" alt="" />';
            }
            if ($_DCACHE['usergroups'][$post['groupid']]['groupavatar']) {
                $post['avatar'] .= '<br /><img src="' . $_DCACHE['usergroups'][$post['groupid']]['groupavatar'] . '" border="0" alt="" />';
            }
            $post['avatar'] .= '</div>';
        }
    } else {
        if (!$post['authorid']) {
            $post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')) . '.x';
        }
    }
    $post['attachments'] = array();
    if ($post['attachment']) {
        if ($allowgetattach) {
            $attachpids .= ",{$post['pid']}";
            $post['attachment'] = 0;
            if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $post['message'], $matchaids)) {
                $attachtags[$post['pid']] = $matchaids[1];
            }
        } else {
            $post['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/i", '', $post['message']);
        }
    }
    $ratelogpids .= $ratelogrecord && $post['ratetimes'] ? ',' . $post['pid'] : '';
    $forum['allowbbcode'] = $forum['allowbbcode'] ? $_DCACHE['usergroups'][$post['groupid']]['allowcusbbcode'] ? 2 : 1 : 0;
    $post['ratings'] = karmaimg($post['rate'], $post['ratetimes']);
    $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'] && $showimages ? 1 : 0, $forum['allowhtml'], $forum['jammer'] && $post['authorid'] != $discuz_uid ? 1 : 0, 0, $post['authorid'], $forum['allowmediacode'], $post['pid']);
    $videoopen && ($post['message'] = videocode($post['message'], $post['tid'], $post['pid']));
    $post['signature'] = $post['usesig'] ? $post['signature'] : '';
    $post['first'] && ($firstpid = $post['pid']);
    return $post;
}