function viewthread_baseinfo($post, $extra)
{
    global $_G;
    list($key, $type) = $extra;
    $v = '';
    if (substr($key, 0, 10) == 'extcredits') {
        $i = substr($key, 10);
        $extcredit = $_G['setting']['extcredits'][$i];
        if ($extcredit) {
            $v = $type ? ($extcredit['img'] ? $extcredit['img'] . ' ' : '') . $extcredit['title'] : $post['extcredits' . $i] . ' ' . $extcredit['unit'];
        }
    } elseif (substr($key, 0, 6) == 'field_') {
        $field = substr($key, 6);
        if (!empty($post['privacy']['profile'][$field])) {
            return '';
        }
        require_once libfile('function/profile');
        if ($field != 'qq') {
            $v = profile_show($field, $post);
        } elseif (!empty($post['qq'])) {
            $v = '<a href="http://wpa.qq.com/msgrd?V=3&Uin=' . $post['qq'] . '&Site=' . $_G['setting']['bbname'] . '&Menu=yes&from=discuz" target="_blank" title="' . lang('spacecp', 'qq_dialog') . '"><img src="' . STATICURL . '/image/common/qq_big.gif" alt="QQ" style="margin:0px;"/></a>';
        }
        if ($v) {
            if (!isset($_G['cache']['profilesetting'])) {
                loadcache('profilesetting');
            }
            $v = $type ? $_G['cache']['profilesetting'][$field]['title'] : $v;
        }
    } elseif ($key == 'eccredit_seller') {
        $v = $type ? lang('space', 'viewthread_userinfo_sellercredit') : '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=trade&view=eccredit#buyercredit" target="_blank" class="vm"><img src="' . STATICURL . 'image/traderank/seller/' . countlevel($post['buyercredit']) . '.gif" /></a>';
    } elseif ($key == 'eccredit_buyer') {
        $v = $type ? lang('space', 'viewthread_userinfo_buyercredit') : '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=trade&view=eccredit#sellercredit" target="_blank" class="vm"><img src="' . STATICURL . 'image/traderank/seller/' . countlevel($post['sellercredit']) . '.gif" /></a>';
    } else {
        $v = getLinkByKey($key, $post);
        if ($v !== '') {
            $v = $type ? lang('space', 'viewthread_userinfo_' . $key) : $v;
        }
    }
    return $v;
}
function viewthread_custominfo($post)
{
    global $_G;
    $types = array('left', 'menu');
    foreach ($types as $type) {
        if (!is_array($_G['cache']['custominfo']['setting'][$type])) {
            continue;
        }
        $data = '';
        foreach ($_G['cache']['custominfo']['setting'][$type] as $key => $order) {
            $v = '';
            if (substr($key, 0, 10) == 'extcredits') {
                $i = substr($key, 10);
                $extcredit = $_G['setting']['extcredits'][$i];
                $v = '<dt>' . ($extcredit['img'] ? $extcredit['img'] . ' ' : '') . $extcredit['title'] . '</dt><dd>' . $post['extcredits' . $i] . ' ' . $extcredit['unit'] . '</dd>';
            } elseif (substr($key, 0, 6) == 'field_') {
                $field = substr($key, 6);
                if (!empty($post['privacy']['profile'][$field])) {
                    continue;
                }
                require_once libfile('function/profile');
                $v = profile_show($field, $post);
                if ($v) {
                    $v = '<dt>' . $_G['cache']['custominfo']['profile'][$key][0] . '</dt><dd title="' . dhtmlspecialchars(strip_tags($v)) . '">' . $v . '</dd>';
                }
            } elseif ($key == 'creditinfo') {
                $v = '<dt>' . lang('space', 'viewthread_userinfo_buyercredit') . '</dt><dd><a href="home.php?mod=space&uid=' . $post['uid'] . '&do=trade&view=eccredit#buyercredit" target="_blank" class="vm"><img src="' . STATICURL . 'image/traderank/seller/' . countlevel($post['buyercredit']) . '.gif" /></a></dd>';
                $v .= '<dt>' . lang('space', 'viewthread_userinfo_sellercredit') . '</dt><dd><a href="home.php?mod=space&uid=' . $post['uid'] . '&do=trade&view=eccredit#sellercredit" target="_blank" class="vm"><img src="' . STATICURL . 'image/traderank/seller/' . countlevel($post['sellercredit']) . '.gif" /></a></dd>';
            } else {
                switch ($key) {
                    case 'uid':
                        $v = $post['uid'];
                        break;
                    case 'posts':
                        $v = '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=thread&type=reply&view=me&from=space" target="_blank" class="xi2">' . $post['posts'] . '</a>';
                        break;
                    case 'threads':
                        $v = '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=thread&type=thread&view=me&from=space" target="_blank" class="xi2">' . $post['threads'] . '</a>';
                        break;
                    case 'doings':
                        $v = '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=doing&view=me&from=space" target="_blank" class="xi2">' . $post['doings'] . '</a>';
                        break;
                    case 'blogs':
                        $v = '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=blog&view=me&from=space" target="_blank" class="xi2">' . $post['blogs'] . '</a>';
                        break;
                    case 'albums':
                        $v = '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=album&view=me&from=space" target="_blank" class="xi2">' . $post['albums'] . '</a>';
                        break;
                    case 'sharings':
                        $v = '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=share&view=me&from=space" target="_blank" class="xi2">' . $post['sharings'] . '</a>';
                        break;
                    case 'friends':
                        $v = '<a href="home.php?mod=space&uid=' . $post['uid'] . '&do=friend&view=me&from=space" target="_blank" class="xi2">' . $post['friends'] . '</a>';
                        break;
                    case 'follower':
                        $v = '<a href="home.php?mod=follow&do=follower&uid=' . $post['uid'] . '" target="_blank" class="xi2">' . $post['follower'] . '</a>';
                        break;
                    case 'following':
                        $v = '<a href="home.php?mod=follow&do=following&uid=' . $post['uid'] . '" target="_blank" class="xi2">' . $post['following'] . '</a>';
                        break;
                    case 'digest':
                        $v = $post['digestposts'];
                        break;
                    case 'credits':
                        $v = $post['credits'];
                        break;
                    case 'readperm':
                        $v = $post['readaccess'];
                        break;
                    case 'regtime':
                        $v = $post['regdate'];
                        break;
                    case 'lastdate':
                        $v = $post['lastdate'];
                        break;
                    case 'oltime':
                        $v = $post['oltime'] . ' ' . lang('space', 'viewthread_userinfo_hour');
                        break;
                }
                if ($v !== '') {
                    $v = '<dt>' . lang('space', 'viewthread_userinfo_' . $key) . '</dt><dd>' . $v . '</dd>';
                }
            }
            $data .= $v;
        }
        $return[$type] = $data;
    }
    return $return;
}