Exemplo n.º 1
0
$spacesettings = getspacesettings($member['uid']);
$menulist = array();
$modulelist = explode('][', ']' . str_replace("\t", '', $spacesettings['layout']) . '[');
foreach ($modulelist as $module) {
    if (array_key_exists($module, $listmodule)) {
        $menulist[$listmodule[$module]] = $module;
    }
}
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];
    }
Exemplo n.º 2
0
function updatespacecache($uid, $module, $list = FALSE)
{
    global $_DCOOKIE, $db, $mod, $tablepre, $timestamp, $tpp, $page, $multipage, $starttime, $endtime, $spacedata, $lastvisit, $videoopen, $tradetypeid;
    if (!file_exists(DISCUZ_ROOT . './forumdata/cache/cache_spacesettings.php')) {
        require_once DISCUZ_ROOT . './include/cache.func.php';
        updatespacesettings();
    }
    require DISCUZ_ROOT . './forumdata/cache/cache_spacesettings.php';
    if ($list) {
        $tpp = $mod != 'mytrades' ? $tpp : 15;
        $page = max(1, intval($page));
        $start_limit = ($page - 1) * $tpp;
        $parms['items'] = "{$start_limit}, {$tpp}";
    } else {
        $parms['items'] = intval($spacedata['limit' . $module]);
    }
    $parms['list'] = $list;
    $parms['conditions'] = $parms['extraquery'] = '';
    $parms['cols'] = '*';
    $user_func = 'module_' . $module;
    $user_func($parms);
    $tids = $datalist = array();
    $query = $db->query("SELECT {$parms['cols']} FROM {$tablepre}{$parms['table']} {$parms['conditions']} LIMIT {$parms['items']}");
    while ($data = $db->fetch_array($query)) {
        if (!empty($data['message'])) {
            $data['message'] = spacecutstr($data['message'], $spacedata['textlength']);
            $videoopen && ($data['message'] = videocode($data['message'], $data['tid'], $data['pid']));
        }
        if ($data['tid'] && $lastvisit < $data['lastpost'] && (empty($_DCOOKIE['oldtopics']) || strpos($_DCOOKIE['oldtopics'], 'D' . $data['tid'] . 'D') === FALSE)) {
            $data['subject'] .= ' <a href="redirect.php?tid=' . $data['tid'] . '&amp;goto=newpost#newpost" target="_blank"><img src="' . IMGDIR . '/firstnew.gif" border="0" alt="" /></a>';
        }
        if ($parms['extraquery']) {
            $tids[] = $data['tid'];
            $datalist[$data['tid']] = $data;
        } else {
            $datalist[] = $data;
        }
    }
    if ($tids) {
        $query = $db->query($parms['extraquery'] . '(' . implodeids($tids) . ')');
        while ($data = $db->fetch_array($query)) {
            $datalist[$data['tid']] = array_merge($datalist[$data['tid']], $data);
        }
    }
    if (!$list) {
        $db->query("REPLACE INTO {$tablepre}spacecaches (uid, variable, value, expiration) VALUES ('{$uid}', '{$module}', '" . addslashes(serialize($datalist)) . "', '" . ($timestamp + $spacedata['cachelife']) . "')");
    } else {
        $num = $db->result_first("SELECT count(*) FROM {$tablepre}{$parms['table']} {$parms['conditions']}");
        $module = empty($parms['pagemodule']) ? $module : $parms['pagemodule'];
        $multipage = spacemulti($num, $tpp, $page, "space.php?uid={$uid}&amp;mod={$module}" . ($starttime ? "&amp;starttime={$starttime}" : '') . ($endtime ? "&amp;endtime={$endtime}" : '') . (isset($tradetypeid) ? "&amp;tradetypeid={$tradetypeid}" : ''));
    }
    return $datalist;
}